@tom2012/cc-web 2026.6.13-c → 2026.6.13-e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.json +2 -0
  2. package/backend/dist/__tests__/login-events.test.d.ts +2 -0
  3. package/backend/dist/__tests__/login-events.test.d.ts.map +1 -0
  4. package/backend/dist/__tests__/login-events.test.js +90 -0
  5. package/backend/dist/__tests__/login-events.test.js.map +1 -0
  6. package/backend/dist/__tests__/project-status.test.d.ts +2 -0
  7. package/backend/dist/__tests__/project-status.test.d.ts.map +1 -0
  8. package/backend/dist/__tests__/project-status.test.js +102 -0
  9. package/backend/dist/__tests__/project-status.test.js.map +1 -0
  10. package/backend/dist/config.d.ts +9 -0
  11. package/backend/dist/config.d.ts.map +1 -1
  12. package/backend/dist/config.js +17 -0
  13. package/backend/dist/config.js.map +1 -1
  14. package/backend/dist/index.d.ts.map +1 -1
  15. package/backend/dist/index.js +74 -0
  16. package/backend/dist/index.js.map +1 -1
  17. package/backend/dist/login-events.d.ts +27 -0
  18. package/backend/dist/login-events.d.ts.map +1 -0
  19. package/backend/dist/login-events.js +68 -0
  20. package/backend/dist/login-events.js.map +1 -0
  21. package/backend/dist/routes/auth.d.ts.map +1 -1
  22. package/backend/dist/routes/auth.js +58 -18
  23. package/backend/dist/routes/auth.js.map +1 -1
  24. package/backend/dist/terminal-manager.js +6 -6
  25. package/backend/dist/terminal-manager.js.map +1 -1
  26. package/bin/ccweb.js +35 -13
  27. package/frontend/dist/assets/{ChatOverlay-BRKFIdip.js → ChatOverlay-DCDmC0Ig.js} +3 -3
  28. package/frontend/dist/assets/{ClaudeMemPage-BJXNbVri.js → ClaudeMemPage-CK2Ceogj.js} +1 -1
  29. package/frontend/dist/assets/{GraphPreview-DWkoBDw7.js → GraphPreview-yUeV2YPI.js} +1 -1
  30. package/frontend/dist/assets/{MobilePage-xWYQCVpe.js → MobilePage-D62Dze6k.js} +3 -3
  31. package/frontend/dist/assets/{OfficePreview-mG-c3-eD.js → OfficePreview-OCMu15Es.js} +2 -2
  32. package/frontend/dist/assets/{PdfPreview-LpHVDc0B.js → PdfPreview-D9BTZyNH.js} +1 -1
  33. package/frontend/dist/assets/{ProjectPage-5iSt8qJ0.js → ProjectPage-BrudnOeN.js} +3 -3
  34. package/frontend/dist/assets/{ProjectSettingsPage-CHpaFSH9.js → ProjectSettingsPage-DsS6M9fI.js} +1 -1
  35. package/frontend/dist/assets/{SettingsPage-DB0DKGyP.js → SettingsPage-CPP6ljrA.js} +1 -1
  36. package/frontend/dist/assets/{SkillHubPage-ldsS5_lE.js → SkillHubPage-BePTeB2c.js} +1 -1
  37. package/frontend/dist/assets/{check-circle-2-CZX-PYDg.js → check-circle-2-fJ0bVOko.js} +1 -1
  38. package/frontend/dist/assets/{chevron-down-Baaa_7Xz.js → chevron-down-CiltYw1c.js} +1 -1
  39. package/frontend/dist/assets/{file-text-Bce74_ZZ.js → file-text-Cq5RdypO.js} +1 -1
  40. package/frontend/dist/assets/{index-Vc7KSrAS.js → index-Bi6It4s6.js} +1 -1
  41. package/frontend/dist/assets/{index-Do7n5H3P.js → index-DLVgSsZT.js} +1 -1
  42. package/frontend/dist/assets/{index---z4AYZg.js → index-iDUel6Zw.js} +3 -3
  43. package/frontend/dist/assets/{jszip.min-ROgSua4f.js → jszip.min-Z9DNjLJt.js} +1 -1
  44. package/frontend/dist/assets/{save-DEyMBCOK.js → save-I4MvlX-M.js} +1 -1
  45. package/frontend/dist/assets/{search-BR_ML1Dg.js → search-YZPbiA4P.js} +1 -1
  46. package/frontend/dist/assets/{select-DgXuPzBS.js → select-CmSO1dzX.js} +1 -1
  47. package/frontend/dist/assets/{tabs-BYtX_ERm.js → tabs-DRHp9DRE.js} +1 -1
  48. package/frontend/dist/assets/{textarea-BOdMOgcu.js → textarea-GNyMOMRD.js} +1 -1
  49. package/frontend/dist/index.html +1 -1
  50. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectPage-5iSt8qJ0.js","assets/purify.es-CgRAQgUo.js","assets/ChatOverlay-BRKFIdip.js","assets/chevron-down-Baaa_7Xz.js","assets/index-Do7n5H3P.js","assets/file-text-Bce74_ZZ.js","assets/check-circle-2-CZX-PYDg.js","assets/ChatOverlay-wklAmtGL.css","assets/save-DEyMBCOK.js","assets/tabs-BYtX_ERm.js","assets/select-DgXuPzBS.js","assets/search-BR_ML1Dg.js","assets/textarea-BOdMOgcu.js","assets/ProjectPage-BNQoGh7a.css","assets/SettingsPage-DB0DKGyP.js","assets/SkillHubPage-ldsS5_lE.js","assets/ClaudeMemPage-BJXNbVri.js","assets/ProjectSettingsPage-CHpaFSH9.js","assets/MobilePage-xWYQCVpe.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectPage-BrudnOeN.js","assets/purify.es-CgRAQgUo.js","assets/ChatOverlay-DCDmC0Ig.js","assets/chevron-down-CiltYw1c.js","assets/index-DLVgSsZT.js","assets/file-text-Cq5RdypO.js","assets/check-circle-2-fJ0bVOko.js","assets/ChatOverlay-wklAmtGL.css","assets/save-I4MvlX-M.js","assets/tabs-DRHp9DRE.js","assets/select-CmSO1dzX.js","assets/search-YZPbiA4P.js","assets/textarea-GNyMOMRD.js","assets/ProjectPage-BNQoGh7a.css","assets/SettingsPage-CPP6ljrA.js","assets/SkillHubPage-BePTeB2c.js","assets/ClaudeMemPage-CK2Ceogj.js","assets/ProjectSettingsPage-DsS6M9fI.js","assets/MobilePage-D62Dze6k.js"])))=>i.map(i=>d[i]);
2
2
  var e=Object.defineProperty,t=(t,n,r)=>((t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r)(t,"symbol"!=typeof n?n+"":n,r);function n(e,t){for(var n=0;n<t.length;n++){const r=t[n];if("string"!=typeof r&&!Array.isArray(r))for(const t in r)if("default"!==t&&!(t in e)){const n=Object.getOwnPropertyDescriptor(r,t);n&&Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const n of e)if("childList"===n.type)for(const e of n.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)}).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function a(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var s={exports:{}},i={},l={exports:{}},c={},u=Symbol.for("react.element"),d=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),g=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),b=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),w=Symbol.iterator;var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,j={};function C(e,t,n){this.props=e,this.context=t,this.refs=j,this.updater=n||k}function E(){}function P(e,t,n){this.props=e,this.context=t,this.refs=j,this.updater=n||k}C.prototype.isReactComponent={},C.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},C.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},E.prototype=C.prototype;var _=P.prototype=new E;_.constructor=P,S(_,C.prototype),_.isPureReactComponent=!0;var N=Array.isArray,T=Object.prototype.hasOwnProperty,R={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function L(e,t,n){var r,o={},a=null,s=null;if(null!=t)for(r in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(a=""+t.key),t)T.call(t,r)&&!M.hasOwnProperty(r)&&(o[r]=t[r]);var i=arguments.length-2;if(1===i)o.children=n;else if(1<i){for(var l=Array(i),c=0;c<i;c++)l[c]=arguments[c+2];o.children=l}if(e&&e.defaultProps)for(r in i=e.defaultProps)void 0===o[r]&&(o[r]=i[r]);return{$$typeof:u,type:e,key:a,ref:s,props:o,_owner:R.current}}function O(e){return"object"==typeof e&&null!==e&&e.$$typeof===u}var A=/\/+/g;function D(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function I(e,t,n,r,o){var a=typeof e;"undefined"!==a&&"boolean"!==a||(e=null);var s=!1;if(null===e)s=!0;else switch(a){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case u:case d:s=!0}}if(s)return o=o(s=e),e=""===r?"."+D(s,0):r,N(o)?(n="",null!=e&&(n=e.replace(A,"$&/")+"/"),I(o,t,n,"",function(e){return e})):null!=o&&(O(o)&&(o=function(e,t){return{$$typeof:u,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(A,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=""===r?".":r+":",N(e))for(var i=0;i<e.length;i++){var l=r+D(a=e[i],i);s+=I(a,t,n,l,o)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=w&&e[w]||e["@@iterator"])?e:null}(e),"function"==typeof l)for(e=l.call(e),i=0;!(a=e.next()).done;)s+=I(a=a.value,t,n,l=r+D(a,i++),o);else if("object"===a)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function F(e,t,n){if(null==e)return e;var r=[],o=0;return I(e,r,"","",function(e){return t.call(n,e,o++)}),r}function $(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var z={current:null},V={transition:null},U={ReactCurrentDispatcher:z,ReactCurrentBatchConfig:V,ReactCurrentOwner:R};function B(){throw Error("act(...) is not supported in production builds of React.")}c.Children={map:F,forEach:function(e,t,n){F(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return F(e,function(){t++}),t},toArray:function(e){return F(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},c.Component=C,c.Fragment=p,c.Profiler=h,c.PureComponent=P,c.StrictMode=f,c.Suspense=y,c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U,c.act=B,c.cloneElement=function(e,t,n){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=S({},e.props),o=e.key,a=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(a=t.ref,s=R.current),void 0!==t.key&&(o=""+t.key),e.type&&e.type.defaultProps)var i=e.type.defaultProps;for(l in t)T.call(t,l)&&!M.hasOwnProperty(l)&&(r[l]=void 0===t[l]&&void 0!==i?i[l]:t[l])}var l=arguments.length-2;if(1===l)r.children=n;else if(1<l){i=Array(l);for(var c=0;c<l;c++)i[c]=arguments[c+2];r.children=i}return{$$typeof:u,type:e.type,key:o,ref:a,props:r,_owner:s}},c.createContext=function(e){return(e={$$typeof:g,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:m,_context:e},e.Consumer=e},c.createElement=L,c.createFactory=function(e){var t=L.bind(null,e);return t.type=e,t},c.createRef=function(){return{current:null}},c.forwardRef=function(e){return{$$typeof:v,render:e}},c.isValidElement=O,c.lazy=function(e){return{$$typeof:x,_payload:{_status:-1,_result:e},_init:$}},c.memo=function(e,t){return{$$typeof:b,type:e,compare:void 0===t?null:t}},c.startTransition=function(e){var t=V.transition;V.transition={};try{e()}finally{V.transition=t}},c.unstable_act=B,c.useCallback=function(e,t){return z.current.useCallback(e,t)},c.useContext=function(e){return z.current.useContext(e)},c.useDebugValue=function(){},c.useDeferredValue=function(e){return z.current.useDeferredValue(e)},c.useEffect=function(e,t){return z.current.useEffect(e,t)},c.useId=function(){return z.current.useId()},c.useImperativeHandle=function(e,t,n){return z.current.useImperativeHandle(e,t,n)},c.useInsertionEffect=function(e,t){return z.current.useInsertionEffect(e,t)},c.useLayoutEffect=function(e,t){return z.current.useLayoutEffect(e,t)},c.useMemo=function(e,t){return z.current.useMemo(e,t)},c.useReducer=function(e,t,n){return z.current.useReducer(e,t,n)},c.useRef=function(e){return z.current.useRef(e)},c.useState=function(e){return z.current.useState(e)},c.useSyncExternalStore=function(e,t,n){return z.current.useSyncExternalStore(e,t,n)},c.useTransition=function(){return z.current.useTransition()},c.version="18.3.1",l.exports=c;var W=l.exports;const H=o(W),q=n({__proto__:null,default:H},[W]);
3
3
  /**
4
4
  * @license React
@@ -60,7 +60,7 @@ function Zd(){return Zd=Object.assign?Object.assign.bind():function(e){for(var t
60
60
  * LICENSE.md file in the root directory of this source tree.
61
61
  *
62
62
  * @license MIT
63
- */function Cp(e){return void 0===e&&(e=""),new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}new Promise(()=>{});try{window.__reactRouterVersion="6"}catch(TO){}const Ep=q.startTransition;function Pp(e){let{basename:t,children:n,future:r,window:o}=e,a=W.useRef();null==a.current&&(a.current=vd({window:o,v5Compat:!0}));let s=a.current,[i,l]=W.useState({action:s.action,location:s.location}),{v7_startTransition:c}=r||{},u=W.useCallback(e=>{c&&Ep?Ep(()=>l(e)):l(e)},[l,c]);return W.useLayoutEffect(()=>s.listen(u),[s,u]),W.useEffect(()=>{return null==(e=r)||e.v7_startTransition,void(null==e||e.v7_relativeSplatPath);var e},[r]),W.createElement(kp,{basename:t,children:n,location:i.location,navigationType:i.action,navigator:s,future:r})}var _p,Np,Tp,Rp;function Mp(e){let t=W.useRef(Cp(e)),n=W.useRef(!1),r=ip(),o=W.useMemo(()=>function(e,t){let n=Cp(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}(r.search,n.current?null:t.current),[r.search]),a=cp(),s=W.useCallback((e,t)=>{const r=Cp("function"==typeof e?e(o):e);n.current=!0,a("?"+r,t)},[a,o]);return[o,s]}(Np=_p||(_p={})).UseScrollRestoration="useScrollRestoration",Np.UseSubmit="useSubmit",Np.UseSubmitFetcher="useSubmitFetcher",Np.UseFetcher="useFetcher",Np.useViewTransitionState="useViewTransitionState",(Rp=Tp||(Tp={})).UseFetcher="useFetcher",Rp.UseFetchers="useFetchers",Rp.UseScrollRestoration="useScrollRestoration";const Lp=e=>"string"==typeof e,Op=()=>{let e,t;const n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},Ap=e=>null==e?"":String(e),Dp=/###/g,Ip=e=>e&&e.includes("###")?e.replace(Dp,"."):e,Fp=e=>!e||Lp(e),$p=(e,t,n)=>{const r=Lp(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(Fp(e))return{};const t=Ip(r[o]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++o}return Fp(e)?{}:{obj:e,k:Ip(r[o])}},zp=(e,t,n)=>{const{obj:r,k:o}=$p(e,t,Object);if(void 0!==r||1===t.length)return void(r[o]=n);let a=t[t.length-1],s=t.slice(0,t.length-1),i=$p(e,s,Object);for(;void 0===i.obj&&s.length;)a=`${s[s.length-1]}.${a}`,s=s.slice(0,s.length-1),i=$p(e,s,Object),(null==i?void 0:i.obj)&&void 0!==i.obj[`${i.k}.${a}`]&&(i.obj=void 0);i.obj[`${i.k}.${a}`]=n},Vp=(e,t)=>{const{obj:n,k:r}=$p(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},Up=(e,t,n)=>{for(const r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?Lp(e[r])||e[r]instanceof String||Lp(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Up(e[r],t[r],n):e[r]=t[r]);return e},Bp=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),Wp={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},Hp=e=>Lp(e)?e.replace(/[&<>"'\/]/g,e=>Wp[e]):e;const qp=[" ",",","?","!",";"],Gp=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}(20),Kp=(e,t,n=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const r=t.split(n);let o=e;for(let a=0;a<r.length;){if(!o||"object"!=typeof o)return;let e,t="";for(let s=a;s<r.length;++s)if(s!==a&&(t+=n),t+=r[s],e=o[t],void 0!==e){if(["string","number","boolean"].includes(typeof e)&&s<r.length-1)continue;a+=s-a+1;break}o=e}return o},Yp=e=>null==e?void 0:e.replace(/_/g,"-"),Xp={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){var n,r;null==(r=null==(n=null==console?void 0:console[e])?void 0:n.apply)||r.call(n,console,t)}};class Qp{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||Xp,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,r){return r&&!this.debug?null:(e=e.map(e=>Lp(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g," "):e),Lp(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Qp(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new Qp(this.logger,e)}}var Jp=new Qp;class Zp{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}once(e,t){const n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}emit(e,...t){if(this.observers[e]){Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(([n,r])=>{for(let o=0;o<r;o++)n(e,...t)})}}}class ef extends Zp{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){var o,a;const s=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;e.includes(".")?l=e.split("."):(l=[e,t],n&&(Array.isArray(n)?l.push(...n):Lp(n)&&s?l.push(...n.split(s)):l.push(n)));const c=Vp(this.data,l);return c||t||n||!e.includes(".")||(e=l[0],t=l[1],n=l.slice(2).join(".")),!c&&i&&Lp(n)?Kp(null==(a=null==(o=this.data)?void 0:o[e])?void 0:a[t],n,s):c}addResource(e,t,n,r,o={silent:!1}){const a=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator;let s=[e,t];n&&(s=s.concat(a?n.split(a):n)),e.includes(".")&&(s=e.split("."),r=t,t=s[1]),this.addNamespaces(t),zp(this.data,s,r),o.silent||this.emit("added",e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(const o in n)(Lp(n[o])||Array.isArray(n[o]))&&this.addResource(e,t,o,n[o],{silent:!0});r.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,r,o,a={silent:!1,skipCopy:!1}){let s=[e,t];e.includes(".")&&(s=e.split("."),r=n,n=t,t=s[1]),this.addNamespaces(t);let i=Vp(this.data,s)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?Up(i,n,o):i={...i,...n},zp(this.data,s,i),a.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var tf={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,o){return e.forEach(e=>{var a;t=(null==(a=this.processors[e])?void 0:a.process(t,n,r,o))??t}),t}};const nf=Symbol("i18next/PATH_KEY");function rf(e,t){const{[nf]:n}=e(function(){const e=[],t=Object.create(null);let n;return t.get=(r,o)=>{var a;return null==(a=null==n?void 0:n.revoke)||a.call(n),o===nf?e:(e.push(o),n=Proxy.revocable(r,t),n.proxy)},Proxy.revocable(Object.create(null),t).proxy}()),r=(null==t?void 0:t.keySeparator)??".",o=(null==t?void 0:t.nsSeparator)??":";if(n.length>1&&o){const e=null==t?void 0:t.ns,a=Array.isArray(e)?e:null;if(a&&a.length>1&&a.slice(1).includes(n[0]))return`${n[0]}${o}${n.slice(1).join(r)}`}return n.join(r)}const of=e=>!Lp(e)&&"boolean"!=typeof e&&"number"!=typeof e;class af extends Zp{constructor(e,t={}){super(),((e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=Jp.create("translator"),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const n={...t};if(null==e)return!1;const r=this.resolve(e,n);if(void 0===(null==r?void 0:r.res))return!1;const o=of(r.res);return!1!==n.returnObjects||!o}extractFromKey(e,t){let n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");const r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let o=t.ns||this.options.defaultNS||[];const a=n&&e.includes(n),s=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,n)=>{t=t||"",n=n||"";const r=qp.filter(e=>!t.includes(e)&&!n.includes(e));if(0===r.length)return!0;const o=Gp.getRegExp(`(${r.map(e=>"?"===e?"\\?":e).join("|")})`);let a=!o.test(e);if(!a){const t=e.indexOf(n);t>0&&!o.test(e.substring(0,t))&&(a=!0)}return a})(e,n,r));if(a&&!s){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:Lp(o)?[o]:o};const a=e.split(n);(n!==r||n===r&&this.options.ns.includes(a[0]))&&(o=a.shift()),e=a.join(r)}return{key:e,namespaces:Lp(o)?[o]:o}}translate(e,t,n){let r="object"==typeof t?{...t}:t;if("object"!=typeof r&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof r&&(r={...r}),r||(r={}),null==e)return"";"function"==typeof e&&(e=rf(e,{...this.options,...r})),Array.isArray(e)||(e=[String(e)]),e=e.map(e=>"function"==typeof e?rf(e,{...this.options,...r}):String(e));const o=void 0!==r.returnDetails?r.returnDetails:this.options.returnDetails,a=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,{key:s,namespaces:i}=this.extractFromKey(e[e.length-1],r),l=i[i.length-1];let c=void 0!==r.nsSeparator?r.nsSeparator:this.options.nsSeparator;void 0===c&&(c=":");const u=r.lng||this.language,d=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===(null==u?void 0:u.toLowerCase()))return d?o?{res:`${l}${c}${s}`,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:`${l}${c}${s}`:o?{res:s,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:s;const p=this.resolve(e,r);let f=null==p?void 0:p.res;const h=(null==p?void 0:p.usedKey)||s,m=(null==p?void 0:p.exactUsedKey)||s,g=void 0!==r.joinArrays?r.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,y=void 0!==r.count&&!Lp(r.count),b=af.hasDefaultValue(r),x=y?this.pluralResolver.getSuffix(u,r.count,r):"",w=r.ordinal&&y?this.pluralResolver.getSuffix(u,r.count,{ordinal:!1}):"",k=y&&!r.ordinal&&0===r.count,S=k&&r[`defaultValue${this.options.pluralSeparator}zero`]||r[`defaultValue${x}`]||r[`defaultValue${w}`]||r.defaultValue;let j=f;v&&!f&&b&&(j=S);const C=of(j),E=Object.prototype.toString.apply(j);if(!(v&&j&&C)||["[object Number]","[object Function]","[object RegExp]"].includes(E)||Lp(g)&&Array.isArray(j))if(v&&Lp(g)&&Array.isArray(f))f=f.join(g),f&&(f=this.extendTranslation(f,e,r,n));else{let t=!1,o=!1;!this.isValidLookup(f)&&b&&(t=!0,f=S),this.isValidLookup(f)||(o=!0,f=s);const i=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&o?void 0:f,d=b&&S!==f&&this.options.updateMissing;if(o||t||d){if(this.logger.log(d?"updateKey":"missingKey",u,l,s,d?S:f),a){const e=this.resolve(s,{...r,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let r=0;r<t.length;r++)e.push(t[r]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(r.lng||this.language):e.push(r.lng||this.language);const n=(e,t,n)=>{var o;const a=b&&n!==f?n:i;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,a,d,r):(null==(o=this.backendConnector)?void 0:o.saveMissing)&&this.backendConnector.saveMissing(e,l,t,a,d,r),this.emit("missingKey",e,l,t,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&y?e.forEach(e=>{const t=this.pluralResolver.getSuffixes(e,r);k&&r[`defaultValue${this.options.pluralSeparator}zero`]&&!t.includes(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,r[`defaultValue${t}`]||S)})}):n(e,s,S))}f=this.extendTranslation(f,e,r,p,n),o&&f===s&&this.options.appendNamespaceToMissingKey&&(f=`${l}${c}${s}`),(o||t)&&this.options.parseMissingKeyHandler&&(f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${c}${s}`:s,t?f:void 0,r))}else{if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,j,{...r,ns:i}):`key '${s} (${this.language})' returned an object instead of string.`;return o?(p.res=e,p.usedParams=this.getUsedParamsDetails(r),p):e}if(a){const e=Array.isArray(j),t=e?[]:{},n=e?m:h;for(const o in j)if(Object.prototype.hasOwnProperty.call(j,o)){const e=`${n}${a}${o}`;t[o]=b&&!f?this.translate(e,{...r,defaultValue:of(S)?S[o]:void 0,joinArrays:!1,ns:i}):this.translate(e,{...r,joinArrays:!1,ns:i}),t[o]===e&&(t[o]=j[o])}f=t}}return o?(p.res=f,p.usedParams=this.getUsedParamsDetails(r),p):f}extendTranslation(e,t,n,r,o){var a,s;if(null==(a=this.i18nFormat)?void 0:a.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const a=Lp(e)&&(void 0!==(null==(s=null==n?void 0:n.interpolation)?void 0:s.skipOnVariables)?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let i;if(a){const t=e.match(this.interpolator.nestingRegexp);i=t&&t.length}let l=n.replace&&!Lp(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,n.lng||this.language||r.usedLng,n),a){const t=e.match(this.interpolator.nestingRegexp);i<(t&&t.length)&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,(...e)=>(null==o?void 0:o[0])!==e[0]||n.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),n)),n.interpolation&&this.interpolator.reset()}const i=n.postProcess||this.options.postProcess,l=Lp(i)?[i]:i;return null!=e&&(null==l?void 0:l.length)&&!1!==n.applyPostProcessor&&(e=tf.handle(l,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,o,a,s;return Lp(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>"function"==typeof e?rf(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;const i=this.extractFromKey(e,t),l=i.key;r=l;let c=i.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const u=void 0!==t.count&&!Lp(t.count),d=u&&!t.ordinal&&0===t.count,p=void 0!==t.context&&(Lp(t.context)||"number"==typeof t.context)&&""!==t.context,f=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);c.forEach(e=>{var i,c;this.isValidLookup(n)||(s=e,this.checkedLoadedFor[`${f[0]}-${e}`]||!(null==(i=this.utils)?void 0:i.hasLoadedNamespace)||(null==(c=this.utils)?void 0:c.hasLoadedNamespace(s))||(this.checkedLoadedFor[`${f[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${f.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),f.forEach(r=>{var s;if(this.isValidLookup(n))return;a=r;const i=[l];if(null==(s=this.i18nFormat)?void 0:s.addLookupKeys)this.i18nFormat.addLookupKeys(i,l,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));const n=`${this.options.pluralSeparator}zero`,o=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.startsWith(o)&&i.push(l+e.replace(o,this.options.pluralSeparator)),i.push(l+e),d&&i.push(l+n)),p){const r=`${l}${this.options.contextSeparator||"_"}${t.context}`;i.push(r),u&&(t.ordinal&&e.startsWith(o)&&i.push(r+e.replace(o,this.options.pluralSeparator)),i.push(r+e),d&&i.push(r+n))}}let c;for(;c=i.pop();)this.isValidLookup(n)||(o=c,n=this.getResource(r,e,c,t))}))})}),{res:n,usedKey:r,exactUsedKey:o,usedLng:a,usedNS:s}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,n,r={}){var o;return(null==(o=this.i18nFormat)?void 0:o.getResource)?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!Lp(e.replace);let r=n?e.replace:e;if(n&&void 0!==e.count&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(const e of t)delete r[e]}return r}static hasDefaultValue(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.startsWith("defaultValue")&&void 0!==e[t])return!0;return!1}}class sf{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Jp.create("languageUtils")}getScriptPartFromCode(e){if(!(e=Yp(e))||!e.includes("-"))return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=Yp(e))||!e.includes("-"))return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(Lp(e)&&e.includes("-")){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(TO){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const n=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(n)||(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;const r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>e===r||!(!e.includes("-")&&!r.includes("-"))&&(!(!e.includes("-")||r.includes("-")||e.slice(0,e.indexOf("-"))!==r)||!!(e.startsWith(r)&&r.length>1)))}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),Lp(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){const n=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),r=[],o=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return Lp(e)&&(e.includes("-")||e.includes("_"))?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):Lp(e)&&o(this.formatLanguageCode(e)),n.forEach(e=>{r.includes(e)||o(this.formatLanguageCode(e))}),r}}const lf={zero:0,one:1,two:2,few:3,many:4,other:5},cf={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class uf{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=Jp.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const n=Yp("dev"===e?"en":e),r=t.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:n,type:r});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let a;try{a=new Intl.PluralRules(n,{type:r})}catch(s){if("undefined"==typeof Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),cf;if(!e.match(/-|_/))return cf;const n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[o]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),(null==n?void 0:n.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),n?n.resolvedOptions().pluralCategories.sort((e,t)=>lf[e]-lf[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,n={}){const r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,n))}}const df=(e,t,n,r=".",o=!0)=>{let a=((e,t,n)=>{const r=Vp(e,n);return void 0!==r?r:Vp(t,n)})(e,t,n);return!a&&o&&Lp(n)&&(a=Kp(e,n,r),void 0===a&&(a=Kp(t,n,r))),a},pf=e=>e.replace(/\$/g,"$$$$");class ff{constructor(e={}){var t;this.logger=Jp.create("interpolator"),this.options=e,this.format=(null==(t=null==e?void 0:e.interpolation)?void 0:t.format)||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:o,prefixEscaped:a,suffix:s,suffixEscaped:i,formatSeparator:l,unescapeSuffix:c,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:p,nestingSuffix:f,nestingSuffixEscaped:h,nestingOptionsSeparator:m,maxReplaces:g,alwaysFormat:v}=e.interpolation;this.escape=void 0!==t?t:Hp,this.escapeValue=void 0===n||n,this.useRawValueToEscape=void 0!==r&&r,this.prefix=o?Bp(o):a||"{{",this.suffix=s?Bp(s):i||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":u?Bp(u):"-",this.unescapeSuffix=this.unescapePrefix?"":c?Bp(c):"",this.nestingPrefix=d?Bp(d):p||Bp("$t("),this.nestingSuffix=f?Bp(f):h||Bp(")"),this.nestingOptionsSeparator=m||",",this.maxReplaces=g||1e3,this.alwaysFormat=void 0!==v&&v,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>(null==e?void 0:e.source)===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){var o;let a,s,i;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(!e.includes(this.formatSeparator)){const o=df(t,l,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(o,void 0,n,{...r,...t,interpolationkey:e}):o}const o=e.split(this.formatSeparator),a=o.shift().trim(),s=o.join(this.formatSeparator).trim();return this.format(df(t,l,a,this.options.keySeparator,this.options.ignoreJSONStructure),s,n,{...r,...t,interpolationkey:a})};this.resetRegExp(),!this.escapeValue&&"string"==typeof e&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");const u=(null==r?void 0:r.missingInterpolationHandler)||this.options.missingInterpolationHandler,d=void 0!==(null==(o=null==r?void 0:r.interpolation)?void 0:o.skipOnVariables)?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>pf(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?pf(this.escape(e)):pf(e)}].forEach(t=>{for(i=0;a=t.regex.exec(e);){const n=a[1].trim();if(s=c(n),void 0===s)if("function"==typeof u){const t=u(e,a,r);s=Lp(t)?t:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))s="";else{if(d){s=a[0];continue}this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),s=""}else Lp(s)||this.useRawValueToEscape||(s=Ap(s));const o=t.safeValue(s);if(e=e.replace(a[0],o),d?(t.regex.lastIndex+=s.length,t.regex.lastIndex-=a[0].length):t.regex.lastIndex=0,i++,i>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,o,a;const s=(e,t)=>{const n=this.nestingOptionsSeparator;if(!e.includes(n))return e;const r=e.split(new RegExp(`${Bp(n)}[ ]*{`));let o=`{${r[1]}`;e=r[0],o=this.interpolate(o,a);const s=o.match(/'/g),i=o.match(/"/g);(((null==s?void 0:s.length)??0)%2==0&&!i||((null==i?void 0:i.length)??0)%2!=0)&&(o=o.replace(/'/g,'"'));try{a=JSON.parse(o),t&&(a={...t,...a})}catch(TO){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,TO),`${e}${n}${o}`}return a.defaultValue&&a.defaultValue.includes(this.prefix)&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let i=[];a={...n},a=a.replace&&!Lp(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;const l=/{.*}/.test(r[1])?r[1].lastIndexOf("}")+1:r[1].indexOf(this.formatSeparator);if(-1!==l&&(i=r[1].slice(l).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,l)),o=t(s.call(this,r[1].trim(),a),a),o&&r[0]===e&&!Lp(o))return o;Lp(o)||(o=Ap(o)),o||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),o=""),i.length&&(o=i.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),o.trim())),e=e.replace(r[0],o),this.regexp.lastIndex=0}return e}}const hf=e=>{const t={};return(n,r,o)=>{let a=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(a={...a,[o.interpolationkey]:void 0});const s=r+JSON.stringify(a);let i=t[s];return i||(i=e(Yp(r),o),t[s]=i),i(n)}},mf=e=>(t,n,r)=>e(Yp(n),r)(t);class gf{constructor(e={}){this.logger=Jp.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const n=t.cacheInBuiltFormats?hf:mf;this.formats={number:n((e,t)=>{const n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{const n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)}),datetime:n((e,t)=>{const n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{const n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")}),list:n((e,t)=>{const n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=hf(t)}format(e,t,n,r={}){if(!t)return e;if(null==e)return e;const o=t.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&!o[0].includes(")")&&o.find(e=>e.includes(")"))){const e=o.findIndex(e=>e.includes(")"));o[0]=[o[0],...o.splice(1,e)].join(this.formatSeparator)}return o.reduce((e,t)=>{var o;const{formatName:a,formatOptions:s}=(e=>{let t=e.toLowerCase().trim();const n={};if(e.includes("(")){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].slice(0,-1);"currency"!==t||o.includes(":")?"relativetime"!==t||o.includes(":")?o.split(";").forEach(e=>{if(e){const[t,...r]=e.split(":"),o=r.join(":").trim().replace(/^'+|'+$/g,""),a=t.trim();n[a]||(n[a]=o),"false"===o&&(n[a]=!1),"true"===o&&(n[a]=!0),isNaN(o)||(n[a]=parseInt(o,10))}}):n.range||(n.range=o.trim()):n.currency||(n.currency=o.trim())}return{formatName:t,formatOptions:n}})(t);if(this.formats[a]){let t=e;try{const i=(null==(o=null==r?void 0:r.formatParams)?void 0:o[r.interpolationkey])||{},l=i.locale||i.lng||r.locale||r.lng||n;t=this.formats[a](e,l,{...s,...r,...i})}catch(i){this.logger.warn(i)}return t}return this.logger.warn(`there was no format function for ${a}`),e},e)}}class vf extends Zp{constructor(e,t,n,r={}){var o,a;super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=Jp.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],null==(a=null==(o=this.backend)?void 0:o.init)||a.call(o,n,r.backend,r)}queueLoad(e,t,n,r){const o={},a={},s={},i={};return e.forEach(e=>{let r=!0;t.forEach(t=>{const s=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[s]=2:this.state[s]<0||(1===this.state[s]?void 0===a[s]&&(a[s]=!0):(this.state[s]=1,r=!1,void 0===a[s]&&(a[s]=!0),void 0===o[s]&&(o[s]=!0),void 0===i[t]&&(i[t]=!0)))}),r||(s[e]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(i)}}loaded(e,t,n){const r=e.split("|"),o=r[0],a=r[1];t&&this.emit("failedLoading",o,a,t),!t&&n&&this.store.addResourceBundle(o,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);const s={};this.queue.forEach(n=>{((e,t,n)=>{const{obj:r,k:o}=$p(e,t,Object);r[o]=r[o]||[],r[o].push(n)})(n.loaded,[o],a),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach(e=>{s[e]||(s[e]={});const t=n.loaded[e];t.length&&t.forEach(t=>{void 0===s[e][t]&&(s[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,o=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:o,callback:a});this.readingCalls++;const s=(s,i)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}s&&i&&r<this.maxRetries?setTimeout(()=>{this.read(e,t,n,r+1,2*o,a)},o):a(s,i)},i=this.backend[n].bind(this.backend);if(2!==i.length)return i(e,t,s);try{const n=i(e,t);n&&"function"==typeof n.then?n.then(e=>s(null,e)).catch(s):s(null,n)}catch(l){s(l)}}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();Lp(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Lp(t)&&(t=[t]);const o=this.queueLoad(e,t,n,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=""){const n=e.split("|"),r=n[0],o=n[1];this.read(r,o,"read",void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${o} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${o} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,o,a={},s=()=>{}){var i,l,c,u,d;if(!(null==(l=null==(i=this.services)?void 0:i.utils)?void 0:l.hasLoadedNamespace)||(null==(u=null==(c=this.services)?void 0:c.utils)?void 0:u.hasLoadedNamespace(t))){if(null!=n&&""!==n){if(null==(d=this.backend)?void 0:d.create){const i={...a,isUpdate:o},l=this.backend.create.bind(this.backend);if(l.length<6)try{let o;o=5===l.length?l(e,t,n,r,i):l(e,t,n,r),o&&"function"==typeof o.then?o.then(e=>s(null,e)).catch(s):s(null,o)}catch(p){s(p)}else l(e,t,n,r,s,i)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}else this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}}const yf=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),Lp(e[1])&&(t.defaultValue=e[1]),Lp(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),bf=e=>(Lp(e.ns)&&(e.ns=[e.ns]),Lp(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Lp(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes("cimode")&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),xf=()=>{};class wf extends Zp{constructor(e={},t){var n;if(super(),this.options=bf(e),this.services={},this.logger=Jp,this.modules={external:[]},n=this,Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(e=>{"function"==typeof n[e]&&(n[e]=n[e].bind(n))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,"function"==typeof e&&(t=e,e={}),null==e.defaultNS&&e.ns&&(Lp(e.ns)?e.defaultNS=e.ns:e.ns.includes("translation")||(e.defaultNS=e.ns[0]));const n=yf();this.options={...n,...this.options,...bf(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator),"function"!=typeof this.options.overloadTranslationOptionHandler&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);const r=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?Jp.init(r(this.modules.logger),this.options):Jp.init(null,this.options),e=this.modules.formatter?this.modules.formatter:gf;const t=new sf(this.options);this.store=new ef(this.options.resources,this.options);const n=this.services;n.logger=Jp,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new uf(t,{prepend:this.options.pluralSeparator}),e&&(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new ff(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new vf(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new af(this.services,this.options),this.translator.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=xf),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=(...t)=>this.store[e](...t)});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});const o=Op(),a=()=>{const e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),o.resolve(n),t(e,n)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),o}loadResources(e,t=xf){var n,r;let o=t;const a=Lp(e)?e:this.language;if("function"==typeof e&&(o=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===(null==a?void 0:a.toLowerCase())&&(!this.options.preload||0===this.options.preload.length))return o();const e=[],t=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&(e.includes(t)||e.push(t))})};if(a)t(a);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e))}null==(r=null==(n=this.options.preload)?void 0:n.forEach)||r.call(n,e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),o(e)})}else o(null)}reloadResources(e,t,n){const r=Op();return"function"==typeof e&&(n=e,e=void 0),"function"==typeof t&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=xf),this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&tf.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!["cimode","dev"].includes(e)){for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!["cimode","dev"].includes(t)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}this.resolvedLanguage||this.languages.includes(e)||!this.store.hasLanguageSomeTranslations(e)||(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const n=Op();this.emit("languageChanging",e);const r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},o=(o,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit("languageChanged",a),this.logger.log("languageChanged",a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(o,(...e)=>this.t(...e))},a=t=>{var n,a;e||t||!this.services.languageDetector||(t=[]);const s=Lp(t)?t:t&&t[0],i=this.store.hasLanguageSomeTranslations(s)?s:this.services.languageUtils.getBestMatchFromCodes(Lp(t)?[t]:t);i&&(this.language||r(i),this.translator.language||this.translator.changeLanguage(i),null==(a=null==(n=this.services.languageDetector)?void 0:n.cacheUserLanguage)||a.call(n,i)),this.loadResources(i,e=>{o(e,i)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e):a(this.services.languageDetector.detect()),n}getFixedT(e,t,n){const r=(e,t,...o)=>{let a;a="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(o)):{...t},a.lng=a.lng||r.lng,a.lngs=a.lngs||r.lngs,a.ns=a.ns||r.ns,""!==a.keyPrefix&&(a.keyPrefix=a.keyPrefix||n||r.keyPrefix);const s={...this.options,...a};"function"==typeof a.keyPrefix&&(a.keyPrefix=rf(a.keyPrefix,s));const i=this.options.keySeparator||".";let l;return a.keyPrefix&&Array.isArray(e)?l=e.map(e=>("function"==typeof e&&(e=rf(e,s)),`${a.keyPrefix}${i}${e}`)):("function"==typeof e&&(e=rf(e,s)),l=a.keyPrefix?`${a.keyPrefix}${i}${e}`:e),this.t(l,a)};return Lp(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}t(...e){var t;return null==(t=this.translator)?void 0:t.translate(...e)}exists(...e){var t;return null==(t=this.translator)?void 0:t.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=t.lng||this.resolvedLanguage||this.languages[0],r=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;const a=(e,t)=>{const n=this.services.backendConnector.state[`${e}|${t}`];return-1===n||0===n||2===n};if(t.precheck){const e=t.precheck(this,a);if(void 0!==e)return e}return!!this.hasResourceBundle(n,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!a(n,e)||r&&!a(o,e)))}loadNamespaces(e,t){const n=Op();return this.options.ns?(Lp(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){const n=Op();Lp(e)&&(e=[e]);const r=this.options.preload||[],o=e.filter(e=>!r.includes(e)&&this.services.languageUtils.isSupportedCode(e));return o.length?(this.options.preload=r.concat(o),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){var t,n;if(e||(e=this.resolvedLanguage||((null==(t=this.languages)?void 0:t.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const t=new Intl.Locale(e);if(t&&t.getTextInfo){const e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch(TO){}const r=(null==(n=this.services)?void 0:n.languageUtils)||new sf(yf());return e.toLowerCase().indexOf("-latn")>1?"ltr":["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].includes(r.getLanguagePartFromCode(e))||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){const n=new wf(e,t);return n.createInstance=wf.createInstance,n}cloneInstance(e={},t=xf){const n=e.forkResourceStore;n&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},o=new wf(r);void 0===e.debug&&void 0===e.prefix||(o.logger=o.logger.clone(e));if(["store","services","language"].forEach(e=>{o[e]=this[e]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},n){const e=Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{});o.store=new ef(e,r),o.services.resourceStore=o.store}if(e.interpolation){const t={...yf().interpolation,...this.options.interpolation,...e.interpolation},n={...r,interpolation:t};o.services.interpolator=new ff(n)}return o.translator=new af(o.services,r),o.translator.on("*",(e,...t)=>{o.emit(e,...t)}),o.init(r,t),o.translator.options=r,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const kf=wf.createInstance();kf.createInstance,kf.dir,kf.init,kf.loadResources,kf.reloadResources,kf.use,kf.changeLanguage,kf.getFixedT,kf.t,kf.exists,kf.setDefaultNamespace,kf.hasLoadedNamespace,kf.loadNamespaces,kf.loadLanguages;const Sf={},jf=(e,t,n,r)=>{_f(n)&&Sf[n]||(_f(n)&&(Sf[n]=new Date),((e,t,n,r)=>{var o,a,s,i;const l=[n,{code:t,...r||{}}];if(null==(a=null==(o=null==e?void 0:e.services)?void 0:o.logger)?void 0:a.forward)return e.services.logger.forward(l,"warn","react-i18next::",!0);_f(l[0])&&(l[0]=`react-i18next:: ${l[0]}`),(null==(i=null==(s=null==e?void 0:e.services)?void 0:s.logger)?void 0:i.warn)?e.services.logger.warn(...l):(null==console?void 0:console.warn)&&console.warn(...l)})(e,t,n,r))},Cf=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},Ef=(e,t,n)=>{e.loadNamespaces(t,Cf(e,n))},Pf=(e,t,n,r)=>{if(_f(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Ef(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,Cf(e,r))},_f=e=>"string"==typeof e,Nf=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Tf={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Rf=e=>Tf[e];let Mf={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(Nf,Rf),transDefaultProps:void 0};let Lf;const Of={type:"3rdParty",init(e){((e={})=>{Mf={...Mf,...e}})(e.options.react),(e=>{Lf=e})(e)}},Af=W.createContext();class Df{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var If={exports:{}},Ff={},$f=W;var zf="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Vf=$f.useState,Uf=$f.useEffect,Bf=$f.useLayoutEffect,Wf=$f.useDebugValue;function Hf(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!zf(e,n)}catch(r){return!0}}var qf="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=Vf({inst:{value:n,getSnapshot:t}}),o=r[0].inst,a=r[1];return Bf(function(){o.value=n,o.getSnapshot=t,Hf(o)&&a({inst:o})},[e,n,t]),Uf(function(){return Hf(o)&&a({inst:o}),e(function(){Hf(o)&&a({inst:o})})},[e]),Wf(n),n};Ff.useSyncExternalStore=void 0!==$f.useSyncExternalStore?$f.useSyncExternalStore:qf,If.exports=Ff;var Gf=If.exports;const Kf={t:(e,t)=>{if(_f(t))return t;if("object"==typeof(n=t)&&null!==n&&_f(t.defaultValue))return t.defaultValue;var n;if("function"==typeof e)return"";if(Array.isArray(e)){const t=e[e.length-1];return"function"==typeof t?"":t}return e},ready:!1},Yf=()=>()=>{},Xf=(e,t={})=>{var n,r,o;const{i18n:a}=t,{i18n:s,defaultNS:i}=W.useContext(Af)||{},l=a||s||Lf;l&&!l.reportNamespaces&&(l.reportNamespaces=new Df),l||jf(l,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const c=W.useMemo(()=>{var e;return{...Mf,...null==(e=null==l?void 0:l.options)?void 0:e.react,...t}},[l,t]),{useSuspense:u,keyPrefix:d}=c,p=i||(null==(n=null==l?void 0:l.options)?void 0:n.defaultNS),f=_f(p)?[p]:p||["translation"],h=W.useMemo(()=>f,f);null==(o=null==(r=null==l?void 0:l.reportNamespaces)?void 0:r.addUsedNamespaces)||o.call(r,h);const m=W.useRef(0),g=W.useCallback(e=>{if(!l)return Yf;const{bindI18n:t,bindI18nStore:n}=c,r=()=>{m.current+=1,e()};return t&&l.on(t,r),n&&l.store.on(n,r),()=>{t&&t.split(" ").forEach(e=>l.off(e,r)),n&&n.split(" ").forEach(e=>l.store.off(e,r))}},[l,c]),v=W.useRef(),y=W.useCallback(()=>{if(!l)return Kf;const e=!(!l.isInitialized&&!l.initializedStoreOnce)&&h.every(e=>((e,t,n={})=>t.languages&&t.languages.length?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}):(jf(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0))(e,l,c)),n=t.lng||l.language,r=m.current,o=v.current;if(o&&o.ready===e&&o.lng===n&&o.keyPrefix===d&&o.revision===r)return o;const a={t:l.getFixedT(n,"fallback"===c.nsMode?h:h[0],d),ready:e,lng:n,keyPrefix:d,revision:r};return v.current=a,a},[l,h,d,c,t.lng]),[b,x]=W.useState(0),{t:w,ready:k}=Gf.useSyncExternalStore(g,y,y);W.useEffect(()=>{if(l&&!k&&!u){const e=()=>x(e=>e+1);t.lng?Pf(l,t.lng,h,e):Ef(l,h,e)}},[l,t.lng,h,k,u,b]);const S=l||{},j=W.useRef(null),C=W.useRef(),E=e=>{const t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;const n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,"__original"))try{Object.defineProperty(n,"__original",{value:e,writable:!1,enumerable:!1,configurable:!1})}catch(r){}return n},P=W.useMemo(()=>{const e=S,t=null==e?void 0:e.language;let n=e;e&&(j.current&&j.current.__original===e?C.current!==t?(n=E(e),j.current=n,C.current=t):n=j.current:(n=E(e),j.current=n,C.current=t));const r=k||u?w:(...e)=>(jf(l,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),w(...e)),o=[r,n,k];return o.t=r,o.i18n=n,o.ready=k,o},[w,S,k,S.resolvedLanguage,S.language,S.languages]);if(l&&u&&!k)throw new Promise(e=>{const n=()=>e();t.lng?Pf(l,t.lng,h,n):Ef(l,h,n)});return P},{slice:Qf,forEach:Jf}=[];const Zf=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,eh={create(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/",sameSite:"strict"};n&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+60*n*1e3)),r&&(o.domain=r),document.cookie=function(e,t){const n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{path:"/"};let r=`${e}=${encodeURIComponent(t)}`;if(n.maxAge>0){const e=n.maxAge-0;if(Number.isNaN(e))throw new Error("maxAge should be a Number");r+=`; Max-Age=${Math.floor(e)}`}if(n.domain){if(!Zf.test(n.domain))throw new TypeError("option domain is invalid");r+=`; Domain=${n.domain}`}if(n.path){if(!Zf.test(n.path))throw new TypeError("option path is invalid");r+=`; Path=${n.path}`}if(n.expires){if("function"!=typeof n.expires.toUTCString)throw new TypeError("option expires is invalid");r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+="; HttpOnly"),n.secure&&(r+="; Secure"),n.sameSite)switch("string"==typeof n.sameSite?n.sameSite.toLowerCase():n.sameSite){case!0:r+="; SameSite=Strict";break;case"lax":r+="; SameSite=Lax";break;case"strict":r+="; SameSite=Strict";break;case"none":r+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return n.partitioned&&(r+="; Partitioned"),r}(e,t,o)},read(e){const t=`${e}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let e=n[r];for(;" "===e.charAt(0);)e=e.substring(1,e.length);if(0===e.indexOf(t))return e.substring(t.length,e.length)}return null},remove(e,t){this.create(e,"",-1,t)}};var th={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&"undefined"!=typeof document)return eh.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:o,cookieOptions:a}=t;n&&"undefined"!=typeof document&&eh.create(n,e,r,o,a)}},nh={name:"querystring",lookup(e){var t;let n,{lookupQuerystring:r}=e;if("undefined"!=typeof window){let{search:e}=window.location;!window.location.search&&(null==(t=window.location.hash)?void 0:t.indexOf("?"))>-1&&(e=window.location.hash.substring(window.location.hash.indexOf("?")));const o=e.substring(1).split("&");for(let t=0;t<o.length;t++){const e=o[t].indexOf("=");if(e>0){o[t].substring(0,e)===r&&(n=o[t].substring(e+1))}}}return n}},rh={name:"hash",lookup(e){var t;let n,{lookupHash:r,lookupFromHashIndex:o}=e;if("undefined"!=typeof window){const{hash:e}=window.location;if(e&&e.length>2){const a=e.substring(1);if(r){const e=a.split("&");for(let t=0;t<e.length;t++){const o=e[t].indexOf("=");if(o>0){e[t].substring(0,o)===r&&(n=e[t].substring(o+1))}}}if(n)return n;if(!n&&o>-1){const n=e.match(/\/([a-zA-Z-]*)/g);if(!Array.isArray(n))return;return null==(t=n["number"==typeof o?o:0])?void 0:t.replace("/","")}}}return n}};let oh=null;const ah=()=>{if(null!==oh)return oh;try{if(oh="undefined"!=typeof window&&null!==window.localStorage,!oh)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch(TO){oh=!1}return oh};var sh={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&ah())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&ah()&&window.localStorage.setItem(n,e)}};let ih=null;const lh=()=>{if(null!==ih)return ih;try{if(ih="undefined"!=typeof window&&null!==window.sessionStorage,!ih)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch(TO){ih=!1}return ih};var ch={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&lh())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&lh()&&window.sessionStorage.setItem(n,e)}},uh={name:"navigator",lookup(e){const t=[];if("undefined"!=typeof navigator){const{languages:e,userLanguage:n,language:r}=navigator;if(e)for(let o=0;o<e.length;o++)t.push(e[o]);n&&t.push(n),r&&t.push(r)}return t.length>0?t:void 0}},dh={name:"htmlTag",lookup(e){let t,{htmlTag:n}=e;const r=n||("undefined"!=typeof document?document.documentElement:null);return r&&"function"==typeof r.getAttribute&&(t=r.getAttribute("lang")),t}},ph={name:"path",lookup(e){var t;let{lookupFromPathIndex:n}=e;if("undefined"==typeof window)return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(!Array.isArray(r))return;return null==(t=r["number"==typeof n?n:0])?void 0:t.replace("/","")}},fh={name:"subdomain",lookup(e){var t,n;let{lookupFromSubdomainIndex:r}=e;const o="number"==typeof r?r+1:1,a="undefined"!=typeof window&&(null==(n=null==(t=window.location)?void 0:t.hostname)?void 0:n.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(a)return a[o]}};let hh=!1;try{document.cookie,hh=!0}catch(TO){}const mh=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];hh||mh.splice(1,1);class gh{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,t)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{languageUtils:{}},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=function(e){return Jf.call(Qf.call(arguments,1),t=>{if(t)for(const n in t)void 0===e[n]&&(e[n]=t[n])}),e}(t,this.options||{},{order:mh,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e}),"string"==typeof this.options.convertDetectedLanguage&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=e=>e.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(th),this.addDetector(nh),this.addDetector(sh),this.addDetector(ch),this.addDetector(uh),this.addDetector(dh),this.addDetector(ph),this.addDetector(fh),this.addDetector(rh)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.order,t=[];return e.forEach(e=>{if(this.detectors[e]){let n=this.detectors[e].lookup(this.options);n&&"string"==typeof n&&(n=[n]),n&&(t=t.concat(n))}}),t=t.filter(e=>{return null!=e&&!("string"==typeof(t=e)&&[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(e=>e.test(t)));var t}).map(e=>this.options.convertDetectedLanguage(e)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?t:t.length>0?t[0]:null}cacheUserLanguage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.caches;t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach(t=>{this.detectors[t]&&this.detectors[t].cacheUserLanguage(e,this.options)}))}}gh.type="languageDetector";const vh={common:{back:"返回",save:"保存",cancel:"取消",delete:"删除",confirm:"确定",loading:"加载中...",refresh:"刷新",add:"添加",remove:"移除",edit:"编辑",close:"关闭",retry:"重试",saving:"保存中...",saved:"已保存",save_failed:"保存失败"},language:{label:"语言",zh:"简体中文",en:"English",switch_failed:"语言切换失败"},settings:{title:"设置",tab_sync:"同步 (rsync)",tab_hub:"CCWeb Hub",tab_notifications:"通知",tab_pomodoro:"番茄钟",tab_usage:"用量监控",tab_language:"语言",webhook:{title:"Webhook 通知",enabled:"已启用",disabled:"已关闭",placeholder:"https://example.com/webhook",saved:"Webhook 配置已保存",save_failed:"保存失败",description:"AI 完成任务时向指定 URL 发送 POST 请求(JSON: event, projectId, projectName, timestamp)",enabled_prefix:"已启用 →"},browser_notify:{title:"浏览器通知",description:"当 AI 完成任务时,浏览器将自动弹出通知。首次打开 Dashboard 时会请求通知权限。"},pomodoro:{saved:"番茄钟设置已保存",section_title:"番茄钟时间设置",section_desc:"修改后重新启动番茄钟生效",work_minutes:"工作时长(分钟)",break_minutes:"休息时长(分钟)",howto_title:"使用说明",howto_item_1:"在项目页面 Header 点击图标启动番茄钟",howto_item_2:"倒计时以大字体悬浮在屏幕上,不影响操作",howto_item_3:"工作阶段结束后自动切换为休息,并弹出通知",howto_item_4:"休息结束后自动切换回工作阶段",howto_item_5:"再次点击图标可停止并重置"},usage:{section_title:"监控工具",section_desc:"选择要监控用量的 CLI 工具,首页和项目页会显示对应的实时用量",info_title:"说明",info_item_1:"用量数据显示在首页 Header 和项目页底部状态栏",info_item_2:"Claude Code 通过 OAuth API 实时查询,每 5 分钟自动刷新",info_item_3:"其他工具的用量查询将在后续版本中支持",info_item_4:"切换后无需刷新页面,用量会自动更新",switched_toast:"用量监控已切换为 {{tool}}",tool_claude_desc:"Anthropic API — 5h/7d 用量窗口",tool_codex_desc:"OpenAI — 用量查询暂未实现",tool_opencode_desc:"OpenCode — 用量查询暂未实现",tool_qwen_desc:"Qwen — 用量查询暂未实现",tool_gemini_desc:"Google — 用量查询暂未实现"}},dashboard:{sync_done_toast:"同步完成:{{ok}} 成功 / {{skipped}} 跳过 / {{failed}} 失败",sync_failed_toast:"同步失败:{{message}}",skillhub_title:"CCWeb Hub",mobile_title:"手机界面",settings_title:"设置",monitor_title_grid:"卡片模式",monitor_title_monitor:"监控大屏",fullscreen_enter:"全屏",fullscreen_exit:"退出全屏",logout:"退出",sync_all:"全部同步",sync_all_title:"通过 rsync 同步所有项目(在设置里配置服务器)",open_project:"打开项目",new_project:"新建项目",tags_clear:"清除",host_cpu:"CPU 占用(负载 {{load}})",host_mem:"内存:{{used}} / {{total}}",host_disk:"磁盘:{{used}} / {{total}}",host_net:"网络上下行速率",host_cores:"核",host_uptime:"已运行 {{hours}} 小时",memories_title:"记忆库",more:"更多"},claudemem:{title:"记忆库",back:"返回",all_projects:"全部项目",all_types:"全部",search_placeholder:"搜索记忆…",refresh:"刷新",count:"共 {{count}} 条",empty:"当前筛选下暂无记忆",load_more:"加载更多",unavailable_title:"记忆库不可用",unavailable_desc:"claude-mem 未安装、暂无记忆,或当前用户无权限(仅管理员)。"},projsync:{back:"返回",title:"同步设置",forbidden:"仅项目所有者可访问同步设置。",load_error:"加载失败,请稍后重试。",no_connection:"尚未配置同步服务器(主机/账号)。",go_global:"前往全局同步设置",remote_path:"远端路径",remote_path_hint:"本项目同步到的远端绝对路径(/ 开头)。留空表示不同步。不能包含空格或 shell 特殊字符。",excludes:"排除规则(本项目)",excludes_hint:"每行一条 rsync 排除规则,如 *.log 或 tmp/。与全局默认排除合并。",save:"保存",saved:"已保存",save_failed:"保存失败",status:"状态",not_configured:"未设置路径",dirty:"有未同步改动",synced:"已同步",syncing:"同步中…",last_sync:"上次同步",never:"从未",direction:"方向",cancel:"取消",sync_now:"立即同步",set_path_first:"请先设置远端路径",sync_done:"同步完成({{files}} 个文件)",sync_failed:"同步失败",sync_failed_reason:"同步失败:{{reason}}"},sync_section:{loading:"加载中…",load_failed:"加载同步配置失败: {{message}}",saved:"已保存",save_failed:"保存失败: {{message}}",test_ok:"连接成功",test_failed:"连接失败",test_failed_with_reason:"测试失败: {{message}}",bulk_done_toast:"同步完成:{{ok}} 成功 / {{skipped}} 跳过 / {{failed}} 失败",bulk_cancelled_toast:"已取消:{{ok}} 成功 / {{skipped}} 跳过 / {{cancelled}} 取消 / {{failed}} 失败",bulk_failed_toast:"同步失败: {{message}}",cancel_requested:"已请求取消",cancel_failed:"取消失败: {{message}}",server_section:"服务器配置",host:"主机 (host)",port:"端口",user:"用户名",remote_root:"远端根路径(默认前缀)",remote_root_hint:"可选:仅作为新建项目时远端路径的默认前缀。各项目的实际远端路径现在在项目设置页单独配置。",auth_section:"认证",auth_method:"方式",auth_password:"密码",key_path:"私钥路径",password:"密码",password_set_placeholder:"已设置,留空保持不变",password_unset_placeholder:"未设置",sshpass_hint:"需要系统安装 <code>sshpass</code>(密码通过 SSHPASS env 传递,不会出现在 argv 里)",strategy_section:"同步策略",direction:"方向",push_label:"单向:本地 → 远端(--delete)",pull_label:"单向:远端 → 本地",bidirectional_label:"双向(先 push 再 pull)",cron_label:"定时 cron 表达式",cron_hint:"5 段:分 时 日 月 周。例:<code>0 3 * * *</code> 每天 03:00",enable_label:"启用",exclude_section:"默认排除(每行一个 glob)",exclude_hint:"作为 <code>rsync --exclude</code> 传入。项目级的额外排除暂通过 API 设置。",save_button:"保存",test_button:"测试连接",syncing_with_files:"同步中: {{project}} ({{files}} 文件)",syncing_no_files:"同步中: {{project}}",sync_all_button:"立即同步全部",sync_all_title:"按当前方向同步所有项目",cancel_button:"取消",cancel_button_title:"取消批量同步:SIGTERM 当前 rsync 并停止后续项目",footer_hint:"一次性 push/pull 工具:进入项目内部,点击 header 的 <up /> / <down /> 按钮。或通过 API 调用 <code>POST /api/sync/project/:id</code> with body <code>{{body}}</code>。"},chat_overlay:{model_switched:"已切换模型:{{name}}",no_history:"暂无对话记录",starting:"启动中...",thinking:"思考中",tool_use:"调用工具",tool_result:"工具结果",placeholder_default:"输入消息… Shift+Enter 发送",placeholder_stopped:"输入消息(自动启动)… Shift+Enter 发送",placeholder_sending:"发送中…",placeholder_waking:"启动中...",placeholder_readonly:"只读模式",send_title:"发送 (Shift+Enter)",send_title_sending:"发送中…",slash_title:"斜杠命令(点击填充到输入框)",at_title:"引用项目文件(点击填充 @path 到输入框)",activity_thinking:"思考中",activity_tool_result:"处理结果",activity_call_tool:"调用工具",activity_call_named:"调用 {{name}}",tool_bash:"执行命令",tool_read:"读取文件",tool_edit:"编辑文件",tool_write:"写入文件",tool_grep:"搜索内容",tool_glob:"匹配文件",tool_web:"访问网络",tool_task:"调度子任务",tool_todo:"更新任务列表",tool_notebook:"编辑 Notebook",skills_builtin:"内置命令",skills_custom:"自定义",skills_plugins:"插件",files_up:"上一层",files_loading:"加载中…",files_empty:"(空目录)",load_older:"加载更早消息",voice_listening_stop:"停止录音",voice_listening_start:"语音输入",voice_err_not_allowed:"麦克风权限被拒绝",voice_err_network:"语音识别需要联网",voice_err_no_speech:"未检测到语音",voice_err_audio:"未找到麦克风",voice_err_aborted:"语音识别被中断",voice_err_other:"语音识别失败: {{error}}"},project_header:{sync:"同步",syncing:"同步中...",sync_failed:"同步失败",sync_success:"同步完成:{{files}} 文件,耗时 {{seconds}}s",sync_skipped:"该项目正在同步中,跳过",sync_failed_with_reason:"同步失败({{reason}})",sync_cancel:"取消",sync_cancelled:"已取消同步",sync_cancel_failed:"取消失败",sync_progress_label:"同步中({{files}} 文件)",sync_progress_label_empty:"同步中…",sync_cancel_title:"点击取消当前同步",fullscreen_enter:"全屏",fullscreen_exit:"退出全屏",toggle_file_tree:"切换文件树",toggle_right_panel:"切换右侧面板",toggle_chat_overlay:"对话框 (Ctrl+I)",sync_button_title:"同步到 rsync 服务器(在设置里配置)",switch_cli:"切换 CLI",switch_cli_title:"切换到其他 LLM CLI"},switch_cli:{title:"切换 LLM CLI",description:"当前使用 {{current}}。切换会终止当前会话并启动新的 CLI。",target_label:"目标 CLI",mode_label:"启动模式",mode_fresh:"直接启动",mode_fresh_hint:"新建会话",mode_continue:"--continue 模式",mode_continue_hint:"恢复目标 CLI 在该目录下最近一次会话。如果目标 CLI 没在该目录跑过,CLI 自身会以新会话起步。",mode_continue_unsupported:"{{tool}} 不支持 --continue",tag_current:"当前使用",tag_supports_continue:"支持 --continue",tag_no_continue:"不支持 --continue",confirm:"切换",confirming:"切换中…",cancel:"取消",switched_toast:"已切换到 {{tool}}",switch_failed:"切换失败:{{reason}}"}},yh={common:{back:"Back",save:"Save",cancel:"Cancel",delete:"Delete",confirm:"Confirm",loading:"Loading...",refresh:"Refresh",add:"Add",remove:"Remove",edit:"Edit",close:"Close",retry:"Retry",saving:"Saving...",saved:"Saved",save_failed:"Save failed"},language:{label:"Language",zh:"简体中文",en:"English",switch_failed:"Failed to switch language"},settings:{title:"Settings",tab_sync:"Sync (rsync)",tab_hub:"CCWeb Hub",tab_notifications:"Notifications",tab_pomodoro:"Pomodoro",tab_usage:"Usage monitor",tab_language:"Language",webhook:{title:"Webhook notifications",enabled:"Enabled",disabled:"Disabled",placeholder:"https://example.com/webhook",saved:"Webhook configuration saved",save_failed:"Save failed",description:"Sends a POST request to the URL when the AI completes a task (JSON: event, projectId, projectName, timestamp)",enabled_prefix:"Enabled →"},browser_notify:{title:"Browser notifications",description:"The browser will pop up a notification when the AI finishes a task. Permission is requested on first Dashboard visit."},pomodoro:{saved:"Pomodoro settings saved",section_title:"Pomodoro timer settings",section_desc:"Restart the timer for changes to take effect",work_minutes:"Work (minutes)",break_minutes:"Break (minutes)",howto_title:"How to use",howto_item_1:"Click the icon in the project page header to start",howto_item_2:"A large countdown floats on screen without blocking",howto_item_3:"Auto-switches to break after work, with a notification",howto_item_4:"Auto-switches back to work after break",howto_item_5:"Click the icon again to stop and reset"},usage:{section_title:"Monitored tool",section_desc:"Pick the CLI tool whose usage you want to monitor — shown in dashboard header and project status bar",info_title:"Notes",info_item_1:"Usage data is shown in the dashboard header and project status bar",info_item_2:"Claude Code queries via OAuth API, auto-refreshed every 5 minutes",info_item_3:"Other tools' usage queries will be supported in future versions",info_item_4:"No page reload needed after switching — usage updates automatically",switched_toast:"Usage monitor switched to {{tool}}",tool_claude_desc:"Anthropic API — 5h/7d usage window",tool_codex_desc:"OpenAI — usage query not yet implemented",tool_opencode_desc:"OpenCode — usage query not yet implemented",tool_qwen_desc:"Qwen — usage query not yet implemented",tool_gemini_desc:"Google — usage query not yet implemented"}},dashboard:{sync_done_toast:"Sync done: {{ok}} ok / {{skipped}} skipped / {{failed}} failed",sync_failed_toast:"Sync failed: {{message}}",skillhub_title:"CCWeb Hub",mobile_title:"Mobile view",settings_title:"Settings",monitor_title_grid:"Card mode",monitor_title_monitor:"Monitor view",fullscreen_enter:"Fullscreen",fullscreen_exit:"Exit fullscreen",logout:"Logout",sync_all:"Sync all",sync_all_title:"Sync every project via rsync (configure server in Settings)",open_project:"Open project",new_project:"New project",tags_clear:"Clear",host_cpu:"CPU usage (load {{load}})",host_mem:"Memory: {{used}} / {{total}}",host_disk:"Disk: {{used}} / {{total}}",host_net:"Network down / up rate",host_cores:"cores",host_uptime:"up {{hours}}h",memories_title:"Memories",more:"More"},claudemem:{title:"Memories",back:"Back",all_projects:"All projects",all_types:"All",search_placeholder:"Search memories…",refresh:"Refresh",count:"{{count}} total",empty:"No memories under the current filter",load_more:"Load more",unavailable_title:"Memories unavailable",unavailable_desc:"claude-mem is not installed, has no memories, or you lack permission (admin only)."},projsync:{back:"Back",title:"Sync settings",forbidden:"Only the project owner can access sync settings.",load_error:"Failed to load, please try again.",no_connection:"No sync server configured (host/account).",go_global:"Open global sync settings",remote_path:"Remote path",remote_path_hint:"Absolute remote path this project syncs to (starts with /). Empty = not synced. No spaces or shell metacharacters.",excludes:"Excludes (this project)",excludes_hint:"One rsync exclude per line, e.g. *.log or tmp/. Merged with the global defaults.",save:"Save",saved:"Saved",save_failed:"Save failed",status:"Status",not_configured:"No path set",dirty:"Unsynced changes",synced:"Synced",syncing:"Syncing…",last_sync:"Last sync",never:"Never",direction:"Direction",cancel:"Cancel",sync_now:"Sync now",set_path_first:"Set a remote path first",sync_done:"Sync done ({{files}} files)",sync_failed:"Sync failed",sync_failed_reason:"Sync failed: {{reason}}"},sync_section:{loading:"Loading…",load_failed:"Failed to load sync config: {{message}}",saved:"Saved",save_failed:"Save failed: {{message}}",test_ok:"Connection ok",test_failed:"Connection failed",test_failed_with_reason:"Test failed: {{message}}",bulk_done_toast:"Sync done: {{ok}} ok / {{skipped}} skipped / {{failed}} failed",bulk_cancelled_toast:"Cancelled: {{ok}} ok / {{skipped}} skipped / {{cancelled}} cancelled / {{failed}} failed",bulk_failed_toast:"Sync failed: {{message}}",cancel_requested:"Cancel requested",cancel_failed:"Cancel failed: {{message}}",server_section:"Server",host:"Host",port:"Port",user:"User",remote_root:"Remote root (default prefix)",remote_root_hint:"Optional: only a default prefix for new project paths. Each project's actual remote path is now configured on its project settings page.",auth_section:"Auth",auth_method:"Method",auth_password:"Password",key_path:"Key path",password:"Password",password_set_placeholder:"Set — leave blank to keep",password_unset_placeholder:"Not set",sshpass_hint:"Requires <code>sshpass</code> on the system (password passed via SSHPASS env, never in argv)",strategy_section:"Strategy",direction:"Direction",push_label:"One-way: local → remote (--delete)",pull_label:"One-way: remote → local",bidirectional_label:"Bidirectional (push then pull)",cron_label:"Cron expression",cron_hint:"5 fields: min hour day month wday. Example <code>0 3 * * *</code> = daily at 03:00.",enable_label:"Enable",exclude_section:"Default excludes (one glob per line)",exclude_hint:"Passed as <code>rsync --exclude</code>. Project-level extras for now via API.",save_button:"Save",test_button:"Test connection",syncing_with_files:"Syncing: {{project}} ({{files}} files)",syncing_no_files:"Syncing: {{project}}",sync_all_button:"Sync all now",sync_all_title:"Sync every project in current direction",cancel_button:"Cancel",cancel_button_title:"Cancel bulk sync: SIGTERM current rsync and stop subsequent projects",footer_hint:"Per-project push/pull: from inside a project, click <up /> / <down /> in the header. Or call <code>POST /api/sync/project/:id</code> with body <code>{{body}}</code>."},chat_overlay:{model_switched:"Model switched: {{name}}",no_history:"No history",starting:"Starting…",thinking:"thinking",tool_use:"tool use",tool_result:"tool result",placeholder_default:"Message… Shift+Enter to send",placeholder_stopped:"Message (auto-start)… Shift+Enter to send",placeholder_sending:"Sending…",placeholder_waking:"Starting…",placeholder_readonly:"Read-only",send_title:"Send (Shift+Enter)",send_title_sending:"Sending…",slash_title:"Slash commands (click to insert)",at_title:"Reference project file (insert @path)",activity_thinking:"thinking",activity_tool_result:"processing",activity_call_tool:"calling tool",activity_call_named:"calling {{name}}",tool_bash:"running command",tool_read:"reading file",tool_edit:"editing file",tool_write:"writing file",tool_grep:"searching",tool_glob:"matching files",tool_web:"fetching web",tool_task:"spawning subtask",tool_todo:"updating todos",tool_notebook:"editing notebook",skills_builtin:"Built-in",skills_custom:"Custom",skills_plugins:"Plugins",files_up:"Up",files_loading:"Loading…",files_empty:"(empty)",load_older:"Load older",voice_listening_stop:"Stop recording",voice_listening_start:"Voice input",voice_err_not_allowed:"Microphone permission denied",voice_err_network:"Voice recognition needs network",voice_err_no_speech:"No speech detected",voice_err_audio:"No microphone found",voice_err_aborted:"Voice recognition aborted",voice_err_other:"Voice recognition failed: {{error}}"},project_header:{sync:"Sync",syncing:"Syncing...",sync_failed:"Sync failed",sync_success:"Sync complete: {{files}} files in {{seconds}}s",sync_skipped:"Project already syncing — skipped",sync_failed_with_reason:"Sync failed ({{reason}})",sync_cancel:"Cancel",sync_cancelled:"Sync cancelled",sync_cancel_failed:"Cancel failed",sync_progress_label:"Syncing ({{files}} files)",sync_progress_label_empty:"Syncing…",sync_cancel_title:"Click to cancel current sync",fullscreen_enter:"Fullscreen",fullscreen_exit:"Exit fullscreen",toggle_file_tree:"Toggle file tree",toggle_right_panel:"Toggle right panel",toggle_chat_overlay:"Chat overlay (Ctrl+I)",sync_button_title:"Sync to rsync server (configure in Settings)",switch_cli:"Switch CLI",switch_cli_title:"Switch to another LLM CLI"},switch_cli:{title:"Switch LLM CLI",description:"Currently using {{current}}. Switching terminates the active session and launches the new CLI.",target_label:"Target CLI",mode_label:"Launch mode",mode_fresh:"Fresh start",mode_fresh_hint:"Begin a new session",mode_continue:"--continue mode",mode_continue_hint:"Resume the target CLI's most recent session in this folder. If that CLI has never run here, the CLI itself will start a new session.",mode_continue_unsupported:"{{tool}} does not support --continue",tag_current:"Currently active",tag_supports_continue:"Supports --continue",tag_no_continue:"No --continue support",confirm:"Switch",confirming:"Switching…",cancel:"Cancel",switched_toast:"Switched to {{tool}}",switch_failed:"Switch failed: {{reason}}"}},bh=["zh","en"],xh="ccweb_lang";kf.use(gh).use(Of).init({resources:{zh:{common:vh},en:{common:yh}},fallbackLng:"zh",defaultNS:"common",ns:["common"],interpolation:{escapeValue:!0},debug:!1,saveMissing:!1,missingKeyHandler:(e,t,n)=>{console.warn(`[i18n] missing key: ${n} (ns=${t}, lngs=${e.join(",")})`)},detection:{order:["localStorage","navigator"],lookupLocalStorage:xh,caches:["localStorage"],convertDetectedLanguage:e=>{const t=e.slice(0,2).toLowerCase();return bh.includes(t)?t:"en"}}});const wh=W.createContext({});function kh(e){const t=W.useRef(null);return null===t.current&&(t.current=e()),t.current}const Sh="undefined"!=typeof window?W.useLayoutEffect:W.useEffect,jh=W.createContext(null);function Ch(e,t){-1===e.indexOf(t)&&e.push(t)}function Eh(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Ph=(e,t,n)=>n>t?t:n<e?e:n;const _h={},Nh=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Th(e){return"object"==typeof e&&null!==e}const Rh=e=>/^0[^.\s]+$/u.test(e);function Mh(e){let t;return()=>(void 0===t&&(t=e()),t)}const Lh=e=>e,Oh=(e,t)=>n=>t(e(n)),Ah=(...e)=>e.reduce(Oh),Dh=(e,t,n)=>{const r=t-e;return 0===r?1:(n-e)/r};class Ih{constructor(){this.subscriptions=[]}add(e){return Ch(this.subscriptions,e),()=>Eh(this.subscriptions,e)}notify(e,t,n){const r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](e,t,n);else for(let o=0;o<r;o++){const r=this.subscriptions[o];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Fh=e=>1e3*e,$h=e=>e/1e3;function zh(e,t){return t?e*(1e3/t):0}const Vh=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function Uh(e,t,n,r){if(e===t&&n===r)return Lh;const o=t=>function(e,t,n,r,o){let a,s,i=0;do{s=t+(n-t)/2,a=Vh(s,r,o)-e,a>0?n=s:t=s}while(Math.abs(a)>1e-7&&++i<12);return s}(t,0,1,e,n);return e=>0===e||1===e?e:Vh(o(e),t,r)}const Bh=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Wh=e=>t=>1-e(1-t),Hh=Uh(.33,1.53,.69,.99),qh=Wh(Hh),Gh=Bh(qh),Kh=e=>e>=1?1:(e*=2)<1?.5*qh(e):.5*(2-Math.pow(2,-10*(e-1))),Yh=e=>1-Math.sin(Math.acos(e)),Xh=Wh(Yh),Qh=Bh(Yh),Jh=Uh(.42,0,1,1),Zh=Uh(0,0,.58,1),em=Uh(.42,0,.58,1),tm=e=>Array.isArray(e)&&"number"==typeof e[0],nm={linear:Lh,easeIn:Jh,easeInOut:em,easeOut:Zh,circIn:Yh,circInOut:Qh,circOut:Xh,backIn:qh,backInOut:Gh,backOut:Hh,anticipate:Kh},rm=e=>{if(tm(e)){e.length;const[t,n,r,o]=e;return Uh(t,n,r,o)}return"string"==typeof e?nm[e]:e},om=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function am(e,t){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,s=om.reduce((e,t)=>(e[t]=function(e){let t=new Set,n=new Set,r=!1,o=!1;const a=new WeakSet;let s={delta:0,timestamp:0,isProcessing:!1};function i(t){a.has(t)&&(l.schedule(t),e()),t(s)}const l={schedule:(e,o=!1,s=!1)=>{const i=s&&r?t:n;return o&&a.add(e),i.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(s=e,r)return void(o=!0);r=!0;const a=t;t=n,n=a,t.forEach(i),t.clear(),r=!1,o&&(o=!1,l.process(e))}};return l}(a),e),{}),{setup:i,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:p,render:f,postRender:h}=s,m=()=>{const a=_h.useManualTiming,s=a?o.timestamp:performance.now();n=!1,a||(o.delta=r?1e3/60:Math.max(Math.min(s-o.timestamp,40),1)),o.timestamp=s,o.isProcessing=!0,i.process(o),l.process(o),c.process(o),u.process(o),d.process(o),p.process(o),f.process(o),h.process(o),o.isProcessing=!1,n&&t&&(r=!1,e(m))};return{schedule:om.reduce((t,a)=>{const i=s[a];return t[a]=(t,a=!1,s=!1)=>(n||(n=!0,r=!0,o.isProcessing||e(m)),i.schedule(t,a,s)),t},{}),cancel:e=>{for(let t=0;t<om.length;t++)s[om[t]].cancel(e)},state:o,steps:s}}const{schedule:sm,cancel:im,state:lm,steps:cm}=am("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:Lh,!0);let um;function dm(){um=void 0}const pm={now:()=>(void 0===um&&pm.set(lm.isProcessing||_h.useManualTiming?lm.timestamp:performance.now()),um),set:e=>{um=e,queueMicrotask(dm)}},fm=e=>t=>"string"==typeof t&&t.startsWith(e),hm=fm("--"),mm=fm("var(--"),gm=e=>!!mm(e)&&vm.test(e.split("/*")[0].trim()),vm=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function ym(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}const bm={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},xm={...bm,transform:e=>Ph(0,1,e)},wm={...bm,default:1},km=e=>Math.round(1e5*e)/1e5,Sm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const jm=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Cm=(e,t)=>n=>Boolean("string"==typeof n&&jm.test(n)&&n.startsWith(e)||t&&!function(e){return null==e}(n)&&Object.prototype.hasOwnProperty.call(n,t)),Em=(e,t,n)=>r=>{if("string"!=typeof r)return r;const[o,a,s,i]=r.match(Sm);return{[e]:parseFloat(o),[t]:parseFloat(a),[n]:parseFloat(s),alpha:void 0!==i?parseFloat(i):1}},Pm={...bm,transform:e=>Math.round((e=>Ph(0,255,e))(e))},_m={test:Cm("rgb","red"),parse:Em("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Pm.transform(e)+", "+Pm.transform(t)+", "+Pm.transform(n)+", "+km(xm.transform(r))+")"};const Nm={test:Cm("#"),parse:function(e){let t="",n="",r="",o="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),o=e.substring(4,5),t+=t,n+=n,r+=r,o+=o),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}},transform:_m.transform},Tm=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),Rm=Tm("deg"),Mm=Tm("%"),Lm=Tm("px"),Om=Tm("vh"),Am=Tm("vw"),Dm=(()=>({...Mm,parse:e=>Mm.parse(e)/100,transform:e=>Mm.transform(100*e)}))(),Im={test:Cm("hsl","hue"),parse:Em("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Mm.transform(km(t))+", "+Mm.transform(km(n))+", "+km(xm.transform(r))+")"},Fm={test:e=>_m.test(e)||Nm.test(e)||Im.test(e),parse:e=>_m.test(e)?_m.parse(e):Im.test(e)?Im.parse(e):Nm.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?_m.transform(e):Im.transform(e),getAnimatableNone:e=>{const t=Fm.parse(e);return t.alpha=0,Fm.transform(t)}},$m=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const zm="number",Vm="color",Um=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Bm(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},o=[];let a=0;const s=t.replace(Um,e=>(Fm.test(e)?(r.color.push(a),o.push(Vm),n.push(Fm.parse(e))):e.startsWith("var(")?(r.var.push(a),o.push("var"),n.push(e)):(r.number.push(a),o.push(zm),n.push(parseFloat(e))),++a,"${}")).split("${}");return{values:n,split:s,indexes:r,types:o}}function Wm({split:e,types:t}){const n=e.length;return r=>{let o="";for(let a=0;a<n;a++)if(o+=e[a],void 0!==r[a]){const e=t[a];o+=e===zm?km(r[a]):e===Vm?Fm.transform(r[a]):r[a]}return o}}const Hm=(e,t)=>{return"number"==typeof e?(null==t?void 0:t.trim().endsWith("/"))?e:0:"number"==typeof(n=e)?0:Fm.test(n)?Fm.getAnimatableNone(n):n;var n};const qm={test:function(e){var t,n;return isNaN(e)&&"string"==typeof e&&((null==(t=e.match(Sm))?void 0:t.length)||0)+((null==(n=e.match($m))?void 0:n.length)||0)>0},parse:function(e){return Bm(e).values},createTransformer:function(e){return Wm(Bm(e))},getAnimatableNone:function(e){const t=Bm(e);return Wm(t)(t.values.map((e,n)=>Hm(e,t.split[n])))}};function Gm(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Km(e,t){return n=>n>0?t:e}const Ym=(e,t,n)=>e+(t-e)*n,Xm=(e,t,n)=>{const r=e*e,o=n*(t*t-r)+r;return o<0?0:Math.sqrt(o)},Qm=[Nm,_m,Im];function Jm(e){const t=(n=e,Qm.find(e=>e.test(n)));var n;if(!Boolean(t))return!1;let r=t.parse(e);return t===Im&&(r=function({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,n/=100;let o=0,a=0,s=0;if(t/=100){const r=n<.5?n*(1+t):n+t-n*t,i=2*n-r;o=Gm(i,r,e+1/3),a=Gm(i,r,e),s=Gm(i,r,e-1/3)}else o=a=s=n;return{red:Math.round(255*o),green:Math.round(255*a),blue:Math.round(255*s),alpha:r}}(r)),r}const Zm=(e,t)=>{const n=Jm(e),r=Jm(t);if(!n||!r)return Km(e,t);const o={...n};return e=>(o.red=Xm(n.red,r.red,e),o.green=Xm(n.green,r.green,e),o.blue=Xm(n.blue,r.blue,e),o.alpha=Ym(n.alpha,r.alpha,e),_m.transform(o))},eg=new Set(["none","hidden"]);function tg(e,t){return n=>Ym(e,t,n)}function ng(e){return"number"==typeof e?tg:"string"==typeof e?gm(e)?Km:Fm.test(e)?Zm:ag:Array.isArray(e)?rg:"object"==typeof e?Fm.test(e)?Zm:og:Km}function rg(e,t){const n=[...e],r=n.length,o=e.map((e,n)=>ng(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=o[t](e);return n}}function og(e,t){const n={...e,...t},r={};for(const o in n)void 0!==e[o]&&void 0!==t[o]&&(r[o]=ng(e[o])(e[o],t[o]));return e=>{for(const t in r)n[t]=r[t](e);return n}}const ag=(e,t)=>{const n=qm.createTransformer(t),r=Bm(e),o=Bm(t);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?eg.has(e)&&!o.values.length||eg.has(t)&&!r.values.length?function(e,t){return eg.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}(e,t):Ah(rg(function(e,t){const n=[],r={color:0,var:0,number:0};for(let o=0;o<t.values.length;o++){const a=t.types[o],s=e.indexes[a][r[a]],i=e.values[s]??0;n[o]=i,r[a]++}return n}(r,o),o.values),n):Km(e,t)};function sg(e,t,n){if("number"==typeof e&&"number"==typeof t&&"number"==typeof n)return Ym(e,t,n);return ng(e)(e,t)}const ig=e=>{const t=({timestamp:t})=>e(t);return{start:(e=!0)=>sm.update(t,e),stop:()=>im(t),now:()=>lm.isProcessing?lm.timestamp:pm.now()}},lg=(e,t,n=10)=>{let r="";const o=Math.max(Math.round(t/n),2);for(let a=0;a<o;a++)r+=Math.round(1e4*e(a/(o-1)))/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},cg=2e4;function ug(e){let t=0;let n=e.next(t);for(;!n.done&&t<cg;)t+=50,n=e.next(t);return t>=cg?1/0:t}const dg=100,pg=10,fg=1,hg=0,mg=800,gg=.3,vg=.3,yg={granular:.01,default:2},bg={granular:.005,default:.5},xg=.01,wg=10,kg=.05,Sg=1;function jg(e,t){return e*Math.sqrt(1-t*t)}const Cg=.001;const Eg=["duration","bounce"],Pg=["stiffness","damping","mass"];function _g(e,t){return t.some(t=>void 0!==e[t])}function Ng(e){let t={velocity:hg,stiffness:dg,damping:pg,mass:fg,isResolvedFromDuration:!1,...e};if(!_g(e,Pg)&&_g(e,Eg))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(1.2*n),o=r*r,a=2*Ph(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:fg,stiffness:o,damping:a}}else{const n=function({duration:e=mg,bounce:t=gg,velocity:n=hg,mass:r=fg}){let o,a,s=1-t;s=Ph(kg,Sg,s),e=Ph(xg,wg,$h(e)),s<1?(o=t=>{const r=t*s,o=r*e,a=r-n,i=jg(t,s),l=Math.exp(-o);return Cg-a/i*l},a=t=>{const r=t*s*e,a=r*n+n,i=Math.pow(s,2)*Math.pow(t,2)*e,l=Math.exp(-r),c=jg(Math.pow(t,2),s);return(-o(t)+Cg>0?-1:1)*((a-i)*l)/c}):(o=t=>Math.exp(-t*e)*((t-n)*e+1)-.001,a=t=>Math.exp(-t*e)*(e*e*(n-t)));const i=function(e,t,n){let r=n;for(let o=1;o<12;o++)r-=e(r)/t(r);return r}(o,a,5/e);if(e=Fh(e),isNaN(i))return{stiffness:dg,damping:pg,duration:e};{const t=Math.pow(i,2)*r;return{stiffness:t,damping:2*s*Math.sqrt(r*t),duration:e}}}({...e,velocity:0});t={...t,...n,mass:fg},t.isResolvedFromDuration=!0}return t}function Tg(e=vg,t=gg){const n="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:o}=n;const a=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],i={done:!1,value:a},{stiffness:l,damping:c,mass:u,duration:d,velocity:p,isResolvedFromDuration:f}=Ng({...n,velocity:-$h(n.velocity||0)}),h=p||0,m=c/(2*Math.sqrt(l*u)),g=s-a,v=$h(Math.sqrt(l/u)),y=Math.abs(g)<5;let b,x,w,k,S,j;if(r||(r=y?yg.granular:yg.default),o||(o=y?bg.granular:bg.default),m<1)w=jg(v,m),k=(h+m*v*g)/w,b=e=>{const t=Math.exp(-m*v*e);return s-t*(k*Math.sin(w*e)+g*Math.cos(w*e))},S=m*v*k+g*w,j=m*v*g-k*w,x=e=>Math.exp(-m*v*e)*(S*Math.sin(w*e)+j*Math.cos(w*e));else if(1===m){b=e=>s-Math.exp(-v*e)*(g+(h+v*g)*e);const e=h+v*g;x=t=>Math.exp(-v*t)*(v*e*t-h)}else{const e=v*Math.sqrt(m*m-1);b=t=>{const n=Math.exp(-m*v*t),r=Math.min(e*t,300);return s-n*((h+m*v*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};const t=(h+m*v*g)/e,n=m*v*t-g*e,r=m*v*g-t*e;x=t=>{const o=Math.exp(-m*v*t),a=Math.min(e*t,300);return o*(n*Math.sinh(a)+r*Math.cosh(a))}}const C={calculatedDuration:f&&d||null,velocity:e=>Fh(x(e)),next:e=>{if(!f&&m<1){const t=Math.exp(-m*v*e),n=Math.sin(w*e),a=Math.cos(w*e),l=s-t*(k*n+g*a),c=Fh(t*(S*n+j*a));return i.done=Math.abs(c)<=r&&Math.abs(s-l)<=o,i.value=i.done?s:l,i}const t=b(e);if(f)i.done=e>=d;else{const n=Fh(x(e));i.done=Math.abs(n)<=r&&Math.abs(s-t)<=o}return i.value=i.done?s:t,i},toString:()=>{const e=Math.min(ug(C),cg),t=lg(t=>C.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return C}Tg.applyToOptions=e=>{const t=function(e,t=100,n){const r=n({...e,keyframes:[0,t]}),o=Math.min(ug(r),cg);return{type:"keyframes",ease:e=>r.next(o*e).value/t,duration:$h(o)}}(e,100,Tg);return e.ease=t.ease,e.duration=Fh(t.duration),e.type="keyframes",e};function Rg(e,t,n){const r=Math.max(t-5,0);return zh(n-e(r),t-r)}function Mg({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:a=500,modifyTarget:s,min:i,max:l,restDelta:c=.5,restSpeed:u}){const d=e[0],p={done:!1,value:d},f=e=>void 0===i?l:void 0===l||Math.abs(i-e)<Math.abs(l-e)?i:l;let h=n*t;const m=d+h,g=void 0===s?m:s(m);g!==m&&(h=g-d);const v=e=>-h*Math.exp(-e/r),y=e=>g+v(e),b=e=>{const t=v(e),n=y(e);p.done=Math.abs(t)<=c,p.value=p.done?g:n};let x,w;const k=e=>{var t;(t=p.value,void 0!==i&&t<i||void 0!==l&&t>l)&&(x=e,w=Tg({keyframes:[p.value,f(p.value)],velocity:Rg(y,e,p.value),damping:o,stiffness:a,restDelta:c,restSpeed:u}))};return k(0),{calculatedDuration:null,next:e=>{let t=!1;return w||void 0!==x||(t=!0,b(e),k(e)),void 0!==x&&e>=x?w.next(e-x):(!t&&b(e),p)}}}function Lg(e,t,{clamp:n=!0,ease:r,mixer:o}={}){const a=e.length;if(t.length,1===a)return()=>t[0];if(2===a&&t[0]===t[1])return()=>t[1];const s=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());const i=function(e,t,n){const r=[],o=n||_h.mix||sg,a=e.length-1;for(let s=0;s<a;s++){let n=o(e[s],e[s+1]);if(t){const e=Array.isArray(t)?t[s]||Lh:t;n=Ah(e,n)}r.push(n)}return r}(t,r,o),l=i.length,c=n=>{if(s&&n<e[0])return t[0];let r=0;if(l>1)for(;r<e.length-2&&!(n<e[r+1]);r++);const o=Dh(e[r],e[r+1],n);return i[r](o)};return n?t=>c(Ph(e[0],e[a-1],t)):c}function Og(e){const t=[0];return function(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const o=Dh(0,t,r);e.push(Ym(n,1,o))}}(t,e.length-1),t}function Ag({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const o=(e=>Array.isArray(e)&&"number"!=typeof e[0])(r)?r.map(rm):rm(r),a={done:!1,value:t[0]},s=function(e,t){return e.map(e=>e*t)}(n&&n.length===t.length?n:Og(t),e),i=Lg(s,t,{ease:Array.isArray(o)?o:(l=t,c=o,l.map(()=>c||em).splice(0,l.length-1))});var l,c;return{calculatedDuration:e,next:t=>(a.value=i(t),a.done=t>=e,a)}}const Dg=e=>null!==e;function Ig(e,{repeat:t,repeatType:n="loop"},r,o=1){const a=e.filter(Dg),s=o<0||t&&"loop"!==n&&t%2==1?0:a.length-1;return s&&void 0!==r?r:a[s]}const Fg={decay:Mg,inertia:Mg,tween:Ag,keyframes:Ag,spring:Tg};function $g(e){"string"==typeof e.type&&(e.type=Fg[e.type])}class zg{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}const Vg=e=>e/100;class Ug extends zg{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var e,t;const{motionValue:n}=this.options;n&&n.updatedAt!==pm.now()&&this.tick(pm.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),null==(t=(e=this.options).onStop)||t.call(e))},this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){const{options:e}=this;$g(e);const{type:t=Ag,repeat:n=0,repeatDelay:r=0,repeatType:o,velocity:a=0}=e;let{keyframes:s}=e;const i=t||Ag;i!==Ag&&"number"!=typeof s[0]&&(this.mixKeyframes=Ah(Vg,sg(s[0],s[1])),s=[0,100]);const l=i({...e,keyframes:s});"mirror"===o&&(this.mirroredGenerator=i({...e,keyframes:[...s].reverse(),velocity:-a})),null===l.calculatedDuration&&(l.calculatedDuration=ug(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=l}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:n,totalDuration:r,mixKeyframes:o,mirroredGenerator:a,resolvedDuration:s,calculatedDuration:i}=this;if(null===this.startTime)return n.next(0);const{delay:l=0,keyframes:c,repeat:u,repeatType:d,repeatDelay:p,type:f,onUpdate:h,finalKeyframe:m}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const g=this.currentTime-l*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=r);let y,b=this.currentTime,x=n;if(u){const e=Math.min(this.currentTime,r)/s;let t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),1===n&&t--,t=Math.min(t,u+1);Boolean(t%2)&&("reverse"===d?(n=1-n,p&&(n-=p/s)):"mirror"===d&&(x=a)),b=Ph(0,1,n)*s}v?(this.delayState.value=c[0],y=this.delayState):y=x.next(b),o&&!v&&(y.value=o(y.value));let{done:w}=y;v||null===i||(w=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const k=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return k&&f!==Mg&&(y.value=Ig(c,this.options,m,this.speed)),h&&h(y.value),k&&this.finish(),y}then(e,t){return this.finished.then(e,t)}get duration(){return $h(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+$h(e)}get time(){return $h(this.currentTime)}set time(e){e=Fh(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);return Rg(e=>this.generator.next(e).value,e,this.generator.next(e).value)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(pm.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=$h(this.currentTime))}play(){var e,t;if(this.isStopped)return;const{driver:n=ig,startTime:r}=this.options;this.driver||(this.driver=n(e=>this.tick(e))),null==(t=(e=this.options).onPlay)||t.call(e);const o=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=o):null!==this.holdTime?this.startTime=o-this.holdTime:this.startTime||(this.startTime=r??o),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(pm.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,t;this.notifyFinished(),this.teardown(),this.state="finished",null==(t=(e=this.options).onComplete)||t.call(e)}cancel(){var e,t;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),null==(t=(e=this.options).onCancel)||t.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var t;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),null==(t=this.driver)||t.stop(),e.observe(this)}}const Bg=e=>180*e/Math.PI,Wg=e=>{const t=Bg(Math.atan2(e[1],e[0]));return qg(t)},Hg={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Wg,rotateZ:Wg,skewX:e=>Bg(Math.atan(e[1])),skewY:e=>Bg(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},qg=e=>((e%=360)<0&&(e+=360),e),Gg=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Kg=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Yg={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Gg,scaleY:Kg,scale:e=>(Gg(e)+Kg(e))/2,rotateX:e=>qg(Bg(Math.atan2(e[6],e[5]))),rotateY:e=>qg(Bg(Math.atan2(-e[2],e[0]))),rotateZ:Wg,rotate:Wg,skewX:e=>Bg(Math.atan(e[4])),skewY:e=>Bg(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Xg(e){return e.includes("scale")?1:0}function Qg(e,t){if(!e||"none"===e)return Xg(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(n)r=Yg,o=n;else{const t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Hg,o=t}if(!o)return Xg(t);const a=r[t],s=o[1].split(",").map(Jg);return"function"==typeof a?a(s):s[a]}function Jg(e){return parseFloat(e.trim())}const Zg=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ev=(()=>new Set(Zg))(),tv=e=>e===bm||e===Lm,nv=new Set(["x","y","z"]),rv=Zg.filter(e=>!nv.has(e));const ov={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:r})=>{const o=e.max-e.min;return"border-box"===r?o:o-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:r})=>{const o=e.max-e.min;return"border-box"===r?o:o-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Qg(t,"x"),y:(e,{transform:t})=>Qg(t,"y")};ov.translateX=ov.x,ov.translateY=ov.y;const av=new Set;let sv=!1,iv=!1,lv=!1;function cv(){if(iv){const e=Array.from(av).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{const t=function(e){const t=[];return rv.forEach(n=>{const r=e.getValue(n);void 0!==r&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();const t=n.get(e);t&&t.forEach(([t,n])=>{var r;null==(r=e.getValue(t))||r.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}iv=!1,sv=!1,av.forEach(e=>e.complete(lv)),av.clear()}function uv(){av.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(iv=!0)})}class dv{constructor(e,t,n,r,o,a=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=o,this.isAsync=a}scheduleResolve(){this.state="scheduled",this.isAsync?(av.add(this),sv||(sv=!0,sm.read(uv),sm.resolveKeyframes(cv))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(null===e[0]){const o=null==r?void 0:r.get(),a=e[e.length-1];if(void 0!==o)e[0]=o;else if(n&&t){const r=n.readValue(t,a);null!=r&&(e[0]=r)}void 0===e[0]&&(e[0]=a),r&&void 0===o&&r.set(e[0])}!function(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),av.delete(this)}cancel(){"scheduled"===this.state&&(av.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function pv(e,t,n){(e=>e.startsWith("--"))(t)?e.style.setProperty(t,n):e.style[t]=n}const fv={};function hv(e,t){const n=Mh(e);return()=>fv[t]??n()}const mv=hv(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),gv=hv(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(TO){return!1}return!0},"linearEasing"),vv=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,yv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:vv([0,.65,.55,1]),circOut:vv([.55,0,1,.45]),backIn:vv([.31,.01,.66,-.59]),backOut:vv([.33,1.53,.69,.99])};function bv(e,t){return e?"function"==typeof e?gv()?lg(e,t):"ease-out":tm(e)?vv(e):Array.isArray(e)?e.map(e=>bv(e,t)||yv.easeOut):yv[e]:void 0}function xv(e,t,n,{delay:r=0,duration:o=300,repeat:a=0,repeatType:s="loop",ease:i="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const d=bv(i,o);Array.isArray(d)&&(u.easing=d);const p={delay:r,duration:o,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:a+1,direction:"reverse"===s?"alternate":"normal"};c&&(p.pseudoElement=c);return e.animate(u,p)}function wv(e){return"function"==typeof e&&"applyToOptions"in e}class kv extends zg{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:n,keyframes:r,pseudoElement:o,allowFlatten:a=!1,finalKeyframe:s,onComplete:i}=e;this.isPseudoElement=Boolean(o),this.allowFlatten=a,this.options=e,e.type;const l=function({type:e,...t}){return wv(e)&&gv()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=xv(t,n,r,l,o),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const e=Ig(r,this.options,s,this.speed);this.updateMotionValue&&this.updateMotionValue(e),pv(t,n,e),this.animation.cancel()}null==i||i(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,t;null==(t=(e=this.animation).finish)||t.call(e)}cancel(){try{this.animation.cancel()}catch(TO){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,t,n;const r=null==(e=this.options)?void 0:e.element;!this.isPseudoElement&&(null==r?void 0:r.isConnected)&&(null==(n=(t=this.animation).commitStyles)||n.call(t))}get duration(){var e,t;const n=(null==(t=null==(e=this.animation.effect)?void 0:e.getComputedTiming)?void 0:t.call(e).duration)||0;return $h(Number(n))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+$h(e)}get time(){return $h(Number(this.animation.currentTime)||0)}set time(e){const t=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Fh(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){var o;return this.allowFlatten&&(null==(o=this.animation.effect)||o.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&mv()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),Lh):r(this)}}const Sv={anticipate:Kh,backInOut:Gh,circInOut:Qh};function jv(e){"string"==typeof e.ease&&e.ease in Sv&&(e.ease=Sv[e.ease])}class Cv extends kv{constructor(e){jv(e),$g(e),super(e),void 0!==e.startTime&&!1!==e.autoplay&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:n,onComplete:r,element:o,...a}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);const s=new Ug({...a,autoplay:!1}),i=Math.max(10,pm.now()-this.startTime),l=Ph(0,10,i-10),c=s.sample(i).value,{name:u}=this.options;o&&u&&pv(o,u,c),t.setWithVelocity(s.sample(Math.max(0,i-l)).value,c,l),s.stop()}}const Ev=(e,t)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!qm.test(e)&&"0"!==e||e.startsWith("url(")));function Pv(e){e.duration=0,e.type="keyframes"}const _v=new Set(["opacity","clipPath","filter","transform"]),Nv=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;const Tv=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Rv=Mh(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Mv(e){var t;const{motionValue:n,name:r,repeatDelay:o,repeatType:a,damping:s,type:i,keyframes:l}=e;if(!((null==(t=null==n?void 0:n.owner)?void 0:t.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return Rv()&&r&&(_v.has(r)||Tv.has(r)&&function(e){for(let t=0;t<e.length;t++)if("string"==typeof e[t]&&Nv.test(e[t]))return!0;return!1}(l))&&("transform"!==r||!u)&&!c&&!o&&"mirror"!==a&&0!==s&&"inertia"!==i}class Lv extends zg{constructor({autoplay:e=!0,delay:t=0,type:n="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:a="loop",keyframes:s,name:i,motionValue:l,element:c,...u}){var d;super(),this.stop=()=>{var e,t;this._animation&&(this._animation.stop(),null==(e=this.stopTimeline)||e.call(this)),null==(t=this.keyframeResolver)||t.cancel()},this.createdAt=pm.now();const p={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:o,repeatType:a,name:i,motionValue:l,element:c,...u},f=(null==c?void 0:c.KeyframeResolver)||dv;this.keyframeResolver=new f(s,(e,t,n)=>this.onKeyframesResolved(e,t,p,!n),i,l,c),null==(d=this.keyframeResolver)||d.scheduleResolve()}onKeyframesResolved(e,t,n,r){var o,a;this.keyframeResolver=void 0;const{name:s,type:i,velocity:l,delay:c,isHandoff:u,onUpdate:d}=n;this.resolvedAt=pm.now();let p=!0;(function(e,t,n,r){const o=e[0];if(null===o)return!1;if("display"===t||"visibility"===t)return!0;const a=e[e.length-1],s=Ev(o,t),i=Ev(a,t);return!(!s||!i)&&(function(e){const t=e[0];if(1===e.length)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}(e)||("spring"===n||wv(n))&&r)})(e,s,i,l)||(p=!1,!_h.instantAnimations&&c||null==d||d(Ig(e,n,t)),e[0]=e[e.length-1],Pv(n),n.repeat=0);const f={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},h=p&&!u&&Mv(f),m=null==(a=null==(o=f.motionValue)?void 0:o.owner)?void 0:a.current;let g;if(h)try{g=new Cv({...f,element:m})}catch{g=new Ug(f)}else g=new Ug(f);g.finished.then(()=>{this.notifyFinished()}).catch(Lh),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||(null==(e=this.keyframeResolver)||e.resume(),lv=!0,uv(),cv(),lv=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),null==(e=this.keyframeResolver)||e.cancel()}}function Ov(e,t,n,r=0,o=1){const a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),s=e.size,i=(s-1)*r;return"function"==typeof n?n(a,s):1===o?a*r:i-a*r}const Av=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Dv(e,t,n=1){const[r,o]=function(e){const t=Av.exec(e);if(!t)return[,];const[,n,r,o]=t;return[`--${n??r}`,o]}(e);if(!r)return;const a=window.getComputedStyle(t).getPropertyValue(r);if(a){const e=a.trim();return Nh(e)?parseFloat(e):e}return gm(o)?Dv(o,t,n+1):o}const Iv={type:"spring",stiffness:500,damping:25,restSpeed:10},Fv={type:"keyframes",duration:.8},$v={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},zv=(e,{keyframes:t})=>t.length>2?Fv:ev.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:Iv:$v;function Vv(e,t){if((null==e?void 0:e.inherit)&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function Uv(e,t){const n=(null==e?void 0:e[t])??(null==e?void 0:e.default)??e;return n!==e?Vv(n,e):n}const Bv=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);const Wv=(e,t,n,r={},o,a)=>s=>{const i=Uv(r,e)||{},l=i.delay||r.delay||0;let{elapsed:c=0}=r;c-=Fh(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...i,delay:-c,onUpdate:e=>{t.set(e),i.onUpdate&&i.onUpdate(e)},onComplete:()=>{s(),i.onComplete&&i.onComplete()},name:e,motionValue:t,element:a?void 0:o};(function(e){for(const t in e)if(!Bv.has(t))return!0;return!1})(i)||Object.assign(u,zv(e,u)),u.duration&&(u.duration=Fh(u.duration)),u.repeatDelay&&(u.repeatDelay=Fh(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let d=!1;if((!1===u.type||0===u.duration&&!u.repeatDelay)&&(Pv(u),0===u.delay&&(d=!0)),(_h.instantAnimations||_h.skipAnimations||(null==o?void 0:o.shouldSkipAnimations))&&(d=!0,Pv(u),u.delay=0),u.allowFlatten=!i.type&&!i.ease,d&&!a&&void 0!==t.get()){const e=Ig(u.keyframes,i);if(void 0!==e)return void sm.update(()=>{u.onUpdate(e),u.onComplete()})}return i.isSync?new Ug(u):new Lv(u)};function Hv(e){const t=[{},{}];return null==e||e.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function qv(e,t,n,r){if("function"==typeof t){const[o,a]=Hv(r);t=t(void 0!==n?n:e.custom,o,a)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){const[o,a]=Hv(r);t=t(void 0!==n?n:e.custom,o,a)}return t}function Gv(e,t,n){const r=e.getProps();return qv(r,t,void 0!==n?n:r.custom,e)}const Kv=new Set(["width","height","top","left","right","bottom",...Zg]);class Yv{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{var t;const n=pm.now();if(this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(null==(t=this.events.change)||t.notify(this.current),this.dependents))for(const r of this.dependents)r.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){var t;this.current=e,this.updatedAt=pm.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=(t=this.current,!isNaN(parseFloat(t))))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new Ih);const n=this.events[e].add(t);return"change"===e?()=>{n(),sm.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;null==(e=this.events.change)||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=pm.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return zh(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,t;null==(e=this.dependents)||e.clear(),null==(t=this.events.destroy)||t.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Xv(e,t){return new Yv(e,t)}const Qv=e=>Array.isArray(e);function Jv(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Xv(n))}function Zv(e){return Qv(e)?e[e.length-1]||0:e}const ey=e=>Boolean(e&&e.getVelocity);function ty(e,t){const n=e.getValue("willChange");if(r=n,Boolean(ey(r)&&r.add))return n.add(t);if(!n&&_h.WillChange){const n=new _h.WillChange("auto");e.addValue("willChange",n),n.add(t)}var r}function ny(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const ry="data-"+ny("framerAppearId");function oy(e){return e.props[ry]}function ay({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&!0!==t[n];return t[n]=!1,r}function sy(e,t,{delay:n=0,transitionOverride:r,type:o}={}){let{transition:a,transitionEnd:s,...i}=t;const l=e.getDefaultTransition();a=a?Vv(a,l):l;const c=null==a?void 0:a.reduceMotion;r&&(a=r);const u=[],d=o&&e.animationState&&e.animationState.getState()[o];for(const p in i){const t=e.getValue(p,e.latestValues[p]??null),r=i[p];if(void 0===r||d&&ay(d,p))continue;const o={delay:n,...Uv(a||{},p)},s=t.get();if(void 0!==s&&!t.isAnimating()&&!Array.isArray(r)&&r===s&&!o.velocity){sm.update(()=>t.set(r));continue}let l=!1;if(window.MotionHandoffAnimation){const t=oy(e);if(t){const e=window.MotionHandoffAnimation(t,p,sm);null!==e&&(o.startTime=e,l=!0)}}ty(e,p);const f=c??e.shouldReduceMotion;t.start(Wv(p,t,r,f&&Kv.has(p)?{type:!1}:o,e,l));const h=t.animation;h&&u.push(h)}if(s){const t=()=>sm.update(()=>{s&&function(e,t){const n=Gv(e,t);let{transitionEnd:r={},transition:o={},...a}=n||{};a={...a,...r};for(const s in a)Jv(e,s,Zv(a[s]))}(e,s)});u.length?Promise.all(u).then(t):t()}return u}function iy(e,t,n={}){var r;const o=Gv(e,t,"exit"===n.type?null==(r=e.presenceContext)?void 0:r.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(a=n.transitionOverride);const s=o?()=>Promise.all(sy(e,o,n)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(r=0)=>{const{delayChildren:o=0,staggerChildren:s,staggerDirection:i}=a;return function(e,t,n=0,r=0,o=0,a=1,s){const i=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),i.push(iy(l,t,{...s,delay:n+("function"==typeof r?0:r)+Ov(e.variantChildren,l,r,o,a)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(i)}(e,t,r,o,s,i,n)}:()=>Promise.resolve(),{when:l}=a;if(l){const[e,t]="beforeChildren"===l?[s,i]:[i,s];return e().then(()=>t())}return Promise.all([s(),i(n.delay)])}const ly=e=>t=>t.test(e),cy=[bm,Lm,Mm,Rm,Am,Om,{test:e=>"auto"===e,parse:e=>e}],uy=e=>cy.find(ly(e));function dy(e){return"number"==typeof e?0===e:null===e||("none"===e||"0"===e||Rh(e))}const py=new Set(["brightness","contrast","saturate","opacity"]);function fy(e){const[t,n]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[r]=n.match(Sm)||[];if(!r)return e;const o=n.replace(r,"");let a=py.has(t)?1:0;return r!==n&&(a*=100),t+"("+a+o+")"}const hy=/\b([a-z-]*)\(.*?\)/gu,my={...qm,getAnimatableNone:e=>{const t=e.match(hy);return t?t.map(fy).join(" "):e}},gy={...qm,getAnimatableNone:e=>{const t=qm.parse(e);return qm.createTransformer(e)(t.map(e=>"number"==typeof e?0:"object"==typeof e?{...e,alpha:1}:e))}},vy={...bm,transform:Math.round},yy={borderWidth:Lm,borderTopWidth:Lm,borderRightWidth:Lm,borderBottomWidth:Lm,borderLeftWidth:Lm,borderRadius:Lm,borderTopLeftRadius:Lm,borderTopRightRadius:Lm,borderBottomRightRadius:Lm,borderBottomLeftRadius:Lm,width:Lm,maxWidth:Lm,height:Lm,maxHeight:Lm,top:Lm,right:Lm,bottom:Lm,left:Lm,inset:Lm,insetBlock:Lm,insetBlockStart:Lm,insetBlockEnd:Lm,insetInline:Lm,insetInlineStart:Lm,insetInlineEnd:Lm,padding:Lm,paddingTop:Lm,paddingRight:Lm,paddingBottom:Lm,paddingLeft:Lm,paddingBlock:Lm,paddingBlockStart:Lm,paddingBlockEnd:Lm,paddingInline:Lm,paddingInlineStart:Lm,paddingInlineEnd:Lm,margin:Lm,marginTop:Lm,marginRight:Lm,marginBottom:Lm,marginLeft:Lm,marginBlock:Lm,marginBlockStart:Lm,marginBlockEnd:Lm,marginInline:Lm,marginInlineStart:Lm,marginInlineEnd:Lm,fontSize:Lm,backgroundPositionX:Lm,backgroundPositionY:Lm,...{rotate:Rm,rotateX:Rm,rotateY:Rm,rotateZ:Rm,scale:wm,scaleX:wm,scaleY:wm,scaleZ:wm,skew:Rm,skewX:Rm,skewY:Rm,distance:Lm,translateX:Lm,translateY:Lm,translateZ:Lm,x:Lm,y:Lm,z:Lm,perspective:Lm,transformPerspective:Lm,opacity:xm,originX:Dm,originY:Dm,originZ:Lm},zIndex:vy,fillOpacity:xm,strokeOpacity:xm,numOctaves:vy},by={...yy,color:Fm,backgroundColor:Fm,outlineColor:Fm,fill:Fm,stroke:Fm,borderColor:Fm,borderTopColor:Fm,borderRightColor:Fm,borderBottomColor:Fm,borderLeftColor:Fm,filter:my,WebkitFilter:my,mask:gy,WebkitMask:gy},xy=e=>by[e],wy=new Set([my,gy]);function ky(e,t){let n=xy(e);return wy.has(n)||(n=qm),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Sy=new Set(["auto","none","0"]);class jy extends dv{constructor(e,t,n,r,o){super(e,t,n,r,o,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let i=0;i<e.length;i++){let n=e[i];if("string"==typeof n&&(n=n.trim(),gm(n))){const r=Dv(n,t.current);void 0!==r&&(e[i]=r),i===e.length-1&&(this.finalKeyframe=n)}}if(this.resolveNoneKeyframes(),!Kv.has(n)||2!==e.length)return;const[r,o]=e,a=uy(r),s=uy(o);if(ym(r)!==ym(o)&&ov[n])this.needsMeasurement=!0;else if(a!==s)if(tv(a)&&tv(s))for(let i=0;i<e.length;i++){const t=e[i];"string"==typeof t&&(e[i]=parseFloat(t))}else ov[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,n=[];for(let r=0;r<e.length;r++)(null===e[r]||dy(e[r]))&&n.push(r);n.length&&function(e,t,n){let r,o=0;for(;o<e.length&&!r;){const t=e[o];"string"==typeof t&&!Sy.has(t)&&Bm(t).values.length&&(r=e[o]),o++}if(r&&n)for(const a of t)e[a]=ky(n,r)}(e,n,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ov[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const r=t[t.length-1];void 0!==r&&e.getValue(n,r).jump(r,!1)}measureEndState(){var e;const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const o=t.getValue(n);o&&o.jump(this.measuredOrigin,!1);const a=r.length-1,s=r[a];r[a]=ov[n](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==s&&void 0===this.finalKeyframe&&(this.finalKeyframe=s),(null==(e=this.removedTransforms)?void 0:e.length)&&this.removedTransforms.forEach(([e,n])=>{t.getValue(e).set(n)}),this.resolveNoneKeyframes()}}function Cy(e,t,n){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let t=document;const r=(null==n?void 0:n[e])??t.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e).filter(e=>null!=e)}const Ey=(e,t)=>t&&"number"==typeof e?t.transform(e):e;function Py(e){return Th(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:_y}=am(queueMicrotask,!1),Ny={x:!1,y:!1};function Ty(){return Ny.x||Ny.y}function Ry(e,t){const n=Cy(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function My(e,t,n={}){const[r,o,a]=Ry(e,n);return r.forEach(e=>{let n,r=!1,a=!1;const s=t=>{n&&(n(t),n=void 0),e.removeEventListener("pointerleave",l)},i=e=>{r=!1,window.removeEventListener("pointerup",i),window.removeEventListener("pointercancel",i),a&&(a=!1,s(e))},l=e=>{"touch"!==e.pointerType&&(r?a=!0:s(e))};e.addEventListener("pointerenter",r=>{if("touch"===r.pointerType||Ty())return;a=!1;const s=t(e,r);"function"==typeof s&&(n=s,e.addEventListener("pointerleave",l,o))},o),e.addEventListener("pointerdown",()=>{r=!0,window.addEventListener("pointerup",i,o),window.addEventListener("pointercancel",i,o)},o)}),a}const Ly=(e,t)=>!!t&&(e===t||Ly(e,t.parentElement)),Oy=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary,Ay=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const Dy=new Set(["INPUT","SELECT","TEXTAREA"]);const Iy=new WeakSet;function Fy(e){return t=>{"Enter"===t.key&&e(t)}}function $y(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function zy(e){return Oy(e)&&!Ty()}const Vy=new WeakSet;function Uy(e,t,n={}){const[r,o,a]=Ry(e,n),s=e=>{const r=e.currentTarget;if(!zy(e))return;if(Vy.has(e))return;Iy.add(r),n.stopPropagation&&Vy.add(e);const a=t(r,e),s=(e,t)=>{window.removeEventListener("pointerup",i),window.removeEventListener("pointercancel",l),Iy.has(r)&&Iy.delete(r),zy(e)&&"function"==typeof a&&a(e,{success:t})},i=e=>{s(e,r===window||r===document||n.useGlobalTarget||Ly(r,e.target))},l=e=>{s(e,!1)};window.addEventListener("pointerup",i,o),window.addEventListener("pointercancel",l,o)};return r.forEach(e=>{var t;(n.useGlobalTarget?window:e).addEventListener("pointerdown",s,o),Py(e)&&(e.addEventListener("focus",e=>((e,t)=>{const n=e.currentTarget;if(!n)return;const r=Fy(()=>{if(Iy.has(n))return;$y(n,"down");const e=Fy(()=>{$y(n,"up")});n.addEventListener("keyup",e,t),n.addEventListener("blur",()=>$y(n,"cancel"),t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)})(e,o)),t=e,Ay.has(t.tagName)||!0===t.isContentEditable||e.hasAttribute("tabindex")||(e.tabIndex=0))}),a}function By(e){return Th(e)&&"ownerSVGElement"in e}const Wy=new WeakMap;let Hy;const qy=(e,t,n)=>(r,o)=>o&&o[0]?o[0][e+"Size"]:By(r)&&"getBBox"in r?r.getBBox()[t]:r[n],Gy=qy("inline","width","offsetWidth"),Ky=qy("block","height","offsetHeight");function Yy({target:e,borderBoxSize:t}){var n;null==(n=Wy.get(e))||n.forEach(n=>{n(e,{get width(){return Gy(e,t)},get height(){return Ky(e,t)}})})}function Xy(e){e.forEach(Yy)}function Qy(e,t){Hy||"undefined"!=typeof ResizeObserver&&(Hy=new ResizeObserver(Xy));const n=Cy(e);return n.forEach(e=>{let n=Wy.get(e);n||(n=new Set,Wy.set(e,n)),n.add(t),null==Hy||Hy.observe(e)}),()=>{n.forEach(e=>{const n=Wy.get(e);null==n||n.delete(t),(null==n?void 0:n.size)||null==Hy||Hy.unobserve(e)})}}const Jy=new Set;let Zy;function eb(e){return Jy.add(e),Zy||(Zy=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Jy.forEach(t=>t(e))},window.addEventListener("resize",Zy)),()=>{Jy.delete(e),Jy.size||"function"!=typeof Zy||(window.removeEventListener("resize",Zy),Zy=void 0)}}function tb(e,t){return"function"==typeof e?eb(e):Qy(e,t)}const nb=[...cy,Fm,qm],rb=()=>({x:{min:0,max:0},y:{min:0,max:0}}),ob=new WeakMap;function ab(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function sb(e){return"string"==typeof e||Array.isArray(e)}const ib=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],lb=["initial",...ib];function cb(e){return ab(e.animate)||lb.some(t=>sb(e[t]))}function ub(e){return Boolean(cb(e)||e.variants)}const db={current:null},pb={current:!1},fb="undefined"!=typeof window;function hb(){if(pb.current=!0,fb)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>db.current=e.matches;e.addEventListener("change",t),t()}else db.current=!1}const mb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let gb={};function vb(e){gb=e}class yb{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:o,blockInitialAnimation:a,visualState:s},i={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=dv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const e=pm.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,sm.render(this.render,!1,!0))};const{latestValues:l,renderState:c}=s;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=o,this.options=i,this.blockInitialAnimation=Boolean(a),this.isControllingVariants=cb(t),this.isVariantNode=ub(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(const p in d){const e=d[p];void 0!==l[p]&&ey(e)&&e.set(l[p])}}mount(e){var t,n;if(this.hasBeenMounted)for(const r in this.initialValues)null==(t=this.values.get(r))||t.jump(this.initialValues[r]),this.latestValues[r]=this.initialValues[r];this.current=e,ob.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(pb.current||hb(),this.shouldReduceMotion=db.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,null==(n=this.parent)||n.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),im(this.notifyUpdate),im(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),null==(e=this.parent)||e.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&_v.has(e)&&this.current instanceof HTMLElement){const{factory:n,keyframes:r,times:o,ease:a,duration:s}=t.accelerate,i=new kv({element:this.current,name:e,keyframes:r,times:o,ease:a,duration:Fh(s)}),l=n(i);return void this.valueSubscriptions.set(e,()=>{l(),i.cancel()})}const n=ev.has(e);n&&this.onBindTransform&&this.onBindTransform();const r=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&sm.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),o&&o(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in gb){const t=gb[e];if(!t)continue;const{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){const t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let n=0;n<mb.length;n++){const t=mb[n];this.propEventSubscriptions[t]&&(this.propEventSubscriptions[t](),delete this.propEventSubscriptions[t]);const r=e["on"+t];r&&(this.propEventSubscriptions[t]=this.on(t,r))}this.prevMotionValues=function(e,t,n){for(const r in t){const o=t[r],a=n[r];if(ey(o))e.addValue(r,o);else if(ey(a))e.addValue(r,Xv(o,{owner:e}));else if(a!==o)if(e.hasValue(r)){const t=e.getValue(r);!0===t.liveStyle?t.jump(o):t.hasAnimated||t.set(o)}else{const t=e.getStaticValue(r);e.addValue(r,Xv(void 0!==t?t:o,{owner:e}))}}for(const r in n)void 0===t[r]&&e.removeValue(r);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return void 0===n&&void 0!==t&&(n=Xv(null===t?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];var r;return null!=n&&("string"==typeof n&&(Nh(n)||Rh(n))?n=parseFloat(n):(r=n,!nb.find(ly(r))&&qm.test(t)&&(n=ky(e,t))),this.setBaseTarget(e,ey(n)?n.get():n)),ey(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:n}=this.props;let r;if("string"==typeof n||"object"==typeof n){const o=qv(this.props,n,null==(t=this.presenceContext)?void 0:t.custom);o&&(r=o[e])}if(n&&void 0!==r)return r;const o=this.getBaseTargetFromProps(this.props,e);return void 0===o||ey(o)?void 0!==this.initialValues[e]&&void 0===r?void 0:this.baseTarget[e]:o}on(e,t){return this.events[e]||(this.events[e]=new Ih),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){_y.render(this.render)}}class bb extends yb{constructor(){super(...arguments),this.KeyframeResolver=jy}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){const n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;ey(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}class xb{constructor(e){this.isMounted=!1,this.node=e}update(){}}function wb({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function kb(e){return void 0===e||1===e}function Sb({scale:e,scaleX:t,scaleY:n}){return!kb(e)||!kb(t)||!kb(n)}function jb(e){return Sb(e)||Cb(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Cb(e){return Eb(e.x)||Eb(e.y)}function Eb(e){return e&&"0%"!==e}function Pb(e,t,n){return n+t*(e-n)}function _b(e,t,n,r,o){return void 0!==o&&(e=Pb(e,o,r)),Pb(e,n,r)+t}function Nb(e,t=0,n=1,r,o){e.min=_b(e.min,t,n,r,o),e.max=_b(e.max,t,n,r,o)}function Tb(e,{x:t,y:n}){Nb(e.x,t.translate,t.scale,t.originPoint),Nb(e.y,n.translate,n.scale,n.originPoint)}const Rb=.999999999999,Mb=1.0000000000001;function Lb(e,t){e.min+=t,e.max+=t}function Ob(e,t,n,r,o=.5){Nb(e,t,n,Ym(e.min,e.max,o),r)}function Ab(e,t){return"string"==typeof e?parseFloat(e)/100*(t.max-t.min):e}function Db(e,t,n){const r=n??e;Ob(e.x,Ab(t.x,r.x),t.scaleX,t.scale,t.originX),Ob(e.y,Ab(t.y,r.y),t.scaleY,t.scale,t.originY)}function Ib(e,t){return wb(function(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(e.getBoundingClientRect(),t))}const Fb={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},$b=Zg.length;function zb(e,t,n){const{style:r,vars:o,transformOrigin:a}=e;let s=!1,i=!1;for(const l in t){const e=t[l];if(ev.has(l))s=!0;else if(hm(l))o[l]=e;else{const t=Ey(e,yy[l]);l.startsWith("origin")?(i=!0,a[l]=t):r[l]=t}}if(t.transform||(s||n?r.transform=function(e,t,n){let r="",o=!0;for(let a=0;a<$b;a++){const s=Zg[a],i=e[s];if(void 0===i)continue;let l=!0;if("number"==typeof i)l=i===(s.startsWith("scale")?1:0);else{const e=parseFloat(i);l=s.startsWith("scale")?1===e:0===e}if(!l||n){const e=Ey(i,yy[s]);l||(o=!1,r+=`${Fb[s]||s}(${e}) `),n&&(t[s]=e)}}return r=r.trim(),n?r=n(t,o?"":r):o&&(r="none"),r}(t,e.transform,n):r.transform&&(r.transform="none")),i){const{originX:e="50%",originY:t="50%",originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function Vb(e,{style:t,vars:n},r,o){const a=e.style;let s;for(s in t)a[s]=t[s];for(s in null==o||o.applyProjectionStyles(a,r),n)a.setProperty(s,n[s])}function Ub(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Bb={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e){if(!Lm.test(e))return e;e=parseFloat(e)}return`${Ub(e,t.target.x)}% ${Ub(e,t.target.y)}%`}},Wb={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,o=qm.parse(e);if(o.length>5)return r;const a=qm.createTransformer(e),s="number"!=typeof o[0]?1:0,i=n.x.scale*t.x,l=n.y.scale*t.y;o[0+s]/=i,o[1+s]/=l;const c=Ym(i,l,.5);return"number"==typeof o[2+s]&&(o[2+s]/=c),"number"==typeof o[3+s]&&(o[3+s]/=c),a(o)}},Hb={borderRadius:{...Bb,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Bb,borderTopRightRadius:Bb,borderBottomLeftRadius:Bb,borderBottomRightRadius:Bb,boxShadow:Wb};function qb(e,{layout:t,layoutId:n}){return ev.has(e)||e.startsWith("origin")||(t||void 0!==n)&&(!!Hb[e]||"opacity"===e)}function Gb(e,t,n){var r;const o=e.style,a=null==t?void 0:t.style,s={};if(!o)return s;for(const i in o)(ey(o[i])||a&&ey(a[i])||qb(i,e)||void 0!==(null==(r=null==n?void 0:n.getValue(i))?void 0:r.liveStyle))&&(s[i]=o[i]);return s}class Kb extends bb{constructor(){super(...arguments),this.type="html",this.renderInstance=Vb}readValueFromInstance(e,t){var n,r;if(ev.has(t))return(null==(n=this.projection)?void 0:n.isProjecting)?Xg(t):((e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Qg(n,t)})(e,t);{const n=(r=e,window.getComputedStyle(r)),o=(hm(t)?n.getPropertyValue(t):n[t])||0;return"string"==typeof o?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Ib(e,t)}build(e,t,n){zb(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Gb(e,t,n)}}const Yb={offset:"stroke-dashoffset",array:"stroke-dasharray"},Xb={offset:"strokeDashoffset",array:"strokeDasharray"};const Qb=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Jb(e,{attrX:t,attrY:n,attrScale:r,pathLength:o,pathSpacing:a=1,pathOffset:s=0,...i},l,c,u){if(zb(e,i,c),l)return void(e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox));e.attrs=e.style,e.style={};const{attrs:d,style:p}=e;d.transform&&(p.transform=d.transform,delete d.transform),(p.transform||d.transformOrigin)&&(p.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),p.transform&&(p.transformBox=(null==u?void 0:u.transformBox)??"fill-box",delete d.transformBox);for(const f of Qb)void 0!==d[f]&&(p[f]=d[f],delete d[f]);void 0!==t&&(d.x=t),void 0!==n&&(d.y=n),void 0!==r&&(d.scale=r),void 0!==o&&function(e,t,n=1,r=0,o=!0){e.pathLength=1;const a=o?Yb:Xb;e[a.offset]=""+-r,e[a.array]=`${t} ${n}`}(d,o,a,s,!1)}const Zb=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),ex=e=>"string"==typeof e&&"svg"===e.toLowerCase();function tx(e,t,n){const r=Gb(e,t,n);for(const o in e)if(ey(e[o])||ey(t[o])){r[-1!==Zg.indexOf(o)?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o]=e[o]}return r}class nx extends bb{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=rb}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(ev.has(t)){const e=xy(t);return e&&e.default||0}return t=Zb.has(t)?t:ny(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return tx(e,t,n)}build(e,t,n){Jb(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){!function(e,t,n,r){Vb(e,t,void 0,r);for(const o in t.attrs)e.setAttribute(Zb.has(o)?o:ny(o),t.attrs[o])}(e,t,0,r)}mount(e){this.isSVGTag=ex(e.tagName),super.mount(e)}}const rx=lb.length;function ox(e){if(!e)return;if(!e.isControllingVariants){const t=e.parent&&ox(e.parent)||{};return void 0!==e.props.initial&&(t.initial=e.props.initial),t}const t={};for(let n=0;n<rx;n++){const r=lb[n],o=e.props[r];(sb(o)||!1===o)&&(t[r]=o)}return t}function ax(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const sx=[...ib].reverse(),ix=ib.length;function lx(e){return t=>Promise.all(t.map(({animation:t,options:n})=>function(e,t,n={}){let r;if(e.notify("AnimationStart",t),Array.isArray(t)){const o=t.map(t=>iy(e,t,n));r=Promise.all(o)}else if("string"==typeof t)r=iy(e,t,n);else{const o="function"==typeof t?Gv(e,t,n.custom):t;r=Promise.all(sy(e,o,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}(e,t,n)))}function cx(e){let t=lx(e),n=px(),r=!0,o=!1;const a=t=>(n,r)=>{var o;const a=Gv(e,r,"exit"===t?null==(o=e.presenceContext)?void 0:o.custom:void 0);if(a){const{transition:e,transitionEnd:t,...r}=a;n={...n,...r,...t}}return n};function s(s){const{props:i}=e,l=ox(e.parent)||{},c=[],u=new Set;let d={},p=1/0;for(let t=0;t<ix;t++){const f=sx[t],h=n[f],m=void 0!==i[f]?i[f]:l[f],g=sb(m),v=f===s?h.isActive:null;!1===v&&(p=t);let y=m===l[f]&&m!==i[f]&&g;if(y&&(r||o)&&e.manuallyAnimateOnMount&&(y=!1),h.protectedKeys={...d},!h.isActive&&null===v||!m&&!h.prevProp||ab(m)||"boolean"==typeof m)continue;if("exit"===f&&h.isActive&&!0!==v){h.prevResolvedValues&&(d={...d,...h.prevResolvedValues});continue}const b=ux(h.prevProp,m);let x=b||f===s&&h.isActive&&!y&&g||t>p&&g,w=!1;const k=Array.isArray(m)?m:[m];let S=k.reduce(a(f),{});!1===v&&(S={});const{prevResolvedValues:j={}}=h,C={...j,...S},E=t=>{x=!0,u.has(t)&&(w=!0,u.delete(t)),h.needsAnimating[t]=!0;const n=e.getValue(t);n&&(n.liveStyle=!1)};for(const e in C){const t=S[e],n=j[e];if(d.hasOwnProperty(e))continue;let r=!1;r=Qv(t)&&Qv(n)?!ax(t,n):t!==n,r?null!=t?E(e):u.add(e):void 0!==t&&u.has(e)?E(e):h.protectedKeys[e]=!0}h.prevProp=m,h.prevResolvedValues=S,h.isActive&&(d={...d,...S}),(r||o)&&e.blockInitialAnimation&&(x=!1);const P=y&&b;x&&(!P||w)&&c.push(...k.map(t=>{const n={type:f};if("string"==typeof t&&(r||o)&&!P&&e.manuallyAnimateOnMount&&e.parent){const{parent:r}=e,o=Gv(r,t);if(r.enteringChildren&&o){const{delayChildren:t}=o.transition||{};n.delay=Ov(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){const t={};if("boolean"!=typeof i.initial){const n=Gv(e,Array.isArray(i.initial)?i.initial[0]:i.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{const r=e.getBaseTarget(n),o=e.getValue(n);o&&(o.liveStyle=!0),t[n]=r??null}),c.push({animation:t})}let f=Boolean(c.length);return!r||!1!==i.initial&&i.initial!==i.animate||e.manuallyAnimateOnMount||(f=!1),r=!1,o=!1,f?t(c):Promise.resolve()}return{animateChanges:s,setActive:function(t,r){var o;if(n[t].isActive===r)return Promise.resolve();null==(o=e.variantChildren)||o.forEach(e=>{var n;return null==(n=e.animationState)?void 0:n.setActive(t,r)}),n[t].isActive=r;const a=s(t);for(const e in n)n[e].protectedKeys={};return a},setAnimateFunction:function(n){t=n(e)},getState:()=>n,reset:()=>{n=px(),o=!0}}}function ux(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!ax(t,e)}function dx(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function px(){return{animate:dx(!0),whileInView:dx(),whileHover:dx(),whileTap:dx(),whileDrag:dx(),whileFocus:dx(),exit:dx()}}function fx(e,t){e.min=t.min,e.max=t.max}function hx(e,t){fx(e.x,t.x),fx(e.y,t.y)}function mx(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function gx(e){return e.max-e.min}function vx(e,t,n,r=.5){e.origin=r,e.originPoint=Ym(t.min,t.max,e.origin),e.scale=gx(n)/gx(t),e.translate=Ym(n.min,n.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function yx(e,t,n,r){vx(e.x,t.x,n.x,r?r.originX:void 0),vx(e.y,t.y,n.y,r?r.originY:void 0)}function bx(e,t,n,r=0){const o=r?Ym(n.min,n.max,r):n.min;e.min=o+t.min,e.max=e.min+gx(t)}function xx(e,t,n,r=0){const o=r?Ym(n.min,n.max,r):n.min;e.min=t.min-o,e.max=e.min+gx(t)}function wx(e,t,n,r){xx(e.x,t.x,n.x,null==r?void 0:r.x),xx(e.y,t.y,n.y,null==r?void 0:r.y)}function kx(e,t,n,r,o){return e=Pb(e-=t,1/n,r),void 0!==o&&(e=Pb(e,1/o,r)),e}function Sx(e,t,[n,r,o],a,s){!function(e,t=0,n=1,r=.5,o,a=e,s=e){Mm.test(t)&&(t=parseFloat(t),t=Ym(s.min,s.max,t/100)-s.min);if("number"!=typeof t)return;let i=Ym(a.min,a.max,r);e===a&&(i-=t),e.min=kx(e.min,t,n,i,o),e.max=kx(e.max,t,n,i,o)}(e,t[n],t[r],t[o],t.scale,a,s)}const jx=["x","scaleX","originX"],Cx=["y","scaleY","originY"];function Ex(e,t,n,r){Sx(e.x,t,jx,n?n.x:void 0,r?r.x:void 0),Sx(e.y,t,Cx,n?n.y:void 0,r?r.y:void 0)}function Px(e){return 0===e.translate&&1===e.scale}function _x(e){return Px(e.x)&&Px(e.y)}function Nx(e,t){return e.min===t.min&&e.max===t.max}function Tx(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Rx(e,t){return Tx(e.x,t.x)&&Tx(e.y,t.y)}function Mx(e){return gx(e.x)/gx(e.y)}function Lx(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Ox(e){return[e("x"),e("y")]}const Ax=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],Dx=Ax.length,Ix=e=>"string"==typeof e?parseFloat(e):e,Fx=e=>"number"==typeof e||Lm.test(e);function $x(e,t){return void 0!==e[t]?e[t]:e.borderRadius}const zx=Ux(0,.5,Xh),Vx=Ux(.5,.95,Lh);function Ux(e,t,n){return r=>r<e?0:r>t?1:n(Dh(e,t,r))}function Bx(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const Wx=(e,t)=>e.depth-t.depth;class Hx{constructor(){this.children=[],this.isDirty=!1}add(e){Ch(this.children,e),this.isDirty=!0}remove(e){Eh(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Wx),this.isDirty=!1,this.children.forEach(e)}}function qx(e){return ey(e)?e.get():e}class Gx{constructor(){this.members=[]}add(e){Ch(this.members,e);for(let t=this.members.length-1;t>=0;t--){const n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;const r=n.instance;r&&!1!==r.isConnected||n.snapshot||(Eh(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Eh(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){var t;for(let n=this.members.indexOf(e)-1;n>=0;n--){const e=this.members[n];if(!1!==e.isPresent&&!1!==(null==(t=e.instance)?void 0:t.isConnected))return this.promote(e),!0}return!1}promote(e,t){var n;const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.updateSnapshot(),e.scheduleRender();const{layoutDependency:o}=r.options,{layoutDependency:a}=e.options;void 0!==o&&o===a||(e.resumeFrom=r,t&&(r.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),(null==(n=e.root)?void 0:n.isUpdating)&&(e.isLayoutDirty=!0)),!1===e.options.crossfade&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{var t,n,r,o,a;null==(n=(t=e.options).onExitComplete)||n.call(t),null==(a=null==(r=e.resumingFrom)?void 0:(o=r.options).onExitComplete)||a.call(o)})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){var e;(null==(e=this.lead)?void 0:e.snapshot)&&(this.lead.snapshot=void 0)}}const Kx={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Yx=["","X","Y","Z"];let Xx=0;function Qx(e,t,n,r){const{latestValues:o}=t;o[e]&&(n[e]=o[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Jx(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=oy(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",sm,!(t||r))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Jx(r)}function Zx({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(e={},n=(null==t?void 0:t())){this.id=Xx++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(nw),this.nodes.forEach(dw),this.nodes.forEach(pw),this.nodes.forEach(rw)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new Hx)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new Ih),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){const n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;var n;this.isSVG=By(t)&&!(By(n=t)&&"svg"===n.tagName),this.instance=t;const{layoutId:r,layout:o,visualElement:a}=this.options;if(a&&!a.current&&a.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(o||r)&&(this.isLayoutDirty=!0),e){let n,r=0;const o=()=>this.root.updateBlockedByResize=!1;sm.read(()=>{r=window.innerWidth}),e(t,()=>{const e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=function(e,t){const n=pm.now(),r=({timestamp:o})=>{const a=o-n;a>=t&&(im(r),e(a-t))};return sm.setup(r,!0),()=>im(r)}(o,250),Kx.hasAnimatedSinceResize&&(Kx.hasAnimatedSinceResize=!1,this.nodes.forEach(uw)))})}r&&this.root.registerSharedNode(r,this),!1!==this.options.animate&&a&&(r||o)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const o=this.options.transition||a.getDefaultTransition()||yw,{onLayoutAnimationStart:s,onLayoutAnimationComplete:i}=a.getProps(),l=!this.targetLayout||!Rx(this.targetLayout,r),c=!t&&n;if(this.options.layoutRoot||this.resumeFrom||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const t={...Uv(o,"layout"),onPlay:s,onComplete:i};(a.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,c)}else t||uw(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),im(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(fw),this.animationId++)}getTransformTemplate(){const{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Jx(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let o=0;o<this.path.length;o++){const e=this.path[o];e.shouldResetTransform=!0,"string"!=typeof e.latestValues.x&&"string"!=typeof e.latestValues.y||(e.isLayoutDirty=!0),e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:t,layout:n}=this.options;if(void 0===t&&!n)return;const r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked()){const e=this.updateBlockedByResize;return this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(sw),void this.nodes.forEach(aw)}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(iw);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(lw),this.nodes.forEach(cw),this.nodes.forEach(ew),this.nodes.forEach(tw)):this.nodes.forEach(iw),this.clearAllSnapshots();const e=pm.now();lm.delta=Ph(0,1e3/60,e-lm.timestamp),lm.timestamp=e,lm.isProcessing=!0,cm.update.process(lm),cm.preRender.process(lm),cm.render.process(lm),lm.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,_y.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ow),this.sharedNodes.forEach(hw)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,sm.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){sm.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||gx(this.snapshot.measuredBox.x)||gx(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let n=0;n<this.path.length;n++){this.path[n].updateScroll()}const e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected={x:{min:0,max:0},y:{min:0,max:0}}),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){const t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!o)return;const e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!_x(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,""):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||jb(this.latestValues)||a)&&(o(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){const t=this.measurePageBox();let n=this.removeElementScroll(t);var r;return e&&(n=this.removeTransform(n)),ww((r=n).x),ww(r.y),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){var e;const{visualElement:t}=this.options;if(!t)return{x:{min:0,max:0},y:{min:0,max:0}};const n=t.measureViewportBox();if(!((null==(e=this.scroll)?void 0:e.wasRoot)||this.path.some(Sw))){const{scroll:e}=this.root;e&&(Lb(n.x,e.offset.x),Lb(n.y,e.offset.y))}return n}removeElementScroll(e){var t;const n={x:{min:0,max:0},y:{min:0,max:0}};if(hx(n,e),null==(t=this.scroll)?void 0:t.wasRoot)return n;for(let r=0;r<this.path.length;r++){const t=this.path[r],{scroll:o,options:a}=t;t!==this.root&&o&&a.layoutScroll&&(o.wasRoot&&hx(n,e),Lb(n.x,o.offset.x),Lb(n.y,o.offset.y))}return n}applyTransform(e,t=!1,n){var r,o;const a=n||{x:{min:0,max:0},y:{min:0,max:0}};hx(a,e);for(let s=0;s<this.path.length;s++){const e=this.path[s];!t&&e.options.layoutScroll&&e.scroll&&e!==e.root&&(Lb(a.x,-e.scroll.offset.x),Lb(a.y,-e.scroll.offset.y)),jb(e.latestValues)&&Db(a,e.latestValues,null==(r=e.layout)?void 0:r.layoutBox)}return jb(this.latestValues)&&Db(a,this.latestValues,null==(o=this.layout)?void 0:o.layoutBox),a}removeTransform(e){var t;const n={x:{min:0,max:0},y:{min:0,max:0}};hx(n,e);for(let r=0;r<this.path.length;r++){const e=this.path[r];if(!jb(e.latestValues))continue;let o;e.instance&&(Sb(e.latestValues)&&e.updateSnapshot(),o=rb(),hx(o,e.measurePageBox())),Ex(n,e.latestValues,null==(t=e.snapshot)?void 0:t.layoutBox,o)}return jb(this.latestValues)&&Ex(n,this.latestValues),n}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==lm.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){var t;const n=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=n.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=n.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=n.isSharedProjectionDirty);const r=Boolean(this.resumingFrom)||this!==n;if(!(e||r&&this.isSharedProjectionDirty||this.isProjectionDirty||(null==(t=this.parent)?void 0:t.isProjectionDirty)||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:o,layoutId:a}=this.options;if(!this.layout||!o&&!a)return;this.resolvedRelativeTargetAt=lm.timestamp;const s=this.getClosestProjectingParent();var i,l,c,u;(s&&this.linkedParentVersion!==s.layoutVersion&&!s.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(!1!==this.options.layoutAnchor&&s&&s.layout?this.createRelativeTarget(s,this.layout.layoutBox,s.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta)&&(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),i=this.target,l=this.relativeTarget,c=this.relativeParent.target,u=this.options.layoutAnchor||void 0,bx(i.x,l.x,c.x,null==u?void 0:u.x),bx(i.y,l.y,c.y,null==u?void 0:u.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.applyTransform(this.layout.layoutBox,!1,this.target):hx(this.target,this.layout.layoutBox),Tb(this.target,this.targetDelta)):hx(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,!1!==this.options.layoutAnchor&&s&&Boolean(s.resumingFrom)===Boolean(this.resumingFrom)&&!s.options.layoutScroll&&s.target&&1!==this.animationProgress?this.createRelativeTarget(s,this.target,s.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(this.parent&&!Sb(this.parent.latestValues)&&!Cb(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},wx(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),hx(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var e;const t=this.getLead(),n=Boolean(this.resumingFrom)||this!==t;let r=!0;if((this.isProjectionDirty||(null==(e=this.parent)?void 0:e.isProjectionDirty))&&(r=!1),n&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===lm.timestamp&&(r=!1),r)return;const{layout:o,layoutId:a}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!o&&!a)return;hx(this.layoutCorrected,this.layout.layoutBox);const s=this.treeScale.x,i=this.treeScale.y;!function(e,t,n,r=!1){var o;const a=n.length;if(!a)return;let s,i;t.x=t.y=1;for(let l=0;l<a;l++){s=n[l],i=s.projectionDelta;const{visualElement:a}=s.options;a&&a.props.style&&"contents"===a.props.style.display||(r&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(Lb(e.x,-s.scroll.offset.x),Lb(e.y,-s.scroll.offset.y)),i&&(t.x*=i.x.scale,t.y*=i.y.scale,Tb(e,i)),r&&jb(s.latestValues)&&Db(e,s.latestValues,null==(o=s.layout)?void 0:o.layoutBox))}t.x<Mb&&t.x>Rb&&(t.x=1),t.y<Mb&&t.y>Rb&&(t.y=1)}(this.layoutCorrected,this.treeScale,this.path,n),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:l}=t;l?(this.projectionDelta&&this.prevProjectionDelta?(mx(this.prevProjectionDelta.x,this.projectionDelta.x),mx(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),yx(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===s&&this.treeScale.y===i&&Lx(this.projectionDelta.x,this.prevProjectionDelta.x)&&Lx(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){var t;if(null==(t=this.options.visualElement)||t.scheduleRender(),e){const e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(e,t=!1){const n=this.snapshot,r=n?n.latestValues:{},o={...this.latestValues},a={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;const s={x:{min:0,max:0},y:{min:0,max:0}},i=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),c=!l||l.members.length<=1,u=Boolean(i&&!c&&!0===this.options.crossfade&&!this.path.some(vw));let d;this.animationProgress=0,this.mixTargetDelta=t=>{const n=t/1e3;var l,p,f,h;mw(a.x,e.x,n),mw(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(wx(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),l=this.relativeTarget,p=this.relativeTargetOrigin,f=s,h=n,gw(l.x,p.x,f.x,h),gw(l.y,p.y,f.y,h),d&&function(e,t){return Nx(e.x,t.x)&&Nx(e.y,t.y)}(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||(d={x:{min:0,max:0},y:{min:0,max:0}}),hx(d,this.relativeTarget)),i&&(this.animationValues=o,function(e,t,n,r,o,a){o?(e.opacity=Ym(0,n.opacity??1,zx(r)),e.opacityExit=Ym(t.opacity??1,0,Vx(r))):a&&(e.opacity=Ym(t.opacity??1,n.opacity??1,r));for(let s=0;s<Dx;s++){const o=Ax[s];let a=$x(t,o),i=$x(n,o);void 0===a&&void 0===i||(a||(a=0),i||(i=0),0===a||0===i||Fx(a)===Fx(i)?(e[o]=Math.max(Ym(Ix(a),Ix(i),r),0),(Mm.test(i)||Mm.test(a))&&(e[o]+="%")):e[o]=i)}(t.rotate||n.rotate)&&(e.rotate=Ym(t.rotate||0,n.rotate||0,r))}(o,r,this.latestValues,n,u,c)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){var t,n,r;this.notifyListeners("animationStart"),null==(t=this.currentAnimation)||t.stop(),null==(r=null==(n=this.resumingFrom)?void 0:n.currentAnimation)||r.stop(),this.pendingAnimation&&(im(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=sm.update(()=>{Kx.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Xv(0)),this.motionValue.jump(0,!1),this.currentAnimation=function(e,t,n){const r=ey(e)?e:Xv(e);return r.start(Wv("",r,t,n)),r.animation}(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const e=this.getLead();let{targetWithTransforms:t,target:n,layout:r,latestValues:o}=e;if(t&&n&&r){if(this!==e&&this.layout&&r&&kw(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const t=gx(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;const r=gx(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}hx(t,n),Db(t,o),yx(this.projectionDeltaWithTransform,this.layoutCorrected,t,o)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new Gx);this.sharedNodes.get(e).add(t);const n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){const e=this.getStack();return!e||e.lead===this}getLead(){var e;const{layoutId:t}=this.options;return t&&(null==(e=this.getStack())?void 0:e.lead)||this}getPrevLead(){var e;const{layoutId:t}=this.options;return t?null==(e=this.getStack())?void 0:e.prevLead:void 0}getStack(){const{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){const r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){const e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){const{visualElement:e}=this.options;if(!e)return;let t=!1;const{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;const r={};n.z&&Qx("z",e,r,this.animationValues);for(let o=0;o<Yx.length;o++)Qx(`rotate${Yx[o]}`,e,r,this.animationValues),Qx(`skew${Yx[o]}`,e,r,this.animationValues);e.render();for(const o in r)e.setStaticValue(o,r[o]),this.animationValues&&(this.animationValues[o]=r[o]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible)return void(e.visibility="hidden");const n=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=qx(null==t?void 0:t.pointerEvents)||"",void(e.transform=n?n(this.latestValues,""):"none");const r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target)return this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=qx(null==t?void 0:t.pointerEvents)||""),void(this.hasProjected&&!jb(this.latestValues)&&(e.transform=n?n({},""):"none",this.hasProjected=!1));e.visibility="";const o=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=function(e,t,n){let r="";const o=e.x.translate/t.x,a=e.y.translate/t.y,s=(null==n?void 0:n.z)||0;if((o||a||s)&&(r=`translate3d(${o}px, ${a}px, ${s}px) `),1===t.x&&1===t.y||(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:e,rotate:t,rotateX:o,rotateY:a,skewX:s,skewY:i}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),o&&(r+=`rotateX(${o}deg) `),a&&(r+=`rotateY(${a}deg) `),s&&(r+=`skewX(${s}deg) `),i&&(r+=`skewY(${i}deg) `)}const i=e.x.scale*t.x,l=e.y.scale*t.y;return 1===i&&1===l||(r+=`scale(${i}, ${l})`),r||"none"}(this.projectionDeltaWithTransform,this.treeScale,o);n&&(a=n(o,a)),e.transform=a;const{x:s,y:i}=this.projectionDelta;e.transformOrigin=`${100*s.origin}% ${100*i.origin}% 0`,r.animationValues?e.opacity=r===this?o.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:o.opacityExit:e.opacity=r===this?void 0!==o.opacity?o.opacity:"":void 0!==o.opacityExit?o.opacityExit:0;for(const l in Hb){if(void 0===o[l])continue;const{correct:t,applyTo:n,isCSSVariable:s}=Hb[l],i="none"===a?o[l]:t(o[l],r);if(n){const t=n.length;for(let r=0;r<t;r++)e[n[r]]=i}else s?this.options.visualElement.renderState.vars[l]=i:e[l]=i}this.options.layoutId&&(e.pointerEvents=r===this?qx(null==t?void 0:t.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>{var t;return null==(t=e.currentAnimation)?void 0:t.stop()}),this.root.nodes.forEach(aw),this.root.sharedNodes.clear()}}}function ew(e){e.updateLayout()}function tw(e){var t;const n=(null==(t=e.resumeFrom)?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:t,measuredBox:r}=e.layout,{animationType:o}=e.options,a=n.source!==e.layout.source;if("size"===o)Ox(e=>{const r=a?n.measuredBox[e]:n.layoutBox[e],o=gx(r);r.min=t[e].min,r.max=r.min+o});else if("x"===o||"y"===o){const e="x"===o?"y":"x";fx(a?n.measuredBox[e]:n.layoutBox[e],t[e])}else kw(o,n.layoutBox,t)&&Ox(r=>{const o=a?n.measuredBox[r]:n.layoutBox[r],s=gx(t[r]);o.max=o.min+s,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+s)});const s={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};yx(s,t,n.layoutBox);const i={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};a?yx(i,e.applyTransform(r,!0),n.measuredBox):yx(i,t,n.layoutBox);const l=!_x(s);let c=!1;if(!e.resumeFrom){const r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){const{snapshot:o,layout:a}=r;if(o&&a){const s=e.options.layoutAnchor||void 0,i={x:{min:0,max:0},y:{min:0,max:0}};wx(i,n.layoutBox,o.layoutBox,s);const l={x:{min:0,max:0},y:{min:0,max:0}};wx(l,t,a.layoutBox,s),Rx(i,l)||(c=!0),r.options.layoutRoot&&(e.relativeTarget=l,e.relativeTargetOrigin=i,e.relativeParent=r)}}}e.notifyListeners("didUpdate",{layout:t,snapshot:n,delta:i,layoutDelta:s,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function nw(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=Boolean(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function rw(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ow(e){e.clearSnapshot()}function aw(e){e.clearMeasurements()}function sw(e){e.isLayoutDirty=!0,e.updateLayout()}function iw(e){e.isLayoutDirty=!1}function lw(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function cw(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function uw(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function dw(e){e.resolveTargetDelta()}function pw(e){e.calcProjection()}function fw(e){e.resetSkewAndRotation()}function hw(e){e.removeLeadSnapshot()}function mw(e,t,n){e.translate=Ym(t.translate,0,n),e.scale=Ym(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function gw(e,t,n,r){e.min=Ym(t.min,n.min,r),e.max=Ym(t.max,n.max,r)}function vw(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}const yw={duration:.45,ease:[.4,0,.1,1]},bw=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),xw=bw("applewebkit/")&&!bw("chrome/")?Math.round:Lh;function ww(e){e.min=xw(e.min),e.max=xw(e.max)}function kw(e,t,n){return"position"===e||"preserve-aspect"===e&&(r=Mx(t),o=Mx(n),a=.2,!(Math.abs(r-o)<=a));var r,o,a}function Sw(e){var t;return e!==e.root&&(null==(t=e.scroll)?void 0:t.wasRoot)}const jw=Zx({attachResizeListener:(e,t)=>Bx(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||(null==(e=document.body)?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||(null==(t=document.body)?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),Cw={current:void 0},Ew=Zx({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Cw.current){const e=new jw({});e.mount(window),e.setOptions({layoutScroll:!0}),Cw.current=e}return Cw.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),Pw=W.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function _w(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Nw(...e){return W.useCallback(function(...e){return t=>{let n=!1;const r=e.map(e=>{const r=_w(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():_w(e[t],null)}}}}(...e),e)}class Tw extends W.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(Py(t)&&e.isPresent&&!this.props.isPresent&&!1!==this.props.pop){const e=t.offsetParent,n=Py(e)&&e.offsetWidth||0,r=Py(e)&&e.offsetHeight||0,o=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(o.height),a.width=parseFloat(o.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top}return null}componentDidUpdate(){}render(){return this.props.children}}function Rw({children:e,isPresent:t,anchorX:n,anchorY:r,root:o,pop:a}){var s;const i=W.useId(),l=W.useRef(null),c=W.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:u}=W.useContext(Pw),d=(null==(s=e.props)?void 0:s.ref)??(null==e?void 0:e.ref),p=Nw(l,d);return W.useInsertionEffect(()=>{const{width:e,height:s,top:d,left:p,right:f,bottom:h}=c.current;if(t||!1===a||!l.current||!e||!s)return;const m="left"===n?`left: ${p}`:`right: ${f}`,g="bottom"===r?`bottom: ${h}`:`top: ${d}`;l.current.dataset.motionPopId=i;const v=document.createElement("style");u&&(v.nonce=u);const y=o??document.head;return y.appendChild(v),v.sheet&&v.sheet.insertRule(`\n [data-motion-pop-id="${i}"] {\n position: absolute !important;\n width: ${e}px !important;\n height: ${s}px !important;\n ${m}px !important;\n ${g}px !important;\n }\n `),()=>{var e;null==(e=l.current)||e.removeAttribute("data-motion-pop-id"),y.contains(v)&&y.removeChild(v)}},[t]),ee.jsx(Tw,{isPresent:t,childRef:l,sizeRef:c,pop:a,children:!1===a?e:W.cloneElement(e,{ref:p})})}const Mw=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:o,presenceAffectsLayout:a,mode:s,anchorX:i,anchorY:l,root:c})=>{const u=kh(Lw),d=W.useId();let p=!0,f=W.useMemo(()=>(p=!1,{id:d,initial:t,isPresent:n,custom:o,onExitComplete:e=>{u.set(e,!0);for(const t of u.values())if(!t)return;r&&r()},register:e=>(u.set(e,!1),()=>u.delete(e))}),[n,u,r]);return a&&p&&(f={...f}),W.useMemo(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),W.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=ee.jsx(Rw,{pop:"popLayout"===s,isPresent:n,anchorX:i,anchorY:l,root:c,children:e}),ee.jsx(jh.Provider,{value:f,children:e})};function Lw(){return new Map}function Ow(e=!0){const t=W.useContext(jh);if(null===t)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=t,a=W.useId();W.useEffect(()=>{if(e)return o(a)},[e]);const s=W.useCallback(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,s]:[!0]}const Aw=e=>e.key||"";function Dw(e){const t=[];return W.Children.forEach(e,e=>{W.isValidElement(e)&&t.push(e)}),t}const Iw=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:o=!0,mode:a="sync",propagate:s=!1,anchorX:i="left",anchorY:l="top",root:c})=>{const[u,d]=Ow(s),p=W.useMemo(()=>Dw(e),[e]),f=s&&!u?[]:p.map(Aw),h=W.useRef(!0),m=W.useRef(p),g=kh(()=>new Map),v=W.useRef(new Set),[y,b]=W.useState(p),[x,w]=W.useState(p);Sh(()=>{h.current=!1,m.current=p;for(let e=0;e<x.length;e++){const t=Aw(x[e]);f.includes(t)?(g.delete(t),v.current.delete(t)):!0!==g.get(t)&&g.set(t,!1)}},[x,f.length,f.join("-")]);const k=[];if(p!==y){let e=[...p];for(let t=0;t<x.length;t++){const n=x[t],r=Aw(n);f.includes(r)||(e.splice(t,0,n),k.push(n))}return"wait"===a&&k.length&&(e=k),w(Dw(e)),b(p),null}const{forceRender:S}=W.useContext(wh);return ee.jsx(ee.Fragment,{children:x.map(e=>{const y=Aw(e),b=!(s&&!u)&&(p===x||f.includes(y));return ee.jsx(Mw,{isPresent:b,initial:!(h.current&&!n)&&void 0,custom:t,presenceAffectsLayout:o,mode:a,root:c,onExitComplete:b?void 0:()=>{if(v.current.has(y))return;if(!g.has(y))return;v.current.add(y),g.set(y,!0);let e=!0;g.forEach(t=>{t||(e=!1)}),e&&(null==S||S(),w(m.current),s&&(null==d||d()),r&&r())},anchorX:i,anchorY:l,children:e},y)})})},Fw=W.createContext({strict:!1}),$w={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let zw=!1;function Vw(){return function(){if(zw)return;const e={};for(const t in $w)e[t]={isEnabled:e=>$w[t].some(t=>!!e[t])};vb(e),zw=!0}(),gb}const Uw=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Bw(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Uw.has(e)}let Ww=e=>!Bw(e);try{"function"==typeof(Hw=require("@emotion/is-prop-valid").default)&&(Ww=e=>e.startsWith("on")?!Bw(e):Hw(e))}catch{}var Hw;const qw=W.createContext({});function Gw(e){const{initial:t,animate:n}=function(e,t){if(cb(e)){const{initial:t,animate:n}=e;return{initial:!1===t||sb(t)?t:void 0,animate:sb(n)?n:void 0}}return!1!==e.inherit?t:{}}(e,W.useContext(qw));return W.useMemo(()=>({initial:t,animate:n}),[Kw(t),Kw(n)])}function Kw(e){return Array.isArray(e)?e.join(" "):e}const Yw=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Xw(e,t,n){for(const r in t)ey(t[r])||qb(r,n)||(e[r]=t[r])}function Qw(e,t){const n={};return Xw(n,e.style||{},e),Object.assign(n,function({transformTemplate:e},t){return W.useMemo(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{}};return zb(n,t,e),Object.assign({},n.vars,n.style)},[t])}(e,t)),n}function Jw(e,t){const n={},r=Qw(e,t);return e.drag&&!1!==e.dragListener&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===e.drag?"none":"pan-"+("x"===e.drag?"y":"x")),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const Zw=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}});function ek(e,t,n,r){const o=W.useMemo(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return Jb(n,t,ex(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){const t={};Xw(t,e.style,e),o.style={...t,...o.style}}return o}const tk=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function nk(e){return"string"==typeof e&&!e.includes("-")&&!!(tk.indexOf(e)>-1||/[A-Z]/u.test(e))}function rk(e,t,n,{latestValues:r},o,a=!1,s){const i=(s??nk(e)?ek:Jw)(t,r,o,e),l=function(e,t,n){const r={};for(const o in e)"values"===o&&"object"==typeof e.values||ey(e[o])||(Ww(o)||!0===n&&Bw(o)||!t&&!Bw(o)||e.draggable&&o.startsWith("onDrag"))&&(r[o]=e[o]);return r}(t,"string"==typeof e,a),c=e!==W.Fragment?{...l,...i,ref:n}:{},{children:u}=t,d=W.useMemo(()=>ey(u)?u.get():u,[u]);return W.createElement(e,{...c,children:d})}function ok(e,t,n,r){const o={},a=r(e,{});for(const p in a)o[p]=qx(a[p]);let{initial:s,animate:i}=e;const l=cb(e),c=ub(e);t&&c&&!l&&!1!==e.inherit&&(void 0===s&&(s=t.initial),void 0===i&&(i=t.animate));let u=!!n&&!1===n.initial;u=u||!1===s;const d=u?i:s;if(d&&"boolean"!=typeof d&&!ab(d)){const t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){const r=qv(e,t[n]);if(r){const{transitionEnd:e,transition:t,...n}=r;for(const r in n){let e=n[r];if(Array.isArray(e)){e=e[u?e.length-1:0]}null!==e&&(o[r]=e)}for(const r in e)o[r]=e[r]}}}return o}const ak=e=>(t,n)=>{const r=W.useContext(qw),o=W.useContext(jh),a=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,o){return{latestValues:ok(n,r,o,e),renderState:t()}}(e,t,r,o);return n?a():kh(a)},sk=ak({scrapeMotionValuesFromProps:Gb,createRenderState:Yw}),ik=ak({scrapeMotionValuesFromProps:tx,createRenderState:Zw}),lk=Symbol.for("motionComponentSymbol");function ck(e,t,n){const r=W.useRef(n);W.useInsertionEffect(()=>{r.current=n});const o=W.useRef(null);return W.useCallback(n=>{var a;n&&(null==(a=e.onMount)||a.call(e,n));const s=r.current;if("function"==typeof s)if(n){const e=s(n);"function"==typeof e&&(o.current=e)}else o.current?(o.current(),o.current=null):s(n);else s&&(s.current=n);t&&(n?t.mount(n):t.unmount())},[t])}const uk=W.createContext({});function dk(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function pk(e,t,n,r,o,a){var s,i;const{visualElement:l}=W.useContext(qw),c=W.useContext(Fw),u=W.useContext(jh),d=W.useContext(Pw),p=d.reducedMotion,f=d.skipAnimations,h=W.useRef(null),m=W.useRef(!1);r=r||c.renderer,!h.current&&r&&(h.current=r(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:p,skipAnimations:f,isSVG:a}),m.current&&h.current&&(h.current.manuallyAnimateOnMount=!0));const g=h.current,v=W.useContext(uk);!g||g.projection||!o||"html"!==g.type&&"svg"!==g.type||function(e,t,n,r){const{layoutId:o,layout:a,drag:s,dragConstraints:i,layoutScroll:l,layoutRoot:c,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:fk(e.parent)),e.projection.setOptions({layoutId:o,layout:a,alwaysMeasureLayout:Boolean(s)||i&&dk(i),visualElement:e,animationType:"string"==typeof a?a:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:l,layoutRoot:c,layoutAnchor:u})}(h.current,n,o,v);const y=W.useRef(!1);W.useInsertionEffect(()=>{g&&y.current&&g.update(n,u)});const b=n[ry],x=W.useRef(Boolean(b)&&"undefined"!=typeof window&&!(null==(s=window.MotionHandoffIsComplete)?void 0:s.call(window,b))&&(null==(i=window.MotionHasOptimisedAnimation)?void 0:i.call(window,b)));return Sh(()=>{m.current=!0,g&&(y.current=!0,window.MotionIsMounted=!0,g.updateFeatures(),g.scheduleRenderMicrotask(),x.current&&g.animationState&&g.animationState.animateChanges())}),W.useEffect(()=>{g&&(!x.current&&g.animationState&&g.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var e;null==(e=window.MotionHandoffMarkAsComplete)||e.call(window,b)}),x.current=!1),g.enteringChildren=void 0)}),g}function fk(e){if(e)return!1!==e.options.allowProjection?e.projection:fk(e.parent)}function hk(e,{forwardMotionProps:t=!1,type:n}={},r,o){r&&function(e){const t=Vw();for(const n in e)t[n]={...t[n],...e[n]};vb(t)}(r);const a=n?"svg"===n:nk(e),s=a?ik:sk;function i(n,r){let i;const l={...W.useContext(Pw),...n,layoutId:mk(n)},{isStatic:c}=l,u=Gw(n),d=s(n,c);if(!c&&"undefined"!=typeof window){W.useContext(Fw).strict;const t=function(e){const t=Vw(),{drag:n,layout:r}=t;if(!n&&!r)return{};const o={...n,...r};return{MeasureLayout:(null==n?void 0:n.isEnabled(e))||(null==r?void 0:r.isEnabled(e))?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}(l);i=t.MeasureLayout,u.visualElement=pk(e,d,l,o,t.ProjectionNode,a)}return ee.jsxs(qw.Provider,{value:u,children:[i&&u.visualElement?ee.jsx(i,{visualElement:u.visualElement,...l}):null,rk(e,n,ck(d,u.visualElement,r),d,c,t,a)]})}i.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;const l=W.forwardRef(i);return l[lk]=e,l}function mk({layoutId:e}){const t=W.useContext(wh).id;return t&&void 0!==e?t+"-"+e:e}function gk(e,t){if("undefined"==typeof Proxy)return hk;const n=new Map,r=(n,r)=>hk(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(o,a)=>"create"===a?r:(n.has(a)||n.set(a,hk(a,void 0,e,t)),n.get(a))})}const vk=(e,t)=>t.isSVG??nk(e)?new nx(t):new Kb(t,{allowProjection:e!==W.Fragment});let yk=0;const bk={animation:{Feature:class extends xb{constructor(e){super(e),e.animationState||(e.animationState=cx(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();ab(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),null==(e=this.unmountControls)||e.call(this)}}},exit:{Feature:class extends xb{constructor(){super(...arguments),this.id=yk++,this.isExitComplete=!1}update(){var e;if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;if(t&&!1===r){if(this.isExitComplete){const{initial:t,custom:n}=this.node.getProps();if("string"==typeof t){const r=Gv(this.node,t,n);if(r){const{transition:t,transitionEnd:n,...o}=r;for(const r in o)null==(e=this.node.getValue(r))||e.jump(o[r])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);return void(this.isExitComplete=!1)}const o=this.node.animationState.setActive("exit",!t);n&&!t&&o.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function xk(e){return{point:{x:e.pageX,y:e.pageY}}}function wk(e,t,n,r){return Bx(e,t,(e=>t=>Oy(t)&&e(t,xk(t)))(n),r)}const kk=({current:e})=>e?e.ownerDocument.defaultView:null,Sk=(e,t)=>Math.abs(e-t);const jk=new Set(["auto","scroll"]);class Ck{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:o=!1,distanceThreshold:a=3,element:s}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Ek(this.lastRawMoveEventInfo,this.transformPagePoint));const e=_k(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,n=function(e,t){const n=Sk(e.x,t.x),r=Sk(e.y,t.y);return Math.sqrt(n**2+r**2)}(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;const{point:r}=e,{timestamp:o}=lm;this.history.push({...r,timestamp:o});const{onStart:a,onMove:s}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),s&&s(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=Ek(t,this.transformPagePoint),sm.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();const{onEnd:n,onSessionEnd:r,resumeAnimation:o}=this.handlers;if(!this.dragSnapToOrigin&&this.startEvent||o&&o(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const a=_k("pointercancel"===e.type?this.lastMoveEventInfo:Ek(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!Oy(e))return;this.dragSnapToOrigin=o,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;const i=Ek(xk(e),this.transformPagePoint),{point:l}=i,{timestamp:c}=lm;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,_k(i,this.history)),this.removeListeners=Ah(wk(this.contextWindow,"pointermove",this.handlePointerMove),wk(this.contextWindow,"pointerup",this.handlePointerUp),wk(this.contextWindow,"pointercancel",this.handlePointerUp)),s&&this.startScrollTracking(s)}startScrollTracking(e){let t=e.parentElement;for(;t;){const e=getComputedStyle(t);(jk.has(e.overflowX)||jk.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},o=r.x-t.x,a=r.y-t.y;0===o&&0===a||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=o,this.lastMoveEventInfo.point.y+=a):this.history.length>0&&(this.history[0].x-=o,this.history[0].y-=a),this.scrollPositions.set(e,r),sm.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),im(this.updatePoint)}}function Ek(e,t){return t?{point:t(e.point)}:e}function Pk(e,t){return{x:e.x-t.x,y:e.y-t.y}}function _k({point:e},t){return{point:e,delta:Pk(e,Tk(t)),offset:Pk(e,Nk(t)),velocity:Rk(t,.1)}}function Nk(e){return e[0]}function Tk(e){return e[e.length-1]}function Rk(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=Tk(e);for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>Fh(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&o.timestamp-r.timestamp>2*Fh(t)&&(r=e[1]);const a=$h(o.timestamp-r.timestamp);if(0===a)return{x:0,y:0};const s={x:(o.x-r.x)/a,y:(o.y-r.y)/a};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function Mk(e,t,n){return{min:void 0!==t?e.min+t:void 0,max:void 0!==n?e.max+n-(e.max-e.min):void 0}}function Lk(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}const Ok=.35;function Ak(e,t,n){return{min:Dk(e,t),max:Dk(e,n)}}function Dk(e,t){return"number"==typeof e?e:e[t]||0}const Ik=new WeakMap;class Fk{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){const{presenceContext:r}=this.visualElement;if(r&&!1===r.isPresent)return;const{dragSnapToOrigin:o}=this.getProps();this.panSession=new Ck(e,{onSessionStart:e=>{t&&this.snapToCursor(xk(e).point),this.stopAnimation()},onStart:(e,t)=>{const{drag:n,dragPropagation:r,onDragStart:o}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(a=n)||"y"===a?Ny[a]?null:(Ny[a]=!0,()=>{Ny[a]=!1}):Ny.x||Ny.y?null:(Ny.x=Ny.y=!0,()=>{Ny.x=Ny.y=!1}),!this.openDragLock))return;var a;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ox(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Mm.test(t)){const{projection:n}=this.visualElement;if(n&&n.layout){const r=n.layout.layoutBox[e];if(r){t=gx(r)*(parseFloat(t)/100)}}}this.originPoint[e]=t}),o&&sm.update(()=>o(e,t),!1,!0),ty(this.visualElement,"transform");const{animationState:s}=this.visualElement;s&&s.setActive("whileDrag",!0)},onMove:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;const{dragPropagation:n,dragDirectionLock:r,onDirectionLock:o,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;const{offset:s}=t;if(r&&null===this.currentDirection)return this.currentDirection=function(e,t=10){let n=null;Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x");return n}(s),void(null!==this.currentDirection&&o&&o(this.currentDirection));this.updateAxis("x",t.point,s),this.updateAxis("y",t.point,s),this.visualElement.render(),a&&sm.update(()=>a(e,t),!1,!0)},onSessionEnd:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation:()=>{const{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})}},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:o,distanceThreshold:n,contextWindow:kk(this.visualElement),element:this.visualElement.current})}stop(e,t){const n=e||this.latestPointerEvent,r=t||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!r||!n)return;const{velocity:a}=r;this.startAnimation(a);const{onDragEnd:s}=this.getProps();s&&sm.postRender(()=>s(n,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){const{drag:r}=this.getProps();if(!n||!zk(e,r,this.currentDirection))return;const o=this.getAxisMotionValue(e);let a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=function(e,{min:t,max:n},r){return void 0!==t&&e<t?e=r?Ym(t,e,r.min):Math.max(e,t):void 0!==n&&e>n&&(e=r?Ym(n,e,r.max):Math.min(e,n)),e}(a,this.constraints[e],this.elastic[e])),o.set(a)}resolveConstraints(){var e;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null==(e=this.visualElement.projection)?void 0:e.layout,o=this.constraints;t&&dk(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!r)&&function(e,{top:t,left:n,bottom:r,right:o}){return{x:Mk(e.x,n,o),y:Mk(e.y,t,r)}}(r.layoutBox,t),this.elastic=function(e=Ok){return!1===e?e=0:!0===e&&(e=Ok),{x:Ak(e,"left","right"),y:Ak(e,"top","bottom")}}(n),o!==this.constraints&&!dk(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&Ox(e=>{!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=function(e,t){const n={};return void 0!==t.min&&(n.min=t.min-e.min),void 0!==t.max&&(n.max=t.max-e.min),n}(r.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!dk(e))return!1;const n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const o=function(e,t,n){const r=Ib(e,n),{scroll:o}=t;return o&&(Lb(r.x,o.offset.x),Lb(r.y,o.offset.y)),r}(n,r.root,this.visualElement.getTransformPagePoint());let a=function(e,t){return{x:Lk(e.x,t.x),y:Lk(e.y,t.y)}}(r.layout.layoutBox,o);if(t){const e=t(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(a));this.hasMutatedConstraints=!!e,e&&(a=wb(e))}return a}startAnimation(e){const{drag:t,dragMomentum:n,dragElastic:r,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:s}=this.getProps(),i=this.constraints||{},l=Ox(s=>{if(!zk(s,t,this.currentDirection))return;let l=i&&i[s]||{};!0!==a&&a!==s||(l={min:0,max:0});const c=r?200:1e6,u=r?40:1e7,d={type:"inertia",velocity:n?e[s]:0,bounceStiffness:c,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...o,...l};return this.startAxisValueAnimation(s,d)});return Promise.all(l).then(s)}startAxisValueAnimation(e,t){const n=this.getAxisMotionValue(e);return ty(this.visualElement,e),n.start(Wv(e,n,0,t,this.visualElement,!1))}stopAnimation(){Ox(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),r=n[t];return r||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){Ox(t=>{const{drag:n}=this.getProps();if(!zk(t,n,this.currentDirection))return;const{projection:r}=this.visualElement,o=this.getAxisMotionValue(t);if(r&&r.layout){const{min:n,max:a}=r.layout.layoutBox[t],s=o.get()||0;o.set(e[t]-Ym(n,a,.5)+s)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!dk(t)||!n||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Ox(e=>{const t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){const n=t.get();r[e]=function(e,t){let n=.5;const r=gx(e),o=gx(t);return o>r?n=Dh(t.min,t.max-r,e.min):r>o&&(n=Dh(e.min,e.max-o,t.min)),Ph(0,1,n)}({min:n,max:n},this.constraints[e])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),Ox(t=>{if(!zk(t,e,null))return;const n=this.getAxisMotionValue(t),{min:o,max:a}=this.constraints[t];n.set(Ym(o,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Ik.set(this.visualElement,this);const e=this.visualElement.current,t=wk(e,"pointerdown",t=>{const{drag:n,dragListener:r=!0}=this.getProps(),o=t.target,a=o!==e&&function(e){return Dy.has(e.tagName)||!0===e.isContentEditable}(o);n&&r&&!a&&this.start(t)});let n;const r=()=>{const{dragConstraints:t}=this.getProps();dk(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||(n=function(e,t,n){const r=tb(e,$k(n)),o=tb(t,$k(n));return()=>{r(),o()}}(e,t.current,()=>this.scalePositionWithinConstraints())))},{projection:o}=this.visualElement,a=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),sm.read(r);const s=Bx(window,"resize",()=>this.scalePositionWithinConstraints()),i=o.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(Ox(t=>{const n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())});return()=>{s(),t(),a(),i&&i(),n&&n()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:o=!1,dragElastic:a=Ok,dragMomentum:s=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:o,dragElastic:a,dragMomentum:s}}}function $k(e){let t=!0;return()=>{t?t=!1:e()}}function zk(e,t,n){return!(!0!==t&&t!==e||null!==n&&n!==e)}const Vk=e=>(t,n)=>{e&&sm.update(()=>e(t,n),!1,!0)};let Uk=!1;class Bk extends W.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:o}=e;o&&(t.group&&t.group.add(o),n&&n.register&&r&&n.register(o),Uk&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Kx.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:n,drag:r,isPresent:o}=this.props,{projection:a}=n;return a?(a.isPresent=o,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),Uk=!0,r||e.layoutDependency!==t||void 0===t||e.isPresent!==o?a.willUpdate():this.safeToRemove(),e.isPresent!==o&&(o?a.promote():a.relegate()||sm.postRender(()=>{const e=a.getStack();e&&e.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),_y.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;Uk=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Wk(e){const[t,n]=Ow(),r=W.useContext(wh);return ee.jsx(Bk,{...e,layoutGroup:r,switchLayoutGroup:W.useContext(uk),isPresent:t,safeToRemove:n})}const Hk={pan:{Feature:class extends xb{constructor(){super(...arguments),this.removePointerDownListener=Lh}onPointerDown(e){this.session=new Ck(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:kk(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Vk(e),onStart:Vk(t),onMove:Vk(n),onEnd:(e,t)=>{delete this.session,r&&sm.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=wk(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends xb{constructor(e){super(e),this.removeGroupControls=Lh,this.removeListeners=Lh,this.controls=new Fk(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Lh}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:Ew,MeasureLayout:Wk}};function qk(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover","Start"===n);const o=r["onHover"+n];o&&sm.postRender(()=>o(t,xk(t)))}function Gk(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap","Start"===n);const o=r["onTap"+("End"===n?"":n)];o&&sm.postRender(()=>o(t,xk(t)))}const Kk=new WeakMap,Yk=new WeakMap,Xk=e=>{const t=Kk.get(e.target);t&&t(e)},Qk=e=>{e.forEach(Xk)};function Jk(e,t,n){const r=function({root:e,...t}){const n=e||document;Yk.has(n)||Yk.set(n,{});const r=Yk.get(n),o=JSON.stringify(t);return r[o]||(r[o]=new IntersectionObserver(Qk,{root:e,...t})),r[o]}(t);return Kk.set(e,n),r.observe(e),()=>{Kk.delete(e),r.unobserve(e)}}const Zk={some:0,all:1};const eS={inView:{Feature:class extends xb{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var e;null==(e=this.stopObserver)||e.call(this);const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:o="some",once:a}=t,s={root:n?n.current:void 0,rootMargin:r,threshold:"number"==typeof o?o:Zk[o]};this.stopObserver=Jk(this.node.current,s,e=>{const{isIntersecting:t}=e;if(this.isInView===t)return;if(this.isInView=t,a&&!t&&this.hasEnteredView)return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);const{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),o=t?n:r;o&&o(e)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}(e,t))&&this.startObserver()}unmount(){var e;null==(e=this.stopObserver)||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}},tap:{Feature:class extends xb{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=Uy(e,(e,t)=>(Gk(this.node,t,"Start"),(e,{success:t})=>Gk(this.node,e,t?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:!1===(null==n?void 0:n.tap)})}unmount(){}}},focus:{Feature:class extends xb{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(TO){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ah(Bx(this.node.current,"focus",()=>this.onFocus()),Bx(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends xb{mount(){const{current:e}=this.node;e&&(this.unmount=My(e,(e,t)=>(qk(this.node,t,"Start"),e=>qk(this.node,e,"End"))))}unmount(){}}}},tS=gk({...bk,...eS,...Hk,...{layout:{ProjectionNode:Ew,MeasureLayout:Wk}}},vk);function nS(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=nS(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function rS(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=nS(e))&&(r&&(r+=" "),r+=t);return r}const oS=e=>{const t=lS(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{const n=e.split("-");return""===n[0]&&1!==n.length&&n.shift(),aS(n,t)||iS(e)},getConflictingClassGroupIds:(e,t)=>{const o=n[e]||[];return t&&r[e]?[...o,...r[e]]:o}}},aS=(e,t)=>{var n;if(0===e.length)return t.classGroupId;const r=e[0],o=t.nextPart.get(r),a=o?aS(e.slice(1),o):void 0;if(a)return a;if(0===t.validators.length)return;const s=e.join("-");return null==(n=t.validators.find(({validator:e})=>e(s)))?void 0:n.classGroupId},sS=/^\[(.+)\]$/,iS=e=>{if(sS.test(e)){const t=sS.exec(e)[1],n=null==t?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},lS=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return pS(Object.entries(e.classGroups),n).forEach(([e,n])=>{cS(n,r,e,t)}),r},cS=(e,t,n,r)=>{e.forEach(e=>{if("string"==typeof e){return void((""===e?t:uS(t,e)).classGroupId=n)}if("function"==typeof e)return dS(e)?void cS(e(r),t,n,r):void t.validators.push({validator:e,classGroupId:n});Object.entries(e).forEach(([e,o])=>{cS(o,uS(t,e),n,r)})})},uS=(e,t)=>{let n=e;return t.split("-").forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},dS=e=>e.isThemeGetter,pS=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>"string"==typeof e?t+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,fS=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(o,a)=>{n.set(o,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);return void 0!==t?t:void 0!==(t=r.get(e))?(o(e,t),t):void 0},set(e,t){n.has(e)?n.set(e,t):o(e,t)}}},hS=e=>{const{separator:t,experimentalParseClassName:n}=e,r=1===t.length,o=t[0],a=t.length,s=e=>{const n=[];let s,i=0,l=0;for(let d=0;d<e.length;d++){let c=e[d];if(0===i){if(c===o&&(r||e.slice(d,d+a)===t)){n.push(e.slice(l,d)),l=d+a;continue}if("/"===c){s=d;continue}}"["===c?i++:"]"===c&&i--}const c=0===n.length?e:e.substring(l),u=c.startsWith("!");return{modifiers:n,hasImportantModifier:u,baseClassName:u?c.substring(1):c,maybePostfixModifierPosition:s&&s>l?s-l:void 0}};return n?e=>n({className:e,parseClassName:s}):s},mS=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(e=>{"["===e[0]?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},gS=/\s+/;function vS(){let e,t,n=0,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=yS(e))&&(r&&(r+=" "),r+=t);return r}const yS=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=yS(e[r]))&&(n&&(n+=" "),n+=t);return n};function bS(e,...t){let n,r,o,a=function(i){const l=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:fS(e.cacheSize),parseClassName:hS(e),...oS(e)}))(l),r=n.cache.get,o=n.cache.set,a=s,s(i)};function s(e){const t=r(e);if(t)return t;const a=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,a=[],s=e.trim().split(gS);let i="";for(let l=s.length-1;l>=0;l-=1){const e=s[l],{modifiers:t,hasImportantModifier:c,baseClassName:u,maybePostfixModifierPosition:d}=n(e);let p=Boolean(d),f=r(p?u.substring(0,d):u);if(!f){if(!p){i=e+(i.length>0?" "+i:i);continue}if(f=r(u),!f){i=e+(i.length>0?" "+i:i);continue}p=!1}const h=mS(t).join(":"),m=c?h+"!":h,g=m+f;if(a.includes(g))continue;a.push(g);const v=o(f,p);for(let n=0;n<v.length;++n){const e=v[n];a.push(m+e)}i=e+(i.length>0?" "+i:i)}return i})(e,n);return o(e,a),a}return function(){return a(vS.apply(null,arguments))}}const xS=e=>{const t=t=>t[e]||[];return t.isThemeGetter=!0,t},wS=/^\[(?:([a-z-]+):)?(.+)\]$/i,kS=/^\d+\/\d+$/,SS=new Set(["px","full","screen"]),jS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,CS=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ES=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,PS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_S=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,NS=e=>RS(e)||SS.has(e)||kS.test(e),TS=e=>WS(e,"length",HS),RS=e=>Boolean(e)&&!Number.isNaN(Number(e)),MS=e=>WS(e,"number",RS),LS=e=>Boolean(e)&&Number.isInteger(Number(e)),OS=e=>e.endsWith("%")&&RS(e.slice(0,-1)),AS=e=>wS.test(e),DS=e=>jS.test(e),IS=new Set(["length","size","percentage"]),FS=e=>WS(e,IS,qS),$S=e=>WS(e,"position",qS),zS=new Set(["image","url"]),VS=e=>WS(e,zS,KS),US=e=>WS(e,"",GS),BS=()=>!0,WS=(e,t,n)=>{const r=wS.exec(e);return!!r&&(r[1]?"string"==typeof t?r[1]===t:t.has(r[1]):n(r[2]))},HS=e=>CS.test(e)&&!ES.test(e),qS=()=>!1,GS=e=>PS.test(e),KS=e=>_S.test(e),YS=bS(()=>{const e=xS("colors"),t=xS("spacing"),n=xS("blur"),r=xS("brightness"),o=xS("borderColor"),a=xS("borderRadius"),s=xS("borderSpacing"),i=xS("borderWidth"),l=xS("contrast"),c=xS("grayscale"),u=xS("hueRotate"),d=xS("invert"),p=xS("gap"),f=xS("gradientColorStops"),h=xS("gradientColorStopPositions"),m=xS("inset"),g=xS("margin"),v=xS("opacity"),y=xS("padding"),b=xS("saturate"),x=xS("scale"),w=xS("sepia"),k=xS("skew"),S=xS("space"),j=xS("translate"),C=()=>["auto",AS,t],E=()=>[AS,t],P=()=>["",NS,TS],_=()=>["auto",RS,AS],N=()=>["","0",AS],T=()=>[RS,AS];return{cacheSize:500,separator:":",theme:{colors:[BS],spacing:[NS,TS],blur:["none","",DS,AS],brightness:T(),borderColor:[e],borderRadius:["none","","full",DS,AS],borderSpacing:E(),borderWidth:P(),contrast:T(),grayscale:N(),hueRotate:T(),invert:N(),gap:E(),gradientColorStops:[e],gradientColorStopPositions:[OS,TS],inset:C(),margin:C(),opacity:T(),padding:E(),saturate:T(),scale:T(),sepia:N(),skew:T(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",AS]}],container:["container"],columns:[{columns:[DS]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",AS]}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",LS,AS]}],basis:[{basis:C()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",AS]}],grow:[{grow:N()}],shrink:[{shrink:N()}],order:[{order:["first","last","none",LS,AS]}],"grid-cols":[{"grid-cols":[BS]}],"col-start-end":[{col:["auto",{span:["full",LS,AS]},AS]}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":[BS]}],"row-start-end":[{row:["auto",{span:[LS,AS]},AS]}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",AS]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",AS]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal","start","end","center","between","around","evenly","stretch"]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[S]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[S]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",AS,t]}],"min-w":[{"min-w":[AS,t,"min","max","fit"]}],"max-w":[{"max-w":[AS,t,"none","full","min","max","fit","prose",{screen:[DS]},DS]}],h:[{h:[AS,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[AS,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[AS,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[AS,t,"auto","min","max","fit"]}],"font-size":[{text:["base",DS,TS]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",MS]}],"font-family":[{font:[BS]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",AS]}],"line-clamp":[{"line-clamp":["none",RS,MS]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",NS,AS]}],"list-image":[{"list-image":["none",AS]}],"list-style-type":[{list:["none","disc","decimal",AS]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","none","wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",NS,TS]}],"underline-offset":[{"underline-offset":["auto",NS,AS]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",AS]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",AS]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",$S]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",FS]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},VS]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[h]}],"gradient-via-pos":[{via:[h]}],"gradient-to-pos":[{to:[h]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-b":[{"border-b":[i]}],"border-w-l":[{"border-l":[i]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:["solid","dashed","dotted","double","none","hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:["solid","dashed","dotted","double","none"]}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["","solid","dashed","dotted","double","none"]}],"outline-offset":[{"outline-offset":[NS,AS]}],"outline-w":[{outline:[NS,TS]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:P()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[NS,TS]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",DS,US]}],"shadow-color":[{shadow:[BS]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",DS,AS]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[b]}],sepia:[{sepia:[w]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[b]}],"backdrop-sepia":[{"backdrop-sepia":[w]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",AS]}],duration:[{duration:T()}],ease:[{ease:["linear","in","out","in-out",AS]}],delay:[{delay:T()}],animate:[{animate:["none","spin","ping","pulse","bounce",AS]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[LS,AS]}],"translate-x":[{"translate-x":[j]}],"translate-y":[{"translate-y":[j]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",AS]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",AS]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",AS]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[NS,TS,MS]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function XS(...e){return YS(rS(e))}const QS=W.forwardRef(({className:e,...t},n)=>ee.jsx("div",{ref:n,className:XS("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));QS.displayName="Card";const JS=W.forwardRef(({className:e,...t},n)=>ee.jsx("div",{ref:n,className:XS("flex flex-col space-y-1.5 p-6",e),...t}));JS.displayName="CardHeader";const ZS=W.forwardRef(({className:e,...t},n)=>ee.jsx("h3",{ref:n,className:XS("font-semibold leading-none",e),...t}));ZS.displayName="CardTitle";const ej=W.forwardRef(({className:e,...t},n)=>ee.jsx("p",{ref:n,className:XS("text-sm text-muted-foreground",e),...t}));ej.displayName="CardDescription";const tj=W.forwardRef(({className:e,...t},n)=>ee.jsx("div",{ref:n,className:XS("p-6 pt-0",e),...t}));tj.displayName="CardContent";const nj=W.forwardRef(({className:e,...t},n)=>ee.jsx("div",{ref:n,className:XS("flex items-center p-6 pt-0",e),...t}));function rj(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function oj(...e){return t=>{let n=!1;const r=e.map(e=>{const r=rj(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():rj(e[t],null)}}}}function aj(...e){return W.useCallback(oj(...e),e)}nj.displayName="CardFooter";var sj=Symbol.for("react.lazy"),ij=q[" use ".trim().toString()];function lj(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===sj&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function cj(e){const t=dj(e),n=W.forwardRef((e,n)=>{let{children:r,...o}=e;lj(r)&&"function"==typeof ij&&(r=ij(r._payload));const a=W.Children.toArray(r),s=a.find(fj);if(s){const e=s.props.children,r=a.map(t=>t===s?W.Children.count(e)>1?W.Children.only(null):W.isValidElement(e)?e.props.children:null:t);return ee.jsx(t,{...o,ref:n,children:W.isValidElement(e)?W.cloneElement(e,void 0,r):null})}return ee.jsx(t,{...o,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var uj=cj("Slot");function dj(e){const t=W.forwardRef((e,t)=>{let{children:n,...r}=e;if(lj(n)&&"function"==typeof ij&&(n=ij(n._payload)),W.isValidElement(n)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{const t=a(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==W.Fragment&&(o.ref=t?oj(t,e):e),W.cloneElement(n,o)}return W.Children.count(n)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var pj=Symbol("radix.slottable");function fj(e){return W.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===pj}const hj=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,mj=rS,gj=(e,t)=>n=>{var r;if(null==(null==t?void 0:t.variants))return mj(e,null==n?void 0:n.class,null==n?void 0:n.className);const{variants:o,defaultVariants:a}=t,s=Object.keys(o).map(e=>{const t=null==n?void 0:n[e],r=null==a?void 0:a[e];if(null===t)return null;const s=hj(t)||hj(r);return o[e][s]}),i=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{}),l=null==t||null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce((e,t)=>{let{class:n,className:r,...o}=t;return Object.entries(o).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...a,...i}[t]):{...a,...i}[t]===n})?[...e,n,r]:e},[]);return mj(e,s,l,null==n?void 0:n.class,null==n?void 0:n.className)},vj=gj("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),yj=W.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},a)=>{const s=r?uj:"button";return ee.jsx(s,{className:XS(vj({variant:t,size:n,className:e})),ref:a,...o})});yj.displayName="Button";const bj=W.forwardRef(({className:e,type:t,...n},r)=>ee.jsx("input",{type:t,className:XS("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));bj.displayName="Input";var xj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const n=cj(`Primitive.${t}`),r=W.forwardRef((e,r)=>{const{asChild:o,...a}=e,s=o?n:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),ee.jsx(s,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),wj=W.forwardRef((e,t)=>ee.jsx(xj.label,{...e,ref:t,onMouseDown:t=>{var n;t.target.closest("button, input, select, textarea")||(null==(n=e.onMouseDown)||n.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));wj.displayName="Label";var kj=wj;const Sj=gj("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),jj=W.forwardRef(({className:e,...t},n)=>ee.jsx(kj,{ref:n,className:XS(Sj(),e),...t}));jj.displayName=kj.displayName;const Cj=e=>{let t;const n=new Set,r=(e,r)=>{const o="function"==typeof e?e(t):e;if(!Object.is(o,t)){const e=t;t=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},t,o),n.forEach(n=>n(t,e))}},o=()=>t,a={setState:r,getState:o,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e))},s=t=e(r,o,a);return a},Ej=e=>e;const Pj=e=>{const t=(e=>e?Cj(e):Cj)(e),n=e=>function(e,t=Ej){const n=H.useSyncExternalStore(e.subscribe,H.useCallback(()=>t(e.getState()),[e,t]),H.useCallback(()=>t(e.getInitialState()),[e,t]));return H.useDebugValue(n),n}(t,e);return Object.assign(n,t),n},_j=e=>e?Pj(e):Pj,Nj={token:"cc_web_token",theme:"cc_web_theme",viewMode:e=>`cc_viewmode_${e}`,panelFileTree:"cc_panel_filetree",panelShortcuts:"cc_panel_shortcuts",fileZoom:"cc_file_zoom",skillhubAuthor:"ccweb_skillhub_author",projectOrder:"cc_project_order",pomodoroConfig:"cc_pomodoro_config",panelLeftWidth:"cc_panel_left_width",panelRightWidth:"cc_panel_right_width",terminalDraft:e=>`cc_terminal_draft_${e}`,usedSkills:"cc_used_skills",projectModel:e=>`cc_project_model_${e}`,draftState:e=>`cc_draft_state_${e}`,usageMonitorTool:"cc_usage_monitor_tool",monitorMode:"cc_monitor_mode",chatOverlay:e=>`cc_chat_overlay_${e}`,rightPanelTab:"cc_right_panel_tab",leftPanelTab:"cc_left_panel_tab",browserLastUrl:"cc_browser_last_url",browserHistory:"cc_browser_history"};function Tj(e,t,n){try{const r=localStorage.getItem(e);return null===r?t:n?JSON.parse(r):r}catch{return t}}function Rj(e,t,n){try{localStorage.setItem(e,n?JSON.stringify(t):String(t))}catch{}}function Mj(e){try{localStorage.removeItem(e)}catch{}}function Lj(e,t,n){const r=(null==n?void 0:n.parse)??!1,[o,a]=W.useState(()=>{try{const n=localStorage.getItem(e);return null===n?t:r?JSON.parse(n):n}catch{return t}});return[o,W.useCallback(t=>{a(n=>{const o="function"==typeof t?t(n):t;try{localStorage.setItem(e,r?JSON.stringify(o):String(o))}catch{}return o})},[e,r])]}const Oj=_j(e=>({token:localStorage.getItem(Nj.token),setToken:t=>{Rj(Nj.token,t),e({token:t})},clearToken:()=>{Mj(Nj.token),e({token:null})}}));let Aj=null;const Dj=_j((e,t)=>({projects:[],loading:!1,error:null,hasFetched:!1,fetchProjects:async()=>{if(!t().loading){e({loading:!0,error:null});try{const t=await async function(){if(!Aj){const e=await pd(()=>Promise.resolve().then(()=>NE),void 0);Aj=e.getProjects}return Aj()}();e({projects:t,hasFetched:!0})}catch(n){e({error:n instanceof Error?n.message:"Failed to load projects"})}finally{e({loading:!1})}}},addProject:t=>e(e=>({projects:[...e.projects,t]})),updateProject:t=>e(e=>({projects:e.projects.map(e=>e.id===t.id?t:e)})),removeProject:t=>e(e=>({projects:e.projects.filter(e=>e.id!==t)})),setProjects:t=>e({projects:t})})),Ij={filePreviews:[],activePreviewPath:null,shortcutEditorOpen:!1,shortcutEditingId:null,shareHubOpen:!1,shareHubLabel:"",shareHubCommand:""};const Fj=_j((e,t)=>({entries:{},get:e=>t().entries[e]??Ij,openFilePreview:(t,n)=>e(e=>{const r=e.entries[t]??Ij,o=r.filePreviews.some(e=>e.path===n)?r.filePreviews.map(e=>e.path===n?{...e,minimized:!1}:e):[...r.filePreviews,{path:n,minimized:!1}];return{entries:{...e.entries,[t]:{...r,filePreviews:o,activePreviewPath:n}}}}),closeFilePreview:(t,n)=>e(e=>{const r=e.entries[t]??Ij,o=r.filePreviews.filter(e=>e.path!==n),a=r.activePreviewPath===n?function(e,t){const n=e.filter(e=>e.path!==t&&!e.minimized);return n.length>0?n[n.length-1].path:null}(r.filePreviews,n):r.activePreviewPath;return{entries:{...e.entries,[t]:{...r,filePreviews:o,activePreviewPath:a}}}}),minimizeFilePreview:(t,n)=>e(e=>{var r;const o=e.entries[t]??Ij,a=o.filePreviews.map(e=>e.path===n?{...e,minimized:!0}:e),s=o.activePreviewPath===n?(null==(r=a.filter(e=>!e.minimized).slice(-1)[0])?void 0:r.path)??null:o.activePreviewPath;return{entries:{...e.entries,[t]:{...o,filePreviews:a,activePreviewPath:s}}}}),setActivePreview:(t,n)=>e(e=>{const r=e.entries[t]??Ij,o=r.filePreviews.map(e=>e.path===n?{...e,minimized:!1}:e);return{entries:{...e.entries,[t]:{...r,filePreviews:o,activePreviewPath:n}}}}),setShortcutEditor:(t,n,r=null)=>e(e=>({entries:{...e.entries,[t]:{...e.entries[t]??Ij,shortcutEditorOpen:n,shortcutEditingId:n?r:null}}})),setShareHub:(t,n,r="",o="")=>e(e=>({entries:{...e.entries,[t]:{...e.entries[t]??Ij,shareHubOpen:n,shareHubLabel:n?r:"",shareHubCommand:n?o:""}}}))}));function $j(){return Oj.getState().token}function zj(){Oj.getState().clearToken()}async function Vj(e,t,n,r=!0,o){const a={"Content-Type":"application/json"};if(r){const e=$j();e&&(a.Authorization=`Bearer ${e}`)}const s=await fetch(`${t}`,{method:e,headers:a,body:void 0!==n?JSON.stringify(n):void 0,signal:o});if(401===s.status)throw zj(),"/login"!==window.location.pathname&&(window.location.href="/login"),new Error("Unauthorized");if(!s.ok){let e=`HTTP ${s.status}`;try{const t=await s.json();t.error&&(e=t.error)}catch{}throw new Error(e)}return s.json()}async function Uj(e,t){return(await Vj("POST","/api/auth/login",{username:e,password:t},!1)).token}function Bj(){const e=window.location.hostname;return"localhost"===e||"127.0.0.1"===e||"::1"===e}async function Wj(){return(await Vj("GET","/api/auth/local-token",void 0,!1)).token}async function Hj(){return(await Vj("GET","/api/projects/order")).order}async function qj(e){await Vj("PUT","/api/projects/order",{order:e})}async function Gj(){return Vj("GET","/api/projects/users")}async function Kj(e,t){return Vj("PUT",`/api/projects/${e}/shares`,{shares:t})}async function Yj(e){return Vj("POST","/api/projects",e)}async function Xj(e){return Vj("POST","/api/projects/open",{folderPath:e})}async function Qj(e){await Vj("DELETE",`/api/projects/${e}`)}async function Jj(e){return Vj("PATCH",`/api/projects/${e}/start`)}async function Zj(e){return Vj("PATCH",`/api/projects/${e}/archive`)}async function eC(e,t,n){return Vj("POST",`/api/projects/${e}/switch-cli`,{cliTool:t,continueSession:n})}async function tC(e){return Vj("PATCH",`/api/projects/${e}/unarchive`)}async function nC(){return Vj("GET","/api/shortcuts")}async function rC(e){return Vj("POST","/api/shortcuts",e)}async function oC(e,t){return Vj("PUT",`/api/shortcuts/${e}`,t)}async function aC(e){await Vj("DELETE",`/api/shortcuts/${e}`)}async function sC(e){return Vj("GET",`/api/shortcuts/project/${e}`)}async function iC(e,t){return Vj("POST",`/api/shortcuts/project/${e}`,t)}async function lC(e,t,n){return Vj("PUT",`/api/shortcuts/project/${e}/${t}`,n)}async function cC(e,t){await Vj("DELETE",`/api/shortcuts/project/${e}/${t}`)}async function uC(e,t,n){return Vj("PATCH",`/api/shortcuts/project/${e}/${t}/used`,{used:n})}async function dC(){return Vj("GET","/api/prompts")}async function pC(e){return Vj("POST","/api/prompts",e)}async function fC(e,t){return Vj("PUT",`/api/prompts/${e}`,t)}async function hC(e){await Vj("DELETE",`/api/prompts/${e}`)}async function mC(e){return Vj("GET",`/api/prompts/project/${e}`)}async function gC(e,t){return Vj("POST",`/api/prompts/project/${e}`,t)}async function vC(e,t,n){return Vj("PUT",`/api/prompts/project/${e}/${t}`,n)}async function yC(e,t){await Vj("DELETE",`/api/prompts/project/${e}/${t}`)}async function bC(e){return Vj("GET",`/api/memory/project/${encodeURIComponent(e)}`)}async function xC(e,t,n){return Vj("POST",`/api/memory/project/${encodeURIComponent(e)}/toggle`,{filename:t,action:n})}async function wC(e,t,n){return Vj("POST",`/api/prompts/project/${e}/toggle`,{text:t,action:n})}async function kC(){return Vj("GET","/api/skillhub/items")}async function SC(){return Vj("GET","/api/skillhub/auth")}async function jC(e){return Vj("PUT","/api/skillhub/auth",{token:e})}async function CC(){await Vj("DELETE","/api/skillhub/auth")}async function EC(e){return Vj("POST","/api/skillhub/submit",e)}async function PC(e="claude"){return Vj("GET",`/api/projects/usage?tool=${encodeURIComponent(e)}`)}async function _C(e="claude"){return Vj("GET",`/api/projects/usage?refresh=true&tool=${encodeURIComponent(e)}`)}async function NC(){return Vj("GET","/api/host-stats")}async function TC(){try{return await Vj("GET","/api/claude-mem/status")}catch{return null}}async function RC(){return(await Vj("GET","/api/claude-mem/projects")).items}async function MC(e){const t=new URLSearchParams;return e.project&&t.set("project",e.project),e.type&&t.set("type",e.type),e.q&&t.set("q",e.q),null!=e.limit&&t.set("limit",String(e.limit)),null!=e.offset&&t.set("offset",String(e.offset)),Vj("GET",`/api/claude-mem/observations?${t.toString()}`)}async function LC(e){return Vj("GET",`/api/filesystem${e?`?path=${encodeURIComponent(e)}`:""}`)}function OC(e){return`/api/filesystem/raw?path=${encodeURIComponent(e)}`}async function AC(e){return(await Vj("GET",`/api/filesystem/doc-text?path=${encodeURIComponent(e)}`)).text}async function DC(e,t,n){return new Promise((r,o)=>{const a=new FormData;a.append("path",e);for(const e of t)a.append("files",e);const s=new XMLHttpRequest;s.open("POST","/api/filesystem/upload");const i=$j();i&&s.setRequestHeader("Authorization",`Bearer ${i}`),n&&(s.upload.onprogress=e=>{e.lengthComputable&&n(e.loaded,e.total)}),s.onload=()=>{if(s.status>=200&&s.status<300)try{r(JSON.parse(s.responseText))}catch(e){o(e instanceof Error?e:new Error(String(e)))}else{let e=`Upload failed: ${s.status}`;try{const t=JSON.parse(s.responseText);t.error&&(e=t.error)}catch{}o(new Error(e))}},s.onerror=()=>o(new Error("Network error")),s.onabort=()=>o(new Error("Upload aborted")),s.send(a)})}async function IC(e,t){return Vj("POST","/api/filesystem/mkdir",{path:e,name:t})}async function FC(e){return Vj("GET",`/api/filesystem/file?path=${encodeURIComponent(e)}`)}async function $C(e,t){return Vj("PUT","/api/filesystem/file",{path:e,content:t})}async function zC(e){return Vj("DELETE",`/api/filesystem?path=${encodeURIComponent(e)}`)}async function VC(){return Vj("GET","/api/update/check-version")}async function UC(){return Vj("GET","/api/update/changelog")}async function BC(){return Vj("POST","/api/update/execute")}async function WC(){return Vj("GET","/api/update/status")}async function HC(){return Vj("GET","/api/user-prefs/language")}async function qC(e){return Vj("PUT","/api/user-prefs/language",{language:e})}async function GC(){return Vj("GET","/api/notify/config")}async function KC(e){return Vj("PUT","/api/notify/config",e)}async function YC(e){return Vj("GET",`/api/projects/${e}/git/status`)}async function XC(e,t){return Vj("GET",`/api/projects/${e}/git/diff${t?`?file=${encodeURIComponent(t)}`:""}`)}async function QC(e,t){await Vj("POST",`/api/projects/${e}/git/add`,{files:t})}async function JC(e,t){await Vj("POST",`/api/projects/${e}/git/commit`,{message:t})}async function ZC(e,t=50,n=0){return Vj("GET",`/api/projects/${e}/git/log?limit=${t}&skip=${n}`)}async function eE(e,t){return Vj("PATCH",`/api/projects/${e}/rename`,{name:t})}async function tE(e,t={}){const n=new URLSearchParams;null!=t.limit&&n.set("limit",String(t.limit)),t.before&&n.set("before",t.before);const r=n.toString();return Vj("GET",`/api/projects/${e}/chat-history${r?"?"+r:""}`)}async function nE(e){return Vj("GET",`/api/projects/${e}/disk-size`)}async function rE(e){return Vj("GET",`/api/claude/scheduled?projectId=${encodeURIComponent(e)}`)}async function oE(e){return Vj("GET",`/api/projects/${e}/sessions-backup`)}async function aE(e){return Vj("POST",`/api/projects/${e}/sessions-backup`)}async function sE(e){return Vj("GET",`/api/tool/model?tool=${encodeURIComponent(e)}`)}async function iE(e,t){return Vj("PUT",`/api/tool/model?tool=${encodeURIComponent(e)}`,{model:t})}async function lE(e){return Vj("GET",`/api/tool/models?tool=${encodeURIComponent(e)}`)}async function cE(e,t){return Vj("GET",`/api/tool/skills${t?`?tool=${encodeURIComponent(e)}&projectId=${encodeURIComponent(t)}`:`?tool=${encodeURIComponent(e)}`}`)}async function uE(){return Vj("GET","/api/plugins")}async function dE(e){return Vj("POST","/api/plugins/install",{downloadUrl:e})}async function pE(e){await Vj("DELETE",`/api/plugins/${e}`)}async function fE(e,t){return Vj("PUT",`/api/plugins/${e}/config`,t)}async function hE(e,t){await Vj("PUT",`/api/plugins/${e}/enabled`,{enabled:t})}async function mE(e){return Vj("GET",`/api/approval/${encodeURIComponent(e)}/pending`)}async function gE(e,t,n,r){return Vj("POST",`/api/approval/${encodeURIComponent(e)}/${encodeURIComponent(t)}/decide`,{behavior:n,message:r})}async function vE(){return Vj("GET","/api/sync/config")}async function yE(e){return Vj("PUT","/api/sync/config",e)}async function bE(){return Vj("POST","/api/sync/test")}async function xE(e,t){return Vj("POST",`/api/sync/project/${encodeURIComponent(e)}`,t?{direction:t}:{})}async function wE(){return Vj("POST","/api/sync/all")}async function kE(e){return Vj("POST",`/api/sync/cancel/${encodeURIComponent(e)}`)}async function SE(){return Vj("POST","/api/sync/cancel-all")}async function jE(e=!1){return(await Vj("GET","/api/sync/project-status"+(e?"?dirty=1":""))).items}async function CE(e){return Vj("GET",`/api/sync/project/${encodeURIComponent(e)}/settings`)}async function EE(e,t){return Vj("PUT",`/api/sync/project/${encodeURIComponent(e)}/settings`,t)}async function PE(e){return Vj("GET",`/api/projects/${encodeURIComponent(e)}/cli-prompt-state`)}async function _E(e,t){return Vj("POST",`/api/projects/${encodeURIComponent(e)}/cli-prompt-respond`,{digit:t})}const NE=Object.freeze(Object.defineProperty({__proto__:null,archiveProject:Zj,browseFilesystem:LC,cancelSyncAll:SE,cancelSyncProject:kE,checkRunningProjects:async function(){return Vj("GET","/api/update/check-running")},checkVersion:VC,clearHubToken:CC,clearToken:zj,createFolder:IC,createGlobalPrompt:pC,createGlobalShortcut:rC,createProject:Yj,createProjectPrompt:gC,createProjectShortcut:iC,decideApproval:gE,deleteGlobalPrompt:hC,deleteGlobalShortcut:aC,deletePath:zC,deleteProject:Qj,deleteProjectPrompt:yC,deleteProjectShortcut:cC,executeUpdate:BC,getAllUsers:Gj,getChangelog:UC,getChatHistory:tE,getClaudeMemStatus:TC,getClaudeModel:async function(){return Vj("GET","/api/claude/model")},getClaudeSkills:async function(){return Vj("GET","/api/claude/skills")},getCliPromptState:PE,getDocText:AC,getGitDiff:XC,getGitLog:ZC,getGitStatus:YC,getGlobalPrompts:dC,getGlobalShortcuts:nC,getHostStats:NC,getHubAuthStatus:SC,getHubItems:kC,getInstalledPlugins:uE,getLanguagePref:HC,getLocalToken:Wj,getMemoryPrompts:bC,getNotifyConfig:GC,getPendingApprovals:mE,getProjectDiskSize:nE,getProjectOrder:Hj,getProjectPrompts:mC,getProjectShortcuts:sC,getProjectSyncSettings:CE,getProjects:async function(){return Vj("GET","/api/projects")},getProjectsActivity:async function(e){return Vj("GET","/api/projects/activity",void 0,!0,e)},getRawFileUrl:OC,getScheduledTasks:rE,getSessionsBackupStatus:oE,getSyncConfig:vE,getSyncProjectStatus:jE,getSyncStatus:async function(){return Vj("GET","/api/sync/status")},getToken:$j,getToolModel:sE,getToolModels:lE,getToolSkills:cE,getUpdateStatus:WC,getUsage:PC,getWorkspace:async function(){return(await Vj("GET","/api/projects/workspace")).workspace},gitAdd:QC,gitCommit:JC,installPlugin:dE,isLocalAccess:Bj,listClaudeMemObservations:MC,listClaudeMemProjects:RC,login:Uj,markProjectShortcutUsed:uC,openProject:Xj,prepareForUpdate:async function(){return Vj("POST","/api/update/prepare")},readFile:FC,refreshUsage:_C,renameProject:eE,resetSyncConfig:async function(){return Vj("POST","/api/sync/reset")},respondCliPrompt:_E,setHubToken:jC,setLanguagePref:qC,setPluginEnabled:hE,setProjectOrder:qj,setToken:function(e){var t;t=e,Oj.getState().setToken(t)},setToolModel:iE,startProject:Jj,stopProject:async function(e){return Vj("PATCH",`/api/projects/${e}/stop`)},submitToHub:EC,switchProjectCliTool:eC,syncAll:wE,syncProjectOnce:xE,testSyncConnection:bE,toggleMemoryInClaudeMd:xC,togglePromptInClaudeMd:wC,triggerSessionsBackup:aE,unarchiveProject:tC,uninstallPlugin:pE,updateGlobalPrompt:fC,updateGlobalShortcut:oC,updateNotifyConfig:KC,updatePlugin:async function(e,t){return Vj("POST",`/api/plugins/${e}/update`,{downloadUrl:t})},updatePluginConfig:fE,updateProjectPrompt:vC,updateProjectShares:Kj,updateProjectShortcut:lC,updateProjectSyncSettings:EE,updateProjectTags:async function(e,t){return Vj("PATCH",`/api/projects/${e}/tags`,{tags:t})},updateSyncConfig:yE,uploadFiles:DC,writeFile:$C},Symbol.toStringTag,{value:"Module"})),TE={fast:{duration:.15,ease:"easeOut"},default:{duration:.2,ease:"easeOut"},slow:{duration:.3,ease:"easeInOut"}};function RE(){const e=cp(),t=Oj(e=>e.setToken),[n,r]=W.useState(""),[o,a]=W.useState(""),[s,i]=W.useState(null),[l,c]=W.useState(!1);W.useEffect(()=>{if(!Bj())return;let n=!1;return(async()=>{try{const r=await Wj();n||(t(r),e("/",{replace:!0}))}catch{}})(),()=>{n=!0}},[e,t]);return ee.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:ee.jsx(tS.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:TE.slow,className:"w-full max-w-sm",children:ee.jsxs(QS,{children:[ee.jsxs(JS,{className:"text-center",children:[ee.jsx(ZS,{className:"text-2xl",children:"CC Web"}),ee.jsx(ej,{children:Bj()?"Connecting locally...":"Sign in to manage your projects"})]}),ee.jsxs("form",{onSubmit:r=>{(async r=>{r.preventDefault(),i(null),c(!0);try{const r=await Uj(n,o);t(r),e("/")}catch(a){i(a instanceof Error?a.message:"Login failed")}finally{c(!1)}})(r)},children:[ee.jsxs(tj,{className:"space-y-4",children:[ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(jj,{htmlFor:"username",children:"Username"}),ee.jsx(bj,{id:"username",type:"text",autoComplete:"username",value:n,onChange:e=>r(e.target.value),required:!0,autoFocus:!0})]}),ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(jj,{htmlFor:"password",children:"Password"}),ee.jsx(bj,{id:"password",type:"password",autoComplete:"current-password",value:o,onChange:e=>a(e.target.value),required:!0})]}),ee.jsx(Iw,{children:s&&ee.jsx(tS.p,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:-8},transition:TE.default,className:"text-sm text-destructive",children:s})})]}),ee.jsx(nj,{children:ee.jsx(tS.div,{className:"w-full",whileTap:{scale:.98},children:ee.jsx(yj,{type:"submit",className:"w-full",disabled:l,children:l?"Signing in...":"Sign In"})})})]})]})})})}
63
+ */function Cp(e){return void 0===e&&(e=""),new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}new Promise(()=>{});try{window.__reactRouterVersion="6"}catch(LO){}const Ep=q.startTransition;function Pp(e){let{basename:t,children:n,future:r,window:o}=e,a=W.useRef();null==a.current&&(a.current=vd({window:o,v5Compat:!0}));let s=a.current,[i,l]=W.useState({action:s.action,location:s.location}),{v7_startTransition:c}=r||{},u=W.useCallback(e=>{c&&Ep?Ep(()=>l(e)):l(e)},[l,c]);return W.useLayoutEffect(()=>s.listen(u),[s,u]),W.useEffect(()=>{return null==(e=r)||e.v7_startTransition,void(null==e||e.v7_relativeSplatPath);var e},[r]),W.createElement(kp,{basename:t,children:n,location:i.location,navigationType:i.action,navigator:s,future:r})}var _p,Np,Tp,Rp;function Mp(e){let t=W.useRef(Cp(e)),n=W.useRef(!1),r=ip(),o=W.useMemo(()=>function(e,t){let n=Cp(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}(r.search,n.current?null:t.current),[r.search]),a=cp(),s=W.useCallback((e,t)=>{const r=Cp("function"==typeof e?e(o):e);n.current=!0,a("?"+r,t)},[a,o]);return[o,s]}(Np=_p||(_p={})).UseScrollRestoration="useScrollRestoration",Np.UseSubmit="useSubmit",Np.UseSubmitFetcher="useSubmitFetcher",Np.UseFetcher="useFetcher",Np.useViewTransitionState="useViewTransitionState",(Rp=Tp||(Tp={})).UseFetcher="useFetcher",Rp.UseFetchers="useFetchers",Rp.UseScrollRestoration="useScrollRestoration";const Lp=e=>"string"==typeof e,Op=()=>{let e,t;const n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},Ap=e=>null==e?"":String(e),Dp=/###/g,Ip=e=>e&&e.includes("###")?e.replace(Dp,"."):e,Fp=e=>!e||Lp(e),$p=(e,t,n)=>{const r=Lp(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(Fp(e))return{};const t=Ip(r[o]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++o}return Fp(e)?{}:{obj:e,k:Ip(r[o])}},zp=(e,t,n)=>{const{obj:r,k:o}=$p(e,t,Object);if(void 0!==r||1===t.length)return void(r[o]=n);let a=t[t.length-1],s=t.slice(0,t.length-1),i=$p(e,s,Object);for(;void 0===i.obj&&s.length;)a=`${s[s.length-1]}.${a}`,s=s.slice(0,s.length-1),i=$p(e,s,Object),(null==i?void 0:i.obj)&&void 0!==i.obj[`${i.k}.${a}`]&&(i.obj=void 0);i.obj[`${i.k}.${a}`]=n},Vp=(e,t)=>{const{obj:n,k:r}=$p(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},Up=(e,t,n)=>{for(const r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?Lp(e[r])||e[r]instanceof String||Lp(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Up(e[r],t[r],n):e[r]=t[r]);return e},Bp=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),Wp={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},Hp=e=>Lp(e)?e.replace(/[&<>"'\/]/g,e=>Wp[e]):e;const qp=[" ",",","?","!",";"],Gp=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}(20),Kp=(e,t,n=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const r=t.split(n);let o=e;for(let a=0;a<r.length;){if(!o||"object"!=typeof o)return;let e,t="";for(let s=a;s<r.length;++s)if(s!==a&&(t+=n),t+=r[s],e=o[t],void 0!==e){if(["string","number","boolean"].includes(typeof e)&&s<r.length-1)continue;a+=s-a+1;break}o=e}return o},Yp=e=>null==e?void 0:e.replace(/_/g,"-"),Xp={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){var n,r;null==(r=null==(n=null==console?void 0:console[e])?void 0:n.apply)||r.call(n,console,t)}};class Qp{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||Xp,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,r){return r&&!this.debug?null:(e=e.map(e=>Lp(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g," "):e),Lp(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Qp(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new Qp(this.logger,e)}}var Jp=new Qp;class Zp{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}once(e,t){const n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}emit(e,...t){if(this.observers[e]){Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(([n,r])=>{for(let o=0;o<r;o++)n(e,...t)})}}}class ef extends Zp{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){var o,a;const s=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;e.includes(".")?l=e.split("."):(l=[e,t],n&&(Array.isArray(n)?l.push(...n):Lp(n)&&s?l.push(...n.split(s)):l.push(n)));const c=Vp(this.data,l);return c||t||n||!e.includes(".")||(e=l[0],t=l[1],n=l.slice(2).join(".")),!c&&i&&Lp(n)?Kp(null==(a=null==(o=this.data)?void 0:o[e])?void 0:a[t],n,s):c}addResource(e,t,n,r,o={silent:!1}){const a=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator;let s=[e,t];n&&(s=s.concat(a?n.split(a):n)),e.includes(".")&&(s=e.split("."),r=t,t=s[1]),this.addNamespaces(t),zp(this.data,s,r),o.silent||this.emit("added",e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(const o in n)(Lp(n[o])||Array.isArray(n[o]))&&this.addResource(e,t,o,n[o],{silent:!0});r.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,r,o,a={silent:!1,skipCopy:!1}){let s=[e,t];e.includes(".")&&(s=e.split("."),r=n,n=t,t=s[1]),this.addNamespaces(t);let i=Vp(this.data,s)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?Up(i,n,o):i={...i,...n},zp(this.data,s,i),a.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var tf={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,o){return e.forEach(e=>{var a;t=(null==(a=this.processors[e])?void 0:a.process(t,n,r,o))??t}),t}};const nf=Symbol("i18next/PATH_KEY");function rf(e,t){const{[nf]:n}=e(function(){const e=[],t=Object.create(null);let n;return t.get=(r,o)=>{var a;return null==(a=null==n?void 0:n.revoke)||a.call(n),o===nf?e:(e.push(o),n=Proxy.revocable(r,t),n.proxy)},Proxy.revocable(Object.create(null),t).proxy}()),r=(null==t?void 0:t.keySeparator)??".",o=(null==t?void 0:t.nsSeparator)??":";if(n.length>1&&o){const e=null==t?void 0:t.ns,a=Array.isArray(e)?e:null;if(a&&a.length>1&&a.slice(1).includes(n[0]))return`${n[0]}${o}${n.slice(1).join(r)}`}return n.join(r)}const of=e=>!Lp(e)&&"boolean"!=typeof e&&"number"!=typeof e;class af extends Zp{constructor(e,t={}){super(),((e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=Jp.create("translator"),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const n={...t};if(null==e)return!1;const r=this.resolve(e,n);if(void 0===(null==r?void 0:r.res))return!1;const o=of(r.res);return!1!==n.returnObjects||!o}extractFromKey(e,t){let n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");const r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let o=t.ns||this.options.defaultNS||[];const a=n&&e.includes(n),s=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,n)=>{t=t||"",n=n||"";const r=qp.filter(e=>!t.includes(e)&&!n.includes(e));if(0===r.length)return!0;const o=Gp.getRegExp(`(${r.map(e=>"?"===e?"\\?":e).join("|")})`);let a=!o.test(e);if(!a){const t=e.indexOf(n);t>0&&!o.test(e.substring(0,t))&&(a=!0)}return a})(e,n,r));if(a&&!s){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:Lp(o)?[o]:o};const a=e.split(n);(n!==r||n===r&&this.options.ns.includes(a[0]))&&(o=a.shift()),e=a.join(r)}return{key:e,namespaces:Lp(o)?[o]:o}}translate(e,t,n){let r="object"==typeof t?{...t}:t;if("object"!=typeof r&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof r&&(r={...r}),r||(r={}),null==e)return"";"function"==typeof e&&(e=rf(e,{...this.options,...r})),Array.isArray(e)||(e=[String(e)]),e=e.map(e=>"function"==typeof e?rf(e,{...this.options,...r}):String(e));const o=void 0!==r.returnDetails?r.returnDetails:this.options.returnDetails,a=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,{key:s,namespaces:i}=this.extractFromKey(e[e.length-1],r),l=i[i.length-1];let c=void 0!==r.nsSeparator?r.nsSeparator:this.options.nsSeparator;void 0===c&&(c=":");const u=r.lng||this.language,d=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===(null==u?void 0:u.toLowerCase()))return d?o?{res:`${l}${c}${s}`,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:`${l}${c}${s}`:o?{res:s,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:s;const p=this.resolve(e,r);let f=null==p?void 0:p.res;const h=(null==p?void 0:p.usedKey)||s,m=(null==p?void 0:p.exactUsedKey)||s,g=void 0!==r.joinArrays?r.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,y=void 0!==r.count&&!Lp(r.count),b=af.hasDefaultValue(r),x=y?this.pluralResolver.getSuffix(u,r.count,r):"",w=r.ordinal&&y?this.pluralResolver.getSuffix(u,r.count,{ordinal:!1}):"",k=y&&!r.ordinal&&0===r.count,S=k&&r[`defaultValue${this.options.pluralSeparator}zero`]||r[`defaultValue${x}`]||r[`defaultValue${w}`]||r.defaultValue;let j=f;v&&!f&&b&&(j=S);const C=of(j),E=Object.prototype.toString.apply(j);if(!(v&&j&&C)||["[object Number]","[object Function]","[object RegExp]"].includes(E)||Lp(g)&&Array.isArray(j))if(v&&Lp(g)&&Array.isArray(f))f=f.join(g),f&&(f=this.extendTranslation(f,e,r,n));else{let t=!1,o=!1;!this.isValidLookup(f)&&b&&(t=!0,f=S),this.isValidLookup(f)||(o=!0,f=s);const i=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&o?void 0:f,d=b&&S!==f&&this.options.updateMissing;if(o||t||d){if(this.logger.log(d?"updateKey":"missingKey",u,l,s,d?S:f),a){const e=this.resolve(s,{...r,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let r=0;r<t.length;r++)e.push(t[r]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(r.lng||this.language):e.push(r.lng||this.language);const n=(e,t,n)=>{var o;const a=b&&n!==f?n:i;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,a,d,r):(null==(o=this.backendConnector)?void 0:o.saveMissing)&&this.backendConnector.saveMissing(e,l,t,a,d,r),this.emit("missingKey",e,l,t,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&y?e.forEach(e=>{const t=this.pluralResolver.getSuffixes(e,r);k&&r[`defaultValue${this.options.pluralSeparator}zero`]&&!t.includes(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,r[`defaultValue${t}`]||S)})}):n(e,s,S))}f=this.extendTranslation(f,e,r,p,n),o&&f===s&&this.options.appendNamespaceToMissingKey&&(f=`${l}${c}${s}`),(o||t)&&this.options.parseMissingKeyHandler&&(f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${c}${s}`:s,t?f:void 0,r))}else{if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,j,{...r,ns:i}):`key '${s} (${this.language})' returned an object instead of string.`;return o?(p.res=e,p.usedParams=this.getUsedParamsDetails(r),p):e}if(a){const e=Array.isArray(j),t=e?[]:{},n=e?m:h;for(const o in j)if(Object.prototype.hasOwnProperty.call(j,o)){const e=`${n}${a}${o}`;t[o]=b&&!f?this.translate(e,{...r,defaultValue:of(S)?S[o]:void 0,joinArrays:!1,ns:i}):this.translate(e,{...r,joinArrays:!1,ns:i}),t[o]===e&&(t[o]=j[o])}f=t}}return o?(p.res=f,p.usedParams=this.getUsedParamsDetails(r),p):f}extendTranslation(e,t,n,r,o){var a,s;if(null==(a=this.i18nFormat)?void 0:a.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const a=Lp(e)&&(void 0!==(null==(s=null==n?void 0:n.interpolation)?void 0:s.skipOnVariables)?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let i;if(a){const t=e.match(this.interpolator.nestingRegexp);i=t&&t.length}let l=n.replace&&!Lp(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,n.lng||this.language||r.usedLng,n),a){const t=e.match(this.interpolator.nestingRegexp);i<(t&&t.length)&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,(...e)=>(null==o?void 0:o[0])!==e[0]||n.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),n)),n.interpolation&&this.interpolator.reset()}const i=n.postProcess||this.options.postProcess,l=Lp(i)?[i]:i;return null!=e&&(null==l?void 0:l.length)&&!1!==n.applyPostProcessor&&(e=tf.handle(l,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,o,a,s;return Lp(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>"function"==typeof e?rf(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;const i=this.extractFromKey(e,t),l=i.key;r=l;let c=i.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const u=void 0!==t.count&&!Lp(t.count),d=u&&!t.ordinal&&0===t.count,p=void 0!==t.context&&(Lp(t.context)||"number"==typeof t.context)&&""!==t.context,f=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);c.forEach(e=>{var i,c;this.isValidLookup(n)||(s=e,this.checkedLoadedFor[`${f[0]}-${e}`]||!(null==(i=this.utils)?void 0:i.hasLoadedNamespace)||(null==(c=this.utils)?void 0:c.hasLoadedNamespace(s))||(this.checkedLoadedFor[`${f[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${f.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),f.forEach(r=>{var s;if(this.isValidLookup(n))return;a=r;const i=[l];if(null==(s=this.i18nFormat)?void 0:s.addLookupKeys)this.i18nFormat.addLookupKeys(i,l,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));const n=`${this.options.pluralSeparator}zero`,o=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.startsWith(o)&&i.push(l+e.replace(o,this.options.pluralSeparator)),i.push(l+e),d&&i.push(l+n)),p){const r=`${l}${this.options.contextSeparator||"_"}${t.context}`;i.push(r),u&&(t.ordinal&&e.startsWith(o)&&i.push(r+e.replace(o,this.options.pluralSeparator)),i.push(r+e),d&&i.push(r+n))}}let c;for(;c=i.pop();)this.isValidLookup(n)||(o=c,n=this.getResource(r,e,c,t))}))})}),{res:n,usedKey:r,exactUsedKey:o,usedLng:a,usedNS:s}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,n,r={}){var o;return(null==(o=this.i18nFormat)?void 0:o.getResource)?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!Lp(e.replace);let r=n?e.replace:e;if(n&&void 0!==e.count&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(const e of t)delete r[e]}return r}static hasDefaultValue(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.startsWith("defaultValue")&&void 0!==e[t])return!0;return!1}}class sf{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Jp.create("languageUtils")}getScriptPartFromCode(e){if(!(e=Yp(e))||!e.includes("-"))return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=Yp(e))||!e.includes("-"))return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(Lp(e)&&e.includes("-")){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(LO){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const n=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(n)||(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;const r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>e===r||!(!e.includes("-")&&!r.includes("-"))&&(!(!e.includes("-")||r.includes("-")||e.slice(0,e.indexOf("-"))!==r)||!!(e.startsWith(r)&&r.length>1)))}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),Lp(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){const n=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),r=[],o=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return Lp(e)&&(e.includes("-")||e.includes("_"))?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):Lp(e)&&o(this.formatLanguageCode(e)),n.forEach(e=>{r.includes(e)||o(this.formatLanguageCode(e))}),r}}const lf={zero:0,one:1,two:2,few:3,many:4,other:5},cf={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class uf{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=Jp.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const n=Yp("dev"===e?"en":e),r=t.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:n,type:r});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let a;try{a=new Intl.PluralRules(n,{type:r})}catch(s){if("undefined"==typeof Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),cf;if(!e.match(/-|_/))return cf;const n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[o]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),(null==n?void 0:n.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),n?n.resolvedOptions().pluralCategories.sort((e,t)=>lf[e]-lf[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,n={}){const r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,n))}}const df=(e,t,n,r=".",o=!0)=>{let a=((e,t,n)=>{const r=Vp(e,n);return void 0!==r?r:Vp(t,n)})(e,t,n);return!a&&o&&Lp(n)&&(a=Kp(e,n,r),void 0===a&&(a=Kp(t,n,r))),a},pf=e=>e.replace(/\$/g,"$$$$");class ff{constructor(e={}){var t;this.logger=Jp.create("interpolator"),this.options=e,this.format=(null==(t=null==e?void 0:e.interpolation)?void 0:t.format)||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:o,prefixEscaped:a,suffix:s,suffixEscaped:i,formatSeparator:l,unescapeSuffix:c,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:p,nestingSuffix:f,nestingSuffixEscaped:h,nestingOptionsSeparator:m,maxReplaces:g,alwaysFormat:v}=e.interpolation;this.escape=void 0!==t?t:Hp,this.escapeValue=void 0===n||n,this.useRawValueToEscape=void 0!==r&&r,this.prefix=o?Bp(o):a||"{{",this.suffix=s?Bp(s):i||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":u?Bp(u):"-",this.unescapeSuffix=this.unescapePrefix?"":c?Bp(c):"",this.nestingPrefix=d?Bp(d):p||Bp("$t("),this.nestingSuffix=f?Bp(f):h||Bp(")"),this.nestingOptionsSeparator=m||",",this.maxReplaces=g||1e3,this.alwaysFormat=void 0!==v&&v,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>(null==e?void 0:e.source)===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){var o;let a,s,i;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(!e.includes(this.formatSeparator)){const o=df(t,l,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(o,void 0,n,{...r,...t,interpolationkey:e}):o}const o=e.split(this.formatSeparator),a=o.shift().trim(),s=o.join(this.formatSeparator).trim();return this.format(df(t,l,a,this.options.keySeparator,this.options.ignoreJSONStructure),s,n,{...r,...t,interpolationkey:a})};this.resetRegExp(),!this.escapeValue&&"string"==typeof e&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");const u=(null==r?void 0:r.missingInterpolationHandler)||this.options.missingInterpolationHandler,d=void 0!==(null==(o=null==r?void 0:r.interpolation)?void 0:o.skipOnVariables)?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>pf(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?pf(this.escape(e)):pf(e)}].forEach(t=>{for(i=0;a=t.regex.exec(e);){const n=a[1].trim();if(s=c(n),void 0===s)if("function"==typeof u){const t=u(e,a,r);s=Lp(t)?t:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))s="";else{if(d){s=a[0];continue}this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),s=""}else Lp(s)||this.useRawValueToEscape||(s=Ap(s));const o=t.safeValue(s);if(e=e.replace(a[0],o),d?(t.regex.lastIndex+=s.length,t.regex.lastIndex-=a[0].length):t.regex.lastIndex=0,i++,i>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,o,a;const s=(e,t)=>{const n=this.nestingOptionsSeparator;if(!e.includes(n))return e;const r=e.split(new RegExp(`${Bp(n)}[ ]*{`));let o=`{${r[1]}`;e=r[0],o=this.interpolate(o,a);const s=o.match(/'/g),i=o.match(/"/g);(((null==s?void 0:s.length)??0)%2==0&&!i||((null==i?void 0:i.length)??0)%2!=0)&&(o=o.replace(/'/g,'"'));try{a=JSON.parse(o),t&&(a={...t,...a})}catch(LO){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,LO),`${e}${n}${o}`}return a.defaultValue&&a.defaultValue.includes(this.prefix)&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let i=[];a={...n},a=a.replace&&!Lp(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;const l=/{.*}/.test(r[1])?r[1].lastIndexOf("}")+1:r[1].indexOf(this.formatSeparator);if(-1!==l&&(i=r[1].slice(l).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,l)),o=t(s.call(this,r[1].trim(),a),a),o&&r[0]===e&&!Lp(o))return o;Lp(o)||(o=Ap(o)),o||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),o=""),i.length&&(o=i.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),o.trim())),e=e.replace(r[0],o),this.regexp.lastIndex=0}return e}}const hf=e=>{const t={};return(n,r,o)=>{let a=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(a={...a,[o.interpolationkey]:void 0});const s=r+JSON.stringify(a);let i=t[s];return i||(i=e(Yp(r),o),t[s]=i),i(n)}},mf=e=>(t,n,r)=>e(Yp(n),r)(t);class gf{constructor(e={}){this.logger=Jp.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const n=t.cacheInBuiltFormats?hf:mf;this.formats={number:n((e,t)=>{const n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{const n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)}),datetime:n((e,t)=>{const n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{const n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")}),list:n((e,t)=>{const n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=hf(t)}format(e,t,n,r={}){if(!t)return e;if(null==e)return e;const o=t.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&!o[0].includes(")")&&o.find(e=>e.includes(")"))){const e=o.findIndex(e=>e.includes(")"));o[0]=[o[0],...o.splice(1,e)].join(this.formatSeparator)}return o.reduce((e,t)=>{var o;const{formatName:a,formatOptions:s}=(e=>{let t=e.toLowerCase().trim();const n={};if(e.includes("(")){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].slice(0,-1);"currency"!==t||o.includes(":")?"relativetime"!==t||o.includes(":")?o.split(";").forEach(e=>{if(e){const[t,...r]=e.split(":"),o=r.join(":").trim().replace(/^'+|'+$/g,""),a=t.trim();n[a]||(n[a]=o),"false"===o&&(n[a]=!1),"true"===o&&(n[a]=!0),isNaN(o)||(n[a]=parseInt(o,10))}}):n.range||(n.range=o.trim()):n.currency||(n.currency=o.trim())}return{formatName:t,formatOptions:n}})(t);if(this.formats[a]){let t=e;try{const i=(null==(o=null==r?void 0:r.formatParams)?void 0:o[r.interpolationkey])||{},l=i.locale||i.lng||r.locale||r.lng||n;t=this.formats[a](e,l,{...s,...r,...i})}catch(i){this.logger.warn(i)}return t}return this.logger.warn(`there was no format function for ${a}`),e},e)}}class vf extends Zp{constructor(e,t,n,r={}){var o,a;super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=Jp.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],null==(a=null==(o=this.backend)?void 0:o.init)||a.call(o,n,r.backend,r)}queueLoad(e,t,n,r){const o={},a={},s={},i={};return e.forEach(e=>{let r=!0;t.forEach(t=>{const s=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[s]=2:this.state[s]<0||(1===this.state[s]?void 0===a[s]&&(a[s]=!0):(this.state[s]=1,r=!1,void 0===a[s]&&(a[s]=!0),void 0===o[s]&&(o[s]=!0),void 0===i[t]&&(i[t]=!0)))}),r||(s[e]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(i)}}loaded(e,t,n){const r=e.split("|"),o=r[0],a=r[1];t&&this.emit("failedLoading",o,a,t),!t&&n&&this.store.addResourceBundle(o,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);const s={};this.queue.forEach(n=>{((e,t,n)=>{const{obj:r,k:o}=$p(e,t,Object);r[o]=r[o]||[],r[o].push(n)})(n.loaded,[o],a),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach(e=>{s[e]||(s[e]={});const t=n.loaded[e];t.length&&t.forEach(t=>{void 0===s[e][t]&&(s[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,o=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:o,callback:a});this.readingCalls++;const s=(s,i)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}s&&i&&r<this.maxRetries?setTimeout(()=>{this.read(e,t,n,r+1,2*o,a)},o):a(s,i)},i=this.backend[n].bind(this.backend);if(2!==i.length)return i(e,t,s);try{const n=i(e,t);n&&"function"==typeof n.then?n.then(e=>s(null,e)).catch(s):s(null,n)}catch(l){s(l)}}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();Lp(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Lp(t)&&(t=[t]);const o=this.queueLoad(e,t,n,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=""){const n=e.split("|"),r=n[0],o=n[1];this.read(r,o,"read",void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${o} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${o} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,o,a={},s=()=>{}){var i,l,c,u,d;if(!(null==(l=null==(i=this.services)?void 0:i.utils)?void 0:l.hasLoadedNamespace)||(null==(u=null==(c=this.services)?void 0:c.utils)?void 0:u.hasLoadedNamespace(t))){if(null!=n&&""!==n){if(null==(d=this.backend)?void 0:d.create){const i={...a,isUpdate:o},l=this.backend.create.bind(this.backend);if(l.length<6)try{let o;o=5===l.length?l(e,t,n,r,i):l(e,t,n,r),o&&"function"==typeof o.then?o.then(e=>s(null,e)).catch(s):s(null,o)}catch(p){s(p)}else l(e,t,n,r,s,i)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}else this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}}const yf=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),Lp(e[1])&&(t.defaultValue=e[1]),Lp(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),bf=e=>(Lp(e.ns)&&(e.ns=[e.ns]),Lp(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Lp(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes("cimode")&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),xf=()=>{};class wf extends Zp{constructor(e={},t){var n;if(super(),this.options=bf(e),this.services={},this.logger=Jp,this.modules={external:[]},n=this,Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(e=>{"function"==typeof n[e]&&(n[e]=n[e].bind(n))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,"function"==typeof e&&(t=e,e={}),null==e.defaultNS&&e.ns&&(Lp(e.ns)?e.defaultNS=e.ns:e.ns.includes("translation")||(e.defaultNS=e.ns[0]));const n=yf();this.options={...n,...this.options,...bf(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator),"function"!=typeof this.options.overloadTranslationOptionHandler&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);const r=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?Jp.init(r(this.modules.logger),this.options):Jp.init(null,this.options),e=this.modules.formatter?this.modules.formatter:gf;const t=new sf(this.options);this.store=new ef(this.options.resources,this.options);const n=this.services;n.logger=Jp,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new uf(t,{prepend:this.options.pluralSeparator}),e&&(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new ff(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new vf(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new af(this.services,this.options),this.translator.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=xf),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=(...t)=>this.store[e](...t)});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});const o=Op(),a=()=>{const e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),o.resolve(n),t(e,n)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),o}loadResources(e,t=xf){var n,r;let o=t;const a=Lp(e)?e:this.language;if("function"==typeof e&&(o=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===(null==a?void 0:a.toLowerCase())&&(!this.options.preload||0===this.options.preload.length))return o();const e=[],t=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&(e.includes(t)||e.push(t))})};if(a)t(a);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e))}null==(r=null==(n=this.options.preload)?void 0:n.forEach)||r.call(n,e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),o(e)})}else o(null)}reloadResources(e,t,n){const r=Op();return"function"==typeof e&&(n=e,e=void 0),"function"==typeof t&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=xf),this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&tf.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!["cimode","dev"].includes(e)){for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!["cimode","dev"].includes(t)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}this.resolvedLanguage||this.languages.includes(e)||!this.store.hasLanguageSomeTranslations(e)||(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const n=Op();this.emit("languageChanging",e);const r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},o=(o,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit("languageChanged",a),this.logger.log("languageChanged",a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(o,(...e)=>this.t(...e))},a=t=>{var n,a;e||t||!this.services.languageDetector||(t=[]);const s=Lp(t)?t:t&&t[0],i=this.store.hasLanguageSomeTranslations(s)?s:this.services.languageUtils.getBestMatchFromCodes(Lp(t)?[t]:t);i&&(this.language||r(i),this.translator.language||this.translator.changeLanguage(i),null==(a=null==(n=this.services.languageDetector)?void 0:n.cacheUserLanguage)||a.call(n,i)),this.loadResources(i,e=>{o(e,i)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e):a(this.services.languageDetector.detect()),n}getFixedT(e,t,n){const r=(e,t,...o)=>{let a;a="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(o)):{...t},a.lng=a.lng||r.lng,a.lngs=a.lngs||r.lngs,a.ns=a.ns||r.ns,""!==a.keyPrefix&&(a.keyPrefix=a.keyPrefix||n||r.keyPrefix);const s={...this.options,...a};"function"==typeof a.keyPrefix&&(a.keyPrefix=rf(a.keyPrefix,s));const i=this.options.keySeparator||".";let l;return a.keyPrefix&&Array.isArray(e)?l=e.map(e=>("function"==typeof e&&(e=rf(e,s)),`${a.keyPrefix}${i}${e}`)):("function"==typeof e&&(e=rf(e,s)),l=a.keyPrefix?`${a.keyPrefix}${i}${e}`:e),this.t(l,a)};return Lp(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}t(...e){var t;return null==(t=this.translator)?void 0:t.translate(...e)}exists(...e){var t;return null==(t=this.translator)?void 0:t.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=t.lng||this.resolvedLanguage||this.languages[0],r=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;const a=(e,t)=>{const n=this.services.backendConnector.state[`${e}|${t}`];return-1===n||0===n||2===n};if(t.precheck){const e=t.precheck(this,a);if(void 0!==e)return e}return!!this.hasResourceBundle(n,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!a(n,e)||r&&!a(o,e)))}loadNamespaces(e,t){const n=Op();return this.options.ns?(Lp(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){const n=Op();Lp(e)&&(e=[e]);const r=this.options.preload||[],o=e.filter(e=>!r.includes(e)&&this.services.languageUtils.isSupportedCode(e));return o.length?(this.options.preload=r.concat(o),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){var t,n;if(e||(e=this.resolvedLanguage||((null==(t=this.languages)?void 0:t.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const t=new Intl.Locale(e);if(t&&t.getTextInfo){const e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch(LO){}const r=(null==(n=this.services)?void 0:n.languageUtils)||new sf(yf());return e.toLowerCase().indexOf("-latn")>1?"ltr":["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].includes(r.getLanguagePartFromCode(e))||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){const n=new wf(e,t);return n.createInstance=wf.createInstance,n}cloneInstance(e={},t=xf){const n=e.forkResourceStore;n&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},o=new wf(r);void 0===e.debug&&void 0===e.prefix||(o.logger=o.logger.clone(e));if(["store","services","language"].forEach(e=>{o[e]=this[e]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},n){const e=Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{});o.store=new ef(e,r),o.services.resourceStore=o.store}if(e.interpolation){const t={...yf().interpolation,...this.options.interpolation,...e.interpolation},n={...r,interpolation:t};o.services.interpolator=new ff(n)}return o.translator=new af(o.services,r),o.translator.on("*",(e,...t)=>{o.emit(e,...t)}),o.init(r,t),o.translator.options=r,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const kf=wf.createInstance();kf.createInstance,kf.dir,kf.init,kf.loadResources,kf.reloadResources,kf.use,kf.changeLanguage,kf.getFixedT,kf.t,kf.exists,kf.setDefaultNamespace,kf.hasLoadedNamespace,kf.loadNamespaces,kf.loadLanguages;const Sf={},jf=(e,t,n,r)=>{_f(n)&&Sf[n]||(_f(n)&&(Sf[n]=new Date),((e,t,n,r)=>{var o,a,s,i;const l=[n,{code:t,...r||{}}];if(null==(a=null==(o=null==e?void 0:e.services)?void 0:o.logger)?void 0:a.forward)return e.services.logger.forward(l,"warn","react-i18next::",!0);_f(l[0])&&(l[0]=`react-i18next:: ${l[0]}`),(null==(i=null==(s=null==e?void 0:e.services)?void 0:s.logger)?void 0:i.warn)?e.services.logger.warn(...l):(null==console?void 0:console.warn)&&console.warn(...l)})(e,t,n,r))},Cf=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},Ef=(e,t,n)=>{e.loadNamespaces(t,Cf(e,n))},Pf=(e,t,n,r)=>{if(_f(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Ef(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,Cf(e,r))},_f=e=>"string"==typeof e,Nf=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Tf={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Rf=e=>Tf[e];let Mf={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(Nf,Rf),transDefaultProps:void 0};let Lf;const Of={type:"3rdParty",init(e){((e={})=>{Mf={...Mf,...e}})(e.options.react),(e=>{Lf=e})(e)}},Af=W.createContext();class Df{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var If={exports:{}},Ff={},$f=W;var zf="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Vf=$f.useState,Uf=$f.useEffect,Bf=$f.useLayoutEffect,Wf=$f.useDebugValue;function Hf(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!zf(e,n)}catch(r){return!0}}var qf="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=Vf({inst:{value:n,getSnapshot:t}}),o=r[0].inst,a=r[1];return Bf(function(){o.value=n,o.getSnapshot=t,Hf(o)&&a({inst:o})},[e,n,t]),Uf(function(){return Hf(o)&&a({inst:o}),e(function(){Hf(o)&&a({inst:o})})},[e]),Wf(n),n};Ff.useSyncExternalStore=void 0!==$f.useSyncExternalStore?$f.useSyncExternalStore:qf,If.exports=Ff;var Gf=If.exports;const Kf={t:(e,t)=>{if(_f(t))return t;if("object"==typeof(n=t)&&null!==n&&_f(t.defaultValue))return t.defaultValue;var n;if("function"==typeof e)return"";if(Array.isArray(e)){const t=e[e.length-1];return"function"==typeof t?"":t}return e},ready:!1},Yf=()=>()=>{},Xf=(e,t={})=>{var n,r,o;const{i18n:a}=t,{i18n:s,defaultNS:i}=W.useContext(Af)||{},l=a||s||Lf;l&&!l.reportNamespaces&&(l.reportNamespaces=new Df),l||jf(l,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const c=W.useMemo(()=>{var e;return{...Mf,...null==(e=null==l?void 0:l.options)?void 0:e.react,...t}},[l,t]),{useSuspense:u,keyPrefix:d}=c,p=i||(null==(n=null==l?void 0:l.options)?void 0:n.defaultNS),f=_f(p)?[p]:p||["translation"],h=W.useMemo(()=>f,f);null==(o=null==(r=null==l?void 0:l.reportNamespaces)?void 0:r.addUsedNamespaces)||o.call(r,h);const m=W.useRef(0),g=W.useCallback(e=>{if(!l)return Yf;const{bindI18n:t,bindI18nStore:n}=c,r=()=>{m.current+=1,e()};return t&&l.on(t,r),n&&l.store.on(n,r),()=>{t&&t.split(" ").forEach(e=>l.off(e,r)),n&&n.split(" ").forEach(e=>l.store.off(e,r))}},[l,c]),v=W.useRef(),y=W.useCallback(()=>{if(!l)return Kf;const e=!(!l.isInitialized&&!l.initializedStoreOnce)&&h.every(e=>((e,t,n={})=>t.languages&&t.languages.length?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}):(jf(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0))(e,l,c)),n=t.lng||l.language,r=m.current,o=v.current;if(o&&o.ready===e&&o.lng===n&&o.keyPrefix===d&&o.revision===r)return o;const a={t:l.getFixedT(n,"fallback"===c.nsMode?h:h[0],d),ready:e,lng:n,keyPrefix:d,revision:r};return v.current=a,a},[l,h,d,c,t.lng]),[b,x]=W.useState(0),{t:w,ready:k}=Gf.useSyncExternalStore(g,y,y);W.useEffect(()=>{if(l&&!k&&!u){const e=()=>x(e=>e+1);t.lng?Pf(l,t.lng,h,e):Ef(l,h,e)}},[l,t.lng,h,k,u,b]);const S=l||{},j=W.useRef(null),C=W.useRef(),E=e=>{const t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;const n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,"__original"))try{Object.defineProperty(n,"__original",{value:e,writable:!1,enumerable:!1,configurable:!1})}catch(r){}return n},P=W.useMemo(()=>{const e=S,t=null==e?void 0:e.language;let n=e;e&&(j.current&&j.current.__original===e?C.current!==t?(n=E(e),j.current=n,C.current=t):n=j.current:(n=E(e),j.current=n,C.current=t));const r=k||u?w:(...e)=>(jf(l,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),w(...e)),o=[r,n,k];return o.t=r,o.i18n=n,o.ready=k,o},[w,S,k,S.resolvedLanguage,S.language,S.languages]);if(l&&u&&!k)throw new Promise(e=>{const n=()=>e();t.lng?Pf(l,t.lng,h,n):Ef(l,h,n)});return P},{slice:Qf,forEach:Jf}=[];const Zf=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,eh={create(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/",sameSite:"strict"};n&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+60*n*1e3)),r&&(o.domain=r),document.cookie=function(e,t){const n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{path:"/"};let r=`${e}=${encodeURIComponent(t)}`;if(n.maxAge>0){const e=n.maxAge-0;if(Number.isNaN(e))throw new Error("maxAge should be a Number");r+=`; Max-Age=${Math.floor(e)}`}if(n.domain){if(!Zf.test(n.domain))throw new TypeError("option domain is invalid");r+=`; Domain=${n.domain}`}if(n.path){if(!Zf.test(n.path))throw new TypeError("option path is invalid");r+=`; Path=${n.path}`}if(n.expires){if("function"!=typeof n.expires.toUTCString)throw new TypeError("option expires is invalid");r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+="; HttpOnly"),n.secure&&(r+="; Secure"),n.sameSite)switch("string"==typeof n.sameSite?n.sameSite.toLowerCase():n.sameSite){case!0:r+="; SameSite=Strict";break;case"lax":r+="; SameSite=Lax";break;case"strict":r+="; SameSite=Strict";break;case"none":r+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return n.partitioned&&(r+="; Partitioned"),r}(e,t,o)},read(e){const t=`${e}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let e=n[r];for(;" "===e.charAt(0);)e=e.substring(1,e.length);if(0===e.indexOf(t))return e.substring(t.length,e.length)}return null},remove(e,t){this.create(e,"",-1,t)}};var th={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&"undefined"!=typeof document)return eh.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:o,cookieOptions:a}=t;n&&"undefined"!=typeof document&&eh.create(n,e,r,o,a)}},nh={name:"querystring",lookup(e){var t;let n,{lookupQuerystring:r}=e;if("undefined"!=typeof window){let{search:e}=window.location;!window.location.search&&(null==(t=window.location.hash)?void 0:t.indexOf("?"))>-1&&(e=window.location.hash.substring(window.location.hash.indexOf("?")));const o=e.substring(1).split("&");for(let t=0;t<o.length;t++){const e=o[t].indexOf("=");if(e>0){o[t].substring(0,e)===r&&(n=o[t].substring(e+1))}}}return n}},rh={name:"hash",lookup(e){var t;let n,{lookupHash:r,lookupFromHashIndex:o}=e;if("undefined"!=typeof window){const{hash:e}=window.location;if(e&&e.length>2){const a=e.substring(1);if(r){const e=a.split("&");for(let t=0;t<e.length;t++){const o=e[t].indexOf("=");if(o>0){e[t].substring(0,o)===r&&(n=e[t].substring(o+1))}}}if(n)return n;if(!n&&o>-1){const n=e.match(/\/([a-zA-Z-]*)/g);if(!Array.isArray(n))return;return null==(t=n["number"==typeof o?o:0])?void 0:t.replace("/","")}}}return n}};let oh=null;const ah=()=>{if(null!==oh)return oh;try{if(oh="undefined"!=typeof window&&null!==window.localStorage,!oh)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch(LO){oh=!1}return oh};var sh={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&ah())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&ah()&&window.localStorage.setItem(n,e)}};let ih=null;const lh=()=>{if(null!==ih)return ih;try{if(ih="undefined"!=typeof window&&null!==window.sessionStorage,!ih)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch(LO){ih=!1}return ih};var ch={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&lh())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&lh()&&window.sessionStorage.setItem(n,e)}},uh={name:"navigator",lookup(e){const t=[];if("undefined"!=typeof navigator){const{languages:e,userLanguage:n,language:r}=navigator;if(e)for(let o=0;o<e.length;o++)t.push(e[o]);n&&t.push(n),r&&t.push(r)}return t.length>0?t:void 0}},dh={name:"htmlTag",lookup(e){let t,{htmlTag:n}=e;const r=n||("undefined"!=typeof document?document.documentElement:null);return r&&"function"==typeof r.getAttribute&&(t=r.getAttribute("lang")),t}},ph={name:"path",lookup(e){var t;let{lookupFromPathIndex:n}=e;if("undefined"==typeof window)return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(!Array.isArray(r))return;return null==(t=r["number"==typeof n?n:0])?void 0:t.replace("/","")}},fh={name:"subdomain",lookup(e){var t,n;let{lookupFromSubdomainIndex:r}=e;const o="number"==typeof r?r+1:1,a="undefined"!=typeof window&&(null==(n=null==(t=window.location)?void 0:t.hostname)?void 0:n.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(a)return a[o]}};let hh=!1;try{document.cookie,hh=!0}catch(LO){}const mh=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];hh||mh.splice(1,1);class gh{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,t)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{languageUtils:{}},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=function(e){return Jf.call(Qf.call(arguments,1),t=>{if(t)for(const n in t)void 0===e[n]&&(e[n]=t[n])}),e}(t,this.options||{},{order:mh,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e}),"string"==typeof this.options.convertDetectedLanguage&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=e=>e.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(th),this.addDetector(nh),this.addDetector(sh),this.addDetector(ch),this.addDetector(uh),this.addDetector(dh),this.addDetector(ph),this.addDetector(fh),this.addDetector(rh)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.order,t=[];return e.forEach(e=>{if(this.detectors[e]){let n=this.detectors[e].lookup(this.options);n&&"string"==typeof n&&(n=[n]),n&&(t=t.concat(n))}}),t=t.filter(e=>{return null!=e&&!("string"==typeof(t=e)&&[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(e=>e.test(t)));var t}).map(e=>this.options.convertDetectedLanguage(e)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?t:t.length>0?t[0]:null}cacheUserLanguage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.caches;t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach(t=>{this.detectors[t]&&this.detectors[t].cacheUserLanguage(e,this.options)}))}}gh.type="languageDetector";const vh={common:{back:"返回",save:"保存",cancel:"取消",delete:"删除",confirm:"确定",loading:"加载中...",refresh:"刷新",add:"添加",remove:"移除",edit:"编辑",close:"关闭",retry:"重试",saving:"保存中...",saved:"已保存",save_failed:"保存失败"},language:{label:"语言",zh:"简体中文",en:"English",switch_failed:"语言切换失败"},settings:{title:"设置",tab_sync:"同步 (rsync)",tab_hub:"CCWeb Hub",tab_notifications:"通知",tab_pomodoro:"番茄钟",tab_usage:"用量监控",tab_language:"语言",webhook:{title:"Webhook 通知",enabled:"已启用",disabled:"已关闭",placeholder:"https://example.com/webhook",saved:"Webhook 配置已保存",save_failed:"保存失败",description:"AI 完成任务时向指定 URL 发送 POST 请求(JSON: event, projectId, projectName, timestamp)",enabled_prefix:"已启用 →"},browser_notify:{title:"浏览器通知",description:"当 AI 完成任务时,浏览器将自动弹出通知。首次打开 Dashboard 时会请求通知权限。"},pomodoro:{saved:"番茄钟设置已保存",section_title:"番茄钟时间设置",section_desc:"修改后重新启动番茄钟生效",work_minutes:"工作时长(分钟)",break_minutes:"休息时长(分钟)",howto_title:"使用说明",howto_item_1:"在项目页面 Header 点击图标启动番茄钟",howto_item_2:"倒计时以大字体悬浮在屏幕上,不影响操作",howto_item_3:"工作阶段结束后自动切换为休息,并弹出通知",howto_item_4:"休息结束后自动切换回工作阶段",howto_item_5:"再次点击图标可停止并重置"},usage:{section_title:"监控工具",section_desc:"选择要监控用量的 CLI 工具,首页和项目页会显示对应的实时用量",info_title:"说明",info_item_1:"用量数据显示在首页 Header 和项目页底部状态栏",info_item_2:"Claude Code 通过 OAuth API 实时查询,每 5 分钟自动刷新",info_item_3:"其他工具的用量查询将在后续版本中支持",info_item_4:"切换后无需刷新页面,用量会自动更新",switched_toast:"用量监控已切换为 {{tool}}",tool_claude_desc:"Anthropic API — 5h/7d 用量窗口",tool_codex_desc:"OpenAI — 用量查询暂未实现",tool_opencode_desc:"OpenCode — 用量查询暂未实现",tool_qwen_desc:"Qwen — 用量查询暂未实现",tool_gemini_desc:"Google — 用量查询暂未实现"}},dashboard:{sync_done_toast:"同步完成:{{ok}} 成功 / {{skipped}} 跳过 / {{failed}} 失败",sync_failed_toast:"同步失败:{{message}}",skillhub_title:"CCWeb Hub",mobile_title:"手机界面",settings_title:"设置",monitor_title_grid:"卡片模式",monitor_title_monitor:"监控大屏",fullscreen_enter:"全屏",fullscreen_exit:"退出全屏",logout:"退出",sync_all:"全部同步",sync_all_title:"通过 rsync 同步所有项目(在设置里配置服务器)",open_project:"打开项目",new_project:"新建项目",tags_clear:"清除",host_cpu:"CPU 占用(负载 {{load}})",host_mem:"内存:{{used}} / {{total}}",host_disk:"磁盘:{{used}} / {{total}}",host_net:"网络上下行速率",host_cores:"核",host_uptime:"已运行 {{hours}} 小时",memories_title:"记忆库",more:"更多"},claudemem:{title:"记忆库",back:"返回",all_projects:"全部项目",all_types:"全部",search_placeholder:"搜索记忆…",refresh:"刷新",count:"共 {{count}} 条",empty:"当前筛选下暂无记忆",load_more:"加载更多",unavailable_title:"记忆库不可用",unavailable_desc:"claude-mem 未安装、暂无记忆,或当前用户无权限(仅管理员)。"},projsync:{back:"返回",title:"同步设置",forbidden:"仅项目所有者可访问同步设置。",load_error:"加载失败,请稍后重试。",no_connection:"尚未配置同步服务器(主机/账号)。",go_global:"前往全局同步设置",remote_path:"远端路径",remote_path_hint:"本项目同步到的远端绝对路径(/ 开头)。留空表示不同步。不能包含空格或 shell 特殊字符。",excludes:"排除规则(本项目)",excludes_hint:"每行一条 rsync 排除规则,如 *.log 或 tmp/。与全局默认排除合并。",save:"保存",saved:"已保存",save_failed:"保存失败",status:"状态",not_configured:"未设置路径",dirty:"有未同步改动",synced:"已同步",syncing:"同步中…",last_sync:"上次同步",never:"从未",direction:"方向",cancel:"取消",sync_now:"立即同步",set_path_first:"请先设置远端路径",sync_done:"同步完成({{files}} 个文件)",sync_failed:"同步失败",sync_failed_reason:"同步失败:{{reason}}"},sync_section:{loading:"加载中…",load_failed:"加载同步配置失败: {{message}}",saved:"已保存",save_failed:"保存失败: {{message}}",test_ok:"连接成功",test_failed:"连接失败",test_failed_with_reason:"测试失败: {{message}}",bulk_done_toast:"同步完成:{{ok}} 成功 / {{skipped}} 跳过 / {{failed}} 失败",bulk_cancelled_toast:"已取消:{{ok}} 成功 / {{skipped}} 跳过 / {{cancelled}} 取消 / {{failed}} 失败",bulk_failed_toast:"同步失败: {{message}}",cancel_requested:"已请求取消",cancel_failed:"取消失败: {{message}}",server_section:"服务器配置",host:"主机 (host)",port:"端口",user:"用户名",remote_root:"远端根路径(默认前缀)",remote_root_hint:"可选:仅作为新建项目时远端路径的默认前缀。各项目的实际远端路径现在在项目设置页单独配置。",auth_section:"认证",auth_method:"方式",auth_password:"密码",key_path:"私钥路径",password:"密码",password_set_placeholder:"已设置,留空保持不变",password_unset_placeholder:"未设置",sshpass_hint:"需要系统安装 <code>sshpass</code>(密码通过 SSHPASS env 传递,不会出现在 argv 里)",strategy_section:"同步策略",direction:"方向",push_label:"单向:本地 → 远端(--delete)",pull_label:"单向:远端 → 本地",bidirectional_label:"双向(先 push 再 pull)",cron_label:"定时 cron 表达式",cron_hint:"5 段:分 时 日 月 周。例:<code>0 3 * * *</code> 每天 03:00",enable_label:"启用",exclude_section:"默认排除(每行一个 glob)",exclude_hint:"作为 <code>rsync --exclude</code> 传入。项目级的额外排除暂通过 API 设置。",save_button:"保存",test_button:"测试连接",syncing_with_files:"同步中: {{project}} ({{files}} 文件)",syncing_no_files:"同步中: {{project}}",sync_all_button:"立即同步全部",sync_all_title:"按当前方向同步所有项目",cancel_button:"取消",cancel_button_title:"取消批量同步:SIGTERM 当前 rsync 并停止后续项目",footer_hint:"一次性 push/pull 工具:进入项目内部,点击 header 的 <up /> / <down /> 按钮。或通过 API 调用 <code>POST /api/sync/project/:id</code> with body <code>{{body}}</code>。"},chat_overlay:{model_switched:"已切换模型:{{name}}",no_history:"暂无对话记录",starting:"启动中...",thinking:"思考中",tool_use:"调用工具",tool_result:"工具结果",placeholder_default:"输入消息… Shift+Enter 发送",placeholder_stopped:"输入消息(自动启动)… Shift+Enter 发送",placeholder_sending:"发送中…",placeholder_waking:"启动中...",placeholder_readonly:"只读模式",send_title:"发送 (Shift+Enter)",send_title_sending:"发送中…",slash_title:"斜杠命令(点击填充到输入框)",at_title:"引用项目文件(点击填充 @path 到输入框)",activity_thinking:"思考中",activity_tool_result:"处理结果",activity_call_tool:"调用工具",activity_call_named:"调用 {{name}}",tool_bash:"执行命令",tool_read:"读取文件",tool_edit:"编辑文件",tool_write:"写入文件",tool_grep:"搜索内容",tool_glob:"匹配文件",tool_web:"访问网络",tool_task:"调度子任务",tool_todo:"更新任务列表",tool_notebook:"编辑 Notebook",skills_builtin:"内置命令",skills_custom:"自定义",skills_plugins:"插件",files_up:"上一层",files_loading:"加载中…",files_empty:"(空目录)",load_older:"加载更早消息",voice_listening_stop:"停止录音",voice_listening_start:"语音输入",voice_err_not_allowed:"麦克风权限被拒绝",voice_err_network:"语音识别需要联网",voice_err_no_speech:"未检测到语音",voice_err_audio:"未找到麦克风",voice_err_aborted:"语音识别被中断",voice_err_other:"语音识别失败: {{error}}"},project_header:{sync:"同步",syncing:"同步中...",sync_failed:"同步失败",sync_success:"同步完成:{{files}} 文件,耗时 {{seconds}}s",sync_skipped:"该项目正在同步中,跳过",sync_failed_with_reason:"同步失败({{reason}})",sync_cancel:"取消",sync_cancelled:"已取消同步",sync_cancel_failed:"取消失败",sync_progress_label:"同步中({{files}} 文件)",sync_progress_label_empty:"同步中…",sync_cancel_title:"点击取消当前同步",fullscreen_enter:"全屏",fullscreen_exit:"退出全屏",toggle_file_tree:"切换文件树",toggle_right_panel:"切换右侧面板",toggle_chat_overlay:"对话框 (Ctrl+I)",sync_button_title:"同步到 rsync 服务器(在设置里配置)",switch_cli:"切换 CLI",switch_cli_title:"切换到其他 LLM CLI"},switch_cli:{title:"切换 LLM CLI",description:"当前使用 {{current}}。切换会终止当前会话并启动新的 CLI。",target_label:"目标 CLI",mode_label:"启动模式",mode_fresh:"直接启动",mode_fresh_hint:"新建会话",mode_continue:"--continue 模式",mode_continue_hint:"恢复目标 CLI 在该目录下最近一次会话。如果目标 CLI 没在该目录跑过,CLI 自身会以新会话起步。",mode_continue_unsupported:"{{tool}} 不支持 --continue",tag_current:"当前使用",tag_supports_continue:"支持 --continue",tag_no_continue:"不支持 --continue",confirm:"切换",confirming:"切换中…",cancel:"取消",switched_toast:"已切换到 {{tool}}",switch_failed:"切换失败:{{reason}}"}},yh={common:{back:"Back",save:"Save",cancel:"Cancel",delete:"Delete",confirm:"Confirm",loading:"Loading...",refresh:"Refresh",add:"Add",remove:"Remove",edit:"Edit",close:"Close",retry:"Retry",saving:"Saving...",saved:"Saved",save_failed:"Save failed"},language:{label:"Language",zh:"简体中文",en:"English",switch_failed:"Failed to switch language"},settings:{title:"Settings",tab_sync:"Sync (rsync)",tab_hub:"CCWeb Hub",tab_notifications:"Notifications",tab_pomodoro:"Pomodoro",tab_usage:"Usage monitor",tab_language:"Language",webhook:{title:"Webhook notifications",enabled:"Enabled",disabled:"Disabled",placeholder:"https://example.com/webhook",saved:"Webhook configuration saved",save_failed:"Save failed",description:"Sends a POST request to the URL when the AI completes a task (JSON: event, projectId, projectName, timestamp)",enabled_prefix:"Enabled →"},browser_notify:{title:"Browser notifications",description:"The browser will pop up a notification when the AI finishes a task. Permission is requested on first Dashboard visit."},pomodoro:{saved:"Pomodoro settings saved",section_title:"Pomodoro timer settings",section_desc:"Restart the timer for changes to take effect",work_minutes:"Work (minutes)",break_minutes:"Break (minutes)",howto_title:"How to use",howto_item_1:"Click the icon in the project page header to start",howto_item_2:"A large countdown floats on screen without blocking",howto_item_3:"Auto-switches to break after work, with a notification",howto_item_4:"Auto-switches back to work after break",howto_item_5:"Click the icon again to stop and reset"},usage:{section_title:"Monitored tool",section_desc:"Pick the CLI tool whose usage you want to monitor — shown in dashboard header and project status bar",info_title:"Notes",info_item_1:"Usage data is shown in the dashboard header and project status bar",info_item_2:"Claude Code queries via OAuth API, auto-refreshed every 5 minutes",info_item_3:"Other tools' usage queries will be supported in future versions",info_item_4:"No page reload needed after switching — usage updates automatically",switched_toast:"Usage monitor switched to {{tool}}",tool_claude_desc:"Anthropic API — 5h/7d usage window",tool_codex_desc:"OpenAI — usage query not yet implemented",tool_opencode_desc:"OpenCode — usage query not yet implemented",tool_qwen_desc:"Qwen — usage query not yet implemented",tool_gemini_desc:"Google — usage query not yet implemented"}},dashboard:{sync_done_toast:"Sync done: {{ok}} ok / {{skipped}} skipped / {{failed}} failed",sync_failed_toast:"Sync failed: {{message}}",skillhub_title:"CCWeb Hub",mobile_title:"Mobile view",settings_title:"Settings",monitor_title_grid:"Card mode",monitor_title_monitor:"Monitor view",fullscreen_enter:"Fullscreen",fullscreen_exit:"Exit fullscreen",logout:"Logout",sync_all:"Sync all",sync_all_title:"Sync every project via rsync (configure server in Settings)",open_project:"Open project",new_project:"New project",tags_clear:"Clear",host_cpu:"CPU usage (load {{load}})",host_mem:"Memory: {{used}} / {{total}}",host_disk:"Disk: {{used}} / {{total}}",host_net:"Network down / up rate",host_cores:"cores",host_uptime:"up {{hours}}h",memories_title:"Memories",more:"More"},claudemem:{title:"Memories",back:"Back",all_projects:"All projects",all_types:"All",search_placeholder:"Search memories…",refresh:"Refresh",count:"{{count}} total",empty:"No memories under the current filter",load_more:"Load more",unavailable_title:"Memories unavailable",unavailable_desc:"claude-mem is not installed, has no memories, or you lack permission (admin only)."},projsync:{back:"Back",title:"Sync settings",forbidden:"Only the project owner can access sync settings.",load_error:"Failed to load, please try again.",no_connection:"No sync server configured (host/account).",go_global:"Open global sync settings",remote_path:"Remote path",remote_path_hint:"Absolute remote path this project syncs to (starts with /). Empty = not synced. No spaces or shell metacharacters.",excludes:"Excludes (this project)",excludes_hint:"One rsync exclude per line, e.g. *.log or tmp/. Merged with the global defaults.",save:"Save",saved:"Saved",save_failed:"Save failed",status:"Status",not_configured:"No path set",dirty:"Unsynced changes",synced:"Synced",syncing:"Syncing…",last_sync:"Last sync",never:"Never",direction:"Direction",cancel:"Cancel",sync_now:"Sync now",set_path_first:"Set a remote path first",sync_done:"Sync done ({{files}} files)",sync_failed:"Sync failed",sync_failed_reason:"Sync failed: {{reason}}"},sync_section:{loading:"Loading…",load_failed:"Failed to load sync config: {{message}}",saved:"Saved",save_failed:"Save failed: {{message}}",test_ok:"Connection ok",test_failed:"Connection failed",test_failed_with_reason:"Test failed: {{message}}",bulk_done_toast:"Sync done: {{ok}} ok / {{skipped}} skipped / {{failed}} failed",bulk_cancelled_toast:"Cancelled: {{ok}} ok / {{skipped}} skipped / {{cancelled}} cancelled / {{failed}} failed",bulk_failed_toast:"Sync failed: {{message}}",cancel_requested:"Cancel requested",cancel_failed:"Cancel failed: {{message}}",server_section:"Server",host:"Host",port:"Port",user:"User",remote_root:"Remote root (default prefix)",remote_root_hint:"Optional: only a default prefix for new project paths. Each project's actual remote path is now configured on its project settings page.",auth_section:"Auth",auth_method:"Method",auth_password:"Password",key_path:"Key path",password:"Password",password_set_placeholder:"Set — leave blank to keep",password_unset_placeholder:"Not set",sshpass_hint:"Requires <code>sshpass</code> on the system (password passed via SSHPASS env, never in argv)",strategy_section:"Strategy",direction:"Direction",push_label:"One-way: local → remote (--delete)",pull_label:"One-way: remote → local",bidirectional_label:"Bidirectional (push then pull)",cron_label:"Cron expression",cron_hint:"5 fields: min hour day month wday. Example <code>0 3 * * *</code> = daily at 03:00.",enable_label:"Enable",exclude_section:"Default excludes (one glob per line)",exclude_hint:"Passed as <code>rsync --exclude</code>. Project-level extras for now via API.",save_button:"Save",test_button:"Test connection",syncing_with_files:"Syncing: {{project}} ({{files}} files)",syncing_no_files:"Syncing: {{project}}",sync_all_button:"Sync all now",sync_all_title:"Sync every project in current direction",cancel_button:"Cancel",cancel_button_title:"Cancel bulk sync: SIGTERM current rsync and stop subsequent projects",footer_hint:"Per-project push/pull: from inside a project, click <up /> / <down /> in the header. Or call <code>POST /api/sync/project/:id</code> with body <code>{{body}}</code>."},chat_overlay:{model_switched:"Model switched: {{name}}",no_history:"No history",starting:"Starting…",thinking:"thinking",tool_use:"tool use",tool_result:"tool result",placeholder_default:"Message… Shift+Enter to send",placeholder_stopped:"Message (auto-start)… Shift+Enter to send",placeholder_sending:"Sending…",placeholder_waking:"Starting…",placeholder_readonly:"Read-only",send_title:"Send (Shift+Enter)",send_title_sending:"Sending…",slash_title:"Slash commands (click to insert)",at_title:"Reference project file (insert @path)",activity_thinking:"thinking",activity_tool_result:"processing",activity_call_tool:"calling tool",activity_call_named:"calling {{name}}",tool_bash:"running command",tool_read:"reading file",tool_edit:"editing file",tool_write:"writing file",tool_grep:"searching",tool_glob:"matching files",tool_web:"fetching web",tool_task:"spawning subtask",tool_todo:"updating todos",tool_notebook:"editing notebook",skills_builtin:"Built-in",skills_custom:"Custom",skills_plugins:"Plugins",files_up:"Up",files_loading:"Loading…",files_empty:"(empty)",load_older:"Load older",voice_listening_stop:"Stop recording",voice_listening_start:"Voice input",voice_err_not_allowed:"Microphone permission denied",voice_err_network:"Voice recognition needs network",voice_err_no_speech:"No speech detected",voice_err_audio:"No microphone found",voice_err_aborted:"Voice recognition aborted",voice_err_other:"Voice recognition failed: {{error}}"},project_header:{sync:"Sync",syncing:"Syncing...",sync_failed:"Sync failed",sync_success:"Sync complete: {{files}} files in {{seconds}}s",sync_skipped:"Project already syncing — skipped",sync_failed_with_reason:"Sync failed ({{reason}})",sync_cancel:"Cancel",sync_cancelled:"Sync cancelled",sync_cancel_failed:"Cancel failed",sync_progress_label:"Syncing ({{files}} files)",sync_progress_label_empty:"Syncing…",sync_cancel_title:"Click to cancel current sync",fullscreen_enter:"Fullscreen",fullscreen_exit:"Exit fullscreen",toggle_file_tree:"Toggle file tree",toggle_right_panel:"Toggle right panel",toggle_chat_overlay:"Chat overlay (Ctrl+I)",sync_button_title:"Sync to rsync server (configure in Settings)",switch_cli:"Switch CLI",switch_cli_title:"Switch to another LLM CLI"},switch_cli:{title:"Switch LLM CLI",description:"Currently using {{current}}. Switching terminates the active session and launches the new CLI.",target_label:"Target CLI",mode_label:"Launch mode",mode_fresh:"Fresh start",mode_fresh_hint:"Begin a new session",mode_continue:"--continue mode",mode_continue_hint:"Resume the target CLI's most recent session in this folder. If that CLI has never run here, the CLI itself will start a new session.",mode_continue_unsupported:"{{tool}} does not support --continue",tag_current:"Currently active",tag_supports_continue:"Supports --continue",tag_no_continue:"No --continue support",confirm:"Switch",confirming:"Switching…",cancel:"Cancel",switched_toast:"Switched to {{tool}}",switch_failed:"Switch failed: {{reason}}"}},bh=["zh","en"],xh="ccweb_lang";kf.use(gh).use(Of).init({resources:{zh:{common:vh},en:{common:yh}},fallbackLng:"zh",defaultNS:"common",ns:["common"],interpolation:{escapeValue:!0},debug:!1,saveMissing:!1,missingKeyHandler:(e,t,n)=>{console.warn(`[i18n] missing key: ${n} (ns=${t}, lngs=${e.join(",")})`)},detection:{order:["localStorage","navigator"],lookupLocalStorage:xh,caches:["localStorage"],convertDetectedLanguage:e=>{const t=e.slice(0,2).toLowerCase();return bh.includes(t)?t:"en"}}});const wh=W.createContext({});function kh(e){const t=W.useRef(null);return null===t.current&&(t.current=e()),t.current}const Sh="undefined"!=typeof window?W.useLayoutEffect:W.useEffect,jh=W.createContext(null);function Ch(e,t){-1===e.indexOf(t)&&e.push(t)}function Eh(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Ph=(e,t,n)=>n>t?t:n<e?e:n;const _h={},Nh=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Th(e){return"object"==typeof e&&null!==e}const Rh=e=>/^0[^.\s]+$/u.test(e);function Mh(e){let t;return()=>(void 0===t&&(t=e()),t)}const Lh=e=>e,Oh=(e,t)=>n=>t(e(n)),Ah=(...e)=>e.reduce(Oh),Dh=(e,t,n)=>{const r=t-e;return 0===r?1:(n-e)/r};class Ih{constructor(){this.subscriptions=[]}add(e){return Ch(this.subscriptions,e),()=>Eh(this.subscriptions,e)}notify(e,t,n){const r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](e,t,n);else for(let o=0;o<r;o++){const r=this.subscriptions[o];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Fh=e=>1e3*e,$h=e=>e/1e3;function zh(e,t){return t?e*(1e3/t):0}const Vh=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function Uh(e,t,n,r){if(e===t&&n===r)return Lh;const o=t=>function(e,t,n,r,o){let a,s,i=0;do{s=t+(n-t)/2,a=Vh(s,r,o)-e,a>0?n=s:t=s}while(Math.abs(a)>1e-7&&++i<12);return s}(t,0,1,e,n);return e=>0===e||1===e?e:Vh(o(e),t,r)}const Bh=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Wh=e=>t=>1-e(1-t),Hh=Uh(.33,1.53,.69,.99),qh=Wh(Hh),Gh=Bh(qh),Kh=e=>e>=1?1:(e*=2)<1?.5*qh(e):.5*(2-Math.pow(2,-10*(e-1))),Yh=e=>1-Math.sin(Math.acos(e)),Xh=Wh(Yh),Qh=Bh(Yh),Jh=Uh(.42,0,1,1),Zh=Uh(0,0,.58,1),em=Uh(.42,0,.58,1),tm=e=>Array.isArray(e)&&"number"==typeof e[0],nm={linear:Lh,easeIn:Jh,easeInOut:em,easeOut:Zh,circIn:Yh,circInOut:Qh,circOut:Xh,backIn:qh,backInOut:Gh,backOut:Hh,anticipate:Kh},rm=e=>{if(tm(e)){e.length;const[t,n,r,o]=e;return Uh(t,n,r,o)}return"string"==typeof e?nm[e]:e},om=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function am(e,t){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,s=om.reduce((e,t)=>(e[t]=function(e){let t=new Set,n=new Set,r=!1,o=!1;const a=new WeakSet;let s={delta:0,timestamp:0,isProcessing:!1};function i(t){a.has(t)&&(l.schedule(t),e()),t(s)}const l={schedule:(e,o=!1,s=!1)=>{const i=s&&r?t:n;return o&&a.add(e),i.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(s=e,r)return void(o=!0);r=!0;const a=t;t=n,n=a,t.forEach(i),t.clear(),r=!1,o&&(o=!1,l.process(e))}};return l}(a),e),{}),{setup:i,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:p,render:f,postRender:h}=s,m=()=>{const a=_h.useManualTiming,s=a?o.timestamp:performance.now();n=!1,a||(o.delta=r?1e3/60:Math.max(Math.min(s-o.timestamp,40),1)),o.timestamp=s,o.isProcessing=!0,i.process(o),l.process(o),c.process(o),u.process(o),d.process(o),p.process(o),f.process(o),h.process(o),o.isProcessing=!1,n&&t&&(r=!1,e(m))};return{schedule:om.reduce((t,a)=>{const i=s[a];return t[a]=(t,a=!1,s=!1)=>(n||(n=!0,r=!0,o.isProcessing||e(m)),i.schedule(t,a,s)),t},{}),cancel:e=>{for(let t=0;t<om.length;t++)s[om[t]].cancel(e)},state:o,steps:s}}const{schedule:sm,cancel:im,state:lm,steps:cm}=am("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:Lh,!0);let um;function dm(){um=void 0}const pm={now:()=>(void 0===um&&pm.set(lm.isProcessing||_h.useManualTiming?lm.timestamp:performance.now()),um),set:e=>{um=e,queueMicrotask(dm)}},fm=e=>t=>"string"==typeof t&&t.startsWith(e),hm=fm("--"),mm=fm("var(--"),gm=e=>!!mm(e)&&vm.test(e.split("/*")[0].trim()),vm=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function ym(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}const bm={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},xm={...bm,transform:e=>Ph(0,1,e)},wm={...bm,default:1},km=e=>Math.round(1e5*e)/1e5,Sm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const jm=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Cm=(e,t)=>n=>Boolean("string"==typeof n&&jm.test(n)&&n.startsWith(e)||t&&!function(e){return null==e}(n)&&Object.prototype.hasOwnProperty.call(n,t)),Em=(e,t,n)=>r=>{if("string"!=typeof r)return r;const[o,a,s,i]=r.match(Sm);return{[e]:parseFloat(o),[t]:parseFloat(a),[n]:parseFloat(s),alpha:void 0!==i?parseFloat(i):1}},Pm={...bm,transform:e=>Math.round((e=>Ph(0,255,e))(e))},_m={test:Cm("rgb","red"),parse:Em("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Pm.transform(e)+", "+Pm.transform(t)+", "+Pm.transform(n)+", "+km(xm.transform(r))+")"};const Nm={test:Cm("#"),parse:function(e){let t="",n="",r="",o="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),o=e.substring(4,5),t+=t,n+=n,r+=r,o+=o),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}},transform:_m.transform},Tm=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),Rm=Tm("deg"),Mm=Tm("%"),Lm=Tm("px"),Om=Tm("vh"),Am=Tm("vw"),Dm=(()=>({...Mm,parse:e=>Mm.parse(e)/100,transform:e=>Mm.transform(100*e)}))(),Im={test:Cm("hsl","hue"),parse:Em("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Mm.transform(km(t))+", "+Mm.transform(km(n))+", "+km(xm.transform(r))+")"},Fm={test:e=>_m.test(e)||Nm.test(e)||Im.test(e),parse:e=>_m.test(e)?_m.parse(e):Im.test(e)?Im.parse(e):Nm.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?_m.transform(e):Im.transform(e),getAnimatableNone:e=>{const t=Fm.parse(e);return t.alpha=0,Fm.transform(t)}},$m=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const zm="number",Vm="color",Um=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Bm(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},o=[];let a=0;const s=t.replace(Um,e=>(Fm.test(e)?(r.color.push(a),o.push(Vm),n.push(Fm.parse(e))):e.startsWith("var(")?(r.var.push(a),o.push("var"),n.push(e)):(r.number.push(a),o.push(zm),n.push(parseFloat(e))),++a,"${}")).split("${}");return{values:n,split:s,indexes:r,types:o}}function Wm({split:e,types:t}){const n=e.length;return r=>{let o="";for(let a=0;a<n;a++)if(o+=e[a],void 0!==r[a]){const e=t[a];o+=e===zm?km(r[a]):e===Vm?Fm.transform(r[a]):r[a]}return o}}const Hm=(e,t)=>{return"number"==typeof e?(null==t?void 0:t.trim().endsWith("/"))?e:0:"number"==typeof(n=e)?0:Fm.test(n)?Fm.getAnimatableNone(n):n;var n};const qm={test:function(e){var t,n;return isNaN(e)&&"string"==typeof e&&((null==(t=e.match(Sm))?void 0:t.length)||0)+((null==(n=e.match($m))?void 0:n.length)||0)>0},parse:function(e){return Bm(e).values},createTransformer:function(e){return Wm(Bm(e))},getAnimatableNone:function(e){const t=Bm(e);return Wm(t)(t.values.map((e,n)=>Hm(e,t.split[n])))}};function Gm(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Km(e,t){return n=>n>0?t:e}const Ym=(e,t,n)=>e+(t-e)*n,Xm=(e,t,n)=>{const r=e*e,o=n*(t*t-r)+r;return o<0?0:Math.sqrt(o)},Qm=[Nm,_m,Im];function Jm(e){const t=(n=e,Qm.find(e=>e.test(n)));var n;if(!Boolean(t))return!1;let r=t.parse(e);return t===Im&&(r=function({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,n/=100;let o=0,a=0,s=0;if(t/=100){const r=n<.5?n*(1+t):n+t-n*t,i=2*n-r;o=Gm(i,r,e+1/3),a=Gm(i,r,e),s=Gm(i,r,e-1/3)}else o=a=s=n;return{red:Math.round(255*o),green:Math.round(255*a),blue:Math.round(255*s),alpha:r}}(r)),r}const Zm=(e,t)=>{const n=Jm(e),r=Jm(t);if(!n||!r)return Km(e,t);const o={...n};return e=>(o.red=Xm(n.red,r.red,e),o.green=Xm(n.green,r.green,e),o.blue=Xm(n.blue,r.blue,e),o.alpha=Ym(n.alpha,r.alpha,e),_m.transform(o))},eg=new Set(["none","hidden"]);function tg(e,t){return n=>Ym(e,t,n)}function ng(e){return"number"==typeof e?tg:"string"==typeof e?gm(e)?Km:Fm.test(e)?Zm:ag:Array.isArray(e)?rg:"object"==typeof e?Fm.test(e)?Zm:og:Km}function rg(e,t){const n=[...e],r=n.length,o=e.map((e,n)=>ng(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=o[t](e);return n}}function og(e,t){const n={...e,...t},r={};for(const o in n)void 0!==e[o]&&void 0!==t[o]&&(r[o]=ng(e[o])(e[o],t[o]));return e=>{for(const t in r)n[t]=r[t](e);return n}}const ag=(e,t)=>{const n=qm.createTransformer(t),r=Bm(e),o=Bm(t);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?eg.has(e)&&!o.values.length||eg.has(t)&&!r.values.length?function(e,t){return eg.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}(e,t):Ah(rg(function(e,t){const n=[],r={color:0,var:0,number:0};for(let o=0;o<t.values.length;o++){const a=t.types[o],s=e.indexes[a][r[a]],i=e.values[s]??0;n[o]=i,r[a]++}return n}(r,o),o.values),n):Km(e,t)};function sg(e,t,n){if("number"==typeof e&&"number"==typeof t&&"number"==typeof n)return Ym(e,t,n);return ng(e)(e,t)}const ig=e=>{const t=({timestamp:t})=>e(t);return{start:(e=!0)=>sm.update(t,e),stop:()=>im(t),now:()=>lm.isProcessing?lm.timestamp:pm.now()}},lg=(e,t,n=10)=>{let r="";const o=Math.max(Math.round(t/n),2);for(let a=0;a<o;a++)r+=Math.round(1e4*e(a/(o-1)))/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},cg=2e4;function ug(e){let t=0;let n=e.next(t);for(;!n.done&&t<cg;)t+=50,n=e.next(t);return t>=cg?1/0:t}const dg=100,pg=10,fg=1,hg=0,mg=800,gg=.3,vg=.3,yg={granular:.01,default:2},bg={granular:.005,default:.5},xg=.01,wg=10,kg=.05,Sg=1;function jg(e,t){return e*Math.sqrt(1-t*t)}const Cg=.001;const Eg=["duration","bounce"],Pg=["stiffness","damping","mass"];function _g(e,t){return t.some(t=>void 0!==e[t])}function Ng(e){let t={velocity:hg,stiffness:dg,damping:pg,mass:fg,isResolvedFromDuration:!1,...e};if(!_g(e,Pg)&&_g(e,Eg))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(1.2*n),o=r*r,a=2*Ph(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:fg,stiffness:o,damping:a}}else{const n=function({duration:e=mg,bounce:t=gg,velocity:n=hg,mass:r=fg}){let o,a,s=1-t;s=Ph(kg,Sg,s),e=Ph(xg,wg,$h(e)),s<1?(o=t=>{const r=t*s,o=r*e,a=r-n,i=jg(t,s),l=Math.exp(-o);return Cg-a/i*l},a=t=>{const r=t*s*e,a=r*n+n,i=Math.pow(s,2)*Math.pow(t,2)*e,l=Math.exp(-r),c=jg(Math.pow(t,2),s);return(-o(t)+Cg>0?-1:1)*((a-i)*l)/c}):(o=t=>Math.exp(-t*e)*((t-n)*e+1)-.001,a=t=>Math.exp(-t*e)*(e*e*(n-t)));const i=function(e,t,n){let r=n;for(let o=1;o<12;o++)r-=e(r)/t(r);return r}(o,a,5/e);if(e=Fh(e),isNaN(i))return{stiffness:dg,damping:pg,duration:e};{const t=Math.pow(i,2)*r;return{stiffness:t,damping:2*s*Math.sqrt(r*t),duration:e}}}({...e,velocity:0});t={...t,...n,mass:fg},t.isResolvedFromDuration=!0}return t}function Tg(e=vg,t=gg){const n="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:o}=n;const a=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],i={done:!1,value:a},{stiffness:l,damping:c,mass:u,duration:d,velocity:p,isResolvedFromDuration:f}=Ng({...n,velocity:-$h(n.velocity||0)}),h=p||0,m=c/(2*Math.sqrt(l*u)),g=s-a,v=$h(Math.sqrt(l/u)),y=Math.abs(g)<5;let b,x,w,k,S,j;if(r||(r=y?yg.granular:yg.default),o||(o=y?bg.granular:bg.default),m<1)w=jg(v,m),k=(h+m*v*g)/w,b=e=>{const t=Math.exp(-m*v*e);return s-t*(k*Math.sin(w*e)+g*Math.cos(w*e))},S=m*v*k+g*w,j=m*v*g-k*w,x=e=>Math.exp(-m*v*e)*(S*Math.sin(w*e)+j*Math.cos(w*e));else if(1===m){b=e=>s-Math.exp(-v*e)*(g+(h+v*g)*e);const e=h+v*g;x=t=>Math.exp(-v*t)*(v*e*t-h)}else{const e=v*Math.sqrt(m*m-1);b=t=>{const n=Math.exp(-m*v*t),r=Math.min(e*t,300);return s-n*((h+m*v*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};const t=(h+m*v*g)/e,n=m*v*t-g*e,r=m*v*g-t*e;x=t=>{const o=Math.exp(-m*v*t),a=Math.min(e*t,300);return o*(n*Math.sinh(a)+r*Math.cosh(a))}}const C={calculatedDuration:f&&d||null,velocity:e=>Fh(x(e)),next:e=>{if(!f&&m<1){const t=Math.exp(-m*v*e),n=Math.sin(w*e),a=Math.cos(w*e),l=s-t*(k*n+g*a),c=Fh(t*(S*n+j*a));return i.done=Math.abs(c)<=r&&Math.abs(s-l)<=o,i.value=i.done?s:l,i}const t=b(e);if(f)i.done=e>=d;else{const n=Fh(x(e));i.done=Math.abs(n)<=r&&Math.abs(s-t)<=o}return i.value=i.done?s:t,i},toString:()=>{const e=Math.min(ug(C),cg),t=lg(t=>C.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return C}Tg.applyToOptions=e=>{const t=function(e,t=100,n){const r=n({...e,keyframes:[0,t]}),o=Math.min(ug(r),cg);return{type:"keyframes",ease:e=>r.next(o*e).value/t,duration:$h(o)}}(e,100,Tg);return e.ease=t.ease,e.duration=Fh(t.duration),e.type="keyframes",e};function Rg(e,t,n){const r=Math.max(t-5,0);return zh(n-e(r),t-r)}function Mg({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:a=500,modifyTarget:s,min:i,max:l,restDelta:c=.5,restSpeed:u}){const d=e[0],p={done:!1,value:d},f=e=>void 0===i?l:void 0===l||Math.abs(i-e)<Math.abs(l-e)?i:l;let h=n*t;const m=d+h,g=void 0===s?m:s(m);g!==m&&(h=g-d);const v=e=>-h*Math.exp(-e/r),y=e=>g+v(e),b=e=>{const t=v(e),n=y(e);p.done=Math.abs(t)<=c,p.value=p.done?g:n};let x,w;const k=e=>{var t;(t=p.value,void 0!==i&&t<i||void 0!==l&&t>l)&&(x=e,w=Tg({keyframes:[p.value,f(p.value)],velocity:Rg(y,e,p.value),damping:o,stiffness:a,restDelta:c,restSpeed:u}))};return k(0),{calculatedDuration:null,next:e=>{let t=!1;return w||void 0!==x||(t=!0,b(e),k(e)),void 0!==x&&e>=x?w.next(e-x):(!t&&b(e),p)}}}function Lg(e,t,{clamp:n=!0,ease:r,mixer:o}={}){const a=e.length;if(t.length,1===a)return()=>t[0];if(2===a&&t[0]===t[1])return()=>t[1];const s=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());const i=function(e,t,n){const r=[],o=n||_h.mix||sg,a=e.length-1;for(let s=0;s<a;s++){let n=o(e[s],e[s+1]);if(t){const e=Array.isArray(t)?t[s]||Lh:t;n=Ah(e,n)}r.push(n)}return r}(t,r,o),l=i.length,c=n=>{if(s&&n<e[0])return t[0];let r=0;if(l>1)for(;r<e.length-2&&!(n<e[r+1]);r++);const o=Dh(e[r],e[r+1],n);return i[r](o)};return n?t=>c(Ph(e[0],e[a-1],t)):c}function Og(e){const t=[0];return function(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const o=Dh(0,t,r);e.push(Ym(n,1,o))}}(t,e.length-1),t}function Ag({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const o=(e=>Array.isArray(e)&&"number"!=typeof e[0])(r)?r.map(rm):rm(r),a={done:!1,value:t[0]},s=function(e,t){return e.map(e=>e*t)}(n&&n.length===t.length?n:Og(t),e),i=Lg(s,t,{ease:Array.isArray(o)?o:(l=t,c=o,l.map(()=>c||em).splice(0,l.length-1))});var l,c;return{calculatedDuration:e,next:t=>(a.value=i(t),a.done=t>=e,a)}}const Dg=e=>null!==e;function Ig(e,{repeat:t,repeatType:n="loop"},r,o=1){const a=e.filter(Dg),s=o<0||t&&"loop"!==n&&t%2==1?0:a.length-1;return s&&void 0!==r?r:a[s]}const Fg={decay:Mg,inertia:Mg,tween:Ag,keyframes:Ag,spring:Tg};function $g(e){"string"==typeof e.type&&(e.type=Fg[e.type])}class zg{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}const Vg=e=>e/100;class Ug extends zg{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var e,t;const{motionValue:n}=this.options;n&&n.updatedAt!==pm.now()&&this.tick(pm.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),null==(t=(e=this.options).onStop)||t.call(e))},this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){const{options:e}=this;$g(e);const{type:t=Ag,repeat:n=0,repeatDelay:r=0,repeatType:o,velocity:a=0}=e;let{keyframes:s}=e;const i=t||Ag;i!==Ag&&"number"!=typeof s[0]&&(this.mixKeyframes=Ah(Vg,sg(s[0],s[1])),s=[0,100]);const l=i({...e,keyframes:s});"mirror"===o&&(this.mirroredGenerator=i({...e,keyframes:[...s].reverse(),velocity:-a})),null===l.calculatedDuration&&(l.calculatedDuration=ug(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=l}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:n,totalDuration:r,mixKeyframes:o,mirroredGenerator:a,resolvedDuration:s,calculatedDuration:i}=this;if(null===this.startTime)return n.next(0);const{delay:l=0,keyframes:c,repeat:u,repeatType:d,repeatDelay:p,type:f,onUpdate:h,finalKeyframe:m}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const g=this.currentTime-l*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=r);let y,b=this.currentTime,x=n;if(u){const e=Math.min(this.currentTime,r)/s;let t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),1===n&&t--,t=Math.min(t,u+1);Boolean(t%2)&&("reverse"===d?(n=1-n,p&&(n-=p/s)):"mirror"===d&&(x=a)),b=Ph(0,1,n)*s}v?(this.delayState.value=c[0],y=this.delayState):y=x.next(b),o&&!v&&(y.value=o(y.value));let{done:w}=y;v||null===i||(w=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const k=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return k&&f!==Mg&&(y.value=Ig(c,this.options,m,this.speed)),h&&h(y.value),k&&this.finish(),y}then(e,t){return this.finished.then(e,t)}get duration(){return $h(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+$h(e)}get time(){return $h(this.currentTime)}set time(e){e=Fh(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);return Rg(e=>this.generator.next(e).value,e,this.generator.next(e).value)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(pm.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=$h(this.currentTime))}play(){var e,t;if(this.isStopped)return;const{driver:n=ig,startTime:r}=this.options;this.driver||(this.driver=n(e=>this.tick(e))),null==(t=(e=this.options).onPlay)||t.call(e);const o=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=o):null!==this.holdTime?this.startTime=o-this.holdTime:this.startTime||(this.startTime=r??o),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(pm.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,t;this.notifyFinished(),this.teardown(),this.state="finished",null==(t=(e=this.options).onComplete)||t.call(e)}cancel(){var e,t;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),null==(t=(e=this.options).onCancel)||t.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var t;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),null==(t=this.driver)||t.stop(),e.observe(this)}}const Bg=e=>180*e/Math.PI,Wg=e=>{const t=Bg(Math.atan2(e[1],e[0]));return qg(t)},Hg={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Wg,rotateZ:Wg,skewX:e=>Bg(Math.atan(e[1])),skewY:e=>Bg(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},qg=e=>((e%=360)<0&&(e+=360),e),Gg=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Kg=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Yg={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Gg,scaleY:Kg,scale:e=>(Gg(e)+Kg(e))/2,rotateX:e=>qg(Bg(Math.atan2(e[6],e[5]))),rotateY:e=>qg(Bg(Math.atan2(-e[2],e[0]))),rotateZ:Wg,rotate:Wg,skewX:e=>Bg(Math.atan(e[4])),skewY:e=>Bg(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Xg(e){return e.includes("scale")?1:0}function Qg(e,t){if(!e||"none"===e)return Xg(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(n)r=Yg,o=n;else{const t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Hg,o=t}if(!o)return Xg(t);const a=r[t],s=o[1].split(",").map(Jg);return"function"==typeof a?a(s):s[a]}function Jg(e){return parseFloat(e.trim())}const Zg=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ev=(()=>new Set(Zg))(),tv=e=>e===bm||e===Lm,nv=new Set(["x","y","z"]),rv=Zg.filter(e=>!nv.has(e));const ov={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:r})=>{const o=e.max-e.min;return"border-box"===r?o:o-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:r})=>{const o=e.max-e.min;return"border-box"===r?o:o-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Qg(t,"x"),y:(e,{transform:t})=>Qg(t,"y")};ov.translateX=ov.x,ov.translateY=ov.y;const av=new Set;let sv=!1,iv=!1,lv=!1;function cv(){if(iv){const e=Array.from(av).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{const t=function(e){const t=[];return rv.forEach(n=>{const r=e.getValue(n);void 0!==r&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();const t=n.get(e);t&&t.forEach(([t,n])=>{var r;null==(r=e.getValue(t))||r.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}iv=!1,sv=!1,av.forEach(e=>e.complete(lv)),av.clear()}function uv(){av.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(iv=!0)})}class dv{constructor(e,t,n,r,o,a=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=o,this.isAsync=a}scheduleResolve(){this.state="scheduled",this.isAsync?(av.add(this),sv||(sv=!0,sm.read(uv),sm.resolveKeyframes(cv))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(null===e[0]){const o=null==r?void 0:r.get(),a=e[e.length-1];if(void 0!==o)e[0]=o;else if(n&&t){const r=n.readValue(t,a);null!=r&&(e[0]=r)}void 0===e[0]&&(e[0]=a),r&&void 0===o&&r.set(e[0])}!function(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),av.delete(this)}cancel(){"scheduled"===this.state&&(av.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function pv(e,t,n){(e=>e.startsWith("--"))(t)?e.style.setProperty(t,n):e.style[t]=n}const fv={};function hv(e,t){const n=Mh(e);return()=>fv[t]??n()}const mv=hv(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),gv=hv(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(LO){return!1}return!0},"linearEasing"),vv=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,yv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:vv([0,.65,.55,1]),circOut:vv([.55,0,1,.45]),backIn:vv([.31,.01,.66,-.59]),backOut:vv([.33,1.53,.69,.99])};function bv(e,t){return e?"function"==typeof e?gv()?lg(e,t):"ease-out":tm(e)?vv(e):Array.isArray(e)?e.map(e=>bv(e,t)||yv.easeOut):yv[e]:void 0}function xv(e,t,n,{delay:r=0,duration:o=300,repeat:a=0,repeatType:s="loop",ease:i="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const d=bv(i,o);Array.isArray(d)&&(u.easing=d);const p={delay:r,duration:o,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:a+1,direction:"reverse"===s?"alternate":"normal"};c&&(p.pseudoElement=c);return e.animate(u,p)}function wv(e){return"function"==typeof e&&"applyToOptions"in e}class kv extends zg{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:n,keyframes:r,pseudoElement:o,allowFlatten:a=!1,finalKeyframe:s,onComplete:i}=e;this.isPseudoElement=Boolean(o),this.allowFlatten=a,this.options=e,e.type;const l=function({type:e,...t}){return wv(e)&&gv()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=xv(t,n,r,l,o),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const e=Ig(r,this.options,s,this.speed);this.updateMotionValue&&this.updateMotionValue(e),pv(t,n,e),this.animation.cancel()}null==i||i(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,t;null==(t=(e=this.animation).finish)||t.call(e)}cancel(){try{this.animation.cancel()}catch(LO){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,t,n;const r=null==(e=this.options)?void 0:e.element;!this.isPseudoElement&&(null==r?void 0:r.isConnected)&&(null==(n=(t=this.animation).commitStyles)||n.call(t))}get duration(){var e,t;const n=(null==(t=null==(e=this.animation.effect)?void 0:e.getComputedTiming)?void 0:t.call(e).duration)||0;return $h(Number(n))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+$h(e)}get time(){return $h(Number(this.animation.currentTime)||0)}set time(e){const t=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Fh(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){var o;return this.allowFlatten&&(null==(o=this.animation.effect)||o.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&mv()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),Lh):r(this)}}const Sv={anticipate:Kh,backInOut:Gh,circInOut:Qh};function jv(e){"string"==typeof e.ease&&e.ease in Sv&&(e.ease=Sv[e.ease])}class Cv extends kv{constructor(e){jv(e),$g(e),super(e),void 0!==e.startTime&&!1!==e.autoplay&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:n,onComplete:r,element:o,...a}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);const s=new Ug({...a,autoplay:!1}),i=Math.max(10,pm.now()-this.startTime),l=Ph(0,10,i-10),c=s.sample(i).value,{name:u}=this.options;o&&u&&pv(o,u,c),t.setWithVelocity(s.sample(Math.max(0,i-l)).value,c,l),s.stop()}}const Ev=(e,t)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!qm.test(e)&&"0"!==e||e.startsWith("url(")));function Pv(e){e.duration=0,e.type="keyframes"}const _v=new Set(["opacity","clipPath","filter","transform"]),Nv=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;const Tv=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Rv=Mh(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Mv(e){var t;const{motionValue:n,name:r,repeatDelay:o,repeatType:a,damping:s,type:i,keyframes:l}=e;if(!((null==(t=null==n?void 0:n.owner)?void 0:t.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return Rv()&&r&&(_v.has(r)||Tv.has(r)&&function(e){for(let t=0;t<e.length;t++)if("string"==typeof e[t]&&Nv.test(e[t]))return!0;return!1}(l))&&("transform"!==r||!u)&&!c&&!o&&"mirror"!==a&&0!==s&&"inertia"!==i}class Lv extends zg{constructor({autoplay:e=!0,delay:t=0,type:n="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:a="loop",keyframes:s,name:i,motionValue:l,element:c,...u}){var d;super(),this.stop=()=>{var e,t;this._animation&&(this._animation.stop(),null==(e=this.stopTimeline)||e.call(this)),null==(t=this.keyframeResolver)||t.cancel()},this.createdAt=pm.now();const p={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:o,repeatType:a,name:i,motionValue:l,element:c,...u},f=(null==c?void 0:c.KeyframeResolver)||dv;this.keyframeResolver=new f(s,(e,t,n)=>this.onKeyframesResolved(e,t,p,!n),i,l,c),null==(d=this.keyframeResolver)||d.scheduleResolve()}onKeyframesResolved(e,t,n,r){var o,a;this.keyframeResolver=void 0;const{name:s,type:i,velocity:l,delay:c,isHandoff:u,onUpdate:d}=n;this.resolvedAt=pm.now();let p=!0;(function(e,t,n,r){const o=e[0];if(null===o)return!1;if("display"===t||"visibility"===t)return!0;const a=e[e.length-1],s=Ev(o,t),i=Ev(a,t);return!(!s||!i)&&(function(e){const t=e[0];if(1===e.length)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}(e)||("spring"===n||wv(n))&&r)})(e,s,i,l)||(p=!1,!_h.instantAnimations&&c||null==d||d(Ig(e,n,t)),e[0]=e[e.length-1],Pv(n),n.repeat=0);const f={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},h=p&&!u&&Mv(f),m=null==(a=null==(o=f.motionValue)?void 0:o.owner)?void 0:a.current;let g;if(h)try{g=new Cv({...f,element:m})}catch{g=new Ug(f)}else g=new Ug(f);g.finished.then(()=>{this.notifyFinished()}).catch(Lh),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||(null==(e=this.keyframeResolver)||e.resume(),lv=!0,uv(),cv(),lv=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),null==(e=this.keyframeResolver)||e.cancel()}}function Ov(e,t,n,r=0,o=1){const a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),s=e.size,i=(s-1)*r;return"function"==typeof n?n(a,s):1===o?a*r:i-a*r}const Av=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Dv(e,t,n=1){const[r,o]=function(e){const t=Av.exec(e);if(!t)return[,];const[,n,r,o]=t;return[`--${n??r}`,o]}(e);if(!r)return;const a=window.getComputedStyle(t).getPropertyValue(r);if(a){const e=a.trim();return Nh(e)?parseFloat(e):e}return gm(o)?Dv(o,t,n+1):o}const Iv={type:"spring",stiffness:500,damping:25,restSpeed:10},Fv={type:"keyframes",duration:.8},$v={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},zv=(e,{keyframes:t})=>t.length>2?Fv:ev.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:Iv:$v;function Vv(e,t){if((null==e?void 0:e.inherit)&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function Uv(e,t){const n=(null==e?void 0:e[t])??(null==e?void 0:e.default)??e;return n!==e?Vv(n,e):n}const Bv=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);const Wv=(e,t,n,r={},o,a)=>s=>{const i=Uv(r,e)||{},l=i.delay||r.delay||0;let{elapsed:c=0}=r;c-=Fh(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...i,delay:-c,onUpdate:e=>{t.set(e),i.onUpdate&&i.onUpdate(e)},onComplete:()=>{s(),i.onComplete&&i.onComplete()},name:e,motionValue:t,element:a?void 0:o};(function(e){for(const t in e)if(!Bv.has(t))return!0;return!1})(i)||Object.assign(u,zv(e,u)),u.duration&&(u.duration=Fh(u.duration)),u.repeatDelay&&(u.repeatDelay=Fh(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let d=!1;if((!1===u.type||0===u.duration&&!u.repeatDelay)&&(Pv(u),0===u.delay&&(d=!0)),(_h.instantAnimations||_h.skipAnimations||(null==o?void 0:o.shouldSkipAnimations))&&(d=!0,Pv(u),u.delay=0),u.allowFlatten=!i.type&&!i.ease,d&&!a&&void 0!==t.get()){const e=Ig(u.keyframes,i);if(void 0!==e)return void sm.update(()=>{u.onUpdate(e),u.onComplete()})}return i.isSync?new Ug(u):new Lv(u)};function Hv(e){const t=[{},{}];return null==e||e.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function qv(e,t,n,r){if("function"==typeof t){const[o,a]=Hv(r);t=t(void 0!==n?n:e.custom,o,a)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){const[o,a]=Hv(r);t=t(void 0!==n?n:e.custom,o,a)}return t}function Gv(e,t,n){const r=e.getProps();return qv(r,t,void 0!==n?n:r.custom,e)}const Kv=new Set(["width","height","top","left","right","bottom",...Zg]);class Yv{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{var t;const n=pm.now();if(this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(null==(t=this.events.change)||t.notify(this.current),this.dependents))for(const r of this.dependents)r.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){var t;this.current=e,this.updatedAt=pm.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=(t=this.current,!isNaN(parseFloat(t))))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new Ih);const n=this.events[e].add(t);return"change"===e?()=>{n(),sm.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;null==(e=this.events.change)||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=pm.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return zh(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,t;null==(e=this.dependents)||e.clear(),null==(t=this.events.destroy)||t.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Xv(e,t){return new Yv(e,t)}const Qv=e=>Array.isArray(e);function Jv(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Xv(n))}function Zv(e){return Qv(e)?e[e.length-1]||0:e}const ey=e=>Boolean(e&&e.getVelocity);function ty(e,t){const n=e.getValue("willChange");if(r=n,Boolean(ey(r)&&r.add))return n.add(t);if(!n&&_h.WillChange){const n=new _h.WillChange("auto");e.addValue("willChange",n),n.add(t)}var r}function ny(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const ry="data-"+ny("framerAppearId");function oy(e){return e.props[ry]}function ay({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&!0!==t[n];return t[n]=!1,r}function sy(e,t,{delay:n=0,transitionOverride:r,type:o}={}){let{transition:a,transitionEnd:s,...i}=t;const l=e.getDefaultTransition();a=a?Vv(a,l):l;const c=null==a?void 0:a.reduceMotion;r&&(a=r);const u=[],d=o&&e.animationState&&e.animationState.getState()[o];for(const p in i){const t=e.getValue(p,e.latestValues[p]??null),r=i[p];if(void 0===r||d&&ay(d,p))continue;const o={delay:n,...Uv(a||{},p)},s=t.get();if(void 0!==s&&!t.isAnimating()&&!Array.isArray(r)&&r===s&&!o.velocity){sm.update(()=>t.set(r));continue}let l=!1;if(window.MotionHandoffAnimation){const t=oy(e);if(t){const e=window.MotionHandoffAnimation(t,p,sm);null!==e&&(o.startTime=e,l=!0)}}ty(e,p);const f=c??e.shouldReduceMotion;t.start(Wv(p,t,r,f&&Kv.has(p)?{type:!1}:o,e,l));const h=t.animation;h&&u.push(h)}if(s){const t=()=>sm.update(()=>{s&&function(e,t){const n=Gv(e,t);let{transitionEnd:r={},transition:o={},...a}=n||{};a={...a,...r};for(const s in a)Jv(e,s,Zv(a[s]))}(e,s)});u.length?Promise.all(u).then(t):t()}return u}function iy(e,t,n={}){var r;const o=Gv(e,t,"exit"===n.type?null==(r=e.presenceContext)?void 0:r.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(a=n.transitionOverride);const s=o?()=>Promise.all(sy(e,o,n)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(r=0)=>{const{delayChildren:o=0,staggerChildren:s,staggerDirection:i}=a;return function(e,t,n=0,r=0,o=0,a=1,s){const i=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),i.push(iy(l,t,{...s,delay:n+("function"==typeof r?0:r)+Ov(e.variantChildren,l,r,o,a)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(i)}(e,t,r,o,s,i,n)}:()=>Promise.resolve(),{when:l}=a;if(l){const[e,t]="beforeChildren"===l?[s,i]:[i,s];return e().then(()=>t())}return Promise.all([s(),i(n.delay)])}const ly=e=>t=>t.test(e),cy=[bm,Lm,Mm,Rm,Am,Om,{test:e=>"auto"===e,parse:e=>e}],uy=e=>cy.find(ly(e));function dy(e){return"number"==typeof e?0===e:null===e||("none"===e||"0"===e||Rh(e))}const py=new Set(["brightness","contrast","saturate","opacity"]);function fy(e){const[t,n]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[r]=n.match(Sm)||[];if(!r)return e;const o=n.replace(r,"");let a=py.has(t)?1:0;return r!==n&&(a*=100),t+"("+a+o+")"}const hy=/\b([a-z-]*)\(.*?\)/gu,my={...qm,getAnimatableNone:e=>{const t=e.match(hy);return t?t.map(fy).join(" "):e}},gy={...qm,getAnimatableNone:e=>{const t=qm.parse(e);return qm.createTransformer(e)(t.map(e=>"number"==typeof e?0:"object"==typeof e?{...e,alpha:1}:e))}},vy={...bm,transform:Math.round},yy={borderWidth:Lm,borderTopWidth:Lm,borderRightWidth:Lm,borderBottomWidth:Lm,borderLeftWidth:Lm,borderRadius:Lm,borderTopLeftRadius:Lm,borderTopRightRadius:Lm,borderBottomRightRadius:Lm,borderBottomLeftRadius:Lm,width:Lm,maxWidth:Lm,height:Lm,maxHeight:Lm,top:Lm,right:Lm,bottom:Lm,left:Lm,inset:Lm,insetBlock:Lm,insetBlockStart:Lm,insetBlockEnd:Lm,insetInline:Lm,insetInlineStart:Lm,insetInlineEnd:Lm,padding:Lm,paddingTop:Lm,paddingRight:Lm,paddingBottom:Lm,paddingLeft:Lm,paddingBlock:Lm,paddingBlockStart:Lm,paddingBlockEnd:Lm,paddingInline:Lm,paddingInlineStart:Lm,paddingInlineEnd:Lm,margin:Lm,marginTop:Lm,marginRight:Lm,marginBottom:Lm,marginLeft:Lm,marginBlock:Lm,marginBlockStart:Lm,marginBlockEnd:Lm,marginInline:Lm,marginInlineStart:Lm,marginInlineEnd:Lm,fontSize:Lm,backgroundPositionX:Lm,backgroundPositionY:Lm,...{rotate:Rm,rotateX:Rm,rotateY:Rm,rotateZ:Rm,scale:wm,scaleX:wm,scaleY:wm,scaleZ:wm,skew:Rm,skewX:Rm,skewY:Rm,distance:Lm,translateX:Lm,translateY:Lm,translateZ:Lm,x:Lm,y:Lm,z:Lm,perspective:Lm,transformPerspective:Lm,opacity:xm,originX:Dm,originY:Dm,originZ:Lm},zIndex:vy,fillOpacity:xm,strokeOpacity:xm,numOctaves:vy},by={...yy,color:Fm,backgroundColor:Fm,outlineColor:Fm,fill:Fm,stroke:Fm,borderColor:Fm,borderTopColor:Fm,borderRightColor:Fm,borderBottomColor:Fm,borderLeftColor:Fm,filter:my,WebkitFilter:my,mask:gy,WebkitMask:gy},xy=e=>by[e],wy=new Set([my,gy]);function ky(e,t){let n=xy(e);return wy.has(n)||(n=qm),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Sy=new Set(["auto","none","0"]);class jy extends dv{constructor(e,t,n,r,o){super(e,t,n,r,o,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let i=0;i<e.length;i++){let n=e[i];if("string"==typeof n&&(n=n.trim(),gm(n))){const r=Dv(n,t.current);void 0!==r&&(e[i]=r),i===e.length-1&&(this.finalKeyframe=n)}}if(this.resolveNoneKeyframes(),!Kv.has(n)||2!==e.length)return;const[r,o]=e,a=uy(r),s=uy(o);if(ym(r)!==ym(o)&&ov[n])this.needsMeasurement=!0;else if(a!==s)if(tv(a)&&tv(s))for(let i=0;i<e.length;i++){const t=e[i];"string"==typeof t&&(e[i]=parseFloat(t))}else ov[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,n=[];for(let r=0;r<e.length;r++)(null===e[r]||dy(e[r]))&&n.push(r);n.length&&function(e,t,n){let r,o=0;for(;o<e.length&&!r;){const t=e[o];"string"==typeof t&&!Sy.has(t)&&Bm(t).values.length&&(r=e[o]),o++}if(r&&n)for(const a of t)e[a]=ky(n,r)}(e,n,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ov[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const r=t[t.length-1];void 0!==r&&e.getValue(n,r).jump(r,!1)}measureEndState(){var e;const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const o=t.getValue(n);o&&o.jump(this.measuredOrigin,!1);const a=r.length-1,s=r[a];r[a]=ov[n](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==s&&void 0===this.finalKeyframe&&(this.finalKeyframe=s),(null==(e=this.removedTransforms)?void 0:e.length)&&this.removedTransforms.forEach(([e,n])=>{t.getValue(e).set(n)}),this.resolveNoneKeyframes()}}function Cy(e,t,n){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let t=document;const r=(null==n?void 0:n[e])??t.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e).filter(e=>null!=e)}const Ey=(e,t)=>t&&"number"==typeof e?t.transform(e):e;function Py(e){return Th(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:_y}=am(queueMicrotask,!1),Ny={x:!1,y:!1};function Ty(){return Ny.x||Ny.y}function Ry(e,t){const n=Cy(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function My(e,t,n={}){const[r,o,a]=Ry(e,n);return r.forEach(e=>{let n,r=!1,a=!1;const s=t=>{n&&(n(t),n=void 0),e.removeEventListener("pointerleave",l)},i=e=>{r=!1,window.removeEventListener("pointerup",i),window.removeEventListener("pointercancel",i),a&&(a=!1,s(e))},l=e=>{"touch"!==e.pointerType&&(r?a=!0:s(e))};e.addEventListener("pointerenter",r=>{if("touch"===r.pointerType||Ty())return;a=!1;const s=t(e,r);"function"==typeof s&&(n=s,e.addEventListener("pointerleave",l,o))},o),e.addEventListener("pointerdown",()=>{r=!0,window.addEventListener("pointerup",i,o),window.addEventListener("pointercancel",i,o)},o)}),a}const Ly=(e,t)=>!!t&&(e===t||Ly(e,t.parentElement)),Oy=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary,Ay=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const Dy=new Set(["INPUT","SELECT","TEXTAREA"]);const Iy=new WeakSet;function Fy(e){return t=>{"Enter"===t.key&&e(t)}}function $y(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function zy(e){return Oy(e)&&!Ty()}const Vy=new WeakSet;function Uy(e,t,n={}){const[r,o,a]=Ry(e,n),s=e=>{const r=e.currentTarget;if(!zy(e))return;if(Vy.has(e))return;Iy.add(r),n.stopPropagation&&Vy.add(e);const a=t(r,e),s=(e,t)=>{window.removeEventListener("pointerup",i),window.removeEventListener("pointercancel",l),Iy.has(r)&&Iy.delete(r),zy(e)&&"function"==typeof a&&a(e,{success:t})},i=e=>{s(e,r===window||r===document||n.useGlobalTarget||Ly(r,e.target))},l=e=>{s(e,!1)};window.addEventListener("pointerup",i,o),window.addEventListener("pointercancel",l,o)};return r.forEach(e=>{var t;(n.useGlobalTarget?window:e).addEventListener("pointerdown",s,o),Py(e)&&(e.addEventListener("focus",e=>((e,t)=>{const n=e.currentTarget;if(!n)return;const r=Fy(()=>{if(Iy.has(n))return;$y(n,"down");const e=Fy(()=>{$y(n,"up")});n.addEventListener("keyup",e,t),n.addEventListener("blur",()=>$y(n,"cancel"),t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)})(e,o)),t=e,Ay.has(t.tagName)||!0===t.isContentEditable||e.hasAttribute("tabindex")||(e.tabIndex=0))}),a}function By(e){return Th(e)&&"ownerSVGElement"in e}const Wy=new WeakMap;let Hy;const qy=(e,t,n)=>(r,o)=>o&&o[0]?o[0][e+"Size"]:By(r)&&"getBBox"in r?r.getBBox()[t]:r[n],Gy=qy("inline","width","offsetWidth"),Ky=qy("block","height","offsetHeight");function Yy({target:e,borderBoxSize:t}){var n;null==(n=Wy.get(e))||n.forEach(n=>{n(e,{get width(){return Gy(e,t)},get height(){return Ky(e,t)}})})}function Xy(e){e.forEach(Yy)}function Qy(e,t){Hy||"undefined"!=typeof ResizeObserver&&(Hy=new ResizeObserver(Xy));const n=Cy(e);return n.forEach(e=>{let n=Wy.get(e);n||(n=new Set,Wy.set(e,n)),n.add(t),null==Hy||Hy.observe(e)}),()=>{n.forEach(e=>{const n=Wy.get(e);null==n||n.delete(t),(null==n?void 0:n.size)||null==Hy||Hy.unobserve(e)})}}const Jy=new Set;let Zy;function eb(e){return Jy.add(e),Zy||(Zy=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Jy.forEach(t=>t(e))},window.addEventListener("resize",Zy)),()=>{Jy.delete(e),Jy.size||"function"!=typeof Zy||(window.removeEventListener("resize",Zy),Zy=void 0)}}function tb(e,t){return"function"==typeof e?eb(e):Qy(e,t)}const nb=[...cy,Fm,qm],rb=()=>({x:{min:0,max:0},y:{min:0,max:0}}),ob=new WeakMap;function ab(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function sb(e){return"string"==typeof e||Array.isArray(e)}const ib=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],lb=["initial",...ib];function cb(e){return ab(e.animate)||lb.some(t=>sb(e[t]))}function ub(e){return Boolean(cb(e)||e.variants)}const db={current:null},pb={current:!1},fb="undefined"!=typeof window;function hb(){if(pb.current=!0,fb)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>db.current=e.matches;e.addEventListener("change",t),t()}else db.current=!1}const mb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let gb={};function vb(e){gb=e}class yb{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:o,blockInitialAnimation:a,visualState:s},i={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=dv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const e=pm.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,sm.render(this.render,!1,!0))};const{latestValues:l,renderState:c}=s;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=o,this.options=i,this.blockInitialAnimation=Boolean(a),this.isControllingVariants=cb(t),this.isVariantNode=ub(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(const p in d){const e=d[p];void 0!==l[p]&&ey(e)&&e.set(l[p])}}mount(e){var t,n;if(this.hasBeenMounted)for(const r in this.initialValues)null==(t=this.values.get(r))||t.jump(this.initialValues[r]),this.latestValues[r]=this.initialValues[r];this.current=e,ob.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(pb.current||hb(),this.shouldReduceMotion=db.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,null==(n=this.parent)||n.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),im(this.notifyUpdate),im(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),null==(e=this.parent)||e.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&_v.has(e)&&this.current instanceof HTMLElement){const{factory:n,keyframes:r,times:o,ease:a,duration:s}=t.accelerate,i=new kv({element:this.current,name:e,keyframes:r,times:o,ease:a,duration:Fh(s)}),l=n(i);return void this.valueSubscriptions.set(e,()=>{l(),i.cancel()})}const n=ev.has(e);n&&this.onBindTransform&&this.onBindTransform();const r=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&sm.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),o&&o(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in gb){const t=gb[e];if(!t)continue;const{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){const t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let n=0;n<mb.length;n++){const t=mb[n];this.propEventSubscriptions[t]&&(this.propEventSubscriptions[t](),delete this.propEventSubscriptions[t]);const r=e["on"+t];r&&(this.propEventSubscriptions[t]=this.on(t,r))}this.prevMotionValues=function(e,t,n){for(const r in t){const o=t[r],a=n[r];if(ey(o))e.addValue(r,o);else if(ey(a))e.addValue(r,Xv(o,{owner:e}));else if(a!==o)if(e.hasValue(r)){const t=e.getValue(r);!0===t.liveStyle?t.jump(o):t.hasAnimated||t.set(o)}else{const t=e.getStaticValue(r);e.addValue(r,Xv(void 0!==t?t:o,{owner:e}))}}for(const r in n)void 0===t[r]&&e.removeValue(r);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return void 0===n&&void 0!==t&&(n=Xv(null===t?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];var r;return null!=n&&("string"==typeof n&&(Nh(n)||Rh(n))?n=parseFloat(n):(r=n,!nb.find(ly(r))&&qm.test(t)&&(n=ky(e,t))),this.setBaseTarget(e,ey(n)?n.get():n)),ey(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:n}=this.props;let r;if("string"==typeof n||"object"==typeof n){const o=qv(this.props,n,null==(t=this.presenceContext)?void 0:t.custom);o&&(r=o[e])}if(n&&void 0!==r)return r;const o=this.getBaseTargetFromProps(this.props,e);return void 0===o||ey(o)?void 0!==this.initialValues[e]&&void 0===r?void 0:this.baseTarget[e]:o}on(e,t){return this.events[e]||(this.events[e]=new Ih),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){_y.render(this.render)}}class bb extends yb{constructor(){super(...arguments),this.KeyframeResolver=jy}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){const n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;ey(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}class xb{constructor(e){this.isMounted=!1,this.node=e}update(){}}function wb({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function kb(e){return void 0===e||1===e}function Sb({scale:e,scaleX:t,scaleY:n}){return!kb(e)||!kb(t)||!kb(n)}function jb(e){return Sb(e)||Cb(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Cb(e){return Eb(e.x)||Eb(e.y)}function Eb(e){return e&&"0%"!==e}function Pb(e,t,n){return n+t*(e-n)}function _b(e,t,n,r,o){return void 0!==o&&(e=Pb(e,o,r)),Pb(e,n,r)+t}function Nb(e,t=0,n=1,r,o){e.min=_b(e.min,t,n,r,o),e.max=_b(e.max,t,n,r,o)}function Tb(e,{x:t,y:n}){Nb(e.x,t.translate,t.scale,t.originPoint),Nb(e.y,n.translate,n.scale,n.originPoint)}const Rb=.999999999999,Mb=1.0000000000001;function Lb(e,t){e.min+=t,e.max+=t}function Ob(e,t,n,r,o=.5){Nb(e,t,n,Ym(e.min,e.max,o),r)}function Ab(e,t){return"string"==typeof e?parseFloat(e)/100*(t.max-t.min):e}function Db(e,t,n){const r=n??e;Ob(e.x,Ab(t.x,r.x),t.scaleX,t.scale,t.originX),Ob(e.y,Ab(t.y,r.y),t.scaleY,t.scale,t.originY)}function Ib(e,t){return wb(function(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(e.getBoundingClientRect(),t))}const Fb={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},$b=Zg.length;function zb(e,t,n){const{style:r,vars:o,transformOrigin:a}=e;let s=!1,i=!1;for(const l in t){const e=t[l];if(ev.has(l))s=!0;else if(hm(l))o[l]=e;else{const t=Ey(e,yy[l]);l.startsWith("origin")?(i=!0,a[l]=t):r[l]=t}}if(t.transform||(s||n?r.transform=function(e,t,n){let r="",o=!0;for(let a=0;a<$b;a++){const s=Zg[a],i=e[s];if(void 0===i)continue;let l=!0;if("number"==typeof i)l=i===(s.startsWith("scale")?1:0);else{const e=parseFloat(i);l=s.startsWith("scale")?1===e:0===e}if(!l||n){const e=Ey(i,yy[s]);l||(o=!1,r+=`${Fb[s]||s}(${e}) `),n&&(t[s]=e)}}return r=r.trim(),n?r=n(t,o?"":r):o&&(r="none"),r}(t,e.transform,n):r.transform&&(r.transform="none")),i){const{originX:e="50%",originY:t="50%",originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function Vb(e,{style:t,vars:n},r,o){const a=e.style;let s;for(s in t)a[s]=t[s];for(s in null==o||o.applyProjectionStyles(a,r),n)a.setProperty(s,n[s])}function Ub(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Bb={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e){if(!Lm.test(e))return e;e=parseFloat(e)}return`${Ub(e,t.target.x)}% ${Ub(e,t.target.y)}%`}},Wb={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,o=qm.parse(e);if(o.length>5)return r;const a=qm.createTransformer(e),s="number"!=typeof o[0]?1:0,i=n.x.scale*t.x,l=n.y.scale*t.y;o[0+s]/=i,o[1+s]/=l;const c=Ym(i,l,.5);return"number"==typeof o[2+s]&&(o[2+s]/=c),"number"==typeof o[3+s]&&(o[3+s]/=c),a(o)}},Hb={borderRadius:{...Bb,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Bb,borderTopRightRadius:Bb,borderBottomLeftRadius:Bb,borderBottomRightRadius:Bb,boxShadow:Wb};function qb(e,{layout:t,layoutId:n}){return ev.has(e)||e.startsWith("origin")||(t||void 0!==n)&&(!!Hb[e]||"opacity"===e)}function Gb(e,t,n){var r;const o=e.style,a=null==t?void 0:t.style,s={};if(!o)return s;for(const i in o)(ey(o[i])||a&&ey(a[i])||qb(i,e)||void 0!==(null==(r=null==n?void 0:n.getValue(i))?void 0:r.liveStyle))&&(s[i]=o[i]);return s}class Kb extends bb{constructor(){super(...arguments),this.type="html",this.renderInstance=Vb}readValueFromInstance(e,t){var n,r;if(ev.has(t))return(null==(n=this.projection)?void 0:n.isProjecting)?Xg(t):((e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Qg(n,t)})(e,t);{const n=(r=e,window.getComputedStyle(r)),o=(hm(t)?n.getPropertyValue(t):n[t])||0;return"string"==typeof o?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Ib(e,t)}build(e,t,n){zb(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Gb(e,t,n)}}const Yb={offset:"stroke-dashoffset",array:"stroke-dasharray"},Xb={offset:"strokeDashoffset",array:"strokeDasharray"};const Qb=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Jb(e,{attrX:t,attrY:n,attrScale:r,pathLength:o,pathSpacing:a=1,pathOffset:s=0,...i},l,c,u){if(zb(e,i,c),l)return void(e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox));e.attrs=e.style,e.style={};const{attrs:d,style:p}=e;d.transform&&(p.transform=d.transform,delete d.transform),(p.transform||d.transformOrigin)&&(p.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),p.transform&&(p.transformBox=(null==u?void 0:u.transformBox)??"fill-box",delete d.transformBox);for(const f of Qb)void 0!==d[f]&&(p[f]=d[f],delete d[f]);void 0!==t&&(d.x=t),void 0!==n&&(d.y=n),void 0!==r&&(d.scale=r),void 0!==o&&function(e,t,n=1,r=0,o=!0){e.pathLength=1;const a=o?Yb:Xb;e[a.offset]=""+-r,e[a.array]=`${t} ${n}`}(d,o,a,s,!1)}const Zb=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),ex=e=>"string"==typeof e&&"svg"===e.toLowerCase();function tx(e,t,n){const r=Gb(e,t,n);for(const o in e)if(ey(e[o])||ey(t[o])){r[-1!==Zg.indexOf(o)?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o]=e[o]}return r}class nx extends bb{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=rb}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(ev.has(t)){const e=xy(t);return e&&e.default||0}return t=Zb.has(t)?t:ny(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return tx(e,t,n)}build(e,t,n){Jb(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){!function(e,t,n,r){Vb(e,t,void 0,r);for(const o in t.attrs)e.setAttribute(Zb.has(o)?o:ny(o),t.attrs[o])}(e,t,0,r)}mount(e){this.isSVGTag=ex(e.tagName),super.mount(e)}}const rx=lb.length;function ox(e){if(!e)return;if(!e.isControllingVariants){const t=e.parent&&ox(e.parent)||{};return void 0!==e.props.initial&&(t.initial=e.props.initial),t}const t={};for(let n=0;n<rx;n++){const r=lb[n],o=e.props[r];(sb(o)||!1===o)&&(t[r]=o)}return t}function ax(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const sx=[...ib].reverse(),ix=ib.length;function lx(e){return t=>Promise.all(t.map(({animation:t,options:n})=>function(e,t,n={}){let r;if(e.notify("AnimationStart",t),Array.isArray(t)){const o=t.map(t=>iy(e,t,n));r=Promise.all(o)}else if("string"==typeof t)r=iy(e,t,n);else{const o="function"==typeof t?Gv(e,t,n.custom):t;r=Promise.all(sy(e,o,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}(e,t,n)))}function cx(e){let t=lx(e),n=px(),r=!0,o=!1;const a=t=>(n,r)=>{var o;const a=Gv(e,r,"exit"===t?null==(o=e.presenceContext)?void 0:o.custom:void 0);if(a){const{transition:e,transitionEnd:t,...r}=a;n={...n,...r,...t}}return n};function s(s){const{props:i}=e,l=ox(e.parent)||{},c=[],u=new Set;let d={},p=1/0;for(let t=0;t<ix;t++){const f=sx[t],h=n[f],m=void 0!==i[f]?i[f]:l[f],g=sb(m),v=f===s?h.isActive:null;!1===v&&(p=t);let y=m===l[f]&&m!==i[f]&&g;if(y&&(r||o)&&e.manuallyAnimateOnMount&&(y=!1),h.protectedKeys={...d},!h.isActive&&null===v||!m&&!h.prevProp||ab(m)||"boolean"==typeof m)continue;if("exit"===f&&h.isActive&&!0!==v){h.prevResolvedValues&&(d={...d,...h.prevResolvedValues});continue}const b=ux(h.prevProp,m);let x=b||f===s&&h.isActive&&!y&&g||t>p&&g,w=!1;const k=Array.isArray(m)?m:[m];let S=k.reduce(a(f),{});!1===v&&(S={});const{prevResolvedValues:j={}}=h,C={...j,...S},E=t=>{x=!0,u.has(t)&&(w=!0,u.delete(t)),h.needsAnimating[t]=!0;const n=e.getValue(t);n&&(n.liveStyle=!1)};for(const e in C){const t=S[e],n=j[e];if(d.hasOwnProperty(e))continue;let r=!1;r=Qv(t)&&Qv(n)?!ax(t,n):t!==n,r?null!=t?E(e):u.add(e):void 0!==t&&u.has(e)?E(e):h.protectedKeys[e]=!0}h.prevProp=m,h.prevResolvedValues=S,h.isActive&&(d={...d,...S}),(r||o)&&e.blockInitialAnimation&&(x=!1);const P=y&&b;x&&(!P||w)&&c.push(...k.map(t=>{const n={type:f};if("string"==typeof t&&(r||o)&&!P&&e.manuallyAnimateOnMount&&e.parent){const{parent:r}=e,o=Gv(r,t);if(r.enteringChildren&&o){const{delayChildren:t}=o.transition||{};n.delay=Ov(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){const t={};if("boolean"!=typeof i.initial){const n=Gv(e,Array.isArray(i.initial)?i.initial[0]:i.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{const r=e.getBaseTarget(n),o=e.getValue(n);o&&(o.liveStyle=!0),t[n]=r??null}),c.push({animation:t})}let f=Boolean(c.length);return!r||!1!==i.initial&&i.initial!==i.animate||e.manuallyAnimateOnMount||(f=!1),r=!1,o=!1,f?t(c):Promise.resolve()}return{animateChanges:s,setActive:function(t,r){var o;if(n[t].isActive===r)return Promise.resolve();null==(o=e.variantChildren)||o.forEach(e=>{var n;return null==(n=e.animationState)?void 0:n.setActive(t,r)}),n[t].isActive=r;const a=s(t);for(const e in n)n[e].protectedKeys={};return a},setAnimateFunction:function(n){t=n(e)},getState:()=>n,reset:()=>{n=px(),o=!0}}}function ux(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!ax(t,e)}function dx(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function px(){return{animate:dx(!0),whileInView:dx(),whileHover:dx(),whileTap:dx(),whileDrag:dx(),whileFocus:dx(),exit:dx()}}function fx(e,t){e.min=t.min,e.max=t.max}function hx(e,t){fx(e.x,t.x),fx(e.y,t.y)}function mx(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function gx(e){return e.max-e.min}function vx(e,t,n,r=.5){e.origin=r,e.originPoint=Ym(t.min,t.max,e.origin),e.scale=gx(n)/gx(t),e.translate=Ym(n.min,n.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function yx(e,t,n,r){vx(e.x,t.x,n.x,r?r.originX:void 0),vx(e.y,t.y,n.y,r?r.originY:void 0)}function bx(e,t,n,r=0){const o=r?Ym(n.min,n.max,r):n.min;e.min=o+t.min,e.max=e.min+gx(t)}function xx(e,t,n,r=0){const o=r?Ym(n.min,n.max,r):n.min;e.min=t.min-o,e.max=e.min+gx(t)}function wx(e,t,n,r){xx(e.x,t.x,n.x,null==r?void 0:r.x),xx(e.y,t.y,n.y,null==r?void 0:r.y)}function kx(e,t,n,r,o){return e=Pb(e-=t,1/n,r),void 0!==o&&(e=Pb(e,1/o,r)),e}function Sx(e,t,[n,r,o],a,s){!function(e,t=0,n=1,r=.5,o,a=e,s=e){Mm.test(t)&&(t=parseFloat(t),t=Ym(s.min,s.max,t/100)-s.min);if("number"!=typeof t)return;let i=Ym(a.min,a.max,r);e===a&&(i-=t),e.min=kx(e.min,t,n,i,o),e.max=kx(e.max,t,n,i,o)}(e,t[n],t[r],t[o],t.scale,a,s)}const jx=["x","scaleX","originX"],Cx=["y","scaleY","originY"];function Ex(e,t,n,r){Sx(e.x,t,jx,n?n.x:void 0,r?r.x:void 0),Sx(e.y,t,Cx,n?n.y:void 0,r?r.y:void 0)}function Px(e){return 0===e.translate&&1===e.scale}function _x(e){return Px(e.x)&&Px(e.y)}function Nx(e,t){return e.min===t.min&&e.max===t.max}function Tx(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Rx(e,t){return Tx(e.x,t.x)&&Tx(e.y,t.y)}function Mx(e){return gx(e.x)/gx(e.y)}function Lx(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Ox(e){return[e("x"),e("y")]}const Ax=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],Dx=Ax.length,Ix=e=>"string"==typeof e?parseFloat(e):e,Fx=e=>"number"==typeof e||Lm.test(e);function $x(e,t){return void 0!==e[t]?e[t]:e.borderRadius}const zx=Ux(0,.5,Xh),Vx=Ux(.5,.95,Lh);function Ux(e,t,n){return r=>r<e?0:r>t?1:n(Dh(e,t,r))}function Bx(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const Wx=(e,t)=>e.depth-t.depth;class Hx{constructor(){this.children=[],this.isDirty=!1}add(e){Ch(this.children,e),this.isDirty=!0}remove(e){Eh(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Wx),this.isDirty=!1,this.children.forEach(e)}}function qx(e){return ey(e)?e.get():e}class Gx{constructor(){this.members=[]}add(e){Ch(this.members,e);for(let t=this.members.length-1;t>=0;t--){const n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;const r=n.instance;r&&!1!==r.isConnected||n.snapshot||(Eh(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Eh(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){var t;for(let n=this.members.indexOf(e)-1;n>=0;n--){const e=this.members[n];if(!1!==e.isPresent&&!1!==(null==(t=e.instance)?void 0:t.isConnected))return this.promote(e),!0}return!1}promote(e,t){var n;const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.updateSnapshot(),e.scheduleRender();const{layoutDependency:o}=r.options,{layoutDependency:a}=e.options;void 0!==o&&o===a||(e.resumeFrom=r,t&&(r.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),(null==(n=e.root)?void 0:n.isUpdating)&&(e.isLayoutDirty=!0)),!1===e.options.crossfade&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{var t,n,r,o,a;null==(n=(t=e.options).onExitComplete)||n.call(t),null==(a=null==(r=e.resumingFrom)?void 0:(o=r.options).onExitComplete)||a.call(o)})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){var e;(null==(e=this.lead)?void 0:e.snapshot)&&(this.lead.snapshot=void 0)}}const Kx={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Yx=["","X","Y","Z"];let Xx=0;function Qx(e,t,n,r){const{latestValues:o}=t;o[e]&&(n[e]=o[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Jx(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=oy(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",sm,!(t||r))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Jx(r)}function Zx({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(e={},n=(null==t?void 0:t())){this.id=Xx++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(nw),this.nodes.forEach(dw),this.nodes.forEach(pw),this.nodes.forEach(rw)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new Hx)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new Ih),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){const n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;var n;this.isSVG=By(t)&&!(By(n=t)&&"svg"===n.tagName),this.instance=t;const{layoutId:r,layout:o,visualElement:a}=this.options;if(a&&!a.current&&a.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(o||r)&&(this.isLayoutDirty=!0),e){let n,r=0;const o=()=>this.root.updateBlockedByResize=!1;sm.read(()=>{r=window.innerWidth}),e(t,()=>{const e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=function(e,t){const n=pm.now(),r=({timestamp:o})=>{const a=o-n;a>=t&&(im(r),e(a-t))};return sm.setup(r,!0),()=>im(r)}(o,250),Kx.hasAnimatedSinceResize&&(Kx.hasAnimatedSinceResize=!1,this.nodes.forEach(uw)))})}r&&this.root.registerSharedNode(r,this),!1!==this.options.animate&&a&&(r||o)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const o=this.options.transition||a.getDefaultTransition()||yw,{onLayoutAnimationStart:s,onLayoutAnimationComplete:i}=a.getProps(),l=!this.targetLayout||!Rx(this.targetLayout,r),c=!t&&n;if(this.options.layoutRoot||this.resumeFrom||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const t={...Uv(o,"layout"),onPlay:s,onComplete:i};(a.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,c)}else t||uw(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),im(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(fw),this.animationId++)}getTransformTemplate(){const{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Jx(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let o=0;o<this.path.length;o++){const e=this.path[o];e.shouldResetTransform=!0,"string"!=typeof e.latestValues.x&&"string"!=typeof e.latestValues.y||(e.isLayoutDirty=!0),e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:t,layout:n}=this.options;if(void 0===t&&!n)return;const r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked()){const e=this.updateBlockedByResize;return this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(sw),void this.nodes.forEach(aw)}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(iw);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(lw),this.nodes.forEach(cw),this.nodes.forEach(ew),this.nodes.forEach(tw)):this.nodes.forEach(iw),this.clearAllSnapshots();const e=pm.now();lm.delta=Ph(0,1e3/60,e-lm.timestamp),lm.timestamp=e,lm.isProcessing=!0,cm.update.process(lm),cm.preRender.process(lm),cm.render.process(lm),lm.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,_y.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ow),this.sharedNodes.forEach(hw)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,sm.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){sm.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||gx(this.snapshot.measuredBox.x)||gx(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let n=0;n<this.path.length;n++){this.path[n].updateScroll()}const e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected={x:{min:0,max:0},y:{min:0,max:0}}),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){const t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!o)return;const e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!_x(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,""):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||jb(this.latestValues)||a)&&(o(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){const t=this.measurePageBox();let n=this.removeElementScroll(t);var r;return e&&(n=this.removeTransform(n)),ww((r=n).x),ww(r.y),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){var e;const{visualElement:t}=this.options;if(!t)return{x:{min:0,max:0},y:{min:0,max:0}};const n=t.measureViewportBox();if(!((null==(e=this.scroll)?void 0:e.wasRoot)||this.path.some(Sw))){const{scroll:e}=this.root;e&&(Lb(n.x,e.offset.x),Lb(n.y,e.offset.y))}return n}removeElementScroll(e){var t;const n={x:{min:0,max:0},y:{min:0,max:0}};if(hx(n,e),null==(t=this.scroll)?void 0:t.wasRoot)return n;for(let r=0;r<this.path.length;r++){const t=this.path[r],{scroll:o,options:a}=t;t!==this.root&&o&&a.layoutScroll&&(o.wasRoot&&hx(n,e),Lb(n.x,o.offset.x),Lb(n.y,o.offset.y))}return n}applyTransform(e,t=!1,n){var r,o;const a=n||{x:{min:0,max:0},y:{min:0,max:0}};hx(a,e);for(let s=0;s<this.path.length;s++){const e=this.path[s];!t&&e.options.layoutScroll&&e.scroll&&e!==e.root&&(Lb(a.x,-e.scroll.offset.x),Lb(a.y,-e.scroll.offset.y)),jb(e.latestValues)&&Db(a,e.latestValues,null==(r=e.layout)?void 0:r.layoutBox)}return jb(this.latestValues)&&Db(a,this.latestValues,null==(o=this.layout)?void 0:o.layoutBox),a}removeTransform(e){var t;const n={x:{min:0,max:0},y:{min:0,max:0}};hx(n,e);for(let r=0;r<this.path.length;r++){const e=this.path[r];if(!jb(e.latestValues))continue;let o;e.instance&&(Sb(e.latestValues)&&e.updateSnapshot(),o=rb(),hx(o,e.measurePageBox())),Ex(n,e.latestValues,null==(t=e.snapshot)?void 0:t.layoutBox,o)}return jb(this.latestValues)&&Ex(n,this.latestValues),n}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==lm.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){var t;const n=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=n.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=n.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=n.isSharedProjectionDirty);const r=Boolean(this.resumingFrom)||this!==n;if(!(e||r&&this.isSharedProjectionDirty||this.isProjectionDirty||(null==(t=this.parent)?void 0:t.isProjectionDirty)||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:o,layoutId:a}=this.options;if(!this.layout||!o&&!a)return;this.resolvedRelativeTargetAt=lm.timestamp;const s=this.getClosestProjectingParent();var i,l,c,u;(s&&this.linkedParentVersion!==s.layoutVersion&&!s.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(!1!==this.options.layoutAnchor&&s&&s.layout?this.createRelativeTarget(s,this.layout.layoutBox,s.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta)&&(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),i=this.target,l=this.relativeTarget,c=this.relativeParent.target,u=this.options.layoutAnchor||void 0,bx(i.x,l.x,c.x,null==u?void 0:u.x),bx(i.y,l.y,c.y,null==u?void 0:u.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.applyTransform(this.layout.layoutBox,!1,this.target):hx(this.target,this.layout.layoutBox),Tb(this.target,this.targetDelta)):hx(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,!1!==this.options.layoutAnchor&&s&&Boolean(s.resumingFrom)===Boolean(this.resumingFrom)&&!s.options.layoutScroll&&s.target&&1!==this.animationProgress?this.createRelativeTarget(s,this.target,s.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(this.parent&&!Sb(this.parent.latestValues)&&!Cb(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},wx(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),hx(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var e;const t=this.getLead(),n=Boolean(this.resumingFrom)||this!==t;let r=!0;if((this.isProjectionDirty||(null==(e=this.parent)?void 0:e.isProjectionDirty))&&(r=!1),n&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===lm.timestamp&&(r=!1),r)return;const{layout:o,layoutId:a}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!o&&!a)return;hx(this.layoutCorrected,this.layout.layoutBox);const s=this.treeScale.x,i=this.treeScale.y;!function(e,t,n,r=!1){var o;const a=n.length;if(!a)return;let s,i;t.x=t.y=1;for(let l=0;l<a;l++){s=n[l],i=s.projectionDelta;const{visualElement:a}=s.options;a&&a.props.style&&"contents"===a.props.style.display||(r&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(Lb(e.x,-s.scroll.offset.x),Lb(e.y,-s.scroll.offset.y)),i&&(t.x*=i.x.scale,t.y*=i.y.scale,Tb(e,i)),r&&jb(s.latestValues)&&Db(e,s.latestValues,null==(o=s.layout)?void 0:o.layoutBox))}t.x<Mb&&t.x>Rb&&(t.x=1),t.y<Mb&&t.y>Rb&&(t.y=1)}(this.layoutCorrected,this.treeScale,this.path,n),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:l}=t;l?(this.projectionDelta&&this.prevProjectionDelta?(mx(this.prevProjectionDelta.x,this.projectionDelta.x),mx(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),yx(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===s&&this.treeScale.y===i&&Lx(this.projectionDelta.x,this.prevProjectionDelta.x)&&Lx(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){var t;if(null==(t=this.options.visualElement)||t.scheduleRender(),e){const e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(e,t=!1){const n=this.snapshot,r=n?n.latestValues:{},o={...this.latestValues},a={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;const s={x:{min:0,max:0},y:{min:0,max:0}},i=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),c=!l||l.members.length<=1,u=Boolean(i&&!c&&!0===this.options.crossfade&&!this.path.some(vw));let d;this.animationProgress=0,this.mixTargetDelta=t=>{const n=t/1e3;var l,p,f,h;mw(a.x,e.x,n),mw(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(wx(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),l=this.relativeTarget,p=this.relativeTargetOrigin,f=s,h=n,gw(l.x,p.x,f.x,h),gw(l.y,p.y,f.y,h),d&&function(e,t){return Nx(e.x,t.x)&&Nx(e.y,t.y)}(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||(d={x:{min:0,max:0},y:{min:0,max:0}}),hx(d,this.relativeTarget)),i&&(this.animationValues=o,function(e,t,n,r,o,a){o?(e.opacity=Ym(0,n.opacity??1,zx(r)),e.opacityExit=Ym(t.opacity??1,0,Vx(r))):a&&(e.opacity=Ym(t.opacity??1,n.opacity??1,r));for(let s=0;s<Dx;s++){const o=Ax[s];let a=$x(t,o),i=$x(n,o);void 0===a&&void 0===i||(a||(a=0),i||(i=0),0===a||0===i||Fx(a)===Fx(i)?(e[o]=Math.max(Ym(Ix(a),Ix(i),r),0),(Mm.test(i)||Mm.test(a))&&(e[o]+="%")):e[o]=i)}(t.rotate||n.rotate)&&(e.rotate=Ym(t.rotate||0,n.rotate||0,r))}(o,r,this.latestValues,n,u,c)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){var t,n,r;this.notifyListeners("animationStart"),null==(t=this.currentAnimation)||t.stop(),null==(r=null==(n=this.resumingFrom)?void 0:n.currentAnimation)||r.stop(),this.pendingAnimation&&(im(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=sm.update(()=>{Kx.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Xv(0)),this.motionValue.jump(0,!1),this.currentAnimation=function(e,t,n){const r=ey(e)?e:Xv(e);return r.start(Wv("",r,t,n)),r.animation}(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const e=this.getLead();let{targetWithTransforms:t,target:n,layout:r,latestValues:o}=e;if(t&&n&&r){if(this!==e&&this.layout&&r&&kw(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const t=gx(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;const r=gx(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}hx(t,n),Db(t,o),yx(this.projectionDeltaWithTransform,this.layoutCorrected,t,o)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new Gx);this.sharedNodes.get(e).add(t);const n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){const e=this.getStack();return!e||e.lead===this}getLead(){var e;const{layoutId:t}=this.options;return t&&(null==(e=this.getStack())?void 0:e.lead)||this}getPrevLead(){var e;const{layoutId:t}=this.options;return t?null==(e=this.getStack())?void 0:e.prevLead:void 0}getStack(){const{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){const r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){const e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){const{visualElement:e}=this.options;if(!e)return;let t=!1;const{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;const r={};n.z&&Qx("z",e,r,this.animationValues);for(let o=0;o<Yx.length;o++)Qx(`rotate${Yx[o]}`,e,r,this.animationValues),Qx(`skew${Yx[o]}`,e,r,this.animationValues);e.render();for(const o in r)e.setStaticValue(o,r[o]),this.animationValues&&(this.animationValues[o]=r[o]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible)return void(e.visibility="hidden");const n=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=qx(null==t?void 0:t.pointerEvents)||"",void(e.transform=n?n(this.latestValues,""):"none");const r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target)return this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=qx(null==t?void 0:t.pointerEvents)||""),void(this.hasProjected&&!jb(this.latestValues)&&(e.transform=n?n({},""):"none",this.hasProjected=!1));e.visibility="";const o=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=function(e,t,n){let r="";const o=e.x.translate/t.x,a=e.y.translate/t.y,s=(null==n?void 0:n.z)||0;if((o||a||s)&&(r=`translate3d(${o}px, ${a}px, ${s}px) `),1===t.x&&1===t.y||(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:e,rotate:t,rotateX:o,rotateY:a,skewX:s,skewY:i}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),o&&(r+=`rotateX(${o}deg) `),a&&(r+=`rotateY(${a}deg) `),s&&(r+=`skewX(${s}deg) `),i&&(r+=`skewY(${i}deg) `)}const i=e.x.scale*t.x,l=e.y.scale*t.y;return 1===i&&1===l||(r+=`scale(${i}, ${l})`),r||"none"}(this.projectionDeltaWithTransform,this.treeScale,o);n&&(a=n(o,a)),e.transform=a;const{x:s,y:i}=this.projectionDelta;e.transformOrigin=`${100*s.origin}% ${100*i.origin}% 0`,r.animationValues?e.opacity=r===this?o.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:o.opacityExit:e.opacity=r===this?void 0!==o.opacity?o.opacity:"":void 0!==o.opacityExit?o.opacityExit:0;for(const l in Hb){if(void 0===o[l])continue;const{correct:t,applyTo:n,isCSSVariable:s}=Hb[l],i="none"===a?o[l]:t(o[l],r);if(n){const t=n.length;for(let r=0;r<t;r++)e[n[r]]=i}else s?this.options.visualElement.renderState.vars[l]=i:e[l]=i}this.options.layoutId&&(e.pointerEvents=r===this?qx(null==t?void 0:t.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>{var t;return null==(t=e.currentAnimation)?void 0:t.stop()}),this.root.nodes.forEach(aw),this.root.sharedNodes.clear()}}}function ew(e){e.updateLayout()}function tw(e){var t;const n=(null==(t=e.resumeFrom)?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:t,measuredBox:r}=e.layout,{animationType:o}=e.options,a=n.source!==e.layout.source;if("size"===o)Ox(e=>{const r=a?n.measuredBox[e]:n.layoutBox[e],o=gx(r);r.min=t[e].min,r.max=r.min+o});else if("x"===o||"y"===o){const e="x"===o?"y":"x";fx(a?n.measuredBox[e]:n.layoutBox[e],t[e])}else kw(o,n.layoutBox,t)&&Ox(r=>{const o=a?n.measuredBox[r]:n.layoutBox[r],s=gx(t[r]);o.max=o.min+s,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+s)});const s={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};yx(s,t,n.layoutBox);const i={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};a?yx(i,e.applyTransform(r,!0),n.measuredBox):yx(i,t,n.layoutBox);const l=!_x(s);let c=!1;if(!e.resumeFrom){const r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){const{snapshot:o,layout:a}=r;if(o&&a){const s=e.options.layoutAnchor||void 0,i={x:{min:0,max:0},y:{min:0,max:0}};wx(i,n.layoutBox,o.layoutBox,s);const l={x:{min:0,max:0},y:{min:0,max:0}};wx(l,t,a.layoutBox,s),Rx(i,l)||(c=!0),r.options.layoutRoot&&(e.relativeTarget=l,e.relativeTargetOrigin=i,e.relativeParent=r)}}}e.notifyListeners("didUpdate",{layout:t,snapshot:n,delta:i,layoutDelta:s,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function nw(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=Boolean(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function rw(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ow(e){e.clearSnapshot()}function aw(e){e.clearMeasurements()}function sw(e){e.isLayoutDirty=!0,e.updateLayout()}function iw(e){e.isLayoutDirty=!1}function lw(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function cw(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function uw(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function dw(e){e.resolveTargetDelta()}function pw(e){e.calcProjection()}function fw(e){e.resetSkewAndRotation()}function hw(e){e.removeLeadSnapshot()}function mw(e,t,n){e.translate=Ym(t.translate,0,n),e.scale=Ym(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function gw(e,t,n,r){e.min=Ym(t.min,n.min,r),e.max=Ym(t.max,n.max,r)}function vw(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}const yw={duration:.45,ease:[.4,0,.1,1]},bw=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),xw=bw("applewebkit/")&&!bw("chrome/")?Math.round:Lh;function ww(e){e.min=xw(e.min),e.max=xw(e.max)}function kw(e,t,n){return"position"===e||"preserve-aspect"===e&&(r=Mx(t),o=Mx(n),a=.2,!(Math.abs(r-o)<=a));var r,o,a}function Sw(e){var t;return e!==e.root&&(null==(t=e.scroll)?void 0:t.wasRoot)}const jw=Zx({attachResizeListener:(e,t)=>Bx(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||(null==(e=document.body)?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||(null==(t=document.body)?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),Cw={current:void 0},Ew=Zx({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Cw.current){const e=new jw({});e.mount(window),e.setOptions({layoutScroll:!0}),Cw.current=e}return Cw.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),Pw=W.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function _w(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Nw(...e){return W.useCallback(function(...e){return t=>{let n=!1;const r=e.map(e=>{const r=_w(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():_w(e[t],null)}}}}(...e),e)}class Tw extends W.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(Py(t)&&e.isPresent&&!this.props.isPresent&&!1!==this.props.pop){const e=t.offsetParent,n=Py(e)&&e.offsetWidth||0,r=Py(e)&&e.offsetHeight||0,o=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(o.height),a.width=parseFloat(o.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top}return null}componentDidUpdate(){}render(){return this.props.children}}function Rw({children:e,isPresent:t,anchorX:n,anchorY:r,root:o,pop:a}){var s;const i=W.useId(),l=W.useRef(null),c=W.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:u}=W.useContext(Pw),d=(null==(s=e.props)?void 0:s.ref)??(null==e?void 0:e.ref),p=Nw(l,d);return W.useInsertionEffect(()=>{const{width:e,height:s,top:d,left:p,right:f,bottom:h}=c.current;if(t||!1===a||!l.current||!e||!s)return;const m="left"===n?`left: ${p}`:`right: ${f}`,g="bottom"===r?`bottom: ${h}`:`top: ${d}`;l.current.dataset.motionPopId=i;const v=document.createElement("style");u&&(v.nonce=u);const y=o??document.head;return y.appendChild(v),v.sheet&&v.sheet.insertRule(`\n [data-motion-pop-id="${i}"] {\n position: absolute !important;\n width: ${e}px !important;\n height: ${s}px !important;\n ${m}px !important;\n ${g}px !important;\n }\n `),()=>{var e;null==(e=l.current)||e.removeAttribute("data-motion-pop-id"),y.contains(v)&&y.removeChild(v)}},[t]),ee.jsx(Tw,{isPresent:t,childRef:l,sizeRef:c,pop:a,children:!1===a?e:W.cloneElement(e,{ref:p})})}const Mw=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:o,presenceAffectsLayout:a,mode:s,anchorX:i,anchorY:l,root:c})=>{const u=kh(Lw),d=W.useId();let p=!0,f=W.useMemo(()=>(p=!1,{id:d,initial:t,isPresent:n,custom:o,onExitComplete:e=>{u.set(e,!0);for(const t of u.values())if(!t)return;r&&r()},register:e=>(u.set(e,!1),()=>u.delete(e))}),[n,u,r]);return a&&p&&(f={...f}),W.useMemo(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),W.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=ee.jsx(Rw,{pop:"popLayout"===s,isPresent:n,anchorX:i,anchorY:l,root:c,children:e}),ee.jsx(jh.Provider,{value:f,children:e})};function Lw(){return new Map}function Ow(e=!0){const t=W.useContext(jh);if(null===t)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=t,a=W.useId();W.useEffect(()=>{if(e)return o(a)},[e]);const s=W.useCallback(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,s]:[!0]}const Aw=e=>e.key||"";function Dw(e){const t=[];return W.Children.forEach(e,e=>{W.isValidElement(e)&&t.push(e)}),t}const Iw=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:o=!0,mode:a="sync",propagate:s=!1,anchorX:i="left",anchorY:l="top",root:c})=>{const[u,d]=Ow(s),p=W.useMemo(()=>Dw(e),[e]),f=s&&!u?[]:p.map(Aw),h=W.useRef(!0),m=W.useRef(p),g=kh(()=>new Map),v=W.useRef(new Set),[y,b]=W.useState(p),[x,w]=W.useState(p);Sh(()=>{h.current=!1,m.current=p;for(let e=0;e<x.length;e++){const t=Aw(x[e]);f.includes(t)?(g.delete(t),v.current.delete(t)):!0!==g.get(t)&&g.set(t,!1)}},[x,f.length,f.join("-")]);const k=[];if(p!==y){let e=[...p];for(let t=0;t<x.length;t++){const n=x[t],r=Aw(n);f.includes(r)||(e.splice(t,0,n),k.push(n))}return"wait"===a&&k.length&&(e=k),w(Dw(e)),b(p),null}const{forceRender:S}=W.useContext(wh);return ee.jsx(ee.Fragment,{children:x.map(e=>{const y=Aw(e),b=!(s&&!u)&&(p===x||f.includes(y));return ee.jsx(Mw,{isPresent:b,initial:!(h.current&&!n)&&void 0,custom:t,presenceAffectsLayout:o,mode:a,root:c,onExitComplete:b?void 0:()=>{if(v.current.has(y))return;if(!g.has(y))return;v.current.add(y),g.set(y,!0);let e=!0;g.forEach(t=>{t||(e=!1)}),e&&(null==S||S(),w(m.current),s&&(null==d||d()),r&&r())},anchorX:i,anchorY:l,children:e},y)})})},Fw=W.createContext({strict:!1}),$w={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let zw=!1;function Vw(){return function(){if(zw)return;const e={};for(const t in $w)e[t]={isEnabled:e=>$w[t].some(t=>!!e[t])};vb(e),zw=!0}(),gb}const Uw=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Bw(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Uw.has(e)}let Ww=e=>!Bw(e);try{"function"==typeof(Hw=require("@emotion/is-prop-valid").default)&&(Ww=e=>e.startsWith("on")?!Bw(e):Hw(e))}catch{}var Hw;const qw=W.createContext({});function Gw(e){const{initial:t,animate:n}=function(e,t){if(cb(e)){const{initial:t,animate:n}=e;return{initial:!1===t||sb(t)?t:void 0,animate:sb(n)?n:void 0}}return!1!==e.inherit?t:{}}(e,W.useContext(qw));return W.useMemo(()=>({initial:t,animate:n}),[Kw(t),Kw(n)])}function Kw(e){return Array.isArray(e)?e.join(" "):e}const Yw=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Xw(e,t,n){for(const r in t)ey(t[r])||qb(r,n)||(e[r]=t[r])}function Qw(e,t){const n={};return Xw(n,e.style||{},e),Object.assign(n,function({transformTemplate:e},t){return W.useMemo(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{}};return zb(n,t,e),Object.assign({},n.vars,n.style)},[t])}(e,t)),n}function Jw(e,t){const n={},r=Qw(e,t);return e.drag&&!1!==e.dragListener&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===e.drag?"none":"pan-"+("x"===e.drag?"y":"x")),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const Zw=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}});function ek(e,t,n,r){const o=W.useMemo(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return Jb(n,t,ex(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){const t={};Xw(t,e.style,e),o.style={...t,...o.style}}return o}const tk=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function nk(e){return"string"==typeof e&&!e.includes("-")&&!!(tk.indexOf(e)>-1||/[A-Z]/u.test(e))}function rk(e,t,n,{latestValues:r},o,a=!1,s){const i=(s??nk(e)?ek:Jw)(t,r,o,e),l=function(e,t,n){const r={};for(const o in e)"values"===o&&"object"==typeof e.values||ey(e[o])||(Ww(o)||!0===n&&Bw(o)||!t&&!Bw(o)||e.draggable&&o.startsWith("onDrag"))&&(r[o]=e[o]);return r}(t,"string"==typeof e,a),c=e!==W.Fragment?{...l,...i,ref:n}:{},{children:u}=t,d=W.useMemo(()=>ey(u)?u.get():u,[u]);return W.createElement(e,{...c,children:d})}function ok(e,t,n,r){const o={},a=r(e,{});for(const p in a)o[p]=qx(a[p]);let{initial:s,animate:i}=e;const l=cb(e),c=ub(e);t&&c&&!l&&!1!==e.inherit&&(void 0===s&&(s=t.initial),void 0===i&&(i=t.animate));let u=!!n&&!1===n.initial;u=u||!1===s;const d=u?i:s;if(d&&"boolean"!=typeof d&&!ab(d)){const t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){const r=qv(e,t[n]);if(r){const{transitionEnd:e,transition:t,...n}=r;for(const r in n){let e=n[r];if(Array.isArray(e)){e=e[u?e.length-1:0]}null!==e&&(o[r]=e)}for(const r in e)o[r]=e[r]}}}return o}const ak=e=>(t,n)=>{const r=W.useContext(qw),o=W.useContext(jh),a=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,o){return{latestValues:ok(n,r,o,e),renderState:t()}}(e,t,r,o);return n?a():kh(a)},sk=ak({scrapeMotionValuesFromProps:Gb,createRenderState:Yw}),ik=ak({scrapeMotionValuesFromProps:tx,createRenderState:Zw}),lk=Symbol.for("motionComponentSymbol");function ck(e,t,n){const r=W.useRef(n);W.useInsertionEffect(()=>{r.current=n});const o=W.useRef(null);return W.useCallback(n=>{var a;n&&(null==(a=e.onMount)||a.call(e,n));const s=r.current;if("function"==typeof s)if(n){const e=s(n);"function"==typeof e&&(o.current=e)}else o.current?(o.current(),o.current=null):s(n);else s&&(s.current=n);t&&(n?t.mount(n):t.unmount())},[t])}const uk=W.createContext({});function dk(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function pk(e,t,n,r,o,a){var s,i;const{visualElement:l}=W.useContext(qw),c=W.useContext(Fw),u=W.useContext(jh),d=W.useContext(Pw),p=d.reducedMotion,f=d.skipAnimations,h=W.useRef(null),m=W.useRef(!1);r=r||c.renderer,!h.current&&r&&(h.current=r(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:p,skipAnimations:f,isSVG:a}),m.current&&h.current&&(h.current.manuallyAnimateOnMount=!0));const g=h.current,v=W.useContext(uk);!g||g.projection||!o||"html"!==g.type&&"svg"!==g.type||function(e,t,n,r){const{layoutId:o,layout:a,drag:s,dragConstraints:i,layoutScroll:l,layoutRoot:c,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:fk(e.parent)),e.projection.setOptions({layoutId:o,layout:a,alwaysMeasureLayout:Boolean(s)||i&&dk(i),visualElement:e,animationType:"string"==typeof a?a:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:l,layoutRoot:c,layoutAnchor:u})}(h.current,n,o,v);const y=W.useRef(!1);W.useInsertionEffect(()=>{g&&y.current&&g.update(n,u)});const b=n[ry],x=W.useRef(Boolean(b)&&"undefined"!=typeof window&&!(null==(s=window.MotionHandoffIsComplete)?void 0:s.call(window,b))&&(null==(i=window.MotionHasOptimisedAnimation)?void 0:i.call(window,b)));return Sh(()=>{m.current=!0,g&&(y.current=!0,window.MotionIsMounted=!0,g.updateFeatures(),g.scheduleRenderMicrotask(),x.current&&g.animationState&&g.animationState.animateChanges())}),W.useEffect(()=>{g&&(!x.current&&g.animationState&&g.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var e;null==(e=window.MotionHandoffMarkAsComplete)||e.call(window,b)}),x.current=!1),g.enteringChildren=void 0)}),g}function fk(e){if(e)return!1!==e.options.allowProjection?e.projection:fk(e.parent)}function hk(e,{forwardMotionProps:t=!1,type:n}={},r,o){r&&function(e){const t=Vw();for(const n in e)t[n]={...t[n],...e[n]};vb(t)}(r);const a=n?"svg"===n:nk(e),s=a?ik:sk;function i(n,r){let i;const l={...W.useContext(Pw),...n,layoutId:mk(n)},{isStatic:c}=l,u=Gw(n),d=s(n,c);if(!c&&"undefined"!=typeof window){W.useContext(Fw).strict;const t=function(e){const t=Vw(),{drag:n,layout:r}=t;if(!n&&!r)return{};const o={...n,...r};return{MeasureLayout:(null==n?void 0:n.isEnabled(e))||(null==r?void 0:r.isEnabled(e))?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}(l);i=t.MeasureLayout,u.visualElement=pk(e,d,l,o,t.ProjectionNode,a)}return ee.jsxs(qw.Provider,{value:u,children:[i&&u.visualElement?ee.jsx(i,{visualElement:u.visualElement,...l}):null,rk(e,n,ck(d,u.visualElement,r),d,c,t,a)]})}i.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;const l=W.forwardRef(i);return l[lk]=e,l}function mk({layoutId:e}){const t=W.useContext(wh).id;return t&&void 0!==e?t+"-"+e:e}function gk(e,t){if("undefined"==typeof Proxy)return hk;const n=new Map,r=(n,r)=>hk(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(o,a)=>"create"===a?r:(n.has(a)||n.set(a,hk(a,void 0,e,t)),n.get(a))})}const vk=(e,t)=>t.isSVG??nk(e)?new nx(t):new Kb(t,{allowProjection:e!==W.Fragment});let yk=0;const bk={animation:{Feature:class extends xb{constructor(e){super(e),e.animationState||(e.animationState=cx(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();ab(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),null==(e=this.unmountControls)||e.call(this)}}},exit:{Feature:class extends xb{constructor(){super(...arguments),this.id=yk++,this.isExitComplete=!1}update(){var e;if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;if(t&&!1===r){if(this.isExitComplete){const{initial:t,custom:n}=this.node.getProps();if("string"==typeof t){const r=Gv(this.node,t,n);if(r){const{transition:t,transitionEnd:n,...o}=r;for(const r in o)null==(e=this.node.getValue(r))||e.jump(o[r])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);return void(this.isExitComplete=!1)}const o=this.node.animationState.setActive("exit",!t);n&&!t&&o.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function xk(e){return{point:{x:e.pageX,y:e.pageY}}}function wk(e,t,n,r){return Bx(e,t,(e=>t=>Oy(t)&&e(t,xk(t)))(n),r)}const kk=({current:e})=>e?e.ownerDocument.defaultView:null,Sk=(e,t)=>Math.abs(e-t);const jk=new Set(["auto","scroll"]);class Ck{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:o=!1,distanceThreshold:a=3,element:s}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Ek(this.lastRawMoveEventInfo,this.transformPagePoint));const e=_k(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,n=function(e,t){const n=Sk(e.x,t.x),r=Sk(e.y,t.y);return Math.sqrt(n**2+r**2)}(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;const{point:r}=e,{timestamp:o}=lm;this.history.push({...r,timestamp:o});const{onStart:a,onMove:s}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),s&&s(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=Ek(t,this.transformPagePoint),sm.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();const{onEnd:n,onSessionEnd:r,resumeAnimation:o}=this.handlers;if(!this.dragSnapToOrigin&&this.startEvent||o&&o(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const a=_k("pointercancel"===e.type?this.lastMoveEventInfo:Ek(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!Oy(e))return;this.dragSnapToOrigin=o,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;const i=Ek(xk(e),this.transformPagePoint),{point:l}=i,{timestamp:c}=lm;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,_k(i,this.history)),this.removeListeners=Ah(wk(this.contextWindow,"pointermove",this.handlePointerMove),wk(this.contextWindow,"pointerup",this.handlePointerUp),wk(this.contextWindow,"pointercancel",this.handlePointerUp)),s&&this.startScrollTracking(s)}startScrollTracking(e){let t=e.parentElement;for(;t;){const e=getComputedStyle(t);(jk.has(e.overflowX)||jk.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},o=r.x-t.x,a=r.y-t.y;0===o&&0===a||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=o,this.lastMoveEventInfo.point.y+=a):this.history.length>0&&(this.history[0].x-=o,this.history[0].y-=a),this.scrollPositions.set(e,r),sm.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),im(this.updatePoint)}}function Ek(e,t){return t?{point:t(e.point)}:e}function Pk(e,t){return{x:e.x-t.x,y:e.y-t.y}}function _k({point:e},t){return{point:e,delta:Pk(e,Tk(t)),offset:Pk(e,Nk(t)),velocity:Rk(t,.1)}}function Nk(e){return e[0]}function Tk(e){return e[e.length-1]}function Rk(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=Tk(e);for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>Fh(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&o.timestamp-r.timestamp>2*Fh(t)&&(r=e[1]);const a=$h(o.timestamp-r.timestamp);if(0===a)return{x:0,y:0};const s={x:(o.x-r.x)/a,y:(o.y-r.y)/a};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function Mk(e,t,n){return{min:void 0!==t?e.min+t:void 0,max:void 0!==n?e.max+n-(e.max-e.min):void 0}}function Lk(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}const Ok=.35;function Ak(e,t,n){return{min:Dk(e,t),max:Dk(e,n)}}function Dk(e,t){return"number"==typeof e?e:e[t]||0}const Ik=new WeakMap;class Fk{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){const{presenceContext:r}=this.visualElement;if(r&&!1===r.isPresent)return;const{dragSnapToOrigin:o}=this.getProps();this.panSession=new Ck(e,{onSessionStart:e=>{t&&this.snapToCursor(xk(e).point),this.stopAnimation()},onStart:(e,t)=>{const{drag:n,dragPropagation:r,onDragStart:o}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(a=n)||"y"===a?Ny[a]?null:(Ny[a]=!0,()=>{Ny[a]=!1}):Ny.x||Ny.y?null:(Ny.x=Ny.y=!0,()=>{Ny.x=Ny.y=!1}),!this.openDragLock))return;var a;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ox(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Mm.test(t)){const{projection:n}=this.visualElement;if(n&&n.layout){const r=n.layout.layoutBox[e];if(r){t=gx(r)*(parseFloat(t)/100)}}}this.originPoint[e]=t}),o&&sm.update(()=>o(e,t),!1,!0),ty(this.visualElement,"transform");const{animationState:s}=this.visualElement;s&&s.setActive("whileDrag",!0)},onMove:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;const{dragPropagation:n,dragDirectionLock:r,onDirectionLock:o,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;const{offset:s}=t;if(r&&null===this.currentDirection)return this.currentDirection=function(e,t=10){let n=null;Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x");return n}(s),void(null!==this.currentDirection&&o&&o(this.currentDirection));this.updateAxis("x",t.point,s),this.updateAxis("y",t.point,s),this.visualElement.render(),a&&sm.update(()=>a(e,t),!1,!0)},onSessionEnd:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation:()=>{const{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})}},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:o,distanceThreshold:n,contextWindow:kk(this.visualElement),element:this.visualElement.current})}stop(e,t){const n=e||this.latestPointerEvent,r=t||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!r||!n)return;const{velocity:a}=r;this.startAnimation(a);const{onDragEnd:s}=this.getProps();s&&sm.postRender(()=>s(n,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){const{drag:r}=this.getProps();if(!n||!zk(e,r,this.currentDirection))return;const o=this.getAxisMotionValue(e);let a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=function(e,{min:t,max:n},r){return void 0!==t&&e<t?e=r?Ym(t,e,r.min):Math.max(e,t):void 0!==n&&e>n&&(e=r?Ym(n,e,r.max):Math.min(e,n)),e}(a,this.constraints[e],this.elastic[e])),o.set(a)}resolveConstraints(){var e;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null==(e=this.visualElement.projection)?void 0:e.layout,o=this.constraints;t&&dk(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!r)&&function(e,{top:t,left:n,bottom:r,right:o}){return{x:Mk(e.x,n,o),y:Mk(e.y,t,r)}}(r.layoutBox,t),this.elastic=function(e=Ok){return!1===e?e=0:!0===e&&(e=Ok),{x:Ak(e,"left","right"),y:Ak(e,"top","bottom")}}(n),o!==this.constraints&&!dk(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&Ox(e=>{!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=function(e,t){const n={};return void 0!==t.min&&(n.min=t.min-e.min),void 0!==t.max&&(n.max=t.max-e.min),n}(r.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!dk(e))return!1;const n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const o=function(e,t,n){const r=Ib(e,n),{scroll:o}=t;return o&&(Lb(r.x,o.offset.x),Lb(r.y,o.offset.y)),r}(n,r.root,this.visualElement.getTransformPagePoint());let a=function(e,t){return{x:Lk(e.x,t.x),y:Lk(e.y,t.y)}}(r.layout.layoutBox,o);if(t){const e=t(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(a));this.hasMutatedConstraints=!!e,e&&(a=wb(e))}return a}startAnimation(e){const{drag:t,dragMomentum:n,dragElastic:r,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:s}=this.getProps(),i=this.constraints||{},l=Ox(s=>{if(!zk(s,t,this.currentDirection))return;let l=i&&i[s]||{};!0!==a&&a!==s||(l={min:0,max:0});const c=r?200:1e6,u=r?40:1e7,d={type:"inertia",velocity:n?e[s]:0,bounceStiffness:c,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...o,...l};return this.startAxisValueAnimation(s,d)});return Promise.all(l).then(s)}startAxisValueAnimation(e,t){const n=this.getAxisMotionValue(e);return ty(this.visualElement,e),n.start(Wv(e,n,0,t,this.visualElement,!1))}stopAnimation(){Ox(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),r=n[t];return r||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){Ox(t=>{const{drag:n}=this.getProps();if(!zk(t,n,this.currentDirection))return;const{projection:r}=this.visualElement,o=this.getAxisMotionValue(t);if(r&&r.layout){const{min:n,max:a}=r.layout.layoutBox[t],s=o.get()||0;o.set(e[t]-Ym(n,a,.5)+s)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!dk(t)||!n||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Ox(e=>{const t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){const n=t.get();r[e]=function(e,t){let n=.5;const r=gx(e),o=gx(t);return o>r?n=Dh(t.min,t.max-r,e.min):r>o&&(n=Dh(e.min,e.max-o,t.min)),Ph(0,1,n)}({min:n,max:n},this.constraints[e])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),Ox(t=>{if(!zk(t,e,null))return;const n=this.getAxisMotionValue(t),{min:o,max:a}=this.constraints[t];n.set(Ym(o,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Ik.set(this.visualElement,this);const e=this.visualElement.current,t=wk(e,"pointerdown",t=>{const{drag:n,dragListener:r=!0}=this.getProps(),o=t.target,a=o!==e&&function(e){return Dy.has(e.tagName)||!0===e.isContentEditable}(o);n&&r&&!a&&this.start(t)});let n;const r=()=>{const{dragConstraints:t}=this.getProps();dk(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||(n=function(e,t,n){const r=tb(e,$k(n)),o=tb(t,$k(n));return()=>{r(),o()}}(e,t.current,()=>this.scalePositionWithinConstraints())))},{projection:o}=this.visualElement,a=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),sm.read(r);const s=Bx(window,"resize",()=>this.scalePositionWithinConstraints()),i=o.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(Ox(t=>{const n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())});return()=>{s(),t(),a(),i&&i(),n&&n()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:o=!1,dragElastic:a=Ok,dragMomentum:s=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:o,dragElastic:a,dragMomentum:s}}}function $k(e){let t=!0;return()=>{t?t=!1:e()}}function zk(e,t,n){return!(!0!==t&&t!==e||null!==n&&n!==e)}const Vk=e=>(t,n)=>{e&&sm.update(()=>e(t,n),!1,!0)};let Uk=!1;class Bk extends W.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:o}=e;o&&(t.group&&t.group.add(o),n&&n.register&&r&&n.register(o),Uk&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Kx.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:n,drag:r,isPresent:o}=this.props,{projection:a}=n;return a?(a.isPresent=o,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),Uk=!0,r||e.layoutDependency!==t||void 0===t||e.isPresent!==o?a.willUpdate():this.safeToRemove(),e.isPresent!==o&&(o?a.promote():a.relegate()||sm.postRender(()=>{const e=a.getStack();e&&e.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),_y.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;Uk=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Wk(e){const[t,n]=Ow(),r=W.useContext(wh);return ee.jsx(Bk,{...e,layoutGroup:r,switchLayoutGroup:W.useContext(uk),isPresent:t,safeToRemove:n})}const Hk={pan:{Feature:class extends xb{constructor(){super(...arguments),this.removePointerDownListener=Lh}onPointerDown(e){this.session=new Ck(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:kk(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Vk(e),onStart:Vk(t),onMove:Vk(n),onEnd:(e,t)=>{delete this.session,r&&sm.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=wk(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends xb{constructor(e){super(e),this.removeGroupControls=Lh,this.removeListeners=Lh,this.controls=new Fk(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Lh}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:Ew,MeasureLayout:Wk}};function qk(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover","Start"===n);const o=r["onHover"+n];o&&sm.postRender(()=>o(t,xk(t)))}function Gk(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap","Start"===n);const o=r["onTap"+("End"===n?"":n)];o&&sm.postRender(()=>o(t,xk(t)))}const Kk=new WeakMap,Yk=new WeakMap,Xk=e=>{const t=Kk.get(e.target);t&&t(e)},Qk=e=>{e.forEach(Xk)};function Jk(e,t,n){const r=function({root:e,...t}){const n=e||document;Yk.has(n)||Yk.set(n,{});const r=Yk.get(n),o=JSON.stringify(t);return r[o]||(r[o]=new IntersectionObserver(Qk,{root:e,...t})),r[o]}(t);return Kk.set(e,n),r.observe(e),()=>{Kk.delete(e),r.unobserve(e)}}const Zk={some:0,all:1};const eS={inView:{Feature:class extends xb{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var e;null==(e=this.stopObserver)||e.call(this);const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:o="some",once:a}=t,s={root:n?n.current:void 0,rootMargin:r,threshold:"number"==typeof o?o:Zk[o]};this.stopObserver=Jk(this.node.current,s,e=>{const{isIntersecting:t}=e;if(this.isInView===t)return;if(this.isInView=t,a&&!t&&this.hasEnteredView)return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);const{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),o=t?n:r;o&&o(e)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}(e,t))&&this.startObserver()}unmount(){var e;null==(e=this.stopObserver)||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}},tap:{Feature:class extends xb{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=Uy(e,(e,t)=>(Gk(this.node,t,"Start"),(e,{success:t})=>Gk(this.node,e,t?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:!1===(null==n?void 0:n.tap)})}unmount(){}}},focus:{Feature:class extends xb{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(LO){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ah(Bx(this.node.current,"focus",()=>this.onFocus()),Bx(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends xb{mount(){const{current:e}=this.node;e&&(this.unmount=My(e,(e,t)=>(qk(this.node,t,"Start"),e=>qk(this.node,e,"End"))))}unmount(){}}}},tS=gk({...bk,...eS,...Hk,...{layout:{ProjectionNode:Ew,MeasureLayout:Wk}}},vk);function nS(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=nS(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function rS(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=nS(e))&&(r&&(r+=" "),r+=t);return r}const oS=e=>{const t=lS(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{const n=e.split("-");return""===n[0]&&1!==n.length&&n.shift(),aS(n,t)||iS(e)},getConflictingClassGroupIds:(e,t)=>{const o=n[e]||[];return t&&r[e]?[...o,...r[e]]:o}}},aS=(e,t)=>{var n;if(0===e.length)return t.classGroupId;const r=e[0],o=t.nextPart.get(r),a=o?aS(e.slice(1),o):void 0;if(a)return a;if(0===t.validators.length)return;const s=e.join("-");return null==(n=t.validators.find(({validator:e})=>e(s)))?void 0:n.classGroupId},sS=/^\[(.+)\]$/,iS=e=>{if(sS.test(e)){const t=sS.exec(e)[1],n=null==t?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},lS=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return pS(Object.entries(e.classGroups),n).forEach(([e,n])=>{cS(n,r,e,t)}),r},cS=(e,t,n,r)=>{e.forEach(e=>{if("string"==typeof e){return void((""===e?t:uS(t,e)).classGroupId=n)}if("function"==typeof e)return dS(e)?void cS(e(r),t,n,r):void t.validators.push({validator:e,classGroupId:n});Object.entries(e).forEach(([e,o])=>{cS(o,uS(t,e),n,r)})})},uS=(e,t)=>{let n=e;return t.split("-").forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},dS=e=>e.isThemeGetter,pS=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>"string"==typeof e?t+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,fS=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(o,a)=>{n.set(o,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);return void 0!==t?t:void 0!==(t=r.get(e))?(o(e,t),t):void 0},set(e,t){n.has(e)?n.set(e,t):o(e,t)}}},hS=e=>{const{separator:t,experimentalParseClassName:n}=e,r=1===t.length,o=t[0],a=t.length,s=e=>{const n=[];let s,i=0,l=0;for(let d=0;d<e.length;d++){let c=e[d];if(0===i){if(c===o&&(r||e.slice(d,d+a)===t)){n.push(e.slice(l,d)),l=d+a;continue}if("/"===c){s=d;continue}}"["===c?i++:"]"===c&&i--}const c=0===n.length?e:e.substring(l),u=c.startsWith("!");return{modifiers:n,hasImportantModifier:u,baseClassName:u?c.substring(1):c,maybePostfixModifierPosition:s&&s>l?s-l:void 0}};return n?e=>n({className:e,parseClassName:s}):s},mS=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(e=>{"["===e[0]?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},gS=/\s+/;function vS(){let e,t,n=0,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=yS(e))&&(r&&(r+=" "),r+=t);return r}const yS=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=yS(e[r]))&&(n&&(n+=" "),n+=t);return n};function bS(e,...t){let n,r,o,a=function(i){const l=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:fS(e.cacheSize),parseClassName:hS(e),...oS(e)}))(l),r=n.cache.get,o=n.cache.set,a=s,s(i)};function s(e){const t=r(e);if(t)return t;const a=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,a=[],s=e.trim().split(gS);let i="";for(let l=s.length-1;l>=0;l-=1){const e=s[l],{modifiers:t,hasImportantModifier:c,baseClassName:u,maybePostfixModifierPosition:d}=n(e);let p=Boolean(d),f=r(p?u.substring(0,d):u);if(!f){if(!p){i=e+(i.length>0?" "+i:i);continue}if(f=r(u),!f){i=e+(i.length>0?" "+i:i);continue}p=!1}const h=mS(t).join(":"),m=c?h+"!":h,g=m+f;if(a.includes(g))continue;a.push(g);const v=o(f,p);for(let n=0;n<v.length;++n){const e=v[n];a.push(m+e)}i=e+(i.length>0?" "+i:i)}return i})(e,n);return o(e,a),a}return function(){return a(vS.apply(null,arguments))}}const xS=e=>{const t=t=>t[e]||[];return t.isThemeGetter=!0,t},wS=/^\[(?:([a-z-]+):)?(.+)\]$/i,kS=/^\d+\/\d+$/,SS=new Set(["px","full","screen"]),jS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,CS=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ES=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,PS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_S=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,NS=e=>RS(e)||SS.has(e)||kS.test(e),TS=e=>WS(e,"length",HS),RS=e=>Boolean(e)&&!Number.isNaN(Number(e)),MS=e=>WS(e,"number",RS),LS=e=>Boolean(e)&&Number.isInteger(Number(e)),OS=e=>e.endsWith("%")&&RS(e.slice(0,-1)),AS=e=>wS.test(e),DS=e=>jS.test(e),IS=new Set(["length","size","percentage"]),FS=e=>WS(e,IS,qS),$S=e=>WS(e,"position",qS),zS=new Set(["image","url"]),VS=e=>WS(e,zS,KS),US=e=>WS(e,"",GS),BS=()=>!0,WS=(e,t,n)=>{const r=wS.exec(e);return!!r&&(r[1]?"string"==typeof t?r[1]===t:t.has(r[1]):n(r[2]))},HS=e=>CS.test(e)&&!ES.test(e),qS=()=>!1,GS=e=>PS.test(e),KS=e=>_S.test(e),YS=bS(()=>{const e=xS("colors"),t=xS("spacing"),n=xS("blur"),r=xS("brightness"),o=xS("borderColor"),a=xS("borderRadius"),s=xS("borderSpacing"),i=xS("borderWidth"),l=xS("contrast"),c=xS("grayscale"),u=xS("hueRotate"),d=xS("invert"),p=xS("gap"),f=xS("gradientColorStops"),h=xS("gradientColorStopPositions"),m=xS("inset"),g=xS("margin"),v=xS("opacity"),y=xS("padding"),b=xS("saturate"),x=xS("scale"),w=xS("sepia"),k=xS("skew"),S=xS("space"),j=xS("translate"),C=()=>["auto",AS,t],E=()=>[AS,t],P=()=>["",NS,TS],_=()=>["auto",RS,AS],N=()=>["","0",AS],T=()=>[RS,AS];return{cacheSize:500,separator:":",theme:{colors:[BS],spacing:[NS,TS],blur:["none","",DS,AS],brightness:T(),borderColor:[e],borderRadius:["none","","full",DS,AS],borderSpacing:E(),borderWidth:P(),contrast:T(),grayscale:N(),hueRotate:T(),invert:N(),gap:E(),gradientColorStops:[e],gradientColorStopPositions:[OS,TS],inset:C(),margin:C(),opacity:T(),padding:E(),saturate:T(),scale:T(),sepia:N(),skew:T(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",AS]}],container:["container"],columns:[{columns:[DS]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",AS]}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",LS,AS]}],basis:[{basis:C()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",AS]}],grow:[{grow:N()}],shrink:[{shrink:N()}],order:[{order:["first","last","none",LS,AS]}],"grid-cols":[{"grid-cols":[BS]}],"col-start-end":[{col:["auto",{span:["full",LS,AS]},AS]}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":[BS]}],"row-start-end":[{row:["auto",{span:[LS,AS]},AS]}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",AS]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",AS]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal","start","end","center","between","around","evenly","stretch"]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[S]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[S]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",AS,t]}],"min-w":[{"min-w":[AS,t,"min","max","fit"]}],"max-w":[{"max-w":[AS,t,"none","full","min","max","fit","prose",{screen:[DS]},DS]}],h:[{h:[AS,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[AS,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[AS,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[AS,t,"auto","min","max","fit"]}],"font-size":[{text:["base",DS,TS]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",MS]}],"font-family":[{font:[BS]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",AS]}],"line-clamp":[{"line-clamp":["none",RS,MS]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",NS,AS]}],"list-image":[{"list-image":["none",AS]}],"list-style-type":[{list:["none","disc","decimal",AS]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","none","wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",NS,TS]}],"underline-offset":[{"underline-offset":["auto",NS,AS]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",AS]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",AS]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",$S]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",FS]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},VS]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[h]}],"gradient-via-pos":[{via:[h]}],"gradient-to-pos":[{to:[h]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-b":[{"border-b":[i]}],"border-w-l":[{"border-l":[i]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:["solid","dashed","dotted","double","none","hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:["solid","dashed","dotted","double","none"]}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["","solid","dashed","dotted","double","none"]}],"outline-offset":[{"outline-offset":[NS,AS]}],"outline-w":[{outline:[NS,TS]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:P()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[NS,TS]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",DS,US]}],"shadow-color":[{shadow:[BS]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",DS,AS]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[b]}],sepia:[{sepia:[w]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[b]}],"backdrop-sepia":[{"backdrop-sepia":[w]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",AS]}],duration:[{duration:T()}],ease:[{ease:["linear","in","out","in-out",AS]}],delay:[{delay:T()}],animate:[{animate:["none","spin","ping","pulse","bounce",AS]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[LS,AS]}],"translate-x":[{"translate-x":[j]}],"translate-y":[{"translate-y":[j]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",AS]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",AS]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",AS]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[NS,TS,MS]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function XS(...e){return YS(rS(e))}const QS=W.forwardRef(({className:e,...t},n)=>ee.jsx("div",{ref:n,className:XS("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));QS.displayName="Card";const JS=W.forwardRef(({className:e,...t},n)=>ee.jsx("div",{ref:n,className:XS("flex flex-col space-y-1.5 p-6",e),...t}));JS.displayName="CardHeader";const ZS=W.forwardRef(({className:e,...t},n)=>ee.jsx("h3",{ref:n,className:XS("font-semibold leading-none",e),...t}));ZS.displayName="CardTitle";const ej=W.forwardRef(({className:e,...t},n)=>ee.jsx("p",{ref:n,className:XS("text-sm text-muted-foreground",e),...t}));ej.displayName="CardDescription";const tj=W.forwardRef(({className:e,...t},n)=>ee.jsx("div",{ref:n,className:XS("p-6 pt-0",e),...t}));tj.displayName="CardContent";const nj=W.forwardRef(({className:e,...t},n)=>ee.jsx("div",{ref:n,className:XS("flex items-center p-6 pt-0",e),...t}));function rj(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function oj(...e){return t=>{let n=!1;const r=e.map(e=>{const r=rj(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():rj(e[t],null)}}}}function aj(...e){return W.useCallback(oj(...e),e)}nj.displayName="CardFooter";var sj=Symbol.for("react.lazy"),ij=q[" use ".trim().toString()];function lj(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===sj&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function cj(e){const t=dj(e),n=W.forwardRef((e,n)=>{let{children:r,...o}=e;lj(r)&&"function"==typeof ij&&(r=ij(r._payload));const a=W.Children.toArray(r),s=a.find(fj);if(s){const e=s.props.children,r=a.map(t=>t===s?W.Children.count(e)>1?W.Children.only(null):W.isValidElement(e)?e.props.children:null:t);return ee.jsx(t,{...o,ref:n,children:W.isValidElement(e)?W.cloneElement(e,void 0,r):null})}return ee.jsx(t,{...o,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var uj=cj("Slot");function dj(e){const t=W.forwardRef((e,t)=>{let{children:n,...r}=e;if(lj(n)&&"function"==typeof ij&&(n=ij(n._payload)),W.isValidElement(n)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{const t=a(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==W.Fragment&&(o.ref=t?oj(t,e):e),W.cloneElement(n,o)}return W.Children.count(n)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var pj=Symbol("radix.slottable");function fj(e){return W.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===pj}const hj=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,mj=rS,gj=(e,t)=>n=>{var r;if(null==(null==t?void 0:t.variants))return mj(e,null==n?void 0:n.class,null==n?void 0:n.className);const{variants:o,defaultVariants:a}=t,s=Object.keys(o).map(e=>{const t=null==n?void 0:n[e],r=null==a?void 0:a[e];if(null===t)return null;const s=hj(t)||hj(r);return o[e][s]}),i=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{}),l=null==t||null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce((e,t)=>{let{class:n,className:r,...o}=t;return Object.entries(o).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...a,...i}[t]):{...a,...i}[t]===n})?[...e,n,r]:e},[]);return mj(e,s,l,null==n?void 0:n.class,null==n?void 0:n.className)},vj=gj("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),yj=W.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},a)=>{const s=r?uj:"button";return ee.jsx(s,{className:XS(vj({variant:t,size:n,className:e})),ref:a,...o})});yj.displayName="Button";const bj=W.forwardRef(({className:e,type:t,...n},r)=>ee.jsx("input",{type:t,className:XS("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));bj.displayName="Input";var xj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const n=cj(`Primitive.${t}`),r=W.forwardRef((e,r)=>{const{asChild:o,...a}=e,s=o?n:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),ee.jsx(s,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),wj=W.forwardRef((e,t)=>ee.jsx(xj.label,{...e,ref:t,onMouseDown:t=>{var n;t.target.closest("button, input, select, textarea")||(null==(n=e.onMouseDown)||n.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));wj.displayName="Label";var kj=wj;const Sj=gj("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),jj=W.forwardRef(({className:e,...t},n)=>ee.jsx(kj,{ref:n,className:XS(Sj(),e),...t}));jj.displayName=kj.displayName;const Cj=e=>{let t;const n=new Set,r=(e,r)=>{const o="function"==typeof e?e(t):e;if(!Object.is(o,t)){const e=t;t=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},t,o),n.forEach(n=>n(t,e))}},o=()=>t,a={setState:r,getState:o,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e))},s=t=e(r,o,a);return a},Ej=e=>e;const Pj=e=>{const t=(e=>e?Cj(e):Cj)(e),n=e=>function(e,t=Ej){const n=H.useSyncExternalStore(e.subscribe,H.useCallback(()=>t(e.getState()),[e,t]),H.useCallback(()=>t(e.getInitialState()),[e,t]));return H.useDebugValue(n),n}(t,e);return Object.assign(n,t),n},_j=e=>e?Pj(e):Pj,Nj={token:"cc_web_token",theme:"cc_web_theme",viewMode:e=>`cc_viewmode_${e}`,panelFileTree:"cc_panel_filetree",panelShortcuts:"cc_panel_shortcuts",fileZoom:"cc_file_zoom",skillhubAuthor:"ccweb_skillhub_author",projectOrder:"cc_project_order",pomodoroConfig:"cc_pomodoro_config",panelLeftWidth:"cc_panel_left_width",panelRightWidth:"cc_panel_right_width",terminalDraft:e=>`cc_terminal_draft_${e}`,usedSkills:"cc_used_skills",projectModel:e=>`cc_project_model_${e}`,draftState:e=>`cc_draft_state_${e}`,usageMonitorTool:"cc_usage_monitor_tool",monitorMode:"cc_monitor_mode",chatOverlay:e=>`cc_chat_overlay_${e}`,rightPanelTab:"cc_right_panel_tab",leftPanelTab:"cc_left_panel_tab",browserLastUrl:"cc_browser_last_url",browserHistory:"cc_browser_history"};function Tj(e,t,n){try{const r=localStorage.getItem(e);return null===r?t:n?JSON.parse(r):r}catch{return t}}function Rj(e,t,n){try{localStorage.setItem(e,n?JSON.stringify(t):String(t))}catch{}}function Mj(e){try{localStorage.removeItem(e)}catch{}}function Lj(e,t,n){const r=(null==n?void 0:n.parse)??!1,[o,a]=W.useState(()=>{try{const n=localStorage.getItem(e);return null===n?t:r?JSON.parse(n):n}catch{return t}});return[o,W.useCallback(t=>{a(n=>{const o="function"==typeof t?t(n):t;try{localStorage.setItem(e,r?JSON.stringify(o):String(o))}catch{}return o})},[e,r])]}const Oj=_j(e=>({token:localStorage.getItem(Nj.token),setToken:t=>{Rj(Nj.token,t),e({token:t})},clearToken:()=>{Mj(Nj.token),e({token:null})}}));let Aj=null;const Dj=_j((e,t)=>({projects:[],loading:!1,error:null,hasFetched:!1,fetchProjects:async()=>{if(!t().loading){e({loading:!0,error:null});try{const t=await async function(){if(!Aj){const e=await pd(()=>Promise.resolve().then(()=>NE),void 0);Aj=e.getProjects}return Aj()}();e({projects:t,hasFetched:!0})}catch(n){e({error:n instanceof Error?n.message:"Failed to load projects"})}finally{e({loading:!1})}}},addProject:t=>e(e=>({projects:[...e.projects,t]})),updateProject:t=>e(e=>({projects:e.projects.map(e=>e.id===t.id?t:e)})),removeProject:t=>e(e=>({projects:e.projects.filter(e=>e.id!==t)})),setProjects:t=>e({projects:t})})),Ij={filePreviews:[],activePreviewPath:null,shortcutEditorOpen:!1,shortcutEditingId:null,shareHubOpen:!1,shareHubLabel:"",shareHubCommand:""};const Fj=_j((e,t)=>({entries:{},get:e=>t().entries[e]??Ij,openFilePreview:(t,n)=>e(e=>{const r=e.entries[t]??Ij,o=r.filePreviews.some(e=>e.path===n)?r.filePreviews.map(e=>e.path===n?{...e,minimized:!1}:e):[...r.filePreviews,{path:n,minimized:!1}];return{entries:{...e.entries,[t]:{...r,filePreviews:o,activePreviewPath:n}}}}),closeFilePreview:(t,n)=>e(e=>{const r=e.entries[t]??Ij,o=r.filePreviews.filter(e=>e.path!==n),a=r.activePreviewPath===n?function(e,t){const n=e.filter(e=>e.path!==t&&!e.minimized);return n.length>0?n[n.length-1].path:null}(r.filePreviews,n):r.activePreviewPath;return{entries:{...e.entries,[t]:{...r,filePreviews:o,activePreviewPath:a}}}}),minimizeFilePreview:(t,n)=>e(e=>{var r;const o=e.entries[t]??Ij,a=o.filePreviews.map(e=>e.path===n?{...e,minimized:!0}:e),s=o.activePreviewPath===n?(null==(r=a.filter(e=>!e.minimized).slice(-1)[0])?void 0:r.path)??null:o.activePreviewPath;return{entries:{...e.entries,[t]:{...o,filePreviews:a,activePreviewPath:s}}}}),setActivePreview:(t,n)=>e(e=>{const r=e.entries[t]??Ij,o=r.filePreviews.map(e=>e.path===n?{...e,minimized:!1}:e);return{entries:{...e.entries,[t]:{...r,filePreviews:o,activePreviewPath:n}}}}),setShortcutEditor:(t,n,r=null)=>e(e=>({entries:{...e.entries,[t]:{...e.entries[t]??Ij,shortcutEditorOpen:n,shortcutEditingId:n?r:null}}})),setShareHub:(t,n,r="",o="")=>e(e=>({entries:{...e.entries,[t]:{...e.entries[t]??Ij,shareHubOpen:n,shareHubLabel:n?r:"",shareHubCommand:n?o:""}}}))}));function $j(){return Oj.getState().token}function zj(){Oj.getState().clearToken()}async function Vj(e,t,n,r=!0,o){const a={"Content-Type":"application/json"};if(r){const e=$j();e&&(a.Authorization=`Bearer ${e}`)}const s=await fetch(`${t}`,{method:e,headers:a,body:void 0!==n?JSON.stringify(n):void 0,signal:o});if(401===s.status)throw zj(),"/login"!==window.location.pathname&&(window.location.href="/login"),new Error("Unauthorized");if(!s.ok){let e=`HTTP ${s.status}`;try{const t=await s.json();t.error&&(e=t.error)}catch{}throw new Error(e)}return s.json()}async function Uj(e,t){return(await Vj("POST","/api/auth/login",{username:e,password:t},!1)).token}function Bj(){const e=window.location.hostname;return"localhost"===e||"127.0.0.1"===e||"::1"===e}async function Wj(){return(await Vj("GET","/api/auth/local-token",void 0,!1)).token}async function Hj(){return(await Vj("GET","/api/projects/order")).order}async function qj(e){await Vj("PUT","/api/projects/order",{order:e})}async function Gj(){return Vj("GET","/api/projects/users")}async function Kj(e,t){return Vj("PUT",`/api/projects/${e}/shares`,{shares:t})}async function Yj(e){return Vj("POST","/api/projects",e)}async function Xj(e){return Vj("POST","/api/projects/open",{folderPath:e})}async function Qj(e){await Vj("DELETE",`/api/projects/${e}`)}async function Jj(e){return Vj("PATCH",`/api/projects/${e}/start`)}async function Zj(e){return Vj("PATCH",`/api/projects/${e}/archive`)}async function eC(e,t,n){return Vj("POST",`/api/projects/${e}/switch-cli`,{cliTool:t,continueSession:n})}async function tC(e){return Vj("PATCH",`/api/projects/${e}/unarchive`)}async function nC(){return Vj("GET","/api/shortcuts")}async function rC(e){return Vj("POST","/api/shortcuts",e)}async function oC(e,t){return Vj("PUT",`/api/shortcuts/${e}`,t)}async function aC(e){await Vj("DELETE",`/api/shortcuts/${e}`)}async function sC(e){return Vj("GET",`/api/shortcuts/project/${e}`)}async function iC(e,t){return Vj("POST",`/api/shortcuts/project/${e}`,t)}async function lC(e,t,n){return Vj("PUT",`/api/shortcuts/project/${e}/${t}`,n)}async function cC(e,t){await Vj("DELETE",`/api/shortcuts/project/${e}/${t}`)}async function uC(e,t,n){return Vj("PATCH",`/api/shortcuts/project/${e}/${t}/used`,{used:n})}async function dC(){return Vj("GET","/api/prompts")}async function pC(e){return Vj("POST","/api/prompts",e)}async function fC(e,t){return Vj("PUT",`/api/prompts/${e}`,t)}async function hC(e){await Vj("DELETE",`/api/prompts/${e}`)}async function mC(e){return Vj("GET",`/api/prompts/project/${e}`)}async function gC(e,t){return Vj("POST",`/api/prompts/project/${e}`,t)}async function vC(e,t,n){return Vj("PUT",`/api/prompts/project/${e}/${t}`,n)}async function yC(e,t){await Vj("DELETE",`/api/prompts/project/${e}/${t}`)}async function bC(e){return Vj("GET",`/api/memory/project/${encodeURIComponent(e)}`)}async function xC(e,t,n){return Vj("POST",`/api/memory/project/${encodeURIComponent(e)}/toggle`,{filename:t,action:n})}async function wC(e,t,n){return Vj("POST",`/api/prompts/project/${e}/toggle`,{text:t,action:n})}async function kC(){return Vj("GET","/api/skillhub/items")}async function SC(){return Vj("GET","/api/skillhub/auth")}async function jC(e){return Vj("PUT","/api/skillhub/auth",{token:e})}async function CC(){await Vj("DELETE","/api/skillhub/auth")}async function EC(e){return Vj("POST","/api/skillhub/submit",e)}async function PC(e="claude"){return Vj("GET",`/api/projects/usage?tool=${encodeURIComponent(e)}`)}async function _C(e="claude"){return Vj("GET",`/api/projects/usage?refresh=true&tool=${encodeURIComponent(e)}`)}async function NC(){return Vj("GET","/api/host-stats")}async function TC(){try{return await Vj("GET","/api/claude-mem/status")}catch{return null}}async function RC(){return(await Vj("GET","/api/claude-mem/projects")).items}async function MC(e){const t=new URLSearchParams;return e.project&&t.set("project",e.project),e.type&&t.set("type",e.type),e.q&&t.set("q",e.q),null!=e.limit&&t.set("limit",String(e.limit)),null!=e.offset&&t.set("offset",String(e.offset)),Vj("GET",`/api/claude-mem/observations?${t.toString()}`)}async function LC(e){return Vj("GET",`/api/filesystem${e?`?path=${encodeURIComponent(e)}`:""}`)}function OC(e){return`/api/filesystem/raw?path=${encodeURIComponent(e)}`}async function AC(e){return(await Vj("GET",`/api/filesystem/doc-text?path=${encodeURIComponent(e)}`)).text}async function DC(e,t,n){return new Promise((r,o)=>{const a=new FormData;a.append("path",e);for(const e of t)a.append("files",e);const s=new XMLHttpRequest;s.open("POST","/api/filesystem/upload");const i=$j();i&&s.setRequestHeader("Authorization",`Bearer ${i}`),n&&(s.upload.onprogress=e=>{e.lengthComputable&&n(e.loaded,e.total)}),s.onload=()=>{if(s.status>=200&&s.status<300)try{r(JSON.parse(s.responseText))}catch(e){o(e instanceof Error?e:new Error(String(e)))}else{let e=`Upload failed: ${s.status}`;try{const t=JSON.parse(s.responseText);t.error&&(e=t.error)}catch{}o(new Error(e))}},s.onerror=()=>o(new Error("Network error")),s.onabort=()=>o(new Error("Upload aborted")),s.send(a)})}async function IC(e,t){return Vj("POST","/api/filesystem/mkdir",{path:e,name:t})}async function FC(e){return Vj("GET",`/api/filesystem/file?path=${encodeURIComponent(e)}`)}async function $C(e,t){return Vj("PUT","/api/filesystem/file",{path:e,content:t})}async function zC(e){return Vj("DELETE",`/api/filesystem?path=${encodeURIComponent(e)}`)}async function VC(){return Vj("GET","/api/update/check-version")}async function UC(){return Vj("GET","/api/update/changelog")}async function BC(){return Vj("POST","/api/update/execute")}async function WC(){return Vj("GET","/api/update/status")}async function HC(){return Vj("GET","/api/user-prefs/language")}async function qC(e){return Vj("PUT","/api/user-prefs/language",{language:e})}async function GC(){return Vj("GET","/api/notify/config")}async function KC(e){return Vj("PUT","/api/notify/config",e)}async function YC(e){return Vj("GET",`/api/projects/${e}/git/status`)}async function XC(e,t){return Vj("GET",`/api/projects/${e}/git/diff${t?`?file=${encodeURIComponent(t)}`:""}`)}async function QC(e,t){await Vj("POST",`/api/projects/${e}/git/add`,{files:t})}async function JC(e,t){await Vj("POST",`/api/projects/${e}/git/commit`,{message:t})}async function ZC(e,t=50,n=0){return Vj("GET",`/api/projects/${e}/git/log?limit=${t}&skip=${n}`)}async function eE(e,t){return Vj("PATCH",`/api/projects/${e}/rename`,{name:t})}async function tE(e,t={}){const n=new URLSearchParams;null!=t.limit&&n.set("limit",String(t.limit)),t.before&&n.set("before",t.before);const r=n.toString();return Vj("GET",`/api/projects/${e}/chat-history${r?"?"+r:""}`)}async function nE(e){return Vj("GET",`/api/projects/${e}/disk-size`)}async function rE(e){return Vj("GET",`/api/claude/scheduled?projectId=${encodeURIComponent(e)}`)}async function oE(e){return Vj("GET",`/api/projects/${e}/sessions-backup`)}async function aE(e){return Vj("POST",`/api/projects/${e}/sessions-backup`)}async function sE(e){return Vj("GET",`/api/tool/model?tool=${encodeURIComponent(e)}`)}async function iE(e,t){return Vj("PUT",`/api/tool/model?tool=${encodeURIComponent(e)}`,{model:t})}async function lE(e){return Vj("GET",`/api/tool/models?tool=${encodeURIComponent(e)}`)}async function cE(e,t){return Vj("GET",`/api/tool/skills${t?`?tool=${encodeURIComponent(e)}&projectId=${encodeURIComponent(t)}`:`?tool=${encodeURIComponent(e)}`}`)}async function uE(){return Vj("GET","/api/plugins")}async function dE(e){return Vj("POST","/api/plugins/install",{downloadUrl:e})}async function pE(e){await Vj("DELETE",`/api/plugins/${e}`)}async function fE(e,t){return Vj("PUT",`/api/plugins/${e}/config`,t)}async function hE(e,t){await Vj("PUT",`/api/plugins/${e}/enabled`,{enabled:t})}async function mE(e){return Vj("GET",`/api/approval/${encodeURIComponent(e)}/pending`)}async function gE(e,t,n,r){return Vj("POST",`/api/approval/${encodeURIComponent(e)}/${encodeURIComponent(t)}/decide`,{behavior:n,message:r})}async function vE(){return Vj("GET","/api/sync/config")}async function yE(e){return Vj("PUT","/api/sync/config",e)}async function bE(){return Vj("POST","/api/sync/test")}async function xE(e,t){return Vj("POST",`/api/sync/project/${encodeURIComponent(e)}`,t?{direction:t}:{})}async function wE(){return Vj("POST","/api/sync/all")}async function kE(e){return Vj("POST",`/api/sync/cancel/${encodeURIComponent(e)}`)}async function SE(){return Vj("POST","/api/sync/cancel-all")}async function jE(e=!1){return(await Vj("GET","/api/sync/project-status"+(e?"?dirty=1":""))).items}async function CE(e){return Vj("GET",`/api/sync/project/${encodeURIComponent(e)}/settings`)}async function EE(e,t){return Vj("PUT",`/api/sync/project/${encodeURIComponent(e)}/settings`,t)}async function PE(e){return Vj("GET",`/api/projects/${encodeURIComponent(e)}/cli-prompt-state`)}async function _E(e,t){return Vj("POST",`/api/projects/${encodeURIComponent(e)}/cli-prompt-respond`,{digit:t})}const NE=Object.freeze(Object.defineProperty({__proto__:null,archiveProject:Zj,browseFilesystem:LC,cancelSyncAll:SE,cancelSyncProject:kE,checkRunningProjects:async function(){return Vj("GET","/api/update/check-running")},checkVersion:VC,clearHubToken:CC,clearToken:zj,createFolder:IC,createGlobalPrompt:pC,createGlobalShortcut:rC,createProject:Yj,createProjectPrompt:gC,createProjectShortcut:iC,decideApproval:gE,deleteGlobalPrompt:hC,deleteGlobalShortcut:aC,deletePath:zC,deleteProject:Qj,deleteProjectPrompt:yC,deleteProjectShortcut:cC,executeUpdate:BC,getAllUsers:Gj,getChangelog:UC,getChatHistory:tE,getClaudeMemStatus:TC,getClaudeModel:async function(){return Vj("GET","/api/claude/model")},getClaudeSkills:async function(){return Vj("GET","/api/claude/skills")},getCliPromptState:PE,getDocText:AC,getGitDiff:XC,getGitLog:ZC,getGitStatus:YC,getGlobalPrompts:dC,getGlobalShortcuts:nC,getHostStats:NC,getHubAuthStatus:SC,getHubItems:kC,getInstalledPlugins:uE,getLanguagePref:HC,getLocalToken:Wj,getMemoryPrompts:bC,getNotifyConfig:GC,getPendingApprovals:mE,getProjectDiskSize:nE,getProjectOrder:Hj,getProjectPrompts:mC,getProjectShortcuts:sC,getProjectSyncSettings:CE,getProjects:async function(){return Vj("GET","/api/projects")},getProjectsActivity:async function(e){return Vj("GET","/api/projects/activity",void 0,!0,e)},getRawFileUrl:OC,getScheduledTasks:rE,getSessionsBackupStatus:oE,getSyncConfig:vE,getSyncProjectStatus:jE,getSyncStatus:async function(){return Vj("GET","/api/sync/status")},getToken:$j,getToolModel:sE,getToolModels:lE,getToolSkills:cE,getUpdateStatus:WC,getUsage:PC,getWorkspace:async function(){return(await Vj("GET","/api/projects/workspace")).workspace},gitAdd:QC,gitCommit:JC,installPlugin:dE,isLocalAccess:Bj,listClaudeMemObservations:MC,listClaudeMemProjects:RC,login:Uj,markProjectShortcutUsed:uC,openProject:Xj,prepareForUpdate:async function(){return Vj("POST","/api/update/prepare")},readFile:FC,refreshUsage:_C,renameProject:eE,resetSyncConfig:async function(){return Vj("POST","/api/sync/reset")},respondCliPrompt:_E,setHubToken:jC,setLanguagePref:qC,setPluginEnabled:hE,setProjectOrder:qj,setToken:function(e){var t;t=e,Oj.getState().setToken(t)},setToolModel:iE,startProject:Jj,stopProject:async function(e){return Vj("PATCH",`/api/projects/${e}/stop`)},submitToHub:EC,switchProjectCliTool:eC,syncAll:wE,syncProjectOnce:xE,testSyncConnection:bE,toggleMemoryInClaudeMd:xC,togglePromptInClaudeMd:wC,triggerSessionsBackup:aE,unarchiveProject:tC,uninstallPlugin:pE,updateGlobalPrompt:fC,updateGlobalShortcut:oC,updateNotifyConfig:KC,updatePlugin:async function(e,t){return Vj("POST",`/api/plugins/${e}/update`,{downloadUrl:t})},updatePluginConfig:fE,updateProjectPrompt:vC,updateProjectShares:Kj,updateProjectShortcut:lC,updateProjectSyncSettings:EE,updateProjectTags:async function(e,t){return Vj("PATCH",`/api/projects/${e}/tags`,{tags:t})},updateSyncConfig:yE,uploadFiles:DC,writeFile:$C},Symbol.toStringTag,{value:"Module"})),TE={fast:{duration:.15,ease:"easeOut"},default:{duration:.2,ease:"easeOut"},slow:{duration:.3,ease:"easeInOut"}};function RE(){const e=cp(),t=Oj(e=>e.setToken),[n,r]=W.useState(""),[o,a]=W.useState(""),[s,i]=W.useState(null),[l,c]=W.useState(!1);W.useEffect(()=>{if(!Bj())return;let n=!1;return(async()=>{try{const r=await Wj();n||(t(r),e("/",{replace:!0}))}catch{}})(),()=>{n=!0}},[e,t]);return ee.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:ee.jsx(tS.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:TE.slow,className:"w-full max-w-sm",children:ee.jsxs(QS,{children:[ee.jsxs(JS,{className:"text-center",children:[ee.jsx(ZS,{className:"text-2xl",children:"CC Web"}),ee.jsx(ej,{children:Bj()?"Connecting locally...":"Sign in to manage your projects"})]}),ee.jsxs("form",{onSubmit:r=>{(async r=>{r.preventDefault(),i(null),c(!0);try{const r=await Uj(n,o);t(r),e("/")}catch(a){i(a instanceof Error?a.message:"Login failed")}finally{c(!1)}})(r)},children:[ee.jsxs(tj,{className:"space-y-4",children:[ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(jj,{htmlFor:"username",children:"Username"}),ee.jsx(bj,{id:"username",type:"text",autoComplete:"username",value:n,onChange:e=>r(e.target.value),required:!0,autoFocus:!0})]}),ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(jj,{htmlFor:"password",children:"Password"}),ee.jsx(bj,{id:"password",type:"password",autoComplete:"current-password",value:o,onChange:e=>a(e.target.value),required:!0})]}),ee.jsx(Iw,{children:s&&ee.jsx(tS.p,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:-8},transition:TE.default,className:"text-sm text-destructive",children:s})})]}),ee.jsx(nj,{children:ee.jsx(tS.div,{className:"w-full",whileTap:{scale:.98},children:ee.jsx(yj,{type:"submit",className:"w-full",disabled:l,children:l?"Signing in...":"Sign In"})})})]})]})})})}
64
64
  /**
65
65
  * @license lucide-react v0.309.0 - ISC
66
66
  *
@@ -72,4 +72,4 @@ function Zd(){return Zd=Object.assign?Object.assign.bind():function(e){for(var t
72
72
  *
73
73
  * This source code is licensed under the ISC license.
74
74
  * See the LICENSE file in the root directory of this source tree.
75
- */const LE=(e,t)=>{const n=W.forwardRef(({color:n="currentColor",size:r=24,strokeWidth:o=2,absoluteStrokeWidth:a,className:s="",children:i,...l},c)=>{return W.createElement("svg",{ref:c,...ME,width:r,height:r,stroke:n,strokeWidth:a?24*Number(o)/Number(r):o,className:["lucide",`lucide-${u=e,u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim()}`,s].join(" "),...l},[...t.map(([e,t])=>W.createElement(e,t)),...Array.isArray(i)?i:[i]]);var u});return n.displayName=`${e}`,n},OE=LE("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]),AE=LE("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]),DE=LE("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),IE=LE("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),FE=LE("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),$E=LE("Brain",[["path",{d:"M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 1.98-3A2.5 2.5 0 0 1 9.5 2Z",key:"1mhkh5"}],["path",{d:"M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-1.98-3A2.5 2.5 0 0 0 14.5 2Z",key:"1d6s00"}]]),zE=LE("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),VE=LE("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),UE=LE("Cpu",[["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"9",y:"9",width:"6",height:"6",key:"o3kz5p"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]),BE=LE("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]),WE=LE("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),HE=LE("File",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}]]),qE=LE("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),GE=LE("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),KE=LE("FolderSync",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v.5",key:"1dkoa9"}],["path",{d:"M12 10v4h4",key:"1czhmt"}],["path",{d:"m12 14 1.535-1.605a5 5 0 0 1 8 1.5",key:"lvuxfi"}],["path",{d:"M22 22v-4h-4",key:"1ewp4q"}],["path",{d:"m22 18-1.535 1.605a5 5 0 0 1-8-1.5",key:"14ync0"}]]),YE=LE("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),XE=LE("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]),QE=LE("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]),JE=LE("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),ZE=LE("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),eP=LE("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]),tP=LE("KeyRound",[["path",{d:"M2 18v3c0 .6.4 1 1 1h4v-3h3v-3h2l1.4-1.4a6.5 6.5 0 1 0-4-4Z",key:"167ctg"}],["circle",{cx:"16.5",cy:"7.5",r:".5",key:"1kog09"}]]),nP=LE("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]),rP=LE("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),oP=LE("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]),aP=LE("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]),sP=LE("MemoryStick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]),iP=LE("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]),lP=LE("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),cP=LE("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),uP=LE("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),dP=LE("MoreHorizontal",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]),pP=LE("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),fP=LE("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),hP=LE("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),mP=LE("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]),gP=LE("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),vP=LE("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),yP=LE("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]),bP=LE("Sparkles",[["path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z",key:"17u4zn"}],["path",{d:"M5 3v4",key:"bklmnn"}],["path",{d:"M19 17v4",key:"iiml17"}],["path",{d:"M3 5h4",key:"nem4j1"}],["path",{d:"M17 19h4",key:"lbex7p"}]]),xP=LE("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),wP=LE("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]),kP=LE("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]),SP=LE("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),jP=LE("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),CP=LE("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),EP=LE("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]);function PP(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(null==e||e(r),!1===n||!r.defaultPrevented)return null==t?void 0:t(r)}}function _P(e,t=[]){let n=[];const r=()=>{const t=n.map(e=>W.createContext(e));return function(n){const r=(null==n?void 0:n[e])||t;return W.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return r.scopeName=e,[function(t,r){const o=W.createContext(r),a=n.length;n=[...n,r];const s=t=>{var n;const{scope:r,children:s,...i}=t,l=(null==(n=null==r?void 0:r[e])?void 0:n[a])||o,c=W.useMemo(()=>i,Object.values(i));return ee.jsx(l.Provider,{value:c,children:s})};return s.displayName=t+"Provider",[s,function(n,s){var i;const l=(null==(i=null==s?void 0:s[e])?void 0:i[a])||o,c=W.useContext(l);if(c)return c;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},NP(r,...t)]}function NP(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const r=n.reduce((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]}),{});return W.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function TP(e){const t=RP(e),n=W.forwardRef((e,n)=>{const{children:r,...o}=e,a=W.Children.toArray(r),s=a.find(LP);if(s){const e=s.props.children,r=a.map(t=>t===s?W.Children.count(e)>1?W.Children.only(null):W.isValidElement(e)?e.props.children:null:t);return ee.jsx(t,{...o,ref:n,children:W.isValidElement(e)?W.cloneElement(e,void 0,r):null})}return ee.jsx(t,{...o,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function RP(e){const t=W.forwardRef((e,t)=>{const{children:n,...r}=e;if(W.isValidElement(n)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{const t=a(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==W.Fragment&&(o.ref=t?oj(t,e):e),W.cloneElement(n,o)}return W.Children.count(n)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var MP=Symbol("radix.slottable");function LP(e){return W.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===MP}var OP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const n=TP(`Primitive.${t}`),r=W.forwardRef((e,r)=>{const{asChild:o,...a}=e,s=o?n:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),ee.jsx(s,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function AP(e,t){e&&ld.flushSync(()=>e.dispatchEvent(t))}function DP(e){const t=W.useRef(e);return W.useEffect(()=>{t.current=e}),W.useMemo(()=>(...e)=>{var n;return null==(n=t.current)?void 0:n.call(t,...e)},[])}var IP,FP="dismissableLayer.update",$P="dismissableLayer.pointerDownOutside",zP="dismissableLayer.focusOutside",VP=W.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),UP=W.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:s,onDismiss:i,...l}=e,c=W.useContext(VP),[u,d]=W.useState(null),p=(null==u?void 0:u.ownerDocument)??(null==globalThis?void 0:globalThis.document),[,f]=W.useState({}),h=aj(t,e=>d(e)),m=Array.from(c.layers),[g]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),v=m.indexOf(g),y=u?m.indexOf(u):-1,b=c.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,w=function(e,t=(null==globalThis?void 0:globalThis.document)){const n=DP(e),r=W.useRef(!1),o=W.useRef(()=>{});return W.useEffect(()=>{const e=e=>{if(e.target&&!r.current){let r=function(){WP($P,n,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}(e=>{const t=e.target,n=[...c.branches].some(e=>e.contains(t));x&&!n&&(null==o||o(e),null==s||s(e),e.defaultPrevented||null==i||i())},p),k=function(e,t=(null==globalThis?void 0:globalThis.document)){const n=DP(e),r=W.useRef(!1);return W.useEffect(()=>{const e=e=>{if(e.target&&!r.current){WP(zP,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}(e=>{const t=e.target;[...c.branches].some(e=>e.contains(t))||(null==a||a(e),null==s||s(e),e.defaultPrevented||null==i||i())},p);return function(e,t=(null==globalThis?void 0:globalThis.document)){const n=DP(e);W.useEffect(()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[n,t])}(e=>{y===c.layers.size-1&&(null==r||r(e),!e.defaultPrevented&&i&&(e.preventDefault(),i()))},p),W.useEffect(()=>{if(u)return n&&(0===c.layersWithOutsidePointerEventsDisabled.size&&(IP=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),BP(),()=>{n&&1===c.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=IP)}},[u,p,n,c]),W.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),BP())},[u,c]),W.useEffect(()=>{const e=()=>f({});return document.addEventListener(FP,e),()=>document.removeEventListener(FP,e)},[]),ee.jsx(OP.div,{...l,ref:h,style:{pointerEvents:b?x?"auto":"none":void 0,...e.style},onFocusCapture:PP(e.onFocusCapture,k.onFocusCapture),onBlurCapture:PP(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:PP(e.onPointerDownCapture,w.onPointerDownCapture)})});UP.displayName="DismissableLayer";function BP(){const e=new CustomEvent(FP);document.dispatchEvent(e)}function WP(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?AP(o,a):o.dispatchEvent(a)}W.forwardRef((e,t)=>{const n=W.useContext(VP),r=W.useRef(null),o=aj(t,r);return W.useEffect(()=>{const e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),ee.jsx(OP.div,{...e,ref:o})}).displayName="DismissableLayerBranch";var HP=0;function qP(){W.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??GP()),document.body.insertAdjacentElement("beforeend",e[1]??GP()),HP++,()=>{1===HP&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),HP--}},[])}function GP(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var KP="focusScope.autoFocusOnMount",YP="focusScope.autoFocusOnUnmount",XP={bubbles:!1,cancelable:!0},QP=W.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...s}=e,[i,l]=W.useState(null),c=DP(o),u=DP(a),d=W.useRef(null),p=aj(t,e=>l(e)),f=W.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;W.useEffect(()=>{if(r){let e=function(e){if(f.paused||!i)return;const t=e.target;i.contains(t)?d.current=t:t_(d.current,{select:!0})},t=function(e){if(f.paused||!i)return;const t=e.relatedTarget;null!==t&&(i.contains(t)||t_(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&t_(i)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return i&&r.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[r,i,f.paused]),W.useEffect(()=>{if(i){n_.add(f);const t=document.activeElement;if(!i.contains(t)){const n=new CustomEvent(KP,XP);i.addEventListener(KP,c),i.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(t_(r,{select:t}),document.activeElement!==n)return}((e=JP(i),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&t_(i))}return()=>{i.removeEventListener(KP,c),setTimeout(()=>{const e=new CustomEvent(YP,XP);i.addEventListener(YP,u),i.dispatchEvent(e),e.defaultPrevented||t_(t??document.body,{select:!0}),i.removeEventListener(YP,u),n_.remove(f)},0)}}var e},[i,c,u,f]);const h=W.useCallback(e=>{if(!n&&!r)return;if(f.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,o=document.activeElement;if(t&&o){const t=e.currentTarget,[r,a]=function(e){const t=JP(e),n=ZP(t,e),r=ZP(t.reverse(),e);return[n,r]}(t);r&&a?e.shiftKey||o!==a?e.shiftKey&&o===r&&(e.preventDefault(),n&&t_(a,{select:!0})):(e.preventDefault(),n&&t_(r,{select:!0})):o===t&&e.preventDefault()}},[n,r,f.paused]);return ee.jsx(OP.div,{tabIndex:-1,...s,ref:p,onKeyDown:h})});function JP(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ZP(e,t){for(const n of e)if(!e_(n,{upTo:t}))return n}function e_(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function t_(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}QP.displayName="FocusScope";var n_=function(){let e=[];return{add(t){const n=e[0];t!==n&&(null==n||n.pause()),e=r_(e,t),e.unshift(t)},remove(t){var n;e=r_(e,t),null==(n=e[0])||n.resume()}}}();function r_(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var o_=(null==globalThis?void 0:globalThis.document)?W.useLayoutEffect:()=>{},a_=q[" useId ".trim().toString()]||(()=>{}),s_=0;function i_(e){const[t,n]=W.useState(a_());return o_(()=>{n(e=>e??String(s_++))},[e]),e||(t?`radix-${t}`:"")}const l_=["top","right","bottom","left"],c_=Math.min,u_=Math.max,d_=Math.round,p_=Math.floor,f_=e=>({x:e,y:e}),h_={left:"right",right:"left",bottom:"top",top:"bottom"};function m_(e,t,n){return u_(e,c_(t,n))}function g_(e,t){return"function"==typeof e?e(t):e}function v_(e){return e.split("-")[0]}function y_(e){return e.split("-")[1]}function b_(e){return"x"===e?"y":"x"}function x_(e){return"y"===e?"height":"width"}function w_(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function k_(e){return b_(w_(e))}function S_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const j_=["left","right"],C_=["right","left"],E_=["top","bottom"],P_=["bottom","top"];function __(e,t,n,r){const o=y_(e);let a=function(e,t,n){switch(e){case"top":case"bottom":return n?t?C_:j_:t?j_:C_;case"left":case"right":return t?E_:P_;default:return[]}}(v_(e),"start"===n,r);return o&&(a=a.map(e=>e+"-"+o),t&&(a=a.concat(a.map(S_)))),a}function N_(e){const t=v_(e);return h_[t]+e.slice(t.length)}function T_(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function R_(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function M_(e,t,n){let{reference:r,floating:o}=e;const a=w_(t),s=k_(t),i=x_(s),l=v_(t),c="y"===a,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[i]/2-o[i]/2;let f;switch(l){case"top":f={x:u,y:r.y-o.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch(y_(t)){case"start":f[s]-=p*(n&&c?-1:1);break;case"end":f[s]+=p*(n&&c?-1:1)}return f}async function L_(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:a,rects:s,elements:i,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=g_(t,e),h=T_(f),m=i[p?"floating"===d?"reference":"floating":d],g=R_(await a.getClippingRect({element:null==(n=await(null==a.isElement?void 0:a.isElement(m)))||n?m:m.contextElement||await(null==a.getDocumentElement?void 0:a.getDocumentElement(i.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,y=await(null==a.getOffsetParent?void 0:a.getOffsetParent(i.floating)),b=await(null==a.isElement?void 0:a.isElement(y))&&await(null==a.getScale?void 0:a.getScale(y))||{x:1,y:1},x=R_(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:v,offsetParent:y,strategy:l}):v);return{top:(g.top-x.top+h.top)/b.y,bottom:(x.bottom-g.bottom+h.bottom)/b.y,left:(g.left-x.left+h.left)/b.x,right:(x.right-g.right+h.right)/b.x}}function O_(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function A_(e){return l_.some(t=>e[t]>=0)}const D_=new Set(["left","top"]);function I_(){return"undefined"!=typeof window}function F_(e){return V_(e)?(e.nodeName||"").toLowerCase():"#document"}function $_(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function z_(e){var t;return null==(t=(V_(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function V_(e){return!!I_()&&(e instanceof Node||e instanceof $_(e).Node)}function U_(e){return!!I_()&&(e instanceof Element||e instanceof $_(e).Element)}function B_(e){return!!I_()&&(e instanceof HTMLElement||e instanceof $_(e).HTMLElement)}function W_(e){return!(!I_()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof $_(e).ShadowRoot)}function H_(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=tN(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==o&&"contents"!==o}function q_(e){return/^(table|td|th)$/.test(F_(e))}function G_(e){try{if(e.matches(":popover-open"))return!0}catch(t){}try{return e.matches(":modal")}catch(t){return!1}}const K_=/transform|translate|scale|rotate|perspective|filter/,Y_=/paint|layout|strict|content/,X_=e=>!!e&&"none"!==e;let Q_;function J_(e){const t=U_(e)?tN(e):e;return X_(t.transform)||X_(t.translate)||X_(t.scale)||X_(t.rotate)||X_(t.perspective)||!Z_()&&(X_(t.backdropFilter)||X_(t.filter))||K_.test(t.willChange||"")||Y_.test(t.contain||"")}function Z_(){return null==Q_&&(Q_="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Q_}function eN(e){return/^(html|body|#document)$/.test(F_(e))}function tN(e){return $_(e).getComputedStyle(e)}function nN(e){return U_(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function rN(e){if("html"===F_(e))return e;const t=e.assignedSlot||e.parentNode||W_(e)&&e.host||z_(e);return W_(t)?t.host:t}function oN(e){const t=rN(e);return eN(t)?e.ownerDocument?e.ownerDocument.body:e.body:B_(t)&&H_(t)?t:oN(t)}function aN(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=oN(e),a=o===(null==(r=e.ownerDocument)?void 0:r.body),s=$_(o);if(a){const e=sN(s);return t.concat(s,s.visualViewport||[],H_(o)?o:[],e&&n?aN(e):[])}return t.concat(o,aN(o,[],n))}function sN(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function iN(e){const t=tN(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=B_(e),a=o?e.offsetWidth:n,s=o?e.offsetHeight:r,i=d_(n)!==a||d_(r)!==s;return i&&(n=a,r=s),{width:n,height:r,$:i}}function lN(e){return U_(e)?e:e.contextElement}function cN(e){const t=lN(e);if(!B_(t))return f_(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:a}=iN(t);let s=(a?d_(n.width):n.width)/r,i=(a?d_(n.height):n.height)/o;return s&&Number.isFinite(s)||(s=1),i&&Number.isFinite(i)||(i=1),{x:s,y:i}}const uN=f_(0);function dN(e){const t=$_(e);return Z_()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:uN}function pN(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),a=lN(e);let s=f_(1);t&&(r?U_(r)&&(s=cN(r)):s=cN(e));const i=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==$_(e))&&t}(a,n,r)?dN(a):f_(0);let l=(o.left+i.x)/s.x,c=(o.top+i.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(a){const e=$_(a),t=r&&U_(r)?$_(r):r;let n=e,o=sN(n);for(;o&&r&&t!==n;){const e=cN(o),t=o.getBoundingClientRect(),r=tN(o),a=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=a,c+=s,n=$_(o),o=sN(n)}}return R_({width:u,height:d,x:l,y:c})}function fN(e,t){const n=nN(e).scrollLeft;return t?t.left+n:pN(z_(e)).left+n}function hN(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-fN(e,n),y:n.top+t.scrollTop}}function mN(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=$_(e),r=z_(e),o=n.visualViewport;let a=r.clientWidth,s=r.clientHeight,i=0,l=0;if(o){a=o.width,s=o.height;const e=Z_();(!e||e&&"fixed"===t)&&(i=o.offsetLeft,l=o.offsetTop)}const c=fN(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),o="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(r.clientWidth-t.clientWidth-o);s<=25&&(a-=s)}else c<=25&&(a+=c);return{width:a,height:s,x:i,y:l}}(e,n);else if("document"===t)r=function(e){const t=z_(e),n=nN(e),r=e.ownerDocument.body,o=u_(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=u_(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+fN(e);const i=-n.scrollTop;return"rtl"===tN(r).direction&&(s+=u_(t.clientWidth,r.clientWidth)-o),{width:o,height:a,x:s,y:i}}(z_(e));else if(U_(t))r=function(e,t){const n=pN(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,a=B_(e)?cN(e):f_(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:o*a.x,y:r*a.y}}(t,n);else{const n=dN(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return R_(r)}function gN(e,t){const n=rN(e);return!(n===t||!U_(n)||eN(n))&&("fixed"===tN(n).position||gN(n,t))}function vN(e,t,n){const r=B_(t),o=z_(t),a="fixed"===n,s=pN(e,!0,a,t);let i={scrollLeft:0,scrollTop:0};const l=f_(0);function c(){l.x=fN(o)}if(r||!r&&!a)if(("body"!==F_(t)||H_(o))&&(i=nN(t)),r){const e=pN(t,!0,a,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&c();a&&!r&&o&&c();const u=!o||r||a?f_(0):hN(o,i);return{x:s.left+i.scrollLeft-l.x-u.x,y:s.top+i.scrollTop-l.y-u.y,width:s.width,height:s.height}}function yN(e){return"static"===tN(e).position}function bN(e,t){if(!B_(e)||"fixed"===tN(e).position)return null;if(t)return t(e);let n=e.offsetParent;return z_(e)===n&&(n=n.ownerDocument.body),n}function xN(e,t){const n=$_(e);if(G_(e))return n;if(!B_(e)){let t=rN(e);for(;t&&!eN(t);){if(U_(t)&&!yN(t))return t;t=rN(t)}return n}let r=bN(e,t);for(;r&&q_(r)&&yN(r);)r=bN(r,t);return r&&eN(r)&&yN(r)&&!J_(r)?n:r||function(e){let t=rN(e);for(;B_(t)&&!eN(t);){if(J_(t))return t;if(G_(t))return null;t=rN(t)}return null}(e)||n}const wN={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const a="fixed"===o,s=z_(r),i=!!t&&G_(t.floating);if(r===s||i&&a)return n;let l={scrollLeft:0,scrollTop:0},c=f_(1);const u=f_(0),d=B_(r);if((d||!d&&!a)&&(("body"!==F_(r)||H_(s))&&(l=nN(r)),d)){const e=pN(r);c=cN(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const p=!s||d||a?f_(0):hN(s,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-l.scrollTop*c.y+u.y+p.y}},getDocumentElement:z_,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[..."clippingAncestors"===n?G_(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=aN(e,[],!1).filter(e=>U_(e)&&"body"!==F_(e)),o=null;const a="fixed"===tN(e).position;let s=a?rN(e):e;for(;U_(s)&&!eN(s);){const t=tN(s),n=J_(s);n||"fixed"!==t.position||(o=null),(a?!n&&!o:!n&&"static"===t.position&&o&&("absolute"===o.position||"fixed"===o.position)||H_(s)&&!n&&gN(e,s))?r=r.filter(e=>e!==s):o=t,s=rN(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],s=mN(t,a[0],o);let i=s.top,l=s.right,c=s.bottom,u=s.left;for(let d=1;d<a.length;d++){const e=mN(t,a[d],o);i=u_(e.top,i),l=c_(e.right,l),c=c_(e.bottom,c),u=u_(e.left,u)}return{width:l-u,height:c-i,x:u,y:i}},getOffsetParent:xN,getElementRects:async function(e){const t=this.getOffsetParent||xN,n=this.getDimensions,r=await n(e.floating);return{reference:vN(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=iN(e);return{width:t,height:n}},getScale:cN,isElement:U_,isRTL:function(e){return"rtl"===tN(e).direction}};function kN(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function SN(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:i="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=lN(e),u=o||a?[...c?aN(c):[],...t?aN(t):[]]:[];u.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),a&&e.addEventListener("resize",n)});const d=c&&i?function(e,t){let n,r=null;const o=z_(e);function a(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function s(i,l){void 0===i&&(i=!1),void 0===l&&(l=1),a();const c=e.getBoundingClientRect(),{left:u,top:d,width:p,height:f}=c;if(i||t(),!p||!f)return;const h={rootMargin:-p_(d)+"px "+-p_(o.clientWidth-(u+p))+"px "+-p_(o.clientHeight-(d+f))+"px "+-p_(u)+"px",threshold:u_(0,c_(1,l))||1};let m=!0;function g(t){const r=t[0].intersectionRatio;if(r!==l){if(!m)return s();r?s(!1,r):n=setTimeout(()=>{s(!1,1e-7)},1e3)}1!==r||kN(c,e.getBoundingClientRect())||s(),m=!1}try{r=new IntersectionObserver(g,{...h,root:o.ownerDocument})}catch(v){r=new IntersectionObserver(g,h)}r.observe(e)}(!0),a}(c,n):null;let p,f=-1,h=null;s&&(h=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&h&&t&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),n()}),c&&!l&&h.observe(c),t&&h.observe(t));let m=l?pN(e):null;return l&&function t(){const r=pN(e);m&&!kN(m,r)&&n();m=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{o&&e.removeEventListener("scroll",n),a&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const jN=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:a,placement:s,middlewareData:i}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,a=await(null==r.isRTL?void 0:r.isRTL(o.floating)),s=v_(n),i=y_(n),l="y"===w_(n),c=D_.has(s)?-1:1,u=a&&l?-1:1,d=g_(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return i&&"number"==typeof h&&(f="end"===i?-1*h:h),l?{x:f*u,y:p*c}:{x:p*c,y:f*u}}(t,e);return s===(null==(n=i.offset)?void 0:n.placement)&&null!=(r=i.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:a+l.y,data:{...l,placement:s}}}}},CN=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:a}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=g_(e,t),u={x:n,y:r},d=await a.detectOverflow(t,c),p=w_(v_(o)),f=b_(p);let h=u[f],m=u[p];if(s){const e="y"===f?"bottom":"right";h=m_(h+d["y"===f?"top":"left"],h,h-d[e])}if(i){const e="y"===p?"bottom":"right";m=m_(m+d["y"===p?"top":"left"],m,m-d[e])}const g=l.fn({...t,[f]:h,[p]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[f]:s,[p]:i}}}}}},EN=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:a,rects:s,initialPlacement:i,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...g}=g_(e,t);if(null!=(n=a.arrow)&&n.alignmentOffset)return{};const v=v_(o),y=w_(i),b=v_(i)===i,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=p||(b||!m?[N_(i)]:function(e){const t=N_(e);return[S_(e),t,S_(t)]}(i)),k="none"!==h;!p&&k&&w.push(...__(i,m,h,x));const S=[i,...w],j=await l.detectOverflow(t,g),C=[];let E=(null==(r=a.flip)?void 0:r.overflows)||[];if(u&&C.push(j[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=y_(e),o=k_(e),a=x_(o);let s="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[a]>t.floating[a]&&(s=N_(s)),[s,N_(s)]}(o,s,x);C.push(j[e[0]],j[e[1]])}if(E=[...E,{placement:o,overflows:C}],!C.every(e=>e<=0)){var P,_;const e=((null==(P=a.flip)?void 0:P.index)||0)+1,t=S[e];if(t){if(!("alignment"===d&&y!==w_(t))||E.every(e=>w_(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:E},reset:{placement:t}}}let n=null==(_=E.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:_.placement;if(!n)switch(f){case"bestFit":{var N;const e=null==(N=E.filter(e=>{if(k){const t=w_(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:N[0];e&&(n=e);break}case"initialPlacement":n=i}if(o!==n)return{reset:{placement:n}}}return{}}}},PN=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:a,platform:s,elements:i}=t,{apply:l=()=>{},...c}=g_(e,t),u=await s.detectOverflow(t,c),d=v_(o),p=y_(o),f="y"===w_(o),{width:h,height:m}=a.floating;let g,v;"top"===d||"bottom"===d?(g=d,v=p===(await(null==s.isRTL?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(v=d,g="end"===p?"top":"bottom");const y=m-u.top-u.bottom,b=h-u.left-u.right,x=c_(m-u[g],y),w=c_(h-u[v],b),k=!t.middlewareData.shift;let S=x,j=w;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(j=b),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(S=y),k&&!p){const e=u_(u.left,0),t=u_(u.right,0),n=u_(u.top,0),r=u_(u.bottom,0);f?j=h-2*(0!==e||0!==t?e+t:u_(u.left,u.right)):S=m-2*(0!==n||0!==r?n+r:u_(u.top,u.bottom))}await l({...t,availableWidth:j,availableHeight:S});const C=await s.getDimensions(i.floating);return h!==C.width||m!==C.height?{reset:{rects:!0}}:{}}}},_N=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...a}=g_(e,t);switch(o){case"referenceHidden":{const e=O_(await r.detectOverflow(t,{...a,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:A_(e)}}}case"escaped":{const e=O_(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:A_(e)}}}default:return{}}}}},NN=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:a,platform:s,elements:i,middlewareData:l}=t,{element:c,padding:u=0}=g_(e,t)||{};if(null==c)return{};const d=T_(u),p={x:n,y:r},f=k_(o),h=x_(f),m=await s.getDimensions(c),g="y"===f,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=a.reference[h]+a.reference[f]-p[f]-a.floating[h],w=p[f]-a.reference[f],k=await(null==s.getOffsetParent?void 0:s.getOffsetParent(c));let S=k?k[b]:0;S&&await(null==s.isElement?void 0:s.isElement(k))||(S=i.floating[b]||a.floating[h]);const j=x/2-w/2,C=S/2-m[h]/2-1,E=c_(d[v],C),P=c_(d[y],C),_=E,N=S-m[h]-P,T=S/2-m[h]/2+j,R=m_(_,T,N),M=!l.arrow&&null!=y_(o)&&T!==R&&a.reference[h]/2-(T<_?E:P)-m[h]/2<0,L=M?T<_?T-_:T-N:0;return{[f]:p[f]+L,data:{[f]:R,centerOffset:T-R-L,...M&&{alignmentOffset:L}},reset:M}}}),TN=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:a,middlewareData:s}=t,{offset:i=0,mainAxis:l=!0,crossAxis:c=!0}=g_(e,t),u={x:n,y:r},d=w_(o),p=b_(d);let f=u[p],h=u[d];const m=g_(i,t),g="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const e="y"===p?"height":"width",t=a.reference[p]-a.floating[e]+g.mainAxis,n=a.reference[p]+a.reference[e]-g.mainAxis;f<t?f=t:f>n&&(f=n)}if(c){var v,y;const e="y"===p?"width":"height",t=D_.has(v_(o)),n=a.reference[d]-a.floating[e]+(t&&(null==(v=s.offset)?void 0:v[d])||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:(null==(y=s.offset)?void 0:y[d])||0)-(t?g.crossAxis:0);h<n?h=n:h>r&&(h=r)}return{[p]:f,[d]:h}}}},RN=(e,t,n)=>{const r=new Map,o={platform:wN,...n},a={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:a=[],platform:s}=n,i=s.detectOverflow?s:{...s,detectOverflow:L_},l=await(null==s.isRTL?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=M_(c,r,l),p=r,f=0;const h={};for(let m=0;m<a.length;m++){const n=a[m];if(!n)continue;const{name:g,fn:v}=n,{x:y,y:b,data:x,reset:w}=await v({x:u,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:h,rects:c,platform:i,elements:{reference:e,floating:t}});u=null!=y?y:u,d=null!=b?b:d,h[g]={...h[g],...x},w&&f<50&&(f++,"object"==typeof w&&(w.placement&&(p=w.placement),w.rects&&(c=!0===w.rects?await s.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:u,y:d}=M_(c,p,l))),m=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:h}})(e,t,{...o,platform:a})};var MN="undefined"!=typeof document?W.useLayoutEffect:function(){};function LN(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!LN(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!LN(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function ON(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function AN(e,t){const n=ON(e);return Math.round(t*n)/n}function DN(e){const t=W.useRef(e);return MN(()=>{t.current=e}),t}const IN=(e,t)=>{const n=jN(e);return{name:n.name,fn:n.fn,options:[e,t]}},FN=(e,t)=>{const n=CN(e);return{name:n.name,fn:n.fn,options:[e,t]}},$N=(e,t)=>({fn:TN(e).fn,options:[e,t]}),zN=(e,t)=>{const n=EN(e);return{name:n.name,fn:n.fn,options:[e,t]}},VN=(e,t)=>{const n=PN(e);return{name:n.name,fn:n.fn,options:[e,t]}},UN=(e,t)=>{const n=_N(e);return{name:n.name,fn:n.fn,options:[e,t]}},BN=(e,t)=>{const n=(e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?NN({element:n.current,padding:r}).fn(t):{}:n?NN({element:n,padding:r}).fn(t):{};var o}}))(e);return{name:n.name,fn:n.fn,options:[e,t]}};var WN=W.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...a}=e;return ee.jsx(OP.svg,{...a,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:ee.jsx("polygon",{points:"0,0 30,0 15,10"})})});WN.displayName="Arrow";var HN=WN;function qN(e){const[t,n]=W.useState(void 0);return o_(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let o,a;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,a=t.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}var GN="Popper",[KN,YN]=_P(GN),[XN,QN]=KN(GN),JN=e=>{const{__scopePopper:t,children:n}=e,[r,o]=W.useState(null);return ee.jsx(XN,{scope:t,anchor:r,onAnchorChange:o,children:n})};JN.displayName=GN;var ZN="PopperAnchor",eT=W.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,a=QN(ZN,n),s=W.useRef(null),i=aj(t,s),l=W.useRef(null);return W.useEffect(()=>{const e=l.current;l.current=(null==r?void 0:r.current)||s.current,e!==l.current&&a.onAnchorChange(l.current)}),r?null:ee.jsx(OP.div,{...o,ref:i})});eT.displayName=ZN;var tT="PopperContent",[nT,rT]=KN(tT),oT=W.forwardRef((e,t)=>{var n,r,o,a,s,i;const{__scopePopper:l,side:c="bottom",sideOffset:u=0,align:d="center",alignOffset:p=0,arrowPadding:f=0,avoidCollisions:h=!0,collisionBoundary:m=[],collisionPadding:g=0,sticky:v="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:x,...w}=e,k=QN(tT,l),[S,j]=W.useState(null),C=aj(t,e=>j(e)),[E,P]=W.useState(null),_=qN(E),N=(null==_?void 0:_.width)??0,T=(null==_?void 0:_.height)??0,R=c+("center"!==d?"-"+d:""),M="number"==typeof g?g:{top:0,right:0,bottom:0,left:0,...g},L=Array.isArray(m)?m:[m],O=L.length>0,A={padding:M,boundary:L.filter(lT),altBoundary:O},{refs:D,floatingStyles:I,placement:F,isPositioned:$,middlewareData:z}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:a,floating:s}={},transform:i=!0,whileElementsMounted:l,open:c}=e,[u,d]=W.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=W.useState(r);LN(p,r)||f(r);const[h,m]=W.useState(null),[g,v]=W.useState(null),y=W.useCallback(e=>{e!==k.current&&(k.current=e,m(e))},[]),b=W.useCallback(e=>{e!==S.current&&(S.current=e,v(e))},[]),x=a||h,w=s||g,k=W.useRef(null),S=W.useRef(null),j=W.useRef(u),C=null!=l,E=DN(l),P=DN(o),_=DN(c),N=W.useCallback(()=>{if(!k.current||!S.current)return;const e={placement:t,strategy:n,middleware:p};P.current&&(e.platform=P.current),RN(k.current,S.current,e).then(e=>{const t={...e,isPositioned:!1!==_.current};T.current&&!LN(j.current,t)&&(j.current=t,ld.flushSync(()=>{d(t)}))})},[p,t,n,P,_]);MN(()=>{!1===c&&j.current.isPositioned&&(j.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[c]);const T=W.useRef(!1);MN(()=>(T.current=!0,()=>{T.current=!1}),[]),MN(()=>{if(x&&(k.current=x),w&&(S.current=w),x&&w){if(E.current)return E.current(x,w,N);N()}},[x,w,N,E,C]);const R=W.useMemo(()=>({reference:k,floating:S,setReference:y,setFloating:b}),[y,b]),M=W.useMemo(()=>({reference:x,floating:w}),[x,w]),L=W.useMemo(()=>{const e={position:n,left:0,top:0};if(!M.floating)return e;const t=AN(M.floating,u.x),r=AN(M.floating,u.y);return i?{...e,transform:"translate("+t+"px, "+r+"px)",...ON(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,i,M.floating,u.x,u.y]);return W.useMemo(()=>({...u,update:N,refs:R,elements:M,floatingStyles:L}),[u,N,R,M,L])}({strategy:"fixed",placement:R,whileElementsMounted:(...e)=>SN(...e,{animationFrame:"always"===b}),elements:{reference:k.anchor},middleware:[IN({mainAxis:u+T,alignmentAxis:p}),h&&FN({mainAxis:!0,crossAxis:!1,limiter:"partial"===v?$N():void 0,...A}),h&&zN({...A}),VN({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:o,height:a}=t.reference,s=e.floating.style;s.setProperty("--radix-popper-available-width",`${n}px`),s.setProperty("--radix-popper-available-height",`${r}px`),s.setProperty("--radix-popper-anchor-width",`${o}px`),s.setProperty("--radix-popper-anchor-height",`${a}px`)}}),E&&BN({element:E,padding:f}),cT({arrowWidth:N,arrowHeight:T}),y&&UN({strategy:"referenceHidden",...A})]}),[V,U]=uT(F),B=DP(x);o_(()=>{$&&(null==B||B())},[$,B]);const H=null==(n=z.arrow)?void 0:n.x,q=null==(r=z.arrow)?void 0:r.y,G=0!==(null==(o=z.arrow)?void 0:o.centerOffset),[K,Y]=W.useState();return o_(()=>{S&&Y(window.getComputedStyle(S).zIndex)},[S]),ee.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:$?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:K,"--radix-popper-transform-origin":[null==(a=z.transformOrigin)?void 0:a.x,null==(s=z.transformOrigin)?void 0:s.y].join(" "),...(null==(i=z.hide)?void 0:i.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:ee.jsx(nT,{scope:l,placedSide:V,onArrowChange:P,arrowX:H,arrowY:q,shouldHideArrow:G,children:ee.jsx(OP.div,{"data-side":V,"data-align":U,...w,ref:C,style:{...w.style,animation:$?void 0:"none"}})})})});oT.displayName=tT;var aT="PopperArrow",sT={top:"bottom",right:"left",bottom:"top",left:"right"},iT=W.forwardRef(function(e,t){const{__scopePopper:n,...r}=e,o=rT(aT,n),a=sT[o.placedSide];return ee.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:ee.jsx(HN,{...r,ref:t,style:{...r.style,display:"block"}})})});function lT(e){return null!==e}iT.displayName=aT;var cT=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o;const{placement:a,rects:s,middlewareData:i}=t,l=0!==(null==(n=i.arrow)?void 0:n.centerOffset),c=l?0:e.arrowWidth,u=l?0:e.arrowHeight,[d,p]=uT(a),f={start:"0%",center:"50%",end:"100%"}[p],h=((null==(r=i.arrow)?void 0:r.x)??0)+c/2,m=((null==(o=i.arrow)?void 0:o.y)??0)+u/2;let g="",v="";return"bottom"===d?(g=l?f:`${h}px`,v=-u+"px"):"top"===d?(g=l?f:`${h}px`,v=`${s.floating.height+u}px`):"right"===d?(g=-u+"px",v=l?f:`${m}px`):"left"===d&&(g=`${s.floating.width+u}px`,v=l?f:`${m}px`),{data:{x:g,y:v}}}});function uT(e){const[t,n="center"]=e.split("-");return[t,n]}var dT=JN,pT=eT,fT=oT,hT=iT,mT=W.forwardRef((e,t)=>{var n;const{container:r,...o}=e,[a,s]=W.useState(!1);o_(()=>s(!0),[]);const i=r||a&&(null==(n=null==globalThis?void 0:globalThis.document)?void 0:n.body);return i?cd.createPortal(ee.jsx(OP.div,{...o,ref:t}),i):null});mT.displayName="Portal";var gT=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=W.useState(),r=W.useRef(null),o=W.useRef(e),a=W.useRef("none"),s=e?"mounted":"unmounted",[i,l]=function(e,t){return W.useReducer((e,n)=>t[e][n]??e,e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return W.useEffect(()=>{const e=vT(r.current);a.current="mounted"===i?e:"none"},[i]),o_(()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,s=vT(t);if(e)l("MOUNT");else if("none"===s||"none"===(null==t?void 0:t.display))l("UNMOUNT");else{l(n&&r!==s?"ANIMATION_OUT":"UNMOUNT")}o.current=e}},[e,l]),o_(()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,s=a=>{const s=vT(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&s&&(l("ANIMATION_END"),!o.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)})}},i=e=>{e.target===t&&(a.current=vT(r.current))};return t.addEventListener("animationstart",i),t.addEventListener("animationcancel",s),t.addEventListener("animationend",s),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",i),t.removeEventListener("animationcancel",s),t.removeEventListener("animationend",s)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:W.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}(t),o="function"==typeof n?n({present:r.isPresent}):W.Children.only(n),a=aj(r.ref,function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof n||r.isPresent?W.cloneElement(o,{ref:a}):null};function vT(e){return(null==e?void 0:e.animationName)||"none"}function yT(e){const t=bT(e),n=W.forwardRef((e,n)=>{const{children:r,...o}=e,a=W.Children.toArray(r),s=a.find(wT);if(s){const e=s.props.children,r=a.map(t=>t===s?W.Children.count(e)>1?W.Children.only(null):W.isValidElement(e)?e.props.children:null:t);return ee.jsx(t,{...o,ref:n,children:W.isValidElement(e)?W.cloneElement(e,void 0,r):null})}return ee.jsx(t,{...o,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function bT(e){const t=W.forwardRef((e,t)=>{const{children:n,...r}=e;if(W.isValidElement(n)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{const t=a(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==W.Fragment&&(o.ref=t?oj(t,e):e),W.cloneElement(n,o)}return W.Children.count(n)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}gT.displayName="Presence";var xT=Symbol("radix.slottable");function wT(e){return W.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===xT}var kT=q[" useInsertionEffect ".trim().toString()]||o_;function ST({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,s]=function({defaultProp:e,onChange:t}){const[n,r]=W.useState(e),o=W.useRef(n),a=W.useRef(t);return kT(()=>{a.current=t},[t]),W.useEffect(()=>{var e;o.current!==n&&(null==(e=a.current)||e.call(a,n),o.current=n)},[n,o]),[n,r,a]}({defaultProp:t,onChange:n}),i=void 0!==e,l=i?e:o;{const t=W.useRef(void 0!==e);W.useEffect(()=>{const e=t.current;if(e!==i){const t=e?"controlled":"uncontrolled",n=i?"controlled":"uncontrolled";console.warn(`${r} is changing from ${t} to ${n}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=i},[i,r])}const c=W.useCallback(t=>{var n;if(i){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&(null==(n=s.current)||n.call(s,r))}else a(t)},[i,e,a,s]);return[l,c]}var jT=new WeakMap,CT=new WeakMap,ET={},PT=0,_T=function(e){return e&&(e.host||_T(e.parentNode))},NT=function(e,t,n,r){var o=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=_T(t);return n&&e.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);ET[n]||(ET[n]=new WeakMap);var a=ET[n],s=[],i=new Set,l=new Set(o),c=function(e){e&&!i.has(e)&&(i.add(e),c(e.parentNode))};o.forEach(c);var u=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(i.has(e))u(e);else try{var t=e.getAttribute(r),o=null!==t&&"false"!==t,l=(jT.get(e)||0)+1,c=(a.get(e)||0)+1;jT.set(e,l),a.set(e,c),s.push(e),1===l&&o&&CT.set(e,!0),1===c&&e.setAttribute(n,"true"),o||e.setAttribute(r,"true")}catch(TO){console.error("aria-hidden: cannot operate on ",e,TO)}})};return u(t),i.clear(),PT++,function(){s.forEach(function(e){var t=jT.get(e)-1,o=a.get(e)-1;jT.set(e,t),a.set(e,o),t||(CT.has(e)||e.removeAttribute(r),CT.delete(e)),o||e.removeAttribute(n)}),--PT||(jT=new WeakMap,jT=new WeakMap,CT=new WeakMap,ET={})}},TT=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),NT(r,o,n,"aria-hidden")):function(){return null}},RT=function(){return RT=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},RT.apply(this,arguments)};function MT(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var LT="right-scroll-bar-position",OT="width-before-scroll-bar";function AT(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var DT="undefined"!=typeof window?W.useLayoutEffect:W.useEffect,IT=new WeakMap;function FT(e,t){var n,r,o,a=(n=null,r=function(t){return e.forEach(function(e){return AT(e,t)})},(o=W.useState(function(){return{value:n,callback:r,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}})[0]).callback=r,o.facade);return DT(function(){var t=IT.get(a);if(t){var n=new Set(t),r=new Set(e),o=a.current;n.forEach(function(e){r.has(e)||AT(e,null)}),r.forEach(function(e){n.has(e)||AT(e,o)})}IT.set(a,e)},[e]),a}function $T(e){return e}var zT=function(e){var t=e.sideCar,n=MT(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return W.createElement(r,RT({},n))};zT.isSideCarExport=!0;var VT=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=$T);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var o=t(e,r);return n.push(o),function(){n=n.filter(function(e){return e!==o})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var o=n;n=[],o.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},s=function(){return Promise.resolve().then(a)};s(),n={push:function(e){t.push(e),s()},filter:function(e){return t=t.filter(e),n}}}}}(null);return t.options=RT({async:!0,ssr:!1},e),t}(),UT=function(){},BT=W.forwardRef(function(e,t){var n=W.useRef(null),r=W.useState({onScrollCapture:UT,onWheelCapture:UT,onTouchMoveCapture:UT}),o=r[0],a=r[1],s=e.forwardProps,i=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,p=e.sideCar,f=e.noRelative,h=e.noIsolation,m=e.inert,g=e.allowPinchZoom,v=e.as,y=void 0===v?"div":v,b=e.gapMode,x=MT(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),w=p,k=FT([n,t]),S=RT(RT({},x),o);return W.createElement(W.Fragment,null,u&&W.createElement(w,{sideCar:VT,removeScrollBar:c,shards:d,noRelative:f,noIsolation:h,inert:m,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:b}),s?W.cloneElement(W.Children.only(i),RT(RT({},S),{ref:k})):W.createElement(y,RT({},S,{className:l,ref:k}),i))});BT.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},BT.classNames={fullWidth:OT,zeroRight:LT};function WT(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var HT=function(){var e=0,t=null;return{add:function(n){var r,o;0==e&&(t=WT())&&(o=n,(r=t).styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},qT=function(){var e,t=(e=HT(),function(t,n){W.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])});return function(e){var n=e.styles,r=e.dynamic;return t(n,r),null}},GT={left:0,top:0,right:0,gap:0},KT=function(e){return parseInt(e||"",10)||0},YT=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return GT;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[KT(n),KT(r),KT(o)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},XT=qT(),QT="data-scroll-locked",JT=function(e,t,n,r){var o=e.left,a=e.top,s=e.right,i=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(i,"px ").concat(r,";\n }\n body[").concat(QT,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(o,"px;\n padding-top: ").concat(a,"px;\n padding-right: ").concat(s,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(i,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(i,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(LT," {\n right: ").concat(i,"px ").concat(r,";\n }\n \n .").concat(OT," {\n margin-right: ").concat(i,"px ").concat(r,";\n }\n \n .").concat(LT," .").concat(LT," {\n right: 0 ").concat(r,";\n }\n \n .").concat(OT," .").concat(OT," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(QT,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(i,"px;\n }\n")},ZT=function(){var e=parseInt(document.body.getAttribute(QT)||"0",10);return isFinite(e)?e:0},eR=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=void 0===r?"margin":r;W.useEffect(function(){return document.body.setAttribute(QT,(ZT()+1).toString()),function(){var e=ZT()-1;e<=0?document.body.removeAttribute(QT):document.body.setAttribute(QT,e.toString())}},[]);var a=W.useMemo(function(){return YT(o)},[o]);return W.createElement(XT,{styles:JT(a,!t,o,n?"":"!important")})},tR=!1;if("undefined"!=typeof window)try{var nR=Object.defineProperty({},"passive",{get:function(){return tR=!0,!0}});window.addEventListener("test",nR,nR),window.removeEventListener("test",nR,nR)}catch(RO){tR=!1}var rR=!!tR&&{passive:!1},oR=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},aR=function(e,t){var n=t.ownerDocument,r=t;do{if("undefined"!=typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),sR(e,r)){var o=iR(e,r);if(o[1]>o[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},sR=function(e,t){return"v"===e?function(e){return oR(e,"overflowY")}(t):function(e){return oR(e,"overflowX")}(t)},iR=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},lR=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},cR=function(e){return[e.deltaX,e.deltaY]},uR=function(e){return e&&"current"in e?e.current:e},dR=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},pR=0,fR=[];function hR(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const mR=(gR=function(e){var t=W.useRef([]),n=W.useRef([0,0]),r=W.useRef(),o=W.useState(pR++)[0],a=W.useState(qT)[0],s=W.useRef(e);W.useEffect(function(){s.current=e},[e]),W.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(uR),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var i=W.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var o,a=lR(e),i=n.current,l="deltaX"in e?e.deltaX:i[0]-a[0],c="deltaY"in e?e.deltaY:i[1]-a[1],u=e.target,d=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===d&&"range"===u.type)return!1;var p=window.getSelection(),f=p&&p.anchorNode;if(f&&(f===u||f.contains(u)))return!1;var h=aR(d,u);if(!h)return!0;if(h?o=d:(o="v"===d?"h":"v",h=aR(d,u)),!h)return!1;if(!r.current&&"changedTouches"in e&&(l||c)&&(r.current=o),!o)return!0;var m=r.current||o;return function(e,t,n,r){var o=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),a=o*r,s=n.target,i=t.contains(s),l=!1,c=a>0,u=0,d=0;do{if(!s)break;var p=iR(e,s),f=p[0],h=p[1]-p[2]-o*f;(f||h)&&sR(e,s)&&(u+=h,d+=f);var m=s.parentNode;s=m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE?m.host:m}while(!i&&s!==document.body||i&&(t.contains(s)||t===s));return(c&&Math.abs(u)<1||!c&&Math.abs(d)<1)&&(l=!0),l}(m,t,e,"h"===m?l:c)},[]),l=W.useCallback(function(e){var n=e;if(fR.length&&fR[fR.length-1]===a){var r="deltaY"in n?cR(n):lR(n),o=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&(t=e.delta,o=r,t[0]===o[0]&&t[1]===o[1]);var t,o})[0];if(o&&o.should)n.cancelable&&n.preventDefault();else if(!o){var l=(s.current.shards||[]).map(uR).filter(Boolean).filter(function(e){return e.contains(n.target)});(l.length>0?i(n,l[0]):!s.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),c=W.useCallback(function(e,n,r,o){var a={name:e,delta:n,target:r,should:o,shadowParent:hR(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=W.useCallback(function(e){n.current=lR(e),r.current=void 0},[]),d=W.useCallback(function(t){c(t.type,cR(t),t.target,i(t,e.lockRef.current))},[]),p=W.useCallback(function(t){c(t.type,lR(t),t.target,i(t,e.lockRef.current))},[]);W.useEffect(function(){return fR.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",l,rR),document.addEventListener("touchmove",l,rR),document.addEventListener("touchstart",u,rR),function(){fR=fR.filter(function(e){return e!==a}),document.removeEventListener("wheel",l,rR),document.removeEventListener("touchmove",l,rR),document.removeEventListener("touchstart",u,rR)}},[]);var f=e.removeScrollBar,h=e.inert;return W.createElement(W.Fragment,null,h?W.createElement(a,{styles:dR(o)}):null,f?W.createElement(eR,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},VT.useMedium(gR),zT);var gR,vR=W.forwardRef(function(e,t){return W.createElement(BT,RT({},e,{ref:t,sideCar:mR}))});vR.classNames=BT.classNames;var yR="Popover",[bR]=_P(yR,[YN]),xR=YN(),[wR,kR]=bR(yR),SR=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:s=!1}=e,i=xR(t),l=W.useRef(null),[c,u]=W.useState(!1),[d,p]=ST({prop:r,defaultProp:o??!1,onChange:a,caller:yR});return ee.jsx(dT,{...i,children:ee.jsx(wR,{scope:t,contentId:i_(),triggerRef:l,open:d,onOpenChange:p,onOpenToggle:W.useCallback(()=>p(e=>!e),[p]),hasCustomAnchor:c,onCustomAnchorAdd:W.useCallback(()=>u(!0),[]),onCustomAnchorRemove:W.useCallback(()=>u(!1),[]),modal:s,children:n})})};SR.displayName=yR;var jR="PopoverAnchor";W.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=kR(jR,n),a=xR(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:i}=o;return W.useEffect(()=>(s(),()=>i()),[s,i]),ee.jsx(pT,{...a,...r,ref:t})}).displayName=jR;var CR="PopoverTrigger",ER=W.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=kR(CR,n),a=xR(n),s=aj(t,o.triggerRef),i=ee.jsx(OP.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":FR(o.open),...r,ref:s,onClick:PP(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?i:ee.jsx(pT,{asChild:!0,...a,children:i})});ER.displayName=CR;var PR="PopoverPortal",[_R,NR]=bR(PR,{forceMount:void 0}),TR=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,a=kR(PR,t);return ee.jsx(_R,{scope:t,forceMount:n,children:ee.jsx(gT,{present:n||a.open,children:ee.jsx(mT,{asChild:!0,container:o,children:r})})})};TR.displayName=PR;var RR="PopoverContent",MR=W.forwardRef((e,t)=>{const n=NR(RR,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,a=kR(RR,e.__scopePopover);return ee.jsx(gT,{present:r||a.open,children:a.modal?ee.jsx(OR,{...o,ref:t}):ee.jsx(AR,{...o,ref:t})})});MR.displayName=RR;var LR=yT("PopoverContent.RemoveScroll"),OR=W.forwardRef((e,t)=>{const n=kR(RR,e.__scopePopover),r=W.useRef(null),o=aj(t,r),a=W.useRef(!1);return W.useEffect(()=>{const e=r.current;if(e)return TT(e)},[]),ee.jsx(vR,{as:LR,allowPinchZoom:!0,children:ee.jsx(DR,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:PP(e.onCloseAutoFocus,e=>{var t;e.preventDefault(),a.current||null==(t=n.triggerRef.current)||t.focus()}),onPointerDownOutside:PP(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,r=2===t.button||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:PP(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),AR=W.forwardRef((e,t)=>{const n=kR(RR,e.__scopePopover),r=W.useRef(!1),o=W.useRef(!1);return ee.jsx(DR,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var a,s;null==(a=e.onCloseAutoFocus)||a.call(e,t),t.defaultPrevented||(r.current||null==(s=n.triggerRef.current)||s.focus(),t.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:t=>{var a,s;null==(a=e.onInteractOutside)||a.call(e,t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(o.current=!0));const i=t.target;(null==(s=n.triggerRef.current)?void 0:s.contains(i))&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&o.current&&t.preventDefault()}})}),DR=W.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=e,p=kR(RR,n),f=xR(n);return qP(),ee.jsx(QP,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:ee.jsx(UP,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>p.onOpenChange(!1),children:ee.jsx(fT,{"data-state":FR(p.open),role:"dialog",id:p.contentId,...f,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),IR="PopoverClose";W.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=kR(IR,n);return ee.jsx(OP.button,{type:"button",...r,ref:t,onClick:PP(e.onClick,()=>o.onOpenChange(!1))})}).displayName=IR;function FR(e){return e?"open":"closed"}W.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=xR(n);return ee.jsx(hT,{...o,...r,ref:t})}).displayName="PopoverArrow";var $R=TR,zR=MR;const VR=SR,UR=ER,BR=W.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>ee.jsx($R,{children:ee.jsx(zR,{ref:o,align:t,sideOffset:n,className:XS("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));function WR({className:e,...t}){return ee.jsx("div",{className:XS("animate-pulse rounded-md bg-muted",e),...t})}BR.displayName=zR.displayName;const HR=gj("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function qR({className:e,variant:t,...n}){return ee.jsx("div",{className:XS(HR({variant:t}),e),...n})}function GR(e){const t=KR(e),n=W.forwardRef((e,n)=>{const{children:r,...o}=e,a=W.Children.toArray(r),s=a.find(XR);if(s){const e=s.props.children,r=a.map(t=>t===s?W.Children.count(e)>1?W.Children.only(null):W.isValidElement(e)?e.props.children:null:t);return ee.jsx(t,{...o,ref:n,children:W.isValidElement(e)?W.cloneElement(e,void 0,r):null})}return ee.jsx(t,{...o,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function KR(e){const t=W.forwardRef((e,t)=>{const{children:n,...r}=e;if(W.isValidElement(n)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{const t=a(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==W.Fragment&&(o.ref=t?oj(t,e):e),W.cloneElement(n,o)}return W.Children.count(n)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var YR=Symbol("radix.slottable");function XR(e){return W.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===YR}var QR="Dialog",[JR]=_P(QR),[ZR,eM]=JR(QR),tM=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:s=!0}=e,i=W.useRef(null),l=W.useRef(null),[c,u]=ST({prop:r,defaultProp:o??!1,onChange:a,caller:QR});return ee.jsx(ZR,{scope:t,triggerRef:i,contentRef:l,contentId:i_(),titleId:i_(),descriptionId:i_(),open:c,onOpenChange:u,onOpenToggle:W.useCallback(()=>u(e=>!e),[u]),modal:s,children:n})};tM.displayName=QR;var nM="DialogTrigger";W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=eM(nM,n),a=aj(t,o.triggerRef);return ee.jsx(OP.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":kM(o.open),...r,ref:a,onClick:PP(e.onClick,o.onOpenToggle)})}).displayName=nM;var rM="DialogPortal",[oM,aM]=JR(rM,{forceMount:void 0}),sM=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=eM(rM,t);return ee.jsx(oM,{scope:t,forceMount:n,children:W.Children.map(r,e=>ee.jsx(gT,{present:n||a.open,children:ee.jsx(mT,{asChild:!0,container:o,children:e})}))})};sM.displayName=rM;var iM="DialogOverlay",lM=W.forwardRef((e,t)=>{const n=aM(iM,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=eM(iM,e.__scopeDialog);return a.modal?ee.jsx(gT,{present:r||a.open,children:ee.jsx(uM,{...o,ref:t})}):null});lM.displayName=iM;var cM=GR("DialogOverlay.RemoveScroll"),uM=W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=eM(iM,n);return ee.jsx(vR,{as:cM,allowPinchZoom:!0,shards:[o.contentRef],children:ee.jsx(OP.div,{"data-state":kM(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),dM="DialogContent",pM=W.forwardRef((e,t)=>{const n=aM(dM,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=eM(dM,e.__scopeDialog);return ee.jsx(gT,{present:r||a.open,children:a.modal?ee.jsx(fM,{...o,ref:t}):ee.jsx(hM,{...o,ref:t})})});pM.displayName=dM;var fM=W.forwardRef((e,t)=>{const n=eM(dM,e.__scopeDialog),r=W.useRef(null),o=aj(t,n.contentRef,r);return W.useEffect(()=>{const e=r.current;if(e)return TT(e)},[]),ee.jsx(mM,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:PP(e.onCloseAutoFocus,e=>{var t;e.preventDefault(),null==(t=n.triggerRef.current)||t.focus()}),onPointerDownOutside:PP(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:PP(e.onFocusOutside,e=>e.preventDefault())})}),hM=W.forwardRef((e,t)=>{const n=eM(dM,e.__scopeDialog),r=W.useRef(!1),o=W.useRef(!1);return ee.jsx(mM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var a,s;null==(a=e.onCloseAutoFocus)||a.call(e,t),t.defaultPrevented||(r.current||null==(s=n.triggerRef.current)||s.focus(),t.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:t=>{var a,s;null==(a=e.onInteractOutside)||a.call(e,t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(o.current=!0));const i=t.target;(null==(s=n.triggerRef.current)?void 0:s.contains(i))&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&o.current&&t.preventDefault()}})}),mM=W.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...s}=e,i=eM(dM,n),l=W.useRef(null),c=aj(t,l);return qP(),ee.jsxs(ee.Fragment,{children:[ee.jsx(QP,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:ee.jsx(UP,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":kM(i.open),...s,ref:c,onDismiss:()=>i.onOpenChange(!1)})}),ee.jsxs(ee.Fragment,{children:[ee.jsx(EM,{titleId:i.titleId}),ee.jsx(PM,{contentRef:l,descriptionId:i.descriptionId})]})]})}),gM="DialogTitle",vM=W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=eM(gM,n);return ee.jsx(OP.h2,{id:o.titleId,...r,ref:t})});vM.displayName=gM;var yM="DialogDescription",bM=W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=eM(yM,n);return ee.jsx(OP.p,{id:o.descriptionId,...r,ref:t})});bM.displayName=yM;var xM="DialogClose",wM=W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=eM(xM,n);return ee.jsx(OP.button,{type:"button",...r,ref:t,onClick:PP(e.onClick,()=>o.onOpenChange(!1))})});function kM(e){return e?"open":"closed"}wM.displayName=xM;var SM="DialogTitleWarning",[jM,CM]=function(e,t){const n=W.createContext(t),r=e=>{const{children:t,...r}=e,o=W.useMemo(()=>r,Object.values(r));return ee.jsx(n.Provider,{value:o,children:t})};return r.displayName=e+"Provider",[r,function(r){const o=W.useContext(n);if(o)return o;if(void 0!==t)return t;throw new Error(`\`${r}\` must be used within \`${e}\``)}]}(SM,{contentName:dM,titleName:gM,docsSlug:"dialog"}),EM=({titleId:e})=>{const t=CM(SM),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return W.useEffect(()=>{if(e){document.getElementById(e)||console.error(n)}},[n,e]),null},PM=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${CM("DialogDescriptionWarning").contentName}}.`;return W.useEffect(()=>{var r;const o=null==(r=e.current)?void 0:r.getAttribute("aria-describedby");if(t&&o){document.getElementById(t)||console.warn(n)}},[n,e,t]),null},_M=lM,NM=pM,TM=vM,RM=bM,MM=wM;const LM=tM,OM=sM,AM=W.forwardRef(({className:e,...t},n)=>ee.jsx(_M,{ref:n,className:XS("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));AM.displayName=_M.displayName;const DM=W.forwardRef(({className:e,children:t,noOverlay:n,...r},o)=>ee.jsxs(OM,{children:[!n&&ee.jsx(AM,{}),ee.jsxs(NM,{ref:o,className:XS("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-xl",e),...r,children:[t,ee.jsxs(MM,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[ee.jsx(CP,{className:"h-4 w-4"}),ee.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));DM.displayName=NM.displayName;const IM=({className:e,...t})=>ee.jsx("div",{className:XS("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});IM.displayName="DialogHeader";const FM=({className:e,...t})=>ee.jsx("div",{className:XS("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});FM.displayName="DialogFooter";const $M=W.forwardRef(({className:e,...t},n)=>ee.jsx(TM,{ref:n,className:XS("text-lg font-semibold leading-none tracking-tight",e),...t}));$M.displayName=TM.displayName;const zM=W.forwardRef(({className:e,...t},n)=>ee.jsx(RM,{ref:n,className:XS("text-sm text-muted-foreground",e),...t}));function VM({project:e,open:t,onOpenChange:n,onUpdated:r}){const[o,a]=W.useState([]),[s,i]=W.useState([]),[l,c]=W.useState(!1),[u,d]=W.useState(null);W.useEffect(()=>{if(!t)return;a(e.shares?[...e.shares]:[]),d(null);let n=!1;return Gj().then(e=>{n||i(e)}).catch(()=>{}),()=>{n=!0}},[t,e.id]);const p=new Set(o.map(e=>e.username)),f=s.filter(t=>t!==e.owner&&!p.has(t));return ee.jsx(LM,{open:t,onOpenChange:n,children:ee.jsxs(DM,{className:"sm:max-w-md",children:[ee.jsxs(IM,{children:[ee.jsxs($M,{className:"flex items-center gap-2",children:[ee.jsx(jP,{className:"h-4 w-4"}),"共享设置"]}),ee.jsx(zM,{children:"选择用户并设置权限:可见(只读)或可编辑(读写+终端)"})]}),ee.jsxs("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:[0===o.length&&ee.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"尚未共享给任何用户"}),o.map(e=>ee.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[ee.jsx("span",{className:"text-sm font-medium",children:e.username}),ee.jsxs("div",{className:"flex items-center gap-1.5",children:[ee.jsx("button",{onClick:()=>{return t=e.username,void a(e=>e.map(e=>e.username===t?{...e,permission:"view"===e.permission?"edit":"view"}:e));var t},className:"focus:outline-none",children:ee.jsx(qR,{variant:"edit"===e.permission?"default":"secondary",className:"cursor-pointer text-xs",children:"edit"===e.permission?"可编辑":"可见"})}),ee.jsx(yj,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>{return t=e.username,void a(e=>e.filter(e=>e.username!==t));var t},children:ee.jsx(SP,{className:"h-3.5 w-3.5"})})]})]},e.username))]}),f.length>0&&ee.jsxs("div",{className:"border-t pt-3",children:[ee.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"添加用户"}),ee.jsx("div",{className:"flex flex-wrap gap-1.5",children:f.map(e=>ee.jsxs(yj,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>{return t=e,void a(e=>[...e,{username:t,permission:"view"}]);var t},children:[ee.jsx(fP,{className:"h-3 w-3"}),e]},e))})]}),u&&ee.jsx("p",{className:"text-sm text-destructive",children:u}),ee.jsxs(FM,{children:[ee.jsx(yj,{variant:"outline",onClick:()=>n(!1),disabled:l,children:"取消"}),ee.jsx(yj,{onClick:()=>{(async()=>{c(!0),d(null);try{const t=await Kj(e.id,o);r(t),n(!1)}catch(RO){d(RO instanceof Error?RO.message:"Failed to update shares")}finally{c(!1)}})()},disabled:l,children:l?"保存中...":"保存"})]})]})})}zM.displayName=RM.displayName;function UM({status:e,onClick:t,title:n,className:r}){const o=W.useId(),a=!!(null==e?void 0:e.hasPath),s=!0===(null==e?void 0:e.dirty),i=!!(null==e?void 0:e.syncing);let l="text-muted-foreground",c="none",u=!1;return a?s?(l="text-amber-500",c=`url(#${o})`):(l="text-muted-foreground",c="currentColor"):(u=!0,l="text-muted-foreground/60"),ee.jsx("button",{type:"button",onClick:t,title:n,"aria-label":n,className:XS("inline-flex h-7 w-7 items-center justify-center rounded-md transition-colors hover:bg-accent",l,i&&"animate-pulse",r),children:ee.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s&&ee.jsx("defs",{children:ee.jsxs("linearGradient",{id:o,x1:"0",y1:"0",x2:"0",y2:"1",children:[ee.jsx("stop",{offset:"0",stopColor:"currentColor",stopOpacity:"0"}),ee.jsx("stop",{offset:"0.5",stopColor:"currentColor",stopOpacity:"0"}),ee.jsx("stop",{offset:"0.5",stopColor:"currentColor",stopOpacity:"0.9"}),ee.jsx("stop",{offset:"1",stopColor:"currentColor",stopOpacity:"0.9"})]})}),ee.jsx("path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",fill:c,strokeDasharray:u?"3 2.5":void 0})]})})}const BM=Array(12).fill(0),WM=({visible:e,className:t})=>H.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},H.createElement("div",{className:"sonner-spinner"},BM.map((e,t)=>H.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${t}`})))),HM=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},H.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),qM=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},H.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),GM=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},H.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),KM=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},H.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),YM=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},H.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),H.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}));let XM=1;const QM=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;const{message:n,...r}=e,o="number"==typeof(null==e?void 0:e.id)||(null==(t=e.id)?void 0:t.length)>0?e.id:XM++,a=this.toasts.find(e=>e.id===o),s=void 0===e.dismissible||e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),a?this.toasts=this.toasts.map(t=>t.id===o?(this.publish({...t,...e,id:o,title:n}),{...t,...e,id:o,dismissible:s,title:n}):t):this.addToast({title:n,...r,dismissible:s,id:o}),o},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;void 0!==t.loading&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:"function"!=typeof t.description?t.description:void 0}));const r=Promise.resolve(e instanceof Function?e():e);let o,a=void 0!==n;const s=r.then(async e=>{o=["resolve",e];if(H.isValidElement(e))a=!1,this.create({id:n,type:"default",message:e});else if(JM(e)&&!e.ok){a=!1;const r="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,o="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description,s="object"==typeof r&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:"error",description:o,...s})}else if(e instanceof Error){a=!1;const r="function"==typeof t.error?await t.error(e):t.error,o="function"==typeof t.description?await t.description(e):t.description,s="object"==typeof r&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:"error",description:o,...s})}else if(void 0!==t.success){a=!1;const r="function"==typeof t.success?await t.success(e):t.success,o="function"==typeof t.description?await t.description(e):t.description,s="object"==typeof r&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:"success",description:o,...s})}}).catch(async e=>{if(o=["reject",e],void 0!==t.error){a=!1;const r="function"==typeof t.error?await t.error(e):t.error,o="function"==typeof t.description?await t.description(e):t.description,s="object"==typeof r&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:"error",description:o,...s})}}).finally(()=>{a&&(this.dismiss(n),n=void 0),null==t.finally||t.finally.call(t)}),i=()=>new Promise((e,t)=>s.then(()=>"reject"===o[0]?t(o[1]):e(o[1])).catch(t));return"string"!=typeof n&&"number"!=typeof n?{unwrap:i}:Object.assign(n,{unwrap:i})},this.custom=(e,t)=>{const n=(null==t?void 0:t.id)||XM++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},JM=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,ZM=(e,t)=>{const n=(null==t?void 0:t.id)||XM++;return QM.addToast({title:e,...t,id:n}),n},eL=Object.assign(ZM,{success:QM.success,info:QM.info,warning:QM.warning,error:QM.error,custom:QM.custom,message:QM.message,promise:QM.promise,dismiss:QM.dismiss,loading:QM.loading},{getHistory:()=>QM.toasts,getToasts:()=>QM.getActiveToasts()});function tL(e){return void 0!==e.label}!function(e){if("undefined"==typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");const nL=3,rL=14;function oL(...e){return e.filter(Boolean).join(" ")}const aL=e=>{var t,n,r,o,a,s,i,l,c;const{invert:u,toast:d,unstyled:p,interacting:f,setHeights:h,visibleToasts:m,heights:g,index:v,toasts:y,expanded:b,removeToast:x,defaultRichColors:w,closeButton:k,style:S,cancelButtonStyle:j,actionButtonStyle:C,className:E="",descriptionClassName:P="",duration:_,position:N,gap:T,expandByDefault:R,classNames:M,icons:L,closeButtonAriaLabel:O="Close toast"}=e,[A,D]=H.useState(null),[I,F]=H.useState(null),[$,z]=H.useState(!1),[V,U]=H.useState(!1),[B,W]=H.useState(!1),[q,G]=H.useState(!1),[K,Y]=H.useState(!1),[X,Q]=H.useState(0),[J,Z]=H.useState(0),ee=H.useRef(d.duration||_||4e3),te=H.useRef(null),ne=H.useRef(null),re=0===v,oe=v+1<=m,ae=d.type,se=!1!==d.dismissible,ie=d.className||"",le=d.descriptionClassName||"",ce=H.useMemo(()=>g.findIndex(e=>e.toastId===d.id)||0,[g,d.id]),ue=H.useMemo(()=>{var e;return null!=(e=d.closeButton)?e:k},[d.closeButton,k]),de=H.useMemo(()=>d.duration||_||4e3,[d.duration,_]),pe=H.useRef(0),fe=H.useRef(0),he=H.useRef(0),me=H.useRef(null),[ge,ve]=N.split("-"),ye=H.useMemo(()=>g.reduce((e,t,n)=>n>=ce?e:e+t.height,0),[g,ce]),be=(()=>{const[e,t]=H.useState(document.hidden);return H.useEffect(()=>{const e=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",e),()=>window.removeEventListener("visibilitychange",e)},[]),e})(),xe=d.invert||u,we="loading"===ae;fe.current=H.useMemo(()=>ce*T+ye,[ce,ye]),H.useEffect(()=>{ee.current=de},[de]),H.useEffect(()=>{z(!0)},[]),H.useEffect(()=>{const e=ne.current;if(e){const t=e.getBoundingClientRect().height;return Z(t),h(e=>[{toastId:d.id,height:t,position:d.position},...e]),()=>h(e=>e.filter(e=>e.toastId!==d.id))}},[h,d.id]),H.useLayoutEffect(()=>{if(!$)return;const e=ne.current,t=e.style.height;e.style.height="auto";const n=e.getBoundingClientRect().height;e.style.height=t,Z(n),h(e=>e.find(e=>e.toastId===d.id)?e.map(e=>e.toastId===d.id?{...e,height:n}:e):[{toastId:d.id,height:n,position:d.position},...e])},[$,d.title,d.description,h,d.id,d.jsx,d.action,d.cancel]);const ke=H.useCallback(()=>{U(!0),Q(fe.current),h(e=>e.filter(e=>e.toastId!==d.id)),setTimeout(()=>{x(d)},200)},[d,x,h,fe]);H.useEffect(()=>{if(d.promise&&"loading"===ae||d.duration===1/0||"loading"===d.type)return;let e;return b||f||be?(()=>{if(he.current<pe.current){const e=(new Date).getTime()-pe.current;ee.current=ee.current-e}he.current=(new Date).getTime()})():ee.current!==1/0&&(pe.current=(new Date).getTime(),e=setTimeout(()=>{null==d.onAutoClose||d.onAutoClose.call(d,d),ke()},ee.current)),()=>clearTimeout(e)},[b,f,d,ae,be,ke]),H.useEffect(()=>{d.delete&&(ke(),null==d.onDismiss||d.onDismiss.call(d,d))},[ke,d.delete]);const Se=d.icon||(null==L?void 0:L[ae])||(e=>{switch(e){case"success":return HM;case"info":return GM;case"warning":return qM;case"error":return KM;default:return null}})(ae);var je,Ce,Ee,Pe;return H.createElement("li",{tabIndex:0,ref:ne,className:oL(E,ie,null==M?void 0:M.toast,null==d||null==(t=d.classNames)?void 0:t.toast,null==M?void 0:M.default,null==M?void 0:M[ae],null==d||null==(n=d.classNames)?void 0:n[ae]),"data-sonner-toast":"","data-rich-colors":null!=(je=d.richColors)?je:w,"data-styled":!Boolean(d.jsx||d.unstyled||p),"data-mounted":$,"data-promise":Boolean(d.promise),"data-swiped":K,"data-removed":V,"data-visible":oe,"data-y-position":ge,"data-x-position":ve,"data-index":v,"data-front":re,"data-swiping":B,"data-dismissible":se,"data-type":ae,"data-invert":xe,"data-swipe-out":q,"data-swipe-direction":I,"data-expanded":Boolean(b||R&&$),"data-testid":d.testId,style:{"--index":v,"--toasts-before":v,"--z-index":y.length-v,"--offset":`${V?X:fe.current}px`,"--initial-height":R?"auto":`${J}px`,...S,...d.style},onDragEnd:()=>{W(!1),D(null),me.current=null},onPointerDown:e=>{2!==e.button&&!we&&se&&(te.current=new Date,Q(fe.current),e.target.setPointerCapture(e.pointerId),"BUTTON"!==e.target.tagName&&(W(!0),me.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e,t,n;if(q||!se)return;me.current=null;const r=Number((null==(e=ne.current)?void 0:e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),o=Number((null==(t=ne.current)?void 0:t.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),a=(new Date).getTime()-(null==(n=te.current)?void 0:n.getTime()),s="x"===A?r:o,i=Math.abs(s)/a;if(Math.abs(s)>=45||i>.11)return Q(fe.current),null==d.onDismiss||d.onDismiss.call(d,d),F("x"===A?r>0?"right":"left":o>0?"down":"up"),ke(),void G(!0);var l,c;null==(l=ne.current)||l.style.setProperty("--swipe-amount-x","0px"),null==(c=ne.current)||c.style.setProperty("--swipe-amount-y","0px"),Y(!1),W(!1),D(null)},onPointerMove:t=>{var n,r,o;if(!me.current||!se)return;if((null==(n=window.getSelection())?void 0:n.toString().length)>0)return;const a=t.clientY-me.current.y,s=t.clientX-me.current.x;var i;const l=null!=(i=e.swipeDirections)?i:function(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}(N);!A&&(Math.abs(s)>1||Math.abs(a)>1)&&D(Math.abs(s)>Math.abs(a)?"x":"y");let c={x:0,y:0};const u=e=>1/(1.5+Math.abs(e)/20);if("y"===A){if(l.includes("top")||l.includes("bottom"))if(l.includes("top")&&a<0||l.includes("bottom")&&a>0)c.y=a;else{const e=a*u(a);c.y=Math.abs(e)<Math.abs(a)?e:a}}else if("x"===A&&(l.includes("left")||l.includes("right")))if(l.includes("left")&&s<0||l.includes("right")&&s>0)c.x=s;else{const e=s*u(s);c.x=Math.abs(e)<Math.abs(s)?e:s}(Math.abs(c.x)>0||Math.abs(c.y)>0)&&Y(!0),null==(r=ne.current)||r.style.setProperty("--swipe-amount-x",`${c.x}px`),null==(o=ne.current)||o.style.setProperty("--swipe-amount-y",`${c.y}px`)}},ue&&!d.jsx&&"loading"!==ae?H.createElement("button",{"aria-label":O,"data-disabled":we,"data-close-button":!0,onClick:we||!se?()=>{}:()=>{ke(),null==d.onDismiss||d.onDismiss.call(d,d)},className:oL(null==M?void 0:M.closeButton,null==d||null==(r=d.classNames)?void 0:r.closeButton)},null!=(Ce=null==L?void 0:L.close)?Ce:YM):null,(ae||d.icon||d.promise)&&null!==d.icon&&(null!==(null==L?void 0:L[ae])||d.icon)?H.createElement("div",{"data-icon":"",className:oL(null==M?void 0:M.icon,null==d||null==(o=d.classNames)?void 0:o.icon)},d.promise||"loading"===d.type&&!d.icon?d.icon||((null==L?void 0:L.loading)?H.createElement("div",{className:oL(null==M?void 0:M.loader,null==d||null==(Pe=d.classNames)?void 0:Pe.loader,"sonner-loader"),"data-visible":"loading"===ae},L.loading):H.createElement(WM,{className:oL(null==M?void 0:M.loader,null==d||null==(Ee=d.classNames)?void 0:Ee.loader),visible:"loading"===ae})):null,"loading"!==d.type?Se:null):null,H.createElement("div",{"data-content":"",className:oL(null==M?void 0:M.content,null==d||null==(a=d.classNames)?void 0:a.content)},H.createElement("div",{"data-title":"",className:oL(null==M?void 0:M.title,null==d||null==(s=d.classNames)?void 0:s.title)},d.jsx?d.jsx:"function"==typeof d.title?d.title():d.title),d.description?H.createElement("div",{"data-description":"",className:oL(P,le,null==M?void 0:M.description,null==d||null==(i=d.classNames)?void 0:i.description)},"function"==typeof d.description?d.description():d.description):null),H.isValidElement(d.cancel)?d.cancel:d.cancel&&tL(d.cancel)?H.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||j,onClick:e=>{tL(d.cancel)&&se&&(null==d.cancel.onClick||d.cancel.onClick.call(d.cancel,e),ke())},className:oL(null==M?void 0:M.cancelButton,null==d||null==(l=d.classNames)?void 0:l.cancelButton)},d.cancel.label):null,H.isValidElement(d.action)?d.action:d.action&&tL(d.action)?H.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||C,onClick:e=>{tL(d.action)&&(null==d.action.onClick||d.action.onClick.call(d.action,e),e.defaultPrevented||ke())},className:oL(null==M?void 0:M.actionButton,null==d||null==(c=d.classNames)?void 0:c.actionButton)},d.action.label):null)};function sL(){if("undefined"==typeof window)return"ltr";if("undefined"==typeof document)return"ltr";const e=document.documentElement.getAttribute("dir");return"auto"!==e&&e?e:window.getComputedStyle(document.documentElement).direction}function iL(e,t){const n={};return[e,t].forEach((e,t)=>{const r=1===t,o=r?"--mobile-offset":"--offset",a=r?"16px":"24px";function s(e){["top","right","bottom","left"].forEach(t=>{n[`${o}-${t}`]="number"==typeof e?`${e}px`:e})}"number"==typeof e||"string"==typeof e?s(e):"object"==typeof e?["top","right","bottom","left"].forEach(t=>{void 0===e[t]?n[`${o}-${t}`]=a:n[`${o}-${t}`]="number"==typeof e[t]?`${e[t]}px`:e[t]}):s(a)}),n}const lL=H.forwardRef(function(e,t){const{id:n,invert:r,position:o="bottom-right",hotkey:a=["altKey","KeyT"],expand:s,closeButton:i,className:l,offset:c,mobileOffset:u,theme:d="light",richColors:p,duration:f,style:h,visibleToasts:m=nL,toastOptions:g,dir:v=sL(),gap:y=rL,icons:b,containerAriaLabel:x="Notifications"}=e,[w,k]=H.useState([]),S=H.useMemo(()=>n?w.filter(e=>e.toasterId===n):w.filter(e=>!e.toasterId),[w,n]),j=H.useMemo(()=>Array.from(new Set([o].concat(S.filter(e=>e.position).map(e=>e.position)))),[S,o]),[C,E]=H.useState([]),[P,_]=H.useState(!1),[N,T]=H.useState(!1),[R,M]=H.useState("system"!==d?d:"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),L=H.useRef(null),O=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),A=H.useRef(null),D=H.useRef(!1),I=H.useCallback(e=>{k(t=>{var n;return(null==(n=t.find(t=>t.id===e.id))?void 0:n.delete)||QM.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return H.useEffect(()=>QM.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{k(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{cd.flushSync(()=>{k(t=>{const n=t.findIndex(t=>t.id===e.id);return-1!==n?[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]:[e,...t]})})})}),[w]),H.useEffect(()=>{if("system"!==d)return void M(d);if("system"===d&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?M("dark"):M("light")),"undefined"==typeof window)return;const e=window.matchMedia("(prefers-color-scheme: dark)");try{e.addEventListener("change",({matches:e})=>{M(e?"dark":"light")})}catch(t){e.addListener(({matches:e})=>{try{M(e?"dark":"light")}catch(TO){console.error(TO)}})}},[d]),H.useEffect(()=>{w.length<=1&&_(!1)},[w]),H.useEffect(()=>{const e=e=>{var t;var n;a.every(t=>e[t]||e.code===t)&&(_(!0),null==(n=L.current)||n.focus());"Escape"!==e.code||document.activeElement!==L.current&&!(null==(t=L.current)?void 0:t.contains(document.activeElement))||_(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a]),H.useEffect(()=>{if(L.current)return()=>{A.current&&(A.current.focus({preventScroll:!0}),A.current=null,D.current=!1)}},[L.current]),H.createElement("section",{ref:t,"aria-label":`${x} ${O}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},j.map((t,n)=>{var o;const[a,d]=t.split("-");return S.length?H.createElement("ol",{key:t,dir:"auto"===v?sL():v,tabIndex:-1,ref:L,className:l,"data-sonner-toaster":!0,"data-sonner-theme":R,"data-y-position":a,"data-x-position":d,style:{"--front-toast-height":`${(null==(o=C[0])?void 0:o.height)||0}px`,"--width":"356px","--gap":`${y}px`,...h,...iL(c,u)},onBlur:e=>{D.current&&!e.currentTarget.contains(e.relatedTarget)&&(D.current=!1,A.current&&(A.current.focus({preventScroll:!0}),A.current=null))},onFocus:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||D.current||(D.current=!0,A.current=e.relatedTarget)},onMouseEnter:()=>_(!0),onMouseMove:()=>_(!0),onMouseLeave:()=>{N||_(!1)},onDragEnd:()=>_(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||T(!0)},onPointerUp:()=>T(!1)},S.filter(e=>!e.position&&0===n||e.position===t).map((n,o)=>{var a,l;return H.createElement(aL,{key:n.id,icons:b,index:o,toast:n,defaultRichColors:p,duration:null!=(a=null==g?void 0:g.duration)?a:f,className:null==g?void 0:g.className,descriptionClassName:null==g?void 0:g.descriptionClassName,invert:r,visibleToasts:m,closeButton:null!=(l=null==g?void 0:g.closeButton)?l:i,interacting:N,position:t,style:null==g?void 0:g.style,unstyled:null==g?void 0:g.unstyled,classNames:null==g?void 0:g.classNames,cancelButtonStyle:null==g?void 0:g.cancelButtonStyle,actionButtonStyle:null==g?void 0:g.actionButtonStyle,closeButtonAriaLabel:null==g?void 0:g.closeButtonAriaLabel,removeToast:I,toasts:S.filter(e=>e.position==n.position),heights:C.filter(e=>e.position==n.position),setHeights:E,expandByDefault:s,gap:y,expanded:P,swipeDirections:e.swipeDirections})})):null}))}),cL=W.createContext(null);function uL({children:e}){const[t,n]=W.useState(!1),[r,o]=W.useState({}),a=W.useRef(null),s=W.useCallback(e=>(o(e),n(!0),new Promise(e=>{a.current=e})),[]),i=W.useCallback(e=>{n(!1);const t=a.current;a.current=null,t&&t(e)},[]);return ee.jsxs(cL.Provider,{value:s,children:[e,ee.jsx(LM,{open:t,onOpenChange:e=>{e||i(!1)},children:ee.jsxs(DM,{className:"max-w-md",children:[ee.jsxs(IM,{children:[ee.jsx($M,{children:r.title??"确认"}),void 0!==r.description&&ee.jsx(zM,{asChild:!0,children:ee.jsx("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:r.description})})]}),ee.jsxs(FM,{children:[ee.jsx(yj,{variant:"outline",onClick:()=>i(!1),children:r.cancelLabel??"取消"}),ee.jsx(dL,{destructive:r.destructive,onClick:()=>i(!0),children:r.confirmLabel??"确定"})]})]})})]})}function dL({destructive:e,onClick:t,children:n}){const r=W.useRef(null);return W.useEffect(()=>{var e;null==(e=r.current)||e.focus()},[]),ee.jsx(yj,{ref:r,onClick:t,className:XS(e&&"bg-red-600 hover:bg-red-700 text-white"),children:n})}function pL(){const e=W.useContext(cL);if(!e)throw new Error("useConfirm must be used within <ConfirmProvider>");return e}function fL(e,t){switch(e){case"thinking":return"Thinking…";case"tool_use":return t?`${t}`:"Tool…";case"tool_result":return"Reading…";case"text":return"Writing…"}}function hL({status:e}){return ee.jsx("span",{className:XS("inline-block w-2 h-2 rounded-full",{"bg-green-500":"running"===e,"bg-zinc-400":"stopped"===e,"bg-yellow-400 animate-pulse":"restarting"===e})})}const mL=H.memo(function({project:e,active:t=!1,statusStack:n=[],syncStatus:r,onDelete:o,onArchive:a,onUnarchive:s,onUpdated:i}){var l,c;const u=cp(),{t:d}=Xf(),p=pL(),[f,h]=W.useState(!1),[m,g]=W.useState(null),[v,y]=W.useState(!1),[b,x]=W.useState(e.name),w=W.useRef(null),k=!!e._sharedPermission;W.useEffect(()=>{let t=!1;return nE(e.id).then(({bytes:e})=>{t||g(e)}).catch(()=>{}),()=>{t=!0}},[e.id]);const S="view"===e._sharedPermission,j=(null==r?void 0:r.hasPath)?r.syncing?d("projsync.syncing"):r.dirty?d("projsync.dirty"):d("projsync.synced"):d("projsync.not_configured"),C=t=>{t.stopPropagation(),x(e.name),y(!0),setTimeout(()=>{var e;return null==(e=w.current)?void 0:e.select()},0)},E=async()=>{const t=b.trim();if(t&&t!==e.name)try{const n=await eE(e.id,t);null==i||i(n),y(!1)}catch(RO){eL.error("Rename failed",{description:null==RO?void 0:RO.message})}else y(!1)},P=ee.jsx(tS.div,{whileHover:e.archived||t?{}:{y:-2},transition:TE.fast,children:ee.jsxs(QS,{className:XS("group cursor-pointer transition-colors relative",e.archived?"opacity-60 hover:opacity-80 hover:border-muted-foreground/40":t?"border-transparent hover:border-transparent bg-transparent shadow-none":"hover:border-muted-foreground/40"),onClick:()=>!e.archived&&u(`/projects/${e.id}`),children:[ee.jsxs(JS,{className:"pb-2",children:[ee.jsxs("div",{className:"flex items-start justify-between gap-2",children:[v?ee.jsx("input",{ref:w,className:"text-base leading-tight font-semibold bg-transparent border-b border-primary outline-none w-full min-w-0",value:b,onChange:e=>x(e.target.value),onBlur:()=>{E()},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),E()),"Escape"===e.key&&y(!1)},onClick:e=>e.stopPropagation()}):ee.jsx(ZS,{className:XS("text-base leading-tight",e.archived&&"text-muted-foreground"),onDoubleClick:k||e.archived?void 0:C,children:e.name}),ee.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[!k&&!e.archived&&ee.jsx(UM,{status:r,title:j,onClick:t=>{t.stopPropagation(),u(`/projects/${e.id}/settings`)}}),ee.jsx("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:!k&&ee.jsxs(ee.Fragment,{children:[e.archived?ee.jsx(yj,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:t=>{t.stopPropagation(),s(e.id)},title:"Restore project",children:ee.jsx(OE,{className:"h-3.5 w-3.5"})}):ee.jsxs(ee.Fragment,{children:[ee.jsx(yj,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:C,title:"Rename project",children:ee.jsx(pP,{className:"h-3.5 w-3.5"})}),ee.jsx(yj,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:e=>{e.stopPropagation(),h(!0)},title:"共享设置",children:ee.jsx(jP,{className:"h-3.5 w-3.5"})}),ee.jsx(yj,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:t=>{t.stopPropagation(),a(e.id)},title:"Archive project",children:ee.jsx(AE,{className:"h-3.5 w-3.5"})})]}),ee.jsx(yj,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:async t=>{t.stopPropagation();await p({title:"删除项目",description:`确认删除项目 "${e.name}"?此操作不可撤销。`,destructive:!0,confirmLabel:"删除"})&&o(e.id)},title:"Delete project",children:ee.jsx(SP,{className:"h-3.5 w-3.5"})})]})})]})]}),ee.jsx("div",{className:"flex items-center gap-1.5",children:e.archived?ee.jsx(qR,{variant:"secondary",className:"text-xs",children:"Archived"}):ee.jsxs(ee.Fragment,{children:[ee.jsx(hL,{status:e.status}),ee.jsx("span",{className:"text-xs text-muted-foreground capitalize",children:e.status}),t&&n.length>0&&ee.jsx("div",{className:"ml-auto",children:ee.jsx(Iw,{mode:"wait",children:n.slice(-1).map(e=>ee.jsx(tS.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:TE.default,children:ee.jsx(qR,{variant:"outline",className:"text-xs font-normal whitespace-nowrap",children:fL(e.phase,e.detail)})},e.id))})})]})})]}),ee.jsxs(tj,{className:"space-y-2",children:[ee.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[ee.jsx(qE,{className:"h-3.5 w-3.5 flex-shrink-0"}),ee.jsx("span",{className:"truncate font-mono",children:e.folderPath}),null!==m&&ee.jsx("span",{className:"flex-shrink-0 ml-auto text-muted-foreground/70",children:(_=m,_>=1073741824?(_/1073741824).toFixed(1)+" GB":_>=1048576?(_/1048576).toFixed(1)+" MB":Math.round(_/1024)+" KB")})]}),ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(qR,{variant:"outline",className:"text-xs font-mono",children:e.cliTool??"claude"}),ee.jsx(qR,{variant:"unlimited"===e.permissionMode?"destructive":"secondary",className:"text-xs",children:"unlimited"===e.permissionMode?"Unlimited":"Limited"}),k&&ee.jsxs(qR,{variant:"outline",className:"text-xs gap-0.5",children:[S?ee.jsx(WE,{className:"h-3 w-3"}):ee.jsx(pP,{className:"h-3 w-3"}),S?"可见":"可编辑"]}),!k&&e.shares&&e.shares.length>0&&ee.jsxs(qR,{variant:"outline",className:"text-xs gap-0.5",children:[ee.jsx(jP,{className:"h-3 w-3"}),e.shares.length]}),ee.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(e.createdAt).toLocaleDateString()})]}),(e.tags??[]).length>0&&ee.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[(e.tags??[]).slice(0,3).map(e=>ee.jsxs("span",{className:"px-1.5 py-0 rounded-full text-[10px] bg-muted text-muted-foreground border border-border",children:["#",e]},e)),((null==(l=e.tags)?void 0:l.length)??0)>3&&ee.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",((null==(c=e.tags)?void 0:c.length)??0)-3]})]})]})]})});var _;const N=t&&!e.archived?ee.jsx("div",{className:"card-active-glow rounded-xl",children:P}):P;return ee.jsxs(ee.Fragment,{children:[N,!k&&i&&ee.jsx(VM,{project:e,open:f,onOpenChange:h,onUpdated:i})]})});function gL({onSelect:e}){const[t,n]=W.useState(""),[r,o]=W.useState(null),[a,s]=W.useState([]),[i,l]=W.useState(!0),[c,u]=W.useState(null),[d,p]=W.useState(!1),[f,h]=W.useState(""),[m,g]=W.useState(null),[v,y]=W.useState(!1),b=W.useRef(null),x=async e=>{l(!0),u(null);try{const t=await LC(e);n(t.path),o(t.parent),s(t.entries)}catch(RO){u(RO instanceof Error?RO.message:"Failed to load directory")}finally{l(!1)}};W.useEffect(()=>{x()},[]),W.useEffect(()=>{d&&setTimeout(()=>{var e;return null==(e=b.current)?void 0:e.focus()},0)},[d]);const w=()=>{p(!1),h(""),g(null)},k=async()=>{const e=f.trim();if(e){y(!0),g(null);try{const{path:n}=await IC(t,e);p(!1),h(""),await x(t),x(n)}catch(RO){g(RO instanceof Error?RO.message:"Failed to create folder")}finally{y(!1)}}},S=t.split("/").filter(Boolean);return ee.jsxs("div",{className:"flex flex-col h-64 border rounded-md overflow-hidden",children:[ee.jsxs("div",{className:"flex items-center gap-1 px-2 py-2 bg-muted border-b flex-shrink-0",children:[ee.jsx(yj,{variant:"ghost",size:"sm",className:"h-6 px-1 flex-shrink-0",onClick:()=>{x()},title:"Home",children:ee.jsx(eP,{className:"h-3 w-3"})}),ee.jsx("div",{className:"flex items-center gap-1 flex-1 overflow-x-auto min-w-0",children:S.map((e,t)=>ee.jsxs(H.Fragment,{children:[ee.jsx(VE,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"}),ee.jsx("button",{className:"text-xs hover:text-foreground text-muted-foreground whitespace-nowrap",onClick:()=>(e=>{const t="/"+S.slice(0,e+1).join("/");x(t)})(t),children:e})]},t))}),ee.jsxs(yj,{variant:"ghost",size:"sm",className:"h-6 px-1.5 flex-shrink-0 gap-1 text-xs",onClick:()=>{h(""),g(null),p(!0)},disabled:d||i||!!c,title:"New folder",children:[ee.jsx(GE,{className:"h-3.5 w-3.5"}),ee.jsx("span",{className:"hidden sm:inline",children:"New folder"})]})]}),ee.jsxs("div",{className:"flex-1 overflow-y-auto",children:[i&&ee.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading..."}),c&&ee.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive px-4 text-center",children:c}),!i&&!c&&ee.jsxs("div",{className:"p-1",children:[r&&ee.jsxs("button",{className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded hover:bg-accent hover:text-accent-foreground",onClick:()=>{x(r)},children:[ee.jsx(IE,{className:"h-4 w-4 text-muted-foreground"}),ee.jsx("span",{children:".."})]}),d&&ee.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5",children:[ee.jsx(YE,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),ee.jsx("input",{ref:b,className:XS("flex-1 text-sm bg-background border rounded px-1.5 py-0.5 outline-none","focus:ring-1 focus:ring-ring",m&&"border-destructive"),placeholder:"Folder name",value:f,onChange:e=>{h(e.target.value),g(null)},onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),k()):"Escape"===e.key&&w()},disabled:v}),ee.jsx("button",{className:"p-1 rounded hover:bg-accent disabled:opacity-50",onClick:()=>{k()},disabled:!f.trim()||v,title:"Create",children:ee.jsx(zE,{className:"h-3.5 w-3.5 text-green-600"})}),ee.jsx("button",{className:"p-1 rounded hover:bg-accent",onClick:w,disabled:v,title:"Cancel",children:ee.jsx(CP,{className:"h-3.5 w-3.5 text-muted-foreground"})})]}),m&&ee.jsx("p",{className:"px-3 pb-1 text-xs text-destructive",children:m}),0===a.length&&!d&&ee.jsx("div",{className:"text-sm text-muted-foreground px-2 py-4 text-center",children:"Empty directory"}),a.map(e=>ee.jsxs("button",{className:XS("flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded text-left","dir"===e.type?"hover:bg-accent hover:text-accent-foreground cursor-pointer":"opacity-40 cursor-not-allowed"),onClick:()=>{"dir"===e.type&&x(e.path)},disabled:"file"===e.type,children:["dir"===e.type?ee.jsx(YE,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}):ee.jsx(HE,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),ee.jsx("span",{className:"truncate",children:e.name})]},e.path))]})]}),ee.jsxs("div",{className:"border-t px-3 py-2 flex items-center justify-between gap-2 flex-shrink-0 bg-background",children:[ee.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:t}),ee.jsx(yj,{size:"sm",onClick:()=>e(t),disabled:!t,children:"Select this folder"})]})]})}function vL(e,t="shift"){return W.useCallback(n=>{if("Enter"!==n.key)return;if(n.nativeEvent.isComposing||229===n.keyCode)return;("shift"===t?!n.shiftKey:n.shiftKey)&&(n.preventDefault(),e())},[e,t])}const yL=[{value:"claude",label:"Claude",desc:"Anthropic Claude Code CLI"},{value:"opencode",label:"OpenCode",desc:"OpenCode CLI (sst/opencode)"},{value:"codex",label:"Codex",desc:"OpenAI Codex CLI"},{value:"qwen",label:"Qwen",desc:"Qwen Code CLI (QwenLM)"},{value:"gemini",label:"Gemini",desc:"Google Gemini CLI"},{value:"terminal",label:"Terminal",desc:"Plain shell (no AI CLI)"}],bL={claude:{limited:"claude",unlimited:"claude --dangerously-skip-permissions"},opencode:{limited:"opencode",unlimited:"opencode --dangerously-skip-permissions"},codex:{limited:"codex",unlimited:"codex --ask-for-approval never --sandbox danger-full-access"},qwen:{limited:"qwen-code",unlimited:"qwen-code --yolo"},gemini:{limited:"gemini",unlimited:"gemini --yolo"},terminal:{limited:"$SHELL (interactive)",unlimited:"$SHELL (interactive)"}};function xL({open:e,onOpenChange:t,onCreated:n}){const[r,o]=W.useState("name"),[a,s]=W.useState(""),[i,l]=W.useState(""),[c,u]=W.useState("claude"),[d,p]=W.useState("limited"),[f,h]=W.useState(!1),[m,g]=W.useState(null),v=e=>{e||(o("name"),s(""),l(""),u("claude"),p("limited"),g(null),h(!1)),t(e)},y=()=>{a.trim()?(g(null),o("folder")):g("Please enter a project name")},b=vL(y,"shift"),x=["name","folder","settings"];return ee.jsx(LM,{open:e,onOpenChange:v,children:ee.jsxs(DM,{className:"sm:max-w-lg",children:[ee.jsxs(IM,{children:[ee.jsx($M,{children:{name:"New Project — Name",folder:"New Project — Select Folder",settings:"New Project — Settings"}[r]}),ee.jsxs(zM,{children:["name"===r&&"Give your project a name.","folder"===r&&"Choose the working directory for this project.","settings"===r&&"Choose the AI coding tool and run mode."]})]}),ee.jsx("div",{className:"flex gap-2 mb-2",children:x.map((e,t)=>ee.jsx("div",{className:"h-1.5 flex-1 rounded-full "+(r===e?"bg-primary":x.indexOf(r)>t?"bg-primary/40":"bg-muted")},e))}),"name"===r&&ee.jsxs("div",{className:"space-y-4",children:[ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(jj,{htmlFor:"project-name",children:"Project Name"}),ee.jsx(bj,{id:"project-name",placeholder:"My Project",value:a,onChange:e=>s(e.target.value),onKeyDown:b,autoFocus:!0})]}),m&&ee.jsx("p",{className:"text-sm text-destructive",children:m})]}),"folder"===r&&ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(jj,{children:"Working Directory"}),ee.jsx(gL,{onSelect:e=>{l(e),o("settings")}})]}),"settings"===r&&ee.jsxs("div",{className:"space-y-5",children:[ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(jj,{children:"AI Coding Tool"}),ee.jsx("div",{className:"grid grid-cols-2 gap-2",children:yL.map(e=>ee.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer p-3 rounded-md border transition-colors "+(c===e.value?"border-primary bg-primary/5":"hover:bg-accent"),children:[ee.jsx("input",{type:"radio",name:"cliTool",value:e.value,checked:c===e.value,onChange:()=>u(e.value),className:"accent-primary"}),ee.jsxs("div",{children:[ee.jsx("div",{className:"font-medium text-sm",children:e.label}),ee.jsx("div",{className:"text-xs text-muted-foreground",children:e.desc})]})]},e.value))})]}),"terminal"!==c&&ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(jj,{children:"Permission Mode"}),ee.jsxs("div",{className:"space-y-2",children:[ee.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[ee.jsx("input",{type:"radio",name:"permissionMode",value:"limited",checked:"limited"===d,onChange:()=>p("limited"),className:"mt-0.5"}),ee.jsxs("div",{children:[ee.jsx("div",{className:"font-medium text-sm",children:"Limited"}),ee.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",ee.jsx("code",{className:"bg-muted px-1 rounded",children:bL[c].limited})," — asks for permission before file changes."]})]})]}),ee.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[ee.jsx("input",{type:"radio",name:"permissionMode",value:"unlimited",checked:"unlimited"===d,onChange:()=>p("unlimited"),className:"mt-0.5"}),ee.jsxs("div",{children:[ee.jsx("div",{className:"font-medium text-sm",children:"Unlimited"}),ee.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",ee.jsx("code",{className:"bg-muted px-1 rounded",children:bL[c].unlimited})," — acts autonomously."]})]})]})]})]}),ee.jsxs("div",{className:"text-xs text-muted-foreground",children:[ee.jsx("span",{className:"font-medium",children:"Folder:"})," ",ee.jsx("span",{className:"font-mono",children:i})]}),m&&ee.jsx("p",{className:"text-sm text-destructive",children:m})]}),ee.jsxs(FM,{children:["name"!==r&&ee.jsx(yj,{variant:"outline",onClick:()=>o("settings"===r?"folder":"name"),disabled:f,children:"Back"}),"name"===r&&ee.jsx(yj,{onClick:y,children:"Next"}),"folder"===r&&ee.jsx(yj,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),"settings"===r&&ee.jsx(yj,{onClick:()=>{(async()=>{h(!0),g(null);try{const e=await Yj({name:a.trim(),folderPath:i,permissionMode:d,cliTool:c});n(e),v(!1)}catch(RO){g(RO instanceof Error?RO.message:"Failed to create project")}finally{h(!1)}})()},disabled:f,children:f?"Creating...":"Create Project"})]})]})})}function wL({open:e,onOpenChange:t,onOpened:n}){const[r,o]=W.useState(""),[a,s]=W.useState(!1),[i,l]=W.useState(null),c=e=>{e||(o(""),l(null),s(!1)),t(e)};return ee.jsx(LM,{open:e,onOpenChange:c,children:ee.jsxs(DM,{className:"sm:max-w-lg",children:[ee.jsxs(IM,{children:[ee.jsx($M,{children:"Open Existing Project"}),ee.jsxs(zM,{children:["Select a folder that contains a ",ee.jsx("code",{className:"bg-muted px-1 rounded text-xs",children:".ccweb/"})," configuration. The project's history and settings will be restored."]})]}),ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(jj,{children:"Project Folder"}),ee.jsx(gL,{onSelect:e=>{(async e=>{o(e),s(!0),l(null);try{const t=await Xj(e);n(t),c(!1)}catch(RO){l(RO instanceof Error?RO.message:"Failed to open project"),s(!1)}})(e)}})]}),i&&ee.jsx("p",{className:"text-sm text-destructive",children:i}),r&&!i&&a&&ee.jsxs("p",{className:"text-sm text-muted-foreground",children:["Opening project from ",r,"..."]}),ee.jsx(FM,{children:ee.jsx(yj,{variant:"outline",onClick:()=>c(!1),disabled:a,children:"Cancel"})})]})})}const kL=`${"https:"===window.location.protocol?"wss:":"ws:"}//${window.location.host}`;function SL(e){return 3e3*Math.min(e,4)+2e3*Math.random()}function jL(e,t){const n=W.useRef(null),r=W.useRef(0),o=W.useRef(!0),a=W.useRef(!1),s=W.useRef(null),i=W.useRef(t);i.current=t;const[l,c]=W.useState(!1),[u,d]=W.useState(0),p=W.useRef(!1),f=W.useRef([]),h=W.useCallback(e=>{var t;(null==(t=n.current)?void 0:t.readyState)===WebSocket.OPEN&&n.current.send(JSON.stringify(e))},[]),m=W.useCallback(()=>{var e;if((null==(e=n.current)?void 0:e.readyState)===WebSocket.OPEN)for(;f.current.length>0;){const e=f.current.shift();n.current.send(JSON.stringify({type:"terminal_input",data:e}))}},[]),g=W.useCallback((e,t)=>{var r;(null==(r=n.current)?void 0:r.readyState)===WebSocket.OPEN?(n.current.send(JSON.stringify({type:"terminal_subscribe",cols:e,rows:t})),p.current=!1):p.current=!0},[]),v=W.useCallback(e=>{var t;(null==(t=n.current)?void 0:t.readyState)===WebSocket.OPEN?n.current.send(JSON.stringify({type:"terminal_input",data:e})):f.current.push(e)},[]),y=W.useCallback((e,t)=>{h({type:"terminal_resize",cols:e,rows:t})},[h]),b=W.useCallback(()=>{h({type:"chat_subscribe",replay:50})},[h]),x=W.useCallback(()=>{if(!o.current)return;if(a.current)return;const t=$j();if(!t)return void(window.location.href="/login");a.current=!0;const l=new WebSocket(`${kL}/ws/projects/${e}`);n.current=l,l.onopen=()=>{a.current=!1,r.current=0,l.send(JSON.stringify({type:"auth",token:t}))},l.onmessage=e=>{var t,n,r,o,a,s,l,u,f,h,g,v,y,b,x,w,k,S,j,C,E,P,_,N,T,R;let M;try{M=JSON.parse(e.data)}catch{return}switch(M.type){case"connected":p.current=!1,c(!0),d(e=>e+1),m(),null==(n=(t=i.current).onConnected)||n.call(t);break;case"terminal_data":null==(o=(r=i.current).onTerminalData)||o.call(r,M.data);break;case"terminal_reset":null==(s=(a=i.current).onTerminalReset)||s.call(a,M.cliTool);break;case"status":null==(u=(l=i.current).onStatus)||u.call(l,M.status);break;case"chat_message":{const e=M;null==(h=(f=i.current).onChatMessage)||h.call(f,e);break}case"project_stopped":{const e=M;null==(v=(g=i.current).onProjectStopped)||v.call(g,e.projectId,e.projectName);break}case"context_update":null==(b=(y=i.current).onContextUpdate)||b.call(y,M);break;case"semantic_update":null==(w=(x=i.current).onSemanticUpdate)||w.call(x,M);break;case"approval_request":null==(S=(k=i.current).onApprovalRequest)||S.call(k,M);break;case"approval_resolved":null==(C=(j=i.current).onApprovalResolved)||C.call(j,M);break;case"track_status_change":case"track_ask_user":case"track_run_complete":"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("ccweb:track-msg",{detail:M})),"track_status_change"===M.type?null==(P=(E=i.current).onTrackStatusChange)||P.call(E,M):"track_ask_user"===M.type?null==(N=(_=i.current).onTrackAskUser)||N.call(_,M):null==(R=(T=i.current).onTrackRunComplete)||R.call(T,M);break;case"flow_started":case"flow_node_active":case"flow_node_completed":case"flow_node_failed":case"flow_var_changed":case"flow_user_input_required":case"flow_done":case"flow_cancelled":case"flow_error":"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("ccweb:flow-msg",{detail:M}));break;case"cli_prompt_detected":case"cli_prompt_dismissed":"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("ccweb:cli-prompt-msg",{detail:M}));break;case"error":console.error("[WS] Server error:",M.message)}},l.onclose=()=>{var e,t;a.current=!1,n.current===l&&(n.current=null),c(!1),null==(t=(e=i.current).onDisconnected)||t.call(e),o.current&&r.current<5&&(r.current++,s.current=window.setTimeout(x,SL(r.current)))},l.onerror=e=>{a.current=!1,console.error("[WS] WebSocket error:",e)}},[e]);return W.useEffect(()=>(o.current=!0,x(),()=>{var e;o.current=!1,s.current&&(clearTimeout(s.current),s.current=null),null==(e=n.current)||e.close(),n.current=null,f.current=[]}),[x]),{subscribeTerminal:g,sendTerminalInput:v,sendTerminalResize:y,subscribeChatMessages:b,connected:l,readyTick:u}}function CL(e){const t=W.useRef(null),n=W.useRef(0),r=W.useRef(!0),o=W.useRef(!1),a=W.useRef(null),s=W.useRef(e);s.current=e;const i=W.useCallback(()=>{if(!r.current)return;if(o.current)return;const e=$j();if(!e)return;o.current=!0;const l=new WebSocket(`${kL}/ws/dashboard`);t.current=l,l.onopen=()=>{o.current=!1,n.current=0,l.send(JSON.stringify({type:"auth",token:e}))},l.onmessage=e=>{var t,n;try{const r=JSON.parse(e.data);"activity_update"===r.type?s.current.onActivityUpdate(r):"project_stopped"===r.type&&(null==(n=(t=s.current).onProjectStopped)||n.call(t,r.projectId,r.projectName))}catch{}},l.onclose=()=>{o.current=!1,t.current===l&&(t.current=null),r.current&&n.current<5&&(n.current++,a.current=window.setTimeout(i,SL(n.current)))},l.onerror=e=>{o.current=!1,console.error("[DashboardWS] Error:",e)}},[]);W.useEffect(()=>(r.current=!0,i(),()=>{var e;r.current=!1,a.current&&(clearTimeout(a.current),a.current=null),null==(e=t.current)||e.close(),t.current=null}),[i])}function EL(e){const t=W.useRef(null),n=W.useRef(0),r=W.useRef(!0),o=W.useRef(!1),a=W.useRef(null),s=W.useRef(e);s.current=e;const i=W.useCallback(()=>{if(!r.current)return;if(o.current)return;const e=$j();if(!e)return;o.current=!0;const l=new WebSocket(`${kL}/ws/dashboard`);t.current=l,l.onopen=()=>{o.current=!1,n.current=0,l.send(JSON.stringify({type:"auth",token:e}))},l.onmessage=e=>{var t,n,r,o,a,i;try{const l=JSON.parse(e.data);if(!l.type||!l.type.startsWith("sync."))return;"sync.start"===l.type?null==(n=(t=s.current).onStart)||n.call(t,l):"sync.progress"===l.type?null==(o=(r=s.current).onProgress)||o.call(r,l):"sync.done"===l.type&&(null==(i=(a=s.current).onDone)||i.call(a,l))}catch{}},l.onclose=()=>{o.current=!1,t.current===l&&(t.current=null),r.current&&n.current<5&&(n.current++,a.current=window.setTimeout(i,SL(n.current)))},l.onerror=()=>{o.current=!1}},[]);W.useEffect(()=>(r.current=!0,i(),()=>{var e;r.current=!1,a.current&&(clearTimeout(a.current),a.current=null),null==(e=t.current)||e.close(),t.current=null}),[i])}function PL({projectId:e,enabled:t,onChatMessage:n,onStatusChange:r,onContextUpdate:o,onApprovalRequest:a,onApprovalResolved:s,onSemanticUpdate:i}){const l=W.useRef(null),c=W.useRef(!0),u=W.useRef(0),d=W.useRef(null),p=W.useRef(!1),f=W.useRef(!1),h=W.useRef([]),m=W.useRef({onChatMessage:n,onStatusChange:r,onContextUpdate:o,onApprovalRequest:a,onApprovalResolved:s,onSemanticUpdate:i});m.current={onChatMessage:n,onStatusChange:r,onContextUpdate:o,onApprovalRequest:a,onApprovalResolved:s,onSemanticUpdate:i};const[g,v]=W.useState(!1),[y,b]=W.useState(0),x=W.useCallback(()=>{if(f.current&&l.current&&l.current.readyState===WebSocket.OPEN)for(;h.current.length>0;){const e=h.current.shift();l.current.send(JSON.stringify({type:"terminal_input",data:e}))}},[]),w=W.useCallback(e=>{var t;f.current&&(null==(t=l.current)?void 0:t.readyState)===WebSocket.OPEN?l.current.send(JSON.stringify({type:"terminal_input",data:e})):h.current.push(e)},[]),k=W.useCallback(()=>{if(!c.current||!t)return;if(p.current)return;const n=$j();if(!n)return;p.current=!0,f.current=!1;const r=new WebSocket(`${kL}/ws/projects/${e}`);l.current=r,r.onopen=()=>{p.current=!1,u.current=0,r.send(JSON.stringify({type:"auth",token:n}))},r.onmessage=e=>{var t,n,o,a,s,i,l,c,u,d,p,h;try{const g=JSON.parse(e.data);"connected"===g.type?(r.send(JSON.stringify({type:"chat_subscribe",replay:50})),f.current=!0,v(!0),b(e=>e+1),x()):"chat_message"===g.type?m.current.onChatMessage(g):"status"===g.type&&g.status?null==(n=(t=m.current).onStatusChange)||n.call(t,g.status):"project_stopped"===g.type?null==(a=(o=m.current).onStatusChange)||a.call(o,"stopped"):"context_update"===g.type?null==(i=(s=m.current).onContextUpdate)||i.call(s,g):"approval_request"===g.type?null==(c=(l=m.current).onApprovalRequest)||c.call(l,g):"approval_resolved"===g.type?null==(d=(u=m.current).onApprovalResolved)||d.call(u,g):"semantic_update"===g.type?null==(h=(p=m.current).onSemanticUpdate)||h.call(p,g):"cli_prompt_detected"!==g.type&&"cli_prompt_dismissed"!==g.type||"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("ccweb:cli-prompt-msg",{detail:g}))}catch{}},r.onclose=()=>{p.current=!1,f.current=!1,v(!1),l.current===r&&(l.current=null),c.current&&t&&(u.current<5?(u.current++,d.current=window.setTimeout(k,SL(u.current))):h.current.length>0&&(console.warn("[MonitorWS] Retries exhausted, dropping",h.current.length,"queued messages"),h.current=[]))},r.onerror=()=>{p.current=!1}},[e,t,x]);return W.useEffect(()=>(c.current=!0,()=>{c.current=!1,h.current=[]}),[]),W.useEffect(()=>(u.current=0,k(),()=>{var e;f.current=!1,d.current&&(clearTimeout(d.current),d.current=null),null==(e=l.current)||e.close(),l.current=null}),[k,t]),{sendInput:w,connected:g,readyTick:y}}const _L="cc_project_order_cache";function NL(){try{const e=localStorage.getItem(_L);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)&&t.every(e=>"string"==typeof e)?t:[]}catch{return[]}}function TL(e){try{localStorage.setItem(_L,JSON.stringify(e))}catch{}}function RL(){const[e,t]=W.useState(NL),n=W.useRef(!1),r=W.useRef(null),o=W.useRef(null),a=W.useRef(!1),s=W.useRef(!0);W.useEffect(()=>{s.current=!0;let e=!1;return Hj().then(r=>{e||n.current||(t(e=>function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(e,r)?e:r),TL(r))}).catch(()=>{}),()=>{e=!0,s.current=!1,o.current&&(clearTimeout(o.current),o.current=null)}},[]);const i=W.useCallback(async()=>{for(;r.current;){const e=r.current;r.current=null,a.current=!0;try{await qj(e)}catch{}a.current=!1}},[]),l=W.useCallback(e=>{n.current=!0,t(e),TL(e),r.current=e,o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{o.current=null,s.current&&(a.current||i())},400)},[i]),c=W.useCallback(t=>{const n=new Map(e.map((e,t)=>[e,t]));return[...t].sort((e,t)=>{const r=n.get(e.id)??1/0,o=n.get(t.id)??1/0;return r===o?0:r-o})},[e]);return W.useMemo(()=>({order:e,setOrder:l,applyOrder:c}),[e,l,c])}const ML=18e6,LL=6048e5;function OL(e,t=18e6){if(!e||void 0===e.utilization||e.utilization<=0||!e.resetAt)return null;const n=new Date(e.resetAt).getTime()-Date.now();if(n<=0)return null;const r=t-n;return r<=0?null:Math.round(e.utilization/(r/t))}function AL({label:e,bucket:t}){if(!t||void 0===t.utilization)return null;const n=t.utilization,r=n<50?"text-green-400":n<80?"text-yellow-400":"text-red-400",o=function(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return n>0?`${n}h${r}m`:`${r}m`}(t.resetAt);return ee.jsxs("span",{className:"text-muted-foreground whitespace-nowrap",children:[e," ",ee.jsxs("span",{className:XS("font-medium",r),children:[n,"%"]}),o&&ee.jsxs("span",{className:"text-muted-foreground/70 ml-0.5",children:["(",o,")"]})]})}function DL({className:e}){const[t,n]=W.useState("loading"),[r,o]=W.useState(!1),a=()=>Tj(Nj.usageMonitorTool,"claude");W.useEffect(()=>{const e=async()=>{try{n(await PC(a()))}catch{n(null)}};e();const t=setInterval(()=>{e()},3e5),r=()=>{e()},o=t=>{t.key===Nj.usageMonitorTool&&e()};return window.addEventListener("ccweb:usage-tool-change",r),window.addEventListener("storage",o),()=>{clearInterval(t),window.removeEventListener("ccweb:usage-tool-change",r),window.removeEventListener("storage",o)}},[]);if("loading"===t)return null;if(!t)return null;const s=!!t.fiveHour,i=!!t.sevenDay,l=!!t.sevenDaySonnet,c=!!t.sevenDayOpus,u=s||i||l||c,d=OL(t.fiveHour,ML),p=OL(t.sevenDay,LL),f=OL(t.sevenDaySonnet,LL),h=null!==d||null!==p||null!==f;return ee.jsxs("div",{className:XS("flex items-center gap-1.5 text-xs",e),children:[h&&ee.jsxs("span",{className:"flex items-center gap-1",children:[null!==d&&ee.jsxs("span",{className:XS("font-medium",d<=100?"text-green-400":"text-orange-400"),title:`5h 配速:按当前速率,窗口结束时预计使用 ${d}%`,children:[d,"%"]}),null!==p&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/40",children:"/"}),ee.jsxs("span",{className:XS("font-medium",p<=100?"text-green-400":"text-orange-400"),title:`7d 配速:按当前速率,窗口结束时预计使用 ${p}%`,children:[p,"%"]})]}),null!==f&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/40",children:"/"}),ee.jsxs("span",{className:XS("font-medium",f<=100?"text-green-400":"text-orange-400"),title:`7d Sonnet 配速:按当前速率,窗口结束时预计使用 ${f}%`,children:[f,"%"]})]})]}),t.planName&&ee.jsx("span",{className:"font-medium text-foreground bg-muted border border-border px-2 py-0.5 rounded-full",children:t.planName}),u&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/50",children:"|"}),ee.jsx(AL,{label:"5h",bucket:t.fiveHour}),i&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/50",children:"·"}),ee.jsx(AL,{label:"7d",bucket:t.sevenDay})]}),l&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/50",children:"·"}),ee.jsx(AL,{label:"7d Sonnet",bucket:t.sevenDaySonnet})]}),c&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/50",children:"·"}),ee.jsx(AL,{label:"7d Opus",bucket:t.sevenDayOpus})]})]}),ee.jsx("button",{onClick:()=>{(async()=>{o(!0);try{n(await _C(a()))}catch{n(null)}finally{o(!1)}})()},className:"text-muted-foreground hover:text-foreground transition-colors",title:"刷新用量信息",children:ee.jsx(hP,{className:XS("h-3 w-3",r&&"animate-spin")})})]})}function IL(e){return e<50?"text-green-400":e<80?"text-yellow-400":"text-red-400"}function FL(e){return e<1024?`${Math.round(e)} B`:e<1048576?`${(e/1024).toFixed(0)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(1)} GB`}function $L(e){return`${FL(e)}/s`}function zL({icon:e,value:t,color:n,title:r}){return ee.jsxs("span",{className:"flex items-center gap-1 whitespace-nowrap",title:r,children:[ee.jsx("span",{className:"text-muted-foreground/70",children:e}),ee.jsx("span",{className:XS("font-medium tabular-nums",n),children:t})]})}function VL({className:e}){const{t:t}=Xf(),[n,r]=W.useState("loading");if(W.useEffect(()=>{let e=!1;const t=async()=>{try{const t=await NC();e||r(t)}catch{e||r(null)}};t();const n=setInterval(()=>{t()},3e3);return()=>{e=!0,clearInterval(n)}},[]),"loading"===n||!n)return null;const o=Math.floor(n.uptimeSec/3600),a=`${n.hostname} · ${n.platform} · ${n.cores} ${t("dashboard.host_cores")} · ${t("dashboard.host_uptime",{hours:o})}`;return ee.jsxs("div",{className:XS("flex items-center gap-2.5 text-xs",e),title:a,children:[ee.jsx(zL,{icon:ee.jsx(UE,{className:"h-3 w-3"}),value:`${n.cpu}%`,color:IL(n.cpu),title:t("dashboard.host_cpu",{load:n.loadAvg})}),ee.jsx(zL,{icon:ee.jsx(sP,{className:"h-3 w-3"}),value:`${n.mem.percent}%`,color:IL(n.mem.percent),title:t("dashboard.host_mem",{used:FL(n.mem.used),total:FL(n.mem.total)})}),n.disk&&ee.jsx(zL,{icon:ee.jsx(ZE,{className:"h-3 w-3"}),value:`${n.disk.percent}%`,color:IL(n.disk.percent),title:t("dashboard.host_disk",{used:FL(n.disk.used),total:FL(n.disk.total)})}),n.net&&ee.jsxs("span",{className:"flex items-center gap-1.5 whitespace-nowrap",title:t("dashboard.host_net"),children:[ee.jsxs("span",{className:"flex items-center gap-0.5 text-muted-foreground",children:[ee.jsx(DE,{className:"h-3 w-3"}),ee.jsx("span",{className:"font-medium tabular-nums",children:$L(n.net.rxBytesPerSec)})]}),ee.jsxs("span",{className:"flex items-center gap-0.5 text-muted-foreground",children:[ee.jsx(FE,{className:"h-3 w-3"}),ee.jsx("span",{className:"font-medium tabular-nums",children:$L(n.net.txBytesPerSec)})]})]})]})}function UL({open:e,onOpenChange:t,kind:n,label:r,content:o}){const a=cp(),[s,i]=W.useState(()=>Tj(Nj.skillhubAuthor,"")),[l,c]=W.useState(""),[u,d]=W.useState(""),[p,f]=W.useState(!1),[h,m]=W.useState(null),[g,v]=W.useState(!0);W.useEffect(()=>{e&&(i(Tj(Nj.skillhubAuthor,"")),c(""),d(""),v(!0),SC().then(m).catch(()=>m({configured:!1,needsReset:!1})).finally(()=>v(!1)))},[e]);const y=()=>{t(!1),a("/settings?tab=hub")},b="quick-prompt"===n?"快捷 Prompt":"Agent Prompt",x=!g&&h&&!h.configured;return ee.jsx(LM,{open:e,onOpenChange:t,children:ee.jsxs(DM,{className:XS("sm:max-w-lg"),children:[ee.jsxs(IM,{children:[ee.jsx($M,{children:"共享到 ccweb-hub"}),ee.jsxs(zM,{children:["「",r,"」将以 GitHub Issue 形式提交到 ",ee.jsx("code",{children:"zbc0315/ccweb-hub"}),", 使用你配置的 GitHub token。审核通过后会合入为社区 prompt。"]})]}),g?ee.jsxs("div",{className:"py-8 flex items-center justify-center text-sm text-muted-foreground",children:[ee.jsx(rP,{className:"h-4 w-4 mr-2 animate-spin"}),"检查 token 配置…"]}):x?ee.jsxs("div",{className:"space-y-3 py-2",children:[ee.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2.5 text-xs",children:ee.jsxs("div",{className:"flex items-start gap-2",children:[ee.jsx(tP,{className:"h-4 w-4 shrink-0 text-amber-500 mt-0.5"}),ee.jsxs("div",{className:"space-y-1",children:[ee.jsx("div",{className:"font-medium text-foreground",children:(null==h?void 0:h.needsReset)?"之前配置的 token 已失效(服务端密钥可能已轮换),请重新设置":"还没配置 GitHub token"}),ee.jsxs("div",{className:"text-muted-foreground",children:["为保护你的 GitHub 账号,ccweb 不自带 token,需要你用自己的 GitHub fine-grained PAT(只勾 ",ee.jsx("code",{children:"ccweb-hub"})," 仓库的",ee.jsx("code",{children:" Issues: Read and write"}),")。"]})]})]})}),ee.jsxs("div",{className:"flex gap-2 pt-1",children:[ee.jsx(yj,{variant:"outline",onClick:()=>t(!1),className:"flex-1",children:"稍后"}),ee.jsx(yj,{onClick:y,className:"flex-1",children:"去设置页配置"})]})]}):ee.jsxs(ee.Fragment,{children:[ee.jsxs("div",{className:"space-y-3 py-2",children:[ee.jsxs("div",{className:"space-y-1.5",children:[ee.jsx(jj,{htmlFor:"share-author",className:"text-xs",children:"GitHub 用户名(可选,用于作者标注)"}),ee.jsx(bj,{id:"share-author",placeholder:"zbc0315",value:s,onChange:e=>i(e.target.value)})]}),ee.jsxs("div",{className:"space-y-1.5",children:[ee.jsx(jj,{htmlFor:"share-desc",className:"text-xs",children:"一句话描述(可选)"}),ee.jsx(bj,{id:"share-desc",placeholder:"quick-prompt"===n?"这个命令用来...":"这段 prompt 让 Claude...",value:l,onChange:e=>c(e.target.value)})]}),ee.jsxs("div",{className:"space-y-1.5",children:[ee.jsx(jj,{htmlFor:"share-tags",className:"text-xs",children:"标签(逗号分隔,可选)"}),ee.jsx(bj,{id:"share-tags",placeholder:"review, 中文, 代码",value:u,onChange:e=>d(e.target.value)})]})]}),ee.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:[ee.jsxs("div",{className:"font-medium text-foreground mb-1",children:["预览:",b," · ",r]}),ee.jsxs("pre",{className:"whitespace-pre-wrap font-mono text-[11px] leading-snug max-h-32 overflow-y-auto",children:[Array.from(o).slice(0,500).join(""),Array.from(o).length>500&&"…"]})]}),ee.jsxs(FM,{children:[ee.jsxs(yj,{variant:"ghost",size:"sm",onClick:y,className:"mr-auto",title:"更换或清除 token",children:[ee.jsx(tP,{className:"h-3.5 w-3.5 mr-1"}),"管理 token"]}),ee.jsx(yj,{variant:"outline",onClick:()=>t(!1),disabled:p,children:"取消"}),ee.jsx(yj,{onClick:()=>{(async()=>{if(!p){f(!0),Rj(Nj.skillhubAuthor,s);try{const e=await EC({kind:n,label:r,body:o,description:l.trim()||void 0,author:s.trim()||void 0,tags:u.split(",").map(e=>e.trim()).filter(Boolean)});eL.success(`已提交:Issue #${e.issueNumber}`,{action:{label:"查看",onClick:()=>window.open(e.issueUrl,"_blank","noopener,noreferrer")}}),t(!1)}catch(RO){const t=RO.message;eL.error(t),/invalid|expired|401/.test(t)&&m({configured:!1,needsReset:!0})}finally{f(!1)}}})()},disabled:p,children:p?ee.jsxs(ee.Fragment,{children:[ee.jsx(rP,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"提交中"]}):ee.jsxs(ee.Fragment,{children:[ee.jsx(mP,{className:"h-3.5 w-3.5 mr-1.5"}),"直接提交"]})})]})]})]})})}function BL(){const[e,t]=W.useState([]),[n,r]=W.useState(!1),[o,a]=W.useState(""),[s,i]=W.useState(""),[l,c]=W.useState(""),[u,d]=W.useState(null),[p,f]=W.useState(""),[h,m]=W.useState(""),[g,v]=W.useState(""),y=W.useRef(null),b=W.useRef(null),[x,w]=W.useState(null);W.useEffect(()=>{nC().then(t).catch(()=>t([]))},[]),W.useEffect(()=>{n&&setTimeout(()=>{var e;return null==(e=y.current)?void 0:e.focus()},0)},[n]),W.useEffect(()=>{u&&setTimeout(()=>{var e;return null==(e=b.current)?void 0:e.focus()},0)},[u]);const k=async()=>{const e=s.trim();if(e)try{const n=await rC({label:o.trim()||e,command:e,...l?{parentId:l}:{}});t(e=>[...e,n]),a(""),i(""),c(""),r(!1)}catch(RO){console.error("[GlobalShortcuts] Failed to add:",RO)}},S=async()=>{const e=h.trim();if(e&&u)try{const n=await oC(u,{label:p.trim()||e,command:e,parentId:g||null});t(e=>e.map(e=>e.id===u?n:e)),d(null)}catch(RO){console.error("[GlobalShortcuts] Failed to save:",RO)}};return ee.jsxs("section",{className:"mt-10",children:[ee.jsxs("div",{className:"flex items-center justify-between mb-4",children:[ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(EP,{className:"h-4 w-4 text-muted-foreground"}),ee.jsx("h2",{className:"text-lg font-semibold",children:"全局快捷 Prompts"}),ee.jsx("span",{className:"text-xs text-muted-foreground",children:"在所有项目的终端中可用"})]}),ee.jsxs("button",{onClick:()=>{r(e=>!e),d(null)},className:XS("flex items-center gap-1.5 text-sm px-3 py-1.5 rounded-md border transition-colors",n?"border-border text-foreground bg-muted":"border-border text-muted-foreground hover:text-foreground hover:bg-muted"),children:[ee.jsx(fP,{className:"h-3.5 w-3.5"}),"新建"]})]}),n&&ee.jsxs("div",{className:"mb-4 p-4 rounded-xl border border-border bg-background space-y-3",children:[ee.jsx("input",{ref:y,placeholder:"名称(可选)",value:o,onChange:e=>a(e.target.value),className:"w-full text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground placeholder:text-muted-foreground outline-none focus:border-border transition-colors"}),ee.jsx("textarea",{placeholder:"命令内容…",value:s,onChange:e=>i(e.target.value),rows:3,className:"w-full text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground placeholder:text-muted-foreground font-mono outline-none focus:border-border transition-colors resize-none",onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),k()),"Escape"===e.key&&(r(!1),a(""),i(""),c(""))}}),ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(XE,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),ee.jsxs("select",{value:l,onChange:e=>c(e.target.value),className:"flex-1 text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground outline-none focus:border-border transition-colors",children:[ee.jsx("option",{value:"",children:"无继承"}),e.map(e=>ee.jsx("option",{value:e.id,children:e.label},e.id))]})]}),ee.jsxs("div",{className:"flex items-center justify-between",children:[ee.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ 保存 · Esc 取消"}),ee.jsxs("div",{className:"flex gap-2",children:[ee.jsx("button",{onClick:()=>{r(!1),a(""),i("")},className:"text-sm px-3 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),ee.jsx("button",{onClick:()=>{k()},disabled:!s.trim(),className:XS("text-sm px-3 py-1 rounded transition-colors text-white",s.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]})]}),0!==e.length||n?ee.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:e.map(n=>u===n.id?ee.jsxs("div",{className:"rounded-xl border border-border bg-background p-3 space-y-2",children:[ee.jsx("input",{ref:b,value:p,onChange:e=>f(e.target.value),placeholder:"名称(可选)",className:"w-full text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground placeholder:text-muted-foreground outline-none focus:border-border transition-colors"}),ee.jsx("textarea",{value:h,onChange:e=>m(e.target.value),rows:3,className:"w-full text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground font-mono outline-none focus:border-border transition-colors resize-none",onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),S()),"Escape"===e.key&&d(null)}}),ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(XE,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),ee.jsxs("select",{value:g,onChange:e=>v(e.target.value),className:"flex-1 text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground outline-none focus:border-border transition-colors",children:[ee.jsx("option",{value:"",children:"无继承"}),e.filter(e=>e.id!==n.id).map(e=>ee.jsx("option",{value:e.id,children:e.label},e.id))]})]}),ee.jsxs("div",{className:"flex gap-2 justify-end",children:[ee.jsx("button",{onClick:()=>d(null),className:"text-xs px-2.5 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),ee.jsx("button",{onClick:()=>{S()},disabled:!h.trim(),className:XS("text-xs px-2.5 py-1 rounded transition-colors text-white",h.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]},n.id):ee.jsxs("div",{className:"group relative rounded-xl border border-border bg-background hover:border-muted-foreground/30 transition-colors p-3",children:[ee.jsx("div",{className:"text-sm font-medium text-foreground truncate pr-14",children:n.label}),n.parentId&&(()=>{const t=e.find(e=>e.id===n.parentId);return t?ee.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[ee.jsx(XE,{className:"h-3 w-3 text-muted-foreground"}),ee.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["继承: ",t.label]})]}):null})(),!n.parentId&&n.label!==n.command&&ee.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-1 pr-14",children:n.command}),ee.jsxs("div",{className:"absolute top-2.5 right-2.5 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[ee.jsx("button",{onClick:()=>w({label:n.label,content:n.command}),className:"p-1 rounded text-muted-foreground hover:text-green-400 transition-colors",title:"共享到 ccweb-hub",children:ee.jsx(vP,{className:"h-3.5 w-3.5"})}),ee.jsx("button",{onClick:()=>{d(n.id),f(n.label),m(n.command),v(n.parentId||""),r(!1)},className:"p-1 rounded text-muted-foreground hover:text-blue-400 transition-colors",title:"编辑",children:ee.jsx(pP,{className:"h-3.5 w-3.5"})}),ee.jsx("button",{onClick:()=>{(async e=>{try{await aC(e),t(t=>t.filter(t=>t.id!==e)),u===e&&d(null)}catch(RO){console.error("[GlobalShortcuts] Failed to delete:",RO)}})(n.id)},className:"p-1 rounded text-muted-foreground hover:text-red-400 transition-colors",title:"删除",children:ee.jsx(CP,{className:"h-3.5 w-3.5"})})]})]},n.id))}):ee.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-muted-foreground/50 border border-dashed border-border rounded-xl",children:[ee.jsx(EP,{className:"h-6 w-6"}),ee.jsx("p",{className:"text-sm",children:"还没有全局快捷 Prompts"})]}),ee.jsx(UL,{open:!!x,onOpenChange:e=>{e||w(null)},kind:"quick-prompt",label:(null==x?void 0:x.label)??"",content:(null==x?void 0:x.content)??""})]})}const WL=W.createContext({theme:"system",resolved:"dark",setTheme:()=>{}});function HL(){return W.useSyncExternalStore(e=>{const t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}function qL({children:e}){const[t,n]=W.useState(()=>Tj(Nj.theme,"system")),r=HL(),o="system"===t?r:t;W.useEffect(()=>{const e=document.documentElement;e.classList.remove("light","dark"),e.classList.add(o)},[o]);return ee.jsx(WL.Provider,{value:{theme:t,resolved:o,setTheme:e=>{n(e),Rj(Nj.theme,e)}},children:e})}function GL(){return W.useContext(WL)}function KL(){const{theme:e,setTheme:t}=GL(),n=[{value:"light",icon:xP,label:"浅色"},{value:"dark",icon:uP,label:"深色"},{value:"system",icon:cP,label:"系统"}];return ee.jsx("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5",children:n.map(({value:n,icon:r,label:o})=>ee.jsx("button",{onClick:()=>t(n),className:XS("p-1 rounded-sm transition-colors",e===n?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:o,children:ee.jsx(r,{className:"h-3.5 w-3.5"})},n))})}const YL={workMinutes:30,breakMinutes:5};function XL(){return Tj(Nj.pomodoroConfig,YL,!0)}const QL=_j(e=>({running:!1,phase:"work",secondsLeft:60*XL().workMinutes,setRunning:t=>e({running:t}),setPhase:t=>e({phase:t}),setSecondsLeft:t=>e({secondsLeft:t})}));function JL(){const{running:e,phase:t,secondsLeft:n,setPhase:r,setSecondsLeft:o}=QL(),a=W.useCallback(e=>{const t=XL();var n;r(e),o("work"===e?60*t.workMinutes:60*t.breakMinutes),n="break"===e?"休息一下 ☕":"该工作了 💻",eL.info(`番茄钟: ${n}`)},[r,o]);return W.useEffect(()=>{if(!e)return;if(0===n)return void a("work"===t?"break":"work");const r=setTimeout(()=>o(n-1),1e3);return()=>clearTimeout(r)},[e,n,t,a,o]),null}function ZL(){const{running:e,phase:t,secondsLeft:n}=QL(),r=Math.floor(n/60),o=n%60,a=`${String(r).padStart(2,"0")}:${String(o).padStart(2,"0")}`,s=W.useRef(null),[i,l]=W.useState(()=>"undefined"==typeof window?360:Math.max(40,Math.floor(window.innerWidth/2.9)));return W.useEffect(()=>{if(!e)return;const t=()=>{const e=s.current;if(!e)return;const t=getComputedStyle(e),n=document.createElement("canvas").getContext("2d");if(!n)return;n.font=`${t.fontWeight} 100px ${t.fontFamily}`;const r=n.measureText(a).width;r&&l(Math.max(40,Math.floor(window.innerWidth/r*100)))},n=requestAnimationFrame(t);return window.addEventListener("resize",t),()=>{cancelAnimationFrame(n),window.removeEventListener("resize",t)}},[e,a.length]),e?ld.createPortal(ee.jsxs("div",{className:"fixed inset-0 flex flex-col items-center justify-center pointer-events-none z-40 select-none overflow-hidden",style:{opacity:"work"===t?.1:.6},children:[ee.jsx("div",{ref:s,className:XS("font-mono font-bold tabular-nums leading-none","work"===t?"text-foreground":"text-blue-400 dark:text-blue-300"),style:{fontSize:`${i}px`},children:a}),ee.jsx("div",{className:"mt-3 text-muted-foreground font-medium tracking-widest uppercase",style:{fontSize:"clamp(12px, 1.5vw, 20px)"},children:"work"===t?"专注工作":"休息一下"})]}),document.body):null}function eO(){const{running:e,phase:t,secondsLeft:n,setRunning:r,setPhase:o,setSecondsLeft:a}=QL(),s=Math.floor(n/60),i=n%60,l=`${String(s).padStart(2,"0")}:${String(i).padStart(2,"0")}`;return ee.jsx("button",{onClick:()=>{if(e){const e=XL();o("work"),a(60*e.workMinutes)}else{const e=XL();o("work"),a(60*e.workMinutes)}r(!e)},className:XS("p-1 rounded transition-colors",e?"work"===t?"text-red-500 bg-red-500/10 hover:bg-red-500/20":"text-green-500 bg-green-500/10 hover:bg-green-500/20":"text-muted-foreground hover:text-foreground hover:bg-muted"),title:e?"work"===t?`工作中 ${l} — 点击停止`:`休息中 ${l} — 点击停止`:"启动番茄钟",children:ee.jsx(kP,{className:"h-4 w-4"})})}const tO="v2026.6.13-c",nO=!!window.electronUpdater;function rO(){const[e,t]=W.useState("idle"),[n,r]=W.useState(!1),[o,a]=W.useState(""),[s,i]=W.useState(0),[l,c]=W.useState(null),[u,d]=W.useState(null),[p,f]=W.useState([]);W.useEffect(()=>{if(!window.electronUpdater)return;return window.electronUpdater.onUpdateStatus(e=>{switch(e.type){case"progress":{const t=e.info;i(Math.round((null==t?void 0:t.percent)??0));break}case"downloaded":t("downloaded");break;case"error":c(e.info||"Download failed"),t("error")}})},[]);const h=W.useCallback(async()=>{t("checking"),c(null),r(!0);try{if(nO){const e=await window.electronUpdater.checkForUpdate();if(e.error)throw new Error(e.error);if(!e.available)return void t("no_update");a(e.version?`v${e.version}`:"new version")}else{const e=await VC();if(!e.updateAvailable)return void t("no_update");a(`v${e.latest}`)}try{const e=await UC();f(e.entries)}catch{f([])}t("update_available")}catch(RO){c(RO instanceof Error?RO.message:"Check failed"),t("error")}},[]),m=W.useCallback(()=>{const e=3e3,n=Date.now(),r=()=>{if(Date.now()-n>3e5)return c("更新超时(5 分钟)— 请检查服务器状态"),void t("update_failed");WC().then(n=>{n?n.success?(a(n.newVersion?`v${n.newVersion}`:"new version"),t("update_complete")):(c(n.error||"Update failed"),t("update_failed")):setTimeout(r,e)}).catch(()=>{setTimeout(r,e)})};setTimeout(r,e)},[]),g=()=>{r(!1),setTimeout(()=>{t("idle"),a(""),c(null),i(0),d(null),f([])},200)};return ee.jsxs(ee.Fragment,{children:[ee.jsx(yj,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{h()},disabled:"checking"===e||"downloading"===e||"executing"===e||"reconnecting"===e,title:"检查更新",children:"checking"===e||"downloading"===e||"executing"===e||"reconnecting"===e?ee.jsx(rP,{className:"h-4 w-4 animate-spin"}):ee.jsx(BE,{className:"h-4 w-4"})}),ee.jsx(LM,{open:n,onOpenChange:e=>{e||g()},children:ee.jsxs(DM,{className:"sm:max-w-md",children:[ee.jsxs(IM,{children:[ee.jsxs($M,{children:["checking"===e&&"Checking for updates...","no_update"===e&&"Up to date","update_available"===e&&`Update ${o} available`,"downloading"===e&&"Downloading update...","downloaded"===e&&"Update ready to install","executing"===e&&"Updating server...","reconnecting"===e&&"Waiting for server restart...","update_complete"===e&&`Updated to ${o}`,"update_failed"===e&&"Update failed","error"===e&&"Update error"]}),ee.jsxs(zM,{children:["checking"===e&&"Checking for the latest version...","no_update"===e&&`Current version ${tO} is the latest.`,"update_available"===e&&"A new version is available. "+(nO?"Click download to update automatically.":""),"downloading"===e&&`Downloading... ${s}%`,"downloaded"===e&&"The update has been downloaded. Click install to restart and apply.","executing"===e&&"Server is shutting down and installing the update. Please wait...","reconnecting"===e&&"Update installed. Waiting for server to restart...","update_complete"===e&&`Successfully updated from ${tO} to ${o}. Click reload to use the new version.`,"update_failed"===e&&(l||"Update failed. You may need to restart the server manually."),"error"===e&&(l||"An error occurred.")]})]}),"update_available"===e&&p.length>0&&ee.jsxs("div",{children:[ee.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:"更新内容"}),ee.jsx("div",{className:"max-h-48 overflow-y-auto rounded-md border border-border bg-muted/30 p-3 text-sm space-y-2",children:p.map(e=>ee.jsxs("div",{className:"flex gap-2",children:[ee.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground pt-0.5",children:["v",e.version]}),ee.jsx("span",{className:"text-foreground/90 leading-snug",children:e.note})]},e.version))})]}),"downloading"===e&&ee.jsx("div",{className:"w-full bg-muted rounded-full h-2 overflow-hidden",children:ee.jsx("div",{className:"bg-primary h-full transition-all duration-300",style:{width:`${s}%`}})}),("executing"===e||"reconnecting"===e)&&ee.jsx("div",{className:"flex items-center justify-center py-6",children:ee.jsx(rP,{className:"h-8 w-8 animate-spin text-muted-foreground"})}),ee.jsxs(FM,{children:["no_update"===e&&ee.jsx(yj,{onClick:g,children:"OK"}),"update_available"===e&&ee.jsxs(ee.Fragment,{children:[ee.jsx(yj,{variant:"outline",onClick:g,children:"Later"}),ee.jsx(yj,{onClick:()=>{(async()=>{if(nO){t("downloading"),i(0);const e=await window.electronUpdater.downloadUpdate();e.success?e.path&&d(e.path):(c(e.error||"Download failed"),t("error"))}else{t("executing");try{await BC(),t("reconnecting"),m()}catch(RO){c(RO instanceof Error?RO.message:"Execute failed"),t("error")}}})()},children:nO?"Download & Install":`Update to ${o}`})]}),"downloaded"===e&&ee.jsxs(ee.Fragment,{children:[ee.jsx(yj,{variant:"outline",onClick:g,children:"Later"}),ee.jsx(yj,{onClick:()=>{var e;null==(e=window.electronUpdater)||e.quitAndInstall(u||void 0)},children:"Restart & Install"})]}),"update_complete"===e&&ee.jsx(yj,{onClick:()=>window.location.reload(),children:"Reload Page"}),"update_failed"===e&&ee.jsx(yj,{onClick:g,children:"Close"}),"error"===e&&ee.jsx(yj,{onClick:g,children:"Close"})]})]})})]})}function oO(e){return e.map(e=>"text"===e.type?e.content:`\n\`\`\`${e.type}\n${e.content}\n\`\`\`\n`).join("")}function aO(e){return"[200~"+e.replace(/\x1b\[20[01]~/g,"").replace(/\n/g,"\r")+"[201~\r"}function sO(e,t){return{id:e.id??t(),role:e.role,content:oO(e.blocks),blocks:e.blocks,ts:e.timestamp}}const iO=3e4;function lO({project:e,liveMessages:t,ws:n,historyLimit:r=20,liveWindow:o=50,historyEnabled:a=!0}){const s=e.id,[i,l]=W.useState("running"===e.status?"live":"stopped"),{history:c,hasMore:u,reload:d,loadMore:p}=function({projectId:e,historyLimit:t=20,enabled:n=!0}){const[r,o]=W.useState([]),[a,s]=W.useState(!1),[i,l]=W.useState(!1),c=W.useRef(0),u=W.useCallback(()=>"h"+ ++c.current,[]),d=W.useRef({projectId:e,enabled:n});d.current={projectId:e,enabled:n};const p=W.useCallback(async()=>{if(!d.current.enabled)return;const e=d.current.projectId;l(!0);try{const n=await tE(e,{limit:t});if(d.current.projectId!==e)return;const r=[];for(const e of n.blocks){const t=sO(e,u);t.content.trim()&&r.push(t)}o(r),s(n.hasMore)}catch{}finally{l(!1)}},[t,u]),f=W.useCallback(async()=>{if(!a||i||0===r.length)return;if(!d.current.enabled)return;const e=d.current.projectId,n=r[0];if(n.id&&!n.id.startsWith("h")){l(!0);try{const r=await tE(e,{limit:t,before:n.id});if(d.current.projectId!==e)return;const a=[];for(const e of r.blocks){const t=sO(e,u);t.content.trim()&&a.push(t)}o(e=>[...a,...e]),s(r.hasMore)}catch{}finally{l(!1)}}},[t,a,i,r,u]);return W.useEffect(()=>{n&&p()},[e,n]),{history:r,hasMore:a,isLoading:i,reload:p,loadMore:f}}({projectId:s,historyLimit:r,enabled:a}),[f,h]=W.useState([]),m=W.useRef(0),g=W.useCallback(()=>"m"+ ++m.current,[]),v=W.useRef([]),y=W.useRef(0),b=W.useCallback(()=>"p"+ ++y.current,[]),x=W.useRef(!1),w=W.useRef(0);W.useEffect(()=>{if(t.length<w.current&&(w.current=0),t.length<=w.current)return;const e=t.slice(w.current);w.current=t.length;for(const t of e){x.current=!0;const e=oO(t.blocks);if(e.trim()){if("user"===t.role){const n=e.trim(),r=v.current.findIndex(e=>"sent"===e.status&&e.text.trim()===n);if(-1!==r){const e=v.current[r];if(v.current.splice(r,1),e.timer&&(clearTimeout(e.timer),e.timer=null),e.displayId&&t.id){const n=t.id;h(t=>t.map(t=>t.id===e.displayId?{...t,id:n}:t))}e.resolve("delivered");continue}}h(n=>{if(t.id&&n.some(e=>e.id===t.id))return n;const r={id:t.id??g(),role:t.role,content:e,blocks:t.blocks,ts:t.timestamp};return[...n,r].slice(-o)})}}},[t,g,o]),W.useEffect(()=>{if("live"!==i)return void(x.current=!1);const e=setTimeout(()=>{x.current||d()},3e3);return()=>clearTimeout(e)},[i,d]),W.useEffect(()=>{"running"!==e.status||"stopped"!==i&&"error"!==i?"stopped"===e.status&&"live"===i&&l("stopped"):(h([]),l("live"))},[e.status]);const k=W.useRef(null),S=W.useRef(0),j=W.useCallback(e=>{e&&h(t=>t.filter(t=>t.id!==e))},[]),C=W.useCallback(()=>{const e=v.current;v.current=[];for(const t of e)t.timer&&(clearTimeout(t.timer),t.timer=null),"sent"===t.status&&j(t.displayId),t.resolve("failed")},[j]),E=W.useCallback(e=>{const t=g();e.displayId=t,e.status="sent",h(n=>[...n,{id:t,role:"user",content:e.text,ts:(new Date).toISOString()}].slice(-o)),n.send(e.isSlashCommand?e.text.replace(/\n/g,"\r")+"\r":aO(e.text))},[n,g,o]);W.useEffect(()=>{if(!n.connected)return;if("live"!==i)return;const e=v.current.filter(e=>"queued"===e.status);if(0!==e.length)for(const t of e)if(E(t),t.isSlashCommand){const e=v.current.indexOf(t);-1!==e&&v.current.splice(e,1),t.timer&&(clearTimeout(t.timer),t.timer=null),t.resolve("delivered")}},[n.connected,i,E]),W.useEffect(()=>()=>{k.current&&clearTimeout(k.current);for(const e of v.current)e.timer&&(clearTimeout(e.timer),e.timer=null),e.resolve("failed");v.current=[]},[]);const P=W.useCallback(e=>new Promise(t=>{const r=e.trimStart().startsWith("/");if(v.current.length>=20){const e=v.current.shift();e&&(e.timer&&clearTimeout(e.timer),"sent"===e.status&&j(e.displayId),e.resolve("failed"))}const o={id:b(),text:e,isSlashCommand:r,status:"queued",resolve:t,timer:null};if(v.current.push(o),r){if("live"===i&&n.connected){E(o);const e=v.current.indexOf(o);return-1!==e&&v.current.splice(e,1),void t("delivered")}o.timer=setTimeout(()=>{const e=v.current.indexOf(o);-1!==e&&v.current.splice(e,1),o.timer=null,"sent"===o.status&&j(o.displayId),t("failed")},iO)}else o.timer=setTimeout(()=>{const e=v.current.indexOf(o);-1!==e&&v.current.splice(e,1),o.timer=null,"sent"===o.status&&j(o.displayId),t("failed")},iO);if("live"===i&&n.connected)E(o);else if("waking"===i||"live"===i);else{const e=++S.current;l("waking"),Jj(s).then(()=>{e===S.current&&(k.current&&clearTimeout(k.current),l("live"))}).catch(t=>{e===S.current&&(eL.error(`启动失败: ${t instanceof Error?t.message:String(t)}`),l("error"),C())}),k.current=setTimeout(()=>{e===S.current&&v.current.some(e=>"queued"===e.status)&&(eL.error("启动超时(10s)"),l("error"),C())},1e4)}}),[i,n,s,E,C,j,b]),_=W.useCallback(e=>{const t=e.replace(/\r$/,"").trim();if(!t)return;const n=g();h(e=>[...e,{id:n,role:"user",content:t,ts:(new Date).toISOString()}].slice(-o));const r={id:b(),text:t,isSlashCommand:!1,status:"sent",displayId:n,resolve:()=>{},timer:setTimeout(()=>{const e=v.current.indexOf(r);-1!==e&&v.current.splice(e,1),r.timer=null},iO)};v.current.push(r)},[g,b,o]),N=W.useMemo(()=>{const e=new Set;for(const t of f)t.id&&e.add(t.id);return[...c.filter(t=>!t.id||!e.has(t.id)),...f]},[c,f]);return{state:i,setState:l,messages:N,historyMessages:c,displayMessages:f,setDisplayMessages:h,hasMoreHistory:u,loadMoreHistory:p,reloadHistory:d,liveReceivedRef:x,sendMessage:P,appendUserMessage:_,isWaking:"waking"===i,isRunning:"live"===i}}function cO(e,t,n){const r=W.useRef(!0),o=W.useRef(0),a=W.useCallback(()=>{const t=e.current;t&&(t.scrollHeight<=t.clientHeight||(o.current=performance.now(),t.scrollTop=t.scrollHeight))},[e]);return W.useEffect(()=>{const t=e.current;t&&(t.style.overflowAnchor="none")},[e]),W.useEffect(()=>{const t=e.current;if(!t)return;const n=()=>{if(performance.now()-o.current<80)return;const e=t.scrollHeight-t.scrollTop-t.clientHeight<80;r.current=e};return t.addEventListener("scroll",n,{passive:!0}),()=>t.removeEventListener("scroll",n)},[e]),W.useLayoutEffect(()=>{r.current&&a()},[a,...n]),W.useEffect(()=>{const e=t.current;if(!e)return;const n=new ResizeObserver(()=>{r.current&&a()});return n.observe(e),()=>n.disconnect()},[t,a]),{pinnedRef:r,scrollToBottom:a}}const uO=H.memo(function({project:e,externalStatus:t,active:n=!1}){const r=cp(),[o,a]=W.useState(""),[s,i]=W.useState(!1),l=W.useRef(null),c=W.useRef(null),[u,d]=W.useState([]),p=W.useRef(0),f=W.useCallback(e=>{d(t=>{const n=[...t,e];return n.length>200?n.slice(-200):n}),"assistant"===e.role&&(i(!0),setTimeout(()=>i(!1),1e3))},[]),h=W.useCallback(e=>{var t;"stopped"===e&&(null==(t=S.current)||t.call(S,"stopped"))},[]),{sendInput:m,connected:g}=PL({projectId:e.id,enabled:!0,onChatMessage:f,onStatusChange:h}),{state:v,setState:y,messages:b,sendMessage:x,isRunning:w,isWaking:k}=lO({project:e,liveMessages:u,ws:{send:m,connected:g},historyLimit:4,liveWindow:4}),S=W.useRef(y);S.current=y,W.useEffect(()=>{"stopped"===v&&(d([]),p.current=0)},[v]),W.useEffect(()=>{t&&("running"!==t||"stopped"!==v&&"error"!==v?"stopped"===t&&"live"===v&&y("stopped"):(d([]),y("live")))},[t]),cO(l,c,[b]);const[j,C]=W.useState(!1),E=vL(W.useCallback(async()=>{const e=o.trim();if(!e||j)return;C(!0);const t=await x(e);C(!1),"delivered"===t&&a("")},[o,j,x]),"enter"),P="stopped"===v,_=b.slice(-4),N=ee.jsxs("div",{className:XS("flex flex-col h-full rounded-xl overflow-hidden bg-background transition-colors duration-300",n?"border-transparent bg-transparent shadow-none":s?"border border-blue-500":"border border-border","error"===v&&"border border-red-500/50"),children:[ee.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-1.5 border-b border-border bg-muted/30 transition-colors",children:[ee.jsx(JE,{className:"h-3.5 w-3.5 text-muted-foreground/40 flex-shrink-0 cursor-grab active:cursor-grabbing"}),ee.jsx("span",{className:"font-medium text-sm truncate flex-1 cursor-pointer hover:text-blue-400 transition-colors",onClick:()=>r(`/projects/${e.id}`),title:"打开项目详情",children:e.name}),ee.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:e.cliTool??"claude"}),ee.jsx("span",{className:XS("w-2 h-2 rounded-full flex-shrink-0",w?"bg-green-500":k?"bg-yellow-400 animate-pulse":"bg-zinc-400")})]}),ee.jsx("div",{ref:l,className:"flex-1 overflow-y-auto min-h-0 text-xs",children:ee.jsxs("div",{ref:c,className:"p-2 space-y-2 min-h-full",children:[_.map(e=>{const t="user"===e.role;return ee.jsx("div",{className:XS("flex",t?"justify-end":"justify-start"),children:ee.jsx("div",{className:XS("max-w-[85%] rounded-2xl px-2.5 py-1.5 whitespace-pre-wrap break-words leading-relaxed",t?"bg-blue-500/15 text-foreground border border-blue-500/20 rounded-br-sm dark:bg-blue-500/20 dark:border-blue-500/25":"bg-secondary text-secondary-foreground border border-border rounded-bl-sm"),children:ee.jsx("div",{className:"line-clamp-6",children:e.content})})},e.id)}),P&&0===_.length&&ee.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/40 text-xs",children:"无对话记录"}),k&&ee.jsx("div",{className:"flex items-center justify-center h-full text-yellow-400 text-xs animate-pulse",children:"启动中..."})]})}),ee.jsx("div",{className:"border-t border-border p-1.5",children:ee.jsx("input",{type:"text",value:o,onChange:e=>a(e.target.value),onKeyDown:E,disabled:k||j,placeholder:k?"启动中...":j?"发送中…":P?"输入命令(自动启动)... Shift+⏎":"输入命令... Shift+⏎",className:XS("w-full bg-transparent text-xs font-mono outline-none placeholder:text-muted-foreground/40 px-1.5 py-1",(k||j)&&"opacity-50 cursor-not-allowed")})})]});return n?ee.jsx("div",{className:"card-active-glow rounded-xl h-full",children:N}):N});function dO({projects:e,projectStatuses:t,activeProjectIds:n}){const r=W.useMemo(()=>e.filter(e=>!e.archived),[e]),{order:o,setOrder:a,applyOrder:s}=RL(),[i,l]=W.useState(null),[c,u]=W.useState(null),d=W.useRef(null),p=W.useMemo(()=>s(r),[r,s]),f=W.useCallback((e,t)=>{l(t),e.dataTransfer.effectAllowed="move";const n=document.createElement("div");n.style.width="1px",n.style.height="1px",n.style.opacity="0.01",document.body.appendChild(n),e.dataTransfer.setDragImage(n,0,0),d.current=n},[]),h=W.useCallback((e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect="move",u(t)},[]),m=W.useCallback((e,t)=>{if(e.preventDefault(),!i||i===t)return l(null),void u(null);const n=p.map(e=>e.id),r=o.length?[...o]:n;for(const o of n)r.includes(o)||r.push(o);const s=r.indexOf(i),c=r.indexOf(t);if(-1===s||-1===c)return l(null),void u(null);r.splice(s,1),r.splice(c,0,i),a(r),l(null),u(null)},[i,p,o,a]),g=W.useCallback(()=>{l(null),u(null),d.current&&(d.current.remove(),d.current=null)},[]),{cols:v,rows:y}=(b=p.length)<=1?{cols:1,rows:1}:b<=2?{cols:2,rows:1}:b<=4?{cols:2,rows:2}:b<=6?{cols:3,rows:2}:b<=9?{cols:3,rows:3}:b<=12?{cols:4,rows:3}:{cols:4,rows:Math.ceil(b/4)};var b;if(0===p.length)return ee.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/50 text-sm",children:"没有活跃项目"});const x=y<=3;return ee.jsx("div",{className:"h-full w-full p-2 gap-2 overflow-y-auto",style:{display:"grid",gridTemplateColumns:`repeat(${v}, minmax(0, 1fr))`,gridAutoRows:x?`minmax(180px, min(${Math.floor(100/y)}vh, 350px))`:"280px"},children:p.map(e=>ee.jsx("div",{draggable:!0,onDragStart:t=>f(t,e.id),onDragOver:t=>h(t,e.id),onDrop:t=>m(t,e.id),onDragEnd:g,className:XS("transition-all duration-200",i===e.id&&"opacity-40 scale-95",c===e.id&&i!==e.id&&"ring-2 ring-ring/50 rounded-xl"),children:ee.jsx(uO,{project:e,externalStatus:t.get(e.id),active:n.has(e.id)})},e.id))})}function pO(){const{t:e}=Xf(),t=cp(),{projects:n,loading:r,error:o,hasFetched:a,fetchProjects:s,addProject:i,updateProject:l,removeProject:c}=Dj(),u=Oj(e=>e.clearToken),[d,p]=W.useState(!1),[f,h]=W.useState(!1),[m,g]=W.useState(new Set),v=W.useRef(new Map),[y,b]=W.useState(new Map),x=W.useRef(0),[w,k]=W.useState(!!document.fullscreenElement),[S,j]=W.useState(!1),[C,E]=Lj(Nj.monitorMode,!1,{parse:!0}),[P,_]=W.useState(new Map),[N,T]=W.useState(()=>"1"===sessionStorage.getItem("ccweb_claudemem_available"));W.useEffect(()=>{null===sessionStorage.getItem("ccweb_claudemem_available")&&(async()=>{var e;const t=await TC(),n=!!((null==t?void 0:t.available)&&((null==(e=t.counts)?void 0:e.observations)??0)>0);sessionStorage.setItem("ccweb_claudemem_available",n?"1":"0"),T(n)})()},[]);W.useEffect(()=>{const e=()=>k(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),W.useEffect(()=>{s()},[s]);CL({onActivityUpdate:W.useCallback(e=>{if(e.status){const t=Dj.getState().projects.find(t=>t.id===e.projectId);t&&t.status!==e.status&&l({...t,status:e.status}),_(t=>{const n=new Map(t);return n.set(e.projectId,e.status),n})}const t=Date.now(),n=v.current;if(e.active){g(t=>t.has(e.projectId)?t:new Set(t).add(e.projectId));const r=n.get(e.projectId)??[];let o=!1;if(e.semantic){const n=r[r.length-1];`${e.semantic.phase}:${e.semantic.detail??""}`!==(n?`${n.phase}:${n.detail??""}`:"")?(r.push({id:x.current++,phase:e.semantic.phase,detail:e.semantic.detail,ts:t}),o=!0):n&&(n.ts=t)}const a=r.filter(e=>t-e.ts<8e3),s=a.length>3?a.slice(-3):a;s.length!==r.length&&(o=!0),n.set(e.projectId,s),o&&b(new Map(n))}else g(t=>{if(!t.has(e.projectId))return t;const n=new Set(t);return n.delete(e.projectId),n}),n.has(e.projectId)&&n.get(e.projectId).length>0&&(n.set(e.projectId,[]),b(new Map(n)))},[l])});const[R,M]=W.useState({}),L=W.useCallback(async e=>{try{const t=await jE(e);M(n=>{var r;if(e)return t;const o={};for(const[e,a]of Object.entries(t))o[e]={...a,dirty:a.dirty??(null==(r=n[e])?void 0:r.dirty)??null};return o})}catch{}},[]);W.useEffect(()=>{let e=!1;(async()=>{await L(!1),e||await L(!0)})();const t=setInterval(()=>{L(!0)},3e4);return()=>{e=!0,clearInterval(t)}},[L]),EL({onStart:()=>{L(!1)},onDone:()=>{L(!0)}}),W.useEffect(()=>{const e=setInterval(()=>{const e=Date.now(),t=v.current;let n=!1;for(const[r,o]of t){const a=o.filter(t=>e-t.ts<8e3);a.length!==o.length&&(t.set(r,a),n=!0)}n&&b(new Map(t)),g(e=>{let n=!1;const r=new Set(e);for(const o of e){const e=t.get(o);e&&0!==e.length||(r.delete(o),n=!0)}return n?r:e})},3e3);return()=>clearInterval(e)},[]);const O=W.useMemo(()=>n.filter(e=>!e.archived),[n]),A=W.useMemo(()=>n.filter(e=>e.archived),[n]),D=W.useMemo(()=>Array.from(new Set(n.flatMap(e=>e.tags??[]))),[n]),[I,F]=W.useState([]),$=W.useMemo(()=>0===I.length?O:O.filter(e=>I.some(t=>{var n;return null==(n=e.tags)?void 0:n.includes(t)})),[O,I]),[z,V]=W.useState(!1),U=W.useCallback(async()=>{if(!z){V(!0);try{const t=await wE(),n=t.results.filter(e=>e.ok).length,r=t.results.filter(e=>e.skipped).length,o=t.total-n-r;eL.success(e("dashboard.sync_done_toast",{ok:n,skipped:r,failed:o}))}catch(RO){eL.error(e("dashboard.sync_failed_toast",{message:RO.message}))}finally{V(!1)}}},[z]),{order:B,setOrder:H,applyOrder:q}=RL(),[G,K]=W.useState(null),[Y,X]=W.useState(null),Q=W.useMemo(()=>q($),[$,q]),J=W.useCallback(e=>K(e),[]),Z=W.useCallback(()=>{K(null),X(null)},[]),te=W.useCallback((e,t)=>{e.preventDefault(),X(t)},[]),ne=W.useCallback((e,t,n)=>{if(e.preventDefault(),!n||n===t)return void X(null);const r=Q.map(e=>e.id),o=B.length?[...B]:r;for(const i of r)o.includes(i)||o.push(i);const a=o.indexOf(n),s=o.indexOf(t);if(-1===a||-1===s)return K(null),void X(null);o.splice(a,1),o.splice(s,0,n),H(o),K(null),X(null)},[Q,B,H]),re={onDelete:e=>{(async e=>{try{await Qj(e),c(e)}catch(RO){eL.error(RO instanceof Error?RO.message:"Failed to delete project")}})(e)},onArchive:e=>{(async e=>{try{const t=await Zj(e);l(t)}catch(RO){eL.error(RO instanceof Error?RO.message:"Failed to archive project")}})(e)},onUnarchive:e=>{(async e=>{try{const t=await tC(e);l(t)}catch(RO){eL.error(RO instanceof Error?RO.message:"Failed to restore project")}})(e)},onUpdated:l},[oe,ae]=W.useState(!1),se=[{key:"skillhub",icon:bP,label:e("dashboard.skillhub_title"),run:()=>t("/skillhub")},...N?[{key:"memories",icon:$E,label:e("dashboard.memories_title"),run:()=>t("/memories")}]:[],{key:"mobile",icon:yP,label:e("dashboard.mobile_title"),run:()=>t("/mobile")},{key:"settings",icon:gP,label:e("dashboard.settings_title"),run:()=>t("/settings")},{key:"fullscreen",icon:w?iP:aP,label:e(w?"dashboard.fullscreen_exit":"dashboard.fullscreen_enter"),run:()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()}}];return ee.jsxs("div",{className:"min-h-screen bg-background",children:[ee.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:ee.jsxs("div",{className:"w-full px-4 sm:px-6 h-14 flex items-center gap-3",children:[ee.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[ee.jsx(wP,{className:"h-5 w-5"}),ee.jsxs("div",{children:[ee.jsx("span",{className:"font-semibold text-lg leading-tight block",children:"CC Web"}),ee.jsx("span",{className:"text-[10px] text-muted-foreground leading-none",children:tO})]})]}),ee.jsxs("div",{className:"hidden md:flex items-center gap-4 pl-2 min-w-0",children:[ee.jsx(DL,{}),ee.jsx(VL,{className:"hidden lg:flex"})]}),ee.jsx("div",{className:"flex-1"}),ee.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[ee.jsx("div",{className:"hidden lg:flex items-center gap-0.5",children:se.map(e=>ee.jsx(yj,{variant:"ghost",size:"sm",onClick:e.run,title:e.label,children:ee.jsx(e.icon,{className:"h-4 w-4"})},e.key))}),ee.jsxs(VR,{open:oe,onOpenChange:ae,children:[ee.jsx(UR,{asChild:!0,children:ee.jsx(yj,{variant:"ghost",size:"sm",className:"lg:hidden",title:e("dashboard.more"),children:ee.jsx(dP,{className:"h-4 w-4"})})}),ee.jsx(BR,{align:"end",className:"w-44 p-1",children:se.map(e=>ee.jsxs("button",{onClick:()=>{e.run(),ae(!1)},className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors hover:bg-accent",children:[ee.jsx(e.icon,{className:"h-4 w-4 text-muted-foreground"}),e.label]},e.key))})]}),ee.jsx(yj,{variant:"ghost",size:"sm",onClick:()=>E(!C),title:e(C?"dashboard.monitor_title_grid":"dashboard.monitor_title_monitor"),className:XS(C&&"bg-accent font-medium"),children:C?ee.jsx(nP,{className:"h-4 w-4"}):ee.jsx(cP,{className:"h-4 w-4"})}),ee.jsx(rO,{}),ee.jsx("span",{className:"hidden sm:inline-flex",children:ee.jsx(eO,{})}),ee.jsx(KL,{}),ee.jsxs(yj,{variant:"ghost",size:"sm",onClick:()=>{sessionStorage.removeItem("ccweb_claudemem_available"),u(),t("/login")},title:e("dashboard.logout"),children:[ee.jsx(oP,{className:"h-4 w-4 sm:mr-2"}),ee.jsx("span",{className:"hidden sm:inline",children:e("dashboard.logout")})]})]})]})}),C&&ee.jsx("div",{className:"flex-1 min-h-0",children:ee.jsx(dO,{projects:n,projectStatuses:P,activeProjectIds:m})}),!C&&ee.jsxs("main",{className:"max-w-6xl mx-auto px-4 py-8",children:[ee.jsxs("div",{className:"flex items-center justify-between mb-6",children:[ee.jsxs("div",{children:[ee.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Projects"}),ee.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Each project runs Claude CLI in a dedicated terminal session."})]}),ee.jsxs("div",{className:"flex gap-2",children:[ee.jsxs(yj,{variant:"outline",onClick:()=>{U()},disabled:z,title:e("dashboard.sync_all_title"),children:[z?ee.jsx(rP,{className:"h-4 w-4 mr-2 animate-spin"}):ee.jsx(KE,{className:"h-4 w-4 mr-2"}),e("dashboard.sync_all")]}),ee.jsxs(yj,{variant:"outline",onClick:()=>h(!0),children:[ee.jsx(qE,{className:"h-4 w-4 mr-2"}),"Open Project"]}),ee.jsxs(yj,{onClick:()=>p(!0),children:[ee.jsx(fP,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),r&&!a&&ee.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4",children:Array.from({length:3}).map((e,t)=>ee.jsx(WR,{className:"h-32 rounded-xl"},t))}),o&&ee.jsx("div",{className:"text-center text-destructive py-12",children:o}),a&&!r&&!o&&0===n.length&&ee.jsxs("div",{className:"text-center py-20",children:[ee.jsx(wP,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),ee.jsx("h2",{className:"text-lg font-semibold mb-2",children:"No projects yet"}),ee.jsx("p",{className:"text-muted-foreground text-sm mb-6",children:"Create a new project or open an existing one."}),ee.jsxs("div",{className:"flex gap-2 justify-center",children:[ee.jsxs(yj,{variant:"outline",onClick:()=>h(!0),children:[ee.jsx(qE,{className:"h-4 w-4 mr-2"}),"Open Project"]}),ee.jsxs(yj,{onClick:()=>p(!0),children:[ee.jsx(fP,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),!r&&!o&&D.length>0&&ee.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-4",children:[D.map(e=>ee.jsxs("button",{onClick:()=>F(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),className:XS("px-2 py-0.5 rounded-full text-xs border transition-colors",I.includes(e)?"bg-primary text-primary-foreground border-transparent font-medium":"bg-muted text-muted-foreground border-border hover:border-muted-foreground/40"),children:["#",e]},e)),I.length>0&&ee.jsx("button",{onClick:()=>F([]),className:"px-2 py-0.5 rounded-full text-xs text-muted-foreground hover:text-foreground transition-colors",children:e("dashboard.tags_clear")})]}),!r&&!o&&Q.length>0&&ee.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4",children:Q.map((e,t)=>ee.jsx(tS.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{...TE.slow,delay:Math.min(.05*t,.3),ease:"easeOut"},draggable:!0,onDragStart:()=>J(e.id),onDragOver:t=>te(t,e.id),onDrop:t=>ne(t,e.id,G),onDragEnd:Z,style:{opacity:G===e.id?.4:1,cursor:"grab"},className:XS(Y===e.id&&G!==e.id&&"ring-2 ring-ring/50 rounded-xl"),children:ee.jsx(mL,{project:e,active:m.has(e.id),statusStack:y.get(e.id)??[],syncStatus:R[e.id],...re})},e.id))}),!r&&!o&&A.length>0&&ee.jsxs("div",{className:"mt-10",children:[ee.jsxs("button",{className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors mb-4 group",onClick:()=>j(e=>!e),children:[ee.jsx(tS.span,{animate:{rotate:S?90:0},transition:TE.default,children:ee.jsx(VE,{className:"h-4 w-4"})}),ee.jsx("span",{className:"font-medium",children:"Archived"}),ee.jsx("span",{className:"text-xs bg-muted rounded-full px-2 py-0.5",children:A.length})]}),ee.jsx(Iw,{children:S&&ee.jsx(tS.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:TE.slow,className:"overflow-hidden",children:ee.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4",children:A.map(e=>ee.jsx(mL,{project:e,active:!1,...re},e.id))})})})]}),ee.jsx(BL,{})]}),ee.jsx(xL,{open:d,onOpenChange:p,onCreated:e=>{i(e)}}),ee.jsx(wL,{open:f,onOpenChange:h,onOpened:e=>{i(e)}})]})}class fO extends H.Component{constructor(){super(...arguments),t(this,"state",{hasError:!1,error:null}),t(this,"handleReset",()=>{var e,t;this.setState({hasError:!1,error:null}),null==(t=(e=this.props).onReset)||t.call(e)})}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error("[ErrorBoundary]",e,t.componentStack),eL.error(e.message||"Something went wrong")}render(){return this.state.hasError?this.props.fallback?this.props.fallback:ee.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 p-4 text-sm text-muted-foreground",children:[ee.jsx("p",{children:"出错了"}),ee.jsx("button",{onClick:this.handleReset,className:"px-3 py-1.5 text-xs rounded-md border border-border hover:bg-muted transition-colors",children:"重新加载"})]}):this.props.children}}function hO({plugin:e,onConfigChange:t,onClose:n}){const{float:r,userConfig:o}=e,[a,s]=W.useState(()=>{var e,t;return{x:(null==(e=o.floatPosition)?void 0:e.x)??.5*window.innerWidth-r.defaultWidth/2,y:(null==(t=o.floatPosition)?void 0:t.y)??.3*window.innerHeight}}),[i,l]=W.useState(()=>{var e,t;return{w:(null==(e=o.floatSize)?void 0:e.w)??r.defaultWidth,h:(null==(t=o.floatSize)?void 0:t.h)??r.defaultHeight}}),[c,u]=W.useState(!1),[d,p]=W.useState(100),f=W.useRef(null),h=W.useRef(null),[m,g]=W.useState(null),v=W.useRef(null);W.useEffect(()=>{v.current=m},[m]),W.useEffect(()=>{let t=!1,n=null;const r=async(o=0)=>{try{const n=$j(),r={"Content-Type":"application/json"};n&&(r.Authorization=`Bearer ${n}`);const o=await fetch(`/api/plugins/${e.id}/session`,{method:"POST",headers:r});if(!o.ok)throw new Error(`status ${o.status}`);const{token:a}=await o.json();t||g(a)}catch(RO){if(t)return;const s=Math.min(3e4,1e3*2**o);console.warn(`[plugin ${e.id}] session token fetch failed (${String(RO)}); retrying in ${s}ms`),n=window.setTimeout(()=>{r(o+1)},s)}};r();const o=window.setInterval(()=>{r()},63e5);return()=>{t=!0,window.clearInterval(o),null!==n&&window.clearTimeout(n)}},[e.id]);const y=W.useCallback(()=>{p(Date.now()%1e5+100)},[]),b=W.useRef(null),x=W.useCallback(n=>{n.preventDefault(),y(),b.current={sx:n.clientX,sy:n.clientY,ox:a.x,oy:a.y},h.current&&(h.current.style.pointerEvents="none");const r=e=>{if(!b.current)return;const t=Math.max(0,Math.min(window.innerWidth-100,b.current.ox+e.clientX-b.current.sx)),n=Math.max(0,Math.min(window.innerHeight-40,b.current.oy+e.clientY-b.current.sy));f.current&&(f.current.style.left=t+"px",f.current.style.top=n+"px")},o=n=>{if(!b.current)return;const a=Math.max(0,Math.min(window.innerWidth-100,b.current.ox+n.clientX-b.current.sx)),i=Math.max(0,Math.min(window.innerHeight-40,b.current.oy+n.clientY-b.current.sy));b.current=null,h.current&&(h.current.style.pointerEvents=""),s({x:a,y:i}),t(e.id,{floatPosition:{x:a,y:i}}),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",o)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",o)},[a,y,e.id,t]),w=W.useRef(null),k=W.useCallback(n=>{if(!r.resizable)return;n.preventDefault(),n.stopPropagation(),y(),w.current={sx:n.clientX,sy:n.clientY,ow:i.w,oh:i.h},h.current&&(h.current.style.pointerEvents="none");const o=r.minWidth??150,a=r.minHeight??100,s=e=>{if(!w.current)return;const t=Math.max(o,w.current.ow+e.clientX-w.current.sx),n=Math.max(a,w.current.oh+e.clientY-w.current.sy);f.current&&(f.current.style.width=t+"px",f.current.style.height=n+"px")},c=n=>{if(!w.current)return;const r=Math.max(o,w.current.ow+n.clientX-w.current.sx),i=Math.max(a,w.current.oh+n.clientY-w.current.sy);w.current=null,h.current&&(h.current.style.pointerEvents=""),l({w:r,h:i}),t(e.id,{floatSize:{w:r,h:i}}),window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",c)};window.addEventListener("mousemove",s),window.addEventListener("mouseup",c)},[i,r,y,e.id,t]);W.useEffect(()=>{const t=async t=>{var n,r,o,a,s;if(t.source!==(null==(n=h.current)?void 0:n.contentWindow))return;const{callId:i,method:l,args:c}=t.data;if(i&&l)try{const t=$j(),n=v.current,a={"Content-Type":"application/json"};let s,u;if(n&&(a["X-Plugin-Session"]=n),t&&(a.Authorization=`Bearer ${t}`),"storage:get"===l)s=`/api/plugin-bridge/storage/${e.id}`,u={method:"GET",headers:a};else if("storage:set"===l)s=`/api/plugin-bridge/storage/${e.id}`,u={method:"PUT",headers:a,body:JSON.stringify(c)};else{const t={"project:status":{path:`/api/plugin-bridge/project/status/${c.projectId}`,httpMethod:"GET"},"project:list":{path:"/api/plugin-bridge/project/list",httpMethod:"GET"},"terminal:send":{path:"/api/plugin-bridge/terminal/send",httpMethod:"POST"},"session:read":{path:`/api/plugin-bridge/session/${c.projectId}`,httpMethod:"GET"},"system:info":{path:"/api/plugin-bridge/system/info",httpMethod:"GET"}};if("backend:api"===l){const{method:t,path:n,body:r}=c;if(!n||!n.startsWith("/")||n.includes(".."))throw new Error("Invalid API path");s=`/api/plugins/${e.id}${n}`,u={method:t||"GET",headers:a},!r||"POST"!==t&&"PUT"!==t||(u.body=JSON.stringify(r))}else{const e=t[l];if(!e)throw new Error(`Unknown method: ${l}`);s=e.path,u={method:e.httpMethod,headers:a},"POST"===e.httpMethod&&(u.body=JSON.stringify(c))}}const d=await fetch(s,u),p=await d.json();null==(o=null==(r=h.current)?void 0:r.contentWindow)||o.postMessage({callId:i,result:p,error:null},window.location.origin)}catch(RO){const t=RO instanceof Error?RO.message:"Bridge error";null==(s=null==(a=h.current)?void 0:a.contentWindow)||s.postMessage({callId:i,result:null,error:t},window.location.origin)}};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[e.id]);const S=o.clickable??r.clickable.default,j=`/plugins/${e.id}/${e.float?"index.html":""}`;return ee.jsxs(tS.div,{ref:f,className:XS("fixed rounded-xl border border-border shadow-sm overflow-hidden flex flex-col","bg-background/95 backdrop-blur-sm"),style:{left:a.x,top:a.y,width:c?200:i.w,height:c?32:i.h,zIndex:d},initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.15},onMouseDown:y,children:[ee.jsxs("div",{className:"h-8 flex items-center gap-1 px-2 bg-muted/50 border-b border-border cursor-grab active:cursor-grabbing flex-shrink-0 select-none",onMouseDown:x,children:[ee.jsx(QE,{className:"h-3 w-3 text-muted-foreground/40 flex-shrink-0"}),ee.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:e.name}),ee.jsx("button",{onClick:()=>u(e=>!e),className:"p-0.5 rounded-md hover:bg-accent text-muted-foreground/60 hover:text-foreground transition-colors",children:ee.jsx(lP,{className:"h-3 w-3"})}),ee.jsx("button",{onClick:()=>n(e.id),className:"p-0.5 rounded hover:bg-red-500/20 text-muted-foreground/60 hover:text-red-400 transition-colors",children:ee.jsx(CP,{className:"h-3 w-3"})})]}),!c&&ee.jsxs("div",{className:"flex-1 min-h-0 relative",children:[m?ee.jsx("iframe",{ref:h,src:j,sandbox:"allow-scripts allow-same-origin",className:"w-full h-full border-0",style:{pointerEvents:S?"auto":"none"}}):ee.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-muted-foreground",children:"Loading…"}),r.resizable&&ee.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 cursor-se-resize",onMouseDown:k,children:ee.jsxs("svg",{viewBox:"0 0 12 12",className:"w-3 h-3 text-muted-foreground/30",children:[ee.jsx("path",{d:"M11 1v10H1",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),ee.jsx("path",{d:"M11 5v6H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})]})})]})]})}function mO({plugins:e,onPluginsChange:t,onClose:n}){const r=W.useCallback(async(e,n)=>{t(t=>t.map(t=>t.id===e?{...t,userConfig:{...t.userConfig,...n}}:t));try{await fE(e,n)}catch{}},[t]);return 0===e.length?null:ee.jsx(Iw,{children:e.map(e=>ee.jsx(hO,{plugin:e,onConfigChange:r,onClose:n},e.id))})}function gO({onTogglePlugin:e,activeIds:t}){const[n,r]=W.useState([]);return W.useEffect(()=>{uE().then(e=>r(e.filter(e=>e.enabled))).catch(()=>r([]))},[]),W.useEffect(()=>{const e=()=>{uE().then(e=>r(e.filter(e=>e.enabled))).catch(()=>{})};return window.addEventListener("focus",e),()=>window.removeEventListener("focus",e)},[]),0===n.length?null:ee.jsx("div",{className:"fixed top-14 left-1/2 -translate-x-1/2 z-40 pointer-events-none",children:ee.jsx(tS.div,{className:"pointer-events-auto flex items-center gap-1 px-2 py-1 rounded-full bg-background/60 backdrop-blur-md border border-border/50 shadow-md",initial:{opacity:0,y:-8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:n.map(n=>{const r=t.has(n.id),o=n.name.slice(0,2);return ee.jsxs(tS.button,{onClick:()=>e(n),className:XS("relative flex items-center justify-center w-7 h-7 rounded-full text-[10px] font-medium transition-colors",r?"bg-blue-500/20 text-blue-400":"text-muted-foreground/70 hover:text-foreground hover:bg-muted/80"),whileHover:{scale:1.12},whileTap:{scale:.92},title:n.name+(n.description?` — ${n.description}`:""),children:[o,ee.jsx(Iw,{children:r&&ee.jsx(tS.span,{className:"absolute -bottom-0.5 left-1/2 -translate-x-1/2 h-1 w-1 rounded-full bg-blue-400",initial:{scale:0},animate:{scale:1},exit:{scale:0}})})]},n.id)})})})}const vO=H.lazy(()=>pd(()=>import("./ProjectPage-5iSt8qJ0.js").then(e=>e.P),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(e=>({default:e.ProjectPage}))),yO=H.lazy(()=>pd(()=>import("./SettingsPage-DB0DKGyP.js"),__vite__mapDeps([14,9,10,4,3,8,6])).then(e=>({default:e.SettingsPage}))),bO=H.lazy(()=>pd(()=>import("./SkillHubPage-ldsS5_lE.js"),__vite__mapDeps([15,11,3])).then(e=>({default:e.SkillHubPage}))),xO=H.lazy(()=>pd(()=>import("./ClaudeMemPage-BJXNbVri.js"),__vite__mapDeps([16,10,4,3,11,5])).then(e=>({default:e.ClaudeMemPage}))),wO=H.lazy(()=>pd(()=>import("./ProjectSettingsPage-CHpaFSH9.js"),__vite__mapDeps([17,12,8])).then(e=>({default:e.ProjectSettingsPage}))),kO=H.lazy(()=>pd(()=>import("./MobilePage-xWYQCVpe.js"),__vite__mapDeps([18,2,3,4,5,6,7])).then(e=>({default:e.MobilePage})));function SO(){return ee.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:ee.jsx("span",{className:"text-muted-foreground text-sm",children:"Loading…"})})}function jO({children:e}){const[t,n]=W.useState(!1),r=Oj(e=>e.token),o=Oj(e=>e.setToken);return W.useEffect(()=>{r?n(!0):Bj()?Wj().then(e=>o(e)).catch(()=>{}).finally(()=>n(!0)):n(!0)},[]),t||r?r?ee.jsx(ee.Fragment,{children:e}):ee.jsx(xp,{to:"/login",replace:!0}):null}const CO=window.matchMedia("(pointer: coarse)").matches&&window.innerWidth<768;function EO(){const[e,t]=W.useState([]),[n,r]=W.useState(()=>{try{return new Set(JSON.parse(localStorage.getItem("cc_plugin_open")||"[]"))}catch{return new Set}}),o=ip();W.useEffect(()=>{uE().then(t).catch(()=>t([]))},[]);const a=W.useCallback(e=>{r(t=>{const n=new Set(t);n.has(e.id)?n.delete(e.id):n.add(e.id);try{localStorage.setItem("cc_plugin_open",JSON.stringify([...n]))}catch{}return n})},[]),s=W.useCallback(e=>{r(t=>{const n=new Set(t);n.delete(e);try{localStorage.setItem("cc_plugin_open",JSON.stringify([...n]))}catch{}return n})},[]),i=function(e){if("/"===e||"/dashboard"===e)return{type:"dashboard"};const t=e.match(/^\/projects?\/([^/]+)/);return t?{type:"project",projectId:t[1]}:{type:"other"}}(o.pathname),l=e.filter(e=>{if(!e.enabled||!n.has(e.id))return!1;switch(e.userConfig.scope??e.float.scope.default){case"global":return!0;case"dashboard":return"dashboard"===i.type;case"project":return"project"===i.type;case"project:specific":return"project"===i.type&&(e.userConfig.projectIds??[]).includes(i.projectId??"");default:return!1}}),c="/login"===o.pathname,u="/mobile"===o.pathname;return ee.jsxs(ee.Fragment,{children:[!c&&!u&&!CO&&ee.jsx(gO,{onTogglePlugin:a,activeIds:n}),ee.jsx(mO,{plugins:l,onPluginsChange:t,onClose:s})]})}function PO(){const e=Oj(e=>e.token);return W.useEffect(()=>{if(!e)return;let t=!1;return HC().then(({language:e})=>{if(!t&&e&&bh.includes(e)&&kf.language!==e){try{localStorage.setItem(xh,e)}catch{}kf.changeLanguage(e)}}).catch(()=>{}),()=>{t=!0}},[e]),null}function _O({children:e}){const t=ip();return CO&&"/"===t.pathname?ee.jsx(xp,{to:"/mobile",replace:!0}):ee.jsx(ee.Fragment,{children:e})}function NO(){return ee.jsx(qL,{children:ee.jsxs(uL,{children:[ee.jsx(lL,{richColors:!0,position:"bottom-right"}),ee.jsx(JL,{}),ee.jsx(ZL,{}),ee.jsx(fO,{children:ee.jsxs(Pp,{children:[ee.jsx(PO,{}),ee.jsx(EO,{}),ee.jsx(_O,{children:ee.jsx(W.Suspense,{fallback:ee.jsx(SO,{}),children:ee.jsxs(Sp,{children:[ee.jsx(wp,{path:"/login",element:ee.jsx(RE,{})}),ee.jsx(wp,{path:"/",element:ee.jsx(jO,{children:ee.jsx(pO,{})})}),ee.jsx(wp,{path:"/projects/:id/settings",element:ee.jsx(jO,{children:ee.jsx(wO,{})})}),ee.jsx(wp,{path:"/projects/:id",element:ee.jsx(jO,{children:ee.jsx(vO,{})})}),ee.jsx(wp,{path:"/settings",element:ee.jsx(jO,{children:ee.jsx(yO,{})})}),ee.jsx(wp,{path:"/skillhub",element:ee.jsx(jO,{children:ee.jsx(bO,{})})}),ee.jsx(wp,{path:"/memories",element:ee.jsx(jO,{children:ee.jsx(xO,{})})}),ee.jsx(wp,{path:"/mobile",element:ee.jsx(jO,{children:ee.jsx(kO,{})})}),ee.jsx(wp,{path:"*",element:ee.jsx(xp,{to:"/",replace:!0})})]})})})]})})]})})}te.createRoot(document.getElementById("root")).render(ee.jsx(H.StrictMode,{children:ee.jsx(NO,{})}));export{zM as $,Iw as A,yj as B,VE as C,BE as D,WE as E,qE as F,XC as G,QC as H,bj as I,JC as J,rE as K,kP as L,lP as M,oE as N,aE as O,pP as P,AE as Q,H as R,Nj as S,SP as T,rP as U,LM as V,DM as W,CP as X,IM as Y,$M as Z,pd as _,GL as a,DL as a$,jj as a0,FM as a1,Lj as a2,oj as a3,DP as a4,dT as a5,pT as a6,_P as a7,YN as a8,gT as a9,pC as aA,gC as aB,fC as aC,vC as aD,hC as aE,yC as aF,bC as aG,xC as aH,IE as aI,EP as aJ,bP as aK,cj as aL,Xf as aM,cp as aN,EL as aO,Dj as aP,qR as aQ,eO as aR,KL as aS,KE as aT,kE as aU,xE as aV,eC as aW,Jj as aX,DE as aY,FE as aZ,jL as a_,mT as aa,aj as ab,PP as ac,OP as ad,TT as ae,AP as af,qP as ag,vR as ah,QP as ai,UP as aj,fT as ak,hT as al,vP as am,uC as an,sC as ao,nC as ap,XE as aq,UL as ar,cC as as,aC as at,rC as au,iC as av,oC as aw,lC as ax,mC as ay,wC as az,FC as b,lE as b$,HE as b0,Gf as b1,o as b2,ld as b3,OM as b4,AM as b5,NM as b6,up as b7,aO as b8,wP as b9,MC as bA,$E as bB,o_ as bC,CE as bD,EE as bE,Oj as bF,CL as bG,RL as bH,rO as bI,gP as bJ,oP as bK,cP as bL,PL as bM,PE as bN,mE as bO,lO as bP,cE as bQ,vL as bR,_E as bS,mP as bT,PC as bU,pb as bV,hb as bW,db as bX,r as bY,gE as bZ,jP as b_,ST as ba,qN as bb,vE as bc,yE as bd,bE as be,wE as bf,SE as bg,SC as bh,CC as bi,jC as bj,bh as bk,xh as bl,qC as bm,Mp as bn,XL as bo,GC as bp,KC as bq,i_ as br,uE as bs,dE as bt,pE as bu,hE as bv,kC as bw,dC as bx,TC as by,RC as bz,LE as c,sE as c0,cO as c1,Mj as c2,iE as c3,AC as c4,rS as c5,a as c6,NE as c7,XS as d,iP as e,aP as f,$j as g,OC as h,Tj as i,ee as j,Fj as k,LC as l,hP as m,zC as n,DC as o,YE as p,tS as q,W as r,Rj as s,eL as t,pL as u,YC as v,$C as w,ZC as x,zE as y,fP as z};
75
+ */const LE=(e,t)=>{const n=W.forwardRef(({color:n="currentColor",size:r=24,strokeWidth:o=2,absoluteStrokeWidth:a,className:s="",children:i,...l},c)=>{return W.createElement("svg",{ref:c,...ME,width:r,height:r,stroke:n,strokeWidth:a?24*Number(o)/Number(r):o,className:["lucide",`lucide-${u=e,u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim()}`,s].join(" "),...l},[...t.map(([e,t])=>W.createElement(e,t)),...Array.isArray(i)?i:[i]]);var u});return n.displayName=`${e}`,n},OE=LE("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]),AE=LE("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]),DE=LE("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),IE=LE("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),FE=LE("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),$E=LE("Brain",[["path",{d:"M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 1.98-3A2.5 2.5 0 0 1 9.5 2Z",key:"1mhkh5"}],["path",{d:"M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-1.98-3A2.5 2.5 0 0 0 14.5 2Z",key:"1d6s00"}]]),zE=LE("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),VE=LE("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),UE=LE("Cpu",[["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"9",y:"9",width:"6",height:"6",key:"o3kz5p"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]),BE=LE("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]),WE=LE("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),HE=LE("File",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}]]),qE=LE("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),GE=LE("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),KE=LE("FolderSync",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v.5",key:"1dkoa9"}],["path",{d:"M12 10v4h4",key:"1czhmt"}],["path",{d:"m12 14 1.535-1.605a5 5 0 0 1 8 1.5",key:"lvuxfi"}],["path",{d:"M22 22v-4h-4",key:"1ewp4q"}],["path",{d:"m22 18-1.535 1.605a5 5 0 0 1-8-1.5",key:"14ync0"}]]),YE=LE("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),XE=LE("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]),QE=LE("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]),JE=LE("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),ZE=LE("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),eP=LE("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]),tP=LE("KeyRound",[["path",{d:"M2 18v3c0 .6.4 1 1 1h4v-3h3v-3h2l1.4-1.4a6.5 6.5 0 1 0-4-4Z",key:"167ctg"}],["circle",{cx:"16.5",cy:"7.5",r:".5",key:"1kog09"}]]),nP=LE("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]),rP=LE("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),oP=LE("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]),aP=LE("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]),sP=LE("MemoryStick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]),iP=LE("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]),lP=LE("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),cP=LE("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),uP=LE("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),dP=LE("MoreHorizontal",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]),pP=LE("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),fP=LE("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),hP=LE("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),mP=LE("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]),gP=LE("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),vP=LE("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),yP=LE("ShieldAlert",[["path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10",key:"1irkt0"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),bP=LE("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]),xP=LE("Sparkles",[["path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z",key:"17u4zn"}],["path",{d:"M5 3v4",key:"bklmnn"}],["path",{d:"M19 17v4",key:"iiml17"}],["path",{d:"M3 5h4",key:"nem4j1"}],["path",{d:"M17 19h4",key:"lbex7p"}]]),wP=LE("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),kP=LE("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]),SP=LE("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]),jP=LE("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),CP=LE("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),EP=LE("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),PP=LE("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]);function _P(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(null==e||e(r),!1===n||!r.defaultPrevented)return null==t?void 0:t(r)}}function NP(e,t=[]){let n=[];const r=()=>{const t=n.map(e=>W.createContext(e));return function(n){const r=(null==n?void 0:n[e])||t;return W.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return r.scopeName=e,[function(t,r){const o=W.createContext(r),a=n.length;n=[...n,r];const s=t=>{var n;const{scope:r,children:s,...i}=t,l=(null==(n=null==r?void 0:r[e])?void 0:n[a])||o,c=W.useMemo(()=>i,Object.values(i));return ee.jsx(l.Provider,{value:c,children:s})};return s.displayName=t+"Provider",[s,function(n,s){var i;const l=(null==(i=null==s?void 0:s[e])?void 0:i[a])||o,c=W.useContext(l);if(c)return c;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},TP(r,...t)]}function TP(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const r=n.reduce((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]}),{});return W.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function RP(e){const t=MP(e),n=W.forwardRef((e,n)=>{const{children:r,...o}=e,a=W.Children.toArray(r),s=a.find(OP);if(s){const e=s.props.children,r=a.map(t=>t===s?W.Children.count(e)>1?W.Children.only(null):W.isValidElement(e)?e.props.children:null:t);return ee.jsx(t,{...o,ref:n,children:W.isValidElement(e)?W.cloneElement(e,void 0,r):null})}return ee.jsx(t,{...o,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function MP(e){const t=W.forwardRef((e,t)=>{const{children:n,...r}=e;if(W.isValidElement(n)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{const t=a(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==W.Fragment&&(o.ref=t?oj(t,e):e),W.cloneElement(n,o)}return W.Children.count(n)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var LP=Symbol("radix.slottable");function OP(e){return W.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===LP}var AP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const n=RP(`Primitive.${t}`),r=W.forwardRef((e,r)=>{const{asChild:o,...a}=e,s=o?n:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),ee.jsx(s,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function DP(e,t){e&&ld.flushSync(()=>e.dispatchEvent(t))}function IP(e){const t=W.useRef(e);return W.useEffect(()=>{t.current=e}),W.useMemo(()=>(...e)=>{var n;return null==(n=t.current)?void 0:n.call(t,...e)},[])}var FP,$P="dismissableLayer.update",zP="dismissableLayer.pointerDownOutside",VP="dismissableLayer.focusOutside",UP=W.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),BP=W.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:s,onDismiss:i,...l}=e,c=W.useContext(UP),[u,d]=W.useState(null),p=(null==u?void 0:u.ownerDocument)??(null==globalThis?void 0:globalThis.document),[,f]=W.useState({}),h=aj(t,e=>d(e)),m=Array.from(c.layers),[g]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),v=m.indexOf(g),y=u?m.indexOf(u):-1,b=c.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,w=function(e,t=(null==globalThis?void 0:globalThis.document)){const n=IP(e),r=W.useRef(!1),o=W.useRef(()=>{});return W.useEffect(()=>{const e=e=>{if(e.target&&!r.current){let r=function(){HP(zP,n,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}(e=>{const t=e.target,n=[...c.branches].some(e=>e.contains(t));x&&!n&&(null==o||o(e),null==s||s(e),e.defaultPrevented||null==i||i())},p),k=function(e,t=(null==globalThis?void 0:globalThis.document)){const n=IP(e),r=W.useRef(!1);return W.useEffect(()=>{const e=e=>{if(e.target&&!r.current){HP(VP,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}(e=>{const t=e.target;[...c.branches].some(e=>e.contains(t))||(null==a||a(e),null==s||s(e),e.defaultPrevented||null==i||i())},p);return function(e,t=(null==globalThis?void 0:globalThis.document)){const n=IP(e);W.useEffect(()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[n,t])}(e=>{y===c.layers.size-1&&(null==r||r(e),!e.defaultPrevented&&i&&(e.preventDefault(),i()))},p),W.useEffect(()=>{if(u)return n&&(0===c.layersWithOutsidePointerEventsDisabled.size&&(FP=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),WP(),()=>{n&&1===c.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=FP)}},[u,p,n,c]),W.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),WP())},[u,c]),W.useEffect(()=>{const e=()=>f({});return document.addEventListener($P,e),()=>document.removeEventListener($P,e)},[]),ee.jsx(AP.div,{...l,ref:h,style:{pointerEvents:b?x?"auto":"none":void 0,...e.style},onFocusCapture:_P(e.onFocusCapture,k.onFocusCapture),onBlurCapture:_P(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:_P(e.onPointerDownCapture,w.onPointerDownCapture)})});BP.displayName="DismissableLayer";function WP(){const e=new CustomEvent($P);document.dispatchEvent(e)}function HP(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?DP(o,a):o.dispatchEvent(a)}W.forwardRef((e,t)=>{const n=W.useContext(UP),r=W.useRef(null),o=aj(t,r);return W.useEffect(()=>{const e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),ee.jsx(AP.div,{...e,ref:o})}).displayName="DismissableLayerBranch";var qP=0;function GP(){W.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??KP()),document.body.insertAdjacentElement("beforeend",e[1]??KP()),qP++,()=>{1===qP&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),qP--}},[])}function KP(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var YP="focusScope.autoFocusOnMount",XP="focusScope.autoFocusOnUnmount",QP={bubbles:!1,cancelable:!0},JP=W.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...s}=e,[i,l]=W.useState(null),c=IP(o),u=IP(a),d=W.useRef(null),p=aj(t,e=>l(e)),f=W.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;W.useEffect(()=>{if(r){let e=function(e){if(f.paused||!i)return;const t=e.target;i.contains(t)?d.current=t:n_(d.current,{select:!0})},t=function(e){if(f.paused||!i)return;const t=e.relatedTarget;null!==t&&(i.contains(t)||n_(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&n_(i)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return i&&r.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[r,i,f.paused]),W.useEffect(()=>{if(i){r_.add(f);const t=document.activeElement;if(!i.contains(t)){const n=new CustomEvent(YP,QP);i.addEventListener(YP,c),i.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(n_(r,{select:t}),document.activeElement!==n)return}((e=ZP(i),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&n_(i))}return()=>{i.removeEventListener(YP,c),setTimeout(()=>{const e=new CustomEvent(XP,QP);i.addEventListener(XP,u),i.dispatchEvent(e),e.defaultPrevented||n_(t??document.body,{select:!0}),i.removeEventListener(XP,u),r_.remove(f)},0)}}var e},[i,c,u,f]);const h=W.useCallback(e=>{if(!n&&!r)return;if(f.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,o=document.activeElement;if(t&&o){const t=e.currentTarget,[r,a]=function(e){const t=ZP(e),n=e_(t,e),r=e_(t.reverse(),e);return[n,r]}(t);r&&a?e.shiftKey||o!==a?e.shiftKey&&o===r&&(e.preventDefault(),n&&n_(a,{select:!0})):(e.preventDefault(),n&&n_(r,{select:!0})):o===t&&e.preventDefault()}},[n,r,f.paused]);return ee.jsx(AP.div,{tabIndex:-1,...s,ref:p,onKeyDown:h})});function ZP(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function e_(e,t){for(const n of e)if(!t_(n,{upTo:t}))return n}function t_(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function n_(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}JP.displayName="FocusScope";var r_=function(){let e=[];return{add(t){const n=e[0];t!==n&&(null==n||n.pause()),e=o_(e,t),e.unshift(t)},remove(t){var n;e=o_(e,t),null==(n=e[0])||n.resume()}}}();function o_(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var a_=(null==globalThis?void 0:globalThis.document)?W.useLayoutEffect:()=>{},s_=q[" useId ".trim().toString()]||(()=>{}),i_=0;function l_(e){const[t,n]=W.useState(s_());return a_(()=>{n(e=>e??String(i_++))},[e]),e||(t?`radix-${t}`:"")}const c_=["top","right","bottom","left"],u_=Math.min,d_=Math.max,p_=Math.round,f_=Math.floor,h_=e=>({x:e,y:e}),m_={left:"right",right:"left",bottom:"top",top:"bottom"};function g_(e,t,n){return d_(e,u_(t,n))}function v_(e,t){return"function"==typeof e?e(t):e}function y_(e){return e.split("-")[0]}function b_(e){return e.split("-")[1]}function x_(e){return"x"===e?"y":"x"}function w_(e){return"y"===e?"height":"width"}function k_(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function S_(e){return x_(k_(e))}function j_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const C_=["left","right"],E_=["right","left"],P_=["top","bottom"],__=["bottom","top"];function N_(e,t,n,r){const o=b_(e);let a=function(e,t,n){switch(e){case"top":case"bottom":return n?t?E_:C_:t?C_:E_;case"left":case"right":return t?P_:__;default:return[]}}(y_(e),"start"===n,r);return o&&(a=a.map(e=>e+"-"+o),t&&(a=a.concat(a.map(j_)))),a}function T_(e){const t=y_(e);return m_[t]+e.slice(t.length)}function R_(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function M_(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function L_(e,t,n){let{reference:r,floating:o}=e;const a=k_(t),s=S_(t),i=w_(s),l=y_(t),c="y"===a,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[i]/2-o[i]/2;let f;switch(l){case"top":f={x:u,y:r.y-o.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch(b_(t)){case"start":f[s]-=p*(n&&c?-1:1);break;case"end":f[s]+=p*(n&&c?-1:1)}return f}async function O_(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:a,rects:s,elements:i,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=v_(t,e),h=R_(f),m=i[p?"floating"===d?"reference":"floating":d],g=M_(await a.getClippingRect({element:null==(n=await(null==a.isElement?void 0:a.isElement(m)))||n?m:m.contextElement||await(null==a.getDocumentElement?void 0:a.getDocumentElement(i.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,y=await(null==a.getOffsetParent?void 0:a.getOffsetParent(i.floating)),b=await(null==a.isElement?void 0:a.isElement(y))&&await(null==a.getScale?void 0:a.getScale(y))||{x:1,y:1},x=M_(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:v,offsetParent:y,strategy:l}):v);return{top:(g.top-x.top+h.top)/b.y,bottom:(x.bottom-g.bottom+h.bottom)/b.y,left:(g.left-x.left+h.left)/b.x,right:(x.right-g.right+h.right)/b.x}}function A_(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function D_(e){return c_.some(t=>e[t]>=0)}const I_=new Set(["left","top"]);function F_(){return"undefined"!=typeof window}function $_(e){return U_(e)?(e.nodeName||"").toLowerCase():"#document"}function z_(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function V_(e){var t;return null==(t=(U_(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function U_(e){return!!F_()&&(e instanceof Node||e instanceof z_(e).Node)}function B_(e){return!!F_()&&(e instanceof Element||e instanceof z_(e).Element)}function W_(e){return!!F_()&&(e instanceof HTMLElement||e instanceof z_(e).HTMLElement)}function H_(e){return!(!F_()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof z_(e).ShadowRoot)}function q_(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=nN(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==o&&"contents"!==o}function G_(e){return/^(table|td|th)$/.test($_(e))}function K_(e){try{if(e.matches(":popover-open"))return!0}catch(t){}try{return e.matches(":modal")}catch(t){return!1}}const Y_=/transform|translate|scale|rotate|perspective|filter/,X_=/paint|layout|strict|content/,Q_=e=>!!e&&"none"!==e;let J_;function Z_(e){const t=B_(e)?nN(e):e;return Q_(t.transform)||Q_(t.translate)||Q_(t.scale)||Q_(t.rotate)||Q_(t.perspective)||!eN()&&(Q_(t.backdropFilter)||Q_(t.filter))||Y_.test(t.willChange||"")||X_.test(t.contain||"")}function eN(){return null==J_&&(J_="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),J_}function tN(e){return/^(html|body|#document)$/.test($_(e))}function nN(e){return z_(e).getComputedStyle(e)}function rN(e){return B_(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function oN(e){if("html"===$_(e))return e;const t=e.assignedSlot||e.parentNode||H_(e)&&e.host||V_(e);return H_(t)?t.host:t}function aN(e){const t=oN(e);return tN(t)?e.ownerDocument?e.ownerDocument.body:e.body:W_(t)&&q_(t)?t:aN(t)}function sN(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=aN(e),a=o===(null==(r=e.ownerDocument)?void 0:r.body),s=z_(o);if(a){const e=iN(s);return t.concat(s,s.visualViewport||[],q_(o)?o:[],e&&n?sN(e):[])}return t.concat(o,sN(o,[],n))}function iN(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function lN(e){const t=nN(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=W_(e),a=o?e.offsetWidth:n,s=o?e.offsetHeight:r,i=p_(n)!==a||p_(r)!==s;return i&&(n=a,r=s),{width:n,height:r,$:i}}function cN(e){return B_(e)?e:e.contextElement}function uN(e){const t=cN(e);if(!W_(t))return h_(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:a}=lN(t);let s=(a?p_(n.width):n.width)/r,i=(a?p_(n.height):n.height)/o;return s&&Number.isFinite(s)||(s=1),i&&Number.isFinite(i)||(i=1),{x:s,y:i}}const dN=h_(0);function pN(e){const t=z_(e);return eN()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:dN}function fN(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),a=cN(e);let s=h_(1);t&&(r?B_(r)&&(s=uN(r)):s=uN(e));const i=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==z_(e))&&t}(a,n,r)?pN(a):h_(0);let l=(o.left+i.x)/s.x,c=(o.top+i.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(a){const e=z_(a),t=r&&B_(r)?z_(r):r;let n=e,o=iN(n);for(;o&&r&&t!==n;){const e=uN(o),t=o.getBoundingClientRect(),r=nN(o),a=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=a,c+=s,n=z_(o),o=iN(n)}}return M_({width:u,height:d,x:l,y:c})}function hN(e,t){const n=rN(e).scrollLeft;return t?t.left+n:fN(V_(e)).left+n}function mN(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-hN(e,n),y:n.top+t.scrollTop}}function gN(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=z_(e),r=V_(e),o=n.visualViewport;let a=r.clientWidth,s=r.clientHeight,i=0,l=0;if(o){a=o.width,s=o.height;const e=eN();(!e||e&&"fixed"===t)&&(i=o.offsetLeft,l=o.offsetTop)}const c=hN(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),o="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(r.clientWidth-t.clientWidth-o);s<=25&&(a-=s)}else c<=25&&(a+=c);return{width:a,height:s,x:i,y:l}}(e,n);else if("document"===t)r=function(e){const t=V_(e),n=rN(e),r=e.ownerDocument.body,o=d_(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=d_(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+hN(e);const i=-n.scrollTop;return"rtl"===nN(r).direction&&(s+=d_(t.clientWidth,r.clientWidth)-o),{width:o,height:a,x:s,y:i}}(V_(e));else if(B_(t))r=function(e,t){const n=fN(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,a=W_(e)?uN(e):h_(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:o*a.x,y:r*a.y}}(t,n);else{const n=pN(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return M_(r)}function vN(e,t){const n=oN(e);return!(n===t||!B_(n)||tN(n))&&("fixed"===nN(n).position||vN(n,t))}function yN(e,t,n){const r=W_(t),o=V_(t),a="fixed"===n,s=fN(e,!0,a,t);let i={scrollLeft:0,scrollTop:0};const l=h_(0);function c(){l.x=hN(o)}if(r||!r&&!a)if(("body"!==$_(t)||q_(o))&&(i=rN(t)),r){const e=fN(t,!0,a,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&c();a&&!r&&o&&c();const u=!o||r||a?h_(0):mN(o,i);return{x:s.left+i.scrollLeft-l.x-u.x,y:s.top+i.scrollTop-l.y-u.y,width:s.width,height:s.height}}function bN(e){return"static"===nN(e).position}function xN(e,t){if(!W_(e)||"fixed"===nN(e).position)return null;if(t)return t(e);let n=e.offsetParent;return V_(e)===n&&(n=n.ownerDocument.body),n}function wN(e,t){const n=z_(e);if(K_(e))return n;if(!W_(e)){let t=oN(e);for(;t&&!tN(t);){if(B_(t)&&!bN(t))return t;t=oN(t)}return n}let r=xN(e,t);for(;r&&G_(r)&&bN(r);)r=xN(r,t);return r&&tN(r)&&bN(r)&&!Z_(r)?n:r||function(e){let t=oN(e);for(;W_(t)&&!tN(t);){if(Z_(t))return t;if(K_(t))return null;t=oN(t)}return null}(e)||n}const kN={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const a="fixed"===o,s=V_(r),i=!!t&&K_(t.floating);if(r===s||i&&a)return n;let l={scrollLeft:0,scrollTop:0},c=h_(1);const u=h_(0),d=W_(r);if((d||!d&&!a)&&(("body"!==$_(r)||q_(s))&&(l=rN(r)),d)){const e=fN(r);c=uN(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const p=!s||d||a?h_(0):mN(s,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-l.scrollTop*c.y+u.y+p.y}},getDocumentElement:V_,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[..."clippingAncestors"===n?K_(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=sN(e,[],!1).filter(e=>B_(e)&&"body"!==$_(e)),o=null;const a="fixed"===nN(e).position;let s=a?oN(e):e;for(;B_(s)&&!tN(s);){const t=nN(s),n=Z_(s);n||"fixed"!==t.position||(o=null),(a?!n&&!o:!n&&"static"===t.position&&o&&("absolute"===o.position||"fixed"===o.position)||q_(s)&&!n&&vN(e,s))?r=r.filter(e=>e!==s):o=t,s=oN(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],s=gN(t,a[0],o);let i=s.top,l=s.right,c=s.bottom,u=s.left;for(let d=1;d<a.length;d++){const e=gN(t,a[d],o);i=d_(e.top,i),l=u_(e.right,l),c=u_(e.bottom,c),u=d_(e.left,u)}return{width:l-u,height:c-i,x:u,y:i}},getOffsetParent:wN,getElementRects:async function(e){const t=this.getOffsetParent||wN,n=this.getDimensions,r=await n(e.floating);return{reference:yN(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=lN(e);return{width:t,height:n}},getScale:uN,isElement:B_,isRTL:function(e){return"rtl"===nN(e).direction}};function SN(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function jN(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:i="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=cN(e),u=o||a?[...c?sN(c):[],...t?sN(t):[]]:[];u.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),a&&e.addEventListener("resize",n)});const d=c&&i?function(e,t){let n,r=null;const o=V_(e);function a(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function s(i,l){void 0===i&&(i=!1),void 0===l&&(l=1),a();const c=e.getBoundingClientRect(),{left:u,top:d,width:p,height:f}=c;if(i||t(),!p||!f)return;const h={rootMargin:-f_(d)+"px "+-f_(o.clientWidth-(u+p))+"px "+-f_(o.clientHeight-(d+f))+"px "+-f_(u)+"px",threshold:d_(0,u_(1,l))||1};let m=!0;function g(t){const r=t[0].intersectionRatio;if(r!==l){if(!m)return s();r?s(!1,r):n=setTimeout(()=>{s(!1,1e-7)},1e3)}1!==r||SN(c,e.getBoundingClientRect())||s(),m=!1}try{r=new IntersectionObserver(g,{...h,root:o.ownerDocument})}catch(v){r=new IntersectionObserver(g,h)}r.observe(e)}(!0),a}(c,n):null;let p,f=-1,h=null;s&&(h=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&h&&t&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),n()}),c&&!l&&h.observe(c),t&&h.observe(t));let m=l?fN(e):null;return l&&function t(){const r=fN(e);m&&!SN(m,r)&&n();m=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{o&&e.removeEventListener("scroll",n),a&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const CN=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:a,placement:s,middlewareData:i}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,a=await(null==r.isRTL?void 0:r.isRTL(o.floating)),s=y_(n),i=b_(n),l="y"===k_(n),c=I_.has(s)?-1:1,u=a&&l?-1:1,d=v_(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return i&&"number"==typeof h&&(f="end"===i?-1*h:h),l?{x:f*u,y:p*c}:{x:p*c,y:f*u}}(t,e);return s===(null==(n=i.offset)?void 0:n.placement)&&null!=(r=i.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:a+l.y,data:{...l,placement:s}}}}},EN=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:a}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=v_(e,t),u={x:n,y:r},d=await a.detectOverflow(t,c),p=k_(y_(o)),f=x_(p);let h=u[f],m=u[p];if(s){const e="y"===f?"bottom":"right";h=g_(h+d["y"===f?"top":"left"],h,h-d[e])}if(i){const e="y"===p?"bottom":"right";m=g_(m+d["y"===p?"top":"left"],m,m-d[e])}const g=l.fn({...t,[f]:h,[p]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[f]:s,[p]:i}}}}}},PN=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:a,rects:s,initialPlacement:i,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...g}=v_(e,t);if(null!=(n=a.arrow)&&n.alignmentOffset)return{};const v=y_(o),y=k_(i),b=y_(i)===i,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=p||(b||!m?[T_(i)]:function(e){const t=T_(e);return[j_(e),t,j_(t)]}(i)),k="none"!==h;!p&&k&&w.push(...N_(i,m,h,x));const S=[i,...w],j=await l.detectOverflow(t,g),C=[];let E=(null==(r=a.flip)?void 0:r.overflows)||[];if(u&&C.push(j[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=b_(e),o=S_(e),a=w_(o);let s="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[a]>t.floating[a]&&(s=T_(s)),[s,T_(s)]}(o,s,x);C.push(j[e[0]],j[e[1]])}if(E=[...E,{placement:o,overflows:C}],!C.every(e=>e<=0)){var P,_;const e=((null==(P=a.flip)?void 0:P.index)||0)+1,t=S[e];if(t){if(!("alignment"===d&&y!==k_(t))||E.every(e=>k_(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:E},reset:{placement:t}}}let n=null==(_=E.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:_.placement;if(!n)switch(f){case"bestFit":{var N;const e=null==(N=E.filter(e=>{if(k){const t=k_(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:N[0];e&&(n=e);break}case"initialPlacement":n=i}if(o!==n)return{reset:{placement:n}}}return{}}}},_N=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:a,platform:s,elements:i}=t,{apply:l=()=>{},...c}=v_(e,t),u=await s.detectOverflow(t,c),d=y_(o),p=b_(o),f="y"===k_(o),{width:h,height:m}=a.floating;let g,v;"top"===d||"bottom"===d?(g=d,v=p===(await(null==s.isRTL?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(v=d,g="end"===p?"top":"bottom");const y=m-u.top-u.bottom,b=h-u.left-u.right,x=u_(m-u[g],y),w=u_(h-u[v],b),k=!t.middlewareData.shift;let S=x,j=w;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(j=b),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(S=y),k&&!p){const e=d_(u.left,0),t=d_(u.right,0),n=d_(u.top,0),r=d_(u.bottom,0);f?j=h-2*(0!==e||0!==t?e+t:d_(u.left,u.right)):S=m-2*(0!==n||0!==r?n+r:d_(u.top,u.bottom))}await l({...t,availableWidth:j,availableHeight:S});const C=await s.getDimensions(i.floating);return h!==C.width||m!==C.height?{reset:{rects:!0}}:{}}}},NN=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...a}=v_(e,t);switch(o){case"referenceHidden":{const e=A_(await r.detectOverflow(t,{...a,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:D_(e)}}}case"escaped":{const e=A_(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:D_(e)}}}default:return{}}}}},TN=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:a,platform:s,elements:i,middlewareData:l}=t,{element:c,padding:u=0}=v_(e,t)||{};if(null==c)return{};const d=R_(u),p={x:n,y:r},f=S_(o),h=w_(f),m=await s.getDimensions(c),g="y"===f,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=a.reference[h]+a.reference[f]-p[f]-a.floating[h],w=p[f]-a.reference[f],k=await(null==s.getOffsetParent?void 0:s.getOffsetParent(c));let S=k?k[b]:0;S&&await(null==s.isElement?void 0:s.isElement(k))||(S=i.floating[b]||a.floating[h]);const j=x/2-w/2,C=S/2-m[h]/2-1,E=u_(d[v],C),P=u_(d[y],C),_=E,N=S-m[h]-P,T=S/2-m[h]/2+j,R=g_(_,T,N),M=!l.arrow&&null!=b_(o)&&T!==R&&a.reference[h]/2-(T<_?E:P)-m[h]/2<0,L=M?T<_?T-_:T-N:0;return{[f]:p[f]+L,data:{[f]:R,centerOffset:T-R-L,...M&&{alignmentOffset:L}},reset:M}}}),RN=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:a,middlewareData:s}=t,{offset:i=0,mainAxis:l=!0,crossAxis:c=!0}=v_(e,t),u={x:n,y:r},d=k_(o),p=x_(d);let f=u[p],h=u[d];const m=v_(i,t),g="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const e="y"===p?"height":"width",t=a.reference[p]-a.floating[e]+g.mainAxis,n=a.reference[p]+a.reference[e]-g.mainAxis;f<t?f=t:f>n&&(f=n)}if(c){var v,y;const e="y"===p?"width":"height",t=I_.has(y_(o)),n=a.reference[d]-a.floating[e]+(t&&(null==(v=s.offset)?void 0:v[d])||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:(null==(y=s.offset)?void 0:y[d])||0)-(t?g.crossAxis:0);h<n?h=n:h>r&&(h=r)}return{[p]:f,[d]:h}}}},MN=(e,t,n)=>{const r=new Map,o={platform:kN,...n},a={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:a=[],platform:s}=n,i=s.detectOverflow?s:{...s,detectOverflow:O_},l=await(null==s.isRTL?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=L_(c,r,l),p=r,f=0;const h={};for(let m=0;m<a.length;m++){const n=a[m];if(!n)continue;const{name:g,fn:v}=n,{x:y,y:b,data:x,reset:w}=await v({x:u,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:h,rects:c,platform:i,elements:{reference:e,floating:t}});u=null!=y?y:u,d=null!=b?b:d,h[g]={...h[g],...x},w&&f<50&&(f++,"object"==typeof w&&(w.placement&&(p=w.placement),w.rects&&(c=!0===w.rects?await s.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:u,y:d}=L_(c,p,l))),m=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:h}})(e,t,{...o,platform:a})};var LN="undefined"!=typeof document?W.useLayoutEffect:function(){};function ON(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!ON(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!ON(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function AN(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function DN(e,t){const n=AN(e);return Math.round(t*n)/n}function IN(e){const t=W.useRef(e);return LN(()=>{t.current=e}),t}const FN=(e,t)=>{const n=CN(e);return{name:n.name,fn:n.fn,options:[e,t]}},$N=(e,t)=>{const n=EN(e);return{name:n.name,fn:n.fn,options:[e,t]}},zN=(e,t)=>({fn:RN(e).fn,options:[e,t]}),VN=(e,t)=>{const n=PN(e);return{name:n.name,fn:n.fn,options:[e,t]}},UN=(e,t)=>{const n=_N(e);return{name:n.name,fn:n.fn,options:[e,t]}},BN=(e,t)=>{const n=NN(e);return{name:n.name,fn:n.fn,options:[e,t]}},WN=(e,t)=>{const n=(e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?TN({element:n.current,padding:r}).fn(t):{}:n?TN({element:n,padding:r}).fn(t):{};var o}}))(e);return{name:n.name,fn:n.fn,options:[e,t]}};var HN=W.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...a}=e;return ee.jsx(AP.svg,{...a,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:ee.jsx("polygon",{points:"0,0 30,0 15,10"})})});HN.displayName="Arrow";var qN=HN;function GN(e){const[t,n]=W.useState(void 0);return a_(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let o,a;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,a=t.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}var KN="Popper",[YN,XN]=NP(KN),[QN,JN]=YN(KN),ZN=e=>{const{__scopePopper:t,children:n}=e,[r,o]=W.useState(null);return ee.jsx(QN,{scope:t,anchor:r,onAnchorChange:o,children:n})};ZN.displayName=KN;var eT="PopperAnchor",tT=W.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,a=JN(eT,n),s=W.useRef(null),i=aj(t,s),l=W.useRef(null);return W.useEffect(()=>{const e=l.current;l.current=(null==r?void 0:r.current)||s.current,e!==l.current&&a.onAnchorChange(l.current)}),r?null:ee.jsx(AP.div,{...o,ref:i})});tT.displayName=eT;var nT="PopperContent",[rT,oT]=YN(nT),aT=W.forwardRef((e,t)=>{var n,r,o,a,s,i;const{__scopePopper:l,side:c="bottom",sideOffset:u=0,align:d="center",alignOffset:p=0,arrowPadding:f=0,avoidCollisions:h=!0,collisionBoundary:m=[],collisionPadding:g=0,sticky:v="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:x,...w}=e,k=JN(nT,l),[S,j]=W.useState(null),C=aj(t,e=>j(e)),[E,P]=W.useState(null),_=GN(E),N=(null==_?void 0:_.width)??0,T=(null==_?void 0:_.height)??0,R=c+("center"!==d?"-"+d:""),M="number"==typeof g?g:{top:0,right:0,bottom:0,left:0,...g},L=Array.isArray(m)?m:[m],O=L.length>0,A={padding:M,boundary:L.filter(cT),altBoundary:O},{refs:D,floatingStyles:I,placement:F,isPositioned:$,middlewareData:z}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:a,floating:s}={},transform:i=!0,whileElementsMounted:l,open:c}=e,[u,d]=W.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=W.useState(r);ON(p,r)||f(r);const[h,m]=W.useState(null),[g,v]=W.useState(null),y=W.useCallback(e=>{e!==k.current&&(k.current=e,m(e))},[]),b=W.useCallback(e=>{e!==S.current&&(S.current=e,v(e))},[]),x=a||h,w=s||g,k=W.useRef(null),S=W.useRef(null),j=W.useRef(u),C=null!=l,E=IN(l),P=IN(o),_=IN(c),N=W.useCallback(()=>{if(!k.current||!S.current)return;const e={placement:t,strategy:n,middleware:p};P.current&&(e.platform=P.current),MN(k.current,S.current,e).then(e=>{const t={...e,isPositioned:!1!==_.current};T.current&&!ON(j.current,t)&&(j.current=t,ld.flushSync(()=>{d(t)}))})},[p,t,n,P,_]);LN(()=>{!1===c&&j.current.isPositioned&&(j.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[c]);const T=W.useRef(!1);LN(()=>(T.current=!0,()=>{T.current=!1}),[]),LN(()=>{if(x&&(k.current=x),w&&(S.current=w),x&&w){if(E.current)return E.current(x,w,N);N()}},[x,w,N,E,C]);const R=W.useMemo(()=>({reference:k,floating:S,setReference:y,setFloating:b}),[y,b]),M=W.useMemo(()=>({reference:x,floating:w}),[x,w]),L=W.useMemo(()=>{const e={position:n,left:0,top:0};if(!M.floating)return e;const t=DN(M.floating,u.x),r=DN(M.floating,u.y);return i?{...e,transform:"translate("+t+"px, "+r+"px)",...AN(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,i,M.floating,u.x,u.y]);return W.useMemo(()=>({...u,update:N,refs:R,elements:M,floatingStyles:L}),[u,N,R,M,L])}({strategy:"fixed",placement:R,whileElementsMounted:(...e)=>jN(...e,{animationFrame:"always"===b}),elements:{reference:k.anchor},middleware:[FN({mainAxis:u+T,alignmentAxis:p}),h&&$N({mainAxis:!0,crossAxis:!1,limiter:"partial"===v?zN():void 0,...A}),h&&VN({...A}),UN({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:o,height:a}=t.reference,s=e.floating.style;s.setProperty("--radix-popper-available-width",`${n}px`),s.setProperty("--radix-popper-available-height",`${r}px`),s.setProperty("--radix-popper-anchor-width",`${o}px`),s.setProperty("--radix-popper-anchor-height",`${a}px`)}}),E&&WN({element:E,padding:f}),uT({arrowWidth:N,arrowHeight:T}),y&&BN({strategy:"referenceHidden",...A})]}),[V,U]=dT(F),B=IP(x);a_(()=>{$&&(null==B||B())},[$,B]);const H=null==(n=z.arrow)?void 0:n.x,q=null==(r=z.arrow)?void 0:r.y,G=0!==(null==(o=z.arrow)?void 0:o.centerOffset),[K,Y]=W.useState();return a_(()=>{S&&Y(window.getComputedStyle(S).zIndex)},[S]),ee.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:$?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:K,"--radix-popper-transform-origin":[null==(a=z.transformOrigin)?void 0:a.x,null==(s=z.transformOrigin)?void 0:s.y].join(" "),...(null==(i=z.hide)?void 0:i.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:ee.jsx(rT,{scope:l,placedSide:V,onArrowChange:P,arrowX:H,arrowY:q,shouldHideArrow:G,children:ee.jsx(AP.div,{"data-side":V,"data-align":U,...w,ref:C,style:{...w.style,animation:$?void 0:"none"}})})})});aT.displayName=nT;var sT="PopperArrow",iT={top:"bottom",right:"left",bottom:"top",left:"right"},lT=W.forwardRef(function(e,t){const{__scopePopper:n,...r}=e,o=oT(sT,n),a=iT[o.placedSide];return ee.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:ee.jsx(qN,{...r,ref:t,style:{...r.style,display:"block"}})})});function cT(e){return null!==e}lT.displayName=sT;var uT=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o;const{placement:a,rects:s,middlewareData:i}=t,l=0!==(null==(n=i.arrow)?void 0:n.centerOffset),c=l?0:e.arrowWidth,u=l?0:e.arrowHeight,[d,p]=dT(a),f={start:"0%",center:"50%",end:"100%"}[p],h=((null==(r=i.arrow)?void 0:r.x)??0)+c/2,m=((null==(o=i.arrow)?void 0:o.y)??0)+u/2;let g="",v="";return"bottom"===d?(g=l?f:`${h}px`,v=-u+"px"):"top"===d?(g=l?f:`${h}px`,v=`${s.floating.height+u}px`):"right"===d?(g=-u+"px",v=l?f:`${m}px`):"left"===d&&(g=`${s.floating.width+u}px`,v=l?f:`${m}px`),{data:{x:g,y:v}}}});function dT(e){const[t,n="center"]=e.split("-");return[t,n]}var pT=ZN,fT=tT,hT=aT,mT=lT,gT=W.forwardRef((e,t)=>{var n;const{container:r,...o}=e,[a,s]=W.useState(!1);a_(()=>s(!0),[]);const i=r||a&&(null==(n=null==globalThis?void 0:globalThis.document)?void 0:n.body);return i?cd.createPortal(ee.jsx(AP.div,{...o,ref:t}),i):null});gT.displayName="Portal";var vT=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=W.useState(),r=W.useRef(null),o=W.useRef(e),a=W.useRef("none"),s=e?"mounted":"unmounted",[i,l]=function(e,t){return W.useReducer((e,n)=>t[e][n]??e,e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return W.useEffect(()=>{const e=yT(r.current);a.current="mounted"===i?e:"none"},[i]),a_(()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,s=yT(t);if(e)l("MOUNT");else if("none"===s||"none"===(null==t?void 0:t.display))l("UNMOUNT");else{l(n&&r!==s?"ANIMATION_OUT":"UNMOUNT")}o.current=e}},[e,l]),a_(()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,s=a=>{const s=yT(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&s&&(l("ANIMATION_END"),!o.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)})}},i=e=>{e.target===t&&(a.current=yT(r.current))};return t.addEventListener("animationstart",i),t.addEventListener("animationcancel",s),t.addEventListener("animationend",s),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",i),t.removeEventListener("animationcancel",s),t.removeEventListener("animationend",s)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:W.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}(t),o="function"==typeof n?n({present:r.isPresent}):W.Children.only(n),a=aj(r.ref,function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof n||r.isPresent?W.cloneElement(o,{ref:a}):null};function yT(e){return(null==e?void 0:e.animationName)||"none"}function bT(e){const t=xT(e),n=W.forwardRef((e,n)=>{const{children:r,...o}=e,a=W.Children.toArray(r),s=a.find(kT);if(s){const e=s.props.children,r=a.map(t=>t===s?W.Children.count(e)>1?W.Children.only(null):W.isValidElement(e)?e.props.children:null:t);return ee.jsx(t,{...o,ref:n,children:W.isValidElement(e)?W.cloneElement(e,void 0,r):null})}return ee.jsx(t,{...o,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function xT(e){const t=W.forwardRef((e,t)=>{const{children:n,...r}=e;if(W.isValidElement(n)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{const t=a(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==W.Fragment&&(o.ref=t?oj(t,e):e),W.cloneElement(n,o)}return W.Children.count(n)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}vT.displayName="Presence";var wT=Symbol("radix.slottable");function kT(e){return W.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===wT}var ST=q[" useInsertionEffect ".trim().toString()]||a_;function jT({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,s]=function({defaultProp:e,onChange:t}){const[n,r]=W.useState(e),o=W.useRef(n),a=W.useRef(t);return ST(()=>{a.current=t},[t]),W.useEffect(()=>{var e;o.current!==n&&(null==(e=a.current)||e.call(a,n),o.current=n)},[n,o]),[n,r,a]}({defaultProp:t,onChange:n}),i=void 0!==e,l=i?e:o;{const t=W.useRef(void 0!==e);W.useEffect(()=>{const e=t.current;if(e!==i){const t=e?"controlled":"uncontrolled",n=i?"controlled":"uncontrolled";console.warn(`${r} is changing from ${t} to ${n}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=i},[i,r])}const c=W.useCallback(t=>{var n;if(i){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&(null==(n=s.current)||n.call(s,r))}else a(t)},[i,e,a,s]);return[l,c]}var CT=new WeakMap,ET=new WeakMap,PT={},_T=0,NT=function(e){return e&&(e.host||NT(e.parentNode))},TT=function(e,t,n,r){var o=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=NT(t);return n&&e.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);PT[n]||(PT[n]=new WeakMap);var a=PT[n],s=[],i=new Set,l=new Set(o),c=function(e){e&&!i.has(e)&&(i.add(e),c(e.parentNode))};o.forEach(c);var u=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(i.has(e))u(e);else try{var t=e.getAttribute(r),o=null!==t&&"false"!==t,l=(CT.get(e)||0)+1,c=(a.get(e)||0)+1;CT.set(e,l),a.set(e,c),s.push(e),1===l&&o&&ET.set(e,!0),1===c&&e.setAttribute(n,"true"),o||e.setAttribute(r,"true")}catch(LO){console.error("aria-hidden: cannot operate on ",e,LO)}})};return u(t),i.clear(),_T++,function(){s.forEach(function(e){var t=CT.get(e)-1,o=a.get(e)-1;CT.set(e,t),a.set(e,o),t||(ET.has(e)||e.removeAttribute(r),ET.delete(e)),o||e.removeAttribute(n)}),--_T||(CT=new WeakMap,CT=new WeakMap,ET=new WeakMap,PT={})}},RT=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),TT(r,o,n,"aria-hidden")):function(){return null}},MT=function(){return MT=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},MT.apply(this,arguments)};function LT(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var OT="right-scroll-bar-position",AT="width-before-scroll-bar";function DT(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var IT="undefined"!=typeof window?W.useLayoutEffect:W.useEffect,FT=new WeakMap;function $T(e,t){var n,r,o,a=(n=null,r=function(t){return e.forEach(function(e){return DT(e,t)})},(o=W.useState(function(){return{value:n,callback:r,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}})[0]).callback=r,o.facade);return IT(function(){var t=FT.get(a);if(t){var n=new Set(t),r=new Set(e),o=a.current;n.forEach(function(e){r.has(e)||DT(e,null)}),r.forEach(function(e){n.has(e)||DT(e,o)})}FT.set(a,e)},[e]),a}function zT(e){return e}var VT=function(e){var t=e.sideCar,n=LT(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return W.createElement(r,MT({},n))};VT.isSideCarExport=!0;var UT=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=zT);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var o=t(e,r);return n.push(o),function(){n=n.filter(function(e){return e!==o})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var o=n;n=[],o.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},s=function(){return Promise.resolve().then(a)};s(),n={push:function(e){t.push(e),s()},filter:function(e){return t=t.filter(e),n}}}}}(null);return t.options=MT({async:!0,ssr:!1},e),t}(),BT=function(){},WT=W.forwardRef(function(e,t){var n=W.useRef(null),r=W.useState({onScrollCapture:BT,onWheelCapture:BT,onTouchMoveCapture:BT}),o=r[0],a=r[1],s=e.forwardProps,i=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,p=e.sideCar,f=e.noRelative,h=e.noIsolation,m=e.inert,g=e.allowPinchZoom,v=e.as,y=void 0===v?"div":v,b=e.gapMode,x=LT(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),w=p,k=$T([n,t]),S=MT(MT({},x),o);return W.createElement(W.Fragment,null,u&&W.createElement(w,{sideCar:UT,removeScrollBar:c,shards:d,noRelative:f,noIsolation:h,inert:m,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:b}),s?W.cloneElement(W.Children.only(i),MT(MT({},S),{ref:k})):W.createElement(y,MT({},S,{className:l,ref:k}),i))});WT.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},WT.classNames={fullWidth:AT,zeroRight:OT};function HT(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var qT=function(){var e=0,t=null;return{add:function(n){var r,o;0==e&&(t=HT())&&(o=n,(r=t).styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},GT=function(){var e,t=(e=qT(),function(t,n){W.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])});return function(e){var n=e.styles,r=e.dynamic;return t(n,r),null}},KT={left:0,top:0,right:0,gap:0},YT=function(e){return parseInt(e||"",10)||0},XT=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return KT;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[YT(n),YT(r),YT(o)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},QT=GT(),JT="data-scroll-locked",ZT=function(e,t,n,r){var o=e.left,a=e.top,s=e.right,i=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(i,"px ").concat(r,";\n }\n body[").concat(JT,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(o,"px;\n padding-top: ").concat(a,"px;\n padding-right: ").concat(s,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(i,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(i,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(OT," {\n right: ").concat(i,"px ").concat(r,";\n }\n \n .").concat(AT," {\n margin-right: ").concat(i,"px ").concat(r,";\n }\n \n .").concat(OT," .").concat(OT," {\n right: 0 ").concat(r,";\n }\n \n .").concat(AT," .").concat(AT," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(JT,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(i,"px;\n }\n")},eR=function(){var e=parseInt(document.body.getAttribute(JT)||"0",10);return isFinite(e)?e:0},tR=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=void 0===r?"margin":r;W.useEffect(function(){return document.body.setAttribute(JT,(eR()+1).toString()),function(){var e=eR()-1;e<=0?document.body.removeAttribute(JT):document.body.setAttribute(JT,e.toString())}},[]);var a=W.useMemo(function(){return XT(o)},[o]);return W.createElement(QT,{styles:ZT(a,!t,o,n?"":"!important")})},nR=!1;if("undefined"!=typeof window)try{var rR=Object.defineProperty({},"passive",{get:function(){return nR=!0,!0}});window.addEventListener("test",rR,rR),window.removeEventListener("test",rR,rR)}catch(OO){nR=!1}var oR=!!nR&&{passive:!1},aR=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},sR=function(e,t){var n=t.ownerDocument,r=t;do{if("undefined"!=typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),iR(e,r)){var o=lR(e,r);if(o[1]>o[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},iR=function(e,t){return"v"===e?function(e){return aR(e,"overflowY")}(t):function(e){return aR(e,"overflowX")}(t)},lR=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},cR=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},uR=function(e){return[e.deltaX,e.deltaY]},dR=function(e){return e&&"current"in e?e.current:e},pR=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},fR=0,hR=[];function mR(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const gR=(vR=function(e){var t=W.useRef([]),n=W.useRef([0,0]),r=W.useRef(),o=W.useState(fR++)[0],a=W.useState(GT)[0],s=W.useRef(e);W.useEffect(function(){s.current=e},[e]),W.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(dR),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var i=W.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var o,a=cR(e),i=n.current,l="deltaX"in e?e.deltaX:i[0]-a[0],c="deltaY"in e?e.deltaY:i[1]-a[1],u=e.target,d=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===d&&"range"===u.type)return!1;var p=window.getSelection(),f=p&&p.anchorNode;if(f&&(f===u||f.contains(u)))return!1;var h=sR(d,u);if(!h)return!0;if(h?o=d:(o="v"===d?"h":"v",h=sR(d,u)),!h)return!1;if(!r.current&&"changedTouches"in e&&(l||c)&&(r.current=o),!o)return!0;var m=r.current||o;return function(e,t,n,r){var o=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),a=o*r,s=n.target,i=t.contains(s),l=!1,c=a>0,u=0,d=0;do{if(!s)break;var p=lR(e,s),f=p[0],h=p[1]-p[2]-o*f;(f||h)&&iR(e,s)&&(u+=h,d+=f);var m=s.parentNode;s=m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE?m.host:m}while(!i&&s!==document.body||i&&(t.contains(s)||t===s));return(c&&Math.abs(u)<1||!c&&Math.abs(d)<1)&&(l=!0),l}(m,t,e,"h"===m?l:c)},[]),l=W.useCallback(function(e){var n=e;if(hR.length&&hR[hR.length-1]===a){var r="deltaY"in n?uR(n):cR(n),o=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&(t=e.delta,o=r,t[0]===o[0]&&t[1]===o[1]);var t,o})[0];if(o&&o.should)n.cancelable&&n.preventDefault();else if(!o){var l=(s.current.shards||[]).map(dR).filter(Boolean).filter(function(e){return e.contains(n.target)});(l.length>0?i(n,l[0]):!s.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),c=W.useCallback(function(e,n,r,o){var a={name:e,delta:n,target:r,should:o,shadowParent:mR(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=W.useCallback(function(e){n.current=cR(e),r.current=void 0},[]),d=W.useCallback(function(t){c(t.type,uR(t),t.target,i(t,e.lockRef.current))},[]),p=W.useCallback(function(t){c(t.type,cR(t),t.target,i(t,e.lockRef.current))},[]);W.useEffect(function(){return hR.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",l,oR),document.addEventListener("touchmove",l,oR),document.addEventListener("touchstart",u,oR),function(){hR=hR.filter(function(e){return e!==a}),document.removeEventListener("wheel",l,oR),document.removeEventListener("touchmove",l,oR),document.removeEventListener("touchstart",u,oR)}},[]);var f=e.removeScrollBar,h=e.inert;return W.createElement(W.Fragment,null,h?W.createElement(a,{styles:pR(o)}):null,f?W.createElement(tR,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},UT.useMedium(vR),VT);var vR,yR=W.forwardRef(function(e,t){return W.createElement(WT,MT({},e,{ref:t,sideCar:gR}))});yR.classNames=WT.classNames;var bR="Popover",[xR]=NP(bR,[XN]),wR=XN(),[kR,SR]=xR(bR),jR=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:s=!1}=e,i=wR(t),l=W.useRef(null),[c,u]=W.useState(!1),[d,p]=jT({prop:r,defaultProp:o??!1,onChange:a,caller:bR});return ee.jsx(pT,{...i,children:ee.jsx(kR,{scope:t,contentId:l_(),triggerRef:l,open:d,onOpenChange:p,onOpenToggle:W.useCallback(()=>p(e=>!e),[p]),hasCustomAnchor:c,onCustomAnchorAdd:W.useCallback(()=>u(!0),[]),onCustomAnchorRemove:W.useCallback(()=>u(!1),[]),modal:s,children:n})})};jR.displayName=bR;var CR="PopoverAnchor";W.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=SR(CR,n),a=wR(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:i}=o;return W.useEffect(()=>(s(),()=>i()),[s,i]),ee.jsx(fT,{...a,...r,ref:t})}).displayName=CR;var ER="PopoverTrigger",PR=W.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=SR(ER,n),a=wR(n),s=aj(t,o.triggerRef),i=ee.jsx(AP.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":$R(o.open),...r,ref:s,onClick:_P(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?i:ee.jsx(fT,{asChild:!0,...a,children:i})});PR.displayName=ER;var _R="PopoverPortal",[NR,TR]=xR(_R,{forceMount:void 0}),RR=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,a=SR(_R,t);return ee.jsx(NR,{scope:t,forceMount:n,children:ee.jsx(vT,{present:n||a.open,children:ee.jsx(gT,{asChild:!0,container:o,children:r})})})};RR.displayName=_R;var MR="PopoverContent",LR=W.forwardRef((e,t)=>{const n=TR(MR,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,a=SR(MR,e.__scopePopover);return ee.jsx(vT,{present:r||a.open,children:a.modal?ee.jsx(AR,{...o,ref:t}):ee.jsx(DR,{...o,ref:t})})});LR.displayName=MR;var OR=bT("PopoverContent.RemoveScroll"),AR=W.forwardRef((e,t)=>{const n=SR(MR,e.__scopePopover),r=W.useRef(null),o=aj(t,r),a=W.useRef(!1);return W.useEffect(()=>{const e=r.current;if(e)return RT(e)},[]),ee.jsx(yR,{as:OR,allowPinchZoom:!0,children:ee.jsx(IR,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:_P(e.onCloseAutoFocus,e=>{var t;e.preventDefault(),a.current||null==(t=n.triggerRef.current)||t.focus()}),onPointerDownOutside:_P(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,r=2===t.button||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:_P(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),DR=W.forwardRef((e,t)=>{const n=SR(MR,e.__scopePopover),r=W.useRef(!1),o=W.useRef(!1);return ee.jsx(IR,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var a,s;null==(a=e.onCloseAutoFocus)||a.call(e,t),t.defaultPrevented||(r.current||null==(s=n.triggerRef.current)||s.focus(),t.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:t=>{var a,s;null==(a=e.onInteractOutside)||a.call(e,t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(o.current=!0));const i=t.target;(null==(s=n.triggerRef.current)?void 0:s.contains(i))&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&o.current&&t.preventDefault()}})}),IR=W.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=e,p=SR(MR,n),f=wR(n);return GP(),ee.jsx(JP,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:ee.jsx(BP,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>p.onOpenChange(!1),children:ee.jsx(hT,{"data-state":$R(p.open),role:"dialog",id:p.contentId,...f,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),FR="PopoverClose";W.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=SR(FR,n);return ee.jsx(AP.button,{type:"button",...r,ref:t,onClick:_P(e.onClick,()=>o.onOpenChange(!1))})}).displayName=FR;function $R(e){return e?"open":"closed"}W.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=wR(n);return ee.jsx(mT,{...o,...r,ref:t})}).displayName="PopoverArrow";var zR=RR,VR=LR;const UR=jR,BR=PR,WR=W.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>ee.jsx(zR,{children:ee.jsx(VR,{ref:o,align:t,sideOffset:n,className:XS("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));function HR({className:e,...t}){return ee.jsx("div",{className:XS("animate-pulse rounded-md bg-muted",e),...t})}WR.displayName=VR.displayName;const qR=gj("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function GR({className:e,variant:t,...n}){return ee.jsx("div",{className:XS(qR({variant:t}),e),...n})}function KR(e){const t=YR(e),n=W.forwardRef((e,n)=>{const{children:r,...o}=e,a=W.Children.toArray(r),s=a.find(QR);if(s){const e=s.props.children,r=a.map(t=>t===s?W.Children.count(e)>1?W.Children.only(null):W.isValidElement(e)?e.props.children:null:t);return ee.jsx(t,{...o,ref:n,children:W.isValidElement(e)?W.cloneElement(e,void 0,r):null})}return ee.jsx(t,{...o,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function YR(e){const t=W.forwardRef((e,t)=>{const{children:n,...r}=e;if(W.isValidElement(n)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{const t=a(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==W.Fragment&&(o.ref=t?oj(t,e):e),W.cloneElement(n,o)}return W.Children.count(n)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var XR=Symbol("radix.slottable");function QR(e){return W.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===XR}var JR="Dialog",[ZR]=NP(JR),[eM,tM]=ZR(JR),nM=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:s=!0}=e,i=W.useRef(null),l=W.useRef(null),[c,u]=jT({prop:r,defaultProp:o??!1,onChange:a,caller:JR});return ee.jsx(eM,{scope:t,triggerRef:i,contentRef:l,contentId:l_(),titleId:l_(),descriptionId:l_(),open:c,onOpenChange:u,onOpenToggle:W.useCallback(()=>u(e=>!e),[u]),modal:s,children:n})};nM.displayName=JR;var rM="DialogTrigger";W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=tM(rM,n),a=aj(t,o.triggerRef);return ee.jsx(AP.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":SM(o.open),...r,ref:a,onClick:_P(e.onClick,o.onOpenToggle)})}).displayName=rM;var oM="DialogPortal",[aM,sM]=ZR(oM,{forceMount:void 0}),iM=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=tM(oM,t);return ee.jsx(aM,{scope:t,forceMount:n,children:W.Children.map(r,e=>ee.jsx(vT,{present:n||a.open,children:ee.jsx(gT,{asChild:!0,container:o,children:e})}))})};iM.displayName=oM;var lM="DialogOverlay",cM=W.forwardRef((e,t)=>{const n=sM(lM,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=tM(lM,e.__scopeDialog);return a.modal?ee.jsx(vT,{present:r||a.open,children:ee.jsx(dM,{...o,ref:t})}):null});cM.displayName=lM;var uM=KR("DialogOverlay.RemoveScroll"),dM=W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=tM(lM,n);return ee.jsx(yR,{as:uM,allowPinchZoom:!0,shards:[o.contentRef],children:ee.jsx(AP.div,{"data-state":SM(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),pM="DialogContent",fM=W.forwardRef((e,t)=>{const n=sM(pM,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=tM(pM,e.__scopeDialog);return ee.jsx(vT,{present:r||a.open,children:a.modal?ee.jsx(hM,{...o,ref:t}):ee.jsx(mM,{...o,ref:t})})});fM.displayName=pM;var hM=W.forwardRef((e,t)=>{const n=tM(pM,e.__scopeDialog),r=W.useRef(null),o=aj(t,n.contentRef,r);return W.useEffect(()=>{const e=r.current;if(e)return RT(e)},[]),ee.jsx(gM,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:_P(e.onCloseAutoFocus,e=>{var t;e.preventDefault(),null==(t=n.triggerRef.current)||t.focus()}),onPointerDownOutside:_P(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:_P(e.onFocusOutside,e=>e.preventDefault())})}),mM=W.forwardRef((e,t)=>{const n=tM(pM,e.__scopeDialog),r=W.useRef(!1),o=W.useRef(!1);return ee.jsx(gM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var a,s;null==(a=e.onCloseAutoFocus)||a.call(e,t),t.defaultPrevented||(r.current||null==(s=n.triggerRef.current)||s.focus(),t.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:t=>{var a,s;null==(a=e.onInteractOutside)||a.call(e,t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(o.current=!0));const i=t.target;(null==(s=n.triggerRef.current)?void 0:s.contains(i))&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&o.current&&t.preventDefault()}})}),gM=W.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...s}=e,i=tM(pM,n),l=W.useRef(null),c=aj(t,l);return GP(),ee.jsxs(ee.Fragment,{children:[ee.jsx(JP,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:ee.jsx(BP,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":SM(i.open),...s,ref:c,onDismiss:()=>i.onOpenChange(!1)})}),ee.jsxs(ee.Fragment,{children:[ee.jsx(PM,{titleId:i.titleId}),ee.jsx(_M,{contentRef:l,descriptionId:i.descriptionId})]})]})}),vM="DialogTitle",yM=W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=tM(vM,n);return ee.jsx(AP.h2,{id:o.titleId,...r,ref:t})});yM.displayName=vM;var bM="DialogDescription",xM=W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=tM(bM,n);return ee.jsx(AP.p,{id:o.descriptionId,...r,ref:t})});xM.displayName=bM;var wM="DialogClose",kM=W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=tM(wM,n);return ee.jsx(AP.button,{type:"button",...r,ref:t,onClick:_P(e.onClick,()=>o.onOpenChange(!1))})});function SM(e){return e?"open":"closed"}kM.displayName=wM;var jM="DialogTitleWarning",[CM,EM]=function(e,t){const n=W.createContext(t),r=e=>{const{children:t,...r}=e,o=W.useMemo(()=>r,Object.values(r));return ee.jsx(n.Provider,{value:o,children:t})};return r.displayName=e+"Provider",[r,function(r){const o=W.useContext(n);if(o)return o;if(void 0!==t)return t;throw new Error(`\`${r}\` must be used within \`${e}\``)}]}(jM,{contentName:pM,titleName:vM,docsSlug:"dialog"}),PM=({titleId:e})=>{const t=EM(jM),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return W.useEffect(()=>{if(e){document.getElementById(e)||console.error(n)}},[n,e]),null},_M=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${EM("DialogDescriptionWarning").contentName}}.`;return W.useEffect(()=>{var r;const o=null==(r=e.current)?void 0:r.getAttribute("aria-describedby");if(t&&o){document.getElementById(t)||console.warn(n)}},[n,e,t]),null},NM=cM,TM=fM,RM=yM,MM=xM,LM=kM;const OM=nM,AM=iM,DM=W.forwardRef(({className:e,...t},n)=>ee.jsx(NM,{ref:n,className:XS("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));DM.displayName=NM.displayName;const IM=W.forwardRef(({className:e,children:t,noOverlay:n,...r},o)=>ee.jsxs(AM,{children:[!n&&ee.jsx(DM,{}),ee.jsxs(TM,{ref:o,className:XS("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-xl",e),...r,children:[t,ee.jsxs(LM,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[ee.jsx(EP,{className:"h-4 w-4"}),ee.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));IM.displayName=TM.displayName;const FM=({className:e,...t})=>ee.jsx("div",{className:XS("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});FM.displayName="DialogHeader";const $M=({className:e,...t})=>ee.jsx("div",{className:XS("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});$M.displayName="DialogFooter";const zM=W.forwardRef(({className:e,...t},n)=>ee.jsx(RM,{ref:n,className:XS("text-lg font-semibold leading-none tracking-tight",e),...t}));zM.displayName=RM.displayName;const VM=W.forwardRef(({className:e,...t},n)=>ee.jsx(MM,{ref:n,className:XS("text-sm text-muted-foreground",e),...t}));function UM({project:e,open:t,onOpenChange:n,onUpdated:r}){const[o,a]=W.useState([]),[s,i]=W.useState([]),[l,c]=W.useState(!1),[u,d]=W.useState(null);W.useEffect(()=>{if(!t)return;a(e.shares?[...e.shares]:[]),d(null);let n=!1;return Gj().then(e=>{n||i(e)}).catch(()=>{}),()=>{n=!0}},[t,e.id]);const p=new Set(o.map(e=>e.username)),f=s.filter(t=>t!==e.owner&&!p.has(t));return ee.jsx(OM,{open:t,onOpenChange:n,children:ee.jsxs(IM,{className:"sm:max-w-md",children:[ee.jsxs(FM,{children:[ee.jsxs(zM,{className:"flex items-center gap-2",children:[ee.jsx(CP,{className:"h-4 w-4"}),"共享设置"]}),ee.jsx(VM,{children:"选择用户并设置权限:可见(只读)或可编辑(读写+终端)"})]}),ee.jsxs("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:[0===o.length&&ee.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"尚未共享给任何用户"}),o.map(e=>ee.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[ee.jsx("span",{className:"text-sm font-medium",children:e.username}),ee.jsxs("div",{className:"flex items-center gap-1.5",children:[ee.jsx("button",{onClick:()=>{return t=e.username,void a(e=>e.map(e=>e.username===t?{...e,permission:"view"===e.permission?"edit":"view"}:e));var t},className:"focus:outline-none",children:ee.jsx(GR,{variant:"edit"===e.permission?"default":"secondary",className:"cursor-pointer text-xs",children:"edit"===e.permission?"可编辑":"可见"})}),ee.jsx(yj,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>{return t=e.username,void a(e=>e.filter(e=>e.username!==t));var t},children:ee.jsx(jP,{className:"h-3.5 w-3.5"})})]})]},e.username))]}),f.length>0&&ee.jsxs("div",{className:"border-t pt-3",children:[ee.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"添加用户"}),ee.jsx("div",{className:"flex flex-wrap gap-1.5",children:f.map(e=>ee.jsxs(yj,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>{return t=e,void a(e=>[...e,{username:t,permission:"view"}]);var t},children:[ee.jsx(fP,{className:"h-3 w-3"}),e]},e))})]}),u&&ee.jsx("p",{className:"text-sm text-destructive",children:u}),ee.jsxs($M,{children:[ee.jsx(yj,{variant:"outline",onClick:()=>n(!1),disabled:l,children:"取消"}),ee.jsx(yj,{onClick:()=>{(async()=>{c(!0),d(null);try{const t=await Kj(e.id,o);r(t),n(!1)}catch(OO){d(OO instanceof Error?OO.message:"Failed to update shares")}finally{c(!1)}})()},disabled:l,children:l?"保存中...":"保存"})]})]})})}VM.displayName=MM.displayName;function BM({status:e,onClick:t,title:n,className:r}){const o=W.useId(),a=!!(null==e?void 0:e.hasPath),s=!0===(null==e?void 0:e.dirty),i=!!(null==e?void 0:e.syncing);let l="text-muted-foreground",c="none",u=!1;return a?s?(l="text-amber-500",c=`url(#${o})`):(l="text-muted-foreground",c="currentColor"):(u=!0,l="text-muted-foreground/60"),ee.jsx("button",{type:"button",onClick:t,title:n,"aria-label":n,className:XS("inline-flex h-7 w-7 items-center justify-center rounded-md transition-colors hover:bg-accent",l,i&&"animate-pulse",r),children:ee.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s&&ee.jsx("defs",{children:ee.jsxs("linearGradient",{id:o,x1:"0",y1:"0",x2:"0",y2:"1",children:[ee.jsx("stop",{offset:"0",stopColor:"currentColor",stopOpacity:"0"}),ee.jsx("stop",{offset:"0.5",stopColor:"currentColor",stopOpacity:"0"}),ee.jsx("stop",{offset:"0.5",stopColor:"currentColor",stopOpacity:"0.9"}),ee.jsx("stop",{offset:"1",stopColor:"currentColor",stopOpacity:"0.9"})]})}),ee.jsx("path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",fill:c,strokeDasharray:u?"3 2.5":void 0})]})})}const WM=Array(12).fill(0),HM=({visible:e,className:t})=>H.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},H.createElement("div",{className:"sonner-spinner"},WM.map((e,t)=>H.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${t}`})))),qM=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},H.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),GM=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},H.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),KM=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},H.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),YM=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},H.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),XM=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},H.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),H.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}));let QM=1;const JM=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;const{message:n,...r}=e,o="number"==typeof(null==e?void 0:e.id)||(null==(t=e.id)?void 0:t.length)>0?e.id:QM++,a=this.toasts.find(e=>e.id===o),s=void 0===e.dismissible||e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),a?this.toasts=this.toasts.map(t=>t.id===o?(this.publish({...t,...e,id:o,title:n}),{...t,...e,id:o,dismissible:s,title:n}):t):this.addToast({title:n,...r,dismissible:s,id:o}),o},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;void 0!==t.loading&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:"function"!=typeof t.description?t.description:void 0}));const r=Promise.resolve(e instanceof Function?e():e);let o,a=void 0!==n;const s=r.then(async e=>{o=["resolve",e];if(H.isValidElement(e))a=!1,this.create({id:n,type:"default",message:e});else if(ZM(e)&&!e.ok){a=!1;const r="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,o="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description,s="object"==typeof r&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:"error",description:o,...s})}else if(e instanceof Error){a=!1;const r="function"==typeof t.error?await t.error(e):t.error,o="function"==typeof t.description?await t.description(e):t.description,s="object"==typeof r&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:"error",description:o,...s})}else if(void 0!==t.success){a=!1;const r="function"==typeof t.success?await t.success(e):t.success,o="function"==typeof t.description?await t.description(e):t.description,s="object"==typeof r&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:"success",description:o,...s})}}).catch(async e=>{if(o=["reject",e],void 0!==t.error){a=!1;const r="function"==typeof t.error?await t.error(e):t.error,o="function"==typeof t.description?await t.description(e):t.description,s="object"==typeof r&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:"error",description:o,...s})}}).finally(()=>{a&&(this.dismiss(n),n=void 0),null==t.finally||t.finally.call(t)}),i=()=>new Promise((e,t)=>s.then(()=>"reject"===o[0]?t(o[1]):e(o[1])).catch(t));return"string"!=typeof n&&"number"!=typeof n?{unwrap:i}:Object.assign(n,{unwrap:i})},this.custom=(e,t)=>{const n=(null==t?void 0:t.id)||QM++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},ZM=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,eL=(e,t)=>{const n=(null==t?void 0:t.id)||QM++;return JM.addToast({title:e,...t,id:n}),n},tL=Object.assign(eL,{success:JM.success,info:JM.info,warning:JM.warning,error:JM.error,custom:JM.custom,message:JM.message,promise:JM.promise,dismiss:JM.dismiss,loading:JM.loading},{getHistory:()=>JM.toasts,getToasts:()=>JM.getActiveToasts()});function nL(e){return void 0!==e.label}!function(e){if("undefined"==typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");const rL=3,oL=14;function aL(...e){return e.filter(Boolean).join(" ")}const sL=e=>{var t,n,r,o,a,s,i,l,c;const{invert:u,toast:d,unstyled:p,interacting:f,setHeights:h,visibleToasts:m,heights:g,index:v,toasts:y,expanded:b,removeToast:x,defaultRichColors:w,closeButton:k,style:S,cancelButtonStyle:j,actionButtonStyle:C,className:E="",descriptionClassName:P="",duration:_,position:N,gap:T,expandByDefault:R,classNames:M,icons:L,closeButtonAriaLabel:O="Close toast"}=e,[A,D]=H.useState(null),[I,F]=H.useState(null),[$,z]=H.useState(!1),[V,U]=H.useState(!1),[B,W]=H.useState(!1),[q,G]=H.useState(!1),[K,Y]=H.useState(!1),[X,Q]=H.useState(0),[J,Z]=H.useState(0),ee=H.useRef(d.duration||_||4e3),te=H.useRef(null),ne=H.useRef(null),re=0===v,oe=v+1<=m,ae=d.type,se=!1!==d.dismissible,ie=d.className||"",le=d.descriptionClassName||"",ce=H.useMemo(()=>g.findIndex(e=>e.toastId===d.id)||0,[g,d.id]),ue=H.useMemo(()=>{var e;return null!=(e=d.closeButton)?e:k},[d.closeButton,k]),de=H.useMemo(()=>d.duration||_||4e3,[d.duration,_]),pe=H.useRef(0),fe=H.useRef(0),he=H.useRef(0),me=H.useRef(null),[ge,ve]=N.split("-"),ye=H.useMemo(()=>g.reduce((e,t,n)=>n>=ce?e:e+t.height,0),[g,ce]),be=(()=>{const[e,t]=H.useState(document.hidden);return H.useEffect(()=>{const e=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",e),()=>window.removeEventListener("visibilitychange",e)},[]),e})(),xe=d.invert||u,we="loading"===ae;fe.current=H.useMemo(()=>ce*T+ye,[ce,ye]),H.useEffect(()=>{ee.current=de},[de]),H.useEffect(()=>{z(!0)},[]),H.useEffect(()=>{const e=ne.current;if(e){const t=e.getBoundingClientRect().height;return Z(t),h(e=>[{toastId:d.id,height:t,position:d.position},...e]),()=>h(e=>e.filter(e=>e.toastId!==d.id))}},[h,d.id]),H.useLayoutEffect(()=>{if(!$)return;const e=ne.current,t=e.style.height;e.style.height="auto";const n=e.getBoundingClientRect().height;e.style.height=t,Z(n),h(e=>e.find(e=>e.toastId===d.id)?e.map(e=>e.toastId===d.id?{...e,height:n}:e):[{toastId:d.id,height:n,position:d.position},...e])},[$,d.title,d.description,h,d.id,d.jsx,d.action,d.cancel]);const ke=H.useCallback(()=>{U(!0),Q(fe.current),h(e=>e.filter(e=>e.toastId!==d.id)),setTimeout(()=>{x(d)},200)},[d,x,h,fe]);H.useEffect(()=>{if(d.promise&&"loading"===ae||d.duration===1/0||"loading"===d.type)return;let e;return b||f||be?(()=>{if(he.current<pe.current){const e=(new Date).getTime()-pe.current;ee.current=ee.current-e}he.current=(new Date).getTime()})():ee.current!==1/0&&(pe.current=(new Date).getTime(),e=setTimeout(()=>{null==d.onAutoClose||d.onAutoClose.call(d,d),ke()},ee.current)),()=>clearTimeout(e)},[b,f,d,ae,be,ke]),H.useEffect(()=>{d.delete&&(ke(),null==d.onDismiss||d.onDismiss.call(d,d))},[ke,d.delete]);const Se=d.icon||(null==L?void 0:L[ae])||(e=>{switch(e){case"success":return qM;case"info":return KM;case"warning":return GM;case"error":return YM;default:return null}})(ae);var je,Ce,Ee,Pe;return H.createElement("li",{tabIndex:0,ref:ne,className:aL(E,ie,null==M?void 0:M.toast,null==d||null==(t=d.classNames)?void 0:t.toast,null==M?void 0:M.default,null==M?void 0:M[ae],null==d||null==(n=d.classNames)?void 0:n[ae]),"data-sonner-toast":"","data-rich-colors":null!=(je=d.richColors)?je:w,"data-styled":!Boolean(d.jsx||d.unstyled||p),"data-mounted":$,"data-promise":Boolean(d.promise),"data-swiped":K,"data-removed":V,"data-visible":oe,"data-y-position":ge,"data-x-position":ve,"data-index":v,"data-front":re,"data-swiping":B,"data-dismissible":se,"data-type":ae,"data-invert":xe,"data-swipe-out":q,"data-swipe-direction":I,"data-expanded":Boolean(b||R&&$),"data-testid":d.testId,style:{"--index":v,"--toasts-before":v,"--z-index":y.length-v,"--offset":`${V?X:fe.current}px`,"--initial-height":R?"auto":`${J}px`,...S,...d.style},onDragEnd:()=>{W(!1),D(null),me.current=null},onPointerDown:e=>{2!==e.button&&!we&&se&&(te.current=new Date,Q(fe.current),e.target.setPointerCapture(e.pointerId),"BUTTON"!==e.target.tagName&&(W(!0),me.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e,t,n;if(q||!se)return;me.current=null;const r=Number((null==(e=ne.current)?void 0:e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),o=Number((null==(t=ne.current)?void 0:t.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),a=(new Date).getTime()-(null==(n=te.current)?void 0:n.getTime()),s="x"===A?r:o,i=Math.abs(s)/a;if(Math.abs(s)>=45||i>.11)return Q(fe.current),null==d.onDismiss||d.onDismiss.call(d,d),F("x"===A?r>0?"right":"left":o>0?"down":"up"),ke(),void G(!0);var l,c;null==(l=ne.current)||l.style.setProperty("--swipe-amount-x","0px"),null==(c=ne.current)||c.style.setProperty("--swipe-amount-y","0px"),Y(!1),W(!1),D(null)},onPointerMove:t=>{var n,r,o;if(!me.current||!se)return;if((null==(n=window.getSelection())?void 0:n.toString().length)>0)return;const a=t.clientY-me.current.y,s=t.clientX-me.current.x;var i;const l=null!=(i=e.swipeDirections)?i:function(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}(N);!A&&(Math.abs(s)>1||Math.abs(a)>1)&&D(Math.abs(s)>Math.abs(a)?"x":"y");let c={x:0,y:0};const u=e=>1/(1.5+Math.abs(e)/20);if("y"===A){if(l.includes("top")||l.includes("bottom"))if(l.includes("top")&&a<0||l.includes("bottom")&&a>0)c.y=a;else{const e=a*u(a);c.y=Math.abs(e)<Math.abs(a)?e:a}}else if("x"===A&&(l.includes("left")||l.includes("right")))if(l.includes("left")&&s<0||l.includes("right")&&s>0)c.x=s;else{const e=s*u(s);c.x=Math.abs(e)<Math.abs(s)?e:s}(Math.abs(c.x)>0||Math.abs(c.y)>0)&&Y(!0),null==(r=ne.current)||r.style.setProperty("--swipe-amount-x",`${c.x}px`),null==(o=ne.current)||o.style.setProperty("--swipe-amount-y",`${c.y}px`)}},ue&&!d.jsx&&"loading"!==ae?H.createElement("button",{"aria-label":O,"data-disabled":we,"data-close-button":!0,onClick:we||!se?()=>{}:()=>{ke(),null==d.onDismiss||d.onDismiss.call(d,d)},className:aL(null==M?void 0:M.closeButton,null==d||null==(r=d.classNames)?void 0:r.closeButton)},null!=(Ce=null==L?void 0:L.close)?Ce:XM):null,(ae||d.icon||d.promise)&&null!==d.icon&&(null!==(null==L?void 0:L[ae])||d.icon)?H.createElement("div",{"data-icon":"",className:aL(null==M?void 0:M.icon,null==d||null==(o=d.classNames)?void 0:o.icon)},d.promise||"loading"===d.type&&!d.icon?d.icon||((null==L?void 0:L.loading)?H.createElement("div",{className:aL(null==M?void 0:M.loader,null==d||null==(Pe=d.classNames)?void 0:Pe.loader,"sonner-loader"),"data-visible":"loading"===ae},L.loading):H.createElement(HM,{className:aL(null==M?void 0:M.loader,null==d||null==(Ee=d.classNames)?void 0:Ee.loader),visible:"loading"===ae})):null,"loading"!==d.type?Se:null):null,H.createElement("div",{"data-content":"",className:aL(null==M?void 0:M.content,null==d||null==(a=d.classNames)?void 0:a.content)},H.createElement("div",{"data-title":"",className:aL(null==M?void 0:M.title,null==d||null==(s=d.classNames)?void 0:s.title)},d.jsx?d.jsx:"function"==typeof d.title?d.title():d.title),d.description?H.createElement("div",{"data-description":"",className:aL(P,le,null==M?void 0:M.description,null==d||null==(i=d.classNames)?void 0:i.description)},"function"==typeof d.description?d.description():d.description):null),H.isValidElement(d.cancel)?d.cancel:d.cancel&&nL(d.cancel)?H.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||j,onClick:e=>{nL(d.cancel)&&se&&(null==d.cancel.onClick||d.cancel.onClick.call(d.cancel,e),ke())},className:aL(null==M?void 0:M.cancelButton,null==d||null==(l=d.classNames)?void 0:l.cancelButton)},d.cancel.label):null,H.isValidElement(d.action)?d.action:d.action&&nL(d.action)?H.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||C,onClick:e=>{nL(d.action)&&(null==d.action.onClick||d.action.onClick.call(d.action,e),e.defaultPrevented||ke())},className:aL(null==M?void 0:M.actionButton,null==d||null==(c=d.classNames)?void 0:c.actionButton)},d.action.label):null)};function iL(){if("undefined"==typeof window)return"ltr";if("undefined"==typeof document)return"ltr";const e=document.documentElement.getAttribute("dir");return"auto"!==e&&e?e:window.getComputedStyle(document.documentElement).direction}function lL(e,t){const n={};return[e,t].forEach((e,t)=>{const r=1===t,o=r?"--mobile-offset":"--offset",a=r?"16px":"24px";function s(e){["top","right","bottom","left"].forEach(t=>{n[`${o}-${t}`]="number"==typeof e?`${e}px`:e})}"number"==typeof e||"string"==typeof e?s(e):"object"==typeof e?["top","right","bottom","left"].forEach(t=>{void 0===e[t]?n[`${o}-${t}`]=a:n[`${o}-${t}`]="number"==typeof e[t]?`${e[t]}px`:e[t]}):s(a)}),n}const cL=H.forwardRef(function(e,t){const{id:n,invert:r,position:o="bottom-right",hotkey:a=["altKey","KeyT"],expand:s,closeButton:i,className:l,offset:c,mobileOffset:u,theme:d="light",richColors:p,duration:f,style:h,visibleToasts:m=rL,toastOptions:g,dir:v=iL(),gap:y=oL,icons:b,containerAriaLabel:x="Notifications"}=e,[w,k]=H.useState([]),S=H.useMemo(()=>n?w.filter(e=>e.toasterId===n):w.filter(e=>!e.toasterId),[w,n]),j=H.useMemo(()=>Array.from(new Set([o].concat(S.filter(e=>e.position).map(e=>e.position)))),[S,o]),[C,E]=H.useState([]),[P,_]=H.useState(!1),[N,T]=H.useState(!1),[R,M]=H.useState("system"!==d?d:"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),L=H.useRef(null),O=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),A=H.useRef(null),D=H.useRef(!1),I=H.useCallback(e=>{k(t=>{var n;return(null==(n=t.find(t=>t.id===e.id))?void 0:n.delete)||JM.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return H.useEffect(()=>JM.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{k(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{cd.flushSync(()=>{k(t=>{const n=t.findIndex(t=>t.id===e.id);return-1!==n?[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]:[e,...t]})})})}),[w]),H.useEffect(()=>{if("system"!==d)return void M(d);if("system"===d&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?M("dark"):M("light")),"undefined"==typeof window)return;const e=window.matchMedia("(prefers-color-scheme: dark)");try{e.addEventListener("change",({matches:e})=>{M(e?"dark":"light")})}catch(t){e.addListener(({matches:e})=>{try{M(e?"dark":"light")}catch(LO){console.error(LO)}})}},[d]),H.useEffect(()=>{w.length<=1&&_(!1)},[w]),H.useEffect(()=>{const e=e=>{var t;var n;a.every(t=>e[t]||e.code===t)&&(_(!0),null==(n=L.current)||n.focus());"Escape"!==e.code||document.activeElement!==L.current&&!(null==(t=L.current)?void 0:t.contains(document.activeElement))||_(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a]),H.useEffect(()=>{if(L.current)return()=>{A.current&&(A.current.focus({preventScroll:!0}),A.current=null,D.current=!1)}},[L.current]),H.createElement("section",{ref:t,"aria-label":`${x} ${O}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},j.map((t,n)=>{var o;const[a,d]=t.split("-");return S.length?H.createElement("ol",{key:t,dir:"auto"===v?iL():v,tabIndex:-1,ref:L,className:l,"data-sonner-toaster":!0,"data-sonner-theme":R,"data-y-position":a,"data-x-position":d,style:{"--front-toast-height":`${(null==(o=C[0])?void 0:o.height)||0}px`,"--width":"356px","--gap":`${y}px`,...h,...lL(c,u)},onBlur:e=>{D.current&&!e.currentTarget.contains(e.relatedTarget)&&(D.current=!1,A.current&&(A.current.focus({preventScroll:!0}),A.current=null))},onFocus:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||D.current||(D.current=!0,A.current=e.relatedTarget)},onMouseEnter:()=>_(!0),onMouseMove:()=>_(!0),onMouseLeave:()=>{N||_(!1)},onDragEnd:()=>_(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||T(!0)},onPointerUp:()=>T(!1)},S.filter(e=>!e.position&&0===n||e.position===t).map((n,o)=>{var a,l;return H.createElement(sL,{key:n.id,icons:b,index:o,toast:n,defaultRichColors:p,duration:null!=(a=null==g?void 0:g.duration)?a:f,className:null==g?void 0:g.className,descriptionClassName:null==g?void 0:g.descriptionClassName,invert:r,visibleToasts:m,closeButton:null!=(l=null==g?void 0:g.closeButton)?l:i,interacting:N,position:t,style:null==g?void 0:g.style,unstyled:null==g?void 0:g.unstyled,classNames:null==g?void 0:g.classNames,cancelButtonStyle:null==g?void 0:g.cancelButtonStyle,actionButtonStyle:null==g?void 0:g.actionButtonStyle,closeButtonAriaLabel:null==g?void 0:g.closeButtonAriaLabel,removeToast:I,toasts:S.filter(e=>e.position==n.position),heights:C.filter(e=>e.position==n.position),setHeights:E,expandByDefault:s,gap:y,expanded:P,swipeDirections:e.swipeDirections})})):null}))}),uL=W.createContext(null);function dL({children:e}){const[t,n]=W.useState(!1),[r,o]=W.useState({}),a=W.useRef(null),s=W.useCallback(e=>(o(e),n(!0),new Promise(e=>{a.current=e})),[]),i=W.useCallback(e=>{n(!1);const t=a.current;a.current=null,t&&t(e)},[]);return ee.jsxs(uL.Provider,{value:s,children:[e,ee.jsx(OM,{open:t,onOpenChange:e=>{e||i(!1)},children:ee.jsxs(IM,{className:"max-w-md",children:[ee.jsxs(FM,{children:[ee.jsx(zM,{children:r.title??"确认"}),void 0!==r.description&&ee.jsx(VM,{asChild:!0,children:ee.jsx("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:r.description})})]}),ee.jsxs($M,{children:[ee.jsx(yj,{variant:"outline",onClick:()=>i(!1),children:r.cancelLabel??"取消"}),ee.jsx(pL,{destructive:r.destructive,onClick:()=>i(!0),children:r.confirmLabel??"确定"})]})]})})]})}function pL({destructive:e,onClick:t,children:n}){const r=W.useRef(null);return W.useEffect(()=>{var e;null==(e=r.current)||e.focus()},[]),ee.jsx(yj,{ref:r,onClick:t,className:XS(e&&"bg-red-600 hover:bg-red-700 text-white"),children:n})}function fL(){const e=W.useContext(uL);if(!e)throw new Error("useConfirm must be used within <ConfirmProvider>");return e}function hL(e,t){switch(e){case"thinking":return"Thinking…";case"tool_use":return t?`${t}`:"Tool…";case"tool_result":return"Reading…";case"text":return"Writing…"}}function mL({status:e}){return ee.jsx("span",{className:XS("inline-block w-2 h-2 rounded-full",{"bg-green-500":"running"===e,"bg-zinc-400":"stopped"===e,"bg-yellow-400 animate-pulse":"restarting"===e})})}const gL=H.memo(function({project:e,active:t=!1,statusStack:n=[],syncStatus:r,onDelete:o,onArchive:a,onUnarchive:s,onUpdated:i}){var l,c;const u=cp(),{t:d}=Xf(),p=fL(),[f,h]=W.useState(!1),[m,g]=W.useState(null),[v,y]=W.useState(!1),[b,x]=W.useState(e.name),w=W.useRef(null),k=!!e._sharedPermission;W.useEffect(()=>{let t=!1;return nE(e.id).then(({bytes:e})=>{t||g(e)}).catch(()=>{}),()=>{t=!0}},[e.id]);const S="view"===e._sharedPermission,j=(null==r?void 0:r.hasPath)?r.syncing?d("projsync.syncing"):r.dirty?d("projsync.dirty"):d("projsync.synced"):d("projsync.not_configured"),C=t=>{t.stopPropagation(),x(e.name),y(!0),setTimeout(()=>{var e;return null==(e=w.current)?void 0:e.select()},0)},E=async()=>{const t=b.trim();if(t&&t!==e.name)try{const n=await eE(e.id,t);null==i||i(n),y(!1)}catch(OO){tL.error("Rename failed",{description:null==OO?void 0:OO.message})}else y(!1)},P=ee.jsx(tS.div,{whileHover:e.archived||t?{}:{y:-2},transition:TE.fast,children:ee.jsxs(QS,{className:XS("group cursor-pointer transition-colors relative",e.archived?"opacity-60 hover:opacity-80 hover:border-muted-foreground/40":t?"border-transparent hover:border-transparent bg-transparent shadow-none":"hover:border-muted-foreground/40"),onClick:()=>!e.archived&&u(`/projects/${e.id}`),children:[ee.jsxs(JS,{className:"pb-2",children:[ee.jsxs("div",{className:"flex items-start justify-between gap-2",children:[v?ee.jsx("input",{ref:w,className:"text-base leading-tight font-semibold bg-transparent border-b border-primary outline-none w-full min-w-0",value:b,onChange:e=>x(e.target.value),onBlur:()=>{E()},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),E()),"Escape"===e.key&&y(!1)},onClick:e=>e.stopPropagation()}):ee.jsx(ZS,{className:XS("text-base leading-tight",e.archived&&"text-muted-foreground"),onDoubleClick:k||e.archived?void 0:C,children:e.name}),ee.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[!k&&!e.archived&&ee.jsx(BM,{status:r,title:j,onClick:t=>{t.stopPropagation(),u(`/projects/${e.id}/settings`)}}),ee.jsx("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:!k&&ee.jsxs(ee.Fragment,{children:[e.archived?ee.jsx(yj,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:t=>{t.stopPropagation(),s(e.id)},title:"Restore project",children:ee.jsx(OE,{className:"h-3.5 w-3.5"})}):ee.jsxs(ee.Fragment,{children:[ee.jsx(yj,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:C,title:"Rename project",children:ee.jsx(pP,{className:"h-3.5 w-3.5"})}),ee.jsx(yj,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:e=>{e.stopPropagation(),h(!0)},title:"共享设置",children:ee.jsx(CP,{className:"h-3.5 w-3.5"})}),ee.jsx(yj,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:t=>{t.stopPropagation(),a(e.id)},title:"Archive project",children:ee.jsx(AE,{className:"h-3.5 w-3.5"})})]}),ee.jsx(yj,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:async t=>{t.stopPropagation();await p({title:"删除项目",description:`确认删除项目 "${e.name}"?此操作不可撤销。`,destructive:!0,confirmLabel:"删除"})&&o(e.id)},title:"Delete project",children:ee.jsx(jP,{className:"h-3.5 w-3.5"})})]})})]})]}),ee.jsx("div",{className:"flex items-center gap-1.5",children:e.archived?ee.jsx(GR,{variant:"secondary",className:"text-xs",children:"Archived"}):ee.jsxs(ee.Fragment,{children:[ee.jsx(mL,{status:e.status}),ee.jsx("span",{className:"text-xs text-muted-foreground capitalize",children:e.status}),t&&n.length>0&&ee.jsx("div",{className:"ml-auto",children:ee.jsx(Iw,{mode:"wait",children:n.slice(-1).map(e=>ee.jsx(tS.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:TE.default,children:ee.jsx(GR,{variant:"outline",className:"text-xs font-normal whitespace-nowrap",children:hL(e.phase,e.detail)})},e.id))})})]})})]}),ee.jsxs(tj,{className:"space-y-2",children:[ee.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[ee.jsx(qE,{className:"h-3.5 w-3.5 flex-shrink-0"}),ee.jsx("span",{className:"truncate font-mono",children:e.folderPath}),null!==m&&ee.jsx("span",{className:"flex-shrink-0 ml-auto text-muted-foreground/70",children:(_=m,_>=1073741824?(_/1073741824).toFixed(1)+" GB":_>=1048576?(_/1048576).toFixed(1)+" MB":Math.round(_/1024)+" KB")})]}),ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(GR,{variant:"outline",className:"text-xs font-mono",children:e.cliTool??"claude"}),ee.jsx(GR,{variant:"unlimited"===e.permissionMode?"destructive":"secondary",className:"text-xs",children:"unlimited"===e.permissionMode?"Unlimited":"Limited"}),k&&ee.jsxs(GR,{variant:"outline",className:"text-xs gap-0.5",children:[S?ee.jsx(WE,{className:"h-3 w-3"}):ee.jsx(pP,{className:"h-3 w-3"}),S?"可见":"可编辑"]}),!k&&e.shares&&e.shares.length>0&&ee.jsxs(GR,{variant:"outline",className:"text-xs gap-0.5",children:[ee.jsx(CP,{className:"h-3 w-3"}),e.shares.length]}),ee.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(e.createdAt).toLocaleDateString()})]}),(e.tags??[]).length>0&&ee.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[(e.tags??[]).slice(0,3).map(e=>ee.jsxs("span",{className:"px-1.5 py-0 rounded-full text-[10px] bg-muted text-muted-foreground border border-border",children:["#",e]},e)),((null==(l=e.tags)?void 0:l.length)??0)>3&&ee.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",((null==(c=e.tags)?void 0:c.length)??0)-3]})]})]})]})});var _;const N=t&&!e.archived?ee.jsx("div",{className:"card-active-glow rounded-xl",children:P}):P;return ee.jsxs(ee.Fragment,{children:[N,!k&&i&&ee.jsx(UM,{project:e,open:f,onOpenChange:h,onUpdated:i})]})});function vL({onSelect:e}){const[t,n]=W.useState(""),[r,o]=W.useState(null),[a,s]=W.useState([]),[i,l]=W.useState(!0),[c,u]=W.useState(null),[d,p]=W.useState(!1),[f,h]=W.useState(""),[m,g]=W.useState(null),[v,y]=W.useState(!1),b=W.useRef(null),x=async e=>{l(!0),u(null);try{const t=await LC(e);n(t.path),o(t.parent),s(t.entries)}catch(OO){u(OO instanceof Error?OO.message:"Failed to load directory")}finally{l(!1)}};W.useEffect(()=>{x()},[]),W.useEffect(()=>{d&&setTimeout(()=>{var e;return null==(e=b.current)?void 0:e.focus()},0)},[d]);const w=()=>{p(!1),h(""),g(null)},k=async()=>{const e=f.trim();if(e){y(!0),g(null);try{const{path:n}=await IC(t,e);p(!1),h(""),await x(t),x(n)}catch(OO){g(OO instanceof Error?OO.message:"Failed to create folder")}finally{y(!1)}}},S=t.split("/").filter(Boolean);return ee.jsxs("div",{className:"flex flex-col h-64 border rounded-md overflow-hidden",children:[ee.jsxs("div",{className:"flex items-center gap-1 px-2 py-2 bg-muted border-b flex-shrink-0",children:[ee.jsx(yj,{variant:"ghost",size:"sm",className:"h-6 px-1 flex-shrink-0",onClick:()=>{x()},title:"Home",children:ee.jsx(eP,{className:"h-3 w-3"})}),ee.jsx("div",{className:"flex items-center gap-1 flex-1 overflow-x-auto min-w-0",children:S.map((e,t)=>ee.jsxs(H.Fragment,{children:[ee.jsx(VE,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"}),ee.jsx("button",{className:"text-xs hover:text-foreground text-muted-foreground whitespace-nowrap",onClick:()=>(e=>{const t="/"+S.slice(0,e+1).join("/");x(t)})(t),children:e})]},t))}),ee.jsxs(yj,{variant:"ghost",size:"sm",className:"h-6 px-1.5 flex-shrink-0 gap-1 text-xs",onClick:()=>{h(""),g(null),p(!0)},disabled:d||i||!!c,title:"New folder",children:[ee.jsx(GE,{className:"h-3.5 w-3.5"}),ee.jsx("span",{className:"hidden sm:inline",children:"New folder"})]})]}),ee.jsxs("div",{className:"flex-1 overflow-y-auto",children:[i&&ee.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading..."}),c&&ee.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive px-4 text-center",children:c}),!i&&!c&&ee.jsxs("div",{className:"p-1",children:[r&&ee.jsxs("button",{className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded hover:bg-accent hover:text-accent-foreground",onClick:()=>{x(r)},children:[ee.jsx(IE,{className:"h-4 w-4 text-muted-foreground"}),ee.jsx("span",{children:".."})]}),d&&ee.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5",children:[ee.jsx(YE,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),ee.jsx("input",{ref:b,className:XS("flex-1 text-sm bg-background border rounded px-1.5 py-0.5 outline-none","focus:ring-1 focus:ring-ring",m&&"border-destructive"),placeholder:"Folder name",value:f,onChange:e=>{h(e.target.value),g(null)},onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),k()):"Escape"===e.key&&w()},disabled:v}),ee.jsx("button",{className:"p-1 rounded hover:bg-accent disabled:opacity-50",onClick:()=>{k()},disabled:!f.trim()||v,title:"Create",children:ee.jsx(zE,{className:"h-3.5 w-3.5 text-green-600"})}),ee.jsx("button",{className:"p-1 rounded hover:bg-accent",onClick:w,disabled:v,title:"Cancel",children:ee.jsx(EP,{className:"h-3.5 w-3.5 text-muted-foreground"})})]}),m&&ee.jsx("p",{className:"px-3 pb-1 text-xs text-destructive",children:m}),0===a.length&&!d&&ee.jsx("div",{className:"text-sm text-muted-foreground px-2 py-4 text-center",children:"Empty directory"}),a.map(e=>ee.jsxs("button",{className:XS("flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded text-left","dir"===e.type?"hover:bg-accent hover:text-accent-foreground cursor-pointer":"opacity-40 cursor-not-allowed"),onClick:()=>{"dir"===e.type&&x(e.path)},disabled:"file"===e.type,children:["dir"===e.type?ee.jsx(YE,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}):ee.jsx(HE,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),ee.jsx("span",{className:"truncate",children:e.name})]},e.path))]})]}),ee.jsxs("div",{className:"border-t px-3 py-2 flex items-center justify-between gap-2 flex-shrink-0 bg-background",children:[ee.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:t}),ee.jsx(yj,{size:"sm",onClick:()=>e(t),disabled:!t,children:"Select this folder"})]})]})}function yL(e,t="shift"){return W.useCallback(n=>{if("Enter"!==n.key)return;if(n.nativeEvent.isComposing||229===n.keyCode)return;("shift"===t?!n.shiftKey:n.shiftKey)&&(n.preventDefault(),e())},[e,t])}const bL=[{value:"claude",label:"Claude",desc:"Anthropic Claude Code CLI"},{value:"opencode",label:"OpenCode",desc:"OpenCode CLI (sst/opencode)"},{value:"codex",label:"Codex",desc:"OpenAI Codex CLI"},{value:"qwen",label:"Qwen",desc:"Qwen Code CLI (QwenLM)"},{value:"gemini",label:"Gemini",desc:"Google Gemini CLI"},{value:"terminal",label:"Terminal",desc:"Plain shell (no AI CLI)"}],xL={claude:{limited:"claude",unlimited:"claude --dangerously-skip-permissions"},opencode:{limited:"opencode",unlimited:"opencode --dangerously-skip-permissions"},codex:{limited:"codex",unlimited:"codex --ask-for-approval never --sandbox danger-full-access"},qwen:{limited:"qwen-code",unlimited:"qwen-code --yolo"},gemini:{limited:"gemini",unlimited:"gemini --yolo"},terminal:{limited:"$SHELL (interactive)",unlimited:"$SHELL (interactive)"}};function wL({open:e,onOpenChange:t,onCreated:n}){const[r,o]=W.useState("name"),[a,s]=W.useState(""),[i,l]=W.useState(""),[c,u]=W.useState("claude"),[d,p]=W.useState("limited"),[f,h]=W.useState(!1),[m,g]=W.useState(null),v=e=>{e||(o("name"),s(""),l(""),u("claude"),p("limited"),g(null),h(!1)),t(e)},y=()=>{a.trim()?(g(null),o("folder")):g("Please enter a project name")},b=yL(y,"shift"),x=["name","folder","settings"];return ee.jsx(OM,{open:e,onOpenChange:v,children:ee.jsxs(IM,{className:"sm:max-w-lg",children:[ee.jsxs(FM,{children:[ee.jsx(zM,{children:{name:"New Project — Name",folder:"New Project — Select Folder",settings:"New Project — Settings"}[r]}),ee.jsxs(VM,{children:["name"===r&&"Give your project a name.","folder"===r&&"Choose the working directory for this project.","settings"===r&&"Choose the AI coding tool and run mode."]})]}),ee.jsx("div",{className:"flex gap-2 mb-2",children:x.map((e,t)=>ee.jsx("div",{className:"h-1.5 flex-1 rounded-full "+(r===e?"bg-primary":x.indexOf(r)>t?"bg-primary/40":"bg-muted")},e))}),"name"===r&&ee.jsxs("div",{className:"space-y-4",children:[ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(jj,{htmlFor:"project-name",children:"Project Name"}),ee.jsx(bj,{id:"project-name",placeholder:"My Project",value:a,onChange:e=>s(e.target.value),onKeyDown:b,autoFocus:!0})]}),m&&ee.jsx("p",{className:"text-sm text-destructive",children:m})]}),"folder"===r&&ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(jj,{children:"Working Directory"}),ee.jsx(vL,{onSelect:e=>{l(e),o("settings")}})]}),"settings"===r&&ee.jsxs("div",{className:"space-y-5",children:[ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(jj,{children:"AI Coding Tool"}),ee.jsx("div",{className:"grid grid-cols-2 gap-2",children:bL.map(e=>ee.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer p-3 rounded-md border transition-colors "+(c===e.value?"border-primary bg-primary/5":"hover:bg-accent"),children:[ee.jsx("input",{type:"radio",name:"cliTool",value:e.value,checked:c===e.value,onChange:()=>u(e.value),className:"accent-primary"}),ee.jsxs("div",{children:[ee.jsx("div",{className:"font-medium text-sm",children:e.label}),ee.jsx("div",{className:"text-xs text-muted-foreground",children:e.desc})]})]},e.value))})]}),"terminal"!==c&&ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(jj,{children:"Permission Mode"}),ee.jsxs("div",{className:"space-y-2",children:[ee.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[ee.jsx("input",{type:"radio",name:"permissionMode",value:"limited",checked:"limited"===d,onChange:()=>p("limited"),className:"mt-0.5"}),ee.jsxs("div",{children:[ee.jsx("div",{className:"font-medium text-sm",children:"Limited"}),ee.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",ee.jsx("code",{className:"bg-muted px-1 rounded",children:xL[c].limited})," — asks for permission before file changes."]})]})]}),ee.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[ee.jsx("input",{type:"radio",name:"permissionMode",value:"unlimited",checked:"unlimited"===d,onChange:()=>p("unlimited"),className:"mt-0.5"}),ee.jsxs("div",{children:[ee.jsx("div",{className:"font-medium text-sm",children:"Unlimited"}),ee.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",ee.jsx("code",{className:"bg-muted px-1 rounded",children:xL[c].unlimited})," — acts autonomously."]})]})]})]})]}),ee.jsxs("div",{className:"text-xs text-muted-foreground",children:[ee.jsx("span",{className:"font-medium",children:"Folder:"})," ",ee.jsx("span",{className:"font-mono",children:i})]}),m&&ee.jsx("p",{className:"text-sm text-destructive",children:m})]}),ee.jsxs($M,{children:["name"!==r&&ee.jsx(yj,{variant:"outline",onClick:()=>o("settings"===r?"folder":"name"),disabled:f,children:"Back"}),"name"===r&&ee.jsx(yj,{onClick:y,children:"Next"}),"folder"===r&&ee.jsx(yj,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),"settings"===r&&ee.jsx(yj,{onClick:()=>{(async()=>{h(!0),g(null);try{const e=await Yj({name:a.trim(),folderPath:i,permissionMode:d,cliTool:c});n(e),v(!1)}catch(OO){g(OO instanceof Error?OO.message:"Failed to create project")}finally{h(!1)}})()},disabled:f,children:f?"Creating...":"Create Project"})]})]})})}function kL({open:e,onOpenChange:t,onOpened:n}){const[r,o]=W.useState(""),[a,s]=W.useState(!1),[i,l]=W.useState(null),c=e=>{e||(o(""),l(null),s(!1)),t(e)};return ee.jsx(OM,{open:e,onOpenChange:c,children:ee.jsxs(IM,{className:"sm:max-w-lg",children:[ee.jsxs(FM,{children:[ee.jsx(zM,{children:"Open Existing Project"}),ee.jsxs(VM,{children:["Select a folder that contains a ",ee.jsx("code",{className:"bg-muted px-1 rounded text-xs",children:".ccweb/"})," configuration. The project's history and settings will be restored."]})]}),ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(jj,{children:"Project Folder"}),ee.jsx(vL,{onSelect:e=>{(async e=>{o(e),s(!0),l(null);try{const t=await Xj(e);n(t),c(!1)}catch(OO){l(OO instanceof Error?OO.message:"Failed to open project"),s(!1)}})(e)}})]}),i&&ee.jsx("p",{className:"text-sm text-destructive",children:i}),r&&!i&&a&&ee.jsxs("p",{className:"text-sm text-muted-foreground",children:["Opening project from ",r,"..."]}),ee.jsx($M,{children:ee.jsx(yj,{variant:"outline",onClick:()=>c(!1),disabled:a,children:"Cancel"})})]})})}const SL=`${"https:"===window.location.protocol?"wss:":"ws:"}//${window.location.host}`;function jL(e){return 3e3*Math.min(e,4)+2e3*Math.random()}function CL(e,t){const n=W.useRef(null),r=W.useRef(0),o=W.useRef(!0),a=W.useRef(!1),s=W.useRef(null),i=W.useRef(t);i.current=t;const[l,c]=W.useState(!1),[u,d]=W.useState(0),p=W.useRef(!1),f=W.useRef([]),h=W.useCallback(e=>{var t;(null==(t=n.current)?void 0:t.readyState)===WebSocket.OPEN&&n.current.send(JSON.stringify(e))},[]),m=W.useCallback(()=>{var e;if((null==(e=n.current)?void 0:e.readyState)===WebSocket.OPEN)for(;f.current.length>0;){const e=f.current.shift();n.current.send(JSON.stringify({type:"terminal_input",data:e}))}},[]),g=W.useCallback((e,t)=>{var r;(null==(r=n.current)?void 0:r.readyState)===WebSocket.OPEN?(n.current.send(JSON.stringify({type:"terminal_subscribe",cols:e,rows:t})),p.current=!1):p.current=!0},[]),v=W.useCallback(e=>{var t;(null==(t=n.current)?void 0:t.readyState)===WebSocket.OPEN?n.current.send(JSON.stringify({type:"terminal_input",data:e})):f.current.push(e)},[]),y=W.useCallback((e,t)=>{h({type:"terminal_resize",cols:e,rows:t})},[h]),b=W.useCallback(()=>{h({type:"chat_subscribe",replay:50})},[h]),x=W.useCallback(()=>{if(!o.current)return;if(a.current)return;const t=$j();if(!t)return void(window.location.href="/login");a.current=!0;const l=new WebSocket(`${SL}/ws/projects/${e}`);n.current=l,l.onopen=()=>{a.current=!1,r.current=0,l.send(JSON.stringify({type:"auth",token:t}))},l.onmessage=e=>{var t,n,r,o,a,s,l,u,f,h,g,v,y,b,x,w,k,S,j,C,E,P,_,N,T,R;let M;try{M=JSON.parse(e.data)}catch{return}switch(M.type){case"connected":p.current=!1,c(!0),d(e=>e+1),m(),null==(n=(t=i.current).onConnected)||n.call(t);break;case"terminal_data":null==(o=(r=i.current).onTerminalData)||o.call(r,M.data);break;case"terminal_reset":null==(s=(a=i.current).onTerminalReset)||s.call(a,M.cliTool);break;case"status":null==(u=(l=i.current).onStatus)||u.call(l,M.status);break;case"chat_message":{const e=M;null==(h=(f=i.current).onChatMessage)||h.call(f,e);break}case"project_stopped":{const e=M;null==(v=(g=i.current).onProjectStopped)||v.call(g,e.projectId,e.projectName);break}case"context_update":null==(b=(y=i.current).onContextUpdate)||b.call(y,M);break;case"semantic_update":null==(w=(x=i.current).onSemanticUpdate)||w.call(x,M);break;case"approval_request":null==(S=(k=i.current).onApprovalRequest)||S.call(k,M);break;case"approval_resolved":null==(C=(j=i.current).onApprovalResolved)||C.call(j,M);break;case"track_status_change":case"track_ask_user":case"track_run_complete":"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("ccweb:track-msg",{detail:M})),"track_status_change"===M.type?null==(P=(E=i.current).onTrackStatusChange)||P.call(E,M):"track_ask_user"===M.type?null==(N=(_=i.current).onTrackAskUser)||N.call(_,M):null==(R=(T=i.current).onTrackRunComplete)||R.call(T,M);break;case"flow_started":case"flow_node_active":case"flow_node_completed":case"flow_node_failed":case"flow_var_changed":case"flow_user_input_required":case"flow_done":case"flow_cancelled":case"flow_error":"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("ccweb:flow-msg",{detail:M}));break;case"cli_prompt_detected":case"cli_prompt_dismissed":"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("ccweb:cli-prompt-msg",{detail:M}));break;case"error":console.error("[WS] Server error:",M.message)}},l.onclose=()=>{var e,t;a.current=!1,n.current===l&&(n.current=null),c(!1),null==(t=(e=i.current).onDisconnected)||t.call(e),o.current&&r.current<5&&(r.current++,s.current=window.setTimeout(x,jL(r.current)))},l.onerror=e=>{a.current=!1,console.error("[WS] WebSocket error:",e)}},[e]);return W.useEffect(()=>(o.current=!0,x(),()=>{var e;o.current=!1,s.current&&(clearTimeout(s.current),s.current=null),null==(e=n.current)||e.close(),n.current=null,f.current=[]}),[x]),{subscribeTerminal:g,sendTerminalInput:v,sendTerminalResize:y,subscribeChatMessages:b,connected:l,readyTick:u}}function EL(e){const t=W.useRef(null),n=W.useRef(0),r=W.useRef(!0),o=W.useRef(!1),a=W.useRef(null),s=W.useRef(e);s.current=e;const i=W.useCallback(()=>{if(!r.current)return;if(o.current)return;const e=$j();if(!e)return;o.current=!0;const l=new WebSocket(`${SL}/ws/dashboard`);t.current=l,l.onopen=()=>{o.current=!1,n.current=0,l.send(JSON.stringify({type:"auth",token:e}))},l.onmessage=e=>{var t,n;try{const r=JSON.parse(e.data);"activity_update"===r.type?s.current.onActivityUpdate(r):"project_stopped"===r.type&&(null==(n=(t=s.current).onProjectStopped)||n.call(t,r.projectId,r.projectName))}catch{}},l.onclose=()=>{o.current=!1,t.current===l&&(t.current=null),r.current&&n.current<5&&(n.current++,a.current=window.setTimeout(i,jL(n.current)))},l.onerror=e=>{o.current=!1,console.error("[DashboardWS] Error:",e)}},[]);W.useEffect(()=>(r.current=!0,i(),()=>{var e;r.current=!1,a.current&&(clearTimeout(a.current),a.current=null),null==(e=t.current)||e.close(),t.current=null}),[i])}function PL(e){const t=W.useRef(null),n=W.useRef(0),r=W.useRef(!0),o=W.useRef(!1),a=W.useRef(null),s=W.useRef(e);s.current=e;const i=W.useCallback(()=>{if(!r.current)return;if(o.current)return;const e=$j();if(!e)return;o.current=!0;const l=new WebSocket(`${SL}/ws/dashboard`);t.current=l,l.onopen=()=>{o.current=!1,n.current=0,l.send(JSON.stringify({type:"auth",token:e}))},l.onmessage=e=>{var t,n,r,o,a,i;try{const l=JSON.parse(e.data);if(!l.type||!l.type.startsWith("sync."))return;"sync.start"===l.type?null==(n=(t=s.current).onStart)||n.call(t,l):"sync.progress"===l.type?null==(o=(r=s.current).onProgress)||o.call(r,l):"sync.done"===l.type&&(null==(i=(a=s.current).onDone)||i.call(a,l))}catch{}},l.onclose=()=>{o.current=!1,t.current===l&&(t.current=null),r.current&&n.current<5&&(n.current++,a.current=window.setTimeout(i,jL(n.current)))},l.onerror=()=>{o.current=!1}},[]);W.useEffect(()=>(r.current=!0,i(),()=>{var e;r.current=!1,a.current&&(clearTimeout(a.current),a.current=null),null==(e=t.current)||e.close(),t.current=null}),[i])}function _L({projectId:e,enabled:t,onChatMessage:n,onStatusChange:r,onContextUpdate:o,onApprovalRequest:a,onApprovalResolved:s,onSemanticUpdate:i}){const l=W.useRef(null),c=W.useRef(!0),u=W.useRef(0),d=W.useRef(null),p=W.useRef(!1),f=W.useRef(!1),h=W.useRef([]),m=W.useRef({onChatMessage:n,onStatusChange:r,onContextUpdate:o,onApprovalRequest:a,onApprovalResolved:s,onSemanticUpdate:i});m.current={onChatMessage:n,onStatusChange:r,onContextUpdate:o,onApprovalRequest:a,onApprovalResolved:s,onSemanticUpdate:i};const[g,v]=W.useState(!1),[y,b]=W.useState(0),x=W.useCallback(()=>{if(f.current&&l.current&&l.current.readyState===WebSocket.OPEN)for(;h.current.length>0;){const e=h.current.shift();l.current.send(JSON.stringify({type:"terminal_input",data:e}))}},[]),w=W.useCallback(e=>{var t;f.current&&(null==(t=l.current)?void 0:t.readyState)===WebSocket.OPEN?l.current.send(JSON.stringify({type:"terminal_input",data:e})):h.current.push(e)},[]),k=W.useCallback(()=>{if(!c.current||!t)return;if(p.current)return;const n=$j();if(!n)return;p.current=!0,f.current=!1;const r=new WebSocket(`${SL}/ws/projects/${e}`);l.current=r,r.onopen=()=>{p.current=!1,u.current=0,r.send(JSON.stringify({type:"auth",token:n}))},r.onmessage=e=>{var t,n,o,a,s,i,l,c,u,d,p,h;try{const g=JSON.parse(e.data);"connected"===g.type?(r.send(JSON.stringify({type:"chat_subscribe",replay:50})),f.current=!0,v(!0),b(e=>e+1),x()):"chat_message"===g.type?m.current.onChatMessage(g):"status"===g.type&&g.status?null==(n=(t=m.current).onStatusChange)||n.call(t,g.status):"project_stopped"===g.type?null==(a=(o=m.current).onStatusChange)||a.call(o,"stopped"):"context_update"===g.type?null==(i=(s=m.current).onContextUpdate)||i.call(s,g):"approval_request"===g.type?null==(c=(l=m.current).onApprovalRequest)||c.call(l,g):"approval_resolved"===g.type?null==(d=(u=m.current).onApprovalResolved)||d.call(u,g):"semantic_update"===g.type?null==(h=(p=m.current).onSemanticUpdate)||h.call(p,g):"cli_prompt_detected"!==g.type&&"cli_prompt_dismissed"!==g.type||"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("ccweb:cli-prompt-msg",{detail:g}))}catch{}},r.onclose=()=>{p.current=!1,f.current=!1,v(!1),l.current===r&&(l.current=null),c.current&&t&&(u.current<5?(u.current++,d.current=window.setTimeout(k,jL(u.current))):h.current.length>0&&(console.warn("[MonitorWS] Retries exhausted, dropping",h.current.length,"queued messages"),h.current=[]))},r.onerror=()=>{p.current=!1}},[e,t,x]);return W.useEffect(()=>(c.current=!0,()=>{c.current=!1,h.current=[]}),[]),W.useEffect(()=>(u.current=0,k(),()=>{var e;f.current=!1,d.current&&(clearTimeout(d.current),d.current=null),null==(e=l.current)||e.close(),l.current=null}),[k,t]),{sendInput:w,connected:g,readyTick:y}}const NL="cc_project_order_cache";function TL(){try{const e=localStorage.getItem(NL);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)&&t.every(e=>"string"==typeof e)?t:[]}catch{return[]}}function RL(e){try{localStorage.setItem(NL,JSON.stringify(e))}catch{}}function ML(){const[e,t]=W.useState(TL),n=W.useRef(!1),r=W.useRef(null),o=W.useRef(null),a=W.useRef(!1),s=W.useRef(!0);W.useEffect(()=>{s.current=!0;let e=!1;return Hj().then(r=>{e||n.current||(t(e=>function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(e,r)?e:r),RL(r))}).catch(()=>{}),()=>{e=!0,s.current=!1,o.current&&(clearTimeout(o.current),o.current=null)}},[]);const i=W.useCallback(async()=>{for(;r.current;){const e=r.current;r.current=null,a.current=!0;try{await qj(e)}catch{}a.current=!1}},[]),l=W.useCallback(e=>{n.current=!0,t(e),RL(e),r.current=e,o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{o.current=null,s.current&&(a.current||i())},400)},[i]),c=W.useCallback(t=>{const n=new Map(e.map((e,t)=>[e,t]));return[...t].sort((e,t)=>{const r=n.get(e.id)??1/0,o=n.get(t.id)??1/0;return r===o?0:r-o})},[e]);return W.useMemo(()=>({order:e,setOrder:l,applyOrder:c}),[e,l,c])}const LL=18e6,OL=6048e5;function AL(e,t=18e6){if(!e||void 0===e.utilization||e.utilization<=0||!e.resetAt)return null;const n=new Date(e.resetAt).getTime()-Date.now();if(n<=0)return null;const r=t-n;return r<=0?null:Math.round(e.utilization/(r/t))}function DL({label:e,bucket:t}){if(!t||void 0===t.utilization)return null;const n=t.utilization,r=n<50?"text-green-400":n<80?"text-yellow-400":"text-red-400",o=function(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return n>0?`${n}h${r}m`:`${r}m`}(t.resetAt);return ee.jsxs("span",{className:"text-muted-foreground whitespace-nowrap",children:[e," ",ee.jsxs("span",{className:XS("font-medium",r),children:[n,"%"]}),o&&ee.jsxs("span",{className:"text-muted-foreground/70 ml-0.5",children:["(",o,")"]})]})}function IL({className:e}){const[t,n]=W.useState("loading"),[r,o]=W.useState(!1),a=()=>Tj(Nj.usageMonitorTool,"claude");W.useEffect(()=>{const e=async()=>{try{n(await PC(a()))}catch{n(null)}};e();const t=setInterval(()=>{e()},3e5),r=()=>{e()},o=t=>{t.key===Nj.usageMonitorTool&&e()};return window.addEventListener("ccweb:usage-tool-change",r),window.addEventListener("storage",o),()=>{clearInterval(t),window.removeEventListener("ccweb:usage-tool-change",r),window.removeEventListener("storage",o)}},[]);if("loading"===t)return null;if(!t)return null;const s=!!t.fiveHour,i=!!t.sevenDay,l=!!t.sevenDaySonnet,c=!!t.sevenDayOpus,u=s||i||l||c,d=AL(t.fiveHour,LL),p=AL(t.sevenDay,OL),f=AL(t.sevenDaySonnet,OL),h=null!==d||null!==p||null!==f;return ee.jsxs("div",{className:XS("flex items-center gap-1.5 text-xs",e),children:[h&&ee.jsxs("span",{className:"flex items-center gap-1",children:[null!==d&&ee.jsxs("span",{className:XS("font-medium",d<=100?"text-green-400":"text-orange-400"),title:`5h 配速:按当前速率,窗口结束时预计使用 ${d}%`,children:[d,"%"]}),null!==p&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/40",children:"/"}),ee.jsxs("span",{className:XS("font-medium",p<=100?"text-green-400":"text-orange-400"),title:`7d 配速:按当前速率,窗口结束时预计使用 ${p}%`,children:[p,"%"]})]}),null!==f&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/40",children:"/"}),ee.jsxs("span",{className:XS("font-medium",f<=100?"text-green-400":"text-orange-400"),title:`7d Sonnet 配速:按当前速率,窗口结束时预计使用 ${f}%`,children:[f,"%"]})]})]}),t.planName&&ee.jsx("span",{className:"font-medium text-foreground bg-muted border border-border px-2 py-0.5 rounded-full",children:t.planName}),u&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/50",children:"|"}),ee.jsx(DL,{label:"5h",bucket:t.fiveHour}),i&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/50",children:"·"}),ee.jsx(DL,{label:"7d",bucket:t.sevenDay})]}),l&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/50",children:"·"}),ee.jsx(DL,{label:"7d Sonnet",bucket:t.sevenDaySonnet})]}),c&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/50",children:"·"}),ee.jsx(DL,{label:"7d Opus",bucket:t.sevenDayOpus})]})]}),ee.jsx("button",{onClick:()=>{(async()=>{o(!0);try{n(await _C(a()))}catch{n(null)}finally{o(!1)}})()},className:"text-muted-foreground hover:text-foreground transition-colors",title:"刷新用量信息",children:ee.jsx(hP,{className:XS("h-3 w-3",r&&"animate-spin")})})]})}function FL(e){return e<50?"text-green-400":e<80?"text-yellow-400":"text-red-400"}function $L(e){return e<1024?`${Math.round(e)} B`:e<1048576?`${(e/1024).toFixed(0)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(1)} GB`}function zL(e){return`${$L(e)}/s`}function VL({icon:e,value:t,color:n,title:r}){return ee.jsxs("span",{className:"flex items-center gap-1 whitespace-nowrap",title:r,children:[ee.jsx("span",{className:"text-muted-foreground/70",children:e}),ee.jsx("span",{className:XS("font-medium tabular-nums",n),children:t})]})}function UL({className:e}){const{t:t}=Xf(),[n,r]=W.useState("loading");if(W.useEffect(()=>{let e=!1;const t=async()=>{try{const t=await NC();e||r(t)}catch{e||r(null)}};t();const n=setInterval(()=>{t()},3e3);return()=>{e=!0,clearInterval(n)}},[]),"loading"===n||!n)return null;const o=Math.floor(n.uptimeSec/3600),a=`${n.hostname} · ${n.platform} · ${n.cores} ${t("dashboard.host_cores")} · ${t("dashboard.host_uptime",{hours:o})}`;return ee.jsxs("div",{className:XS("flex items-center gap-2.5 text-xs",e),title:a,children:[ee.jsx(VL,{icon:ee.jsx(UE,{className:"h-3 w-3"}),value:`${n.cpu}%`,color:FL(n.cpu),title:t("dashboard.host_cpu",{load:n.loadAvg})}),ee.jsx(VL,{icon:ee.jsx(sP,{className:"h-3 w-3"}),value:`${n.mem.percent}%`,color:FL(n.mem.percent),title:t("dashboard.host_mem",{used:$L(n.mem.used),total:$L(n.mem.total)})}),n.disk&&ee.jsx(VL,{icon:ee.jsx(ZE,{className:"h-3 w-3"}),value:`${n.disk.percent}%`,color:FL(n.disk.percent),title:t("dashboard.host_disk",{used:$L(n.disk.used),total:$L(n.disk.total)})}),n.net&&ee.jsxs("span",{className:"flex items-center gap-1.5 whitespace-nowrap",title:t("dashboard.host_net"),children:[ee.jsxs("span",{className:"flex items-center gap-0.5 text-muted-foreground",children:[ee.jsx(DE,{className:"h-3 w-3"}),ee.jsx("span",{className:"font-medium tabular-nums",children:zL(n.net.rxBytesPerSec)})]}),ee.jsxs("span",{className:"flex items-center gap-0.5 text-muted-foreground",children:[ee.jsx(FE,{className:"h-3 w-3"}),ee.jsx("span",{className:"font-medium tabular-nums",children:zL(n.net.txBytesPerSec)})]})]})]})}function BL({open:e,onOpenChange:t,kind:n,label:r,content:o}){const a=cp(),[s,i]=W.useState(()=>Tj(Nj.skillhubAuthor,"")),[l,c]=W.useState(""),[u,d]=W.useState(""),[p,f]=W.useState(!1),[h,m]=W.useState(null),[g,v]=W.useState(!0);W.useEffect(()=>{e&&(i(Tj(Nj.skillhubAuthor,"")),c(""),d(""),v(!0),SC().then(m).catch(()=>m({configured:!1,needsReset:!1})).finally(()=>v(!1)))},[e]);const y=()=>{t(!1),a("/settings?tab=hub")},b="quick-prompt"===n?"快捷 Prompt":"Agent Prompt",x=!g&&h&&!h.configured;return ee.jsx(OM,{open:e,onOpenChange:t,children:ee.jsxs(IM,{className:XS("sm:max-w-lg"),children:[ee.jsxs(FM,{children:[ee.jsx(zM,{children:"共享到 ccweb-hub"}),ee.jsxs(VM,{children:["「",r,"」将以 GitHub Issue 形式提交到 ",ee.jsx("code",{children:"zbc0315/ccweb-hub"}),", 使用你配置的 GitHub token。审核通过后会合入为社区 prompt。"]})]}),g?ee.jsxs("div",{className:"py-8 flex items-center justify-center text-sm text-muted-foreground",children:[ee.jsx(rP,{className:"h-4 w-4 mr-2 animate-spin"}),"检查 token 配置…"]}):x?ee.jsxs("div",{className:"space-y-3 py-2",children:[ee.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2.5 text-xs",children:ee.jsxs("div",{className:"flex items-start gap-2",children:[ee.jsx(tP,{className:"h-4 w-4 shrink-0 text-amber-500 mt-0.5"}),ee.jsxs("div",{className:"space-y-1",children:[ee.jsx("div",{className:"font-medium text-foreground",children:(null==h?void 0:h.needsReset)?"之前配置的 token 已失效(服务端密钥可能已轮换),请重新设置":"还没配置 GitHub token"}),ee.jsxs("div",{className:"text-muted-foreground",children:["为保护你的 GitHub 账号,ccweb 不自带 token,需要你用自己的 GitHub fine-grained PAT(只勾 ",ee.jsx("code",{children:"ccweb-hub"})," 仓库的",ee.jsx("code",{children:" Issues: Read and write"}),")。"]})]})]})}),ee.jsxs("div",{className:"flex gap-2 pt-1",children:[ee.jsx(yj,{variant:"outline",onClick:()=>t(!1),className:"flex-1",children:"稍后"}),ee.jsx(yj,{onClick:y,className:"flex-1",children:"去设置页配置"})]})]}):ee.jsxs(ee.Fragment,{children:[ee.jsxs("div",{className:"space-y-3 py-2",children:[ee.jsxs("div",{className:"space-y-1.5",children:[ee.jsx(jj,{htmlFor:"share-author",className:"text-xs",children:"GitHub 用户名(可选,用于作者标注)"}),ee.jsx(bj,{id:"share-author",placeholder:"zbc0315",value:s,onChange:e=>i(e.target.value)})]}),ee.jsxs("div",{className:"space-y-1.5",children:[ee.jsx(jj,{htmlFor:"share-desc",className:"text-xs",children:"一句话描述(可选)"}),ee.jsx(bj,{id:"share-desc",placeholder:"quick-prompt"===n?"这个命令用来...":"这段 prompt 让 Claude...",value:l,onChange:e=>c(e.target.value)})]}),ee.jsxs("div",{className:"space-y-1.5",children:[ee.jsx(jj,{htmlFor:"share-tags",className:"text-xs",children:"标签(逗号分隔,可选)"}),ee.jsx(bj,{id:"share-tags",placeholder:"review, 中文, 代码",value:u,onChange:e=>d(e.target.value)})]})]}),ee.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:[ee.jsxs("div",{className:"font-medium text-foreground mb-1",children:["预览:",b," · ",r]}),ee.jsxs("pre",{className:"whitespace-pre-wrap font-mono text-[11px] leading-snug max-h-32 overflow-y-auto",children:[Array.from(o).slice(0,500).join(""),Array.from(o).length>500&&"…"]})]}),ee.jsxs($M,{children:[ee.jsxs(yj,{variant:"ghost",size:"sm",onClick:y,className:"mr-auto",title:"更换或清除 token",children:[ee.jsx(tP,{className:"h-3.5 w-3.5 mr-1"}),"管理 token"]}),ee.jsx(yj,{variant:"outline",onClick:()=>t(!1),disabled:p,children:"取消"}),ee.jsx(yj,{onClick:()=>{(async()=>{if(!p){f(!0),Rj(Nj.skillhubAuthor,s);try{const e=await EC({kind:n,label:r,body:o,description:l.trim()||void 0,author:s.trim()||void 0,tags:u.split(",").map(e=>e.trim()).filter(Boolean)});tL.success(`已提交:Issue #${e.issueNumber}`,{action:{label:"查看",onClick:()=>window.open(e.issueUrl,"_blank","noopener,noreferrer")}}),t(!1)}catch(OO){const t=OO.message;tL.error(t),/invalid|expired|401/.test(t)&&m({configured:!1,needsReset:!0})}finally{f(!1)}}})()},disabled:p,children:p?ee.jsxs(ee.Fragment,{children:[ee.jsx(rP,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"提交中"]}):ee.jsxs(ee.Fragment,{children:[ee.jsx(mP,{className:"h-3.5 w-3.5 mr-1.5"}),"直接提交"]})})]})]})]})})}function WL(){const[e,t]=W.useState([]),[n,r]=W.useState(!1),[o,a]=W.useState(""),[s,i]=W.useState(""),[l,c]=W.useState(""),[u,d]=W.useState(null),[p,f]=W.useState(""),[h,m]=W.useState(""),[g,v]=W.useState(""),y=W.useRef(null),b=W.useRef(null),[x,w]=W.useState(null);W.useEffect(()=>{nC().then(t).catch(()=>t([]))},[]),W.useEffect(()=>{n&&setTimeout(()=>{var e;return null==(e=y.current)?void 0:e.focus()},0)},[n]),W.useEffect(()=>{u&&setTimeout(()=>{var e;return null==(e=b.current)?void 0:e.focus()},0)},[u]);const k=async()=>{const e=s.trim();if(e)try{const n=await rC({label:o.trim()||e,command:e,...l?{parentId:l}:{}});t(e=>[...e,n]),a(""),i(""),c(""),r(!1)}catch(OO){console.error("[GlobalShortcuts] Failed to add:",OO)}},S=async()=>{const e=h.trim();if(e&&u)try{const n=await oC(u,{label:p.trim()||e,command:e,parentId:g||null});t(e=>e.map(e=>e.id===u?n:e)),d(null)}catch(OO){console.error("[GlobalShortcuts] Failed to save:",OO)}};return ee.jsxs("section",{className:"mt-10",children:[ee.jsxs("div",{className:"flex items-center justify-between mb-4",children:[ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(PP,{className:"h-4 w-4 text-muted-foreground"}),ee.jsx("h2",{className:"text-lg font-semibold",children:"全局快捷 Prompts"}),ee.jsx("span",{className:"text-xs text-muted-foreground",children:"在所有项目的终端中可用"})]}),ee.jsxs("button",{onClick:()=>{r(e=>!e),d(null)},className:XS("flex items-center gap-1.5 text-sm px-3 py-1.5 rounded-md border transition-colors",n?"border-border text-foreground bg-muted":"border-border text-muted-foreground hover:text-foreground hover:bg-muted"),children:[ee.jsx(fP,{className:"h-3.5 w-3.5"}),"新建"]})]}),n&&ee.jsxs("div",{className:"mb-4 p-4 rounded-xl border border-border bg-background space-y-3",children:[ee.jsx("input",{ref:y,placeholder:"名称(可选)",value:o,onChange:e=>a(e.target.value),className:"w-full text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground placeholder:text-muted-foreground outline-none focus:border-border transition-colors"}),ee.jsx("textarea",{placeholder:"命令内容…",value:s,onChange:e=>i(e.target.value),rows:3,className:"w-full text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground placeholder:text-muted-foreground font-mono outline-none focus:border-border transition-colors resize-none",onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),k()),"Escape"===e.key&&(r(!1),a(""),i(""),c(""))}}),ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(XE,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),ee.jsxs("select",{value:l,onChange:e=>c(e.target.value),className:"flex-1 text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground outline-none focus:border-border transition-colors",children:[ee.jsx("option",{value:"",children:"无继承"}),e.map(e=>ee.jsx("option",{value:e.id,children:e.label},e.id))]})]}),ee.jsxs("div",{className:"flex items-center justify-between",children:[ee.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ 保存 · Esc 取消"}),ee.jsxs("div",{className:"flex gap-2",children:[ee.jsx("button",{onClick:()=>{r(!1),a(""),i("")},className:"text-sm px-3 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),ee.jsx("button",{onClick:()=>{k()},disabled:!s.trim(),className:XS("text-sm px-3 py-1 rounded transition-colors text-white",s.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]})]}),0!==e.length||n?ee.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:e.map(n=>u===n.id?ee.jsxs("div",{className:"rounded-xl border border-border bg-background p-3 space-y-2",children:[ee.jsx("input",{ref:b,value:p,onChange:e=>f(e.target.value),placeholder:"名称(可选)",className:"w-full text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground placeholder:text-muted-foreground outline-none focus:border-border transition-colors"}),ee.jsx("textarea",{value:h,onChange:e=>m(e.target.value),rows:3,className:"w-full text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground font-mono outline-none focus:border-border transition-colors resize-none",onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),S()),"Escape"===e.key&&d(null)}}),ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(XE,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),ee.jsxs("select",{value:g,onChange:e=>v(e.target.value),className:"flex-1 text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground outline-none focus:border-border transition-colors",children:[ee.jsx("option",{value:"",children:"无继承"}),e.filter(e=>e.id!==n.id).map(e=>ee.jsx("option",{value:e.id,children:e.label},e.id))]})]}),ee.jsxs("div",{className:"flex gap-2 justify-end",children:[ee.jsx("button",{onClick:()=>d(null),className:"text-xs px-2.5 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),ee.jsx("button",{onClick:()=>{S()},disabled:!h.trim(),className:XS("text-xs px-2.5 py-1 rounded transition-colors text-white",h.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]},n.id):ee.jsxs("div",{className:"group relative rounded-xl border border-border bg-background hover:border-muted-foreground/30 transition-colors p-3",children:[ee.jsx("div",{className:"text-sm font-medium text-foreground truncate pr-14",children:n.label}),n.parentId&&(()=>{const t=e.find(e=>e.id===n.parentId);return t?ee.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[ee.jsx(XE,{className:"h-3 w-3 text-muted-foreground"}),ee.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["继承: ",t.label]})]}):null})(),!n.parentId&&n.label!==n.command&&ee.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-1 pr-14",children:n.command}),ee.jsxs("div",{className:"absolute top-2.5 right-2.5 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[ee.jsx("button",{onClick:()=>w({label:n.label,content:n.command}),className:"p-1 rounded text-muted-foreground hover:text-green-400 transition-colors",title:"共享到 ccweb-hub",children:ee.jsx(vP,{className:"h-3.5 w-3.5"})}),ee.jsx("button",{onClick:()=>{d(n.id),f(n.label),m(n.command),v(n.parentId||""),r(!1)},className:"p-1 rounded text-muted-foreground hover:text-blue-400 transition-colors",title:"编辑",children:ee.jsx(pP,{className:"h-3.5 w-3.5"})}),ee.jsx("button",{onClick:()=>{(async e=>{try{await aC(e),t(t=>t.filter(t=>t.id!==e)),u===e&&d(null)}catch(OO){console.error("[GlobalShortcuts] Failed to delete:",OO)}})(n.id)},className:"p-1 rounded text-muted-foreground hover:text-red-400 transition-colors",title:"删除",children:ee.jsx(EP,{className:"h-3.5 w-3.5"})})]})]},n.id))}):ee.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-muted-foreground/50 border border-dashed border-border rounded-xl",children:[ee.jsx(PP,{className:"h-6 w-6"}),ee.jsx("p",{className:"text-sm",children:"还没有全局快捷 Prompts"})]}),ee.jsx(BL,{open:!!x,onOpenChange:e=>{e||w(null)},kind:"quick-prompt",label:(null==x?void 0:x.label)??"",content:(null==x?void 0:x.content)??""})]})}const HL=W.createContext({theme:"system",resolved:"dark",setTheme:()=>{}});function qL(){return W.useSyncExternalStore(e=>{const t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}function GL({children:e}){const[t,n]=W.useState(()=>Tj(Nj.theme,"system")),r=qL(),o="system"===t?r:t;W.useEffect(()=>{const e=document.documentElement;e.classList.remove("light","dark"),e.classList.add(o)},[o]);return ee.jsx(HL.Provider,{value:{theme:t,resolved:o,setTheme:e=>{n(e),Rj(Nj.theme,e)}},children:e})}function KL(){return W.useContext(HL)}function YL(){const{theme:e,setTheme:t}=KL(),n=[{value:"light",icon:wP,label:"浅色"},{value:"dark",icon:uP,label:"深色"},{value:"system",icon:cP,label:"系统"}];return ee.jsx("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5",children:n.map(({value:n,icon:r,label:o})=>ee.jsx("button",{onClick:()=>t(n),className:XS("p-1 rounded-sm transition-colors",e===n?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:o,children:ee.jsx(r,{className:"h-3.5 w-3.5"})},n))})}const XL={workMinutes:30,breakMinutes:5};function QL(){return Tj(Nj.pomodoroConfig,XL,!0)}const JL=_j(e=>({running:!1,phase:"work",secondsLeft:60*QL().workMinutes,setRunning:t=>e({running:t}),setPhase:t=>e({phase:t}),setSecondsLeft:t=>e({secondsLeft:t})}));function ZL(){const{running:e,phase:t,secondsLeft:n,setPhase:r,setSecondsLeft:o}=JL(),a=W.useCallback(e=>{const t=QL();var n;r(e),o("work"===e?60*t.workMinutes:60*t.breakMinutes),n="break"===e?"休息一下 ☕":"该工作了 💻",tL.info(`番茄钟: ${n}`)},[r,o]);return W.useEffect(()=>{if(!e)return;if(0===n)return void a("work"===t?"break":"work");const r=setTimeout(()=>o(n-1),1e3);return()=>clearTimeout(r)},[e,n,t,a,o]),null}function eO(){const{running:e,phase:t,secondsLeft:n}=JL(),r=Math.floor(n/60),o=n%60,a=`${String(r).padStart(2,"0")}:${String(o).padStart(2,"0")}`,s=W.useRef(null),[i,l]=W.useState(()=>"undefined"==typeof window?360:Math.max(40,Math.floor(window.innerWidth/2.9)));return W.useEffect(()=>{if(!e)return;const t=()=>{const e=s.current;if(!e)return;const t=getComputedStyle(e),n=document.createElement("canvas").getContext("2d");if(!n)return;n.font=`${t.fontWeight} 100px ${t.fontFamily}`;const r=n.measureText(a).width;r&&l(Math.max(40,Math.floor(window.innerWidth/r*100)))},n=requestAnimationFrame(t);return window.addEventListener("resize",t),()=>{cancelAnimationFrame(n),window.removeEventListener("resize",t)}},[e,a.length]),e?ld.createPortal(ee.jsxs("div",{className:"fixed inset-0 flex flex-col items-center justify-center pointer-events-none z-40 select-none overflow-hidden",style:{opacity:"work"===t?.1:.6},children:[ee.jsx("div",{ref:s,className:XS("font-mono font-bold tabular-nums leading-none","work"===t?"text-foreground":"text-blue-400 dark:text-blue-300"),style:{fontSize:`${i}px`},children:a}),ee.jsx("div",{className:"mt-3 text-muted-foreground font-medium tracking-widest uppercase",style:{fontSize:"clamp(12px, 1.5vw, 20px)"},children:"work"===t?"专注工作":"休息一下"})]}),document.body):null}function tO(){const{running:e,phase:t,secondsLeft:n,setRunning:r,setPhase:o,setSecondsLeft:a}=JL(),s=Math.floor(n/60),i=n%60,l=`${String(s).padStart(2,"0")}:${String(i).padStart(2,"0")}`;return ee.jsx("button",{onClick:()=>{if(e){const e=QL();o("work"),a(60*e.workMinutes)}else{const e=QL();o("work"),a(60*e.workMinutes)}r(!e)},className:XS("p-1 rounded transition-colors",e?"work"===t?"text-red-500 bg-red-500/10 hover:bg-red-500/20":"text-green-500 bg-green-500/10 hover:bg-green-500/20":"text-muted-foreground hover:text-foreground hover:bg-muted"),title:e?"work"===t?`工作中 ${l} — 点击停止`:`休息中 ${l} — 点击停止`:"启动番茄钟",children:ee.jsx(SP,{className:"h-4 w-4"})})}const nO="v2026.6.13-e",rO=!!window.electronUpdater;function oO(){const[e,t]=W.useState("idle"),[n,r]=W.useState(!1),[o,a]=W.useState(""),[s,i]=W.useState(0),[l,c]=W.useState(null),[u,d]=W.useState(null),[p,f]=W.useState([]);W.useEffect(()=>{if(!window.electronUpdater)return;return window.electronUpdater.onUpdateStatus(e=>{switch(e.type){case"progress":{const t=e.info;i(Math.round((null==t?void 0:t.percent)??0));break}case"downloaded":t("downloaded");break;case"error":c(e.info||"Download failed"),t("error")}})},[]);const h=W.useCallback(async()=>{t("checking"),c(null),r(!0);try{if(rO){const e=await window.electronUpdater.checkForUpdate();if(e.error)throw new Error(e.error);if(!e.available)return void t("no_update");a(e.version?`v${e.version}`:"new version")}else{const e=await VC();if(!e.updateAvailable)return void t("no_update");a(`v${e.latest}`)}try{const e=await UC();f(e.entries)}catch{f([])}t("update_available")}catch(OO){c(OO instanceof Error?OO.message:"Check failed"),t("error")}},[]),m=W.useCallback(()=>{const e=3e3,n=Date.now(),r=()=>{if(Date.now()-n>3e5)return c("更新超时(5 分钟)— 请检查服务器状态"),void t("update_failed");WC().then(n=>{n?n.success?(a(n.newVersion?`v${n.newVersion}`:"new version"),t("update_complete")):(c(n.error||"Update failed"),t("update_failed")):setTimeout(r,e)}).catch(()=>{setTimeout(r,e)})};setTimeout(r,e)},[]),g=()=>{r(!1),setTimeout(()=>{t("idle"),a(""),c(null),i(0),d(null),f([])},200)};return ee.jsxs(ee.Fragment,{children:[ee.jsx(yj,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{h()},disabled:"checking"===e||"downloading"===e||"executing"===e||"reconnecting"===e,title:"检查更新",children:"checking"===e||"downloading"===e||"executing"===e||"reconnecting"===e?ee.jsx(rP,{className:"h-4 w-4 animate-spin"}):ee.jsx(BE,{className:"h-4 w-4"})}),ee.jsx(OM,{open:n,onOpenChange:e=>{e||g()},children:ee.jsxs(IM,{className:"sm:max-w-md",children:[ee.jsxs(FM,{children:[ee.jsxs(zM,{children:["checking"===e&&"Checking for updates...","no_update"===e&&"Up to date","update_available"===e&&`Update ${o} available`,"downloading"===e&&"Downloading update...","downloaded"===e&&"Update ready to install","executing"===e&&"Updating server...","reconnecting"===e&&"Waiting for server restart...","update_complete"===e&&`Updated to ${o}`,"update_failed"===e&&"Update failed","error"===e&&"Update error"]}),ee.jsxs(VM,{children:["checking"===e&&"Checking for the latest version...","no_update"===e&&`Current version ${nO} is the latest.`,"update_available"===e&&"A new version is available. "+(rO?"Click download to update automatically.":""),"downloading"===e&&`Downloading... ${s}%`,"downloaded"===e&&"The update has been downloaded. Click install to restart and apply.","executing"===e&&"Server is shutting down and installing the update. Please wait...","reconnecting"===e&&"Update installed. Waiting for server to restart...","update_complete"===e&&`Successfully updated from ${nO} to ${o}. Click reload to use the new version.`,"update_failed"===e&&(l||"Update failed. You may need to restart the server manually."),"error"===e&&(l||"An error occurred.")]})]}),"update_available"===e&&p.length>0&&ee.jsxs("div",{children:[ee.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:"更新内容"}),ee.jsx("div",{className:"max-h-48 overflow-y-auto rounded-md border border-border bg-muted/30 p-3 text-sm space-y-2",children:p.map(e=>ee.jsxs("div",{className:"flex gap-2",children:[ee.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground pt-0.5",children:["v",e.version]}),ee.jsx("span",{className:"text-foreground/90 leading-snug",children:e.note})]},e.version))})]}),"downloading"===e&&ee.jsx("div",{className:"w-full bg-muted rounded-full h-2 overflow-hidden",children:ee.jsx("div",{className:"bg-primary h-full transition-all duration-300",style:{width:`${s}%`}})}),("executing"===e||"reconnecting"===e)&&ee.jsx("div",{className:"flex items-center justify-center py-6",children:ee.jsx(rP,{className:"h-8 w-8 animate-spin text-muted-foreground"})}),ee.jsxs($M,{children:["no_update"===e&&ee.jsx(yj,{onClick:g,children:"OK"}),"update_available"===e&&ee.jsxs(ee.Fragment,{children:[ee.jsx(yj,{variant:"outline",onClick:g,children:"Later"}),ee.jsx(yj,{onClick:()=>{(async()=>{if(rO){t("downloading"),i(0);const e=await window.electronUpdater.downloadUpdate();e.success?e.path&&d(e.path):(c(e.error||"Download failed"),t("error"))}else{t("executing");try{await BC(),t("reconnecting"),m()}catch(OO){c(OO instanceof Error?OO.message:"Execute failed"),t("error")}}})()},children:rO?"Download & Install":`Update to ${o}`})]}),"downloaded"===e&&ee.jsxs(ee.Fragment,{children:[ee.jsx(yj,{variant:"outline",onClick:g,children:"Later"}),ee.jsx(yj,{onClick:()=>{var e;null==(e=window.electronUpdater)||e.quitAndInstall(u||void 0)},children:"Restart & Install"})]}),"update_complete"===e&&ee.jsx(yj,{onClick:()=>window.location.reload(),children:"Reload Page"}),"update_failed"===e&&ee.jsx(yj,{onClick:g,children:"Close"}),"error"===e&&ee.jsx(yj,{onClick:g,children:"Close"})]})]})})]})}function aO(e){return e.map(e=>"text"===e.type?e.content:`\n\`\`\`${e.type}\n${e.content}\n\`\`\`\n`).join("")}function sO(e){return"[200~"+e.replace(/\x1b\[20[01]~/g,"").replace(/\n/g,"\r")+"[201~\r"}function iO(e,t){return{id:e.id??t(),role:e.role,content:aO(e.blocks),blocks:e.blocks,ts:e.timestamp}}const lO=3e4;function cO({project:e,liveMessages:t,ws:n,historyLimit:r=20,liveWindow:o=50,historyEnabled:a=!0}){const s=e.id,[i,l]=W.useState("running"===e.status?"live":"stopped"),{history:c,hasMore:u,reload:d,loadMore:p}=function({projectId:e,historyLimit:t=20,enabled:n=!0}){const[r,o]=W.useState([]),[a,s]=W.useState(!1),[i,l]=W.useState(!1),c=W.useRef(0),u=W.useCallback(()=>"h"+ ++c.current,[]),d=W.useRef({projectId:e,enabled:n});d.current={projectId:e,enabled:n};const p=W.useCallback(async()=>{if(!d.current.enabled)return;const e=d.current.projectId;l(!0);try{const n=await tE(e,{limit:t});if(d.current.projectId!==e)return;const r=[];for(const e of n.blocks){const t=iO(e,u);t.content.trim()&&r.push(t)}o(r),s(n.hasMore)}catch{}finally{l(!1)}},[t,u]),f=W.useCallback(async()=>{if(!a||i||0===r.length)return;if(!d.current.enabled)return;const e=d.current.projectId,n=r[0];if(n.id&&!n.id.startsWith("h")){l(!0);try{const r=await tE(e,{limit:t,before:n.id});if(d.current.projectId!==e)return;const a=[];for(const e of r.blocks){const t=iO(e,u);t.content.trim()&&a.push(t)}o(e=>[...a,...e]),s(r.hasMore)}catch{}finally{l(!1)}}},[t,a,i,r,u]);return W.useEffect(()=>{n&&p()},[e,n]),{history:r,hasMore:a,isLoading:i,reload:p,loadMore:f}}({projectId:s,historyLimit:r,enabled:a}),[f,h]=W.useState([]),m=W.useRef(0),g=W.useCallback(()=>"m"+ ++m.current,[]),v=W.useRef([]),y=W.useRef(0),b=W.useCallback(()=>"p"+ ++y.current,[]),x=W.useRef(!1),w=W.useRef(0);W.useEffect(()=>{if(t.length<w.current&&(w.current=0),t.length<=w.current)return;const e=t.slice(w.current);w.current=t.length;for(const t of e){x.current=!0;const e=aO(t.blocks);if(e.trim()){if("user"===t.role){const n=e.trim(),r=v.current.findIndex(e=>"sent"===e.status&&e.text.trim()===n);if(-1!==r){const e=v.current[r];if(v.current.splice(r,1),e.timer&&(clearTimeout(e.timer),e.timer=null),e.displayId&&t.id){const n=t.id;h(t=>t.map(t=>t.id===e.displayId?{...t,id:n}:t))}e.resolve("delivered");continue}}h(n=>{if(t.id&&n.some(e=>e.id===t.id))return n;const r={id:t.id??g(),role:t.role,content:e,blocks:t.blocks,ts:t.timestamp};return[...n,r].slice(-o)})}}},[t,g,o]),W.useEffect(()=>{if("live"!==i)return void(x.current=!1);const e=setTimeout(()=>{x.current||d()},3e3);return()=>clearTimeout(e)},[i,d]),W.useEffect(()=>{"running"!==e.status||"stopped"!==i&&"error"!==i?"stopped"===e.status&&"live"===i&&l("stopped"):(h([]),l("live"))},[e.status]);const k=W.useRef(null),S=W.useRef(0),j=W.useCallback(e=>{e&&h(t=>t.filter(t=>t.id!==e))},[]),C=W.useCallback(()=>{const e=v.current;v.current=[];for(const t of e)t.timer&&(clearTimeout(t.timer),t.timer=null),"sent"===t.status&&j(t.displayId),t.resolve("failed")},[j]),E=W.useCallback(e=>{const t=g();e.displayId=t,e.status="sent",h(n=>[...n,{id:t,role:"user",content:e.text,ts:(new Date).toISOString()}].slice(-o)),n.send(e.isSlashCommand?e.text.replace(/\n/g,"\r")+"\r":sO(e.text))},[n,g,o]);W.useEffect(()=>{if(!n.connected)return;if("live"!==i)return;const e=v.current.filter(e=>"queued"===e.status);if(0!==e.length)for(const t of e)if(E(t),t.isSlashCommand){const e=v.current.indexOf(t);-1!==e&&v.current.splice(e,1),t.timer&&(clearTimeout(t.timer),t.timer=null),t.resolve("delivered")}},[n.connected,i,E]),W.useEffect(()=>()=>{k.current&&clearTimeout(k.current);for(const e of v.current)e.timer&&(clearTimeout(e.timer),e.timer=null),e.resolve("failed");v.current=[]},[]);const P=W.useCallback(e=>new Promise(t=>{const r=e.trimStart().startsWith("/");if(v.current.length>=20){const e=v.current.shift();e&&(e.timer&&clearTimeout(e.timer),"sent"===e.status&&j(e.displayId),e.resolve("failed"))}const o={id:b(),text:e,isSlashCommand:r,status:"queued",resolve:t,timer:null};if(v.current.push(o),r){if("live"===i&&n.connected){E(o);const e=v.current.indexOf(o);return-1!==e&&v.current.splice(e,1),void t("delivered")}o.timer=setTimeout(()=>{const e=v.current.indexOf(o);-1!==e&&v.current.splice(e,1),o.timer=null,"sent"===o.status&&j(o.displayId),t("failed")},lO)}else o.timer=setTimeout(()=>{const e=v.current.indexOf(o);-1!==e&&v.current.splice(e,1),o.timer=null,"sent"===o.status&&j(o.displayId),t("failed")},lO);if("live"===i&&n.connected)E(o);else if("waking"===i||"live"===i);else{const e=++S.current;l("waking"),Jj(s).then(()=>{e===S.current&&(k.current&&clearTimeout(k.current),l("live"))}).catch(t=>{e===S.current&&(tL.error(`启动失败: ${t instanceof Error?t.message:String(t)}`),l("error"),C())}),k.current=setTimeout(()=>{e===S.current&&v.current.some(e=>"queued"===e.status)&&(tL.error("启动超时(10s)"),l("error"),C())},1e4)}}),[i,n,s,E,C,j,b]),_=W.useCallback(e=>{const t=e.replace(/\r$/,"").trim();if(!t)return;const n=g();h(e=>[...e,{id:n,role:"user",content:t,ts:(new Date).toISOString()}].slice(-o));const r={id:b(),text:t,isSlashCommand:!1,status:"sent",displayId:n,resolve:()=>{},timer:setTimeout(()=>{const e=v.current.indexOf(r);-1!==e&&v.current.splice(e,1),r.timer=null},lO)};v.current.push(r)},[g,b,o]),N=W.useMemo(()=>{const e=new Set;for(const t of f)t.id&&e.add(t.id);return[...c.filter(t=>!t.id||!e.has(t.id)),...f]},[c,f]);return{state:i,setState:l,messages:N,historyMessages:c,displayMessages:f,setDisplayMessages:h,hasMoreHistory:u,loadMoreHistory:p,reloadHistory:d,liveReceivedRef:x,sendMessage:P,appendUserMessage:_,isWaking:"waking"===i,isRunning:"live"===i}}function uO(e,t,n){const r=W.useRef(!0),o=W.useRef(0),a=W.useCallback(()=>{const t=e.current;t&&(t.scrollHeight<=t.clientHeight||(o.current=performance.now(),t.scrollTop=t.scrollHeight))},[e]);return W.useEffect(()=>{const t=e.current;t&&(t.style.overflowAnchor="none")},[e]),W.useEffect(()=>{const t=e.current;if(!t)return;const n=()=>{if(performance.now()-o.current<80)return;const e=t.scrollHeight-t.scrollTop-t.clientHeight<80;r.current=e};return t.addEventListener("scroll",n,{passive:!0}),()=>t.removeEventListener("scroll",n)},[e]),W.useLayoutEffect(()=>{r.current&&a()},[a,...n]),W.useEffect(()=>{const e=t.current;if(!e)return;const n=new ResizeObserver(()=>{r.current&&a()});return n.observe(e),()=>n.disconnect()},[t,a]),{pinnedRef:r,scrollToBottom:a}}const dO=H.memo(function({project:e,externalStatus:t,active:n=!1}){const r=cp(),[o,a]=W.useState(""),[s,i]=W.useState(!1),l=W.useRef(null),c=W.useRef(null),[u,d]=W.useState([]),p=W.useRef(0),f=W.useCallback(e=>{d(t=>{const n=[...t,e];return n.length>200?n.slice(-200):n}),"assistant"===e.role&&(i(!0),setTimeout(()=>i(!1),1e3))},[]),h=W.useCallback(e=>{var t;"stopped"===e&&(null==(t=S.current)||t.call(S,"stopped"))},[]),{sendInput:m,connected:g}=_L({projectId:e.id,enabled:!0,onChatMessage:f,onStatusChange:h}),{state:v,setState:y,messages:b,sendMessage:x,isRunning:w,isWaking:k}=cO({project:e,liveMessages:u,ws:{send:m,connected:g},historyLimit:4,liveWindow:4}),S=W.useRef(y);S.current=y,W.useEffect(()=>{"stopped"===v&&(d([]),p.current=0)},[v]),W.useEffect(()=>{t&&("running"!==t||"stopped"!==v&&"error"!==v?"stopped"===t&&"live"===v&&y("stopped"):(d([]),y("live")))},[t]),uO(l,c,[b]);const[j,C]=W.useState(!1),E=yL(W.useCallback(async()=>{const e=o.trim();if(!e||j)return;C(!0);const t=await x(e);C(!1),"delivered"===t&&a("")},[o,j,x]),"enter"),P="stopped"===v,_=b.slice(-4),N=ee.jsxs("div",{className:XS("flex flex-col h-full rounded-xl overflow-hidden bg-background transition-colors duration-300",n?"border-transparent bg-transparent shadow-none":s?"border border-blue-500":"border border-border","error"===v&&"border border-red-500/50"),children:[ee.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-1.5 border-b border-border bg-muted/30 transition-colors",children:[ee.jsx(JE,{className:"h-3.5 w-3.5 text-muted-foreground/40 flex-shrink-0 cursor-grab active:cursor-grabbing"}),ee.jsx("span",{className:"font-medium text-sm truncate flex-1 cursor-pointer hover:text-blue-400 transition-colors",onClick:()=>r(`/projects/${e.id}`),title:"打开项目详情",children:e.name}),ee.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:e.cliTool??"claude"}),ee.jsx("span",{className:XS("w-2 h-2 rounded-full flex-shrink-0",w?"bg-green-500":k?"bg-yellow-400 animate-pulse":"bg-zinc-400")})]}),ee.jsx("div",{ref:l,className:"flex-1 overflow-y-auto min-h-0 text-xs",children:ee.jsxs("div",{ref:c,className:"p-2 space-y-2 min-h-full",children:[_.map(e=>{const t="user"===e.role;return ee.jsx("div",{className:XS("flex",t?"justify-end":"justify-start"),children:ee.jsx("div",{className:XS("max-w-[85%] rounded-2xl px-2.5 py-1.5 whitespace-pre-wrap break-words leading-relaxed",t?"bg-blue-500/15 text-foreground border border-blue-500/20 rounded-br-sm dark:bg-blue-500/20 dark:border-blue-500/25":"bg-secondary text-secondary-foreground border border-border rounded-bl-sm"),children:ee.jsx("div",{className:"line-clamp-6",children:e.content})})},e.id)}),P&&0===_.length&&ee.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/40 text-xs",children:"无对话记录"}),k&&ee.jsx("div",{className:"flex items-center justify-center h-full text-yellow-400 text-xs animate-pulse",children:"启动中..."})]})}),ee.jsx("div",{className:"border-t border-border p-1.5",children:ee.jsx("input",{type:"text",value:o,onChange:e=>a(e.target.value),onKeyDown:E,disabled:k||j,placeholder:k?"启动中...":j?"发送中…":P?"输入命令(自动启动)... Shift+⏎":"输入命令... Shift+⏎",className:XS("w-full bg-transparent text-xs font-mono outline-none placeholder:text-muted-foreground/40 px-1.5 py-1",(k||j)&&"opacity-50 cursor-not-allowed")})})]});return n?ee.jsx("div",{className:"card-active-glow rounded-xl h-full",children:N}):N});function pO({projects:e,projectStatuses:t,activeProjectIds:n}){const r=W.useMemo(()=>e.filter(e=>!e.archived),[e]),{order:o,setOrder:a,applyOrder:s}=ML(),[i,l]=W.useState(null),[c,u]=W.useState(null),d=W.useRef(null),p=W.useMemo(()=>s(r),[r,s]),f=W.useCallback((e,t)=>{l(t),e.dataTransfer.effectAllowed="move";const n=document.createElement("div");n.style.width="1px",n.style.height="1px",n.style.opacity="0.01",document.body.appendChild(n),e.dataTransfer.setDragImage(n,0,0),d.current=n},[]),h=W.useCallback((e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect="move",u(t)},[]),m=W.useCallback((e,t)=>{if(e.preventDefault(),!i||i===t)return l(null),void u(null);const n=p.map(e=>e.id),r=o.length?[...o]:n;for(const o of n)r.includes(o)||r.push(o);const s=r.indexOf(i),c=r.indexOf(t);if(-1===s||-1===c)return l(null),void u(null);r.splice(s,1),r.splice(c,0,i),a(r),l(null),u(null)},[i,p,o,a]),g=W.useCallback(()=>{l(null),u(null),d.current&&(d.current.remove(),d.current=null)},[]),{cols:v,rows:y}=(b=p.length)<=1?{cols:1,rows:1}:b<=2?{cols:2,rows:1}:b<=4?{cols:2,rows:2}:b<=6?{cols:3,rows:2}:b<=9?{cols:3,rows:3}:b<=12?{cols:4,rows:3}:{cols:4,rows:Math.ceil(b/4)};var b;if(0===p.length)return ee.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/50 text-sm",children:"没有活跃项目"});const x=y<=3;return ee.jsx("div",{className:"h-full w-full p-2 gap-2 overflow-y-auto",style:{display:"grid",gridTemplateColumns:`repeat(${v}, minmax(0, 1fr))`,gridAutoRows:x?`minmax(180px, min(${Math.floor(100/y)}vh, 350px))`:"280px"},children:p.map(e=>ee.jsx("div",{draggable:!0,onDragStart:t=>f(t,e.id),onDragOver:t=>h(t,e.id),onDrop:t=>m(t,e.id),onDragEnd:g,className:XS("transition-all duration-200",i===e.id&&"opacity-40 scale-95",c===e.id&&i!==e.id&&"ring-2 ring-ring/50 rounded-xl"),children:ee.jsx(dO,{project:e,externalStatus:t.get(e.id),active:n.has(e.id)})},e.id))})}function fO(){const{t:e}=Xf(),t=cp(),{projects:n,loading:r,error:o,hasFetched:a,fetchProjects:s,addProject:i,updateProject:l,removeProject:c}=Dj(),u=Oj(e=>e.clearToken),[d,p]=W.useState(!1),[f,h]=W.useState(!1),[m,g]=W.useState(new Set),v=W.useRef(new Map),[y,b]=W.useState(new Map),x=W.useRef(0),[w,k]=W.useState(!!document.fullscreenElement),[S,j]=W.useState(!1),[C,E]=Lj(Nj.monitorMode,!1,{parse:!0}),[P,_]=W.useState(new Map),[N,T]=W.useState(()=>"1"===sessionStorage.getItem("ccweb_claudemem_available"));W.useEffect(()=>{null===sessionStorage.getItem("ccweb_claudemem_available")&&(async()=>{var e;const t=await TC(),n=!!((null==t?void 0:t.available)&&((null==(e=t.counts)?void 0:e.observations)??0)>0);sessionStorage.setItem("ccweb_claudemem_available",n?"1":"0"),T(n)})()},[]);W.useEffect(()=>{const e=()=>k(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),W.useEffect(()=>{s()},[s]);EL({onActivityUpdate:W.useCallback(e=>{if(e.status){const t=Dj.getState().projects.find(t=>t.id===e.projectId);t&&t.status!==e.status&&l({...t,status:e.status}),_(t=>{const n=new Map(t);return n.set(e.projectId,e.status),n})}const t=Date.now(),n=v.current;if(e.active){g(t=>t.has(e.projectId)?t:new Set(t).add(e.projectId));const r=n.get(e.projectId)??[];let o=!1;if(e.semantic){const n=r[r.length-1];`${e.semantic.phase}:${e.semantic.detail??""}`!==(n?`${n.phase}:${n.detail??""}`:"")?(r.push({id:x.current++,phase:e.semantic.phase,detail:e.semantic.detail,ts:t}),o=!0):n&&(n.ts=t)}const a=r.filter(e=>t-e.ts<8e3),s=a.length>3?a.slice(-3):a;s.length!==r.length&&(o=!0),n.set(e.projectId,s),o&&b(new Map(n))}else g(t=>{if(!t.has(e.projectId))return t;const n=new Set(t);return n.delete(e.projectId),n}),n.has(e.projectId)&&n.get(e.projectId).length>0&&(n.set(e.projectId,[]),b(new Map(n)))},[l])});const[R,M]=W.useState({}),L=W.useCallback(async e=>{try{const t=await jE(e);M(n=>{var r;if(e)return t;const o={};for(const[e,a]of Object.entries(t))o[e]={...a,dirty:a.dirty??(null==(r=n[e])?void 0:r.dirty)??null};return o})}catch{}},[]);W.useEffect(()=>{let e=!1;(async()=>{await L(!1),e||await L(!0)})();const t=setInterval(()=>{L(!0)},3e4);return()=>{e=!0,clearInterval(t)}},[L]),PL({onStart:()=>{L(!1)},onDone:()=>{L(!0)}}),W.useEffect(()=>{const e=setInterval(()=>{const e=Date.now(),t=v.current;let n=!1;for(const[r,o]of t){const a=o.filter(t=>e-t.ts<8e3);a.length!==o.length&&(t.set(r,a),n=!0)}n&&b(new Map(t)),g(e=>{let n=!1;const r=new Set(e);for(const o of e){const e=t.get(o);e&&0!==e.length||(r.delete(o),n=!0)}return n?r:e})},3e3);return()=>clearInterval(e)},[]);const O=W.useMemo(()=>n.filter(e=>!e.archived),[n]),A=W.useMemo(()=>n.filter(e=>e.archived),[n]),D=W.useMemo(()=>Array.from(new Set(n.flatMap(e=>e.tags??[]))),[n]),[I,F]=W.useState([]),$=W.useMemo(()=>0===I.length?O:O.filter(e=>I.some(t=>{var n;return null==(n=e.tags)?void 0:n.includes(t)})),[O,I]),[z,V]=W.useState(!1),U=W.useCallback(async()=>{if(!z){V(!0);try{const t=await wE(),n=t.results.filter(e=>e.ok).length,r=t.results.filter(e=>e.skipped).length,o=t.total-n-r;tL.success(e("dashboard.sync_done_toast",{ok:n,skipped:r,failed:o}))}catch(OO){tL.error(e("dashboard.sync_failed_toast",{message:OO.message}))}finally{V(!1)}}},[z]),{order:B,setOrder:H,applyOrder:q}=ML(),[G,K]=W.useState(null),[Y,X]=W.useState(null),Q=W.useMemo(()=>q($),[$,q]),J=W.useCallback(e=>K(e),[]),Z=W.useCallback(()=>{K(null),X(null)},[]),te=W.useCallback((e,t)=>{e.preventDefault(),X(t)},[]),ne=W.useCallback((e,t,n)=>{if(e.preventDefault(),!n||n===t)return void X(null);const r=Q.map(e=>e.id),o=B.length?[...B]:r;for(const i of r)o.includes(i)||o.push(i);const a=o.indexOf(n),s=o.indexOf(t);if(-1===a||-1===s)return K(null),void X(null);o.splice(a,1),o.splice(s,0,n),H(o),K(null),X(null)},[Q,B,H]),re={onDelete:e=>{(async e=>{try{await Qj(e),c(e)}catch(OO){tL.error(OO instanceof Error?OO.message:"Failed to delete project")}})(e)},onArchive:e=>{(async e=>{try{const t=await Zj(e);l(t)}catch(OO){tL.error(OO instanceof Error?OO.message:"Failed to archive project")}})(e)},onUnarchive:e=>{(async e=>{try{const t=await tC(e);l(t)}catch(OO){tL.error(OO instanceof Error?OO.message:"Failed to restore project")}})(e)},onUpdated:l},[oe,ae]=W.useState(!1),se=[{key:"skillhub",icon:xP,label:e("dashboard.skillhub_title"),run:()=>t("/skillhub")},...N?[{key:"memories",icon:$E,label:e("dashboard.memories_title"),run:()=>t("/memories")}]:[],{key:"mobile",icon:bP,label:e("dashboard.mobile_title"),run:()=>t("/mobile")},{key:"settings",icon:gP,label:e("dashboard.settings_title"),run:()=>t("/settings")},{key:"fullscreen",icon:w?iP:aP,label:e(w?"dashboard.fullscreen_exit":"dashboard.fullscreen_enter"),run:()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()}}];return ee.jsxs("div",{className:"min-h-screen bg-background",children:[ee.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:ee.jsxs("div",{className:"w-full px-4 sm:px-6 h-14 flex items-center gap-3",children:[ee.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[ee.jsx(kP,{className:"h-5 w-5"}),ee.jsxs("div",{children:[ee.jsx("span",{className:"font-semibold text-lg leading-tight block",children:"CC Web"}),ee.jsx("span",{className:"text-[10px] text-muted-foreground leading-none",children:nO})]})]}),ee.jsxs("div",{className:"hidden md:flex items-center gap-4 pl-2 min-w-0",children:[ee.jsx(IL,{}),ee.jsx(UL,{className:"hidden lg:flex"})]}),ee.jsx("div",{className:"flex-1"}),ee.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[ee.jsx("div",{className:"hidden lg:flex items-center gap-0.5",children:se.map(e=>ee.jsx(yj,{variant:"ghost",size:"sm",onClick:e.run,title:e.label,children:ee.jsx(e.icon,{className:"h-4 w-4"})},e.key))}),ee.jsxs(UR,{open:oe,onOpenChange:ae,children:[ee.jsx(BR,{asChild:!0,children:ee.jsx(yj,{variant:"ghost",size:"sm",className:"lg:hidden",title:e("dashboard.more"),children:ee.jsx(dP,{className:"h-4 w-4"})})}),ee.jsx(WR,{align:"end",className:"w-44 p-1",children:se.map(e=>ee.jsxs("button",{onClick:()=>{e.run(),ae(!1)},className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors hover:bg-accent",children:[ee.jsx(e.icon,{className:"h-4 w-4 text-muted-foreground"}),e.label]},e.key))})]}),ee.jsx(yj,{variant:"ghost",size:"sm",onClick:()=>E(!C),title:e(C?"dashboard.monitor_title_grid":"dashboard.monitor_title_monitor"),className:XS(C&&"bg-accent font-medium"),children:C?ee.jsx(nP,{className:"h-4 w-4"}):ee.jsx(cP,{className:"h-4 w-4"})}),ee.jsx(oO,{}),ee.jsx("span",{className:"hidden sm:inline-flex",children:ee.jsx(tO,{})}),ee.jsx(YL,{}),ee.jsxs(yj,{variant:"ghost",size:"sm",onClick:()=>{sessionStorage.removeItem("ccweb_claudemem_available"),u(),t("/login")},title:e("dashboard.logout"),children:[ee.jsx(oP,{className:"h-4 w-4 sm:mr-2"}),ee.jsx("span",{className:"hidden sm:inline",children:e("dashboard.logout")})]})]})]})}),C&&ee.jsx("div",{className:"flex-1 min-h-0",children:ee.jsx(pO,{projects:n,projectStatuses:P,activeProjectIds:m})}),!C&&ee.jsxs("main",{className:"max-w-6xl mx-auto px-4 py-8",children:[ee.jsxs("div",{className:"flex items-center justify-between mb-6",children:[ee.jsxs("div",{children:[ee.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Projects"}),ee.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Each project runs Claude CLI in a dedicated terminal session."})]}),ee.jsxs("div",{className:"flex gap-2",children:[ee.jsxs(yj,{variant:"outline",onClick:()=>{U()},disabled:z,title:e("dashboard.sync_all_title"),children:[z?ee.jsx(rP,{className:"h-4 w-4 mr-2 animate-spin"}):ee.jsx(KE,{className:"h-4 w-4 mr-2"}),e("dashboard.sync_all")]}),ee.jsxs(yj,{variant:"outline",onClick:()=>h(!0),children:[ee.jsx(qE,{className:"h-4 w-4 mr-2"}),"Open Project"]}),ee.jsxs(yj,{onClick:()=>p(!0),children:[ee.jsx(fP,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),r&&!a&&ee.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4",children:Array.from({length:3}).map((e,t)=>ee.jsx(HR,{className:"h-32 rounded-xl"},t))}),o&&ee.jsx("div",{className:"text-center text-destructive py-12",children:o}),a&&!r&&!o&&0===n.length&&ee.jsxs("div",{className:"text-center py-20",children:[ee.jsx(kP,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),ee.jsx("h2",{className:"text-lg font-semibold mb-2",children:"No projects yet"}),ee.jsx("p",{className:"text-muted-foreground text-sm mb-6",children:"Create a new project or open an existing one."}),ee.jsxs("div",{className:"flex gap-2 justify-center",children:[ee.jsxs(yj,{variant:"outline",onClick:()=>h(!0),children:[ee.jsx(qE,{className:"h-4 w-4 mr-2"}),"Open Project"]}),ee.jsxs(yj,{onClick:()=>p(!0),children:[ee.jsx(fP,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),!r&&!o&&D.length>0&&ee.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-4",children:[D.map(e=>ee.jsxs("button",{onClick:()=>F(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),className:XS("px-2 py-0.5 rounded-full text-xs border transition-colors",I.includes(e)?"bg-primary text-primary-foreground border-transparent font-medium":"bg-muted text-muted-foreground border-border hover:border-muted-foreground/40"),children:["#",e]},e)),I.length>0&&ee.jsx("button",{onClick:()=>F([]),className:"px-2 py-0.5 rounded-full text-xs text-muted-foreground hover:text-foreground transition-colors",children:e("dashboard.tags_clear")})]}),!r&&!o&&Q.length>0&&ee.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4",children:Q.map((e,t)=>ee.jsx(tS.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{...TE.slow,delay:Math.min(.05*t,.3),ease:"easeOut"},draggable:!0,onDragStart:()=>J(e.id),onDragOver:t=>te(t,e.id),onDrop:t=>ne(t,e.id,G),onDragEnd:Z,style:{opacity:G===e.id?.4:1,cursor:"grab"},className:XS(Y===e.id&&G!==e.id&&"ring-2 ring-ring/50 rounded-xl"),children:ee.jsx(gL,{project:e,active:m.has(e.id),statusStack:y.get(e.id)??[],syncStatus:R[e.id],...re})},e.id))}),!r&&!o&&A.length>0&&ee.jsxs("div",{className:"mt-10",children:[ee.jsxs("button",{className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors mb-4 group",onClick:()=>j(e=>!e),children:[ee.jsx(tS.span,{animate:{rotate:S?90:0},transition:TE.default,children:ee.jsx(VE,{className:"h-4 w-4"})}),ee.jsx("span",{className:"font-medium",children:"Archived"}),ee.jsx("span",{className:"text-xs bg-muted rounded-full px-2 py-0.5",children:A.length})]}),ee.jsx(Iw,{children:S&&ee.jsx(tS.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:TE.slow,className:"overflow-hidden",children:ee.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4",children:A.map(e=>ee.jsx(gL,{project:e,active:!1,...re},e.id))})})})]}),ee.jsx(WL,{})]}),ee.jsx(wL,{open:d,onOpenChange:p,onCreated:e=>{i(e)}}),ee.jsx(kL,{open:f,onOpenChange:h,onOpened:e=>{i(e)}})]})}class hO extends H.Component{constructor(){super(...arguments),t(this,"state",{hasError:!1,error:null}),t(this,"handleReset",()=>{var e,t;this.setState({hasError:!1,error:null}),null==(t=(e=this.props).onReset)||t.call(e)})}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error("[ErrorBoundary]",e,t.componentStack),tL.error(e.message||"Something went wrong")}render(){return this.state.hasError?this.props.fallback?this.props.fallback:ee.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 p-4 text-sm text-muted-foreground",children:[ee.jsx("p",{children:"出错了"}),ee.jsx("button",{onClick:this.handleReset,className:"px-3 py-1.5 text-xs rounded-md border border-border hover:bg-muted transition-colors",children:"重新加载"})]}):this.props.children}}function mO({plugin:e,onConfigChange:t,onClose:n}){const{float:r,userConfig:o}=e,[a,s]=W.useState(()=>{var e,t;return{x:(null==(e=o.floatPosition)?void 0:e.x)??.5*window.innerWidth-r.defaultWidth/2,y:(null==(t=o.floatPosition)?void 0:t.y)??.3*window.innerHeight}}),[i,l]=W.useState(()=>{var e,t;return{w:(null==(e=o.floatSize)?void 0:e.w)??r.defaultWidth,h:(null==(t=o.floatSize)?void 0:t.h)??r.defaultHeight}}),[c,u]=W.useState(!1),[d,p]=W.useState(100),f=W.useRef(null),h=W.useRef(null),[m,g]=W.useState(null),v=W.useRef(null);W.useEffect(()=>{v.current=m},[m]),W.useEffect(()=>{let t=!1,n=null;const r=async(o=0)=>{try{const n=$j(),r={"Content-Type":"application/json"};n&&(r.Authorization=`Bearer ${n}`);const o=await fetch(`/api/plugins/${e.id}/session`,{method:"POST",headers:r});if(!o.ok)throw new Error(`status ${o.status}`);const{token:a}=await o.json();t||g(a)}catch(OO){if(t)return;const s=Math.min(3e4,1e3*2**o);console.warn(`[plugin ${e.id}] session token fetch failed (${String(OO)}); retrying in ${s}ms`),n=window.setTimeout(()=>{r(o+1)},s)}};r();const o=window.setInterval(()=>{r()},63e5);return()=>{t=!0,window.clearInterval(o),null!==n&&window.clearTimeout(n)}},[e.id]);const y=W.useCallback(()=>{p(Date.now()%1e5+100)},[]),b=W.useRef(null),x=W.useCallback(n=>{n.preventDefault(),y(),b.current={sx:n.clientX,sy:n.clientY,ox:a.x,oy:a.y},h.current&&(h.current.style.pointerEvents="none");const r=e=>{if(!b.current)return;const t=Math.max(0,Math.min(window.innerWidth-100,b.current.ox+e.clientX-b.current.sx)),n=Math.max(0,Math.min(window.innerHeight-40,b.current.oy+e.clientY-b.current.sy));f.current&&(f.current.style.left=t+"px",f.current.style.top=n+"px")},o=n=>{if(!b.current)return;const a=Math.max(0,Math.min(window.innerWidth-100,b.current.ox+n.clientX-b.current.sx)),i=Math.max(0,Math.min(window.innerHeight-40,b.current.oy+n.clientY-b.current.sy));b.current=null,h.current&&(h.current.style.pointerEvents=""),s({x:a,y:i}),t(e.id,{floatPosition:{x:a,y:i}}),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",o)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",o)},[a,y,e.id,t]),w=W.useRef(null),k=W.useCallback(n=>{if(!r.resizable)return;n.preventDefault(),n.stopPropagation(),y(),w.current={sx:n.clientX,sy:n.clientY,ow:i.w,oh:i.h},h.current&&(h.current.style.pointerEvents="none");const o=r.minWidth??150,a=r.minHeight??100,s=e=>{if(!w.current)return;const t=Math.max(o,w.current.ow+e.clientX-w.current.sx),n=Math.max(a,w.current.oh+e.clientY-w.current.sy);f.current&&(f.current.style.width=t+"px",f.current.style.height=n+"px")},c=n=>{if(!w.current)return;const r=Math.max(o,w.current.ow+n.clientX-w.current.sx),i=Math.max(a,w.current.oh+n.clientY-w.current.sy);w.current=null,h.current&&(h.current.style.pointerEvents=""),l({w:r,h:i}),t(e.id,{floatSize:{w:r,h:i}}),window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",c)};window.addEventListener("mousemove",s),window.addEventListener("mouseup",c)},[i,r,y,e.id,t]);W.useEffect(()=>{const t=async t=>{var n,r,o,a,s;if(t.source!==(null==(n=h.current)?void 0:n.contentWindow))return;const{callId:i,method:l,args:c}=t.data;if(i&&l)try{const t=$j(),n=v.current,a={"Content-Type":"application/json"};let s,u;if(n&&(a["X-Plugin-Session"]=n),t&&(a.Authorization=`Bearer ${t}`),"storage:get"===l)s=`/api/plugin-bridge/storage/${e.id}`,u={method:"GET",headers:a};else if("storage:set"===l)s=`/api/plugin-bridge/storage/${e.id}`,u={method:"PUT",headers:a,body:JSON.stringify(c)};else{const t={"project:status":{path:`/api/plugin-bridge/project/status/${c.projectId}`,httpMethod:"GET"},"project:list":{path:"/api/plugin-bridge/project/list",httpMethod:"GET"},"terminal:send":{path:"/api/plugin-bridge/terminal/send",httpMethod:"POST"},"session:read":{path:`/api/plugin-bridge/session/${c.projectId}`,httpMethod:"GET"},"system:info":{path:"/api/plugin-bridge/system/info",httpMethod:"GET"}};if("backend:api"===l){const{method:t,path:n,body:r}=c;if(!n||!n.startsWith("/")||n.includes(".."))throw new Error("Invalid API path");s=`/api/plugins/${e.id}${n}`,u={method:t||"GET",headers:a},!r||"POST"!==t&&"PUT"!==t||(u.body=JSON.stringify(r))}else{const e=t[l];if(!e)throw new Error(`Unknown method: ${l}`);s=e.path,u={method:e.httpMethod,headers:a},"POST"===e.httpMethod&&(u.body=JSON.stringify(c))}}const d=await fetch(s,u),p=await d.json();null==(o=null==(r=h.current)?void 0:r.contentWindow)||o.postMessage({callId:i,result:p,error:null},window.location.origin)}catch(OO){const t=OO instanceof Error?OO.message:"Bridge error";null==(s=null==(a=h.current)?void 0:a.contentWindow)||s.postMessage({callId:i,result:null,error:t},window.location.origin)}};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[e.id]);const S=o.clickable??r.clickable.default,j=`/plugins/${e.id}/${e.float?"index.html":""}`;return ee.jsxs(tS.div,{ref:f,className:XS("fixed rounded-xl border border-border shadow-sm overflow-hidden flex flex-col","bg-background/95 backdrop-blur-sm"),style:{left:a.x,top:a.y,width:c?200:i.w,height:c?32:i.h,zIndex:d},initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.15},onMouseDown:y,children:[ee.jsxs("div",{className:"h-8 flex items-center gap-1 px-2 bg-muted/50 border-b border-border cursor-grab active:cursor-grabbing flex-shrink-0 select-none",onMouseDown:x,children:[ee.jsx(QE,{className:"h-3 w-3 text-muted-foreground/40 flex-shrink-0"}),ee.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:e.name}),ee.jsx("button",{onClick:()=>u(e=>!e),className:"p-0.5 rounded-md hover:bg-accent text-muted-foreground/60 hover:text-foreground transition-colors",children:ee.jsx(lP,{className:"h-3 w-3"})}),ee.jsx("button",{onClick:()=>n(e.id),className:"p-0.5 rounded hover:bg-red-500/20 text-muted-foreground/60 hover:text-red-400 transition-colors",children:ee.jsx(EP,{className:"h-3 w-3"})})]}),!c&&ee.jsxs("div",{className:"flex-1 min-h-0 relative",children:[m?ee.jsx("iframe",{ref:h,src:j,sandbox:"allow-scripts allow-same-origin",className:"w-full h-full border-0",style:{pointerEvents:S?"auto":"none"}}):ee.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-muted-foreground",children:"Loading…"}),r.resizable&&ee.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 cursor-se-resize",onMouseDown:k,children:ee.jsxs("svg",{viewBox:"0 0 12 12",className:"w-3 h-3 text-muted-foreground/30",children:[ee.jsx("path",{d:"M11 1v10H1",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),ee.jsx("path",{d:"M11 5v6H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})]})})]})]})}function gO({plugins:e,onPluginsChange:t,onClose:n}){const r=W.useCallback(async(e,n)=>{t(t=>t.map(t=>t.id===e?{...t,userConfig:{...t.userConfig,...n}}:t));try{await fE(e,n)}catch{}},[t]);return 0===e.length?null:ee.jsx(Iw,{children:e.map(e=>ee.jsx(mO,{plugin:e,onConfigChange:r,onClose:n},e.id))})}function vO({onTogglePlugin:e,activeIds:t}){const[n,r]=W.useState([]);return W.useEffect(()=>{uE().then(e=>r(e.filter(e=>e.enabled))).catch(()=>r([]))},[]),W.useEffect(()=>{const e=()=>{uE().then(e=>r(e.filter(e=>e.enabled))).catch(()=>{})};return window.addEventListener("focus",e),()=>window.removeEventListener("focus",e)},[]),0===n.length?null:ee.jsx("div",{className:"fixed top-14 left-1/2 -translate-x-1/2 z-40 pointer-events-none",children:ee.jsx(tS.div,{className:"pointer-events-auto flex items-center gap-1 px-2 py-1 rounded-full bg-background/60 backdrop-blur-md border border-border/50 shadow-md",initial:{opacity:0,y:-8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:n.map(n=>{const r=t.has(n.id),o=n.name.slice(0,2);return ee.jsxs(tS.button,{onClick:()=>e(n),className:XS("relative flex items-center justify-center w-7 h-7 rounded-full text-[10px] font-medium transition-colors",r?"bg-blue-500/20 text-blue-400":"text-muted-foreground/70 hover:text-foreground hover:bg-muted/80"),whileHover:{scale:1.12},whileTap:{scale:.92},title:n.name+(n.description?` — ${n.description}`:""),children:[o,ee.jsx(Iw,{children:r&&ee.jsx(tS.span,{className:"absolute -bottom-0.5 left-1/2 -translate-x-1/2 h-1 w-1 rounded-full bg-blue-400",initial:{scale:0},animate:{scale:1},exit:{scale:0}})})]},n.id)})})})}function yO(){const[e,t]=W.useState(null);!function(e){const t=W.useRef(null),n=W.useRef(0),r=W.useRef(!0),o=W.useRef(!1),a=W.useRef(null),s=W.useRef(e);s.current=e;const i=W.useCallback(()=>{if(!r.current)return;if(o.current)return;const e=$j();if(!e)return;o.current=!0;const l=new WebSocket(`${SL}/ws/alerts`);t.current=l,l.onopen=()=>{o.current=!1,n.current=0,l.send(JSON.stringify({type:"auth",token:e}))},l.onmessage=e=>{try{const t=JSON.parse(e.data);"login_alert"===t.type&&s.current(t)}catch{}},l.onclose=()=>{o.current=!1,t.current===l&&(t.current=null),r.current&&n.current<5&&(n.current++,a.current=window.setTimeout(i,jL(n.current)))},l.onerror=()=>{o.current=!1}},[]);W.useEffect(()=>(r.current=!0,i(),()=>{var e;r.current=!1,a.current&&(clearTimeout(a.current),a.current=null),null==(e=t.current)||e.close(),t.current=null}),[i])}(W.useCallback(e=>t(e),[]));const n=e?new Date(e.at).toLocaleString("zh-CN",{hour12:!1}):"";return ee.jsx(OM,{open:!!e,onOpenChange:e=>{e||t(null)},children:ee.jsxs(IM,{className:"sm:max-w-md",children:[ee.jsxs(FM,{children:[ee.jsxs(zM,{className:"flex items-center gap-2",children:[ee.jsx(yP,{className:"h-5 w-5 text-red-500 shrink-0"}),"检测到新的登录"]}),ee.jsx(VM,{children:"你的账号刚刚有一次新的登录。如果不是你本人操作,请立即修改密码并轮换密钥。"})]}),e&&ee.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3 text-sm space-y-1.5",children:[ee.jsxs("div",{className:"flex gap-2",children:[ee.jsx("span",{className:"shrink-0 w-16 text-muted-foreground",children:"账号"}),ee.jsx("span",{className:"font-medium",children:e.username})]}),ee.jsxs("div",{className:"flex gap-2",children:[ee.jsx("span",{className:"shrink-0 w-16 text-muted-foreground",children:"IP"}),ee.jsx("span",{className:"font-mono",children:e.ip})]}),ee.jsxs("div",{className:"flex gap-2",children:[ee.jsx("span",{className:"shrink-0 w-16 text-muted-foreground",children:"时间"}),ee.jsx("span",{children:n})]}),ee.jsxs("div",{className:"flex gap-2",children:[ee.jsx("span",{className:"shrink-0 w-16 text-muted-foreground",children:"设备"}),ee.jsx("span",{className:"break-all text-foreground/80",children:e.userAgent})]})]}),ee.jsx($M,{children:ee.jsx(yj,{onClick:()=>t(null),children:"知道了"})})]})})}function bO(){return Oj(e=>e.token)?ee.jsx(yO,{}):null}const xO=H.lazy(()=>pd(()=>import("./ProjectPage-BrudnOeN.js").then(e=>e.P),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(e=>({default:e.ProjectPage}))),wO=H.lazy(()=>pd(()=>import("./SettingsPage-CPP6ljrA.js"),__vite__mapDeps([14,9,10,4,3,8,6])).then(e=>({default:e.SettingsPage}))),kO=H.lazy(()=>pd(()=>import("./SkillHubPage-BePTeB2c.js"),__vite__mapDeps([15,11,3])).then(e=>({default:e.SkillHubPage}))),SO=H.lazy(()=>pd(()=>import("./ClaudeMemPage-CK2Ceogj.js"),__vite__mapDeps([16,10,4,3,11,5])).then(e=>({default:e.ClaudeMemPage}))),jO=H.lazy(()=>pd(()=>import("./ProjectSettingsPage-DsS6M9fI.js"),__vite__mapDeps([17,12,8])).then(e=>({default:e.ProjectSettingsPage}))),CO=H.lazy(()=>pd(()=>import("./MobilePage-D62Dze6k.js"),__vite__mapDeps([18,2,3,4,5,6,7])).then(e=>({default:e.MobilePage})));function EO(){return ee.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:ee.jsx("span",{className:"text-muted-foreground text-sm",children:"Loading…"})})}function PO({children:e}){const[t,n]=W.useState(!1),r=Oj(e=>e.token),o=Oj(e=>e.setToken);return W.useEffect(()=>{r?n(!0):Bj()?Wj().then(e=>o(e)).catch(()=>{}).finally(()=>n(!0)):n(!0)},[]),t||r?r?ee.jsx(ee.Fragment,{children:e}):ee.jsx(xp,{to:"/login",replace:!0}):null}const _O=window.matchMedia("(pointer: coarse)").matches&&window.innerWidth<768;function NO(){const[e,t]=W.useState([]),[n,r]=W.useState(()=>{try{return new Set(JSON.parse(localStorage.getItem("cc_plugin_open")||"[]"))}catch{return new Set}}),o=ip();W.useEffect(()=>{uE().then(t).catch(()=>t([]))},[]);const a=W.useCallback(e=>{r(t=>{const n=new Set(t);n.has(e.id)?n.delete(e.id):n.add(e.id);try{localStorage.setItem("cc_plugin_open",JSON.stringify([...n]))}catch{}return n})},[]),s=W.useCallback(e=>{r(t=>{const n=new Set(t);n.delete(e);try{localStorage.setItem("cc_plugin_open",JSON.stringify([...n]))}catch{}return n})},[]),i=function(e){if("/"===e||"/dashboard"===e)return{type:"dashboard"};const t=e.match(/^\/projects?\/([^/]+)/);return t?{type:"project",projectId:t[1]}:{type:"other"}}(o.pathname),l=e.filter(e=>{if(!e.enabled||!n.has(e.id))return!1;switch(e.userConfig.scope??e.float.scope.default){case"global":return!0;case"dashboard":return"dashboard"===i.type;case"project":return"project"===i.type;case"project:specific":return"project"===i.type&&(e.userConfig.projectIds??[]).includes(i.projectId??"");default:return!1}}),c="/login"===o.pathname,u="/mobile"===o.pathname;return ee.jsxs(ee.Fragment,{children:[!c&&!u&&!_O&&ee.jsx(vO,{onTogglePlugin:a,activeIds:n}),ee.jsx(gO,{plugins:l,onPluginsChange:t,onClose:s})]})}function TO(){const e=Oj(e=>e.token);return W.useEffect(()=>{if(!e)return;let t=!1;return HC().then(({language:e})=>{if(!t&&e&&bh.includes(e)&&kf.language!==e){try{localStorage.setItem(xh,e)}catch{}kf.changeLanguage(e)}}).catch(()=>{}),()=>{t=!0}},[e]),null}function RO({children:e}){const t=ip();return _O&&"/"===t.pathname?ee.jsx(xp,{to:"/mobile",replace:!0}):ee.jsx(ee.Fragment,{children:e})}function MO(){return ee.jsx(GL,{children:ee.jsxs(dL,{children:[ee.jsx(cL,{richColors:!0,position:"bottom-right"}),ee.jsx(ZL,{}),ee.jsx(eO,{}),ee.jsx(hO,{children:ee.jsxs(Pp,{children:[ee.jsx(TO,{}),ee.jsx(bO,{}),ee.jsx(NO,{}),ee.jsx(RO,{children:ee.jsx(W.Suspense,{fallback:ee.jsx(EO,{}),children:ee.jsxs(Sp,{children:[ee.jsx(wp,{path:"/login",element:ee.jsx(RE,{})}),ee.jsx(wp,{path:"/",element:ee.jsx(PO,{children:ee.jsx(fO,{})})}),ee.jsx(wp,{path:"/projects/:id/settings",element:ee.jsx(PO,{children:ee.jsx(jO,{})})}),ee.jsx(wp,{path:"/projects/:id",element:ee.jsx(PO,{children:ee.jsx(xO,{})})}),ee.jsx(wp,{path:"/settings",element:ee.jsx(PO,{children:ee.jsx(wO,{})})}),ee.jsx(wp,{path:"/skillhub",element:ee.jsx(PO,{children:ee.jsx(kO,{})})}),ee.jsx(wp,{path:"/memories",element:ee.jsx(PO,{children:ee.jsx(SO,{})})}),ee.jsx(wp,{path:"/mobile",element:ee.jsx(PO,{children:ee.jsx(CO,{})})}),ee.jsx(wp,{path:"*",element:ee.jsx(xp,{to:"/",replace:!0})})]})})})]})})]})})}te.createRoot(document.getElementById("root")).render(ee.jsx(H.StrictMode,{children:ee.jsx(MO,{})}));export{VM as $,Iw as A,yj as B,VE as C,BE as D,WE as E,qE as F,XC as G,QC as H,bj as I,JC as J,rE as K,SP as L,lP as M,oE as N,aE as O,pP as P,AE as Q,H as R,Nj as S,jP as T,rP as U,OM as V,IM as W,EP as X,FM as Y,zM as Z,pd as _,KL as a,IL as a$,jj as a0,$M as a1,Lj as a2,oj as a3,IP as a4,pT as a5,fT as a6,NP as a7,XN as a8,vT as a9,pC as aA,gC as aB,fC as aC,vC as aD,hC as aE,yC as aF,bC as aG,xC as aH,IE as aI,PP as aJ,xP as aK,cj as aL,Xf as aM,cp as aN,PL as aO,Dj as aP,GR as aQ,tO as aR,YL as aS,KE as aT,kE as aU,xE as aV,eC as aW,Jj as aX,DE as aY,FE as aZ,CL as a_,gT as aa,aj as ab,_P as ac,AP as ad,RT as ae,DP as af,GP as ag,yR as ah,JP as ai,BP as aj,hT as ak,mT as al,vP as am,uC as an,sC as ao,nC as ap,XE as aq,BL as ar,cC as as,aC as at,rC as au,iC as av,oC as aw,lC as ax,mC as ay,wC as az,FC as b,CP as b$,HE as b0,Gf as b1,o as b2,ld as b3,AM as b4,DM as b5,TM as b6,up as b7,sO as b8,kP as b9,MC as bA,$E as bB,a_ as bC,CE as bD,EE as bE,Oj as bF,EL as bG,ML as bH,oO as bI,gP as bJ,oP as bK,cP as bL,_L as bM,PE as bN,mE as bO,cO as bP,cE as bQ,yL as bR,_E as bS,mP as bT,PC as bU,pb as bV,hb as bW,db as bX,r as bY,yP as bZ,gE as b_,jT as ba,GN as bb,vE as bc,yE as bd,bE as be,wE as bf,SE as bg,SC as bh,CC as bi,jC as bj,bh as bk,xh as bl,qC as bm,Mp as bn,QL as bo,GC as bp,KC as bq,l_ as br,uE as bs,dE as bt,pE as bu,hE as bv,kC as bw,dC as bx,TC as by,RC as bz,LE as c,lE as c0,sE as c1,uO as c2,Mj as c3,iE as c4,AC as c5,rS as c6,a as c7,NE as c8,XS as d,iP as e,aP as f,$j as g,OC as h,Tj as i,ee as j,Fj as k,LC as l,hP as m,zC as n,DC as o,YE as p,tS as q,W as r,Rj as s,tL as t,fL as u,YC as v,$C as w,ZC as x,zE as y,fP as z};