@college-africa/chat-ui 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./summaries-xrTgKTOr.cjs`);let t=require(`react`),n=e.T(t,1);t=e.T(t);let r=require(`@mui/material`),i=require(`react/jsx-runtime`),a=require(`@emotion/styled`);a=e.T(a),require(`@emotion/react`);var o=(e,t)=>e instanceof Error?e:Error(t),s=()=>(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100vh`,children:(0,i.jsx)(r.CircularProgress,{})}),c=({error:e,retry:t})=>(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100vh`,p:2,children:(0,i.jsxs)(r.Alert,{severity:`error`,action:(0,i.jsx)(r.Button,{onClick:t,children:` Retry`}),children:[(0,i.jsx)(r.AlertTitle,{children:`Failed to initialize chat`}),e.message]})}),l=({config:t,children:r,LoadingComponent:a=s,ErrorComponent:l=c})=>{let[u,d]=(0,n.useState)(!1),[f,p]=(0,n.useState)(null),m=(0,n.useCallback)(async()=>{d(!1),p(null);try{if(e.s())return;await e.o(t),d(!0)}catch(e){p(o(e,`Unknown error initializing SDK`))}},[t]);return(0,n.useEffect)(()=>(m(),()=>{e.i()}),[m]),!u&&!f?(0,i.jsx)(a,{}):f?(0,i.jsx)(l,{error:f,retry:m}):(0,i.jsx)(i.Fragment,{children:r})},u=e=>e,d=(()=>{let e=u;return{configure(t){e=t},generate(t){return e(t)},reset(){e=u}}})();function f(e,...t){let n=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(e=>n.searchParams.append(`args[]`,e)),`Minified MUI error #${e}; visit ${n} for the full message.`}function p(e){if(typeof e!=`string`)throw Error(process.env.NODE_ENV===`production`?f(7):"MUI: `capitalize(string)` expects a string argument.");return e.charAt(0).toUpperCase()+e.slice(1)}var m=p,h=e.w((e=>{var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:switch(e=e.type,e){case l:case u:case i:case o:case a:case f:return e;default:switch(e&&=e.$$typeof,e){case c:case d:case h:case m:case s:return e;default:return t}}case r:return t}}}function x(e){return b(e)===u}e.AsyncMode=l,e.ConcurrentMode=u,e.ContextConsumer=c,e.ContextProvider=s,e.Element=n,e.ForwardRef=d,e.Fragment=i,e.Lazy=h,e.Memo=m,e.Portal=r,e.Profiler=o,e.StrictMode=a,e.Suspense=f,e.isAsyncMode=function(e){return x(e)||b(e)===l},e.isConcurrentMode=x,e.isContextConsumer=function(e){return b(e)===c},e.isContextProvider=function(e){return b(e)===s},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===n},e.isForwardRef=function(e){return b(e)===d},e.isFragment=function(e){return b(e)===i},e.isLazy=function(e){return b(e)===h},e.isMemo=function(e){return b(e)===m},e.isPortal=function(e){return b(e)===r},e.isProfiler=function(e){return b(e)===o},e.isStrictMode=function(e){return b(e)===a},e.isSuspense=function(e){return b(e)===f},e.isValidElementType=function(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=b})),g=e.w((e=>{process.env.NODE_ENV!==`production`&&(function(){"use strict";var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)}function x(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:var p=e.type;switch(p){case l:case u:case i:case o:case a:case f:return p;default:var g=p&&p.$$typeof;switch(g){case c:case d:case h:case m:case s:return g;default:return t}}case r:return t}}}var S=l,C=u,w=c,T=s,E=n,D=d,O=i,k=h,A=m,j=r,M=o,N=a,ee=f,P=!1;function F(e){return P||(P=!0,console.warn(`The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.`)),I(e)||x(e)===l}function I(e){return x(e)===u}function L(e){return x(e)===c}function te(e){return x(e)===s}function ne(e){return typeof e==`object`&&!!e&&e.$$typeof===n}function R(e){return x(e)===d}function re(e){return x(e)===i}function ie(e){return x(e)===h}function z(e){return x(e)===m}function ae(e){return x(e)===r}function oe(e){return x(e)===o}function se(e){return x(e)===a}function ce(e){return x(e)===f}e.AsyncMode=S,e.ConcurrentMode=C,e.ContextConsumer=w,e.ContextProvider=T,e.Element=E,e.ForwardRef=D,e.Fragment=O,e.Lazy=k,e.Memo=A,e.Portal=j,e.Profiler=M,e.StrictMode=N,e.Suspense=ee,e.isAsyncMode=F,e.isConcurrentMode=I,e.isContextConsumer=L,e.isContextProvider=te,e.isElement=ne,e.isForwardRef=R,e.isFragment=re,e.isLazy=ie,e.isMemo=z,e.isPortal=ae,e.isProfiler=oe,e.isStrictMode=se,e.isSuspense=ce,e.isValidElementType=b,e.typeOf=x})()})),_=e.w(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=h():t.exports=g()})),v=e.w(((e,t)=>{var n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(e==null)throw TypeError(`Object.assign cannot be called with null or undefined`);return Object(e)}function o(){try{if(!Object.assign)return!1;var e=new String(`abc`);if(e[5]=`de`,Object.getOwnPropertyNames(e)[0]===`5`)return!1;for(var t={},n=0;n<10;n++)t[`_`+String.fromCharCode(n)]=n;if(Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(``)!==`0123456789`)return!1;var r={};return`abcdefghijklmnopqrst`.split(``).forEach(function(e){r[e]=e}),Object.keys(Object.assign({},r)).join(``)===`abcdefghijklmnopqrst`}catch{return!1}}t.exports=o()?Object.assign:function(e,t){for(var o,s=a(e),c,l=1;l<arguments.length;l++){for(var u in o=Object(arguments[l]),o)r.call(o,u)&&(s[u]=o[u]);if(n){c=n(o);for(var d=0;d<c.length;d++)i.call(o,c[d])&&(s[c[d]]=o[c[d]])}}return s}})),y=e.w(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),b=e.w(((e,t)=>{t.exports=Function.call.bind(Object.prototype.hasOwnProperty)})),x=e.w(((e,t)=>{var n=function(){};if(process.env.NODE_ENV!==`production`){var r=y(),i={},a=b();n=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}}}function o(e,t,o,s,c){if(process.env.NODE_ENV!==`production`){for(var l in e)if(a(e,l)){var u;try{if(typeof e[l]!=`function`){var d=Error((s||`React class`)+`: `+o+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name=`Invariant Violation`,d}u=e[l](t,l,s,o,null,r)}catch(e){u=e}if(u&&!(u instanceof Error)&&n((s||`React class`)+`: type specification of `+o+" `"+l+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+`. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).`),u instanceof Error&&!(u.message in i)){i[u.message]=!0;var f=c?c():``;n(`Failed `+o+` type: `+u.message+(f??``))}}}}o.resetWarningCache=function(){process.env.NODE_ENV!==`production`&&(i={})},t.exports=o})),S=e.w(((e,t)=>{var n=_(),r=v(),i=y(),a=b(),o=x(),s=function(){};process.env.NODE_ENV!==`production`&&(s=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}});function c(){return null}t.exports=function(e,t){var l=typeof Symbol==`function`&&Symbol.iterator,u=`@@iterator`;function d(e){var t=e&&(l&&e[l]||e[u]);if(typeof t==`function`)return t}var f=`<<anonymous>>`,p={array:_(`array`),bigint:_(`bigint`),bool:_(`boolean`),func:_(`function`),number:_(`number`),object:_(`object`),string:_(`string`),symbol:_(`symbol`),any:v(),arrayOf:y,element:b(),elementType:x(),instanceOf:S,node:E(),objectOf:w,oneOf:C,oneOfType:T,shape:O,exact:k};function m(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function h(e,t){this.message=e,this.data=t&&typeof t==`object`?t:{},this.stack=``}h.prototype=Error.prototype;function g(e){if(process.env.NODE_ENV!==`production`)var n={},r=0;function a(a,o,c,l,u,d,p){if(l||=f,d||=c,p!==i){if(t){var m=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw m.name=`Invariant Violation`,m}else if(process.env.NODE_ENV!==`production`&&typeof console<`u`){var g=l+`:`+c;!n[g]&&r<3&&(s("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+l+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[g]=!0,r++)}}return o[c]==null?a?o[c]===null?new h(`The `+u+" `"+d+"` is marked as required "+("in `"+l+"`, but its value is `null`.")):new h(`The `+u+" `"+d+"` is marked as required in "+("`"+l+"`, but its value is `undefined`.")):null:e(o,c,l,u,d)}var o=a.bind(null,!1);return o.isRequired=a.bind(null,!0),o}function _(e){function t(t,n,r,i,a,o){var s=t[n];if(M(s)!==e){var c=N(s);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."),{expectedType:e})}return null}return g(t)}function v(){return g(c)}function y(e){function t(t,n,r,a,o){if(typeof e!=`function`)return new h("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){var c=M(s);return new h(`Invalid `+a+" `"+o+"` of type "+("`"+c+"` supplied to `"+r+"`, expected an array."))}for(var l=0;l<s.length;l++){var u=e(s,l,r,a,o+`[`+l+`]`,i);if(u instanceof Error)return u}return null}return g(t)}function b(){function t(t,n,r,i,a){var o=t[n];if(!e(o)){var s=M(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement."))}return null}return g(t)}function x(){function e(e,t,r,i,a){var o=e[t];if(!n.isValidElementType(o)){var s=M(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement type."))}return null}return g(e)}function S(e){function t(t,n,r,i,a){if(!(t[n]instanceof e)){var o=e.name||f,s=P(t[n]);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+o+"`."))}return null}return g(t)}function C(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&(arguments.length>1?s(`Invalid arguments supplied to oneOf, expected an array, got `+arguments.length+` arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).`):s(`Invalid argument supplied to oneOf, expected an array.`)),c;function t(t,n,r,i,a){for(var o=t[n],s=0;s<e.length;s++)if(m(o,e[s]))return null;var c=JSON.stringify(e,function(e,t){return N(t)===`symbol`?String(t):t});return new h(`Invalid `+i+" `"+a+"` of value `"+String(o)+"` "+("supplied to `"+r+"`, expected one of "+c+`.`))}return g(t)}function w(e){function t(t,n,r,o,s){if(typeof e!=`function`)return new h("Property `"+s+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var c=t[n],l=M(c);if(l!==`object`)return new h(`Invalid `+o+" `"+s+"` of type "+("`"+l+"` supplied to `"+r+"`, expected an object."));for(var u in c)if(a(c,u)){var d=e(c,u,r,o,s+`.`+u,i);if(d instanceof Error)return d}return null}return g(t)}function T(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&s(`Invalid argument supplied to oneOfType, expected an instance of array.`),c;for(var t=0;t<e.length;t++){var n=e[t];if(typeof n!=`function`)return s(`Invalid argument supplied to oneOfType. Expected an array of check functions, but received `+ee(n)+` at index `+t+`.`),c}function r(t,n,r,o,s){for(var c=[],l=0;l<e.length;l++){var u=e[l],d=u(t,n,r,o,s,i);if(d==null)return null;d.data&&a(d.data,`expectedType`)&&c.push(d.data.expectedType)}var f=c.length>0?`, expected one of type [`+c.join(`, `)+`]`:``;return new h(`Invalid `+o+" `"+s+"` supplied to "+("`"+r+"`"+f+`.`))}return g(r)}function E(){function e(e,t,n,r,i){return A(e[t])?null:new h(`Invalid `+r+" `"+i+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return g(e)}function D(e,t,n,r,i){return new h((e||`React class`)+`: `+t+" type `"+n+`.`+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}function O(e){function t(t,n,r,a,o){var s=t[n],c=M(s);if(c!==`object`)return new h(`Invalid `+a+" `"+o+"` of type `"+c+"` "+("supplied to `"+r+"`, expected `object`."));for(var l in e){var u=e[l];if(typeof u!=`function`)return D(r,a,o,l,N(u));var d=u(s,l,r,a,o+`.`+l,i);if(d)return d}return null}return g(t)}function k(e){function t(t,n,o,s,c){var l=t[n],u=M(l);if(u!==`object`)return new h(`Invalid `+s+" `"+c+"` of type `"+u+"` "+("supplied to `"+o+"`, expected `object`."));for(var d in r({},t[n],e)){var f=e[d];if(a(e,d)&&typeof f!=`function`)return D(o,s,c,d,N(f));if(!f)return new h(`Invalid `+s+" `"+c+"` key `"+d+"` supplied to `"+o+`\`.
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./summaries-B5kldVNr.cjs`);let t=require(`react`),n=e.T(t,1);t=e.T(t);let r=require(`@mui/material`),i=require(`react/jsx-runtime`),a=require(`@emotion/styled`);a=e.T(a),require(`@emotion/react`);var o=(e,t)=>e instanceof Error?e:Error(t),s=()=>(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100vh`,children:(0,i.jsx)(r.CircularProgress,{})}),c=({error:e,retry:t})=>(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100vh`,p:2,children:(0,i.jsxs)(r.Alert,{severity:`error`,action:(0,i.jsx)(r.Button,{onClick:t,children:` Retry`}),children:[(0,i.jsx)(r.AlertTitle,{children:`Failed to initialize chat`}),e.message]})}),l=({config:t,children:r,LoadingComponent:a=s,ErrorComponent:l=c})=>{let[u,d]=(0,n.useState)(!1),[f,p]=(0,n.useState)(null),m=(0,n.useCallback)(async()=>{d(!1),p(null);try{if(e.s())return;await e.o(t),d(!0)}catch(e){p(o(e,`Unknown error initializing SDK`))}},[t]);return(0,n.useEffect)(()=>(m(),()=>{e.i()}),[m]),!u&&!f?(0,i.jsx)(a,{}):f?(0,i.jsx)(l,{error:f,retry:m}):(0,i.jsx)(i.Fragment,{children:r})},u=e=>e,d=(()=>{let e=u;return{configure(t){e=t},generate(t){return e(t)},reset(){e=u}}})();function f(e,...t){let n=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(e=>n.searchParams.append(`args[]`,e)),`Minified MUI error #${e}; visit ${n} for the full message.`}function p(e){if(typeof e!=`string`)throw Error(process.env.NODE_ENV===`production`?f(7):"MUI: `capitalize(string)` expects a string argument.");return e.charAt(0).toUpperCase()+e.slice(1)}var m=p,h=e.w((e=>{var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:switch(e=e.type,e){case l:case u:case i:case o:case a:case f:return e;default:switch(e&&=e.$$typeof,e){case c:case d:case h:case m:case s:return e;default:return t}}case r:return t}}}function x(e){return b(e)===u}e.AsyncMode=l,e.ConcurrentMode=u,e.ContextConsumer=c,e.ContextProvider=s,e.Element=n,e.ForwardRef=d,e.Fragment=i,e.Lazy=h,e.Memo=m,e.Portal=r,e.Profiler=o,e.StrictMode=a,e.Suspense=f,e.isAsyncMode=function(e){return x(e)||b(e)===l},e.isConcurrentMode=x,e.isContextConsumer=function(e){return b(e)===c},e.isContextProvider=function(e){return b(e)===s},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===n},e.isForwardRef=function(e){return b(e)===d},e.isFragment=function(e){return b(e)===i},e.isLazy=function(e){return b(e)===h},e.isMemo=function(e){return b(e)===m},e.isPortal=function(e){return b(e)===r},e.isProfiler=function(e){return b(e)===o},e.isStrictMode=function(e){return b(e)===a},e.isSuspense=function(e){return b(e)===f},e.isValidElementType=function(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=b})),g=e.w((e=>{process.env.NODE_ENV!==`production`&&(function(){"use strict";var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)}function x(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:var p=e.type;switch(p){case l:case u:case i:case o:case a:case f:return p;default:var g=p&&p.$$typeof;switch(g){case c:case d:case h:case m:case s:return g;default:return t}}case r:return t}}}var S=l,C=u,w=c,T=s,E=n,D=d,O=i,k=h,A=m,j=r,M=o,N=a,ee=f,P=!1;function F(e){return P||(P=!0,console.warn(`The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.`)),I(e)||x(e)===l}function I(e){return x(e)===u}function L(e){return x(e)===c}function te(e){return x(e)===s}function ne(e){return typeof e==`object`&&!!e&&e.$$typeof===n}function R(e){return x(e)===d}function re(e){return x(e)===i}function ie(e){return x(e)===h}function z(e){return x(e)===m}function ae(e){return x(e)===r}function oe(e){return x(e)===o}function se(e){return x(e)===a}function ce(e){return x(e)===f}e.AsyncMode=S,e.ConcurrentMode=C,e.ContextConsumer=w,e.ContextProvider=T,e.Element=E,e.ForwardRef=D,e.Fragment=O,e.Lazy=k,e.Memo=A,e.Portal=j,e.Profiler=M,e.StrictMode=N,e.Suspense=ee,e.isAsyncMode=F,e.isConcurrentMode=I,e.isContextConsumer=L,e.isContextProvider=te,e.isElement=ne,e.isForwardRef=R,e.isFragment=re,e.isLazy=ie,e.isMemo=z,e.isPortal=ae,e.isProfiler=oe,e.isStrictMode=se,e.isSuspense=ce,e.isValidElementType=b,e.typeOf=x})()})),_=e.w(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=h():t.exports=g()})),v=e.w(((e,t)=>{var n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(e==null)throw TypeError(`Object.assign cannot be called with null or undefined`);return Object(e)}function o(){try{if(!Object.assign)return!1;var e=new String(`abc`);if(e[5]=`de`,Object.getOwnPropertyNames(e)[0]===`5`)return!1;for(var t={},n=0;n<10;n++)t[`_`+String.fromCharCode(n)]=n;if(Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(``)!==`0123456789`)return!1;var r={};return`abcdefghijklmnopqrst`.split(``).forEach(function(e){r[e]=e}),Object.keys(Object.assign({},r)).join(``)===`abcdefghijklmnopqrst`}catch{return!1}}t.exports=o()?Object.assign:function(e,t){for(var o,s=a(e),c,l=1;l<arguments.length;l++){for(var u in o=Object(arguments[l]),o)r.call(o,u)&&(s[u]=o[u]);if(n){c=n(o);for(var d=0;d<c.length;d++)i.call(o,c[d])&&(s[c[d]]=o[c[d]])}}return s}})),y=e.w(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),b=e.w(((e,t)=>{t.exports=Function.call.bind(Object.prototype.hasOwnProperty)})),x=e.w(((e,t)=>{var n=function(){};if(process.env.NODE_ENV!==`production`){var r=y(),i={},a=b();n=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}}}function o(e,t,o,s,c){if(process.env.NODE_ENV!==`production`){for(var l in e)if(a(e,l)){var u;try{if(typeof e[l]!=`function`){var d=Error((s||`React class`)+`: `+o+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name=`Invariant Violation`,d}u=e[l](t,l,s,o,null,r)}catch(e){u=e}if(u&&!(u instanceof Error)&&n((s||`React class`)+`: type specification of `+o+" `"+l+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+`. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).`),u instanceof Error&&!(u.message in i)){i[u.message]=!0;var f=c?c():``;n(`Failed `+o+` type: `+u.message+(f??``))}}}}o.resetWarningCache=function(){process.env.NODE_ENV!==`production`&&(i={})},t.exports=o})),S=e.w(((e,t)=>{var n=_(),r=v(),i=y(),a=b(),o=x(),s=function(){};process.env.NODE_ENV!==`production`&&(s=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}});function c(){return null}t.exports=function(e,t){var l=typeof Symbol==`function`&&Symbol.iterator,u=`@@iterator`;function d(e){var t=e&&(l&&e[l]||e[u]);if(typeof t==`function`)return t}var f=`<<anonymous>>`,p={array:_(`array`),bigint:_(`bigint`),bool:_(`boolean`),func:_(`function`),number:_(`number`),object:_(`object`),string:_(`string`),symbol:_(`symbol`),any:v(),arrayOf:y,element:b(),elementType:x(),instanceOf:S,node:E(),objectOf:w,oneOf:C,oneOfType:T,shape:O,exact:k};function m(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function h(e,t){this.message=e,this.data=t&&typeof t==`object`?t:{},this.stack=``}h.prototype=Error.prototype;function g(e){if(process.env.NODE_ENV!==`production`)var n={},r=0;function a(a,o,c,l,u,d,p){if(l||=f,d||=c,p!==i){if(t){var m=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw m.name=`Invariant Violation`,m}else if(process.env.NODE_ENV!==`production`&&typeof console<`u`){var g=l+`:`+c;!n[g]&&r<3&&(s("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+l+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[g]=!0,r++)}}return o[c]==null?a?o[c]===null?new h(`The `+u+" `"+d+"` is marked as required "+("in `"+l+"`, but its value is `null`.")):new h(`The `+u+" `"+d+"` is marked as required in "+("`"+l+"`, but its value is `undefined`.")):null:e(o,c,l,u,d)}var o=a.bind(null,!1);return o.isRequired=a.bind(null,!0),o}function _(e){function t(t,n,r,i,a,o){var s=t[n];if(M(s)!==e){var c=N(s);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."),{expectedType:e})}return null}return g(t)}function v(){return g(c)}function y(e){function t(t,n,r,a,o){if(typeof e!=`function`)return new h("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){var c=M(s);return new h(`Invalid `+a+" `"+o+"` of type "+("`"+c+"` supplied to `"+r+"`, expected an array."))}for(var l=0;l<s.length;l++){var u=e(s,l,r,a,o+`[`+l+`]`,i);if(u instanceof Error)return u}return null}return g(t)}function b(){function t(t,n,r,i,a){var o=t[n];if(!e(o)){var s=M(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement."))}return null}return g(t)}function x(){function e(e,t,r,i,a){var o=e[t];if(!n.isValidElementType(o)){var s=M(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement type."))}return null}return g(e)}function S(e){function t(t,n,r,i,a){if(!(t[n]instanceof e)){var o=e.name||f,s=P(t[n]);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+o+"`."))}return null}return g(t)}function C(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&(arguments.length>1?s(`Invalid arguments supplied to oneOf, expected an array, got `+arguments.length+` arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).`):s(`Invalid argument supplied to oneOf, expected an array.`)),c;function t(t,n,r,i,a){for(var o=t[n],s=0;s<e.length;s++)if(m(o,e[s]))return null;var c=JSON.stringify(e,function(e,t){return N(t)===`symbol`?String(t):t});return new h(`Invalid `+i+" `"+a+"` of value `"+String(o)+"` "+("supplied to `"+r+"`, expected one of "+c+`.`))}return g(t)}function w(e){function t(t,n,r,o,s){if(typeof e!=`function`)return new h("Property `"+s+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var c=t[n],l=M(c);if(l!==`object`)return new h(`Invalid `+o+" `"+s+"` of type "+("`"+l+"` supplied to `"+r+"`, expected an object."));for(var u in c)if(a(c,u)){var d=e(c,u,r,o,s+`.`+u,i);if(d instanceof Error)return d}return null}return g(t)}function T(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&s(`Invalid argument supplied to oneOfType, expected an instance of array.`),c;for(var t=0;t<e.length;t++){var n=e[t];if(typeof n!=`function`)return s(`Invalid argument supplied to oneOfType. Expected an array of check functions, but received `+ee(n)+` at index `+t+`.`),c}function r(t,n,r,o,s){for(var c=[],l=0;l<e.length;l++){var u=e[l],d=u(t,n,r,o,s,i);if(d==null)return null;d.data&&a(d.data,`expectedType`)&&c.push(d.data.expectedType)}var f=c.length>0?`, expected one of type [`+c.join(`, `)+`]`:``;return new h(`Invalid `+o+" `"+s+"` supplied to "+("`"+r+"`"+f+`.`))}return g(r)}function E(){function e(e,t,n,r,i){return A(e[t])?null:new h(`Invalid `+r+" `"+i+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return g(e)}function D(e,t,n,r,i){return new h((e||`React class`)+`: `+t+" type `"+n+`.`+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}function O(e){function t(t,n,r,a,o){var s=t[n],c=M(s);if(c!==`object`)return new h(`Invalid `+a+" `"+o+"` of type `"+c+"` "+("supplied to `"+r+"`, expected `object`."));for(var l in e){var u=e[l];if(typeof u!=`function`)return D(r,a,o,l,N(u));var d=u(s,l,r,a,o+`.`+l,i);if(d)return d}return null}return g(t)}function k(e){function t(t,n,o,s,c){var l=t[n],u=M(l);if(u!==`object`)return new h(`Invalid `+s+" `"+c+"` of type `"+u+"` "+("supplied to `"+o+"`, expected `object`."));for(var d in r({},t[n],e)){var f=e[d];if(a(e,d)&&typeof f!=`function`)return D(o,s,c,d,N(f));if(!f)return new h(`Invalid `+s+" `"+c+"` key `"+d+"` supplied to `"+o+`\`.
2
2
  Bad object: `+JSON.stringify(t[n],null,` `)+`
3
3
  Valid keys: `+JSON.stringify(Object.keys(e),null,` `));var p=f(l,d,o,s,c+`.`+d,i);if(p)return p}return null}return g(t)}function A(t){switch(typeof t){case`number`:case`string`:case`undefined`:return!0;case`boolean`:return!t;case`object`:if(Array.isArray(t))return t.every(A);if(t===null||e(t))return!0;var n=d(t);if(n){var r=n.call(t),i;if(n!==t.entries){for(;!(i=r.next()).done;)if(!A(i.value))return!1}else for(;!(i=r.next()).done;){var a=i.value;if(a&&!A(a[1]))return!1}}else return!1;return!0;default:return!1}}function j(e,t){return e===`symbol`?!0:t?t[`@@toStringTag`]===`Symbol`||typeof Symbol==`function`&&t instanceof Symbol:!1}function M(e){var t=typeof e;return Array.isArray(e)?`array`:e instanceof RegExp?`object`:j(t,e)?`symbol`:t}function N(e){if(e==null)return``+e;var t=M(e);if(t===`object`){if(e instanceof Date)return`date`;if(e instanceof RegExp)return`regexp`}return t}function ee(e){var t=N(e);switch(t){case`array`:case`object`:return`an `+t;case`boolean`:case`date`:case`regexp`:return`a `+t;default:return t}}function P(e){return!e.constructor||!e.constructor.name?f:e.constructor.name}return p.checkPropTypes=o,p.resetWarningCache=o.resetWarningCache,p.PropTypes=p,p}})),C=e.w(((e,t)=>{var n=y();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),w=e.w(((e,t)=>{if(process.env.NODE_ENV!==`production`){var n=_();t.exports=S()(n.isElement,!0)}else t.exports=C()()}));function T(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=T(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function E(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=T(e))&&(r&&(r+=` `),r+=t);return r}function D(e,t,n=void 0){let r={};for(let i in e){let a=e[i],o=``,s=!0;for(let e=0;e<a.length;e+=1){let r=a[e];r&&(o+=(s===!0?``:` `)+t(r),s=!1,n&&n[r]&&(o+=` `+n[r]))}r[i]=o}return r}var O=e.w((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.suspense_list`),d=Symbol.for(`react.memo`),f=Symbol.for(`react.lazy`),p=Symbol.for(`react.view_transition`),m=Symbol.for(`react.client.reference`);function h(e){if(typeof e==`object`&&e){var m=e.$$typeof;switch(m){case t:switch(e=e.type,e){case r:case a:case i:case l:case u:case p:return e;default:switch(e&&=e.$$typeof,e){case s:case c:case f:case d:return e;case o:return e;default:return m}}case n:return m}}}e.ContextConsumer=o,e.ContextProvider=s,e.Element=t,e.ForwardRef=c,e.Fragment=r,e.Lazy=f,e.Memo=d,e.Portal=n,e.Profiler=a,e.StrictMode=i,e.Suspense=l,e.SuspenseList=u,e.isContextConsumer=function(e){return h(e)===o},e.isContextProvider=function(e){return h(e)===s},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===t},e.isForwardRef=function(e){return h(e)===c},e.isFragment=function(e){return h(e)===r},e.isLazy=function(e){return h(e)===f},e.isMemo=function(e){return h(e)===d},e.isPortal=function(e){return h(e)===n},e.isProfiler=function(e){return h(e)===a},e.isStrictMode=function(e){return h(e)===i},e.isSuspense=function(e){return h(e)===l},e.isSuspenseList=function(e){return h(e)===u},e.isValidElementType=function(e){return!!(typeof e==`string`||typeof e==`function`||e===r||e===a||e===i||e===l||e===u||typeof e==`object`&&e&&(e.$$typeof===f||e.$$typeof===d||e.$$typeof===s||e.$$typeof===o||e.$$typeof===c||e.$$typeof===m||e.getModuleId!==void 0))},e.typeOf=h})),k=e.w((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:switch(e=e.type,e){case i:case o:case a:case u:case d:case m:return e;default:switch(e&&=e.$$typeof,e){case c:case l:case p:case f:return e;case s:return e;default:return t}}case r:return t}}}var n=Symbol.for(`react.transitional.element`),r=Symbol.for(`react.portal`),i=Symbol.for(`react.fragment`),a=Symbol.for(`react.strict_mode`),o=Symbol.for(`react.profiler`),s=Symbol.for(`react.consumer`),c=Symbol.for(`react.context`),l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.suspense`),d=Symbol.for(`react.suspense_list`),f=Symbol.for(`react.memo`),p=Symbol.for(`react.lazy`),m=Symbol.for(`react.view_transition`),h=Symbol.for(`react.client.reference`);e.ContextConsumer=s,e.ContextProvider=c,e.Element=n,e.ForwardRef=l,e.Fragment=i,e.Lazy=p,e.Memo=f,e.Portal=r,e.Profiler=o,e.StrictMode=a,e.Suspense=u,e.SuspenseList=d,e.isContextConsumer=function(e){return t(e)===s},e.isContextProvider=function(e){return t(e)===c},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===n},e.isForwardRef=function(e){return t(e)===l},e.isFragment=function(e){return t(e)===i},e.isLazy=function(e){return t(e)===p},e.isMemo=function(e){return t(e)===f},e.isPortal=function(e){return t(e)===r},e.isProfiler=function(e){return t(e)===o},e.isStrictMode=function(e){return t(e)===a},e.isSuspense=function(e){return t(e)===u},e.isSuspenseList=function(e){return t(e)===d},e.isValidElementType=function(e){return!!(typeof e==`string`||typeof e==`function`||e===i||e===o||e===a||e===u||e===d||typeof e==`object`&&e&&(e.$$typeof===p||e.$$typeof===f||e.$$typeof===c||e.$$typeof===s||e.$$typeof===l||e.$$typeof===h||e.getModuleId!==void 0))},e.typeOf=t})()})),A=e.w(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=O():t.exports=k()}))();function j(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function M(e){if(t.isValidElement(e)||(0,A.isValidElementType)(e)||!j(e))return e;let n={};return Object.keys(e).forEach(t=>{n[t]=M(e[t])}),n}function N(e,n,r={clone:!0}){let i=r.clone?{...e}:e;return j(e)&&j(n)&&Object.keys(n).forEach(a=>{t.isValidElement(n[a])||(0,A.isValidElementType)(n[a])?i[a]=n[a]:j(n[a])&&Object.prototype.hasOwnProperty.call(e,a)&&j(e[a])?i[a]=N(e[a],n[a],r):r.clone?i[a]=j(n[a])?M(n[a]):n[a]:i[a]=n[a]}),i}function ee(e,t){return t?N(e,t,{clone:!1}):e}var P=e.T(w()),F=process.env.NODE_ENV===`production`?{}:P.default.oneOfType([P.default.number,P.default.string,P.default.object,P.default.array]);function I(e,t){if(!e.containerQueries)return t;let n=Object.keys(t).filter(e=>e.startsWith(`@container`)).sort((e,t)=>{let n=/min-width:\s*([0-9.]+)/;return(e.match(n)?.[1]||0)-+(t.match(n)?.[1]||0)});return n.length?n.reduce((e,n)=>{let r=t[n];return delete e[n],e[n]=r,e},{...t}):t}function L(e,t){return t===`@`||t.startsWith(`@`)&&(e.some(e=>t.startsWith(`@${e}`))||!!t.match(/^@\d/))}function te(e,t){let n=t.match(/^@([^/]+)?\/?(.+)?$/);if(!n){if(process.env.NODE_ENV!==`production`)throw Error(`MUI: The provided shorthand ${`(${t})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.\nFor example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`);return null}let[,r,i]=n,a=Number.isNaN(+r)?r||0:+r;return e.containerQueries(i).up(a)}function ne(e){let t=(e,t)=>e.replace(`@media`,t?`@container ${t}`:`@container`);function n(n,r){n.up=(...n)=>t(e.breakpoints.up(...n),r),n.down=(...n)=>t(e.breakpoints.down(...n),r),n.between=(...n)=>t(e.breakpoints.between(...n),r),n.only=(...n)=>t(e.breakpoints.only(...n),r),n.not=(...n)=>{let i=t(e.breakpoints.not(...n),r);return i.includes(`not all and`)?i.replace(`not all and `,``).replace(`min-width:`,`width<`).replace(`max-width:`,`width>`).replace(`and`,`or`):i}}let r={},i=e=>(n(r,e),r);return n(i),{...e,containerQueries:i}}var R={xs:0,sm:600,md:900,lg:1200,xl:1536},re={keys:[`xs`,`sm`,`md`,`lg`,`xl`],up:e=>`@media (min-width:${R[e]}px)`},ie={containerQueries:e=>({up:t=>{let n=typeof t==`number`?t:R[t]||t;return typeof n==`number`&&(n=`${n}px`),e?`@container ${e} (min-width:${n})`:`@container (min-width:${n})`}})};function z(e,t,n){let r=e.theme||{};if(Array.isArray(t)){let e=r.breakpoints||re;return t.reduce((r,i,a)=>(r[e.up(e.keys[a])]=n(t[a]),r),{})}if(typeof t==`object`){let e=r.breakpoints||re;return Object.keys(t).reduce((i,a)=>{if(L(e.keys,a)){let e=te(r.containerQueries?r:ie,a);e&&(i[e]=n(t[a],a))}else if(Object.keys(e.values||R).includes(a)){let r=e.up(a);i[r]=n(t[a],a)}else{let e=a;i[e]=t[e]}return i},{})}return n(t)}function ae(e={}){return e.keys?.reduce((t,n)=>{let r=e.up(n);return t[r]={},t},{})||{}}function oe(e,t){return e.reduce((e,t)=>{let n=e[t];return(!n||Object.keys(n).length===0)&&delete e[t],e},t)}function se(e,t,n=!0){if(!t||typeof t!=`string`)return null;if(e&&e.vars&&n){let n=`vars.${t}`.split(`.`).reduce((e,t)=>e&&e[t]?e[t]:null,e);if(n!=null)return n}return t.split(`.`).reduce((e,t)=>e&&e[t]!=null?e[t]:null,e)}function ce(e,t,n,r=n){let i;return i=typeof e==`function`?e(n):Array.isArray(e)?e[n]||r:se(e,n)||r,t&&(i=t(i,r,e)),i}function B(e){let{prop:t,cssProperty:n=e.prop,themeKey:r,transform:i}=e,a=e=>{if(e[t]==null)return null;let a=e[t],o=e.theme,s=se(o,r)||{};return z(e,a,e=>{let r=ce(s,i,e);return e===r&&typeof e==`string`&&(r=ce(s,i,`${t}${e===`default`?``:p(e)}`,e)),n===!1?r:{[n]:r}})};return a.propTypes=process.env.NODE_ENV===`production`?{}:{[t]:F},a.filterProps=[t],a}function le(e){let t={};return n=>(t[n]===void 0&&(t[n]=e(n)),t[n])}var ue={m:`margin`,p:`padding`},de={t:`Top`,r:`Right`,b:`Bottom`,l:`Left`,x:[`Left`,`Right`],y:[`Top`,`Bottom`]},fe={marginX:`mx`,marginY:`my`,paddingX:`px`,paddingY:`py`},pe=le(e=>{if(e.length>2)if(fe[e])e=fe[e];else return[e];let[t,n]=e.split(``),r=ue[t],i=de[n]||``;return Array.isArray(i)?i.map(e=>r+e):[r+i]}),me=[`m`,`mt`,`mr`,`mb`,`ml`,`mx`,`my`,`margin`,`marginTop`,`marginRight`,`marginBottom`,`marginLeft`,`marginX`,`marginY`,`marginInline`,`marginInlineStart`,`marginInlineEnd`,`marginBlock`,`marginBlockStart`,`marginBlockEnd`],he=[`p`,`pt`,`pr`,`pb`,`pl`,`px`,`py`,`padding`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`,`paddingX`,`paddingY`,`paddingInline`,`paddingInlineStart`,`paddingInlineEnd`,`paddingBlock`,`paddingBlockStart`,`paddingBlockEnd`],ge=[...me,...he];function _e(e,t,n,r){let i=se(e,t,!0)??n;return typeof i==`number`||typeof i==`string`?e=>typeof e==`string`?e:(process.env.NODE_ENV!==`production`&&typeof e!=`number`&&console.error(`MUI: Expected ${r} argument to be a number or a string, got ${e}.`),typeof i==`string`?i.startsWith(`var(`)&&e===0?0:i.startsWith(`var(`)&&e===1?i:`calc(${e} * ${i})`:i*e):Array.isArray(i)?e=>{if(typeof e==`string`)return e;let n=Math.abs(e);process.env.NODE_ENV!==`production`&&(Number.isInteger(n)?n>i.length-1&&console.error([`MUI: The value provided (${n}) overflows.`,`The supported values are: ${JSON.stringify(i)}.`,`${n} > ${i.length-1}, you need to add the missing values.`].join(`
4
4
  `)):console.error([`MUI: The \`theme.${t}\` array type cannot be combined with non integer values.You should either use an integer value that can be used as index, or define the \`theme.${t}\` as a number.`].join(`
@@ -28,7 +28,7 @@ export default theme;`}function dr(e){return typeof e==`number`?`${(e*100).toFix
28
28
  `))}t[r]={}}}};Object.keys(m.components).forEach(e=>{let n=m.components[e].styleOverrides;n&&e.startsWith(`Mui`)&&t(n,e)})}return m.unstable_sxConfig={...Ze,...u?.unstable_sxConfig},m.unstable_sx=function(e){return tt({sx:e,theme:this})},m.toRuntimeSource=ur,pr(m),m}function hr(e){let t;return t=e<1?5.11916*e**2:4.5*Math.log(e+1)+2,Math.round(t*10)/1e3}var gr=[...Array(25)].map((e,t)=>{if(t===0)return`none`;let n=hr(t);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function _r(e){return{inputPlaceholder:e===`dark`?.5:.42,inputUnderline:e===`dark`?.7:.42,switchTrackDisabled:e===`dark`?.2:.12,switchTrack:e===`dark`?.3:.38}}function vr(e){return e===`dark`?gr:[]}function yr(e){let{palette:t={mode:`light`},opacity:n,overlays:r,colorSpace:i,...a}=e,o=Kn({...t,colorSpace:i});return{palette:o,opacity:{..._r(o.mode),...n},overlays:r||vr(o.mode),...a}}function br(e){return!!e[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!e[0].match(/sxConfig$/)||e[0]===`palette`&&!!e[1]?.match(/(mode|contrastThreshold|tonalOffset)/)}var xr=e=>[...[...Array(25)].map((t,n)=>`--${e?`${e}-`:``}overlays-${n}`),`--${e?`${e}-`:``}palette-AppBar-darkBg`,`--${e?`${e}-`:``}palette-AppBar-darkColor`],Sr=e=>(t,n)=>{let r=e.rootSelector||`:root`,i=e.colorSchemeSelector,a=i;if(i===`class`&&(a=`.%s`),i===`data`&&(a=`[data-%s]`),i?.startsWith(`data-`)&&!i.includes(`%s`)&&(a=`[${i}="%s"]`),e.defaultColorScheme===t){if(t===`dark`){let i={};return xr(e.cssVarPrefix).forEach(e=>{i[e]=n[e],delete n[e]}),a===`media`?{[r]:n,"@media (prefers-color-scheme: dark)":{[r]:i}}:a?{[a.replace(`%s`,t)]:i,[`${r}, ${a.replace(`%s`,t)}`]:n}:{[r]:{...n,...i}}}if(a&&a!==`media`)return`${r}, ${a.replace(`%s`,String(t))}`}else if(t){if(a===`media`)return{[`@media (prefers-color-scheme: ${String(t)})`]:{[r]:n}};if(a)return a.replace(`%s`,String(t))}return r};function Cr(e,t){t.forEach(t=>{e[t]||(e[t]={})})}function K(e,t,n){!e[t]&&n&&(e[t]=n)}function wr(e){return typeof e!=`string`||!e.startsWith(`hsl`)?e:nn(e)}function Tr(e,t){`${t}Channel`in e||(e[`${t}Channel`]=en(wr(e[t]),`MUI: Can't create \`palette.${t}Channel\` because \`palette.${t}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
29
29
  To suppress this warning, you need to explicitly provide the \`palette.${t}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function Er(e){return typeof e==`number`?`${e}px`:typeof e==`string`||typeof e==`function`||Array.isArray(e)?e:`8px`}var Dr=e=>{try{return e()}catch{}},Or=(e=`mui`)=>vn(e);function kr(e,t,n,r,i){if(!n)return;n=n===!0?{}:n;let a=i===`dark`?`dark`:`light`;if(!r){t[i]=yr({...n,palette:{mode:a,...n?.palette},colorSpace:e});return}let{palette:o,...s}=mr({...r,palette:{mode:a,...n?.palette},colorSpace:e});return t[i]={...n,palette:o,opacity:{..._r(a),...n?.opacity},overlays:n?.overlays||vr(a)},s}function Ar(e={},...t){let{colorSchemes:n={light:!0},defaultColorScheme:r,disableCssColorScheme:i=!1,cssVarPrefix:a=`mui`,nativeColor:o=!1,shouldSkipGeneratingVar:s=br,colorSchemeSelector:c=n.light&&n.dark?`media`:void 0,rootSelector:l=`:root`,...u}=e,d=Object.keys(n)[0],p=r||(n.light&&d!==`light`?`light`:d),m=Or(a),{[p]:h,light:g,dark:_,...v}=n,y={...v},b=h;if((p===`dark`&&!(`dark`in n)||p===`light`&&!(`light`in n))&&(b=!0),!b)throw Error(process.env.NODE_ENV===`production`?f(21,p):`MUI: The \`colorSchemes.${p}\` option is either missing or invalid.`);let x;o&&(x=`oklch`);let S=kr(x,y,b,u,p);g&&!y.light&&kr(x,y,g,void 0,`light`),_&&!y.dark&&kr(x,y,_,void 0,`dark`);let C={defaultColorScheme:p,...S,cssVarPrefix:a,colorSchemeSelector:c,rootSelector:l,getCssVar:m,colorSchemes:y,font:{...qn(S.typography),...S.font},spacing:Er(u.spacing)};Object.keys(C.colorSchemes).forEach(e=>{let t=C.colorSchemes[e].palette,n=e=>{let n=e.split(`-`),r=n[1],i=n[2];return m(e,t[r][i])};t.mode===`light`&&(K(t.common,`background`,`#fff`),K(t.common,`onBackground`,`#000`)),t.mode===`dark`&&(K(t.common,`background`,`#000`),K(t.common,`onBackground`,`#fff`));function r(e,t,n){if(x){let r;return e===sn&&(r=`transparent ${((1-n)*100).toFixed(0)}%`),e===U&&(r=`#000 ${(n*100).toFixed(0)}%`),e===W&&(r=`#fff ${(n*100).toFixed(0)}%`),`color-mix(in ${x}, ${t}, ${r})`}return e(t,n)}if(Cr(t,[`Alert`,`AppBar`,`Avatar`,`Button`,`Chip`,`FilledInput`,`LinearProgress`,`Skeleton`,`Slider`,`SnackbarContent`,`SpeedDialAction`,`StepConnector`,`StepContent`,`Switch`,`TableCell`,`Tooltip`]),t.mode===`light`){K(t.Alert,`errorColor`,r(U,o?m(`palette-error-light`):t.error.light,.6)),K(t.Alert,`infoColor`,r(U,o?m(`palette-info-light`):t.info.light,.6)),K(t.Alert,`successColor`,r(U,o?m(`palette-success-light`):t.success.light,.6)),K(t.Alert,`warningColor`,r(U,o?m(`palette-warning-light`):t.warning.light,.6)),K(t.Alert,`errorFilledBg`,n(`palette-error-main`)),K(t.Alert,`infoFilledBg`,n(`palette-info-main`)),K(t.Alert,`successFilledBg`,n(`palette-success-main`)),K(t.Alert,`warningFilledBg`,n(`palette-warning-main`)),K(t.Alert,`errorFilledColor`,Dr(()=>t.getContrastText(t.error.main))),K(t.Alert,`infoFilledColor`,Dr(()=>t.getContrastText(t.info.main))),K(t.Alert,`successFilledColor`,Dr(()=>t.getContrastText(t.success.main))),K(t.Alert,`warningFilledColor`,Dr(()=>t.getContrastText(t.warning.main))),K(t.Alert,`errorStandardBg`,r(W,o?m(`palette-error-light`):t.error.light,.9)),K(t.Alert,`infoStandardBg`,r(W,o?m(`palette-info-light`):t.info.light,.9)),K(t.Alert,`successStandardBg`,r(W,o?m(`palette-success-light`):t.success.light,.9)),K(t.Alert,`warningStandardBg`,r(W,o?m(`palette-warning-light`):t.warning.light,.9)),K(t.Alert,`errorIconColor`,n(`palette-error-main`)),K(t.Alert,`infoIconColor`,n(`palette-info-main`)),K(t.Alert,`successIconColor`,n(`palette-success-main`)),K(t.Alert,`warningIconColor`,n(`palette-warning-main`)),K(t.AppBar,`defaultBg`,n(`palette-grey-100`)),K(t.Avatar,`defaultBg`,n(`palette-grey-400`)),K(t.Button,`inheritContainedBg`,n(`palette-grey-300`)),K(t.Button,`inheritContainedHoverBg`,n(`palette-grey-A100`)),K(t.Chip,`defaultBorder`,n(`palette-grey-400`)),K(t.Chip,`defaultAvatarColor`,n(`palette-grey-700`)),K(t.Chip,`defaultIconColor`,n(`palette-grey-700`)),K(t.FilledInput,`bg`,`rgba(0, 0, 0, 0.06)`),K(t.FilledInput,`hoverBg`,`rgba(0, 0, 0, 0.09)`),K(t.FilledInput,`disabledBg`,`rgba(0, 0, 0, 0.12)`),K(t.LinearProgress,`primaryBg`,r(W,o?m(`palette-primary-main`):t.primary.main,.62)),K(t.LinearProgress,`secondaryBg`,r(W,o?m(`palette-secondary-main`):t.secondary.main,.62)),K(t.LinearProgress,`errorBg`,r(W,o?m(`palette-error-main`):t.error.main,.62)),K(t.LinearProgress,`infoBg`,r(W,o?m(`palette-info-main`):t.info.main,.62)),K(t.LinearProgress,`successBg`,r(W,o?m(`palette-success-main`):t.success.main,.62)),K(t.LinearProgress,`warningBg`,r(W,o?m(`palette-warning-light`):t.warning.main,.62)),K(t.Skeleton,`bg`,x?r(sn,o?m(`palette-text-primary`):t.text.primary,.11):`rgba(${n(`palette-text-primaryChannel`)} / 0.11)`),K(t.Slider,`primaryTrack`,r(W,o?m(`palette-primary-main`):t.primary.main,.62)),K(t.Slider,`secondaryTrack`,r(W,o?m(`palette-secondary-main`):t.secondary.main,.62)),K(t.Slider,`errorTrack`,r(W,o?m(`palette-error-main`):t.error.main,.62)),K(t.Slider,`infoTrack`,r(W,o?m(`palette-info-main`):t.info.main,.62)),K(t.Slider,`successTrack`,r(W,o?m(`palette-success-main`):t.success.main,.62)),K(t.Slider,`warningTrack`,r(W,o?m(`palette-warning-main`):t.warning.main,.62));let e=x?r(U,o?m(`palette-background-default`):t.background.default,.6825):dn(t.background.default,.8);K(t.SnackbarContent,`bg`,e),K(t.SnackbarContent,`color`,Dr(()=>x?In.text.primary:t.getContrastText(e))),K(t.SpeedDialAction,`fabHoverBg`,dn(t.background.paper,.15)),K(t.StepConnector,`border`,n(`palette-grey-400`)),K(t.StepContent,`border`,n(`palette-grey-400`)),K(t.Switch,`defaultColor`,n(`palette-common-white`)),K(t.Switch,`defaultDisabledColor`,n(`palette-grey-100`)),K(t.Switch,`primaryDisabledColor`,r(W,o?m(`palette-primary-main`):t.primary.main,.62)),K(t.Switch,`secondaryDisabledColor`,r(W,o?m(`palette-secondary-main`):t.secondary.main,.62)),K(t.Switch,`errorDisabledColor`,r(W,o?m(`palette-error-main`):t.error.main,.62)),K(t.Switch,`infoDisabledColor`,r(W,o?m(`palette-info-main`):t.info.main,.62)),K(t.Switch,`successDisabledColor`,r(W,o?m(`palette-success-main`):t.success.main,.62)),K(t.Switch,`warningDisabledColor`,r(W,o?m(`palette-warning-main`):t.warning.main,.62)),K(t.TableCell,`border`,r(W,sn(o?m(`palette-divider`):t.divider,1),.88)),K(t.Tooltip,`bg`,r(sn,o?m(`palette-grey-700`):t.grey[700],.92))}if(t.mode===`dark`){K(t.Alert,`errorColor`,r(W,o?m(`palette-error-light`):t.error.light,.6)),K(t.Alert,`infoColor`,r(W,o?m(`palette-info-light`):t.info.light,.6)),K(t.Alert,`successColor`,r(W,o?m(`palette-success-light`):t.success.light,.6)),K(t.Alert,`warningColor`,r(W,o?m(`palette-warning-light`):t.warning.light,.6)),K(t.Alert,`errorFilledBg`,n(`palette-error-dark`)),K(t.Alert,`infoFilledBg`,n(`palette-info-dark`)),K(t.Alert,`successFilledBg`,n(`palette-success-dark`)),K(t.Alert,`warningFilledBg`,n(`palette-warning-dark`)),K(t.Alert,`errorFilledColor`,Dr(()=>t.getContrastText(t.error.dark))),K(t.Alert,`infoFilledColor`,Dr(()=>t.getContrastText(t.info.dark))),K(t.Alert,`successFilledColor`,Dr(()=>t.getContrastText(t.success.dark))),K(t.Alert,`warningFilledColor`,Dr(()=>t.getContrastText(t.warning.dark))),K(t.Alert,`errorStandardBg`,r(U,o?m(`palette-error-light`):t.error.light,.9)),K(t.Alert,`infoStandardBg`,r(U,o?m(`palette-info-light`):t.info.light,.9)),K(t.Alert,`successStandardBg`,r(U,o?m(`palette-success-light`):t.success.light,.9)),K(t.Alert,`warningStandardBg`,r(U,o?m(`palette-warning-light`):t.warning.light,.9)),K(t.Alert,`errorIconColor`,n(`palette-error-main`)),K(t.Alert,`infoIconColor`,n(`palette-info-main`)),K(t.Alert,`successIconColor`,n(`palette-success-main`)),K(t.Alert,`warningIconColor`,n(`palette-warning-main`)),K(t.AppBar,`defaultBg`,n(`palette-grey-900`)),K(t.AppBar,`darkBg`,n(`palette-background-paper`)),K(t.AppBar,`darkColor`,n(`palette-text-primary`)),K(t.Avatar,`defaultBg`,n(`palette-grey-600`)),K(t.Button,`inheritContainedBg`,n(`palette-grey-800`)),K(t.Button,`inheritContainedHoverBg`,n(`palette-grey-700`)),K(t.Chip,`defaultBorder`,n(`palette-grey-700`)),K(t.Chip,`defaultAvatarColor`,n(`palette-grey-300`)),K(t.Chip,`defaultIconColor`,n(`palette-grey-300`)),K(t.FilledInput,`bg`,`rgba(255, 255, 255, 0.09)`),K(t.FilledInput,`hoverBg`,`rgba(255, 255, 255, 0.13)`),K(t.FilledInput,`disabledBg`,`rgba(255, 255, 255, 0.12)`),K(t.LinearProgress,`primaryBg`,r(U,o?m(`palette-primary-main`):t.primary.main,.5)),K(t.LinearProgress,`secondaryBg`,r(U,o?m(`palette-secondary-main`):t.secondary.main,.5)),K(t.LinearProgress,`errorBg`,r(U,o?m(`palette-error-main`):t.error.main,.5)),K(t.LinearProgress,`infoBg`,r(U,o?m(`palette-info-main`):t.info.main,.5)),K(t.LinearProgress,`successBg`,r(U,o?m(`palette-success-main`):t.success.main,.5)),K(t.LinearProgress,`warningBg`,r(U,o?m(`palette-warning-main`):t.warning.main,.5)),K(t.Skeleton,`bg`,x?r(sn,o?m(`palette-text-primary`):t.text.primary,.13):`rgba(${n(`palette-text-primaryChannel`)} / 0.13)`),K(t.Slider,`primaryTrack`,r(U,o?m(`palette-primary-main`):t.primary.main,.5)),K(t.Slider,`secondaryTrack`,r(U,o?m(`palette-secondary-main`):t.secondary.main,.5)),K(t.Slider,`errorTrack`,r(U,o?m(`palette-error-main`):t.error.main,.5)),K(t.Slider,`infoTrack`,r(U,o?m(`palette-info-main`):t.info.main,.5)),K(t.Slider,`successTrack`,r(U,o?m(`palette-success-main`):t.success.main,.5)),K(t.Slider,`warningTrack`,r(U,o?m(`palette-warning-light`):t.warning.main,.5));let e=x?r(W,o?m(`palette-background-default`):t.background.default,.985):dn(t.background.default,.98);K(t.SnackbarContent,`bg`,e),K(t.SnackbarContent,`color`,Dr(()=>x?Pn.text.primary:t.getContrastText(e))),K(t.SpeedDialAction,`fabHoverBg`,dn(t.background.paper,.15)),K(t.StepConnector,`border`,n(`palette-grey-600`)),K(t.StepContent,`border`,n(`palette-grey-600`)),K(t.Switch,`defaultColor`,n(`palette-grey-300`)),K(t.Switch,`defaultDisabledColor`,n(`palette-grey-600`)),K(t.Switch,`primaryDisabledColor`,r(U,o?m(`palette-primary-main`):t.primary.main,.55)),K(t.Switch,`secondaryDisabledColor`,r(U,o?m(`palette-secondary-main`):t.secondary.main,.55)),K(t.Switch,`errorDisabledColor`,r(U,o?m(`palette-error-main`):t.error.main,.55)),K(t.Switch,`infoDisabledColor`,r(U,o?m(`palette-info-main`):t.info.main,.55)),K(t.Switch,`successDisabledColor`,r(U,o?m(`palette-success-main`):t.success.main,.55)),K(t.Switch,`warningDisabledColor`,r(U,o?m(`palette-warning-light`):t.warning.main,.55)),K(t.TableCell,`border`,r(U,sn(o?m(`palette-divider`):t.divider,1),.68)),K(t.Tooltip,`bg`,r(sn,o?m(`palette-grey-700`):t.grey[700],.92))}o||(Tr(t.background,`default`),Tr(t.background,`paper`),Tr(t.common,`background`),Tr(t.common,`onBackground`),Tr(t,`divider`)),Object.keys(t).forEach(e=>{let n=t[e];e!==`tonalOffset`&&!o&&n&&typeof n==`object`&&(n.main&&K(t[e],`mainChannel`,en(wr(n.main))),n.light&&K(t[e],`lightChannel`,en(wr(n.light))),n.dark&&K(t[e],`darkChannel`,en(wr(n.dark))),n.contrastText&&K(t[e],`contrastTextChannel`,en(wr(n.contrastText))),e===`text`&&(Tr(t[e],`primary`),Tr(t[e],`secondary`)),e===`action`&&(n.active&&Tr(t[e],`active`),n.selected&&Tr(t[e],`selected`)))})}),C=t.reduce((e,t)=>N(e,t),C);let w={prefix:a,disableCssColorScheme:i,shouldSkipGeneratingVar:s,getSelector:Sr(C),enableContrastVars:o},{vars:T,generateThemeVars:E,generateStyleSheets:D}=Cn(C,w);return C.vars=T,Object.entries(C.colorSchemes[C.defaultColorScheme]).forEach(([e,t])=>{C[e]=t}),C.generateThemeVars=E,C.generateStyleSheets=D,C.generateSpacing=function(){return Tt(u.spacing,ve(this))},C.getColorSchemeSelector=wn(c),C.spacing=C.generateSpacing(),C.shouldSkipGeneratingVar=s,C.unstable_sxConfig={...Ze,...u?.unstable_sxConfig},C.unstable_sx=function(e){return tt({sx:e,theme:this})},C.toRuntimeSource=ur,C}function jr(e,t,n){e.colorSchemes&&n&&(e.colorSchemes[t]={...n!==!0&&n,palette:Kn({...n===!0?{}:n.palette,mode:t})})}function Mr(e={},...t){let{palette:n,cssVariables:r=!1,colorSchemes:i=n?void 0:{light:!0},defaultColorScheme:a=n?.mode,...o}=e,s=a||`light`,c=i?.[s],l={...i,...n?{[s]:{...typeof c!=`boolean`&&c,palette:n}}:void 0};if(r===!1){if(!(`colorSchemes`in e))return mr(e,...t);let r=n;`palette`in e||l[s]&&(l[s]===!0?s===`dark`&&(r={mode:`dark`}):r=l[s].palette);let i=mr({...e,palette:r},...t);return i.defaultColorScheme=s,i.colorSchemes=l,i.palette.mode===`light`&&(i.colorSchemes.light={...l.light!==!0&&l.light,palette:i.palette},jr(i,`dark`,l.dark)),i.palette.mode===`dark`&&(i.colorSchemes.dark={...l.dark!==!0&&l.dark,palette:i.palette},jr(i,`light`,l.light)),i}return!n&&!(`light`in l)&&s===`light`&&(l.light=!0),Ar({...o,colorSchemes:l,defaultColorScheme:s,...typeof r!=`boolean`&&r},...t)}var Nr=Mr(),Pr=`$$material`;function Fr(e){return e!==`ownerState`&&e!==`theme`&&e!==`sx`&&e!==`as`}var Ir=Ht({themeId:Pr,defaultTheme:Nr,rootShouldForwardProp:e=>Fr(e)&&e!==`classes`}),Lr=_n;function Rr(e){return(0,i.jsx)(pn,{...e})}process.env.NODE_ENV!==`production`&&(Rr.propTypes={children:P.default.node,value:P.default.object.isRequired});function zr(e){return hn(e)}function Br(e){return kt(`MuiSvgIcon`,e)}At(`MuiSvgIcon`,[`root`,`colorPrimary`,`colorSecondary`,`colorAction`,`colorError`,`colorDisabled`,`fontSizeInherit`,`fontSizeSmall`,`fontSizeMedium`,`fontSizeLarge`]);var Vr=e=>{let{color:t,fontSize:n,classes:r}=e;return D({root:[`root`,t!==`inherit`&&`color${m(t)}`,`fontSize${m(n)}`]},Br,r)},Hr=Ir(`svg`,{name:`MuiSvgIcon`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.color!==`inherit`&&t[`color${m(n.color)}`],t[`fontSize${m(n.fontSize)}`]]}})(Lr(({theme:e})=>({userSelect:`none`,width:`1em`,height:`1em`,display:`inline-block`,flexShrink:0,transition:e.transitions?.create?.(`fill`,{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:e=>!e.hasSvgAsChild,style:{fill:`currentColor`}},{props:{fontSize:`inherit`},style:{fontSize:`inherit`}},{props:{fontSize:`small`},style:{fontSize:e.typography?.pxToRem?.(20)||`1.25rem`}},{props:{fontSize:`medium`},style:{fontSize:e.typography?.pxToRem?.(24)||`1.5rem`}},{props:{fontSize:`large`},style:{fontSize:e.typography?.pxToRem?.(35)||`2.1875rem`}},...Object.entries((e.vars??e).palette).filter(([,e])=>e&&e.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:`action`},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:`disabled`},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:`inherit`},style:{color:void 0}}]}))),Ur=t.forwardRef(function(e,n){let r=zr({props:e,name:`MuiSvgIcon`}),{children:a,className:o,color:s=`inherit`,component:c=`svg`,fontSize:l=`medium`,htmlColor:u,inheritViewBox:d=!1,titleAccess:f,viewBox:p=`0 0 24 24`,...m}=r,h=t.isValidElement(a)&&a.type===`svg`,g={...r,color:s,component:c,fontSize:l,instanceFontSize:e.fontSize,inheritViewBox:d,viewBox:p,hasSvgAsChild:h},_={};return d||(_.viewBox=p),(0,i.jsxs)(Hr,{as:c,className:E(Vr(g).root,o),focusable:`false`,color:u,"aria-hidden":f?void 0:!0,role:f?`img`:void 0,ref:n,..._,...m,...h&&a.props,ownerState:g,children:[h?a.props.children:a,f?(0,i.jsx)(`title`,{children:f}):null]})});process.env.NODE_ENV!==`production`&&(Ur.propTypes={children:P.default.node,classes:P.default.object,className:P.default.string,color:P.default.oneOfType([P.default.oneOf([`inherit`,`action`,`disabled`,`primary`,`secondary`,`error`,`info`,`success`,`warning`]),P.default.string]),component:P.default.elementType,fontSize:P.default.oneOfType([P.default.oneOf([`inherit`,`large`,`medium`,`small`]),P.default.string]),htmlColor:P.default.string,inheritViewBox:P.default.bool,shapeRendering:P.default.string,sx:P.default.oneOfType([P.default.arrayOf(P.default.oneOfType([P.default.func,P.default.object,P.default.bool])),P.default.func,P.default.object]),titleAccess:P.default.string,viewBox:P.default.string}),Ur.muiName=`SvgIcon`;function q(e,n){function r(t,r){return(0,i.jsx)(Ur,{"data-testid":process.env.NODE_ENV===`production`?void 0:`${n}Icon`,ref:r,...t,children:e})}return process.env.NODE_ENV!==`production`&&(r.displayName=`${n}Icon`),r.muiName=Ur.muiName,t.memo(t.forwardRef(r))}var Wr=q((0,i.jsx)(`path`,{d:`M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z`}),`Add`),Gr=q((0,i.jsx)(`path`,{d:`M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z`}),`ArrowBack`),Kr=q((0,i.jsx)(`path`,{d:`m7 10 5 5 5-5z`}),`ArrowDropDown`),qr=q((0,i.jsx)(`path`,{d:`M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6z`}),`AttachFile`),Jr=q((0,i.jsx)(`path`,{d:`M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z`}),`AutoFixHigh`),Yr=q((0,i.jsx)(`path`,{d:`M20 4h-3.17L15 2H9L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 14H4V6h4.05l1.83-2h4.24l1.83 2H20zM12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5m0 8c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3`}),`CameraAltOutlined`),Xr=q((0,i.jsx)(`path`,{d:`M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z`}),`ChevronLeft`),Zr=q((0,i.jsx)(`path`,{d:`M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z`}),`ChevronRight`),Qr=q((0,i.jsx)(`path`,{d:`M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`}),`Close`),$r=q((0,i.jsx)(`path`,{d:`M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z`}),`Delete`),ei=q((0,i.jsx)(`path`,{d:`M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z`}),`DeleteOutline`),ti=q((0,i.jsx)(`path`,{d:`M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z`}),`Done`),ni=q((0,i.jsx)(`path`,{d:`M18.41 5.8 17.2 4.59c-.78-.78-2.05-.78-2.83 0l-2.68 2.68L3 15.96V20h4.04l8.74-8.74 2.63-2.63c.79-.78.79-2.05 0-2.83M6.21 18H5v-1.21l8.66-8.66 1.21 1.21zM11 20l4-4h6v4z`}),`DriveFileRenameOutline`),ri=q((0,i.jsx)(`path`,{d:`M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8`}),`ErrorOutline`),ii=q((0,i.jsx)(`path`,{d:`M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3 1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5`}),`Group`),ai=q((0,i.jsx)(`path`,{d:`M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2`}),`MoreVert`),oi=q([(0,i.jsx)(`path`,{fillRule:`evenodd`,d:`M16.67 13.13C18.04 14.06 19 15.32 19 17v3h4v-3c0-2.18-3.57-3.47-6.33-3.87`},`0`),(0,i.jsx)(`circle`,{cx:`9`,cy:`8`,r:`4`,fillRule:`evenodd`},`1`),(0,i.jsx)(`path`,{fillRule:`evenodd`,d:`M15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4c-.47 0-.91.1-1.33.24C14.5 5.27 15 6.58 15 8s-.5 2.73-1.33 3.76c.42.14.86.24 1.33.24m-6 1c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4`},`2`)],`PeopleAlt`),si=q((0,i.jsx)(`path`,{d:`M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4`}),`Person`),ci=q((0,i.jsx)(`path`,{d:`M15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m-9-2V7H4v3H1v2h3v3h2v-3h3v-2zm9 4c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4`}),`PersonAdd`),li=q((0,i.jsx)(`path`,{d:`M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z`}),`Refresh`),ui=q([(0,i.jsx)(`path`,{d:`M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8`},`0`),(0,i.jsx)(`path`,{d:`M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z`},`1`)],`Schedule`),di=q((0,i.jsx)(`path`,{d:`M2.01 21 23 12 2.01 3 2 10l15 2-15 2z`}),`Send`),fi=q((0,i.jsx)(`path`,{d:`M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3`}),`Visibility`),pi=q((0,i.jsx)(`path`,{d:`M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3z`}),`VisibilityOff`),mi=q((0,i.jsx)(`path`,{d:`M22.99 9C19.15 5.16 13.8 3.76 8.84 4.78l2.52 2.52c3.47-.17 6.99 1.05 9.63 3.7zm-4 4c-1.29-1.29-2.84-2.13-4.49-2.56l3.53 3.53zM2 3.05 5.07 6.1C3.6 6.82 2.22 7.78 1 9l1.99 2c1.24-1.24 2.67-2.16 4.2-2.77l2.24 2.24C7.81 10.89 6.27 11.73 5 13v.01L6.99 15c1.36-1.36 3.14-2.04 4.92-2.06L18.98 20l1.27-1.26L3.29 1.79zM9 17l3 3 3-3c-1.65-1.66-4.34-1.66-6 0`}),`WifiOff`);function hi(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4),i=Math.floor(n/36e5),a=Math.floor(n/864e5);return r<1?`now`:r<60?`${r}m`:i<24?`${i}h`:a<7?`${a}d`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}var gi=n.default.memo(({conversation:e,displayName:t,selected:n,onClick:a,currentUser:o})=>{let s=!!e.group,c=e.unread_count,l=o?.role===`admin`;return(0,i.jsx)(r.ListItem,{disablePadding:!0,children:(0,i.jsxs)(r.ListItemButton,{selected:n,onClick:a,sx:{"&.Mui-selected":{backgroundColor:`action.selected`,"&:hover":{backgroundColor:`action.selected`}}},children:[(0,i.jsx)(r.ListItemAvatar,{children:(0,i.jsx)(r.Badge,{badgeContent:c,color:`primary`,overlap:`circular`,invisible:c===0,children:(0,i.jsx)(r.Avatar,{sx:{bgcolor:s?`primary.main`:`secondary.main`},children:s?(0,i.jsx)(ii,{}):(0,i.jsx)(si,{})})})}),(0,i.jsx)(r.ListItemText,{primary:(0,i.jsxs)(r.Box,{display:`flex`,justifyContent:`space-between`,alignItems:`center`,children:[(0,i.jsx)(r.Typography,{variant:`subtitle2`,noWrap:!0,sx:{fontWeight:c>0?600:400,flex:1},children:t}),(0,i.jsx)(r.Typography,{variant:`caption`,color:`text.secondary`,sx:{ml:1,flexShrink:0},children:hi(e.last_message_at)})]}),secondary:(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,noWrap:!0,sx:{fontWeight:c>0?500:400},children:e.message_count===0?l&&s?`View group`:`No messages yet`:`${e.message_count} message${e.message_count===1?``:`s`}`})})]})})}),_i=()=>(0,i.jsxs)(r.ListItem,{children:[(0,i.jsx)(r.ListItemAvatar,{children:(0,i.jsx)(r.Skeleton,{variant:`circular`,width:40,height:40})}),(0,i.jsx)(r.ListItemText,{primary:(0,i.jsxs)(r.Box,{display:`flex`,justifyContent:`space-between`,children:[(0,i.jsx)(r.Skeleton,{variant:`text`,width:`60%`}),(0,i.jsx)(r.Skeleton,{variant:`text`,width:`15%`})]}),secondary:(0,i.jsx)(r.Skeleton,{variant:`text`,width:`80%`})})]}),vi=function(e){return yi(e)&&!bi(e)};function yi(e){return!!e&&typeof e==`object`}function bi(e){var t=Object.prototype.toString.call(e);return t===`[object RegExp]`||t===`[object Date]`||Si(e)}var xi=typeof Symbol==`function`&&Symbol.for?Symbol.for(`react.element`):60103;function Si(e){return e.$$typeof===xi}function Ci(e){return Array.isArray(e)?[]:{}}function wi(e,t){return t.clone!==!1&&t.isMergeableObject(e)?Di(Ci(e),e,t):e}function Ti(e,t,n){return e.concat(t).map(function(e){return wi(e,n)})}function Ei(e,t,n){var r={};return n.isMergeableObject(e)&&Object.keys(e).forEach(function(t){r[t]=wi(e[t],n)}),Object.keys(t).forEach(function(i){!n.isMergeableObject(t[i])||!e[i]?r[i]=wi(t[i],n):r[i]=Di(e[i],t[i],n)}),r}function Di(e,t,n){n||={},n.arrayMerge=n.arrayMerge||Ti,n.isMergeableObject=n.isMergeableObject||vi;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):Ei(e,t,n):wi(t,n)}Di.all=function(e,t){if(!Array.isArray(e))throw Error(`first argument should be an array`);return e.reduce(function(e,n){return Di(e,n,t)},{})};var Oi=Di,ki=typeof global==`object`&&global&&global.Object===Object&&global,Ai=typeof self==`object`&&self&&self.Object===Object&&self,ji=ki||Ai||Function(`return this`)(),Mi=ji.Symbol,Ni=Object.prototype,Pi=Ni.hasOwnProperty,Fi=Ni.toString,Ii=Mi?Mi.toStringTag:void 0;function Li(e){var t=Pi.call(e,Ii),n=e[Ii];try{e[Ii]=void 0;var r=!0}catch{}var i=Fi.call(e);return r&&(t?e[Ii]=n:delete e[Ii]),i}var Ri=Object.prototype.toString;function zi(e){return Ri.call(e)}var Bi=`[object Null]`,Vi=`[object Undefined]`,Hi=Mi?Mi.toStringTag:void 0;function Ui(e){return e==null?e===void 0?Vi:Bi:Hi&&Hi in Object(e)?Li(e):zi(e)}function Wi(e,t){return function(n){return e(t(n))}}var Gi=Wi(Object.getPrototypeOf,Object);function Ki(e){return typeof e==`object`&&!!e}var qi=`[object Object]`,Ji=Function.prototype,Yi=Object.prototype,Xi=Ji.toString,Zi=Yi.hasOwnProperty,Qi=Xi.call(Object);function $i(e){if(!Ki(e)||Ui(e)!=qi)return!1;var t=Gi(e);if(t===null)return!0;var n=Zi.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Xi.call(n)==Qi}function ea(){this.__data__=[],this.size=0}function ta(e,t){return e===t||e!==e&&t!==t}function na(e,t){for(var n=e.length;n--;)if(ta(e[n][0],t))return n;return-1}var ra=Array.prototype.splice;function ia(e){var t=this.__data__,n=na(t,e);return n<0?!1:(n==t.length-1?t.pop():ra.call(t,n,1),--this.size,!0)}function aa(e){var t=this.__data__,n=na(t,e);return n<0?void 0:t[n][1]}function oa(e){return na(this.__data__,e)>-1}function sa(e,t){var n=this.__data__,r=na(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function ca(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ca.prototype.clear=ea,ca.prototype.delete=ia,ca.prototype.get=aa,ca.prototype.has=oa,ca.prototype.set=sa;function la(){this.__data__=new ca,this.size=0}function ua(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function da(e){return this.__data__.get(e)}function fa(e){return this.__data__.has(e)}function pa(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var ma=`[object AsyncFunction]`,ha=`[object Function]`,ga=`[object GeneratorFunction]`,_a=`[object Proxy]`;function va(e){if(!pa(e))return!1;var t=Ui(e);return t==ha||t==ga||t==ma||t==_a}var ya=ji[`__core-js_shared__`],ba=function(){var e=/[^.]+$/.exec(ya&&ya.keys&&ya.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function xa(e){return!!ba&&ba in e}var Sa=Function.prototype.toString;function Ca(e){if(e!=null){try{return Sa.call(e)}catch{}try{return e+``}catch{}}return``}var wa=/[\\^$.*+?()[\]{}|]/g,Ta=/^\[object .+?Constructor\]$/,Ea=Function.prototype,Da=Object.prototype,Oa=Ea.toString,ka=Da.hasOwnProperty,Aa=RegExp(`^`+Oa.call(ka).replace(wa,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function ja(e){return!pa(e)||xa(e)?!1:(va(e)?Aa:Ta).test(Ca(e))}function Ma(e,t){return e?.[t]}function Na(e,t){var n=Ma(e,t);return ja(n)?n:void 0}var Pa=Na(ji,`Map`),Fa=Na(Object,`create`);function Ia(){this.__data__=Fa?Fa(null):{},this.size=0}function La(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var Ra=`__lodash_hash_undefined__`,za=Object.prototype.hasOwnProperty;function Ba(e){var t=this.__data__;if(Fa){var n=t[e];return n===Ra?void 0:n}return za.call(t,e)?t[e]:void 0}var Va=Object.prototype.hasOwnProperty;function Ha(e){var t=this.__data__;return Fa?t[e]!==void 0:Va.call(t,e)}var Ua=`__lodash_hash_undefined__`;function Wa(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=Fa&&t===void 0?Ua:t,this}function Ga(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ga.prototype.clear=Ia,Ga.prototype.delete=La,Ga.prototype.get=Ba,Ga.prototype.has=Ha,Ga.prototype.set=Wa;function Ka(){this.size=0,this.__data__={hash:new Ga,map:new(Pa||ca),string:new Ga}}function qa(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function Ja(e,t){var n=e.__data__;return qa(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function Ya(e){var t=Ja(this,e).delete(e);return this.size-=+!!t,t}function Xa(e){return Ja(this,e).get(e)}function Za(e){return Ja(this,e).has(e)}function Qa(e,t){var n=Ja(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function $a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}$a.prototype.clear=Ka,$a.prototype.delete=Ya,$a.prototype.get=Xa,$a.prototype.has=Za,$a.prototype.set=Qa;var eo=200;function to(e,t){var n=this.__data__;if(n instanceof ca){var r=n.__data__;if(!Pa||r.length<eo-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new $a(r)}return n.set(e,t),this.size=n.size,this}function no(e){this.size=(this.__data__=new ca(e)).size}no.prototype.clear=la,no.prototype.delete=ua,no.prototype.get=da,no.prototype.has=fa,no.prototype.set=to;function ro(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var io=function(){try{var e=Na(Object,`defineProperty`);return e({},``,{}),e}catch{}}();function ao(e,t,n){t==`__proto__`&&io?io(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var oo=Object.prototype.hasOwnProperty;function so(e,t,n){var r=e[t];(!(oo.call(e,t)&&ta(r,n))||n===void 0&&!(t in e))&&ao(e,t,n)}function co(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?ao(n,s,c):so(n,s,c)}return n}function lo(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var uo=`[object Arguments]`;function fo(e){return Ki(e)&&Ui(e)==uo}var po=Object.prototype,mo=po.hasOwnProperty,ho=po.propertyIsEnumerable,go=fo(function(){return arguments}())?fo:function(e){return Ki(e)&&mo.call(e,`callee`)&&!ho.call(e,`callee`)},_o=Array.isArray;function vo(){return!1}var yo=typeof exports==`object`&&exports&&!exports.nodeType&&exports,bo=yo&&typeof module==`object`&&module&&!module.nodeType&&module,xo=bo&&bo.exports===yo?ji.Buffer:void 0,So=(xo?xo.isBuffer:void 0)||vo,Co=9007199254740991,wo=/^(?:0|[1-9]\d*)$/;function To(e,t){var n=typeof e;return t??=Co,!!t&&(n==`number`||n!=`symbol`&&wo.test(e))&&e>-1&&e%1==0&&e<t}var Eo=9007199254740991;function Do(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=Eo}var Oo=`[object Arguments]`,ko=`[object Array]`,Ao=`[object Boolean]`,jo=`[object Date]`,Mo=`[object Error]`,No=`[object Function]`,Po=`[object Map]`,Fo=`[object Number]`,Io=`[object Object]`,Lo=`[object RegExp]`,Ro=`[object Set]`,zo=`[object String]`,Bo=`[object WeakMap]`,Vo=`[object ArrayBuffer]`,Ho=`[object DataView]`,Uo=`[object Float32Array]`,Wo=`[object Float64Array]`,Go=`[object Int8Array]`,Ko=`[object Int16Array]`,qo=`[object Int32Array]`,Jo=`[object Uint8Array]`,Yo=`[object Uint8ClampedArray]`,Xo=`[object Uint16Array]`,Zo=`[object Uint32Array]`,J={};J[Uo]=J[Wo]=J[Go]=J[Ko]=J[qo]=J[Jo]=J[Yo]=J[Xo]=J[Zo]=!0,J[Oo]=J[ko]=J[Vo]=J[Ao]=J[Ho]=J[jo]=J[Mo]=J[No]=J[Po]=J[Fo]=J[Io]=J[Lo]=J[Ro]=J[zo]=J[Bo]=!1;function Qo(e){return Ki(e)&&Do(e.length)&&!!J[Ui(e)]}function $o(e){return function(t){return e(t)}}var es=typeof exports==`object`&&exports&&!exports.nodeType&&exports,ts=es&&typeof module==`object`&&module&&!module.nodeType&&module,ns=ts&&ts.exports===es&&ki.process,rs=function(){try{return ts&&ts.require&&ts.require(`util`).types||ns&&ns.binding&&ns.binding(`util`)}catch{}}(),is=rs&&rs.isTypedArray,as=is?$o(is):Qo,os=Object.prototype.hasOwnProperty;function ss(e,t){var n=_o(e),r=!n&&go(e),i=!n&&!r&&So(e),a=!n&&!r&&!i&&as(e),o=n||r||i||a,s=o?lo(e.length,String):[],c=s.length;for(var l in e)(t||os.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||To(l,c)))&&s.push(l);return s}var cs=Object.prototype;function ls(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||cs)}var us=Wi(Object.keys,Object),ds=Object.prototype.hasOwnProperty;function fs(e){if(!ls(e))return us(e);var t=[];for(var n in Object(e))ds.call(e,n)&&n!=`constructor`&&t.push(n);return t}function ps(e){return e!=null&&Do(e.length)&&!va(e)}function ms(e){return ps(e)?ss(e):fs(e)}function hs(e,t){return e&&co(t,ms(t),e)}function gs(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var _s=Object.prototype.hasOwnProperty;function vs(e){if(!pa(e))return gs(e);var t=ls(e),n=[];for(var r in e)r==`constructor`&&(t||!_s.call(e,r))||n.push(r);return n}function ys(e){return ps(e)?ss(e,!0):vs(e)}function bs(e,t){return e&&co(t,ys(t),e)}var xs=typeof exports==`object`&&exports&&!exports.nodeType&&exports,Ss=xs&&typeof module==`object`&&module&&!module.nodeType&&module,Cs=Ss&&Ss.exports===xs?ji.Buffer:void 0,ws=Cs?Cs.allocUnsafe:void 0;function Ts(e,t){if(t)return e.slice();var n=e.length,r=ws?ws(n):new e.constructor(n);return e.copy(r),r}function Es(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function Ds(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function Os(){return[]}var ks=Object.prototype.propertyIsEnumerable,As=Object.getOwnPropertySymbols,js=As?function(e){return e==null?[]:(e=Object(e),Ds(As(e),function(t){return ks.call(e,t)}))}:Os;function Ms(e,t){return co(e,js(e),t)}function Ns(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var Ps=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Ns(t,js(e)),e=Gi(e);return t}:Os;function Fs(e,t){return co(e,Ps(e),t)}function Is(e,t,n){var r=t(e);return _o(e)?r:Ns(r,n(e))}function Ls(e){return Is(e,ms,js)}function Rs(e){return Is(e,ys,Ps)}var zs=Na(ji,`DataView`),Bs=Na(ji,`Promise`),Vs=Na(ji,`Set`),Hs=Na(ji,`WeakMap`),Us=`[object Map]`,Ws=`[object Object]`,Gs=`[object Promise]`,Ks=`[object Set]`,qs=`[object WeakMap]`,Js=`[object DataView]`,Ys=Ca(zs),Xs=Ca(Pa),Zs=Ca(Bs),Qs=Ca(Vs),$s=Ca(Hs),ec=Ui;(zs&&ec(new zs(new ArrayBuffer(1)))!=Js||Pa&&ec(new Pa)!=Us||Bs&&ec(Bs.resolve())!=Gs||Vs&&ec(new Vs)!=Ks||Hs&&ec(new Hs)!=qs)&&(ec=function(e){var t=Ui(e),n=t==Ws?e.constructor:void 0,r=n?Ca(n):``;if(r)switch(r){case Ys:return Js;case Xs:return Us;case Zs:return Gs;case Qs:return Ks;case $s:return qs}return t});var tc=ec,nc=Object.prototype.hasOwnProperty;function rc(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&nc.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}var ic=ji.Uint8Array;function ac(e){var t=new e.constructor(e.byteLength);return new ic(t).set(new ic(e)),t}function oc(e,t){var n=t?ac(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var sc=/\w*$/;function cc(e){var t=new e.constructor(e.source,sc.exec(e));return t.lastIndex=e.lastIndex,t}var lc=Mi?Mi.prototype:void 0,uc=lc?lc.valueOf:void 0;function dc(e){return uc?Object(uc.call(e)):{}}function fc(e,t){var n=t?ac(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var pc=`[object Boolean]`,mc=`[object Date]`,hc=`[object Map]`,gc=`[object Number]`,_c=`[object RegExp]`,vc=`[object Set]`,yc=`[object String]`,bc=`[object Symbol]`,xc=`[object ArrayBuffer]`,Sc=`[object DataView]`,Cc=`[object Float32Array]`,wc=`[object Float64Array]`,Tc=`[object Int8Array]`,Ec=`[object Int16Array]`,Dc=`[object Int32Array]`,Oc=`[object Uint8Array]`,kc=`[object Uint8ClampedArray]`,Ac=`[object Uint16Array]`,jc=`[object Uint32Array]`;function Mc(e,t,n){var r=e.constructor;switch(t){case xc:return ac(e);case pc:case mc:return new r(+e);case Sc:return oc(e,n);case Cc:case wc:case Tc:case Ec:case Dc:case Oc:case kc:case Ac:case jc:return fc(e,n);case hc:return new r;case gc:case yc:return new r(e);case _c:return cc(e);case vc:return new r;case bc:return dc(e)}}var Nc=Object.create,Pc=function(){function e(){}return function(t){if(!pa(t))return{};if(Nc)return Nc(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Fc(e){return typeof e.constructor==`function`&&!ls(e)?Pc(Gi(e)):{}}var Ic=`[object Map]`;function Lc(e){return Ki(e)&&tc(e)==Ic}var Rc=rs&&rs.isMap,zc=Rc?$o(Rc):Lc,Bc=`[object Set]`;function Vc(e){return Ki(e)&&tc(e)==Bc}var Hc=rs&&rs.isSet,Uc=Hc?$o(Hc):Vc,Wc=1,Gc=2,Kc=4,qc=`[object Arguments]`,Jc=`[object Array]`,Yc=`[object Boolean]`,Xc=`[object Date]`,Zc=`[object Error]`,Qc=`[object Function]`,$c=`[object GeneratorFunction]`,el=`[object Map]`,tl=`[object Number]`,nl=`[object Object]`,rl=`[object RegExp]`,il=`[object Set]`,al=`[object String]`,ol=`[object Symbol]`,sl=`[object WeakMap]`,cl=`[object ArrayBuffer]`,ll=`[object DataView]`,ul=`[object Float32Array]`,dl=`[object Float64Array]`,fl=`[object Int8Array]`,pl=`[object Int16Array]`,ml=`[object Int32Array]`,hl=`[object Uint8Array]`,gl=`[object Uint8ClampedArray]`,_l=`[object Uint16Array]`,vl=`[object Uint32Array]`,Y={};Y[qc]=Y[Jc]=Y[cl]=Y[ll]=Y[Yc]=Y[Xc]=Y[ul]=Y[dl]=Y[fl]=Y[pl]=Y[ml]=Y[el]=Y[tl]=Y[nl]=Y[rl]=Y[il]=Y[al]=Y[ol]=Y[hl]=Y[gl]=Y[_l]=Y[vl]=!0,Y[Zc]=Y[Qc]=Y[sl]=!1;function yl(e,t,n,r,i,a){var o,s=t&Wc,c=t&Gc,l=t&Kc;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!pa(e))return e;var u=_o(e);if(u){if(o=rc(e),!s)return Es(e,o)}else{var d=tc(e),f=d==Qc||d==$c;if(So(e))return Ts(e,s);if(d==nl||d==qc||f&&!i){if(o=c||f?{}:Fc(e),!s)return c?Fs(e,bs(o,e)):Ms(e,hs(o,e))}else{if(!Y[d])return i?e:{};o=Mc(e,d,s)}}a||=new no;var p=a.get(e);if(p)return p;a.set(e,o),Uc(e)?e.forEach(function(r){o.add(yl(r,t,n,r,e,a))}):zc(e)&&e.forEach(function(r,i){o.set(i,yl(r,t,n,i,e,a))});var m=u?void 0:(l?c?Rs:Ls:c?ys:ms)(e);return ro(m||e,function(r,i){m&&(i=r,r=e[i]),so(o,i,yl(r,t,n,i,e,a))}),o}var bl=1,xl=4;function Sl(e){return yl(e,bl|xl)}var Cl=e.w(((e,t)=>{var n=Array.isArray,r=Object.keys,i=Object.prototype.hasOwnProperty,a=typeof Element<`u`;function o(e,t){if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){var s=n(e),c=n(t),l,u,d;if(s&&c){if(u=e.length,u!=t.length)return!1;for(l=u;l--!==0;)if(!o(e[l],t[l]))return!1;return!0}if(s!=c)return!1;var f=e instanceof Date,p=t instanceof Date;if(f!=p)return!1;if(f&&p)return e.getTime()==t.getTime();var m=e instanceof RegExp,h=t instanceof RegExp;if(m!=h)return!1;if(m&&h)return e.toString()==t.toString();var g=r(e);if(u=g.length,u!==r(t).length)return!1;for(l=u;l--!==0;)if(!i.call(t,g[l]))return!1;if(a&&e instanceof Element&&t instanceof Element)return e===t;for(l=u;l--!==0;)if(d=g[l],!(d===`_owner`&&e.$$typeof)&&!o(e[d],t[d]))return!1;return!0}return e!==e&&t!==t}t.exports=function(e,t){try{return o(e,t)}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||e.number===-2146828260)return console.warn(`Warning: react-fast-compare does not handle circular references.`,e.name,e.message),!1;throw e}}})),wl=e.T(Cl()),Tl=process.env.NODE_ENV===`production`;function El(e,t){if(!Tl){if(e)return;var n=`Warning: `+t;typeof console<`u`&&console.warn(n);try{throw Error(n)}catch{}}}var Dl=4;function Ol(e){return yl(e,Dl)}function kl(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var Al=`[object Symbol]`;function jl(e){return typeof e==`symbol`||Ki(e)&&Ui(e)==Al}var Ml=`Expected a function`;function Nl(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(Ml);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Nl.Cache||$a),n}Nl.Cache=$a;var Pl=500;function Fl(e){var t=Nl(e,function(e){return n.size===Pl&&n.clear(),e}),n=t.cache;return t}var Il=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ll=/\\(\\)?/g,Rl=Fl(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(Il,function(e,n,r,i){t.push(r?i.replace(Ll,`$1`):n||e)}),t}),zl=1/0;function Bl(e){if(typeof e==`string`||jl(e))return e;var t=e+``;return t==`0`&&1/e==-zl?`-0`:t}var Vl=1/0,Hl=Mi?Mi.prototype:void 0,Ul=Hl?Hl.toString:void 0;function Wl(e){if(typeof e==`string`)return e;if(_o(e))return kl(e,Wl)+``;if(jl(e))return Ul?Ul.call(e):``;var t=e+``;return t==`0`&&1/e==-Vl?`-0`:t}function Gl(e){return e==null?``:Wl(e)}function Kl(e){return _o(e)?kl(e,Bl):jl(e)?[e]:Es(Rl(Gl(e)))}var ql=e.w((e=>{var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:switch(e=e.type,e){case l:case u:case i:case o:case a:case f:return e;default:switch(e&&=e.$$typeof,e){case c:case d:case h:case m:case s:return e;default:return t}}case r:return t}}}function x(e){return b(e)===u}e.AsyncMode=l,e.ConcurrentMode=u,e.ContextConsumer=c,e.ContextProvider=s,e.Element=n,e.ForwardRef=d,e.Fragment=i,e.Lazy=h,e.Memo=m,e.Portal=r,e.Profiler=o,e.StrictMode=a,e.Suspense=f,e.isAsyncMode=function(e){return x(e)||b(e)===l},e.isConcurrentMode=x,e.isContextConsumer=function(e){return b(e)===c},e.isContextProvider=function(e){return b(e)===s},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===n},e.isForwardRef=function(e){return b(e)===d},e.isFragment=function(e){return b(e)===i},e.isLazy=function(e){return b(e)===h},e.isMemo=function(e){return b(e)===m},e.isPortal=function(e){return b(e)===r},e.isProfiler=function(e){return b(e)===o},e.isStrictMode=function(e){return b(e)===a},e.isSuspense=function(e){return b(e)===f},e.isValidElementType=function(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=b})),Jl=e.w((e=>{process.env.NODE_ENV!==`production`&&(function(){"use strict";var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)}function x(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:var p=e.type;switch(p){case l:case u:case i:case o:case a:case f:return p;default:var g=p&&p.$$typeof;switch(g){case c:case d:case h:case m:case s:return g;default:return t}}case r:return t}}}var S=l,C=u,w=c,T=s,E=n,D=d,O=i,k=h,A=m,j=r,M=o,N=a,ee=f,P=!1;function F(e){return P||(P=!0,console.warn(`The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.`)),I(e)||x(e)===l}function I(e){return x(e)===u}function L(e){return x(e)===c}function te(e){return x(e)===s}function ne(e){return typeof e==`object`&&!!e&&e.$$typeof===n}function R(e){return x(e)===d}function re(e){return x(e)===i}function ie(e){return x(e)===h}function z(e){return x(e)===m}function ae(e){return x(e)===r}function oe(e){return x(e)===o}function se(e){return x(e)===a}function ce(e){return x(e)===f}e.AsyncMode=S,e.ConcurrentMode=C,e.ContextConsumer=w,e.ContextProvider=T,e.Element=E,e.ForwardRef=D,e.Fragment=O,e.Lazy=k,e.Memo=A,e.Portal=j,e.Profiler=M,e.StrictMode=N,e.Suspense=ee,e.isAsyncMode=F,e.isConcurrentMode=I,e.isContextConsumer=L,e.isContextProvider=te,e.isElement=ne,e.isForwardRef=R,e.isFragment=re,e.isLazy=ie,e.isMemo=z,e.isPortal=ae,e.isProfiler=oe,e.isStrictMode=se,e.isSuspense=ce,e.isValidElementType=b,e.typeOf=x})()})),Yl=e.w(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=ql():t.exports=Jl()}));e.w(((e,t)=>{var n=Yl(),r={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},o={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};s[n.ForwardRef]=a,s[n.Memo]=o;function c(e){return n.isMemo(e)?o:s[e.$$typeof]||r}var l=Object.defineProperty,u=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,m=Object.prototype;function h(e,t,n){if(typeof t!=`string`){if(m){var r=p(t);r&&r!==m&&h(e,r,n)}var a=u(t);d&&(a=a.concat(d(t)));for(var o=c(e),s=c(t),g=0;g<a.length;++g){var _=a[g];if(!i[_]&&!(n&&n[_])&&!(s&&s[_])&&!(o&&o[_])){var v=f(t,_);try{l(e,_,v)}catch{}}}}return e}t.exports=h}))();function X(){return X=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},X.apply(this,arguments)}function Xl(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function Zl(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function Ql(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}var $l=(0,t.createContext)(void 0);$l.displayName=`FormikContext`,$l.Provider,$l.Consumer;function eu(){var e=(0,t.useContext)($l);return!e&&(process.env.NODE_ENV===`production`?El(!1):El(!1,`Formik context is undefined, please verify you are calling useFormikContext() as child of a <Formik> component.`)),e}var tu=function(e){return Array.isArray(e)&&e.length===0},Z=function(e){return typeof e==`function`},nu=function(e){return typeof e==`object`&&!!e},ru=function(e){return String(Math.floor(Number(e)))===e},iu=function(e){return Object.prototype.toString.call(e)===`[object String]`},au=function(e){return t.Children.count(e)===0},ou=function(e){return nu(e)&&Z(e.then)};function su(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Q(e,t,n,r){r===void 0&&(r=0);for(var i=Kl(t);e&&r<i.length;)e=e[i[r++]];return r!==i.length&&!e||e===void 0?n:e}function cu(e,t,n){for(var r=Ol(e),i=r,a=0,o=Kl(t);a<o.length-1;a++){var s=o[a],c=Q(e,o.slice(0,a+1));if(c&&(nu(c)||Array.isArray(c)))i=i[s]=Ol(c);else{var l=o[a+1];i=i[s]=ru(l)&&Number(l)>=0?[]:{}}}return(a===0?e:i)[o[a]]===n?e:(n===void 0?delete i[o[a]]:i[o[a]]=n,a===0&&n===void 0&&delete r[o[a]],r)}function lu(e,t,n,r){n===void 0&&(n=new WeakMap),r===void 0&&(r={});for(var i=0,a=Object.keys(e);i<a.length;i++){var o=a[i],s=e[o];nu(s)?n.get(s)||(n.set(s,!0),r[o]=Array.isArray(s)?[]:{},lu(s,t,n,r[o])):r[o]=t}return r}function uu(e,t){switch(t.type){case`SET_VALUES`:return X({},e,{values:t.payload});case`SET_TOUCHED`:return X({},e,{touched:t.payload});case`SET_ERRORS`:return(0,wl.default)(e.errors,t.payload)?e:X({},e,{errors:t.payload});case`SET_STATUS`:return X({},e,{status:t.payload});case`SET_ISSUBMITTING`:return X({},e,{isSubmitting:t.payload});case`SET_ISVALIDATING`:return X({},e,{isValidating:t.payload});case`SET_FIELD_VALUE`:return X({},e,{values:cu(e.values,t.payload.field,t.payload.value)});case`SET_FIELD_TOUCHED`:return X({},e,{touched:cu(e.touched,t.payload.field,t.payload.value)});case`SET_FIELD_ERROR`:return X({},e,{errors:cu(e.errors,t.payload.field,t.payload.value)});case`RESET_FORM`:return X({},e,t.payload);case`SET_FORMIK_STATE`:return t.payload(e);case`SUBMIT_ATTEMPT`:return X({},e,{touched:lu(e.values,!0),isSubmitting:!0,submitCount:e.submitCount+1});case`SUBMIT_FAILURE`:return X({},e,{isSubmitting:!1});case`SUBMIT_SUCCESS`:return X({},e,{isSubmitting:!1});default:return e}}var du={},fu={};function pu(e){var n=e.validateOnChange,r=n===void 0?!0:n,i=e.validateOnBlur,a=i===void 0?!0:i,o=e.validateOnMount,s=o===void 0?!1:o,c=e.isInitialValid,l=e.enableReinitialize,u=l===void 0?!1:l,d=e.onSubmit,f=Zl(e,[`validateOnChange`,`validateOnBlur`,`validateOnMount`,`isInitialValid`,`enableReinitialize`,`onSubmit`]),p=X({validateOnChange:r,validateOnBlur:a,validateOnMount:s,onSubmit:d},f),m=(0,t.useRef)(p.initialValues),h=(0,t.useRef)(p.initialErrors||du),g=(0,t.useRef)(p.initialTouched||fu),_=(0,t.useRef)(p.initialStatus),v=(0,t.useRef)(!1),y=(0,t.useRef)({});process.env.NODE_ENV!==`production`&&(0,t.useEffect)(function(){c!==void 0&&(process.env.NODE_ENV===`production`?El(!1):El(!1,`isInitialValid has been deprecated and will be removed in future versions of Formik. Please use initialErrors or validateOnMount instead.`))},[]),(0,t.useEffect)(function(){return v.current=!0,function(){v.current=!1}},[]);var b=(0,t.useState)(0)[1],x=(0,t.useRef)({values:Sl(p.initialValues),errors:Sl(p.initialErrors)||du,touched:Sl(p.initialTouched)||fu,status:Sl(p.initialStatus),isSubmitting:!1,isValidating:!1,submitCount:0}),S=x.current,C=(0,t.useCallback)(function(e){var t=x.current;x.current=uu(t,e),t!==x.current&&b(function(e){return e+1})},[]),w=(0,t.useCallback)(function(e,t){return new Promise(function(n,r){var i=p.validate(e,t);i==null?n(du):ou(i)?i.then(function(e){n(e||du)},function(e){process.env.NODE_ENV!==`production`&&console.warn(`Warning: An unhandled error was caught during validation in <Formik validate />`,e),r(e)}):n(i)})},[p.validate]),T=(0,t.useCallback)(function(e,t){var n=p.validationSchema,r=Z(n)?n(t):n,i=t&&r.validateAt?r.validateAt(t,e):gu(e,r);return new Promise(function(e,t){i.then(function(){e(du)},function(n){n.name===`ValidationError`?e(hu(n)):(process.env.NODE_ENV!==`production`&&console.warn(`Warning: An unhandled error was caught during validation in <Formik validationSchema />`,n),t(n))})})},[p.validationSchema]),E=(0,t.useCallback)(function(e,t){return new Promise(function(n){return n(y.current[e].validate(t))})},[]),D=(0,t.useCallback)(function(e){var t=Object.keys(y.current).filter(function(e){return Z(y.current[e].validate)}),n=t.length>0?t.map(function(t){return E(t,Q(e,t))}):[Promise.resolve(`DO_NOT_DELETE_YOU_WILL_BE_FIRED`)];return Promise.all(n).then(function(e){return e.reduce(function(e,n,r){return n===`DO_NOT_DELETE_YOU_WILL_BE_FIRED`||n&&(e=cu(e,t[r],n)),e},{})})},[E]),O=(0,t.useCallback)(function(e){return Promise.all([D(e),p.validationSchema?T(e):{},p.validate?w(e):{}]).then(function(e){var t=e[0],n=e[1],r=e[2];return Oi.all([t,n,r],{arrayMerge:vu})})},[p.validate,p.validationSchema,D,w,T]),k=Su(function(e){return e===void 0&&(e=S.values),C({type:`SET_ISVALIDATING`,payload:!0}),O(e).then(function(e){return v.current&&(C({type:`SET_ISVALIDATING`,payload:!1}),C({type:`SET_ERRORS`,payload:e})),e})});(0,t.useEffect)(function(){s&&v.current===!0&&(0,wl.default)(m.current,p.initialValues)&&k(m.current)},[s,k]);var A=(0,t.useCallback)(function(e){var t=e&&e.values?e.values:m.current,n=e&&e.errors?e.errors:h.current?h.current:p.initialErrors||{},r=e&&e.touched?e.touched:g.current?g.current:p.initialTouched||{},i=e&&e.status?e.status:_.current?_.current:p.initialStatus;m.current=t,h.current=n,g.current=r,_.current=i;var a=function(){C({type:`RESET_FORM`,payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:n,touched:r,status:i,values:t,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&typeof e.submitCount==`number`?e.submitCount:0}})};if(p.onReset){var o=p.onReset(S.values,B);ou(o)?o.then(a):a()}else a()},[p.initialErrors,p.initialStatus,p.initialTouched,p.onReset]);(0,t.useEffect)(function(){v.current===!0&&!(0,wl.default)(m.current,p.initialValues)&&u&&(m.current=p.initialValues,A(),s&&k(m.current))},[u,p.initialValues,A,s,k]),(0,t.useEffect)(function(){u&&v.current===!0&&!(0,wl.default)(h.current,p.initialErrors)&&(h.current=p.initialErrors||du,C({type:`SET_ERRORS`,payload:p.initialErrors||du}))},[u,p.initialErrors]),(0,t.useEffect)(function(){u&&v.current===!0&&!(0,wl.default)(g.current,p.initialTouched)&&(g.current=p.initialTouched||fu,C({type:`SET_TOUCHED`,payload:p.initialTouched||fu}))},[u,p.initialTouched]),(0,t.useEffect)(function(){u&&v.current===!0&&!(0,wl.default)(_.current,p.initialStatus)&&(_.current=p.initialStatus,C({type:`SET_STATUS`,payload:p.initialStatus}))},[u,p.initialStatus,p.initialTouched]);var j=Su(function(e){if(y.current[e]&&Z(y.current[e].validate)){var t=Q(S.values,e),n=y.current[e].validate(t);return ou(n)?(C({type:`SET_ISVALIDATING`,payload:!0}),n.then(function(e){return e}).then(function(t){C({type:`SET_FIELD_ERROR`,payload:{field:e,value:t}}),C({type:`SET_ISVALIDATING`,payload:!1})})):(C({type:`SET_FIELD_ERROR`,payload:{field:e,value:n}}),Promise.resolve(n))}else if(p.validationSchema)return C({type:`SET_ISVALIDATING`,payload:!0}),T(S.values,e).then(function(e){return e}).then(function(t){C({type:`SET_FIELD_ERROR`,payload:{field:e,value:Q(t,e)}}),C({type:`SET_ISVALIDATING`,payload:!1})});return Promise.resolve()}),M=(0,t.useCallback)(function(e,t){var n=t.validate;y.current[e]={validate:n}},[]),N=(0,t.useCallback)(function(e){delete y.current[e]},[]),ee=Su(function(e,t){return C({type:`SET_TOUCHED`,payload:e}),(t===void 0?a:t)?k(S.values):Promise.resolve()}),P=(0,t.useCallback)(function(e){C({type:`SET_ERRORS`,payload:e})},[]),F=Su(function(e,t){var n=Z(e)?e(S.values):e;return C({type:`SET_VALUES`,payload:n}),(t===void 0?r:t)?k(n):Promise.resolve()}),I=(0,t.useCallback)(function(e,t){C({type:`SET_FIELD_ERROR`,payload:{field:e,value:t}})},[]),L=Su(function(e,t,n){var i=Z(t)?t(Q(S.values,e)):t;return C({type:`SET_FIELD_VALUE`,payload:{field:e,value:i}}),(n===void 0?r:n)?k(cu(S.values,e,i)):Promise.resolve()}),te=(0,t.useCallback)(function(e,t){var n=t,r=e,i;if(!iu(e)){e.persist&&e.persist();var a=e.target?e.target:e.currentTarget,o=a.type,s=a.name,c=a.id,l=a.value,u=a.checked,d=a.outerHTML,f=a.options,p=a.multiple;n=t||s||c,!n&&process.env.NODE_ENV!==`production`&&mu({htmlContent:d,documentationAnchorLink:`handlechange-e-reactchangeeventany--void`,handlerName:`handleChange`}),r=/number|range/.test(o)?(i=parseFloat(l),isNaN(i)?``:i):/checkbox/.test(o)?bu(Q(S.values,n),u,l):f&&p?yu(f):l}n&&L(n,r)},[L,S.values]),ne=Su(function(e){if(iu(e))return function(t){return te(t,e)};te(e)}),R=Su(function(e,t,n){return t===void 0&&(t=!0),C({type:`SET_FIELD_TOUCHED`,payload:{field:e,value:t}}),(n===void 0?a:n)?k(S.values):Promise.resolve()}),re=(0,t.useCallback)(function(e,t){e.persist&&e.persist();var n=e.target,r=n.name,i=n.id,a=n.outerHTML,o=t||r||i;!o&&process.env.NODE_ENV!==`production`&&mu({htmlContent:a,documentationAnchorLink:`handleblur-e-any--void`,handlerName:`handleBlur`}),R(o,!0)},[R]),ie=Su(function(e){if(iu(e))return function(t){return re(t,e)};re(e)}),z=(0,t.useCallback)(function(e){Z(e)?C({type:`SET_FORMIK_STATE`,payload:e}):C({type:`SET_FORMIK_STATE`,payload:function(){return e}})},[]),ae=(0,t.useCallback)(function(e){C({type:`SET_STATUS`,payload:e})},[]),oe=(0,t.useCallback)(function(e){C({type:`SET_ISSUBMITTING`,payload:e})},[]),se=Su(function(){return C({type:`SUBMIT_ATTEMPT`}),k().then(function(e){var t=e instanceof Error;if(!t&&Object.keys(e).length===0){var n;try{if(n=le(),n===void 0)return}catch(e){throw e}return Promise.resolve(n).then(function(e){return v.current&&C({type:`SUBMIT_SUCCESS`}),e}).catch(function(e){if(v.current)throw C({type:`SUBMIT_FAILURE`}),e})}else if(v.current&&(C({type:`SUBMIT_FAILURE`}),t))throw e})}),ce=Su(function(e){if(e&&e.preventDefault&&Z(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&Z(e.stopPropagation)&&e.stopPropagation(),process.env.NODE_ENV!==`production`&&typeof document<`u`){var t=su();t!==null&&t instanceof HTMLButtonElement&&!(t.attributes&&t.attributes.getNamedItem(`type`))&&(process.env.NODE_ENV===`production`?El(!1):El(!1,'You submitted a Formik form using a button with an unspecified `type` attribute. Most browsers default button elements to `type="submit"`. If this is not a submit button, please add `type="button"`.'))}se().catch(function(e){console.warn(`Warning: An unhandled error was caught from submitForm()`,e)})}),B={resetForm:A,validateForm:k,validateField:j,setErrors:P,setFieldError:I,setFieldTouched:R,setFieldValue:L,setStatus:ae,setSubmitting:oe,setTouched:ee,setValues:F,setFormikState:z,submitForm:se},le=Su(function(){return d(S.values,B)}),ue=Su(function(e){e&&e.preventDefault&&Z(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&Z(e.stopPropagation)&&e.stopPropagation(),A()}),de=(0,t.useCallback)(function(e){return{value:Q(S.values,e),error:Q(S.errors,e),touched:!!Q(S.touched,e),initialValue:Q(m.current,e),initialTouched:!!Q(g.current,e),initialError:Q(h.current,e)}},[S.errors,S.touched,S.values]),fe=(0,t.useCallback)(function(e){return{setValue:function(t,n){return L(e,t,n)},setTouched:function(t,n){return R(e,t,n)},setError:function(t){return I(e,t)}}},[L,R,I]),pe=(0,t.useCallback)(function(e){var t=nu(e),n=t?e.name:e,r=Q(S.values,n),i={name:n,value:r,onChange:ne,onBlur:ie};if(t){var a=e.type,o=e.value,s=e.as,c=e.multiple;a===`checkbox`?o===void 0?i.checked=!!r:(i.checked=!!(Array.isArray(r)&&~r.indexOf(o)),i.value=o):a===`radio`?(i.checked=r===o,i.value=o):s===`select`&&c&&(i.value=i.value||[],i.multiple=!0)}return i},[ie,ne,S.values]),me=(0,t.useMemo)(function(){return!(0,wl.default)(m.current,S.values)},[m.current,S.values]),he=(0,t.useMemo)(function(){return c===void 0||me?S.errors&&Object.keys(S.errors).length===0:c!==!1&&Z(c)?c(p):c},[c,me,S.errors,p]);return X({},S,{initialValues:m.current,initialErrors:h.current,initialTouched:g.current,initialStatus:_.current,handleBlur:ie,handleChange:ne,handleReset:ue,handleSubmit:ce,resetForm:A,setErrors:P,setFormikState:z,setFieldTouched:R,setFieldValue:L,setFieldError:I,setStatus:ae,setSubmitting:oe,setTouched:ee,setValues:F,submitForm:se,validateForm:k,validateField:j,isValid:he,dirty:me,unregisterField:N,registerField:M,getFieldProps:pe,getFieldMeta:de,getFieldHelpers:fe,validateOnBlur:a,validateOnChange:r,validateOnMount:s})}function mu(e){var t=e.htmlContent,n=e.documentationAnchorLink,r=e.handlerName;console.warn("Warning: Formik called `"+r+"`, but you forgot to pass an `id` or `name` attribute to your input:\n "+t+`
30
30
  Formik cannot determine which value to update. For more info see https://formik.org/docs/api/formik#`+n+`
31
- `)}function hu(e){var t={};if(e.inner){if(e.inner.length===0)return cu(t,e.path,e.message);for(var n=e.inner,r=Array.isArray(n),i=0,n=r?n:n[Symbol.iterator]();;){var a;if(r){if(i>=n.length)break;a=n[i++]}else{if(i=n.next(),i.done)break;a=i.value}var o=a;Q(t,o.path)||(t=cu(t,o.path,o.message))}}return t}function gu(e,t,n,r){n===void 0&&(n=!1);var i=_u(e);return t[n?`validateSync`:`validate`](i,{abortEarly:!1,context:r||i})}function _u(e){var t=Array.isArray(e)?[]:{};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=String(n);Array.isArray(e[r])===!0?t[r]=e[r].map(function(e){return Array.isArray(e)===!0||$i(e)?_u(e):e===``?void 0:e}):$i(e[r])?t[r]=_u(e[r]):t[r]=e[r]===``?void 0:e[r]}return t}function vu(e,t,n){var r=e.slice();return t.forEach(function(t,i){r[i]===void 0?r[i]=n.clone!==!1&&n.isMergeableObject(t)?Oi(Array.isArray(t)?[]:{},t,n):t:n.isMergeableObject(t)?r[i]=Oi(e[i],t,n):e.indexOf(t)===-1&&r.push(t)}),r}function yu(e){return Array.from(e).filter(function(e){return e.selected}).map(function(e){return e.value})}function bu(e,t,n){if(typeof e==`boolean`)return!!t;var r=[],i=!1,a=-1;if(Array.isArray(e))r=e,a=e.indexOf(n),i=a>=0;else if(!n||n==`true`||n==`false`)return!!t;return t&&n&&!i?r.concat(n):i?r.slice(0,a).concat(r.slice(a+1)):r}var xu=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?t.useLayoutEffect:t.useEffect;function Su(e){var n=(0,t.useRef)(e);return xu(function(){n.current=e}),(0,t.useCallback)(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.current.apply(void 0,t)},[])}var Cu=(0,t.forwardRef)(function(e,n){var r=e.action,i=Zl(e,[`action`]),a=r??`#`,o=eu(),s=o.handleReset,c=o.handleSubmit;return(0,t.createElement)(`form`,X({onSubmit:c,ref:n,onReset:s,action:a},i))});Cu.displayName=`Form`;var wu=function(e,t,n){var r=Ou(e),i=r[t];return r.splice(t,1),r.splice(n,0,i),r},Tu=function(e,t,n){var r=Ou(e),i=r[t];return r[t]=r[n],r[n]=i,r},Eu=function(e,t,n){var r=Ou(e);return r.splice(t,0,n),r},Du=function(e,t,n){var r=Ou(e);return r[t]=n,r},Ou=function(e){if(!e)return[];if(Array.isArray(e))return[].concat(e);var t=Object.keys(e).map(function(e){return parseInt(e)}).reduce(function(e,t){return t>e?t:e},0);return Array.from(X({},e,{length:t+1}))},ku=function(e,t){var n=typeof e==`function`?e:t;return function(e){return Array.isArray(e)||nu(e)?n(Ou(e)):e}},Au=function(e){Xl(n,e);function n(t){var n=e.call(this,t)||this;return n.updateArrayField=function(e,t,r){var i=n.props,a=i.name,o=i.formik.setFormikState;o(function(n){var i=ku(r,e),o=ku(t,e),s=cu(n.values,a,e(Q(n.values,a))),c=r?i(Q(n.errors,a)):void 0,l=t?o(Q(n.touched,a)):void 0;return tu(c)&&(c=void 0),tu(l)&&(l=void 0),X({},n,{values:s,errors:r?cu(n.errors,a,c):n.errors,touched:t?cu(n.touched,a,l):n.touched})})},n.push=function(e){return n.updateArrayField(function(t){return[].concat(Ou(t),[Sl(e)])},!1,!1)},n.handlePush=function(e){return function(){return n.push(e)}},n.swap=function(e,t){return n.updateArrayField(function(n){return Tu(n,e,t)},!0,!0)},n.handleSwap=function(e,t){return function(){return n.swap(e,t)}},n.move=function(e,t){return n.updateArrayField(function(n){return wu(n,e,t)},!0,!0)},n.handleMove=function(e,t){return function(){return n.move(e,t)}},n.insert=function(e,t){return n.updateArrayField(function(n){return Eu(n,e,t)},function(t){return Eu(t,e,null)},function(t){return Eu(t,e,null)})},n.handleInsert=function(e,t){return function(){return n.insert(e,t)}},n.replace=function(e,t){return n.updateArrayField(function(n){return Du(n,e,t)},!1,!1)},n.handleReplace=function(e,t){return function(){return n.replace(e,t)}},n.unshift=function(e){var t=-1;return n.updateArrayField(function(n){var r=n?[e].concat(n):[e];return t=r.length,r},function(e){return e?[null].concat(e):[null]},function(e){return e?[null].concat(e):[null]}),t},n.handleUnshift=function(e){return function(){return n.unshift(e)}},n.handleRemove=function(e){return function(){return n.remove(e)}},n.handlePop=function(){return function(){return n.pop()}},n.remove=n.remove.bind(Ql(n)),n.pop=n.pop.bind(Ql(n)),n}var r=n.prototype;return r.componentDidUpdate=function(e){this.props.validateOnChange&&this.props.formik.validateOnChange&&!(0,wl.default)(Q(e.formik.values,e.name),Q(this.props.formik.values,this.props.name))&&this.props.formik.validateForm(this.props.formik.values)},r.remove=function(e){var t;return this.updateArrayField(function(n){var r=n?Ou(n):[];return t||=r[e],Z(r.splice)&&r.splice(e,1),Z(r.every)&&r.every(function(e){return e===void 0})?[]:r},!0,!0),t},r.pop=function(){var e;return this.updateArrayField(function(t){var n=t.slice();return e||=n&&n.pop&&n.pop(),n},!0,!0),e},r.render=function(){var e={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},n=this.props,r=n.component,i=n.render,a=n.children,o=n.name,s=n.formik,c=Zl(s,[`validate`,`validationSchema`]),l=X({},e,{form:c,name:o});return r?(0,t.createElement)(r,l):i?i(l):a?typeof a==`function`?a(l):au(a)?null:t.Children.only(a):null},n}(t.Component);Au.defaultProps={validateOnChange:!0};var ju=e.w(((t,n)=>{var r=e.y(),i=e.g(),a=`[object Symbol]`;function o(e){return typeof e==`symbol`||i(e)&&r(e)==a}n.exports=o})),Mu=e.w(((t,n)=>{var r=e.h(),i=ju(),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/;function s(e,t){if(r(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||i(e)?!0:o.test(e)||!a.test(e)||t!=null&&e in Object(t)}n.exports=s})),Nu=e.w(((t,n)=>{var r=e._(),i=`Expected a function`;function a(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(i);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(a.Cache||r),n}a.Cache=r,n.exports=a})),Pu=e.w(((e,t)=>{var n=Nu(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),Fu=e.w(((e,t)=>{var n=Pu(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),Iu=e.w(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}t.exports=n})),Lu=e.w(((t,n)=>{var r=e.b(),i=Iu(),a=e.h(),o=ju(),s=1/0,c=r?r.prototype:void 0,l=c?c.toString:void 0;function u(e){if(typeof e==`string`)return e;if(a(e))return i(e,u)+``;if(o(e))return l?l.call(e):``;var t=e+``;return t==`0`&&1/e==-s?`-0`:t}n.exports=u})),Ru=e.w(((e,t)=>{var n=Lu();function r(e){return e==null?``:n(e)}t.exports=r})),zu=e.w(((t,n)=>{var r=e.h(),i=Mu(),a=Fu(),o=Ru();function s(e,t){return r(e)?e:i(e,t)?[e]:a(o(e))}n.exports=s})),Bu=e.w(((e,t)=>{var n=ju(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),Vu=e.w(((e,t)=>{var n=zu(),r=Bu();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i<a;)e=e[r(t[i++])];return i&&i==a?e:void 0}t.exports=i})),Hu=e.w(((e,t)=>{var n=Vu();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),Uu=e.T(Hu(),1),Wu=(e=16)=>{let t={upper:`ABCDEFGHIJKLMNOPQRSTUVWXYZ`,lower:`abcdefghijklmnopqrstuvwxyz`,numbers:`0123456789`,symbols:`!@%^&*()_+[]{}|;:,.<>?`},n=t.upper+t.lower+t.numbers+t.symbols,r=e=>e[crypto.getRandomValues(new Uint32Array(1))[0]%e.length],i=[r(t.upper),r(t.lower),r(t.numbers),r(t.symbols)];for(let t=4;t<e;t++)i.push(r(n));for(let e=i.length-1;e>0;e--){let t=crypto.getRandomValues(new Uint32Array(1))[0]%(e+1),n=i[e];i[e]=i[t],i[t]=n}return i.join(``)},Gu=({showPassword:e,onToggleVisibility:t,onGenerate:n})=>(0,i.jsxs)(r.InputAdornment,{position:`end`,children:[n&&(0,i.jsx)(r.Tooltip,{title:`Generate Password`,children:(0,i.jsx)(r.IconButton,{onClick:n,edge:`end`,size:`small`,sx:{opacity:.7},"aria-label":`generate password`,children:(0,i.jsx)(Jr,{})})}),(0,i.jsx)(r.Tooltip,{title:e?`Hide password`:`Show password`,children:(0,i.jsx)(r.IconButton,{onClick:t,edge:`end`,size:`small`,sx:{opacity:.7},"aria-label":e?`hide password`:`show password`,children:e?(0,i.jsx)(pi,{}):(0,i.jsx)(fi,{})})})]}),Ku=({type:e,autoGenerate:t=!1,formik:r,name:i})=>{let[a,o]=(0,n.useState)(!1),s={},c=a?`text`:`password`;return e===`password`?(s.endAdornment=Gu({showPassword:a,onToggleVisibility:()=>{o(!a)},onGenerate:t?()=>{if(!r||!i)return;let e=Wu();r.setFieldValue(i,e),a||o(!0)}:void 0}),{inputType:c,inputProps:s}):{inputType:e,inputProps:s}},qu=({helperText:e,errorText:t,formik:a,name:o,defaultValue:s,onChange:c,type:l,fullWidth:u=!0,autoGenerate:d=!1,...f})=>{let p=Ku({type:l,autoGenerate:d,formik:a,name:o}),m={},h=f.value??s;if((0,n.useEffect)(()=>{!a||!o||h===void 0||a.setFieldValue(o,h)},[h]),o&&a){a.touched[o]&&(t??=a.errors[o]);let e=(0,Uu.default)(a.values,o,``);l===`date`&&(e=Ju(e)),m={value:e??``,onBlur:()=>a.setFieldTouched(o),onChange:e=>{let t=e.target.value;l===`date`&&t&&(t=new Date(t)),a.setFieldValue(o,t||null),c?.(e)},slotProps:{...f.slotProps,input:{...f.InputProps,...f.slotProps?.input,...p.inputProps},inputLabel:l===`date`?{shrink:!0}:void 0}}}return(0,i.jsx)(r.TextField,{variant:`standard`,onChange:c,...f,...m,name:o,type:p.inputType,fullWidth:u,helperText:t||e,error:!!t})},Ju=e=>{if(!e)return``;let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`},Yu=({multiple:t=!1,formik:a,name:o,label:s=`Search users`,disabled:c=!1,error:l,helperText:u,value:d,onChange:f})=>{let[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)([]),[_,v]=(0,n.useState)(!1),[y,b]=(0,n.useState)(``),x=(0,n.useCallback)(async t=>{if(t.length<2){g([]);return}v(!0);try{let n=e.a();if(!n)return;g(await n.searchUsers({name:t}))}catch(t){e.m.error(`Failed to search users:`,t),g([])}finally{v(!1)}},[]),S=(0,n.useCallback)((e,t)=>{b(t),x(t)},[x]),C=()=>d===void 0?a&&o?a.values[o]:t?[]:null:d,w=(e,t)=>{f?f(t):a&&o&&a.setFieldValue(o,t)},T=()=>{a&&o&&a.setFieldTouched(o)},E=()=>{if(l)return` `;if(a&&o&&a.touched[o]&&a.errors[o])return a.errors[o]};return(0,i.jsx)(r.Autocomplete,{open:p,onOpen:()=>m(!0),onClose:()=>m(!1),multiple:t,options:h,value:C(),onChange:w,onBlur:T,onInputChange:S,getOptionLabel:e=>e.name,isOptionEqualToValue:(e,t)=>e.id===t.id,loading:_,noOptionsText:y.length<3?`Type at least 3 characters to search`:`No users found`,renderOption:(e,t)=>(0,n.createElement)(r.Box,{component:`li`,...e,key:t.id},(0,i.jsxs)(r.Box,{children:[(0,i.jsx)(r.Typography,{variant:`body1`,children:t.name}),(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,children:t.email})]})),renderInput:e=>(0,i.jsx)(r.TextField,{...e,label:s,disabled:c,variant:`standard`,error:!!E(),helperText:E()||u,InputProps:{...e.InputProps,endAdornment:(0,i.jsxs)(i.Fragment,{children:[_?(0,i.jsx)(r.CircularProgress,{size:20}):null,e.InputProps.endAdornment]})}})})},Xu=e.S({name:e.C().trim().required(`Group name is required`).min(2,`Group name must be at least 2 characters`).max(100,`Group name must be at most 100 characters`)}),Zu=({open:t,onClose:a,onSuccess:s,orgId:c})=>{let[l,u]=(0,n.useState)(null),d=pu({initialValues:{name:``,read_only:!1,members:[]},validationSchema:Xu,onSubmit:async(t,{setSubmitting:n,resetForm:r})=>{u(null);try{let n=e.a();if(!n)return;let i=await n.createGroup(c,{name:t.name.trim(),read_only:t.read_only});t.members&&t.members.length>0&&await n.addGroupMembers(c,i.id,t.members.map(e=>({user:e.userId,role:e.role}))),r(),s?.(),a()}catch(e){u(o(e,`Failed to create group`))}n(!1)}}),f=e=>{let t=Array.isArray(e)?e:[];d.setFieldValue(`members`,t.map(e=>({userId:e.id,role:`member`,user:e})))},p=(e,t)=>{let n=d.values.members.map(n=>n.userId===e?{...n,role:t}:n);d.setFieldValue(`members`,n)},m=e=>{let t=d.values.members.filter(t=>t.userId!==e);d.setFieldValue(`members`,t)},h=()=>{d.resetForm(),a()};return(0,i.jsxs)(r.Dialog,{open:t,onClose:h,maxWidth:`sm`,fullWidth:!0,PaperProps:{component:`form`,onSubmit:d.handleSubmit},children:[(0,i.jsx)(r.DialogTitle,{children:`Create New Group`}),(0,i.jsx)(r.DialogContent,{children:(0,i.jsxs)(r.Box,{sx:{display:`flex`,flexDirection:`column`,gap:2,pt:1},children:[l&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>u(null),children:l.message}),(0,i.jsx)(qu,{label:`Group Name`,name:`name`,formik:d,required:!0,disabled:d.isSubmitting,placeholder:`e.g., Computer Science 101`}),(0,i.jsx)(r.FormControlLabel,{control:(0,i.jsx)(r.Switch,{name:`read_only`,checked:d.values.read_only,onChange:d.handleChange,disabled:d.isSubmitting}),label:`Read-only group (only moderators can post)`}),(0,i.jsx)(r.Divider,{sx:{my:2}}),(0,i.jsxs)(r.Box,{children:[(0,i.jsx)(r.Typography,{variant:`subtitle2`,gutterBottom:!0,children:`Add Members`}),(0,i.jsx)(Yu,{multiple:!0,label:`Search users to add`,value:d.values.members.map(e=>e.user),onChange:f,disabled:d.isSubmitting})]}),d.values.members.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Typography,{variant:`subtitle2`,gutterBottom:!0,children:`Selected Members`}),d.values.members.map(e=>(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,borderRadius:1},children:[(0,i.jsx)(r.Box,{sx:{flex:1},children:e.user.name}),(0,i.jsxs)(r.Select,{value:e.role,onChange:t=>p(e.userId,t.target.value),size:`small`,disabled:d.isSubmitting,sx:{mr:2},children:[(0,i.jsx)(r.MenuItem,{value:`member`,children:`Member`}),(0,i.jsx)(r.MenuItem,{value:`moderator`,children:`Moderator`})]}),(0,i.jsx)(r.IconButton,{size:`small`,onClick:()=>m(e.userId),disabled:d.isSubmitting,color:`error`,children:(0,i.jsx)(Qr,{})})]},e.userId))]})]})}),(0,i.jsxs)(r.DialogActions,{sx:{p:3},children:[(0,i.jsx)(r.Button,{onClick:h,disabled:d.isSubmitting,children:`Cancel`}),(0,i.jsx)(r.Button,{type:`submit`,variant:`contained`,disabled:d.isSubmitting||!d.isValid,startIcon:d.isSubmitting&&(0,i.jsx)(r.CircularProgress,{size:16}),children:`Create Group`})]})]})},Qu=async t=>{let n=e.a();if(!n)throw Error(`SDK not initialized`);let r=await n.getGroups(t);return await e.d.groups.clear(),await e.d.groups.bulkPut(r),r},$u=async(t,n,r)=>{let i=e.a();if(!i)throw Error(`SDK not initialized`);let a=await i.updateGroup(t,n,{name:r});return await e.d.groups.update(n,{name:a.name}),a},ed=async(t,n)=>{let r=e.a();if(!r)throw Error(`SDK not initialized`);await r.deleteGroup(t,n),await e.d.groups.delete(n),await e.d.summaries.filter(e=>e.group===n).delete()};function td(e,t,r){let i,a;typeof e==`function`?(i=t||[],a=r):(i=[],a=t);let o=n.default.useRef({hasResult:!1,result:a,error:null}),[s,c]=n.default.useReducer(e=>e+1,0),l=n.default.useMemo(()=>{let t=typeof e==`function`?e():e;if(!t||typeof t.subscribe!=`function`)throw TypeError(e===t?`Given argument to useObservable() was neither a valid observable nor a function.`:`Observable factory given to useObservable() did not return a valid observable.`);if(!o.current.hasResult&&typeof window<`u`&&(typeof t.hasValue!=`function`||t.hasValue()))if(typeof t.getValue==`function`)o.current.result=t.getValue(),o.current.hasResult=!0;else{let e=t.subscribe(e=>{o.current.result=e,o.current.hasResult=!0});typeof e==`function`?e():e.unsubscribe()}return t},i);if(n.default.useDebugValue(o.current.result),n.default.useEffect(()=>{let e=l.subscribe(e=>{let{current:t}=o;(t.error!==null||t.result!==e)&&(t.error=null,t.result=e,t.hasResult=!0,c())},e=>{let{current:t}=o;t.error!==e&&(t.error=e,c())});return typeof e==`function`?e:e.unsubscribe.bind(e)},i),o.current.error)throw o.current.error;return o.current.result}function nd(t,n,r){return td(()=>e.f.liveQuery(t),n||[],r)}typeof FinalizationRegistry<`u`&&new FinalizationRegistry(t=>{let n=e.f.DexieYProvider;n&&n.release(t)}),Reflect.get(n,`use`);var rd=({selectedConversation:t,currentUser:a,onConversationSelect:o})=>{let[s,c]=(0,n.useState)(!0),[l,u]=(0,n.useState)(),[d,f]=(0,n.useState)(!1),p=nd(()=>e.d.summaries.toArray(),[t])||[],m=nd(()=>e.d.groups.toArray(),[])||[],h=a?.role===`admin`||a?.role===`system`,g=(0,n.useCallback)(async()=>{c(!0),a?.org&&(await Promise.all([e.t({}),Qu(a?.org)]).catch(e=>{u(e instanceof Error?e:Error(String(e)))}),c(!1))},[a?.org]);(0,n.useEffect)(()=>{g();let e=setInterval(g,3*6e4);return()=>clearInterval(e)},[g]);let[_,v]=(0,n.useState)({});(0,n.useEffect)(()=>{p.length>0&&a?.org&&(async()=>{if(!a?.org)return;let t=e.a();if(!t)return;let n={};for(let r of p)try{if(r.user!==void 0&&!_[r.user]){let e=await t.getUser(r.user);n[r.user]=e.name}}catch(t){e.m.error(`Failed to load conversation name:`,t)}Object.keys(n).length>0&&v(e=>({...e,...n}))})()},[p,a?.org]);let y=e=>e.user===void 0?e.group===void 0?`Unknown`:m.find(t=>t.id===e.group)?.name||`Group ${e.group}`:_[e.user]||`User ${e.user}`,b=e=>t?e.group===void 0?e.user===void 0?!1:t.type===`dm`&&t.id===e.user:t.type===`group`&&t.id===e.group:!1,x=e=>{e.group===void 0?e.user!==void 0&&o({type:`dm`,id:e.user,name:y(e)}):o({type:`group`,id:e.group,name:y(e)})};return(0,i.jsxs)(r.Box,{display:`flex`,flexDirection:`column`,height:`100%`,children:[(0,i.jsx)(r.AppBar,{position:`static`,elevation:0,sx:{backgroundColor:`background.default`,color:`text.primary`},children:(0,i.jsxs)(r.Toolbar,{children:[(0,i.jsx)(r.Typography,{variant:`h6`,component:`div`,sx:{flexGrow:1},children:`Messages`}),h&&(0,i.jsx)(r.Tooltip,{title:`Create Group`,children:(0,i.jsx)(r.IconButton,{color:`primary`,onClick:()=>f(!0),size:`small`,sx:{mr:-2},children:(0,i.jsx)(Wr,{})})})]})}),h&&a?.org&&(0,i.jsx)(Zu,{open:d,onClose:()=>f(!1),onSuccess:async()=>{await g()},orgId:a.org}),(0,i.jsx)(r.Box,{flex:1,overflow:`auto`,children:s&&!p.length?(0,i.jsx)(r.List,{disablePadding:!0,children:[1,2,3,4,5].map(e=>(0,i.jsx)(_i,{},e))}):l?(0,i.jsx)(r.Box,{p:2,children:(0,i.jsxs)(r.Alert,{severity:`error`,children:[`Failed to load conversations: `,l.message]})}):p.length===0&&m.length===0?(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,p:2,children:(0,i.jsx)(r.Typography,{color:`text.secondary`,align:`center`,children:`No conversations yet`})}):(0,i.jsx)(r.List,{disablePadding:!0,children:(()=>{let e=new Set(p.filter(e=>e.group!==void 0).map(e=>e.group)),t=m.filter(t=>!e.has(t.id)).map(e=>({group:e.id,last_message_at:e.created_at,message_count:0,unread_count:0}));return[...[...p].sort((e,t)=>new Date(t.last_message_at).getTime()-new Date(e.last_message_at).getTime()),...t].map(e=>(0,i.jsx)(gi,{conversation:e,displayName:y(e),selected:b(e),onClick:()=>x(e),currentUser:a},e.group===void 0?`user-${e.user}`:`group-${e.group}`))})()})})]})},id=({displayName:e,type:t,subtitle:a,isConnected:o=!0,onBack:s,showJoinButton:c=!1,onJoin:l,joining:u=!1,showMembersButton:d=!1,onManageMembers:f,canManageGroup:p=!1,onRenameGroup:m,onDeleteGroup:h,deletingGroup:g=!1})=>{let _=t===`group`,[v,y]=(0,n.useState)(null),[b,x]=(0,n.useState)(null),S=e=>{y(e.currentTarget)},C=()=>{y(null)},w=e=>{l(e),C()};return(0,i.jsx)(r.AppBar,{position:`static`,elevation:0,sx:{backgroundColor:`background.default`,color:`text.primary`},children:(0,i.jsxs)(r.Toolbar,{children:[s&&(0,i.jsx)(r.IconButton,{edge:`start`,color:`inherit`,onClick:s,sx:{mr:2,display:{xs:`flex`,sm:`flex`,md:`none`}},children:(0,i.jsx)(Gr,{})}),(0,i.jsx)(r.Avatar,{sx:{bgcolor:_?`primary.main`:`secondary.main`,mr:2},children:_?(0,i.jsx)(ii,{}):(0,i.jsx)(si,{})}),(0,i.jsxs)(r.Box,{flex:1,children:[(0,i.jsx)(r.Typography,{variant:`h6`,component:`div`,noWrap:!0,children:e}),a&&(0,i.jsx)(r.Typography,{variant:`caption`,color:`inherit`,sx:{opacity:.7},children:a})]}),d&&_&&(0,i.jsx)(r.IconButton,{color:`inherit`,onClick:f,title:`Members`,sx:{mr:.5},children:(0,i.jsx)(oi,{})}),p&&_&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.IconButton,{color:`inherit`,onClick:e=>x(e.currentTarget),disabled:g,title:`Manage group`,children:(0,i.jsx)(ai,{})}),(0,i.jsxs)(r.Menu,{anchorEl:b,open:!!b,onClose:()=>x(null),children:[(0,i.jsxs)(r.MenuItem,{onClick:()=>{x(null),m?.()},children:[(0,i.jsx)(ni,{fontSize:`small`,sx:{mr:1}}),`Rename Group`]}),(0,i.jsxs)(r.MenuItem,{onClick:()=>{x(null),h?.()},sx:{color:`error.main`},children:[(0,i.jsx)(ei,{fontSize:`small`,sx:{mr:1}}),`Delete Group`]})]})]}),c&&_&&(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,mr:1},children:[(0,i.jsx)(r.Button,{variant:`contained`,color:`primary`,startIcon:(0,i.jsx)(ci,{}),endIcon:(0,i.jsx)(Kr,{}),onClick:S,disabled:u,children:u?`Joining...`:`Join`}),(0,i.jsxs)(r.Menu,{anchorEl:v,open:!!v,onClose:C,children:[(0,i.jsx)(r.MenuItem,{onClick:()=>w(`member`),children:`Member`}),(0,i.jsx)(r.MenuItem,{onClick:()=>w(`moderator`),children:`Moderator`})]})]}),!o&&(0,i.jsx)(r.Chip,{icon:(0,i.jsx)(mi,{}),label:`Disconnected`,size:`small`,color:`warning`,sx:{ml:1}})]})})},ad=({member:e,currentUserId:t,canManage:n,removing:a,updating:o,onRemove:s,onRoleChange:c})=>(0,i.jsxs)(r.ListItem,{secondaryAction:n?(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,i.jsxs)(r.Select,{value:e.role,onChange:t=>c(e.id,t.target.value),size:`small`,disabled:o||a,variant:`standard`,disableUnderline:!0,sx:{fontSize:12},children:[(0,i.jsx)(r.MenuItem,{value:`member`,children:`Member`}),(0,i.jsx)(r.MenuItem,{value:`moderator`,children:`Moderator`})]}),(0,i.jsx)(r.IconButton,{size:`small`,color:`error`,onClick:()=>s(e.id),disabled:a||o,children:a?(0,i.jsx)(r.CircularProgress,{size:16}):(0,i.jsx)($r,{fontSize:`small`})})]}):void 0,children:[(0,i.jsx)(r.Avatar,{sx:{mr:1.5,width:32,height:32,bgcolor:`primary.main`},children:(0,i.jsx)(si,{fontSize:`small`})}),(0,i.jsx)(r.ListItemText,{primary:(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,i.jsx)(r.Typography,{variant:`body1`,noWrap:!0,children:e.name}),e.id===t&&(0,i.jsx)(r.Typography,{variant:`caption`,color:`text.secondary`,children:`(you)`})]})})]}),od=({open:t,onClose:a,orgId:s,groupId:c,existingMemberIds:l,onSuccess:u})=>{let[d,f]=(0,n.useState)([]),[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)(null),_=()=>{f([]),g(null),a()},v=e=>{f((Array.isArray(e)?e:[]).filter(e=>!l.has(e.id)).map(e=>({id:e.id,role:`member`,user:e})))},y=(e,t)=>{f(n=>n.map(n=>n.id===e?{...n,role:t}:n))},b=e=>{f(t=>t.filter(t=>t.id!==e))};return(0,i.jsxs)(r.Dialog,{open:t,onClose:_,maxWidth:`xs`,fullWidth:!0,children:[(0,i.jsx)(r.DialogTitle,{children:`Add Members`}),(0,i.jsx)(r.DialogContent,{children:(0,i.jsxs)(r.Box,{sx:{display:`flex`,flexDirection:`column`,gap:2,pt:1},children:[h&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>g(null),children:h.message}),(0,i.jsx)(Yu,{multiple:!0,label:`Search users to add`,value:d.map(e=>e.user),onChange:v,disabled:p}),d.map(e=>(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,i.jsx)(r.Typography,{variant:`body2`,noWrap:!0,sx:{flex:1,mr:1},children:e.user.name}),(0,i.jsxs)(r.Select,{value:e.role,onChange:t=>y(e.id,t.target.value),size:`small`,disabled:p,sx:{mr:1},children:[(0,i.jsx)(r.MenuItem,{value:`member`,children:`Member`}),(0,i.jsx)(r.MenuItem,{value:`moderator`,children:`Moderator`})]}),(0,i.jsx)(r.IconButton,{size:`small`,color:`error`,onClick:()=>b(e.id),disabled:p,children:(0,i.jsx)(Qr,{fontSize:`small`})})]},e.id))]})}),(0,i.jsxs)(r.DialogActions,{sx:{p:2},children:[(0,i.jsx)(r.Button,{onClick:_,disabled:p,children:`Cancel`}),(0,i.jsx)(r.Button,{variant:`contained`,onClick:async()=>{if(d.length!==0){m(!0),g(null);try{await e.a()?.addGroupMembers(s,c,d.map(e=>({user:e.id,role:e.role}))),_(),u()}catch(e){g(o(e,`Failed to add members`))}finally{m(!1)}}},disabled:p||d.length===0,startIcon:p&&(0,i.jsx)(r.CircularProgress,{size:16}),children:p?`Adding...`:`Add${d.length>0?` ${d.length}`:``}`})]})]})},sd=({open:t,onClose:a,orgId:s,groupId:c,currentUserId:l,canManage:u})=>{let[d,f]=(0,n.useState)([]),[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)(null),[_,v]=(0,n.useState)(null),[y,b]=(0,n.useState)(null),[x,S]=(0,n.useState)(!1),C=(0,n.useCallback)(async()=>{m(!0),g(null);try{let t=e.a();if(!t)return;f(await t.getGroupMembers(s,c))}catch(e){g(o(e,`Failed to load members`))}finally{m(!1)}},[s,c]);(0,n.useEffect)(()=>{t&&C()},[t,C]);let w=async t=>{v(t);try{let n=e.a();if(!n)return;await n.removeGroupMember(s,c,t),f(e=>e.filter(e=>e.id!==t))}catch(e){g(o(e,`Failed to remove member`))}finally{v(null)}},T=async(t,n)=>{b(t);try{let r=e.a();if(!r)return;await r.addGroupMembers(s,c,[{user:t,role:n}]),f(e=>e.map(e=>e.id===t?{...e,role:n}:e))}catch(e){g(o(e,`Failed to update role`))}finally{b(null)}};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(r.Drawer,{anchor:`right`,open:t,onClose:a,slotProps:{paper:{sx:{width:360,maxWidth:`100vw`}}},children:[(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,px:2,py:1.5},children:[(0,i.jsx)(r.Typography,{variant:`h6`,children:`Members`}),(0,i.jsx)(r.IconButton,{size:`small`,onClick:a,children:(0,i.jsx)(Qr,{})})]}),(0,i.jsxs)(r.Box,{sx:{display:`flex`,flexDirection:`column`,overflow:`hidden`,flex:1},children:[h&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>g(null),sx:{m:2},children:h.message}),(0,i.jsx)(r.Box,{sx:{overflow:`auto`,flex:1},children:p?(0,i.jsx)(r.Box,{sx:{display:`flex`,justifyContent:`center`,mt:4},children:(0,i.jsx)(r.CircularProgress,{size:32})}):(0,i.jsxs)(r.List,{disablePadding:!0,children:[d.map(e=>(0,i.jsx)(ad,{member:e,currentUserId:l,canManage:u,removing:_===e.id,updating:y===e.id,onRemove:w,onRoleChange:T},e.id)),d.length===0&&(0,i.jsx)(r.Box,{sx:{p:3,textAlign:`center`},children:(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,children:`No members yet`})})]})}),u&&(0,i.jsx)(r.Box,{sx:{p:2,borderTop:1,borderColor:`divider`},children:(0,i.jsx)(r.Button,{variant:`outlined`,color:`secondary`,fullWidth:!0,onClick:()=>S(!0),children:`Add Members`})})]})]}),(0,i.jsx)(od,{open:x,onClose:()=>S(!1),orgId:s,groupId:c,existingMemberIds:new Set(d.map(e=>e.id)),onSuccess:C})]})};function cd(e){return(typeof e==`string`?new Date(e):e).toLocaleTimeString(`en-US`,{hour:`numeric`,minute:`2-digit`,hour12:!0})}function ld(e){let t=typeof e==`string`?new Date(e):e,n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(r);i.setDate(i.getDate()-1);let a=new Date(t.getFullYear(),t.getMonth(),t.getDate());return a.getTime()===r.getTime()?`Today`:a.getTime()===i.getTime()?`Yesterday`:a.getTime()>r.getTime()-10080*60*1e3?t.toLocaleDateString(`en-US`,{weekday:`long`}):t.getFullYear()===n.getFullYear()?t.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`}):t.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}var ud=({isOwnMessage:e,isLastInGroup:t,status:n,isOptimistic:r})=>{if(!e||!t)return null;let a={fontSize:14,ml:.5,opacity:.7,verticalAlign:`middle`};return n===`failed`?(0,i.jsx)(ri,{sx:{...a,color:`error.main`}}):n===`sending`||r?(0,i.jsx)(ui,{sx:a}):(0,i.jsx)(ti,{sx:a})},dd=n.default.memo(({message:t,isOwnMessage:n,senderName:a,showSenderName:o=!0,isFirstInGroup:s=!0,isLastInGroup:c=!0,status:l=`sent`,onImagePress:u})=>{let d=t.id.startsWith(`temp-`),f=(0,i.jsx)(r.Avatar,{sx:{width:32,height:32,fontSize:`0.875rem`,color:n?`primary.contrastText`:`secondary.contrastText`,bgcolor:n?`primary.main`:`secondary.main`,visibility:c?`visible`:`hidden`},children:e.l(a)}),p=t.media?.[0],m=!!p,h=!!t.content;return(0,i.jsxs)(r.Box,{display:`flex`,justifyContent:n?`flex-end`:`flex-start`,alignItems:`flex-end`,mb:c?1:.25,gap:1,children:[!n&&f,(0,i.jsxs)(r.Paper,{elevation:1,sx:{maxWidth:`80%`,overflow:`hidden`,backgroundColor:n?`primary.main`:`background.paper`,color:n?`primary.contrastText`:`text.primary`,borderTopLeftRadius:n||!s?void 0:4,borderTopRightRadius:!n||!s?void 0:4,borderBottomLeftRadius:n||!c?void 0:4,borderBottomRightRadius:!n||!c?void 0:4},children:[!n&&o&&s&&(0,i.jsx)(r.Typography,{variant:`caption`,fontWeight:`bold`,display:`block`,px:1.5,pt:1.5,children:a||`User ${t.sender}`}),m&&(0,i.jsxs)(r.Box,{p:`4px`,children:[(0,i.jsx)(r.Box,{component:`img`,src:p.thumbnail,alt:`attachment`,onClick:()=>u?.(t),sx:{display:`block`,width:`100%`,maxWidth:280,cursor:`pointer`,borderRadius:`4px`}}),c&&!h&&(0,i.jsxs)(r.Box,{display:`flex`,justifyContent:`flex-end`,alignItems:`center`,mt:.5,children:[(0,i.jsx)(r.Typography,{variant:`caption`,color:n?`inherit`:`text.secondary`,sx:{opacity:.7},children:cd(new Date(t.created_at))}),(0,i.jsx)(ud,{isOwnMessage:n,isLastInGroup:c,status:l,isOptimistic:d})]})]}),(h||!m&&c)&&(0,i.jsxs)(r.Box,{px:1.5,pt:m?.75:n||!o||!s?1.5:.5,pb:1.5,children:[h&&(0,i.jsx)(r.Typography,{variant:`body1`,sx:{whiteSpace:`pre-wrap`},children:t.content}),c&&(0,i.jsxs)(r.Box,{display:`flex`,justifyContent:`flex-end`,alignItems:`center`,mt:.5,children:[(0,i.jsx)(r.Typography,{variant:`caption`,color:n?`inherit`:`text.secondary`,sx:{opacity:.7},children:cd(new Date(t.created_at))}),(0,i.jsx)(ud,{isOwnMessage:n,isLastInGroup:c,status:l,isOptimistic:d})]})]})]}),n&&f]})}),fd=({src:e,open:t,onClose:a,alt:o=`Image`,senderName:s,onPrev:c,onNext:l})=>((0,n.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`ArrowLeft`?c?.():e.key===`ArrowRight`?l?.():e.key===`Escape`&&a()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,c,l,a]),(0,i.jsxs)(r.Dialog,{open:t,onClose:a,maxWidth:!1,PaperProps:{sx:{background:`rgba(0,0,0,0.9)`,boxShadow:`none`,m:0,maxWidth:`100vw`,maxHeight:`100vh`,width:`100vw`,height:`100vh`,borderRadius:0,display:`flex`,flexDirection:`column`}},children:[(0,i.jsxs)(r.Box,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,px:1,py:.5,sx:{flexShrink:0},children:[s?(0,i.jsx)(r.Typography,{variant:`subtitle1`,sx:{color:`white`,ml:1},children:s}):(0,i.jsx)(r.Box,{}),(0,i.jsx)(r.IconButton,{onClick:a,sx:{color:`white`},children:(0,i.jsx)(Qr,{fontSize:`large`})})]}),(0,i.jsxs)(r.Box,{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`,children:[(0,i.jsx)(r.IconButton,{onClick:c,disabled:!c,sx:{position:`absolute`,left:8,color:c?`white`:`rgba(255,255,255,0.25)`,bgcolor:`rgba(0,0,0,0.4)`,"&:hover":{bgcolor:`rgba(0,0,0,0.6)`},"&.Mui-disabled":{color:`rgba(255,255,255,0.2)`}},children:(0,i.jsx)(Xr,{fontSize:`large`})}),(0,i.jsx)(r.Box,{component:`img`,src:e,alt:o,sx:{maxWidth:`80vw`,maxHeight:`calc(100vh - 64px)`,objectFit:`contain`}}),(0,i.jsx)(r.IconButton,{onClick:l,disabled:!l,sx:{position:`absolute`,right:8,color:l?`white`:`rgba(255,255,255,0.25)`,bgcolor:`rgba(0,0,0,0.4)`,"&:hover":{bgcolor:`rgba(0,0,0,0.6)`},"&.Mui-disabled":{color:`rgba(255,255,255,0.2)`}},children:(0,i.jsx)(Zr,{fontSize:`large`})})]})]})),pd=({isOwnMessage:e=!1})=>(0,i.jsx)(r.Box,{display:`flex`,justifyContent:e?`flex-end`:`flex-start`,mb:1,children:(0,i.jsxs)(r.Box,{maxWidth:`70%`,children:[!e&&(0,i.jsx)(r.Skeleton,{variant:`text`,width:80,sx:{mb:.5}}),(0,i.jsx)(r.Skeleton,{variant:`rounded`,width:Math.random()*200+150,height:60,sx:{borderRadius:2,bgcolor:e?`primary.light`:`background.main`}})]})}),md=({hasMore:e,loading:t,onLoadMore:a,threshold:o=1,rootMargin:s=`100px`})=>{let c=(0,n.useRef)(null),l=(0,n.useRef)(null);return(0,n.useEffect)(()=>{if(!e||t)return;let n=c.current;if(n)return l.current=new IntersectionObserver(n=>{let[r]=n;r&&r.isIntersecting&&e&&!t&&a()},{threshold:o,rootMargin:s}),l.current.observe(n),()=>{l.current&&n&&(l.current.unobserve(n),l.current.disconnect())}},[e,t,a,o,s]),e?(0,i.jsx)(r.Box,{ref:c,display:`flex`,justifyContent:`center`,alignItems:`center`,py:2,children:t?(0,i.jsx)(r.CircularProgress,{size:24}):(0,i.jsx)(r.Typography,{variant:`caption`,color:`text.secondary`,children:`Scroll to load more`})}):null},hd=({date:e})=>(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,my:1.5,children:(0,i.jsx)(r.Typography,{variant:`caption`,color:`text.secondary`,fontWeight:500,sx:{userSelect:`none`,bgcolor:`background.paper`,px:1.5,py:.5,borderRadius:.5},children:ld(e)})}),gd=(e,t,r)=>{(0,n.useEffect)(()=>((async()=>{await e()})(),r),t)};function _d(e){let t=e.map(e=>Number(e.sender));return new Set(t)}function vd(t){let[r,i]=(0,n.useState)(()=>new Map),a=(0,n.useCallback)(async()=>{if(!t.length)return r;try{let n=_d(t),i=Array.from(n);if(e.m.debug(`[names] size:`,n.size),!n.size)return r;let a=(await e.d.users.bulkGet(i)).filter(e=>!!e),o=new Map;if(a.forEach(e=>{o.set(e.id,e.name)}),n.size===a.length)return o;let s=i.filter(e=>!o.has(e)),c=e.a();if(!c)return r;let l=await c.getUsers(s,{fields:[`id`,`name`]});await e.d.users.bulkPut(l);let u=o;return l.forEach(e=>u.set(e.id,e.name)),u}catch(t){e.m.error(`[useSenderNames] Failed to fetch users:`,t)}return r},[t,r]);return gd(async()=>{i(await a())},[t]),r}var yd=({messages:t,currentUserId:a,loading:o=!1,error:s=null,autoScroll:c=!0,hasMore:l=!1,loadingMore:u=!1,onLoadMore:d})=>{let f=(0,n.useRef)(null),p=(0,n.useRef)(null),m=(0,n.useRef)(0),h=(0,n.useRef)(!0),[g,_]=(0,n.useState)(c),[v,y]=(0,n.useState)(null),b=vd(t),x=(0,n.useMemo)(()=>t.filter(e=>e.media&&e.media.length>0),[t]),S=(0,n.useCallback)(e=>{let t=x.findIndex(t=>t.id===e.id);t!==-1&&y(t)},[x]),C=v!==null&&v>0?()=>y(e=>e-1):void 0,w=v!==null&&v<x.length-1?()=>y(e=>e+1):void 0,T=v===null?null:x[v],E=()=>{if(!p.current)return!1;let{scrollTop:e,scrollHeight:t,clientHeight:n}=p.current;return t-e-n<100};return(0,n.useEffect)(()=>{t.length>0&&f.current&&(f.current.scrollIntoView({behavior:`auto`}),h.current=!0)},[]),(0,n.useEffect)(()=>{!u||!t.length||(p.current&&(m.current=p.current.scrollHeight),_(!1))},[u]),(0,n.useLayoutEffect)(()=>{if(t.length){if(g&&f.current&&h.current)f.current.scrollIntoView({behavior:`smooth`});else if(!g&&p.current&&m.current>0){let e=p.current.scrollHeight-m.current;p.current.scrollTop=p.current.scrollTop+e,m.current=0,_(!0)}}},[t.length,c]),o&&!t.length?(0,i.jsx)(r.Box,{flex:1,overflow:`auto`,p:2,children:[1,2,3,4,5].map(e=>(0,i.jsx)(pd,{isOwnMessage:e%3==0},e))}):s&&!t.length?(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,flex:1,p:2,children:(0,i.jsxs)(r.Alert,{severity:`error`,children:[(0,i.jsx)(`strong`,{children:`Failed to load messages`}),(0,i.jsx)(`br`,{}),s.message]})}):t.length===0?(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,flex:1,children:(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,children:`No messages yet. Start the conversation!`})}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(r.Box,{ref:p,flex:1,overflow:`auto`,p:2,display:`flex`,flexDirection:`column`,onScroll:()=>{h.current=E()},children:[l&&d&&(0,i.jsx)(md,{hasMore:l,loading:u,onLoadMore:d}),t.map((r,o)=>{let s=r.sender,c=r.sender===a,l=b.get(s),u=o>0?t[o-1]:null,d=o<t.length-1?t[o+1]:null,f=new Date(r.created_at).toDateString(),p=f!==(u?new Date(u.created_at).toDateString():null),m=p||!u||!e.u(u,r),h=f!==(d?new Date(d.created_at).toDateString():null)||!d||!e.u(r,d);return(0,i.jsxs)(n.default.Fragment,{children:[p&&(0,i.jsx)(hd,{date:r.created_at}),(0,i.jsx)(dd,{message:r,isOwnMessage:c,senderName:l,showSenderName:m,isFirstInGroup:m,isLastInGroup:h,onImagePress:S})]},r.id)}),(0,i.jsx)(`div`,{ref:f})]}),T&&(0,i.jsx)(fd,{src:T.media[0].url,open:!0,onClose:()=>y(null),senderName:b.get(T.sender),onPrev:C,onNext:w})]})},bd=({open:e,onCapture:t,onClose:a})=>{let o=(0,n.useRef)(null),s=(0,n.useRef)(null),[c,l]=(0,n.useState)(!1),[u,d]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(e)return l(!1),d(null),navigator.mediaDevices.getUserMedia({video:{facingMode:`environment`,width:{ideal:1920},height:{ideal:1080}},audio:!1}).then(e=>{s.current=e,o.current&&(o.current.srcObject=e)}).catch(()=>d(`Camera access denied or unavailable.`)),()=>{s.current?.getTracks().forEach(e=>e.stop()),s.current=null}},[e]),(0,i.jsxs)(r.Dialog,{open:e,onClose:a,maxWidth:`sm`,fullWidth:!0,children:[(0,i.jsx)(r.DialogContent,{sx:{p:0,bgcolor:`black`,aspectRatio:`4/3`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:u?(0,i.jsx)(r.Typography,{color:`error`,textAlign:`center`,p:3,children:u}):(0,i.jsxs)(i.Fragment,{children:[!c&&(0,i.jsx)(r.CircularProgress,{sx:{position:`absolute`,color:`white`}}),(0,i.jsx)(r.Box,{component:`video`,ref:o,autoPlay:!0,playsInline:!0,muted:!0,onCanPlay:()=>l(!0),sx:{width:`100%`,height:`100%`,objectFit:`cover`,display:c?`block`:`none`}})]})}),(0,i.jsxs)(r.DialogActions,{children:[(0,i.jsx)(r.Button,{onClick:a,children:`Cancel`}),(0,i.jsx)(r.Button,{variant:`contained`,onClick:()=>{let e=o.current;if(!e)return;let n=document.createElement(`canvas`);n.width=e.videoWidth,n.height=e.videoHeight,n.getContext(`2d`).drawImage(e,0,0),n.toBlob(e=>{e&&(t(e),a())},`image/webp`,.85)},disabled:!c,startIcon:(0,i.jsx)(Yr,{}),children:`Capture`})]})]})};function xd(e,t){return t.forEach((function(t){t&&typeof t!=`string`&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if(n!==`default`&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}function Sd(e,t){return new Promise((function(n,r){let i;return Cd(e).then((function(e){try{return i=e,n(new Blob([t.slice(0,2),i,t.slice(2)],{type:`image/jpeg`}))}catch(e){return r(e)}}),r)}))}var Cd=e=>new Promise(((t,n)=>{let r=new FileReader;r.addEventListener(`load`,(({target:{result:e}})=>{let r=new DataView(e),i=0;if(r.getUint16(i)!==65496)return n(`not a valid JPEG`);for(i+=2;;){let a=r.getUint16(i);if(a===65498)break;let o=r.getUint16(i+2);if(a===65505&&r.getUint32(i+4)===1165519206){let a=i+10,s;switch(r.getUint16(a)){case 18761:s=!0;break;case 19789:s=!1;break;default:return n(`TIFF header contains invalid endian`)}if(r.getUint16(a+2,s)!==42)return n(`TIFF header contains invalid version`);let c=r.getUint32(a+4,s),l=a+c+2+12*r.getUint16(a+c,s);for(let e=a+c+2;e<l;e+=12)if(r.getUint16(e,s)==274){if(r.getUint16(e+2,s)!==3)return n(`Orientation data type is invalid`);if(r.getUint32(e+4,s)!==1)return n(`Orientation data count is invalid`);r.setUint16(e+8,1,s);break}return t(e.slice(i,i+2+o))}i+=2+o}return t(new Blob)})),r.readAsArrayBuffer(e)})),wd={},Td={get exports(){return wd},set exports(e){wd=e}};(function(e){var t,n,r={};Td.exports=r,r.parse=function(e,t){for(var n=r.bin.readUshort,i=r.bin.readUint,a=0,o={},s=new Uint8Array(e),c=s.length-4;i(s,c)!=101010256;)c--;a=c,a+=4;var l=n(s,a+=4);n(s,a+=2);var u=i(s,a+=2),d=i(s,a+=4);a+=4,a=d;for(var f=0;f<l;f++){i(s,a),a+=4,a+=4,a+=4,i(s,a+=4),u=i(s,a+=4);var p=i(s,a+=4),m=n(s,a+=4),h=n(s,a+2),g=n(s,a+4);a+=6;var _=i(s,a+=8);a+=4,a+=m+h+g,r._readLocal(s,_,o,u,p,t)}return o},r._readLocal=function(e,t,n,i,a,o){var s=r.bin.readUshort,c=r.bin.readUint;c(e,t),s(e,t+=4),s(e,t+=2);var l=s(e,t+=2);c(e,t+=2),c(e,t+=4),t+=4;var u=s(e,t+=8),d=s(e,t+=2);t+=2;var f=r.bin.readUTF8(e,t,u);if(t+=u,t+=d,o)n[f]={size:a,csize:i};else{var p=new Uint8Array(e.buffer,t);if(l==0)n[f]=new Uint8Array(p.buffer.slice(t,t+i));else{if(l!=8)throw`unknown compression method: `+l;var m=new Uint8Array(a);r.inflateRaw(p,m),n[f]=m}}},r.inflateRaw=function(e,t){return r.F.inflate(e,t)},r.inflate=function(e,t){return e[0],e[1],r.inflateRaw(new Uint8Array(e.buffer,e.byteOffset+2,e.length-6),t)},r.deflate=function(e,t){t??={level:6};var n=0,i=new Uint8Array(50+Math.floor(1.1*e.length));i[n]=120,i[n+1]=156,n+=2,n=r.F.deflateRaw(e,i,n,t.level);var a=r.adler(e,0,e.length);return i[n+0]=a>>>24&255,i[n+1]=a>>>16&255,i[n+2]=a>>>8&255,i[n+3]=a>>>0&255,new Uint8Array(i.buffer,0,n+4)},r.deflateRaw=function(e,t){t??={level:6};var n=new Uint8Array(50+Math.floor(1.1*e.length)),i=r.F.deflateRaw(e,n,i,t.level);return new Uint8Array(n.buffer,0,i)},r.encode=function(e,t){t??=!1;var n=0,i=r.bin.writeUint,a=r.bin.writeUshort,o={};for(var s in e){var c=!r._noNeed(s)&&!t,l=e[s],u=r.crc.crc(l,0,l.length);o[s]={cpr:c,usize:l.length,crc:u,file:c?r.deflateRaw(l):l}}for(var s in o)n+=o[s].file.length+30+46+2*r.bin.sizeUTF8(s);n+=22;var d=new Uint8Array(n),f=0,p=[];for(var s in o){var m=o[s];p.push(f),f=r._writeHeader(d,f,s,m,0)}var h=0,g=f;for(var s in o)m=o[s],p.push(f),f=r._writeHeader(d,f,s,m,1,p[h++]);var _=f-g;return i(d,f,101010256),f+=4,a(d,f+=4,h),a(d,f+=2,h),i(d,f+=2,_),i(d,f+=4,g),f+=4,f+=2,d.buffer},r._noNeed=function(e){var t=e.split(`.`).pop().toLowerCase();return`png,jpg,jpeg,zip`.indexOf(t)!=-1},r._writeHeader=function(e,t,n,i,a,o){var s=r.bin.writeUint,c=r.bin.writeUshort,l=i.file;return s(e,t,a==0?67324752:33639248),t+=4,a==1&&(t+=2),c(e,t,20),c(e,t+=2,0),c(e,t+=2,i.cpr?8:0),s(e,t+=2,0),s(e,t+=4,i.crc),s(e,t+=4,l.length),s(e,t+=4,i.usize),c(e,t+=4,r.bin.sizeUTF8(n)),c(e,t+=2,0),t+=2,a==1&&(t+=2,t+=2,s(e,t+=6,o),t+=4),t+=r.bin.writeUTF8(e,t,n),a==0&&(e.set(l,t),t+=l.length),t},r.crc={table:function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var n=t,r=0;r<8;r++)1&n?n=3988292384^n>>>1:n>>>=1;e[t]=n}return e}(),update:function(e,t,n,i){for(var a=0;a<i;a++)e=r.crc.table[255&(e^t[n+a])]^e>>>8;return e},crc:function(e,t,n){return 4294967295^r.crc.update(4294967295,e,t,n)}},r.adler=function(e,t,n){for(var r=1,i=0,a=t,o=t+n;a<o;){for(var s=Math.min(a+5552,o);a<s;)i+=r+=e[a++];r%=65521,i%=65521}return i<<16|r},r.bin={readUshort:function(e,t){return e[t]|e[t+1]<<8},writeUshort:function(e,t,n){e[t]=255&n,e[t+1]=n>>8&255},readUint:function(e,t){return 16777216*e[t+3]+(e[t+2]<<16|e[t+1]<<8|e[t])},writeUint:function(e,t,n){e[t]=255&n,e[t+1]=n>>8&255,e[t+2]=n>>16&255,e[t+3]=n>>24&255},readASCII:function(e,t,n){for(var r=``,i=0;i<n;i++)r+=String.fromCharCode(e[t+i]);return r},writeASCII:function(e,t,n){for(var r=0;r<n.length;r++)e[t+r]=n.charCodeAt(r)},pad:function(e){return e.length<2?`0`+e:e},readUTF8:function(e,t,n){for(var i,a=``,o=0;o<n;o++)a+=`%`+r.bin.pad(e[t+o].toString(16));try{i=decodeURIComponent(a)}catch{return r.bin.readASCII(e,t,n)}return i},writeUTF8:function(e,t,n){for(var r=n.length,i=0,a=0;a<r;a++){var o=n.charCodeAt(a);if(!(4294967168&o))e[t+i]=o,i++;else if(!(4294965248&o))e[t+i]=192|o>>6,e[t+i+1]=128|o>>0&63,i+=2;else if(!(4294901760&o))e[t+i]=224|o>>12,e[t+i+1]=128|o>>6&63,e[t+i+2]=128|o>>0&63,i+=3;else{if(4292870144&o)throw`e`;e[t+i]=240|o>>18,e[t+i+1]=128|o>>12&63,e[t+i+2]=128|o>>6&63,e[t+i+3]=128|o>>0&63,i+=4}}return i},sizeUTF8:function(e){for(var t=e.length,n=0,r=0;r<t;r++){var i=e.charCodeAt(r);if(!(4294967168&i))n++;else if(!(4294965248&i))n+=2;else if(!(4294901760&i))n+=3;else{if(4292870144&i)throw`e`;n+=4}}return n}},r.F={},r.F.deflateRaw=function(e,t,n,i){var a=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][i],o=r.F.U,s=r.F._goodIndex;r.F._hash;var c=r.F._putsE,l=0,u=n<<3,d=0,f=e.length;if(i==0){for(;l<f;)c(t,u,+(l+(w=Math.min(65535,f-l))==f)),u=r.F._copyExact(e,l,w,t,u+8),l+=w;return u>>>3}var p=o.lits,m=o.strt,h=o.prev,g=0,_=0,v=0,y=0,b=0,x=0;for(f>2&&(m[x=r.F._hash(e,0)]=0),l=0;l<f;l++){if(b=x,l+1<f-2){x=r.F._hash(e,l+1);var S=l+1&32767;h[S]=m[x],m[x]=S}if(d<=l){(g>14e3||_>26697)&&f-l>100&&(d<l&&(p[g]=l-d,g+=2,d=l),u=r.F._writeBlock(+(l==f-1||d==f),p,g,y,e,v,l-v,t,u),g=_=y=0,v=l);var C=0;l<f-2&&(C=r.F._bestMatch(e,l,h,b,Math.min(a[2],f-l),a[3]));var w=C>>>16,T=65535&C;if(C!=0){T=65535&C;var E=s(w=C>>>16,o.of0);o.lhst[257+E]++;var D=s(T,o.df0);o.dhst[D]++,y+=o.exb[E]+o.dxb[D],p[g]=w<<23|l-d,p[g+1]=T<<16|E<<8|D,g+=2,d=l+w}else o.lhst[e[l]]++;_++}}for(v==l&&e.length!=0||(d<l&&(p[g]=l-d,g+=2,d=l),u=r.F._writeBlock(1,p,g,y,e,v,l-v,t,u),g=0,_=0,g=_=y=0,v=l);7&u;)u++;return u>>>3},r.F._bestMatch=function(e,t,n,i,a,o){var s=32767&t,c=n[s],l=s-c+32768&32767;if(c==s||i!=r.F._hash(e,t-l))return 0;for(var u=0,d=0,f=Math.min(32767,t);l<=f&&--o!=0&&c!=s;){if(u==0||e[t+u]==e[t+u-l]){var p=r.F._howLong(e,t,l);if(p>u){if(d=l,(u=p)>=a)break;l+2<p&&(p=l+2);for(var m=0,h=0;h<p-2;h++){var g=t-l+h+32768&32767,_=g-n[g]+32768&32767;_>m&&(m=_,c=g)}}}l+=(s=c)-(c=n[s])+32768&32767}return u<<16|d},r.F._howLong=function(e,t,n){if(e[t]!=e[t-n]||e[t+1]!=e[t+1-n]||e[t+2]!=e[t+2-n])return 0;var r=t,i=Math.min(e.length,t+258);for(t+=3;t<i&&e[t]==e[t-n];)t++;return t-r},r.F._hash=function(e,t){return(e[t]<<8|e[t+1])+(e[t+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(e,t,n,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y=r.F.U,b=r.F._putsF,x=r.F._putsE;y.lhst[256]++,d=(u=r.F.getTrees())[0],f=u[1],p=u[2],m=u[3],h=u[4],g=u[5],_=u[6],v=u[7];var S=32+(l+3&7?8-(l+3&7):0)+(s<<3),C=i+r.F.contSize(y.fltree,y.lhst)+r.F.contSize(y.fdtree,y.dhst),w=i+r.F.contSize(y.ltree,y.lhst)+r.F.contSize(y.dtree,y.dhst);w+=14+3*g+r.F.contSize(y.itree,y.ihst)+(2*y.ihst[16]+3*y.ihst[17]+7*y.ihst[18]);for(var T=0;T<286;T++)y.lhst[T]=0;for(T=0;T<30;T++)y.dhst[T]=0;for(T=0;T<19;T++)y.ihst[T]=0;var E=S<C&&S<w?0:C<w?1:2;if(b(c,l,e),b(c,l+1,E),l+=3,E==0){for(;7&l;)l++;l=r.F._copyExact(a,o,s,c,l)}else{var D,O;if(E==1&&(D=y.fltree,O=y.fdtree),E==2){r.F.makeCodes(y.ltree,d),r.F.revCodes(y.ltree,d),r.F.makeCodes(y.dtree,f),r.F.revCodes(y.dtree,f),r.F.makeCodes(y.itree,p),r.F.revCodes(y.itree,p),D=y.ltree,O=y.dtree,x(c,l,m-257),x(c,l+=5,h-1),x(c,l+=5,g-4),l+=4;for(var k=0;k<g;k++)x(c,l+3*k,y.itree[1+(y.ordr[k]<<1)]);l+=3*g,l=r.F._codeTiny(_,y.itree,c,l),l=r.F._codeTiny(v,y.itree,c,l)}for(var A=o,j=0;j<n;j+=2){for(var M=t[j],N=M>>>23,ee=A+(8388607&M);A<ee;)l=r.F._writeLit(a[A++],D,c,l);if(N!=0){var P=t[j+1],F=P>>16,I=P>>8&255,L=255&P;x(c,l=r.F._writeLit(257+I,D,c,l),N-y.of0[I]),l+=y.exb[I],b(c,l=r.F._writeLit(L,O,c,l),F-y.df0[L]),l+=y.dxb[L],A+=N}}l=r.F._writeLit(256,D,c,l)}return l},r.F._copyExact=function(e,t,n,r,i){var a=i>>>3;return r[a]=n,r[a+1]=n>>>8,r[a+2]=255-r[a],r[a+3]=255-r[a+1],a+=4,r.set(new Uint8Array(e.buffer,t,n),a),i+(n+4<<3)},r.F.getTrees=function(){for(var e=r.F.U,t=r.F._hufTree(e.lhst,e.ltree,15),n=r.F._hufTree(e.dhst,e.dtree,15),i=[],a=r.F._lenCodes(e.ltree,i),o=[],s=r.F._lenCodes(e.dtree,o),c=0;c<i.length;c+=2)e.ihst[i[c]]++;for(c=0;c<o.length;c+=2)e.ihst[o[c]]++;for(var l=r.F._hufTree(e.ihst,e.itree,7),u=19;u>4&&e.itree[1+(e.ordr[u-1]<<1)]==0;)u--;return[t,n,l,a,s,u,i,o]},r.F.getSecond=function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(e[n+1]);return t},r.F.nonZero=function(e){for(var t=``,n=0;n<e.length;n+=2)e[n+1]!=0&&(t+=(n>>1)+`,`);return t},r.F.contSize=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r]*e[1+(r<<1)];return n},r.F._codeTiny=function(e,t,n,i){for(var a=0;a<e.length;a+=2){var o=e[a],s=e[a+1];i=r.F._writeLit(o,t,n,i);var c=o==16?2:o==17?3:7;o>15&&(r.F._putsE(n,i,s,c),i+=c)}return i},r.F._lenCodes=function(e,t){for(var n=e.length;n!=2&&e[n-1]==0;)n-=2;for(var r=0;r<n;r+=2){var i=e[r+1],a=r+3<n?e[r+3]:-1,o=r+5<n?e[r+5]:-1,s=r==0?-1:e[r-1];if(i==0&&a==i&&o==i){for(var c=r+5;c+2<n&&e[c+2]==i;)c+=2;(l=Math.min(c+1-r>>>1,138))<11?t.push(17,l-3):t.push(18,l-11),r+=2*l-2}else if(i==s&&a==i&&o==i){for(c=r+5;c+2<n&&e[c+2]==i;)c+=2;var l=Math.min(c+1-r>>>1,6);t.push(16,l-3),r+=2*l-2}else t.push(i,0)}return n>>>1},r.F._hufTree=function(e,t,n){var i=[],a=e.length,o=t.length,s=0;for(s=0;s<o;s+=2)t[s]=0,t[s+1]=0;for(s=0;s<a;s++)e[s]!=0&&i.push({lit:s,f:e[s]});var c=i.length,l=i.slice(0);if(c==0)return 0;if(c==1){var u=i[0].lit;return l=+(u==0),t[1+(u<<1)]=1,t[1+(l<<1)]=1,1}i.sort((function(e,t){return e.f-t.f}));var d=i[0],f=i[1],p=0,m=1,h=2;for(i[0]={lit:-1,f:d.f+f.f,l:d,r:f,d:0};m!=c-1;)d=p!=m&&(h==c||i[p].f<i[h].f)?i[p++]:i[h++],f=p!=m&&(h==c||i[p].f<i[h].f)?i[p++]:i[h++],i[m++]={lit:-1,f:d.f+f.f,l:d,r:f};var g=r.F.setDepth(i[m-1],0);for(g>n&&(r.F.restrictDepth(l,n,g),g=n),s=0;s<c;s++)t[1+(l[s].lit<<1)]=l[s].d;return g},r.F.setDepth=function(e,t){return e.lit==-1?Math.max(r.F.setDepth(e.l,t+1),r.F.setDepth(e.r,t+1)):(e.d=t,t)},r.F.restrictDepth=function(e,t,n){var r=0,i=1<<n-t,a=0;for(e.sort((function(e,t){return t.d==e.d?e.f-t.f:t.d-e.d})),r=0;r<e.length&&e[r].d>t;r++){var o=e[r].d;e[r].d=t,a+=i-(1<<n-o)}for(a>>>=n-t;a>0;)(o=e[r].d)<t?(e[r].d++,a-=1<<t-o-1):r++;for(;r>=0;r--)e[r].d==t&&a<0&&(e[r].d--,a++);a!=0&&console.log(`debt left`)},r.F._goodIndex=function(e,t){var n=0;return t[16|n]<=e&&(n|=16),t[8|n]<=e&&(n|=8),t[4|n]<=e&&(n|=4),t[2|n]<=e&&(n|=2),t[1|n]<=e&&(n|=1),n},r.F._writeLit=function(e,t,n,i){return r.F._putsF(n,i,t[e<<1]),i+t[1+(e<<1)]},r.F.inflate=function(e,t){var n=Uint8Array;if(e[0]==3&&e[1]==0)return t||new n(0);var i=r.F,a=i._bitsF,o=i._bitsE,s=i._decodeTiny,c=i.makeCodes,l=i.codes2map,u=i._get17,d=i.U,f=t==null;f&&(t=new n(e.length>>>2<<3));for(var p,m,h=0,g=0,_=0,v=0,y=0,b=0,x=0,S=0,C=0;h==0;)if(h=a(e,C,1),g=a(e,C+1,2),C+=3,g!=0){if(f&&(t=r.F._check(t,S+(1<<17))),g==1&&(p=d.flmap,m=d.fdmap,b=511,x=31),g==2){_=o(e,C,5)+257,v=o(e,C+5,5)+1,y=o(e,C+10,4)+4,C+=14;for(var w=0;w<38;w+=2)d.itree[w]=0,d.itree[w+1]=0;var T=1;for(w=0;w<y;w++){var E=o(e,C+3*w,3);d.itree[1+(d.ordr[w]<<1)]=E,E>T&&(T=E)}C+=3*y,c(d.itree,T),l(d.itree,T,d.imap),p=d.lmap,m=d.dmap,C=s(d.imap,(1<<T)-1,_+v,e,C,d.ttree);var D=i._copyOut(d.ttree,0,_,d.ltree);b=(1<<D)-1;var O=i._copyOut(d.ttree,_,v,d.dtree);x=(1<<O)-1,c(d.ltree,D),l(d.ltree,D,p),c(d.dtree,O),l(d.dtree,O,m)}for(;;){var k=p[u(e,C)&b];C+=15&k;var A=k>>>4;if(!(A>>>8))t[S++]=A;else{if(A==256)break;var j=S+A-254;if(A>264){var M=d.ldef[A-257];j=S+(M>>>3)+o(e,C,7&M),C+=7&M}var N=m[u(e,C)&x];C+=15&N;var ee=N>>>4,P=d.ddef[ee],F=(P>>>4)+a(e,C,15&P);for(C+=15&P,f&&(t=r.F._check(t,S+(1<<17)));S<j;)t[S]=t[S++-F],t[S]=t[S++-F],t[S]=t[S++-F],t[S]=t[S++-F];S=j}}}else{7&C&&(C+=8-(7&C));var I=4+(C>>>3),L=e[I-4]|e[I-3]<<8;f&&(t=r.F._check(t,S+L)),t.set(new n(e.buffer,e.byteOffset+I,L),S),C=I+L<<3,S+=L}return t.length==S?t:t.slice(0,S)},r.F._check=function(e,t){var n=e.length;if(t<=n)return e;var r=new Uint8Array(Math.max(n<<1,t));return r.set(e,0),r},r.F._decodeTiny=function(e,t,n,i,a,o){for(var s=r.F._bitsE,c=r.F._get17,l=0;l<n;){var u=e[c(i,a)&t];a+=15&u;var d=u>>>4;if(d<=15)o[l]=d,l++;else{var f=0,p=0;d==16?(p=3+s(i,a,2),a+=2,f=o[l-1]):d==17?(p=3+s(i,a,3),a+=3):d==18&&(p=11+s(i,a,7),a+=7);for(var m=l+p;l<m;)o[l]=f,l++}}return a},r.F._copyOut=function(e,t,n,r){for(var i=0,a=0,o=r.length>>>1;a<n;){var s=e[a+t];r[a<<1]=0,r[1+(a<<1)]=s,s>i&&(i=s),a++}for(;a<o;)r[a<<1]=0,r[1+(a<<1)]=0,a++;return i},r.F.makeCodes=function(e,t){for(var n,i,a,o,s=r.F.U,c=e.length,l=s.bl_count,u=0;u<=t;u++)l[u]=0;for(u=1;u<c;u+=2)l[e[u]]++;var d=s.next_code;for(n=0,l[0]=0,i=1;i<=t;i++)n=n+l[i-1]<<1,d[i]=n;for(a=0;a<c;a+=2)(o=e[a+1])!=0&&(e[a]=d[o],d[o]++)},r.F.codes2map=function(e,t,n){for(var i=e.length,a=r.F.U.rev15,o=0;o<i;o+=2)if(e[o+1]!=0)for(var s=o>>1,c=e[o+1],l=s<<4|c,u=t-c,d=e[o]<<u,f=d+(1<<u);d!=f;)n[a[d]>>>15-t]=l,d++},r.F.revCodes=function(e,t){for(var n=r.F.U.rev15,i=15-t,a=0;a<e.length;a+=2)e[a]=n[e[a]<<t-e[a+1]]>>>i},r.F._putsE=function(e,t,n){n<<=7&t;var r=t>>>3;e[r]|=n,e[r+1]|=n>>>8},r.F._putsF=function(e,t,n){n<<=7&t;var r=t>>>3;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},r.F._bitsE=function(e,t,n){return(e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<n)-1},r.F._bitsF=function(e,t,n){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<n)-1},r.F._get17=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},r.F._get25=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16|e[3+(t>>>3)]<<24)>>>(7&t)},r.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),function(){for(var e=r.F.U,t=0;t<32768;t++){var n=t;n=(4278255360&(n=(4042322160&(n=(3435973836&(n=(2863311530&n)>>>1|(1431655765&n)<<1))>>>2|(858993459&n)<<2))>>>4|(252645135&n)<<4))>>>8|(16711935&n)<<8,e.rev15[t]=(n>>>16|n<<16)>>>17}function i(e,t,n){for(;t--!=0;)e.push(0,n)}for(t=0;t<32;t++)e.ldef[t]=e.of0[t]<<3|e.exb[t],e.ddef[t]=e.df0[t]<<4|e.dxb[t];i(e.fltree,144,8),i(e.fltree,112,9),i(e.fltree,24,7),i(e.fltree,8,8),r.F.makeCodes(e.fltree,9),r.F.codes2map(e.fltree,9,e.flmap),r.F.revCodes(e.fltree,9),i(e.fdtree,32,5),r.F.makeCodes(e.fdtree,5),r.F.codes2map(e.fdtree,5,e.fdmap),r.F.revCodes(e.fdtree,5),i(e.itree,19,0),i(e.ltree,286,0),i(e.dtree,30,0),i(e.ttree,320,0)}()})();var Ed=xd({__proto__:null,default:wd},[wd]),Dd=function(){var e={nextZero(e,t){for(;e[t]!=0;)t++;return t},readUshort:(e,t)=>e[t]<<8|e[t+1],writeUshort(e,t,n){e[t]=n>>8&255,e[t+1]=255&n},readUint:(e,t)=>16777216*e[t]+(e[t+1]<<16|e[t+2]<<8|e[t+3]),writeUint(e,t,n){e[t]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n},readASCII(e,t,n){let r=``;for(let i=0;i<n;i++)r+=String.fromCharCode(e[t+i]);return r},writeASCII(e,t,n){for(let r=0;r<n.length;r++)e[t+r]=n.charCodeAt(r)},readBytes(e,t,n){let r=[];for(let i=0;i<n;i++)r.push(e[t+i]);return r},pad:e=>e.length<2?`0${e}`:e,readUTF8(t,n,r){let i,a=``;for(let i=0;i<r;i++)a+=`%${e.pad(t[n+i].toString(16))}`;try{i=decodeURIComponent(a)}catch{return e.readASCII(t,n,r)}return i}};function t(t,n,r,i){let o=n*r,s=a(i),c=Math.ceil(n*s/8),l=new Uint8Array(4*o),u=new Uint32Array(l.buffer),{ctype:d}=i,{depth:f}=i,p=e.readUshort;if(d==6){let e=o<<2;if(f==8)for(var m=0;m<e;m+=4)l[m]=t[m],l[m+1]=t[m+1],l[m+2]=t[m+2],l[m+3]=t[m+3];if(f==16)for(m=0;m<e;m++)l[m]=t[m<<1]}else if(d==2){let e=i.tabs.tRNS;if(e==null){if(f==8)for(m=0;m<o;m++){var h=3*m;u[m]=255<<24|t[h+2]<<16|t[h+1]<<8|t[h]}if(f==16)for(m=0;m<o;m++)h=6*m,u[m]=255<<24|t[h+4]<<16|t[h+2]<<8|t[h]}else{var g=e[0];let n=e[1],r=e[2];if(f==8)for(m=0;m<o;m++){var _=m<<2;h=3*m,u[m]=255<<24|t[h+2]<<16|t[h+1]<<8|t[h],t[h]==g&&t[h+1]==n&&t[h+2]==r&&(l[_+3]=0)}if(f==16)for(m=0;m<o;m++)_=m<<2,h=6*m,u[m]=255<<24|t[h+4]<<16|t[h+2]<<8|t[h],p(t,h)==g&&p(t,h+2)==n&&p(t,h+4)==r&&(l[_+3]=0)}}else if(d==3){let e=i.tabs.PLTE,a=i.tabs.tRNS,s=a?a.length:0;if(f==1)for(var v=0;v<r;v++){var y=v*c,b=v*n;for(m=0;m<n;m++){_=b+m<<2;var x=3*(S=t[y+(m>>3)]>>7-((7&m)<<0)&1);l[_]=e[x],l[_+1]=e[x+1],l[_+2]=e[x+2],l[_+3]=S<s?a[S]:255}}if(f==2)for(v=0;v<r;v++)for(y=v*c,b=v*n,m=0;m<n;m++)_=b+m<<2,x=3*(S=t[y+(m>>2)]>>6-((3&m)<<1)&3),l[_]=e[x],l[_+1]=e[x+1],l[_+2]=e[x+2],l[_+3]=S<s?a[S]:255;if(f==4)for(v=0;v<r;v++)for(y=v*c,b=v*n,m=0;m<n;m++)_=b+m<<2,x=3*(S=t[y+(m>>1)]>>4-((1&m)<<2)&15),l[_]=e[x],l[_+1]=e[x+1],l[_+2]=e[x+2],l[_+3]=S<s?a[S]:255;if(f==8)for(m=0;m<o;m++){var S;_=m<<2,x=3*(S=t[m]),l[_]=e[x],l[_+1]=e[x+1],l[_+2]=e[x+2],l[_+3]=S<s?a[S]:255}}else if(d==4){if(f==8)for(m=0;m<o;m++){_=m<<2;var C=t[w=m<<1];l[_]=C,l[_+1]=C,l[_+2]=C,l[_+3]=t[w+1]}if(f==16)for(m=0;m<o;m++){var w;_=m<<2,C=t[w=m<<2],l[_]=C,l[_+1]=C,l[_+2]=C,l[_+3]=t[w+2]}}else if(d==0)for(g=i.tabs.tRNS?i.tabs.tRNS:-1,v=0;v<r;v++){let e=v*c,r=v*n;if(f==1)for(var T=0;T<n;T++){var E=(C=255*(t[e+(T>>>3)]>>>7-(7&T)&1))==255*g?0:255;u[r+T]=E<<24|C<<16|C<<8|C}else if(f==2)for(T=0;T<n;T++)E=(C=85*(t[e+(T>>>2)]>>>6-((3&T)<<1)&3))==85*g?0:255,u[r+T]=E<<24|C<<16|C<<8|C;else if(f==4)for(T=0;T<n;T++)E=(C=17*(t[e+(T>>>1)]>>>4-((1&T)<<2)&15))==17*g?0:255,u[r+T]=E<<24|C<<16|C<<8|C;else if(f==8)for(T=0;T<n;T++)E=(C=t[e+T])==g?0:255,u[r+T]=E<<24|C<<16|C<<8|C;else if(f==16)for(T=0;T<n;T++)C=t[e+(T<<1)],E=p(t,e+(T<<1))==g?0:255,u[r+T]=E<<24|C<<16|C<<8|C}return l}function n(e,t,n,s){let c=a(e),l=Math.ceil(n*c/8),u=new Uint8Array((l+1+e.interlace)*s);return t=e.tabs.CgBI?i(t,u):r(t,u),e.interlace==0?t=o(t,e,0,n,s):e.interlace==1&&(t=function(e,t){let n=t.width,r=t.height,i=a(t),s=i>>3,c=Math.ceil(n*i/8),l=new Uint8Array(r*c),u=0,d=[0,0,4,0,2,0,1],f=[0,4,0,2,0,1,0],p=[8,8,8,4,4,2,2],m=[8,8,4,4,2,2,1],h=0;for(;h<7;){let a=p[h],_=m[h],v=0,y=0,b=d[h];for(;b<r;)b+=a,y++;let x=f[h];for(;x<n;)x+=_,v++;let S=Math.ceil(v*i/8);o(e,t,u,v,y);let C=0,w=d[h];for(;w<r;){let t=f[h],r=u+C*S<<3;for(;t<n;){var g;if(i==1&&(g=(g=e[r>>3])>>7-(7&r)&1,l[w*c+(t>>3)]|=g<<7-((7&t)<<0)),i==2&&(g=(g=e[r>>3])>>6-(7&r)&3,l[w*c+(t>>2)]|=g<<6-((3&t)<<1)),i==4&&(g=(g=e[r>>3])>>4-(7&r)&15,l[w*c+(t>>1)]|=g<<4-((1&t)<<2)),i>=8){let n=w*c+t*s;for(let t=0;t<s;t++)l[n+t]=e[(r>>3)+t]}r+=i,t+=_}C++,w+=a}v*y!=0&&(u+=y*(1+S)),h+=1}return l}(t,e)),t}function r(e,t){return i(new Uint8Array(e.buffer,2,e.length-6),t)}var i=function(){let e={H:{}};return e.H.N=function(t,n){let r=Uint8Array,i,a,o=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0;if(t[0]==3&&t[1]==0)return n||new r(0);let h=e.H,g=h.b,_=h.e,v=h.R,y=h.n,b=h.A,x=h.Z,S=h.m,C=n==null;for(C&&(n=new r(t.length>>>2<<5));o==0;)if(o=g(t,m,1),s=g(t,m+1,2),m+=3,s!=0){if(C&&(n=e.H.W(n,p+(1<<17))),s==1&&(i=S.J,a=S.h,d=511,f=31),s==2){c=_(t,m,5)+257,l=_(t,m+5,5)+1,u=_(t,m+10,4)+4,m+=14;let e=1;for(var w=0;w<38;w+=2)S.Q[w]=0,S.Q[w+1]=0;for(w=0;w<u;w++){let n=_(t,m+3*w,3);S.Q[1+(S.X[w]<<1)]=n,n>e&&(e=n)}m+=3*u,y(S.Q,e),b(S.Q,e,S.u),i=S.w,a=S.d,m=v(S.u,(1<<e)-1,c+l,t,m,S.v);let n=h.V(S.v,0,c,S.C);d=(1<<n)-1;let r=h.V(S.v,c,l,S.D);f=(1<<r)-1,y(S.C,n),b(S.C,n,i),y(S.D,r),b(S.D,r,a)}for(;;){let e=i[x(t,m)&d];m+=15&e;let r=e>>>4;if(!(r>>>8))n[p++]=r;else{if(r==256)break;{let e=p+r-254;if(r>264){let n=S.q[r-257];e=p+(n>>>3)+_(t,m,7&n),m+=7&n}let i=a[x(t,m)&f];m+=15&i;let o=i>>>4,s=S.c[o],c=(s>>>4)+g(t,m,15&s);for(m+=15&s;p<e;)n[p]=n[p++-c],n[p]=n[p++-c],n[p]=n[p++-c],n[p]=n[p++-c];p=e}}}}else{7&m&&(m+=8-(7&m));let i=4+(m>>>3),a=t[i-4]|t[i-3]<<8;C&&(n=e.H.W(n,p+a)),n.set(new r(t.buffer,t.byteOffset+i,a),p),m=i+a<<3,p+=a}return n.length==p?n:n.slice(0,p)},e.H.W=function(e,t){let n=e.length;if(t<=n)return e;let r=new Uint8Array(n<<1);return r.set(e,0),r},e.H.R=function(t,n,r,i,a,o){let s=e.H.e,c=e.H.Z,l=0;for(;l<r;){let e=t[c(i,a)&n];a+=15&e;let r=e>>>4;if(r<=15)o[l]=r,l++;else{let e=0,t=0;r==16?(t=3+s(i,a,2),a+=2,e=o[l-1]):r==17?(t=3+s(i,a,3),a+=3):r==18&&(t=11+s(i,a,7),a+=7);let n=l+t;for(;l<n;)o[l]=e,l++}}return a},e.H.V=function(e,t,n,r){let i=0,a=0,o=r.length>>>1;for(;a<n;){let n=e[a+t];r[a<<1]=0,r[1+(a<<1)]=n,n>i&&(i=n),a++}for(;a<o;)r[a<<1]=0,r[1+(a<<1)]=0,a++;return i},e.H.n=function(t,n){let r=e.H.m,i=t.length,a,o,s,c,l=r.j;for(var u=0;u<=n;u++)l[u]=0;for(u=1;u<i;u+=2)l[t[u]]++;let d=r.K;for(a=0,l[0]=0,o=1;o<=n;o++)a=a+l[o-1]<<1,d[o]=a;for(s=0;s<i;s+=2)c=t[s+1],c!=0&&(t[s]=d[c],d[c]++)},e.H.A=function(t,n,r){let i=t.length,a=e.H.m.r;for(let e=0;e<i;e+=2)if(t[e+1]!=0){let i=e>>1,o=t[e+1],s=i<<4|o,c=n-o,l=t[e]<<c,u=l+(1<<c);for(;l!=u;)r[a[l]>>>15-n]=s,l++}},e.H.l=function(t,n){let r=e.H.m.r,i=15-n;for(let e=0;e<t.length;e+=2)t[e]=r[t[e]<<n-t[e+1]]>>>i},e.H.M=function(e,t,n){n<<=7&t;let r=t>>>3;e[r]|=n,e[r+1]|=n>>>8},e.H.I=function(e,t,n){n<<=7&t;let r=t>>>3;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},e.H.e=function(e,t,n){return(e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<n)-1},e.H.b=function(e,t,n){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<n)-1},e.H.Z=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},e.H.i=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16|e[3+(t>>>3)]<<24)>>>(7&t)},e.H.m=function(){let e=Uint16Array,t=Uint32Array;return{K:new e(16),j:new e(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new e(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new t(32),J:new e(512),_:[],h:new e(32),$:[],w:new e(32768),C:[],v:[],d:new e(32768),D:[],u:new e(512),Q:[],r:new e(32768),s:new t(286),Y:new t(30),a:new t(19),t:new t(15e3),k:new e(65536),g:new e(32768)}}(),function(){let t=e.H.m;for(var n=0;n<32768;n++){let e=n;e=(2863311530&e)>>>1|(1431655765&e)<<1,e=(3435973836&e)>>>2|(858993459&e)<<2,e=(4042322160&e)>>>4|(252645135&e)<<4,e=(4278255360&e)>>>8|(16711935&e)<<8,t.r[n]=(e>>>16|e<<16)>>>17}function r(e,t,n){for(;t--!=0;)e.push(0,n)}for(n=0;n<32;n++)t.q[n]=t.S[n]<<3|t.T[n],t.c[n]=t.p[n]<<4|t.z[n];r(t._,144,8),r(t._,112,9),r(t._,24,7),r(t._,8,8),e.H.n(t._,9),e.H.A(t._,9,t.J),e.H.l(t._,9),r(t.$,32,5),e.H.n(t.$,5),e.H.A(t.$,5,t.h),e.H.l(t.$,5),r(t.Q,19,0),r(t.C,286,0),r(t.D,30,0),r(t.v,320,0)}(),e.H.N}();function a(e){return[1,null,3,1,2,null,4][e.ctype]*e.depth}function o(e,t,n,r,i){let o=a(t),c=Math.ceil(r*o/8),l,u;o=Math.ceil(o/8);let d=e[n],f=0;if(d>1&&(e[n]=[0,0,1][d-2]),d==3)for(f=o;f<c;f++)e[f+1]=e[f+1]+(e[f+1-o]>>>1)&255;for(let t=0;t<i;t++)if(l=n+t*c,u=l+t+1,d=e[u-1],f=0,d==0)for(;f<c;f++)e[l+f]=e[u+f];else if(d==1){for(;f<o;f++)e[l+f]=e[u+f];for(;f<c;f++)e[l+f]=e[u+f]+e[l+f-o]}else if(d==2)for(;f<c;f++)e[l+f]=e[u+f]+e[l+f-c];else if(d==3){for(;f<o;f++)e[l+f]=e[u+f]+(e[l+f-c]>>>1);for(;f<c;f++)e[l+f]=e[u+f]+(e[l+f-c]+e[l+f-o]>>>1)}else{for(;f<o;f++)e[l+f]=e[u+f]+s(0,e[l+f-c],0);for(;f<c;f++)e[l+f]=e[u+f]+s(e[l+f-o],e[l+f-c],e[l+f-o-c])}return e}function s(e,t,n){let r=e+t-n,i=r-e,a=r-t,o=r-n;return i*i<=a*a&&i*i<=o*o?e:a*a<=o*o?t:n}function c(t,n,r){r.width=e.readUint(t,n),n+=4,r.height=e.readUint(t,n),n+=4,r.depth=t[n],n++,r.ctype=t[n],n++,r.compress=t[n],n++,r.filter=t[n],n++,r.interlace=t[n],n++}function l(e,t,n,r,i,a,o,s,c){let l=Math.min(t,i),u=Math.min(n,a),d=0,f=0;for(let n=0;n<u;n++)for(let a=0;a<l;a++)if(o>=0&&s>=0?(d=n*t+a<<2,f=(s+n)*i+o+a<<2):(d=(-s+n)*t-o+a<<2,f=n*i+a<<2),c==0)r[f]=e[d],r[f+1]=e[d+1],r[f+2]=e[d+2],r[f+3]=e[d+3];else if(c==1){var p=e[d+3]*(1/255),m=e[d]*p,h=e[d+1]*p,g=e[d+2]*p,_=r[f+3]*(1/255),v=r[f]*_,y=r[f+1]*_,b=r[f+2]*_;let t=1-p,n=p+_*t,i=n==0?0:1/n;r[f+3]=255*n,r[f+0]=(m+v*t)*i,r[f+1]=(h+y*t)*i,r[f+2]=(g+b*t)*i}else if(c==2)p=e[d+3],m=e[d],h=e[d+1],g=e[d+2],_=r[f+3],v=r[f],y=r[f+1],b=r[f+2],p==_&&m==v&&h==y&&g==b?(r[f]=0,r[f+1]=0,r[f+2]=0,r[f+3]=0):(r[f]=m,r[f+1]=h,r[f+2]=g,r[f+3]=p);else if(c==3){if(p=e[d+3],m=e[d],h=e[d+1],g=e[d+2],_=r[f+3],v=r[f],y=r[f+1],b=r[f+2],p==_&&m==v&&h==y&&g==b)continue;if(p<220&&_>20)return!1}return!0}return{decode:function(t){let a=new Uint8Array(t),o=8,s=e,l=s.readUshort,u=s.readUint,d={tabs:{},frames:[]},f=new Uint8Array(a.length),p,m=0,h=0,g=[137,80,78,71,13,10,26,10];for(var _=0;_<8;_++)if(a[_]!=g[_])throw`The input is not a PNG file!`;for(;o<a.length;){let e=s.readUint(a,o);o+=4;let t=s.readASCII(a,o,4);if(o+=4,t==`IHDR`)c(a,o,d);else if(t==`iCCP`){for(var v=o;a[v]!=0;)v++;s.readASCII(a,o,v-o),a[v+1];let n=a.slice(v+2,o+e),c=null;try{c=r(n)}catch{c=i(n)}d.tabs[t]=c}else if(t==`CgBI`)d.tabs[t]=a.slice(o,o+4);else if(t==`IDAT`){for(_=0;_<e;_++)f[m+_]=a[o+_];m+=e}else if(t==`acTL`)d.tabs[t]={num_frames:u(a,o),num_plays:u(a,o+4)},p=new Uint8Array(a.length);else if(t==`fcTL`){h!=0&&((w=d.frames[d.frames.length-1]).data=n(d,p.slice(0,h),w.rect.width,w.rect.height),h=0);let e={x:u(a,o+12),y:u(a,o+16),width:u(a,o+4),height:u(a,o+8)},t=l(a,o+22);t=l(a,o+20)/(t==0?100:t);let r={rect:e,delay:Math.round(1e3*t),dispose:a[o+24],blend:a[o+25]};d.frames.push(r)}else if(t==`fdAT`){for(_=0;_<e-4;_++)p[h+_]=a[o+_+4];h+=e-4}else if(t==`pHYs`)d.tabs[t]=[s.readUint(a,o),s.readUint(a,o+4),a[o+8]];else if(t==`cHRM`)for(d.tabs[t]=[],_=0;_<8;_++)d.tabs[t].push(s.readUint(a,o+4*_));else if(t==`tEXt`||t==`zTXt`){d.tabs[t]??(d.tabs[t]={});var y=s.nextZero(a,o),b=s.readASCII(a,o,y-o),x=o+e-y-1;if(t==`tEXt`)C=s.readASCII(a,y+1,x);else{var S=r(a.slice(y+2,y+2+x));C=s.readUTF8(S,0,S.length)}d.tabs[t][b]=C}else if(t==`iTXt`){d.tabs[t]??(d.tabs[t]={}),y=0,v=o,y=s.nextZero(a,v),b=s.readASCII(a,v,y-v);let n=a[v=y+1];var C;a[v+1],v+=2,y=s.nextZero(a,v),s.readASCII(a,v,y-v),v=y+1,y=s.nextZero(a,v),s.readUTF8(a,v,y-v),x=e-((v=y+1)-o),n==0?C=s.readUTF8(a,v,x):(S=r(a.slice(v,v+x)),C=s.readUTF8(S,0,S.length)),d.tabs[t][b]=C}else if(t==`PLTE`)d.tabs[t]=s.readBytes(a,o,e);else if(t==`hIST`){let e=d.tabs.PLTE.length/3;for(d.tabs[t]=[],_=0;_<e;_++)d.tabs[t].push(l(a,o+2*_))}else if(t==`tRNS`)d.ctype==3?d.tabs[t]=s.readBytes(a,o,e):d.ctype==0?d.tabs[t]=l(a,o):d.ctype==2&&(d.tabs[t]=[l(a,o),l(a,o+2),l(a,o+4)]);else if(t==`gAMA`)d.tabs[t]=s.readUint(a,o)/1e5;else if(t==`sRGB`)d.tabs[t]=a[o];else if(t==`bKGD`)d.ctype==0||d.ctype==4?d.tabs[t]=[l(a,o)]:d.ctype==2||d.ctype==6?d.tabs[t]=[l(a,o),l(a,o+2),l(a,o+4)]:d.ctype==3&&(d.tabs[t]=a[o]);else if(t==`IEND`)break;o+=e,s.readUint(a,o),o+=4}var w;return h!=0&&((w=d.frames[d.frames.length-1]).data=n(d,p.slice(0,h),w.rect.width,w.rect.height)),d.data=n(d,f,d.width,d.height),delete d.compress,delete d.interlace,delete d.filter,d},toRGBA8:function(e){let n=e.width,r=e.height;if(e.tabs.acTL==null)return[t(e.data,n,r,e).buffer];let i=[];e.frames[0].data??(e.frames[0].data=e.data);let a=n*r*4,o=new Uint8Array(a),s=new Uint8Array(a),c=new Uint8Array(a);for(let d=0;d<e.frames.length;d++){let f=e.frames[d],p=f.rect.x,m=f.rect.y,h=f.rect.width,g=f.rect.height,_=t(f.data,h,g,e);if(d!=0)for(var u=0;u<a;u++)c[u]=o[u];if(f.blend==0?l(_,h,g,o,n,r,p,m,0):f.blend==1&&l(_,h,g,o,n,r,p,m,1),i.push(o.buffer.slice(0)),f.dispose!=0){if(f.dispose==1)l(s,h,g,o,n,r,p,m,0);else if(f.dispose==2)for(u=0;u<a;u++)o[u]=c[u]}}return i},_paeth:s,_copyTile:l,_bin:e}}();(function(){let{_copyTile:e}=Dd,{_bin:t}=Dd,n=Dd._paeth;var r={table:function(){let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)1&n?n=3988292384^n>>>1:n>>>=1;e[t]=n}return e}(),update(e,t,n,i){for(let a=0;a<i;a++)e=r.table[255&(e^t[n+a])]^e>>>8;return e},crc:(e,t,n)=>4294967295^r.update(4294967295,e,t,n)};function i(e,t,n,r){t[n]+=e[0]*r>>4,t[n+1]+=e[1]*r>>4,t[n+2]+=e[2]*r>>4,t[n+3]+=e[3]*r>>4}function a(e){return Math.max(0,Math.min(255,e))}function o(e,t){let n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return n*n+r*r+i*i+a*a}function s(e,t,n,r,s,c,l){l??=1;let u=r.length,d=[];for(var f=0;f<u;f++){let e=r[f];d.push([e>>>0&255,e>>>8&255,e>>>16&255,e>>>24&255])}for(f=0;f<u;f++){let e=4294967295;for(var p=0,m=0;m<u;m++){var h=o(d[f],d[m]);m!=f&&h<e&&(e=h,p=m)}}let g=new Uint32Array(s.buffer),_=new Int16Array(t*n*4),v=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(f=0;f<v.length;f++)v[f]=255*((v[f]+.5)/16-.5);for(let s=0;s<n;s++)for(let b=0;b<t;b++){var y;f=4*(s*t+b),l==2?(h=v[4*(3&s)+(3&b)],y=[a(e[f]+h),a(e[f+1]+h),a(e[f+2]+h),a(e[f+3]+h)]):y=[a(e[f]+_[f]),a(e[f+1]+_[f+1]),a(e[f+2]+_[f+2]),a(e[f+3]+_[f+3])],p=0;let x=16777215;for(m=0;m<u;m++){let e=o(y,d[m]);e<x&&(x=e,p=m)}let S=d[p],C=[y[0]-S[0],y[1]-S[1],y[2]-S[2],y[3]-S[3]];l==1&&(b!=t-1&&i(C,_,f+4,7),s!=n-1&&(b!=0&&i(C,_,f+4*t-4,3),i(C,_,f+4*t,5),b!=t-1&&i(C,_,f+4*t+4,1))),c[f>>2]=p,g[f>>2]=r[p]}}function c(e,n,i,a,o){o??={};let{crc:s}=r,c=t.writeUint,l=t.writeUshort,u=t.writeASCII,d=8,f=e.frames.length>1,p,m=!1,h=33+(f?20:0);if(o.sRGB!=null&&(h+=13),o.pHYs!=null&&(h+=21),o.iCCP!=null&&(p=pako.deflate(o.iCCP),h+=21+p.length+4),e.ctype==3){for(var g=e.plte.length,_=0;_<g;_++)e.plte[_]>>>24!=255&&(m=!0);h+=8+3*g+4+(m?8+1*g+4:0)}for(var v=0;v<e.frames.length;v++)f&&(h+=38),h+=(S=e.frames[v]).cimg.length+12,v!=0&&(h+=4);h+=12;let y=new Uint8Array(h),b=[137,80,78,71,13,10,26,10];for(_=0;_<8;_++)y[_]=b[_];if(c(y,d,13),d+=4,u(y,d,`IHDR`),d+=4,c(y,d,n),d+=4,c(y,d,i),d+=4,y[d]=e.depth,d++,y[d]=e.ctype,d++,y[d]=0,d++,y[d]=0,d++,y[d]=0,d++,c(y,d,s(y,d-17,17)),d+=4,o.sRGB!=null&&(c(y,d,1),d+=4,u(y,d,`sRGB`),d+=4,y[d]=o.sRGB,d++,c(y,d,s(y,d-5,5)),d+=4),o.iCCP!=null){let e=13+p.length;c(y,d,e),d+=4,u(y,d,`iCCP`),d+=4,u(y,d,`ICC profile`),d+=11,d+=2,y.set(p,d),d+=p.length,c(y,d,s(y,d-(e+4),e+4)),d+=4}if(o.pHYs!=null&&(c(y,d,9),d+=4,u(y,d,`pHYs`),d+=4,c(y,d,o.pHYs[0]),d+=4,c(y,d,o.pHYs[1]),d+=4,y[d]=o.pHYs[2],d++,c(y,d,s(y,d-13,13)),d+=4),f&&(c(y,d,8),d+=4,u(y,d,`acTL`),d+=4,c(y,d,e.frames.length),d+=4,c(y,d,o.loop==null?0:o.loop),d+=4,c(y,d,s(y,d-12,12)),d+=4),e.ctype==3){for(c(y,d,3*(g=e.plte.length)),d+=4,u(y,d,`PLTE`),d+=4,_=0;_<g;_++){let t=3*_,n=e.plte[_],r=255&n,i=n>>>8&255,a=n>>>16&255;y[d+t+0]=r,y[d+t+1]=i,y[d+t+2]=a}if(d+=3*g,c(y,d,s(y,d-3*g-4,3*g+4)),d+=4,m){for(c(y,d,g),d+=4,u(y,d,`tRNS`),d+=4,_=0;_<g;_++)y[d+_]=e.plte[_]>>>24&255;d+=g,c(y,d,s(y,d-g-4,g+4)),d+=4}}let x=0;for(v=0;v<e.frames.length;v++){var S=e.frames[v];f&&(c(y,d,26),d+=4,u(y,d,`fcTL`),d+=4,c(y,d,x++),d+=4,c(y,d,S.rect.width),d+=4,c(y,d,S.rect.height),d+=4,c(y,d,S.rect.x),d+=4,c(y,d,S.rect.y),d+=4,l(y,d,a[v]),d+=2,l(y,d,1e3),d+=2,y[d]=S.dispose,d++,y[d]=S.blend,d++,c(y,d,s(y,d-30,30)),d+=4);let t=S.cimg;c(y,d,(g=t.length)+(v==0?0:4)),d+=4;let n=d;u(y,d,v==0?`IDAT`:`fdAT`),d+=4,v!=0&&(c(y,d,x++),d+=4),y.set(t,d),d+=g,c(y,d,s(y,n,d-n)),d+=4}return c(y,d,0),d+=4,u(y,d,`IEND`),d+=4,c(y,d,s(y,d-4,4)),d+=4,y.buffer}function l(e,t,n){for(let r=0;r<e.frames.length;r++){let i=e.frames[r];i.rect.width;let a=i.rect.height,o=new Uint8Array(a*i.bpl+a);i.cimg=p(i.img,a,i.bpp,i.bpl,o,t,n)}}function u(t,n,r,i,a){let o=a[0],c=a[1],l=a[2],u=a[3],p=a[4],m=a[5],g=6,_=8,v=255;for(var y=0;y<t.length;y++){let e=new Uint8Array(t[y]);for(var b=e.length,x=0;x<b;x+=4)v&=e[x+3]}let S=v!=255,C=function(t,n,r,i,a,o){let s=[];for(var c=0;c<t.length;c++){let d=new Uint8Array(t[c]),p=new Uint32Array(d.buffer);var l;let h=0,g=0,_=n,v=r,y=+!!i;if(c!=0){let b=o||i||c==1||s[c-2].dispose!=0?1:2,x=0,S=1e9;for(let e=0;e<b;e++){var u=new Uint8Array(t[c-1-e]);let i=new Uint32Array(t[c-1-e]),o=n,s=r,l=-1,d=-1;for(let e=0;e<r;e++)for(let t=0;t<n;t++)p[m=e*n+t]!=i[m]&&(t<o&&(o=t),t>l&&(l=t),e<s&&(s=e),e>d&&(d=e));l==-1&&(o=s=l=d=0),a&&((1&o)==1&&o--,(1&s)==1&&s--);let f=(l-o+1)*(d-s+1);f<S&&(S=f,x=e,h=o,g=s,_=l-o+1,v=d-s+1)}u=new Uint8Array(t[c-1-x]),x==1&&(s[c-1].dispose=2),l=new Uint8Array(_*v*4),e(u,n,r,l,_,v,-h,-g,0),y=+!!e(d,n,r,l,_,v,-h,-g,3),y==1?f(d,n,r,l,{x:h,y:g,width:_,height:v}):e(d,n,r,l,_,v,-h,-g,0)}else l=d.slice(0);s.push({rect:{x:h,y:g,width:_,height:v},img:l,blend:y,dispose:0})}if(i)for(c=0;c<s.length;c++){if((h=s[c]).blend==1)continue;let e=h.rect,i=s[c-1].rect,o=Math.min(e.x,i.x),l=Math.min(e.y,i.y),u={x:o,y:l,width:Math.max(e.x+e.width,i.x+i.width)-o,height:Math.max(e.y+e.height,i.y+i.height)-l};s[c-1].dispose=1,c-1!=0&&d(t,n,r,s,c-1,u,a),d(t,n,r,s,c,u,a)}let p=0;if(t.length!=1)for(var m=0;m<s.length;m++){var h;p+=(h=s[m]).rect.width*h.rect.height}return s}(t,n,r,o,c,l),w={},T=[],E=[];if(i!=0){let e=[];for(x=0;x<C.length;x++)e.push(C[x].img.buffer);let t=h(function(e){let t=0;for(var n=0;n<e.length;n++)t+=e[n].byteLength;let r=new Uint8Array(t),i=0;for(n=0;n<e.length;n++){let t=new Uint8Array(e[n]),a=t.length;for(let e=0;e<a;e+=4){let n=t[e],a=t[e+1],o=t[e+2],s=t[e+3];s==0&&(n=a=o=0),r[i+e]=n,r[i+e+1]=a,r[i+e+2]=o,r[i+e+3]=s}i+=a}return r.buffer}(e),i);for(x=0;x<t.plte.length;x++)T.push(t.plte[x].est.rgba);let n=0;for(x=0;x<C.length;x++){let e=(O=C[x]).img.length;var D=new Uint8Array(t.inds.buffer,n>>2,e>>2);E.push(D);let r=new Uint8Array(t.abuf,n,e);m&&s(O.img,O.rect.width,O.rect.height,T,r,D),O.img.set(r),n+=e}}else for(y=0;y<C.length;y++){var O=C[y];let e=new Uint32Array(O.img.buffer);var k=O.rect.width;for(b=e.length,D=new Uint8Array(b),E.push(D),x=0;x<b;x++){let t=e[x];if(x!=0&&t==e[x-1])D[x]=D[x-1];else if(x>k&&t==e[x-k])D[x]=D[x-k];else{let e=w[t];if(e==null&&(w[t]=e=T.length,T.push(t),T.length>=300))break;D[x]=e}}}let A=T.length;for(A<=256&&p==0&&(_=A<=2?1:A<=4?2:A<=16?4:8,_=Math.max(_,u)),y=0;y<C.length;y++){(O=C[y]).rect.x,O.rect.y,k=O.rect.width;let e=O.rect.height,t=O.img;new Uint32Array(t.buffer);let n=4*k,r=4;if(A<=256&&p==0){n=Math.ceil(_*k/8);var j=new Uint8Array(n*e);let i=E[y];for(let t=0;t<e;t++){x=t*n;let e=t*k;if(_==8)for(var M=0;M<k;M++)j[x+M]=i[e+M];else if(_==4)for(M=0;M<k;M++)j[x+(M>>1)]|=i[e+M]<<4-4*(1&M);else if(_==2)for(M=0;M<k;M++)j[x+(M>>2)]|=i[e+M]<<6-2*(3&M);else if(_==1)for(M=0;M<k;M++)j[x+(M>>3)]|=i[e+M]<<7-1*(7&M)}t=j,g=3,r=1}else if(S==0&&C.length==1){j=new Uint8Array(k*e*3);let i=k*e;for(x=0;x<i;x++){let e=3*x,n=4*x;j[e]=t[n],j[e+1]=t[n+1],j[e+2]=t[n+2]}t=j,g=2,r=3,n=3*k}O.img=t,O.bpl=n,O.bpp=r}return{ctype:g,depth:_,plte:T,frames:C}}function d(t,n,r,i,a,o,s){let c=Uint8Array,l=Uint32Array,u=new c(t[a-1]),d=new l(t[a-1]),p=a+1<t.length?new c(t[a+1]):null,m=new c(t[a]),h=new l(m.buffer),g=n,_=r,v=-1,y=-1;for(let e=0;e<o.height;e++)for(let t=0;t<o.width;t++){let r=o.x+t,s=o.y+e,c=s*n+r,l=h[c];l==0||i[a-1].dispose==0&&d[c]==l&&(p==null||p[4*c+3]!=0)||(r<g&&(g=r),r>v&&(v=r),s<_&&(_=s),s>y&&(y=s))}v==-1&&(g=_=v=y=0),s&&((1&g)==1&&g--,(1&_)==1&&_--),o={x:g,y:_,width:v-g+1,height:y-_+1};let b=i[a];b.rect=o,b.blend=1,b.img=new Uint8Array(o.width*o.height*4),i[a-1].dispose==0?(e(u,n,r,b.img,o.width,o.height,-o.x,-o.y,0),f(m,n,r,b.img,o)):e(m,n,r,b.img,o.width,o.height,-o.x,-o.y,0)}function f(t,n,r,i,a){e(t,n,r,i,a.width,a.height,-a.x,-a.y,2)}function p(e,t,n,r,i,a,o){let s=[],c,l=[0,1,2,3,4];a==-1?(t*r>5e5||n==1)&&(l=[0]):l=[a],o&&(c={level:0});let u=Ed;for(var d=0;d<l.length;d++){for(let a=0;a<t;a++)m(i,e,a,r,n,l[d]);s.push(u.deflate(i,c))}let f,p=1e9;for(d=0;d<s.length;d++)s[d].length<p&&(f=d,p=s[d].length);return s[f]}function m(e,t,r,i,a,o){let s=r*i,c=s+r;if(e[c]=o,c++,o==0)if(i<500)for(var l=0;l<i;l++)e[c+l]=t[s+l];else e.set(new Uint8Array(t.buffer,s,i),c);else if(o==1){for(l=0;l<a;l++)e[c+l]=t[s+l];for(l=a;l<i;l++)e[c+l]=t[s+l]-t[s+l-a]+256&255}else if(r==0){for(l=0;l<a;l++)e[c+l]=t[s+l];if(o==2)for(l=a;l<i;l++)e[c+l]=t[s+l];if(o==3)for(l=a;l<i;l++)e[c+l]=t[s+l]-(t[s+l-a]>>1)+256&255;if(o==4)for(l=a;l<i;l++)e[c+l]=t[s+l]-n(t[s+l-a],0,0)+256&255}else{if(o==2)for(l=0;l<i;l++)e[c+l]=t[s+l]+256-t[s+l-i]&255;if(o==3){for(l=0;l<a;l++)e[c+l]=t[s+l]+256-(t[s+l-i]>>1)&255;for(l=a;l<i;l++)e[c+l]=t[s+l]+256-(t[s+l-i]+t[s+l-a]>>1)&255}if(o==4){for(l=0;l<a;l++)e[c+l]=t[s+l]+256-n(0,t[s+l-i],0)&255;for(l=a;l<i;l++)e[c+l]=t[s+l]+256-n(t[s+l-a],t[s+l-i],t[s+l-a-i])&255}}}function h(e,t){let n=new Uint8Array(e),r=n.slice(0),i=new Uint32Array(r.buffer),a=g(r,t),o=a[0],s=a[1],c=n.length,l=new Uint8Array(c>>2),u;if(n.length<2e7)for(var d=0;d<c;d+=4)u=_(o,f=n[d]*(1/255),p=n[d+1]*(1/255),m=n[d+2]*(1/255),h=n[d+3]*(1/255)),l[d>>2]=u.ind,i[d>>2]=u.est.rgba;else for(d=0;d<c;d+=4){var f=n[d]*(1/255),p=n[d+1]*(1/255),m=n[d+2]*(1/255),h=n[d+3]*(1/255);for(u=o;u.left;)u=v(u.est,f,p,m,h)<=0?u.left:u.right;l[d>>2]=u.ind,i[d>>2]=u.est.rgba}return{abuf:r.buffer,inds:l,plte:s}}function g(e,t,n){n??=1e-4;let r=new Uint32Array(e.buffer),i={i0:0,i1:e.length,bst:null,est:null,tdst:0,left:null,right:null};i.bst=x(e,i.i0,i.i1),i.est=S(i.bst);let a=[i];for(;a.length<t;){let t=0,i=0;for(var o=0;o<a.length;o++)a[o].est.L>t&&(t=a[o].est.L,i=o);if(t<n)break;let s=a[i],c=y(e,r,s.i0,s.i1,s.est.e,s.est.eMq255);if(s.i0>=c||s.i1<=c){s.est.L=0;continue}let l={i0:s.i0,i1:c,bst:null,est:null,tdst:0,left:null,right:null};l.bst=x(e,l.i0,l.i1),l.est=S(l.bst);let u={i0:c,i1:s.i1,bst:null,est:null,tdst:0,left:null,right:null};for(u.bst={R:[],m:[],N:s.bst.N-l.bst.N},o=0;o<16;o++)u.bst.R[o]=s.bst.R[o]-l.bst.R[o];for(o=0;o<4;o++)u.bst.m[o]=s.bst.m[o]-l.bst.m[o];u.est=S(u.bst),s.left=l,s.right=u,a[i]=l,a.push(u)}for(a.sort(((e,t)=>t.bst.N-e.bst.N)),o=0;o<a.length;o++)a[o].ind=o;return[i,a]}function _(e,t,n,r,i){if(e.left==null)return e.tdst=function(e,t,n,r,i){let a=t-e[0],o=n-e[1],s=r-e[2],c=i-e[3];return a*a+o*o+s*s+c*c}(e.est.q,t,n,r,i),e;let a=v(e.est,t,n,r,i),o=e.left,s=e.right;a>0&&(o=e.right,s=e.left);let c=_(o,t,n,r,i);if(c.tdst<=a*a)return c;let l=_(s,t,n,r,i);return l.tdst<c.tdst?l:c}function v(e,t,n,r,i){let{e:a}=e;return a[0]*t+a[1]*n+a[2]*r+a[3]*i-e.eMq}function y(e,t,n,r,i,a){for(r-=4;n<r;){for(;b(e,n,i)<=a;)n+=4;for(;b(e,r,i)>a;)r-=4;if(n>=r)break;let o=t[n>>2];t[n>>2]=t[r>>2],t[r>>2]=o,n+=4,r-=4}for(;b(e,n,i)>a;)n-=4;return n+4}function b(e,t,n){return e[t]*n[0]+e[t+1]*n[1]+e[t+2]*n[2]+e[t+3]*n[3]}function x(e,t,n){let r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0],a=n-t>>2;for(let a=t;a<n;a+=4){let t=e[a]*(1/255),n=e[a+1]*(1/255),o=e[a+2]*(1/255),s=e[a+3]*(1/255);i[0]+=t,i[1]+=n,i[2]+=o,i[3]+=s,r[0]+=t*t,r[1]+=t*n,r[2]+=t*o,r[3]+=t*s,r[5]+=n*n,r[6]+=n*o,r[7]+=n*s,r[10]+=o*o,r[11]+=o*s,r[15]+=s*s}return r[4]=r[1],r[8]=r[2],r[9]=r[6],r[12]=r[3],r[13]=r[7],r[14]=r[11],{R:r,m:i,N:a}}function S(e){let{R:t}=e,{m:n}=e,{N:r}=e,i=n[0],a=n[1],o=n[2],s=n[3],c=r==0?0:1/r,l=[t[0]-i*i*c,t[1]-i*a*c,t[2]-i*o*c,t[3]-i*s*c,t[4]-a*i*c,t[5]-a*a*c,t[6]-a*o*c,t[7]-a*s*c,t[8]-o*i*c,t[9]-o*a*c,t[10]-o*o*c,t[11]-o*s*c,t[12]-s*i*c,t[13]-s*a*c,t[14]-s*o*c,t[15]-s*s*c],u=l,d=C,f=[Math.random(),Math.random(),Math.random(),Math.random()],p=0,m=0;if(r!=0)for(let e=0;e<16&&(f=d.multVec(u,f),m=Math.sqrt(d.dot(f,f)),f=d.sml(1/m,f),!(e!=0&&Math.abs(m-p)<1e-9));e++)p=m;let h=[i*c,a*c,o*c,s*c];return{Cov:l,q:h,e:f,L:p,eMq255:d.dot(d.sml(255,h),f),eMq:d.dot(f,h),rgba:(Math.round(255*h[3])<<24|Math.round(255*h[2])<<16|Math.round(255*h[1])<<8|Math.round(255*h[0])<<0)>>>0}}var C={multVec:(e,t)=>[e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],e[4]*t[0]+e[5]*t[1]+e[6]*t[2]+e[7]*t[3],e[8]*t[0]+e[9]*t[1]+e[10]*t[2]+e[11]*t[3],e[12]*t[0]+e[13]*t[1]+e[14]*t[2]+e[15]*t[3]],dot:(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],sml:(e,t)=>[e*t[0],e*t[1],e*t[2],e*t[3]]};Dd.encode=function(e,t,n,r,i,a,o){r??=0,o??=!1;let s=u(e,t,n,r,[!1,!1,!1,0,o,!1]);return l(s,-1),c(s,t,n,i,a)},Dd.encodeLL=function(e,t,n,r,i,a,o,s){let u={ctype:0+(r==1?0:2)+(i==0?0:4),depth:a,frames:[]},d=(r+i)*a,f=d*t;for(let r=0;r<e.length;r++)u.frames.push({rect:{x:0,y:0,width:t,height:n},img:new Uint8Array(e[r]),blend:0,dispose:1,bpp:Math.ceil(d/8),bpl:Math.ceil(f/8)});return l(u,0,!0),c(u,t,n,o,s)},Dd.encode.compress=u,Dd.encode.dither=s,Dd.quantize=h,Dd.quantize.getKDtree=g,Dd.quantize.getNearest=_})();var Od={toArrayBuffer(e,t){let n=e.width,r=e.height,i=n<<2,a=e.getContext(`2d`).getImageData(0,0,n,r),o=new Uint32Array(a.data.buffer),s=(32*n+31)/32<<2,c=s*r,l=122+c,u=new ArrayBuffer(l),d=new DataView(u),f=1<<20,p,m,h,g,_=f,v=0,y=0,b=0;function x(e){d.setUint16(y,e,!0),y+=2}function S(e){d.setUint32(y,e,!0),y+=4}function C(e){y+=e}x(19778),S(l),C(4),S(122),S(108),S(n),S(-r>>>0),x(1),x(32),S(3),S(c),S(2835),S(2835),C(8),S(16711680),S(65280),S(255),S(4278190080),S(1466527264),function e(){for(;v<r&&_>0;){for(g=122+v*s,p=0;p<i;)_--,m=o[b++],h=m>>>24,d.setUint32(g+p,m<<8|h),p+=4;v++}b<o.length?(_=f,setTimeout(e,Od._dly)):t(u)}()},toBlob(e,t){this.toArrayBuffer(e,(e=>{t(new Blob([e],{type:`image/bmp`}))}))},_dly:9},kd={CHROME:`CHROME`,FIREFOX:`FIREFOX`,DESKTOP_SAFARI:`DESKTOP_SAFARI`,IE:`IE`,IOS:`IOS`,ETC:`ETC`},Ad={[kd.CHROME]:16384,[kd.FIREFOX]:11180,[kd.DESKTOP_SAFARI]:16384,[kd.IE]:8192,[kd.IOS]:4096,[kd.ETC]:8192},jd=typeof window<`u`,Md=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope,Nd=jd&&window.cordova&&window.cordova.require&&window.cordova.require(`cordova/modulemapper`),Pd=(jd||Md)&&(Nd&&Nd.getOriginalSymbol(window,`File`)||typeof File<`u`&&File),Fd=(jd||Md)&&(Nd&&Nd.getOriginalSymbol(window,`FileReader`)||typeof FileReader<`u`&&FileReader);function Id(e,t,n=Date.now()){return new Promise((r=>{let i=e.split(`,`),a=i[0].match(/:(.*?);/)[1],o=globalThis.atob(i[1]),s=o.length,c=new Uint8Array(s);for(;s--;)c[s]=o.charCodeAt(s);let l=new Blob([c],{type:a});l.name=t,l.lastModified=n,r(l)}))}function Ld(e){return new Promise(((t,n)=>{let r=new Fd;r.onload=()=>t(r.result),r.onerror=e=>n(e),r.readAsDataURL(e)}))}function Rd(e){return new Promise(((t,n)=>{let r=new Image;r.onload=()=>t(r),r.onerror=e=>n(e),r.src=e}))}function zd(){if(zd.cachedResult!==void 0)return zd.cachedResult;let e=kd.ETC,{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=kd.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=kd.IOS:/Safari/i.test(t)?e=kd.DESKTOP_SAFARI:/Firefox/i.test(t)?e=kd.FIREFOX:(/MSIE/i.test(t)||!!document.documentMode==1)&&(e=kd.IE),zd.cachedResult=e,zd.cachedResult}function Bd(e,t){let n=Ad[zd()],r=e,i=t,a=r*i,o=r>i?i/r:r/i;for(;a>n*n;){let e=(n+r)/2,t=(n+i)/2;e<t?(i=t,r=t*o):(i=e*o,r=e),a=r*i}return{width:r,height:i}}function Vd(e,t){let n,r;try{if(n=new OffscreenCanvas(e,t),r=n.getContext(`2d`),r===null)throw Error(`getContext of OffscreenCanvas returns null`)}catch{n=document.createElement(`canvas`),r=n.getContext(`2d`)}return n.width=e,n.height=t,[n,r]}function Hd(e,t){let{width:n,height:r}=Bd(e.width,e.height),[i,a]=Vd(n,r);return t&&/jpe?g/.test(t)&&(a.fillStyle=`white`,a.fillRect(0,0,i.width,i.height)),a.drawImage(e,0,0,i.width,i.height),i}function Ud(){return Ud.cachedResult!==void 0||(Ud.cachedResult=[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&typeof document<`u`&&`ontouchend`in document),Ud.cachedResult}function Wd(e,t={}){return new Promise((function(n,r){let i,a;var o=function(){try{return a=Hd(i,t.fileType||e.type),n([i,a])}catch(e){return r(e)}},s=function(t){try{var n=function(e){try{throw e}catch(e){return r(e)}};try{let t;return Ld(e).then((function(e){try{return t=e,Rd(t).then((function(e){try{return i=e,function(){try{return o()}catch(e){return r(e)}}()}catch(e){return n(e)}}),n)}catch(e){return n(e)}}),n)}catch(e){n(e)}}catch(e){return r(e)}};try{if(Ud()||[kd.DESKTOP_SAFARI,kd.MOBILE_SAFARI].includes(zd()))throw Error(`Skip createImageBitmap on IOS and Safari`);return createImageBitmap(e).then((function(e){try{return i=e,o()}catch{return s()}}),s)}catch{s()}}))}function Gd(e,t,n,r,i=1){return new Promise((function(a,o){let s;if(t===`image/png`){let a,o,c;return a=e.getContext(`2d`),{data:o}=a.getImageData(0,0,e.width,e.height),c=Dd.encode([o.buffer],e.width,e.height,4096*i),s=new Blob([c],{type:t}),s.name=n,s.lastModified=r,u.call(this)}{if(t===`image/bmp`)return new Promise((t=>Od.toBlob(e,t))).then(function(e){try{return s=e,s.name=n,s.lastModified=r,l.call(this)}catch(e){return o(e)}}.bind(this),o);{if(typeof OffscreenCanvas==`function`&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:i}).then(function(e){try{return s=e,s.name=n,s.lastModified=r,c.call(this)}catch(e){return o(e)}}.bind(this),o);{let a;return a=e.toDataURL(t,i),Id(a,n,r).then(function(e){try{return s=e,c.call(this)}catch(e){return o(e)}}.bind(this),o)}function c(){return l.call(this)}}function l(){return u.call(this)}}function u(){return a(s)}}))}function Kd(e){e.width=0,e.height=0}function qd(){return new Promise((function(e,t){let n,r,i,a;return qd.cachedResult===void 0?Id(`data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==`,`test.jpg`,Date.now()).then((function(o){try{return n=o,Wd(n).then((function(o){try{return r=o[1],Gd(r,n.type,n.name,n.lastModified).then((function(n){try{return i=n,Kd(r),Wd(i).then((function(n){try{return a=n[0],qd.cachedResult=a.width===1&&a.height===2,e(qd.cachedResult)}catch(e){return t(e)}}),t)}catch(e){return t(e)}}),t)}catch(e){return t(e)}}),t)}catch(e){return t(e)}}),t):e(qd.cachedResult)}))}function Jd(e){return new Promise(((t,n)=>{let r=new Fd;r.onload=e=>{let n=new DataView(e.target.result);if(n.getUint16(0,!1)!=65496)return t(-2);let r=n.byteLength,i=2;for(;i<r;){if(n.getUint16(i+2,!1)<=8)return t(-1);let e=n.getUint16(i,!1);if(i+=2,e==65505){if(n.getUint32(i+=2,!1)!=1165519206)return t(-1);let e=n.getUint16(i+=6,!1)==18761;i+=n.getUint32(i+4,e);let r=n.getUint16(i,e);i+=2;for(let a=0;a<r;a++)if(n.getUint16(i+12*a,e)==274)return t(n.getUint16(i+12*a+8,e))}else{if((65280&e)!=65280)break;i+=n.getUint16(i,!1)}}return t(-1)},r.onerror=e=>n(e),r.readAsArrayBuffer(e)}))}function Yd(e,t){let{width:n}=e,{height:r}=e,{maxWidthOrHeight:i}=t,a,o=e;return isFinite(i)&&(n>i||r>i)&&([o,a]=Vd(n,r),n>r?(o.width=i,o.height=r/n*i):(o.width=n/r*i,o.height=i),a.drawImage(e,0,0,o.width,o.height),Kd(e)),o}function Xd(e,t){let{width:n}=e,{height:r}=e,[i,a]=Vd(n,r);switch(t>4&&t<9?(i.width=r,i.height=n):(i.width=n,i.height=r),t){case 2:a.transform(-1,0,0,1,n,0);break;case 3:a.transform(-1,0,0,-1,n,r);break;case 4:a.transform(1,0,0,-1,0,r);break;case 5:a.transform(0,1,1,0,0,0);break;case 6:a.transform(0,1,-1,0,r,0);break;case 7:a.transform(0,-1,-1,0,r,n);break;case 8:a.transform(0,-1,1,0,0,n)}return a.drawImage(e,0,0,n,r),Kd(e),i}function Zd(e,t,n=0){return new Promise((function(r,i){let a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w;function T(e=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;a+=e,t.onProgress(Math.min(a,100))}function E(e){if(t.signal&&t.signal.aborted)throw t.signal.reason;a=Math.min(Math.max(e,a),100),t.onProgress(a)}return a=n,o=t.maxIteration||10,s=1024*t.maxSizeMB*1024,T(),Wd(e,t).then(function(n){try{return[,c]=n,T(),l=Yd(c,t),T(),new Promise((function(n,r){var i;if(!(i=t.exifOrientation))return Jd(e).then(function(e){try{return i=e,a.call(this)}catch(e){return r(e)}}.bind(this),r);function a(){return n(i)}return a.call(this)})).then(function(n){try{return u=n,T(),qd().then(function(n){try{return d=n?l:Xd(l,u),T(),f=t.initialQuality||1,p=t.fileType||e.type,Gd(d,p,e.name,e.lastModified,f).then(function(n){try{{if(m=n,T(),h=m.size>s,g=m.size>e.size,!h&&!g)return E(100),r(m);var a;function u(){if(o--&&(y>s||y>_)){let t,n;return t=w?.95*C.width:C.width,n=w?.95*C.height:C.height,[x,S]=Vd(t,n),S.drawImage(C,0,0,t,n),f*=p===`image/png`?.85:.95,Gd(x,p,e.name,e.lastModified,f).then((function(e){try{return b=e,Kd(C),C=x,y=b.size,E(Math.min(99,Math.floor((v-y)/(v-s)*100))),u}catch(e){return i(e)}}),i)}return[1]}return _=e.size,v=m.size,y=v,C=d,w=!t.alwaysKeepResolution&&h,(a=function(e){for(;e;){if(e.then)return void e.then(a,i);try{if(e.pop){if(e.length)return e.pop()?D.call(this):e;e=u}else e=e.call(this)}catch(e){return i(e)}}}.bind(this))(u);function D(){return Kd(C),Kd(x),Kd(l),Kd(d),Kd(c),E(100),r(b)}}}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}))}var Qd=`
31
+ `)}function hu(e){var t={};if(e.inner){if(e.inner.length===0)return cu(t,e.path,e.message);for(var n=e.inner,r=Array.isArray(n),i=0,n=r?n:n[Symbol.iterator]();;){var a;if(r){if(i>=n.length)break;a=n[i++]}else{if(i=n.next(),i.done)break;a=i.value}var o=a;Q(t,o.path)||(t=cu(t,o.path,o.message))}}return t}function gu(e,t,n,r){n===void 0&&(n=!1);var i=_u(e);return t[n?`validateSync`:`validate`](i,{abortEarly:!1,context:r||i})}function _u(e){var t=Array.isArray(e)?[]:{};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=String(n);Array.isArray(e[r])===!0?t[r]=e[r].map(function(e){return Array.isArray(e)===!0||$i(e)?_u(e):e===``?void 0:e}):$i(e[r])?t[r]=_u(e[r]):t[r]=e[r]===``?void 0:e[r]}return t}function vu(e,t,n){var r=e.slice();return t.forEach(function(t,i){r[i]===void 0?r[i]=n.clone!==!1&&n.isMergeableObject(t)?Oi(Array.isArray(t)?[]:{},t,n):t:n.isMergeableObject(t)?r[i]=Oi(e[i],t,n):e.indexOf(t)===-1&&r.push(t)}),r}function yu(e){return Array.from(e).filter(function(e){return e.selected}).map(function(e){return e.value})}function bu(e,t,n){if(typeof e==`boolean`)return!!t;var r=[],i=!1,a=-1;if(Array.isArray(e))r=e,a=e.indexOf(n),i=a>=0;else if(!n||n==`true`||n==`false`)return!!t;return t&&n&&!i?r.concat(n):i?r.slice(0,a).concat(r.slice(a+1)):r}var xu=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?t.useLayoutEffect:t.useEffect;function Su(e){var n=(0,t.useRef)(e);return xu(function(){n.current=e}),(0,t.useCallback)(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.current.apply(void 0,t)},[])}var Cu=(0,t.forwardRef)(function(e,n){var r=e.action,i=Zl(e,[`action`]),a=r??`#`,o=eu(),s=o.handleReset,c=o.handleSubmit;return(0,t.createElement)(`form`,X({onSubmit:c,ref:n,onReset:s,action:a},i))});Cu.displayName=`Form`;var wu=function(e,t,n){var r=Ou(e),i=r[t];return r.splice(t,1),r.splice(n,0,i),r},Tu=function(e,t,n){var r=Ou(e),i=r[t];return r[t]=r[n],r[n]=i,r},Eu=function(e,t,n){var r=Ou(e);return r.splice(t,0,n),r},Du=function(e,t,n){var r=Ou(e);return r[t]=n,r},Ou=function(e){if(!e)return[];if(Array.isArray(e))return[].concat(e);var t=Object.keys(e).map(function(e){return parseInt(e)}).reduce(function(e,t){return t>e?t:e},0);return Array.from(X({},e,{length:t+1}))},ku=function(e,t){var n=typeof e==`function`?e:t;return function(e){return Array.isArray(e)||nu(e)?n(Ou(e)):e}},Au=function(e){Xl(n,e);function n(t){var n=e.call(this,t)||this;return n.updateArrayField=function(e,t,r){var i=n.props,a=i.name,o=i.formik.setFormikState;o(function(n){var i=ku(r,e),o=ku(t,e),s=cu(n.values,a,e(Q(n.values,a))),c=r?i(Q(n.errors,a)):void 0,l=t?o(Q(n.touched,a)):void 0;return tu(c)&&(c=void 0),tu(l)&&(l=void 0),X({},n,{values:s,errors:r?cu(n.errors,a,c):n.errors,touched:t?cu(n.touched,a,l):n.touched})})},n.push=function(e){return n.updateArrayField(function(t){return[].concat(Ou(t),[Sl(e)])},!1,!1)},n.handlePush=function(e){return function(){return n.push(e)}},n.swap=function(e,t){return n.updateArrayField(function(n){return Tu(n,e,t)},!0,!0)},n.handleSwap=function(e,t){return function(){return n.swap(e,t)}},n.move=function(e,t){return n.updateArrayField(function(n){return wu(n,e,t)},!0,!0)},n.handleMove=function(e,t){return function(){return n.move(e,t)}},n.insert=function(e,t){return n.updateArrayField(function(n){return Eu(n,e,t)},function(t){return Eu(t,e,null)},function(t){return Eu(t,e,null)})},n.handleInsert=function(e,t){return function(){return n.insert(e,t)}},n.replace=function(e,t){return n.updateArrayField(function(n){return Du(n,e,t)},!1,!1)},n.handleReplace=function(e,t){return function(){return n.replace(e,t)}},n.unshift=function(e){var t=-1;return n.updateArrayField(function(n){var r=n?[e].concat(n):[e];return t=r.length,r},function(e){return e?[null].concat(e):[null]},function(e){return e?[null].concat(e):[null]}),t},n.handleUnshift=function(e){return function(){return n.unshift(e)}},n.handleRemove=function(e){return function(){return n.remove(e)}},n.handlePop=function(){return function(){return n.pop()}},n.remove=n.remove.bind(Ql(n)),n.pop=n.pop.bind(Ql(n)),n}var r=n.prototype;return r.componentDidUpdate=function(e){this.props.validateOnChange&&this.props.formik.validateOnChange&&!(0,wl.default)(Q(e.formik.values,e.name),Q(this.props.formik.values,this.props.name))&&this.props.formik.validateForm(this.props.formik.values)},r.remove=function(e){var t;return this.updateArrayField(function(n){var r=n?Ou(n):[];return t||=r[e],Z(r.splice)&&r.splice(e,1),Z(r.every)&&r.every(function(e){return e===void 0})?[]:r},!0,!0),t},r.pop=function(){var e;return this.updateArrayField(function(t){var n=t.slice();return e||=n&&n.pop&&n.pop(),n},!0,!0),e},r.render=function(){var e={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},n=this.props,r=n.component,i=n.render,a=n.children,o=n.name,s=n.formik,c=Zl(s,[`validate`,`validationSchema`]),l=X({},e,{form:c,name:o});return r?(0,t.createElement)(r,l):i?i(l):a?typeof a==`function`?a(l):au(a)?null:t.Children.only(a):null},n}(t.Component);Au.defaultProps={validateOnChange:!0};var ju=e.w(((t,n)=>{var r=e.v(),i=e.h(),a=`[object Symbol]`;function o(e){return typeof e==`symbol`||i(e)&&r(e)==a}n.exports=o})),Mu=e.w(((t,n)=>{var r=e.m(),i=ju(),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/;function s(e,t){if(r(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||i(e)?!0:o.test(e)||!a.test(e)||t!=null&&e in Object(t)}n.exports=s})),Nu=e.w(((t,n)=>{var r=e.g(),i=`Expected a function`;function a(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(i);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(a.Cache||r),n}a.Cache=r,n.exports=a})),Pu=e.w(((e,t)=>{var n=Nu(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),Fu=e.w(((e,t)=>{var n=Pu(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),Iu=e.w(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}t.exports=n})),Lu=e.w(((t,n)=>{var r=e.y(),i=Iu(),a=e.m(),o=ju(),s=1/0,c=r?r.prototype:void 0,l=c?c.toString:void 0;function u(e){if(typeof e==`string`)return e;if(a(e))return i(e,u)+``;if(o(e))return l?l.call(e):``;var t=e+``;return t==`0`&&1/e==-s?`-0`:t}n.exports=u})),Ru=e.w(((e,t)=>{var n=Lu();function r(e){return e==null?``:n(e)}t.exports=r})),zu=e.w(((t,n)=>{var r=e.m(),i=Mu(),a=Fu(),o=Ru();function s(e,t){return r(e)?e:i(e,t)?[e]:a(o(e))}n.exports=s})),Bu=e.w(((e,t)=>{var n=ju(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),Vu=e.w(((e,t)=>{var n=zu(),r=Bu();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i<a;)e=e[r(t[i++])];return i&&i==a?e:void 0}t.exports=i})),Hu=e.w(((e,t)=>{var n=Vu();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),Uu=e.T(Hu(),1),Wu=(e=16)=>{let t={upper:`ABCDEFGHIJKLMNOPQRSTUVWXYZ`,lower:`abcdefghijklmnopqrstuvwxyz`,numbers:`0123456789`,symbols:`!@%^&*()_+[]{}|;:,.<>?`},n=t.upper+t.lower+t.numbers+t.symbols,r=e=>e[crypto.getRandomValues(new Uint32Array(1))[0]%e.length],i=[r(t.upper),r(t.lower),r(t.numbers),r(t.symbols)];for(let t=4;t<e;t++)i.push(r(n));for(let e=i.length-1;e>0;e--){let t=crypto.getRandomValues(new Uint32Array(1))[0]%(e+1),n=i[e];i[e]=i[t],i[t]=n}return i.join(``)},Gu=({showPassword:e,onToggleVisibility:t,onGenerate:n})=>(0,i.jsxs)(r.InputAdornment,{position:`end`,children:[n&&(0,i.jsx)(r.Tooltip,{title:`Generate Password`,children:(0,i.jsx)(r.IconButton,{onClick:n,edge:`end`,size:`small`,sx:{opacity:.7},"aria-label":`generate password`,children:(0,i.jsx)(Jr,{})})}),(0,i.jsx)(r.Tooltip,{title:e?`Hide password`:`Show password`,children:(0,i.jsx)(r.IconButton,{onClick:t,edge:`end`,size:`small`,sx:{opacity:.7},"aria-label":e?`hide password`:`show password`,children:e?(0,i.jsx)(pi,{}):(0,i.jsx)(fi,{})})})]}),Ku=({type:e,autoGenerate:t=!1,formik:r,name:i})=>{let[a,o]=(0,n.useState)(!1),s={},c=a?`text`:`password`;return e===`password`?(s.endAdornment=Gu({showPassword:a,onToggleVisibility:()=>{o(!a)},onGenerate:t?()=>{if(!r||!i)return;let e=Wu();r.setFieldValue(i,e),a||o(!0)}:void 0}),{inputType:c,inputProps:s}):{inputType:e,inputProps:s}},qu=({helperText:e,errorText:t,formik:a,name:o,defaultValue:s,onChange:c,type:l,fullWidth:u=!0,autoGenerate:d=!1,...f})=>{let p=Ku({type:l,autoGenerate:d,formik:a,name:o}),m={},h=f.value??s;if((0,n.useEffect)(()=>{!a||!o||h===void 0||a.setFieldValue(o,h)},[h]),o&&a){a.touched[o]&&(t??=a.errors[o]);let e=(0,Uu.default)(a.values,o,``);l===`date`&&(e=Ju(e)),m={value:e??``,onBlur:()=>a.setFieldTouched(o),onChange:e=>{let t=e.target.value;l===`date`&&t&&(t=new Date(t)),a.setFieldValue(o,t||null),c?.(e)},slotProps:{...f.slotProps,input:{...f.InputProps,...f.slotProps?.input,...p.inputProps},inputLabel:l===`date`?{shrink:!0}:void 0}}}return(0,i.jsx)(r.TextField,{variant:`standard`,onChange:c,...f,...m,name:o,type:p.inputType,fullWidth:u,helperText:t||e,error:!!t})},Ju=e=>{if(!e)return``;let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`},Yu=({multiple:t=!1,formik:a,name:o,label:s=`Search users`,disabled:c=!1,error:l,helperText:u,value:d,onChange:f})=>{let[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)([]),[_,v]=(0,n.useState)(!1),[y,b]=(0,n.useState)(``),x=(0,n.useCallback)(async t=>{if(t.length<2){g([]);return}v(!0);try{let n=e.a();if(!n)return;g(await n.searchUsers({name:t}))}catch(t){e.x.error(`Failed to search users:`,t),g([])}finally{v(!1)}},[]),S=(0,n.useCallback)((e,t)=>{b(t),x(t)},[x]),C=()=>d===void 0?a&&o?a.values[o]:t?[]:null:d,w=(e,t)=>{f?f(t):a&&o&&a.setFieldValue(o,t)},T=()=>{a&&o&&a.setFieldTouched(o)},E=()=>{if(l)return` `;if(a&&o&&a.touched[o]&&a.errors[o])return a.errors[o]};return(0,i.jsx)(r.Autocomplete,{open:p,onOpen:()=>m(!0),onClose:()=>m(!1),multiple:t,options:h,value:C(),onChange:w,onBlur:T,onInputChange:S,getOptionLabel:e=>e.name,isOptionEqualToValue:(e,t)=>e.id===t.id,loading:_,noOptionsText:y.length<3?`Type at least 3 characters to search`:`No users found`,renderOption:(e,t)=>(0,n.createElement)(r.Box,{component:`li`,...e,key:t.id},(0,i.jsxs)(r.Box,{children:[(0,i.jsx)(r.Typography,{variant:`body1`,children:t.name}),(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,children:t.email})]})),renderInput:e=>(0,i.jsx)(r.TextField,{...e,label:s,disabled:c,variant:`standard`,error:!!E(),helperText:E()||u,InputProps:{...e.InputProps,endAdornment:(0,i.jsxs)(i.Fragment,{children:[_?(0,i.jsx)(r.CircularProgress,{size:20}):null,e.InputProps.endAdornment]})}})})},Xu=e.S({name:e.C().trim().required(`Group name is required`).min(2,`Group name must be at least 2 characters`).max(100,`Group name must be at most 100 characters`)}),Zu=({open:t,onClose:a,onSuccess:s,orgId:c})=>{let[l,u]=(0,n.useState)(null),d=pu({initialValues:{name:``,read_only:!1,members:[]},validationSchema:Xu,onSubmit:async(t,{setSubmitting:n,resetForm:r})=>{u(null);try{let n=e.a();if(!n)return;let i=await n.createGroup(c,{name:t.name.trim(),read_only:t.read_only});t.members&&t.members.length>0&&await n.addGroupMembers(c,i.id,t.members.map(e=>({user:e.userId,role:e.role}))),r(),s?.(),a()}catch(e){u(o(e,`Failed to create group`))}n(!1)}}),f=e=>{let t=Array.isArray(e)?e:[];d.setFieldValue(`members`,t.map(e=>({userId:e.id,role:`member`,user:e})))},p=(e,t)=>{let n=d.values.members.map(n=>n.userId===e?{...n,role:t}:n);d.setFieldValue(`members`,n)},m=e=>{let t=d.values.members.filter(t=>t.userId!==e);d.setFieldValue(`members`,t)},h=()=>{d.resetForm(),a()};return(0,i.jsxs)(r.Dialog,{open:t,onClose:h,maxWidth:`sm`,fullWidth:!0,PaperProps:{component:`form`,onSubmit:d.handleSubmit},children:[(0,i.jsx)(r.DialogTitle,{children:`Create New Group`}),(0,i.jsx)(r.DialogContent,{children:(0,i.jsxs)(r.Box,{sx:{display:`flex`,flexDirection:`column`,gap:2,pt:1},children:[l&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>u(null),children:l.message}),(0,i.jsx)(qu,{label:`Group Name`,name:`name`,formik:d,required:!0,disabled:d.isSubmitting,placeholder:`e.g., Computer Science 101`}),(0,i.jsx)(r.FormControlLabel,{control:(0,i.jsx)(r.Switch,{name:`read_only`,checked:d.values.read_only,onChange:d.handleChange,disabled:d.isSubmitting}),label:`Read-only group (only moderators can post)`}),(0,i.jsx)(r.Divider,{sx:{my:2}}),(0,i.jsxs)(r.Box,{children:[(0,i.jsx)(r.Typography,{variant:`subtitle2`,gutterBottom:!0,children:`Add Members`}),(0,i.jsx)(Yu,{multiple:!0,label:`Search users to add`,value:d.values.members.map(e=>e.user),onChange:f,disabled:d.isSubmitting})]}),d.values.members.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Typography,{variant:`subtitle2`,gutterBottom:!0,children:`Selected Members`}),d.values.members.map(e=>(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,borderRadius:1},children:[(0,i.jsx)(r.Box,{sx:{flex:1},children:e.user.name}),(0,i.jsxs)(r.Select,{value:e.role,onChange:t=>p(e.userId,t.target.value),size:`small`,disabled:d.isSubmitting,sx:{mr:2},children:[(0,i.jsx)(r.MenuItem,{value:`member`,children:`Member`}),(0,i.jsx)(r.MenuItem,{value:`moderator`,children:`Moderator`})]}),(0,i.jsx)(r.IconButton,{size:`small`,onClick:()=>m(e.userId),disabled:d.isSubmitting,color:`error`,children:(0,i.jsx)(Qr,{})})]},e.userId))]})]})}),(0,i.jsxs)(r.DialogActions,{sx:{p:3},children:[(0,i.jsx)(r.Button,{onClick:h,disabled:d.isSubmitting,children:`Cancel`}),(0,i.jsx)(r.Button,{type:`submit`,variant:`contained`,disabled:d.isSubmitting||!d.isValid,startIcon:d.isSubmitting&&(0,i.jsx)(r.CircularProgress,{size:16}),children:`Create Group`})]})]})},Qu=async t=>{let n=e.a();if(!n)throw Error(`SDK not initialized`);let r=await n.getGroups(t);return await e.d.groups.clear(),await e.d.groups.bulkPut(r),r},$u=async(t,n,r)=>{let i=e.a();if(!i)throw Error(`SDK not initialized`);let a=await i.updateGroup(t,n,{name:r});return await e.d.groups.update(n,{name:a.name}),a},ed=async(t,n)=>{let r=e.a();if(!r)throw Error(`SDK not initialized`);await r.deleteGroup(t,n),await e.d.groups.delete(n),await e.d.summaries.filter(e=>e.group===n).delete()};function td(e,t,r){let i,a;typeof e==`function`?(i=t||[],a=r):(i=[],a=t);let o=n.default.useRef({hasResult:!1,result:a,error:null}),[s,c]=n.default.useReducer(e=>e+1,0),l=n.default.useMemo(()=>{let t=typeof e==`function`?e():e;if(!t||typeof t.subscribe!=`function`)throw TypeError(e===t?`Given argument to useObservable() was neither a valid observable nor a function.`:`Observable factory given to useObservable() did not return a valid observable.`);if(!o.current.hasResult&&typeof window<`u`&&(typeof t.hasValue!=`function`||t.hasValue()))if(typeof t.getValue==`function`)o.current.result=t.getValue(),o.current.hasResult=!0;else{let e=t.subscribe(e=>{o.current.result=e,o.current.hasResult=!0});typeof e==`function`?e():e.unsubscribe()}return t},i);if(n.default.useDebugValue(o.current.result),n.default.useEffect(()=>{let e=l.subscribe(e=>{let{current:t}=o;(t.error!==null||t.result!==e)&&(t.error=null,t.result=e,t.hasResult=!0,c())},e=>{let{current:t}=o;t.error!==e&&(t.error=e,c())});return typeof e==`function`?e:e.unsubscribe.bind(e)},i),o.current.error)throw o.current.error;return o.current.result}function nd(t,n,r){return td(()=>e.f.liveQuery(t),n||[],r)}typeof FinalizationRegistry<`u`&&new FinalizationRegistry(t=>{let n=e.f.DexieYProvider;n&&n.release(t)}),Reflect.get(n,`use`);var rd=({selectedConversation:t,currentUser:a,onConversationSelect:o})=>{let[s,c]=(0,n.useState)(!0),[l,u]=(0,n.useState)(),[d,f]=(0,n.useState)(!1),p=nd(()=>e.d.summaries.toArray(),[t])||[],m=nd(()=>e.d.groups.toArray(),[])||[],h=a?.role===`admin`||a?.role===`system`,g=(0,n.useCallback)(async()=>{c(!0),a?.org&&(await Promise.all([e.t({}),Qu(a?.org)]).catch(e=>{u(e instanceof Error?e:Error(String(e)))}),c(!1))},[a?.org]);(0,n.useEffect)(()=>{g();let e=setInterval(g,3*6e4);return()=>clearInterval(e)},[g]);let[_,v]=(0,n.useState)({});(0,n.useEffect)(()=>{p.length>0&&a?.org&&(async()=>{if(!a?.org)return;let t=e.a();if(!t)return;let n={};for(let r of p)try{if(r.user!==void 0&&!_[r.user]){let e=await t.getUser(r.user);n[r.user]=e.name}}catch(t){e.x.error(`Failed to load conversation name:`,t)}Object.keys(n).length>0&&v(e=>({...e,...n}))})()},[p,a?.org]);let y=e=>e.user===void 0?e.group===void 0?`Unknown`:m.find(t=>t.id===e.group)?.name||`Group ${e.group}`:_[e.user]||`User ${e.user}`,b=e=>t?e.group===void 0?e.user===void 0?!1:t.type===`dm`&&t.id===e.user:t.type===`group`&&t.id===e.group:!1,x=e=>{e.group===void 0?e.user!==void 0&&o({type:`dm`,id:e.user,name:y(e)}):o({type:`group`,id:e.group,name:y(e)})};return(0,i.jsxs)(r.Box,{display:`flex`,flexDirection:`column`,height:`100%`,children:[(0,i.jsx)(r.AppBar,{position:`static`,elevation:0,sx:{backgroundColor:`background.default`,color:`text.primary`},children:(0,i.jsxs)(r.Toolbar,{children:[(0,i.jsx)(r.Typography,{variant:`h6`,component:`div`,sx:{flexGrow:1},children:`Messages`}),h&&(0,i.jsx)(r.Tooltip,{title:`Create Group`,children:(0,i.jsx)(r.IconButton,{color:`primary`,onClick:()=>f(!0),size:`small`,sx:{mr:-2},children:(0,i.jsx)(Wr,{})})})]})}),h&&a?.org&&(0,i.jsx)(Zu,{open:d,onClose:()=>f(!1),onSuccess:async()=>{await g()},orgId:a.org}),(0,i.jsx)(r.Box,{flex:1,overflow:`auto`,children:s&&!p.length?(0,i.jsx)(r.List,{disablePadding:!0,children:[1,2,3,4,5].map(e=>(0,i.jsx)(_i,{},e))}):l?(0,i.jsx)(r.Box,{p:2,children:(0,i.jsxs)(r.Alert,{severity:`error`,children:[`Failed to load conversations: `,l.message]})}):p.length===0&&m.length===0?(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,p:2,children:(0,i.jsx)(r.Typography,{color:`text.secondary`,align:`center`,children:`No conversations yet`})}):(0,i.jsx)(r.List,{disablePadding:!0,children:(()=>{let e=new Set(p.filter(e=>e.group!==void 0).map(e=>e.group)),t=m.filter(t=>!e.has(t.id)).map(e=>({group:e.id,last_message_at:e.created_at,message_count:0,unread_count:0}));return[...[...p].sort((e,t)=>new Date(t.last_message_at).getTime()-new Date(e.last_message_at).getTime()),...t].map(e=>(0,i.jsx)(gi,{conversation:e,displayName:y(e),selected:b(e),onClick:()=>x(e),currentUser:a},e.group===void 0?`user-${e.user}`:`group-${e.group}`))})()})})]})},id=({displayName:e,type:t,subtitle:a,isConnected:o=!0,onBack:s,showJoinButton:c=!1,onJoin:l,joining:u=!1,showMembersButton:d=!1,onManageMembers:f,canManageGroup:p=!1,onRenameGroup:m,onDeleteGroup:h,deletingGroup:g=!1})=>{let _=t===`group`,[v,y]=(0,n.useState)(null),[b,x]=(0,n.useState)(null),S=e=>{y(e.currentTarget)},C=()=>{y(null)},w=e=>{l(e),C()};return(0,i.jsx)(r.AppBar,{position:`static`,elevation:0,sx:{backgroundColor:`background.default`,color:`text.primary`},children:(0,i.jsxs)(r.Toolbar,{children:[s&&(0,i.jsx)(r.IconButton,{edge:`start`,color:`inherit`,onClick:s,sx:{mr:2,display:{xs:`flex`,sm:`flex`,md:`none`}},children:(0,i.jsx)(Gr,{})}),(0,i.jsx)(r.Avatar,{sx:{bgcolor:_?`primary.main`:`secondary.main`,mr:2},children:_?(0,i.jsx)(ii,{}):(0,i.jsx)(si,{})}),(0,i.jsxs)(r.Box,{flex:1,children:[(0,i.jsx)(r.Typography,{variant:`h6`,component:`div`,noWrap:!0,children:e}),a&&(0,i.jsx)(r.Typography,{variant:`caption`,color:`inherit`,sx:{opacity:.7},children:a})]}),d&&_&&(0,i.jsx)(r.IconButton,{color:`inherit`,onClick:f,title:`Members`,sx:{mr:.5},children:(0,i.jsx)(oi,{})}),p&&_&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.IconButton,{color:`inherit`,onClick:e=>x(e.currentTarget),disabled:g,title:`Manage group`,children:(0,i.jsx)(ai,{})}),(0,i.jsxs)(r.Menu,{anchorEl:b,open:!!b,onClose:()=>x(null),children:[(0,i.jsxs)(r.MenuItem,{onClick:()=>{x(null),m?.()},children:[(0,i.jsx)(ni,{fontSize:`small`,sx:{mr:1}}),`Rename Group`]}),(0,i.jsxs)(r.MenuItem,{onClick:()=>{x(null),h?.()},sx:{color:`error.main`},children:[(0,i.jsx)(ei,{fontSize:`small`,sx:{mr:1}}),`Delete Group`]})]})]}),c&&_&&(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,mr:1},children:[(0,i.jsx)(r.Button,{variant:`contained`,color:`primary`,startIcon:(0,i.jsx)(ci,{}),endIcon:(0,i.jsx)(Kr,{}),onClick:S,disabled:u,children:u?`Joining...`:`Join`}),(0,i.jsxs)(r.Menu,{anchorEl:v,open:!!v,onClose:C,children:[(0,i.jsx)(r.MenuItem,{onClick:()=>w(`member`),children:`Member`}),(0,i.jsx)(r.MenuItem,{onClick:()=>w(`moderator`),children:`Moderator`})]})]}),!o&&(0,i.jsx)(r.Chip,{icon:(0,i.jsx)(mi,{}),label:`Disconnected`,size:`small`,color:`warning`,sx:{ml:1}})]})})},ad=({member:e,currentUserId:t,canManage:n,removing:a,updating:o,onRemove:s,onRoleChange:c})=>(0,i.jsxs)(r.ListItem,{secondaryAction:n?(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,i.jsxs)(r.Select,{value:e.role,onChange:t=>c(e.id,t.target.value),size:`small`,disabled:o||a,variant:`standard`,disableUnderline:!0,sx:{fontSize:12},children:[(0,i.jsx)(r.MenuItem,{value:`member`,children:`Member`}),(0,i.jsx)(r.MenuItem,{value:`moderator`,children:`Moderator`})]}),(0,i.jsx)(r.IconButton,{size:`small`,color:`error`,onClick:()=>s(e.id),disabled:a||o,children:a?(0,i.jsx)(r.CircularProgress,{size:16}):(0,i.jsx)($r,{fontSize:`small`})})]}):void 0,children:[(0,i.jsx)(r.Avatar,{sx:{mr:1.5,width:32,height:32,bgcolor:`primary.main`},children:(0,i.jsx)(si,{fontSize:`small`})}),(0,i.jsx)(r.ListItemText,{primary:(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,i.jsx)(r.Typography,{variant:`body1`,noWrap:!0,children:e.name}),e.id===t&&(0,i.jsx)(r.Typography,{variant:`caption`,color:`text.secondary`,children:`(you)`})]})})]}),od=({open:t,onClose:a,orgId:s,groupId:c,existingMemberIds:l,onSuccess:u})=>{let[d,f]=(0,n.useState)([]),[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)(null),_=()=>{f([]),g(null),a()},v=e=>{f((Array.isArray(e)?e:[]).filter(e=>!l.has(e.id)).map(e=>({id:e.id,role:`member`,user:e})))},y=(e,t)=>{f(n=>n.map(n=>n.id===e?{...n,role:t}:n))},b=e=>{f(t=>t.filter(t=>t.id!==e))};return(0,i.jsxs)(r.Dialog,{open:t,onClose:_,maxWidth:`xs`,fullWidth:!0,children:[(0,i.jsx)(r.DialogTitle,{children:`Add Members`}),(0,i.jsx)(r.DialogContent,{children:(0,i.jsxs)(r.Box,{sx:{display:`flex`,flexDirection:`column`,gap:2,pt:1},children:[h&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>g(null),children:h.message}),(0,i.jsx)(Yu,{multiple:!0,label:`Search users to add`,value:d.map(e=>e.user),onChange:v,disabled:p}),d.map(e=>(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,i.jsx)(r.Typography,{variant:`body2`,noWrap:!0,sx:{flex:1,mr:1},children:e.user.name}),(0,i.jsxs)(r.Select,{value:e.role,onChange:t=>y(e.id,t.target.value),size:`small`,disabled:p,sx:{mr:1},children:[(0,i.jsx)(r.MenuItem,{value:`member`,children:`Member`}),(0,i.jsx)(r.MenuItem,{value:`moderator`,children:`Moderator`})]}),(0,i.jsx)(r.IconButton,{size:`small`,color:`error`,onClick:()=>b(e.id),disabled:p,children:(0,i.jsx)(Qr,{fontSize:`small`})})]},e.id))]})}),(0,i.jsxs)(r.DialogActions,{sx:{p:2},children:[(0,i.jsx)(r.Button,{onClick:_,disabled:p,children:`Cancel`}),(0,i.jsx)(r.Button,{variant:`contained`,onClick:async()=>{if(d.length!==0){m(!0),g(null);try{await e.a()?.addGroupMembers(s,c,d.map(e=>({user:e.id,role:e.role}))),_(),u()}catch(e){g(o(e,`Failed to add members`))}finally{m(!1)}}},disabled:p||d.length===0,startIcon:p&&(0,i.jsx)(r.CircularProgress,{size:16}),children:p?`Adding...`:`Add${d.length>0?` ${d.length}`:``}`})]})]})},sd=({open:t,onClose:a,orgId:s,groupId:c,currentUserId:l,canManage:u})=>{let[d,f]=(0,n.useState)([]),[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)(null),[_,v]=(0,n.useState)(null),[y,b]=(0,n.useState)(null),[x,S]=(0,n.useState)(!1),C=(0,n.useCallback)(async()=>{m(!0),g(null);try{let t=e.a();if(!t)return;f(await t.getGroupMembers(s,c))}catch(e){g(o(e,`Failed to load members`))}finally{m(!1)}},[s,c]);(0,n.useEffect)(()=>{t&&C()},[t,C]);let w=async t=>{v(t);try{let n=e.a();if(!n)return;await n.removeGroupMember(s,c,t),f(e=>e.filter(e=>e.id!==t))}catch(e){g(o(e,`Failed to remove member`))}finally{v(null)}},T=async(t,n)=>{b(t);try{let r=e.a();if(!r)return;await r.addGroupMembers(s,c,[{user:t,role:n}]),f(e=>e.map(e=>e.id===t?{...e,role:n}:e))}catch(e){g(o(e,`Failed to update role`))}finally{b(null)}};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(r.Drawer,{anchor:`right`,open:t,onClose:a,slotProps:{paper:{sx:{width:360,maxWidth:`100vw`}}},children:[(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,px:2,py:1.5},children:[(0,i.jsx)(r.Typography,{variant:`h6`,children:`Members`}),(0,i.jsx)(r.IconButton,{size:`small`,onClick:a,children:(0,i.jsx)(Qr,{})})]}),(0,i.jsxs)(r.Box,{sx:{display:`flex`,flexDirection:`column`,overflow:`hidden`,flex:1},children:[h&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>g(null),sx:{m:2},children:h.message}),(0,i.jsx)(r.Box,{sx:{overflow:`auto`,flex:1},children:p?(0,i.jsx)(r.Box,{sx:{display:`flex`,justifyContent:`center`,mt:4},children:(0,i.jsx)(r.CircularProgress,{size:32})}):(0,i.jsxs)(r.List,{disablePadding:!0,children:[d.map(e=>(0,i.jsx)(ad,{member:e,currentUserId:l,canManage:u,removing:_===e.id,updating:y===e.id,onRemove:w,onRoleChange:T},e.id)),d.length===0&&(0,i.jsx)(r.Box,{sx:{p:3,textAlign:`center`},children:(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,children:`No members yet`})})]})}),u&&(0,i.jsx)(r.Box,{sx:{p:2,borderTop:1,borderColor:`divider`},children:(0,i.jsx)(r.Button,{variant:`outlined`,color:`secondary`,fullWidth:!0,onClick:()=>S(!0),children:`Add Members`})})]})]}),(0,i.jsx)(od,{open:x,onClose:()=>S(!1),orgId:s,groupId:c,existingMemberIds:new Set(d.map(e=>e.id)),onSuccess:C})]})};function cd(e){return(typeof e==`string`?new Date(e):e).toLocaleTimeString(`en-US`,{hour:`numeric`,minute:`2-digit`,hour12:!0})}function ld(e){let t=typeof e==`string`?new Date(e):e,n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(r);i.setDate(i.getDate()-1);let a=new Date(t.getFullYear(),t.getMonth(),t.getDate());return a.getTime()===r.getTime()?`Today`:a.getTime()===i.getTime()?`Yesterday`:a.getTime()>r.getTime()-10080*60*1e3?t.toLocaleDateString(`en-US`,{weekday:`long`}):t.getFullYear()===n.getFullYear()?t.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`}):t.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}var ud=({isOwnMessage:e,isLastInGroup:t,status:n,isOptimistic:r})=>{if(!e||!t)return null;let a={fontSize:14,ml:.5,opacity:.7,verticalAlign:`middle`};return n===`failed`?(0,i.jsx)(ri,{sx:{...a,color:`error.main`}}):n===`sending`||r?(0,i.jsx)(ui,{sx:a}):(0,i.jsx)(ti,{sx:a})},dd=n.default.memo(({message:t,isOwnMessage:n,senderName:a,showSenderName:o=!0,isFirstInGroup:s=!0,isLastInGroup:c=!0,status:l=`sent`,onImagePress:u})=>{let d=t.id.startsWith(`temp-`),f=(0,i.jsx)(r.Avatar,{sx:{width:32,height:32,fontSize:`0.875rem`,color:n?`primary.contrastText`:`secondary.contrastText`,bgcolor:n?`primary.main`:`secondary.main`,visibility:c?`visible`:`hidden`},children:e.l(a)}),p=t.media?.[0],m=!!p,h=!!t.content;return(0,i.jsxs)(r.Box,{display:`flex`,justifyContent:n?`flex-end`:`flex-start`,alignItems:`flex-end`,mb:c?1:.25,gap:1,children:[!n&&f,(0,i.jsxs)(r.Paper,{elevation:1,sx:{maxWidth:`80%`,overflow:`hidden`,backgroundColor:n?`primary.main`:`background.paper`,color:n?`primary.contrastText`:`text.primary`,borderTopLeftRadius:n||!s?void 0:4,borderTopRightRadius:!n||!s?void 0:4,borderBottomLeftRadius:n||!c?void 0:4,borderBottomRightRadius:!n||!c?void 0:4},children:[!n&&o&&s&&(0,i.jsx)(r.Typography,{variant:`caption`,fontWeight:`bold`,display:`block`,px:1.5,pt:1.5,children:a||`User ${t.sender}`}),m&&(0,i.jsxs)(r.Box,{p:`4px`,children:[(0,i.jsx)(r.Box,{component:`img`,src:p.thumbnail,alt:`attachment`,onClick:()=>u?.(t),sx:{display:`block`,width:`100%`,maxWidth:280,maxHeight:300,cursor:`pointer`,borderRadius:`4px`}}),c&&!h&&(0,i.jsxs)(r.Box,{display:`flex`,justifyContent:`flex-end`,alignItems:`center`,mt:.5,children:[(0,i.jsx)(r.Typography,{variant:`caption`,color:n?`inherit`:`text.secondary`,sx:{opacity:.7},children:cd(new Date(t.created_at))}),(0,i.jsx)(ud,{isOwnMessage:n,isLastInGroup:c,status:l,isOptimistic:d})]})]}),(h||!m&&c)&&(0,i.jsxs)(r.Box,{px:1.5,pt:m?.75:n||!o||!s?1.5:.5,pb:1.5,children:[h&&(0,i.jsx)(r.Typography,{variant:`body1`,sx:{whiteSpace:`pre-wrap`},children:t.content}),c&&(0,i.jsxs)(r.Box,{display:`flex`,justifyContent:`flex-end`,alignItems:`center`,mt:.5,children:[(0,i.jsx)(r.Typography,{variant:`caption`,color:n?`inherit`:`text.secondary`,sx:{opacity:.7},children:cd(new Date(t.created_at))}),(0,i.jsx)(ud,{isOwnMessage:n,isLastInGroup:c,status:l,isOptimistic:d})]})]})]}),n&&f]})}),fd=({src:e,open:t,onClose:a,alt:o=`Image`,senderName:s,onPrev:c,onNext:l})=>((0,n.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`ArrowLeft`?c?.():e.key===`ArrowRight`?l?.():e.key===`Escape`&&a()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,c,l,a]),(0,i.jsxs)(r.Dialog,{open:t,onClose:a,maxWidth:!1,PaperProps:{sx:{background:`rgba(0,0,0,0.9)`,boxShadow:`none`,m:0,maxWidth:`100vw`,maxHeight:`100vh`,width:`100vw`,height:`100vh`,borderRadius:0,display:`flex`,flexDirection:`column`}},children:[(0,i.jsxs)(r.Box,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,px:1,py:.5,sx:{flexShrink:0},children:[s?(0,i.jsx)(r.Typography,{variant:`subtitle1`,sx:{color:`white`,ml:1},children:s}):(0,i.jsx)(r.Box,{}),(0,i.jsx)(r.IconButton,{onClick:a,sx:{color:`white`},children:(0,i.jsx)(Qr,{fontSize:`large`})})]}),(0,i.jsxs)(r.Box,{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`,children:[(0,i.jsx)(r.IconButton,{onClick:c,disabled:!c,sx:{position:`absolute`,left:8,color:c?`white`:`rgba(255,255,255,0.25)`,bgcolor:`rgba(0,0,0,0.4)`,"&:hover":{bgcolor:`rgba(0,0,0,0.6)`},"&.Mui-disabled":{color:`rgba(255,255,255,0.2)`}},children:(0,i.jsx)(Xr,{fontSize:`large`})}),(0,i.jsx)(r.Box,{component:`img`,src:e,alt:o,sx:{maxWidth:`80vw`,maxHeight:`calc(100vh - 64px)`,objectFit:`contain`}}),(0,i.jsx)(r.IconButton,{onClick:l,disabled:!l,sx:{position:`absolute`,right:8,color:l?`white`:`rgba(255,255,255,0.25)`,bgcolor:`rgba(0,0,0,0.4)`,"&:hover":{bgcolor:`rgba(0,0,0,0.6)`},"&.Mui-disabled":{color:`rgba(255,255,255,0.2)`}},children:(0,i.jsx)(Zr,{fontSize:`large`})})]})]})),pd=({isOwnMessage:e=!1})=>(0,i.jsx)(r.Box,{display:`flex`,justifyContent:e?`flex-end`:`flex-start`,mb:1,children:(0,i.jsxs)(r.Box,{maxWidth:`70%`,children:[!e&&(0,i.jsx)(r.Skeleton,{variant:`text`,width:80,sx:{mb:.5}}),(0,i.jsx)(r.Skeleton,{variant:`rounded`,width:Math.random()*200+150,height:60,sx:{borderRadius:2,bgcolor:e?`primary.light`:`background.main`}})]})}),md=({hasMore:e,loading:t,onLoadMore:a,threshold:o=1,rootMargin:s=`100px`})=>{let c=(0,n.useRef)(null),l=(0,n.useRef)(null);return(0,n.useEffect)(()=>{if(!e||t)return;let n=c.current;if(n)return l.current=new IntersectionObserver(n=>{let[r]=n;r&&r.isIntersecting&&e&&!t&&a()},{threshold:o,rootMargin:s}),l.current.observe(n),()=>{l.current&&n&&(l.current.unobserve(n),l.current.disconnect())}},[e,t,a,o,s]),e?(0,i.jsx)(r.Box,{ref:c,display:`flex`,justifyContent:`center`,alignItems:`center`,py:2,children:t?(0,i.jsx)(r.CircularProgress,{size:24}):(0,i.jsx)(r.Typography,{variant:`caption`,color:`text.secondary`,children:`Scroll to load more`})}):null},hd=({date:e})=>(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,my:1.5,children:(0,i.jsx)(r.Typography,{variant:`caption`,color:`text.secondary`,fontWeight:500,sx:{userSelect:`none`,bgcolor:`background.paper`,px:1.5,py:.5,borderRadius:.5},children:ld(e)})}),gd=(e,t,r)=>{(0,n.useEffect)(()=>((async()=>{await e()})(),r),t)};function _d(e){let t=e.map(e=>Number(e.sender));return new Set(t)}function vd(t){let[r,i]=(0,n.useState)(()=>new Map),a=(0,n.useCallback)(async()=>{if(!t.length)return r;try{let n=_d(t),i=Array.from(n);if(e.x.debug(`[names] size:`,n.size),!n.size)return r;let a=(await e.d.users.bulkGet(i)).filter(e=>!!e),o=new Map;if(a.forEach(e=>{o.set(e.id,e.name)}),n.size===a.length)return o;let s=i.filter(e=>!o.has(e)),c=e.a();if(!c)return r;let l=await c.getUsers(s,{fields:[`id`,`name`]});await e.d.users.bulkPut(l);let u=o;return l.forEach(e=>u.set(e.id,e.name)),u}catch(t){e.x.error(`[useSenderNames] Failed to fetch users:`,t)}return r},[t,r]);return gd(async()=>{i(await a())},[t]),r}var yd=({messages:t,currentUserId:a,loading:o=!1,error:s=null,autoScroll:c=!0,hasMore:l=!1,loadingMore:u=!1,onLoadMore:d})=>{let f=(0,n.useRef)(null),p=(0,n.useRef)(null),m=(0,n.useRef)(0),h=(0,n.useRef)(!0),[g,_]=(0,n.useState)(c),[v,y]=(0,n.useState)(null),b=vd(t),x=(0,n.useMemo)(()=>t.filter(e=>e.media&&e.media.length>0),[t]),S=(0,n.useCallback)(e=>{let t=x.findIndex(t=>t.id===e.id);t!==-1&&y(t)},[x]),C=v!==null&&v>0?()=>y(e=>e-1):void 0,w=v!==null&&v<x.length-1?()=>y(e=>e+1):void 0,T=v===null?null:x[v],E=()=>{if(!p.current)return!1;let{scrollTop:e,scrollHeight:t,clientHeight:n}=p.current;return t-e-n<100};return(0,n.useEffect)(()=>{t.length>0&&f.current&&(f.current.scrollIntoView({behavior:`auto`}),h.current=!0)},[]),(0,n.useEffect)(()=>{!u||!t.length||(p.current&&(m.current=p.current.scrollHeight),_(!1))},[u]),(0,n.useLayoutEffect)(()=>{if(t.length){if(g&&f.current&&h.current)f.current.scrollIntoView({behavior:`smooth`});else if(!g&&p.current&&m.current>0){let e=p.current.scrollHeight-m.current;p.current.scrollTop=p.current.scrollTop+e,m.current=0,_(!0)}}},[t.length,c]),o&&!t.length?(0,i.jsx)(r.Box,{flex:1,overflow:`auto`,p:2,children:[1,2,3,4,5].map(e=>(0,i.jsx)(pd,{isOwnMessage:e%3==0},e))}):s&&!t.length?(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,flex:1,p:2,children:(0,i.jsxs)(r.Alert,{severity:`error`,children:[(0,i.jsx)(`strong`,{children:`Failed to load messages`}),(0,i.jsx)(`br`,{}),s.message]})}):t.length===0?(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,flex:1,children:(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,children:`No messages yet. Start the conversation!`})}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(r.Box,{ref:p,flex:1,overflow:`auto`,p:2,display:`flex`,flexDirection:`column`,onScroll:()=>{h.current=E()},children:[l&&d&&(0,i.jsx)(md,{hasMore:l,loading:u,onLoadMore:d}),t.map((r,o)=>{let s=r.sender,c=r.sender===a,l=b.get(s),u=o>0?t[o-1]:null,d=o<t.length-1?t[o+1]:null,f=new Date(r.created_at).toDateString(),p=f!==(u?new Date(u.created_at).toDateString():null),m=p||!u||!e.u(u,r),h=f!==(d?new Date(d.created_at).toDateString():null)||!d||!e.u(r,d);return(0,i.jsxs)(n.default.Fragment,{children:[p&&(0,i.jsx)(hd,{date:r.created_at}),(0,i.jsx)(dd,{message:r,isOwnMessage:c,senderName:l,showSenderName:m,isFirstInGroup:m,isLastInGroup:h,onImagePress:S})]},r.id)}),(0,i.jsx)(`div`,{ref:f})]}),T&&(0,i.jsx)(fd,{src:T.media[0].url,open:!0,onClose:()=>y(null),senderName:b.get(T.sender),onPrev:C,onNext:w})]})},bd=({open:e,onCapture:t,onClose:a})=>{let o=(0,n.useRef)(null),s=(0,n.useRef)(null),[c,l]=(0,n.useState)(!1),[u,d]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(e)return l(!1),d(null),navigator.mediaDevices.getUserMedia({video:{facingMode:`environment`,width:{ideal:1920},height:{ideal:1080}},audio:!1}).then(e=>{s.current=e,o.current&&(o.current.srcObject=e)}).catch(()=>d(`Camera access denied or unavailable.`)),()=>{s.current?.getTracks().forEach(e=>e.stop()),s.current=null}},[e]),(0,i.jsxs)(r.Dialog,{open:e,onClose:a,maxWidth:`sm`,fullWidth:!0,children:[(0,i.jsx)(r.DialogContent,{sx:{p:0,bgcolor:`black`,aspectRatio:`4/3`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:u?(0,i.jsx)(r.Typography,{color:`error`,textAlign:`center`,p:3,children:u}):(0,i.jsxs)(i.Fragment,{children:[!c&&(0,i.jsx)(r.CircularProgress,{sx:{position:`absolute`,color:`white`}}),(0,i.jsx)(r.Box,{component:`video`,ref:o,autoPlay:!0,playsInline:!0,muted:!0,onCanPlay:()=>l(!0),sx:{width:`100%`,height:`100%`,objectFit:`cover`,display:c?`block`:`none`}})]})}),(0,i.jsxs)(r.DialogActions,{children:[(0,i.jsx)(r.Button,{onClick:a,children:`Cancel`}),(0,i.jsx)(r.Button,{variant:`contained`,onClick:()=>{let e=o.current;if(!e)return;let n=document.createElement(`canvas`);n.width=e.videoWidth,n.height=e.videoHeight,n.getContext(`2d`).drawImage(e,0,0),n.toBlob(e=>{e&&(t(e),a())},`image/webp`,.85)},disabled:!c,startIcon:(0,i.jsx)(Yr,{}),children:`Capture`})]})]})};function xd(e,t){return t.forEach((function(t){t&&typeof t!=`string`&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if(n!==`default`&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}function Sd(e,t){return new Promise((function(n,r){let i;return Cd(e).then((function(e){try{return i=e,n(new Blob([t.slice(0,2),i,t.slice(2)],{type:`image/jpeg`}))}catch(e){return r(e)}}),r)}))}var Cd=e=>new Promise(((t,n)=>{let r=new FileReader;r.addEventListener(`load`,(({target:{result:e}})=>{let r=new DataView(e),i=0;if(r.getUint16(i)!==65496)return n(`not a valid JPEG`);for(i+=2;;){let a=r.getUint16(i);if(a===65498)break;let o=r.getUint16(i+2);if(a===65505&&r.getUint32(i+4)===1165519206){let a=i+10,s;switch(r.getUint16(a)){case 18761:s=!0;break;case 19789:s=!1;break;default:return n(`TIFF header contains invalid endian`)}if(r.getUint16(a+2,s)!==42)return n(`TIFF header contains invalid version`);let c=r.getUint32(a+4,s),l=a+c+2+12*r.getUint16(a+c,s);for(let e=a+c+2;e<l;e+=12)if(r.getUint16(e,s)==274){if(r.getUint16(e+2,s)!==3)return n(`Orientation data type is invalid`);if(r.getUint32(e+4,s)!==1)return n(`Orientation data count is invalid`);r.setUint16(e+8,1,s);break}return t(e.slice(i,i+2+o))}i+=2+o}return t(new Blob)})),r.readAsArrayBuffer(e)})),wd={},Td={get exports(){return wd},set exports(e){wd=e}};(function(e){var t,n,r={};Td.exports=r,r.parse=function(e,t){for(var n=r.bin.readUshort,i=r.bin.readUint,a=0,o={},s=new Uint8Array(e),c=s.length-4;i(s,c)!=101010256;)c--;a=c,a+=4;var l=n(s,a+=4);n(s,a+=2);var u=i(s,a+=2),d=i(s,a+=4);a+=4,a=d;for(var f=0;f<l;f++){i(s,a),a+=4,a+=4,a+=4,i(s,a+=4),u=i(s,a+=4);var p=i(s,a+=4),m=n(s,a+=4),h=n(s,a+2),g=n(s,a+4);a+=6;var _=i(s,a+=8);a+=4,a+=m+h+g,r._readLocal(s,_,o,u,p,t)}return o},r._readLocal=function(e,t,n,i,a,o){var s=r.bin.readUshort,c=r.bin.readUint;c(e,t),s(e,t+=4),s(e,t+=2);var l=s(e,t+=2);c(e,t+=2),c(e,t+=4),t+=4;var u=s(e,t+=8),d=s(e,t+=2);t+=2;var f=r.bin.readUTF8(e,t,u);if(t+=u,t+=d,o)n[f]={size:a,csize:i};else{var p=new Uint8Array(e.buffer,t);if(l==0)n[f]=new Uint8Array(p.buffer.slice(t,t+i));else{if(l!=8)throw`unknown compression method: `+l;var m=new Uint8Array(a);r.inflateRaw(p,m),n[f]=m}}},r.inflateRaw=function(e,t){return r.F.inflate(e,t)},r.inflate=function(e,t){return e[0],e[1],r.inflateRaw(new Uint8Array(e.buffer,e.byteOffset+2,e.length-6),t)},r.deflate=function(e,t){t??={level:6};var n=0,i=new Uint8Array(50+Math.floor(1.1*e.length));i[n]=120,i[n+1]=156,n+=2,n=r.F.deflateRaw(e,i,n,t.level);var a=r.adler(e,0,e.length);return i[n+0]=a>>>24&255,i[n+1]=a>>>16&255,i[n+2]=a>>>8&255,i[n+3]=a>>>0&255,new Uint8Array(i.buffer,0,n+4)},r.deflateRaw=function(e,t){t??={level:6};var n=new Uint8Array(50+Math.floor(1.1*e.length)),i=r.F.deflateRaw(e,n,i,t.level);return new Uint8Array(n.buffer,0,i)},r.encode=function(e,t){t??=!1;var n=0,i=r.bin.writeUint,a=r.bin.writeUshort,o={};for(var s in e){var c=!r._noNeed(s)&&!t,l=e[s],u=r.crc.crc(l,0,l.length);o[s]={cpr:c,usize:l.length,crc:u,file:c?r.deflateRaw(l):l}}for(var s in o)n+=o[s].file.length+30+46+2*r.bin.sizeUTF8(s);n+=22;var d=new Uint8Array(n),f=0,p=[];for(var s in o){var m=o[s];p.push(f),f=r._writeHeader(d,f,s,m,0)}var h=0,g=f;for(var s in o)m=o[s],p.push(f),f=r._writeHeader(d,f,s,m,1,p[h++]);var _=f-g;return i(d,f,101010256),f+=4,a(d,f+=4,h),a(d,f+=2,h),i(d,f+=2,_),i(d,f+=4,g),f+=4,f+=2,d.buffer},r._noNeed=function(e){var t=e.split(`.`).pop().toLowerCase();return`png,jpg,jpeg,zip`.indexOf(t)!=-1},r._writeHeader=function(e,t,n,i,a,o){var s=r.bin.writeUint,c=r.bin.writeUshort,l=i.file;return s(e,t,a==0?67324752:33639248),t+=4,a==1&&(t+=2),c(e,t,20),c(e,t+=2,0),c(e,t+=2,i.cpr?8:0),s(e,t+=2,0),s(e,t+=4,i.crc),s(e,t+=4,l.length),s(e,t+=4,i.usize),c(e,t+=4,r.bin.sizeUTF8(n)),c(e,t+=2,0),t+=2,a==1&&(t+=2,t+=2,s(e,t+=6,o),t+=4),t+=r.bin.writeUTF8(e,t,n),a==0&&(e.set(l,t),t+=l.length),t},r.crc={table:function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var n=t,r=0;r<8;r++)1&n?n=3988292384^n>>>1:n>>>=1;e[t]=n}return e}(),update:function(e,t,n,i){for(var a=0;a<i;a++)e=r.crc.table[255&(e^t[n+a])]^e>>>8;return e},crc:function(e,t,n){return 4294967295^r.crc.update(4294967295,e,t,n)}},r.adler=function(e,t,n){for(var r=1,i=0,a=t,o=t+n;a<o;){for(var s=Math.min(a+5552,o);a<s;)i+=r+=e[a++];r%=65521,i%=65521}return i<<16|r},r.bin={readUshort:function(e,t){return e[t]|e[t+1]<<8},writeUshort:function(e,t,n){e[t]=255&n,e[t+1]=n>>8&255},readUint:function(e,t){return 16777216*e[t+3]+(e[t+2]<<16|e[t+1]<<8|e[t])},writeUint:function(e,t,n){e[t]=255&n,e[t+1]=n>>8&255,e[t+2]=n>>16&255,e[t+3]=n>>24&255},readASCII:function(e,t,n){for(var r=``,i=0;i<n;i++)r+=String.fromCharCode(e[t+i]);return r},writeASCII:function(e,t,n){for(var r=0;r<n.length;r++)e[t+r]=n.charCodeAt(r)},pad:function(e){return e.length<2?`0`+e:e},readUTF8:function(e,t,n){for(var i,a=``,o=0;o<n;o++)a+=`%`+r.bin.pad(e[t+o].toString(16));try{i=decodeURIComponent(a)}catch{return r.bin.readASCII(e,t,n)}return i},writeUTF8:function(e,t,n){for(var r=n.length,i=0,a=0;a<r;a++){var o=n.charCodeAt(a);if(!(4294967168&o))e[t+i]=o,i++;else if(!(4294965248&o))e[t+i]=192|o>>6,e[t+i+1]=128|o>>0&63,i+=2;else if(!(4294901760&o))e[t+i]=224|o>>12,e[t+i+1]=128|o>>6&63,e[t+i+2]=128|o>>0&63,i+=3;else{if(4292870144&o)throw`e`;e[t+i]=240|o>>18,e[t+i+1]=128|o>>12&63,e[t+i+2]=128|o>>6&63,e[t+i+3]=128|o>>0&63,i+=4}}return i},sizeUTF8:function(e){for(var t=e.length,n=0,r=0;r<t;r++){var i=e.charCodeAt(r);if(!(4294967168&i))n++;else if(!(4294965248&i))n+=2;else if(!(4294901760&i))n+=3;else{if(4292870144&i)throw`e`;n+=4}}return n}},r.F={},r.F.deflateRaw=function(e,t,n,i){var a=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][i],o=r.F.U,s=r.F._goodIndex;r.F._hash;var c=r.F._putsE,l=0,u=n<<3,d=0,f=e.length;if(i==0){for(;l<f;)c(t,u,+(l+(w=Math.min(65535,f-l))==f)),u=r.F._copyExact(e,l,w,t,u+8),l+=w;return u>>>3}var p=o.lits,m=o.strt,h=o.prev,g=0,_=0,v=0,y=0,b=0,x=0;for(f>2&&(m[x=r.F._hash(e,0)]=0),l=0;l<f;l++){if(b=x,l+1<f-2){x=r.F._hash(e,l+1);var S=l+1&32767;h[S]=m[x],m[x]=S}if(d<=l){(g>14e3||_>26697)&&f-l>100&&(d<l&&(p[g]=l-d,g+=2,d=l),u=r.F._writeBlock(+(l==f-1||d==f),p,g,y,e,v,l-v,t,u),g=_=y=0,v=l);var C=0;l<f-2&&(C=r.F._bestMatch(e,l,h,b,Math.min(a[2],f-l),a[3]));var w=C>>>16,T=65535&C;if(C!=0){T=65535&C;var E=s(w=C>>>16,o.of0);o.lhst[257+E]++;var D=s(T,o.df0);o.dhst[D]++,y+=o.exb[E]+o.dxb[D],p[g]=w<<23|l-d,p[g+1]=T<<16|E<<8|D,g+=2,d=l+w}else o.lhst[e[l]]++;_++}}for(v==l&&e.length!=0||(d<l&&(p[g]=l-d,g+=2,d=l),u=r.F._writeBlock(1,p,g,y,e,v,l-v,t,u),g=0,_=0,g=_=y=0,v=l);7&u;)u++;return u>>>3},r.F._bestMatch=function(e,t,n,i,a,o){var s=32767&t,c=n[s],l=s-c+32768&32767;if(c==s||i!=r.F._hash(e,t-l))return 0;for(var u=0,d=0,f=Math.min(32767,t);l<=f&&--o!=0&&c!=s;){if(u==0||e[t+u]==e[t+u-l]){var p=r.F._howLong(e,t,l);if(p>u){if(d=l,(u=p)>=a)break;l+2<p&&(p=l+2);for(var m=0,h=0;h<p-2;h++){var g=t-l+h+32768&32767,_=g-n[g]+32768&32767;_>m&&(m=_,c=g)}}}l+=(s=c)-(c=n[s])+32768&32767}return u<<16|d},r.F._howLong=function(e,t,n){if(e[t]!=e[t-n]||e[t+1]!=e[t+1-n]||e[t+2]!=e[t+2-n])return 0;var r=t,i=Math.min(e.length,t+258);for(t+=3;t<i&&e[t]==e[t-n];)t++;return t-r},r.F._hash=function(e,t){return(e[t]<<8|e[t+1])+(e[t+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(e,t,n,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y=r.F.U,b=r.F._putsF,x=r.F._putsE;y.lhst[256]++,d=(u=r.F.getTrees())[0],f=u[1],p=u[2],m=u[3],h=u[4],g=u[5],_=u[6],v=u[7];var S=32+(l+3&7?8-(l+3&7):0)+(s<<3),C=i+r.F.contSize(y.fltree,y.lhst)+r.F.contSize(y.fdtree,y.dhst),w=i+r.F.contSize(y.ltree,y.lhst)+r.F.contSize(y.dtree,y.dhst);w+=14+3*g+r.F.contSize(y.itree,y.ihst)+(2*y.ihst[16]+3*y.ihst[17]+7*y.ihst[18]);for(var T=0;T<286;T++)y.lhst[T]=0;for(T=0;T<30;T++)y.dhst[T]=0;for(T=0;T<19;T++)y.ihst[T]=0;var E=S<C&&S<w?0:C<w?1:2;if(b(c,l,e),b(c,l+1,E),l+=3,E==0){for(;7&l;)l++;l=r.F._copyExact(a,o,s,c,l)}else{var D,O;if(E==1&&(D=y.fltree,O=y.fdtree),E==2){r.F.makeCodes(y.ltree,d),r.F.revCodes(y.ltree,d),r.F.makeCodes(y.dtree,f),r.F.revCodes(y.dtree,f),r.F.makeCodes(y.itree,p),r.F.revCodes(y.itree,p),D=y.ltree,O=y.dtree,x(c,l,m-257),x(c,l+=5,h-1),x(c,l+=5,g-4),l+=4;for(var k=0;k<g;k++)x(c,l+3*k,y.itree[1+(y.ordr[k]<<1)]);l+=3*g,l=r.F._codeTiny(_,y.itree,c,l),l=r.F._codeTiny(v,y.itree,c,l)}for(var A=o,j=0;j<n;j+=2){for(var M=t[j],N=M>>>23,ee=A+(8388607&M);A<ee;)l=r.F._writeLit(a[A++],D,c,l);if(N!=0){var P=t[j+1],F=P>>16,I=P>>8&255,L=255&P;x(c,l=r.F._writeLit(257+I,D,c,l),N-y.of0[I]),l+=y.exb[I],b(c,l=r.F._writeLit(L,O,c,l),F-y.df0[L]),l+=y.dxb[L],A+=N}}l=r.F._writeLit(256,D,c,l)}return l},r.F._copyExact=function(e,t,n,r,i){var a=i>>>3;return r[a]=n,r[a+1]=n>>>8,r[a+2]=255-r[a],r[a+3]=255-r[a+1],a+=4,r.set(new Uint8Array(e.buffer,t,n),a),i+(n+4<<3)},r.F.getTrees=function(){for(var e=r.F.U,t=r.F._hufTree(e.lhst,e.ltree,15),n=r.F._hufTree(e.dhst,e.dtree,15),i=[],a=r.F._lenCodes(e.ltree,i),o=[],s=r.F._lenCodes(e.dtree,o),c=0;c<i.length;c+=2)e.ihst[i[c]]++;for(c=0;c<o.length;c+=2)e.ihst[o[c]]++;for(var l=r.F._hufTree(e.ihst,e.itree,7),u=19;u>4&&e.itree[1+(e.ordr[u-1]<<1)]==0;)u--;return[t,n,l,a,s,u,i,o]},r.F.getSecond=function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(e[n+1]);return t},r.F.nonZero=function(e){for(var t=``,n=0;n<e.length;n+=2)e[n+1]!=0&&(t+=(n>>1)+`,`);return t},r.F.contSize=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r]*e[1+(r<<1)];return n},r.F._codeTiny=function(e,t,n,i){for(var a=0;a<e.length;a+=2){var o=e[a],s=e[a+1];i=r.F._writeLit(o,t,n,i);var c=o==16?2:o==17?3:7;o>15&&(r.F._putsE(n,i,s,c),i+=c)}return i},r.F._lenCodes=function(e,t){for(var n=e.length;n!=2&&e[n-1]==0;)n-=2;for(var r=0;r<n;r+=2){var i=e[r+1],a=r+3<n?e[r+3]:-1,o=r+5<n?e[r+5]:-1,s=r==0?-1:e[r-1];if(i==0&&a==i&&o==i){for(var c=r+5;c+2<n&&e[c+2]==i;)c+=2;(l=Math.min(c+1-r>>>1,138))<11?t.push(17,l-3):t.push(18,l-11),r+=2*l-2}else if(i==s&&a==i&&o==i){for(c=r+5;c+2<n&&e[c+2]==i;)c+=2;var l=Math.min(c+1-r>>>1,6);t.push(16,l-3),r+=2*l-2}else t.push(i,0)}return n>>>1},r.F._hufTree=function(e,t,n){var i=[],a=e.length,o=t.length,s=0;for(s=0;s<o;s+=2)t[s]=0,t[s+1]=0;for(s=0;s<a;s++)e[s]!=0&&i.push({lit:s,f:e[s]});var c=i.length,l=i.slice(0);if(c==0)return 0;if(c==1){var u=i[0].lit;return l=+(u==0),t[1+(u<<1)]=1,t[1+(l<<1)]=1,1}i.sort((function(e,t){return e.f-t.f}));var d=i[0],f=i[1],p=0,m=1,h=2;for(i[0]={lit:-1,f:d.f+f.f,l:d,r:f,d:0};m!=c-1;)d=p!=m&&(h==c||i[p].f<i[h].f)?i[p++]:i[h++],f=p!=m&&(h==c||i[p].f<i[h].f)?i[p++]:i[h++],i[m++]={lit:-1,f:d.f+f.f,l:d,r:f};var g=r.F.setDepth(i[m-1],0);for(g>n&&(r.F.restrictDepth(l,n,g),g=n),s=0;s<c;s++)t[1+(l[s].lit<<1)]=l[s].d;return g},r.F.setDepth=function(e,t){return e.lit==-1?Math.max(r.F.setDepth(e.l,t+1),r.F.setDepth(e.r,t+1)):(e.d=t,t)},r.F.restrictDepth=function(e,t,n){var r=0,i=1<<n-t,a=0;for(e.sort((function(e,t){return t.d==e.d?e.f-t.f:t.d-e.d})),r=0;r<e.length&&e[r].d>t;r++){var o=e[r].d;e[r].d=t,a+=i-(1<<n-o)}for(a>>>=n-t;a>0;)(o=e[r].d)<t?(e[r].d++,a-=1<<t-o-1):r++;for(;r>=0;r--)e[r].d==t&&a<0&&(e[r].d--,a++);a!=0&&console.log(`debt left`)},r.F._goodIndex=function(e,t){var n=0;return t[16|n]<=e&&(n|=16),t[8|n]<=e&&(n|=8),t[4|n]<=e&&(n|=4),t[2|n]<=e&&(n|=2),t[1|n]<=e&&(n|=1),n},r.F._writeLit=function(e,t,n,i){return r.F._putsF(n,i,t[e<<1]),i+t[1+(e<<1)]},r.F.inflate=function(e,t){var n=Uint8Array;if(e[0]==3&&e[1]==0)return t||new n(0);var i=r.F,a=i._bitsF,o=i._bitsE,s=i._decodeTiny,c=i.makeCodes,l=i.codes2map,u=i._get17,d=i.U,f=t==null;f&&(t=new n(e.length>>>2<<3));for(var p,m,h=0,g=0,_=0,v=0,y=0,b=0,x=0,S=0,C=0;h==0;)if(h=a(e,C,1),g=a(e,C+1,2),C+=3,g!=0){if(f&&(t=r.F._check(t,S+(1<<17))),g==1&&(p=d.flmap,m=d.fdmap,b=511,x=31),g==2){_=o(e,C,5)+257,v=o(e,C+5,5)+1,y=o(e,C+10,4)+4,C+=14;for(var w=0;w<38;w+=2)d.itree[w]=0,d.itree[w+1]=0;var T=1;for(w=0;w<y;w++){var E=o(e,C+3*w,3);d.itree[1+(d.ordr[w]<<1)]=E,E>T&&(T=E)}C+=3*y,c(d.itree,T),l(d.itree,T,d.imap),p=d.lmap,m=d.dmap,C=s(d.imap,(1<<T)-1,_+v,e,C,d.ttree);var D=i._copyOut(d.ttree,0,_,d.ltree);b=(1<<D)-1;var O=i._copyOut(d.ttree,_,v,d.dtree);x=(1<<O)-1,c(d.ltree,D),l(d.ltree,D,p),c(d.dtree,O),l(d.dtree,O,m)}for(;;){var k=p[u(e,C)&b];C+=15&k;var A=k>>>4;if(!(A>>>8))t[S++]=A;else{if(A==256)break;var j=S+A-254;if(A>264){var M=d.ldef[A-257];j=S+(M>>>3)+o(e,C,7&M),C+=7&M}var N=m[u(e,C)&x];C+=15&N;var ee=N>>>4,P=d.ddef[ee],F=(P>>>4)+a(e,C,15&P);for(C+=15&P,f&&(t=r.F._check(t,S+(1<<17)));S<j;)t[S]=t[S++-F],t[S]=t[S++-F],t[S]=t[S++-F],t[S]=t[S++-F];S=j}}}else{7&C&&(C+=8-(7&C));var I=4+(C>>>3),L=e[I-4]|e[I-3]<<8;f&&(t=r.F._check(t,S+L)),t.set(new n(e.buffer,e.byteOffset+I,L),S),C=I+L<<3,S+=L}return t.length==S?t:t.slice(0,S)},r.F._check=function(e,t){var n=e.length;if(t<=n)return e;var r=new Uint8Array(Math.max(n<<1,t));return r.set(e,0),r},r.F._decodeTiny=function(e,t,n,i,a,o){for(var s=r.F._bitsE,c=r.F._get17,l=0;l<n;){var u=e[c(i,a)&t];a+=15&u;var d=u>>>4;if(d<=15)o[l]=d,l++;else{var f=0,p=0;d==16?(p=3+s(i,a,2),a+=2,f=o[l-1]):d==17?(p=3+s(i,a,3),a+=3):d==18&&(p=11+s(i,a,7),a+=7);for(var m=l+p;l<m;)o[l]=f,l++}}return a},r.F._copyOut=function(e,t,n,r){for(var i=0,a=0,o=r.length>>>1;a<n;){var s=e[a+t];r[a<<1]=0,r[1+(a<<1)]=s,s>i&&(i=s),a++}for(;a<o;)r[a<<1]=0,r[1+(a<<1)]=0,a++;return i},r.F.makeCodes=function(e,t){for(var n,i,a,o,s=r.F.U,c=e.length,l=s.bl_count,u=0;u<=t;u++)l[u]=0;for(u=1;u<c;u+=2)l[e[u]]++;var d=s.next_code;for(n=0,l[0]=0,i=1;i<=t;i++)n=n+l[i-1]<<1,d[i]=n;for(a=0;a<c;a+=2)(o=e[a+1])!=0&&(e[a]=d[o],d[o]++)},r.F.codes2map=function(e,t,n){for(var i=e.length,a=r.F.U.rev15,o=0;o<i;o+=2)if(e[o+1]!=0)for(var s=o>>1,c=e[o+1],l=s<<4|c,u=t-c,d=e[o]<<u,f=d+(1<<u);d!=f;)n[a[d]>>>15-t]=l,d++},r.F.revCodes=function(e,t){for(var n=r.F.U.rev15,i=15-t,a=0;a<e.length;a+=2)e[a]=n[e[a]<<t-e[a+1]]>>>i},r.F._putsE=function(e,t,n){n<<=7&t;var r=t>>>3;e[r]|=n,e[r+1]|=n>>>8},r.F._putsF=function(e,t,n){n<<=7&t;var r=t>>>3;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},r.F._bitsE=function(e,t,n){return(e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<n)-1},r.F._bitsF=function(e,t,n){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<n)-1},r.F._get17=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},r.F._get25=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16|e[3+(t>>>3)]<<24)>>>(7&t)},r.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),function(){for(var e=r.F.U,t=0;t<32768;t++){var n=t;n=(4278255360&(n=(4042322160&(n=(3435973836&(n=(2863311530&n)>>>1|(1431655765&n)<<1))>>>2|(858993459&n)<<2))>>>4|(252645135&n)<<4))>>>8|(16711935&n)<<8,e.rev15[t]=(n>>>16|n<<16)>>>17}function i(e,t,n){for(;t--!=0;)e.push(0,n)}for(t=0;t<32;t++)e.ldef[t]=e.of0[t]<<3|e.exb[t],e.ddef[t]=e.df0[t]<<4|e.dxb[t];i(e.fltree,144,8),i(e.fltree,112,9),i(e.fltree,24,7),i(e.fltree,8,8),r.F.makeCodes(e.fltree,9),r.F.codes2map(e.fltree,9,e.flmap),r.F.revCodes(e.fltree,9),i(e.fdtree,32,5),r.F.makeCodes(e.fdtree,5),r.F.codes2map(e.fdtree,5,e.fdmap),r.F.revCodes(e.fdtree,5),i(e.itree,19,0),i(e.ltree,286,0),i(e.dtree,30,0),i(e.ttree,320,0)}()})();var Ed=xd({__proto__:null,default:wd},[wd]),Dd=function(){var e={nextZero(e,t){for(;e[t]!=0;)t++;return t},readUshort:(e,t)=>e[t]<<8|e[t+1],writeUshort(e,t,n){e[t]=n>>8&255,e[t+1]=255&n},readUint:(e,t)=>16777216*e[t]+(e[t+1]<<16|e[t+2]<<8|e[t+3]),writeUint(e,t,n){e[t]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n},readASCII(e,t,n){let r=``;for(let i=0;i<n;i++)r+=String.fromCharCode(e[t+i]);return r},writeASCII(e,t,n){for(let r=0;r<n.length;r++)e[t+r]=n.charCodeAt(r)},readBytes(e,t,n){let r=[];for(let i=0;i<n;i++)r.push(e[t+i]);return r},pad:e=>e.length<2?`0${e}`:e,readUTF8(t,n,r){let i,a=``;for(let i=0;i<r;i++)a+=`%${e.pad(t[n+i].toString(16))}`;try{i=decodeURIComponent(a)}catch{return e.readASCII(t,n,r)}return i}};function t(t,n,r,i){let o=n*r,s=a(i),c=Math.ceil(n*s/8),l=new Uint8Array(4*o),u=new Uint32Array(l.buffer),{ctype:d}=i,{depth:f}=i,p=e.readUshort;if(d==6){let e=o<<2;if(f==8)for(var m=0;m<e;m+=4)l[m]=t[m],l[m+1]=t[m+1],l[m+2]=t[m+2],l[m+3]=t[m+3];if(f==16)for(m=0;m<e;m++)l[m]=t[m<<1]}else if(d==2){let e=i.tabs.tRNS;if(e==null){if(f==8)for(m=0;m<o;m++){var h=3*m;u[m]=255<<24|t[h+2]<<16|t[h+1]<<8|t[h]}if(f==16)for(m=0;m<o;m++)h=6*m,u[m]=255<<24|t[h+4]<<16|t[h+2]<<8|t[h]}else{var g=e[0];let n=e[1],r=e[2];if(f==8)for(m=0;m<o;m++){var _=m<<2;h=3*m,u[m]=255<<24|t[h+2]<<16|t[h+1]<<8|t[h],t[h]==g&&t[h+1]==n&&t[h+2]==r&&(l[_+3]=0)}if(f==16)for(m=0;m<o;m++)_=m<<2,h=6*m,u[m]=255<<24|t[h+4]<<16|t[h+2]<<8|t[h],p(t,h)==g&&p(t,h+2)==n&&p(t,h+4)==r&&(l[_+3]=0)}}else if(d==3){let e=i.tabs.PLTE,a=i.tabs.tRNS,s=a?a.length:0;if(f==1)for(var v=0;v<r;v++){var y=v*c,b=v*n;for(m=0;m<n;m++){_=b+m<<2;var x=3*(S=t[y+(m>>3)]>>7-((7&m)<<0)&1);l[_]=e[x],l[_+1]=e[x+1],l[_+2]=e[x+2],l[_+3]=S<s?a[S]:255}}if(f==2)for(v=0;v<r;v++)for(y=v*c,b=v*n,m=0;m<n;m++)_=b+m<<2,x=3*(S=t[y+(m>>2)]>>6-((3&m)<<1)&3),l[_]=e[x],l[_+1]=e[x+1],l[_+2]=e[x+2],l[_+3]=S<s?a[S]:255;if(f==4)for(v=0;v<r;v++)for(y=v*c,b=v*n,m=0;m<n;m++)_=b+m<<2,x=3*(S=t[y+(m>>1)]>>4-((1&m)<<2)&15),l[_]=e[x],l[_+1]=e[x+1],l[_+2]=e[x+2],l[_+3]=S<s?a[S]:255;if(f==8)for(m=0;m<o;m++){var S;_=m<<2,x=3*(S=t[m]),l[_]=e[x],l[_+1]=e[x+1],l[_+2]=e[x+2],l[_+3]=S<s?a[S]:255}}else if(d==4){if(f==8)for(m=0;m<o;m++){_=m<<2;var C=t[w=m<<1];l[_]=C,l[_+1]=C,l[_+2]=C,l[_+3]=t[w+1]}if(f==16)for(m=0;m<o;m++){var w;_=m<<2,C=t[w=m<<2],l[_]=C,l[_+1]=C,l[_+2]=C,l[_+3]=t[w+2]}}else if(d==0)for(g=i.tabs.tRNS?i.tabs.tRNS:-1,v=0;v<r;v++){let e=v*c,r=v*n;if(f==1)for(var T=0;T<n;T++){var E=(C=255*(t[e+(T>>>3)]>>>7-(7&T)&1))==255*g?0:255;u[r+T]=E<<24|C<<16|C<<8|C}else if(f==2)for(T=0;T<n;T++)E=(C=85*(t[e+(T>>>2)]>>>6-((3&T)<<1)&3))==85*g?0:255,u[r+T]=E<<24|C<<16|C<<8|C;else if(f==4)for(T=0;T<n;T++)E=(C=17*(t[e+(T>>>1)]>>>4-((1&T)<<2)&15))==17*g?0:255,u[r+T]=E<<24|C<<16|C<<8|C;else if(f==8)for(T=0;T<n;T++)E=(C=t[e+T])==g?0:255,u[r+T]=E<<24|C<<16|C<<8|C;else if(f==16)for(T=0;T<n;T++)C=t[e+(T<<1)],E=p(t,e+(T<<1))==g?0:255,u[r+T]=E<<24|C<<16|C<<8|C}return l}function n(e,t,n,s){let c=a(e),l=Math.ceil(n*c/8),u=new Uint8Array((l+1+e.interlace)*s);return t=e.tabs.CgBI?i(t,u):r(t,u),e.interlace==0?t=o(t,e,0,n,s):e.interlace==1&&(t=function(e,t){let n=t.width,r=t.height,i=a(t),s=i>>3,c=Math.ceil(n*i/8),l=new Uint8Array(r*c),u=0,d=[0,0,4,0,2,0,1],f=[0,4,0,2,0,1,0],p=[8,8,8,4,4,2,2],m=[8,8,4,4,2,2,1],h=0;for(;h<7;){let a=p[h],_=m[h],v=0,y=0,b=d[h];for(;b<r;)b+=a,y++;let x=f[h];for(;x<n;)x+=_,v++;let S=Math.ceil(v*i/8);o(e,t,u,v,y);let C=0,w=d[h];for(;w<r;){let t=f[h],r=u+C*S<<3;for(;t<n;){var g;if(i==1&&(g=(g=e[r>>3])>>7-(7&r)&1,l[w*c+(t>>3)]|=g<<7-((7&t)<<0)),i==2&&(g=(g=e[r>>3])>>6-(7&r)&3,l[w*c+(t>>2)]|=g<<6-((3&t)<<1)),i==4&&(g=(g=e[r>>3])>>4-(7&r)&15,l[w*c+(t>>1)]|=g<<4-((1&t)<<2)),i>=8){let n=w*c+t*s;for(let t=0;t<s;t++)l[n+t]=e[(r>>3)+t]}r+=i,t+=_}C++,w+=a}v*y!=0&&(u+=y*(1+S)),h+=1}return l}(t,e)),t}function r(e,t){return i(new Uint8Array(e.buffer,2,e.length-6),t)}var i=function(){let e={H:{}};return e.H.N=function(t,n){let r=Uint8Array,i,a,o=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0;if(t[0]==3&&t[1]==0)return n||new r(0);let h=e.H,g=h.b,_=h.e,v=h.R,y=h.n,b=h.A,x=h.Z,S=h.m,C=n==null;for(C&&(n=new r(t.length>>>2<<5));o==0;)if(o=g(t,m,1),s=g(t,m+1,2),m+=3,s!=0){if(C&&(n=e.H.W(n,p+(1<<17))),s==1&&(i=S.J,a=S.h,d=511,f=31),s==2){c=_(t,m,5)+257,l=_(t,m+5,5)+1,u=_(t,m+10,4)+4,m+=14;let e=1;for(var w=0;w<38;w+=2)S.Q[w]=0,S.Q[w+1]=0;for(w=0;w<u;w++){let n=_(t,m+3*w,3);S.Q[1+(S.X[w]<<1)]=n,n>e&&(e=n)}m+=3*u,y(S.Q,e),b(S.Q,e,S.u),i=S.w,a=S.d,m=v(S.u,(1<<e)-1,c+l,t,m,S.v);let n=h.V(S.v,0,c,S.C);d=(1<<n)-1;let r=h.V(S.v,c,l,S.D);f=(1<<r)-1,y(S.C,n),b(S.C,n,i),y(S.D,r),b(S.D,r,a)}for(;;){let e=i[x(t,m)&d];m+=15&e;let r=e>>>4;if(!(r>>>8))n[p++]=r;else{if(r==256)break;{let e=p+r-254;if(r>264){let n=S.q[r-257];e=p+(n>>>3)+_(t,m,7&n),m+=7&n}let i=a[x(t,m)&f];m+=15&i;let o=i>>>4,s=S.c[o],c=(s>>>4)+g(t,m,15&s);for(m+=15&s;p<e;)n[p]=n[p++-c],n[p]=n[p++-c],n[p]=n[p++-c],n[p]=n[p++-c];p=e}}}}else{7&m&&(m+=8-(7&m));let i=4+(m>>>3),a=t[i-4]|t[i-3]<<8;C&&(n=e.H.W(n,p+a)),n.set(new r(t.buffer,t.byteOffset+i,a),p),m=i+a<<3,p+=a}return n.length==p?n:n.slice(0,p)},e.H.W=function(e,t){let n=e.length;if(t<=n)return e;let r=new Uint8Array(n<<1);return r.set(e,0),r},e.H.R=function(t,n,r,i,a,o){let s=e.H.e,c=e.H.Z,l=0;for(;l<r;){let e=t[c(i,a)&n];a+=15&e;let r=e>>>4;if(r<=15)o[l]=r,l++;else{let e=0,t=0;r==16?(t=3+s(i,a,2),a+=2,e=o[l-1]):r==17?(t=3+s(i,a,3),a+=3):r==18&&(t=11+s(i,a,7),a+=7);let n=l+t;for(;l<n;)o[l]=e,l++}}return a},e.H.V=function(e,t,n,r){let i=0,a=0,o=r.length>>>1;for(;a<n;){let n=e[a+t];r[a<<1]=0,r[1+(a<<1)]=n,n>i&&(i=n),a++}for(;a<o;)r[a<<1]=0,r[1+(a<<1)]=0,a++;return i},e.H.n=function(t,n){let r=e.H.m,i=t.length,a,o,s,c,l=r.j;for(var u=0;u<=n;u++)l[u]=0;for(u=1;u<i;u+=2)l[t[u]]++;let d=r.K;for(a=0,l[0]=0,o=1;o<=n;o++)a=a+l[o-1]<<1,d[o]=a;for(s=0;s<i;s+=2)c=t[s+1],c!=0&&(t[s]=d[c],d[c]++)},e.H.A=function(t,n,r){let i=t.length,a=e.H.m.r;for(let e=0;e<i;e+=2)if(t[e+1]!=0){let i=e>>1,o=t[e+1],s=i<<4|o,c=n-o,l=t[e]<<c,u=l+(1<<c);for(;l!=u;)r[a[l]>>>15-n]=s,l++}},e.H.l=function(t,n){let r=e.H.m.r,i=15-n;for(let e=0;e<t.length;e+=2)t[e]=r[t[e]<<n-t[e+1]]>>>i},e.H.M=function(e,t,n){n<<=7&t;let r=t>>>3;e[r]|=n,e[r+1]|=n>>>8},e.H.I=function(e,t,n){n<<=7&t;let r=t>>>3;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},e.H.e=function(e,t,n){return(e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<n)-1},e.H.b=function(e,t,n){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<n)-1},e.H.Z=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},e.H.i=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16|e[3+(t>>>3)]<<24)>>>(7&t)},e.H.m=function(){let e=Uint16Array,t=Uint32Array;return{K:new e(16),j:new e(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new e(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new t(32),J:new e(512),_:[],h:new e(32),$:[],w:new e(32768),C:[],v:[],d:new e(32768),D:[],u:new e(512),Q:[],r:new e(32768),s:new t(286),Y:new t(30),a:new t(19),t:new t(15e3),k:new e(65536),g:new e(32768)}}(),function(){let t=e.H.m;for(var n=0;n<32768;n++){let e=n;e=(2863311530&e)>>>1|(1431655765&e)<<1,e=(3435973836&e)>>>2|(858993459&e)<<2,e=(4042322160&e)>>>4|(252645135&e)<<4,e=(4278255360&e)>>>8|(16711935&e)<<8,t.r[n]=(e>>>16|e<<16)>>>17}function r(e,t,n){for(;t--!=0;)e.push(0,n)}for(n=0;n<32;n++)t.q[n]=t.S[n]<<3|t.T[n],t.c[n]=t.p[n]<<4|t.z[n];r(t._,144,8),r(t._,112,9),r(t._,24,7),r(t._,8,8),e.H.n(t._,9),e.H.A(t._,9,t.J),e.H.l(t._,9),r(t.$,32,5),e.H.n(t.$,5),e.H.A(t.$,5,t.h),e.H.l(t.$,5),r(t.Q,19,0),r(t.C,286,0),r(t.D,30,0),r(t.v,320,0)}(),e.H.N}();function a(e){return[1,null,3,1,2,null,4][e.ctype]*e.depth}function o(e,t,n,r,i){let o=a(t),c=Math.ceil(r*o/8),l,u;o=Math.ceil(o/8);let d=e[n],f=0;if(d>1&&(e[n]=[0,0,1][d-2]),d==3)for(f=o;f<c;f++)e[f+1]=e[f+1]+(e[f+1-o]>>>1)&255;for(let t=0;t<i;t++)if(l=n+t*c,u=l+t+1,d=e[u-1],f=0,d==0)for(;f<c;f++)e[l+f]=e[u+f];else if(d==1){for(;f<o;f++)e[l+f]=e[u+f];for(;f<c;f++)e[l+f]=e[u+f]+e[l+f-o]}else if(d==2)for(;f<c;f++)e[l+f]=e[u+f]+e[l+f-c];else if(d==3){for(;f<o;f++)e[l+f]=e[u+f]+(e[l+f-c]>>>1);for(;f<c;f++)e[l+f]=e[u+f]+(e[l+f-c]+e[l+f-o]>>>1)}else{for(;f<o;f++)e[l+f]=e[u+f]+s(0,e[l+f-c],0);for(;f<c;f++)e[l+f]=e[u+f]+s(e[l+f-o],e[l+f-c],e[l+f-o-c])}return e}function s(e,t,n){let r=e+t-n,i=r-e,a=r-t,o=r-n;return i*i<=a*a&&i*i<=o*o?e:a*a<=o*o?t:n}function c(t,n,r){r.width=e.readUint(t,n),n+=4,r.height=e.readUint(t,n),n+=4,r.depth=t[n],n++,r.ctype=t[n],n++,r.compress=t[n],n++,r.filter=t[n],n++,r.interlace=t[n],n++}function l(e,t,n,r,i,a,o,s,c){let l=Math.min(t,i),u=Math.min(n,a),d=0,f=0;for(let n=0;n<u;n++)for(let a=0;a<l;a++)if(o>=0&&s>=0?(d=n*t+a<<2,f=(s+n)*i+o+a<<2):(d=(-s+n)*t-o+a<<2,f=n*i+a<<2),c==0)r[f]=e[d],r[f+1]=e[d+1],r[f+2]=e[d+2],r[f+3]=e[d+3];else if(c==1){var p=e[d+3]*(1/255),m=e[d]*p,h=e[d+1]*p,g=e[d+2]*p,_=r[f+3]*(1/255),v=r[f]*_,y=r[f+1]*_,b=r[f+2]*_;let t=1-p,n=p+_*t,i=n==0?0:1/n;r[f+3]=255*n,r[f+0]=(m+v*t)*i,r[f+1]=(h+y*t)*i,r[f+2]=(g+b*t)*i}else if(c==2)p=e[d+3],m=e[d],h=e[d+1],g=e[d+2],_=r[f+3],v=r[f],y=r[f+1],b=r[f+2],p==_&&m==v&&h==y&&g==b?(r[f]=0,r[f+1]=0,r[f+2]=0,r[f+3]=0):(r[f]=m,r[f+1]=h,r[f+2]=g,r[f+3]=p);else if(c==3){if(p=e[d+3],m=e[d],h=e[d+1],g=e[d+2],_=r[f+3],v=r[f],y=r[f+1],b=r[f+2],p==_&&m==v&&h==y&&g==b)continue;if(p<220&&_>20)return!1}return!0}return{decode:function(t){let a=new Uint8Array(t),o=8,s=e,l=s.readUshort,u=s.readUint,d={tabs:{},frames:[]},f=new Uint8Array(a.length),p,m=0,h=0,g=[137,80,78,71,13,10,26,10];for(var _=0;_<8;_++)if(a[_]!=g[_])throw`The input is not a PNG file!`;for(;o<a.length;){let e=s.readUint(a,o);o+=4;let t=s.readASCII(a,o,4);if(o+=4,t==`IHDR`)c(a,o,d);else if(t==`iCCP`){for(var v=o;a[v]!=0;)v++;s.readASCII(a,o,v-o),a[v+1];let n=a.slice(v+2,o+e),c=null;try{c=r(n)}catch{c=i(n)}d.tabs[t]=c}else if(t==`CgBI`)d.tabs[t]=a.slice(o,o+4);else if(t==`IDAT`){for(_=0;_<e;_++)f[m+_]=a[o+_];m+=e}else if(t==`acTL`)d.tabs[t]={num_frames:u(a,o),num_plays:u(a,o+4)},p=new Uint8Array(a.length);else if(t==`fcTL`){h!=0&&((w=d.frames[d.frames.length-1]).data=n(d,p.slice(0,h),w.rect.width,w.rect.height),h=0);let e={x:u(a,o+12),y:u(a,o+16),width:u(a,o+4),height:u(a,o+8)},t=l(a,o+22);t=l(a,o+20)/(t==0?100:t);let r={rect:e,delay:Math.round(1e3*t),dispose:a[o+24],blend:a[o+25]};d.frames.push(r)}else if(t==`fdAT`){for(_=0;_<e-4;_++)p[h+_]=a[o+_+4];h+=e-4}else if(t==`pHYs`)d.tabs[t]=[s.readUint(a,o),s.readUint(a,o+4),a[o+8]];else if(t==`cHRM`)for(d.tabs[t]=[],_=0;_<8;_++)d.tabs[t].push(s.readUint(a,o+4*_));else if(t==`tEXt`||t==`zTXt`){d.tabs[t]??(d.tabs[t]={});var y=s.nextZero(a,o),b=s.readASCII(a,o,y-o),x=o+e-y-1;if(t==`tEXt`)C=s.readASCII(a,y+1,x);else{var S=r(a.slice(y+2,y+2+x));C=s.readUTF8(S,0,S.length)}d.tabs[t][b]=C}else if(t==`iTXt`){d.tabs[t]??(d.tabs[t]={}),y=0,v=o,y=s.nextZero(a,v),b=s.readASCII(a,v,y-v);let n=a[v=y+1];var C;a[v+1],v+=2,y=s.nextZero(a,v),s.readASCII(a,v,y-v),v=y+1,y=s.nextZero(a,v),s.readUTF8(a,v,y-v),x=e-((v=y+1)-o),n==0?C=s.readUTF8(a,v,x):(S=r(a.slice(v,v+x)),C=s.readUTF8(S,0,S.length)),d.tabs[t][b]=C}else if(t==`PLTE`)d.tabs[t]=s.readBytes(a,o,e);else if(t==`hIST`){let e=d.tabs.PLTE.length/3;for(d.tabs[t]=[],_=0;_<e;_++)d.tabs[t].push(l(a,o+2*_))}else if(t==`tRNS`)d.ctype==3?d.tabs[t]=s.readBytes(a,o,e):d.ctype==0?d.tabs[t]=l(a,o):d.ctype==2&&(d.tabs[t]=[l(a,o),l(a,o+2),l(a,o+4)]);else if(t==`gAMA`)d.tabs[t]=s.readUint(a,o)/1e5;else if(t==`sRGB`)d.tabs[t]=a[o];else if(t==`bKGD`)d.ctype==0||d.ctype==4?d.tabs[t]=[l(a,o)]:d.ctype==2||d.ctype==6?d.tabs[t]=[l(a,o),l(a,o+2),l(a,o+4)]:d.ctype==3&&(d.tabs[t]=a[o]);else if(t==`IEND`)break;o+=e,s.readUint(a,o),o+=4}var w;return h!=0&&((w=d.frames[d.frames.length-1]).data=n(d,p.slice(0,h),w.rect.width,w.rect.height)),d.data=n(d,f,d.width,d.height),delete d.compress,delete d.interlace,delete d.filter,d},toRGBA8:function(e){let n=e.width,r=e.height;if(e.tabs.acTL==null)return[t(e.data,n,r,e).buffer];let i=[];e.frames[0].data??(e.frames[0].data=e.data);let a=n*r*4,o=new Uint8Array(a),s=new Uint8Array(a),c=new Uint8Array(a);for(let d=0;d<e.frames.length;d++){let f=e.frames[d],p=f.rect.x,m=f.rect.y,h=f.rect.width,g=f.rect.height,_=t(f.data,h,g,e);if(d!=0)for(var u=0;u<a;u++)c[u]=o[u];if(f.blend==0?l(_,h,g,o,n,r,p,m,0):f.blend==1&&l(_,h,g,o,n,r,p,m,1),i.push(o.buffer.slice(0)),f.dispose!=0){if(f.dispose==1)l(s,h,g,o,n,r,p,m,0);else if(f.dispose==2)for(u=0;u<a;u++)o[u]=c[u]}}return i},_paeth:s,_copyTile:l,_bin:e}}();(function(){let{_copyTile:e}=Dd,{_bin:t}=Dd,n=Dd._paeth;var r={table:function(){let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)1&n?n=3988292384^n>>>1:n>>>=1;e[t]=n}return e}(),update(e,t,n,i){for(let a=0;a<i;a++)e=r.table[255&(e^t[n+a])]^e>>>8;return e},crc:(e,t,n)=>4294967295^r.update(4294967295,e,t,n)};function i(e,t,n,r){t[n]+=e[0]*r>>4,t[n+1]+=e[1]*r>>4,t[n+2]+=e[2]*r>>4,t[n+3]+=e[3]*r>>4}function a(e){return Math.max(0,Math.min(255,e))}function o(e,t){let n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return n*n+r*r+i*i+a*a}function s(e,t,n,r,s,c,l){l??=1;let u=r.length,d=[];for(var f=0;f<u;f++){let e=r[f];d.push([e>>>0&255,e>>>8&255,e>>>16&255,e>>>24&255])}for(f=0;f<u;f++){let e=4294967295;for(var p=0,m=0;m<u;m++){var h=o(d[f],d[m]);m!=f&&h<e&&(e=h,p=m)}}let g=new Uint32Array(s.buffer),_=new Int16Array(t*n*4),v=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(f=0;f<v.length;f++)v[f]=255*((v[f]+.5)/16-.5);for(let s=0;s<n;s++)for(let b=0;b<t;b++){var y;f=4*(s*t+b),l==2?(h=v[4*(3&s)+(3&b)],y=[a(e[f]+h),a(e[f+1]+h),a(e[f+2]+h),a(e[f+3]+h)]):y=[a(e[f]+_[f]),a(e[f+1]+_[f+1]),a(e[f+2]+_[f+2]),a(e[f+3]+_[f+3])],p=0;let x=16777215;for(m=0;m<u;m++){let e=o(y,d[m]);e<x&&(x=e,p=m)}let S=d[p],C=[y[0]-S[0],y[1]-S[1],y[2]-S[2],y[3]-S[3]];l==1&&(b!=t-1&&i(C,_,f+4,7),s!=n-1&&(b!=0&&i(C,_,f+4*t-4,3),i(C,_,f+4*t,5),b!=t-1&&i(C,_,f+4*t+4,1))),c[f>>2]=p,g[f>>2]=r[p]}}function c(e,n,i,a,o){o??={};let{crc:s}=r,c=t.writeUint,l=t.writeUshort,u=t.writeASCII,d=8,f=e.frames.length>1,p,m=!1,h=33+(f?20:0);if(o.sRGB!=null&&(h+=13),o.pHYs!=null&&(h+=21),o.iCCP!=null&&(p=pako.deflate(o.iCCP),h+=21+p.length+4),e.ctype==3){for(var g=e.plte.length,_=0;_<g;_++)e.plte[_]>>>24!=255&&(m=!0);h+=8+3*g+4+(m?8+1*g+4:0)}for(var v=0;v<e.frames.length;v++)f&&(h+=38),h+=(S=e.frames[v]).cimg.length+12,v!=0&&(h+=4);h+=12;let y=new Uint8Array(h),b=[137,80,78,71,13,10,26,10];for(_=0;_<8;_++)y[_]=b[_];if(c(y,d,13),d+=4,u(y,d,`IHDR`),d+=4,c(y,d,n),d+=4,c(y,d,i),d+=4,y[d]=e.depth,d++,y[d]=e.ctype,d++,y[d]=0,d++,y[d]=0,d++,y[d]=0,d++,c(y,d,s(y,d-17,17)),d+=4,o.sRGB!=null&&(c(y,d,1),d+=4,u(y,d,`sRGB`),d+=4,y[d]=o.sRGB,d++,c(y,d,s(y,d-5,5)),d+=4),o.iCCP!=null){let e=13+p.length;c(y,d,e),d+=4,u(y,d,`iCCP`),d+=4,u(y,d,`ICC profile`),d+=11,d+=2,y.set(p,d),d+=p.length,c(y,d,s(y,d-(e+4),e+4)),d+=4}if(o.pHYs!=null&&(c(y,d,9),d+=4,u(y,d,`pHYs`),d+=4,c(y,d,o.pHYs[0]),d+=4,c(y,d,o.pHYs[1]),d+=4,y[d]=o.pHYs[2],d++,c(y,d,s(y,d-13,13)),d+=4),f&&(c(y,d,8),d+=4,u(y,d,`acTL`),d+=4,c(y,d,e.frames.length),d+=4,c(y,d,o.loop==null?0:o.loop),d+=4,c(y,d,s(y,d-12,12)),d+=4),e.ctype==3){for(c(y,d,3*(g=e.plte.length)),d+=4,u(y,d,`PLTE`),d+=4,_=0;_<g;_++){let t=3*_,n=e.plte[_],r=255&n,i=n>>>8&255,a=n>>>16&255;y[d+t+0]=r,y[d+t+1]=i,y[d+t+2]=a}if(d+=3*g,c(y,d,s(y,d-3*g-4,3*g+4)),d+=4,m){for(c(y,d,g),d+=4,u(y,d,`tRNS`),d+=4,_=0;_<g;_++)y[d+_]=e.plte[_]>>>24&255;d+=g,c(y,d,s(y,d-g-4,g+4)),d+=4}}let x=0;for(v=0;v<e.frames.length;v++){var S=e.frames[v];f&&(c(y,d,26),d+=4,u(y,d,`fcTL`),d+=4,c(y,d,x++),d+=4,c(y,d,S.rect.width),d+=4,c(y,d,S.rect.height),d+=4,c(y,d,S.rect.x),d+=4,c(y,d,S.rect.y),d+=4,l(y,d,a[v]),d+=2,l(y,d,1e3),d+=2,y[d]=S.dispose,d++,y[d]=S.blend,d++,c(y,d,s(y,d-30,30)),d+=4);let t=S.cimg;c(y,d,(g=t.length)+(v==0?0:4)),d+=4;let n=d;u(y,d,v==0?`IDAT`:`fdAT`),d+=4,v!=0&&(c(y,d,x++),d+=4),y.set(t,d),d+=g,c(y,d,s(y,n,d-n)),d+=4}return c(y,d,0),d+=4,u(y,d,`IEND`),d+=4,c(y,d,s(y,d-4,4)),d+=4,y.buffer}function l(e,t,n){for(let r=0;r<e.frames.length;r++){let i=e.frames[r];i.rect.width;let a=i.rect.height,o=new Uint8Array(a*i.bpl+a);i.cimg=p(i.img,a,i.bpp,i.bpl,o,t,n)}}function u(t,n,r,i,a){let o=a[0],c=a[1],l=a[2],u=a[3],p=a[4],m=a[5],g=6,_=8,v=255;for(var y=0;y<t.length;y++){let e=new Uint8Array(t[y]);for(var b=e.length,x=0;x<b;x+=4)v&=e[x+3]}let S=v!=255,C=function(t,n,r,i,a,o){let s=[];for(var c=0;c<t.length;c++){let d=new Uint8Array(t[c]),p=new Uint32Array(d.buffer);var l;let h=0,g=0,_=n,v=r,y=+!!i;if(c!=0){let b=o||i||c==1||s[c-2].dispose!=0?1:2,x=0,S=1e9;for(let e=0;e<b;e++){var u=new Uint8Array(t[c-1-e]);let i=new Uint32Array(t[c-1-e]),o=n,s=r,l=-1,d=-1;for(let e=0;e<r;e++)for(let t=0;t<n;t++)p[m=e*n+t]!=i[m]&&(t<o&&(o=t),t>l&&(l=t),e<s&&(s=e),e>d&&(d=e));l==-1&&(o=s=l=d=0),a&&((1&o)==1&&o--,(1&s)==1&&s--);let f=(l-o+1)*(d-s+1);f<S&&(S=f,x=e,h=o,g=s,_=l-o+1,v=d-s+1)}u=new Uint8Array(t[c-1-x]),x==1&&(s[c-1].dispose=2),l=new Uint8Array(_*v*4),e(u,n,r,l,_,v,-h,-g,0),y=+!!e(d,n,r,l,_,v,-h,-g,3),y==1?f(d,n,r,l,{x:h,y:g,width:_,height:v}):e(d,n,r,l,_,v,-h,-g,0)}else l=d.slice(0);s.push({rect:{x:h,y:g,width:_,height:v},img:l,blend:y,dispose:0})}if(i)for(c=0;c<s.length;c++){if((h=s[c]).blend==1)continue;let e=h.rect,i=s[c-1].rect,o=Math.min(e.x,i.x),l=Math.min(e.y,i.y),u={x:o,y:l,width:Math.max(e.x+e.width,i.x+i.width)-o,height:Math.max(e.y+e.height,i.y+i.height)-l};s[c-1].dispose=1,c-1!=0&&d(t,n,r,s,c-1,u,a),d(t,n,r,s,c,u,a)}let p=0;if(t.length!=1)for(var m=0;m<s.length;m++){var h;p+=(h=s[m]).rect.width*h.rect.height}return s}(t,n,r,o,c,l),w={},T=[],E=[];if(i!=0){let e=[];for(x=0;x<C.length;x++)e.push(C[x].img.buffer);let t=h(function(e){let t=0;for(var n=0;n<e.length;n++)t+=e[n].byteLength;let r=new Uint8Array(t),i=0;for(n=0;n<e.length;n++){let t=new Uint8Array(e[n]),a=t.length;for(let e=0;e<a;e+=4){let n=t[e],a=t[e+1],o=t[e+2],s=t[e+3];s==0&&(n=a=o=0),r[i+e]=n,r[i+e+1]=a,r[i+e+2]=o,r[i+e+3]=s}i+=a}return r.buffer}(e),i);for(x=0;x<t.plte.length;x++)T.push(t.plte[x].est.rgba);let n=0;for(x=0;x<C.length;x++){let e=(O=C[x]).img.length;var D=new Uint8Array(t.inds.buffer,n>>2,e>>2);E.push(D);let r=new Uint8Array(t.abuf,n,e);m&&s(O.img,O.rect.width,O.rect.height,T,r,D),O.img.set(r),n+=e}}else for(y=0;y<C.length;y++){var O=C[y];let e=new Uint32Array(O.img.buffer);var k=O.rect.width;for(b=e.length,D=new Uint8Array(b),E.push(D),x=0;x<b;x++){let t=e[x];if(x!=0&&t==e[x-1])D[x]=D[x-1];else if(x>k&&t==e[x-k])D[x]=D[x-k];else{let e=w[t];if(e==null&&(w[t]=e=T.length,T.push(t),T.length>=300))break;D[x]=e}}}let A=T.length;for(A<=256&&p==0&&(_=A<=2?1:A<=4?2:A<=16?4:8,_=Math.max(_,u)),y=0;y<C.length;y++){(O=C[y]).rect.x,O.rect.y,k=O.rect.width;let e=O.rect.height,t=O.img;new Uint32Array(t.buffer);let n=4*k,r=4;if(A<=256&&p==0){n=Math.ceil(_*k/8);var j=new Uint8Array(n*e);let i=E[y];for(let t=0;t<e;t++){x=t*n;let e=t*k;if(_==8)for(var M=0;M<k;M++)j[x+M]=i[e+M];else if(_==4)for(M=0;M<k;M++)j[x+(M>>1)]|=i[e+M]<<4-4*(1&M);else if(_==2)for(M=0;M<k;M++)j[x+(M>>2)]|=i[e+M]<<6-2*(3&M);else if(_==1)for(M=0;M<k;M++)j[x+(M>>3)]|=i[e+M]<<7-1*(7&M)}t=j,g=3,r=1}else if(S==0&&C.length==1){j=new Uint8Array(k*e*3);let i=k*e;for(x=0;x<i;x++){let e=3*x,n=4*x;j[e]=t[n],j[e+1]=t[n+1],j[e+2]=t[n+2]}t=j,g=2,r=3,n=3*k}O.img=t,O.bpl=n,O.bpp=r}return{ctype:g,depth:_,plte:T,frames:C}}function d(t,n,r,i,a,o,s){let c=Uint8Array,l=Uint32Array,u=new c(t[a-1]),d=new l(t[a-1]),p=a+1<t.length?new c(t[a+1]):null,m=new c(t[a]),h=new l(m.buffer),g=n,_=r,v=-1,y=-1;for(let e=0;e<o.height;e++)for(let t=0;t<o.width;t++){let r=o.x+t,s=o.y+e,c=s*n+r,l=h[c];l==0||i[a-1].dispose==0&&d[c]==l&&(p==null||p[4*c+3]!=0)||(r<g&&(g=r),r>v&&(v=r),s<_&&(_=s),s>y&&(y=s))}v==-1&&(g=_=v=y=0),s&&((1&g)==1&&g--,(1&_)==1&&_--),o={x:g,y:_,width:v-g+1,height:y-_+1};let b=i[a];b.rect=o,b.blend=1,b.img=new Uint8Array(o.width*o.height*4),i[a-1].dispose==0?(e(u,n,r,b.img,o.width,o.height,-o.x,-o.y,0),f(m,n,r,b.img,o)):e(m,n,r,b.img,o.width,o.height,-o.x,-o.y,0)}function f(t,n,r,i,a){e(t,n,r,i,a.width,a.height,-a.x,-a.y,2)}function p(e,t,n,r,i,a,o){let s=[],c,l=[0,1,2,3,4];a==-1?(t*r>5e5||n==1)&&(l=[0]):l=[a],o&&(c={level:0});let u=Ed;for(var d=0;d<l.length;d++){for(let a=0;a<t;a++)m(i,e,a,r,n,l[d]);s.push(u.deflate(i,c))}let f,p=1e9;for(d=0;d<s.length;d++)s[d].length<p&&(f=d,p=s[d].length);return s[f]}function m(e,t,r,i,a,o){let s=r*i,c=s+r;if(e[c]=o,c++,o==0)if(i<500)for(var l=0;l<i;l++)e[c+l]=t[s+l];else e.set(new Uint8Array(t.buffer,s,i),c);else if(o==1){for(l=0;l<a;l++)e[c+l]=t[s+l];for(l=a;l<i;l++)e[c+l]=t[s+l]-t[s+l-a]+256&255}else if(r==0){for(l=0;l<a;l++)e[c+l]=t[s+l];if(o==2)for(l=a;l<i;l++)e[c+l]=t[s+l];if(o==3)for(l=a;l<i;l++)e[c+l]=t[s+l]-(t[s+l-a]>>1)+256&255;if(o==4)for(l=a;l<i;l++)e[c+l]=t[s+l]-n(t[s+l-a],0,0)+256&255}else{if(o==2)for(l=0;l<i;l++)e[c+l]=t[s+l]+256-t[s+l-i]&255;if(o==3){for(l=0;l<a;l++)e[c+l]=t[s+l]+256-(t[s+l-i]>>1)&255;for(l=a;l<i;l++)e[c+l]=t[s+l]+256-(t[s+l-i]+t[s+l-a]>>1)&255}if(o==4){for(l=0;l<a;l++)e[c+l]=t[s+l]+256-n(0,t[s+l-i],0)&255;for(l=a;l<i;l++)e[c+l]=t[s+l]+256-n(t[s+l-a],t[s+l-i],t[s+l-a-i])&255}}}function h(e,t){let n=new Uint8Array(e),r=n.slice(0),i=new Uint32Array(r.buffer),a=g(r,t),o=a[0],s=a[1],c=n.length,l=new Uint8Array(c>>2),u;if(n.length<2e7)for(var d=0;d<c;d+=4)u=_(o,f=n[d]*(1/255),p=n[d+1]*(1/255),m=n[d+2]*(1/255),h=n[d+3]*(1/255)),l[d>>2]=u.ind,i[d>>2]=u.est.rgba;else for(d=0;d<c;d+=4){var f=n[d]*(1/255),p=n[d+1]*(1/255),m=n[d+2]*(1/255),h=n[d+3]*(1/255);for(u=o;u.left;)u=v(u.est,f,p,m,h)<=0?u.left:u.right;l[d>>2]=u.ind,i[d>>2]=u.est.rgba}return{abuf:r.buffer,inds:l,plte:s}}function g(e,t,n){n??=1e-4;let r=new Uint32Array(e.buffer),i={i0:0,i1:e.length,bst:null,est:null,tdst:0,left:null,right:null};i.bst=x(e,i.i0,i.i1),i.est=S(i.bst);let a=[i];for(;a.length<t;){let t=0,i=0;for(var o=0;o<a.length;o++)a[o].est.L>t&&(t=a[o].est.L,i=o);if(t<n)break;let s=a[i],c=y(e,r,s.i0,s.i1,s.est.e,s.est.eMq255);if(s.i0>=c||s.i1<=c){s.est.L=0;continue}let l={i0:s.i0,i1:c,bst:null,est:null,tdst:0,left:null,right:null};l.bst=x(e,l.i0,l.i1),l.est=S(l.bst);let u={i0:c,i1:s.i1,bst:null,est:null,tdst:0,left:null,right:null};for(u.bst={R:[],m:[],N:s.bst.N-l.bst.N},o=0;o<16;o++)u.bst.R[o]=s.bst.R[o]-l.bst.R[o];for(o=0;o<4;o++)u.bst.m[o]=s.bst.m[o]-l.bst.m[o];u.est=S(u.bst),s.left=l,s.right=u,a[i]=l,a.push(u)}for(a.sort(((e,t)=>t.bst.N-e.bst.N)),o=0;o<a.length;o++)a[o].ind=o;return[i,a]}function _(e,t,n,r,i){if(e.left==null)return e.tdst=function(e,t,n,r,i){let a=t-e[0],o=n-e[1],s=r-e[2],c=i-e[3];return a*a+o*o+s*s+c*c}(e.est.q,t,n,r,i),e;let a=v(e.est,t,n,r,i),o=e.left,s=e.right;a>0&&(o=e.right,s=e.left);let c=_(o,t,n,r,i);if(c.tdst<=a*a)return c;let l=_(s,t,n,r,i);return l.tdst<c.tdst?l:c}function v(e,t,n,r,i){let{e:a}=e;return a[0]*t+a[1]*n+a[2]*r+a[3]*i-e.eMq}function y(e,t,n,r,i,a){for(r-=4;n<r;){for(;b(e,n,i)<=a;)n+=4;for(;b(e,r,i)>a;)r-=4;if(n>=r)break;let o=t[n>>2];t[n>>2]=t[r>>2],t[r>>2]=o,n+=4,r-=4}for(;b(e,n,i)>a;)n-=4;return n+4}function b(e,t,n){return e[t]*n[0]+e[t+1]*n[1]+e[t+2]*n[2]+e[t+3]*n[3]}function x(e,t,n){let r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0],a=n-t>>2;for(let a=t;a<n;a+=4){let t=e[a]*(1/255),n=e[a+1]*(1/255),o=e[a+2]*(1/255),s=e[a+3]*(1/255);i[0]+=t,i[1]+=n,i[2]+=o,i[3]+=s,r[0]+=t*t,r[1]+=t*n,r[2]+=t*o,r[3]+=t*s,r[5]+=n*n,r[6]+=n*o,r[7]+=n*s,r[10]+=o*o,r[11]+=o*s,r[15]+=s*s}return r[4]=r[1],r[8]=r[2],r[9]=r[6],r[12]=r[3],r[13]=r[7],r[14]=r[11],{R:r,m:i,N:a}}function S(e){let{R:t}=e,{m:n}=e,{N:r}=e,i=n[0],a=n[1],o=n[2],s=n[3],c=r==0?0:1/r,l=[t[0]-i*i*c,t[1]-i*a*c,t[2]-i*o*c,t[3]-i*s*c,t[4]-a*i*c,t[5]-a*a*c,t[6]-a*o*c,t[7]-a*s*c,t[8]-o*i*c,t[9]-o*a*c,t[10]-o*o*c,t[11]-o*s*c,t[12]-s*i*c,t[13]-s*a*c,t[14]-s*o*c,t[15]-s*s*c],u=l,d=C,f=[Math.random(),Math.random(),Math.random(),Math.random()],p=0,m=0;if(r!=0)for(let e=0;e<16&&(f=d.multVec(u,f),m=Math.sqrt(d.dot(f,f)),f=d.sml(1/m,f),!(e!=0&&Math.abs(m-p)<1e-9));e++)p=m;let h=[i*c,a*c,o*c,s*c];return{Cov:l,q:h,e:f,L:p,eMq255:d.dot(d.sml(255,h),f),eMq:d.dot(f,h),rgba:(Math.round(255*h[3])<<24|Math.round(255*h[2])<<16|Math.round(255*h[1])<<8|Math.round(255*h[0])<<0)>>>0}}var C={multVec:(e,t)=>[e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],e[4]*t[0]+e[5]*t[1]+e[6]*t[2]+e[7]*t[3],e[8]*t[0]+e[9]*t[1]+e[10]*t[2]+e[11]*t[3],e[12]*t[0]+e[13]*t[1]+e[14]*t[2]+e[15]*t[3]],dot:(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],sml:(e,t)=>[e*t[0],e*t[1],e*t[2],e*t[3]]};Dd.encode=function(e,t,n,r,i,a,o){r??=0,o??=!1;let s=u(e,t,n,r,[!1,!1,!1,0,o,!1]);return l(s,-1),c(s,t,n,i,a)},Dd.encodeLL=function(e,t,n,r,i,a,o,s){let u={ctype:0+(r==1?0:2)+(i==0?0:4),depth:a,frames:[]},d=(r+i)*a,f=d*t;for(let r=0;r<e.length;r++)u.frames.push({rect:{x:0,y:0,width:t,height:n},img:new Uint8Array(e[r]),blend:0,dispose:1,bpp:Math.ceil(d/8),bpl:Math.ceil(f/8)});return l(u,0,!0),c(u,t,n,o,s)},Dd.encode.compress=u,Dd.encode.dither=s,Dd.quantize=h,Dd.quantize.getKDtree=g,Dd.quantize.getNearest=_})();var Od={toArrayBuffer(e,t){let n=e.width,r=e.height,i=n<<2,a=e.getContext(`2d`).getImageData(0,0,n,r),o=new Uint32Array(a.data.buffer),s=(32*n+31)/32<<2,c=s*r,l=122+c,u=new ArrayBuffer(l),d=new DataView(u),f=1<<20,p,m,h,g,_=f,v=0,y=0,b=0;function x(e){d.setUint16(y,e,!0),y+=2}function S(e){d.setUint32(y,e,!0),y+=4}function C(e){y+=e}x(19778),S(l),C(4),S(122),S(108),S(n),S(-r>>>0),x(1),x(32),S(3),S(c),S(2835),S(2835),C(8),S(16711680),S(65280),S(255),S(4278190080),S(1466527264),function e(){for(;v<r&&_>0;){for(g=122+v*s,p=0;p<i;)_--,m=o[b++],h=m>>>24,d.setUint32(g+p,m<<8|h),p+=4;v++}b<o.length?(_=f,setTimeout(e,Od._dly)):t(u)}()},toBlob(e,t){this.toArrayBuffer(e,(e=>{t(new Blob([e],{type:`image/bmp`}))}))},_dly:9},kd={CHROME:`CHROME`,FIREFOX:`FIREFOX`,DESKTOP_SAFARI:`DESKTOP_SAFARI`,IE:`IE`,IOS:`IOS`,ETC:`ETC`},Ad={[kd.CHROME]:16384,[kd.FIREFOX]:11180,[kd.DESKTOP_SAFARI]:16384,[kd.IE]:8192,[kd.IOS]:4096,[kd.ETC]:8192},jd=typeof window<`u`,Md=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope,Nd=jd&&window.cordova&&window.cordova.require&&window.cordova.require(`cordova/modulemapper`),Pd=(jd||Md)&&(Nd&&Nd.getOriginalSymbol(window,`File`)||typeof File<`u`&&File),Fd=(jd||Md)&&(Nd&&Nd.getOriginalSymbol(window,`FileReader`)||typeof FileReader<`u`&&FileReader);function Id(e,t,n=Date.now()){return new Promise((r=>{let i=e.split(`,`),a=i[0].match(/:(.*?);/)[1],o=globalThis.atob(i[1]),s=o.length,c=new Uint8Array(s);for(;s--;)c[s]=o.charCodeAt(s);let l=new Blob([c],{type:a});l.name=t,l.lastModified=n,r(l)}))}function Ld(e){return new Promise(((t,n)=>{let r=new Fd;r.onload=()=>t(r.result),r.onerror=e=>n(e),r.readAsDataURL(e)}))}function Rd(e){return new Promise(((t,n)=>{let r=new Image;r.onload=()=>t(r),r.onerror=e=>n(e),r.src=e}))}function zd(){if(zd.cachedResult!==void 0)return zd.cachedResult;let e=kd.ETC,{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=kd.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=kd.IOS:/Safari/i.test(t)?e=kd.DESKTOP_SAFARI:/Firefox/i.test(t)?e=kd.FIREFOX:(/MSIE/i.test(t)||!!document.documentMode==1)&&(e=kd.IE),zd.cachedResult=e,zd.cachedResult}function Bd(e,t){let n=Ad[zd()],r=e,i=t,a=r*i,o=r>i?i/r:r/i;for(;a>n*n;){let e=(n+r)/2,t=(n+i)/2;e<t?(i=t,r=t*o):(i=e*o,r=e),a=r*i}return{width:r,height:i}}function Vd(e,t){let n,r;try{if(n=new OffscreenCanvas(e,t),r=n.getContext(`2d`),r===null)throw Error(`getContext of OffscreenCanvas returns null`)}catch{n=document.createElement(`canvas`),r=n.getContext(`2d`)}return n.width=e,n.height=t,[n,r]}function Hd(e,t){let{width:n,height:r}=Bd(e.width,e.height),[i,a]=Vd(n,r);return t&&/jpe?g/.test(t)&&(a.fillStyle=`white`,a.fillRect(0,0,i.width,i.height)),a.drawImage(e,0,0,i.width,i.height),i}function Ud(){return Ud.cachedResult!==void 0||(Ud.cachedResult=[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&typeof document<`u`&&`ontouchend`in document),Ud.cachedResult}function Wd(e,t={}){return new Promise((function(n,r){let i,a;var o=function(){try{return a=Hd(i,t.fileType||e.type),n([i,a])}catch(e){return r(e)}},s=function(t){try{var n=function(e){try{throw e}catch(e){return r(e)}};try{let t;return Ld(e).then((function(e){try{return t=e,Rd(t).then((function(e){try{return i=e,function(){try{return o()}catch(e){return r(e)}}()}catch(e){return n(e)}}),n)}catch(e){return n(e)}}),n)}catch(e){n(e)}}catch(e){return r(e)}};try{if(Ud()||[kd.DESKTOP_SAFARI,kd.MOBILE_SAFARI].includes(zd()))throw Error(`Skip createImageBitmap on IOS and Safari`);return createImageBitmap(e).then((function(e){try{return i=e,o()}catch{return s()}}),s)}catch{s()}}))}function Gd(e,t,n,r,i=1){return new Promise((function(a,o){let s;if(t===`image/png`){let a,o,c;return a=e.getContext(`2d`),{data:o}=a.getImageData(0,0,e.width,e.height),c=Dd.encode([o.buffer],e.width,e.height,4096*i),s=new Blob([c],{type:t}),s.name=n,s.lastModified=r,u.call(this)}{if(t===`image/bmp`)return new Promise((t=>Od.toBlob(e,t))).then(function(e){try{return s=e,s.name=n,s.lastModified=r,l.call(this)}catch(e){return o(e)}}.bind(this),o);{if(typeof OffscreenCanvas==`function`&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:i}).then(function(e){try{return s=e,s.name=n,s.lastModified=r,c.call(this)}catch(e){return o(e)}}.bind(this),o);{let a;return a=e.toDataURL(t,i),Id(a,n,r).then(function(e){try{return s=e,c.call(this)}catch(e){return o(e)}}.bind(this),o)}function c(){return l.call(this)}}function l(){return u.call(this)}}function u(){return a(s)}}))}function Kd(e){e.width=0,e.height=0}function qd(){return new Promise((function(e,t){let n,r,i,a;return qd.cachedResult===void 0?Id(`data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==`,`test.jpg`,Date.now()).then((function(o){try{return n=o,Wd(n).then((function(o){try{return r=o[1],Gd(r,n.type,n.name,n.lastModified).then((function(n){try{return i=n,Kd(r),Wd(i).then((function(n){try{return a=n[0],qd.cachedResult=a.width===1&&a.height===2,e(qd.cachedResult)}catch(e){return t(e)}}),t)}catch(e){return t(e)}}),t)}catch(e){return t(e)}}),t)}catch(e){return t(e)}}),t):e(qd.cachedResult)}))}function Jd(e){return new Promise(((t,n)=>{let r=new Fd;r.onload=e=>{let n=new DataView(e.target.result);if(n.getUint16(0,!1)!=65496)return t(-2);let r=n.byteLength,i=2;for(;i<r;){if(n.getUint16(i+2,!1)<=8)return t(-1);let e=n.getUint16(i,!1);if(i+=2,e==65505){if(n.getUint32(i+=2,!1)!=1165519206)return t(-1);let e=n.getUint16(i+=6,!1)==18761;i+=n.getUint32(i+4,e);let r=n.getUint16(i,e);i+=2;for(let a=0;a<r;a++)if(n.getUint16(i+12*a,e)==274)return t(n.getUint16(i+12*a+8,e))}else{if((65280&e)!=65280)break;i+=n.getUint16(i,!1)}}return t(-1)},r.onerror=e=>n(e),r.readAsArrayBuffer(e)}))}function Yd(e,t){let{width:n}=e,{height:r}=e,{maxWidthOrHeight:i}=t,a,o=e;return isFinite(i)&&(n>i||r>i)&&([o,a]=Vd(n,r),n>r?(o.width=i,o.height=r/n*i):(o.width=n/r*i,o.height=i),a.drawImage(e,0,0,o.width,o.height),Kd(e)),o}function Xd(e,t){let{width:n}=e,{height:r}=e,[i,a]=Vd(n,r);switch(t>4&&t<9?(i.width=r,i.height=n):(i.width=n,i.height=r),t){case 2:a.transform(-1,0,0,1,n,0);break;case 3:a.transform(-1,0,0,-1,n,r);break;case 4:a.transform(1,0,0,-1,0,r);break;case 5:a.transform(0,1,1,0,0,0);break;case 6:a.transform(0,1,-1,0,r,0);break;case 7:a.transform(0,-1,-1,0,r,n);break;case 8:a.transform(0,-1,1,0,0,n)}return a.drawImage(e,0,0,n,r),Kd(e),i}function Zd(e,t,n=0){return new Promise((function(r,i){let a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w;function T(e=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;a+=e,t.onProgress(Math.min(a,100))}function E(e){if(t.signal&&t.signal.aborted)throw t.signal.reason;a=Math.min(Math.max(e,a),100),t.onProgress(a)}return a=n,o=t.maxIteration||10,s=1024*t.maxSizeMB*1024,T(),Wd(e,t).then(function(n){try{return[,c]=n,T(),l=Yd(c,t),T(),new Promise((function(n,r){var i;if(!(i=t.exifOrientation))return Jd(e).then(function(e){try{return i=e,a.call(this)}catch(e){return r(e)}}.bind(this),r);function a(){return n(i)}return a.call(this)})).then(function(n){try{return u=n,T(),qd().then(function(n){try{return d=n?l:Xd(l,u),T(),f=t.initialQuality||1,p=t.fileType||e.type,Gd(d,p,e.name,e.lastModified,f).then(function(n){try{{if(m=n,T(),h=m.size>s,g=m.size>e.size,!h&&!g)return E(100),r(m);var a;function u(){if(o--&&(y>s||y>_)){let t,n;return t=w?.95*C.width:C.width,n=w?.95*C.height:C.height,[x,S]=Vd(t,n),S.drawImage(C,0,0,t,n),f*=p===`image/png`?.85:.95,Gd(x,p,e.name,e.lastModified,f).then((function(e){try{return b=e,Kd(C),C=x,y=b.size,E(Math.min(99,Math.floor((v-y)/(v-s)*100))),u}catch(e){return i(e)}}),i)}return[1]}return _=e.size,v=m.size,y=v,C=d,w=!t.alwaysKeepResolution&&h,(a=function(e){for(;e;){if(e.then)return void e.then(a,i);try{if(e.pop){if(e.length)return e.pop()?D.call(this):e;e=u}else e=e.call(this)}catch(e){return i(e)}}}.bind(this))(u);function D(){return Kd(C),Kd(x),Kd(l),Kd(d),Kd(c),E(100),r(b)}}}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}))}var Qd=`
32
32
  let scriptImported = false
33
33
  self.addEventListener('message', async (e) => {
34
34
  const { file, id, imageCompressionLibUrl, options } = e.data
@@ -47,4 +47,4 @@ self.addEventListener('message', async (e) => {
47
47
  self.postMessage({ error: e.message + '\\n' + e.stack, id })
48
48
  }
49
49
  })
50
- `,$d;function ef(e,t){return new Promise(((n,r)=>{$d||=function(e){let t=[];return typeof e==`function`?t.push(`(${e})()`):t.push(e),URL.createObjectURL(new Blob(t))}(Qd);let i=new Worker($d);i.addEventListener(`message`,(function(e){if(t.signal&&t.signal.aborted)i.terminate();else if(e.data.progress===void 0){if(e.data.error)return r(Error(e.data.error)),void i.terminate();n(e.data.file),i.terminate()}else t.onProgress(e.data.progress)})),i.addEventListener(`error`,r),t.signal&&t.signal.addEventListener(`abort`,(()=>{r(t.signal.reason),i.terminate()})),i.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function $(e,t){return new Promise((function(n,r){let i,a,o,s,c,l;if(i={...t},o=0,{onProgress:s}=i,i.maxSizeMB=i.maxSizeMB||1/0,c=typeof i.useWebWorker!=`boolean`||i.useWebWorker,delete i.useWebWorker,i.onProgress=e=>{o=e,typeof s==`function`&&s(o)},!(e instanceof Blob||e instanceof Pd))return r(Error(`The file given is not an instance of Blob or File`));if(!/^image/.test(e.type))return r(Error(`The file given is not an image`));if(l=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope,!c||typeof Worker!=`function`||l)return Zd(e,i).then(function(e){try{return a=e,f.call(this)}catch(e){return r(e)}}.bind(this),r);var u=function(){try{return f.call(this)}catch(e){return r(e)}}.bind(this),d=function(t){try{return Zd(e,i).then((function(e){try{return a=e,u()}catch(e){return r(e)}}),r)}catch(e){return r(e)}};try{return i.libURL=i.libURL||`https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js`,ef(e,i).then((function(e){try{return a=e,u()}catch{return d()}}),d)}catch{d()}function f(){try{a.name=e.name,a.lastModified=e.lastModified}catch{}try{i.preserveExif&&e.type===`image/jpeg`&&(!i.fileType||i.fileType&&i.fileType===e.type)&&(a=Sd(e,a))}catch{}return n(a)}}))}$.getDataUrlFromFile=Ld,$.getFilefromDataUrl=Id,$.loadImage=Rd,$.drawImageInCanvas=Hd,$.drawFileInCanvas=Wd,$.canvasToFile=Gd,$.getExifOrientation=Jd,$.handleMaxWidthOrHeight=Yd,$.followExifOrientation=Xd,$.cleanupCanvasMemory=Kd,$.isAutoOrientationInBrowser=qd,$.approximateBelowMaximumCanvasSizeOfBrowser=Bd,$.copyExifWithoutOrientation=Sd,$.getBrowserName=zd,$.version=`2.0.2`;async function tf(e,t,n=.85,r=`image/webp`){return $(e,{maxWidthOrHeight:t,fileType:r,initialQuality:n,useWebWorker:!0})}var nf=({onSend:t,sending:a=!1,placeholder:o=`Type a message...`,disabled:s=!1,disableReason:c})=>{let[l,u]=(0,n.useState)(``),[d,f]=(0,n.useState)(null),[p,m]=(0,n.useState)(null),[h,g]=(0,n.useState)(!1),[_,v]=(0,n.useState)(void 0),[y,b]=(0,n.useState)(null),[x,S]=(0,n.useState)(!1),C=(0,n.useRef)(null),w=(0,n.useRef)(null),T=h,E=!a&&!T&&!s&&(!!l.trim()||!!d),D=()=>{E&&(t(l.trim()||``,d?[d]:void 0),u(``),f(null),m(null),g(!1),setTimeout(()=>{C.current?.querySelector(`textarea`)?.focus()},300))},O=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),D())},k=async t=>{let n=e.a();if(n){g(!0),v(void 0);try{let e=await tf(t,1280),r=await tf(e,400,1,`image/jpeg`),i=await n.uploadFile(e,r,e=>v(e));m(URL.createObjectURL(r)),f({id:i.id,ext:i.ext,size:e.size})}catch(e){m(null),f(null),b(e instanceof Error?e.message:`Failed to upload image. Please try again.`)}finally{g(!1),v(void 0)}}};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Snackbar,{open:!!y,autoHideDuration:4e3,onClose:()=>b(null),anchorOrigin:{vertical:`bottom`,horizontal:`center`},children:(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>b(null),children:y})}),(0,i.jsxs)(r.Box,{borderTop:1,borderColor:`divider`,children:[h&&(0,i.jsx)(r.LinearProgress,{variant:_===void 0?`indeterminate`:`determinate`,value:_,sx:{height:2}}),p&&(0,i.jsxs)(r.Box,{display:`flex`,alignItems:`center`,px:2,pt:1.5,gap:1,children:[(0,i.jsxs)(r.Box,{position:`relative`,display:`inline-flex`,children:[(0,i.jsx)(r.Box,{component:`img`,src:p,alt:`preview`,sx:{height:64,width:64,objectFit:`cover`,borderRadius:1,opacity:T?.5:1}}),!T&&(0,i.jsx)(r.IconButton,{size:`small`,onClick:()=>{p&&URL.revokeObjectURL(p),m(null),f(null),g(!1)},sx:{position:`absolute`,top:-8,right:-8,bgcolor:`background.paper`,border:1,borderColor:`divider`,p:.25,"&:hover":{bgcolor:`error.light`}},children:(0,i.jsx)(Qr,{sx:{fontSize:14}})})]}),T&&(0,i.jsx)(r.Chip,{label:`Uploading…`,size:`small`,variant:`outlined`})]}),(0,i.jsxs)(r.Box,{display:`flex`,gap:1,p:2,alignItems:`flex-end`,children:[(0,i.jsx)(`input`,{ref:w,type:`file`,accept:`image/*`,style:{display:`none`},onChange:async e=>{let t=e.target.files?.[0];t&&(e.target.value=``,await k(t))}}),(0,i.jsx)(r.Tooltip,{title:`Attach image`,children:(0,i.jsx)(`span`,{children:(0,i.jsx)(r.IconButton,{onClick:()=>w.current?.click(),disabled:s||T||!!d,size:`medium`,children:(0,i.jsx)(qr,{})})})}),(0,i.jsx)(r.Tooltip,{title:`Take photo`,children:(0,i.jsx)(`span`,{children:(0,i.jsx)(r.IconButton,{onClick:()=>S(!0),disabled:s||T||!!d,size:`medium`,children:(0,i.jsx)(Yr,{})})})}),(0,i.jsx)(bd,{open:x,onCapture:e=>k(e),onClose:()=>S(!1)}),(0,i.jsx)(r.TextField,{ref:C,fullWidth:!0,multiline:!0,maxRows:4,value:l,onChange:e=>u(e.target.value),onKeyDown:O,placeholder:s&&c?c:o,disabled:s||a,variant:`outlined`,size:`small`}),(0,i.jsx)(r.IconButton,{color:`primary`,onClick:D,disabled:!E,size:`large`,children:a?(0,i.jsx)(r.CircularProgress,{size:24}):(0,i.jsx)(di,{})})]})]})]})};function rf({conversation:t,limit:r=50}){let i=e.p(t),[a,o]=(0,n.useState)(!1),[s,c]=(0,n.useState)(!1),[l,u]=(0,n.useState)(),d=nd(()=>e.d.messages.where(`conversationId`).equals(i).sortBy(`created_at`),[i])||[],f=nd(()=>e.d.msgCursor.where(`id`).equals(i).first(),[i]);return gd(async()=>{let n={limit:r};d.length&&(n.cursorType=`after`,n.cursorDatetime=d[d.length-1]?.created_at),o(!0),await e.c(t,n).catch(u),o(!1),await e.d.summaries.update(i,{unread_count:0})},[t,r]),e.m.debug(`mw`,d.length),{messages:d,cursor:f,loading:a,error:l,loadMore:(0,n.useCallback)(async()=>{if(!(!f||s||a)){c(!0);try{let n={limit:r};if(!f?.datetime)return;n.cursorType=`before`,n.cursorDatetime=f.datetime,await e.c(t,n)}catch(t){e.m.error(`[useMessages] Failed to load more:`,t)}c(!1)}},[f,r,t,s,a]),loadingMore:s}}var af=({conversation:t,user:a,isConnected:s,onBack:c})=>{let l=e.a();if(!l)return null;let{messages:u,cursor:d,loading:f,error:p,loadMore:m,loadingMore:h}=rf({conversation:t}),g=nd(async()=>t.type===`group`?await e.d.groups.get(t.id):null,[t.id,t.type]),_=a?.role===`admin`,v=a?.role===`moderator`,y=g?.is_member??!0,b=g?.system??!1,x=_&&t.type===`group`&&!y,S=t.type===`group`&&!y,C=t.type===`group`&&(_||y),w=t.type===`group`&&!b&&(_||v&&y),T=_&&t.type===`group`&&!b,[E,D]=(0,n.useState)(!1),[O,k]=(0,n.useState)(!1),[A,j]=(0,n.useState)(``),[M,N]=(0,n.useState)(!1),[ee,P]=(0,n.useState)(null),F=()=>{j(t.name||``),P(null),k(!0)},I=async()=>{if(A.trim()){N(!0),P(null);try{await $u(a.org,t.id,A.trim()),k(!1)}catch(e){P(o(e,`Failed to rename group`))}finally{N(!1)}}},[L,te]=(0,n.useState)(!1),[ne,R]=(0,n.useState)(!1),[re,ie]=(0,n.useState)(null),z=async()=>{te(!1),R(!0),ie(null);try{await ed(a.org,t.id)}catch(e){ie(o(e,`Failed to delete group`)),R(!1)}},[ae,oe]=(0,n.useState)(!1),[se,ce]=(0,n.useState)(!1),B=async n=>{if(t.type===`group`){oe(!0);try{await l.joinGroup(a.org,t.id,n),ce(!0),await Qu(a.org),await e.t({}),setTimeout(()=>ce(!1),3e3)}catch(e){fe(o(e,`Failed to join group`))}oe(!1)}},[le,ue]=(0,n.useState)(!1),[de,fe]=(0,n.useState)(null),[pe,me]=(0,n.useState)(!1);return(0,i.jsxs)(r.Box,{display:`flex`,flexDirection:`column`,height:`100%`,children:[(0,i.jsx)(id,{displayName:t.name||`Chat`,type:t.type,isConnected:s,onBack:c,showJoinButton:x,onJoin:B,joining:ae,showMembersButton:C,onManageMembers:()=>D(!0),canManageGroup:T,onRenameGroup:F,onDeleteGroup:()=>te(!0),deletingGroup:ne}),C&&(0,i.jsx)(sd,{open:E,onClose:()=>D(!1),orgId:a.org,groupId:t.id,currentUserId:a.id,canManage:w}),(0,i.jsxs)(r.Dialog,{open:O,onClose:()=>k(!1),fullWidth:!0,maxWidth:`xs`,children:[(0,i.jsx)(r.DialogTitle,{children:`Rename Group`}),(0,i.jsx)(r.DialogContent,{children:(0,i.jsx)(r.TextField,{autoFocus:!0,fullWidth:!0,label:`Group name`,value:A,onChange:e=>j(e.target.value),onKeyDown:e=>e.key===`Enter`&&I(),error:!!ee,helperText:ee?.message,sx:{mt:1}})}),(0,i.jsxs)(r.DialogActions,{children:[(0,i.jsx)(r.Button,{onClick:()=>k(!1),children:`Cancel`}),(0,i.jsx)(r.Button,{onClick:I,disabled:M||!A.trim(),variant:`contained`,children:M?`Renaming...`:`Rename`})]})]}),(0,i.jsxs)(r.Dialog,{open:L,onClose:()=>te(!1),maxWidth:`xs`,fullWidth:!0,children:[(0,i.jsx)(r.DialogTitle,{children:`Delete Group`}),(0,i.jsx)(r.DialogContent,{children:`Are you sure you want to delete this group? This action cannot be undone.`}),(0,i.jsxs)(r.DialogActions,{children:[(0,i.jsx)(r.Button,{onClick:()=>te(!1),children:`Cancel`}),(0,i.jsx)(r.Button,{onClick:z,disabled:ne,color:`error`,variant:`contained`,children:ne?`Deleting...`:`Delete`})]})]}),re&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>ie(null),children:re.message}),(0,i.jsx)(r.Snackbar,{open:se,autoHideDuration:3e3,onClose:()=>ce(!1),message:`Successfully joined group`}),de&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>fe(null),children:de.message}),(0,i.jsx)(yd,{messages:u,currentUserId:a?.id||0,loading:f,error:p,autoScroll:!0,hasMore:!!d?.datetime,loadingMore:h,onLoadMore:m,forceScrollToBottom:pe}),S?(0,i.jsx)(r.Alert,{severity:`warning`,sx:{m:2},children:`You must be a group member to send messages`}):(0,i.jsx)(nf,{onSend:async(n,r)=>{if(!n.trim()&&!r?.length)return;ue(!0),fe(null),me(!0);let i=`temp-${Date.now()}-${Math.random()}`,s={id:i,sender:a?.id,receiver:t.type===`dm`?t.id:null,group:t.type===`group`?t.id:null,content:n||null,media:null,created_at:new Date().toISOString(),conversationId:e.p(t)};try{await e.d.messages.put(s);let a=await(t.type===`group`?l.sendGroupMessage:l.sendDM).bind(l)(t.id,n||void 0,r);await e.d.messages.delete(i),await e.d.messages.put({...a,conversationId:e.p(t)})}catch(e){fe(o(e,`Failed to send message`))}ue(!1),setTimeout(()=>me(!1),100)},sending:le,disabled:!s,disableReason:s?void 0:`You're offline. You need to be online to send messages`})]})},of=class extends n.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(t,n){e.m.error(`ErrorBoundary caught an error:`,t,n),this.props.onError?.(t,n)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,i.jsxs)(r.Box,{display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,height:`100%`,p:3,children:[(0,i.jsxs)(r.Alert,{severity:`error`,sx:{mb:2,maxWidth:500},children:[(0,i.jsx)(r.Typography,{variant:`h6`,gutterBottom:!0,children:`Something went wrong`}),(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,children:this.state.error?.message||`An unexpected error occurred`})]}),(0,i.jsx)(r.Button,{variant:`contained`,startIcon:(0,i.jsx)(li,{}),onClick:this.handleReset,children:`Try Again`})]}):this.props.children}};function sf({onMessage:t,onConnect:r,onDisconnect:i,onError:a}={}){let[o,s]=(0,n.useState)(!1),c=(0,n.useCallback)(e=>{t?.(e)},[t]),l=(0,n.useCallback)(()=>{s(!0),r?.()},[r]),u=(0,n.useCallback)(()=>{s(!1),i?.()},[i]),d=(0,n.useCallback)(e=>{a?.(e)},[a]);return(0,n.useEffect)(()=>{if(e.s())try{let t=e.a();return t?(s(t.isConnected()),t.on(`message`,c),t.on(`open`,l),t.on(`close`,u),t.on(`error`,d),()=>{t.off(`message`,c),t.off(`open`,l),t.off(`close`,u),t.off(`error`,d)}):void 0}catch(t){e.m.error(`Failed to setup WebSocket listeners:`,t)}},[c,l,u,d]),{isConnected:o}}var cf=({initialConversation:t})=>{let[a,o]=(0,n.useState)(t??null),[s,c]=(0,n.useState)(),[l,u]=(0,n.useState)(!0),[d,f]=(0,n.useState)(()=>e.a()),p=(0,n.useCallback)(e=>()=>u(e),[]);return(0,n.useEffect)(()=>{d||e.a(f)},[d]),gd(async()=>{if(!d)return;let t=await d.getMe();c(t),e.d.users.put(t)},[d]),sf({onError:p(!1),onConnect:p(!0),onDisconnect:p(!1)}),d?(0,i.jsxs)(r.Box,{display:`flex`,height:`100%`,overflow:`hidden`,children:[(0,i.jsx)(r.Box,{sx:{width:{xs:`100%`,sm:`100%`,md:`320px`},flexShrink:0,border:`0px solid`,borderRightWidth:{xs:0,md:1},borderColor:`divider`,overflow:`hidden`,display:{xs:a?`none`:`flex`,sm:a?`none`:`flex`,md:`flex`},flexDirection:`column`},children:(0,i.jsx)(of,{children:(0,i.jsx)(rd,{currentUser:s,selectedConversation:a,onConversationSelect:t=>{o(t),e.n(e.p(t))}})})}),(0,i.jsx)(r.Box,{sx:{flex:1,overflow:`hidden`,display:{xs:a?`flex`:`none`,sm:a?`flex`:`none`,md:`flex`},flexDirection:`column`},children:a?(0,i.jsx)(of,{children:(0,i.jsx)(af,{conversation:a,user:s,isConnected:l,onBack:()=>{o(null),e.n(null)}})}):(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,color:`text.secondary`,children:`Select a conversation to start chatting`})})]}):(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,children:(0,i.jsx)(r.CircularProgress,{})})},lf=({count:e,children:t,max:n=99})=>(0,i.jsx)(r.Badge,{badgeContent:e,color:`error`,max:n,overlap:`rectangular`,sx:{"& .MuiBadge-badge":{right:8,top:`50%`,transform:`translateY(-50%)`}},children:t}),uf=e.w(((t,n)=>{var r=e.x();n.exports=function(){return r.Date.now()}})),df=e.w(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),ff=e.w(((e,t)=>{var n=df(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),pf=e.w(((t,n)=>{var r=ff(),i=e.v(),a=ju(),o=NaN,s=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function d(e){if(typeof e==`number`)return e;if(a(e))return o;if(i(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=i(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=r(e);var n=c.test(e);return n||l.test(e)?u(e.slice(2),n?2:8):s.test(e)?o:+e}n.exports=d})),mf=e.w(((t,n)=>{var r=e.v(),i=uf(),a=pf(),o=`Expected a function`,s=Math.max,c=Math.min;function l(e,t,n){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof e!=`function`)throw TypeError(o);t=a(t)||0,r(n)&&(g=!!n.leading,_=`maxWait`in n,d=_?s(a(n.maxWait)||0,t):d,v=`trailing`in n?!!n.trailing:v);function y(t){var n=l,r=u;return l=u=void 0,h=t,f=e.apply(r,n),f}function b(e){return h=e,p=setTimeout(C,t),g?y(e):f}function x(e){var n=e-m,r=e-h,i=t-n;return _?c(i,d-r):i}function S(e){var n=e-m,r=e-h;return m===void 0||n>=t||n<0||_&&r>=d}function C(){var e=i();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(i())}function D(){var e=i(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,t),y(m)}return p===void 0&&(p=setTimeout(C,t)),f}return D.cancel=T,D.flush=E,D}n.exports=l})),hf=e.T(mf(),1),gf=0,_f=(0,hf.default)(()=>{e.a()&&e.t().catch(t=>e.m.warn(String(t)))},600);function vf(){return(0,n.useEffect)(()=>(gf++,gf===1&&(document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&_f()}),e.a(e=>{e.on(`open`,_f)})),()=>{gf--,gf===0&&(e.a()?.off(`open`,_f),_f.cancel())}),[]),nd(()=>e.d.summaries.toArray().then(e=>e.reduce((e,t)=>e+t.unread_count,0)),[],void 0)}var yf={SUMMARIES:300*1e3,USER:3600*1e3,MESSAGES:1/0},bf=()=>typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches,xf={mode:`dark`,background:{paper:`#3d3d43`,default:`#333338`},text:{primary:`#eee`,secondary:`#aaa`}},Sf={mode:`light`,background:{default:`#f5f5f5`,paper:`#ffff`}},Cf=e=>{let t=bf(),n=(e||(t?`dark`:`light`))===`dark`;return Mr({palette:{...n?xf:Sf,primary:{main:`#E91E63`,light:`#F48FB1`,dark:`#AD1457`,contrastText:`#fff`},secondary:{main:`#e4e6eb`,light:`#f0f2f5`,dark:`#b0b3b8`,contrastText:`rgba(0, 0, 0, 0.87)`},error:{main:`#d32f2f`,light:`#ef5350`,dark:`#c62828`,contrastText:`#fff`},warning:{main:`#ed6c02`,light:`#ff9800`,dark:`#e65100`,contrastText:`#fff`},info:{main:`#0288d1`,light:`#03a9f4`,dark:`#01579b`,contrastText:`#fff`},success:{main:`#2e7d32`,light:`#4caf50`,dark:`#1b5e20`,contrastText:`#fff`}},typography:{fontFamily:[`-apple-system`,`BlinkMacSystemFont`,`"Segoe UI"`,`Roboto`,`"Helvetica Neue"`,`Arial`,`sans-serif`,`"Apple Color Emoji"`,`"Segoe UI Emoji"`,`"Segoe UI Symbol"`].join(`,`),fontSize:14,h1:{fontSize:`2.5rem`,fontWeight:500},h2:{fontSize:`2rem`,fontWeight:500},h3:{fontSize:`1.75rem`,fontWeight:500},h4:{fontSize:`1.5rem`,fontWeight:500},h5:{fontSize:`1.25rem`,fontWeight:500},h6:{fontSize:`1rem`,fontWeight:500},body1:{fontSize:`0.9375rem`,lineHeight:1.4},body2:{fontSize:`0.8125rem`,lineHeight:1.4}},shape:{borderRadius:12},components:{MuiButton:{styleOverrides:{root:{textTransform:`none`,fontWeight:500,borderRadius:20}}},MuiIconButton:{styleOverrides:{root:{borderRadius:`50%`}}},MuiPaper:{styleOverrides:{root:{backgroundImage:`none`},rounded:{borderRadius:12}}},MuiBadge:{styleOverrides:{badge:{fontSize:`0.6875rem`,height:18,minWidth:18,borderRadius:9,fontWeight:600}}},MuiCssBaseline:{styleOverrides:{body:{"*::-webkit-scrollbar":{width:`8px`,height:`8px`},"*::-webkit-scrollbar-track":{background:`undo`,borderRadius:`4px`},"*::-webkit-scrollbar-thumb":{background:`undo`,borderRadius:`4px`,"&:hover":{background:`undo`}},scrollbarWidth:`thin`,scrollbarColor:n?`#6a6a6e #333338`:`#c1c1c1 #f5f5f5`}}}}})},wf=Cf();exports.CACHE_TTL=yf,exports.ChatApp=l,exports.ChatContainer=cf,exports.ChatHeader=id,exports.ChatWindow=af,exports.ConversationItem=gi,exports.ConversationItemSkeleton=_i,exports.ConversationList=rd,exports.CreateGroupDialog=Zu,exports.ErrorBoundary=of,exports.LoadMoreTrigger=md,exports.MessageBubble=dd,exports.MessageInput=nf,exports.MessageList=yd,exports.MessageSkeleton=pd,exports.UnreadBadge=lf,exports.db=e.d,exports.disconnectSDK=e.i,exports.fetchSummaries=e.t,exports.getSDK=e.a,exports.getTheme=Cf,exports.initSDK=e.o,exports.isSDKInitialized=e.s,exports.theme=wf,exports.useMessages=rf,exports.useSenderNames=vd,exports.useUnreadCount=vf,exports.useWebSocket=sf;
50
+ `,$d;function ef(e,t){return new Promise(((n,r)=>{$d||=function(e){let t=[];return typeof e==`function`?t.push(`(${e})()`):t.push(e),URL.createObjectURL(new Blob(t))}(Qd);let i=new Worker($d);i.addEventListener(`message`,(function(e){if(t.signal&&t.signal.aborted)i.terminate();else if(e.data.progress===void 0){if(e.data.error)return r(Error(e.data.error)),void i.terminate();n(e.data.file),i.terminate()}else t.onProgress(e.data.progress)})),i.addEventListener(`error`,r),t.signal&&t.signal.addEventListener(`abort`,(()=>{r(t.signal.reason),i.terminate()})),i.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function $(e,t){return new Promise((function(n,r){let i,a,o,s,c,l;if(i={...t},o=0,{onProgress:s}=i,i.maxSizeMB=i.maxSizeMB||1/0,c=typeof i.useWebWorker!=`boolean`||i.useWebWorker,delete i.useWebWorker,i.onProgress=e=>{o=e,typeof s==`function`&&s(o)},!(e instanceof Blob||e instanceof Pd))return r(Error(`The file given is not an instance of Blob or File`));if(!/^image/.test(e.type))return r(Error(`The file given is not an image`));if(l=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope,!c||typeof Worker!=`function`||l)return Zd(e,i).then(function(e){try{return a=e,f.call(this)}catch(e){return r(e)}}.bind(this),r);var u=function(){try{return f.call(this)}catch(e){return r(e)}}.bind(this),d=function(t){try{return Zd(e,i).then((function(e){try{return a=e,u()}catch(e){return r(e)}}),r)}catch(e){return r(e)}};try{return i.libURL=i.libURL||`https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js`,ef(e,i).then((function(e){try{return a=e,u()}catch{return d()}}),d)}catch{d()}function f(){try{a.name=e.name,a.lastModified=e.lastModified}catch{}try{i.preserveExif&&e.type===`image/jpeg`&&(!i.fileType||i.fileType&&i.fileType===e.type)&&(a=Sd(e,a))}catch{}return n(a)}}))}$.getDataUrlFromFile=Ld,$.getFilefromDataUrl=Id,$.loadImage=Rd,$.drawImageInCanvas=Hd,$.drawFileInCanvas=Wd,$.canvasToFile=Gd,$.getExifOrientation=Jd,$.handleMaxWidthOrHeight=Yd,$.followExifOrientation=Xd,$.cleanupCanvasMemory=Kd,$.isAutoOrientationInBrowser=qd,$.approximateBelowMaximumCanvasSizeOfBrowser=Bd,$.copyExifWithoutOrientation=Sd,$.getBrowserName=zd,$.version=`2.0.2`;async function tf(e,t,n=.85,r=`image/webp`){return $(e,{maxWidthOrHeight:t,fileType:r,initialQuality:n,useWebWorker:!0})}var nf=({onSend:t,sending:a=!1,placeholder:o=`Type a message...`,disabled:s=!1,disableReason:c})=>{let[l,u]=(0,n.useState)(``),[d,f]=(0,n.useState)(null),[p,m]=(0,n.useState)(null),[h,g]=(0,n.useState)(!1),[_,v]=(0,n.useState)(void 0),[y,b]=(0,n.useState)(null),[x,S]=(0,n.useState)(!1),C=(0,n.useRef)(null),w=(0,n.useRef)(null),T=h,E=!a&&!T&&!s&&(!!l.trim()||!!d),D=()=>{E&&(t(l.trim()||``,d?[d]:void 0),u(``),f(null),m(null),g(!1),setTimeout(()=>{C.current?.querySelector(`textarea`)?.focus()},300))},O=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),D())},k=async t=>{let n=e.a();if(n){g(!0),v(void 0);try{let e=await tf(t,1280),r=await tf(e,400,1,`image/jpeg`),i=await n.uploadFile(e,r,e=>v(e));m(URL.createObjectURL(r)),f({id:i.id,ext:i.ext,size:e.size})}catch(e){m(null),f(null),b(e instanceof Error?e.message:`Failed to upload image. Please try again.`)}finally{g(!1),v(void 0)}}};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Snackbar,{open:!!y,autoHideDuration:4e3,onClose:()=>b(null),anchorOrigin:{vertical:`bottom`,horizontal:`center`},children:(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>b(null),children:y})}),(0,i.jsxs)(r.Box,{borderTop:1,borderColor:`divider`,children:[h&&(0,i.jsx)(r.LinearProgress,{variant:_===void 0?`indeterminate`:`determinate`,value:_,sx:{height:2}}),p&&(0,i.jsxs)(r.Box,{display:`flex`,alignItems:`center`,px:2,pt:1.5,gap:1,children:[(0,i.jsxs)(r.Box,{position:`relative`,display:`inline-flex`,children:[(0,i.jsx)(r.Box,{component:`img`,src:p,alt:`preview`,sx:{height:64,width:64,objectFit:`cover`,borderRadius:1,opacity:T?.5:1}}),!T&&(0,i.jsx)(r.IconButton,{size:`small`,onClick:()=>{p&&URL.revokeObjectURL(p),m(null),f(null),g(!1)},sx:{position:`absolute`,top:-8,right:-8,bgcolor:`background.paper`,border:1,borderColor:`divider`,p:.25,"&:hover":{bgcolor:`error.light`}},children:(0,i.jsx)(Qr,{sx:{fontSize:14}})})]}),T&&(0,i.jsx)(r.Chip,{label:`Uploading…`,size:`small`,variant:`outlined`})]}),(0,i.jsxs)(r.Box,{display:`flex`,gap:1,p:2,alignItems:`flex-end`,children:[(0,i.jsx)(`input`,{ref:w,type:`file`,accept:`image/*`,style:{display:`none`},onChange:async e=>{let t=e.target.files?.[0];t&&(e.target.value=``,await k(t))}}),(0,i.jsx)(r.Tooltip,{title:`Attach image`,children:(0,i.jsx)(`span`,{children:(0,i.jsx)(r.IconButton,{onClick:()=>w.current?.click(),disabled:s||T||!!d,size:`medium`,children:(0,i.jsx)(qr,{})})})}),(0,i.jsx)(r.Tooltip,{title:`Take photo`,children:(0,i.jsx)(`span`,{children:(0,i.jsx)(r.IconButton,{onClick:()=>S(!0),disabled:s||T||!!d,size:`medium`,children:(0,i.jsx)(Yr,{})})})}),(0,i.jsx)(bd,{open:x,onCapture:e=>k(e),onClose:()=>S(!1)}),(0,i.jsx)(r.TextField,{ref:C,fullWidth:!0,multiline:!0,maxRows:4,value:l,onChange:e=>u(e.target.value),onKeyDown:O,placeholder:s&&c?c:o,disabled:s||a,variant:`outlined`,size:`small`}),(0,i.jsx)(r.IconButton,{color:`primary`,onClick:D,disabled:!E,size:`large`,children:a?(0,i.jsx)(r.CircularProgress,{size:24}):(0,i.jsx)(di,{})})]})]})]})};function rf({conversation:t,limit:r=50}){let i=e.p(t),[a,o]=(0,n.useState)(!1),[s,c]=(0,n.useState)(!1),[l,u]=(0,n.useState)(),d=nd(()=>e.d.messages.where(`conversationId`).equals(i).sortBy(`created_at`),[i])||[],f=nd(()=>e.d.msgCursor.where(`id`).equals(i).first(),[i]);return gd(async()=>{let n={limit:r};d.length&&(n.cursorType=`after`,n.cursorDatetime=d[d.length-1]?.created_at),o(!0),await e.c(t,n).catch(u),o(!1),await e.d.summaries.update(i,{unread_count:0})},[t,r]),e.x.debug(`mw`,d.length),{messages:d,cursor:f,loading:a,error:l,loadMore:(0,n.useCallback)(async()=>{if(!(!f||s||a)){c(!0);try{let n={limit:r};if(!f?.datetime)return;n.cursorType=`before`,n.cursorDatetime=f.datetime,await e.c(t,n)}catch(t){e.x.error(`[useMessages] Failed to load more:`,t)}c(!1)}},[f,r,t,s,a]),loadingMore:s}}var af=({conversation:t,user:a,isConnected:s,onBack:c})=>{let l=e.a();if(!l)return null;let{messages:u,cursor:d,loading:f,error:p,loadMore:m,loadingMore:h}=rf({conversation:t}),g=nd(async()=>t.type===`group`?await e.d.groups.get(t.id):null,[t.id,t.type]),_=a?.role===`admin`,v=a?.role===`moderator`,y=g?.is_member??!0,b=g?.system??!1,x=_&&t.type===`group`&&!y,S=t.type===`group`&&!y,C=t.type===`group`&&(_||y),w=t.type===`group`&&!b&&(_||v&&y),T=_&&t.type===`group`&&!b,[E,D]=(0,n.useState)(!1),[O,k]=(0,n.useState)(!1),[A,j]=(0,n.useState)(``),[M,N]=(0,n.useState)(!1),[ee,P]=(0,n.useState)(null),F=()=>{j(t.name||``),P(null),k(!0)},I=async()=>{if(A.trim()){N(!0),P(null);try{await $u(a.org,t.id,A.trim()),k(!1)}catch(e){P(o(e,`Failed to rename group`))}finally{N(!1)}}},[L,te]=(0,n.useState)(!1),[ne,R]=(0,n.useState)(!1),[re,ie]=(0,n.useState)(null),z=async()=>{te(!1),R(!0),ie(null);try{await ed(a.org,t.id)}catch(e){ie(o(e,`Failed to delete group`)),R(!1)}},[ae,oe]=(0,n.useState)(!1),[se,ce]=(0,n.useState)(!1),B=async n=>{if(t.type===`group`){oe(!0);try{await l.joinGroup(a.org,t.id,n),ce(!0),await Qu(a.org),await e.t({}),setTimeout(()=>ce(!1),3e3)}catch(e){fe(o(e,`Failed to join group`))}oe(!1)}},[le,ue]=(0,n.useState)(!1),[de,fe]=(0,n.useState)(null),[pe,me]=(0,n.useState)(!1);return(0,i.jsxs)(r.Box,{display:`flex`,flexDirection:`column`,height:`100%`,children:[(0,i.jsx)(id,{displayName:t.name||`Chat`,type:t.type,isConnected:s,onBack:c,showJoinButton:x,onJoin:B,joining:ae,showMembersButton:C,onManageMembers:()=>D(!0),canManageGroup:T,onRenameGroup:F,onDeleteGroup:()=>te(!0),deletingGroup:ne}),C&&(0,i.jsx)(sd,{open:E,onClose:()=>D(!1),orgId:a.org,groupId:t.id,currentUserId:a.id,canManage:w}),(0,i.jsxs)(r.Dialog,{open:O,onClose:()=>k(!1),fullWidth:!0,maxWidth:`xs`,children:[(0,i.jsx)(r.DialogTitle,{children:`Rename Group`}),(0,i.jsx)(r.DialogContent,{children:(0,i.jsx)(r.TextField,{autoFocus:!0,fullWidth:!0,label:`Group name`,value:A,onChange:e=>j(e.target.value),onKeyDown:e=>e.key===`Enter`&&I(),error:!!ee,helperText:ee?.message,sx:{mt:1}})}),(0,i.jsxs)(r.DialogActions,{children:[(0,i.jsx)(r.Button,{onClick:()=>k(!1),children:`Cancel`}),(0,i.jsx)(r.Button,{onClick:I,disabled:M||!A.trim(),variant:`contained`,children:M?`Renaming...`:`Rename`})]})]}),(0,i.jsxs)(r.Dialog,{open:L,onClose:()=>te(!1),maxWidth:`xs`,fullWidth:!0,children:[(0,i.jsx)(r.DialogTitle,{children:`Delete Group`}),(0,i.jsx)(r.DialogContent,{children:`Are you sure you want to delete this group? This action cannot be undone.`}),(0,i.jsxs)(r.DialogActions,{children:[(0,i.jsx)(r.Button,{onClick:()=>te(!1),children:`Cancel`}),(0,i.jsx)(r.Button,{onClick:z,disabled:ne,color:`error`,variant:`contained`,children:ne?`Deleting...`:`Delete`})]})]}),re&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>ie(null),children:re.message}),(0,i.jsx)(r.Snackbar,{open:se,autoHideDuration:3e3,onClose:()=>ce(!1),message:`Successfully joined group`}),de&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>fe(null),children:de.message}),(0,i.jsx)(yd,{messages:u,currentUserId:a?.id||0,loading:f,error:p,autoScroll:!0,hasMore:!!d?.datetime,loadingMore:h,onLoadMore:m,forceScrollToBottom:pe}),S?(0,i.jsx)(r.Alert,{severity:`warning`,sx:{m:2},children:`You must be a group member to send messages`}):(0,i.jsx)(nf,{onSend:async(n,r)=>{if(!n.trim()&&!r?.length)return;ue(!0),fe(null),me(!0);let i=`temp-${Date.now()}-${Math.random()}`,s={id:i,sender:a?.id,receiver:t.type===`dm`?t.id:null,group:t.type===`group`?t.id:null,content:n||null,media:null,created_at:new Date().toISOString(),conversationId:e.p(t)};try{await e.d.messages.put(s);let a=await(t.type===`group`?l.sendGroupMessage:l.sendDM).bind(l)(t.id,n||void 0,r);await e.d.messages.delete(i),await e.d.messages.put({...a,conversationId:e.p(t)})}catch(e){fe(o(e,`Failed to send message`))}ue(!1),setTimeout(()=>me(!1),100)},sending:le,disabled:!s,disableReason:s?void 0:`You're offline. You need to be online to send messages`})]})},of=class extends n.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(t,n){e.x.error(`ErrorBoundary caught an error:`,t,n),this.props.onError?.(t,n)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,i.jsxs)(r.Box,{display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,height:`100%`,p:3,children:[(0,i.jsxs)(r.Alert,{severity:`error`,sx:{mb:2,maxWidth:500},children:[(0,i.jsx)(r.Typography,{variant:`h6`,gutterBottom:!0,children:`Something went wrong`}),(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,children:this.state.error?.message||`An unexpected error occurred`})]}),(0,i.jsx)(r.Button,{variant:`contained`,startIcon:(0,i.jsx)(li,{}),onClick:this.handleReset,children:`Try Again`})]}):this.props.children}};function sf({onMessage:t,onConnect:r,onDisconnect:i,onError:a}={}){let[o,s]=(0,n.useState)(!1),c=(0,n.useCallback)(e=>{t?.(e)},[t]),l=(0,n.useCallback)(()=>{s(!0),r?.()},[r]),u=(0,n.useCallback)(()=>{s(!1),i?.()},[i]),d=(0,n.useCallback)(e=>{a?.(e)},[a]);return(0,n.useEffect)(()=>{if(e.s())try{let t=e.a();return t?(s(t.isConnected()),t.on(`message`,c),t.on(`open`,l),t.on(`close`,u),t.on(`error`,d),()=>{t.off(`message`,c),t.off(`open`,l),t.off(`close`,u),t.off(`error`,d)}):void 0}catch(t){e.x.error(`Failed to setup WebSocket listeners:`,t)}},[c,l,u,d]),{isConnected:o}}var cf=({initialConversation:t})=>{let[a,o]=(0,n.useState)(t??null),[s,c]=(0,n.useState)(),[l,u]=(0,n.useState)(!0),[d,f]=(0,n.useState)(()=>e.a()),p=(0,n.useCallback)(e=>()=>u(e),[]);return(0,n.useEffect)(()=>{d||e.a(f)},[d]),gd(async()=>{if(!d)return;let t=await d.getMe();c(t),e.d.users.put(t)},[d]),sf({onError:p(!1),onConnect:p(!0),onDisconnect:p(!1)}),d?(0,i.jsxs)(r.Box,{display:`flex`,height:`100%`,overflow:`hidden`,children:[(0,i.jsx)(r.Box,{sx:{width:{xs:`100%`,sm:`100%`,md:`320px`},flexShrink:0,border:`0px solid`,borderRightWidth:{xs:0,md:1},borderColor:`divider`,overflow:`hidden`,display:{xs:a?`none`:`flex`,sm:a?`none`:`flex`,md:`flex`},flexDirection:`column`},children:(0,i.jsx)(of,{children:(0,i.jsx)(rd,{currentUser:s,selectedConversation:a,onConversationSelect:t=>{o(t),e.n(e.p(t))}})})}),(0,i.jsx)(r.Box,{sx:{flex:1,overflow:`hidden`,display:{xs:a?`flex`:`none`,sm:a?`flex`:`none`,md:`flex`},flexDirection:`column`},children:a?(0,i.jsx)(of,{children:(0,i.jsx)(af,{conversation:a,user:s,isConnected:l,onBack:()=>{o(null),e.n(null)}})}):(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,color:`text.secondary`,children:`Select a conversation to start chatting`})})]}):(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,children:(0,i.jsx)(r.CircularProgress,{})})},lf=({count:e,children:t,max:n=99})=>(0,i.jsx)(r.Badge,{badgeContent:e,color:`error`,max:n,overlap:`rectangular`,sx:{"& .MuiBadge-badge":{right:8,top:`50%`,transform:`translateY(-50%)`}},children:t}),uf=e.w(((t,n)=>{var r=e.b();n.exports=function(){return r.Date.now()}})),df=e.w(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),ff=e.w(((e,t)=>{var n=df(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),pf=e.w(((t,n)=>{var r=ff(),i=e._(),a=ju(),o=NaN,s=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function d(e){if(typeof e==`number`)return e;if(a(e))return o;if(i(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=i(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=r(e);var n=c.test(e);return n||l.test(e)?u(e.slice(2),n?2:8):s.test(e)?o:+e}n.exports=d})),mf=e.w(((t,n)=>{var r=e._(),i=uf(),a=pf(),o=`Expected a function`,s=Math.max,c=Math.min;function l(e,t,n){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof e!=`function`)throw TypeError(o);t=a(t)||0,r(n)&&(g=!!n.leading,_=`maxWait`in n,d=_?s(a(n.maxWait)||0,t):d,v=`trailing`in n?!!n.trailing:v);function y(t){var n=l,r=u;return l=u=void 0,h=t,f=e.apply(r,n),f}function b(e){return h=e,p=setTimeout(C,t),g?y(e):f}function x(e){var n=e-m,r=e-h,i=t-n;return _?c(i,d-r):i}function S(e){var n=e-m,r=e-h;return m===void 0||n>=t||n<0||_&&r>=d}function C(){var e=i();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(i())}function D(){var e=i(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,t),y(m)}return p===void 0&&(p=setTimeout(C,t)),f}return D.cancel=T,D.flush=E,D}n.exports=l})),hf=e.T(mf(),1),gf=0,_f=(0,hf.default)(()=>{e.a()&&e.t().catch(t=>e.x.warn(String(t)))},600);function vf(){return(0,n.useEffect)(()=>(gf++,gf===1&&(document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&_f()}),e.a(e=>{e.on(`open`,_f)})),()=>{gf--,gf===0&&(e.a()?.off(`open`,_f),_f.cancel())}),[]),nd(()=>e.d.summaries.toArray().then(e=>e.reduce((e,t)=>e+t.unread_count,0)),[],void 0)}var yf={SUMMARIES:300*1e3,USER:3600*1e3,MESSAGES:1/0},bf=()=>typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches,xf={mode:`dark`,background:{paper:`#3d3d43`,default:`#333338`},text:{primary:`#eee`,secondary:`#aaa`}},Sf={mode:`light`,background:{default:`#f5f5f5`,paper:`#ffff`}},Cf=e=>{let t=bf(),n=(e||(t?`dark`:`light`))===`dark`;return Mr({palette:{...n?xf:Sf,primary:{main:`#E91E63`,light:`#F48FB1`,dark:`#AD1457`,contrastText:`#fff`},secondary:{main:`#e4e6eb`,light:`#f0f2f5`,dark:`#b0b3b8`,contrastText:`rgba(0, 0, 0, 0.87)`},error:{main:`#d32f2f`,light:`#ef5350`,dark:`#c62828`,contrastText:`#fff`},warning:{main:`#ed6c02`,light:`#ff9800`,dark:`#e65100`,contrastText:`#fff`},info:{main:`#0288d1`,light:`#03a9f4`,dark:`#01579b`,contrastText:`#fff`},success:{main:`#2e7d32`,light:`#4caf50`,dark:`#1b5e20`,contrastText:`#fff`}},typography:{fontFamily:[`-apple-system`,`BlinkMacSystemFont`,`"Segoe UI"`,`Roboto`,`"Helvetica Neue"`,`Arial`,`sans-serif`,`"Apple Color Emoji"`,`"Segoe UI Emoji"`,`"Segoe UI Symbol"`].join(`,`),fontSize:14,h1:{fontSize:`2.5rem`,fontWeight:500},h2:{fontSize:`2rem`,fontWeight:500},h3:{fontSize:`1.75rem`,fontWeight:500},h4:{fontSize:`1.5rem`,fontWeight:500},h5:{fontSize:`1.25rem`,fontWeight:500},h6:{fontSize:`1rem`,fontWeight:500},body1:{fontSize:`0.9375rem`,lineHeight:1.4},body2:{fontSize:`0.8125rem`,lineHeight:1.4}},shape:{borderRadius:12},components:{MuiButton:{styleOverrides:{root:{textTransform:`none`,fontWeight:500,borderRadius:20}}},MuiIconButton:{styleOverrides:{root:{borderRadius:`50%`}}},MuiPaper:{styleOverrides:{root:{backgroundImage:`none`},rounded:{borderRadius:12}}},MuiBadge:{styleOverrides:{badge:{fontSize:`0.6875rem`,height:18,minWidth:18,borderRadius:9,fontWeight:600}}},MuiCssBaseline:{styleOverrides:{body:{"*::-webkit-scrollbar":{width:`8px`,height:`8px`},"*::-webkit-scrollbar-track":{background:`undo`,borderRadius:`4px`},"*::-webkit-scrollbar-thumb":{background:`undo`,borderRadius:`4px`,"&:hover":{background:`undo`}},scrollbarWidth:`thin`,scrollbarColor:n?`#6a6a6e #333338`:`#c1c1c1 #f5f5f5`}}}}})},wf=Cf();exports.CACHE_TTL=yf,exports.ChatApp=l,exports.ChatContainer=cf,exports.ChatHeader=id,exports.ChatWindow=af,exports.ConversationItem=gi,exports.ConversationItemSkeleton=_i,exports.ConversationList=rd,exports.CreateGroupDialog=Zu,exports.ErrorBoundary=of,exports.LoadMoreTrigger=md,exports.MessageBubble=dd,exports.MessageInput=nf,exports.MessageList=yd,exports.MessageSkeleton=pd,exports.UnreadBadge=lf,exports.db=e.d,exports.disconnectSDK=e.i,exports.fetchSummaries=e.t,exports.getSDK=e.a,exports.getTheme=Cf,exports.initSDK=e.o,exports.isSDKInitialized=e.s,exports.theme=wf,exports.useMessages=rf,exports.useSenderNames=vd,exports.useUnreadCount=vf,exports.useWebSocket=sf;