spry-apps-dropdown 3.0.1 → 3.0.3
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/README.md +275 -276
- package/dist/index.cjs +15 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1349 -1332
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("react/jsx-runtime"),T=require("react"),$=require("@mui/material"),sr=require("framer-motion"),Pn=require("@emotion/styled");require("@emotion/react");const Lt=require("@mui/icons-material"),Ge=require("oidc-client-ts");function Nn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Ae=Nn(T);function Vr({apps:e,open:t,onClose:r,buttonRef:n,isLoading:o=!1,error:i=null,onRetry:s,excludeAppId:l}){const f=T.useRef(null),[u,h]=T.useState("64px"),d=()=>{const S=window.location.origin;return e.find(c=>c.url.startsWith(S))?.id},m=e.filter(S=>{if(l&&S.id===l)return!1;const c=d();return!(c&&S.id===c)});T.useLayoutEffect(()=>{if(t&&n?.current){const S=n.current.getBoundingClientRect();h(`${S.bottom+8}px`)}},[t,n]),T.useEffect(()=>{const S=c=>{f.current&&!f.current.contains(c.target)&&n?.current&&!n.current.contains(c.target)&&r()};return t&&document.addEventListener("mousedown",S),()=>{document.removeEventListener("mousedown",S)}},[t,r,n]);const E=S=>{window.open(S,"_blank"),r()};return w.jsx(sr.AnimatePresence,{children:t&&w.jsx(sr.motion.div,{ref:f,initial:{opacity:0,scaleX:.6,scaleY:.6,y:-8},animate:{opacity:1,scaleX:1,scaleY:1,y:0},exit:{opacity:0,scaleX:.6,scaleY:.6,y:-8},transition:{duration:.18,ease:"easeOut"},style:{position:"absolute",top:u,right:"16px",zIndex:1e3,transformOrigin:"top right"},children:w.jsxs($.Box,{sx:{bgcolor:"#E8F0FE",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)",p:2,width:"320px",minHeight:"100px"},onClick:S=>S.stopPropagation(),children:[o&&m.length===0&&w.jsx($.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100px"},children:w.jsx($.CircularProgress,{size:32})}),i&&m.length===0&&w.jsxs($.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100px",gap:1},children:[w.jsx($.Typography,{sx:{fontSize:"0.875rem",color:"#ea4335",textAlign:"center"},children:"Failed to load apps"}),s&&w.jsx($.Link,{component:"button",onClick:s,sx:{fontSize:"0.875rem",color:"#1a73e8",cursor:"pointer",textDecoration:"underline"},children:"Retry"})]}),m.length>0&&w.jsx($.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:1},children:m.map(S=>w.jsxs($.Link,{onClick:()=>E(S.url),sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100px",p:1.5,borderRadius:"12px",cursor:"pointer",textDecoration:"none",transition:"background-color 200ms","&:hover":{bgcolor:"#f1f3f4"}},title:S.description,children:[w.jsx($.Box,{sx:{pb:1},children:S.iconUrl?w.jsx($.Box,{component:"img",src:S.iconUrl,alt:S.name,sx:{width:"32px",height:"32px",objectFit:"contain"}}):w.jsx($.Box,{sx:{width:"32px",height:"32px",borderRadius:"6px",bgcolor:S.color||"#4285f4",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.5rem"},children:S.name.charAt(0)})}),w.jsx($.Typography,{sx:{fontSize:"0.75rem",fontWeight:500,color:"#202124",textAlign:"center",lineHeight:1.2},children:S.name})]},S.id))})]})})})}const xt="spry_apps_cache",Un=300*1e3,Dn=300*1e3;function Wr(e,t={}){const{refetchInterval:r=Un,cacheTime:n=Dn}=t,[o,i]=T.useState([]),[s,l]=T.useState(!0),[f,u]=T.useState(null),h=T.useRef(null),d=T.useRef(null),m=T.useCallback(()=>{try{const c=localStorage.getItem(xt);if(!c)return null;const v=JSON.parse(c);return Date.now()-v.timestamp<n?v.apps:(localStorage.removeItem(xt),null)}catch(c){return console.error("Error loading from cache:",c),null}},[n]),E=T.useCallback(c=>{try{const v={apps:c,timestamp:Date.now()};localStorage.setItem(xt,JSON.stringify(v))}catch(v){console.error("Error saving to cache:",v)}},[]),S=T.useCallback(async()=>{d.current&&d.current.abort(),d.current=new AbortController;try{l(!0),u(null);const c=await fetch(`${e}/api/apps`,{signal:d.current.signal,headers:{Accept:"application/json"}});if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);const v=await c.json();i(v.apps),E(v.apps),u(null)}catch(c){if(c instanceof Error&&c.name==="AbortError")return;const v=c instanceof Error?c.message:"Failed to fetch apps";u(v),console.error("Error fetching apps:",c);const C=m();C&&i(C)}finally{l(!1)}},[e,m,E]);return T.useEffect(()=>{const c=m();return c&&(i(c),l(!1)),S(),r>0&&(h.current=window.setInterval(()=>{S()},r)),()=>{h.current&&window.clearInterval(h.current),d.current&&d.current.abort()}},[e,r,n]),{apps:o,isLoading:s,error:f,refetch:S}}function Mn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qe={exports:{}},H={};var ar;function jn(){if(ar)return H;ar=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),s=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),m=Symbol.for("react.view_transition"),E=Symbol.for("react.client.reference");function S(c){if(typeof c=="object"&&c!==null){var v=c.$$typeof;switch(v){case e:switch(c=c.type,c){case r:case o:case n:case f:case u:case m:return c;default:switch(c=c&&c.$$typeof,c){case s:case l:case d:case h:return c;case i:return c;default:return v}}case t:return v}}}return H.ContextConsumer=i,H.ContextProvider=s,H.Element=e,H.ForwardRef=l,H.Fragment=r,H.Lazy=d,H.Memo=h,H.Portal=t,H.Profiler=o,H.StrictMode=n,H.Suspense=f,H.SuspenseList=u,H.isContextConsumer=function(c){return S(c)===i},H.isContextProvider=function(c){return S(c)===s},H.isElement=function(c){return typeof c=="object"&&c!==null&&c.$$typeof===e},H.isForwardRef=function(c){return S(c)===l},H.isFragment=function(c){return S(c)===r},H.isLazy=function(c){return S(c)===d},H.isMemo=function(c){return S(c)===h},H.isPortal=function(c){return S(c)===t},H.isProfiler=function(c){return S(c)===o},H.isStrictMode=function(c){return S(c)===n},H.isSuspense=function(c){return S(c)===f},H.isSuspenseList=function(c){return S(c)===u},H.isValidElementType=function(c){return typeof c=="string"||typeof c=="function"||c===r||c===o||c===n||c===f||c===u||typeof c=="object"&&c!==null&&(c.$$typeof===d||c.$$typeof===h||c.$$typeof===s||c.$$typeof===i||c.$$typeof===l||c.$$typeof===E||c.getModuleId!==void 0)},H.typeOf=S,H}var J={};var cr;function Ln(){return cr||(cr=1,process.env.NODE_ENV!=="production"&&(function(){function e(c){if(typeof c=="object"&&c!==null){var v=c.$$typeof;switch(v){case t:switch(c=c.type,c){case n:case i:case o:case u:case h:case E:return c;default:switch(c=c&&c.$$typeof,c){case l:case f:case m:case d:return c;case s:return c;default:return v}}case r:return v}}}var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),l=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),E=Symbol.for("react.view_transition"),S=Symbol.for("react.client.reference");J.ContextConsumer=s,J.ContextProvider=l,J.Element=t,J.ForwardRef=f,J.Fragment=n,J.Lazy=m,J.Memo=d,J.Portal=r,J.Profiler=i,J.StrictMode=o,J.Suspense=u,J.SuspenseList=h,J.isContextConsumer=function(c){return e(c)===s},J.isContextProvider=function(c){return e(c)===l},J.isElement=function(c){return typeof c=="object"&&c!==null&&c.$$typeof===t},J.isForwardRef=function(c){return e(c)===f},J.isFragment=function(c){return e(c)===n},J.isLazy=function(c){return e(c)===m},J.isMemo=function(c){return e(c)===d},J.isPortal=function(c){return e(c)===r},J.isProfiler=function(c){return e(c)===i},J.isStrictMode=function(c){return e(c)===o},J.isSuspense=function(c){return e(c)===u},J.isSuspenseList=function(c){return e(c)===h},J.isValidElementType=function(c){return typeof c=="string"||typeof c=="function"||c===n||c===i||c===o||c===u||c===h||typeof c=="object"&&c!==null&&(c.$$typeof===m||c.$$typeof===d||c.$$typeof===l||c.$$typeof===s||c.$$typeof===f||c.$$typeof===S||c.getModuleId!==void 0)},J.typeOf=e})()),J}var lr;function Bn(){return lr||(lr=1,process.env.NODE_ENV==="production"?Qe.exports=jn():Qe.exports=Ln()),Qe.exports}var st=Bn();function be(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Gr(e){if(Ae.isValidElement(e)||st.isValidElementType(e)||!be(e))return e;const t={};return Object.keys(e).forEach(r=>{t[r]=Gr(e[r])}),t}function ue(e,t,r={clone:!0}){const n=r.clone?{...e}:e;return be(e)&&be(t)&&Object.keys(t).forEach(o=>{Ae.isValidElement(t[o])||st.isValidElementType(t[o])?n[o]=t[o]:be(t[o])&&Object.prototype.hasOwnProperty.call(e,o)&&be(e[o])?n[o]=ue(e[o],t[o],r):r.clone?n[o]=be(t[o])?Gr(t[o]):t[o]:n[o]=t[o]}),n}var Ze={exports:{}},et={exports:{}},Y={};var ur;function Fn(){if(ur)return Y;ur=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,h=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,E=e?Symbol.for("react.memo"):60115,S=e?Symbol.for("react.lazy"):60116,c=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function y(p){if(typeof p=="object"&&p!==null){var R=p.$$typeof;switch(R){case t:switch(p=p.type,p){case f:case u:case n:case i:case o:case d:return p;default:switch(p=p&&p.$$typeof,p){case l:case h:case S:case E:case s:return p;default:return R}}case r:return R}}}function g(p){return y(p)===u}return Y.AsyncMode=f,Y.ConcurrentMode=u,Y.ContextConsumer=l,Y.ContextProvider=s,Y.Element=t,Y.ForwardRef=h,Y.Fragment=n,Y.Lazy=S,Y.Memo=E,Y.Portal=r,Y.Profiler=i,Y.StrictMode=o,Y.Suspense=d,Y.isAsyncMode=function(p){return g(p)||y(p)===f},Y.isConcurrentMode=g,Y.isContextConsumer=function(p){return y(p)===l},Y.isContextProvider=function(p){return y(p)===s},Y.isElement=function(p){return typeof p=="object"&&p!==null&&p.$$typeof===t},Y.isForwardRef=function(p){return y(p)===h},Y.isFragment=function(p){return y(p)===n},Y.isLazy=function(p){return y(p)===S},Y.isMemo=function(p){return y(p)===E},Y.isPortal=function(p){return y(p)===r},Y.isProfiler=function(p){return y(p)===i},Y.isStrictMode=function(p){return y(p)===o},Y.isSuspense=function(p){return y(p)===d},Y.isValidElementType=function(p){return typeof p=="string"||typeof p=="function"||p===n||p===u||p===i||p===o||p===d||p===m||typeof p=="object"&&p!==null&&(p.$$typeof===S||p.$$typeof===E||p.$$typeof===s||p.$$typeof===l||p.$$typeof===h||p.$$typeof===v||p.$$typeof===C||p.$$typeof===x||p.$$typeof===c)},Y.typeOf=y,Y}var K={};var fr;function zn(){return fr||(fr=1,process.env.NODE_ENV!=="production"&&(function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,h=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,E=e?Symbol.for("react.memo"):60115,S=e?Symbol.for("react.lazy"):60116,c=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function y(_){return typeof _=="string"||typeof _=="function"||_===n||_===u||_===i||_===o||_===d||_===m||typeof _=="object"&&_!==null&&(_.$$typeof===S||_.$$typeof===E||_.$$typeof===s||_.$$typeof===l||_.$$typeof===h||_.$$typeof===v||_.$$typeof===C||_.$$typeof===x||_.$$typeof===c)}function g(_){if(typeof _=="object"&&_!==null){var he=_.$$typeof;switch(he){case t:var Xe=_.type;switch(Xe){case f:case u:case n:case i:case o:case d:return Xe;default:var ir=Xe&&Xe.$$typeof;switch(ir){case l:case h:case S:case E:case s:return ir;default:return he}}case r:return he}}}var p=f,R=u,U=l,V=s,k=t,a=h,I=n,G=S,W=E,se=r,oe=i,ae=o,ge=d,Je=!1;function Ct(_){return Je||(Je=!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.")),A(_)||g(_)===f}function A(_){return g(_)===u}function O(_){return g(_)===l}function j(_){return g(_)===s}function D(_){return typeof _=="object"&&_!==null&&_.$$typeof===t}function P(_){return g(_)===h}function L(_){return g(_)===n}function N(_){return g(_)===S}function M(_){return g(_)===E}function B(_){return g(_)===r}function q(_){return g(_)===i}function F(_){return g(_)===o}function ie(_){return g(_)===d}K.AsyncMode=p,K.ConcurrentMode=R,K.ContextConsumer=U,K.ContextProvider=V,K.Element=k,K.ForwardRef=a,K.Fragment=I,K.Lazy=G,K.Memo=W,K.Portal=se,K.Profiler=oe,K.StrictMode=ae,K.Suspense=ge,K.isAsyncMode=Ct,K.isConcurrentMode=A,K.isContextConsumer=O,K.isContextProvider=j,K.isElement=D,K.isForwardRef=P,K.isFragment=L,K.isLazy=N,K.isMemo=M,K.isPortal=B,K.isProfiler=q,K.isStrictMode=F,K.isSuspense=ie,K.isValidElementType=y,K.typeOf=g})()),K}var dr;function Yr(){return dr||(dr=1,process.env.NODE_ENV==="production"?et.exports=Fn():et.exports=zn()),et.exports}var Tt,pr;function Vn(){if(pr)return Tt;pr=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function n(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},l=0;l<10;l++)s["_"+String.fromCharCode(l)]=l;var f=Object.getOwnPropertyNames(s).map(function(h){return s[h]});if(f.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(h){u[h]=h}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Tt=o()?Object.assign:function(i,s){for(var l,f=n(i),u,h=1;h<arguments.length;h++){l=Object(arguments[h]);for(var d in l)t.call(l,d)&&(f[d]=l[d]);if(e){u=e(l);for(var m=0;m<u.length;m++)r.call(l,u[m])&&(f[u[m]]=l[u[m]])}}return f},Tt}var _t,mr;function Yt(){if(mr)return _t;mr=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return _t=e,_t}var Rt,gr;function Kr(){return gr||(gr=1,Rt=Function.call.bind(Object.prototype.hasOwnProperty)),Rt}var Ot,hr;function Wn(){if(hr)return Ot;hr=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Yt(),r={},n=Kr();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function o(i,s,l,f,u){if(process.env.NODE_ENV!=="production"){for(var h in i)if(n(i,h)){var d;try{if(typeof i[h]!="function"){var m=Error((f||"React class")+": "+l+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}d=i[h](s,h,f,l,null,t)}catch(S){d=S}if(d&&!(d instanceof Error)&&e((f||"React class")+": type specification of "+l+" `"+h+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in r)){r[d.message]=!0;var E=u?u():"";e("Failed "+l+" type: "+d.message+(E??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(r={})},Ot=o,Ot}var It,yr;function Gn(){if(yr)return It;yr=1;var e=Yr(),t=Vn(),r=Yt(),n=Kr(),o=Wn(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(l){var f="Warning: "+l;typeof console<"u"&&console.error(f);try{throw new Error(f)}catch{}});function s(){return null}return It=function(l,f){var u=typeof Symbol=="function"&&Symbol.iterator,h="@@iterator";function d(A){var O=A&&(u&&A[u]||A[h]);if(typeof O=="function")return O}var m="<<anonymous>>",E={array:C("array"),bigint:C("bigint"),bool:C("boolean"),func:C("function"),number:C("number"),object:C("object"),string:C("string"),symbol:C("symbol"),any:x(),arrayOf:y,element:g(),elementType:p(),instanceOf:R,node:a(),objectOf:V,oneOf:U,oneOfType:k,shape:G,exact:W};function S(A,O){return A===O?A!==0||1/A===1/O:A!==A&&O!==O}function c(A,O){this.message=A,this.data=O&&typeof O=="object"?O:{},this.stack=""}c.prototype=Error.prototype;function v(A){if(process.env.NODE_ENV!=="production")var O={},j=0;function D(L,N,M,B,q,F,ie){if(B=B||m,F=F||M,ie!==r){if(f){var _=new 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 _.name="Invariant Violation",_}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var he=B+":"+M;!O[he]&&j<3&&(i("You are manually calling a React.PropTypes validation function for the `"+F+"` prop on `"+B+"`. 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."),O[he]=!0,j++)}}return N[M]==null?L?N[M]===null?new c("The "+q+" `"+F+"` is marked as required "+("in `"+B+"`, but its value is `null`.")):new c("The "+q+" `"+F+"` is marked as required in "+("`"+B+"`, but its value is `undefined`.")):null:A(N,M,B,q,F)}var P=D.bind(null,!1);return P.isRequired=D.bind(null,!0),P}function C(A){function O(j,D,P,L,N,M){var B=j[D],q=ae(B);if(q!==A){var F=ge(B);return new c("Invalid "+L+" `"+N+"` of type "+("`"+F+"` supplied to `"+P+"`, expected ")+("`"+A+"`."),{expectedType:A})}return null}return v(O)}function x(){return v(s)}function y(A){function O(j,D,P,L,N){if(typeof A!="function")return new c("Property `"+N+"` of component `"+P+"` has invalid PropType notation inside arrayOf.");var M=j[D];if(!Array.isArray(M)){var B=ae(M);return new c("Invalid "+L+" `"+N+"` of type "+("`"+B+"` supplied to `"+P+"`, expected an array."))}for(var q=0;q<M.length;q++){var F=A(M,q,P,L,N+"["+q+"]",r);if(F instanceof Error)return F}return null}return v(O)}function g(){function A(O,j,D,P,L){var N=O[j];if(!l(N)){var M=ae(N);return new c("Invalid "+P+" `"+L+"` of type "+("`"+M+"` supplied to `"+D+"`, expected a single ReactElement."))}return null}return v(A)}function p(){function A(O,j,D,P,L){var N=O[j];if(!e.isValidElementType(N)){var M=ae(N);return new c("Invalid "+P+" `"+L+"` of type "+("`"+M+"` supplied to `"+D+"`, expected a single ReactElement type."))}return null}return v(A)}function R(A){function O(j,D,P,L,N){if(!(j[D]instanceof A)){var M=A.name||m,B=Ct(j[D]);return new c("Invalid "+L+" `"+N+"` of type "+("`"+B+"` supplied to `"+P+"`, expected ")+("instance of `"+M+"`."))}return null}return v(O)}function U(A){if(!Array.isArray(A))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("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])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function O(j,D,P,L,N){for(var M=j[D],B=0;B<A.length;B++)if(S(M,A[B]))return null;var q=JSON.stringify(A,function(ie,_){var he=ge(_);return he==="symbol"?String(_):_});return new c("Invalid "+L+" `"+N+"` of value `"+String(M)+"` "+("supplied to `"+P+"`, expected one of "+q+"."))}return v(O)}function V(A){function O(j,D,P,L,N){if(typeof A!="function")return new c("Property `"+N+"` of component `"+P+"` has invalid PropType notation inside objectOf.");var M=j[D],B=ae(M);if(B!=="object")return new c("Invalid "+L+" `"+N+"` of type "+("`"+B+"` supplied to `"+P+"`, expected an object."));for(var q in M)if(n(M,q)){var F=A(M,q,P,L,N+"."+q,r);if(F instanceof Error)return F}return null}return v(O)}function k(A){if(!Array.isArray(A))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var O=0;O<A.length;O++){var j=A[O];if(typeof j!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Je(j)+" at index "+O+"."),s}function D(P,L,N,M,B){for(var q=[],F=0;F<A.length;F++){var ie=A[F],_=ie(P,L,N,M,B,r);if(_==null)return null;_.data&&n(_.data,"expectedType")&&q.push(_.data.expectedType)}var he=q.length>0?", expected one of type ["+q.join(", ")+"]":"";return new c("Invalid "+M+" `"+B+"` supplied to "+("`"+N+"`"+he+"."))}return v(D)}function a(){function A(O,j,D,P,L){return se(O[j])?null:new c("Invalid "+P+" `"+L+"` supplied to "+("`"+D+"`, expected a ReactNode."))}return v(A)}function I(A,O,j,D,P){return new c((A||"React class")+": "+O+" type `"+j+"."+D+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+P+"`.")}function G(A){function O(j,D,P,L,N){var M=j[D],B=ae(M);if(B!=="object")return new c("Invalid "+L+" `"+N+"` of type `"+B+"` "+("supplied to `"+P+"`, expected `object`."));for(var q in A){var F=A[q];if(typeof F!="function")return I(P,L,N,q,ge(F));var ie=F(M,q,P,L,N+"."+q,r);if(ie)return ie}return null}return v(O)}function W(A){function O(j,D,P,L,N){var M=j[D],B=ae(M);if(B!=="object")return new c("Invalid "+L+" `"+N+"` of type `"+B+"` "+("supplied to `"+P+"`, expected `object`."));var q=t({},j[D],A);for(var F in q){var ie=A[F];if(n(A,F)&&typeof ie!="function")return I(P,L,N,F,ge(ie));if(!ie)return new c("Invalid "+L+" `"+N+"` key `"+F+"` supplied to `"+P+"`.\nBad object: "+JSON.stringify(j[D],null," ")+`
|
|
2
|
-
Valid keys: `+JSON.stringify(Object.keys(A),null," "));var
|
|
3
|
-
For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`:Ce(18,`(${t})`));return null}const[,n,o]=r,i=Number.isNaN(+n)?n||0:+n;return e.containerQueries(o).up(i)}function io(e){const t=(i,
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("react/jsx-runtime"),_=require("react"),I=require("@mui/material"),sr=require("framer-motion"),Pn=require("@emotion/styled");require("@emotion/react");const Lt=require("@mui/icons-material"),Ge=require("oidc-client-ts");function Nn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Ae=Nn(_);function Vr({apps:e,open:t,onClose:r,buttonRef:n,isLoading:o=!1,error:i=null,onRetry:c,excludeAppId:l}){const f=_.useRef(null),[u,y]=_.useState("64px"),d=()=>{const h=window.location.origin;return e.find(a=>a.url.startsWith(h))?.id},g=e.filter(h=>{if(l&&h.id===l)return!1;const a=d();return!(a&&h.id===a)});_.useLayoutEffect(()=>{if(t&&n?.current){const h=n.current.getBoundingClientRect();y(`${h.bottom+8}px`)}},[t,n]),_.useEffect(()=>{const h=a=>{f.current&&!f.current.contains(a.target)&&n?.current&&!n.current.contains(a.target)&&r()};return t&&document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[t,r,n]);const v=h=>{window.open(h,"_blank"),r()};return w.jsx(sr.AnimatePresence,{children:t&&w.jsx(sr.motion.div,{ref:f,initial:{opacity:0,scaleX:.6,scaleY:.6,y:-8},animate:{opacity:1,scaleX:1,scaleY:1,y:0},exit:{opacity:0,scaleX:.6,scaleY:.6,y:-8},transition:{duration:.18,ease:"easeOut"},style:{position:"absolute",top:u,right:"16px",zIndex:1e3,transformOrigin:"top right"},children:w.jsxs(I.Box,{sx:{bgcolor:"#E8F0FE",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)",p:2,width:"320px",minHeight:"100px"},onClick:h=>h.stopPropagation(),children:[o&&g.length===0&&w.jsx(I.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100px"},children:w.jsx(I.CircularProgress,{size:32})}),i&&g.length===0&&w.jsxs(I.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100px",gap:1},children:[w.jsx(I.Typography,{sx:{fontSize:"0.875rem",color:"#ea4335",textAlign:"center"},children:"Failed to load apps"}),c&&w.jsx(I.Link,{component:"button",onClick:c,sx:{fontSize:"0.875rem",color:"#1a73e8",cursor:"pointer",textDecoration:"underline"},children:"Retry"})]}),g.length>0&&w.jsx(I.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:1},children:g.map(h=>w.jsxs(I.Link,{onClick:()=>v(h.url),sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100px",p:1.5,borderRadius:"12px",cursor:"pointer",textDecoration:"none",transition:"background-color 200ms","&:hover":{bgcolor:"#f1f3f4"}},title:h.description,children:[w.jsx(I.Box,{sx:{pb:1},children:h.iconUrl?w.jsx(I.Box,{component:"img",src:h.iconUrl,alt:h.name,sx:{width:"32px",height:"32px",objectFit:"contain"}}):w.jsx(I.Box,{sx:{width:"32px",height:"32px",borderRadius:"6px",bgcolor:h.color||"#4285f4",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.5rem"},children:h.name.charAt(0)})}),w.jsx(I.Typography,{sx:{fontSize:"0.75rem",fontWeight:500,color:"#202124",textAlign:"center",lineHeight:1.2},children:h.name})]},h.id))})]})})})}const xt="spry_apps_cache",Un=300*1e3,Dn=300*1e3;function Wr(e,t={}){const{refetchInterval:r=Un,cacheTime:n=Dn}=t,[o,i]=_.useState([]),[c,l]=_.useState(!0),[f,u]=_.useState(null),y=_.useRef(null),d=_.useRef(null),g=_.useCallback(()=>{try{const a=localStorage.getItem(xt);if(!a)return null;const b=JSON.parse(a);return Date.now()-b.timestamp<n?b.apps:(localStorage.removeItem(xt),null)}catch(a){return console.error("Error loading from cache:",a),null}},[n]),v=_.useCallback(a=>{try{const b={apps:a,timestamp:Date.now()};localStorage.setItem(xt,JSON.stringify(b))}catch(b){console.error("Error saving to cache:",b)}},[]),h=_.useCallback(async()=>{d.current&&d.current.abort(),d.current=new AbortController;try{l(!0),u(null);const a=await fetch(`${e}/api/apps`,{signal:d.current.signal,headers:{Accept:"application/json"}});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const b=await a.json();i(b.apps),v(b.apps),u(null)}catch(a){if(a instanceof Error&&a.name==="AbortError")return;const b=a instanceof Error?a.message:"Failed to fetch apps";u(b),console.error("Error fetching apps:",a);const x=g();x&&i(x)}finally{l(!1)}},[e,g,v]);return _.useEffect(()=>{const a=g();return a&&(i(a),l(!1)),h(),r>0&&(y.current=window.setInterval(()=>{h()},r)),()=>{y.current&&window.clearInterval(y.current),d.current&&d.current.abort()}},[e,r,n]),{apps:o,isLoading:c,error:f,refetch:h}}function Mn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qe={exports:{}},H={};var ar;function jn(){if(ar)return H;ar=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),c=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),g=Symbol.for("react.view_transition"),v=Symbol.for("react.client.reference");function h(a){if(typeof a=="object"&&a!==null){var b=a.$$typeof;switch(b){case e:switch(a=a.type,a){case r:case o:case n:case f:case u:case g:return a;default:switch(a=a&&a.$$typeof,a){case c:case l:case d:case y:return a;case i:return a;default:return b}}case t:return b}}}return H.ContextConsumer=i,H.ContextProvider=c,H.Element=e,H.ForwardRef=l,H.Fragment=r,H.Lazy=d,H.Memo=y,H.Portal=t,H.Profiler=o,H.StrictMode=n,H.Suspense=f,H.SuspenseList=u,H.isContextConsumer=function(a){return h(a)===i},H.isContextProvider=function(a){return h(a)===c},H.isElement=function(a){return typeof a=="object"&&a!==null&&a.$$typeof===e},H.isForwardRef=function(a){return h(a)===l},H.isFragment=function(a){return h(a)===r},H.isLazy=function(a){return h(a)===d},H.isMemo=function(a){return h(a)===y},H.isPortal=function(a){return h(a)===t},H.isProfiler=function(a){return h(a)===o},H.isStrictMode=function(a){return h(a)===n},H.isSuspense=function(a){return h(a)===f},H.isSuspenseList=function(a){return h(a)===u},H.isValidElementType=function(a){return typeof a=="string"||typeof a=="function"||a===r||a===o||a===n||a===f||a===u||typeof a=="object"&&a!==null&&(a.$$typeof===d||a.$$typeof===y||a.$$typeof===c||a.$$typeof===i||a.$$typeof===l||a.$$typeof===v||a.getModuleId!==void 0)},H.typeOf=h,H}var J={};var cr;function Ln(){return cr||(cr=1,process.env.NODE_ENV!=="production"&&(function(){function e(a){if(typeof a=="object"&&a!==null){var b=a.$$typeof;switch(b){case t:switch(a=a.type,a){case n:case i:case o:case u:case y:case v:return a;default:switch(a=a&&a.$$typeof,a){case l:case f:case g:case d:return a;case c:return a;default:return b}}case r:return b}}}var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),l=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.view_transition"),h=Symbol.for("react.client.reference");J.ContextConsumer=c,J.ContextProvider=l,J.Element=t,J.ForwardRef=f,J.Fragment=n,J.Lazy=g,J.Memo=d,J.Portal=r,J.Profiler=i,J.StrictMode=o,J.Suspense=u,J.SuspenseList=y,J.isContextConsumer=function(a){return e(a)===c},J.isContextProvider=function(a){return e(a)===l},J.isElement=function(a){return typeof a=="object"&&a!==null&&a.$$typeof===t},J.isForwardRef=function(a){return e(a)===f},J.isFragment=function(a){return e(a)===n},J.isLazy=function(a){return e(a)===g},J.isMemo=function(a){return e(a)===d},J.isPortal=function(a){return e(a)===r},J.isProfiler=function(a){return e(a)===i},J.isStrictMode=function(a){return e(a)===o},J.isSuspense=function(a){return e(a)===u},J.isSuspenseList=function(a){return e(a)===y},J.isValidElementType=function(a){return typeof a=="string"||typeof a=="function"||a===n||a===i||a===o||a===u||a===y||typeof a=="object"&&a!==null&&(a.$$typeof===g||a.$$typeof===d||a.$$typeof===l||a.$$typeof===c||a.$$typeof===f||a.$$typeof===h||a.getModuleId!==void 0)},J.typeOf=e})()),J}var lr;function Bn(){return lr||(lr=1,process.env.NODE_ENV==="production"?Qe.exports=jn():Qe.exports=Ln()),Qe.exports}var st=Bn();function ve(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Gr(e){if(Ae.isValidElement(e)||st.isValidElementType(e)||!ve(e))return e;const t={};return Object.keys(e).forEach(r=>{t[r]=Gr(e[r])}),t}function fe(e,t,r={clone:!0}){const n=r.clone?{...e}:e;return ve(e)&&ve(t)&&Object.keys(t).forEach(o=>{Ae.isValidElement(t[o])||st.isValidElementType(t[o])?n[o]=t[o]:ve(t[o])&&Object.prototype.hasOwnProperty.call(e,o)&&ve(e[o])?n[o]=fe(e[o],t[o],r):r.clone?n[o]=ve(t[o])?Gr(t[o]):t[o]:n[o]=t[o]}),n}var Ze={exports:{}},et={exports:{}},Y={};var ur;function Fn(){if(ur)return Y;ur=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,c=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,y=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,g=e?Symbol.for("react.suspense_list"):60120,v=e?Symbol.for("react.memo"):60115,h=e?Symbol.for("react.lazy"):60116,a=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,T=e?Symbol.for("react.scope"):60119;function C(p){if(typeof p=="object"&&p!==null){var E=p.$$typeof;switch(E){case t:switch(p=p.type,p){case f:case u:case n:case i:case o:case d:return p;default:switch(p=p&&p.$$typeof,p){case l:case y:case h:case v:case c:return p;default:return E}}case r:return E}}}function m(p){return C(p)===u}return Y.AsyncMode=f,Y.ConcurrentMode=u,Y.ContextConsumer=l,Y.ContextProvider=c,Y.Element=t,Y.ForwardRef=y,Y.Fragment=n,Y.Lazy=h,Y.Memo=v,Y.Portal=r,Y.Profiler=i,Y.StrictMode=o,Y.Suspense=d,Y.isAsyncMode=function(p){return m(p)||C(p)===f},Y.isConcurrentMode=m,Y.isContextConsumer=function(p){return C(p)===l},Y.isContextProvider=function(p){return C(p)===c},Y.isElement=function(p){return typeof p=="object"&&p!==null&&p.$$typeof===t},Y.isForwardRef=function(p){return C(p)===y},Y.isFragment=function(p){return C(p)===n},Y.isLazy=function(p){return C(p)===h},Y.isMemo=function(p){return C(p)===v},Y.isPortal=function(p){return C(p)===r},Y.isProfiler=function(p){return C(p)===i},Y.isStrictMode=function(p){return C(p)===o},Y.isSuspense=function(p){return C(p)===d},Y.isValidElementType=function(p){return typeof p=="string"||typeof p=="function"||p===n||p===u||p===i||p===o||p===d||p===g||typeof p=="object"&&p!==null&&(p.$$typeof===h||p.$$typeof===v||p.$$typeof===c||p.$$typeof===l||p.$$typeof===y||p.$$typeof===b||p.$$typeof===x||p.$$typeof===T||p.$$typeof===a)},Y.typeOf=C,Y}var K={};var fr;function zn(){return fr||(fr=1,process.env.NODE_ENV!=="production"&&(function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,c=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,y=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,g=e?Symbol.for("react.suspense_list"):60120,v=e?Symbol.for("react.memo"):60115,h=e?Symbol.for("react.lazy"):60116,a=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,T=e?Symbol.for("react.scope"):60119;function C(R){return typeof R=="string"||typeof R=="function"||R===n||R===u||R===i||R===o||R===d||R===g||typeof R=="object"&&R!==null&&(R.$$typeof===h||R.$$typeof===v||R.$$typeof===c||R.$$typeof===l||R.$$typeof===y||R.$$typeof===b||R.$$typeof===x||R.$$typeof===T||R.$$typeof===a)}function m(R){if(typeof R=="object"&&R!==null){var ye=R.$$typeof;switch(ye){case t:var Xe=R.type;switch(Xe){case f:case u:case n:case i:case o:case d:return Xe;default:var ir=Xe&&Xe.$$typeof;switch(ir){case l:case y:case h:case v:case c:return ir;default:return ye}}case r:return ye}}}var p=f,E=u,k=l,N=c,P=t,s=y,$=n,L=h,G=v,ae=r,oe=i,ce=o,he=d,Je=!1;function Ct(R){return Je||(Je=!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.")),A(R)||m(R)===f}function A(R){return m(R)===u}function O(R){return m(R)===l}function B(R){return m(R)===c}function M(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function U(R){return m(R)===y}function F(R){return m(R)===n}function D(R){return m(R)===h}function j(R){return m(R)===v}function z(R){return m(R)===r}function q(R){return m(R)===i}function V(R){return m(R)===o}function ie(R){return m(R)===d}K.AsyncMode=p,K.ConcurrentMode=E,K.ContextConsumer=k,K.ContextProvider=N,K.Element=P,K.ForwardRef=s,K.Fragment=$,K.Lazy=L,K.Memo=G,K.Portal=ae,K.Profiler=oe,K.StrictMode=ce,K.Suspense=he,K.isAsyncMode=Ct,K.isConcurrentMode=A,K.isContextConsumer=O,K.isContextProvider=B,K.isElement=M,K.isForwardRef=U,K.isFragment=F,K.isLazy=D,K.isMemo=j,K.isPortal=z,K.isProfiler=q,K.isStrictMode=V,K.isSuspense=ie,K.isValidElementType=C,K.typeOf=m})()),K}var dr;function Yr(){return dr||(dr=1,process.env.NODE_ENV==="production"?et.exports=Fn():et.exports=zn()),et.exports}var Tt,pr;function Vn(){if(pr)return Tt;pr=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function n(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var c={},l=0;l<10;l++)c["_"+String.fromCharCode(l)]=l;var f=Object.getOwnPropertyNames(c).map(function(y){return c[y]});if(f.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(y){u[y]=y}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Tt=o()?Object.assign:function(i,c){for(var l,f=n(i),u,y=1;y<arguments.length;y++){l=Object(arguments[y]);for(var d in l)t.call(l,d)&&(f[d]=l[d]);if(e){u=e(l);for(var g=0;g<u.length;g++)r.call(l,u[g])&&(f[u[g]]=l[u[g]])}}return f},Tt}var _t,mr;function Yt(){if(mr)return _t;mr=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return _t=e,_t}var Rt,gr;function Kr(){return gr||(gr=1,Rt=Function.call.bind(Object.prototype.hasOwnProperty)),Rt}var Ot,hr;function Wn(){if(hr)return Ot;hr=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Yt(),r={},n=Kr();e=function(i){var c="Warning: "+i;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}}}function o(i,c,l,f,u){if(process.env.NODE_ENV!=="production"){for(var y in i)if(n(i,y)){var d;try{if(typeof i[y]!="function"){var g=Error((f||"React class")+": "+l+" type `"+y+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[y]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}d=i[y](c,y,f,l,null,t)}catch(h){d=h}if(d&&!(d instanceof Error)&&e((f||"React class")+": type specification of "+l+" `"+y+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in r)){r[d.message]=!0;var v=u?u():"";e("Failed "+l+" type: "+d.message+(v??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(r={})},Ot=o,Ot}var It,yr;function Gn(){if(yr)return It;yr=1;var e=Yr(),t=Vn(),r=Yt(),n=Kr(),o=Wn(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(l){var f="Warning: "+l;typeof console<"u"&&console.error(f);try{throw new Error(f)}catch{}});function c(){return null}return It=function(l,f){var u=typeof Symbol=="function"&&Symbol.iterator,y="@@iterator";function d(A){var O=A&&(u&&A[u]||A[y]);if(typeof O=="function")return O}var g="<<anonymous>>",v={array:x("array"),bigint:x("bigint"),bool:x("boolean"),func:x("function"),number:x("number"),object:x("object"),string:x("string"),symbol:x("symbol"),any:T(),arrayOf:C,element:m(),elementType:p(),instanceOf:E,node:s(),objectOf:N,oneOf:k,oneOfType:P,shape:L,exact:G};function h(A,O){return A===O?A!==0||1/A===1/O:A!==A&&O!==O}function a(A,O){this.message=A,this.data=O&&typeof O=="object"?O:{},this.stack=""}a.prototype=Error.prototype;function b(A){if(process.env.NODE_ENV!=="production")var O={},B=0;function M(F,D,j,z,q,V,ie){if(z=z||g,V=V||j,ie!==r){if(f){var R=new 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 R.name="Invariant Violation",R}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ye=z+":"+j;!O[ye]&&B<3&&(i("You are manually calling a React.PropTypes validation function for the `"+V+"` prop on `"+z+"`. 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."),O[ye]=!0,B++)}}return D[j]==null?F?D[j]===null?new a("The "+q+" `"+V+"` is marked as required "+("in `"+z+"`, but its value is `null`.")):new a("The "+q+" `"+V+"` is marked as required in "+("`"+z+"`, but its value is `undefined`.")):null:A(D,j,z,q,V)}var U=M.bind(null,!1);return U.isRequired=M.bind(null,!0),U}function x(A){function O(B,M,U,F,D,j){var z=B[M],q=ce(z);if(q!==A){var V=he(z);return new a("Invalid "+F+" `"+D+"` of type "+("`"+V+"` supplied to `"+U+"`, expected ")+("`"+A+"`."),{expectedType:A})}return null}return b(O)}function T(){return b(c)}function C(A){function O(B,M,U,F,D){if(typeof A!="function")return new a("Property `"+D+"` of component `"+U+"` has invalid PropType notation inside arrayOf.");var j=B[M];if(!Array.isArray(j)){var z=ce(j);return new a("Invalid "+F+" `"+D+"` of type "+("`"+z+"` supplied to `"+U+"`, expected an array."))}for(var q=0;q<j.length;q++){var V=A(j,q,U,F,D+"["+q+"]",r);if(V instanceof Error)return V}return null}return b(O)}function m(){function A(O,B,M,U,F){var D=O[B];if(!l(D)){var j=ce(D);return new a("Invalid "+U+" `"+F+"` of type "+("`"+j+"` supplied to `"+M+"`, expected a single ReactElement."))}return null}return b(A)}function p(){function A(O,B,M,U,F){var D=O[B];if(!e.isValidElementType(D)){var j=ce(D);return new a("Invalid "+U+" `"+F+"` of type "+("`"+j+"` supplied to `"+M+"`, expected a single ReactElement type."))}return null}return b(A)}function E(A){function O(B,M,U,F,D){if(!(B[M]instanceof A)){var j=A.name||g,z=Ct(B[M]);return new a("Invalid "+F+" `"+D+"` of type "+("`"+z+"` supplied to `"+U+"`, expected ")+("instance of `"+j+"`."))}return null}return b(O)}function k(A){if(!Array.isArray(A))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("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])."):i("Invalid argument supplied to oneOf, expected an array.")),c;function O(B,M,U,F,D){for(var j=B[M],z=0;z<A.length;z++)if(h(j,A[z]))return null;var q=JSON.stringify(A,function(ie,R){var ye=he(R);return ye==="symbol"?String(R):R});return new a("Invalid "+F+" `"+D+"` of value `"+String(j)+"` "+("supplied to `"+U+"`, expected one of "+q+"."))}return b(O)}function N(A){function O(B,M,U,F,D){if(typeof A!="function")return new a("Property `"+D+"` of component `"+U+"` has invalid PropType notation inside objectOf.");var j=B[M],z=ce(j);if(z!=="object")return new a("Invalid "+F+" `"+D+"` of type "+("`"+z+"` supplied to `"+U+"`, expected an object."));for(var q in j)if(n(j,q)){var V=A(j,q,U,F,D+"."+q,r);if(V instanceof Error)return V}return null}return b(O)}function P(A){if(!Array.isArray(A))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),c;for(var O=0;O<A.length;O++){var B=A[O];if(typeof B!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Je(B)+" at index "+O+"."),c}function M(U,F,D,j,z){for(var q=[],V=0;V<A.length;V++){var ie=A[V],R=ie(U,F,D,j,z,r);if(R==null)return null;R.data&&n(R.data,"expectedType")&&q.push(R.data.expectedType)}var ye=q.length>0?", expected one of type ["+q.join(", ")+"]":"";return new a("Invalid "+j+" `"+z+"` supplied to "+("`"+D+"`"+ye+"."))}return b(M)}function s(){function A(O,B,M,U,F){return ae(O[B])?null:new a("Invalid "+U+" `"+F+"` supplied to "+("`"+M+"`, expected a ReactNode."))}return b(A)}function $(A,O,B,M,U){return new a((A||"React class")+": "+O+" type `"+B+"."+M+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+U+"`.")}function L(A){function O(B,M,U,F,D){var j=B[M],z=ce(j);if(z!=="object")return new a("Invalid "+F+" `"+D+"` of type `"+z+"` "+("supplied to `"+U+"`, expected `object`."));for(var q in A){var V=A[q];if(typeof V!="function")return $(U,F,D,q,he(V));var ie=V(j,q,U,F,D+"."+q,r);if(ie)return ie}return null}return b(O)}function G(A){function O(B,M,U,F,D){var j=B[M],z=ce(j);if(z!=="object")return new a("Invalid "+F+" `"+D+"` of type `"+z+"` "+("supplied to `"+U+"`, expected `object`."));var q=t({},B[M],A);for(var V in q){var ie=A[V];if(n(A,V)&&typeof ie!="function")return $(U,F,D,V,he(ie));if(!ie)return new a("Invalid "+F+" `"+D+"` key `"+V+"` supplied to `"+U+"`.\nBad object: "+JSON.stringify(B[M],null," ")+`
|
|
2
|
+
Valid keys: `+JSON.stringify(Object.keys(A),null," "));var R=ie(j,V,U,F,D+"."+V,r);if(R)return R}return null}return b(O)}function ae(A){switch(typeof A){case"number":case"string":case"undefined":return!0;case"boolean":return!A;case"object":if(Array.isArray(A))return A.every(ae);if(A===null||l(A))return!0;var O=d(A);if(O){var B=O.call(A),M;if(O!==A.entries){for(;!(M=B.next()).done;)if(!ae(M.value))return!1}else for(;!(M=B.next()).done;){var U=M.value;if(U&&!ae(U[1]))return!1}}else return!1;return!0;default:return!1}}function oe(A,O){return A==="symbol"?!0:O?O["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&O instanceof Symbol:!1}function ce(A){var O=typeof A;return Array.isArray(A)?"array":A instanceof RegExp?"object":oe(O,A)?"symbol":O}function he(A){if(typeof A>"u"||A===null)return""+A;var O=ce(A);if(O==="object"){if(A instanceof Date)return"date";if(A instanceof RegExp)return"regexp"}return O}function Je(A){var O=he(A);switch(O){case"array":case"object":return"an "+O;case"boolean":case"date":case"regexp":return"a "+O;default:return O}}function Ct(A){return!A.constructor||!A.constructor.name?g:A.constructor.name}return v.checkPropTypes=o,v.resetWarningCache=o.resetWarningCache,v.PropTypes=v,v},It}var $t,Sr;function Yn(){if(Sr)return $t;Sr=1;var e=Yt();function t(){}function r(){}return r.resetWarningCache=t,$t=function(){function n(c,l,f,u,y,d){if(d!==e){var g=new 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 g.name="Invariant Violation",g}}n.isRequired=n;function o(){return n}var i={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:o,element:n,elementType:n,instanceOf:o,node:n,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:t};return i.PropTypes=i,i},$t}var br;function Kn(){if(br)return Ze.exports;if(br=1,process.env.NODE_ENV!=="production"){var e=Yr(),t=!0;Ze.exports=Gn()(e.isElement,t)}else Ze.exports=Yn()();return Ze.exports}var qn=Kn();const W=Mn(qn);function Ce(e,...t){const r=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(n=>r.searchParams.append("args[]",n)),`Minified MUI error #${e}; visit ${r} for the full message.`}function qr(e,t=""){return e.displayName||e.name||t}function vr(e,t,r){const n=qr(t);return e.displayName||(n!==""?`${r}(${n})`:r)}function Hn(e){if(e!=null){if(typeof e=="string")return e;if(typeof e=="function")return qr(e,"Component");if(typeof e=="object")switch(e.$$typeof){case st.ForwardRef:return vr(e,e.render,"ForwardRef");case st.Memo:return vr(e,e.type,"memo");default:return}}}function Oe(e){if(typeof e!="string")throw new Error(process.env.NODE_ENV!=="production"?"MUI: `capitalize(string)` expects a string argument.":Ce(7));return e.charAt(0).toUpperCase()+e.slice(1)}function Bt(e,t){const r={...t};for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const o=n;if(o==="components"||o==="slots")r[o]={...e[o],...r[o]};else if(o==="componentsProps"||o==="slotProps"){const i=e[o],c=t[o];if(!c)r[o]=i||{};else if(!i)r[o]=c;else{r[o]={...c};for(const l in i)if(Object.prototype.hasOwnProperty.call(i,l)){const f=l;r[o][f]=Bt(i[f],c[f])}}}else r[o]===void 0&&(r[o]=e[o])}return r}function Jn(e,t,r=void 0){const n={};for(const o in e){const i=e[o];let c="",l=!0;for(let f=0;f<i.length;f+=1){const u=i[f];u&&(c+=(l===!0?"":" ")+t(u),l=!1,r&&r[u]&&(c+=" "+r[u]))}n[o]=c}return n}const Er=e=>e,Xn=()=>{let e=Er;return{configure(t){e=t},generate(t){return e(t)},reset(){e=Er}}},Qn=Xn(),Zn={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function Kt(e,t,r="Mui"){const n=Zn[t];return n?`${r}-${n}`:`${Qn.generate(e)}-${t}`}function eo(e,t,r="Mui"){const n={};return t.forEach(o=>{n[o]=Kt(e,o,r)}),n}function to(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}function Hr(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=Hr(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ro(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=Hr(e))&&(n&&(n+=" "),n+=t);return n}function We(e,t){return t?fe(e,t,{clone:!1}):e}const Te=process.env.NODE_ENV!=="production"?W.oneOfType([W.number,W.string,W.object,W.array]):{};function wr(e,t){if(!e.containerQueries)return t;const r=Object.keys(t).filter(n=>n.startsWith("@container")).sort((n,o)=>{const i=/min-width:\s*([0-9.]+)/;return+(n.match(i)?.[1]||0)-+(o.match(i)?.[1]||0)});return r.length?r.reduce((n,o)=>{const i=t[o];return delete n[o],n[o]=i,n},{...t}):t}function no(e,t){return t==="@"||t.startsWith("@")&&(e.some(r=>t.startsWith(`@${r}`))||!!t.match(/^@\d/))}function oo(e,t){const r=t.match(/^@([^/]+)?\/?(.+)?$/);if(!r){if(process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV!=="production"?`MUI: The provided shorthand ${`(${t})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
|
|
3
|
+
For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`:Ce(18,`(${t})`));return null}const[,n,o]=r,i=Number.isNaN(+n)?n||0:+n;return e.containerQueries(o).up(i)}function io(e){const t=(i,c)=>i.replace("@media",c?`@container ${c}`:"@container");function r(i,c){i.up=(...l)=>t(e.breakpoints.up(...l),c),i.down=(...l)=>t(e.breakpoints.down(...l),c),i.between=(...l)=>t(e.breakpoints.between(...l),c),i.only=(...l)=>t(e.breakpoints.only(...l),c),i.not=(...l)=>{const f=t(e.breakpoints.not(...l),c);return f.includes("not all and")?f.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):f}}const n={},o=i=>(r(n,i),n);return r(o),{...e,containerQueries:o}}const ut={xs:0,sm:600,md:900,lg:1200,xl:1536},Ar={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${ut[e]}px)`},so={containerQueries:e=>({up:t=>{let r=typeof t=="number"?t:ut[t]||t;return typeof r=="number"&&(r=`${r}px`),e?`@container ${e} (min-width:${r})`:`@container (min-width:${r})`}})};function Ee(e,t,r){const n=e.theme||{};if(Array.isArray(t)){const i=n.breakpoints||Ar;return t.reduce((c,l,f)=>(c[i.up(i.keys[f])]=r(t[f]),c),{})}if(typeof t=="object"){const i=n.breakpoints||Ar;return Object.keys(t).reduce((c,l)=>{if(no(i.keys,l)){const f=oo(n.containerQueries?n:so,l);f&&(c[f]=r(t[l],l))}else if(Object.keys(i.values||ut).includes(l)){const f=i.up(l);c[f]=r(t[l],l)}else{const f=l;c[f]=t[f]}return c},{})}return r(t)}function ao(e={}){return e.keys?.reduce((r,n)=>{const o=e.up(n);return r[o]={},r},{})||{}}function Cr(e,t){return e.reduce((r,n)=>{const o=r[n];return(!o||Object.keys(o).length===0)&&delete r[n],r},t)}function ft(e,t,r=!0){if(!t||typeof t!="string")return null;if(e&&e.vars&&r){const n=`vars.${t}`.split(".").reduce((o,i)=>o&&o[i]?o[i]:null,e);if(n!=null)return n}return t.split(".").reduce((n,o)=>n&&n[o]!=null?n[o]:null,e)}function at(e,t,r,n=r){let o;return typeof e=="function"?o=e(r):Array.isArray(e)?o=e[r]||n:o=ft(e,r)||n,t&&(o=t(o,n,e)),o}function ne(e){const{prop:t,cssProperty:r=e.prop,themeKey:n,transform:o}=e,i=c=>{if(c[t]==null)return null;const l=c[t],f=c.theme,u=ft(f,n)||{};return Ee(c,l,d=>{let g=at(u,o,d);return d===g&&typeof d=="string"&&(g=at(u,o,`${t}${d==="default"?"":Oe(d)}`,d)),r===!1?g:{[r]:g}})};return i.propTypes=process.env.NODE_ENV!=="production"?{[t]:Te}:{},i.filterProps=[t],i}function co(e){const t={};return r=>(t[r]===void 0&&(t[r]=e(r)),t[r])}const lo={m:"margin",p:"padding"},uo={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},xr={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},fo=co(e=>{if(e.length>2)if(xr[e])e=xr[e];else return[e];const[t,r]=e.split(""),n=lo[t],o=uo[r]||"";return Array.isArray(o)?o.map(i=>n+i):[n+o]}),dt=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],pt=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],po=[...dt,...pt];function Ke(e,t,r,n){const o=ft(e,t,!0)??r;return typeof o=="number"||typeof o=="string"?i=>typeof i=="string"?i:(process.env.NODE_ENV!=="production"&&typeof i!="number"&&console.error(`MUI: Expected ${n} argument to be a number or a string, got ${i}.`),typeof o=="string"?`calc(${i} * ${o})`:o*i):Array.isArray(o)?i=>{if(typeof i=="string")return i;const c=Math.abs(i);process.env.NODE_ENV!=="production"&&(Number.isInteger(c)?c>o.length-1&&console.error([`MUI: The value provided (${c}) overflows.`,`The supported values are: ${JSON.stringify(o)}.`,`${c} > ${o.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(`
|
|
5
|
-
`)));const l=o[
|
|
6
|
-
`)),()=>{})}function qt(e){return Ke(e,"spacing",8,"spacing")}function qe(e,t){return typeof t=="string"||t==null?t:e(t)}function mo(e,t){return r=>e.reduce((n,o)=>(n[o]=qe(t,r),n),{})}function go(e,t,r,n){if(!t.includes(r))return null;const o=fo(r),i=mo(o,n),s=e[r];return Ee(e,s,i)}function Jr(e,t){const r=qt(e.theme);return Object.keys(e).map(n=>go(e,t,n,r)).reduce(We,{})}function ee(e){return Jr(e,dt)}ee.propTypes=process.env.NODE_ENV!=="production"?dt.reduce((e,t)=>(e[t]=Te,e),{}):{};ee.filterProps=dt;function te(e){return Jr(e,pt)}te.propTypes=process.env.NODE_ENV!=="production"?pt.reduce((e,t)=>(e[t]=Te,e),{}):{};te.filterProps=pt;process.env.NODE_ENV!=="production"&&po.reduce((e,t)=>(e[t]=Te,e),{});function mt(...e){const t=e.reduce((n,o)=>(o.filterProps.forEach(i=>{n[i]=o}),n),{}),r=n=>Object.keys(n).reduce((o,i)=>t[i]?We(o,t[i](n)):o,{});return r.propTypes=process.env.NODE_ENV!=="production"?e.reduce((n,o)=>Object.assign(n,o.propTypes),{}):{},r.filterProps=e.reduce((n,o)=>n.concat(o.filterProps),[]),r}function de(e){return typeof e!="number"?e:`${e}px solid`}function me(e,t){return re({prop:e,themeKey:"borders",transform:t})}const ho=me("border",de),yo=me("borderTop",de),So=me("borderRight",de),bo=me("borderBottom",de),vo=me("borderLeft",de),Eo=me("borderColor"),wo=me("borderTopColor"),Ao=me("borderRightColor"),Co=me("borderBottomColor"),xo=me("borderLeftColor"),To=me("outline",de),_o=me("outlineColor"),gt=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){const t=Ke(e.theme,"shape.borderRadius",4,"borderRadius"),r=n=>({borderRadius:qe(t,n)});return Ee(e,e.borderRadius,r)}return null};gt.propTypes=process.env.NODE_ENV!=="production"?{borderRadius:Te}:{};gt.filterProps=["borderRadius"];mt(ho,yo,So,bo,vo,Eo,wo,Ao,Co,xo,gt,To,_o);const ht=e=>{if(e.gap!==void 0&&e.gap!==null){const t=Ke(e.theme,"spacing",8,"gap"),r=n=>({gap:qe(t,n)});return Ee(e,e.gap,r)}return null};ht.propTypes=process.env.NODE_ENV!=="production"?{gap:Te}:{};ht.filterProps=["gap"];const yt=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){const t=Ke(e.theme,"spacing",8,"columnGap"),r=n=>({columnGap:qe(t,n)});return Ee(e,e.columnGap,r)}return null};yt.propTypes=process.env.NODE_ENV!=="production"?{columnGap:Te}:{};yt.filterProps=["columnGap"];const St=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){const t=Ke(e.theme,"spacing",8,"rowGap"),r=n=>({rowGap:qe(t,n)});return Ee(e,e.rowGap,r)}return null};St.propTypes=process.env.NODE_ENV!=="production"?{rowGap:Te}:{};St.filterProps=["rowGap"];const Ro=re({prop:"gridColumn"}),Oo=re({prop:"gridRow"}),Io=re({prop:"gridAutoFlow"}),$o=re({prop:"gridAutoColumns"}),ko=re({prop:"gridAutoRows"}),Po=re({prop:"gridTemplateColumns"}),No=re({prop:"gridTemplateRows"}),Uo=re({prop:"gridTemplateAreas"}),Do=re({prop:"gridArea"});mt(ht,yt,St,Ro,Oo,Io,$o,ko,Po,No,Uo,Do);function je(e,t){return t==="grey"?t:e}const Mo=re({prop:"color",themeKey:"palette",transform:je}),jo=re({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:je}),Lo=re({prop:"backgroundColor",themeKey:"palette",transform:je});mt(Mo,jo,Lo);function le(e){return e<=1&&e!==0?`${e*100}%`:e}const Bo=re({prop:"width",transform:le}),Ht=e=>{if(e.maxWidth!==void 0&&e.maxWidth!==null){const t=r=>{const n=e.theme?.breakpoints?.values?.[r]||ut[r];return n?e.theme?.breakpoints?.unit!=="px"?{maxWidth:`${n}${e.theme.breakpoints.unit}`}:{maxWidth:n}:{maxWidth:le(r)}};return Ee(e,e.maxWidth,t)}return null};Ht.filterProps=["maxWidth"];const Fo=re({prop:"minWidth",transform:le}),zo=re({prop:"height",transform:le}),Vo=re({prop:"maxHeight",transform:le}),Wo=re({prop:"minHeight",transform:le});re({prop:"size",cssProperty:"width",transform:le});re({prop:"size",cssProperty:"height",transform:le});const Go=re({prop:"boxSizing"});mt(Bo,Ht,Fo,zo,Vo,Wo,Go);const bt={border:{themeKey:"borders",transform:de},borderTop:{themeKey:"borders",transform:de},borderRight:{themeKey:"borders",transform:de},borderBottom:{themeKey:"borders",transform:de},borderLeft:{themeKey:"borders",transform:de},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:de},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:gt},color:{themeKey:"palette",transform:je},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:je},backgroundColor:{themeKey:"palette",transform:je},p:{style:te},pt:{style:te},pr:{style:te},pb:{style:te},pl:{style:te},px:{style:te},py:{style:te},padding:{style:te},paddingTop:{style:te},paddingRight:{style:te},paddingBottom:{style:te},paddingLeft:{style:te},paddingX:{style:te},paddingY:{style:te},paddingInline:{style:te},paddingInlineStart:{style:te},paddingInlineEnd:{style:te},paddingBlock:{style:te},paddingBlockStart:{style:te},paddingBlockEnd:{style:te},m:{style:ee},mt:{style:ee},mr:{style:ee},mb:{style:ee},ml:{style:ee},mx:{style:ee},my:{style:ee},margin:{style:ee},marginTop:{style:ee},marginRight:{style:ee},marginBottom:{style:ee},marginLeft:{style:ee},marginX:{style:ee},marginY:{style:ee},marginInline:{style:ee},marginInlineStart:{style:ee},marginInlineEnd:{style:ee},marginBlock:{style:ee},marginBlockStart:{style:ee},marginBlockEnd:{style:ee},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:ht},rowGap:{style:St},columnGap:{style:yt},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:le},maxWidth:{style:Ht},minWidth:{transform:le},height:{transform:le},maxHeight:{transform:le},minHeight:{transform:le},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function Yo(...e){const t=e.reduce((n,o)=>n.concat(Object.keys(o)),[]),r=new Set(t);return e.every(n=>r.size===Object.keys(n).length)}function Ko(e,t){return typeof e=="function"?e(t):e}function qo(){function e(r,n,o,i){const s={[r]:n,theme:o},l=i[r];if(!l)return{[r]:n};const{cssProperty:f=r,themeKey:u,transform:h,style:d}=l;if(n==null)return null;if(u==="typography"&&n==="inherit")return{[r]:n};const m=ft(o,u)||{};return d?d(s):Ee(s,n,S=>{let c=at(m,h,S);return S===c&&typeof S=="string"&&(c=at(m,h,`${r}${S==="default"?"":Oe(S)}`,S)),f===!1?c:{[f]:c}})}function t(r){const{sx:n,theme:o={},nested:i}=r||{};if(!n)return null;const s=o.unstable_sxConfig??bt;function l(f){let u=f;if(typeof f=="function")u=f(o);else if(typeof f!="object")return f;if(!u)return null;const h=ao(o.breakpoints),d=Object.keys(h);let m=h;return Object.keys(u).forEach(E=>{const S=Ko(u[E],o);if(S!=null)if(typeof S=="object")if(s[E])m=We(m,e(E,S,o,s));else{const c=Ee({theme:o},S,v=>({[E]:v}));Yo(c,S)?m[E]=t({sx:S,theme:o,nested:!0}):m=We(m,c)}else m=We(m,e(E,S,o,s))}),!i&&o.modularCssLayers?{"@layer sx":wr(o,Cr(d,m))}:wr(o,Cr(d,m))}return Array.isArray(n)?n.map(l):l(n)}return t}const Le=qo();Le.filterProps=["sx"];function Ho(e){for(var t=0,r,n=0,o=e.length;o>=4;++n,o-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var Jo={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function Xo(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var Qo=/[A-Z]|^ms/g,Zo=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Xr=function(t){return t.charCodeAt(1)===45},Tr=function(t){return t!=null&&typeof t!="boolean"},kt=Xo(function(e){return Xr(e)?e:e.replace(Qo,"-$&").toLowerCase()}),_r=function(t,r){switch(t){case"animation":case"animationName":if(typeof r=="string")return r.replace(Zo,function(n,o,i){return we={name:o,styles:i,next:we},o})}return Jo[t]!==1&&!Xr(t)&&typeof r=="number"&&r!==0?r+"px":r};function ct(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var o=r;if(o.anim===1)return we={name:o.name,styles:o.styles,next:we},o.name;var i=r;if(i.styles!==void 0){var s=i.next;if(s!==void 0)for(;s!==void 0;)we={name:s.name,styles:s.styles,next:we},s=s.next;var l=i.styles+";";return l}return ei(e,t,r)}}var f=r;return f}function ei(e,t,r){var n="";if(Array.isArray(r))for(var o=0;o<r.length;o++)n+=ct(e,t,r[o])+";";else for(var i in r){var s=r[i];if(typeof s!="object"){var l=s;Tr(l)&&(n+=kt(i)+":"+_r(i,l)+";")}else if(Array.isArray(s)&&typeof s[0]=="string"&&t==null)for(var f=0;f<s.length;f++)Tr(s[f])&&(n+=kt(i)+":"+_r(i,s[f])+";");else{var u=ct(e,t,s);switch(i){case"animation":case"animationName":{n+=kt(i)+":"+u+";";break}default:n+=i+"{"+u+"}"}}}return n}var Rr=/label:\s*([^\s;{]+)\s*(;|$)/g,we;function ti(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,o="";we=void 0;var i=e[0];if(i==null||i.raw===void 0)n=!1,o+=ct(r,t,i);else{var s=i;o+=s[0]}for(var l=1;l<e.length;l++)if(o+=ct(r,t,e[l]),n){var f=i;o+=f[l]}Rr.lastIndex=0;for(var u="",h;(h=Rr.exec(o))!==null;)u+="-"+h[1];var d=Ho(o)+u;return{name:d,styles:o,next:we}}function ri(e,t){const r=Pn(e,t);return process.env.NODE_ENV!=="production"?(...n)=>{const o=typeof e=="string"?`"${e}"`:"component";return n.length===0?console.error([`MUI: Seems like you called \`styled(${o})()\` without a \`style\` argument.`,'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join(`
|
|
7
|
-
`)):n.some(i=>i===void 0)&&console.error(`MUI: the styled(${o})(...args) API requires all its args to be defined.`),r(...n)}:r}function ni(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}const Or=[];function Re(e){return Or[0]=e,ti(Or)}const oi=e=>{const t=Object.keys(e).map(r=>({key:r,val:e[r]}))||[];return t.sort((r,n)=>r.val-n.val),t.reduce((r,n)=>({...r,[n.key]:n.val}),{})};function ii(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:n=5,...o}=e,i=oi(t),
|
|
5
|
+
`)));const l=o[c];return i>=0?l:typeof l=="number"?-l:`-${l}`}:typeof o=="function"?o:(process.env.NODE_ENV!=="production"&&console.error([`MUI: The \`theme.${t}\` value (${o}) is invalid.`,"It should be a number, an array or a function."].join(`
|
|
6
|
+
`)),()=>{})}function qt(e){return Ke(e,"spacing",8,"spacing")}function qe(e,t){return typeof t=="string"||t==null?t:e(t)}function mo(e,t){return r=>e.reduce((n,o)=>(n[o]=qe(t,r),n),{})}function go(e,t,r,n){if(!t.includes(r))return null;const o=fo(r),i=mo(o,n),c=e[r];return Ee(e,c,i)}function Jr(e,t){const r=qt(e.theme);return Object.keys(e).map(n=>go(e,t,n,r)).reduce(We,{})}function ee(e){return Jr(e,dt)}ee.propTypes=process.env.NODE_ENV!=="production"?dt.reduce((e,t)=>(e[t]=Te,e),{}):{};ee.filterProps=dt;function te(e){return Jr(e,pt)}te.propTypes=process.env.NODE_ENV!=="production"?pt.reduce((e,t)=>(e[t]=Te,e),{}):{};te.filterProps=pt;process.env.NODE_ENV!=="production"&&po.reduce((e,t)=>(e[t]=Te,e),{});function mt(...e){const t=e.reduce((n,o)=>(o.filterProps.forEach(i=>{n[i]=o}),n),{}),r=n=>Object.keys(n).reduce((o,i)=>t[i]?We(o,t[i](n)):o,{});return r.propTypes=process.env.NODE_ENV!=="production"?e.reduce((n,o)=>Object.assign(n,o.propTypes),{}):{},r.filterProps=e.reduce((n,o)=>n.concat(o.filterProps),[]),r}function pe(e){return typeof e!="number"?e:`${e}px solid`}function ge(e,t){return ne({prop:e,themeKey:"borders",transform:t})}const ho=ge("border",pe),yo=ge("borderTop",pe),So=ge("borderRight",pe),bo=ge("borderBottom",pe),vo=ge("borderLeft",pe),Eo=ge("borderColor"),wo=ge("borderTopColor"),Ao=ge("borderRightColor"),Co=ge("borderBottomColor"),xo=ge("borderLeftColor"),To=ge("outline",pe),_o=ge("outlineColor"),gt=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){const t=Ke(e.theme,"shape.borderRadius",4,"borderRadius"),r=n=>({borderRadius:qe(t,n)});return Ee(e,e.borderRadius,r)}return null};gt.propTypes=process.env.NODE_ENV!=="production"?{borderRadius:Te}:{};gt.filterProps=["borderRadius"];mt(ho,yo,So,bo,vo,Eo,wo,Ao,Co,xo,gt,To,_o);const ht=e=>{if(e.gap!==void 0&&e.gap!==null){const t=Ke(e.theme,"spacing",8,"gap"),r=n=>({gap:qe(t,n)});return Ee(e,e.gap,r)}return null};ht.propTypes=process.env.NODE_ENV!=="production"?{gap:Te}:{};ht.filterProps=["gap"];const yt=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){const t=Ke(e.theme,"spacing",8,"columnGap"),r=n=>({columnGap:qe(t,n)});return Ee(e,e.columnGap,r)}return null};yt.propTypes=process.env.NODE_ENV!=="production"?{columnGap:Te}:{};yt.filterProps=["columnGap"];const St=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){const t=Ke(e.theme,"spacing",8,"rowGap"),r=n=>({rowGap:qe(t,n)});return Ee(e,e.rowGap,r)}return null};St.propTypes=process.env.NODE_ENV!=="production"?{rowGap:Te}:{};St.filterProps=["rowGap"];const Ro=ne({prop:"gridColumn"}),Oo=ne({prop:"gridRow"}),Io=ne({prop:"gridAutoFlow"}),$o=ne({prop:"gridAutoColumns"}),ko=ne({prop:"gridAutoRows"}),Po=ne({prop:"gridTemplateColumns"}),No=ne({prop:"gridTemplateRows"}),Uo=ne({prop:"gridTemplateAreas"}),Do=ne({prop:"gridArea"});mt(ht,yt,St,Ro,Oo,Io,$o,ko,Po,No,Uo,Do);function je(e,t){return t==="grey"?t:e}const Mo=ne({prop:"color",themeKey:"palette",transform:je}),jo=ne({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:je}),Lo=ne({prop:"backgroundColor",themeKey:"palette",transform:je});mt(Mo,jo,Lo);function ue(e){return e<=1&&e!==0?`${e*100}%`:e}const Bo=ne({prop:"width",transform:ue}),Ht=e=>{if(e.maxWidth!==void 0&&e.maxWidth!==null){const t=r=>{const n=e.theme?.breakpoints?.values?.[r]||ut[r];return n?e.theme?.breakpoints?.unit!=="px"?{maxWidth:`${n}${e.theme.breakpoints.unit}`}:{maxWidth:n}:{maxWidth:ue(r)}};return Ee(e,e.maxWidth,t)}return null};Ht.filterProps=["maxWidth"];const Fo=ne({prop:"minWidth",transform:ue}),zo=ne({prop:"height",transform:ue}),Vo=ne({prop:"maxHeight",transform:ue}),Wo=ne({prop:"minHeight",transform:ue});ne({prop:"size",cssProperty:"width",transform:ue});ne({prop:"size",cssProperty:"height",transform:ue});const Go=ne({prop:"boxSizing"});mt(Bo,Ht,Fo,zo,Vo,Wo,Go);const bt={border:{themeKey:"borders",transform:pe},borderTop:{themeKey:"borders",transform:pe},borderRight:{themeKey:"borders",transform:pe},borderBottom:{themeKey:"borders",transform:pe},borderLeft:{themeKey:"borders",transform:pe},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:pe},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:gt},color:{themeKey:"palette",transform:je},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:je},backgroundColor:{themeKey:"palette",transform:je},p:{style:te},pt:{style:te},pr:{style:te},pb:{style:te},pl:{style:te},px:{style:te},py:{style:te},padding:{style:te},paddingTop:{style:te},paddingRight:{style:te},paddingBottom:{style:te},paddingLeft:{style:te},paddingX:{style:te},paddingY:{style:te},paddingInline:{style:te},paddingInlineStart:{style:te},paddingInlineEnd:{style:te},paddingBlock:{style:te},paddingBlockStart:{style:te},paddingBlockEnd:{style:te},m:{style:ee},mt:{style:ee},mr:{style:ee},mb:{style:ee},ml:{style:ee},mx:{style:ee},my:{style:ee},margin:{style:ee},marginTop:{style:ee},marginRight:{style:ee},marginBottom:{style:ee},marginLeft:{style:ee},marginX:{style:ee},marginY:{style:ee},marginInline:{style:ee},marginInlineStart:{style:ee},marginInlineEnd:{style:ee},marginBlock:{style:ee},marginBlockStart:{style:ee},marginBlockEnd:{style:ee},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:ht},rowGap:{style:St},columnGap:{style:yt},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:ue},maxWidth:{style:Ht},minWidth:{transform:ue},height:{transform:ue},maxHeight:{transform:ue},minHeight:{transform:ue},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function Yo(...e){const t=e.reduce((n,o)=>n.concat(Object.keys(o)),[]),r=new Set(t);return e.every(n=>r.size===Object.keys(n).length)}function Ko(e,t){return typeof e=="function"?e(t):e}function qo(){function e(r,n,o,i){const c={[r]:n,theme:o},l=i[r];if(!l)return{[r]:n};const{cssProperty:f=r,themeKey:u,transform:y,style:d}=l;if(n==null)return null;if(u==="typography"&&n==="inherit")return{[r]:n};const g=ft(o,u)||{};return d?d(c):Ee(c,n,h=>{let a=at(g,y,h);return h===a&&typeof h=="string"&&(a=at(g,y,`${r}${h==="default"?"":Oe(h)}`,h)),f===!1?a:{[f]:a}})}function t(r){const{sx:n,theme:o={},nested:i}=r||{};if(!n)return null;const c=o.unstable_sxConfig??bt;function l(f){let u=f;if(typeof f=="function")u=f(o);else if(typeof f!="object")return f;if(!u)return null;const y=ao(o.breakpoints),d=Object.keys(y);let g=y;return Object.keys(u).forEach(v=>{const h=Ko(u[v],o);if(h!=null)if(typeof h=="object")if(c[v])g=We(g,e(v,h,o,c));else{const a=Ee({theme:o},h,b=>({[v]:b}));Yo(a,h)?g[v]=t({sx:h,theme:o,nested:!0}):g=We(g,a)}else g=We(g,e(v,h,o,c))}),!i&&o.modularCssLayers?{"@layer sx":wr(o,Cr(d,g))}:wr(o,Cr(d,g))}return Array.isArray(n)?n.map(l):l(n)}return t}const Le=qo();Le.filterProps=["sx"];function Ho(e){for(var t=0,r,n=0,o=e.length;o>=4;++n,o-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var Jo={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function Xo(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var Qo=/[A-Z]|^ms/g,Zo=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Xr=function(t){return t.charCodeAt(1)===45},Tr=function(t){return t!=null&&typeof t!="boolean"},kt=Xo(function(e){return Xr(e)?e:e.replace(Qo,"-$&").toLowerCase()}),_r=function(t,r){switch(t){case"animation":case"animationName":if(typeof r=="string")return r.replace(Zo,function(n,o,i){return we={name:o,styles:i,next:we},o})}return Jo[t]!==1&&!Xr(t)&&typeof r=="number"&&r!==0?r+"px":r};function ct(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var o=r;if(o.anim===1)return we={name:o.name,styles:o.styles,next:we},o.name;var i=r;if(i.styles!==void 0){var c=i.next;if(c!==void 0)for(;c!==void 0;)we={name:c.name,styles:c.styles,next:we},c=c.next;var l=i.styles+";";return l}return ei(e,t,r)}}var f=r;return f}function ei(e,t,r){var n="";if(Array.isArray(r))for(var o=0;o<r.length;o++)n+=ct(e,t,r[o])+";";else for(var i in r){var c=r[i];if(typeof c!="object"){var l=c;Tr(l)&&(n+=kt(i)+":"+_r(i,l)+";")}else if(Array.isArray(c)&&typeof c[0]=="string"&&t==null)for(var f=0;f<c.length;f++)Tr(c[f])&&(n+=kt(i)+":"+_r(i,c[f])+";");else{var u=ct(e,t,c);switch(i){case"animation":case"animationName":{n+=kt(i)+":"+u+";";break}default:n+=i+"{"+u+"}"}}}return n}var Rr=/label:\s*([^\s;{]+)\s*(;|$)/g,we;function ti(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,o="";we=void 0;var i=e[0];if(i==null||i.raw===void 0)n=!1,o+=ct(r,t,i);else{var c=i;o+=c[0]}for(var l=1;l<e.length;l++)if(o+=ct(r,t,e[l]),n){var f=i;o+=f[l]}Rr.lastIndex=0;for(var u="",y;(y=Rr.exec(o))!==null;)u+="-"+y[1];var d=Ho(o)+u;return{name:d,styles:o,next:we}}function ri(e,t){const r=Pn(e,t);return process.env.NODE_ENV!=="production"?(...n)=>{const o=typeof e=="string"?`"${e}"`:"component";return n.length===0?console.error([`MUI: Seems like you called \`styled(${o})()\` without a \`style\` argument.`,'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join(`
|
|
7
|
+
`)):n.some(i=>i===void 0)&&console.error(`MUI: the styled(${o})(...args) API requires all its args to be defined.`),r(...n)}:r}function ni(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}const Or=[];function Re(e){return Or[0]=e,ti(Or)}const oi=e=>{const t=Object.keys(e).map(r=>({key:r,val:e[r]}))||[];return t.sort((r,n)=>r.val-n.val),t.reduce((r,n)=>({...r,[n.key]:n.val}),{})};function ii(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:n=5,...o}=e,i=oi(t),c=Object.keys(i);function l(g){return`@media (min-width:${typeof t[g]=="number"?t[g]:g}${r})`}function f(g){return`@media (max-width:${(typeof t[g]=="number"?t[g]:g)-n/100}${r})`}function u(g,v){const h=c.indexOf(v);return`@media (min-width:${typeof t[g]=="number"?t[g]:g}${r}) and (max-width:${(h!==-1&&typeof t[c[h]]=="number"?t[c[h]]:v)-n/100}${r})`}function y(g){return c.indexOf(g)+1<c.length?u(g,c[c.indexOf(g)+1]):l(g)}function d(g){const v=c.indexOf(g);return v===0?l(c[1]):v===c.length-1?f(c[v]):u(g,c[c.indexOf(g)+1]).replace("@media","@media not all and")}return{keys:c,values:i,up:l,down:f,between:u,only:y,not:d,unit:r,...o}}const si={borderRadius:4};function Qr(e=8,t=qt({spacing:e})){if(e.mui)return e;const r=(...n)=>(process.env.NODE_ENV!=="production"&&(n.length<=4||console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${n.length}`)),(n.length===0?[1]:n).map(i=>{const c=t(i);return typeof c=="number"?`${c}px`:c}).join(" "));return r.mui=!0,r}function ai(e,t){const r=this;if(r.vars){if(!r.colorSchemes?.[e]||typeof r.getColorSchemeSelector!="function")return{};let n=r.getColorSchemeSelector(e);return n==="&"?t:((n.includes("data-")||n.includes("."))&&(n=`*:where(${n.replace(/\s*&$/,"")}) &`),{[n]:t})}return r.palette.mode===e?t:{}}function Zr(e={},...t){const{breakpoints:r={},palette:n={},spacing:o,shape:i={},...c}=e,l=ii(r),f=Qr(o);let u=fe({breakpoints:l,direction:"ltr",components:{},palette:{mode:"light",...n},spacing:f,shape:{...si,...i}},c);return u=io(u),u.applyStyles=ai,u=t.reduce((y,d)=>fe(y,d),u),u.unstable_sxConfig={...bt,...c?.unstable_sxConfig},u.unstable_sx=function(d){return Le({sx:d,theme:this})},u}function en(e){const{variants:t,...r}=e,n={variants:t,style:Re(r),isProcessed:!0};return n.style===r||t&&t.forEach(o=>{typeof o.style!="function"&&(o.style=Re(o.style))}),n}const ci=Zr();function Pt(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function _e(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function li(e){return e?(t,r)=>r[e]:null}function ui(e,t,r){e.theme=mi(e.theme)?r:e.theme[t]||e.theme}function nt(e,t,r){const n=typeof t=="function"?t(e):t;if(Array.isArray(n))return n.flatMap(o=>nt(e,o,r));if(Array.isArray(n?.variants)){let o;if(n.isProcessed)o=r?_e(n.style,r):n.style;else{const{variants:i,...c}=n;o=r?_e(Re(c),r):c}return tn(e,n.variants,[o],r)}return n?.isProcessed?r?_e(Re(n.style),r):n.style:r?_e(Re(n),r):n}function tn(e,t,r=[],n=void 0){let o;e:for(let i=0;i<t.length;i+=1){const c=t[i];if(typeof c.props=="function"){if(o??={...e,...e.ownerState,ownerState:e.ownerState},!c.props(o))continue}else for(const l in c.props)if(e[l]!==c.props[l]&&e.ownerState?.[l]!==c.props[l])continue e;typeof c.style=="function"?(o??={...e,...e.ownerState,ownerState:e.ownerState},r.push(n?_e(Re(c.style(o)),n):c.style(o))):r.push(n?_e(Re(c.style),n):c.style)}return r}function fi(e={}){const{themeId:t,defaultTheme:r=ci,rootShouldForwardProp:n=Pt,slotShouldForwardProp:o=Pt}=e;function i(l){ui(l,t,r)}return(l,f={})=>{ni(l,E=>E.filter(k=>k!==Le));const{name:u,slot:y,skipVariantsResolver:d,skipSx:g,overridesResolver:v=li(rn(y)),...h}=f,a=u&&u.startsWith("Mui")||y?"components":"custom",b=d!==void 0?d:y&&y!=="Root"&&y!=="root"||!1,x=g||!1;let T=Pt;y==="Root"||y==="root"?T=n:y?T=o:gi(l)&&(T=void 0);const C=ri(l,{shouldForwardProp:T,label:pi(u,y),...h}),m=E=>{if(E.__emotion_real===E)return E;if(typeof E=="function")return function(N){return nt(N,E,N.theme.modularCssLayers?a:void 0)};if(ve(E)){const k=en(E);return function(P){return k.variants?nt(P,k,P.theme.modularCssLayers?a:void 0):P.theme.modularCssLayers?_e(k.style,a):k.style}}return E},p=(...E)=>{const k=[],N=E.map(m),P=[];if(k.push(i),u&&v&&P.push(function(G){const oe=G.theme.components?.[u]?.styleOverrides;if(!oe)return null;const ce={};for(const he in oe)ce[he]=nt(G,oe[he],G.theme.modularCssLayers?"theme":void 0);return v(G,ce)}),u&&!b&&P.push(function(G){const oe=G.theme?.components?.[u]?.variants;return oe?tn(G,oe,[],G.theme.modularCssLayers?"theme":void 0):null}),x||P.push(Le),Array.isArray(N[0])){const L=N.shift(),G=new Array(k.length).fill(""),ae=new Array(P.length).fill("");let oe;oe=[...G,...L,...ae],oe.raw=[...G,...L.raw,...ae],k.unshift(oe)}const s=[...k,...N,...P],$=C(...s);return l.muiName&&($.muiName=l.muiName),process.env.NODE_ENV!=="production"&&($.displayName=di(u,y,l)),$};return C.withConfig&&(p.withConfig=C.withConfig),p}}function di(e,t,r){return e?`${e}${Oe(t||"")}`:`Styled(${Hn(r)})`}function pi(e,t){let r;return process.env.NODE_ENV!=="production"&&e&&(r=`${e}-${rn(t||"Root")}`),r}function mi(e){for(const t in e)return!1;return!0}function gi(e){return typeof e=="string"&&e.charCodeAt(0)>96}function rn(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}function Jt(e,t=0,r=1){return process.env.NODE_ENV!=="production"&&(e<t||e>r)&&console.error(`MUI: The value provided ${e} is out of range [${t}, ${r}].`),to(e,t,r)}function hi(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let r=e.match(t);return r&&r[0].length===1&&(r=r.map(n=>n+n)),process.env.NODE_ENV!=="production"&&e.length!==e.trim().length&&console.error(`MUI: The color: "${e}" is invalid. Make sure the color input doesn't contain leading/trailing space.`),r?`rgb${r.length===4?"a":""}(${r.map((n,o)=>o<3?parseInt(n,16):Math.round(parseInt(n,16)/255*1e3)/1e3).join(", ")})`:""}function xe(e){if(e.type)return e;if(e.charAt(0)==="#")return xe(hi(e));const t=e.indexOf("("),r=e.substring(0,t);if(!["rgb","rgba","hsl","hsla","color"].includes(r))throw new Error(process.env.NODE_ENV!=="production"?`MUI: Unsupported \`${e}\` color.
|
|
8
8
|
The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:Ce(9,e));let n=e.substring(t+1,e.length-1),o;if(r==="color"){if(n=n.split(" "),o=n.shift(),n.length===4&&n[3].charAt(0)==="/"&&(n[3]=n[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(o))throw new Error(process.env.NODE_ENV!=="production"?`MUI: unsupported \`${o}\` color space.
|
|
9
|
-
The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:Ce(10,o))}else n=n.split(",");return n=n.map(i=>parseFloat(i)),{type:r,values:n,colorSpace:o}}const yi=e=>{const t=xe(e);return t.values.slice(0,3).map((r,n)=>t.type.includes("hsl")&&n!==0?`${r}%`:r).join(" ")},ze=(e,t)=>{try{return yi(e)}catch{return t&&process.env.NODE_ENV!=="production"&&console.warn(t),e}};function vt(e){const{type:t,colorSpace:r}=e;let{values:n}=e;return t.includes("rgb")?n=n.map((o,i)=>i<3?parseInt(o,10):o):t.includes("hsl")&&(n[1]=`${n[1]}%`,n[2]=`${n[2]}%`),t.includes("color")?n=`${r} ${n.join(" ")}`:n=`${n.join(", ")}`,`${t}(${n})`}function nn(e){e=xe(e);const{values:t}=e,r=t[0],n=t[1]/100,o=t[2]/100,i=n*Math.min(o,1-o),
|
|
10
|
-
`))}return
|
|
11
|
-
The color object needs to have a \`main\` property or a \`${
|
|
12
|
-
\`color.main\` should be a string, but \`${JSON.stringify(
|
|
9
|
+
The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:Ce(10,o))}else n=n.split(",");return n=n.map(i=>parseFloat(i)),{type:r,values:n,colorSpace:o}}const yi=e=>{const t=xe(e);return t.values.slice(0,3).map((r,n)=>t.type.includes("hsl")&&n!==0?`${r}%`:r).join(" ")},ze=(e,t)=>{try{return yi(e)}catch{return t&&process.env.NODE_ENV!=="production"&&console.warn(t),e}};function vt(e){const{type:t,colorSpace:r}=e;let{values:n}=e;return t.includes("rgb")?n=n.map((o,i)=>i<3?parseInt(o,10):o):t.includes("hsl")&&(n[1]=`${n[1]}%`,n[2]=`${n[2]}%`),t.includes("color")?n=`${r} ${n.join(" ")}`:n=`${n.join(", ")}`,`${t}(${n})`}function nn(e){e=xe(e);const{values:t}=e,r=t[0],n=t[1]/100,o=t[2]/100,i=n*Math.min(o,1-o),c=(u,y=(u+r/30)%12)=>o-i*Math.max(Math.min(y-3,9-y,1),-1);let l="rgb";const f=[Math.round(c(0)*255),Math.round(c(8)*255),Math.round(c(4)*255)];return e.type==="hsla"&&(l+="a",f.push(t[3])),vt({type:l,values:f})}function Ft(e){e=xe(e);let t=e.type==="hsl"||e.type==="hsla"?xe(nn(e)).values:e.values;return t=t.map(r=>(e.type!=="color"&&(r/=255),r<=.03928?r/12.92:((r+.055)/1.055)**2.4)),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function Ir(e,t){const r=Ft(e),n=Ft(t);return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}function Si(e,t){return e=xe(e),t=Jt(t),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${t}`:e.values[3]=t,vt(e)}function tt(e,t,r){try{return Si(e,t)}catch{return e}}function Xt(e,t){if(e=xe(e),t=Jt(t),e.type.includes("hsl"))e.values[2]*=1-t;else if(e.type.includes("rgb")||e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]*=1-t;return vt(e)}function X(e,t,r){try{return Xt(e,t)}catch{return e}}function Qt(e,t){if(e=xe(e),t=Jt(t),e.type.includes("hsl"))e.values[2]+=(100-e.values[2])*t;else if(e.type.includes("rgb"))for(let r=0;r<3;r+=1)e.values[r]+=(255-e.values[r])*t;else if(e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]+=(1-e.values[r])*t;return vt(e)}function Q(e,t,r){try{return Qt(e,t)}catch{return e}}function bi(e,t=.15){return Ft(e)>.5?Xt(e,t):Qt(e,t)}function rt(e,t,r){try{return bi(e,t)}catch{return e}}const vi=Ae.createContext(void 0);process.env.NODE_ENV!=="production"&&(W.node,W.object);function Ei(e){const{theme:t,name:r,props:n}=e;if(!t||!t.components||!t.components[r])return n;const o=t.components[r];return o.defaultProps?Bt(o.defaultProps,n):!o.styleOverrides&&!o.variants?Bt(o,n):n}function wi({props:e,name:t}){const r=Ae.useContext(vi);return Ei({props:e,name:t,theme:{components:r}})}const $r={theme:void 0};function Ai(e){let t,r;return function(o){let i=t;return(i===void 0||o.theme!==r)&&($r.theme=o.theme,i=en(e($r)),t=i,r=o.theme),i}}function Ci(e=""){function t(...n){if(!n.length)return"";const o=n[0];return typeof o=="string"&&!o.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, var(--${e?`${e}-`:""}${o}${t(...n.slice(1))})`:`, ${o}`}return(n,...o)=>`var(--${e?`${e}-`:""}${n}${t(...o)})`}const kr=(e,t,r,n=[])=>{let o=e;t.forEach((i,c)=>{c===t.length-1?Array.isArray(o)?o[Number(i)]=r:o&&typeof o=="object"&&(o[i]=r):o&&typeof o=="object"&&(o[i]||(o[i]=n.includes(i)?[]:{}),o=o[i])})},xi=(e,t,r)=>{function n(o,i=[],c=[]){Object.entries(o).forEach(([l,f])=>{(!r||r&&!r([...i,l]))&&f!=null&&(typeof f=="object"&&Object.keys(f).length>0?n(f,[...i,l],Array.isArray(f)?[...c,l]:c):t([...i,l],f,c))})}n(e)},Ti=(e,t)=>typeof t=="number"?["lineHeight","fontWeight","opacity","zIndex"].some(n=>e.includes(n))||e[e.length-1].toLowerCase().includes("opacity")?t:`${t}px`:t;function Nt(e,t){const{prefix:r,shouldSkipGeneratingVar:n}=t||{},o={},i={},c={};return xi(e,(l,f,u)=>{if((typeof f=="string"||typeof f=="number")&&(!n||!n(l,f))){const y=`--${r?`${r}-`:""}${l.join("-")}`,d=Ti(l,f);Object.assign(o,{[y]:d}),kr(i,l,`var(${y})`,u),kr(c,l,`var(${y}, ${d})`,u)}},l=>l[0]==="vars"),{css:o,vars:i,varsWithDefaults:c}}function _i(e,t={}){const{getSelector:r=b,disableCssColorScheme:n,colorSchemeSelector:o}=t,{colorSchemes:i={},components:c,defaultColorScheme:l="light",...f}=e,{vars:u,css:y,varsWithDefaults:d}=Nt(f,t);let g=d;const v={},{[l]:h,...a}=i;if(Object.entries(a||{}).forEach(([C,m])=>{const{vars:p,css:E,varsWithDefaults:k}=Nt(m,t);g=fe(g,k),v[C]={css:E,vars:p}}),h){const{css:C,vars:m,varsWithDefaults:p}=Nt(h,t);g=fe(g,p),v[l]={css:C,vars:m}}function b(C,m){let p=o;if(o==="class"&&(p=".%s"),o==="data"&&(p="[data-%s]"),o?.startsWith("data-")&&!o.includes("%s")&&(p=`[${o}="%s"]`),C){if(p==="media")return e.defaultColorScheme===C?":root":{[`@media (prefers-color-scheme: ${i[C]?.palette?.mode||C})`]:{":root":m}};if(p)return e.defaultColorScheme===C?`:root, ${p.replace("%s",String(C))}`:p.replace("%s",String(C))}return":root"}return{vars:g,generateThemeVars:()=>{let C={...u};return Object.entries(v).forEach(([,{vars:m}])=>{C=fe(C,m)}),C},generateStyleSheets:()=>{const C=[],m=e.defaultColorScheme||"light";function p(N,P){Object.keys(P).length&&C.push(typeof N=="string"?{[N]:{...P}}:N)}p(r(void 0,{...y}),y);const{[m]:E,...k}=v;if(E){const{css:N}=E,P=i[m]?.palette?.mode,s=!n&&P?{colorScheme:P,...N}:{...N};p(r(m,{...s}),s)}return Object.entries(k).forEach(([N,{css:P}])=>{const s=i[N]?.palette?.mode,$=!n&&s?{colorScheme:s,...P}:{...P};p(r(N,{...$}),$)}),C}}}function Ri(e){return function(r){return e==="media"?(process.env.NODE_ENV!=="production"&&r!=="light"&&r!=="dark"&&console.error(`MUI: @media (prefers-color-scheme) supports only 'light' or 'dark', but receive '${r}'.`),`@media (prefers-color-scheme: ${r})`):e?e.startsWith("data-")&&!e.includes("%s")?`[${e}="${r}"] &`:e==="class"?`.${r} &`:e==="data"?`[data-${r}] &`:`${e.replace("%s",r)} &`:"&"}}const Ye={black:"#000",white:"#fff"},Oi={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},$e={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},ke={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},Fe={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},Pe={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},Ne={300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",700:"#0288d1",900:"#01579b"},Ue={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"};function on(){return{text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:Ye.white,default:Ye.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}}}const Ii=on();function sn(){return{text:{primary:Ye.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:Ye.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}}}const Pr=sn();function Nr(e,t,r,n){const o=n.light||n,i=n.dark||n*1.5;e[t]||(e.hasOwnProperty(r)?e[t]=e[r]:t==="light"?e.light=Qt(e.main,o):t==="dark"&&(e.dark=Xt(e.main,i)))}function $i(e="light"){return e==="dark"?{main:Pe[200],light:Pe[50],dark:Pe[400]}:{main:Pe[700],light:Pe[400],dark:Pe[800]}}function ki(e="light"){return e==="dark"?{main:$e[200],light:$e[50],dark:$e[400]}:{main:$e[500],light:$e[300],dark:$e[700]}}function Pi(e="light"){return e==="dark"?{main:ke[500],light:ke[300],dark:ke[700]}:{main:ke[700],light:ke[400],dark:ke[800]}}function Ni(e="light"){return e==="dark"?{main:Ne[400],light:Ne[300],dark:Ne[700]}:{main:Ne[700],light:Ne[500],dark:Ne[900]}}function Ui(e="light"){return e==="dark"?{main:Ue[400],light:Ue[300],dark:Ue[700]}:{main:Ue[800],light:Ue[500],dark:Ue[900]}}function Di(e="light"){return e==="dark"?{main:Fe[400],light:Fe[300],dark:Fe[700]}:{main:"#ed6c02",light:Fe[500],dark:Fe[900]}}function Zt(e){const{mode:t="light",contrastThreshold:r=3,tonalOffset:n=.2,...o}=e,i=e.primary||$i(t),c=e.secondary||ki(t),l=e.error||Pi(t),f=e.info||Ni(t),u=e.success||Ui(t),y=e.warning||Di(t);function d(a){const b=Ir(a,Pr.text.primary)>=r?Pr.text.primary:Ii.text.primary;if(process.env.NODE_ENV!=="production"){const x=Ir(a,b);x<3&&console.error([`MUI: The contrast ratio of ${x}:1 for ${b} on ${a}`,"falls below the WCAG recommended absolute minimum contrast ratio of 3:1.","https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast"].join(`
|
|
10
|
+
`))}return b}const g=({color:a,name:b,mainShade:x=500,lightShade:T=300,darkShade:C=700})=>{if(a={...a},!a.main&&a[x]&&(a.main=a[x]),!a.hasOwnProperty("main"))throw new Error(process.env.NODE_ENV!=="production"?`MUI: The color${b?` (${b})`:""} provided to augmentColor(color) is invalid.
|
|
11
|
+
The color object needs to have a \`main\` property or a \`${x}\` property.`:Ce(11,b?` (${b})`:"",x));if(typeof a.main!="string")throw new Error(process.env.NODE_ENV!=="production"?`MUI: The color${b?` (${b})`:""} provided to augmentColor(color) is invalid.
|
|
12
|
+
\`color.main\` should be a string, but \`${JSON.stringify(a.main)}\` was provided instead.
|
|
13
13
|
|
|
14
14
|
Did you intend to use one of the following approaches?
|
|
15
15
|
|
|
@@ -21,15 +21,15 @@ const theme1 = createTheme({ palette: {
|
|
|
21
21
|
|
|
22
22
|
const theme2 = createTheme({ palette: {
|
|
23
23
|
primary: { main: green[500] },
|
|
24
|
-
} });`:Ce(12,
|
|
25
|
-
`)),Object.keys(u).length!==0&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(u).join(",")}].`)}return(Array.isArray(o)?o:[o]).map(
|
|
24
|
+
} });`:Ce(12,b?` (${b})`:"",JSON.stringify(a.main)));return Nr(a,"light",T,n),Nr(a,"dark",C,n),a.contrastText||(a.contrastText=d(a.main)),a};let v;return t==="light"?v=on():t==="dark"&&(v=sn()),process.env.NODE_ENV!=="production"&&(v||console.error(`MUI: The palette mode \`${t}\` is not supported.`)),fe({common:{...Ye},mode:t,primary:g({color:i,name:"primary"}),secondary:g({color:c,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:g({color:l,name:"error"}),warning:g({color:y,name:"warning"}),info:g({color:f,name:"info"}),success:g({color:u,name:"success"}),grey:Oi,contrastThreshold:r,getContrastText:d,augmentColor:g,tonalOffset:n,...v},o)}function Mi(e){const t={};return Object.entries(e).forEach(n=>{const[o,i]=n;typeof i=="object"&&(t[o]=`${i.fontStyle?`${i.fontStyle} `:""}${i.fontVariant?`${i.fontVariant} `:""}${i.fontWeight?`${i.fontWeight} `:""}${i.fontStretch?`${i.fontStretch} `:""}${i.fontSize||""}${i.lineHeight?`/${i.lineHeight} `:""}${i.fontFamily||""}`)}),t}function ji(e,t){return{toolbar:{minHeight:56,[e.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[e.up("sm")]:{minHeight:64}},...t}}function Li(e){return Math.round(e*1e5)/1e5}const Ur={textTransform:"uppercase"},Dr='"Roboto", "Helvetica", "Arial", sans-serif';function Bi(e,t){const{fontFamily:r=Dr,fontSize:n=14,fontWeightLight:o=300,fontWeightRegular:i=400,fontWeightMedium:c=500,fontWeightBold:l=700,htmlFontSize:f=16,allVariants:u,pxToRem:y,...d}=typeof t=="function"?t(e):t;process.env.NODE_ENV!=="production"&&(typeof n!="number"&&console.error("MUI: `fontSize` is required to be a number."),typeof f!="number"&&console.error("MUI: `htmlFontSize` is required to be a number."));const g=n/14,v=y||(b=>`${b/f*g}rem`),h=(b,x,T,C,m)=>({fontFamily:r,fontWeight:b,fontSize:v(x),lineHeight:T,...r===Dr?{letterSpacing:`${Li(C/x)}em`}:{},...m,...u}),a={h1:h(o,96,1.167,-1.5),h2:h(o,60,1.2,-.5),h3:h(i,48,1.167,0),h4:h(i,34,1.235,.25),h5:h(i,24,1.334,0),h6:h(c,20,1.6,.15),subtitle1:h(i,16,1.75,.15),subtitle2:h(c,14,1.57,.1),body1:h(i,16,1.5,.15),body2:h(i,14,1.43,.15),button:h(c,14,1.75,.4,Ur),caption:h(i,12,1.66,.4),overline:h(i,12,2.66,1,Ur),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return fe({htmlFontSize:f,pxToRem:v,fontFamily:r,fontSize:n,fontWeightLight:o,fontWeightRegular:i,fontWeightMedium:c,fontWeightBold:l,...a},d,{clone:!1})}const Fi=.2,zi=.14,Vi=.12;function Z(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${Fi})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${zi})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${Vi})`].join(",")}const Wi=["none",Z(0,2,1,-1,0,1,1,0,0,1,3,0),Z(0,3,1,-2,0,2,2,0,0,1,5,0),Z(0,3,3,-2,0,3,4,0,0,1,8,0),Z(0,2,4,-1,0,4,5,0,0,1,10,0),Z(0,3,5,-1,0,5,8,0,0,1,14,0),Z(0,3,5,-1,0,6,10,0,0,1,18,0),Z(0,4,5,-2,0,7,10,1,0,2,16,1),Z(0,5,5,-3,0,8,10,1,0,3,14,2),Z(0,5,6,-3,0,9,12,1,0,3,16,2),Z(0,6,6,-3,0,10,14,1,0,4,18,3),Z(0,6,7,-4,0,11,15,1,0,4,20,3),Z(0,7,8,-4,0,12,17,2,0,5,22,4),Z(0,7,8,-4,0,13,19,2,0,5,24,4),Z(0,7,9,-4,0,14,21,2,0,5,26,4),Z(0,8,9,-5,0,15,22,2,0,6,28,5),Z(0,8,10,-5,0,16,24,2,0,6,30,5),Z(0,8,11,-5,0,17,26,2,0,6,32,5),Z(0,9,11,-5,0,18,28,2,0,7,34,6),Z(0,9,12,-6,0,19,29,2,0,7,36,6),Z(0,10,13,-6,0,20,31,3,0,8,38,7),Z(0,10,13,-6,0,21,33,3,0,8,40,7),Z(0,10,14,-6,0,22,35,3,0,8,42,7),Z(0,11,14,-7,0,23,36,3,0,9,44,8),Z(0,11,15,-7,0,24,38,3,0,9,46,8)],Gi={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},Yi={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function Mr(e){return`${Math.round(e)}ms`}function Ki(e){if(!e)return 0;const t=e/36;return Math.min(Math.round((4+15*t**.25+t/5)*10),3e3)}function qi(e){const t={...Gi,...e.easing},r={...Yi,...e.duration};return{getAutoHeightDuration:Ki,create:(o=["all"],i={})=>{const{duration:c=r.standard,easing:l=t.easeInOut,delay:f=0,...u}=i;if(process.env.NODE_ENV!=="production"){const y=g=>typeof g=="string",d=g=>!Number.isNaN(parseFloat(g));!y(o)&&!Array.isArray(o)&&console.error('MUI: Argument "props" must be a string or Array.'),!d(c)&&!y(c)&&console.error(`MUI: Argument "duration" must be a number or a string but found ${c}.`),y(l)||console.error('MUI: Argument "easing" must be a string.'),!d(f)&&!y(f)&&console.error('MUI: Argument "delay" must be a number or a string.'),typeof i!="object"&&console.error(["MUI: Secong argument of transition.create must be an object.","Arguments should be either `create('prop1', options)` or `create(['prop1', 'prop2'], options)`"].join(`
|
|
25
|
+
`)),Object.keys(u).length!==0&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(u).join(",")}].`)}return(Array.isArray(o)?o:[o]).map(y=>`${y} ${typeof c=="string"?c:Mr(c)} ${l} ${typeof f=="string"?f:Mr(f)}`).join(",")},...e,easing:t,duration:r}}const Hi={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function Ji(e){return ve(e)||typeof e>"u"||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||Array.isArray(e)}function an(e={}){const t={...e};function r(n){const o=Object.entries(n);for(let i=0;i<o.length;i++){const[c,l]=o[i];!Ji(l)||c.startsWith("unstable_")?delete n[c]:ve(l)&&(n[c]={...l},r(n[c]))}}return r(t),`import { unstable_createBreakpoints as createBreakpoints, createTransitions } from '@mui/material/styles';
|
|
26
26
|
|
|
27
27
|
const theme = ${JSON.stringify(t,null,2)};
|
|
28
28
|
|
|
29
29
|
theme.breakpoints = createBreakpoints(theme.breakpoints || {});
|
|
30
30
|
theme.transitions = createTransitions(theme.transitions || {});
|
|
31
31
|
|
|
32
|
-
export default theme;`}function zt(e={},...t){const{breakpoints:r,mixins:n={},spacing:o,palette:i={},transitions:
|
|
33
|
-
`))}
|
|
34
|
-
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 os(e){return typeof e=="number"?`${e}px`:typeof e=="string"||typeof e=="function"||Array.isArray(e)?e:"8px"}const ye=e=>{try{return e()}catch{}},is=(e="mui")=>Ci(e);function Ut(e,t,r,n){if(!t)return;t=t===!0?{}:t;const o=n==="dark"?"dark":"light";if(!r){e[n]=Zi({...t,palette:{mode:o,...t?.palette}});return}const{palette:i,...s}=zt({...r,palette:{mode:o,...t?.palette}});return e[n]={...t,palette:i,opacity:{...cn(o),...t?.opacity},overlays:t?.overlays||ln(o)},s}function ss(e={},...t){const{colorSchemes:r={light:!0},defaultColorScheme:n,disableCssColorScheme:o=!1,cssVarPrefix:i="mui",shouldSkipGeneratingVar:s=es,colorSchemeSelector:l=r.light&&r.dark?"media":void 0,rootSelector:f=":root",...u}=e,h=Object.keys(r)[0],d=n||(r.light&&h!=="light"?"light":h),m=is(i),{[d]:E,light:S,dark:c,...v}=r,C={...v};let x=E;if((d==="dark"&&!("dark"in r)||d==="light"&&!("light"in r))&&(x=!0),!x)throw new Error(process.env.NODE_ENV!=="production"?`MUI: The \`colorSchemes.${d}\` option is either missing or invalid.`:Ce(21,d));const y=Ut(C,x,u,d);S&&!C.light&&Ut(C,S,void 0,"light"),c&&!C.dark&&Ut(C,c,void 0,"dark");let g={defaultColorScheme:d,...y,cssVarPrefix:i,colorSchemeSelector:l,rootSelector:f,getCssVar:m,colorSchemes:C,font:{...Mi(y.typography),...y.font},spacing:os(u.spacing)};Object.keys(g.colorSchemes).forEach(k=>{const a=g.colorSchemes[k].palette,I=G=>{const W=G.split("-"),se=W[1],oe=W[2];return m(G,a[se][oe])};if(a.mode==="light"&&(b(a.common,"background","#fff"),b(a.common,"onBackground","#000")),a.mode==="dark"&&(b(a.common,"background","#000"),b(a.common,"onBackground","#fff")),ns(a,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),a.mode==="light"){b(a.Alert,"errorColor",X(a.error.light,.6)),b(a.Alert,"infoColor",X(a.info.light,.6)),b(a.Alert,"successColor",X(a.success.light,.6)),b(a.Alert,"warningColor",X(a.warning.light,.6)),b(a.Alert,"errorFilledBg",I("palette-error-main")),b(a.Alert,"infoFilledBg",I("palette-info-main")),b(a.Alert,"successFilledBg",I("palette-success-main")),b(a.Alert,"warningFilledBg",I("palette-warning-main")),b(a.Alert,"errorFilledColor",ye(()=>a.getContrastText(a.error.main))),b(a.Alert,"infoFilledColor",ye(()=>a.getContrastText(a.info.main))),b(a.Alert,"successFilledColor",ye(()=>a.getContrastText(a.success.main))),b(a.Alert,"warningFilledColor",ye(()=>a.getContrastText(a.warning.main))),b(a.Alert,"errorStandardBg",Q(a.error.light,.9)),b(a.Alert,"infoStandardBg",Q(a.info.light,.9)),b(a.Alert,"successStandardBg",Q(a.success.light,.9)),b(a.Alert,"warningStandardBg",Q(a.warning.light,.9)),b(a.Alert,"errorIconColor",I("palette-error-main")),b(a.Alert,"infoIconColor",I("palette-info-main")),b(a.Alert,"successIconColor",I("palette-success-main")),b(a.Alert,"warningIconColor",I("palette-warning-main")),b(a.AppBar,"defaultBg",I("palette-grey-100")),b(a.Avatar,"defaultBg",I("palette-grey-400")),b(a.Button,"inheritContainedBg",I("palette-grey-300")),b(a.Button,"inheritContainedHoverBg",I("palette-grey-A100")),b(a.Chip,"defaultBorder",I("palette-grey-400")),b(a.Chip,"defaultAvatarColor",I("palette-grey-700")),b(a.Chip,"defaultIconColor",I("palette-grey-700")),b(a.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),b(a.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),b(a.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),b(a.LinearProgress,"primaryBg",Q(a.primary.main,.62)),b(a.LinearProgress,"secondaryBg",Q(a.secondary.main,.62)),b(a.LinearProgress,"errorBg",Q(a.error.main,.62)),b(a.LinearProgress,"infoBg",Q(a.info.main,.62)),b(a.LinearProgress,"successBg",Q(a.success.main,.62)),b(a.LinearProgress,"warningBg",Q(a.warning.main,.62)),b(a.Skeleton,"bg",`rgba(${I("palette-text-primaryChannel")} / 0.11)`),b(a.Slider,"primaryTrack",Q(a.primary.main,.62)),b(a.Slider,"secondaryTrack",Q(a.secondary.main,.62)),b(a.Slider,"errorTrack",Q(a.error.main,.62)),b(a.Slider,"infoTrack",Q(a.info.main,.62)),b(a.Slider,"successTrack",Q(a.success.main,.62)),b(a.Slider,"warningTrack",Q(a.warning.main,.62));const G=rt(a.background.default,.8);b(a.SnackbarContent,"bg",G),b(a.SnackbarContent,"color",ye(()=>a.getContrastText(G))),b(a.SpeedDialAction,"fabHoverBg",rt(a.background.paper,.15)),b(a.StepConnector,"border",I("palette-grey-400")),b(a.StepContent,"border",I("palette-grey-400")),b(a.Switch,"defaultColor",I("palette-common-white")),b(a.Switch,"defaultDisabledColor",I("palette-grey-100")),b(a.Switch,"primaryDisabledColor",Q(a.primary.main,.62)),b(a.Switch,"secondaryDisabledColor",Q(a.secondary.main,.62)),b(a.Switch,"errorDisabledColor",Q(a.error.main,.62)),b(a.Switch,"infoDisabledColor",Q(a.info.main,.62)),b(a.Switch,"successDisabledColor",Q(a.success.main,.62)),b(a.Switch,"warningDisabledColor",Q(a.warning.main,.62)),b(a.TableCell,"border",Q(tt(a.divider,1),.88)),b(a.Tooltip,"bg",tt(a.grey[700],.92))}if(a.mode==="dark"){b(a.Alert,"errorColor",Q(a.error.light,.6)),b(a.Alert,"infoColor",Q(a.info.light,.6)),b(a.Alert,"successColor",Q(a.success.light,.6)),b(a.Alert,"warningColor",Q(a.warning.light,.6)),b(a.Alert,"errorFilledBg",I("palette-error-dark")),b(a.Alert,"infoFilledBg",I("palette-info-dark")),b(a.Alert,"successFilledBg",I("palette-success-dark")),b(a.Alert,"warningFilledBg",I("palette-warning-dark")),b(a.Alert,"errorFilledColor",ye(()=>a.getContrastText(a.error.dark))),b(a.Alert,"infoFilledColor",ye(()=>a.getContrastText(a.info.dark))),b(a.Alert,"successFilledColor",ye(()=>a.getContrastText(a.success.dark))),b(a.Alert,"warningFilledColor",ye(()=>a.getContrastText(a.warning.dark))),b(a.Alert,"errorStandardBg",X(a.error.light,.9)),b(a.Alert,"infoStandardBg",X(a.info.light,.9)),b(a.Alert,"successStandardBg",X(a.success.light,.9)),b(a.Alert,"warningStandardBg",X(a.warning.light,.9)),b(a.Alert,"errorIconColor",I("palette-error-main")),b(a.Alert,"infoIconColor",I("palette-info-main")),b(a.Alert,"successIconColor",I("palette-success-main")),b(a.Alert,"warningIconColor",I("palette-warning-main")),b(a.AppBar,"defaultBg",I("palette-grey-900")),b(a.AppBar,"darkBg",I("palette-background-paper")),b(a.AppBar,"darkColor",I("palette-text-primary")),b(a.Avatar,"defaultBg",I("palette-grey-600")),b(a.Button,"inheritContainedBg",I("palette-grey-800")),b(a.Button,"inheritContainedHoverBg",I("palette-grey-700")),b(a.Chip,"defaultBorder",I("palette-grey-700")),b(a.Chip,"defaultAvatarColor",I("palette-grey-300")),b(a.Chip,"defaultIconColor",I("palette-grey-300")),b(a.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),b(a.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),b(a.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),b(a.LinearProgress,"primaryBg",X(a.primary.main,.5)),b(a.LinearProgress,"secondaryBg",X(a.secondary.main,.5)),b(a.LinearProgress,"errorBg",X(a.error.main,.5)),b(a.LinearProgress,"infoBg",X(a.info.main,.5)),b(a.LinearProgress,"successBg",X(a.success.main,.5)),b(a.LinearProgress,"warningBg",X(a.warning.main,.5)),b(a.Skeleton,"bg",`rgba(${I("palette-text-primaryChannel")} / 0.13)`),b(a.Slider,"primaryTrack",X(a.primary.main,.5)),b(a.Slider,"secondaryTrack",X(a.secondary.main,.5)),b(a.Slider,"errorTrack",X(a.error.main,.5)),b(a.Slider,"infoTrack",X(a.info.main,.5)),b(a.Slider,"successTrack",X(a.success.main,.5)),b(a.Slider,"warningTrack",X(a.warning.main,.5));const G=rt(a.background.default,.98);b(a.SnackbarContent,"bg",G),b(a.SnackbarContent,"color",ye(()=>a.getContrastText(G))),b(a.SpeedDialAction,"fabHoverBg",rt(a.background.paper,.15)),b(a.StepConnector,"border",I("palette-grey-600")),b(a.StepContent,"border",I("palette-grey-600")),b(a.Switch,"defaultColor",I("palette-grey-300")),b(a.Switch,"defaultDisabledColor",I("palette-grey-600")),b(a.Switch,"primaryDisabledColor",X(a.primary.main,.55)),b(a.Switch,"secondaryDisabledColor",X(a.secondary.main,.55)),b(a.Switch,"errorDisabledColor",X(a.error.main,.55)),b(a.Switch,"infoDisabledColor",X(a.info.main,.55)),b(a.Switch,"successDisabledColor",X(a.success.main,.55)),b(a.Switch,"warningDisabledColor",X(a.warning.main,.55)),b(a.TableCell,"border",X(tt(a.divider,1),.68)),b(a.Tooltip,"bg",tt(a.grey[700],.92))}Se(a.background,"default"),Se(a.background,"paper"),Se(a.common,"background"),Se(a.common,"onBackground"),Se(a,"divider"),Object.keys(a).forEach(G=>{const W=a[G];G!=="tonalOffset"&&W&&typeof W=="object"&&(W.main&&b(a[G],"mainChannel",ze(Ve(W.main))),W.light&&b(a[G],"lightChannel",ze(Ve(W.light))),W.dark&&b(a[G],"darkChannel",ze(Ve(W.dark))),W.contrastText&&b(a[G],"contrastTextChannel",ze(Ve(W.contrastText))),G==="text"&&(Se(a[G],"primary"),Se(a[G],"secondary")),G==="action"&&(W.active&&Se(a[G],"active"),W.selected&&Se(a[G],"selected")))})}),g=t.reduce((k,a)=>ue(k,a),g);const p={prefix:i,disableCssColorScheme:o,shouldSkipGeneratingVar:s,getSelector:rs(g)},{vars:R,generateThemeVars:U,generateStyleSheets:V}=_i(g,p);return g.vars=R,Object.entries(g.colorSchemes[g.defaultColorScheme]).forEach(([k,a])=>{g[k]=a}),g.generateThemeVars=U,g.generateStyleSheets=V,g.generateSpacing=function(){return Qr(u.spacing,qt(this))},g.getColorSchemeSelector=Ri(l),g.spacing=g.generateSpacing(),g.shouldSkipGeneratingVar=s,g.unstable_sxConfig={...bt,...u?.unstable_sxConfig},g.unstable_sx=function(a){return Le({sx:a,theme:this})},g.toRuntimeSource=an,g}function jr(e,t,r){e.colorSchemes&&r&&(e.colorSchemes[t]={...r!==!0&&r,palette:Zt({...r===!0?{}:r.palette,mode:t})})}function as(e={},...t){const{palette:r,cssVariables:n=!1,colorSchemes:o=r?void 0:{light:!0},defaultColorScheme:i=r?.mode,...s}=e,l=i||"light",f=o?.[l],u={...o,...r?{[l]:{...typeof f!="boolean"&&f,palette:r}}:void 0};if(n===!1){if(!("colorSchemes"in e))return zt(e,...t);let h=r;"palette"in e||u[l]&&(u[l]!==!0?h=u[l].palette:l==="dark"&&(h={mode:"dark"}));const d=zt({...e,palette:h},...t);return d.defaultColorScheme=l,d.colorSchemes=u,d.palette.mode==="light"&&(d.colorSchemes.light={...u.light!==!0&&u.light,palette:d.palette},jr(d,"dark",u.dark)),d.palette.mode==="dark"&&(d.colorSchemes.dark={...u.dark!==!0&&u.dark,palette:d.palette},jr(d,"light",u.light)),d}return!r&&!("light"in u)&&l==="light"&&(u.light=!0),ss({...s,colorSchemes:u,defaultColorScheme:l,...typeof n!="boolean"&&n},...t)}const cs=as(),ls="$$material";function us(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const fs=e=>us(e)&&e!=="classes",ds=fi({themeId:ls,defaultTheme:cs,rootShouldForwardProp:fs}),ps=Ai;process.env.NODE_ENV!=="production"&&(z.node,z.object.isRequired);function ms(e){return wi(e)}function gs(e){return Kt("MuiSvgIcon",e)}eo("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const hs=e=>{const{color:t,fontSize:r,classes:n}=e,o={root:["root",t!=="inherit"&&`color${Oe(t)}`,`fontSize${Oe(r)}`]};return Jn(o,gs,n)},ys=ds("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,r.color!=="inherit"&&t[`color${Oe(r.color)}`],t[`fontSize${Oe(r.fontSize)}`]]}})(ps(({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:t=>!t.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(([,t])=>t&&t.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}}]}))),lt=Ae.forwardRef(function(t,r){const n=ms({props:t,name:"MuiSvgIcon"}),{children:o,className:i,color:s="inherit",component:l="svg",fontSize:f="medium",htmlColor:u,inheritViewBox:h=!1,titleAccess:d,viewBox:m="0 0 24 24",...E}=n,S=Ae.isValidElement(o)&&o.type==="svg",c={...n,color:s,component:l,fontSize:f,instanceFontSize:t.fontSize,inheritViewBox:h,viewBox:m,hasSvgAsChild:S},v={};h||(v.viewBox=m);const C=hs(c);return w.jsxs(ys,{as:l,className:ro(C.root,i),focusable:"false",color:u,"aria-hidden":d?void 0:!0,role:d?"img":void 0,ref:r,...v,...E,...S&&o.props,ownerState:c,children:[S?o.props.children:o,d?w.jsx("title",{children:d}):null]})});process.env.NODE_ENV!=="production"&&(lt.propTypes={children:z.node,classes:z.object,className:z.string,color:z.oneOfType([z.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),z.string]),component:z.elementType,fontSize:z.oneOfType([z.oneOf(["inherit","large","medium","small"]),z.string]),htmlColor:z.string,inheritViewBox:z.bool,shapeRendering:z.string,sx:z.oneOfType([z.arrayOf(z.oneOfType([z.func,z.object,z.bool])),z.func,z.object]),titleAccess:z.string,viewBox:z.string});lt.muiName="SvgIcon";function un(e,t){function r(n,o){return w.jsx(lt,{"data-testid":`${t}Icon`,ref:o,...n,children:e})}return process.env.NODE_ENV!=="production"&&(r.displayName=`${t}Icon`),r.muiName=lt.muiName,Ae.memo(Ae.forwardRef(r))}const Ss=un(w.jsx("path",{d:"m17 7-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4z"}),"Logout"),fe={ACCOUNTS:"spry_accounts",BRIDGE_ACCOUNTS:"spry_accounts_shared_state",ADD_ACCOUNT_IN_PROGRESS:"spry_add_account_in_progress",RETURN_URL:"spry_return_url",TEMP_CURRENT_USER:"spry_temp_current_user"},He={ACCESS_TOKEN_BUFFER_SECONDS:60,REFRESH_TOKEN_BUFFER_SECONDS:300,STALE_CHECK_INTERVAL_MS:1e3},pe={INVALID_TOKEN:"Invalid or malformed token",TOKEN_DECODE_FAILED:"Failed to decode token",ACCOUNT_NOT_FOUND:"Account not found",SIGNIN_REDIRECT_FAILED:"Failed to initiate sign-in redirect",LOGOUT_FAILED:"Failed to logout from Keycloak, but account will be removed locally.",TOKEN_REFRESH_FAILED:"Failed to refresh token for account",SSO_CLEAR_FAILED:"Failed to clear SSO session. Please sign out first if prompted by Keycloak."},fn={LOCALSTORAGE_XSS_WARNING:"⚠️ Tokens stored in localStorage are vulnerable to XSS. Ensure CSP headers are configured.",ACCOUNT_MARKED_STALE:"Account refresh token expired. Click to re-authenticate.",NO_ACCOUNTS:"No additional accounts stored. Your primary auth remains active.",REDIRECT_IN_PROGRESS:"Redirecting to Keycloak for authentication..."},dn="https://sprylogin.com/apps-api/sync-bridge.html";function Be(e){try{const t=e.split(".");if(t.length!==3)return console.warn(pe.INVALID_TOKEN),null;const r=t[1];return JSON.parse(decodeURIComponent(atob(r).split("").map(o=>"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(t){return console.warn(pe.TOKEN_DECODE_FAILED,t),null}}function Et(e,t=He.ACCESS_TOKEN_BUFFER_SECONDS){if(!e)return!0;const r=Be(e);if(!r||typeof r.exp!="number")return!0;const n=r.exp*1e3,o=Date.now(),i=t*1e3;return o>=n-i}function er(e,t=He.REFRESH_TOKEN_BUFFER_SECONDS){if(!e)return!0;const r=Be(e);if(!r||typeof r.exp!="number")return!0;const n=r.exp*1e3,o=Date.now(),i=t*1e3;return o>=n-i}function bs(e){if(!e)return null;const t=Be(e);return!t||typeof t.exp!="number"?null:t.exp*1e3}function vs(e){if(!e)return-1;const t=Be(e);if(!t||typeof t.exp!="number")return-1;const r=t.exp*1e3,n=Date.now(),o=r-n;return Math.max(0,o/1e3)}function Me(e){const t=e.profile||{},r=t.email||"unknown@example.com",n=t.given_name,o=t.name||n||r.split("@")[0],i=t.picture;return{email:r,name:o,avatar:i}}function pn(e){return!!(e.isStale||er(e.user.refresh_token)||!e.user.refresh_token&&Et(e.user.access_token))}function Es(e){return Et(e,He.ACCESS_TOKEN_BUFFER_SECONDS)}function ws(e){return er(e,He.REFRESH_TOKEN_BUFFER_SECONDS)}function As(e){if(!e)return!1;const t=Be(e);if(!t||typeof t.exp!="number")return!1;const r=t.exp*1e3;return Date.now()<r}function Cs({account:e,isActive:t,isLoading:r,onSwitch:n,onRemove:o,onRefresh:i}){const{email:s,name:l,avatar:f}=Me(e.user),[u,h]=T.useState(!1),[d,m]=T.useState(!1),E=async v=>{v.stopPropagation(),h(!0);try{await o()}finally{h(!1)}},S=async v=>{v.stopPropagation(),m(!0);try{await i()}finally{m(!1)}},c=async()=>{r||await n()};return w.jsx(T.Fragment,{children:w.jsxs($.ListItemButton,{selected:t,onClick:c,disabled:r,sx:{opacity:t?1:.8,backgroundColor:t?"action.selected":"inherit","&:hover":{backgroundColor:t?"action.selected":"action.hover"}},children:[w.jsx($.ListItemIcon,{children:w.jsx($.Avatar,{src:f,alt:l,sx:{width:32,height:32,bgcolor:"primary.main",fontSize:"0.875rem"},children:l.charAt(0).toUpperCase()})}),w.jsx($.ListItemText,{primary:w.jsxs($.Box,{display:"flex",alignItems:"center",gap:1,children:[w.jsx("span",{children:l}),t&&w.jsx($.Chip,{label:"Active",size:"small",color:"primary",variant:"outlined",sx:{height:20}}),e.isStale&&!t&&w.jsx($.Chip,{label:"Stale",size:"small",color:"warning",variant:"filled",sx:{height:20}})]}),secondary:s,secondaryTypographyProps:{noWrap:!0}}),!t&&w.jsxs($.ListItemSecondaryAction,{children:[e.isStale&&w.jsx($.IconButton,{edge:"end",size:"small",onClick:S,disabled:d||r,title:"Re-authenticate this account",children:d?w.jsx($.CircularProgress,{size:20}):w.jsx(Lt.Refresh,{fontSize:"small"})}),w.jsx($.IconButton,{edge:"end",size:"small",onClick:E,disabled:u||r,title:"Remove this account",children:u?w.jsx($.CircularProgress,{size:20}):w.jsx(Lt.Close,{fontSize:"small"})})]})]})},e.accountId)}const tr=T.forwardRef(({accounts:e,activeAccountId:t,isLoading:r=!1,onSwitchAccount:n,onAddAccount:o,onRemoveAccount:i,onRefreshAccount:s},l)=>{const[f,u]=T.useState(!1),h=async()=>{u(!0);try{await o()}finally{u(!1)}};return w.jsx($.Box,{ref:l,sx:{width:"100%",maxWidth:360,bgcolor:"background.paper"},children:e.length===0?w.jsxs($.Box,{sx:{p:2,textAlign:"center"},children:[w.jsx($.Typography,{variant:"body2",color:"textSecondary",sx:{mb:2},children:"No additional accounts logged in"}),w.jsx("button",{onClick:h,disabled:f||r,style:{padding:"8px 16px",borderRadius:"4px",border:"1px solid #ccc",background:"#fff",cursor:"pointer"},children:f?"Adding Account...":"Add Account"})]}):w.jsxs(w.Fragment,{children:[w.jsx($.List,{children:e.map(d=>w.jsx(Cs,{account:d,isActive:d.accountId===t,isLoading:r,onSwitch:()=>n(d.accountId),onRemove:()=>i(d.accountId),onRefresh:()=>s(d.accountId)},d.accountId))}),w.jsx($.Divider,{sx:{my:1}}),w.jsx($.Box,{sx:{p:1},children:w.jsxs($.ListItemButton,{onClick:h,disabled:f||r,sx:{justifyContent:"center",py:1},children:[w.jsx(Lt.Add,{sx:{mr:1},fontSize:"small"}),w.jsx($.Typography,{variant:"button",sx:{fontSize:"0.875rem"},children:f?"Adding...":"Add Another Account"})]})})]})})});tr.displayName="AccountList";function mn({profile:e,isLoading:t,onSignOut:r,onManageAccount:n,accountManager:o}){const i="https://sprylogin.com/my-account/",[s,l]=T.useState(null),[f,u]=T.useState(!1),h=o?.accounts.length??0,d=g=>{l(g.currentTarget)},m=()=>{l(null),u(!1)},E=()=>{o&&o.activeAccount?o.removeAccount(o.activeAccount.accountId):(m(),r&&r()),m()},S=()=>{m(),n?n():e?.manageAccountUrl?window.location.href=e.manageAccountUrl:window.location.href=i},c=!!s,v=()=>{if(o?.activeAccount){const{name:g,email:p}=Me(o.activeAccount.user);if(g)return g.split(" ").map(R=>R[0]).join("").slice(0,2).toUpperCase();if(p)return p[0].toUpperCase()}return e?.firstName&&e?.lastName?`${e.firstName[0]}${e.lastName[0]}`.toUpperCase():e?.firstName?e.firstName[0].toUpperCase():e?.email?e.email[0].toUpperCase():"?"},C=()=>{if(o?.activeAccount){const{name:g}=Me(o.activeAccount.user);return g}return e?.firstName&&e?.lastName?`${e.firstName} ${e.lastName}`:e?.firstName?e.firstName:e?.email?e.email.split("@")[0]:"User"},x=()=>{if(o?.activeAccount){const{email:g}=Me(o.activeAccount.user);return g}return e?.email||"No email"},y=()=>{if(o?.activeAccount){const{avatar:g}=Me(o.activeAccount.user);return g||null}return e?.avatar||null};return w.jsxs(w.Fragment,{children:[w.jsx($.IconButton,{onClick:d,sx:{p:.5,"&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},disabled:t&&!e,children:t&&!e?w.jsx($.CircularProgress,{size:32}):w.jsx($.Avatar,{src:y()||void 0,sx:{width:32,height:32,bgcolor:"#1a73e8",fontSize:"0.875rem",fontWeight:500},children:v()})}),w.jsx($.Menu,{anchorEl:s,open:c,onClose:m,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{width:300,mt:.5,overflow:"visible",boxShadow:"0 2px 8px rgba(0,0,0,0.15)",borderRadius:"8px"}}},children:f?w.jsxs($.Box,{children:[w.jsxs($.Box,{sx:{px:1.5,py:1.25,display:"flex",alignItems:"center",gap:.75},children:[w.jsx($.Button,{size:"small",onClick:()=>u(!1),sx:{textTransform:"none",color:"#1a73e8",fontSize:"0.75rem",p:.5,minWidth:"auto"},children:"← Back"}),w.jsx($.Typography,{variant:"caption",sx:{fontWeight:600,flex:1,fontSize:"0.75rem"},children:"Accounts"})]}),w.jsx($.Divider,{sx:{my:0}}),w.jsx($.Box,{sx:{px:.75,py:.75},children:o&&w.jsx(tr,{accounts:o.accounts,activeAccountId:o.activeAccount?.accountId||null,isLoading:!1,onSwitchAccount:o.switchAccount,onAddAccount:o.addNewAccount,onRemoveAccount:o.removeAccount,onRefreshAccount:o.refreshAccountToken})})]}):w.jsxs($.Box,{children:[w.jsxs($.Box,{sx:{px:1.5,py:1.5},children:[w.jsxs($.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",mb:1.25},children:[w.jsx($.Avatar,{src:y()||void 0,sx:{width:56,height:56,bgcolor:"#1a73e8",fontSize:"1.25rem",fontWeight:500,mb:1},children:v()},o?.activeAccount?.accountId||"profile-avatar"),w.jsx($.Typography,{sx:{fontWeight:500,color:"text.primary",textAlign:"center",mb:.25,fontSize:"0.9rem"},children:C()}),w.jsx($.Typography,{sx:{color:"text.secondary",textAlign:"center",wordBreak:"break-all",fontSize:"0.75rem"},children:x()})]}),w.jsx($.Button,{variant:"outlined",fullWidth:!0,onClick:S,sx:{borderRadius:"20px",textTransform:"none",borderColor:"#dadce0",color:"#3c4043",fontWeight:500,fontSize:"0.8125rem",py:.55,"&:hover":{backgroundColor:"rgba(66, 133, 244, 0.04)",borderColor:"#dadce0"}},children:"Manage your Account"})]}),w.jsx($.Divider,{sx:{my:0}}),o&&w.jsxs(w.Fragment,{children:[w.jsx($.MenuItem,{onClick:()=>u(!0),sx:{py:.75,px:1.5,fontSize:"0.8125rem","&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},children:w.jsx($.Typography,{sx:{color:"#3c4043",width:"100%",fontSize:"0.8125rem"},children:h>0?`Accounts (${h})`:"Accounts"})}),w.jsx($.Divider,{sx:{my:0}})]}),o?.addNewAccount&&w.jsx($.Box,{sx:{px:1.5,py:.5}}),w.jsxs($.MenuItem,{onClick:E,sx:{py:.75,px:1.5,fontSize:"0.8125rem","&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},children:[w.jsx($.ListItemIcon,{sx:{minWidth:32,mr:.5},children:w.jsx(Ss,{sx:{fontSize:"1rem",color:"#5f6368"}})}),w.jsx($.Typography,{sx:{color:"#3c4043",fontSize:"0.8125rem"},children:"Sign out"})]})]})})]})}const Dt="spry_profile_cache",xs=300*1e3,Ts=300*1e3;function gn(e,t={}){const{refetchInterval:r=xs,cacheTime:n=Ts,getAuthToken:o,headers:i={}}=t,[s,l]=T.useState(null),[f,u]=T.useState(!0),[h,d]=T.useState(null),m=T.useRef(null),E=T.useRef(null),S=T.useCallback(()=>{try{const C=localStorage.getItem(Dt);if(!C)return null;const x=JSON.parse(C);return Date.now()-x.timestamp<n?x.profile:(localStorage.removeItem(Dt),null)}catch(C){return console.error("Error loading profile from cache:",C),null}},[n]),c=T.useCallback(C=>{try{const x={profile:C,timestamp:Date.now()};localStorage.setItem(Dt,JSON.stringify(x))}catch(x){console.error("Error saving profile to cache:",x)}},[]),v=T.useCallback(async()=>{E.current&&E.current.abort(),E.current=new AbortController;try{u(!0),d(null);let C=null;o&&(C=await Promise.resolve(o()));const x={Accept:"application/json",...i};C&&(x.Authorization=`Bearer ${C}`);const y=await fetch(`${e}/api/profile`,{signal:E.current.signal,headers:x});if(!y.ok)throw new Error(`HTTP error! status: ${y.status}`);const g=await y.json();l(g),c(g),d(null)}catch(C){if(C instanceof Error&&C.name==="AbortError")return;const x=C instanceof Error?C.message:"Failed to fetch profile";d(x),console.error("Error fetching profile:",C);const y=S();y&&l(y)}finally{u(!1)}},[e,o,i,S,c]);return T.useEffect(()=>{const C=S();return C&&(l(C),u(!1)),v(),r>0&&(m.current=window.setInterval(()=>{v()},r)),()=>{m.current&&window.clearInterval(m.current),E.current&&E.current.abort()}},[e,r,n]),{profile:s,isLoading:f,error:h,refetch:v}}function hn({apiUrl:e,onSignOut:t,onManageAccount:r,accountManager:n,...o}){const{profile:i,isLoading:s,error:l}=gn(e,o);return l&&console.error("Error loading profile:",l),w.jsx(mn,{profile:i,isLoading:s,onSignOut:t,onManageAccount:r,accountManager:n})}const _s=un(w.jsx("path",{d:"M4 8h4V4H4zm6 12h4v-4h-4zm-6 0h4v-4H4zm0-6h4v-4H4zm6 0h4v-4h-4zm6-10v4h4V4zm-6 4h4V4h-4zm6 6h4v-4h-4zm0 6h4v-4h-4z"}),"Apps");function Rs({apiUrl:e,profileApiUrl:t,onSignOut:r,getAuthToken:n,profileHeaders:o,showAppsDropdown:i=!0,showProfileMenu:s=!0,appsRefetchInterval:l=300*1e3,appsCacheTime:f=300*1e3,profileRefetchInterval:u=300*1e3,profileCacheTime:h=300*1e3,accountManager:d}){const[m,E]=T.useState(!1),S=T.useRef(null),c=t||e;return w.jsxs($.Stack,{direction:"row",spacing:1,alignItems:"center",children:[i&&w.jsxs(w.Fragment,{children:[w.jsx($.IconButton,{ref:S,onClick:()=>E(!m),sx:{color:"#5f6368","&:hover":{bgcolor:"rgba(60, 64, 67, 0.08)"}},"aria-label":"Google apps",children:w.jsx(_s,{})}),w.jsx(or,{apiUrl:e,open:m,onClose:()=>E(!1),buttonRef:S,refetchInterval:l,cacheTime:f})]}),s&&w.jsx(hn,{apiUrl:c,onSignOut:r,refetchInterval:u,cacheTime:h,getAuthToken:n,headers:o,accountManager:d})]})}var rr=T.createContext(void 0);rr.displayName="AuthContext";var Os={isLoading:!0,isAuthenticated:!1},Is=(e,t)=>{switch(t.type){case"INITIALISED":case"USER_LOADED":return{...e,user:t.user,isLoading:!1,isAuthenticated:t.user?!t.user.expired:!1,error:void 0};case"USER_SIGNED_OUT":case"USER_UNLOADED":return{...e,user:void 0,isAuthenticated:!1};case"NAVIGATOR_INIT":return{...e,isLoading:!0,activeNavigator:t.method};case"NAVIGATOR_CLOSE":return{...e,isLoading:!1,activeNavigator:void 0};case"ERROR":{const r=t.error;return r.toString=()=>`${r.name}: ${r.message}`,{...e,isLoading:!1,error:r}}default:{const r=new TypeError(`unknown type ${t.type}`),n={name:r.name,message:r.message,innerError:r,stack:r.stack,source:"unknown"};return n.toString=()=>`${n.name}: ${n.message}`,{...e,isLoading:!1,error:n}}}},$s=(e=window.location)=>{let t=new URLSearchParams(e.search);return!!((t.get("code")||t.get("error"))&&t.get("state")||(t=new URLSearchParams(e.hash.replace("#","?")),(t.get("code")||t.get("error"))&&t.get("state")))},ks=nr("signinCallback","Sign-in failed"),Ps=nr("signoutCallback","Sign-out failed"),Ns=nr("renewSilent","Renew silent failed");function yn(e,t){return{name:Mt(e,"name",()=>"Error"),message:Mt(e,"message",()=>t),stack:Mt(e,"stack",()=>new Error().stack),innerError:e}}function nr(e,t){return r=>({...yn(r,t),source:e})}function Mt(e,t,r){if(e&&typeof e=="object"){const n=e[t];if(typeof n=="string")return n}return r()}var Us=["clearStaleState","querySessionStatus","revokeTokens","startSilentRenew","stopSilentRenew"],Ds=["signinPopup","signinSilent","signinRedirect","signinResourceOwnerCredentials","signoutPopup","signoutRedirect","signoutSilent"],Lr=e=>()=>{throw new Error(`UserManager#${e} was called from an unsupported context. If this is a server-rendered page, defer this call with useEffect() or pass a custom UserManager implementation.`)},Br=typeof window>"u"?null:Ge.UserManager,Ms=e=>{const{children:t,onSigninCallback:r,skipSigninCallback:n,matchSignoutCallback:o,onSignoutCallback:i,onRemoveUser:s,userManager:l=null,...f}=e,[u]=T.useState(()=>l??(Br?new Br(f):{settings:f})),[h,d]=T.useReducer(Is,Os),m=T.useMemo(()=>Object.assign({settings:u.settings,events:u.events},Object.fromEntries(Us.map(v=>{var C,x;return[v,(x=(C=u[v])==null?void 0:C.bind(u))!=null?x:Lr(v)]})),Object.fromEntries(Ds.map(v=>[v,u[v]?async C=>{d({type:"NAVIGATOR_INIT",method:v});try{return await u[v](C)}catch(x){return d({type:"ERROR",error:{...yn(x,`Unknown error while executing ${v}(...).`),source:v,args:C}}),null}finally{d({type:"NAVIGATOR_CLOSE"})}}:Lr(v)]))),[u]),E=T.useRef(!1);T.useEffect(()=>{!u||E.current||(E.current=!0,(async()=>{try{let v=null;$s()&&!n&&(v=await u.signinCallback(),r&&await r(v)),v=v||await u.getUser(),d({type:"INITIALISED",user:v})}catch(v){d({type:"ERROR",error:ks(v)})}try{if(o&&o(u.settings)){const v=await u.signoutCallback();i&&await i(v)}}catch(v){d({type:"ERROR",error:Ps(v)})}})())},[u,n,r,i,o]),T.useEffect(()=>{if(!u)return;const v=g=>{d({type:"USER_LOADED",user:g})};u.events.addUserLoaded(v);const C=()=>{d({type:"USER_UNLOADED"})};u.events.addUserUnloaded(C);const x=()=>{d({type:"USER_SIGNED_OUT"})};u.events.addUserSignedOut(x);const y=g=>{d({type:"ERROR",error:Ns(g)})};return u.events.addSilentRenewError(y),()=>{u.events.removeUserLoaded(v),u.events.removeUserUnloaded(C),u.events.removeUserSignedOut(x),u.events.removeSilentRenewError(y)}},[u]);const S=T.useCallback(async()=>{await u.removeUser(),s&&await s()},[u,s]),c=T.useMemo(()=>({...h,...m,removeUser:S}),[h,m,S]);return T.createElement(rr.Provider,{value:c},t)},Sn=()=>{const e=T.useContext(rr);return e||console.warn("AuthProvider context is undefined, please verify you are calling useAuth() as child of a <AuthProvider> component."),e};const bn=T.createContext(null),js=()=>{typeof window>"u"||window.history.replaceState({},document.title,window.location.pathname)},Ls=e=>{if(typeof window>"u")return!1;const t=e.post_logout_redirect_uri||e.redirect_uri;return t?window.location.href.startsWith(t):!1},Bs=e=>{if(typeof window>"u")return;const t=e.post_logout_redirect_uri||e.redirect_uri||window.location.origin;window.location.href!==t?window.history.replaceState({},document.title,t):window.history.replaceState({},document.title,window.location.pathname)};function Fs({children:e,config:t,onSigninCallback:r,matchSignoutCallback:n,onSignoutCallback:o,onRemoveUser:i,skipSigninCallback:s}){const l=T.useMemo(()=>({...t,post_logout_redirect_uri:t.post_logout_redirect_uri||t.redirect_uri||(typeof window<"u"?window.location.origin:void 0)}),[t]),f=T.useMemo(()=>new Ge.UserManager(l),[l]),u=T.useMemo(()=>({authority:l.authority,client_id:l.client_id,redirect_uri:l.redirect_uri,post_logout_redirect_uri:l.post_logout_redirect_uri}),[l]),h=r||js,d=n||Ls,m=o||(()=>Bs(l));return w.jsx(bn.Provider,{value:{keycloakConfig:u,userManager:f,syncBridgeUrl:dn},children:w.jsx(Ms,{userManager:f,onSigninCallback:h,matchSignoutCallback:d,onSignoutCallback:m,onRemoveUser:i,skipSigninCallback:s,children:e})})}function vn(){const e=T.useContext(bn);if(!e)throw new Error("useSpryAuthContext must be used within SpryAuthProvider");return e}function zs(e){const t=e.profile?.email||e.profile?.sub||"unknown",r=Date.now();return`account_${t.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_${r}`}function ne(){try{const e=localStorage.getItem(fe.ACCOUNTS);return e?JSON.parse(e):{accounts:[],activeAccountId:null,lastUpdated:Date.now()}}catch(e){return console.error("Failed to read accounts from localStorage:",e),{accounts:[],activeAccountId:null,lastUpdated:Date.now()}}}function ve(){return ne().accounts}function Ie(e){try{localStorage.setItem(fe.ACCOUNTS,JSON.stringify(e))}catch(t){console.error("Failed to save accounts to localStorage:",t)}}function En(e,t=null){const r=ne(),n={accounts:e,activeAccountId:t??r.activeAccountId,lastUpdated:Date.now()};Ie(n)}function De(e){const t=ne(),r=zs(e),n=e.profile?.sub,o=e.profile?.email,i=t.accounts.findIndex(f=>n&&f.user.profile?.sub?f.user.profile.sub===n:o&&f.user.profile?.email?f.user.profile.email===o:!1),l={...{accountId:r,lastUsed:Date.now(),isStale:!1,createdAt:Date.now()},user:e};return i>=0?t.accounts[i]=l:t.accounts.push(l),t.lastUpdated=Date.now(),Ie(t),r}function wt(e){const t=ne();t.accounts=t.accounts.filter(r=>r.accountId!==e),t.activeAccountId===e&&(t.activeAccountId=null),t.lastUpdated=Date.now(),Ie(t)}function ce(e){const t=ne();t.activeAccountId=e,t.lastUpdated=Date.now(),Ie(t)}function wn(){const e=ne();return e.activeAccountId&&e.accounts.find(t=>t.accountId===e.activeAccountId)||null}function An(){return ne().activeAccountId}function Cn(e,t){const r=ne(),n=r.accounts.find(o=>o.accountId===e);n&&(n.user=t,n.lastUsed=Date.now(),n.isStale=!1,r.lastUpdated=Date.now(),Ie(r))}function xn(e){const t=ne(),r=t.accounts.find(n=>n.accountId===e);r&&(r.isStale=!0,t.lastUpdated=Date.now(),Ie(t))}function Vs(){localStorage.removeItem(fe.ACCOUNTS)}function Ws(e){const r=ne().accounts.find(n=>n.accountId===e);return r?{accountId:r.accountId,lastUsed:r.lastUsed,isStale:r.isStale,createdAt:r.createdAt}:null}function ot(e){e?localStorage.setItem(fe.ADD_ACCOUNT_IN_PROGRESS,"true"):localStorage.removeItem(fe.ADD_ACCOUNT_IN_PROGRESS)}function it(){return localStorage.getItem(fe.ADD_ACCOUNT_IN_PROGRESS)==="true"}function Tn(e){localStorage.setItem(fe.RETURN_URL,e)}function _n(){return localStorage.getItem(fe.RETURN_URL)}function Vt(){localStorage.removeItem(fe.RETURN_URL)}function Rn(e){localStorage.setItem(fe.TEMP_CURRENT_USER,JSON.stringify(e))}function Gs(){try{const e=localStorage.getItem(fe.TEMP_CURRENT_USER);return e?JSON.parse(e):null}catch{return null}}function Wt(){localStorage.removeItem(fe.TEMP_CURRENT_USER)}async function On(e,t){try{const r=`${t.authority.replace(/\/$/,"")}/soft-logout`,n="openid profile email offline_access",o=t.redirect_uri||window.location.origin,i=`${t.authority.replace(/\/$/,"")}/protocol/openid-connect/auth?client_id=${encodeURIComponent(t.client_id)}&redirect_uri=${encodeURIComponent(o)}&response_type=code&scope=${encodeURIComponent(n)}`;return window.location.href=`${r}?post_logout_redirect_uri=${encodeURIComponent(i)}`,!0}catch(r){return console.error("Failed to clear SSO session:",r),console.warn(pe.SSO_CLEAR_FAILED),!1}}async function In(e,t,r){try{const o=ve().length===1;if(!await Js(e,t)&&o)return console.warn("Token revocation failed for last account, falling back to redirect logout"),await $n(e,t,r),{success:!0,message:"Redirecting to logout...",remainingAccounts:0};wt(r),At.remove(r);const s=ve(),f=s.sort((u,h)=>h.lastUsed-u.lastUsed)[0]||null;return f?(ce(f.accountId),{success:!0,message:`Logged out. Switched to ${f.user.profile?.email||f.user.profile?.sub}`,remainingAccounts:s.length}):(ce(null),{success:!0,message:"Logged out. No other accounts available.",remainingAccounts:0})}catch(n){return console.error("Error during logout:",n),{success:!1,message:`Logout failed: ${n instanceof Error?n.message:"Unknown error"}`,remainingAccounts:ve().length}}}async function Ys(e,t){const r=e.map(n=>$n(n.user,t,n.accountId).catch(o=>{console.warn(`Failed to logout ${n.accountId}:`,o)}));return await Promise.all(r),e.forEach(n=>{wt(n.accountId),At.remove(n.accountId)}),ce(null),{success:!0,message:"All accounts logged out.",remainingAccounts:0}}function Ks(e){wt(e);const t=ve();if(t.length>0){const n=t.sort((o,i)=>i.lastUsed-o.lastUsed)[0];return ce(n.accountId),{success:!0,message:`Account removed locally. Switched to ${n.user.profile?.email||n.user.profile?.sub}`,remainingAccounts:t.length-1}}else return ce(null),{success:!0,message:"Account removed. No other accounts available.",remainingAccounts:0}}async function qs(e,t){try{return new Ge.UserManager({authority:e.authority,client_id:e.client_id,redirect_uri:e.redirect_uri||window.location.origin,post_logout_redirect_uri:e.post_logout_redirect_uri||e.redirect_uri||window.location.origin,response_type:"code",scope:"openid profile email offline_access",userStore:new Ge.WebStorageStateStore({prefix:`oidc_${t}`})})}catch(r){throw console.error("Failed to create UserManager:",r),new Error("oidc-client-ts library not found. Ensure it is installed in consuming app.")}}class Hs{pool=new Map;async getOrCreate(t,r){if(!this.pool.has(r)){const o=await qs(t,r);this.pool.set(r,o)}const n=this.pool.get(r);if(!n)throw new Error(`UserManager not found for ${r}`);return n}remove(t){this.pool.delete(t)}clear(){this.pool.clear()}has(t){return this.pool.has(t)}}const At=new Hs;async function Gt(e,t,r){if(!t.refresh_token)return console.warn(`${pe.TOKEN_REFRESH_FAILED} (${e}): missing refresh token`),null;const n=`${r.authority.replace(/\/$/,"")}/protocol/openid-connect/token`;try{const o=await fetch(n,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",client_id:r.client_id,refresh_token:t.refresh_token}).toString()});if(!o.ok){const l=await o.text();return console.warn(`${pe.TOKEN_REFRESH_FAILED} (${e}):`,l),null}const i=await o.json(),s={access_token:i.access_token,refresh_token:i.refresh_token||t.refresh_token,id_token:i.id_token||t.id_token,expires_in:i.expires_in||t.expires_in,profile:t.profile};return Cn(e,s),s}catch(o){return console.warn(`${pe.TOKEN_REFRESH_FAILED} (${e}):`,o),null}}async function Fr(e,t){try{await(await At.getOrCreate(e,t)).signinRedirect()}catch(r){throw console.error(pe.SIGNIN_REDIRECT_FAILED,r),r}}async function Js(e,t){try{if(!e.refresh_token)return console.warn("No refresh token available for revocation"),!1;const r=`${t.authority.replace(/\/$/,"")}/protocol/openid-connect/revoke`,n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:t.client_id,token:e.refresh_token,token_type_hint:"refresh_token"}).toString()});return!n.ok&&n.status!==204?(console.warn(`Token revocation returned ${n.status}`),!1):(console.log("✅ Token revoked successfully"),!0)}catch(r){return console.warn("Failed to revoke token:",r),!1}}async function $n(e,t,r){try{await(await At.getOrCreate(t,r)).signoutRedirect({id_token_hint:e.id_token,post_logout_redirect_uri:t.post_logout_redirect_uri||t.redirect_uri||window.location.origin})}catch(n){console.warn(pe.LOGOUT_FAILED,n)}}function kn(e){const{keycloakConfig:t,initialUser:r,onAccountSwitch:n,signinRedirect:o,syncBridge:i}=e,[s,l]=T.useState([]),[f,u]=T.useState(null),h=T.useRef(!1),d=T.useRef(!1),m=T.useRef(!1),E=T.useCallback(y=>{const g=y.accounts;let p=y.activeAccountId;if(p&&!g.find(R=>R.accountId===p)&&(p=g[0]?.accountId||null),l(g),u(p),p){const R=g.find(U=>U.accountId===p);R&&n(R.user)}},[n]);T.useEffect(()=>{!i||m.current||(m.current=!0,i.getAccountsState().then(y=>{if(!y||!y.accounts.length)return;y.accounts.forEach(p=>{De(p.user)}),y.activeAccountId&&ce(y.activeAccountId);const g=ne();E(g)}))},[E,i]),T.useEffect(()=>{if(d.current)return;if(it())if(console.log("🔄 Detected redirect callback for add account flow"),r){const g=ve(),p=r.profile?.sub,R=r.profile?.email;if(g.some(I=>p&&I.user.profile?.sub?I.user.profile.sub===p:R&&I.user.profile?.email?I.user.profile.email===R:!1)){console.log("⏳ initialUser matches an existing account, waiting for new user...");return}d.current=!0,console.log("✅ Primary auth populated initialUser, processing new account...");const V=De(r);console.log(`✅ Added new account: ${V}`),ce(V),ot(!1);const k=_n();Wt(),Vt();const a=ne();l(a.accounts),u(V),i&&i.setAccountsState(a),n(r),console.log("✅ Account switch completed"),k&&k!==window.location.href&&(console.log(`🔄 Navigating back to: ${k}`),window.location.assign(k))}else console.log("⏳ Waiting for primary auth to populate initialUser...")},[r,n]),T.useEffect(()=>{(async()=>{const y=async()=>!(localStorage.getItem("spry_add_account_pending")!=="1"||d.current);let g=0;for(;g<10&&!await y();)await new Promise(p=>setTimeout(p,150)),g++;if(await y())if(localStorage.removeItem("spry_add_account_pending"),console.log("🔄 Soft-logout completed, initiating signinRedirect..."),o)o().catch(p=>{console.error("signinRedirect failed:",p)});else{const p=`temp_add_${Date.now()}`;Fr(t,p).catch(R=>{console.error("signinRedirectForNewAccount failed:",R)})}})()},[t,o]),T.useEffect(()=>{if(!h.current&&!d.current){h.current=!0;try{const y=ne();let g=y.accounts,p=y.activeAccountId;if(g.length===0&&r){const R=De(r);g=ve(),p=R,ce(R)}p&&!g.find(R=>R.accountId===p)&&(p=g[0]?.accountId||null,p&&ce(p)),E({accounts:g,activeAccountId:p,lastUpdated:y.lastUpdated}),i&&i.setAccountsState({accounts:g,activeAccountId:p,lastUpdated:y.lastUpdated}),console.log(`📦 Loaded ${g.length} accounts from localStorage`)}catch(y){const g=y instanceof Error?y.message:"Unknown initialization error";console.error("Failed to initialize account manager:",g)}}},[E,r,n,i]),T.useEffect(()=>{if(d.current||!r||ne().accounts.length>0||it())return;const g=De(r);ce(g);const p=ne();E(p),i&&i.setAccountsState(p),console.log("✅ Seeded initial account after auth became available")},[E,r,n,i]),T.useEffect(()=>{if(!r||d.current||it())return;const y=ve(),g=r.profile?.sub,p=r.profile?.email;if(y.some(k=>g&&k.user.profile?.sub?k.user.profile.sub===g:p&&k.user.profile?.email?k.user.profile.email===p:!1))return;const U=De(r);ce(U);const V=ne();E(V),i&&i.setAccountsState(V),console.log("✅ Added account from auth state update")},[E,r,n,i]);const S=T.useCallback(async y=>{try{const g=s.find(p=>p.accountId===y);if(!g){console.error(pe.ACCOUNT_NOT_FOUND);return}Et(g.user.access_token)&&(console.warn("Access token expired for account:",y),xn(y)),ce(y),u(y),await n(g.user),i&&await i.setAccountsState(ne()),console.log(`✅ Switched to account: ${g.user.profile?.email||y}`)}catch(g){const p=g instanceof Error?g.message:"Failed to switch account";console.error(p,g)}},[s,n,i]),c=T.useCallback(async()=>{try{if(console.log("🔄 Starting add new account flow..."),console.log("📦 Saving state flags to localStorage..."),r&&Rn(r),ot(!0),localStorage.setItem("spry_add_account_pending","1"),Tn(window.location.href),console.log("🔄 Clearing SSO session..."),await On(r||null,t),await new Promise(y=>setTimeout(y,1200)),console.log(fn.REDIRECT_IN_PROGRESS),o)await o();else{const y=`temp_add_${Date.now()}`;await Fr(t,y)}}catch(y){const g=y instanceof Error?y.message:"Failed to add new account";console.error(g,y),ot(!1),Vt(),Wt(),localStorage.removeItem("spry_add_account_pending")}},[t,r]),v=T.useCallback(async y=>{try{const g=s.find(U=>U.accountId===y);if(!g){console.error(pe.ACCOUNT_NOT_FOUND);return}const p=await In(g.user,t,y);p.success||console.warn("Keycloak logout failed, but account removed locally:",p.message);const R=ne();E(R),i&&i.setAccountsState(R)}catch(g){const p=g instanceof Error?g.message:"Failed to remove account";console.error(p,g)}},[s,t,n,E,i]),C=T.useCallback(async y=>{try{const g=s.find(U=>U.accountId===y);if(!g){console.error(pe.ACCOUNT_NOT_FOUND);return}if(!await Gt(y,g.user,t)){console.error(`No refreshed user returned for ${y}`);return}const R=ne();E(R),i&&i.setAccountsState(R)}catch(g){const p=g instanceof Error?g.message:"Failed to refresh token";console.error(p,g)}},[s,f,t,n,E,i]);T.useEffect(()=>{const y=()=>{const g=s.map(R=>({...R,isStale:pn(R)}));g.some((R,U)=>R.isStale!==s[U]?.isStale)&&(En(g),l(g))};s.length>0&&y()},[s]);const x=s.find(y=>y.accountId===f)||null;return{accounts:s,activeAccount:x,switchAccount:S,addNewAccount:c,removeAccount:v,refreshAccountToken:C}}const Xs=2e3,jt=new Map;function Qs(e){if(!e?.bridgeUrl||typeof window>"u"||typeof document>"u")return null;if(jt.has(e.bridgeUrl))return jt.get(e.bridgeUrl)||null;const t=e.bridgeUrl,r=new URL(t).origin,n=e.timeoutMs??Xs;let o=null,i=!1,s=null,l=null;const f=new Map,u=()=>{o||(o=document.createElement("iframe"),o.src=t,o.title="Spry Sync Bridge",o.style.width="0",o.style.height="0",o.style.border="0",o.style.position="absolute",o.style.left="-9999px",o.style.top="-9999px",o.setAttribute("aria-hidden","true"),o.addEventListener("load",()=>{i=!0}),document.body.appendChild(o))},h=()=>(u(),i?Promise.resolve():s||(s=new Promise((x,y)=>{if(!o){s=null,y(new Error("Bridge iframe not available"));return}const g=()=>{if(i=!0,d()){R(),x();return}R(),y(new Error("Bridge iframe did not load the expected origin"))},p=()=>{R(),y(new Error("Bridge iframe failed to load"))},R=()=>{o?.removeEventListener("load",g),o?.removeEventListener("error",p),s=null};o.addEventListener("load",g),o.addEventListener("error",p)}),s)),d=()=>{if(!o||!o.contentWindow)return!1;try{const x=o.contentWindow.location.href;return!x||x==="about:blank"?!1:x.startsWith(t)}catch{return!0}},m=x=>{if(x.origin!==r)return;const y=x.data;if(!y||typeof y!="object")return;const g=y.requestId;if(!g||typeof g!="string")return;const p=f.get(g);if(p){if(f.delete(g),window.clearTimeout(p.timeoutId),y.type==="ERROR"){p.reject(new Error(y.error||"Bridge error"));return}p.resolve(y.payload??null)}},E=(x,y,g)=>g?c(x,y):v().then(()=>c(x,y)),S=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}_${Math.random().toString(16).slice(2)}`,c=(x,y)=>h().then(()=>new Promise((g,p)=>{const R=S(),U=window.setTimeout(()=>{f.delete(R),p(new Error(`Bridge request timed out: ${x}`))},n);f.set(R,{resolve:g,reject:p,timeoutId:U});try{o?.contentWindow?.postMessage({type:x,requestId:R,payload:y},"*")}catch{f.delete(R),window.clearTimeout(U),p(new Error("Bridge postMessage failed"))}})),v=()=>l||(l=E("PING",null,!0).then(()=>{}).catch(x=>{throw l=null,x}),l);window.addEventListener("message",m);const C={getAccountsState:async()=>{try{const x=await E("GET_ACCOUNTS");return!x||!Array.isArray(x.accounts)?null:{accounts:x.accounts,activeAccountId:x.activeAccountId??null,lastUpdated:Number(x.lastUpdated)||0}}catch(x){return console.warn("Sync bridge unavailable for GET_ACCOUNTS:",x),null}},setAccountsState:async x=>{try{await E("SET_ACCOUNTS",{accounts:x.accounts,activeAccountId:x.activeAccountId??null,lastUpdated:x.lastUpdated??Date.now()})}catch(y){console.warn("Sync bridge unavailable for SET_ACCOUNTS:",y)}}};return jt.set(t,C),C}function Zs(e){if(e)return{access_token:e.access_token,refresh_token:e.refresh_token,id_token:e.id_token,expires_in:e.expires_in,profile:e.profile}}function zr(e){const t=Math.floor(Date.now()/1e3),r=e.expires_in?t+e.expires_in:void 0;return new Ge.User({...e,token_type:"Bearer",profile:e.profile||{sub:""},expires_at:r})}function ea(){const e=Sn(),{keycloakConfig:t,userManager:r,syncBridgeUrl:n}=vn(),o=T.useRef(!1),i=T.useMemo(()=>Qs(n?{bridgeUrl:n}:null),[n]),s=kn({keycloakConfig:t,initialUser:Zs(e.user),signinRedirect:e.signinRedirect,syncBridge:i,onAccountSwitch:async f=>{let u=f;const h=ve(),d=f.profile?.sub,m=f.profile?.email,E=h.find(c=>d&&c.user.profile?.sub?c.user.profile.sub===d:m&&c.user.profile?.email?c.user.profile.email===m:!1);if(E&&f.refresh_token){const c=await Gt(E.accountId,f,t);c&&(u=c)}const S=zr(u);await r.storeUser(S),await r.events.load(S),window.dispatchEvent(new CustomEvent("auth:account-switched",{detail:{user:u}}))}});T.useEffect(()=>{if(o.current||e.isAuthenticated||e.isLoading||e.activeNavigator)return;const f=wn();if(!f)return;o.current=!0,(async()=>{let h=f.user;if(h.refresh_token){const m=await Gt(f.accountId,h,t);m&&(h=m)}const d=zr(h);await r.storeUser(d),await r.events.load(d)})().catch(h=>{console.log("Restore from stored account failed:",h)})},[s.accounts.length,e,t,r]);const l=T.useCallback(async f=>{await s.removeAccount(f),An()||await r.removeUser()},[s,r]);return T.useMemo(()=>({...s,removeAccount:l}),[s,l])}function ta(){return Sn()}function or({apiUrl:e,open:t,onClose:r,buttonRef:n,refetchInterval:o,cacheTime:i}){const{apps:s,isLoading:l,error:f,refetch:u}=Wr(e,{refetchInterval:o,cacheTime:i});return w.jsx(Vr,{apps:s,open:t,onClose:r,buttonRef:n,isLoading:l,error:f,onRetry:u})}exports.AccountList=tr;exports.AppsDropdown=Vr;exports.AppsDropdownConnected=or;exports.ERROR_MESSAGES=pe;exports.INFO_MESSAGES=fn;exports.ProfileMenu=mn;exports.ProfileMenuConnected=hn;exports.STORAGE_KEYS=fe;exports.SYNC_BRIDGE_URL=dn;exports.SpryAuthProvider=Fs;exports.TOKEN_VALIDATION=He;exports.TopBar=Rs;exports.addAccount=De;exports.clearAllAccounts=Vs;exports.clearReturnUrl=Vt;exports.clearSSOSessionBeforeAddAccount=On;exports.clearTempCurrentUser=Wt;exports.decodeToken=Be;exports.default=or;exports.extractUserInfo=Me;exports.getAccountMetadata=Ws;exports.getAccounts=ve;exports.getAccountsState=ne;exports.getActiveAccount=wn;exports.getActiveAccountId=An;exports.getReturnUrl=_n;exports.getTempCurrentUser=Gs;exports.getTokenExpiryTime=bs;exports.getTokenTimeRemaining=vs;exports.isAccessTokenValid=As;exports.isAccountStale=pn;exports.isAddAccountInProgress=it;exports.isRefreshTokenExpired=er;exports.isTokenExpired=Et;exports.logoutAccount=In;exports.logoutAccountLocally=Ks;exports.logoutAllAccounts=Ys;exports.markAccountStale=xn;exports.removeAccount=wt;exports.saveAccounts=En;exports.saveAccountsState=Ie;exports.saveTempCurrentUser=Rn;exports.setActiveAccount=ce;exports.setAddAccountInProgress=ot;exports.setReturnUrl=Tn;exports.shouldRefreshAccessToken=Es;exports.shouldRefreshRefreshToken=ws;exports.updateAccountTokens=Cn;exports.useAccountManager=kn;exports.useAppsData=Wr;exports.useProfileData=gn;exports.useSpryAccountManager=ea;exports.useSpryAuth=ta;exports.useSpryAuthContext=vn;
|
|
32
|
+
export default theme;`}function zt(e={},...t){const{breakpoints:r,mixins:n={},spacing:o,palette:i={},transitions:c={},typography:l={},shape:f,...u}=e;if(e.vars&&e.generateThemeVars===void 0)throw new Error(process.env.NODE_ENV!=="production"?"MUI: `vars` is a private field used for CSS variables support.\nPlease use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.":Ce(20));const y=Zt(i),d=Zr(e);let g=fe(d,{mixins:ji(d.breakpoints,n),palette:y,shadows:Wi.slice(),typography:Bi(y,l),transitions:qi(c),zIndex:{...Hi}});if(g=fe(g,u),g=t.reduce((v,h)=>fe(v,h),g),process.env.NODE_ENV!=="production"){const v=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],h=(a,b)=>{let x;for(x in a){const T=a[x];if(v.includes(x)&&Object.keys(T).length>0){if(process.env.NODE_ENV!=="production"){const C=Kt("",x);console.error([`MUI: The \`${b}\` component increases the CSS specificity of the \`${x}\` internal state.`,"You can not override it like this: ",JSON.stringify(a,null,2),"",`Instead, you need to use the '&.${C}' syntax:`,JSON.stringify({root:{[`&.${C}`]:T}},null,2),"","https://mui.com/r/state-classes-guide"].join(`
|
|
33
|
+
`))}a[x]={}}}};Object.keys(g.components).forEach(a=>{const b=g.components[a].styleOverrides;b&&a.startsWith("Mui")&&h(b,a)})}return g.unstable_sxConfig={...bt,...u?.unstable_sxConfig},g.unstable_sx=function(h){return Le({sx:h,theme:this})},g.toRuntimeSource=an,g}function Xi(e){let t;return e<1?t=5.11916*e**2:t=4.5*Math.log(e+1)+2,Math.round(t*10)/1e3}const Qi=[...Array(25)].map((e,t)=>{if(t===0)return"none";const r=Xi(t);return`linear-gradient(rgba(255 255 255 / ${r}), rgba(255 255 255 / ${r}))`});function cn(e){return{inputPlaceholder:e==="dark"?.5:.42,inputUnderline:e==="dark"?.7:.42,switchTrackDisabled:e==="dark"?.2:.12,switchTrack:e==="dark"?.3:.38}}function ln(e){return e==="dark"?Qi:[]}function Zi(e){const{palette:t={mode:"light"},opacity:r,overlays:n,...o}=e,i=Zt(t);return{palette:i,opacity:{...cn(i.mode),...r},overlays:n||ln(i.mode),...o}}function es(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)/)}const ts=e=>[...[...Array(25)].map((t,r)=>`--${e?`${e}-`:""}overlays-${r}`),`--${e?`${e}-`:""}palette-AppBar-darkBg`,`--${e?`${e}-`:""}palette-AppBar-darkColor`],rs=e=>(t,r)=>{const n=e.rootSelector||":root",o=e.colorSchemeSelector;let i=o;if(o==="class"&&(i=".%s"),o==="data"&&(i="[data-%s]"),o?.startsWith("data-")&&!o.includes("%s")&&(i=`[${o}="%s"]`),e.defaultColorScheme===t){if(t==="dark"){const c={};return ts(e.cssVarPrefix).forEach(l=>{c[l]=r[l],delete r[l]}),i==="media"?{[n]:r,"@media (prefers-color-scheme: dark)":{[n]:c}}:i?{[i.replace("%s",t)]:c,[`${n}, ${i.replace("%s",t)}`]:r}:{[n]:{...r,...c}}}if(i&&i!=="media")return`${n}, ${i.replace("%s",String(t))}`}else if(t){if(i==="media")return{[`@media (prefers-color-scheme: ${String(t)})`]:{[n]:r}};if(i)return i.replace("%s",String(t))}return n};function ns(e,t){t.forEach(r=>{e[r]||(e[r]={})})}function S(e,t,r){!e[t]&&r&&(e[t]=r)}function Ve(e){return typeof e!="string"||!e.startsWith("hsl")?e:nn(e)}function be(e,t){`${t}Channel`in e||(e[`${t}Channel`]=ze(Ve(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().
|
|
34
|
+
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 os(e){return typeof e=="number"?`${e}px`:typeof e=="string"||typeof e=="function"||Array.isArray(e)?e:"8px"}const Se=e=>{try{return e()}catch{}},is=(e="mui")=>Ci(e);function Ut(e,t,r,n){if(!t)return;t=t===!0?{}:t;const o=n==="dark"?"dark":"light";if(!r){e[n]=Zi({...t,palette:{mode:o,...t?.palette}});return}const{palette:i,...c}=zt({...r,palette:{mode:o,...t?.palette}});return e[n]={...t,palette:i,opacity:{...cn(o),...t?.opacity},overlays:t?.overlays||ln(o)},c}function ss(e={},...t){const{colorSchemes:r={light:!0},defaultColorScheme:n,disableCssColorScheme:o=!1,cssVarPrefix:i="mui",shouldSkipGeneratingVar:c=es,colorSchemeSelector:l=r.light&&r.dark?"media":void 0,rootSelector:f=":root",...u}=e,y=Object.keys(r)[0],d=n||(r.light&&y!=="light"?"light":y),g=is(i),{[d]:v,light:h,dark:a,...b}=r,x={...b};let T=v;if((d==="dark"&&!("dark"in r)||d==="light"&&!("light"in r))&&(T=!0),!T)throw new Error(process.env.NODE_ENV!=="production"?`MUI: The \`colorSchemes.${d}\` option is either missing or invalid.`:Ce(21,d));const C=Ut(x,T,u,d);h&&!x.light&&Ut(x,h,void 0,"light"),a&&!x.dark&&Ut(x,a,void 0,"dark");let m={defaultColorScheme:d,...C,cssVarPrefix:i,colorSchemeSelector:l,rootSelector:f,getCssVar:g,colorSchemes:x,font:{...Mi(C.typography),...C.font},spacing:os(u.spacing)};Object.keys(m.colorSchemes).forEach(P=>{const s=m.colorSchemes[P].palette,$=L=>{const G=L.split("-"),ae=G[1],oe=G[2];return g(L,s[ae][oe])};if(s.mode==="light"&&(S(s.common,"background","#fff"),S(s.common,"onBackground","#000")),s.mode==="dark"&&(S(s.common,"background","#000"),S(s.common,"onBackground","#fff")),ns(s,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),s.mode==="light"){S(s.Alert,"errorColor",X(s.error.light,.6)),S(s.Alert,"infoColor",X(s.info.light,.6)),S(s.Alert,"successColor",X(s.success.light,.6)),S(s.Alert,"warningColor",X(s.warning.light,.6)),S(s.Alert,"errorFilledBg",$("palette-error-main")),S(s.Alert,"infoFilledBg",$("palette-info-main")),S(s.Alert,"successFilledBg",$("palette-success-main")),S(s.Alert,"warningFilledBg",$("palette-warning-main")),S(s.Alert,"errorFilledColor",Se(()=>s.getContrastText(s.error.main))),S(s.Alert,"infoFilledColor",Se(()=>s.getContrastText(s.info.main))),S(s.Alert,"successFilledColor",Se(()=>s.getContrastText(s.success.main))),S(s.Alert,"warningFilledColor",Se(()=>s.getContrastText(s.warning.main))),S(s.Alert,"errorStandardBg",Q(s.error.light,.9)),S(s.Alert,"infoStandardBg",Q(s.info.light,.9)),S(s.Alert,"successStandardBg",Q(s.success.light,.9)),S(s.Alert,"warningStandardBg",Q(s.warning.light,.9)),S(s.Alert,"errorIconColor",$("palette-error-main")),S(s.Alert,"infoIconColor",$("palette-info-main")),S(s.Alert,"successIconColor",$("palette-success-main")),S(s.Alert,"warningIconColor",$("palette-warning-main")),S(s.AppBar,"defaultBg",$("palette-grey-100")),S(s.Avatar,"defaultBg",$("palette-grey-400")),S(s.Button,"inheritContainedBg",$("palette-grey-300")),S(s.Button,"inheritContainedHoverBg",$("palette-grey-A100")),S(s.Chip,"defaultBorder",$("palette-grey-400")),S(s.Chip,"defaultAvatarColor",$("palette-grey-700")),S(s.Chip,"defaultIconColor",$("palette-grey-700")),S(s.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),S(s.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),S(s.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),S(s.LinearProgress,"primaryBg",Q(s.primary.main,.62)),S(s.LinearProgress,"secondaryBg",Q(s.secondary.main,.62)),S(s.LinearProgress,"errorBg",Q(s.error.main,.62)),S(s.LinearProgress,"infoBg",Q(s.info.main,.62)),S(s.LinearProgress,"successBg",Q(s.success.main,.62)),S(s.LinearProgress,"warningBg",Q(s.warning.main,.62)),S(s.Skeleton,"bg",`rgba(${$("palette-text-primaryChannel")} / 0.11)`),S(s.Slider,"primaryTrack",Q(s.primary.main,.62)),S(s.Slider,"secondaryTrack",Q(s.secondary.main,.62)),S(s.Slider,"errorTrack",Q(s.error.main,.62)),S(s.Slider,"infoTrack",Q(s.info.main,.62)),S(s.Slider,"successTrack",Q(s.success.main,.62)),S(s.Slider,"warningTrack",Q(s.warning.main,.62));const L=rt(s.background.default,.8);S(s.SnackbarContent,"bg",L),S(s.SnackbarContent,"color",Se(()=>s.getContrastText(L))),S(s.SpeedDialAction,"fabHoverBg",rt(s.background.paper,.15)),S(s.StepConnector,"border",$("palette-grey-400")),S(s.StepContent,"border",$("palette-grey-400")),S(s.Switch,"defaultColor",$("palette-common-white")),S(s.Switch,"defaultDisabledColor",$("palette-grey-100")),S(s.Switch,"primaryDisabledColor",Q(s.primary.main,.62)),S(s.Switch,"secondaryDisabledColor",Q(s.secondary.main,.62)),S(s.Switch,"errorDisabledColor",Q(s.error.main,.62)),S(s.Switch,"infoDisabledColor",Q(s.info.main,.62)),S(s.Switch,"successDisabledColor",Q(s.success.main,.62)),S(s.Switch,"warningDisabledColor",Q(s.warning.main,.62)),S(s.TableCell,"border",Q(tt(s.divider,1),.88)),S(s.Tooltip,"bg",tt(s.grey[700],.92))}if(s.mode==="dark"){S(s.Alert,"errorColor",Q(s.error.light,.6)),S(s.Alert,"infoColor",Q(s.info.light,.6)),S(s.Alert,"successColor",Q(s.success.light,.6)),S(s.Alert,"warningColor",Q(s.warning.light,.6)),S(s.Alert,"errorFilledBg",$("palette-error-dark")),S(s.Alert,"infoFilledBg",$("palette-info-dark")),S(s.Alert,"successFilledBg",$("palette-success-dark")),S(s.Alert,"warningFilledBg",$("palette-warning-dark")),S(s.Alert,"errorFilledColor",Se(()=>s.getContrastText(s.error.dark))),S(s.Alert,"infoFilledColor",Se(()=>s.getContrastText(s.info.dark))),S(s.Alert,"successFilledColor",Se(()=>s.getContrastText(s.success.dark))),S(s.Alert,"warningFilledColor",Se(()=>s.getContrastText(s.warning.dark))),S(s.Alert,"errorStandardBg",X(s.error.light,.9)),S(s.Alert,"infoStandardBg",X(s.info.light,.9)),S(s.Alert,"successStandardBg",X(s.success.light,.9)),S(s.Alert,"warningStandardBg",X(s.warning.light,.9)),S(s.Alert,"errorIconColor",$("palette-error-main")),S(s.Alert,"infoIconColor",$("palette-info-main")),S(s.Alert,"successIconColor",$("palette-success-main")),S(s.Alert,"warningIconColor",$("palette-warning-main")),S(s.AppBar,"defaultBg",$("palette-grey-900")),S(s.AppBar,"darkBg",$("palette-background-paper")),S(s.AppBar,"darkColor",$("palette-text-primary")),S(s.Avatar,"defaultBg",$("palette-grey-600")),S(s.Button,"inheritContainedBg",$("palette-grey-800")),S(s.Button,"inheritContainedHoverBg",$("palette-grey-700")),S(s.Chip,"defaultBorder",$("palette-grey-700")),S(s.Chip,"defaultAvatarColor",$("palette-grey-300")),S(s.Chip,"defaultIconColor",$("palette-grey-300")),S(s.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),S(s.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),S(s.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),S(s.LinearProgress,"primaryBg",X(s.primary.main,.5)),S(s.LinearProgress,"secondaryBg",X(s.secondary.main,.5)),S(s.LinearProgress,"errorBg",X(s.error.main,.5)),S(s.LinearProgress,"infoBg",X(s.info.main,.5)),S(s.LinearProgress,"successBg",X(s.success.main,.5)),S(s.LinearProgress,"warningBg",X(s.warning.main,.5)),S(s.Skeleton,"bg",`rgba(${$("palette-text-primaryChannel")} / 0.13)`),S(s.Slider,"primaryTrack",X(s.primary.main,.5)),S(s.Slider,"secondaryTrack",X(s.secondary.main,.5)),S(s.Slider,"errorTrack",X(s.error.main,.5)),S(s.Slider,"infoTrack",X(s.info.main,.5)),S(s.Slider,"successTrack",X(s.success.main,.5)),S(s.Slider,"warningTrack",X(s.warning.main,.5));const L=rt(s.background.default,.98);S(s.SnackbarContent,"bg",L),S(s.SnackbarContent,"color",Se(()=>s.getContrastText(L))),S(s.SpeedDialAction,"fabHoverBg",rt(s.background.paper,.15)),S(s.StepConnector,"border",$("palette-grey-600")),S(s.StepContent,"border",$("palette-grey-600")),S(s.Switch,"defaultColor",$("palette-grey-300")),S(s.Switch,"defaultDisabledColor",$("palette-grey-600")),S(s.Switch,"primaryDisabledColor",X(s.primary.main,.55)),S(s.Switch,"secondaryDisabledColor",X(s.secondary.main,.55)),S(s.Switch,"errorDisabledColor",X(s.error.main,.55)),S(s.Switch,"infoDisabledColor",X(s.info.main,.55)),S(s.Switch,"successDisabledColor",X(s.success.main,.55)),S(s.Switch,"warningDisabledColor",X(s.warning.main,.55)),S(s.TableCell,"border",X(tt(s.divider,1),.68)),S(s.Tooltip,"bg",tt(s.grey[700],.92))}be(s.background,"default"),be(s.background,"paper"),be(s.common,"background"),be(s.common,"onBackground"),be(s,"divider"),Object.keys(s).forEach(L=>{const G=s[L];L!=="tonalOffset"&&G&&typeof G=="object"&&(G.main&&S(s[L],"mainChannel",ze(Ve(G.main))),G.light&&S(s[L],"lightChannel",ze(Ve(G.light))),G.dark&&S(s[L],"darkChannel",ze(Ve(G.dark))),G.contrastText&&S(s[L],"contrastTextChannel",ze(Ve(G.contrastText))),L==="text"&&(be(s[L],"primary"),be(s[L],"secondary")),L==="action"&&(G.active&&be(s[L],"active"),G.selected&&be(s[L],"selected")))})}),m=t.reduce((P,s)=>fe(P,s),m);const p={prefix:i,disableCssColorScheme:o,shouldSkipGeneratingVar:c,getSelector:rs(m)},{vars:E,generateThemeVars:k,generateStyleSheets:N}=_i(m,p);return m.vars=E,Object.entries(m.colorSchemes[m.defaultColorScheme]).forEach(([P,s])=>{m[P]=s}),m.generateThemeVars=k,m.generateStyleSheets=N,m.generateSpacing=function(){return Qr(u.spacing,qt(this))},m.getColorSchemeSelector=Ri(l),m.spacing=m.generateSpacing(),m.shouldSkipGeneratingVar=c,m.unstable_sxConfig={...bt,...u?.unstable_sxConfig},m.unstable_sx=function(s){return Le({sx:s,theme:this})},m.toRuntimeSource=an,m}function jr(e,t,r){e.colorSchemes&&r&&(e.colorSchemes[t]={...r!==!0&&r,palette:Zt({...r===!0?{}:r.palette,mode:t})})}function as(e={},...t){const{palette:r,cssVariables:n=!1,colorSchemes:o=r?void 0:{light:!0},defaultColorScheme:i=r?.mode,...c}=e,l=i||"light",f=o?.[l],u={...o,...r?{[l]:{...typeof f!="boolean"&&f,palette:r}}:void 0};if(n===!1){if(!("colorSchemes"in e))return zt(e,...t);let y=r;"palette"in e||u[l]&&(u[l]!==!0?y=u[l].palette:l==="dark"&&(y={mode:"dark"}));const d=zt({...e,palette:y},...t);return d.defaultColorScheme=l,d.colorSchemes=u,d.palette.mode==="light"&&(d.colorSchemes.light={...u.light!==!0&&u.light,palette:d.palette},jr(d,"dark",u.dark)),d.palette.mode==="dark"&&(d.colorSchemes.dark={...u.dark!==!0&&u.dark,palette:d.palette},jr(d,"light",u.light)),d}return!r&&!("light"in u)&&l==="light"&&(u.light=!0),ss({...c,colorSchemes:u,defaultColorScheme:l,...typeof n!="boolean"&&n},...t)}const cs=as(),ls="$$material";function us(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const fs=e=>us(e)&&e!=="classes",ds=fi({themeId:ls,defaultTheme:cs,rootShouldForwardProp:fs}),ps=Ai;process.env.NODE_ENV!=="production"&&(W.node,W.object.isRequired);function ms(e){return wi(e)}function gs(e){return Kt("MuiSvgIcon",e)}eo("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const hs=e=>{const{color:t,fontSize:r,classes:n}=e,o={root:["root",t!=="inherit"&&`color${Oe(t)}`,`fontSize${Oe(r)}`]};return Jn(o,gs,n)},ys=ds("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,r.color!=="inherit"&&t[`color${Oe(r.color)}`],t[`fontSize${Oe(r.fontSize)}`]]}})(ps(({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:t=>!t.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(([,t])=>t&&t.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}}]}))),lt=Ae.forwardRef(function(t,r){const n=ms({props:t,name:"MuiSvgIcon"}),{children:o,className:i,color:c="inherit",component:l="svg",fontSize:f="medium",htmlColor:u,inheritViewBox:y=!1,titleAccess:d,viewBox:g="0 0 24 24",...v}=n,h=Ae.isValidElement(o)&&o.type==="svg",a={...n,color:c,component:l,fontSize:f,instanceFontSize:t.fontSize,inheritViewBox:y,viewBox:g,hasSvgAsChild:h},b={};y||(b.viewBox=g);const x=hs(a);return w.jsxs(ys,{as:l,className:ro(x.root,i),focusable:"false",color:u,"aria-hidden":d?void 0:!0,role:d?"img":void 0,ref:r,...b,...v,...h&&o.props,ownerState:a,children:[h?o.props.children:o,d?w.jsx("title",{children:d}):null]})});process.env.NODE_ENV!=="production"&&(lt.propTypes={children:W.node,classes:W.object,className:W.string,color:W.oneOfType([W.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),W.string]),component:W.elementType,fontSize:W.oneOfType([W.oneOf(["inherit","large","medium","small"]),W.string]),htmlColor:W.string,inheritViewBox:W.bool,shapeRendering:W.string,sx:W.oneOfType([W.arrayOf(W.oneOfType([W.func,W.object,W.bool])),W.func,W.object]),titleAccess:W.string,viewBox:W.string});lt.muiName="SvgIcon";function un(e,t){function r(n,o){return w.jsx(lt,{"data-testid":`${t}Icon`,ref:o,...n,children:e})}return process.env.NODE_ENV!=="production"&&(r.displayName=`${t}Icon`),r.muiName=lt.muiName,Ae.memo(Ae.forwardRef(r))}const Ss=un(w.jsx("path",{d:"m17 7-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4z"}),"Logout"),de={ACCOUNTS:"spry_accounts",BRIDGE_ACCOUNTS:"spry_accounts_shared_state",ADD_ACCOUNT_IN_PROGRESS:"spry_add_account_in_progress",RETURN_URL:"spry_return_url",TEMP_CURRENT_USER:"spry_temp_current_user"},He={ACCESS_TOKEN_BUFFER_SECONDS:60,REFRESH_TOKEN_BUFFER_SECONDS:300,STALE_CHECK_INTERVAL_MS:1e3},me={INVALID_TOKEN:"Invalid or malformed token",TOKEN_DECODE_FAILED:"Failed to decode token",ACCOUNT_NOT_FOUND:"Account not found",SIGNIN_REDIRECT_FAILED:"Failed to initiate sign-in redirect",LOGOUT_FAILED:"Failed to logout from Keycloak, but account will be removed locally.",TOKEN_REFRESH_FAILED:"Failed to refresh token for account",SSO_CLEAR_FAILED:"Failed to clear SSO session. Please sign out first if prompted by Keycloak."},fn={LOCALSTORAGE_XSS_WARNING:"⚠️ Tokens stored in localStorage are vulnerable to XSS. Ensure CSP headers are configured.",ACCOUNT_MARKED_STALE:"Account refresh token expired. Click to re-authenticate.",NO_ACCOUNTS:"No additional accounts stored. Your primary auth remains active.",REDIRECT_IN_PROGRESS:"Redirecting to Keycloak for authentication..."},dn="https://sprylogin.com/apps-api/sync-bridge.html";function Be(e){try{const t=e.split(".");if(t.length!==3)return console.warn(me.INVALID_TOKEN),null;const r=t[1];return JSON.parse(decodeURIComponent(atob(r).split("").map(o=>"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(t){return console.warn(me.TOKEN_DECODE_FAILED,t),null}}function Et(e,t=He.ACCESS_TOKEN_BUFFER_SECONDS){if(!e)return!0;const r=Be(e);if(!r||typeof r.exp!="number")return!0;const n=r.exp*1e3,o=Date.now(),i=t*1e3;return o>=n-i}function er(e,t=He.REFRESH_TOKEN_BUFFER_SECONDS){if(!e)return!0;const r=Be(e);if(!r||typeof r.exp!="number")return!0;const n=r.exp*1e3,o=Date.now(),i=t*1e3;return o>=n-i}function bs(e){if(!e)return null;const t=Be(e);return!t||typeof t.exp!="number"?null:t.exp*1e3}function vs(e){if(!e)return-1;const t=Be(e);if(!t||typeof t.exp!="number")return-1;const r=t.exp*1e3,n=Date.now(),o=r-n;return Math.max(0,o/1e3)}function Me(e){const t=e.profile||{},r=t.email||"unknown@example.com",n=t.given_name,o=t.name||n||r.split("@")[0],i=t.picture;return{email:r,name:o,avatar:i}}function pn(e){return!!(e.isStale||er(e.user.refresh_token)||!e.user.refresh_token&&Et(e.user.access_token))}function Es(e){return Et(e,He.ACCESS_TOKEN_BUFFER_SECONDS)}function ws(e){return er(e,He.REFRESH_TOKEN_BUFFER_SECONDS)}function As(e){if(!e)return!1;const t=Be(e);if(!t||typeof t.exp!="number")return!1;const r=t.exp*1e3;return Date.now()<r}function Cs({account:e,isActive:t,isLoading:r,onSwitch:n,onRemove:o,onRefresh:i}){const{email:c,name:l,avatar:f}=Me(e.user),[u,y]=_.useState(!1),[d,g]=_.useState(!1),v=async b=>{b.stopPropagation(),y(!0);try{await o()}finally{y(!1)}},h=async b=>{b.stopPropagation(),g(!0);try{await i()}finally{g(!1)}},a=async()=>{r||await n()};return w.jsx(_.Fragment,{children:w.jsxs(I.ListItemButton,{selected:t,onClick:a,disabled:r,sx:{opacity:t?1:.8,backgroundColor:t?"action.selected":"inherit","&:hover":{backgroundColor:t?"action.selected":"action.hover"}},children:[w.jsx(I.ListItemIcon,{children:w.jsx(I.Avatar,{src:f,alt:l,sx:{width:32,height:32,bgcolor:"primary.main",fontSize:"0.875rem"},children:l.charAt(0).toUpperCase()})}),w.jsx(I.ListItemText,{primary:w.jsxs(I.Box,{display:"flex",alignItems:"center",gap:1,children:[w.jsx("span",{children:l}),t&&w.jsx(I.Chip,{label:"Active",size:"small",color:"primary",variant:"outlined",sx:{height:20}}),e.isStale&&!t&&w.jsx(I.Chip,{label:"Stale",size:"small",color:"warning",variant:"filled",sx:{height:20}})]}),secondary:c,secondaryTypographyProps:{noWrap:!0}}),!t&&w.jsxs(I.ListItemSecondaryAction,{children:[e.isStale&&w.jsx(I.IconButton,{edge:"end",size:"small",onClick:h,disabled:d||r,title:"Re-authenticate this account",children:d?w.jsx(I.CircularProgress,{size:20}):w.jsx(Lt.Refresh,{fontSize:"small"})}),w.jsx(I.IconButton,{edge:"end",size:"small",onClick:v,disabled:u||r,title:"Remove this account",children:u?w.jsx(I.CircularProgress,{size:20}):w.jsx(Lt.Close,{fontSize:"small"})})]})]})},e.accountId)}const tr=_.forwardRef(({accounts:e,activeAccountId:t,isLoading:r=!1,onSwitchAccount:n,onAddAccount:o,onRemoveAccount:i,onRefreshAccount:c},l)=>{const[f,u]=_.useState(!1),y=async()=>{u(!0);try{await o()}finally{u(!1)}};return w.jsx(I.Box,{ref:l,sx:{width:"100%",maxWidth:360,bgcolor:"background.paper"},children:e.length===0?w.jsxs(I.Box,{sx:{p:2,textAlign:"center"},children:[w.jsx(I.Typography,{variant:"body2",color:"textSecondary",sx:{mb:2},children:"No additional accounts logged in"}),w.jsx("button",{onClick:y,disabled:f||r,style:{padding:"8px 16px",borderRadius:"4px",border:"1px solid #ccc",background:"#fff",cursor:"pointer"},children:f?"Adding Account...":"Add Account"})]}):w.jsxs(w.Fragment,{children:[w.jsx(I.List,{children:e.map(d=>w.jsx(Cs,{account:d,isActive:d.accountId===t,isLoading:r,onSwitch:()=>n(d.accountId),onRemove:()=>i(d.accountId),onRefresh:()=>c(d.accountId)},d.accountId))}),w.jsx(I.Divider,{sx:{my:1}}),w.jsx(I.Box,{sx:{p:1},children:w.jsxs(I.ListItemButton,{onClick:y,disabled:f||r,sx:{justifyContent:"center",py:1},children:[w.jsx(Lt.Add,{sx:{mr:1},fontSize:"small"}),w.jsx(I.Typography,{variant:"button",sx:{fontSize:"0.875rem"},children:f?"Adding...":"Add Another Account"})]})})]})})});tr.displayName="AccountList";function mn({profile:e,isLoading:t,onSignOut:r,onManageAccount:n,accountManager:o}){const i="https://sprylogin.com/my-account/",[c,l]=_.useState(null),[f,u]=_.useState(!1),y=o?.accounts.length??0,d=m=>{l(m.currentTarget)},g=()=>{l(null),u(!1)},v=()=>{o&&o.activeAccount?o.removeAccount(o.activeAccount.accountId):(g(),r&&r()),g()},h=()=>{g(),n?n():e?.manageAccountUrl?window.location.href=e.manageAccountUrl:window.location.href=i},a=!!c,b=()=>{if(o?.activeAccount){const{name:m,email:p}=Me(o.activeAccount.user);if(m)return m.split(" ").map(E=>E[0]).join("").slice(0,2).toUpperCase();if(p)return p[0].toUpperCase()}return e?.firstName&&e?.lastName?`${e.firstName[0]}${e.lastName[0]}`.toUpperCase():e?.firstName?e.firstName[0].toUpperCase():e?.email?e.email[0].toUpperCase():"?"},x=()=>{if(o?.activeAccount){const{name:m}=Me(o.activeAccount.user);return m}return e?.firstName&&e?.lastName?`${e.firstName} ${e.lastName}`:e?.firstName?e.firstName:e?.email?e.email.split("@")[0]:"User"},T=()=>{if(o?.activeAccount){const{email:m}=Me(o.activeAccount.user);return m}return e?.email||"No email"},C=()=>{if(o?.activeAccount){const{avatar:m}=Me(o.activeAccount.user);return m||null}return e?.avatar||null};return w.jsxs(w.Fragment,{children:[w.jsx(I.IconButton,{onClick:d,sx:{p:.5,"&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},disabled:t&&!e,children:t&&!e?w.jsx(I.CircularProgress,{size:32}):w.jsx(I.Avatar,{src:C()||void 0,sx:{width:32,height:32,bgcolor:"#1a73e8",fontSize:"0.875rem",fontWeight:500},children:b()})}),w.jsx(I.Menu,{anchorEl:c,open:a,onClose:g,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{width:300,mt:.5,overflow:"visible",boxShadow:"0 2px 8px rgba(0,0,0,0.15)",borderRadius:"8px"}}},children:f?w.jsxs(I.Box,{children:[w.jsxs(I.Box,{sx:{px:1.5,py:1.25,display:"flex",alignItems:"center",gap:.75},children:[w.jsx(I.Button,{size:"small",onClick:()=>u(!1),sx:{textTransform:"none",color:"#1a73e8",fontSize:"0.75rem",p:.5,minWidth:"auto"},children:"← Back"}),w.jsx(I.Typography,{variant:"caption",sx:{fontWeight:600,flex:1,fontSize:"0.75rem"},children:"Accounts"})]}),w.jsx(I.Divider,{sx:{my:0}}),w.jsx(I.Box,{sx:{px:.75,py:.75},children:o&&w.jsx(tr,{accounts:o.accounts,activeAccountId:o.activeAccount?.accountId||null,isLoading:!1,onSwitchAccount:o.switchAccount,onAddAccount:o.addNewAccount,onRemoveAccount:o.removeAccount,onRefreshAccount:o.refreshAccountToken})})]}):w.jsxs(I.Box,{children:[w.jsxs(I.Box,{sx:{px:1.5,py:1.5},children:[w.jsxs(I.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",mb:1.25},children:[w.jsx(I.Avatar,{src:C()||void 0,sx:{width:56,height:56,bgcolor:"#1a73e8",fontSize:"1.25rem",fontWeight:500,mb:1},children:b()},o?.activeAccount?.accountId||"profile-avatar"),w.jsx(I.Typography,{sx:{fontWeight:500,color:"text.primary",textAlign:"center",mb:.25,fontSize:"0.9rem"},children:x()}),w.jsx(I.Typography,{sx:{color:"text.secondary",textAlign:"center",wordBreak:"break-all",fontSize:"0.75rem"},children:T()})]}),w.jsx(I.Button,{variant:"outlined",fullWidth:!0,onClick:h,sx:{borderRadius:"20px",textTransform:"none",borderColor:"#dadce0",color:"#3c4043",fontWeight:500,fontSize:"0.8125rem",py:.55,"&:hover":{backgroundColor:"rgba(66, 133, 244, 0.04)",borderColor:"#dadce0"}},children:"Manage your Account"})]}),w.jsx(I.Divider,{sx:{my:0}}),o&&w.jsxs(w.Fragment,{children:[w.jsx(I.MenuItem,{onClick:()=>u(!0),sx:{py:.75,px:1.5,fontSize:"0.8125rem","&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},children:w.jsx(I.Typography,{sx:{color:"#3c4043",width:"100%",fontSize:"0.8125rem"},children:y>0?`Accounts (${y})`:"Accounts"})}),w.jsx(I.Divider,{sx:{my:0}})]}),o?.addNewAccount&&w.jsx(I.Box,{sx:{px:1.5,py:.5}}),w.jsxs(I.MenuItem,{onClick:v,sx:{py:.75,px:1.5,fontSize:"0.8125rem","&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},children:[w.jsx(I.ListItemIcon,{sx:{minWidth:32,mr:.5},children:w.jsx(Ss,{sx:{fontSize:"1rem",color:"#5f6368"}})}),w.jsx(I.Typography,{sx:{color:"#3c4043",fontSize:"0.8125rem"},children:"Sign out"})]})]})})]})}const Dt="spry_profile_cache",xs=300*1e3,Ts=300*1e3;function gn(e,t={}){const{refetchInterval:r=xs,cacheTime:n=Ts,getAuthToken:o,headers:i={}}=t,[c,l]=_.useState(null),[f,u]=_.useState(!0),[y,d]=_.useState(null),g=_.useRef(null),v=_.useRef(null),h=_.useCallback(()=>{try{const x=localStorage.getItem(Dt);if(!x)return null;const T=JSON.parse(x);return Date.now()-T.timestamp<n?T.profile:(localStorage.removeItem(Dt),null)}catch(x){return console.error("Error loading profile from cache:",x),null}},[n]),a=_.useCallback(x=>{try{const T={profile:x,timestamp:Date.now()};localStorage.setItem(Dt,JSON.stringify(T))}catch(T){console.error("Error saving profile to cache:",T)}},[]),b=_.useCallback(async()=>{v.current&&v.current.abort(),v.current=new AbortController;try{u(!0),d(null);let x=null;o&&(x=await Promise.resolve(o()));const T={Accept:"application/json",...i};x&&(T.Authorization=`Bearer ${x}`);const C=await fetch(`${e}/api/profile`,{signal:v.current.signal,headers:T});if(!C.ok)throw new Error(`HTTP error! status: ${C.status}`);const m=await C.json();l(m),a(m),d(null)}catch(x){if(x instanceof Error&&x.name==="AbortError")return;const T=x instanceof Error?x.message:"Failed to fetch profile";d(T),console.error("Error fetching profile:",x);const C=h();C&&l(C)}finally{u(!1)}},[e,o,i,h,a]);return _.useEffect(()=>{const x=h();return x&&(l(x),u(!1)),b(),r>0&&(g.current=window.setInterval(()=>{b()},r)),()=>{g.current&&window.clearInterval(g.current),v.current&&v.current.abort()}},[e,r,n]),{profile:c,isLoading:f,error:y,refetch:b}}function hn({apiUrl:e,onSignOut:t,onManageAccount:r,accountManager:n,...o}){const{profile:i,isLoading:c,error:l}=gn(e,o);return l&&console.error("Error loading profile:",l),w.jsx(mn,{profile:i,isLoading:c,onSignOut:t,onManageAccount:r,accountManager:n})}const _s=un(w.jsx("path",{d:"M4 8h4V4H4zm6 12h4v-4h-4zm-6 0h4v-4H4zm0-6h4v-4H4zm6 0h4v-4h-4zm6-10v4h4V4zm-6 4h4V4h-4zm6 6h4v-4h-4zm0 6h4v-4h-4z"}),"Apps");function Rs({apiUrl:e,profileApiUrl:t,onSignOut:r,getAuthToken:n,profileHeaders:o,showAppsDropdown:i=!0,showProfileMenu:c=!0,appsRefetchInterval:l=300*1e3,appsCacheTime:f=300*1e3,profileRefetchInterval:u=300*1e3,profileCacheTime:y=300*1e3,accountManager:d}){const[g,v]=_.useState(!1),h=_.useRef(null),a=t||e;return w.jsxs(I.Stack,{direction:"row",spacing:1,alignItems:"center",children:[i&&w.jsxs(w.Fragment,{children:[w.jsx(I.IconButton,{ref:h,onClick:()=>v(!g),sx:{color:"#5f6368","&:hover":{bgcolor:"rgba(60, 64, 67, 0.08)"}},"aria-label":"Google apps",children:w.jsx(_s,{})}),w.jsx(or,{apiUrl:e,open:g,onClose:()=>v(!1),buttonRef:h,refetchInterval:l,cacheTime:f})]}),c&&w.jsx(hn,{apiUrl:a,onSignOut:r,refetchInterval:u,cacheTime:y,getAuthToken:n,headers:o,accountManager:d})]})}var rr=_.createContext(void 0);rr.displayName="AuthContext";var Os={isLoading:!0,isAuthenticated:!1},Is=(e,t)=>{switch(t.type){case"INITIALISED":case"USER_LOADED":return{...e,user:t.user,isLoading:!1,isAuthenticated:t.user?!t.user.expired:!1,error:void 0};case"USER_SIGNED_OUT":case"USER_UNLOADED":return{...e,user:void 0,isAuthenticated:!1};case"NAVIGATOR_INIT":return{...e,isLoading:!0,activeNavigator:t.method};case"NAVIGATOR_CLOSE":return{...e,isLoading:!1,activeNavigator:void 0};case"ERROR":{const r=t.error;return r.toString=()=>`${r.name}: ${r.message}`,{...e,isLoading:!1,error:r}}default:{const r=new TypeError(`unknown type ${t.type}`),n={name:r.name,message:r.message,innerError:r,stack:r.stack,source:"unknown"};return n.toString=()=>`${n.name}: ${n.message}`,{...e,isLoading:!1,error:n}}}},$s=(e=window.location)=>{let t=new URLSearchParams(e.search);return!!((t.get("code")||t.get("error"))&&t.get("state")||(t=new URLSearchParams(e.hash.replace("#","?")),(t.get("code")||t.get("error"))&&t.get("state")))},ks=nr("signinCallback","Sign-in failed"),Ps=nr("signoutCallback","Sign-out failed"),Ns=nr("renewSilent","Renew silent failed");function yn(e,t){return{name:Mt(e,"name",()=>"Error"),message:Mt(e,"message",()=>t),stack:Mt(e,"stack",()=>new Error().stack),innerError:e}}function nr(e,t){return r=>({...yn(r,t),source:e})}function Mt(e,t,r){if(e&&typeof e=="object"){const n=e[t];if(typeof n=="string")return n}return r()}var Us=["clearStaleState","querySessionStatus","revokeTokens","startSilentRenew","stopSilentRenew"],Ds=["signinPopup","signinSilent","signinRedirect","signinResourceOwnerCredentials","signoutPopup","signoutRedirect","signoutSilent"],Lr=e=>()=>{throw new Error(`UserManager#${e} was called from an unsupported context. If this is a server-rendered page, defer this call with useEffect() or pass a custom UserManager implementation.`)},Br=typeof window>"u"?null:Ge.UserManager,Ms=e=>{const{children:t,onSigninCallback:r,skipSigninCallback:n,matchSignoutCallback:o,onSignoutCallback:i,onRemoveUser:c,userManager:l=null,...f}=e,[u]=_.useState(()=>l??(Br?new Br(f):{settings:f})),[y,d]=_.useReducer(Is,Os),g=_.useMemo(()=>Object.assign({settings:u.settings,events:u.events},Object.fromEntries(Us.map(b=>{var x,T;return[b,(T=(x=u[b])==null?void 0:x.bind(u))!=null?T:Lr(b)]})),Object.fromEntries(Ds.map(b=>[b,u[b]?async x=>{d({type:"NAVIGATOR_INIT",method:b});try{return await u[b](x)}catch(T){return d({type:"ERROR",error:{...yn(T,`Unknown error while executing ${b}(...).`),source:b,args:x}}),null}finally{d({type:"NAVIGATOR_CLOSE"})}}:Lr(b)]))),[u]),v=_.useRef(!1);_.useEffect(()=>{!u||v.current||(v.current=!0,(async()=>{try{let b=null;$s()&&!n&&(b=await u.signinCallback(),r&&await r(b)),b=b||await u.getUser(),d({type:"INITIALISED",user:b})}catch(b){d({type:"ERROR",error:ks(b)})}try{if(o&&o(u.settings)){const b=await u.signoutCallback();i&&await i(b)}}catch(b){d({type:"ERROR",error:Ps(b)})}})())},[u,n,r,i,o]),_.useEffect(()=>{if(!u)return;const b=m=>{d({type:"USER_LOADED",user:m})};u.events.addUserLoaded(b);const x=()=>{d({type:"USER_UNLOADED"})};u.events.addUserUnloaded(x);const T=()=>{d({type:"USER_SIGNED_OUT"})};u.events.addUserSignedOut(T);const C=m=>{d({type:"ERROR",error:Ns(m)})};return u.events.addSilentRenewError(C),()=>{u.events.removeUserLoaded(b),u.events.removeUserUnloaded(x),u.events.removeUserSignedOut(T),u.events.removeSilentRenewError(C)}},[u]);const h=_.useCallback(async()=>{await u.removeUser(),c&&await c()},[u,c]),a=_.useMemo(()=>({...y,...g,removeUser:h}),[y,g,h]);return _.createElement(rr.Provider,{value:a},t)},Sn=()=>{const e=_.useContext(rr);return e||console.warn("AuthProvider context is undefined, please verify you are calling useAuth() as child of a <AuthProvider> component."),e};const bn=_.createContext(null),js=()=>{typeof window>"u"||window.history.replaceState({},document.title,window.location.pathname)},Ls=e=>{if(typeof window>"u")return!1;const t=e.post_logout_redirect_uri||e.redirect_uri;return t?window.location.href.startsWith(t):!1},Bs=e=>{if(typeof window>"u")return;const t=e.post_logout_redirect_uri||e.redirect_uri||window.location.origin;window.location.href!==t?window.history.replaceState({},document.title,t):window.history.replaceState({},document.title,window.location.pathname)};function Fs({children:e,config:t,onSigninCallback:r,matchSignoutCallback:n,onSignoutCallback:o,onRemoveUser:i,skipSigninCallback:c}){const l=_.useMemo(()=>({...t,post_logout_redirect_uri:t.post_logout_redirect_uri||t.redirect_uri||(typeof window<"u"?window.location.origin:void 0)}),[t]),f=_.useMemo(()=>new Ge.UserManager(l),[l]),u=_.useMemo(()=>({authority:l.authority,client_id:l.client_id,redirect_uri:l.redirect_uri,post_logout_redirect_uri:l.post_logout_redirect_uri}),[l]),y=r||js,d=n||Ls,g=o||(()=>Bs(l));return w.jsx(bn.Provider,{value:{keycloakConfig:u,userManager:f,syncBridgeUrl:dn},children:w.jsx(Ms,{userManager:f,onSigninCallback:y,matchSignoutCallback:d,onSignoutCallback:g,onRemoveUser:i,skipSigninCallback:c,children:e})})}function vn(){const e=_.useContext(bn);if(!e)throw new Error("useSpryAuthContext must be used within SpryAuthProvider");return e}function zs(e){const t=e.profile?.email||e.profile?.sub||"unknown",r=Date.now();return`account_${t.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_${r}`}function re(){try{const e=localStorage.getItem(de.ACCOUNTS);return e?JSON.parse(e):{accounts:[],activeAccountId:null,lastUpdated:Date.now()}}catch(e){return console.error("Failed to read accounts from localStorage:",e),{accounts:[],activeAccountId:null,lastUpdated:Date.now()}}}function le(){return re().accounts}function Ie(e){try{localStorage.setItem(de.ACCOUNTS,JSON.stringify(e))}catch(t){console.error("Failed to save accounts to localStorage:",t)}}function En(e,t=null){const r=re(),n={accounts:e,activeAccountId:t??r.activeAccountId,lastUpdated:Date.now()};Ie(n)}function De(e){const t=re(),r=zs(e),n=e.profile?.sub,o=e.profile?.email,i=t.accounts.findIndex(f=>n&&f.user.profile?.sub?f.user.profile.sub===n:o&&f.user.profile?.email?f.user.profile.email===o:!1),l={...{accountId:r,lastUsed:Date.now(),isStale:!1,createdAt:Date.now()},user:e};return i>=0?t.accounts[i]=l:t.accounts.push(l),t.lastUpdated=Date.now(),Ie(t),r}function wt(e){const t=re();t.accounts=t.accounts.filter(r=>r.accountId!==e),t.activeAccountId===e&&(t.activeAccountId=null),t.lastUpdated=Date.now(),Ie(t)}function se(e){const t=re();t.activeAccountId=e,t.lastUpdated=Date.now(),Ie(t)}function wn(){const e=re();return e.activeAccountId&&e.accounts.find(t=>t.accountId===e.activeAccountId)||null}function An(){return re().activeAccountId}function Cn(e,t){const r=re(),n=r.accounts.find(o=>o.accountId===e);n&&(n.user=t,n.lastUsed=Date.now(),n.isStale=!1,r.lastUpdated=Date.now(),Ie(r))}function xn(e){const t=re(),r=t.accounts.find(n=>n.accountId===e);r&&(r.isStale=!0,t.lastUpdated=Date.now(),Ie(t))}function Vs(){localStorage.removeItem(de.ACCOUNTS)}function Ws(e){const r=re().accounts.find(n=>n.accountId===e);return r?{accountId:r.accountId,lastUsed:r.lastUsed,isStale:r.isStale,createdAt:r.createdAt}:null}function ot(e){e?localStorage.setItem(de.ADD_ACCOUNT_IN_PROGRESS,"true"):localStorage.removeItem(de.ADD_ACCOUNT_IN_PROGRESS)}function it(){return localStorage.getItem(de.ADD_ACCOUNT_IN_PROGRESS)==="true"}function Tn(e){localStorage.setItem(de.RETURN_URL,e)}function _n(){return localStorage.getItem(de.RETURN_URL)}function Vt(){localStorage.removeItem(de.RETURN_URL)}function Rn(e){localStorage.setItem(de.TEMP_CURRENT_USER,JSON.stringify(e))}function Gs(){try{const e=localStorage.getItem(de.TEMP_CURRENT_USER);return e?JSON.parse(e):null}catch{return null}}function Wt(){localStorage.removeItem(de.TEMP_CURRENT_USER)}async function On(e,t){try{const r=`${t.authority.replace(/\/$/,"")}/soft-logout`,n="openid profile email offline_access",o=t.redirect_uri||window.location.origin,i=`${t.authority.replace(/\/$/,"")}/protocol/openid-connect/auth?client_id=${encodeURIComponent(t.client_id)}&redirect_uri=${encodeURIComponent(o)}&response_type=code&scope=${encodeURIComponent(n)}`;return window.location.href=`${r}?post_logout_redirect_uri=${encodeURIComponent(i)}`,!0}catch(r){return console.error("Failed to clear SSO session:",r),console.warn(me.SSO_CLEAR_FAILED),!1}}async function In(e,t,r){try{const o=le().length===1;if(!await Js(e,t)&&o)return console.warn("Token revocation failed for last account, falling back to redirect logout"),await $n(e,t,r),{success:!0,message:"Redirecting to logout...",remainingAccounts:0};wt(r),At.remove(r);const c=le(),f=c.sort((u,y)=>y.lastUsed-u.lastUsed)[0]||null;return f?(se(f.accountId),{success:!0,message:`Logged out. Switched to ${f.user.profile?.email||f.user.profile?.sub}`,remainingAccounts:c.length}):(se(null),{success:!0,message:"Logged out. No other accounts available.",remainingAccounts:0})}catch(n){return console.error("Error during logout:",n),{success:!1,message:`Logout failed: ${n instanceof Error?n.message:"Unknown error"}`,remainingAccounts:le().length}}}async function Ys(e,t){const r=e.map(n=>$n(n.user,t,n.accountId).catch(o=>{console.warn(`Failed to logout ${n.accountId}:`,o)}));return await Promise.all(r),e.forEach(n=>{wt(n.accountId),At.remove(n.accountId)}),se(null),{success:!0,message:"All accounts logged out.",remainingAccounts:0}}function Ks(e){wt(e);const t=le();if(t.length>0){const n=t.sort((o,i)=>i.lastUsed-o.lastUsed)[0];return se(n.accountId),{success:!0,message:`Account removed locally. Switched to ${n.user.profile?.email||n.user.profile?.sub}`,remainingAccounts:t.length-1}}else return se(null),{success:!0,message:"Account removed. No other accounts available.",remainingAccounts:0}}async function qs(e,t){try{return new Ge.UserManager({authority:e.authority,client_id:e.client_id,redirect_uri:e.redirect_uri||window.location.origin,post_logout_redirect_uri:e.post_logout_redirect_uri||e.redirect_uri||window.location.origin,response_type:"code",scope:"openid profile email offline_access",userStore:new Ge.WebStorageStateStore({prefix:`oidc_${t}`})})}catch(r){throw console.error("Failed to create UserManager:",r),new Error("oidc-client-ts library not found. Ensure it is installed in consuming app.")}}class Hs{pool=new Map;async getOrCreate(t,r){if(!this.pool.has(r)){const o=await qs(t,r);this.pool.set(r,o)}const n=this.pool.get(r);if(!n)throw new Error(`UserManager not found for ${r}`);return n}remove(t){this.pool.delete(t)}clear(){this.pool.clear()}has(t){return this.pool.has(t)}}const At=new Hs;async function Gt(e,t,r){if(!t.refresh_token)return console.warn(`${me.TOKEN_REFRESH_FAILED} (${e}): missing refresh token`),null;const n=`${r.authority.replace(/\/$/,"")}/protocol/openid-connect/token`;try{const o=await fetch(n,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",client_id:r.client_id,refresh_token:t.refresh_token}).toString()});if(!o.ok){const l=await o.text();return console.warn(`${me.TOKEN_REFRESH_FAILED} (${e}):`,l),null}const i=await o.json(),c={access_token:i.access_token,refresh_token:i.refresh_token||t.refresh_token,id_token:i.id_token||t.id_token,expires_in:i.expires_in||t.expires_in,profile:t.profile};return Cn(e,c),c}catch(o){return console.warn(`${me.TOKEN_REFRESH_FAILED} (${e}):`,o),null}}async function Fr(e,t){try{await(await At.getOrCreate(e,t)).signinRedirect()}catch(r){throw console.error(me.SIGNIN_REDIRECT_FAILED,r),r}}async function Js(e,t){try{if(!e.refresh_token)return console.warn("No refresh token available for revocation"),!1;const r=`${t.authority.replace(/\/$/,"")}/protocol/openid-connect/revoke`,n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:t.client_id,token:e.refresh_token,token_type_hint:"refresh_token"}).toString()});return!n.ok&&n.status!==204?(console.warn(`Token revocation returned ${n.status}`),!1):(console.log("✅ Token revoked successfully"),!0)}catch(r){return console.warn("Failed to revoke token:",r),!1}}async function $n(e,t,r){try{await(await At.getOrCreate(t,r)).signoutRedirect({id_token_hint:e.id_token,post_logout_redirect_uri:t.post_logout_redirect_uri||t.redirect_uri||window.location.origin})}catch(n){console.warn(me.LOGOUT_FAILED,n)}}function kn(e){const{keycloakConfig:t,initialUser:r,onAccountSwitch:n,signinRedirect:o,syncBridge:i}=e,[c,l]=_.useState([]),[f,u]=_.useState(null),y=_.useRef(!1),d=_.useRef(!1),g=_.useRef(!1),v=_.useRef(null),h=_.useCallback(m=>{const p=m.accounts;let E=m.activeAccountId;if(E&&!p.find(k=>k.accountId===E)&&(E=p[0]?.accountId||null),l(p),u(E),E){const k=p.find(N=>N.accountId===E);k&&n(k.user)}},[n]);_.useEffect(()=>{!i||g.current||(g.current=!0,i.getAccountsState().then(m=>{if(!m||!m.accounts.length)return;m.accounts.forEach(E=>{De(E.user)}),m.activeAccountId&&se(m.activeAccountId);const p=re();h(p)}))},[h,i]),_.useEffect(()=>{if(d.current)return;if(it())if(console.log("🔄 Detected redirect callback for add account flow"),r){const p=le(),E=r.profile?.sub,k=r.profile?.email;if(p.some(L=>E&&L.user.profile?.sub?L.user.profile.sub===E:k&&L.user.profile?.email?L.user.profile.email===k:!1)){console.log("⏳ initialUser matches an existing account, waiting for new user...");return}d.current=!0,console.log("✅ Primary auth populated initialUser, processing new account...");const P=De(r);console.log(`✅ Added new account: ${P}`),se(P),ot(!1);const s=_n();Wt(),Vt();const $=re();l($.accounts),u(P),i&&i.setAccountsState($),n(r),console.log("✅ Account switch completed"),s&&s!==window.location.href&&(console.log(`🔄 Navigating back to: ${s}`),window.location.assign(s))}else console.log("⏳ Waiting for primary auth to populate initialUser...")},[r,n]),_.useEffect(()=>{(async()=>{const m=async()=>!(localStorage.getItem("spry_add_account_pending")!=="1"||d.current);let p=0;for(;p<10&&!await m();)await new Promise(E=>setTimeout(E,150)),p++;if(await m())if(localStorage.removeItem("spry_add_account_pending"),console.log("🔄 Soft-logout completed, initiating signinRedirect..."),o)o().catch(E=>{console.error("signinRedirect failed:",E)});else{const E=`temp_add_${Date.now()}`;Fr(t,E).catch(k=>{console.error("signinRedirectForNewAccount failed:",k)})}})()},[t,o]),_.useEffect(()=>{if(!y.current&&!d.current){y.current=!0;try{const m=re();let p=m.accounts,E=m.activeAccountId;if(p.length===0&&r){const k=De(r);p=le(),E=k,se(k)}E&&!p.find(k=>k.accountId===E)&&(E=p[0]?.accountId||null,E&&se(E)),h({accounts:p,activeAccountId:E,lastUpdated:m.lastUpdated}),i&&i.setAccountsState({accounts:p,activeAccountId:E,lastUpdated:m.lastUpdated}),console.log(`📦 Loaded ${p.length} accounts from localStorage`)}catch(m){const p=m instanceof Error?m.message:"Unknown initialization error";console.error("Failed to initialize account manager:",p)}}},[h,r,n,i]),_.useEffect(()=>{if(d.current||!r||re().accounts.length>0||it())return;const p=De(r);se(p);const E=re();h(E),i&&i.setAccountsState(E),console.log("✅ Seeded initial account after auth became available")},[h,r,n,i]),_.useEffect(()=>{if(!r||d.current||it())return;const m=le(),p=r.profile?.sub,E=r.profile?.email;if(m.some(s=>p&&s.user.profile?.sub?s.user.profile.sub===p:E&&s.user.profile?.email?s.user.profile.email===E:!1))return;const N=De(r);se(N);const P=re();h(P),i&&i.setAccountsState(P),console.log("✅ Added account from auth state update")},[h,r,n,i]),_.useEffect(()=>{const m=p=>{if(p.key==="spry_accounts"){console.log("🔄 Detected cross-tab localStorage change, reloading accounts...");const E=re();h(E)}};return window.addEventListener("storage",m),()=>{window.removeEventListener("storage",m)}},[h]);const a=_.useCallback(async m=>{try{const E=le().find(N=>N.accountId===m);if(!E){console.error(me.ACCOUNT_NOT_FOUND);return}const k=v.current===m;Et(E.user.access_token)&&(console.warn("Access token expired for account:",m),xn(m)),se(m),u(m),await n(E.user),i&&await i.setAccountsState(re()),console.log(`✅ Switched to account: ${E.user.profile?.email||m}`),k?v.current=null:(v.current=m,setTimeout(async()=>{if(v.current===m){const P=le().find(s=>s.accountId===m);P&&(se(m),u(m),await n(P.user),i&&await i.setAccountsState(re())),v.current=null}},100))}catch(p){const E=p instanceof Error?p.message:"Failed to switch account";console.error(E,p),v.current=null}},[n,i]),b=_.useCallback(async()=>{try{if(console.log("🔄 Starting add new account flow..."),console.log("📦 Saving state flags to localStorage..."),r&&Rn(r),ot(!0),localStorage.setItem("spry_add_account_pending","1"),Tn(window.location.href),console.log("🔄 Clearing SSO session..."),await On(r||null,t),await new Promise(m=>setTimeout(m,1200)),console.log(fn.REDIRECT_IN_PROGRESS),o)await o();else{const m=`temp_add_${Date.now()}`;await Fr(t,m)}}catch(m){const p=m instanceof Error?m.message:"Failed to add new account";console.error(p,m),ot(!1),Vt(),Wt(),localStorage.removeItem("spry_add_account_pending")}},[t,r]),x=_.useCallback(async m=>{try{const E=le().find(P=>P.accountId===m);if(!E){console.error(me.ACCOUNT_NOT_FOUND);return}const k=await In(E.user,t,m);k.success||console.warn("Keycloak logout failed, but account removed locally:",k.message);const N=re();h(N),i&&i.setAccountsState(N)}catch(p){const E=p instanceof Error?p.message:"Failed to remove account";console.error(E,p)}},[t,h,i]),T=_.useCallback(async m=>{try{const E=le().find(P=>P.accountId===m);if(!E){console.error(me.ACCOUNT_NOT_FOUND);return}if(!await Gt(m,E.user,t)){console.error(`No refreshed user returned for ${m}`);return}const N=re();h(N),i&&i.setAccountsState(N)}catch(p){const E=p instanceof Error?p.message:"Failed to refresh token";console.error(E,p)}},[t,h,i]);_.useEffect(()=>{const m=()=>{const p=c.map(k=>({...k,isStale:pn(k)}));p.some((k,N)=>k.isStale!==c[N]?.isStale)&&(En(p),l(p))};c.length>0&&m()},[c]);const C=f&&c.find(m=>m.accountId===f)||null;return{accounts:c,activeAccount:C,switchAccount:a,addNewAccount:b,removeAccount:x,refreshAccountToken:T}}const Xs=2e3,jt=new Map;function Qs(e){if(!e?.bridgeUrl||typeof window>"u"||typeof document>"u")return null;if(jt.has(e.bridgeUrl))return jt.get(e.bridgeUrl)||null;const t=e.bridgeUrl,r=new URL(t).origin,n=e.timeoutMs??Xs;let o=null,i=!1,c=null,l=null;const f=new Map,u=()=>{o||(o=document.createElement("iframe"),o.src=t,o.title="Spry Sync Bridge",o.style.width="0",o.style.height="0",o.style.border="0",o.style.position="absolute",o.style.left="-9999px",o.style.top="-9999px",o.setAttribute("aria-hidden","true"),o.addEventListener("load",()=>{i=!0}),document.body.appendChild(o))},y=()=>(u(),i?Promise.resolve():c||(c=new Promise((T,C)=>{if(!o){c=null,C(new Error("Bridge iframe not available"));return}const m=()=>{if(i=!0,d()){E(),T();return}E(),C(new Error("Bridge iframe did not load the expected origin"))},p=()=>{E(),C(new Error("Bridge iframe failed to load"))},E=()=>{o?.removeEventListener("load",m),o?.removeEventListener("error",p),c=null};o.addEventListener("load",m),o.addEventListener("error",p)}),c)),d=()=>{if(!o||!o.contentWindow)return!1;try{const T=o.contentWindow.location.href;return!T||T==="about:blank"?!1:T.startsWith(t)}catch{return!0}},g=T=>{if(T.origin!==r)return;const C=T.data;if(!C||typeof C!="object")return;const m=C.requestId;if(!m||typeof m!="string")return;const p=f.get(m);if(p){if(f.delete(m),window.clearTimeout(p.timeoutId),C.type==="ERROR"){p.reject(new Error(C.error||"Bridge error"));return}p.resolve(C.payload??null)}},v=(T,C,m)=>m?a(T,C):b().then(()=>a(T,C)),h=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}_${Math.random().toString(16).slice(2)}`,a=(T,C)=>y().then(()=>new Promise((m,p)=>{const E=h(),k=window.setTimeout(()=>{f.delete(E),p(new Error(`Bridge request timed out: ${T}`))},n);f.set(E,{resolve:m,reject:p,timeoutId:k});try{o?.contentWindow?.postMessage({type:T,requestId:E,payload:C},"*")}catch{f.delete(E),window.clearTimeout(k),p(new Error("Bridge postMessage failed"))}})),b=()=>l||(l=v("PING",null,!0).then(()=>{}).catch(T=>{throw l=null,T}),l);window.addEventListener("message",g);const x={getAccountsState:async()=>{try{const T=await v("GET_ACCOUNTS");return!T||!Array.isArray(T.accounts)?null:{accounts:T.accounts,activeAccountId:T.activeAccountId??null,lastUpdated:Number(T.lastUpdated)||0}}catch(T){return console.warn("Sync bridge unavailable for GET_ACCOUNTS:",T),null}},setAccountsState:async T=>{try{await v("SET_ACCOUNTS",{accounts:T.accounts,activeAccountId:T.activeAccountId??null,lastUpdated:T.lastUpdated??Date.now()})}catch(C){console.warn("Sync bridge unavailable for SET_ACCOUNTS:",C)}}};return jt.set(t,x),x}function Zs(e){if(e)return{access_token:e.access_token,refresh_token:e.refresh_token,id_token:e.id_token,expires_in:e.expires_in,profile:e.profile}}function zr(e){const t=Math.floor(Date.now()/1e3),r=e.expires_in?t+e.expires_in:void 0;return new Ge.User({...e,token_type:"Bearer",profile:e.profile||{sub:""},expires_at:r})}function ea(){const e=Sn(),{keycloakConfig:t,userManager:r,syncBridgeUrl:n}=vn(),o=_.useRef(!1),i=_.useMemo(()=>Qs(n?{bridgeUrl:n}:null),[n]),c=kn({keycloakConfig:t,initialUser:Zs(e.user),signinRedirect:e.signinRedirect,syncBridge:i,onAccountSwitch:async f=>{let u=f;const y=le(),d=f.profile?.sub,g=f.profile?.email,v=y.find(a=>d&&a.user.profile?.sub?a.user.profile.sub===d:g&&a.user.profile?.email?a.user.profile.email===g:!1);if(v&&f.refresh_token){const a=await Gt(v.accountId,f,t);a&&(u=a)}const h=zr(u);await r.storeUser(h),await r.events.load(h),window.dispatchEvent(new CustomEvent("auth:account-switched",{detail:{user:u}}))}});_.useEffect(()=>{if(o.current||e.isAuthenticated||e.isLoading||e.activeNavigator)return;const f=wn();if(!f)return;o.current=!0,(async()=>{let y=f.user;if(y.refresh_token){const g=await Gt(f.accountId,y,t);g&&(y=g)}const d=zr(y);await r.storeUser(d),await r.events.load(d)})().catch(y=>{console.log("Restore from stored account failed:",y)})},[c.accounts.length,e,t,r]);const l=_.useCallback(async f=>{await c.removeAccount(f),An()||await r.removeUser()},[c,r]);return _.useMemo(()=>({...c,removeAccount:l}),[c,l])}function ta(){return Sn()}function or({apiUrl:e,open:t,onClose:r,buttonRef:n,refetchInterval:o,cacheTime:i}){const{apps:c,isLoading:l,error:f,refetch:u}=Wr(e,{refetchInterval:o,cacheTime:i});return w.jsx(Vr,{apps:c,open:t,onClose:r,buttonRef:n,isLoading:l,error:f,onRetry:u})}exports.AccountList=tr;exports.AppsDropdown=Vr;exports.AppsDropdownConnected=or;exports.ERROR_MESSAGES=me;exports.INFO_MESSAGES=fn;exports.ProfileMenu=mn;exports.ProfileMenuConnected=hn;exports.STORAGE_KEYS=de;exports.SYNC_BRIDGE_URL=dn;exports.SpryAuthProvider=Fs;exports.TOKEN_VALIDATION=He;exports.TopBar=Rs;exports.addAccount=De;exports.clearAllAccounts=Vs;exports.clearReturnUrl=Vt;exports.clearSSOSessionBeforeAddAccount=On;exports.clearTempCurrentUser=Wt;exports.decodeToken=Be;exports.default=or;exports.extractUserInfo=Me;exports.getAccountMetadata=Ws;exports.getAccounts=le;exports.getAccountsState=re;exports.getActiveAccount=wn;exports.getActiveAccountId=An;exports.getReturnUrl=_n;exports.getTempCurrentUser=Gs;exports.getTokenExpiryTime=bs;exports.getTokenTimeRemaining=vs;exports.isAccessTokenValid=As;exports.isAccountStale=pn;exports.isAddAccountInProgress=it;exports.isRefreshTokenExpired=er;exports.isTokenExpired=Et;exports.logoutAccount=In;exports.logoutAccountLocally=Ks;exports.logoutAllAccounts=Ys;exports.markAccountStale=xn;exports.removeAccount=wt;exports.saveAccounts=En;exports.saveAccountsState=Ie;exports.saveTempCurrentUser=Rn;exports.setActiveAccount=se;exports.setAddAccountInProgress=ot;exports.setReturnUrl=Tn;exports.shouldRefreshAccessToken=Es;exports.shouldRefreshRefreshToken=ws;exports.updateAccountTokens=Cn;exports.useAccountManager=kn;exports.useAppsData=Wr;exports.useProfileData=gn;exports.useSpryAccountManager=ea;exports.useSpryAuth=ta;exports.useSpryAuthContext=vn;
|
|
35
35
|
//# sourceMappingURL=index.cjs.map
|