convex-cms 0.0.16 → 0.0.17

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 (99) hide show
  1. package/admin/dist/types/admin/src/components/ui/field.d.ts +1 -1
  2. package/admin/dist/types/admin/src/lib/cmsExports.d.ts +6 -6
  3. package/admin/dist/types/admin/src/lib/cmsExports.d.ts.map +1 -1
  4. package/admin/src/lib/cmsExports.ts +8 -8
  5. package/admin-dist/assets/index-DagpgVMo.js +104 -0
  6. package/admin-dist/embed/favicon.ico +0 -0
  7. package/admin-dist/embed/index.js +30961 -0
  8. package/admin-dist/embed/index.js.map +1 -0
  9. package/admin-dist/index.html +1 -1
  10. package/package.json +12 -5
  11. package/admin/dist/types/src/client/admin/bulk.d.ts +0 -79
  12. package/admin/dist/types/src/client/admin/bulk.d.ts.map +0 -1
  13. package/admin/dist/types/src/client/admin/contentLock.d.ts +0 -118
  14. package/admin/dist/types/src/client/admin/contentLock.d.ts.map +0 -1
  15. package/admin/dist/types/src/client/admin/contentTypes.d.ts +0 -1627
  16. package/admin/dist/types/src/client/admin/contentTypes.d.ts.map +0 -1
  17. package/admin/dist/types/src/client/admin/dashboard.d.ts +0 -16
  18. package/admin/dist/types/src/client/admin/dashboard.d.ts.map +0 -1
  19. package/admin/dist/types/src/client/admin/entries.d.ts +0 -357
  20. package/admin/dist/types/src/client/admin/entries.d.ts.map +0 -1
  21. package/admin/dist/types/src/client/admin/index.d.ts +0 -7502
  22. package/admin/dist/types/src/client/admin/index.d.ts.map +0 -1
  23. package/admin/dist/types/src/client/admin/media.d.ts +0 -1038
  24. package/admin/dist/types/src/client/admin/media.d.ts.map +0 -1
  25. package/admin/dist/types/src/client/admin/settings.d.ts +0 -50
  26. package/admin/dist/types/src/client/admin/settings.d.ts.map +0 -1
  27. package/admin/dist/types/src/client/admin/taxonomies.d.ts +0 -339
  28. package/admin/dist/types/src/client/admin/taxonomies.d.ts.map +0 -1
  29. package/admin/dist/types/src/client/admin/trash.d.ts +0 -90
  30. package/admin/dist/types/src/client/admin/trash.d.ts.map +0 -1
  31. package/admin/dist/types/src/client/admin/types.d.ts +0 -594
  32. package/admin/dist/types/src/client/admin/types.d.ts.map +0 -1
  33. package/admin/dist/types/src/client/admin/users.d.ts +0 -58
  34. package/admin/dist/types/src/client/admin/users.d.ts.map +0 -1
  35. package/admin/dist/types/src/client/admin/validators.d.ts +0 -7732
  36. package/admin/dist/types/src/client/admin/validators.d.ts.map +0 -1
  37. package/admin/dist/types/src/client/admin/versions.d.ts +0 -106
  38. package/admin/dist/types/src/client/admin/versions.d.ts.map +0 -1
  39. package/admin/dist/types/src/client/adminConfig.d.ts +0 -125
  40. package/admin/dist/types/src/client/adminConfig.d.ts.map +0 -1
  41. package/admin/dist/types/src/client/config.d.ts +0 -155
  42. package/admin/dist/types/src/client/config.d.ts.map +0 -1
  43. package/admin/dist/types/src/client/field-types.d.ts +0 -55
  44. package/admin/dist/types/src/client/field-types.d.ts.map +0 -1
  45. package/admin/dist/types/src/client/fields.d.ts +0 -70
  46. package/admin/dist/types/src/client/fields.d.ts.map +0 -1
  47. package/admin/dist/types/src/client/registry.d.ts +0 -77
  48. package/admin/dist/types/src/client/registry.d.ts.map +0 -1
  49. package/admin/dist/types/src/client/schema/defineContentType.d.ts +0 -233
  50. package/admin/dist/types/src/client/schema/defineContentType.d.ts.map +0 -1
  51. package/admin/dist/types/src/client/schema/types.d.ts +0 -540
  52. package/admin/dist/types/src/client/schema/types.d.ts.map +0 -1
  53. package/admin/dist/types/src/client/types.d.ts +0 -449
  54. package/admin/dist/types/src/client/types.d.ts.map +0 -1
  55. package/admin/dist/types/src/client/utils/toSlug.d.ts +0 -60
  56. package/admin/dist/types/src/client/utils/toSlug.d.ts.map +0 -1
  57. package/admin/dist/types/src/client/workflows.d.ts +0 -51
  58. package/admin/dist/types/src/client/workflows.d.ts.map +0 -1
  59. package/admin/dist/types/src/component/_generated/component.d.ts +0 -4813
  60. package/admin/dist/types/src/component/_generated/component.d.ts.map +0 -1
  61. package/admin/dist/types/src/component/_generated/dataModel.d.ts +0 -46
  62. package/admin/dist/types/src/component/_generated/dataModel.d.ts.map +0 -1
  63. package/admin/dist/types/src/component/_generated/server.d.ts +0 -121
  64. package/admin/dist/types/src/component/_generated/server.d.ts.map +0 -1
  65. package/admin/dist/types/src/component/contentEntryMutations.d.ts +0 -551
  66. package/admin/dist/types/src/component/contentEntryMutations.d.ts.map +0 -1
  67. package/admin/dist/types/src/component/contentLock.d.ts +0 -328
  68. package/admin/dist/types/src/component/contentLock.d.ts.map +0 -1
  69. package/admin/dist/types/src/component/contentTypeMutations.d.ts +0 -1253
  70. package/admin/dist/types/src/component/contentTypeMutations.d.ts.map +0 -1
  71. package/admin/dist/types/src/component/documentTypes.d.ts +0 -186
  72. package/admin/dist/types/src/component/documentTypes.d.ts.map +0 -1
  73. package/admin/dist/types/src/component/eventEmitter.d.ts +0 -309
  74. package/admin/dist/types/src/component/eventEmitter.d.ts.map +0 -1
  75. package/admin/dist/types/src/component/lib/errors.d.ts +0 -306
  76. package/admin/dist/types/src/component/lib/errors.d.ts.map +0 -1
  77. package/admin/dist/types/src/component/lib/metadataExtractor.d.ts +0 -245
  78. package/admin/dist/types/src/component/lib/metadataExtractor.d.ts.map +0 -1
  79. package/admin/dist/types/src/component/lib/mutationAuth.d.ts +0 -95
  80. package/admin/dist/types/src/component/lib/mutationAuth.d.ts.map +0 -1
  81. package/admin/dist/types/src/component/lib/slugGenerator.d.ts +0 -71
  82. package/admin/dist/types/src/component/lib/slugGenerator.d.ts.map +0 -1
  83. package/admin/dist/types/src/component/lib/slugUniqueness.d.ts +0 -131
  84. package/admin/dist/types/src/component/lib/slugUniqueness.d.ts.map +0 -1
  85. package/admin/dist/types/src/component/lib/softDelete.d.ts +0 -18
  86. package/admin/dist/types/src/component/lib/softDelete.d.ts.map +0 -1
  87. package/admin/dist/types/src/component/localeFields.d.ts +0 -508
  88. package/admin/dist/types/src/component/localeFields.d.ts.map +0 -1
  89. package/admin/dist/types/src/component/mediaAssetMutations.d.ts +0 -282
  90. package/admin/dist/types/src/component/mediaAssetMutations.d.ts.map +0 -1
  91. package/admin/dist/types/src/component/schema.d.ts +0 -5248
  92. package/admin/dist/types/src/component/schema.d.ts.map +0 -1
  93. package/admin/dist/types/src/component/validation.d.ts +0 -407
  94. package/admin/dist/types/src/component/validation.d.ts.map +0 -1
  95. package/admin/dist/types/src/component/validators.d.ts +0 -5722
  96. package/admin/dist/types/src/component/validators.d.ts.map +0 -1
  97. package/admin/dist/types/src/react/index.d.ts +0 -493
  98. package/admin/dist/types/src/react/index.d.ts.map +0 -1
  99. package/admin-dist/assets/index-DTgANhXL.js +0 -104
@@ -1,104 +0,0 @@
1
- function qO(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const l=Object.getOwnPropertyDescriptor(r,o);l&&Object.defineProperty(e,o,l.get?l:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();function vN(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pg={exports:{}},zc={};var y1;function VO(){if(y1)return zc;y1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,l){var u=null;if(l!==void 0&&(u=""+l),o.key!==void 0&&(u=""+o.key),"key"in o){l={};for(var d in o)d!=="key"&&(l[d]=o[d])}else l=o;return o=l.ref,{$$typeof:e,type:r,key:u,ref:o!==void 0?o:null,props:l}}return zc.Fragment=t,zc.jsx=n,zc.jsxs=n,zc}var b1;function HO(){return b1||(b1=1,Pg.exports=VO()),Pg.exports}var i=HO(),Lg={exports:{}},We={};var w1;function YO(){if(w1)return We;w1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),y=Symbol.iterator;function w(I){return I===null||typeof I!="object"?null:(I=y&&I[y]||I["@@iterator"],typeof I=="function"?I:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,N={};function C(I,F,K){this.props=I,this.context=F,this.refs=N,this.updater=K||S}C.prototype.isReactComponent={},C.prototype.setState=function(I,F){if(typeof I!="object"&&typeof I!="function"&&I!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,I,F,"setState")},C.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function _(){}_.prototype=C.prototype;function E(I,F,K){this.props=I,this.context=F,this.refs=N,this.updater=K||S}var M=E.prototype=new _;M.constructor=E,j(M,C.prototype),M.isPureReactComponent=!0;var A=Array.isArray;function R(){}var T={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function D(I,F,K){var ne=K.ref;return{$$typeof:e,type:I,key:F,ref:ne!==void 0?ne:null,props:K}}function z(I,F){return D(I.type,F,I.props)}function B(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function V(I){var F={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(K){return F[K]})}var Y=/\/+/g;function G(I,F){return typeof I=="object"&&I!==null&&I.key!=null?V(""+I.key):F.toString(36)}function ae(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(R,R):(I.status="pending",I.then(function(F){I.status==="pending"&&(I.status="fulfilled",I.value=F)},function(F){I.status==="pending"&&(I.status="rejected",I.reason=F)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function L(I,F,K,ne,X){var ue=typeof I;(ue==="undefined"||ue==="boolean")&&(I=null);var te=!1;if(I===null)te=!0;else switch(ue){case"bigint":case"string":case"number":te=!0;break;case"object":switch(I.$$typeof){case e:case t:te=!0;break;case v:return te=I._init,L(te(I._payload),F,K,ne,X)}}if(te)return X=X(I),te=ne===""?"."+G(I,0):ne,A(X)?(K="",te!=null&&(K=te.replace(Y,"$&/")+"/"),L(X,F,K,"",function(_e){return _e})):X!=null&&(B(X)&&(X=z(X,K+(X.key==null||I&&I.key===X.key?"":(""+X.key).replace(Y,"$&/")+"/")+te)),F.push(X)),1;te=0;var ye=ne===""?".":ne+":";if(A(I))for(var Ce=0;Ce<I.length;Ce++)ne=I[Ce],ue=ye+G(ne,Ce),te+=L(ne,F,K,ue,X);else if(Ce=w(I),typeof Ce=="function")for(I=Ce.call(I),Ce=0;!(ne=I.next()).done;)ne=ne.value,ue=ye+G(ne,Ce++),te+=L(ne,F,K,ue,X);else if(ue==="object"){if(typeof I.then=="function")return L(ae(I),F,K,ne,X);throw F=String(I),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return te}function $(I,F,K){if(I==null)return I;var ne=[],X=0;return L(I,ne,"","",function(ue){return F.call(K,ue,X++)}),ne}function U(I){if(I._status===-1){var F=I._result;F=F(),F.then(function(K){(I._status===0||I._status===-1)&&(I._status=1,I._result=K)},function(K){(I._status===0||I._status===-1)&&(I._status=2,I._result=K)}),I._status===-1&&(I._status=0,I._result=F)}if(I._status===1)return I._result.default;throw I._result}var H=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},le={map:$,forEach:function(I,F,K){$(I,function(){F.apply(this,arguments)},K)},count:function(I){var F=0;return $(I,function(){F++}),F},toArray:function(I){return $(I,function(F){return F})||[]},only:function(I){if(!B(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return We.Activity=g,We.Children=le,We.Component=C,We.Fragment=n,We.Profiler=o,We.PureComponent=E,We.StrictMode=r,We.Suspense=h,We.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,We.__COMPILER_RUNTIME={__proto__:null,c:function(I){return T.H.useMemoCache(I)}},We.cache=function(I){return function(){return I.apply(null,arguments)}},We.cacheSignal=function(){return null},We.cloneElement=function(I,F,K){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var ne=j({},I.props),X=I.key;if(F!=null)for(ue in F.key!==void 0&&(X=""+F.key),F)!O.call(F,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&F.ref===void 0||(ne[ue]=F[ue]);var ue=arguments.length-2;if(ue===1)ne.children=K;else if(1<ue){for(var te=Array(ue),ye=0;ye<ue;ye++)te[ye]=arguments[ye+2];ne.children=te}return D(I.type,X,ne)},We.createContext=function(I){return I={$$typeof:u,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:l,_context:I},I},We.createElement=function(I,F,K){var ne,X={},ue=null;if(F!=null)for(ne in F.key!==void 0&&(ue=""+F.key),F)O.call(F,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(X[ne]=F[ne]);var te=arguments.length-2;if(te===1)X.children=K;else if(1<te){for(var ye=Array(te),Ce=0;Ce<te;Ce++)ye[Ce]=arguments[Ce+2];X.children=ye}if(I&&I.defaultProps)for(ne in te=I.defaultProps,te)X[ne]===void 0&&(X[ne]=te[ne]);return D(I,ue,X)},We.createRef=function(){return{current:null}},We.forwardRef=function(I){return{$$typeof:d,render:I}},We.isValidElement=B,We.lazy=function(I){return{$$typeof:v,_payload:{_status:-1,_result:I},_init:U}},We.memo=function(I,F){return{$$typeof:m,type:I,compare:F===void 0?null:F}},We.startTransition=function(I){var F=T.T,K={};T.T=K;try{var ne=I(),X=T.S;X!==null&&X(K,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(R,H)}catch(ue){H(ue)}finally{F!==null&&K.types!==null&&(F.types=K.types),T.T=F}},We.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},We.use=function(I){return T.H.use(I)},We.useActionState=function(I,F,K){return T.H.useActionState(I,F,K)},We.useCallback=function(I,F){return T.H.useCallback(I,F)},We.useContext=function(I){return T.H.useContext(I)},We.useDebugValue=function(){},We.useDeferredValue=function(I,F){return T.H.useDeferredValue(I,F)},We.useEffect=function(I,F){return T.H.useEffect(I,F)},We.useEffectEvent=function(I){return T.H.useEffectEvent(I)},We.useId=function(){return T.H.useId()},We.useImperativeHandle=function(I,F,K){return T.H.useImperativeHandle(I,F,K)},We.useInsertionEffect=function(I,F){return T.H.useInsertionEffect(I,F)},We.useLayoutEffect=function(I,F){return T.H.useLayoutEffect(I,F)},We.useMemo=function(I,F){return T.H.useMemo(I,F)},We.useOptimistic=function(I,F){return T.H.useOptimistic(I,F)},We.useReducer=function(I,F,K){return T.H.useReducer(I,F,K)},We.useRef=function(I){return T.H.useRef(I)},We.useState=function(I){return T.H.useState(I)},We.useSyncExternalStore=function(I,F,K){return T.H.useSyncExternalStore(I,F,K)},We.useTransition=function(){return T.H.useTransition()},We.version="19.2.4",We}var S1;function Pu(){return S1||(S1=1,Lg.exports=YO()),Lg.exports}var p=Pu();const ee=vN(p),Ax=qO({__proto__:null,default:ee},[p]);var Ig={exports:{}},Pc={},$g={exports:{}},Fg={};var j1;function WO(){return j1||(j1=1,(function(e){function t(L,$){var U=L.length;L.push($);e:for(;0<U;){var H=U-1>>>1,le=L[H];if(0<o(le,$))L[H]=$,L[U]=le,U=H;else break e}}function n(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var $=L[0],U=L.pop();if(U!==$){L[0]=U;e:for(var H=0,le=L.length,I=le>>>1;H<I;){var F=2*(H+1)-1,K=L[F],ne=F+1,X=L[ne];if(0>o(K,U))ne<le&&0>o(X,K)?(L[H]=X,L[ne]=U,H=ne):(L[H]=K,L[F]=U,H=F);else if(ne<le&&0>o(X,U))L[H]=X,L[ne]=U,H=ne;else break e}}return $}function o(L,$){var U=L.sortIndex-$.sortIndex;return U!==0?U:L.id-$.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var h=[],m=[],v=1,g=null,y=3,w=!1,S=!1,j=!1,N=!1,C=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function M(L){for(var $=n(m);$!==null;){if($.callback===null)r(m);else if($.startTime<=L)r(m),$.sortIndex=$.expirationTime,t(h,$);else break;$=n(m)}}function A(L){if(j=!1,M(L),!S)if(n(h)!==null)S=!0,R||(R=!0,V());else{var $=n(m);$!==null&&ae(A,$.startTime-L)}}var R=!1,T=-1,O=5,D=-1;function z(){return N?!0:!(e.unstable_now()-D<O)}function B(){if(N=!1,R){var L=e.unstable_now();D=L;var $=!0;try{e:{S=!1,j&&(j=!1,_(T),T=-1),w=!0;var U=y;try{t:{for(M(L),g=n(h);g!==null&&!(g.expirationTime>L&&z());){var H=g.callback;if(typeof H=="function"){g.callback=null,y=g.priorityLevel;var le=H(g.expirationTime<=L);if(L=e.unstable_now(),typeof le=="function"){g.callback=le,M(L),$=!0;break t}g===n(h)&&r(h),M(L)}else r(h);g=n(h)}if(g!==null)$=!0;else{var I=n(m);I!==null&&ae(A,I.startTime-L),$=!1}}break e}finally{g=null,y=U,w=!1}$=void 0}}finally{$?V():R=!1}}}var V;if(typeof E=="function")V=function(){E(B)};else if(typeof MessageChannel<"u"){var Y=new MessageChannel,G=Y.port2;Y.port1.onmessage=B,V=function(){G.postMessage(null)}}else V=function(){C(B,0)};function ae(L,$){T=C(function(){L(e.unstable_now())},$)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(L){L.callback=null},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(L){switch(y){case 1:case 2:case 3:var $=3;break;default:$=y}var U=y;y=$;try{return L()}finally{y=U}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(L,$){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var U=y;y=L;try{return $()}finally{y=U}},e.unstable_scheduleCallback=function(L,$,U){var H=e.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?H+U:H):U=H,L){case 1:var le=-1;break;case 2:le=250;break;case 5:le=1073741823;break;case 4:le=1e4;break;default:le=5e3}return le=U+le,L={id:v++,callback:$,priorityLevel:L,startTime:U,expirationTime:le,sortIndex:-1},U>H?(L.sortIndex=U,t(m,L),n(h)===null&&L===n(m)&&(j?(_(T),T=-1):j=!0,ae(A,U-H))):(L.sortIndex=le,t(h,L),S||w||(S=!0,R||(R=!0,V()))),L},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(L){var $=y;return function(){var U=y;y=$;try{return L.apply(this,arguments)}finally{y=U}}}})(Fg)),Fg}var C1;function GO(){return C1||(C1=1,$g.exports=WO()),$g.exports}var Bg={exports:{}},An={};var N1;function ZO(){if(N1)return An;N1=1;var e=Pu();function t(h){var m="https://react.dev/errors/"+h;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)m+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+h+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function l(h,m,v){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:h,containerInfo:m,implementation:v}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(h,m){if(h==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return An.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,An.createPortal=function(h,m){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return l(h,m,null,v)},An.flushSync=function(h){var m=u.T,v=r.p;try{if(u.T=null,r.p=2,h)return h()}finally{u.T=m,r.p=v,r.d.f()}},An.preconnect=function(h,m){typeof h=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(h,m))},An.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},An.preinit=function(h,m){if(typeof h=="string"&&m&&typeof m.as=="string"){var v=m.as,g=d(v,m.crossOrigin),y=typeof m.integrity=="string"?m.integrity:void 0,w=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;v==="style"?r.d.S(h,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:y,fetchPriority:w}):v==="script"&&r.d.X(h,{crossOrigin:g,integrity:y,fetchPriority:w,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},An.preinitModule=function(h,m){if(typeof h=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var v=d(m.as,m.crossOrigin);r.d.M(h,{crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(h)},An.preload=function(h,m){if(typeof h=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var v=m.as,g=d(v,m.crossOrigin);r.d.L(h,v,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},An.preloadModule=function(h,m){if(typeof h=="string")if(m){var v=d(m.as,m.crossOrigin);r.d.m(h,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(h)},An.requestFormReset=function(h){r.d.r(h)},An.unstable_batchedUpdates=function(h,m){return h(m)},An.useFormState=function(h,m,v){return u.H.useFormState(h,m,v)},An.useFormStatus=function(){return u.H.useHostTransitionStatus()},An.version="19.2.4",An}var k1;function xN(){if(k1)return Bg.exports;k1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Bg.exports=ZO(),Bg.exports}var _1;function QO(){if(_1)return Pc;_1=1;var e=GO(),t=Pu(),n=xN();function r(s){var a="https://react.dev/errors/"+s;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)a+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function l(s){var a=s,c=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(c=a.return),s=a.return;while(s)}return a.tag===3?c:null}function u(s){if(s.tag===13){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function d(s){if(s.tag===31){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function h(s){if(l(s)!==s)throw Error(r(188))}function m(s){var a=s.alternate;if(!a){if(a=l(s),a===null)throw Error(r(188));return a!==s?null:s}for(var c=s,f=a;;){var x=c.return;if(x===null)break;var b=x.alternate;if(b===null){if(f=x.return,f!==null){c=f;continue}break}if(x.child===b.child){for(b=x.child;b;){if(b===c)return h(x),s;if(b===f)return h(x),a;b=b.sibling}throw Error(r(188))}if(c.return!==f.return)c=x,f=b;else{for(var k=!1,P=x.child;P;){if(P===c){k=!0,c=x,f=b;break}if(P===f){k=!0,f=x,c=b;break}P=P.sibling}if(!k){for(P=b.child;P;){if(P===c){k=!0,c=b,f=x;break}if(P===f){k=!0,f=b,c=x;break}P=P.sibling}if(!k)throw Error(r(189))}}if(c.alternate!==f)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?s:a}function v(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=v(s),a!==null)return a;s=s.sibling}return null}var g=Object.assign,y=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),E=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function V(s){return s===null||typeof s!="object"?null:(s=B&&s[B]||s["@@iterator"],typeof s=="function"?s:null)}var Y=Symbol.for("react.client.reference");function G(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===Y?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case j:return"Fragment";case C:return"Profiler";case N:return"StrictMode";case A:return"Suspense";case R:return"SuspenseList";case D:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case S:return"Portal";case E:return s.displayName||"Context";case _:return(s._context.displayName||"Context")+".Consumer";case M:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case T:return a=s.displayName||null,a!==null?a:G(s.type)||"Memo";case O:a=s._payload,s=s._init;try{return G(s(a))}catch{}}return null}var ae=Array.isArray,L=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U={pending:!1,data:null,method:null,action:null},H=[],le=-1;function I(s){return{current:s}}function F(s){0>le||(s.current=H[le],H[le]=null,le--)}function K(s,a){le++,H[le]=s.current,s.current=a}var ne=I(null),X=I(null),ue=I(null),te=I(null);function ye(s,a){switch(K(ue,a),K(X,s),K(ne,null),a.nodeType){case 9:case 11:s=(s=a.documentElement)&&(s=s.namespaceURI)?US(s):0;break;default:if(s=a.tagName,a=a.namespaceURI)a=US(a),s=qS(a,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}F(ne),K(ne,s)}function Ce(){F(ne),F(X),F(ue)}function _e(s){s.memoizedState!==null&&K(te,s);var a=ne.current,c=qS(a,s.type);a!==c&&(K(X,s),K(ne,c))}function Re(s){X.current===s&&(F(ne),F(X)),te.current===s&&(F(te),Rc._currentValue=U)}var ge,Fe;function be(s){if(ge===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);ge=a&&a[1]||"",Fe=-1<c.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+ge+s+Fe}var Be=!1;function nt(s,a){if(!s||Be)return"";Be=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(a){var he=function(){throw Error()};if(Object.defineProperty(he.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(he,[])}catch(ie){var oe=ie}Reflect.construct(s,[],he)}else{try{he.call()}catch(ie){oe=ie}s.call(he.prototype)}}else{try{throw Error()}catch(ie){oe=ie}(he=s())&&typeof he.catch=="function"&&he.catch(function(){})}}catch(ie){if(ie&&oe&&typeof ie.stack=="string")return[ie.stack,oe.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=f.DetermineComponentFrameRoot(),k=b[0],P=b[1];if(k&&P){var q=k.split(`
4
- `),se=P.split(`
5
- `);for(x=f=0;f<q.length&&!q[f].includes("DetermineComponentFrameRoot");)f++;for(;x<se.length&&!se[x].includes("DetermineComponentFrameRoot");)x++;if(f===q.length||x===se.length)for(f=q.length-1,x=se.length-1;1<=f&&0<=x&&q[f]!==se[x];)x--;for(;1<=f&&0<=x;f--,x--)if(q[f]!==se[x]){if(f!==1||x!==1)do if(f--,x--,0>x||q[f]!==se[x]){var ce=`
6
- `+q[f].replace(" at new "," at ");return s.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",s.displayName)),ce}while(1<=f&&0<=x);break}}}finally{Be=!1,Error.prepareStackTrace=c}return(c=s?s.displayName||s.name:"")?be(c):""}function ot(s,a){switch(s.tag){case 26:case 27:case 5:return be(s.type);case 16:return be("Lazy");case 13:return s.child!==a&&a!==null?be("Suspense Fallback"):be("Suspense");case 19:return be("SuspenseList");case 0:case 15:return nt(s.type,!1);case 11:return nt(s.type.render,!1);case 1:return nt(s.type,!0);case 31:return be("Activity");default:return""}}function yt(s){try{var a="",c=null;do a+=ot(s,c),c=s,s=s.return;while(s);return a}catch(f){return`
7
- Error generating stack: `+f.message+`
8
- `+f.stack}}var pe=Object.prototype.hasOwnProperty,Le=e.unstable_scheduleCallback,Ye=e.unstable_cancelCallback,Oe=e.unstable_shouldYield,dt=e.unstable_requestPaint,ct=e.unstable_now,Mn=e.unstable_getCurrentPriorityLevel,Qe=e.unstable_ImmediatePriority,bt=e.unstable_UserBlockingPriority,pt=e.unstable_NormalPriority,Vn=e.unstable_LowPriority,or=e.unstable_IdlePriority,Hr=e.log,zn=e.unstable_setDisableYieldValue,Pn=null,qt=null;function en(s){if(typeof Hr=="function"&&zn(s),qt&&typeof qt.setStrictMode=="function")try{qt.setStrictMode(Pn,s)}catch{}}var $t=Math.clz32?Math.clz32:xe,us=Math.log,Yr=Math.LN2;function xe(s){return s>>>=0,s===0?32:31-(us(s)/Yr|0)|0}var ke=256,we=262144,Ne=4194304;function Ve(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function De(s,a,c){var f=s.pendingLanes;if(f===0)return 0;var x=0,b=s.suspendedLanes,k=s.pingedLanes;s=s.warmLanes;var P=f&134217727;return P!==0?(f=P&~b,f!==0?x=Ve(f):(k&=P,k!==0?x=Ve(k):c||(c=P&~s,c!==0&&(x=Ve(c))))):(P=f&~b,P!==0?x=Ve(P):k!==0?x=Ve(k):c||(c=f&~s,c!==0&&(x=Ve(c)))),x===0?0:a!==0&&a!==x&&(a&b)===0&&(b=x&-x,c=a&-a,b>=c||b===32&&(c&4194048)!==0)?a:x}function wt(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function bn(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function tn(){var s=Ne;return Ne<<=1,(Ne&62914560)===0&&(Ne=4194304),s}function Gt(s){for(var a=[],c=0;31>c;c++)a.push(s);return a}function Ot(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Rn(s,a,c,f,x,b){var k=s.pendingLanes;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=c,s.entangledLanes&=c,s.errorRecoveryDisabledLanes&=c,s.shellSuspendCounter=0;var P=s.entanglements,q=s.expirationTimes,se=s.hiddenUpdates;for(c=k&~c;0<c;){var ce=31-$t(c),he=1<<ce;P[ce]=0,q[ce]=-1;var oe=se[ce];if(oe!==null)for(se[ce]=null,ce=0;ce<oe.length;ce++){var ie=oe[ce];ie!==null&&(ie.lane&=-536870913)}c&=~he}f!==0&&Hn(s,f,0),b!==0&&x===0&&s.tag!==0&&(s.suspendedLanes|=b&~(k&~a))}function Hn(s,a,c){s.pendingLanes|=a,s.suspendedLanes&=~a;var f=31-$t(a);s.entangledLanes|=a,s.entanglements[f]=s.entanglements[f]|1073741824|c&261930}function wn(s,a){var c=s.entangledLanes|=a;for(s=s.entanglements;c;){var f=31-$t(c),x=1<<f;x&a|s[f]&a&&(s[f]|=a),c&=~x}}function Q(s,a){var c=a&-a;return c=(c&42)!==0?1:je(c),(c&(s.suspendedLanes|a))!==0?0:c}function je(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Ue(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function gt(){var s=$.p;return s!==0?s:(s=window.event,s===void 0?32:f1(s.type))}function Ke(s,a){var c=$.p;try{return $.p=s,a()}finally{$.p=c}}var Yn=Math.random().toString(36).slice(2),Zt="__reactFiber$"+Yn,Wn="__reactProps$"+Yn,ni="__reactContainer$"+Yn,_m="__reactEvents$"+Yn,AR="__reactListeners$"+Yn,OR="__reactHandles$"+Yn,Tb="__reactResources$"+Yn,Yl="__reactMarker$"+Yn;function Em(s){delete s[Zt],delete s[Wn],delete s[_m],delete s[AR],delete s[OR]}function ri(s){var a=s[Zt];if(a)return a;for(var c=s.parentNode;c;){if(a=c[ni]||c[Zt]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(s=QS(s);s!==null;){if(c=s[Zt])return c;s=QS(s)}return a}s=c,c=s.parentNode}return null}function si(s){if(s=s[Zt]||s[ni]){var a=s.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return s}return null}function Wl(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s.stateNode;throw Error(r(33))}function ai(s){var a=s[Tb];return a||(a=s[Tb]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Sn(s){s[Yl]=!0}var Mb=new Set,Rb={};function io(s,a){oi(s,a),oi(s+"Capture",a)}function oi(s,a){for(Rb[s]=a,s=0;s<a.length;s++)Mb.add(a[s])}var DR=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Ab={},Ob={};function zR(s){return pe.call(Ob,s)?!0:pe.call(Ab,s)?!1:DR.test(s)?Ob[s]=!0:(Ab[s]=!0,!1)}function od(s,a,c){if(zR(a))if(c===null)s.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(a);return;case"boolean":var f=a.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){s.removeAttribute(a);return}}s.setAttribute(a,""+c)}}function id(s,a,c){if(c===null)s.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(a);return}s.setAttribute(a,""+c)}}function Ds(s,a,c,f){if(f===null)s.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(a,c,""+f)}}function Nr(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Db(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function PR(s,a,c){var f=Object.getOwnPropertyDescriptor(s.constructor.prototype,a);if(!s.hasOwnProperty(a)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var x=f.get,b=f.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return x.call(this)},set:function(k){c=""+k,b.call(this,k)}}),Object.defineProperty(s,a,{enumerable:f.enumerable}),{getValue:function(){return c},setValue:function(k){c=""+k},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function Tm(s){if(!s._valueTracker){var a=Db(s)?"checked":"value";s._valueTracker=PR(s,a,""+s[a])}}function zb(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var c=a.getValue(),f="";return s&&(f=Db(s)?s.checked?"true":"false":s.value),s=f,s!==c?(a.setValue(s),!0):!1}function ld(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var LR=/[\n"\\]/g;function kr(s){return s.replace(LR,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Mm(s,a,c,f,x,b,k,P){s.name="",k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?s.type=k:s.removeAttribute("type"),a!=null?k==="number"?(a===0&&s.value===""||s.value!=a)&&(s.value=""+Nr(a)):s.value!==""+Nr(a)&&(s.value=""+Nr(a)):k!=="submit"&&k!=="reset"||s.removeAttribute("value"),a!=null?Rm(s,k,Nr(a)):c!=null?Rm(s,k,Nr(c)):f!=null&&s.removeAttribute("value"),x==null&&b!=null&&(s.defaultChecked=!!b),x!=null&&(s.checked=x&&typeof x!="function"&&typeof x!="symbol"),P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?s.name=""+Nr(P):s.removeAttribute("name")}function Pb(s,a,c,f,x,b,k,P){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(s.type=b),a!=null||c!=null){if(!(b!=="submit"&&b!=="reset"||a!=null)){Tm(s);return}c=c!=null?""+Nr(c):"",a=a!=null?""+Nr(a):c,P||a===s.value||(s.value=a),s.defaultValue=a}f=f??x,f=typeof f!="function"&&typeof f!="symbol"&&!!f,s.checked=P?s.checked:!!f,s.defaultChecked=!!f,k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(s.name=k),Tm(s)}function Rm(s,a,c){a==="number"&&ld(s.ownerDocument)===s||s.defaultValue===""+c||(s.defaultValue=""+c)}function ii(s,a,c,f){if(s=s.options,a){a={};for(var x=0;x<c.length;x++)a["$"+c[x]]=!0;for(c=0;c<s.length;c++)x=a.hasOwnProperty("$"+s[c].value),s[c].selected!==x&&(s[c].selected=x),x&&f&&(s[c].defaultSelected=!0)}else{for(c=""+Nr(c),a=null,x=0;x<s.length;x++){if(s[x].value===c){s[x].selected=!0,f&&(s[x].defaultSelected=!0);return}a!==null||s[x].disabled||(a=s[x])}a!==null&&(a.selected=!0)}}function Lb(s,a,c){if(a!=null&&(a=""+Nr(a),a!==s.value&&(s.value=a),c==null)){s.defaultValue!==a&&(s.defaultValue=a);return}s.defaultValue=c!=null?""+Nr(c):""}function Ib(s,a,c,f){if(a==null){if(f!=null){if(c!=null)throw Error(r(92));if(ae(f)){if(1<f.length)throw Error(r(93));f=f[0]}c=f}c==null&&(c=""),a=c}c=Nr(a),s.defaultValue=c,f=s.textContent,f===c&&f!==""&&f!==null&&(s.value=f),Tm(s)}function li(s,a){if(a){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=a;return}}s.textContent=a}var IR=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function $b(s,a,c){var f=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?f?s.setProperty(a,""):a==="float"?s.cssFloat="":s[a]="":f?s.setProperty(a,c):typeof c!="number"||c===0||IR.has(a)?a==="float"?s.cssFloat=c:s[a]=(""+c).trim():s[a]=c+"px"}function Fb(s,a,c){if(a!=null&&typeof a!="object")throw Error(r(62));if(s=s.style,c!=null){for(var f in c)!c.hasOwnProperty(f)||a!=null&&a.hasOwnProperty(f)||(f.indexOf("--")===0?s.setProperty(f,""):f==="float"?s.cssFloat="":s[f]="");for(var x in a)f=a[x],a.hasOwnProperty(x)&&c[x]!==f&&$b(s,x,f)}else for(var b in a)a.hasOwnProperty(b)&&$b(s,b,a[b])}function Am(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var $R=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),FR=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function cd(s){return FR.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function zs(){}var Om=null;function Dm(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var ci=null,ui=null;function Bb(s){var a=si(s);if(a&&(s=a.stateNode)){var c=s[Wn]||null;e:switch(s=a.stateNode,a.type){case"input":if(Mm(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+kr(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var f=c[a];if(f!==s&&f.form===s.form){var x=f[Wn]||null;if(!x)throw Error(r(90));Mm(f,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(a=0;a<c.length;a++)f=c[a],f.form===s.form&&zb(f)}break e;case"textarea":Lb(s,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&ii(s,!!c.multiple,a,!1)}}}var zm=!1;function Ub(s,a,c){if(zm)return s(a,c);zm=!0;try{var f=s(a);return f}finally{if(zm=!1,(ci!==null||ui!==null)&&(Qd(),ci&&(a=ci,s=ui,ui=ci=null,Bb(a),s)))for(a=0;a<s.length;a++)Bb(s[a])}}function Gl(s,a){var c=s.stateNode;if(c===null)return null;var f=c[Wn]||null;if(f===null)return null;c=f[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(s=s.type,f=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!f;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(r(231,a,typeof c));return c}var Ps=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Pm=!1;if(Ps)try{var Zl={};Object.defineProperty(Zl,"passive",{get:function(){Pm=!0}}),window.addEventListener("test",Zl,Zl),window.removeEventListener("test",Zl,Zl)}catch{Pm=!1}var ga=null,Lm=null,ud=null;function qb(){if(ud)return ud;var s,a=Lm,c=a.length,f,x="value"in ga?ga.value:ga.textContent,b=x.length;for(s=0;s<c&&a[s]===x[s];s++);var k=c-s;for(f=1;f<=k&&a[c-f]===x[b-f];f++);return ud=x.slice(s,1<f?1-f:void 0)}function dd(s){var a=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&a===13&&(s=13)):s=a,s===10&&(s=13),32<=s||s===13?s:0}function fd(){return!0}function Vb(){return!1}function Gn(s){function a(c,f,x,b,k){this._reactName=c,this._targetInst=x,this.type=f,this.nativeEvent=b,this.target=k,this.currentTarget=null;for(var P in s)s.hasOwnProperty(P)&&(c=s[P],this[P]=c?c(b):b[P]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?fd:Vb,this.isPropagationStopped=Vb,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=fd)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=fd)},persist:function(){},isPersistent:fd}),a}var lo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hd=Gn(lo),Ql=g({},lo,{view:0,detail:0}),BR=Gn(Ql),Im,$m,Kl,md=g({},Ql,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bm,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Kl&&(Kl&&s.type==="mousemove"?(Im=s.screenX-Kl.screenX,$m=s.screenY-Kl.screenY):$m=Im=0,Kl=s),Im)},movementY:function(s){return"movementY"in s?s.movementY:$m}}),Hb=Gn(md),UR=g({},md,{dataTransfer:0}),qR=Gn(UR),VR=g({},Ql,{relatedTarget:0}),Fm=Gn(VR),HR=g({},lo,{animationName:0,elapsedTime:0,pseudoElement:0}),YR=Gn(HR),WR=g({},lo,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),GR=Gn(WR),ZR=g({},lo,{data:0}),Yb=Gn(ZR),QR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},KR={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},XR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function JR(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=XR[s])?!!a[s]:!1}function Bm(){return JR}var eA=g({},Ql,{key:function(s){if(s.key){var a=QR[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=dd(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?KR[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bm,charCode:function(s){return s.type==="keypress"?dd(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?dd(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),tA=Gn(eA),nA=g({},md,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Wb=Gn(nA),rA=g({},Ql,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bm}),sA=Gn(rA),aA=g({},lo,{propertyName:0,elapsedTime:0,pseudoElement:0}),oA=Gn(aA),iA=g({},md,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),lA=Gn(iA),cA=g({},lo,{newState:0,oldState:0}),uA=Gn(cA),dA=[9,13,27,32],Um=Ps&&"CompositionEvent"in window,Xl=null;Ps&&"documentMode"in document&&(Xl=document.documentMode);var fA=Ps&&"TextEvent"in window&&!Xl,Gb=Ps&&(!Um||Xl&&8<Xl&&11>=Xl),Zb=" ",Qb=!1;function Kb(s,a){switch(s){case"keyup":return dA.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xb(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var di=!1;function hA(s,a){switch(s){case"compositionend":return Xb(a);case"keypress":return a.which!==32?null:(Qb=!0,Zb);case"textInput":return s=a.data,s===Zb&&Qb?null:s;default:return null}}function mA(s,a){if(di)return s==="compositionend"||!Um&&Kb(s,a)?(s=qb(),ud=Lm=ga=null,di=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Gb&&a.locale!=="ko"?null:a.data;default:return null}}var pA={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Jb(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!pA[s.type]:a==="textarea"}function e0(s,a,c,f){ci?ui?ui.push(f):ui=[f]:ci=f,a=rf(a,"onChange"),0<a.length&&(c=new hd("onChange","change",null,c,f),s.push({event:c,listeners:a}))}var Jl=null,ec=null;function gA(s){PS(s,0)}function pd(s){var a=Wl(s);if(zb(a))return s}function t0(s,a){if(s==="change")return a}var n0=!1;if(Ps){var qm;if(Ps){var Vm="oninput"in document;if(!Vm){var r0=document.createElement("div");r0.setAttribute("oninput","return;"),Vm=typeof r0.oninput=="function"}qm=Vm}else qm=!1;n0=qm&&(!document.documentMode||9<document.documentMode)}function s0(){Jl&&(Jl.detachEvent("onpropertychange",a0),ec=Jl=null)}function a0(s){if(s.propertyName==="value"&&pd(ec)){var a=[];e0(a,ec,s,Dm(s)),Ub(gA,a)}}function vA(s,a,c){s==="focusin"?(s0(),Jl=a,ec=c,Jl.attachEvent("onpropertychange",a0)):s==="focusout"&&s0()}function xA(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return pd(ec)}function yA(s,a){if(s==="click")return pd(a)}function bA(s,a){if(s==="input"||s==="change")return pd(a)}function wA(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var ir=typeof Object.is=="function"?Object.is:wA;function tc(s,a){if(ir(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var c=Object.keys(s),f=Object.keys(a);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var x=c[f];if(!pe.call(a,x)||!ir(s[x],a[x]))return!1}return!0}function o0(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function i0(s,a){var c=o0(s);s=0;for(var f;c;){if(c.nodeType===3){if(f=s+c.textContent.length,s<=a&&f>=a)return{node:c,offset:a-s};s=f}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=o0(c)}}function l0(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?l0(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function c0(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var a=ld(s.document);a instanceof s.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)s=a.contentWindow;else break;a=ld(s.document)}return a}function Hm(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}var SA=Ps&&"documentMode"in document&&11>=document.documentMode,fi=null,Ym=null,nc=null,Wm=!1;function u0(s,a,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Wm||fi==null||fi!==ld(f)||(f=fi,"selectionStart"in f&&Hm(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),nc&&tc(nc,f)||(nc=f,f=rf(Ym,"onSelect"),0<f.length&&(a=new hd("onSelect","select",null,a,c),s.push({event:a,listeners:f}),a.target=fi)))}function co(s,a){var c={};return c[s.toLowerCase()]=a.toLowerCase(),c["Webkit"+s]="webkit"+a,c["Moz"+s]="moz"+a,c}var hi={animationend:co("Animation","AnimationEnd"),animationiteration:co("Animation","AnimationIteration"),animationstart:co("Animation","AnimationStart"),transitionrun:co("Transition","TransitionRun"),transitionstart:co("Transition","TransitionStart"),transitioncancel:co("Transition","TransitionCancel"),transitionend:co("Transition","TransitionEnd")},Gm={},d0={};Ps&&(d0=document.createElement("div").style,"AnimationEvent"in window||(delete hi.animationend.animation,delete hi.animationiteration.animation,delete hi.animationstart.animation),"TransitionEvent"in window||delete hi.transitionend.transition);function uo(s){if(Gm[s])return Gm[s];if(!hi[s])return s;var a=hi[s],c;for(c in a)if(a.hasOwnProperty(c)&&c in d0)return Gm[s]=a[c];return s}var f0=uo("animationend"),h0=uo("animationiteration"),m0=uo("animationstart"),jA=uo("transitionrun"),CA=uo("transitionstart"),NA=uo("transitioncancel"),p0=uo("transitionend"),g0=new Map,Zm="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Zm.push("scrollEnd");function Wr(s,a){g0.set(s,a),io(a,[s])}var gd=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},_r=[],mi=0,Qm=0;function vd(){for(var s=mi,a=Qm=mi=0;a<s;){var c=_r[a];_r[a++]=null;var f=_r[a];_r[a++]=null;var x=_r[a];_r[a++]=null;var b=_r[a];if(_r[a++]=null,f!==null&&x!==null){var k=f.pending;k===null?x.next=x:(x.next=k.next,k.next=x),f.pending=x}b!==0&&v0(c,x,b)}}function xd(s,a,c,f){_r[mi++]=s,_r[mi++]=a,_r[mi++]=c,_r[mi++]=f,Qm|=f,s.lanes|=f,s=s.alternate,s!==null&&(s.lanes|=f)}function Km(s,a,c,f){return xd(s,a,c,f),yd(s)}function fo(s,a){return xd(s,null,null,a),yd(s)}function v0(s,a,c){s.lanes|=c;var f=s.alternate;f!==null&&(f.lanes|=c);for(var x=!1,b=s.return;b!==null;)b.childLanes|=c,f=b.alternate,f!==null&&(f.childLanes|=c),b.tag===22&&(s=b.stateNode,s===null||s._visibility&1||(x=!0)),s=b,b=b.return;return s.tag===3?(b=s.stateNode,x&&a!==null&&(x=31-$t(c),s=b.hiddenUpdates,f=s[x],f===null?s[x]=[a]:f.push(a),a.lane=c|536870912),b):null}function yd(s){if(50<Cc)throw Cc=0,og=null,Error(r(185));for(var a=s.return;a!==null;)s=a,a=s.return;return s.tag===3?s.stateNode:null}var pi={};function kA(s,a,c,f){this.tag=s,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function lr(s,a,c,f){return new kA(s,a,c,f)}function Xm(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Ls(s,a){var c=s.alternate;return c===null?(c=lr(s.tag,a,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=a,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&65011712,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,a=s.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c.refCleanup=s.refCleanup,c}function x0(s,a){s.flags&=65011714;var c=s.alternate;return c===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,a=c.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function bd(s,a,c,f,x,b){var k=0;if(f=s,typeof s=="function")Xm(s)&&(k=1);else if(typeof s=="string")k=RO(s,c,ne.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case D:return s=lr(31,c,a,x),s.elementType=D,s.lanes=b,s;case j:return ho(c.children,x,b,a);case N:k=8,x|=24;break;case C:return s=lr(12,c,a,x|2),s.elementType=C,s.lanes=b,s;case A:return s=lr(13,c,a,x),s.elementType=A,s.lanes=b,s;case R:return s=lr(19,c,a,x),s.elementType=R,s.lanes=b,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case E:k=10;break e;case _:k=9;break e;case M:k=11;break e;case T:k=14;break e;case O:k=16,f=null;break e}k=29,c=Error(r(130,s===null?"null":typeof s,"")),f=null}return a=lr(k,c,a,x),a.elementType=s,a.type=f,a.lanes=b,a}function ho(s,a,c,f){return s=lr(7,s,f,a),s.lanes=c,s}function Jm(s,a,c){return s=lr(6,s,null,a),s.lanes=c,s}function y0(s){var a=lr(18,null,null,0);return a.stateNode=s,a}function ep(s,a,c){return a=lr(4,s.children!==null?s.children:[],s.key,a),a.lanes=c,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}var b0=new WeakMap;function Er(s,a){if(typeof s=="object"&&s!==null){var c=b0.get(s);return c!==void 0?c:(a={value:s,source:a,stack:yt(a)},b0.set(s,a),a)}return{value:s,source:a,stack:yt(a)}}var gi=[],vi=0,wd=null,rc=0,Tr=[],Mr=0,va=null,ds=1,fs="";function Is(s,a){gi[vi++]=rc,gi[vi++]=wd,wd=s,rc=a}function w0(s,a,c){Tr[Mr++]=ds,Tr[Mr++]=fs,Tr[Mr++]=va,va=s;var f=ds;s=fs;var x=32-$t(f)-1;f&=~(1<<x),c+=1;var b=32-$t(a)+x;if(30<b){var k=x-x%5;b=(f&(1<<k)-1).toString(32),f>>=k,x-=k,ds=1<<32-$t(a)+x|c<<x|f,fs=b+s}else ds=1<<b|c<<x|f,fs=s}function tp(s){s.return!==null&&(Is(s,1),w0(s,1,0))}function np(s){for(;s===wd;)wd=gi[--vi],gi[vi]=null,rc=gi[--vi],gi[vi]=null;for(;s===va;)va=Tr[--Mr],Tr[Mr]=null,fs=Tr[--Mr],Tr[Mr]=null,ds=Tr[--Mr],Tr[Mr]=null}function S0(s,a){Tr[Mr++]=ds,Tr[Mr++]=fs,Tr[Mr++]=va,ds=a.id,fs=a.overflow,va=s}var kn=null,Dt=null,ut=!1,xa=null,Rr=!1,rp=Error(r(519));function ya(s){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw sc(Er(a,s)),rp}function j0(s){var a=s.stateNode,c=s.type,f=s.memoizedProps;switch(a[Zt]=s,a[Wn]=f,c){case"dialog":at("cancel",a),at("close",a);break;case"iframe":case"object":case"embed":at("load",a);break;case"video":case"audio":for(c=0;c<kc.length;c++)at(kc[c],a);break;case"source":at("error",a);break;case"img":case"image":case"link":at("error",a),at("load",a);break;case"details":at("toggle",a);break;case"input":at("invalid",a),Pb(a,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":at("invalid",a);break;case"textarea":at("invalid",a),Ib(a,f.value,f.defaultValue,f.children)}c=f.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||f.suppressHydrationWarning===!0||FS(a.textContent,c)?(f.popover!=null&&(at("beforetoggle",a),at("toggle",a)),f.onScroll!=null&&at("scroll",a),f.onScrollEnd!=null&&at("scrollend",a),f.onClick!=null&&(a.onclick=zs),a=!0):a=!1,a||ya(s,!0)}function C0(s){for(kn=s.return;kn;)switch(kn.tag){case 5:case 31:case 13:Rr=!1;return;case 27:case 3:Rr=!0;return;default:kn=kn.return}}function xi(s){if(s!==kn)return!1;if(!ut)return C0(s),ut=!0,!1;var a=s.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=s.type,c=!(c!=="form"&&c!=="button")||wg(s.type,s.memoizedProps)),c=!c),c&&Dt&&ya(s),C0(s),a===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));Dt=ZS(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));Dt=ZS(s)}else a===27?(a=Dt,Oa(s.type)?(s=kg,kg=null,Dt=s):Dt=a):Dt=kn?Or(s.stateNode.nextSibling):null;return!0}function mo(){Dt=kn=null,ut=!1}function sp(){var s=xa;return s!==null&&(Xn===null?Xn=s:Xn.push.apply(Xn,s),xa=null),s}function sc(s){xa===null?xa=[s]:xa.push(s)}var ap=I(null),po=null,$s=null;function ba(s,a,c){K(ap,a._currentValue),a._currentValue=c}function Fs(s){s._currentValue=ap.current,F(ap)}function op(s,a,c){for(;s!==null;){var f=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,f!==null&&(f.childLanes|=a)):f!==null&&(f.childLanes&a)!==a&&(f.childLanes|=a),s===c)break;s=s.return}}function ip(s,a,c,f){var x=s.child;for(x!==null&&(x.return=s);x!==null;){var b=x.dependencies;if(b!==null){var k=x.child;b=b.firstContext;e:for(;b!==null;){var P=b;b=x;for(var q=0;q<a.length;q++)if(P.context===a[q]){b.lanes|=c,P=b.alternate,P!==null&&(P.lanes|=c),op(b.return,c,s),f||(k=null);break e}b=P.next}}else if(x.tag===18){if(k=x.return,k===null)throw Error(r(341));k.lanes|=c,b=k.alternate,b!==null&&(b.lanes|=c),op(k,c,s),k=null}else k=x.child;if(k!==null)k.return=x;else for(k=x;k!==null;){if(k===s){k=null;break}if(x=k.sibling,x!==null){x.return=k.return,k=x;break}k=k.return}x=k}}function yi(s,a,c,f){s=null;for(var x=a,b=!1;x!==null;){if(!b){if((x.flags&524288)!==0)b=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var k=x.alternate;if(k===null)throw Error(r(387));if(k=k.memoizedProps,k!==null){var P=x.type;ir(x.pendingProps.value,k.value)||(s!==null?s.push(P):s=[P])}}else if(x===te.current){if(k=x.alternate,k===null)throw Error(r(387));k.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(s!==null?s.push(Rc):s=[Rc])}x=x.return}s!==null&&ip(a,s,c,f),a.flags|=262144}function Sd(s){for(s=s.firstContext;s!==null;){if(!ir(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function go(s){po=s,$s=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function _n(s){return N0(po,s)}function jd(s,a){return po===null&&go(s),N0(s,a)}function N0(s,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},$s===null){if(s===null)throw Error(r(308));$s=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else $s=$s.next=a;return c}var _A=typeof AbortController<"u"?AbortController:function(){var s=[],a=this.signal={aborted:!1,addEventListener:function(c,f){s.push(f)}};this.abort=function(){a.aborted=!0,s.forEach(function(c){return c()})}},EA=e.unstable_scheduleCallback,TA=e.unstable_NormalPriority,nn={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function lp(){return{controller:new _A,data:new Map,refCount:0}}function ac(s){s.refCount--,s.refCount===0&&EA(TA,function(){s.controller.abort()})}var oc=null,cp=0,bi=0,wi=null;function MA(s,a){if(oc===null){var c=oc=[];cp=0,bi=fg(),wi={status:"pending",value:void 0,then:function(f){c.push(f)}}}return cp++,a.then(k0,k0),a}function k0(){if(--cp===0&&oc!==null){wi!==null&&(wi.status="fulfilled");var s=oc;oc=null,bi=0,wi=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function RA(s,a){var c=[],f={status:"pending",value:null,reason:null,then:function(x){c.push(x)}};return s.then(function(){f.status="fulfilled",f.value=a;for(var x=0;x<c.length;x++)(0,c[x])(a)},function(x){for(f.status="rejected",f.reason=x,x=0;x<c.length;x++)(0,c[x])(void 0)}),f}var _0=L.S;L.S=function(s,a){uS=ct(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&MA(s,a),_0!==null&&_0(s,a)};var vo=I(null);function up(){var s=vo.current;return s!==null?s:Rt.pooledCache}function Cd(s,a){a===null?K(vo,vo.current):K(vo,a.pool)}function E0(){var s=up();return s===null?null:{parent:nn._currentValue,pool:s}}var Si=Error(r(460)),dp=Error(r(474)),Nd=Error(r(542)),kd={then:function(){}};function T0(s){return s=s.status,s==="fulfilled"||s==="rejected"}function M0(s,a,c){switch(c=s[c],c===void 0?s.push(a):c!==a&&(a.then(zs,zs),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,A0(s),s;default:if(typeof a.status=="string")a.then(zs,zs);else{if(s=Rt,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=a,s.status="pending",s.then(function(f){if(a.status==="pending"){var x=a;x.status="fulfilled",x.value=f}},function(f){if(a.status==="pending"){var x=a;x.status="rejected",x.reason=f}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,A0(s),s}throw yo=a,Si}}function xo(s){try{var a=s._init;return a(s._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(yo=c,Si):c}}var yo=null;function R0(){if(yo===null)throw Error(r(459));var s=yo;return yo=null,s}function A0(s){if(s===Si||s===Nd)throw Error(r(483))}var ji=null,ic=0;function _d(s){var a=ic;return ic+=1,ji===null&&(ji=[]),M0(ji,s,a)}function lc(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function Ed(s,a){throw a.$$typeof===y?Error(r(525)):(s=Object.prototype.toString.call(a),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s)))}function O0(s){function a(J,Z){if(s){var re=J.deletions;re===null?(J.deletions=[Z],J.flags|=16):re.push(Z)}}function c(J,Z){if(!s)return null;for(;Z!==null;)a(J,Z),Z=Z.sibling;return null}function f(J){for(var Z=new Map;J!==null;)J.key!==null?Z.set(J.key,J):Z.set(J.index,J),J=J.sibling;return Z}function x(J,Z){return J=Ls(J,Z),J.index=0,J.sibling=null,J}function b(J,Z,re){return J.index=re,s?(re=J.alternate,re!==null?(re=re.index,re<Z?(J.flags|=67108866,Z):re):(J.flags|=67108866,Z)):(J.flags|=1048576,Z)}function k(J){return s&&J.alternate===null&&(J.flags|=67108866),J}function P(J,Z,re,de){return Z===null||Z.tag!==6?(Z=Jm(re,J.mode,de),Z.return=J,Z):(Z=x(Z,re),Z.return=J,Z)}function q(J,Z,re,de){var Ie=re.type;return Ie===j?ce(J,Z,re.props.children,de,re.key):Z!==null&&(Z.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===O&&xo(Ie)===Z.type)?(Z=x(Z,re.props),lc(Z,re),Z.return=J,Z):(Z=bd(re.type,re.key,re.props,null,J.mode,de),lc(Z,re),Z.return=J,Z)}function se(J,Z,re,de){return Z===null||Z.tag!==4||Z.stateNode.containerInfo!==re.containerInfo||Z.stateNode.implementation!==re.implementation?(Z=ep(re,J.mode,de),Z.return=J,Z):(Z=x(Z,re.children||[]),Z.return=J,Z)}function ce(J,Z,re,de,Ie){return Z===null||Z.tag!==7?(Z=ho(re,J.mode,de,Ie),Z.return=J,Z):(Z=x(Z,re),Z.return=J,Z)}function he(J,Z,re){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Z=Jm(""+Z,J.mode,re),Z.return=J,Z;if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case w:return re=bd(Z.type,Z.key,Z.props,null,J.mode,re),lc(re,Z),re.return=J,re;case S:return Z=ep(Z,J.mode,re),Z.return=J,Z;case O:return Z=xo(Z),he(J,Z,re)}if(ae(Z)||V(Z))return Z=ho(Z,J.mode,re,null),Z.return=J,Z;if(typeof Z.then=="function")return he(J,_d(Z),re);if(Z.$$typeof===E)return he(J,jd(J,Z),re);Ed(J,Z)}return null}function oe(J,Z,re,de){var Ie=Z!==null?Z.key:null;if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return Ie!==null?null:P(J,Z,""+re,de);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case w:return re.key===Ie?q(J,Z,re,de):null;case S:return re.key===Ie?se(J,Z,re,de):null;case O:return re=xo(re),oe(J,Z,re,de)}if(ae(re)||V(re))return Ie!==null?null:ce(J,Z,re,de,null);if(typeof re.then=="function")return oe(J,Z,_d(re),de);if(re.$$typeof===E)return oe(J,Z,jd(J,re),de);Ed(J,re)}return null}function ie(J,Z,re,de,Ie){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return J=J.get(re)||null,P(Z,J,""+de,Ie);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case w:return J=J.get(de.key===null?re:de.key)||null,q(Z,J,de,Ie);case S:return J=J.get(de.key===null?re:de.key)||null,se(Z,J,de,Ie);case O:return de=xo(de),ie(J,Z,re,de,Ie)}if(ae(de)||V(de))return J=J.get(re)||null,ce(Z,J,de,Ie,null);if(typeof de.then=="function")return ie(J,Z,re,_d(de),Ie);if(de.$$typeof===E)return ie(J,Z,re,jd(Z,de),Ie);Ed(Z,de)}return null}function Ee(J,Z,re,de){for(var Ie=null,ft=null,Ae=Z,Xe=Z=0,lt=null;Ae!==null&&Xe<re.length;Xe++){Ae.index>Xe?(lt=Ae,Ae=null):lt=Ae.sibling;var ht=oe(J,Ae,re[Xe],de);if(ht===null){Ae===null&&(Ae=lt);break}s&&Ae&&ht.alternate===null&&a(J,Ae),Z=b(ht,Z,Xe),ft===null?Ie=ht:ft.sibling=ht,ft=ht,Ae=lt}if(Xe===re.length)return c(J,Ae),ut&&Is(J,Xe),Ie;if(Ae===null){for(;Xe<re.length;Xe++)Ae=he(J,re[Xe],de),Ae!==null&&(Z=b(Ae,Z,Xe),ft===null?Ie=Ae:ft.sibling=Ae,ft=Ae);return ut&&Is(J,Xe),Ie}for(Ae=f(Ae);Xe<re.length;Xe++)lt=ie(Ae,J,Xe,re[Xe],de),lt!==null&&(s&&lt.alternate!==null&&Ae.delete(lt.key===null?Xe:lt.key),Z=b(lt,Z,Xe),ft===null?Ie=lt:ft.sibling=lt,ft=lt);return s&&Ae.forEach(function(Ia){return a(J,Ia)}),ut&&Is(J,Xe),Ie}function qe(J,Z,re,de){if(re==null)throw Error(r(151));for(var Ie=null,ft=null,Ae=Z,Xe=Z=0,lt=null,ht=re.next();Ae!==null&&!ht.done;Xe++,ht=re.next()){Ae.index>Xe?(lt=Ae,Ae=null):lt=Ae.sibling;var Ia=oe(J,Ae,ht.value,de);if(Ia===null){Ae===null&&(Ae=lt);break}s&&Ae&&Ia.alternate===null&&a(J,Ae),Z=b(Ia,Z,Xe),ft===null?Ie=Ia:ft.sibling=Ia,ft=Ia,Ae=lt}if(ht.done)return c(J,Ae),ut&&Is(J,Xe),Ie;if(Ae===null){for(;!ht.done;Xe++,ht=re.next())ht=he(J,ht.value,de),ht!==null&&(Z=b(ht,Z,Xe),ft===null?Ie=ht:ft.sibling=ht,ft=ht);return ut&&Is(J,Xe),Ie}for(Ae=f(Ae);!ht.done;Xe++,ht=re.next())ht=ie(Ae,J,Xe,ht.value,de),ht!==null&&(s&&ht.alternate!==null&&Ae.delete(ht.key===null?Xe:ht.key),Z=b(ht,Z,Xe),ft===null?Ie=ht:ft.sibling=ht,ft=ht);return s&&Ae.forEach(function(UO){return a(J,UO)}),ut&&Is(J,Xe),Ie}function Et(J,Z,re,de){if(typeof re=="object"&&re!==null&&re.type===j&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case w:e:{for(var Ie=re.key;Z!==null;){if(Z.key===Ie){if(Ie=re.type,Ie===j){if(Z.tag===7){c(J,Z.sibling),de=x(Z,re.props.children),de.return=J,J=de;break e}}else if(Z.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===O&&xo(Ie)===Z.type){c(J,Z.sibling),de=x(Z,re.props),lc(de,re),de.return=J,J=de;break e}c(J,Z);break}else a(J,Z);Z=Z.sibling}re.type===j?(de=ho(re.props.children,J.mode,de,re.key),de.return=J,J=de):(de=bd(re.type,re.key,re.props,null,J.mode,de),lc(de,re),de.return=J,J=de)}return k(J);case S:e:{for(Ie=re.key;Z!==null;){if(Z.key===Ie)if(Z.tag===4&&Z.stateNode.containerInfo===re.containerInfo&&Z.stateNode.implementation===re.implementation){c(J,Z.sibling),de=x(Z,re.children||[]),de.return=J,J=de;break e}else{c(J,Z);break}else a(J,Z);Z=Z.sibling}de=ep(re,J.mode,de),de.return=J,J=de}return k(J);case O:return re=xo(re),Et(J,Z,re,de)}if(ae(re))return Ee(J,Z,re,de);if(V(re)){if(Ie=V(re),typeof Ie!="function")throw Error(r(150));return re=Ie.call(re),qe(J,Z,re,de)}if(typeof re.then=="function")return Et(J,Z,_d(re),de);if(re.$$typeof===E)return Et(J,Z,jd(J,re),de);Ed(J,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,Z!==null&&Z.tag===6?(c(J,Z.sibling),de=x(Z,re),de.return=J,J=de):(c(J,Z),de=Jm(re,J.mode,de),de.return=J,J=de),k(J)):c(J,Z)}return function(J,Z,re,de){try{ic=0;var Ie=Et(J,Z,re,de);return ji=null,Ie}catch(Ae){if(Ae===Si||Ae===Nd)throw Ae;var ft=lr(29,Ae,null,J.mode);return ft.lanes=de,ft.return=J,ft}}}var bo=O0(!0),D0=O0(!1),wa=!1;function fp(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hp(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Sa(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function ja(s,a,c){var f=s.updateQueue;if(f===null)return null;if(f=f.shared,(vt&2)!==0){var x=f.pending;return x===null?a.next=a:(a.next=x.next,x.next=a),f.pending=a,a=yd(s),v0(s,null,c),a}return xd(s,f,a,c),yd(s)}function cc(s,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var f=a.lanes;f&=s.pendingLanes,c|=f,a.lanes=c,wn(s,c)}}function mp(s,a){var c=s.updateQueue,f=s.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var x=null,b=null;if(c=c.firstBaseUpdate,c!==null){do{var k={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};b===null?x=b=k:b=b.next=k,c=c.next}while(c!==null);b===null?x=b=a:b=b.next=a}else x=b=a;c={baseState:f.baseState,firstBaseUpdate:x,lastBaseUpdate:b,shared:f.shared,callbacks:f.callbacks},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=a:s.next=a,c.lastBaseUpdate=a}var pp=!1;function uc(){if(pp){var s=wi;if(s!==null)throw s}}function dc(s,a,c,f){pp=!1;var x=s.updateQueue;wa=!1;var b=x.firstBaseUpdate,k=x.lastBaseUpdate,P=x.shared.pending;if(P!==null){x.shared.pending=null;var q=P,se=q.next;q.next=null,k===null?b=se:k.next=se,k=q;var ce=s.alternate;ce!==null&&(ce=ce.updateQueue,P=ce.lastBaseUpdate,P!==k&&(P===null?ce.firstBaseUpdate=se:P.next=se,ce.lastBaseUpdate=q))}if(b!==null){var he=x.baseState;k=0,ce=se=q=null,P=b;do{var oe=P.lane&-536870913,ie=oe!==P.lane;if(ie?(it&oe)===oe:(f&oe)===oe){oe!==0&&oe===bi&&(pp=!0),ce!==null&&(ce=ce.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});e:{var Ee=s,qe=P;oe=a;var Et=c;switch(qe.tag){case 1:if(Ee=qe.payload,typeof Ee=="function"){he=Ee.call(Et,he,oe);break e}he=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=qe.payload,oe=typeof Ee=="function"?Ee.call(Et,he,oe):Ee,oe==null)break e;he=g({},he,oe);break e;case 2:wa=!0}}oe=P.callback,oe!==null&&(s.flags|=64,ie&&(s.flags|=8192),ie=x.callbacks,ie===null?x.callbacks=[oe]:ie.push(oe))}else ie={lane:oe,tag:P.tag,payload:P.payload,callback:P.callback,next:null},ce===null?(se=ce=ie,q=he):ce=ce.next=ie,k|=oe;if(P=P.next,P===null){if(P=x.shared.pending,P===null)break;ie=P,P=ie.next,ie.next=null,x.lastBaseUpdate=ie,x.shared.pending=null}}while(!0);ce===null&&(q=he),x.baseState=q,x.firstBaseUpdate=se,x.lastBaseUpdate=ce,b===null&&(x.shared.lanes=0),Ea|=k,s.lanes=k,s.memoizedState=he}}function z0(s,a){if(typeof s!="function")throw Error(r(191,s));s.call(a)}function P0(s,a){var c=s.callbacks;if(c!==null)for(s.callbacks=null,s=0;s<c.length;s++)z0(c[s],a)}var Ci=I(null),Td=I(0);function L0(s,a){s=Zs,K(Td,s),K(Ci,a),Zs=s|a.baseLanes}function gp(){K(Td,Zs),K(Ci,Ci.current)}function vp(){Zs=Td.current,F(Ci),F(Td)}var cr=I(null),Ar=null;function Ca(s){var a=s.alternate;K(Qt,Qt.current&1),K(cr,s),Ar===null&&(a===null||Ci.current!==null||a.memoizedState!==null)&&(Ar=s)}function xp(s){K(Qt,Qt.current),K(cr,s),Ar===null&&(Ar=s)}function I0(s){s.tag===22?(K(Qt,Qt.current),K(cr,s),Ar===null&&(Ar=s)):Na()}function Na(){K(Qt,Qt.current),K(cr,cr.current)}function ur(s){F(cr),Ar===s&&(Ar=null),F(Qt)}var Qt=I(0);function Md(s){for(var a=s;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Cg(c)||Ng(c)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Bs=0,Ze=null,kt=null,rn=null,Rd=!1,Ni=!1,wo=!1,Ad=0,fc=0,ki=null,AA=0;function Vt(){throw Error(r(321))}function yp(s,a){if(a===null)return!1;for(var c=0;c<a.length&&c<s.length;c++)if(!ir(s[c],a[c]))return!1;return!0}function bp(s,a,c,f,x,b){return Bs=b,Ze=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,L.H=s===null||s.memoizedState===null?ww:zp,wo=!1,b=c(f,x),wo=!1,Ni&&(b=F0(a,c,f,x)),$0(s),b}function $0(s){L.H=pc;var a=kt!==null&&kt.next!==null;if(Bs=0,rn=kt=Ze=null,Rd=!1,fc=0,ki=null,a)throw Error(r(300));s===null||sn||(s=s.dependencies,s!==null&&Sd(s)&&(sn=!0))}function F0(s,a,c,f){Ze=s;var x=0;do{if(Ni&&(ki=null),fc=0,Ni=!1,25<=x)throw Error(r(301));if(x+=1,rn=kt=null,s.updateQueue!=null){var b=s.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}L.H=Sw,b=a(c,f)}while(Ni);return b}function OA(){var s=L.H,a=s.useState()[0];return a=typeof a.then=="function"?hc(a):a,s=s.useState()[0],(kt!==null?kt.memoizedState:null)!==s&&(Ze.flags|=1024),a}function wp(){var s=Ad!==0;return Ad=0,s}function Sp(s,a,c){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~c}function jp(s){if(Rd){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}Rd=!1}Bs=0,rn=kt=Ze=null,Ni=!1,fc=Ad=0,ki=null}function Ln(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rn===null?Ze.memoizedState=rn=s:rn=rn.next=s,rn}function Kt(){if(kt===null){var s=Ze.alternate;s=s!==null?s.memoizedState:null}else s=kt.next;var a=rn===null?Ze.memoizedState:rn.next;if(a!==null)rn=a,kt=s;else{if(s===null)throw Ze.alternate===null?Error(r(467)):Error(r(310));kt=s,s={memoizedState:kt.memoizedState,baseState:kt.baseState,baseQueue:kt.baseQueue,queue:kt.queue,next:null},rn===null?Ze.memoizedState=rn=s:rn=rn.next=s}return rn}function Od(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function hc(s){var a=fc;return fc+=1,ki===null&&(ki=[]),s=M0(ki,s,a),a=Ze,(rn===null?a.memoizedState:rn.next)===null&&(a=a.alternate,L.H=a===null||a.memoizedState===null?ww:zp),s}function Dd(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return hc(s);if(s.$$typeof===E)return _n(s)}throw Error(r(438,String(s)))}function Cp(s){var a=null,c=Ze.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var f=Ze.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(a={data:f.data.map(function(x){return x.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=Od(),Ze.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(s),f=0;f<s;f++)c[f]=z;return a.index++,c}function Us(s,a){return typeof a=="function"?a(s):a}function zd(s){var a=Kt();return Np(a,kt,s)}function Np(s,a,c){var f=s.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=c;var x=s.baseQueue,b=f.pending;if(b!==null){if(x!==null){var k=x.next;x.next=b.next,b.next=k}a.baseQueue=x=b,f.pending=null}if(b=s.baseState,x===null)s.memoizedState=b;else{a=x.next;var P=k=null,q=null,se=a,ce=!1;do{var he=se.lane&-536870913;if(he!==se.lane?(it&he)===he:(Bs&he)===he){var oe=se.revertLane;if(oe===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null}),he===bi&&(ce=!0);else if((Bs&oe)===oe){se=se.next,oe===bi&&(ce=!0);continue}else he={lane:0,revertLane:se.revertLane,gesture:null,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},q===null?(P=q=he,k=b):q=q.next=he,Ze.lanes|=oe,Ea|=oe;he=se.action,wo&&c(b,he),b=se.hasEagerState?se.eagerState:c(b,he)}else oe={lane:he,revertLane:se.revertLane,gesture:se.gesture,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},q===null?(P=q=oe,k=b):q=q.next=oe,Ze.lanes|=he,Ea|=he;se=se.next}while(se!==null&&se!==a);if(q===null?k=b:q.next=P,!ir(b,s.memoizedState)&&(sn=!0,ce&&(c=wi,c!==null)))throw c;s.memoizedState=b,s.baseState=k,s.baseQueue=q,f.lastRenderedState=b}return x===null&&(f.lanes=0),[s.memoizedState,f.dispatch]}function kp(s){var a=Kt(),c=a.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=s;var f=c.dispatch,x=c.pending,b=a.memoizedState;if(x!==null){c.pending=null;var k=x=x.next;do b=s(b,k.action),k=k.next;while(k!==x);ir(b,a.memoizedState)||(sn=!0),a.memoizedState=b,a.baseQueue===null&&(a.baseState=b),c.lastRenderedState=b}return[b,f]}function B0(s,a,c){var f=Ze,x=Kt(),b=ut;if(b){if(c===void 0)throw Error(r(407));c=c()}else c=a();var k=!ir((kt||x).memoizedState,c);if(k&&(x.memoizedState=c,sn=!0),x=x.queue,Tp(V0.bind(null,f,x,s),[s]),x.getSnapshot!==a||k||rn!==null&&rn.memoizedState.tag&1){if(f.flags|=2048,_i(9,{destroy:void 0},q0.bind(null,f,x,c,a),null),Rt===null)throw Error(r(349));b||(Bs&127)!==0||U0(f,a,c)}return c}function U0(s,a,c){s.flags|=16384,s={getSnapshot:a,value:c},a=Ze.updateQueue,a===null?(a=Od(),Ze.updateQueue=a,a.stores=[s]):(c=a.stores,c===null?a.stores=[s]:c.push(s))}function q0(s,a,c,f){a.value=c,a.getSnapshot=f,H0(a)&&Y0(s)}function V0(s,a,c){return c(function(){H0(a)&&Y0(s)})}function H0(s){var a=s.getSnapshot;s=s.value;try{var c=a();return!ir(s,c)}catch{return!0}}function Y0(s){var a=fo(s,2);a!==null&&Jn(a,s,2)}function _p(s){var a=Ln();if(typeof s=="function"){var c=s;if(s=c(),wo){en(!0);try{c()}finally{en(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Us,lastRenderedState:s},a}function W0(s,a,c,f){return s.baseState=c,Np(s,kt,typeof f=="function"?f:Us)}function DA(s,a,c,f,x){if(Id(s))throw Error(r(485));if(s=a.action,s!==null){var b={payload:x,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(k){b.listeners.push(k)}};L.T!==null?c(!0):b.isTransition=!1,f(b),c=a.pending,c===null?(b.next=a.pending=b,G0(a,b)):(b.next=c.next,a.pending=c.next=b)}}function G0(s,a){var c=a.action,f=a.payload,x=s.state;if(a.isTransition){var b=L.T,k={};L.T=k;try{var P=c(x,f),q=L.S;q!==null&&q(k,P),Z0(s,a,P)}catch(se){Ep(s,a,se)}finally{b!==null&&k.types!==null&&(b.types=k.types),L.T=b}}else try{b=c(x,f),Z0(s,a,b)}catch(se){Ep(s,a,se)}}function Z0(s,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){Q0(s,a,f)},function(f){return Ep(s,a,f)}):Q0(s,a,c)}function Q0(s,a,c){a.status="fulfilled",a.value=c,K0(a),s.state=c,a=s.pending,a!==null&&(c=a.next,c===a?s.pending=null:(c=c.next,a.next=c,G0(s,c)))}function Ep(s,a,c){var f=s.pending;if(s.pending=null,f!==null){f=f.next;do a.status="rejected",a.reason=c,K0(a),a=a.next;while(a!==f)}s.action=null}function K0(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function X0(s,a){return a}function J0(s,a){if(ut){var c=Rt.formState;if(c!==null){e:{var f=Ze;if(ut){if(Dt){t:{for(var x=Dt,b=Rr;x.nodeType!==8;){if(!b){x=null;break t}if(x=Or(x.nextSibling),x===null){x=null;break t}}b=x.data,x=b==="F!"||b==="F"?x:null}if(x){Dt=Or(x.nextSibling),f=x.data==="F!";break e}}ya(f)}f=!1}f&&(a=c[0])}}return c=Ln(),c.memoizedState=c.baseState=a,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:X0,lastRenderedState:a},c.queue=f,c=xw.bind(null,Ze,f),f.dispatch=c,f=_p(!1),b=Dp.bind(null,Ze,!1,f.queue),f=Ln(),x={state:a,dispatch:null,action:s,pending:null},f.queue=x,c=DA.bind(null,Ze,x,b,c),x.dispatch=c,f.memoizedState=s,[a,c,!1]}function ew(s){var a=Kt();return tw(a,kt,s)}function tw(s,a,c){if(a=Np(s,a,X0)[0],s=zd(Us)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var f=hc(a)}catch(k){throw k===Si?Nd:k}else f=a;a=Kt();var x=a.queue,b=x.dispatch;return c!==a.memoizedState&&(Ze.flags|=2048,_i(9,{destroy:void 0},zA.bind(null,x,c),null)),[f,b,s]}function zA(s,a){s.action=a}function nw(s){var a=Kt(),c=kt;if(c!==null)return tw(a,c,s);Kt(),a=a.memoizedState,c=Kt();var f=c.queue.dispatch;return c.memoizedState=s,[a,f,!1]}function _i(s,a,c,f){return s={tag:s,create:c,deps:f,inst:a,next:null},a=Ze.updateQueue,a===null&&(a=Od(),Ze.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=s.next=s:(f=c.next,c.next=s,s.next=f,a.lastEffect=s),s}function rw(){return Kt().memoizedState}function Pd(s,a,c,f){var x=Ln();Ze.flags|=s,x.memoizedState=_i(1|a,{destroy:void 0},c,f===void 0?null:f)}function Ld(s,a,c,f){var x=Kt();f=f===void 0?null:f;var b=x.memoizedState.inst;kt!==null&&f!==null&&yp(f,kt.memoizedState.deps)?x.memoizedState=_i(a,b,c,f):(Ze.flags|=s,x.memoizedState=_i(1|a,b,c,f))}function sw(s,a){Pd(8390656,8,s,a)}function Tp(s,a){Ld(2048,8,s,a)}function PA(s){Ze.flags|=4;var a=Ze.updateQueue;if(a===null)a=Od(),Ze.updateQueue=a,a.events=[s];else{var c=a.events;c===null?a.events=[s]:c.push(s)}}function aw(s){var a=Kt().memoizedState;return PA({ref:a,nextImpl:s}),function(){if((vt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function ow(s,a){return Ld(4,2,s,a)}function iw(s,a){return Ld(4,4,s,a)}function lw(s,a){if(typeof a=="function"){s=s();var c=a(s);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return s=s(),a.current=s,function(){a.current=null}}function cw(s,a,c){c=c!=null?c.concat([s]):null,Ld(4,4,lw.bind(null,a,s),c)}function Mp(){}function uw(s,a){var c=Kt();a=a===void 0?null:a;var f=c.memoizedState;return a!==null&&yp(a,f[1])?f[0]:(c.memoizedState=[s,a],s)}function dw(s,a){var c=Kt();a=a===void 0?null:a;var f=c.memoizedState;if(a!==null&&yp(a,f[1]))return f[0];if(f=s(),wo){en(!0);try{s()}finally{en(!1)}}return c.memoizedState=[f,a],f}function Rp(s,a,c){return c===void 0||(Bs&1073741824)!==0&&(it&261930)===0?s.memoizedState=a:(s.memoizedState=c,s=fS(),Ze.lanes|=s,Ea|=s,c)}function fw(s,a,c,f){return ir(c,a)?c:Ci.current!==null?(s=Rp(s,c,f),ir(s,a)||(sn=!0),s):(Bs&42)===0||(Bs&1073741824)!==0&&(it&261930)===0?(sn=!0,s.memoizedState=c):(s=fS(),Ze.lanes|=s,Ea|=s,a)}function hw(s,a,c,f,x){var b=$.p;$.p=b!==0&&8>b?b:8;var k=L.T,P={};L.T=P,Dp(s,!1,a,c);try{var q=x(),se=L.S;if(se!==null&&se(P,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var ce=RA(q,f);mc(s,a,ce,hr(s))}else mc(s,a,f,hr(s))}catch(he){mc(s,a,{then:function(){},status:"rejected",reason:he},hr())}finally{$.p=b,k!==null&&P.types!==null&&(k.types=P.types),L.T=k}}function LA(){}function Ap(s,a,c,f){if(s.tag!==5)throw Error(r(476));var x=mw(s).queue;hw(s,x,a,U,c===null?LA:function(){return pw(s),c(f)})}function mw(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:U,baseState:U,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Us,lastRenderedState:U},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Us,lastRenderedState:c},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function pw(s){var a=mw(s);a.next===null&&(a=s.alternate.memoizedState),mc(s,a.next.queue,{},hr())}function Op(){return _n(Rc)}function gw(){return Kt().memoizedState}function vw(){return Kt().memoizedState}function IA(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var c=hr();s=Sa(c);var f=ja(a,s,c);f!==null&&(Jn(f,a,c),cc(f,a,c)),a={cache:lp()},s.payload=a;return}a=a.return}}function $A(s,a,c){var f=hr();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Id(s)?yw(a,c):(c=Km(s,a,c,f),c!==null&&(Jn(c,s,f),bw(c,a,f)))}function xw(s,a,c){var f=hr();mc(s,a,c,f)}function mc(s,a,c,f){var x={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Id(s))yw(a,x);else{var b=s.alternate;if(s.lanes===0&&(b===null||b.lanes===0)&&(b=a.lastRenderedReducer,b!==null))try{var k=a.lastRenderedState,P=b(k,c);if(x.hasEagerState=!0,x.eagerState=P,ir(P,k))return xd(s,a,x,0),Rt===null&&vd(),!1}catch{}if(c=Km(s,a,x,f),c!==null)return Jn(c,s,f),bw(c,a,f),!0}return!1}function Dp(s,a,c,f){if(f={lane:2,revertLane:fg(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Id(s)){if(a)throw Error(r(479))}else a=Km(s,c,f,2),a!==null&&Jn(a,s,2)}function Id(s){var a=s.alternate;return s===Ze||a!==null&&a===Ze}function yw(s,a){Ni=Rd=!0;var c=s.pending;c===null?a.next=a:(a.next=c.next,c.next=a),s.pending=a}function bw(s,a,c){if((c&4194048)!==0){var f=a.lanes;f&=s.pendingLanes,c|=f,a.lanes=c,wn(s,c)}}var pc={readContext:_n,use:Dd,useCallback:Vt,useContext:Vt,useEffect:Vt,useImperativeHandle:Vt,useLayoutEffect:Vt,useInsertionEffect:Vt,useMemo:Vt,useReducer:Vt,useRef:Vt,useState:Vt,useDebugValue:Vt,useDeferredValue:Vt,useTransition:Vt,useSyncExternalStore:Vt,useId:Vt,useHostTransitionStatus:Vt,useFormState:Vt,useActionState:Vt,useOptimistic:Vt,useMemoCache:Vt,useCacheRefresh:Vt};pc.useEffectEvent=Vt;var ww={readContext:_n,use:Dd,useCallback:function(s,a){return Ln().memoizedState=[s,a===void 0?null:a],s},useContext:_n,useEffect:sw,useImperativeHandle:function(s,a,c){c=c!=null?c.concat([s]):null,Pd(4194308,4,lw.bind(null,a,s),c)},useLayoutEffect:function(s,a){return Pd(4194308,4,s,a)},useInsertionEffect:function(s,a){Pd(4,2,s,a)},useMemo:function(s,a){var c=Ln();a=a===void 0?null:a;var f=s();if(wo){en(!0);try{s()}finally{en(!1)}}return c.memoizedState=[f,a],f},useReducer:function(s,a,c){var f=Ln();if(c!==void 0){var x=c(a);if(wo){en(!0);try{c(a)}finally{en(!1)}}}else x=a;return f.memoizedState=f.baseState=x,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:x},f.queue=s,s=s.dispatch=$A.bind(null,Ze,s),[f.memoizedState,s]},useRef:function(s){var a=Ln();return s={current:s},a.memoizedState=s},useState:function(s){s=_p(s);var a=s.queue,c=xw.bind(null,Ze,a);return a.dispatch=c,[s.memoizedState,c]},useDebugValue:Mp,useDeferredValue:function(s,a){var c=Ln();return Rp(c,s,a)},useTransition:function(){var s=_p(!1);return s=hw.bind(null,Ze,s.queue,!0,!1),Ln().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,c){var f=Ze,x=Ln();if(ut){if(c===void 0)throw Error(r(407));c=c()}else{if(c=a(),Rt===null)throw Error(r(349));(it&127)!==0||U0(f,a,c)}x.memoizedState=c;var b={value:c,getSnapshot:a};return x.queue=b,sw(V0.bind(null,f,b,s),[s]),f.flags|=2048,_i(9,{destroy:void 0},q0.bind(null,f,b,c,a),null),c},useId:function(){var s=Ln(),a=Rt.identifierPrefix;if(ut){var c=fs,f=ds;c=(f&~(1<<32-$t(f)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Ad++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=AA++,a="_"+a+"r_"+c.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:Op,useFormState:J0,useActionState:J0,useOptimistic:function(s){var a=Ln();a.memoizedState=a.baseState=s;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=Dp.bind(null,Ze,!0,c),c.dispatch=a,[s,a]},useMemoCache:Cp,useCacheRefresh:function(){return Ln().memoizedState=IA.bind(null,Ze)},useEffectEvent:function(s){var a=Ln(),c={impl:s};return a.memoizedState=c,function(){if((vt&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}},zp={readContext:_n,use:Dd,useCallback:uw,useContext:_n,useEffect:Tp,useImperativeHandle:cw,useInsertionEffect:ow,useLayoutEffect:iw,useMemo:dw,useReducer:zd,useRef:rw,useState:function(){return zd(Us)},useDebugValue:Mp,useDeferredValue:function(s,a){var c=Kt();return fw(c,kt.memoizedState,s,a)},useTransition:function(){var s=zd(Us)[0],a=Kt().memoizedState;return[typeof s=="boolean"?s:hc(s),a]},useSyncExternalStore:B0,useId:gw,useHostTransitionStatus:Op,useFormState:ew,useActionState:ew,useOptimistic:function(s,a){var c=Kt();return W0(c,kt,s,a)},useMemoCache:Cp,useCacheRefresh:vw};zp.useEffectEvent=aw;var Sw={readContext:_n,use:Dd,useCallback:uw,useContext:_n,useEffect:Tp,useImperativeHandle:cw,useInsertionEffect:ow,useLayoutEffect:iw,useMemo:dw,useReducer:kp,useRef:rw,useState:function(){return kp(Us)},useDebugValue:Mp,useDeferredValue:function(s,a){var c=Kt();return kt===null?Rp(c,s,a):fw(c,kt.memoizedState,s,a)},useTransition:function(){var s=kp(Us)[0],a=Kt().memoizedState;return[typeof s=="boolean"?s:hc(s),a]},useSyncExternalStore:B0,useId:gw,useHostTransitionStatus:Op,useFormState:nw,useActionState:nw,useOptimistic:function(s,a){var c=Kt();return kt!==null?W0(c,kt,s,a):(c.baseState=s,[s,c.queue.dispatch])},useMemoCache:Cp,useCacheRefresh:vw};Sw.useEffectEvent=aw;function Pp(s,a,c,f){a=s.memoizedState,c=c(f,a),c=c==null?a:g({},a,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var Lp={enqueueSetState:function(s,a,c){s=s._reactInternals;var f=hr(),x=Sa(f);x.payload=a,c!=null&&(x.callback=c),a=ja(s,x,f),a!==null&&(Jn(a,s,f),cc(a,s,f))},enqueueReplaceState:function(s,a,c){s=s._reactInternals;var f=hr(),x=Sa(f);x.tag=1,x.payload=a,c!=null&&(x.callback=c),a=ja(s,x,f),a!==null&&(Jn(a,s,f),cc(a,s,f))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var c=hr(),f=Sa(c);f.tag=2,a!=null&&(f.callback=a),a=ja(s,f,c),a!==null&&(Jn(a,s,c),cc(a,s,c))}};function jw(s,a,c,f,x,b,k){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(f,b,k):a.prototype&&a.prototype.isPureReactComponent?!tc(c,f)||!tc(x,b):!0}function Cw(s,a,c,f){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,f),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,f),a.state!==s&&Lp.enqueueReplaceState(a,a.state,null)}function So(s,a){var c=a;if("ref"in a){c={};for(var f in a)f!=="ref"&&(c[f]=a[f])}if(s=s.defaultProps){c===a&&(c=g({},c));for(var x in s)c[x]===void 0&&(c[x]=s[x])}return c}function Nw(s){gd(s)}function kw(s){console.error(s)}function _w(s){gd(s)}function $d(s,a){try{var c=s.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(f){setTimeout(function(){throw f})}}function Ew(s,a,c){try{var f=s.onCaughtError;f(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Ip(s,a,c){return c=Sa(c),c.tag=3,c.payload={element:null},c.callback=function(){$d(s,a)},c}function Tw(s){return s=Sa(s),s.tag=3,s}function Mw(s,a,c,f){var x=c.type.getDerivedStateFromError;if(typeof x=="function"){var b=f.value;s.payload=function(){return x(b)},s.callback=function(){Ew(a,c,f)}}var k=c.stateNode;k!==null&&typeof k.componentDidCatch=="function"&&(s.callback=function(){Ew(a,c,f),typeof x!="function"&&(Ta===null?Ta=new Set([this]):Ta.add(this));var P=f.stack;this.componentDidCatch(f.value,{componentStack:P!==null?P:""})})}function FA(s,a,c,f,x){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(a=c.alternate,a!==null&&yi(a,c,x,!0),c=cr.current,c!==null){switch(c.tag){case 31:case 13:return Ar===null?Kd():c.alternate===null&&Ht===0&&(Ht=3),c.flags&=-257,c.flags|=65536,c.lanes=x,f===kd?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([f]):a.add(f),cg(s,f,x)),!1;case 22:return c.flags|=65536,f===kd?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([f])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([f]):c.add(f)),cg(s,f,x)),!1}throw Error(r(435,c.tag))}return cg(s,f,x),Kd(),!1}if(ut)return a=cr.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,f!==rp&&(s=Error(r(422),{cause:f}),sc(Er(s,c)))):(f!==rp&&(a=Error(r(423),{cause:f}),sc(Er(a,c))),s=s.current.alternate,s.flags|=65536,x&=-x,s.lanes|=x,f=Er(f,c),x=Ip(s.stateNode,f,x),mp(s,x),Ht!==4&&(Ht=2)),!1;var b=Error(r(520),{cause:f});if(b=Er(b,c),jc===null?jc=[b]:jc.push(b),Ht!==4&&(Ht=2),a===null)return!0;f=Er(f,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,s=x&-x,c.lanes|=s,s=Ip(c.stateNode,f,s),mp(c,s),!1;case 1:if(a=c.type,b=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(Ta===null||!Ta.has(b))))return c.flags|=65536,x&=-x,c.lanes|=x,x=Tw(x),Mw(x,s,c,f),mp(c,x),!1}c=c.return}while(c!==null);return!1}var $p=Error(r(461)),sn=!1;function En(s,a,c,f){a.child=s===null?D0(a,null,c,f):bo(a,s.child,c,f)}function Rw(s,a,c,f,x){c=c.render;var b=a.ref;if("ref"in f){var k={};for(var P in f)P!=="ref"&&(k[P]=f[P])}else k=f;return go(a),f=bp(s,a,c,k,b,x),P=wp(),s!==null&&!sn?(Sp(s,a,x),qs(s,a,x)):(ut&&P&&tp(a),a.flags|=1,En(s,a,f,x),a.child)}function Aw(s,a,c,f,x){if(s===null){var b=c.type;return typeof b=="function"&&!Xm(b)&&b.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=b,Ow(s,a,b,f,x)):(s=bd(c.type,null,f,a,a.mode,x),s.ref=a.ref,s.return=a,a.child=s)}if(b=s.child,!Wp(s,x)){var k=b.memoizedProps;if(c=c.compare,c=c!==null?c:tc,c(k,f)&&s.ref===a.ref)return qs(s,a,x)}return a.flags|=1,s=Ls(b,f),s.ref=a.ref,s.return=a,a.child=s}function Ow(s,a,c,f,x){if(s!==null){var b=s.memoizedProps;if(tc(b,f)&&s.ref===a.ref)if(sn=!1,a.pendingProps=f=b,Wp(s,x))(s.flags&131072)!==0&&(sn=!0);else return a.lanes=s.lanes,qs(s,a,x)}return Fp(s,a,c,f,x)}function Dw(s,a,c,f){var x=f.children,b=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((a.flags&128)!==0){if(b=b!==null?b.baseLanes|c:c,s!==null){for(f=a.child=s.child,x=0;f!==null;)x=x|f.lanes|f.childLanes,f=f.sibling;f=x&~b}else f=0,a.child=null;return zw(s,a,b,c,f)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Cd(a,b!==null?b.cachePool:null),b!==null?L0(a,b):gp(),I0(a);else return f=a.lanes=536870912,zw(s,a,b!==null?b.baseLanes|c:c,c,f)}else b!==null?(Cd(a,b.cachePool),L0(a,b),Na(),a.memoizedState=null):(s!==null&&Cd(a,null),gp(),Na());return En(s,a,x,c),a.child}function gc(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function zw(s,a,c,f,x){var b=up();return b=b===null?null:{parent:nn._currentValue,pool:b},a.memoizedState={baseLanes:c,cachePool:b},s!==null&&Cd(a,null),gp(),I0(a),s!==null&&yi(s,a,f,!0),a.childLanes=x,null}function Fd(s,a){return a=Ud({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function Pw(s,a,c){return bo(a,s.child,null,c),s=Fd(a,a.pendingProps),s.flags|=2,ur(a),a.memoizedState=null,s}function BA(s,a,c){var f=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(ut){if(f.mode==="hidden")return s=Fd(a,f),a.lanes=536870912,gc(null,s);if(xp(a),(s=Dt)?(s=GS(s,Rr),s=s!==null&&s.data==="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:va!==null?{id:ds,overflow:fs}:null,retryLane:536870912,hydrationErrors:null},c=y0(s),c.return=a,a.child=c,kn=a,Dt=null)):s=null,s===null)throw ya(a);return a.lanes=536870912,null}return Fd(a,f)}var b=s.memoizedState;if(b!==null){var k=b.dehydrated;if(xp(a),x)if(a.flags&256)a.flags&=-257,a=Pw(s,a,c);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(r(558));else if(sn||yi(s,a,c,!1),x=(c&s.childLanes)!==0,sn||x){if(f=Rt,f!==null&&(k=Q(f,c),k!==0&&k!==b.retryLane))throw b.retryLane=k,fo(s,k),Jn(f,s,k),$p;Kd(),a=Pw(s,a,c)}else s=b.treeContext,Dt=Or(k.nextSibling),kn=a,ut=!0,xa=null,Rr=!1,s!==null&&S0(a,s),a=Fd(a,f),a.flags|=4096;return a}return s=Ls(s.child,{mode:f.mode,children:f.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Bd(s,a){var c=a.ref;if(c===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(r(284));(s===null||s.ref!==c)&&(a.flags|=4194816)}}function Fp(s,a,c,f,x){return go(a),c=bp(s,a,c,f,void 0,x),f=wp(),s!==null&&!sn?(Sp(s,a,x),qs(s,a,x)):(ut&&f&&tp(a),a.flags|=1,En(s,a,c,x),a.child)}function Lw(s,a,c,f,x,b){return go(a),a.updateQueue=null,c=F0(a,f,c,x),$0(s),f=wp(),s!==null&&!sn?(Sp(s,a,b),qs(s,a,b)):(ut&&f&&tp(a),a.flags|=1,En(s,a,c,b),a.child)}function Iw(s,a,c,f,x){if(go(a),a.stateNode===null){var b=pi,k=c.contextType;typeof k=="object"&&k!==null&&(b=_n(k)),b=new c(f,b),a.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=Lp,a.stateNode=b,b._reactInternals=a,b=a.stateNode,b.props=f,b.state=a.memoizedState,b.refs={},fp(a),k=c.contextType,b.context=typeof k=="object"&&k!==null?_n(k):pi,b.state=a.memoizedState,k=c.getDerivedStateFromProps,typeof k=="function"&&(Pp(a,c,k,f),b.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(k=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),k!==b.state&&Lp.enqueueReplaceState(b,b.state,null),dc(a,f,b,x),uc(),b.state=a.memoizedState),typeof b.componentDidMount=="function"&&(a.flags|=4194308),f=!0}else if(s===null){b=a.stateNode;var P=a.memoizedProps,q=So(c,P);b.props=q;var se=b.context,ce=c.contextType;k=pi,typeof ce=="object"&&ce!==null&&(k=_n(ce));var he=c.getDerivedStateFromProps;ce=typeof he=="function"||typeof b.getSnapshotBeforeUpdate=="function",P=a.pendingProps!==P,ce||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(P||se!==k)&&Cw(a,b,f,k),wa=!1;var oe=a.memoizedState;b.state=oe,dc(a,f,b,x),uc(),se=a.memoizedState,P||oe!==se||wa?(typeof he=="function"&&(Pp(a,c,he,f),se=a.memoizedState),(q=wa||jw(a,c,q,f,oe,se,k))?(ce||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(a.flags|=4194308)):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=f,a.memoizedState=se),b.props=f,b.state=se,b.context=k,f=q):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),f=!1)}else{b=a.stateNode,hp(s,a),k=a.memoizedProps,ce=So(c,k),b.props=ce,he=a.pendingProps,oe=b.context,se=c.contextType,q=pi,typeof se=="object"&&se!==null&&(q=_n(se)),P=c.getDerivedStateFromProps,(se=typeof P=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(k!==he||oe!==q)&&Cw(a,b,f,q),wa=!1,oe=a.memoizedState,b.state=oe,dc(a,f,b,x),uc();var ie=a.memoizedState;k!==he||oe!==ie||wa||s!==null&&s.dependencies!==null&&Sd(s.dependencies)?(typeof P=="function"&&(Pp(a,c,P,f),ie=a.memoizedState),(ce=wa||jw(a,c,ce,f,oe,ie,q)||s!==null&&s.dependencies!==null&&Sd(s.dependencies))?(se||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(f,ie,q),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(f,ie,q)),typeof b.componentDidUpdate=="function"&&(a.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof b.componentDidUpdate!="function"||k===s.memoizedProps&&oe===s.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||k===s.memoizedProps&&oe===s.memoizedState||(a.flags|=1024),a.memoizedProps=f,a.memoizedState=ie),b.props=f,b.state=ie,b.context=q,f=ce):(typeof b.componentDidUpdate!="function"||k===s.memoizedProps&&oe===s.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||k===s.memoizedProps&&oe===s.memoizedState||(a.flags|=1024),f=!1)}return b=f,Bd(s,a),f=(a.flags&128)!==0,b||f?(b=a.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:b.render(),a.flags|=1,s!==null&&f?(a.child=bo(a,s.child,null,x),a.child=bo(a,null,c,x)):En(s,a,c,x),a.memoizedState=b.state,s=a.child):s=qs(s,a,x),s}function $w(s,a,c,f){return mo(),a.flags|=256,En(s,a,c,f),a.child}var Bp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Up(s){return{baseLanes:s,cachePool:E0()}}function qp(s,a,c){return s=s!==null?s.childLanes&~c:0,a&&(s|=fr),s}function Fw(s,a,c){var f=a.pendingProps,x=!1,b=(a.flags&128)!==0,k;if((k=b)||(k=s!==null&&s.memoizedState===null?!1:(Qt.current&2)!==0),k&&(x=!0,a.flags&=-129),k=(a.flags&32)!==0,a.flags&=-33,s===null){if(ut){if(x?Ca(a):Na(),(s=Dt)?(s=GS(s,Rr),s=s!==null&&s.data!=="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:va!==null?{id:ds,overflow:fs}:null,retryLane:536870912,hydrationErrors:null},c=y0(s),c.return=a,a.child=c,kn=a,Dt=null)):s=null,s===null)throw ya(a);return Ng(s)?a.lanes=32:a.lanes=536870912,null}var P=f.children;return f=f.fallback,x?(Na(),x=a.mode,P=Ud({mode:"hidden",children:P},x),f=ho(f,x,c,null),P.return=a,f.return=a,P.sibling=f,a.child=P,f=a.child,f.memoizedState=Up(c),f.childLanes=qp(s,k,c),a.memoizedState=Bp,gc(null,f)):(Ca(a),Vp(a,P))}var q=s.memoizedState;if(q!==null&&(P=q.dehydrated,P!==null)){if(b)a.flags&256?(Ca(a),a.flags&=-257,a=Hp(s,a,c)):a.memoizedState!==null?(Na(),a.child=s.child,a.flags|=128,a=null):(Na(),P=f.fallback,x=a.mode,f=Ud({mode:"visible",children:f.children},x),P=ho(P,x,c,null),P.flags|=2,f.return=a,P.return=a,f.sibling=P,a.child=f,bo(a,s.child,null,c),f=a.child,f.memoizedState=Up(c),f.childLanes=qp(s,k,c),a.memoizedState=Bp,a=gc(null,f));else if(Ca(a),Ng(P)){if(k=P.nextSibling&&P.nextSibling.dataset,k)var se=k.dgst;k=se,f=Error(r(419)),f.stack="",f.digest=k,sc({value:f,source:null,stack:null}),a=Hp(s,a,c)}else if(sn||yi(s,a,c,!1),k=(c&s.childLanes)!==0,sn||k){if(k=Rt,k!==null&&(f=Q(k,c),f!==0&&f!==q.retryLane))throw q.retryLane=f,fo(s,f),Jn(k,s,f),$p;Cg(P)||Kd(),a=Hp(s,a,c)}else Cg(P)?(a.flags|=192,a.child=s.child,a=null):(s=q.treeContext,Dt=Or(P.nextSibling),kn=a,ut=!0,xa=null,Rr=!1,s!==null&&S0(a,s),a=Vp(a,f.children),a.flags|=4096);return a}return x?(Na(),P=f.fallback,x=a.mode,q=s.child,se=q.sibling,f=Ls(q,{mode:"hidden",children:f.children}),f.subtreeFlags=q.subtreeFlags&65011712,se!==null?P=Ls(se,P):(P=ho(P,x,c,null),P.flags|=2),P.return=a,f.return=a,f.sibling=P,a.child=f,gc(null,f),f=a.child,P=s.child.memoizedState,P===null?P=Up(c):(x=P.cachePool,x!==null?(q=nn._currentValue,x=x.parent!==q?{parent:q,pool:q}:x):x=E0(),P={baseLanes:P.baseLanes|c,cachePool:x}),f.memoizedState=P,f.childLanes=qp(s,k,c),a.memoizedState=Bp,gc(s.child,f)):(Ca(a),c=s.child,s=c.sibling,c=Ls(c,{mode:"visible",children:f.children}),c.return=a,c.sibling=null,s!==null&&(k=a.deletions,k===null?(a.deletions=[s],a.flags|=16):k.push(s)),a.child=c,a.memoizedState=null,c)}function Vp(s,a){return a=Ud({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function Ud(s,a){return s=lr(22,s,null,a),s.lanes=0,s}function Hp(s,a,c){return bo(a,s.child,null,c),s=Vp(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function Bw(s,a,c){s.lanes|=a;var f=s.alternate;f!==null&&(f.lanes|=a),op(s.return,a,c)}function Yp(s,a,c,f,x,b){var k=s.memoizedState;k===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:x,treeForkCount:b}:(k.isBackwards=a,k.rendering=null,k.renderingStartTime=0,k.last=f,k.tail=c,k.tailMode=x,k.treeForkCount=b)}function Uw(s,a,c){var f=a.pendingProps,x=f.revealOrder,b=f.tail;f=f.children;var k=Qt.current,P=(k&2)!==0;if(P?(k=k&1|2,a.flags|=128):k&=1,K(Qt,k),En(s,a,f,c),f=ut?rc:0,!P&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Bw(s,c,a);else if(s.tag===19)Bw(s,c,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(x){case"forwards":for(c=a.child,x=null;c!==null;)s=c.alternate,s!==null&&Md(s)===null&&(x=c),c=c.sibling;c=x,c===null?(x=a.child,a.child=null):(x=c.sibling,c.sibling=null),Yp(a,!1,x,c,b,f);break;case"backwards":case"unstable_legacy-backwards":for(c=null,x=a.child,a.child=null;x!==null;){if(s=x.alternate,s!==null&&Md(s)===null){a.child=x;break}s=x.sibling,x.sibling=c,c=x,x=s}Yp(a,!0,c,null,b,f);break;case"together":Yp(a,!1,null,null,void 0,f);break;default:a.memoizedState=null}return a.child}function qs(s,a,c){if(s!==null&&(a.dependencies=s.dependencies),Ea|=a.lanes,(c&a.childLanes)===0)if(s!==null){if(yi(s,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(r(153));if(a.child!==null){for(s=a.child,c=Ls(s,s.pendingProps),a.child=c,c.return=a;s.sibling!==null;)s=s.sibling,c=c.sibling=Ls(s,s.pendingProps),c.return=a;c.sibling=null}return a.child}function Wp(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&Sd(s)))}function UA(s,a,c){switch(a.tag){case 3:ye(a,a.stateNode.containerInfo),ba(a,nn,s.memoizedState.cache),mo();break;case 27:case 5:_e(a);break;case 4:ye(a,a.stateNode.containerInfo);break;case 10:ba(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,xp(a),null;break;case 13:var f=a.memoizedState;if(f!==null)return f.dehydrated!==null?(Ca(a),a.flags|=128,null):(c&a.child.childLanes)!==0?Fw(s,a,c):(Ca(a),s=qs(s,a,c),s!==null?s.sibling:null);Ca(a);break;case 19:var x=(s.flags&128)!==0;if(f=(c&a.childLanes)!==0,f||(yi(s,a,c,!1),f=(c&a.childLanes)!==0),x){if(f)return Uw(s,a,c);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),K(Qt,Qt.current),f)break;return null;case 22:return a.lanes=0,Dw(s,a,c,a.pendingProps);case 24:ba(a,nn,s.memoizedState.cache)}return qs(s,a,c)}function qw(s,a,c){if(s!==null)if(s.memoizedProps!==a.pendingProps)sn=!0;else{if(!Wp(s,c)&&(a.flags&128)===0)return sn=!1,UA(s,a,c);sn=(s.flags&131072)!==0}else sn=!1,ut&&(a.flags&1048576)!==0&&w0(a,rc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var f=a.pendingProps;if(s=xo(a.elementType),a.type=s,typeof s=="function")Xm(s)?(f=So(s,f),a.tag=1,a=Iw(null,a,s,f,c)):(a.tag=0,a=Fp(null,a,s,f,c));else{if(s!=null){var x=s.$$typeof;if(x===M){a.tag=11,a=Rw(null,a,s,f,c);break e}else if(x===T){a.tag=14,a=Aw(null,a,s,f,c);break e}}throw a=G(s)||s,Error(r(306,a,""))}}return a;case 0:return Fp(s,a,a.type,a.pendingProps,c);case 1:return f=a.type,x=So(f,a.pendingProps),Iw(s,a,f,x,c);case 3:e:{if(ye(a,a.stateNode.containerInfo),s===null)throw Error(r(387));f=a.pendingProps;var b=a.memoizedState;x=b.element,hp(s,a),dc(a,f,null,c);var k=a.memoizedState;if(f=k.cache,ba(a,nn,f),f!==b.cache&&ip(a,[nn],c,!0),uc(),f=k.element,b.isDehydrated)if(b={element:f,isDehydrated:!1,cache:k.cache},a.updateQueue.baseState=b,a.memoizedState=b,a.flags&256){a=$w(s,a,f,c);break e}else if(f!==x){x=Er(Error(r(424)),a),sc(x),a=$w(s,a,f,c);break e}else for(s=a.stateNode.containerInfo,s.nodeType===9?s=s.body:s=s.nodeName==="HTML"?s.ownerDocument.body:s,Dt=Or(s.firstChild),kn=a,ut=!0,xa=null,Rr=!0,c=D0(a,null,f,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(mo(),f===x){a=qs(s,a,c);break e}En(s,a,f,c)}a=a.child}return a;case 26:return Bd(s,a),s===null?(c=e1(a.type,null,a.pendingProps,null))?a.memoizedState=c:ut||(c=a.type,s=a.pendingProps,f=sf(ue.current).createElement(c),f[Zt]=a,f[Wn]=s,Tn(f,c,s),Sn(f),a.stateNode=f):a.memoizedState=e1(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:return _e(a),s===null&&ut&&(f=a.stateNode=KS(a.type,a.pendingProps,ue.current),kn=a,Rr=!0,x=Dt,Oa(a.type)?(kg=x,Dt=Or(f.firstChild)):Dt=x),En(s,a,a.pendingProps.children,c),Bd(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&ut&&((x=f=Dt)&&(f=xO(f,a.type,a.pendingProps,Rr),f!==null?(a.stateNode=f,kn=a,Dt=Or(f.firstChild),Rr=!1,x=!0):x=!1),x||ya(a)),_e(a),x=a.type,b=a.pendingProps,k=s!==null?s.memoizedProps:null,f=b.children,wg(x,b)?f=null:k!==null&&wg(x,k)&&(a.flags|=32),a.memoizedState!==null&&(x=bp(s,a,OA,null,null,c),Rc._currentValue=x),Bd(s,a),En(s,a,f,c),a.child;case 6:return s===null&&ut&&((s=c=Dt)&&(c=yO(c,a.pendingProps,Rr),c!==null?(a.stateNode=c,kn=a,Dt=null,s=!0):s=!1),s||ya(a)),null;case 13:return Fw(s,a,c);case 4:return ye(a,a.stateNode.containerInfo),f=a.pendingProps,s===null?a.child=bo(a,null,f,c):En(s,a,f,c),a.child;case 11:return Rw(s,a,a.type,a.pendingProps,c);case 7:return En(s,a,a.pendingProps,c),a.child;case 8:return En(s,a,a.pendingProps.children,c),a.child;case 12:return En(s,a,a.pendingProps.children,c),a.child;case 10:return f=a.pendingProps,ba(a,a.type,f.value),En(s,a,f.children,c),a.child;case 9:return x=a.type._context,f=a.pendingProps.children,go(a),x=_n(x),f=f(x),a.flags|=1,En(s,a,f,c),a.child;case 14:return Aw(s,a,a.type,a.pendingProps,c);case 15:return Ow(s,a,a.type,a.pendingProps,c);case 19:return Uw(s,a,c);case 31:return BA(s,a,c);case 22:return Dw(s,a,c,a.pendingProps);case 24:return go(a),f=_n(nn),s===null?(x=up(),x===null&&(x=Rt,b=lp(),x.pooledCache=b,b.refCount++,b!==null&&(x.pooledCacheLanes|=c),x=b),a.memoizedState={parent:f,cache:x},fp(a),ba(a,nn,x)):((s.lanes&c)!==0&&(hp(s,a),dc(a,null,null,c),uc()),x=s.memoizedState,b=a.memoizedState,x.parent!==f?(x={parent:f,cache:f},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),ba(a,nn,f)):(f=b.cache,ba(a,nn,f),f!==x.cache&&ip(a,[nn],c,!0))),En(s,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Vs(s){s.flags|=4}function Gp(s,a,c,f,x){if((a=(s.mode&32)!==0)&&(a=!1),a){if(s.flags|=16777216,(x&335544128)===x)if(s.stateNode.complete)s.flags|=8192;else if(gS())s.flags|=8192;else throw yo=kd,dp}else s.flags&=-16777217}function Vw(s,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!a1(a))if(gS())s.flags|=8192;else throw yo=kd,dp}function qd(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?tn():536870912,s.lanes|=a,Ri|=a)}function vc(s,a){if(!ut)switch(s.tailMode){case"hidden":a=s.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?s.tail=null:c.sibling=null;break;case"collapsed":c=s.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:f.sibling=null}}function zt(s){var a=s.alternate!==null&&s.alternate.child===s.child,c=0,f=0;if(a)for(var x=s.child;x!==null;)c|=x.lanes|x.childLanes,f|=x.subtreeFlags&65011712,f|=x.flags&65011712,x.return=s,x=x.sibling;else for(x=s.child;x!==null;)c|=x.lanes|x.childLanes,f|=x.subtreeFlags,f|=x.flags,x.return=s,x=x.sibling;return s.subtreeFlags|=f,s.childLanes=c,a}function qA(s,a,c){var f=a.pendingProps;switch(np(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zt(a),null;case 1:return zt(a),null;case 3:return c=a.stateNode,f=null,s!==null&&(f=s.memoizedState.cache),a.memoizedState.cache!==f&&(a.flags|=2048),Fs(nn),Ce(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(s===null||s.child===null)&&(xi(a)?Vs(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,sp())),zt(a),null;case 26:var x=a.type,b=a.memoizedState;return s===null?(Vs(a),b!==null?(zt(a),Vw(a,b)):(zt(a),Gp(a,x,null,f,c))):b?b!==s.memoizedState?(Vs(a),zt(a),Vw(a,b)):(zt(a),a.flags&=-16777217):(s=s.memoizedProps,s!==f&&Vs(a),zt(a),Gp(a,x,s,f,c)),null;case 27:if(Re(a),c=ue.current,x=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==f&&Vs(a);else{if(!f){if(a.stateNode===null)throw Error(r(166));return zt(a),null}s=ne.current,xi(a)?j0(a):(s=KS(x,f,c),a.stateNode=s,Vs(a))}return zt(a),null;case 5:if(Re(a),x=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==f&&Vs(a);else{if(!f){if(a.stateNode===null)throw Error(r(166));return zt(a),null}if(b=ne.current,xi(a))j0(a);else{var k=sf(ue.current);switch(b){case 1:b=k.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:b=k.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":b=k.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":b=k.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":b=k.createElement("div"),b.innerHTML="<script><\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof f.is=="string"?k.createElement("select",{is:f.is}):k.createElement("select"),f.multiple?b.multiple=!0:f.size&&(b.size=f.size);break;default:b=typeof f.is=="string"?k.createElement(x,{is:f.is}):k.createElement(x)}}b[Zt]=a,b[Wn]=f;e:for(k=a.child;k!==null;){if(k.tag===5||k.tag===6)b.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===a)break e;for(;k.sibling===null;){if(k.return===null||k.return===a)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}a.stateNode=b;e:switch(Tn(b,x,f),x){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&Vs(a)}}return zt(a),Gp(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,c),null;case 6:if(s&&a.stateNode!=null)s.memoizedProps!==f&&Vs(a);else{if(typeof f!="string"&&a.stateNode===null)throw Error(r(166));if(s=ue.current,xi(a)){if(s=a.stateNode,c=a.memoizedProps,f=null,x=kn,x!==null)switch(x.tag){case 27:case 5:f=x.memoizedProps}s[Zt]=a,s=!!(s.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||FS(s.nodeValue,c)),s||ya(a,!0)}else s=sf(s).createTextNode(f),s[Zt]=a,a.stateNode=s}return zt(a),null;case 31:if(c=a.memoizedState,s===null||s.memoizedState!==null){if(f=xi(a),c!==null){if(s===null){if(!f)throw Error(r(318));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[Zt]=a}else mo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;zt(a),s=!1}else c=sp(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),s=!0;if(!s)return a.flags&256?(ur(a),a):(ur(a),null);if((a.flags&128)!==0)throw Error(r(558))}return zt(a),null;case 13:if(f=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(x=xi(a),f!==null&&f.dehydrated!==null){if(s===null){if(!x)throw Error(r(318));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[Zt]=a}else mo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;zt(a),x=!1}else x=sp(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(ur(a),a):(ur(a),null)}return ur(a),(a.flags&128)!==0?(a.lanes=c,a):(c=f!==null,s=s!==null&&s.memoizedState!==null,c&&(f=a.child,x=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(x=f.alternate.memoizedState.cachePool.pool),b=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(b=f.memoizedState.cachePool.pool),b!==x&&(f.flags|=2048)),c!==s&&c&&(a.child.flags|=8192),qd(a,a.updateQueue),zt(a),null);case 4:return Ce(),s===null&&gg(a.stateNode.containerInfo),zt(a),null;case 10:return Fs(a.type),zt(a),null;case 19:if(F(Qt),f=a.memoizedState,f===null)return zt(a),null;if(x=(a.flags&128)!==0,b=f.rendering,b===null)if(x)vc(f,!1);else{if(Ht!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(b=Md(s),b!==null){for(a.flags|=128,vc(f,!1),s=b.updateQueue,a.updateQueue=s,qd(a,s),a.subtreeFlags=0,s=c,c=a.child;c!==null;)x0(c,s),c=c.sibling;return K(Qt,Qt.current&1|2),ut&&Is(a,f.treeForkCount),a.child}s=s.sibling}f.tail!==null&&ct()>Gd&&(a.flags|=128,x=!0,vc(f,!1),a.lanes=4194304)}else{if(!x)if(s=Md(b),s!==null){if(a.flags|=128,x=!0,s=s.updateQueue,a.updateQueue=s,qd(a,s),vc(f,!0),f.tail===null&&f.tailMode==="hidden"&&!b.alternate&&!ut)return zt(a),null}else 2*ct()-f.renderingStartTime>Gd&&c!==536870912&&(a.flags|=128,x=!0,vc(f,!1),a.lanes=4194304);f.isBackwards?(b.sibling=a.child,a.child=b):(s=f.last,s!==null?s.sibling=b:a.child=b,f.last=b)}return f.tail!==null?(s=f.tail,f.rendering=s,f.tail=s.sibling,f.renderingStartTime=ct(),s.sibling=null,c=Qt.current,K(Qt,x?c&1|2:c&1),ut&&Is(a,f.treeForkCount),s):(zt(a),null);case 22:case 23:return ur(a),vp(),f=a.memoizedState!==null,s!==null?s.memoizedState!==null!==f&&(a.flags|=8192):f&&(a.flags|=8192),f?(c&536870912)!==0&&(a.flags&128)===0&&(zt(a),a.subtreeFlags&6&&(a.flags|=8192)):zt(a),c=a.updateQueue,c!==null&&qd(a,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),f=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),f!==c&&(a.flags|=2048),s!==null&&F(vo),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),Fs(nn),zt(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function VA(s,a){switch(np(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Fs(nn),Ce(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Re(a),null;case 31:if(a.memoizedState!==null){if(ur(a),a.alternate===null)throw Error(r(340));mo()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(ur(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(r(340));mo()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return F(Qt),null;case 4:return Ce(),null;case 10:return Fs(a.type),null;case 22:case 23:return ur(a),vp(),s!==null&&F(vo),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Fs(nn),null;case 25:return null;default:return null}}function Hw(s,a){switch(np(a),a.tag){case 3:Fs(nn),Ce();break;case 26:case 27:case 5:Re(a);break;case 4:Ce();break;case 31:a.memoizedState!==null&&ur(a);break;case 13:ur(a);break;case 19:F(Qt);break;case 10:Fs(a.type);break;case 22:case 23:ur(a),vp(),s!==null&&F(vo);break;case 24:Fs(nn)}}function xc(s,a){try{var c=a.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var x=f.next;c=x;do{if((c.tag&s)===s){f=void 0;var b=c.create,k=c.inst;f=b(),k.destroy=f}c=c.next}while(c!==x)}}catch(P){jt(a,a.return,P)}}function ka(s,a,c){try{var f=a.updateQueue,x=f!==null?f.lastEffect:null;if(x!==null){var b=x.next;f=b;do{if((f.tag&s)===s){var k=f.inst,P=k.destroy;if(P!==void 0){k.destroy=void 0,x=a;var q=c,se=P;try{se()}catch(ce){jt(x,q,ce)}}}f=f.next}while(f!==b)}}catch(ce){jt(a,a.return,ce)}}function Yw(s){var a=s.updateQueue;if(a!==null){var c=s.stateNode;try{P0(a,c)}catch(f){jt(s,s.return,f)}}}function Ww(s,a,c){c.props=So(s.type,s.memoizedProps),c.state=s.memoizedState;try{c.componentWillUnmount()}catch(f){jt(s,a,f)}}function yc(s,a){try{var c=s.ref;if(c!==null){switch(s.tag){case 26:case 27:case 5:var f=s.stateNode;break;case 30:f=s.stateNode;break;default:f=s.stateNode}typeof c=="function"?s.refCleanup=c(f):c.current=f}}catch(x){jt(s,a,x)}}function hs(s,a){var c=s.ref,f=s.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(x){jt(s,a,x)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(x){jt(s,a,x)}else c.current=null}function Gw(s){var a=s.type,c=s.memoizedProps,f=s.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&f.focus();break e;case"img":c.src?f.src=c.src:c.srcSet&&(f.srcset=c.srcSet)}}catch(x){jt(s,s.return,x)}}function Zp(s,a,c){try{var f=s.stateNode;fO(f,s.type,c,a),f[Wn]=a}catch(x){jt(s,s.return,x)}}function Zw(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Oa(s.type)||s.tag===4}function Qp(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Zw(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Oa(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Kp(s,a,c){var f=s.tag;if(f===5||f===6)s=s.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(s,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(s),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=zs));else if(f!==4&&(f===27&&Oa(s.type)&&(c=s.stateNode,a=null),s=s.child,s!==null))for(Kp(s,a,c),s=s.sibling;s!==null;)Kp(s,a,c),s=s.sibling}function Vd(s,a,c){var f=s.tag;if(f===5||f===6)s=s.stateNode,a?c.insertBefore(s,a):c.appendChild(s);else if(f!==4&&(f===27&&Oa(s.type)&&(c=s.stateNode),s=s.child,s!==null))for(Vd(s,a,c),s=s.sibling;s!==null;)Vd(s,a,c),s=s.sibling}function Qw(s){var a=s.stateNode,c=s.memoizedProps;try{for(var f=s.type,x=a.attributes;x.length;)a.removeAttributeNode(x[0]);Tn(a,f,c),a[Zt]=s,a[Wn]=c}catch(b){jt(s,s.return,b)}}var Hs=!1,an=!1,Xp=!1,Kw=typeof WeakSet=="function"?WeakSet:Set,jn=null;function HA(s,a){if(s=s.containerInfo,yg=ff,s=c0(s),Hm(s)){if("selectionStart"in s)var c={start:s.selectionStart,end:s.selectionEnd};else e:{c=(c=s.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var x=f.anchorOffset,b=f.focusNode;f=f.focusOffset;try{c.nodeType,b.nodeType}catch{c=null;break e}var k=0,P=-1,q=-1,se=0,ce=0,he=s,oe=null;t:for(;;){for(var ie;he!==c||x!==0&&he.nodeType!==3||(P=k+x),he!==b||f!==0&&he.nodeType!==3||(q=k+f),he.nodeType===3&&(k+=he.nodeValue.length),(ie=he.firstChild)!==null;)oe=he,he=ie;for(;;){if(he===s)break t;if(oe===c&&++se===x&&(P=k),oe===b&&++ce===f&&(q=k),(ie=he.nextSibling)!==null)break;he=oe,oe=he.parentNode}he=ie}c=P===-1||q===-1?null:{start:P,end:q}}else c=null}c=c||{start:0,end:0}}else c=null;for(bg={focusedElem:s,selectionRange:c},ff=!1,jn=a;jn!==null;)if(a=jn,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,jn=s;else for(;jn!==null;){switch(a=jn,b=a.alternate,s=a.flags,a.tag){case 0:if((s&4)!==0&&(s=a.updateQueue,s=s!==null?s.events:null,s!==null))for(c=0;c<s.length;c++)x=s[c],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&b!==null){s=void 0,c=a,x=b.memoizedProps,b=b.memoizedState,f=c.stateNode;try{var Ee=So(c.type,x);s=f.getSnapshotBeforeUpdate(Ee,b),f.__reactInternalSnapshotBeforeUpdate=s}catch(qe){jt(c,c.return,qe)}}break;case 3:if((s&1024)!==0){if(s=a.stateNode.containerInfo,c=s.nodeType,c===9)jg(s);else if(c===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":jg(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(r(163))}if(s=a.sibling,s!==null){s.return=a.return,jn=s;break}jn=a.return}}function Xw(s,a,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:Ws(s,c),f&4&&xc(5,c);break;case 1:if(Ws(s,c),f&4)if(s=c.stateNode,a===null)try{s.componentDidMount()}catch(k){jt(c,c.return,k)}else{var x=So(c.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(x,a,s.__reactInternalSnapshotBeforeUpdate)}catch(k){jt(c,c.return,k)}}f&64&&Yw(c),f&512&&yc(c,c.return);break;case 3:if(Ws(s,c),f&64&&(s=c.updateQueue,s!==null)){if(a=null,c.child!==null)switch(c.child.tag){case 27:case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}try{P0(s,a)}catch(k){jt(c,c.return,k)}}break;case 27:a===null&&f&4&&Qw(c);case 26:case 5:Ws(s,c),a===null&&f&4&&Gw(c),f&512&&yc(c,c.return);break;case 12:Ws(s,c);break;case 31:Ws(s,c),f&4&&tS(s,c);break;case 13:Ws(s,c),f&4&&nS(s,c),f&64&&(s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(c=eO.bind(null,c),bO(s,c))));break;case 22:if(f=c.memoizedState!==null||Hs,!f){a=a!==null&&a.memoizedState!==null||an,x=Hs;var b=an;Hs=f,(an=a)&&!b?Gs(s,c,(c.subtreeFlags&8772)!==0):Ws(s,c),Hs=x,an=b}break;case 30:break;default:Ws(s,c)}}function Jw(s){var a=s.alternate;a!==null&&(s.alternate=null,Jw(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&Em(a)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var Pt=null,Zn=!1;function Ys(s,a,c){for(c=c.child;c!==null;)eS(s,a,c),c=c.sibling}function eS(s,a,c){if(qt&&typeof qt.onCommitFiberUnmount=="function")try{qt.onCommitFiberUnmount(Pn,c)}catch{}switch(c.tag){case 26:an||hs(c,a),Ys(s,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:an||hs(c,a);var f=Pt,x=Zn;Oa(c.type)&&(Pt=c.stateNode,Zn=!1),Ys(s,a,c),Ec(c.stateNode),Pt=f,Zn=x;break;case 5:an||hs(c,a);case 6:if(f=Pt,x=Zn,Pt=null,Ys(s,a,c),Pt=f,Zn=x,Pt!==null)if(Zn)try{(Pt.nodeType===9?Pt.body:Pt.nodeName==="HTML"?Pt.ownerDocument.body:Pt).removeChild(c.stateNode)}catch(b){jt(c,a,b)}else try{Pt.removeChild(c.stateNode)}catch(b){jt(c,a,b)}break;case 18:Pt!==null&&(Zn?(s=Pt,YS(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,c.stateNode),$i(s)):YS(Pt,c.stateNode));break;case 4:f=Pt,x=Zn,Pt=c.stateNode.containerInfo,Zn=!0,Ys(s,a,c),Pt=f,Zn=x;break;case 0:case 11:case 14:case 15:ka(2,c,a),an||ka(4,c,a),Ys(s,a,c);break;case 1:an||(hs(c,a),f=c.stateNode,typeof f.componentWillUnmount=="function"&&Ww(c,a,f)),Ys(s,a,c);break;case 21:Ys(s,a,c);break;case 22:an=(f=an)||c.memoizedState!==null,Ys(s,a,c),an=f;break;default:Ys(s,a,c)}}function tS(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{$i(s)}catch(c){jt(a,a.return,c)}}}function nS(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{$i(s)}catch(c){jt(a,a.return,c)}}function YA(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new Kw),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new Kw),a;default:throw Error(r(435,s.tag))}}function Hd(s,a){var c=YA(s);a.forEach(function(f){if(!c.has(f)){c.add(f);var x=tO.bind(null,s,f);f.then(x,x)}})}function Qn(s,a){var c=a.deletions;if(c!==null)for(var f=0;f<c.length;f++){var x=c[f],b=s,k=a,P=k;e:for(;P!==null;){switch(P.tag){case 27:if(Oa(P.type)){Pt=P.stateNode,Zn=!1;break e}break;case 5:Pt=P.stateNode,Zn=!1;break e;case 3:case 4:Pt=P.stateNode.containerInfo,Zn=!0;break e}P=P.return}if(Pt===null)throw Error(r(160));eS(b,k,x),Pt=null,Zn=!1,b=x.alternate,b!==null&&(b.return=null),x.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)rS(a,s),a=a.sibling}var Gr=null;function rS(s,a){var c=s.alternate,f=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Qn(a,s),Kn(s),f&4&&(ka(3,s,s.return),xc(3,s),ka(5,s,s.return));break;case 1:Qn(a,s),Kn(s),f&512&&(an||c===null||hs(c,c.return)),f&64&&Hs&&(s=s.updateQueue,s!==null&&(f=s.callbacks,f!==null&&(c=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var x=Gr;if(Qn(a,s),Kn(s),f&512&&(an||c===null||hs(c,c.return)),f&4){var b=c!==null?c.memoizedState:null;if(f=s.memoizedState,c===null)if(f===null)if(s.stateNode===null){e:{f=s.type,c=s.memoizedProps,x=x.ownerDocument||x;t:switch(f){case"title":b=x.getElementsByTagName("title")[0],(!b||b[Yl]||b[Zt]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=x.createElement(f),x.head.insertBefore(b,x.querySelector("head > title"))),Tn(b,f,c),b[Zt]=s,Sn(b),f=b;break e;case"link":var k=r1("link","href",x).get(f+(c.href||""));if(k){for(var P=0;P<k.length;P++)if(b=k[P],b.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&b.getAttribute("rel")===(c.rel==null?null:c.rel)&&b.getAttribute("title")===(c.title==null?null:c.title)&&b.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){k.splice(P,1);break t}}b=x.createElement(f),Tn(b,f,c),x.head.appendChild(b);break;case"meta":if(k=r1("meta","content",x).get(f+(c.content||""))){for(P=0;P<k.length;P++)if(b=k[P],b.getAttribute("content")===(c.content==null?null:""+c.content)&&b.getAttribute("name")===(c.name==null?null:c.name)&&b.getAttribute("property")===(c.property==null?null:c.property)&&b.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&b.getAttribute("charset")===(c.charSet==null?null:c.charSet)){k.splice(P,1);break t}}b=x.createElement(f),Tn(b,f,c),x.head.appendChild(b);break;default:throw Error(r(468,f))}b[Zt]=s,Sn(b),f=b}s.stateNode=f}else s1(x,s.type,s.stateNode);else s.stateNode=n1(x,f,s.memoizedProps);else b!==f?(b===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):b.count--,f===null?s1(x,s.type,s.stateNode):n1(x,f,s.memoizedProps)):f===null&&s.stateNode!==null&&Zp(s,s.memoizedProps,c.memoizedProps)}break;case 27:Qn(a,s),Kn(s),f&512&&(an||c===null||hs(c,c.return)),c!==null&&f&4&&Zp(s,s.memoizedProps,c.memoizedProps);break;case 5:if(Qn(a,s),Kn(s),f&512&&(an||c===null||hs(c,c.return)),s.flags&32){x=s.stateNode;try{li(x,"")}catch(Ee){jt(s,s.return,Ee)}}f&4&&s.stateNode!=null&&(x=s.memoizedProps,Zp(s,x,c!==null?c.memoizedProps:x)),f&1024&&(Xp=!0);break;case 6:if(Qn(a,s),Kn(s),f&4){if(s.stateNode===null)throw Error(r(162));f=s.memoizedProps,c=s.stateNode;try{c.nodeValue=f}catch(Ee){jt(s,s.return,Ee)}}break;case 3:if(lf=null,x=Gr,Gr=af(a.containerInfo),Qn(a,s),Gr=x,Kn(s),f&4&&c!==null&&c.memoizedState.isDehydrated)try{$i(a.containerInfo)}catch(Ee){jt(s,s.return,Ee)}Xp&&(Xp=!1,sS(s));break;case 4:f=Gr,Gr=af(s.stateNode.containerInfo),Qn(a,s),Kn(s),Gr=f;break;case 12:Qn(a,s),Kn(s);break;case 31:Qn(a,s),Kn(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Hd(s,f)));break;case 13:Qn(a,s),Kn(s),s.child.flags&8192&&s.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Wd=ct()),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Hd(s,f)));break;case 22:x=s.memoizedState!==null;var q=c!==null&&c.memoizedState!==null,se=Hs,ce=an;if(Hs=se||x,an=ce||q,Qn(a,s),an=ce,Hs=se,Kn(s),f&8192)e:for(a=s.stateNode,a._visibility=x?a._visibility&-2:a._visibility|1,x&&(c===null||q||Hs||an||jo(s)),c=null,a=s;;){if(a.tag===5||a.tag===26){if(c===null){q=c=a;try{if(b=q.stateNode,x)k=b.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none";else{P=q.stateNode;var he=q.memoizedProps.style,oe=he!=null&&he.hasOwnProperty("display")?he.display:null;P.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(Ee){jt(q,q.return,Ee)}}}else if(a.tag===6){if(c===null){q=a;try{q.stateNode.nodeValue=x?"":q.memoizedProps}catch(Ee){jt(q,q.return,Ee)}}}else if(a.tag===18){if(c===null){q=a;try{var ie=q.stateNode;x?WS(ie,!0):WS(q.stateNode,!1)}catch(Ee){jt(q,q.return,Ee)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===s)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break e;for(;a.sibling===null;){if(a.return===null||a.return===s)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}f&4&&(f=s.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,Hd(s,c))));break;case 19:Qn(a,s),Kn(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Hd(s,f)));break;case 30:break;case 21:break;default:Qn(a,s),Kn(s)}}function Kn(s){var a=s.flags;if(a&2){try{for(var c,f=s.return;f!==null;){if(Zw(f)){c=f;break}f=f.return}if(c==null)throw Error(r(160));switch(c.tag){case 27:var x=c.stateNode,b=Qp(s);Vd(s,b,x);break;case 5:var k=c.stateNode;c.flags&32&&(li(k,""),c.flags&=-33);var P=Qp(s);Vd(s,P,k);break;case 3:case 4:var q=c.stateNode.containerInfo,se=Qp(s);Kp(s,se,q);break;default:throw Error(r(161))}}catch(ce){jt(s,s.return,ce)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function sS(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;sS(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),s=s.sibling}}function Ws(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Xw(s,a.alternate,a),a=a.sibling}function jo(s){for(s=s.child;s!==null;){var a=s;switch(a.tag){case 0:case 11:case 14:case 15:ka(4,a,a.return),jo(a);break;case 1:hs(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&Ww(a,a.return,c),jo(a);break;case 27:Ec(a.stateNode);case 26:case 5:hs(a,a.return),jo(a);break;case 22:a.memoizedState===null&&jo(a);break;case 30:jo(a);break;default:jo(a)}s=s.sibling}}function Gs(s,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var f=a.alternate,x=s,b=a,k=b.flags;switch(b.tag){case 0:case 11:case 15:Gs(x,b,c),xc(4,b);break;case 1:if(Gs(x,b,c),f=b,x=f.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(se){jt(f,f.return,se)}if(f=b,x=f.updateQueue,x!==null){var P=f.stateNode;try{var q=x.shared.hiddenCallbacks;if(q!==null)for(x.shared.hiddenCallbacks=null,x=0;x<q.length;x++)z0(q[x],P)}catch(se){jt(f,f.return,se)}}c&&k&64&&Yw(b),yc(b,b.return);break;case 27:Qw(b);case 26:case 5:Gs(x,b,c),c&&f===null&&k&4&&Gw(b),yc(b,b.return);break;case 12:Gs(x,b,c);break;case 31:Gs(x,b,c),c&&k&4&&tS(x,b);break;case 13:Gs(x,b,c),c&&k&4&&nS(x,b);break;case 22:b.memoizedState===null&&Gs(x,b,c),yc(b,b.return);break;case 30:break;default:Gs(x,b,c)}a=a.sibling}}function Jp(s,a){var c=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),s=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(s=a.memoizedState.cachePool.pool),s!==c&&(s!=null&&s.refCount++,c!=null&&ac(c))}function eg(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&ac(s))}function Zr(s,a,c,f){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)aS(s,a,c,f),a=a.sibling}function aS(s,a,c,f){var x=a.flags;switch(a.tag){case 0:case 11:case 15:Zr(s,a,c,f),x&2048&&xc(9,a);break;case 1:Zr(s,a,c,f);break;case 3:Zr(s,a,c,f),x&2048&&(s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&ac(s)));break;case 12:if(x&2048){Zr(s,a,c,f),s=a.stateNode;try{var b=a.memoizedProps,k=b.id,P=b.onPostCommit;typeof P=="function"&&P(k,a.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(q){jt(a,a.return,q)}}else Zr(s,a,c,f);break;case 31:Zr(s,a,c,f);break;case 13:Zr(s,a,c,f);break;case 23:break;case 22:b=a.stateNode,k=a.alternate,a.memoizedState!==null?b._visibility&2?Zr(s,a,c,f):bc(s,a):b._visibility&2?Zr(s,a,c,f):(b._visibility|=2,Ei(s,a,c,f,(a.subtreeFlags&10256)!==0||!1)),x&2048&&Jp(k,a);break;case 24:Zr(s,a,c,f),x&2048&&eg(a.alternate,a);break;default:Zr(s,a,c,f)}}function Ei(s,a,c,f,x){for(x=x&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var b=s,k=a,P=c,q=f,se=k.flags;switch(k.tag){case 0:case 11:case 15:Ei(b,k,P,q,x),xc(8,k);break;case 23:break;case 22:var ce=k.stateNode;k.memoizedState!==null?ce._visibility&2?Ei(b,k,P,q,x):bc(b,k):(ce._visibility|=2,Ei(b,k,P,q,x)),x&&se&2048&&Jp(k.alternate,k);break;case 24:Ei(b,k,P,q,x),x&&se&2048&&eg(k.alternate,k);break;default:Ei(b,k,P,q,x)}a=a.sibling}}function bc(s,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=s,f=a,x=f.flags;switch(f.tag){case 22:bc(c,f),x&2048&&Jp(f.alternate,f);break;case 24:bc(c,f),x&2048&&eg(f.alternate,f);break;default:bc(c,f)}a=a.sibling}}var wc=8192;function Ti(s,a,c){if(s.subtreeFlags&wc)for(s=s.child;s!==null;)oS(s,a,c),s=s.sibling}function oS(s,a,c){switch(s.tag){case 26:Ti(s,a,c),s.flags&wc&&s.memoizedState!==null&&AO(c,Gr,s.memoizedState,s.memoizedProps);break;case 5:Ti(s,a,c);break;case 3:case 4:var f=Gr;Gr=af(s.stateNode.containerInfo),Ti(s,a,c),Gr=f;break;case 22:s.memoizedState===null&&(f=s.alternate,f!==null&&f.memoizedState!==null?(f=wc,wc=16777216,Ti(s,a,c),wc=f):Ti(s,a,c));break;default:Ti(s,a,c)}}function iS(s){var a=s.alternate;if(a!==null&&(s=a.child,s!==null)){a.child=null;do a=s.sibling,s.sibling=null,s=a;while(s!==null)}}function Sc(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];jn=f,cS(f,s)}iS(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)lS(s),s=s.sibling}function lS(s){switch(s.tag){case 0:case 11:case 15:Sc(s),s.flags&2048&&ka(9,s,s.return);break;case 3:Sc(s);break;case 12:Sc(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,Yd(s)):Sc(s);break;default:Sc(s)}}function Yd(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];jn=f,cS(f,s)}iS(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:ka(8,a,a.return),Yd(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,Yd(a));break;default:Yd(a)}s=s.sibling}}function cS(s,a){for(;jn!==null;){var c=jn;switch(c.tag){case 0:case 11:case 15:ka(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var f=c.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:ac(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,jn=f;else e:for(c=s;jn!==null;){f=jn;var x=f.sibling,b=f.return;if(Jw(f),f===c){jn=null;break e}if(x!==null){x.return=b,jn=x;break e}jn=b}}}var WA={getCacheForType:function(s){var a=_n(nn),c=a.data.get(s);return c===void 0&&(c=s(),a.data.set(s,c)),c},cacheSignal:function(){return _n(nn).controller.signal}},GA=typeof WeakMap=="function"?WeakMap:Map,vt=0,Rt=null,st=null,it=0,St=0,dr=null,_a=!1,Mi=!1,tg=!1,Zs=0,Ht=0,Ea=0,Co=0,ng=0,fr=0,Ri=0,jc=null,Xn=null,rg=!1,Wd=0,uS=0,Gd=1/0,Zd=null,Ta=null,fn=0,Ma=null,Ai=null,Qs=0,sg=0,ag=null,dS=null,Cc=0,og=null;function hr(){return(vt&2)!==0&&it!==0?it&-it:L.T!==null?fg():gt()}function fS(){if(fr===0)if((it&536870912)===0||ut){var s=we;we<<=1,(we&3932160)===0&&(we=262144),fr=s}else fr=536870912;return s=cr.current,s!==null&&(s.flags|=32),fr}function Jn(s,a,c){(s===Rt&&(St===2||St===9)||s.cancelPendingCommit!==null)&&(Oi(s,0),Ra(s,it,fr,!1)),Ot(s,c),((vt&2)===0||s!==Rt)&&(s===Rt&&((vt&2)===0&&(Co|=c),Ht===4&&Ra(s,it,fr,!1)),ms(s))}function hS(s,a,c){if((vt&6)!==0)throw Error(r(327));var f=!c&&(a&127)===0&&(a&s.expiredLanes)===0||wt(s,a),x=f?KA(s,a):lg(s,a,!0),b=f;do{if(x===0){Mi&&!f&&Ra(s,a,0,!1);break}else{if(c=s.current.alternate,b&&!ZA(c)){x=lg(s,a,!1),b=!1;continue}if(x===2){if(b=a,s.errorRecoveryDisabledLanes&b)var k=0;else k=s.pendingLanes&-536870913,k=k!==0?k:k&536870912?536870912:0;if(k!==0){a=k;e:{var P=s;x=jc;var q=P.current.memoizedState.isDehydrated;if(q&&(Oi(P,k).flags|=256),k=lg(P,k,!1),k!==2){if(tg&&!q){P.errorRecoveryDisabledLanes|=b,Co|=b,x=4;break e}b=Xn,Xn=x,b!==null&&(Xn===null?Xn=b:Xn.push.apply(Xn,b))}x=k}if(b=!1,x!==2)continue}}if(x===1){Oi(s,0),Ra(s,a,0,!0);break}e:{switch(f=s,b=x,b){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Ra(f,a,fr,!_a);break e;case 2:Xn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(x=Wd+300-ct(),10<x)){if(Ra(f,a,fr,!_a),De(f,0,!0)!==0)break e;Qs=a,f.timeoutHandle=VS(mS.bind(null,f,c,Xn,Zd,rg,a,fr,Co,Ri,_a,b,"Throttled",-0,0),x);break e}mS(f,c,Xn,Zd,rg,a,fr,Co,Ri,_a,b,null,-0,0)}}break}while(!0);ms(s)}function mS(s,a,c,f,x,b,k,P,q,se,ce,he,oe,ie){if(s.timeoutHandle=-1,he=a.subtreeFlags,he&8192||(he&16785408)===16785408){he={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:zs},oS(a,b,he);var Ee=(b&62914560)===b?Wd-ct():(b&4194048)===b?uS-ct():0;if(Ee=OO(he,Ee),Ee!==null){Qs=b,s.cancelPendingCommit=Ee(SS.bind(null,s,a,b,c,f,x,k,P,q,ce,he,null,oe,ie)),Ra(s,b,k,!se);return}}SS(s,a,b,c,f,x,k,P,q)}function ZA(s){for(var a=s;;){var c=a.tag;if((c===0||c===11||c===15)&&a.flags&16384&&(c=a.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var f=0;f<c.length;f++){var x=c[f],b=x.getSnapshot;x=x.value;try{if(!ir(b(),x))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Ra(s,a,c,f){a&=~ng,a&=~Co,s.suspendedLanes|=a,s.pingedLanes&=~a,f&&(s.warmLanes|=a),f=s.expirationTimes;for(var x=a;0<x;){var b=31-$t(x),k=1<<b;f[b]=-1,x&=~k}c!==0&&Hn(s,c,a)}function Qd(){return(vt&6)===0?(Nc(0),!1):!0}function ig(){if(st!==null){if(St===0)var s=st.return;else s=st,$s=po=null,jp(s),ji=null,ic=0,s=st;for(;s!==null;)Hw(s.alternate,s),s=s.return;st=null}}function Oi(s,a){var c=s.timeoutHandle;c!==-1&&(s.timeoutHandle=-1,pO(c)),c=s.cancelPendingCommit,c!==null&&(s.cancelPendingCommit=null,c()),Qs=0,ig(),Rt=s,st=c=Ls(s.current,null),it=a,St=0,dr=null,_a=!1,Mi=wt(s,a),tg=!1,Ri=fr=ng=Co=Ea=Ht=0,Xn=jc=null,rg=!1,(a&8)!==0&&(a|=a&32);var f=s.entangledLanes;if(f!==0)for(s=s.entanglements,f&=a;0<f;){var x=31-$t(f),b=1<<x;a|=s[x],f&=~b}return Zs=a,vd(),c}function pS(s,a){Ze=null,L.H=pc,a===Si||a===Nd?(a=R0(),St=3):a===dp?(a=R0(),St=4):St=a===$p?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,dr=a,st===null&&(Ht=1,$d(s,Er(a,s.current)))}function gS(){var s=cr.current;return s===null?!0:(it&4194048)===it?Ar===null:(it&62914560)===it||(it&536870912)!==0?s===Ar:!1}function vS(){var s=L.H;return L.H=pc,s===null?pc:s}function xS(){var s=L.A;return L.A=WA,s}function Kd(){Ht=4,_a||(it&4194048)!==it&&cr.current!==null||(Mi=!0),(Ea&134217727)===0&&(Co&134217727)===0||Rt===null||Ra(Rt,it,fr,!1)}function lg(s,a,c){var f=vt;vt|=2;var x=vS(),b=xS();(Rt!==s||it!==a)&&(Zd=null,Oi(s,a)),a=!1;var k=Ht;e:do try{if(St!==0&&st!==null){var P=st,q=dr;switch(St){case 8:ig(),k=6;break e;case 3:case 2:case 9:case 6:cr.current===null&&(a=!0);var se=St;if(St=0,dr=null,Di(s,P,q,se),c&&Mi){k=0;break e}break;default:se=St,St=0,dr=null,Di(s,P,q,se)}}QA(),k=Ht;break}catch(ce){pS(s,ce)}while(!0);return a&&s.shellSuspendCounter++,$s=po=null,vt=f,L.H=x,L.A=b,st===null&&(Rt=null,it=0,vd()),k}function QA(){for(;st!==null;)yS(st)}function KA(s,a){var c=vt;vt|=2;var f=vS(),x=xS();Rt!==s||it!==a?(Zd=null,Gd=ct()+500,Oi(s,a)):Mi=wt(s,a);e:do try{if(St!==0&&st!==null){a=st;var b=dr;t:switch(St){case 1:St=0,dr=null,Di(s,a,b,1);break;case 2:case 9:if(T0(b)){St=0,dr=null,bS(a);break}a=function(){St!==2&&St!==9||Rt!==s||(St=7),ms(s)},b.then(a,a);break e;case 3:St=7;break e;case 4:St=5;break e;case 7:T0(b)?(St=0,dr=null,bS(a)):(St=0,dr=null,Di(s,a,b,7));break;case 5:var k=null;switch(st.tag){case 26:k=st.memoizedState;case 5:case 27:var P=st;if(k?a1(k):P.stateNode.complete){St=0,dr=null;var q=P.sibling;if(q!==null)st=q;else{var se=P.return;se!==null?(st=se,Xd(se)):st=null}break t}}St=0,dr=null,Di(s,a,b,5);break;case 6:St=0,dr=null,Di(s,a,b,6);break;case 8:ig(),Ht=6;break e;default:throw Error(r(462))}}XA();break}catch(ce){pS(s,ce)}while(!0);return $s=po=null,L.H=f,L.A=x,vt=c,st!==null?0:(Rt=null,it=0,vd(),Ht)}function XA(){for(;st!==null&&!Oe();)yS(st)}function yS(s){var a=qw(s.alternate,s,Zs);s.memoizedProps=s.pendingProps,a===null?Xd(s):st=a}function bS(s){var a=s,c=a.alternate;switch(a.tag){case 15:case 0:a=Lw(c,a,a.pendingProps,a.type,void 0,it);break;case 11:a=Lw(c,a,a.pendingProps,a.type.render,a.ref,it);break;case 5:jp(a);default:Hw(c,a),a=st=x0(a,Zs),a=qw(c,a,Zs)}s.memoizedProps=s.pendingProps,a===null?Xd(s):st=a}function Di(s,a,c,f){$s=po=null,jp(a),ji=null,ic=0;var x=a.return;try{if(FA(s,x,a,c,it)){Ht=1,$d(s,Er(c,s.current)),st=null;return}}catch(b){if(x!==null)throw st=x,b;Ht=1,$d(s,Er(c,s.current)),st=null;return}a.flags&32768?(ut||f===1?s=!0:Mi||(it&536870912)!==0?s=!1:(_a=s=!0,(f===2||f===9||f===3||f===6)&&(f=cr.current,f!==null&&f.tag===13&&(f.flags|=16384))),wS(a,s)):Xd(a)}function Xd(s){var a=s;do{if((a.flags&32768)!==0){wS(a,_a);return}s=a.return;var c=qA(a.alternate,a,Zs);if(c!==null){st=c;return}if(a=a.sibling,a!==null){st=a;return}st=a=s}while(a!==null);Ht===0&&(Ht=5)}function wS(s,a){do{var c=VA(s.alternate,s);if(c!==null){c.flags&=32767,st=c;return}if(c=s.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(s=s.sibling,s!==null)){st=s;return}st=s=c}while(s!==null);Ht=6,st=null}function SS(s,a,c,f,x,b,k,P,q){s.cancelPendingCommit=null;do Jd();while(fn!==0);if((vt&6)!==0)throw Error(r(327));if(a!==null){if(a===s.current)throw Error(r(177));if(b=a.lanes|a.childLanes,b|=Qm,Rn(s,c,b,k,P,q),s===Rt&&(st=Rt=null,it=0),Ai=a,Ma=s,Qs=c,sg=b,ag=x,dS=f,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,nO(pt,function(){return _S(),null})):(s.callbackNode=null,s.callbackPriority=0),f=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||f){f=L.T,L.T=null,x=$.p,$.p=2,k=vt,vt|=4;try{HA(s,a,c)}finally{vt=k,$.p=x,L.T=f}}fn=1,jS(),CS(),NS()}}function jS(){if(fn===1){fn=0;var s=Ma,a=Ai,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=L.T,L.T=null;var f=$.p;$.p=2;var x=vt;vt|=4;try{rS(a,s);var b=bg,k=c0(s.containerInfo),P=b.focusedElem,q=b.selectionRange;if(k!==P&&P&&P.ownerDocument&&l0(P.ownerDocument.documentElement,P)){if(q!==null&&Hm(P)){var se=q.start,ce=q.end;if(ce===void 0&&(ce=se),"selectionStart"in P)P.selectionStart=se,P.selectionEnd=Math.min(ce,P.value.length);else{var he=P.ownerDocument||document,oe=he&&he.defaultView||window;if(oe.getSelection){var ie=oe.getSelection(),Ee=P.textContent.length,qe=Math.min(q.start,Ee),Et=q.end===void 0?qe:Math.min(q.end,Ee);!ie.extend&&qe>Et&&(k=Et,Et=qe,qe=k);var J=i0(P,qe),Z=i0(P,Et);if(J&&Z&&(ie.rangeCount!==1||ie.anchorNode!==J.node||ie.anchorOffset!==J.offset||ie.focusNode!==Z.node||ie.focusOffset!==Z.offset)){var re=he.createRange();re.setStart(J.node,J.offset),ie.removeAllRanges(),qe>Et?(ie.addRange(re),ie.extend(Z.node,Z.offset)):(re.setEnd(Z.node,Z.offset),ie.addRange(re))}}}}for(he=[],ie=P;ie=ie.parentNode;)ie.nodeType===1&&he.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof P.focus=="function"&&P.focus(),P=0;P<he.length;P++){var de=he[P];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}ff=!!yg,bg=yg=null}finally{vt=x,$.p=f,L.T=c}}s.current=a,fn=2}}function CS(){if(fn===2){fn=0;var s=Ma,a=Ai,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=L.T,L.T=null;var f=$.p;$.p=2;var x=vt;vt|=4;try{Xw(s,a.alternate,a)}finally{vt=x,$.p=f,L.T=c}}fn=3}}function NS(){if(fn===4||fn===3){fn=0,dt();var s=Ma,a=Ai,c=Qs,f=dS;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?fn=5:(fn=0,Ai=Ma=null,kS(s,s.pendingLanes));var x=s.pendingLanes;if(x===0&&(Ta=null),Ue(c),a=a.stateNode,qt&&typeof qt.onCommitFiberRoot=="function")try{qt.onCommitFiberRoot(Pn,a,void 0,(a.current.flags&128)===128)}catch{}if(f!==null){a=L.T,x=$.p,$.p=2,L.T=null;try{for(var b=s.onRecoverableError,k=0;k<f.length;k++){var P=f[k];b(P.value,{componentStack:P.stack})}}finally{L.T=a,$.p=x}}(Qs&3)!==0&&Jd(),ms(s),x=s.pendingLanes,(c&261930)!==0&&(x&42)!==0?s===og?Cc++:(Cc=0,og=s):Cc=0,Nc(0)}}function kS(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,ac(a)))}function Jd(){return jS(),CS(),NS(),_S()}function _S(){if(fn!==5)return!1;var s=Ma,a=sg;sg=0;var c=Ue(Qs),f=L.T,x=$.p;try{$.p=32>c?32:c,L.T=null,c=ag,ag=null;var b=Ma,k=Qs;if(fn=0,Ai=Ma=null,Qs=0,(vt&6)!==0)throw Error(r(331));var P=vt;if(vt|=4,lS(b.current),aS(b,b.current,k,c),vt=P,Nc(0,!1),qt&&typeof qt.onPostCommitFiberRoot=="function")try{qt.onPostCommitFiberRoot(Pn,b)}catch{}return!0}finally{$.p=x,L.T=f,kS(s,a)}}function ES(s,a,c){a=Er(c,a),a=Ip(s.stateNode,a,2),s=ja(s,a,2),s!==null&&(Ot(s,2),ms(s))}function jt(s,a,c){if(s.tag===3)ES(s,s,c);else for(;a!==null;){if(a.tag===3){ES(a,s,c);break}else if(a.tag===1){var f=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Ta===null||!Ta.has(f))){s=Er(c,s),c=Tw(2),f=ja(a,c,2),f!==null&&(Mw(c,f,a,s),Ot(f,2),ms(f));break}}a=a.return}}function cg(s,a,c){var f=s.pingCache;if(f===null){f=s.pingCache=new GA;var x=new Set;f.set(a,x)}else x=f.get(a),x===void 0&&(x=new Set,f.set(a,x));x.has(c)||(tg=!0,x.add(c),s=JA.bind(null,s,a,c),a.then(s,s))}function JA(s,a,c){var f=s.pingCache;f!==null&&f.delete(a),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,Rt===s&&(it&c)===c&&(Ht===4||Ht===3&&(it&62914560)===it&&300>ct()-Wd?(vt&2)===0&&Oi(s,0):ng|=c,Ri===it&&(Ri=0)),ms(s)}function TS(s,a){a===0&&(a=tn()),s=fo(s,a),s!==null&&(Ot(s,a),ms(s))}function eO(s){var a=s.memoizedState,c=0;a!==null&&(c=a.retryLane),TS(s,c)}function tO(s,a){var c=0;switch(s.tag){case 31:case 13:var f=s.stateNode,x=s.memoizedState;x!==null&&(c=x.retryLane);break;case 19:f=s.stateNode;break;case 22:f=s.stateNode._retryCache;break;default:throw Error(r(314))}f!==null&&f.delete(a),TS(s,c)}function nO(s,a){return Le(s,a)}var ef=null,zi=null,ug=!1,tf=!1,dg=!1,Aa=0;function ms(s){s!==zi&&s.next===null&&(zi===null?ef=zi=s:zi=zi.next=s),tf=!0,ug||(ug=!0,sO())}function Nc(s,a){if(!dg&&tf){dg=!0;do for(var c=!1,f=ef;f!==null;){if(s!==0){var x=f.pendingLanes;if(x===0)var b=0;else{var k=f.suspendedLanes,P=f.pingedLanes;b=(1<<31-$t(42|s)+1)-1,b&=x&~(k&~P),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(c=!0,OS(f,b))}else b=it,b=De(f,f===Rt?b:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(b&3)===0||wt(f,b)||(c=!0,OS(f,b));f=f.next}while(c);dg=!1}}function rO(){MS()}function MS(){tf=ug=!1;var s=0;Aa!==0&&mO()&&(s=Aa);for(var a=ct(),c=null,f=ef;f!==null;){var x=f.next,b=RS(f,a);b===0?(f.next=null,c===null?ef=x:c.next=x,x===null&&(zi=c)):(c=f,(s!==0||(b&3)!==0)&&(tf=!0)),f=x}fn!==0&&fn!==5||Nc(s),Aa!==0&&(Aa=0)}function RS(s,a){for(var c=s.suspendedLanes,f=s.pingedLanes,x=s.expirationTimes,b=s.pendingLanes&-62914561;0<b;){var k=31-$t(b),P=1<<k,q=x[k];q===-1?((P&c)===0||(P&f)!==0)&&(x[k]=bn(P,a)):q<=a&&(s.expiredLanes|=P),b&=~P}if(a=Rt,c=it,c=De(s,s===a?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f=s.callbackNode,c===0||s===a&&(St===2||St===9)||s.cancelPendingCommit!==null)return f!==null&&f!==null&&Ye(f),s.callbackNode=null,s.callbackPriority=0;if((c&3)===0||wt(s,c)){if(a=c&-c,a===s.callbackPriority)return a;switch(f!==null&&Ye(f),Ue(c)){case 2:case 8:c=bt;break;case 32:c=pt;break;case 268435456:c=or;break;default:c=pt}return f=AS.bind(null,s),c=Le(c,f),s.callbackPriority=a,s.callbackNode=c,a}return f!==null&&f!==null&&Ye(f),s.callbackPriority=2,s.callbackNode=null,2}function AS(s,a){if(fn!==0&&fn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var c=s.callbackNode;if(Jd()&&s.callbackNode!==c)return null;var f=it;return f=De(s,s===Rt?f:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f===0?null:(hS(s,f,a),RS(s,ct()),s.callbackNode!=null&&s.callbackNode===c?AS.bind(null,s):null)}function OS(s,a){if(Jd())return null;hS(s,a,!0)}function sO(){gO(function(){(vt&6)!==0?Le(Qe,rO):MS()})}function fg(){if(Aa===0){var s=bi;s===0&&(s=ke,ke<<=1,(ke&261888)===0&&(ke=256)),Aa=s}return Aa}function DS(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:cd(""+s)}function zS(s,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,s.id&&c.setAttribute("form",s.id),a.parentNode.insertBefore(c,a),s=new FormData(s),c.parentNode.removeChild(c),s}function aO(s,a,c,f,x){if(a==="submit"&&c&&c.stateNode===x){var b=DS((x[Wn]||null).action),k=f.submitter;k&&(a=(a=k[Wn]||null)?DS(a.formAction):k.getAttribute("formAction"),a!==null&&(b=a,k=null));var P=new hd("action","action",null,f,x);s.push({event:P,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(Aa!==0){var q=k?zS(x,k):new FormData(x);Ap(c,{pending:!0,data:q,method:x.method,action:b},null,q)}}else typeof b=="function"&&(P.preventDefault(),q=k?zS(x,k):new FormData(x),Ap(c,{pending:!0,data:q,method:x.method,action:b},b,q))},currentTarget:x}]})}}for(var hg=0;hg<Zm.length;hg++){var mg=Zm[hg],oO=mg.toLowerCase(),iO=mg[0].toUpperCase()+mg.slice(1);Wr(oO,"on"+iO)}Wr(f0,"onAnimationEnd"),Wr(h0,"onAnimationIteration"),Wr(m0,"onAnimationStart"),Wr("dblclick","onDoubleClick"),Wr("focusin","onFocus"),Wr("focusout","onBlur"),Wr(jA,"onTransitionRun"),Wr(CA,"onTransitionStart"),Wr(NA,"onTransitionCancel"),Wr(p0,"onTransitionEnd"),oi("onMouseEnter",["mouseout","mouseover"]),oi("onMouseLeave",["mouseout","mouseover"]),oi("onPointerEnter",["pointerout","pointerover"]),oi("onPointerLeave",["pointerout","pointerover"]),io("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),io("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),io("onBeforeInput",["compositionend","keypress","textInput","paste"]),io("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),io("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),io("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var kc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),lO=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(kc));function PS(s,a){a=(a&4)!==0;for(var c=0;c<s.length;c++){var f=s[c],x=f.event;f=f.listeners;e:{var b=void 0;if(a)for(var k=f.length-1;0<=k;k--){var P=f[k],q=P.instance,se=P.currentTarget;if(P=P.listener,q!==b&&x.isPropagationStopped())break e;b=P,x.currentTarget=se;try{b(x)}catch(ce){gd(ce)}x.currentTarget=null,b=q}else for(k=0;k<f.length;k++){if(P=f[k],q=P.instance,se=P.currentTarget,P=P.listener,q!==b&&x.isPropagationStopped())break e;b=P,x.currentTarget=se;try{b(x)}catch(ce){gd(ce)}x.currentTarget=null,b=q}}}}function at(s,a){var c=a[_m];c===void 0&&(c=a[_m]=new Set);var f=s+"__bubble";c.has(f)||(LS(a,s,2,!1),c.add(f))}function pg(s,a,c){var f=0;a&&(f|=4),LS(c,s,f,a)}var nf="_reactListening"+Math.random().toString(36).slice(2);function gg(s){if(!s[nf]){s[nf]=!0,Mb.forEach(function(c){c!=="selectionchange"&&(lO.has(c)||pg(c,!1,s),pg(c,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[nf]||(a[nf]=!0,pg("selectionchange",!1,a))}}function LS(s,a,c,f){switch(f1(a)){case 2:var x=PO;break;case 8:x=LO;break;default:x=Rg}c=x.bind(null,a,c,s),x=void 0,!Pm||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(x=!0),f?x!==void 0?s.addEventListener(a,c,{capture:!0,passive:x}):s.addEventListener(a,c,!0):x!==void 0?s.addEventListener(a,c,{passive:x}):s.addEventListener(a,c,!1)}function vg(s,a,c,f,x){var b=f;if((a&1)===0&&(a&2)===0&&f!==null)e:for(;;){if(f===null)return;var k=f.tag;if(k===3||k===4){var P=f.stateNode.containerInfo;if(P===x)break;if(k===4)for(k=f.return;k!==null;){var q=k.tag;if((q===3||q===4)&&k.stateNode.containerInfo===x)return;k=k.return}for(;P!==null;){if(k=ri(P),k===null)return;if(q=k.tag,q===5||q===6||q===26||q===27){f=b=k;continue e}P=P.parentNode}}f=f.return}Ub(function(){var se=b,ce=Dm(c),he=[];e:{var oe=g0.get(s);if(oe!==void 0){var ie=hd,Ee=s;switch(s){case"keypress":if(dd(c)===0)break e;case"keydown":case"keyup":ie=tA;break;case"focusin":Ee="focus",ie=Fm;break;case"focusout":Ee="blur",ie=Fm;break;case"beforeblur":case"afterblur":ie=Fm;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=Hb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=qR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=sA;break;case f0:case h0:case m0:ie=YR;break;case p0:ie=oA;break;case"scroll":case"scrollend":ie=BR;break;case"wheel":ie=lA;break;case"copy":case"cut":case"paste":ie=GR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=Wb;break;case"toggle":case"beforetoggle":ie=uA}var qe=(a&4)!==0,Et=!qe&&(s==="scroll"||s==="scrollend"),J=qe?oe!==null?oe+"Capture":null:oe;qe=[];for(var Z=se,re;Z!==null;){var de=Z;if(re=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||re===null||J===null||(de=Gl(Z,J),de!=null&&qe.push(_c(Z,de,re))),Et)break;Z=Z.return}0<qe.length&&(oe=new ie(oe,Ee,null,c,ce),he.push({event:oe,listeners:qe}))}}if((a&7)===0){e:{if(oe=s==="mouseover"||s==="pointerover",ie=s==="mouseout"||s==="pointerout",oe&&c!==Om&&(Ee=c.relatedTarget||c.fromElement)&&(ri(Ee)||Ee[ni]))break e;if((ie||oe)&&(oe=ce.window===ce?ce:(oe=ce.ownerDocument)?oe.defaultView||oe.parentWindow:window,ie?(Ee=c.relatedTarget||c.toElement,ie=se,Ee=Ee?ri(Ee):null,Ee!==null&&(Et=l(Ee),qe=Ee.tag,Ee!==Et||qe!==5&&qe!==27&&qe!==6)&&(Ee=null)):(ie=null,Ee=se),ie!==Ee)){if(qe=Hb,de="onMouseLeave",J="onMouseEnter",Z="mouse",(s==="pointerout"||s==="pointerover")&&(qe=Wb,de="onPointerLeave",J="onPointerEnter",Z="pointer"),Et=ie==null?oe:Wl(ie),re=Ee==null?oe:Wl(Ee),oe=new qe(de,Z+"leave",ie,c,ce),oe.target=Et,oe.relatedTarget=re,de=null,ri(ce)===se&&(qe=new qe(J,Z+"enter",Ee,c,ce),qe.target=re,qe.relatedTarget=Et,de=qe),Et=de,ie&&Ee)t:{for(qe=cO,J=ie,Z=Ee,re=0,de=J;de;de=qe(de))re++;de=0;for(var Ie=Z;Ie;Ie=qe(Ie))de++;for(;0<re-de;)J=qe(J),re--;for(;0<de-re;)Z=qe(Z),de--;for(;re--;){if(J===Z||Z!==null&&J===Z.alternate){qe=J;break t}J=qe(J),Z=qe(Z)}qe=null}else qe=null;ie!==null&&IS(he,oe,ie,qe,!1),Ee!==null&&Et!==null&&IS(he,Et,Ee,qe,!0)}}e:{if(oe=se?Wl(se):window,ie=oe.nodeName&&oe.nodeName.toLowerCase(),ie==="select"||ie==="input"&&oe.type==="file")var ft=t0;else if(Jb(oe))if(n0)ft=bA;else{ft=xA;var Ae=vA}else ie=oe.nodeName,!ie||ie.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?se&&Am(se.elementType)&&(ft=t0):ft=yA;if(ft&&(ft=ft(s,se))){e0(he,ft,c,ce);break e}Ae&&Ae(s,oe,se),s==="focusout"&&se&&oe.type==="number"&&se.memoizedProps.value!=null&&Rm(oe,"number",oe.value)}switch(Ae=se?Wl(se):window,s){case"focusin":(Jb(Ae)||Ae.contentEditable==="true")&&(fi=Ae,Ym=se,nc=null);break;case"focusout":nc=Ym=fi=null;break;case"mousedown":Wm=!0;break;case"contextmenu":case"mouseup":case"dragend":Wm=!1,u0(he,c,ce);break;case"selectionchange":if(SA)break;case"keydown":case"keyup":u0(he,c,ce)}var Xe;if(Um)e:{switch(s){case"compositionstart":var lt="onCompositionStart";break e;case"compositionend":lt="onCompositionEnd";break e;case"compositionupdate":lt="onCompositionUpdate";break e}lt=void 0}else di?Kb(s,c)&&(lt="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(lt="onCompositionStart");lt&&(Gb&&c.locale!=="ko"&&(di||lt!=="onCompositionStart"?lt==="onCompositionEnd"&&di&&(Xe=qb()):(ga=ce,Lm="value"in ga?ga.value:ga.textContent,di=!0)),Ae=rf(se,lt),0<Ae.length&&(lt=new Yb(lt,s,null,c,ce),he.push({event:lt,listeners:Ae}),Xe?lt.data=Xe:(Xe=Xb(c),Xe!==null&&(lt.data=Xe)))),(Xe=fA?hA(s,c):mA(s,c))&&(lt=rf(se,"onBeforeInput"),0<lt.length&&(Ae=new Yb("onBeforeInput","beforeinput",null,c,ce),he.push({event:Ae,listeners:lt}),Ae.data=Xe)),aO(he,s,se,c,ce)}PS(he,a)})}function _c(s,a,c){return{instance:s,listener:a,currentTarget:c}}function rf(s,a){for(var c=a+"Capture",f=[];s!==null;){var x=s,b=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||b===null||(x=Gl(s,c),x!=null&&f.unshift(_c(s,x,b)),x=Gl(s,a),x!=null&&f.push(_c(s,x,b))),s.tag===3)return f;s=s.return}return[]}function cO(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function IS(s,a,c,f,x){for(var b=a._reactName,k=[];c!==null&&c!==f;){var P=c,q=P.alternate,se=P.stateNode;if(P=P.tag,q!==null&&q===f)break;P!==5&&P!==26&&P!==27||se===null||(q=se,x?(se=Gl(c,b),se!=null&&k.unshift(_c(c,se,q))):x||(se=Gl(c,b),se!=null&&k.push(_c(c,se,q)))),c=c.return}k.length!==0&&s.push({event:a,listeners:k})}var uO=/\r\n?/g,dO=/\u0000|\uFFFD/g;function $S(s){return(typeof s=="string"?s:""+s).replace(uO,`
9
- `).replace(dO,"")}function FS(s,a){return a=$S(a),$S(s)===a}function _t(s,a,c,f,x,b){switch(c){case"children":typeof f=="string"?a==="body"||a==="textarea"&&f===""||li(s,f):(typeof f=="number"||typeof f=="bigint")&&a!=="body"&&li(s,""+f);break;case"className":id(s,"class",f);break;case"tabIndex":id(s,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":id(s,c,f);break;case"style":Fb(s,f,b);break;case"data":if(a!=="object"){id(s,"data",f);break}case"src":case"href":if(f===""&&(a!=="a"||c!=="href")){s.removeAttribute(c);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(c);break}f=cd(""+f),s.setAttribute(c,f);break;case"action":case"formAction":if(typeof f=="function"){s.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof b=="function"&&(c==="formAction"?(a!=="input"&&_t(s,a,"name",x.name,x,null),_t(s,a,"formEncType",x.formEncType,x,null),_t(s,a,"formMethod",x.formMethod,x,null),_t(s,a,"formTarget",x.formTarget,x,null)):(_t(s,a,"encType",x.encType,x,null),_t(s,a,"method",x.method,x,null),_t(s,a,"target",x.target,x,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(c);break}f=cd(""+f),s.setAttribute(c,f);break;case"onClick":f!=null&&(s.onclick=zs);break;case"onScroll":f!=null&&at("scroll",s);break;case"onScrollEnd":f!=null&&at("scrollend",s);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(r(61));if(c=f.__html,c!=null){if(x.children!=null)throw Error(r(60));s.innerHTML=c}}break;case"multiple":s.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":s.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){s.removeAttribute("xlink:href");break}c=cd(""+f),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(c,""+f):s.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(c,""):s.removeAttribute(c);break;case"capture":case"download":f===!0?s.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(c,f):s.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?s.setAttribute(c,f):s.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?s.removeAttribute(c):s.setAttribute(c,f);break;case"popover":at("beforetoggle",s),at("toggle",s),od(s,"popover",f);break;case"xlinkActuate":Ds(s,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Ds(s,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Ds(s,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Ds(s,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Ds(s,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Ds(s,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Ds(s,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Ds(s,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Ds(s,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":od(s,"is",f);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=$R.get(c)||c,od(s,c,f))}}function xg(s,a,c,f,x,b){switch(c){case"style":Fb(s,f,b);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(r(61));if(c=f.__html,c!=null){if(x.children!=null)throw Error(r(60));s.innerHTML=c}}break;case"children":typeof f=="string"?li(s,f):(typeof f=="number"||typeof f=="bigint")&&li(s,""+f);break;case"onScroll":f!=null&&at("scroll",s);break;case"onScrollEnd":f!=null&&at("scrollend",s);break;case"onClick":f!=null&&(s.onclick=zs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Rb.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(x=c.endsWith("Capture"),a=c.slice(2,x?c.length-7:void 0),b=s[Wn]||null,b=b!=null?b[c]:null,typeof b=="function"&&s.removeEventListener(a,b,x),typeof f=="function")){typeof b!="function"&&b!==null&&(c in s?s[c]=null:s.hasAttribute(c)&&s.removeAttribute(c)),s.addEventListener(a,f,x);break e}c in s?s[c]=f:f===!0?s.setAttribute(c,""):od(s,c,f)}}}function Tn(s,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":at("error",s),at("load",s);var f=!1,x=!1,b;for(b in c)if(c.hasOwnProperty(b)){var k=c[b];if(k!=null)switch(b){case"src":f=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:_t(s,a,b,k,c,null)}}x&&_t(s,a,"srcSet",c.srcSet,c,null),f&&_t(s,a,"src",c.src,c,null);return;case"input":at("invalid",s);var P=b=k=x=null,q=null,se=null;for(f in c)if(c.hasOwnProperty(f)){var ce=c[f];if(ce!=null)switch(f){case"name":x=ce;break;case"type":k=ce;break;case"checked":q=ce;break;case"defaultChecked":se=ce;break;case"value":b=ce;break;case"defaultValue":P=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(r(137,a));break;default:_t(s,a,f,ce,c,null)}}Pb(s,b,P,q,se,k,x,!1);return;case"select":at("invalid",s),f=k=b=null;for(x in c)if(c.hasOwnProperty(x)&&(P=c[x],P!=null))switch(x){case"value":b=P;break;case"defaultValue":k=P;break;case"multiple":f=P;default:_t(s,a,x,P,c,null)}a=b,c=k,s.multiple=!!f,a!=null?ii(s,!!f,a,!1):c!=null&&ii(s,!!f,c,!0);return;case"textarea":at("invalid",s),b=x=f=null;for(k in c)if(c.hasOwnProperty(k)&&(P=c[k],P!=null))switch(k){case"value":f=P;break;case"defaultValue":x=P;break;case"children":b=P;break;case"dangerouslySetInnerHTML":if(P!=null)throw Error(r(91));break;default:_t(s,a,k,P,c,null)}Ib(s,f,x,b);return;case"option":for(q in c)c.hasOwnProperty(q)&&(f=c[q],f!=null)&&(q==="selected"?s.selected=f&&typeof f!="function"&&typeof f!="symbol":_t(s,a,q,f,c,null));return;case"dialog":at("beforetoggle",s),at("toggle",s),at("cancel",s),at("close",s);break;case"iframe":case"object":at("load",s);break;case"video":case"audio":for(f=0;f<kc.length;f++)at(kc[f],s);break;case"image":at("error",s),at("load",s);break;case"details":at("toggle",s);break;case"embed":case"source":case"link":at("error",s),at("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(se in c)if(c.hasOwnProperty(se)&&(f=c[se],f!=null))switch(se){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:_t(s,a,se,f,c,null)}return;default:if(Am(a)){for(ce in c)c.hasOwnProperty(ce)&&(f=c[ce],f!==void 0&&xg(s,a,ce,f,c,void 0));return}}for(P in c)c.hasOwnProperty(P)&&(f=c[P],f!=null&&_t(s,a,P,f,c,null))}function fO(s,a,c,f){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,b=null,k=null,P=null,q=null,se=null,ce=null;for(ie in c){var he=c[ie];if(c.hasOwnProperty(ie)&&he!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":q=he;default:f.hasOwnProperty(ie)||_t(s,a,ie,null,f,he)}}for(var oe in f){var ie=f[oe];if(he=c[oe],f.hasOwnProperty(oe)&&(ie!=null||he!=null))switch(oe){case"type":b=ie;break;case"name":x=ie;break;case"checked":se=ie;break;case"defaultChecked":ce=ie;break;case"value":k=ie;break;case"defaultValue":P=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(r(137,a));break;default:ie!==he&&_t(s,a,oe,ie,f,he)}}Mm(s,k,P,q,se,ce,b,x);return;case"select":ie=k=P=oe=null;for(b in c)if(q=c[b],c.hasOwnProperty(b)&&q!=null)switch(b){case"value":break;case"multiple":ie=q;default:f.hasOwnProperty(b)||_t(s,a,b,null,f,q)}for(x in f)if(b=f[x],q=c[x],f.hasOwnProperty(x)&&(b!=null||q!=null))switch(x){case"value":oe=b;break;case"defaultValue":P=b;break;case"multiple":k=b;default:b!==q&&_t(s,a,x,b,f,q)}a=P,c=k,f=ie,oe!=null?ii(s,!!c,oe,!1):!!f!=!!c&&(a!=null?ii(s,!!c,a,!0):ii(s,!!c,c?[]:"",!1));return;case"textarea":ie=oe=null;for(P in c)if(x=c[P],c.hasOwnProperty(P)&&x!=null&&!f.hasOwnProperty(P))switch(P){case"value":break;case"children":break;default:_t(s,a,P,null,f,x)}for(k in f)if(x=f[k],b=c[k],f.hasOwnProperty(k)&&(x!=null||b!=null))switch(k){case"value":oe=x;break;case"defaultValue":ie=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:x!==b&&_t(s,a,k,x,f,b)}Lb(s,oe,ie);return;case"option":for(var Ee in c)oe=c[Ee],c.hasOwnProperty(Ee)&&oe!=null&&!f.hasOwnProperty(Ee)&&(Ee==="selected"?s.selected=!1:_t(s,a,Ee,null,f,oe));for(q in f)oe=f[q],ie=c[q],f.hasOwnProperty(q)&&oe!==ie&&(oe!=null||ie!=null)&&(q==="selected"?s.selected=oe&&typeof oe!="function"&&typeof oe!="symbol":_t(s,a,q,oe,f,ie));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var qe in c)oe=c[qe],c.hasOwnProperty(qe)&&oe!=null&&!f.hasOwnProperty(qe)&&_t(s,a,qe,null,f,oe);for(se in f)if(oe=f[se],ie=c[se],f.hasOwnProperty(se)&&oe!==ie&&(oe!=null||ie!=null))switch(se){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(r(137,a));break;default:_t(s,a,se,oe,f,ie)}return;default:if(Am(a)){for(var Et in c)oe=c[Et],c.hasOwnProperty(Et)&&oe!==void 0&&!f.hasOwnProperty(Et)&&xg(s,a,Et,void 0,f,oe);for(ce in f)oe=f[ce],ie=c[ce],!f.hasOwnProperty(ce)||oe===ie||oe===void 0&&ie===void 0||xg(s,a,ce,oe,f,ie);return}}for(var J in c)oe=c[J],c.hasOwnProperty(J)&&oe!=null&&!f.hasOwnProperty(J)&&_t(s,a,J,null,f,oe);for(he in f)oe=f[he],ie=c[he],!f.hasOwnProperty(he)||oe===ie||oe==null&&ie==null||_t(s,a,he,oe,f,ie)}function BS(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function hO(){if(typeof performance.getEntriesByType=="function"){for(var s=0,a=0,c=performance.getEntriesByType("resource"),f=0;f<c.length;f++){var x=c[f],b=x.transferSize,k=x.initiatorType,P=x.duration;if(b&&P&&BS(k)){for(k=0,P=x.responseEnd,f+=1;f<c.length;f++){var q=c[f],se=q.startTime;if(se>P)break;var ce=q.transferSize,he=q.initiatorType;ce&&BS(he)&&(q=q.responseEnd,k+=ce*(q<P?1:(P-se)/(q-se)))}if(--f,a+=8*(b+k)/(x.duration/1e3),s++,10<s)break}}if(0<s)return a/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var yg=null,bg=null;function sf(s){return s.nodeType===9?s:s.ownerDocument}function US(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function qS(s,a){if(s===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&a==="foreignObject"?0:s}function wg(s,a){return s==="textarea"||s==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Sg=null;function mO(){var s=window.event;return s&&s.type==="popstate"?s===Sg?!1:(Sg=s,!0):(Sg=null,!1)}var VS=typeof setTimeout=="function"?setTimeout:void 0,pO=typeof clearTimeout=="function"?clearTimeout:void 0,HS=typeof Promise=="function"?Promise:void 0,gO=typeof queueMicrotask=="function"?queueMicrotask:typeof HS<"u"?function(s){return HS.resolve(null).then(s).catch(vO)}:VS;function vO(s){setTimeout(function(){throw s})}function Oa(s){return s==="head"}function YS(s,a){var c=a,f=0;do{var x=c.nextSibling;if(s.removeChild(c),x&&x.nodeType===8)if(c=x.data,c==="/$"||c==="/&"){if(f===0){s.removeChild(x),$i(a);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")Ec(s.ownerDocument.documentElement);else if(c==="head"){c=s.ownerDocument.head,Ec(c);for(var b=c.firstChild;b;){var k=b.nextSibling,P=b.nodeName;b[Yl]||P==="SCRIPT"||P==="STYLE"||P==="LINK"&&b.rel.toLowerCase()==="stylesheet"||c.removeChild(b),b=k}}else c==="body"&&Ec(s.ownerDocument.body);c=x}while(c);$i(a)}function WS(s,a){var c=s;s=0;do{var f=c.nextSibling;if(c.nodeType===1?a?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(a?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),f&&f.nodeType===8)if(c=f.data,c==="/$"){if(s===0)break;s--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||s++;c=f}while(c)}function jg(s){var a=s.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var c=a;switch(a=a.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":jg(c),Em(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}s.removeChild(c)}}function xO(s,a,c,f){for(;s.nodeType===1;){var x=c;if(s.nodeName.toLowerCase()!==a.toLowerCase()){if(!f&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(f){if(!s[Yl])switch(a){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(b=s.getAttribute("rel"),b==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(b!==x.rel||s.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||s.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||s.getAttribute("title")!==(x.title==null?null:x.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(b=s.getAttribute("src"),(b!==(x.src==null?null:x.src)||s.getAttribute("type")!==(x.type==null?null:x.type)||s.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&b&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(a==="input"&&s.type==="hidden"){var b=x.name==null?null:""+x.name;if(x.type==="hidden"&&s.getAttribute("name")===b)return s}else return s;if(s=Or(s.nextSibling),s===null)break}return null}function yO(s,a,c){if(a==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!c||(s=Or(s.nextSibling),s===null))return null;return s}function GS(s,a){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=Or(s.nextSibling),s===null))return null;return s}function Cg(s){return s.data==="$?"||s.data==="$~"}function Ng(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function bO(s,a){var c=s.ownerDocument;if(s.data==="$~")s._reactRetry=a;else if(s.data!=="$?"||c.readyState!=="loading")a();else{var f=function(){a(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),s._reactRetry=f}}function Or(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return s}var kg=null;function ZS(s){s=s.nextSibling;for(var a=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"||c==="/&"){if(a===0)return Or(s.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}s=s.nextSibling}return null}function QS(s){s=s.previousSibling;for(var a=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return s;a--}else c!=="/$"&&c!=="/&"||a++}s=s.previousSibling}return null}function KS(s,a,c){switch(a=sf(c),s){case"html":if(s=a.documentElement,!s)throw Error(r(452));return s;case"head":if(s=a.head,!s)throw Error(r(453));return s;case"body":if(s=a.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function Ec(s){for(var a=s.attributes;a.length;)s.removeAttributeNode(a[0]);Em(s)}var Dr=new Map,XS=new Set;function af(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Ks=$.d;$.d={f:wO,r:SO,D:jO,C:CO,L:NO,m:kO,X:EO,S:_O,M:TO};function wO(){var s=Ks.f(),a=Qd();return s||a}function SO(s){var a=si(s);a!==null&&a.tag===5&&a.type==="form"?pw(a):Ks.r(s)}var Pi=typeof document>"u"?null:document;function JS(s,a,c){var f=Pi;if(f&&typeof a=="string"&&a){var x=kr(a);x='link[rel="'+s+'"][href="'+x+'"]',typeof c=="string"&&(x+='[crossorigin="'+c+'"]'),XS.has(x)||(XS.add(x),s={rel:s,crossOrigin:c,href:a},f.querySelector(x)===null&&(a=f.createElement("link"),Tn(a,"link",s),Sn(a),f.head.appendChild(a)))}}function jO(s){Ks.D(s),JS("dns-prefetch",s,null)}function CO(s,a){Ks.C(s,a),JS("preconnect",s,a)}function NO(s,a,c){Ks.L(s,a,c);var f=Pi;if(f&&s&&a){var x='link[rel="preload"][as="'+kr(a)+'"]';a==="image"&&c&&c.imageSrcSet?(x+='[imagesrcset="'+kr(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(x+='[imagesizes="'+kr(c.imageSizes)+'"]')):x+='[href="'+kr(s)+'"]';var b=x;switch(a){case"style":b=Li(s);break;case"script":b=Ii(s)}Dr.has(b)||(s=g({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:s,as:a},c),Dr.set(b,s),f.querySelector(x)!==null||a==="style"&&f.querySelector(Tc(b))||a==="script"&&f.querySelector(Mc(b))||(a=f.createElement("link"),Tn(a,"link",s),Sn(a),f.head.appendChild(a)))}}function kO(s,a){Ks.m(s,a);var c=Pi;if(c&&s){var f=a&&typeof a.as=="string"?a.as:"script",x='link[rel="modulepreload"][as="'+kr(f)+'"][href="'+kr(s)+'"]',b=x;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Ii(s)}if(!Dr.has(b)&&(s=g({rel:"modulepreload",href:s},a),Dr.set(b,s),c.querySelector(x)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Mc(b)))return}f=c.createElement("link"),Tn(f,"link",s),Sn(f),c.head.appendChild(f)}}}function _O(s,a,c){Ks.S(s,a,c);var f=Pi;if(f&&s){var x=ai(f).hoistableStyles,b=Li(s);a=a||"default";var k=x.get(b);if(!k){var P={loading:0,preload:null};if(k=f.querySelector(Tc(b)))P.loading=5;else{s=g({rel:"stylesheet",href:s,"data-precedence":a},c),(c=Dr.get(b))&&_g(s,c);var q=k=f.createElement("link");Sn(q),Tn(q,"link",s),q._p=new Promise(function(se,ce){q.onload=se,q.onerror=ce}),q.addEventListener("load",function(){P.loading|=1}),q.addEventListener("error",function(){P.loading|=2}),P.loading|=4,of(k,a,f)}k={type:"stylesheet",instance:k,count:1,state:P},x.set(b,k)}}}function EO(s,a){Ks.X(s,a);var c=Pi;if(c&&s){var f=ai(c).hoistableScripts,x=Ii(s),b=f.get(x);b||(b=c.querySelector(Mc(x)),b||(s=g({src:s,async:!0},a),(a=Dr.get(x))&&Eg(s,a),b=c.createElement("script"),Sn(b),Tn(b,"link",s),c.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},f.set(x,b))}}function TO(s,a){Ks.M(s,a);var c=Pi;if(c&&s){var f=ai(c).hoistableScripts,x=Ii(s),b=f.get(x);b||(b=c.querySelector(Mc(x)),b||(s=g({src:s,async:!0,type:"module"},a),(a=Dr.get(x))&&Eg(s,a),b=c.createElement("script"),Sn(b),Tn(b,"link",s),c.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},f.set(x,b))}}function e1(s,a,c,f){var x=(x=ue.current)?af(x):null;if(!x)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=Li(c.href),c=ai(x).hoistableStyles,f=c.get(a),f||(f={type:"style",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=Li(c.href);var b=ai(x).hoistableStyles,k=b.get(s);if(k||(x=x.ownerDocument||x,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(s,k),(b=x.querySelector(Tc(s)))&&!b._p&&(k.instance=b,k.state.loading=5),Dr.has(s)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Dr.set(s,c),b||MO(x,s,c,k.state))),a&&f===null)throw Error(r(528,""));return k}if(a&&f!==null)throw Error(r(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Ii(c),c=ai(x).hoistableScripts,f=c.get(a),f||(f={type:"script",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function Li(s){return'href="'+kr(s)+'"'}function Tc(s){return'link[rel="stylesheet"]['+s+"]"}function t1(s){return g({},s,{"data-precedence":s.precedence,precedence:null})}function MO(s,a,c,f){s.querySelector('link[rel="preload"][as="style"]['+a+"]")?f.loading=1:(a=s.createElement("link"),f.preload=a,a.addEventListener("load",function(){return f.loading|=1}),a.addEventListener("error",function(){return f.loading|=2}),Tn(a,"link",c),Sn(a),s.head.appendChild(a))}function Ii(s){return'[src="'+kr(s)+'"]'}function Mc(s){return"script[async]"+s}function n1(s,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var f=s.querySelector('style[data-href~="'+kr(c.href)+'"]');if(f)return a.instance=f,Sn(f),f;var x=g({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return f=(s.ownerDocument||s).createElement("style"),Sn(f),Tn(f,"style",x),of(f,c.precedence,s),a.instance=f;case"stylesheet":x=Li(c.href);var b=s.querySelector(Tc(x));if(b)return a.state.loading|=4,a.instance=b,Sn(b),b;f=t1(c),(x=Dr.get(x))&&_g(f,x),b=(s.ownerDocument||s).createElement("link"),Sn(b);var k=b;return k._p=new Promise(function(P,q){k.onload=P,k.onerror=q}),Tn(b,"link",f),a.state.loading|=4,of(b,c.precedence,s),a.instance=b;case"script":return b=Ii(c.src),(x=s.querySelector(Mc(b)))?(a.instance=x,Sn(x),x):(f=c,(x=Dr.get(b))&&(f=g({},c),Eg(f,x)),s=s.ownerDocument||s,x=s.createElement("script"),Sn(x),Tn(x,"link",f),s.head.appendChild(x),a.instance=x);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(f=a.instance,a.state.loading|=4,of(f,c.precedence,s));return a.instance}function of(s,a,c){for(var f=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=f.length?f[f.length-1]:null,b=x,k=0;k<f.length;k++){var P=f[k];if(P.dataset.precedence===a)b=P;else if(b!==x)break}b?b.parentNode.insertBefore(s,b.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(s,a.firstChild))}function _g(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.title==null&&(s.title=a.title)}function Eg(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.integrity==null&&(s.integrity=a.integrity)}var lf=null;function r1(s,a,c){if(lf===null){var f=new Map,x=lf=new Map;x.set(c,f)}else x=lf,f=x.get(c),f||(f=new Map,x.set(c,f));if(f.has(s))return f;for(f.set(s,null),c=c.getElementsByTagName(s),x=0;x<c.length;x++){var b=c[x];if(!(b[Yl]||b[Zt]||s==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var k=b.getAttribute(a)||"";k=s+k;var P=f.get(k);P?P.push(b):f.set(k,[b])}}return f}function s1(s,a,c){s=s.ownerDocument||s,s.head.insertBefore(c,a==="title"?s.querySelector("head > title"):null)}function RO(s,a,c){if(c===1||a.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(s=a.disabled,typeof a.precedence=="string"&&s==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function a1(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function AO(s,a,c,f){if(c.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var x=Li(f.href),b=a.querySelector(Tc(x));if(b){a=b._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(s.count++,s=cf.bind(s),a.then(s,s)),c.state.loading|=4,c.instance=b,Sn(b);return}b=a.ownerDocument||a,f=t1(f),(x=Dr.get(x))&&_g(f,x),b=b.createElement("link"),Sn(b);var k=b;k._p=new Promise(function(P,q){k.onload=P,k.onerror=q}),Tn(b,"link",f),c.instance=b}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(s.count++,c=cf.bind(s),a.addEventListener("load",c),a.addEventListener("error",c))}}var Tg=0;function OO(s,a){return s.stylesheets&&s.count===0&&df(s,s.stylesheets),0<s.count||0<s.imgCount?function(c){var f=setTimeout(function(){if(s.stylesheets&&df(s,s.stylesheets),s.unsuspend){var b=s.unsuspend;s.unsuspend=null,b()}},6e4+a);0<s.imgBytes&&Tg===0&&(Tg=62500*hO());var x=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&df(s,s.stylesheets),s.unsuspend)){var b=s.unsuspend;s.unsuspend=null,b()}},(s.imgBytes>Tg?50:800)+a);return s.unsuspend=c,function(){s.unsuspend=null,clearTimeout(f),clearTimeout(x)}}:null}function cf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)df(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var uf=null;function df(s,a){s.stylesheets=null,s.unsuspend!==null&&(s.count++,uf=new Map,a.forEach(DO,s),uf=null,cf.call(s))}function DO(s,a){if(!(a.state.loading&4)){var c=uf.get(s);if(c)var f=c.get(null);else{c=new Map,uf.set(s,c);for(var x=s.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<x.length;b++){var k=x[b];(k.nodeName==="LINK"||k.getAttribute("media")!=="not all")&&(c.set(k.dataset.precedence,k),f=k)}f&&c.set(null,f)}x=a.instance,k=x.getAttribute("data-precedence"),b=c.get(k)||f,b===f&&c.set(null,x),c.set(k,x),this.count++,f=cf.bind(this),x.addEventListener("load",f),x.addEventListener("error",f),b?b.parentNode.insertBefore(x,b.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(x,s.firstChild)),a.state.loading|=4}}var Rc={$$typeof:E,Provider:null,Consumer:null,_currentValue:U,_currentValue2:U,_threadCount:0};function zO(s,a,c,f,x,b,k,P,q){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Gt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gt(0),this.hiddenUpdates=Gt(null),this.identifierPrefix=f,this.onUncaughtError=x,this.onCaughtError=b,this.onRecoverableError=k,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function o1(s,a,c,f,x,b,k,P,q,se,ce,he){return s=new zO(s,a,c,k,q,se,ce,he,P),a=1,b===!0&&(a|=24),b=lr(3,null,null,a),s.current=b,b.stateNode=s,a=lp(),a.refCount++,s.pooledCache=a,a.refCount++,b.memoizedState={element:f,isDehydrated:c,cache:a},fp(b),s}function i1(s){return s?(s=pi,s):pi}function l1(s,a,c,f,x,b){x=i1(x),f.context===null?f.context=x:f.pendingContext=x,f=Sa(a),f.payload={element:c},b=b===void 0?null:b,b!==null&&(f.callback=b),c=ja(s,f,a),c!==null&&(Jn(c,s,a),cc(c,s,a))}function c1(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<a?c:a}}function Mg(s,a){c1(s,a),(s=s.alternate)&&c1(s,a)}function u1(s){if(s.tag===13||s.tag===31){var a=fo(s,67108864);a!==null&&Jn(a,s,67108864),Mg(s,67108864)}}function d1(s){if(s.tag===13||s.tag===31){var a=hr();a=je(a);var c=fo(s,a);c!==null&&Jn(c,s,a),Mg(s,a)}}var ff=!0;function PO(s,a,c,f){var x=L.T;L.T=null;var b=$.p;try{$.p=2,Rg(s,a,c,f)}finally{$.p=b,L.T=x}}function LO(s,a,c,f){var x=L.T;L.T=null;var b=$.p;try{$.p=8,Rg(s,a,c,f)}finally{$.p=b,L.T=x}}function Rg(s,a,c,f){if(ff){var x=Ag(f);if(x===null)vg(s,a,f,hf,c),h1(s,f);else if($O(x,s,a,c,f))f.stopPropagation();else if(h1(s,f),a&4&&-1<IO.indexOf(s)){for(;x!==null;){var b=si(x);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var k=Ve(b.pendingLanes);if(k!==0){var P=b;for(P.pendingLanes|=2,P.entangledLanes|=2;k;){var q=1<<31-$t(k);P.entanglements[1]|=q,k&=~q}ms(b),(vt&6)===0&&(Gd=ct()+500,Nc(0))}}break;case 31:case 13:P=fo(b,2),P!==null&&Jn(P,b,2),Qd(),Mg(b,2)}if(b=Ag(f),b===null&&vg(s,a,f,hf,c),b===x)break;x=b}x!==null&&f.stopPropagation()}else vg(s,a,f,null,c)}}function Ag(s){return s=Dm(s),Og(s)}var hf=null;function Og(s){if(hf=null,s=ri(s),s!==null){var a=l(s);if(a===null)s=null;else{var c=a.tag;if(c===13){if(s=u(a),s!==null)return s;s=null}else if(c===31){if(s=d(a),s!==null)return s;s=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;s=null}else a!==s&&(s=null)}}return hf=s,null}function f1(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Mn()){case Qe:return 2;case bt:return 8;case pt:case Vn:return 32;case or:return 268435456;default:return 32}default:return 32}}var Dg=!1,Da=null,za=null,Pa=null,Ac=new Map,Oc=new Map,La=[],IO="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function h1(s,a){switch(s){case"focusin":case"focusout":Da=null;break;case"dragenter":case"dragleave":za=null;break;case"mouseover":case"mouseout":Pa=null;break;case"pointerover":case"pointerout":Ac.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oc.delete(a.pointerId)}}function Dc(s,a,c,f,x,b){return s===null||s.nativeEvent!==b?(s={blockedOn:a,domEventName:c,eventSystemFlags:f,nativeEvent:b,targetContainers:[x]},a!==null&&(a=si(a),a!==null&&u1(a)),s):(s.eventSystemFlags|=f,a=s.targetContainers,x!==null&&a.indexOf(x)===-1&&a.push(x),s)}function $O(s,a,c,f,x){switch(a){case"focusin":return Da=Dc(Da,s,a,c,f,x),!0;case"dragenter":return za=Dc(za,s,a,c,f,x),!0;case"mouseover":return Pa=Dc(Pa,s,a,c,f,x),!0;case"pointerover":var b=x.pointerId;return Ac.set(b,Dc(Ac.get(b)||null,s,a,c,f,x)),!0;case"gotpointercapture":return b=x.pointerId,Oc.set(b,Dc(Oc.get(b)||null,s,a,c,f,x)),!0}return!1}function m1(s){var a=ri(s.target);if(a!==null){var c=l(a);if(c!==null){if(a=c.tag,a===13){if(a=u(c),a!==null){s.blockedOn=a,Ke(s.priority,function(){d1(c)});return}}else if(a===31){if(a=d(c),a!==null){s.blockedOn=a,Ke(s.priority,function(){d1(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function mf(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var c=Ag(s.nativeEvent);if(c===null){c=s.nativeEvent;var f=new c.constructor(c.type,c);Om=f,c.target.dispatchEvent(f),Om=null}else return a=si(c),a!==null&&u1(a),s.blockedOn=c,!1;a.shift()}return!0}function p1(s,a,c){mf(s)&&c.delete(a)}function FO(){Dg=!1,Da!==null&&mf(Da)&&(Da=null),za!==null&&mf(za)&&(za=null),Pa!==null&&mf(Pa)&&(Pa=null),Ac.forEach(p1),Oc.forEach(p1)}function pf(s,a){s.blockedOn===a&&(s.blockedOn=null,Dg||(Dg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,FO)))}var gf=null;function g1(s){gf!==s&&(gf=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){gf===s&&(gf=null);for(var a=0;a<s.length;a+=3){var c=s[a],f=s[a+1],x=s[a+2];if(typeof f!="function"){if(Og(f||c)===null)continue;break}var b=si(c);b!==null&&(s.splice(a,3),a-=3,Ap(b,{pending:!0,data:x,method:c.method,action:f},f,x))}}))}function $i(s){function a(q){return pf(q,s)}Da!==null&&pf(Da,s),za!==null&&pf(za,s),Pa!==null&&pf(Pa,s),Ac.forEach(a),Oc.forEach(a);for(var c=0;c<La.length;c++){var f=La[c];f.blockedOn===s&&(f.blockedOn=null)}for(;0<La.length&&(c=La[0],c.blockedOn===null);)m1(c),c.blockedOn===null&&La.shift();if(c=(s.ownerDocument||s).$$reactFormReplay,c!=null)for(f=0;f<c.length;f+=3){var x=c[f],b=c[f+1],k=x[Wn]||null;if(typeof b=="function")k||g1(c);else if(k){var P=null;if(b&&b.hasAttribute("formAction")){if(x=b,k=b[Wn]||null)P=k.formAction;else if(Og(x)!==null)continue}else P=k.action;typeof P=="function"?c[f+1]=P:(c.splice(f,3),f-=3),g1(c)}}}function v1(){function s(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(k){return x=k})},focusReset:"manual",scroll:"manual"})}function a(){x!==null&&(x(),x=null),f||setTimeout(c,20)}function c(){if(!f&&!navigation.transition){var b=navigation.currentEntry;b&&b.url!=null&&navigation.navigate(b.url,{state:b.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,x=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){f=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),x!==null&&(x(),x=null)}}}function zg(s){this._internalRoot=s}vf.prototype.render=zg.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(r(409));var c=a.current,f=hr();l1(c,f,s,a,null,null)},vf.prototype.unmount=zg.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;l1(s.current,2,null,s,null,null),Qd(),a[ni]=null}};function vf(s){this._internalRoot=s}vf.prototype.unstable_scheduleHydration=function(s){if(s){var a=gt();s={blockedOn:null,target:s,priority:a};for(var c=0;c<La.length&&a!==0&&a<La[c].priority;c++);La.splice(c,0,s),c===0&&m1(s)}};var x1=t.version;if(x1!=="19.2.4")throw Error(r(527,x1,"19.2.4"));$.findDOMNode=function(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=m(a),s=s!==null?v(s):null,s=s===null?null:s.stateNode,s};var BO={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xf.isDisabled&&xf.supportsFiber)try{Pn=xf.inject(BO),qt=xf}catch{}}return Pc.createRoot=function(s,a){if(!o(s))throw Error(r(299));var c=!1,f="",x=Nw,b=kw,k=_w;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(x=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(k=a.onRecoverableError)),a=o1(s,1,!1,null,null,c,f,null,x,b,k,v1),s[ni]=a.current,gg(s),new zg(a)},Pc.hydrateRoot=function(s,a,c){if(!o(s))throw Error(r(299));var f=!1,x="",b=Nw,k=kw,P=_w,q=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onUncaughtError!==void 0&&(b=c.onUncaughtError),c.onCaughtError!==void 0&&(k=c.onCaughtError),c.onRecoverableError!==void 0&&(P=c.onRecoverableError),c.formState!==void 0&&(q=c.formState)),a=o1(s,1,!0,a,c??null,f,x,q,b,k,P,v1),a.context=i1(null),c=a.current,f=hr(),f=je(f),x=Sa(f),x.callback=null,ja(c,x,f),c=f,a.current.lanes=c,Ot(a,c),ms(a),s[ni]=a.current,gg(s),new vf(a)},Pc.version="19.2.4",Pc}var E1;function KO(){if(E1)return Ig.exports;E1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ig.exports=QO(),Ig.exports}var XO=KO(),vs=[],Pr=[],JO=Uint8Array,Ug="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Fi=0,eD=Ug.length;Fi<eD;++Fi)vs[Fi]=Ug[Fi],Pr[Ug.charCodeAt(Fi)]=Fi;Pr[45]=62;Pr[95]=63;function tD(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function nD(e,t,n){return(t+n)*3/4-n}function cu(e){var t,n=tD(e),r=n[0],o=n[1],l=new JO(nD(e,r,o)),u=0,d=o>0?r-4:r,h;for(h=0;h<d;h+=4)t=Pr[e.charCodeAt(h)]<<18|Pr[e.charCodeAt(h+1)]<<12|Pr[e.charCodeAt(h+2)]<<6|Pr[e.charCodeAt(h+3)],l[u++]=t>>16&255,l[u++]=t>>8&255,l[u++]=t&255;return o===2&&(t=Pr[e.charCodeAt(h)]<<2|Pr[e.charCodeAt(h+1)]>>4,l[u++]=t&255),o===1&&(t=Pr[e.charCodeAt(h)]<<10|Pr[e.charCodeAt(h+1)]<<4|Pr[e.charCodeAt(h+2)]>>2,l[u++]=t>>8&255,l[u++]=t&255),l}function rD(e){return vs[e>>18&63]+vs[e>>12&63]+vs[e>>6&63]+vs[e&63]}function sD(e,t,n){for(var r,o=[],l=t;l<n;l+=3)r=(e[l]<<16&16711680)+(e[l+1]<<8&65280)+(e[l+2]&255),o.push(rD(r));return o.join("")}function uu(e){for(var t,n=e.length,r=n%3,o=[],l=16383,u=0,d=n-r;u<d;u+=l)o.push(sD(e,u,u+l>d?d:u+l));return r===1?(t=e[n-1],o.push(vs[t>>2]+vs[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],o.push(vs[t>>10]+vs[t>>4&63]+vs[t<<2&63]+"=")),o.join("")}function na(e){if(e===void 0)return{};if(!yN(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}function aD(e){if(typeof e>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof e!="string")throw new Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith("http:")||e.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw new Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}function yN(e){const t=typeof e=="object",n=Object.getPrototypeOf(e),r=n===null||n===Object.prototype||n?.constructor?.name==="Object";return t&&r}const bN=!0,dl=BigInt("-9223372036854775808"),Ox=BigInt("9223372036854775807"),Zv=BigInt("0"),oD=BigInt("8"),iD=BigInt("256");function wN(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}function lD(e){e<Zv&&(e-=dl+dl);let t=e.toString(16);t.length%2===1&&(t="0"+t);const n=new Uint8Array(new ArrayBuffer(8));let r=0;for(const o of t.match(/.{2}/g).reverse())n.set([parseInt(o,16)],r++),e>>=oD;return uu(n)}function cD(e){const t=cu(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let n=Zv,r=Zv;for(const o of t)n+=BigInt(o)*iD**r,r++;return n>Ox&&(n+=dl+dl),n}function uD(e){if(e<dl||Ox<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);const t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),uu(new Uint8Array(t))}function dD(e){const t=cu(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}const fD=DataView.prototype.setBigInt64?uD:lD,hD=DataView.prototype.getBigInt64?dD:cD,T1=1024;function SN(e){if(e.length>T1)throw new Error(`Field name ${e} exceeds maximum field name length ${T1}.`);if(e.startsWith("$"))throw new Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){const n=e.charCodeAt(t);if(n<32||n>=127)throw new Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}function fl(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(r=>fl(r));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);const t=Object.entries(e);if(t.length===1){const r=t[0][0];if(r==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return cu(e.$bytes).buffer}if(r==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return hD(e.$integer)}if(r==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);const o=cu(e.$float);if(o.byteLength!==8)throw new Error(`Received ${o.byteLength} bytes, expected 8 for $float`);const u=new DataView(o.buffer).getFloat64(0,bN);if(!wN(u))throw new Error(`Float ${u} should be encoded as a number`);return u}if(r==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(r==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}const n={};for(const[r,o]of Object.entries(e))SN(r),n[r]=fl(o);return n}const M1=16384;function ru(e){const t=JSON.stringify(e,(n,r)=>r===void 0?"undefined":typeof r=="bigint"?`${r.toString()}n`:r);if(t.length>M1){const n="[...truncated]";let r=M1-n.length;const o=t.codePointAt(r-1);return o!==void 0&&o>65535&&(r-=1),t.substring(0,r)+n}return t}function Qv(e,t,n,r){if(e===void 0){const u=n&&` (present at path ${n} in original object ${ru(t)})`;throw new Error(`undefined is not a valid Convex value${u}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e=="bigint"){if(e<dl||Ox<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:fD(e)}}if(typeof e=="number")if(wN(e)){const u=new ArrayBuffer(8);return new DataView(u).setFloat64(0,e,bN),{$float:uu(new Uint8Array(u))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:uu(new Uint8Array(e))};if(Array.isArray(e))return e.map((u,d)=>Qv(u,t,n+`[${d}]`));if(e instanceof Set)throw new Error(qg(n,"Set",[...e],t));if(e instanceof Map)throw new Error(qg(n,"Map",[...e],t));if(!yN(e)){const u=e?.constructor?.name,d=u?`${u} `:"";throw new Error(qg(n,d,e,t))}const o={},l=Object.entries(e);l.sort(([u,d],[h,m])=>u===h?0:u<h?-1:1);for(const[u,d]of l)d!==void 0&&(SN(u),o[u]=Qv(d,t,n+`.${u}`));return o}function qg(e,t,n,r){return e?`${t}${ru(n)} is not a supported Convex type (present at path ${e} in original object ${ru(r)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${ru(n)} is not a supported Convex type.`}function ks(e){return Qv(e,e,"")}var mD=Object.defineProperty,pD=(e,t,n)=>t in e?mD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vg=(e,t,n)=>pD(e,typeof t!="symbol"?t+"":t,n),R1,A1;const gD=Symbol.for("ConvexError");class Kv extends(A1=Error,R1=gD,A1){constructor(t){super(typeof t=="string"?t:ru(t)),Vg(this,"name","ConvexError"),Vg(this,"data"),Vg(this,R1,!0),this.data=t}}const jN=()=>Array.from({length:4},()=>0);jN();jN();const O1="1.31.6";var vD=Object.defineProperty,xD=(e,t,n)=>t in e?vD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,D1=(e,t,n)=>xD(e,typeof t!="symbol"?t+"":t,n);const yD="color:rgb(0, 145, 255)";function CN(e){switch(e){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}class NN{constructor(t){D1(this,"_onLogLineFuncs"),D1(this,"_verbose"),this._onLogLineFuncs={},this._verbose=t.verbose}addLogLineListener(t){let n=Math.random().toString(36).substring(2,15);for(let r=0;r<10&&this._onLogLineFuncs[n]!==void 0;r++)n=Math.random().toString(36).substring(2,15);return this._onLogLineFuncs[n]=t,()=>{delete this._onLogLineFuncs[n]}}logVerbose(...t){if(this._verbose)for(const n of Object.values(this._onLogLineFuncs))n("debug",`${new Date().toISOString()}`,...t)}log(...t){for(const n of Object.values(this._onLogLineFuncs))n("info",...t)}warn(...t){for(const n of Object.values(this._onLogLineFuncs))n("warn",...t)}error(...t){for(const n of Object.values(this._onLogLineFuncs))n("error",...t)}}function kN(e){const t=new NN(e);return t.addLogLineListener((n,...r)=>{switch(n){case"debug":console.debug(...r);break;case"info":console.log(...r);break;case"warn":console.warn(...r);break;case"error":console.error(...r);break;default:console.log(...r)}}),t}function _N(e){return new NN(e)}function Kf(e,t,n,r,o){const l=CN(n);if(typeof o=="object"&&(o=`ConvexError ${JSON.stringify(o.errorData,null,2)}`),t==="info"){const u=o.match(/^\[.*?\] /);if(u===null){e.error(`[CONVEX ${l}(${r})] Could not parse console.log`);return}const d=o.slice(1,u[0].length-2),h=o.slice(u[0].length);e.log(`%c[CONVEX ${l}(${r})] [${d}]`,yD,h)}else e.error(`[CONVEX ${l}(${r})] ${o}`)}function bD(e,t){const n=`[CONVEX FATAL ERROR] ${t}`;return e.error(n),new Error(n)}function Ji(e,t,n){return`[CONVEX ${CN(e)}(${t})] ${n.errorMessage}
10
- Called by client`}function Xv(e,t){return t.data=e.errorData,t}function Lo(e){const t=e.split(":");let n,r;return t.length===1?(n=t[0],r="default"):(n=t.slice(0,t.length-1).join(":"),r=t[t.length-1]),n.endsWith(".js")&&(n=n.slice(0,-3)),`${n}:${r}`}function Oo(e,t){return JSON.stringify({udfPath:Lo(e),args:ks(t)})}function z1(e,t,n){const{initialNumItems:r,id:o}=n;return JSON.stringify({type:"paginated",udfPath:Lo(e),args:ks(t),options:ks({initialNumItems:r,id:o})})}var wD=Object.defineProperty,SD=(e,t,n)=>t in e?wD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ps=(e,t,n)=>SD(e,typeof t!="symbol"?t+"":t,n);class jD{constructor(){ps(this,"nextQueryId"),ps(this,"querySetVersion"),ps(this,"querySet"),ps(this,"queryIdToToken"),ps(this,"identityVersion"),ps(this,"auth"),ps(this,"outstandingQueriesOlderThanRestart"),ps(this,"outstandingAuthOlderThanRestart"),ps(this,"paused"),ps(this,"pendingQuerySetModifications"),this.nextQueryId=0,this.querySetVersion=0,this.identityVersion=0,this.querySet=new Map,this.queryIdToToken=new Map,this.outstandingQueriesOlderThanRestart=new Set,this.outstandingAuthOlderThanRestart=!1,this.paused=!1,this.pendingQuerySetModifications=new Map}hasSyncedPastLastReconnect(){return this.outstandingQueriesOlderThanRestart.size===0&&!this.outstandingAuthOlderThanRestart}markAuthCompletion(){this.outstandingAuthOlderThanRestart=!1}subscribe(t,n,r,o){const l=Lo(t),u=Oo(l,n),d=this.querySet.get(u);if(d!==void 0)return d.numSubscribers+=1,{queryToken:u,modification:null,unsubscribe:()=>this.removeSubscriber(u)};{const h=this.nextQueryId++,m={id:h,canonicalizedUdfPath:l,args:n,numSubscribers:1,journal:r,componentPath:o};this.querySet.set(u,m),this.queryIdToToken.set(h,u);const v=this.querySetVersion,g=this.querySetVersion+1,y={type:"Add",queryId:h,udfPath:l,args:[ks(n)],journal:r,componentPath:o};return this.paused?this.pendingQuerySetModifications.set(h,y):this.querySetVersion=g,{queryToken:u,modification:{type:"ModifyQuerySet",baseVersion:v,newVersion:g,modifications:[y]},unsubscribe:()=>this.removeSubscriber(u)}}}transition(t){for(const n of t.modifications)switch(n.type){case"QueryUpdated":case"QueryFailed":{this.outstandingQueriesOlderThanRestart.delete(n.queryId);const r=n.journal;if(r!==void 0){const o=this.queryIdToToken.get(n.queryId);o!==void 0&&(this.querySet.get(o).journal=r)}break}case"QueryRemoved":{this.outstandingQueriesOlderThanRestart.delete(n.queryId);break}default:throw new Error(`Invalid modification ${n.type}`)}}queryId(t,n){const r=Lo(t),o=Oo(r,n),l=this.querySet.get(o);return l!==void 0?l.id:null}isCurrentOrNewerAuthVersion(t){return t>=this.identityVersion}getAuth(){return this.auth}setAuth(t){this.auth={tokenType:"User",value:t};const n=this.identityVersion;return this.paused||(this.identityVersion=n+1),{type:"Authenticate",baseVersion:n,...this.auth}}setAdminAuth(t,n){const r={tokenType:"Admin",value:t,impersonating:n};this.auth=r;const o=this.identityVersion;return this.paused||(this.identityVersion=o+1),{type:"Authenticate",baseVersion:o,...r}}clearAuth(){this.auth=void 0,this.markAuthCompletion();const t=this.identityVersion;return this.paused||(this.identityVersion=t+1),{type:"Authenticate",tokenType:"None",baseVersion:t}}hasAuth(){return!!this.auth}isNewAuth(t){return this.auth?.value!==t}queryPath(t){const n=this.queryIdToToken.get(t);return n?this.querySet.get(n).canonicalizedUdfPath:null}queryArgs(t){const n=this.queryIdToToken.get(t);return n?this.querySet.get(n).args:null}queryToken(t){return this.queryIdToToken.get(t)??null}queryJournal(t){return this.querySet.get(t)?.journal}restart(t){this.unpause(),this.outstandingQueriesOlderThanRestart.clear();const n=[];for(const l of this.querySet.values()){const u={type:"Add",queryId:l.id,udfPath:l.canonicalizedUdfPath,args:[ks(l.args)],journal:l.journal,componentPath:l.componentPath};n.push(u),t.has(l.id)||this.outstandingQueriesOlderThanRestart.add(l.id)}this.querySetVersion=1;const r={type:"ModifyQuerySet",baseVersion:0,newVersion:1,modifications:n};if(!this.auth)return this.identityVersion=0,[r,void 0];this.outstandingAuthOlderThanRestart=!0;const o={type:"Authenticate",baseVersion:0,...this.auth};return this.identityVersion=1,[r,o]}pause(){this.paused=!0}resume(){const t=this.pendingQuerySetModifications.size>0?{type:"ModifyQuerySet",baseVersion:this.querySetVersion,newVersion:++this.querySetVersion,modifications:Array.from(this.pendingQuerySetModifications.values())}:void 0,n=this.auth!==void 0?{type:"Authenticate",baseVersion:this.identityVersion++,...this.auth}:void 0;return this.unpause(),[t,n]}unpause(){this.paused=!1,this.pendingQuerySetModifications.clear()}removeSubscriber(t){const n=this.querySet.get(t);if(n.numSubscribers>1)return n.numSubscribers-=1,null;{this.querySet.delete(t),this.queryIdToToken.delete(n.id),this.outstandingQueriesOlderThanRestart.delete(n.id);const r=this.querySetVersion,o=this.querySetVersion+1,l={type:"Remove",queryId:n.id};return this.paused?this.pendingQuerySetModifications.has(n.id)?this.pendingQuerySetModifications.delete(n.id):this.pendingQuerySetModifications.set(n.id,l):this.querySetVersion=o,{type:"ModifyQuerySet",baseVersion:r,newVersion:o,modifications:[l]}}}}var CD=Object.defineProperty,ND=(e,t,n)=>t in e?CD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yf=(e,t,n)=>ND(e,typeof t!="symbol"?t+"":t,n);class kD{constructor(t,n){this.logger=t,this.markConnectionStateDirty=n,yf(this,"inflightRequests"),yf(this,"requestsOlderThanRestart"),yf(this,"inflightMutationsCount",0),yf(this,"inflightActionsCount",0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(t,n){const r=new Promise(o=>{const l=n?"Requested":"NotSent";this.inflightRequests.set(t.requestId,{message:t,status:{status:l,requestedAt:new Date,onResult:o}}),t.type==="Mutation"?this.inflightMutationsCount++:t.type==="Action"&&this.inflightActionsCount++});return this.markConnectionStateDirty(),r}onResponse(t){const n=this.inflightRequests.get(t.requestId);if(n===void 0||n.status.status==="Completed")return null;const r=n.message.type==="Mutation"?"mutation":"action",o=n.message.udfPath;for(const h of t.logLines)Kf(this.logger,"info",r,o,h);const l=n.status;let u,d;if(t.success)u={success:!0,logLines:t.logLines,value:fl(t.result)},d=()=>l.onResult(u);else{const h=t.result,{errorData:m}=t;Kf(this.logger,"error",r,o,h),u={success:!1,errorMessage:h,errorData:m!==void 0?fl(m):void 0,logLines:t.logLines},d=()=>l.onResult(u)}return t.type==="ActionResponse"||!t.success?(d(),this.inflightRequests.delete(t.requestId),this.requestsOlderThanRestart.delete(t.requestId),n.message.type==="Action"?this.inflightActionsCount--:n.message.type==="Mutation"&&this.inflightMutationsCount--,this.markConnectionStateDirty(),{requestId:t.requestId,result:u}):(n.status={status:"Completed",result:u,ts:t.ts,onResolve:d},null)}removeCompleted(t){const n=new Map;for(const[r,o]of this.inflightRequests.entries()){const l=o.status;l.status==="Completed"&&l.ts.lessThanOrEqual(t)&&(l.onResolve(),n.set(r,l.result),o.message.type==="Mutation"?this.inflightMutationsCount--:o.message.type==="Action"&&this.inflightActionsCount--,this.inflightRequests.delete(r),this.requestsOlderThanRestart.delete(r))}return n.size>0&&this.markConnectionStateDirty(),n}restart(){this.requestsOlderThanRestart=new Set(this.inflightRequests.keys());const t=[];for(const[n,r]of this.inflightRequests){if(r.status.status==="NotSent"){r.status.status="Requested",t.push(r.message);continue}if(r.message.type==="Mutation")t.push(r.message);else if(r.message.type==="Action"){if(this.inflightRequests.delete(n),this.requestsOlderThanRestart.delete(n),this.inflightActionsCount--,r.status.status==="Completed")throw new Error("Action should never be in 'Completed' state");r.status.onResult({success:!1,errorMessage:"Connection lost while action was in flight",logLines:[]})}}return this.markConnectionStateDirty(),t}resume(){const t=[];for(const[,n]of this.inflightRequests)if(n.status.status==="NotSent"){n.status.status="Requested",t.push(n.message);continue}return t}hasIncompleteRequests(){for(const t of this.inflightRequests.values())if(t.status.status==="Requested")return!0;return!1}hasInflightRequests(){return this.inflightRequests.size>0}hasSyncedPastLastReconnect(){return this.requestsOlderThanRestart.size===0}timeOfOldestInflightRequest(){if(this.inflightRequests.size===0)return null;let t=Date.now();for(const n of this.inflightRequests.values())n.status.status!=="Completed"&&n.status.requestedAt.getTime()<t&&(t=n.status.requestedAt.getTime());return new Date(t)}inflightMutations(){return this.inflightMutationsCount}inflightActions(){return this.inflightActionsCount}}const du=Symbol.for("functionName"),_D=Symbol.for("toReferencePath");function ED(e){return e[_D]??null}function TD(e){return e.startsWith("function://")}function MD(e){let t;if(typeof e=="string")TD(e)?t={functionHandle:e}:t={name:e};else if(e[du])t={name:e[du]};else{const n=ED(e);if(!n)throw new Error(`${e} is not a functionReference`);t={reference:n}}return t}function tr(e){const t=MD(e);if(t.name===void 0)throw t.functionHandle!==void 0?new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`):t.reference!==void 0?new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`):new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`);if(typeof e=="string")return e;const n=e[du];if(!n)throw new Error(`${e} is not a functionReference`);return n}function EN(e){return{[du]:e}}function TN(e=[]){const t={get(n,r){if(typeof r=="string"){const o=[...e,r];return TN(o)}else if(r===du){if(e.length<2){const u=["api",...e].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${u}\``)}const o=e.slice(0,-1).join("/"),l=e[e.length-1];return l==="default"?o:o+":"+l}else return r===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},t)}TN();var RD=Object.defineProperty,AD=(e,t,n)=>t in e?RD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xf=(e,t,n)=>AD(e,typeof t!="symbol"?t+"":t,n);class fu{constructor(t){Xf(this,"queryResults"),Xf(this,"modifiedQueries"),this.queryResults=t,this.modifiedQueries=[]}getQuery(t,...n){const r=na(n[0]),o=tr(t),l=this.queryResults.get(Oo(o,r));if(l!==void 0)return fu.queryValue(l.result)}getAllQueries(t){const n=[],r=tr(t);for(const o of this.queryResults.values())o.udfPath===Lo(r)&&n.push({args:o.args,value:fu.queryValue(o.result)});return n}setQuery(t,n,r){const o=na(n),l=tr(t),u=Oo(l,o);let d;r===void 0?d=void 0:d={success:!0,value:r,logLines:[]};const h={udfPath:l,args:o,result:d};this.queryResults.set(u,h),this.modifiedQueries.push(u)}static queryValue(t){if(t!==void 0)return t.success?t.value:void 0}}class OD{constructor(){Xf(this,"queryResults"),Xf(this,"optimisticUpdates"),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(t,n){this.optimisticUpdates=this.optimisticUpdates.filter(u=>!n.has(u.mutationId));const r=this.queryResults;this.queryResults=new Map(t);const o=new fu(this.queryResults);for(const u of this.optimisticUpdates)u.update(o);const l=[];for(const[u,d]of this.queryResults){const h=r.get(u);(h===void 0||h.result!==d.result)&&l.push(u)}return l}applyOptimisticUpdate(t,n){this.optimisticUpdates.push({update:t,mutationId:n});const r=new fu(this.queryResults);return t(r),r.modifiedQueries}rawQueryResult(t){const n=this.queryResults.get(t);if(n!==void 0)return n.result}queryResult(t){const n=this.queryResults.get(t);if(n===void 0)return;const r=n.result;if(r!==void 0){if(r.success)return r.value;throw r.errorData!==void 0?Xv(r,new Kv(Ji("query",n.udfPath,r))):new Error(Ji("query",n.udfPath,r))}}hasQueryResult(t){return this.queryResults.get(t)!==void 0}queryLogs(t){return this.queryResults.get(t)?.result?.logLines}}var DD=Object.defineProperty,zD=(e,t,n)=>t in e?DD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hg=(e,t,n)=>zD(e,typeof t!="symbol"?t+"":t,n);let Lu=class ta{constructor(t,n){Hg(this,"low"),Hg(this,"high"),Hg(this,"__isUnsignedLong__"),this.low=t|0,this.high=n|0,this.__isUnsignedLong__=!0}static isLong(t){return(t&&t.__isUnsignedLong__)===!0}static fromBytesLE(t){return new ta(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24)}toBytesLE(){const t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]}static fromNumber(t){return isNaN(t)||t<0?P1:t>=PD?LD:new ta(t%su|0,t/su|0)}toString(){return(BigInt(this.high)*BigInt(su)+BigInt(this.low)).toString()}equals(t){return ta.isLong(t)||(t=ta.fromValue(t)),this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low}notEquals(t){return!this.equals(t)}comp(t){return ta.isLong(t)||(t=ta.fromValue(t)),this.equals(t)?0:t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(t){return this.comp(t)<=0}static fromValue(t){return typeof t=="number"?ta.fromNumber(t):new ta(t.low,t.high)}};const P1=new Lu(0,0),L1=65536,su=L1*L1,PD=su*su,LD=new Lu(-1,-1);var ID=Object.defineProperty,$D=(e,t,n)=>t in e?ID(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bf=(e,t,n)=>$D(e,typeof t!="symbol"?t+"":t,n);class I1{constructor(t,n){bf(this,"version"),bf(this,"remoteQuerySet"),bf(this,"queryPath"),bf(this,"logger"),this.version={querySet:0,ts:Lu.fromNumber(0),identity:0},this.remoteQuerySet=new Map,this.queryPath=t,this.logger=n}transition(t){const n=t.startVersion;if(this.version.querySet!==n.querySet||this.version.ts.notEquals(n.ts)||this.version.identity!==n.identity)throw new Error(`Invalid start version: ${n.ts.toString()}:${n.querySet}:${n.identity}, transitioning from ${this.version.ts.toString()}:${this.version.querySet}:${this.version.identity}`);for(const r of t.modifications)switch(r.type){case"QueryUpdated":{const o=this.queryPath(r.queryId);if(o)for(const u of r.logLines)Kf(this.logger,"info","query",o,u);const l=fl(r.value??null);this.remoteQuerySet.set(r.queryId,{success:!0,value:l,logLines:r.logLines});break}case"QueryFailed":{const o=this.queryPath(r.queryId);if(o)for(const u of r.logLines)Kf(this.logger,"info","query",o,u);const{errorData:l}=r;this.remoteQuerySet.set(r.queryId,{success:!1,errorMessage:r.errorMessage,errorData:l!==void 0?fl(l):void 0,logLines:r.logLines});break}case"QueryRemoved":{this.remoteQuerySet.delete(r.queryId);break}default:throw new Error(`Invalid modification ${r.type}`)}this.version=t.endVersion}remoteQueryResults(){return this.remoteQuerySet}timestamp(){return this.version.ts}}function Yg(e){const t=cu(e);return Lu.fromBytesLE(Array.from(t))}function FD(e){const t=new Uint8Array(e.toBytesLE());return uu(t)}function $1(e){switch(e.type){case"FatalError":case"AuthError":case"ActionResponse":case"TransitionChunk":case"Ping":return{...e};case"MutationResponse":return e.success?{...e,ts:Yg(e.ts)}:{...e};case"Transition":return{...e,startVersion:{...e.startVersion,ts:Yg(e.startVersion.ts)},endVersion:{...e.endVersion,ts:Yg(e.endVersion.ts)}}}}function BD(e){switch(e.type){case"Authenticate":case"ModifyQuerySet":case"Mutation":case"Action":case"Event":return{...e};case"Connect":return e.maxObservedTimestamp!==void 0?{...e,maxObservedTimestamp:FD(e.maxObservedTimestamp)}:{...e,maxObservedTimestamp:void 0}}}var UD=Object.defineProperty,qD=(e,t,n)=>t in e?UD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,on=(e,t,n)=>qD(e,typeof t!="symbol"?t+"":t,n);const VD=1e3,HD=1001,YD=1005,WD=4040;let Bf;function Gi(){return Bf===void 0&&(Bf=Date.now()),typeof performance>"u"||!performance.now?Date.now():Math.round(Bf+performance.now())}function F1(){return`t=${Math.round((Gi()-Bf)/100)/10}s`}const MN={InternalServerError:{timeout:1e3},SubscriptionsWorkerFullError:{timeout:3e3},TooManyConcurrentRequests:{timeout:3e3},CommitterFullError:{timeout:3e3},AwsTooManyRequestsException:{timeout:3e3},ExecuteFullError:{timeout:3e3},SystemTimeoutError:{timeout:3e3},ExpiredInQueue:{timeout:3e3},VectorIndexesUnavailable:{timeout:1e3},SearchIndexesUnavailable:{timeout:1e3},TableSummariesUnavailable:{timeout:1e3},VectorIndexTooLarge:{timeout:3e3},SearchIndexTooLarge:{timeout:3e3},TooManyWritesInTimePeriod:{timeout:3e3}};function GD(e){if(e===void 0)return"Unknown";for(const t of Object.keys(MN))if(e.startsWith(t))return t;return"Unknown"}class ZD{constructor(t,n,r,o,l,u){this.markConnectionStateDirty=l,this.debug=u,on(this,"socket"),on(this,"connectionCount"),on(this,"_hasEverConnected",!1),on(this,"lastCloseReason"),on(this,"transitionChunkBuffer",null),on(this,"defaultInitialBackoff"),on(this,"maxBackoff"),on(this,"retries"),on(this,"serverInactivityThreshold"),on(this,"reconnectDueToServerInactivityTimeout"),on(this,"scheduledReconnect",null),on(this,"networkOnlineHandler",null),on(this,"pendingNetworkRecoveryInfo",null),on(this,"uri"),on(this,"onOpen"),on(this,"onResume"),on(this,"onMessage"),on(this,"webSocketConstructor"),on(this,"logger"),on(this,"onServerDisconnectError"),this.webSocketConstructor=r,this.socket={state:"disconnected"},this.connectionCount=0,this.lastCloseReason="InitialConnect",this.defaultInitialBackoff=1e3,this.maxBackoff=16e3,this.retries=0,this.serverInactivityThreshold=6e4,this.reconnectDueToServerInactivityTimeout=null,this.uri=t,this.onOpen=n.onOpen,this.onResume=n.onResume,this.onMessage=n.onMessage,this.onServerDisconnectError=n.onServerDisconnectError,this.logger=o,this.setupNetworkListener(),this.connect()}setSocketState(t){this.socket=t,this._logVerbose(`socket state changed: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}`),this.markConnectionStateDirty()}setupNetworkListener(){typeof window>"u"||typeof window.addEventListener!="function"||this.networkOnlineHandler===null&&(this.networkOnlineHandler=()=>{this._logVerbose("network online event detected"),this.tryReconnectImmediately()},window.addEventListener("online",this.networkOnlineHandler),this._logVerbose("network online event listener registered"))}cleanupNetworkListener(){this.networkOnlineHandler&&typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("online",this.networkOnlineHandler),this.networkOnlineHandler=null,this._logVerbose("network online event listener removed"))}assembleTransition(t){if(t.partNumber<0||t.partNumber>=t.totalParts||t.totalParts===0||this.transitionChunkBuffer&&(this.transitionChunkBuffer.totalParts!==t.totalParts||this.transitionChunkBuffer.transitionId!==t.transitionId))throw this.transitionChunkBuffer=null,new Error("Invalid TransitionChunk");if(this.transitionChunkBuffer===null&&(this.transitionChunkBuffer={chunks:[],totalParts:t.totalParts,transitionId:t.transitionId}),t.partNumber!==this.transitionChunkBuffer.chunks.length){const n=this.transitionChunkBuffer.chunks.length;throw this.transitionChunkBuffer=null,new Error(`TransitionChunk received out of order: expected part ${n}, got ${t.partNumber}`)}if(this.transitionChunkBuffer.chunks.push(t.chunk),this.transitionChunkBuffer.chunks.length===t.totalParts){const n=this.transitionChunkBuffer.chunks.join("");this.transitionChunkBuffer=null;const r=$1(JSON.parse(n));if(r.type!=="Transition")throw new Error(`Expected Transition, got ${r.type} after assembling chunks`);return r}return null}connect(){if(this.socket.state==="terminated")return;if(this.socket.state!=="disconnected"&&this.socket.state!=="stopped")throw new Error("Didn't start connection from disconnected state: "+this.socket.state);const t=new this.webSocketConstructor(this.uri);this._logVerbose("constructed WebSocket"),this.setSocketState({state:"connecting",ws:t,paused:"no"}),this.resetServerInactivityTimeout(),t.onopen=()=>{if(this.logger.logVerbose("begin ws.onopen"),this.socket.state!=="connecting")throw new Error("onopen called with socket not in connecting state");if(this.setSocketState({state:"ready",ws:t,paused:this.socket.paused==="yes"?"uninitialized":"no"}),this.resetServerInactivityTimeout(),this.socket.paused==="no"&&(this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Gi()})),this.lastCloseReason!=="InitialConnect"&&(this.lastCloseReason?this.logger.log("WebSocket reconnected at",F1(),"after disconnect due to",this.lastCloseReason):this.logger.log("WebSocket reconnected at",F1())),this.connectionCount+=1,this.lastCloseReason=null,this.pendingNetworkRecoveryInfo!==null){const{timeSavedMs:n}=this.pendingNetworkRecoveryInfo;this.pendingNetworkRecoveryInfo=null,this.sendMessage({type:"Event",eventType:"NetworkRecoveryReconnect",event:{timeSavedMs:n}}),this.logger.log(`Network recovery reconnect saved ~${Math.round(n/1e3)}s of waiting`)}},t.onerror=n=>{this.transitionChunkBuffer=null;const r=n.message;r&&this.logger.log(`WebSocket error message: ${r}`)},t.onmessage=n=>{this.resetServerInactivityTimeout();const r=n.data.length;let o=$1(JSON.parse(n.data));if(this._logVerbose(`received ws message with type ${o.type}`),o.type==="Ping")return;if(o.type==="TransitionChunk"){const u=this.assembleTransition(o);if(!u)return;o=u,this._logVerbose(`assembled full ws message of type ${o.type}`)}this.transitionChunkBuffer!==null&&(this.transitionChunkBuffer=null,this.logger.log(`Received unexpected ${o.type} while buffering TransitionChunks`)),o.type==="Transition"&&this.reportLargeTransition({messageLength:r,transition:o}),this.onMessage(o).hasSyncedPastLastReconnect&&(this.retries=0,this.markConnectionStateDirty())},t.onclose=n=>{if(this._logVerbose("begin ws.onclose"),this.transitionChunkBuffer=null,this.lastCloseReason===null&&(this.lastCloseReason=n.reason||`closed with code ${n.code}`),n.code!==VD&&n.code!==HD&&n.code!==YD&&n.code!==WD){let o=`WebSocket closed with code ${n.code}`;n.reason&&(o+=`: ${n.reason}`),this.logger.log(o),this.onServerDisconnectError&&n.reason&&this.onServerDisconnectError(o)}const r=GD(n.reason);this.scheduleReconnect(r)}}socketState(){return this.socket.state}sendMessage(t){const n={type:t.type,...t.type==="Authenticate"&&t.tokenType==="User"?{value:`...${t.value.slice(-7)}`}:{}};if(this.socket.state==="ready"&&this.socket.paused==="no"){const r=BD(t),o=JSON.stringify(r);let l=!1;try{this.socket.ws.send(o),l=!0}catch(u){this.logger.log(`Failed to send message on WebSocket, reconnecting: ${u}`),this.closeAndReconnect("FailedToSendMessage")}return this._logVerbose(`${l?"sent":"failed to send"} message with type ${t.type}: ${JSON.stringify(n)}`),!0}return this._logVerbose(`message not sent (socket state: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}): ${JSON.stringify(n)}`),!1}resetServerInactivityTimeout(){this.socket.state!=="terminated"&&(this.reconnectDueToServerInactivityTimeout!==null&&(clearTimeout(this.reconnectDueToServerInactivityTimeout),this.reconnectDueToServerInactivityTimeout=null),this.reconnectDueToServerInactivityTimeout=setTimeout(()=>{this.closeAndReconnect("InactiveServer")},this.serverInactivityThreshold))}scheduleReconnect(t){this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.socket={state:"disconnected"};const n=this.nextBackoff(t);this.markConnectionStateDirty(),this.logger.log(`Attempting reconnect in ${Math.round(n)}ms`);const r=Gi(),o=setTimeout(()=>{this.scheduledReconnect?.timeout===o&&(this.scheduledReconnect=null,this.connect())},n);this.scheduledReconnect={timeout:o,scheduledAt:r,backoffMs:n}}closeAndReconnect(t){switch(this._logVerbose(`begin closeAndReconnect with reason ${t}`),this.socket.state){case"disconnected":case"terminated":case"stopped":return;case"connecting":case"ready":{this.lastCloseReason=t,this.close(),this.scheduleReconnect("client");return}default:this.socket}}close(){switch(this.transitionChunkBuffer=null,this.socket.state){case"disconnected":case"terminated":case"stopped":return Promise.resolve();case"connecting":{const t=this.socket.ws;return t.onmessage=n=>{this._logVerbose("Ignoring message received after close")},new Promise(n=>{t.onclose=()=>{this._logVerbose("Closed after connecting"),n()},t.onopen=()=>{this._logVerbose("Opened after connecting"),t.close()}})}case"ready":{this._logVerbose("ws.close called");const t=this.socket.ws;t.onmessage=r=>{this._logVerbose("Ignoring message received after close")};const n=new Promise(r=>{t.onclose=()=>{r()}});return t.close(),n}default:return this.socket,Promise.resolve()}}terminate(){switch(this.reconnectDueToServerInactivityTimeout&&clearTimeout(this.reconnectDueToServerInactivityTimeout),this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.cleanupNetworkListener(),this.socket.state){case"terminated":case"stopped":case"disconnected":case"connecting":case"ready":{const t=this.close();return this.setSocketState({state:"terminated"}),t}default:throw this.socket,new Error(`Invalid websocket state: ${this.socket.state}`)}}stop(){switch(this.socket.state){case"terminated":return Promise.resolve();case"connecting":case"stopped":case"disconnected":case"ready":{this.cleanupNetworkListener();const t=this.close();return this.socket={state:"stopped"},t}default:return this.socket,Promise.resolve()}}tryRestart(){switch(this.socket.state){case"stopped":break;case"terminated":case"connecting":case"ready":case"disconnected":this.logger.logVerbose("Restart called without stopping first");return;default:this.socket}this.setupNetworkListener(),this.connect()}pause(){switch(this.socket.state){case"disconnected":case"stopped":case"terminated":return;case"connecting":case"ready":{this.socket={...this.socket,paused:"yes"};return}default:{this.socket;return}}}tryReconnectImmediately(){if(this._logVerbose("tryReconnectImmediately called"),this.socket.state!=="disconnected"){this._logVerbose(`tryReconnectImmediately called but socket state is ${this.socket.state}, no action taken`);return}let t=null;if(this.scheduledReconnect){const n=Gi()-this.scheduledReconnect.scheduledAt;t=Math.max(0,this.scheduledReconnect.backoffMs-n),this._logVerbose(`would have waited ${Math.round(t)}ms more (backoff was ${Math.round(this.scheduledReconnect.backoffMs)}ms, elapsed ${Math.round(n)}ms)`),clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null,this._logVerbose("canceled scheduled reconnect")}this.logger.log("Network recovery detected, reconnecting immediately"),this.pendingNetworkRecoveryInfo=t!==null?{timeSavedMs:t}:null,this.connect()}resume(){switch(this.socket.state){case"connecting":this.socket={...this.socket,paused:"no"};return;case"ready":this.socket.paused==="uninitialized"?(this.socket={...this.socket,paused:"no"},this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Gi()})):this.socket.paused==="yes"&&(this.socket={...this.socket,paused:"no"},this.onResume());return;case"terminated":case"stopped":case"disconnected":return;default:this.socket}this.connect()}connectionState(){return{isConnected:this.socket.state==="ready",hasEverConnected:this._hasEverConnected,connectionCount:this.connectionCount,connectionRetries:this.retries}}_logVerbose(t){this.logger.logVerbose(t)}nextBackoff(t){const r=(t==="client"?100:t==="Unknown"?this.defaultInitialBackoff:MN[t].timeout)*Math.pow(2,this.retries);this.retries+=1;const o=Math.min(r,this.maxBackoff),l=o*(Math.random()-.5);return o+l}reportLargeTransition({transition:t,messageLength:n}){if(t.clientClockSkew===void 0||t.serverTs===void 0)return;const r=Gi()-t.clientClockSkew-t.serverTs/1e6,o=`${Math.round(r)}ms`,l=`${Math.round(n/1e4)/100}MB`,u=n/(r/1e3),d=`${Math.round(u/1e4)/100}MB per second`;this._logVerbose(`received ${l} transition in ${o} at ${d}`),n>2e7?this.logger.log(`received query results totaling more that 20MB (${l}) which will take a long time to download on slower connections`):r>2e4&&this.logger.log(`received query results totaling ${l} which took more than 20s to arrive (${o})`),this.debug&&this.sendMessage({type:"Event",eventType:"ClientReceivedTransition",event:{transitionTransitTime:r,messageLength:n}})}}function QD(){return KD()}function KD(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}let Gc=class extends Error{};Gc.prototype.name="InvalidTokenError";function XD(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let r=n.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}function JD(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return XD(t)}catch{return atob(t)}}function RN(e,t){if(typeof e!="string")throw new Gc("Invalid token specified: must be a string");t||(t={});const n=t.header===!0?0:1,r=e.split(".")[n];if(typeof r!="string")throw new Gc(`Invalid token specified: missing part #${n+1}`);let o;try{o=JD(r)}catch(l){throw new Gc(`Invalid token specified: invalid base64 for part #${n+1} (${l.message})`)}try{return JSON.parse(o)}catch(l){throw new Gc(`Invalid token specified: invalid json for part #${n+1} (${l.message})`)}}var ez=Object.defineProperty,tz=(e,t,n)=>t in e?ez(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zr=(e,t,n)=>tz(e,typeof t!="symbol"?t+"":t,n);const nz=480*60*60*1e3,B1=2;class rz{constructor(t,n,r){zr(this,"authState",{state:"noAuth"}),zr(this,"configVersion",0),zr(this,"syncState"),zr(this,"authenticate"),zr(this,"stopSocket"),zr(this,"tryRestartSocket"),zr(this,"pauseSocket"),zr(this,"resumeSocket"),zr(this,"clearAuth"),zr(this,"logger"),zr(this,"refreshTokenLeewaySeconds"),zr(this,"tokenConfirmationAttempts",0),this.syncState=t,this.authenticate=n.authenticate,this.stopSocket=n.stopSocket,this.tryRestartSocket=n.tryRestartSocket,this.pauseSocket=n.pauseSocket,this.resumeSocket=n.resumeSocket,this.clearAuth=n.clearAuth,this.logger=r.logger,this.refreshTokenLeewaySeconds=r.refreshTokenLeewaySeconds}async setConfig(t,n){this.resetAuthState(),this._logVerbose("pausing WS for auth token fetch"),this.pauseSocket();const r=await this.fetchTokenAndGuardAgainstRace(t,{forceRefreshToken:!1});r.isFromOutdatedConfig||(r.value?(this.setAuthState({state:"waitingForServerConfirmationOfCachedToken",config:{fetchToken:t,onAuthChange:n},hasRetried:!1}),this.authenticate(r.value)):(this.setAuthState({state:"initialRefetch",config:{fetchToken:t,onAuthChange:n}}),await this.refetchToken()),this._logVerbose("resuming WS after auth token fetch"),this.resumeSocket())}onTransition(t){if(this.syncState.isCurrentOrNewerAuthVersion(t.endVersion.identity)&&!(t.endVersion.identity<=t.startVersion.identity)){if(this.authState.state==="waitingForServerConfirmationOfCachedToken"){this._logVerbose("server confirmed auth token is valid"),this.refetchToken(),this.authState.config.onAuthChange(!0);return}this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this._logVerbose("server confirmed new auth token is valid"),this.scheduleTokenRefetch(this.authState.token),this.tokenConfirmationAttempts=0,this.authState.hadAuth||this.authState.config.onAuthChange(!0))}}onAuthError(t){if(t.authUpdateAttempted===!1&&(this.authState.state==="waitingForServerConfirmationOfFreshToken"||this.authState.state==="waitingForServerConfirmationOfCachedToken")){this._logVerbose("ignoring non-auth token expired error");return}const{baseVersion:n}=t;if(!this.syncState.isCurrentOrNewerAuthVersion(n+1)){this._logVerbose("ignoring auth error for previous auth attempt");return}this.tryToReauthenticate(t)}async tryToReauthenticate(t){if(this._logVerbose(`attempting to reauthenticate: ${t.error}`),this.authState.state==="noAuth"||this.authState.state==="waitingForServerConfirmationOfFreshToken"&&this.tokenConfirmationAttempts>=B1){this.logger.error(`Failed to authenticate: "${t.error}", check your server auth config`),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.authState.state!=="noAuth"&&this.setAndReportAuthFailed(this.authState.config.onAuthChange);return}this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this.tokenConfirmationAttempts++,this._logVerbose(`retrying reauthentication, ${B1-this.tokenConfirmationAttempts} attempts remaining`)),await this.stopSocket();const n=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});n.isFromOutdatedConfig||(n.value&&this.syncState.isNewAuth(n.value)?(this.authenticate(n.value),this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",config:this.authState.config,token:n.value,hadAuth:this.authState.state==="notRefetching"||this.authState.state==="waitingForScheduledRefetch"})):(this._logVerbose("reauthentication failed, could not fetch a new token"),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this.tryRestartSocket())}async refetchToken(){if(this.authState.state==="noAuth")return;this._logVerbose("refetching auth token");const t=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});t.isFromOutdatedConfig||(t.value?this.syncState.isNewAuth(t.value)?(this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",hadAuth:this.syncState.hasAuth(),token:t.value,config:this.authState.config}),this.authenticate(t.value)):this.setAuthState({state:"notRefetching",config:this.authState.config}):(this._logVerbose("refetching token failed"),this.syncState.hasAuth()&&this.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this._logVerbose("restarting WS after auth token fetch (if currently stopped)"),this.tryRestartSocket())}scheduleTokenRefetch(t){if(this.authState.state==="noAuth")return;const n=this.decodeToken(t);if(!n){this.logger.error("Auth token is not a valid JWT, cannot refetch the token");return}const{iat:r,exp:o}=n;if(!r||!o){this.logger.error("Auth token does not have required fields, cannot refetch the token");return}const l=o-r;if(l<=2){this.logger.error("Auth token does not live long enough, cannot refetch the token");return}let u=Math.min(nz,(l-this.refreshTokenLeewaySeconds)*1e3);u<=0&&(this.logger.warn(`Refetching auth token immediately, configured leeway ${this.refreshTokenLeewaySeconds}s is larger than the token's lifetime ${l}s`),u=0);const d=setTimeout(()=>{this._logVerbose("running scheduled token refetch"),this.refetchToken()},u);this.setAuthState({state:"waitingForScheduledRefetch",refetchTokenTimeoutId:d,config:this.authState.config}),this._logVerbose(`scheduled preemptive auth token refetching in ${u}ms`)}async fetchTokenAndGuardAgainstRace(t,n){const r=++this.configVersion;this._logVerbose(`fetching token with config version ${r}`);const o=await t(n);return this.configVersion!==r?(this._logVerbose(`stale config version, expected ${r}, got ${this.configVersion}`),{isFromOutdatedConfig:!0}):{isFromOutdatedConfig:!1,value:o}}stop(){this.resetAuthState(),this.configVersion++,this._logVerbose(`config version bumped to ${this.configVersion}`)}setAndReportAuthFailed(t){t(!1),this.resetAuthState()}resetAuthState(){this.setAuthState({state:"noAuth"})}setAuthState(t){const n=t.state==="waitingForServerConfirmationOfFreshToken"?{hadAuth:t.hadAuth,state:t.state,token:`...${t.token.slice(-7)}`}:{state:t.state};switch(this._logVerbose(`setting auth state to ${JSON.stringify(n)}`),t.state){case"waitingForScheduledRefetch":case"notRefetching":case"noAuth":this.tokenConfirmationAttempts=0;break}this.authState.state==="waitingForScheduledRefetch"&&(clearTimeout(this.authState.refetchTokenTimeoutId),this.syncState.markAuthCompletion()),this.authState=t}decodeToken(t){try{return RN(t)}catch(n){return this._logVerbose(`Error decoding token: ${n instanceof Error?n.message:"Unknown error"}`),null}}_logVerbose(t){this.logger.logVerbose(`${t} [v${this.configVersion}]`)}}const sz=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function az(e,t){const n={sessionId:t};typeof performance>"u"||!performance.mark||performance.mark(e,{detail:n})}function oz(e){let t=e.name.slice(6);return t=t.charAt(0).toLowerCase()+t.slice(1),{name:t,startTime:e.startTime}}function iz(e){if(typeof performance>"u"||!performance.getEntriesByName)return[];const t=[];for(const n of sz){const r=performance.getEntriesByName(n).filter(o=>o.entryType==="mark").filter(o=>o.detail.sessionId===e);t.push(...r)}return t.map(oz)}var lz=Object.defineProperty,cz=(e,t,n)=>t in e?lz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ln=(e,t,n)=>cz(e,typeof t!="symbol"?t+"":t,n);class uz{constructor(t,n,r){if(ln(this,"address"),ln(this,"state"),ln(this,"requestManager"),ln(this,"webSocketManager"),ln(this,"authenticationManager"),ln(this,"remoteQuerySet"),ln(this,"optimisticQueryResults"),ln(this,"_transitionHandlerCounter",0),ln(this,"_nextRequestId"),ln(this,"_onTransitionFns",new Map),ln(this,"_sessionId"),ln(this,"firstMessageReceived",!1),ln(this,"debug"),ln(this,"logger"),ln(this,"maxObservedTimestamp"),ln(this,"connectionStateSubscribers",new Map),ln(this,"nextConnectionStateSubscriberId",0),ln(this,"_lastPublishedConnectionState"),ln(this,"markConnectionStateDirty",()=>{Promise.resolve().then(()=>{const w=this.connectionState();if(JSON.stringify(w)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=w;for(const S of this.connectionStateSubscribers.values())S(w)}})}),ln(this,"mark",w=>{this.debug&&az(w,this.sessionId)}),typeof t=="object")throw new Error("Passing a ClientConfig object is no longer supported. Pass the URL of the Convex deployment as a string directly.");r?.skipConvexDeploymentUrlCheck!==!0&&aD(t),r={...r};const o=r.authRefreshTokenLeewaySeconds??2;let l=r.webSocketConstructor;if(!l&&typeof WebSocket>"u")throw new Error("No WebSocket global variable defined! To use Convex in an environment without WebSocket try the HTTP client: https://docs.convex.dev/api/classes/browser.ConvexHttpClient");l=l||WebSocket,this.debug=r.reportDebugInfoToConvex??!1,this.address=t,this.logger=r.logger===!1?_N({verbose:r.verbose??!1}):r.logger!==!0&&r.logger?r.logger:kN({verbose:r.verbose??!1});const u=t.search("://");if(u===-1)throw new Error("Provided address was not an absolute URL.");const d=t.substring(u+3),h=t.substring(0,u);let m;if(h==="http")m="ws";else if(h==="https")m="wss";else throw new Error(`Unknown parent protocol ${h}`);const v=`${m}://${d}/api/${O1}/sync`;this.state=new jD,this.remoteQuerySet=new I1(w=>this.state.queryPath(w),this.logger),this.requestManager=new kD(this.logger,this.markConnectionStateDirty);const g=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new rz(this.state,{authenticate:w=>{const S=this.state.setAuth(w);return this.webSocketManager.sendMessage(S),S.baseVersion},stopSocket:()=>this.webSocketManager.stop(),tryRestartSocket:()=>this.webSocketManager.tryRestart(),pauseSocket:g,resumeSocket:()=>this.webSocketManager.resume(),clearAuth:()=>{this.clearAuth()}},{logger:this.logger,refreshTokenLeewaySeconds:o}),this.optimisticQueryResults=new OD,this.addOnTransitionHandler(w=>{n(w.queries.map(S=>S.token))}),this._nextRequestId=0,this._sessionId=QD();const{unsavedChangesWarning:y}=r;if(typeof window>"u"||typeof window.addEventListener>"u"){if(y===!0)throw new Error("unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.")}else y!==!1&&window.addEventListener("beforeunload",w=>{if(this.requestManager.hasIncompleteRequests()){w.preventDefault();const S="Are you sure you want to leave? Your changes may not be saved.";return(w||window.event).returnValue=S,S}});this.webSocketManager=new ZD(v,{onOpen:w=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({...w,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp});const S=new Set(this.remoteQuerySet.remoteQueryResults().keys());this.remoteQuerySet=new I1(C=>this.state.queryPath(C),this.logger);const[j,N]=this.state.restart(S);N&&this.webSocketManager.sendMessage(N),this.webSocketManager.sendMessage(j);for(const C of this.requestManager.restart())this.webSocketManager.sendMessage(C)},onResume:()=>{const[w,S]=this.state.resume();S&&this.webSocketManager.sendMessage(S),w&&this.webSocketManager.sendMessage(w);for(const j of this.requestManager.resume())this.webSocketManager.sendMessage(j)},onMessage:w=>{switch(this.firstMessageReceived||(this.firstMessageReceived=!0,this.mark("convexFirstMessageReceived"),this.reportMarks()),w.type){case"Transition":{this.observedTimestamp(w.endVersion.ts),this.authenticationManager.onTransition(w),this.remoteQuerySet.transition(w),this.state.transition(w);const S=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(S);break}case"MutationResponse":{w.success&&this.observedTimestamp(w.ts);const S=this.requestManager.onResponse(w);S!==null&&this.notifyOnQueryResultChanges(new Map([[S.requestId,S.result]]));break}case"ActionResponse":{this.requestManager.onResponse(w);break}case"AuthError":{this.authenticationManager.onAuthError(w);break}case"FatalError":{const S=bD(this.logger,w.error);throw this.webSocketManager.terminate(),S}}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:r.onServerDisconnectError},l,this.logger,this.markConnectionStateDirty,this.debug),this.mark("convexClientConstructed"),r.expectAuth&&g()}hasSyncedPastLastReconnect(){return this.requestManager.hasSyncedPastLastReconnect()||this.state.hasSyncedPastLastReconnect()}observedTimestamp(t){(this.maxObservedTimestamp===void 0||this.maxObservedTimestamp.lessThanOrEqual(t))&&(this.maxObservedTimestamp=t)}getMaxObservedTimestamp(){return this.maxObservedTimestamp}notifyOnQueryResultChanges(t){const n=this.remoteQuerySet.remoteQueryResults(),r=new Map;for(const[l,u]of n){const d=this.state.queryToken(l);if(d!==null){const h={result:u,udfPath:this.state.queryPath(l),args:this.state.queryArgs(l)};r.set(d,h)}}const o=this.optimisticQueryResults.ingestQueryResultsFromServer(r,new Set(t.keys()));this.handleTransition({queries:o.map(l=>{const u=this.optimisticQueryResults.rawQueryResult(l);return{token:l,modification:{kind:"Updated",result:u}}}),reflectedMutations:Array.from(t).map(([l,u])=>({requestId:l,result:u})),timestamp:this.remoteQuerySet.timestamp()})}handleTransition(t){for(const n of this._onTransitionFns.values())n(t)}addOnTransitionHandler(t){const n=this._transitionHandlerCounter++;return this._onTransitionFns.set(n,t),()=>this._onTransitionFns.delete(n)}getCurrentAuthClaims(){const t=this.state.getAuth();let n={};if(t&&t.tokenType==="User")try{n=t?RN(t.value):{}}catch{n={}}else return;return{token:t.value,decoded:n}}setAuth(t,n){this.authenticationManager.setConfig(t,n)}hasAuth(){return this.state.hasAuth()}setAdminAuth(t,n){const r=this.state.setAdminAuth(t,n);this.webSocketManager.sendMessage(r)}clearAuth(){const t=this.state.clearAuth();this.webSocketManager.sendMessage(t)}subscribe(t,n,r){const o=na(n),{modification:l,queryToken:u,unsubscribe:d}=this.state.subscribe(t,o,r?.journal,r?.componentPath);return l!==null&&this.webSocketManager.sendMessage(l),{queryToken:u,unsubscribe:()=>{const h=d();h&&this.webSocketManager.sendMessage(h)}}}localQueryResult(t,n){const r=na(n),o=Oo(t,r);return this.optimisticQueryResults.queryResult(o)}localQueryResultByToken(t){return this.optimisticQueryResults.queryResult(t)}hasLocalQueryResultByToken(t){return this.optimisticQueryResults.hasQueryResult(t)}localQueryLogs(t,n){const r=na(n),o=Oo(t,r);return this.optimisticQueryResults.queryLogs(o)}queryJournal(t,n){const r=na(n),o=Oo(t,r);return this.state.queryJournal(o)}connectionState(){const t=this.webSocketManager.connectionState();return{hasInflightRequests:this.requestManager.hasInflightRequests(),isWebSocketConnected:t.isConnected,hasEverConnected:t.hasEverConnected,connectionCount:t.connectionCount,connectionRetries:t.connectionRetries,timeOfOldestInflightRequest:this.requestManager.timeOfOldestInflightRequest(),inflightMutations:this.requestManager.inflightMutations(),inflightActions:this.requestManager.inflightActions()}}subscribeToConnectionState(t){const n=this.nextConnectionStateSubscriberId++;return this.connectionStateSubscribers.set(n,t),()=>{this.connectionStateSubscribers.delete(n)}}async mutation(t,n,r){const o=await this.mutationInternal(t,n,r);if(!o.success)throw o.errorData!==void 0?Xv(o,new Kv(Ji("mutation",t,o))):new Error(Ji("mutation",t,o));return o.value}async mutationInternal(t,n,r,o){const{mutationPromise:l}=this.enqueueMutation(t,n,r,o);return l}enqueueMutation(t,n,r,o){const l=na(n);this.tryReportLongDisconnect();const u=this.nextRequestId;if(this._nextRequestId++,r!==void 0){const v=r.optimisticUpdate;if(v!==void 0){const g=S=>{v(S,l)instanceof Promise&&this.logger.warn("Optimistic update handler returned a Promise. Optimistic updates should be synchronous.")},w=this.optimisticQueryResults.applyOptimisticUpdate(g,u).map(S=>{const j=this.localQueryResultByToken(S);return{token:S,modification:{kind:"Updated",result:j===void 0?void 0:{success:!0,value:j,logLines:[]}}}});this.handleTransition({queries:w,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}const d={type:"Mutation",requestId:u,udfPath:t,componentPath:o,args:[ks(l)]},h=this.webSocketManager.sendMessage(d),m=this.requestManager.request(d,h);return{requestId:u,mutationPromise:m}}async action(t,n){const r=await this.actionInternal(t,n);if(!r.success)throw r.errorData!==void 0?Xv(r,new Kv(Ji("action",t,r))):new Error(Ji("action",t,r));return r.value}async actionInternal(t,n,r){const o=na(n),l=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();const u={type:"Action",requestId:l,udfPath:t,componentPath:r,args:[ks(o)]},d=this.webSocketManager.sendMessage(u);return this.requestManager.request(u,d)}async close(){return this.authenticationManager.stop(),this.webSocketManager.terminate()}get url(){return this.address}get nextRequestId(){return this._nextRequestId}get sessionId(){return this._sessionId}reportMarks(){if(this.debug){const t=iz(this.sessionId);this.webSocketManager.sendMessage({type:"Event",eventType:"ClientConnect",event:t})}}tryReportLongDisconnect(){if(!this.debug)return;const t=this.connectionState().timeOfOldestInflightRequest;if(t===null||Date.now()-t.getTime()<=60*1e3)return;const n=`${this.address}/api/debug_event`;fetch(n,{method:"POST",headers:{"Content-Type":"application/json","Convex-Client":`npm-${O1}`},body:JSON.stringify({event:"LongWebsocketDisconnect"})}).then(r=>{r.ok||this.logger.warn("Analytics request failed with response:",r.body)}).catch(r=>{this.logger.warn("Analytics response failed with error:",r)})}}function Wg(e){if(typeof e!="object"||e===null||!Array.isArray(e.page)||typeof e.isDone!="boolean"||typeof e.continueCursor!="string")throw new Error(`Not a valid paginated query result: ${e?.toString()}`);return e}var dz=Object.defineProperty,fz=(e,t,n)=>t in e?dz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U1=(e,t,n)=>fz(e,typeof t!="symbol"?t+"":t,n);class hz{constructor(t,n){this.client=t,this.onTransition=n,U1(this,"paginatedQuerySet",new Map),U1(this,"lastTransitionTs"),this.lastTransitionTs=Lu.fromNumber(0),this.client.addOnTransitionHandler(r=>this.onBaseTransition(r))}subscribe(t,n,r){const o=Lo(t),l=z1(o,n,r),u=()=>this.removePaginatedQuerySubscriber(l),d=this.paginatedQuerySet.get(l);return d?(d.numSubscribers+=1,{paginatedQueryToken:l,unsubscribe:u}):(this.paginatedQuerySet.set(l,{token:l,canonicalizedUdfPath:o,args:n,numSubscribers:1,options:{initialNumItems:r.initialNumItems},nextPageKey:0,pageKeys:[],pageKeyToQuery:new Map,ongoingSplits:new Map,skip:!1,id:r.id}),this.addPageToPaginatedQuery(l,null,r.initialNumItems),{paginatedQueryToken:l,unsubscribe:u})}localQueryResult(t,n,r){const o=Lo(t),l=z1(o,n,r);return this.localQueryResultByToken(l)}localQueryResultByToken(t){const n=this.paginatedQuerySet.get(t);if(!n)return;const r=this.activePageQueryTokens(n);if(r.length===0)return{results:[],status:"LoadingFirstPage",loadMore:h=>this.loadMoreOfPaginatedQuery(t,h)};let o=[],l=!1,u=!1;for(const h of r){const m=this.client.localQueryResultByToken(h);if(m===void 0){l=!0,u=!1;continue}const v=Wg(m);o=o.concat(v.page),u=!!v.isDone}let d;return l?d=o.length===0?"LoadingFirstPage":"LoadingMore":u?d="Exhausted":d="CanLoadMore",{results:o,status:d,loadMore:h=>this.loadMoreOfPaginatedQuery(t,h)}}onBaseTransition(t){const n=t.queries.map(u=>u.token),r=this.queriesContainingTokens(n);let o=[];r.length>0&&(this.processPaginatedQuerySplits(r,u=>this.client.localQueryResultByToken(u)),o=r.map(u=>({token:u,modification:{kind:"Updated",result:this.localQueryResultByToken(u)}})));const l={...t,paginatedQueries:o};this.onTransition(l)}loadMoreOfPaginatedQuery(t,n){this.mustGetPaginatedQuery(t);const r=this.queryTokenForLastPageOfPaginatedQuery(t),o=this.client.localQueryResultByToken(r);if(!o)return!1;const l=Wg(o);if(l.isDone)return!1;this.addPageToPaginatedQuery(t,l.continueCursor,n);const u={timestamp:this.lastTransitionTs,reflectedMutations:[],queries:[],paginatedQueries:[{token:t,modification:{kind:"Updated",result:this.localQueryResultByToken(t)}}]};return this.onTransition(u),!0}queriesContainingTokens(t){if(t.length===0)return[];const n=[],r=new Set(t);for(const[o,l]of this.paginatedQuerySet)for(const u of this.allQueryTokens(l))if(r.has(u)){n.push(o);break}return n}processPaginatedQuerySplits(t,n){for(const r of t){const o=this.mustGetPaginatedQuery(r),{ongoingSplits:l,pageKeyToQuery:u,pageKeys:d}=o;for(const[h,[m,v]]of l)n(u.get(m).queryToken)!==void 0&&n(u.get(v).queryToken)!==void 0&&this.completePaginatedQuerySplit(o,h,m,v);for(const h of d){if(l.has(h))continue;const m=u.get(h).queryToken,v=n(m);if(!v)continue;const g=Wg(v);g.splitCursor&&(g.pageStatus==="SplitRecommended"||g.pageStatus==="SplitRequired"||g.page.length>o.options.initialNumItems*2)&&this.splitPaginatedQueryPage(o,h,g.splitCursor,g.continueCursor)}}}splitPaginatedQueryPage(t,n,r,o){const l=t.nextPageKey++,u=t.nextPageKey++,d={cursor:o,numItems:t.options.initialNumItems,id:t.id},h=this.client.subscribe(t.canonicalizedUdfPath,{...t.args,paginationOpts:{...d,cursor:null,endCursor:r}});t.pageKeyToQuery.set(l,h);const m=this.client.subscribe(t.canonicalizedUdfPath,{...t.args,paginationOpts:{...d,cursor:r,endCursor:o}});t.pageKeyToQuery.set(u,m),t.ongoingSplits.set(n,[l,u])}addPageToPaginatedQuery(t,n,r){const o=this.mustGetPaginatedQuery(t),l=o.nextPageKey++,u={cursor:n,numItems:r,id:o.id},d={...o.args,paginationOpts:u},h=this.client.subscribe(o.canonicalizedUdfPath,d);return o.pageKeys.push(l),o.pageKeyToQuery.set(l,h),h}removePaginatedQuerySubscriber(t){const n=this.paginatedQuerySet.get(t);if(n&&(n.numSubscribers-=1,!(n.numSubscribers>0))){for(const r of n.pageKeyToQuery.values())r.unsubscribe();this.paginatedQuerySet.delete(t)}}completePaginatedQuerySplit(t,n,r,o){const l=t.pageKeyToQuery.get(n);t.pageKeyToQuery.delete(n);const u=t.pageKeys.indexOf(n);t.pageKeys.splice(u,1,r,o),t.ongoingSplits.delete(n),l.unsubscribe()}activePageQueryTokens(t){return t.pageKeys.map(n=>t.pageKeyToQuery.get(n).queryToken)}allQueryTokens(t){return Array.from(t.pageKeyToQuery.values()).map(n=>n.queryToken)}queryTokenForLastPageOfPaginatedQuery(t){const n=this.mustGetPaginatedQuery(t),r=n.pageKeys[n.pageKeys.length-1];if(r===void 0)throw new Error(`No pages for paginated query ${t}`);return n.pageKeyToQuery.get(r).queryToken}mustGetPaginatedQuery(t){const n=this.paginatedQuerySet.get(t);if(!n)throw new Error("paginated query no longer exists for token "+t);return n}}function mz({getCurrentValue:e,subscribe:t}){const[n,r]=p.useState(()=>({getCurrentValue:e,subscribe:t,value:e()}));let o=n.value;return(n.getCurrentValue!==e||n.subscribe!==t)&&(o=e(),r({getCurrentValue:e,subscribe:t,value:o})),p.useEffect(()=>{let l=!1;const u=()=>{l||r(h=>{if(h.getCurrentValue!==e||h.subscribe!==t)return h;const m=e();return h.value===m?h:{...h,value:m}})},d=t(u);return u(),()=>{l=!0,d()}},[e,t]),o}var pz=Object.defineProperty,gz=(e,t,n)=>t in e?pz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xs=(e,t,n)=>gz(e,typeof t!="symbol"?t+"":t,n);const vz=5e3;if(typeof ee>"u")throw new Error("Required dependency 'react' not found");function AN(e,t,n){function r(o){return wz(o),t.mutation(e,o,{optimisticUpdate:n})}return r.withOptimisticUpdate=function(l){if(n!==void 0)throw new Error(`Already specified optimistic update for mutation ${tr(e)}`);return AN(e,t,l)},r}class xz{constructor(t,n){if(Xs(this,"address"),Xs(this,"cachedSync"),Xs(this,"cachedPaginatedQueryClient"),Xs(this,"listeners"),Xs(this,"options"),Xs(this,"closed",!1),Xs(this,"_logger"),Xs(this,"adminAuth"),Xs(this,"fakeUserIdentity"),t===void 0)throw new Error("No address provided to ConvexReactClient.\nIf trying to deploy to production, make sure to follow all the instructions found at https://docs.convex.dev/production/hosting/\nIf running locally, make sure to run `convex dev` and ensure the .env.local file is populated.");if(typeof t!="string")throw new Error(`ConvexReactClient requires a URL like 'https://happy-otter-123.convex.cloud', received something of type ${typeof t} instead.`);if(!t.includes("://"))throw new Error("Provided address was not an absolute URL.");this.address=t,this.listeners=new Map,this._logger=n?.logger===!1?_N({verbose:n?.verbose??!1}):n?.logger!==!0&&n?.logger?n.logger:kN({verbose:n?.verbose??!1}),this.options={...n,logger:this._logger}}get url(){return this.address}get sync(){if(this.closed)throw new Error("ConvexReactClient has already been closed.");return this.cachedSync?this.cachedSync:(this.cachedSync=new uz(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new hz(this.cachedSync,t=>this.handleTransition(t)),this.cachedSync)}get paginatedQueryClient(){if(this.sync,this.cachedPaginatedQueryClient)return this.cachedPaginatedQueryClient;throw new Error("Should already be instantiated")}setAuth(t,n){if(typeof t=="string")throw new Error("Passing a string to ConvexReactClient.setAuth is no longer supported, please upgrade to passing in an async function to handle reauthentication.");this.sync.setAuth(t,n??(()=>{}))}clearAuth(){this.sync.clearAuth()}setAdminAuth(t,n){if(this.adminAuth=t,this.fakeUserIdentity=n,this.closed)throw new Error("ConvexReactClient has already been closed.");this.cachedSync&&this.sync.setAdminAuth(t,n)}watchQuery(t,...n){const[r,o]=n,l=tr(t);return{onUpdate:u=>{const{queryToken:d,unsubscribe:h}=this.sync.subscribe(l,r,o),m=this.listeners.get(d);return m!==void 0?m.add(u):this.listeners.set(d,new Set([u])),()=>{if(this.closed)return;const v=this.listeners.get(d);v.delete(u),v.size===0&&this.listeners.delete(d),h()}},localQueryResult:()=>{if(this.cachedSync)return this.cachedSync.localQueryResult(l,r)},localQueryLogs:()=>{if(this.cachedSync)return this.cachedSync.localQueryLogs(l,r)},journal:()=>{if(this.cachedSync)return this.cachedSync.queryJournal(l,r)}}}prewarmQuery(t){const n=t.extendSubscriptionFor??vz,o=this.watchQuery(t.query,t.args||{}).onUpdate(()=>{});setTimeout(o,n)}watchPaginatedQuery(t,n,r){const o=tr(t);return{onUpdate:l=>{const{paginatedQueryToken:u,unsubscribe:d}=this.paginatedQueryClient.subscribe(o,n||{},r),h=this.listeners.get(u);return h!==void 0?h.add(l):this.listeners.set(u,new Set([l])),()=>{if(this.closed)return;const m=this.listeners.get(u);m.delete(l),m.size===0&&this.listeners.delete(u),d()}},localQueryResult:()=>this.paginatedQueryClient.localQueryResult(o,n,r)}}mutation(t,...n){const[r,o]=n,l=tr(t);return this.sync.mutation(l,r,o)}action(t,...n){const r=tr(t);return this.sync.action(r,...n)}query(t,...n){const r=this.watchQuery(t,...n),o=r.localQueryResult();return o!==void 0?Promise.resolve(o):new Promise((l,u)=>{const d=r.onUpdate(()=>{d();try{l(r.localQueryResult())}catch(h){u(h)}})})}connectionState(){return this.sync.connectionState()}subscribeToConnectionState(t){return this.sync.subscribeToConnectionState(t)}get logger(){return this._logger}async close(){if(this.closed=!0,this.listeners=new Map,this.cachedPaginatedQueryClient&&(this.cachedPaginatedQueryClient=void 0),this.cachedSync){const t=this.cachedSync;this.cachedSync=void 0,await t.close()}}handleTransition(t){const n=t.queries.map(o=>o.token),r=t.paginatedQueries.map(o=>o.token);this.transition([...n,...r])}transition(t){for(const n of t){const r=this.listeners.get(n);if(r)for(const o of r)o()}}}const Dx=ee.createContext(void 0);function yz(){return p.useContext(Dx)}const bz=({client:e,children:t})=>ee.createElement(Dx.Provider,{value:e},t);function He(e,...t){const n=t[0]==="skip",r=t[0]==="skip"?{}:na(t[0]),o=typeof e=="string"?EN(e):e,l=tr(o),u=p.useMemo(()=>n?{}:{query:{query:o,args:r}},[JSON.stringify(ks(r)),l,n]),h=Nz(u).query;if(h instanceof Error)throw h;return h}function et(e){const t=typeof e=="string"?EN(e):e,n=p.useContext(Dx);if(n===void 0)throw new Error("Could not find Convex client! `useMutation` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return p.useMemo(()=>AN(t,n),[n,tr(t)])}function wz(e){if(typeof e=="object"&&e!==null&&"bubbles"in e&&"persist"in e&&"isDefaultPrevented"in e)throw new Error("Convex function called with SyntheticEvent object. Did you use a Convex function as an event handler directly? Event handlers like onClick receive an event object as their first argument. These SyntheticEvent objects are not valid Convex values. Try wrapping the function like `const handler = () => myMutation();` and using `handler` in the event handler.")}var Sz=Object.defineProperty,jz=(e,t,n)=>t in e?Sz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gg=(e,t,n)=>jz(e,typeof t!="symbol"?t+"":t,n);class Cz{constructor(t){Gg(this,"createWatch"),Gg(this,"queries"),Gg(this,"listeners"),this.createWatch=t,this.queries={},this.listeners=new Set}setQueries(t){for(const n of Object.keys(t)){const{query:r,args:o,paginationOptions:l}=t[n];if(tr(r),this.queries[n]===void 0)this.addQuery(n,r,o,l?{paginationOptions:l}:{});else{const u=this.queries[n];(tr(r)!==tr(u.query)||JSON.stringify(ks(o))!==JSON.stringify(ks(u.args))||JSON.stringify(l)!==JSON.stringify(u.paginationOptions))&&(this.removeQuery(n),this.addQuery(n,r,o,l?{paginationOptions:l}:{}))}}for(const n of Object.keys(this.queries))t[n]===void 0&&this.removeQuery(n)}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}getLocalResults(t){const n={};for(const r of Object.keys(t)){const{query:o,args:l}=t[r],u=t[r].paginationOptions;tr(o);const d=this.createWatch(o,l,u?{paginationOptions:u}:{});let h;try{h=d.localQueryResult()}catch(m){if(m instanceof Error)h=m;else throw m}n[r]=h}return n}setCreateWatch(t){this.createWatch=t;for(const n of Object.keys(this.queries)){const{query:r,args:o,watch:l,paginationOptions:u}=this.queries[n],d="journal"in l?l.journal():void 0;this.removeQuery(n),this.addQuery(n,r,o,{...d?{journal:d}:[],...u?{paginationOptions:u}:{}})}}destroy(){for(const t of Object.keys(this.queries))this.removeQuery(t);this.listeners=new Set}addQuery(t,n,r,{paginationOptions:o,journal:l}){if(this.queries[t]!==void 0)throw new Error(`Tried to add a new query with identifier ${t} when it already exists.`);const u=this.createWatch(n,r,{...l?{journal:l}:[],...o?{paginationOptions:o}:{}}),d=u.onUpdate(()=>this.notifyListeners());this.queries[t]={query:n,args:r,watch:u,unsubscribe:d,...o?{paginationOptions:o}:{}}}removeQuery(t){const n=this.queries[t];if(n===void 0)throw new Error(`No query found with identifier ${t}.`);n.unsubscribe(),delete this.queries[t]}notifyListeners(){for(const t of this.listeners)t()}}function Nz(e){const t=yz();if(t===void 0)throw new Error("Could not find Convex client! `useQuery` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");const n=p.useMemo(()=>(r,o,{journal:l,paginationOptions:u})=>u?t.watchPaginatedQuery(r,o,u):t.watchQuery(r,o,l?{journal:l}:{}),[t]);return kz(e,n)}function kz(e,t){const[n]=p.useState(()=>new Cz(t));n.createWatch!==t&&n.setCreateWatch(t),p.useEffect(()=>()=>n.destroy(),[n]);const r=p.useMemo(()=>({getCurrentValue:()=>n.getLocalResults(e),subscribe:o=>(n.setQueries(e),n.subscribe(o))}),[n,e]);return mz(r)}const Jv=new WeakMap,_z=new WeakMap,Jf={current:[]};let Zg=!1,au=0;const Zc=new Set,wf=new Map;function ON(e){for(const t of e){if(Jf.current.includes(t))continue;Jf.current.push(t),t.recompute();const n=_z.get(t);if(n)for(const r of n){const o=Jv.get(r);o?.length&&ON(o)}}}function Ez(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Tz(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function DN(e){if(au>0&&!wf.has(e)&&wf.set(e,e.prevState),Zc.add(e),!(au>0)&&!Zg)try{for(Zg=!0;Zc.size>0;){const t=Array.from(Zc);Zc.clear();for(const n of t){const r=wf.get(n)??n.prevState;n.prevState=r,Ez(n)}for(const n of t){const r=Jv.get(n);r&&(Jf.current.push(n),ON(r))}for(const n of t){const r=Jv.get(n);if(r)for(const o of r)Tz(o)}}}finally{Zg=!1,Jf.current=[],wf.clear()}}function Mz(e){au++;try{e()}finally{if(au--,au===0){const t=Zc.values().next().value;t&&DN(t)}}}function Rz(e){return typeof e=="function"}class Az{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,l;this.listeners.add(r);const u=(l=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:l.call(o,r,this);return()=>{this.listeners.delete(r),u?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):Rz(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),DN(this)}}const Ha="__TSR_index",q1="popstate",V1="beforeunload";function Oz(e){let t=e.getLocation();const n=new Set,r=u=>{t=e.getLocation(),n.forEach(d=>d({location:t,action:u}))},o=u=>{e.notifyOnIndexChange??!0?r(u):t=e.getLocation()},l=async({task:u,navigateOpts:d,...h})=>{if(d?.ignoreBlocker??!1){u();return}const v=e.getBlockers?.()??[],g=h.type==="PUSH"||h.type==="REPLACE";if(typeof document<"u"&&v.length&&g)for(const y of v){const w=eh(h.path,h.state);if(await y.blockerFn({currentLocation:t,nextLocation:w,action:h.type})){e.onBlocked?.();return}}u()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:u=>(n.add(u),()=>{n.delete(u)}),push:(u,d,h)=>{const m=t.state[Ha];d=H1(m+1,d),l({task:()=>{e.pushState(u,d),r({type:"PUSH"})},navigateOpts:h,type:"PUSH",path:u,state:d})},replace:(u,d,h)=>{const m=t.state[Ha];d=H1(m,d),l({task:()=>{e.replaceState(u,d),r({type:"REPLACE"})},navigateOpts:h,type:"REPLACE",path:u,state:d})},go:(u,d)=>{l({task:()=>{e.go(u),o({type:"GO",index:u})},navigateOpts:d,type:"GO"})},back:u=>{l({task:()=>{e.back(u?.ignoreBlocker??!1),o({type:"BACK"})},navigateOpts:u,type:"BACK"})},forward:u=>{l({task:()=>{e.forward(u?.ignoreBlocker??!1),o({type:"FORWARD"})},navigateOpts:u,type:"FORWARD"})},canGoBack:()=>t.state[Ha]!==0,createHref:u=>e.createHref(u),block:u=>{if(!e.setBlockers)return()=>{};const d=e.getBlockers?.()??[];return e.setBlockers([...d,u]),()=>{const h=e.getBlockers?.()??[];e.setBlockers?.(h.filter(m=>m!==u))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function H1(e,t){t||(t={});const n=zx();return{...t,key:n,__TSR_key:n,[Ha]:e}}function Dz(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,r=t.history.replaceState;let o=[];const l=()=>o,u=O=>o=O,d=(O=>O),h=(()=>eh(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const O=zx();t.history.replaceState({[Ha]:0,key:O,__TSR_key:O},"")}let m=h(),v,g=!1,y=!1,w=!1,S=!1;const j=()=>m;let N,C;const _=()=>{N&&(T._ignoreSubscribers=!0,(N.isPush?t.history.pushState:t.history.replaceState)(N.state,"",N.href),T._ignoreSubscribers=!1,N=void 0,C=void 0,v=void 0)},E=(O,D,z)=>{const B=d(D);C||(v=m),m=eh(D,z),N={href:B,state:z,isPush:N?.isPush||O==="push"},C||(C=Promise.resolve().then(()=>_()))},M=O=>{m=h(),T.notify({type:O})},A=async()=>{if(y){y=!1;return}const O=h(),D=O.state[Ha]-m.state[Ha],z=D===1,B=D===-1,V=!z&&!B||g;g=!1;const Y=V?"GO":B?"BACK":"FORWARD",G=V?{type:"GO",index:D}:{type:B?"BACK":"FORWARD"};if(w)w=!1;else{const ae=l();if(typeof document<"u"&&ae.length){for(const L of ae)if(await L.blockerFn({currentLocation:m,nextLocation:O,action:Y})){y=!0,t.history.go(1),T.notify(G);return}}}m=h(),T.notify(G)},R=O=>{if(S){S=!1;return}let D=!1;const z=l();if(typeof document<"u"&&z.length)for(const B of z){const V=B.enableBeforeUnload??!0;if(V===!0){D=!0;break}if(typeof V=="function"&&V()===!0){D=!0;break}}if(D)return O.preventDefault(),O.returnValue=""},T=Oz({getLocation:j,getLength:()=>t.history.length,pushState:(O,D)=>E("push",O,D),replaceState:(O,D)=>E("replace",O,D),back:O=>(O&&(w=!0),S=!0,t.history.back()),forward:O=>{O&&(w=!0),S=!0,t.history.forward()},go:O=>{g=!0,t.history.go(O)},createHref:O=>d(O),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(V1,R,{capture:!0}),t.removeEventListener(q1,A)},onBlocked:()=>{v&&m!==v&&(m=v)},getBlockers:l,setBlockers:u,notifyOnIndexChange:!1});return t.addEventListener(V1,R,{capture:!0}),t.addEventListener(q1,A),t.history.pushState=function(...O){const D=n.apply(t.history,O);return T._ignoreSubscribers||M("PUSH"),D},t.history.replaceState=function(...O){const D=r.apply(t.history,O);return T._ignoreSubscribers||M("REPLACE"),D},T}function zz(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function eh(e,t){const n=zz(e),r=n.indexOf("#"),o=n.indexOf("?"),l=zx();return{href:n,pathname:n.substring(0,r>0?o>0?Math.min(r,o):r:o>0?o:n.length),hash:r>-1?n.substring(r):"",search:o>-1?n.slice(o,r===-1?void 0:r):"",state:t||{[Ha]:0,key:l,__TSR_key:l}}}function zx(){return(Math.random()+1).toString(36).substring(7)}const Pz=!1;function ou(e){let t;return Mz(()=>{t=e()}),t}function hu(e){return e[e.length-1]}function Lz(e){return typeof e=="function"}function qa(e,t){return Lz(e)?e(t):e}const Iz=Object.prototype.hasOwnProperty,Y1=Object.prototype.propertyIsEnumerable;function er(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=t,o=Z1(e)&&Z1(r);if(!o&&!(th(e)&&th(r)))return r;const l=o?e:W1(e);if(!l)return r;const u=o?r:W1(r);if(!u)return r;const d=l.length,h=u.length,m=o?new Array(h):{};let v=0;for(let g=0;g<h;g++){const y=o?g:u[g],w=e[y],S=r[y];if(w===S){m[y]=w,(o?g<d:Iz.call(e,y))&&v++;continue}if(w===null||S===null||typeof w!="object"||typeof S!="object"){m[y]=S;continue}const j=er(w,S,n+1);m[y]=j,j===w&&v++}return d===h&&v===d?e:m}function W1(e){const t=Object.getOwnPropertyNames(e);for(const o of t)if(!Y1.call(e,o))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const r=t;for(const o of n){if(!Y1.call(e,o))return!1;r.push(o)}return r}function th(e){if(!G1(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!G1(n)||!n.hasOwnProperty("isPrototypeOf"))}function G1(e){return Object.prototype.toString.call(e)==="[object Object]"}function Z1(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Do(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,o=e.length;r<o;r++)if(!Do(e[r],t[r],n))return!1;return!0}if(th(e)&&th(t)){const r=n?.ignoreUndefined??!0;if(n?.partial){for(const u in t)if((!r||t[u]!==void 0)&&!Do(e[u],t[u],n))return!1;return!0}let o=0;if(!r)o=Object.keys(e).length;else for(const u in e)e[u]!==void 0&&o++;let l=0;for(const u in t)if((!r||t[u]!==void 0)&&(l++,l>o||!Do(e[u],t[u],n)))return!1;return o===l}return!1}function hl(e){let t,n;const r=new Promise((o,l)=>{t=o,n=l});return r.status="pending",r.resolve=o=>{r.status="resolved",r.value=o,t(o),e?.(o)},r.reject=o=>{r.status="rejected",n(o)},r}function sl(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function $z(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function Q1(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return $z(t)}const zN=["http:","https:","mailto:","tel:"];function nh(e){if(!e)return!1;try{const t=new URL(e);return!zN.includes(t.protocol)}catch{return!1}}function Lc(e,t){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return e;const n=/%25|%5C/gi;let r=0,o="",l;for(;(l=n.exec(e))!==null;)o+=Q1(e.slice(r,l.index))+l[0],r=n.lastIndex;return o=o+Q1(r?e.slice(r):e),o.startsWith("//")&&(o="/"+o.replace(/^\/+/,"")),o}function Fz(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}var Bz="Invariant failed";function da(e,t){if(!e)throw new Error(Bz)}function rh(e){const t=new Map;let n,r;const o=l=>{l.next&&(l.prev?(l.prev.next=l.next,l.next.prev=l.prev,l.next=void 0,r&&(r.next=l,l.prev=r)):(l.next.prev=void 0,n=l.next,l.next=void 0,r&&(l.prev=r,r.next=l)),r=l)};return{get(l){const u=t.get(l);if(u)return o(u),u.value},set(l,u){if(t.size>=e&&n){const h=n;t.delete(h.key),h.next&&(n=h.next,h.next.prev=void 0),h===r&&(r=void 0)}const d=t.get(l);if(d)d.value=u,o(d);else{const h={key:l,value:u,prev:r};r&&(r.next=h),r=h,n||(n=h),t.set(l,h)}},clear(){t.clear(),n=void 0,r=void 0}}}const ml=0,Io=1,$o=2,mu=3,To=4,PN=5;function Uz(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function Px(e,t,n=new Uint16Array(6)){const r=e.indexOf("/",t),o=r===-1?e.length:r,l=e.substring(t,o);if(!l||!l.includes("$"))return n[0]=ml,n[1]=t,n[2]=t,n[3]=o,n[4]=o,n[5]=o,n;if(l==="$"){const d=e.length;return n[0]=$o,n[1]=t,n[2]=t,n[3]=d,n[4]=d,n[5]=d,n}if(l.charCodeAt(0)===36)return n[0]=Io,n[1]=t,n[2]=t+1,n[3]=o,n[4]=o,n[5]=o,n;const u=Uz(l);if(u){const[d,h]=u,m=l.charCodeAt(d+1);if(m===45){if(d+2<l.length&&l.charCodeAt(d+2)===36){const v=d+3,g=h;if(v<g)return n[0]=mu,n[1]=t+d,n[2]=t+v,n[3]=t+g,n[4]=t+h+1,n[5]=o,n}}else if(m===36){const v=d+1,g=d+2;return g===h?(n[0]=$o,n[1]=t+d,n[2]=t+v,n[3]=t+g,n[4]=t+h+1,n[5]=e.length,n):(n[0]=Io,n[1]=t+d,n[2]=t+g,n[3]=t+h,n[4]=t+h+1,n[5]=o,n)}}return n[0]=ml,n[1]=t,n[2]=t,n[3]=o,n[4]=o,n[5]=o,n}function Ph(e,t,n,r,o,l,u){u?.(n);let d=r;{const h=n.fullPath??n.from,m=h.length,v=n.options?.caseSensitive??e,g=!!(n.options?.params?.parse&&n.options?.skipRouteOnParseError?.params);for(;d<m;){const w=Px(h,d,t);let S;const j=d,N=w[5];switch(d=N+1,l++,w[0]){case ml:{const _=h.substring(w[2],w[3]);if(v){const E=o.static?.get(_);if(E)S=E;else{o.static??=new Map;const M=Mo(n.fullPath??n.from);M.parent=o,M.depth=l,S=M,o.static.set(_,M)}}else{const E=_.toLowerCase(),M=o.staticInsensitive?.get(E);if(M)S=M;else{o.staticInsensitive??=new Map;const A=Mo(n.fullPath??n.from);A.parent=o,A.depth=l,S=A,o.staticInsensitive.set(E,A)}}break}case Io:{const _=h.substring(j,w[1]),E=h.substring(w[4],N),M=v&&!!(_||E),A=_?M?_:_.toLowerCase():void 0,R=E?M?E:E.toLowerCase():void 0,T=!g&&o.dynamic?.find(O=>!O.skipOnParamError&&O.caseSensitive===M&&O.prefix===A&&O.suffix===R);if(T)S=T;else{const O=Kg(Io,n.fullPath??n.from,M,A,R);S=O,O.depth=l,O.parent=o,o.dynamic??=[],o.dynamic.push(O)}break}case mu:{const _=h.substring(j,w[1]),E=h.substring(w[4],N),M=v&&!!(_||E),A=_?M?_:_.toLowerCase():void 0,R=E?M?E:E.toLowerCase():void 0,T=!g&&o.optional?.find(O=>!O.skipOnParamError&&O.caseSensitive===M&&O.prefix===A&&O.suffix===R);if(T)S=T;else{const O=Kg(mu,n.fullPath??n.from,M,A,R);S=O,O.parent=o,O.depth=l,o.optional??=[],o.optional.push(O)}break}case $o:{const _=h.substring(j,w[1]),E=h.substring(w[4],N),M=v&&!!(_||E),A=_?M?_:_.toLowerCase():void 0,R=E?M?E:E.toLowerCase():void 0,T=Kg($o,n.fullPath??n.from,M,A,R);S=T,T.parent=o,T.depth=l,o.wildcard??=[],o.wildcard.push(T)}}o=S}if(g&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const w=Mo(n.fullPath??n.from);w.kind=PN,w.parent=o,l++,w.depth=l,o.pathless??=[],o.pathless.push(w),o=w}const y=(n.path||!n.children)&&!n.isRoot;if(y&&h.endsWith("/")){const w=Mo(n.fullPath??n.from);w.kind=To,w.parent=o,l++,w.depth=l,o.index=w,o=w}o.parse=n.options?.params?.parse??null,o.skipOnParamError=g,o.parsingPriority=n.options?.skipRouteOnParseError?.priority??0,y&&!o.route&&(o.route=n,o.fullPath=n.fullPath??n.from)}if(n.children)for(const h of n.children)Ph(e,t,h,d,o,l,u)}function Qg(e,t){if(e.skipOnParamError&&!t.skipOnParamError)return-1;if(!e.skipOnParamError&&t.skipOnParamError)return 1;if(e.skipOnParamError&&t.skipOnParamError&&(e.parsingPriority||t.parsingPriority))return t.parsingPriority-e.parsingPriority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Ua(e){if(e.pathless)for(const t of e.pathless)Ua(t);if(e.static)for(const t of e.static.values())Ua(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())Ua(t);if(e.dynamic?.length){e.dynamic.sort(Qg);for(const t of e.dynamic)Ua(t)}if(e.optional?.length){e.optional.sort(Qg);for(const t of e.optional)Ua(t)}if(e.wildcard?.length){e.wildcard.sort(Qg);for(const t of e.wildcard)Ua(t)}}function Mo(e){return{kind:ml,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function Kg(e,t,n,r,o){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:n,prefix:r,suffix:o}}function qz(e,t){const n=Mo("/"),r=new Uint16Array(6);for(const o of e)Ph(!1,r,o,1,n,0);Ua(n),t.masksTree=n,t.flatCache=rh(1e3)}function Vz(e,t){e||="/";const n=t.flatCache.get(e);if(n)return n;const r=Lx(e,t.masksTree);return t.flatCache.set(e,r),r}function Hz(e,t,n,r,o){e||="/",r||="/";const l=t?`case\0${e}`:e;let u=o.singleCache.get(l);if(!u){u=Mo("/");const d=new Uint16Array(6);Ph(t,d,{from:e},1,u,0),o.singleCache.set(l,u)}return Lx(r,u,n)}function Yz(e,t,n=!1){const r=n?e:`nofuzz\0${e}`,o=t.matchCache.get(r);if(o!==void 0)return o;e||="/";let l;try{l=Lx(e,t.segmentTree,n)}catch(u){if(u instanceof URIError)l=null;else throw u}return l&&(l.branch=Zz(l.route)),t.matchCache.set(r,l),l}function Wz(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function Gz(e,t=!1,n){const r=Mo(e.fullPath),o=new Uint16Array(6),l={},u={};let d=0;return Ph(t,o,e,1,r,0,m=>{if(n?.(m,d),da(!(m.id in l),`Duplicate routes found with id: ${String(m.id)}`),l[m.id]=m,d!==0&&m.path){const v=Wz(m.fullPath);(!u[v]||m.fullPath.endsWith("/"))&&(u[v]=m)}d++}),Ua(r),{processedTree:{segmentTree:r,singleCache:rh(1e3),matchCache:rh(1e3),flatCache:null,masksTree:null},routesById:l,routesByPath:u}}function Lx(e,t,n=!1){const r=e.split("/"),o=Kz(e,r,t,n);if(!o)return null;const[l]=LN(e,r,o);return{route:o.node.route,rawParams:l,parsedParams:o.parsedParams}}function LN(e,t,n){const r=Qz(n.node);let o=null;const l={};let u=n.extract?.part??0,d=n.extract?.node??0,h=n.extract?.path??0,m=n.extract?.segment??0;for(;d<r.length;u++,d++,h++,m++){const v=r[d];if(v.kind===To)break;if(v.kind===PN){m--,u--,h--;continue}const g=t[u],y=h;if(g&&(h+=g.length),v.kind===Io){o??=n.node.fullPath.split("/");const w=o[m],S=v.prefix?.length??0;if(w.charCodeAt(S)===123){const N=v.suffix?.length??0,C=w.substring(S+2,w.length-N-1),_=g.substring(S,g.length-N);l[C]=decodeURIComponent(_)}else{const N=w.substring(1);l[N]=decodeURIComponent(g)}}else if(v.kind===mu){if(n.skipped&1<<d){u--,h=y-1;continue}o??=n.node.fullPath.split("/");const w=o[m],S=v.prefix?.length??0,j=v.suffix?.length??0,N=w.substring(S+3,w.length-j-1),C=v.suffix||v.prefix?g.substring(S,g.length-j):g;C&&(l[N]=decodeURIComponent(C))}else if(v.kind===$o){const w=v,S=e.substring(y+(w.prefix?.length??0),e.length-(w.suffix?.length??0)),j=decodeURIComponent(S);l["*"]=j,l._splat=j;break}}return n.rawParams&&Object.assign(l,n.rawParams),[l,{part:u,node:d,path:h,segment:m}]}function Zz(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Qz(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Kz(e,t,n,r){if(e==="/"&&n.index)return{node:n.index,skipped:0};const o=!hu(t),l=o&&e!=="/",u=t.length-(o?1:0),d=[{node:n,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let h=null,m=null,v=null;for(;d.length;){const g=d.pop(),{node:y,index:w,skipped:S,depth:j,statics:N,dynamics:C,optionals:_}=g;let{extract:E,rawParams:M,parsedParams:A}=g;if(y.skipOnParamError){if(!Xg(e,t,g))continue;M=g.rawParams,E=g.extract,A=g.parsedParams}r&&y.route&&y.kind!==To&&Ic(m,g)&&(m=g);const R=w===u;if(R&&(y.route&&!l&&Ic(v,g)&&(v=g),!y.optional&&!y.wildcard&&!y.index&&!y.pathless))continue;const T=R?void 0:t[w];let O;if(R&&y.index){const D={node:y.index,index:w,skipped:S,depth:j+1,statics:N,dynamics:C,optionals:_,extract:E,rawParams:M,parsedParams:A};let z=!0;if(y.index.skipOnParamError&&(Xg(e,t,D)||(z=!1)),z){if(N===u&&!C&&!_&&!S)return D;Ic(v,D)&&(v=D)}}if(y.wildcard&&Ic(h,g))for(const D of y.wildcard){const{prefix:z,suffix:B}=D;if(z&&(R||!(D.caseSensitive?T:O??=T.toLowerCase()).startsWith(z)))continue;if(B){if(R)continue;const Y=t.slice(w).join("/").slice(-B.length);if((D.caseSensitive?Y:Y.toLowerCase())!==B)continue}const V={node:D,index:u,skipped:S,depth:j,statics:N,dynamics:C,optionals:_,extract:E,rawParams:M,parsedParams:A};if(!(D.skipOnParamError&&!Xg(e,t,V))){h=V;break}}if(y.optional){const D=S|1<<j,z=j+1;for(let B=y.optional.length-1;B>=0;B--){const V=y.optional[B];d.push({node:V,index:w,skipped:D,depth:z,statics:N,dynamics:C,optionals:_,extract:E,rawParams:M,parsedParams:A})}if(!R)for(let B=y.optional.length-1;B>=0;B--){const V=y.optional[B],{prefix:Y,suffix:G}=V;if(Y||G){const ae=V.caseSensitive?T:O??=T.toLowerCase();if(Y&&!ae.startsWith(Y)||G&&!ae.endsWith(G))continue}d.push({node:V,index:w+1,skipped:S,depth:z,statics:N,dynamics:C,optionals:_+1,extract:E,rawParams:M,parsedParams:A})}}if(!R&&y.dynamic&&T)for(let D=y.dynamic.length-1;D>=0;D--){const z=y.dynamic[D],{prefix:B,suffix:V}=z;if(B||V){const Y=z.caseSensitive?T:O??=T.toLowerCase();if(B&&!Y.startsWith(B)||V&&!Y.endsWith(V))continue}d.push({node:z,index:w+1,skipped:S,depth:j+1,statics:N,dynamics:C+1,optionals:_,extract:E,rawParams:M,parsedParams:A})}if(!R&&y.staticInsensitive){const D=y.staticInsensitive.get(O??=T.toLowerCase());D&&d.push({node:D,index:w+1,skipped:S,depth:j+1,statics:N+1,dynamics:C,optionals:_,extract:E,rawParams:M,parsedParams:A})}if(!R&&y.static){const D=y.static.get(T);D&&d.push({node:D,index:w+1,skipped:S,depth:j+1,statics:N+1,dynamics:C,optionals:_,extract:E,rawParams:M,parsedParams:A})}if(y.pathless){const D=j+1;for(let z=y.pathless.length-1;z>=0;z--){const B=y.pathless[z];d.push({node:B,index:w,skipped:S,depth:D,statics:N,dynamics:C,optionals:_,extract:E,rawParams:M,parsedParams:A})}}}if(v&&h)return Ic(h,v)?v:h;if(v)return v;if(h)return h;if(r&&m){let g=m.index;for(let w=0;w<m.index;w++)g+=t[w].length;const y=g===e.length?"/":e.slice(g);return m.rawParams??={},m.rawParams["**"]=decodeURIComponent(y),m}return null}function Xg(e,t,n){try{const[r,o]=LN(e,t,n);n.rawParams=r,n.extract=o;const l=n.node.parse(r);return n.parsedParams=Object.assign({},n.parsedParams,l),!0}catch{return null}}function Ic(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===To)>(e.node.kind===To)||t.node.kind===To==(e.node.kind===To)&&t.depth>e.depth))):!0}function Uf(e){return Ix(e.filter(t=>t!==void 0).join("/"))}function Ix(e){return e.replace(/\/{2,}/g,"/")}function IN(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function ra(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function $N(e){return ra(IN(e))}function sh(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Xz(e,t,n){return sh(e,n)===sh(t,n)}function Jz({base:e,to:t,trailingSlash:n="never",cache:r}){const o=t.startsWith("/"),l=!o&&t===".";let u;if(r){u=o?t:l?e:e+"\0"+t;const g=r.get(u);if(g)return g}let d;if(l)d=e.split("/");else if(o)d=t.split("/");else{for(d=e.split("/");d.length>1&&hu(d)==="";)d.pop();const g=t.split("/");for(let y=0,w=g.length;y<w;y++){const S=g[y];S===""?y?y===w-1&&d.push(S):d=[S]:S===".."?d.pop():S==="."||d.push(S)}}d.length>1&&(hu(d)===""?n==="never"&&d.pop():n==="always"&&d.push(""));let h,m="";for(let g=0;g<d.length;g++){g>0&&(m+="/");const y=d[g];if(!y)continue;h=Px(y,0,h);const w=h[0];if(w===ml){m+=y;continue}const S=h[5],j=y.substring(0,h[1]),N=y.substring(h[4],S),C=y.substring(h[2],h[3]);w===Io?m+=j||N?`${j}{$${C}}${N}`:`$${C}`:w===$o?m+=j||N?`${j}{$}${N}`:"$":m+=`${j}{-$${C}}${N}`}m=Ix(m);const v=m||"/";return u&&r&&r.set(u,v),v}function e4(e){const t=new Map(e.map(o=>[encodeURIComponent(o),o])),n=Array.from(t.keys()).map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(n,"g");return o=>o.replace(r,l=>t.get(l)??l)}function Jg(e,t,n){const r=t[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(o=>K1(o,n)).join("/"):K1(r,n)}function ev({path:e,params:t,decoder:n,server:r}){let o=!1;const l={};if(!e||e==="/")return{interpolatedPath:"/",usedParams:l,isMissingParams:o};if(!e.includes("$"))return{interpolatedPath:e,usedParams:l,isMissingParams:o};const u=e.length;let d=0,h,m="";for(;d<u;){const g=d;h=Px(e,g,h);const y=h[5];if(d=y+1,g===y)continue;const w=h[0];if(w===ml){m+="/"+e.substring(g,y);continue}if(w===$o){const S=t._splat;l._splat=S,l["*"]=S;const j=e.substring(g,h[1]),N=e.substring(h[4],y);if(!S){o=!0,(j||N)&&(m+="/"+j+N);continue}const C=Jg("_splat",t,n);m+="/"+j+C+N;continue}if(w===Io){const S=e.substring(h[2],h[3]);!o&&!(S in t)&&(o=!0),l[S]=t[S];const j=e.substring(g,h[1]),N=e.substring(h[4],y),C=Jg(S,t,n)??"undefined";m+="/"+j+C+N;continue}if(w===mu){const S=e.substring(h[2],h[3]),j=t[S];if(j==null)continue;l[S]=j;const N=e.substring(g,h[1]),C=e.substring(h[4],y),_=Jg(S,t,n)??"";m+="/"+N+_+C;continue}}return e.endsWith("/")&&(m+="/"),{usedParams:l,interpolatedPath:m||"/",isMissingParams:o}}function K1(e,t){const n=encodeURIComponent(e);return t?.(n)??n}function yr(e){return!!e?.isNotFound}function t4(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}const ex="tsr-scroll-restoration-v1_3",n4=(e,t)=>{let n;return(...r)=>{n||(n=setTimeout(()=>{e(...r),n=null},t))}};function r4(){const e=t4();if(!e)return null;const t=e.getItem(ex);let n=t?JSON.parse(t):{};return{state:n,set:r=>{n=qa(r,n)||n;try{e.setItem(ex,JSON.stringify(n))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}const Sf=r4(),s4=e=>e.state.__TSR_key||e.href;function a4(e){const t=[];let n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(" > ")}`.toLowerCase()}let ah=!1;function o4({storageKey:e,key:t,behavior:n,shouldScrollRestoration:r,scrollToTopSelectors:o,location:l}){let u;try{u=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(m){console.error(m);return}const d=t||window.history.state?.__TSR_key,h=u[d];ah=!0;e:{if(r&&h&&Object.keys(h).length>0){for(const g in h){const y=h[g];if(g==="window")window.scrollTo({top:y.scrollY,left:y.scrollX,behavior:n});else if(g){const w=document.querySelector(g);w&&(w.scrollLeft=y.scrollX,w.scrollTop=y.scrollY)}}break e}const m=(l??window.location).hash.split("#",2)[1];if(m){const g=window.history.state?.__hashScrollIntoViewOptions??!0;if(g){const y=document.getElementById(m);y&&y.scrollIntoView(g)}break e}const v={top:0,left:0,behavior:n};if(window.scrollTo(v),o)for(const g of o){if(g==="window")continue;const y=typeof g=="function"?g():document.querySelector(g);y&&y.scrollTo(v)}}ah=!1}function i4(e,t){if(!Sf||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!Sf))return;e.isScrollRestorationSetup=!0,ah=!1;const r=e.options.getScrollRestorationKey||s4;window.history.scrollRestoration="manual";const o=l=>{if(ah||!e.isScrollRestoring)return;let u="";if(l.target===document||l.target===window)u="window";else{const h=l.target.getAttribute("data-scroll-restoration-id");h?u=`[data-scroll-restoration-id="${h}"]`:u=a4(l.target)}const d=r(e.state.location);Sf.set(h=>{const m=h[d]||={},v=m[u]||={};if(u==="window")v.scrollX=window.scrollX||0,v.scrollY=window.scrollY||0;else if(u){const g=document.querySelector(u);g&&(v.scrollX=g.scrollLeft||0,v.scrollY=g.scrollTop||0)}return h})};typeof document<"u"&&document.addEventListener("scroll",n4(o,100),!0),e.subscribe("onRendered",l=>{const u=r(l.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(o4({storageKey:ex,key:u,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&Sf.set(d=>(d[u]||={},d)))})}function l4(e){if(typeof document<"u"&&document.querySelector){const t=e.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&e.state.location.hash!==""){const n=document.getElementById(e.state.location.hash);n&&n.scrollIntoView(t)}}}function c4(e,t=String){const n=new URLSearchParams;for(const r in e){const o=e[r];o!==void 0&&n.set(r,t(o))}return n.toString()}function tv(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function u4(e){const t=new URLSearchParams(e),n={};for(const[r,o]of t.entries()){const l=n[r];l==null?n[r]=tv(o):Array.isArray(l)?l.push(tv(o)):n[r]=[l,tv(o)]}return n}const d4=h4(JSON.parse),f4=m4(JSON.stringify,JSON.parse);function h4(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=u4(t);for(const r in n){const o=n[r];if(typeof o=="string")try{n[r]=e(o)}catch{}}return n}}function m4(e,t){const n=typeof t=="function";function r(o){if(typeof o=="object"&&o!==null)try{return e(o)}catch{}else if(n&&typeof o=="string")try{return t(o),e(o)}catch{}return o}return o=>{const l=c4(o,r);return l?`?${l}`:""}}const $r="__root__";function p4(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&typeof e.href=="string"&&nh(e.href))throw new Error(`Redirect blocked: unsafe protocol in href "${e.href}". Only ${zN.join(", ")} protocols are allowed.`);if(!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Fr(e){return e instanceof Response&&!!e.options}const qf=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Lh=(e,t)=>!!(e.preload&&!e.router.state.matches.some(n=>n.id===t)),al=(e,t,n=!0)=>{const r={...e.router.options.context??{}},o=n?t:t-1;for(let l=0;l<=o;l++){const u=e.matches[l];if(!u)continue;const d=e.router.getMatch(u.id);d&&Object.assign(r,d.__routeContext,d.__beforeLoadContext)}return r},FN=(e,t)=>{const n=e.router.routesById[t.routeId??""]??e.router.routeTree;!n.options.notFoundComponent&&e.router.options?.defaultNotFoundComponent&&(n.options.notFoundComponent=e.router.options.defaultNotFoundComponent),da(n.options.notFoundComponent);const r=e.matches.find(o=>o.routeId===n.id);da(r,"Could not find match for route: "+n.id),e.updateMatch(r.id,o=>({...o,status:"notFound",error:t,isFetching:!1})),t.routerCode==="BEFORE_LOAD"&&n.parentRoute&&(t.routeId=n.parentRoute.id,FN(e,t))},Va=(e,t,n)=>{if(!(!Fr(n)&&!yr(n))){if(Fr(n)&&n.redirectHandled&&!n.options.reloadDocument)throw n;if(t){t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0;const r=Fr(n)?"redirected":"notFound";t._nonReactive.error=n,e.updateMatch(t.id,o=>({...o,status:r,context:al(e,t.index),isFetching:!1,error:n})),yr(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()}throw Fr(n)?(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n),n):(FN(e,n),n)}},BN=(e,t)=>!!e.router.getMatch(t)._nonReactive.dehydrated,$c=(e,t,n,r)=>{const{id:o,routeId:l}=e.matches[t],u=e.router.looseRoutesById[l];if(n instanceof Promise)throw n;n.routerCode=r,e.firstBadMatchIndex??=t,Va(e,e.router.getMatch(o),n);try{u.options.onError?.(n)}catch(d){n=d,Va(e,e.router.getMatch(o),n)}e.updateMatch(o,d=>(d._nonReactive.beforeLoadPromise?.resolve(),d._nonReactive.beforeLoadPromise=void 0,d._nonReactive.loadPromise?.resolve(),{...d,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},UN=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;const o=n.options.pendingMs??e.router.options.defaultPendingMs;if(!!(e.onReady&&!Lh(e,t)&&(n.options.loader||n.options.beforeLoad||HN(n))&&typeof o=="number"&&o!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent))){const u=setTimeout(()=>{qf(e)},o);r._nonReactive.pendingTimeout=u}},g4=(e,t,n)=>{const r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;UN(e,t,n,r);const o=()=>{const l=e.router.getMatch(t);l.preload&&(l.status==="redirected"||l.status==="notFound")&&Va(e,l,l.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(o):o()},v4=(e,t,n,r)=>{const o=e.router.getMatch(t),l=o._nonReactive.loadPromise;o._nonReactive.loadPromise=hl(()=>{l?.resolve()});const{paramsError:u,searchError:d}=o;u&&$c(e,n,u,"PARSE_PARAMS"),d&&$c(e,n,d,"VALIDATE_SEARCH"),UN(e,t,r,o);const h=new AbortController;let m=!1;const v=()=>{m||(m=!0,e.updateMatch(t,M=>({...M,isFetching:"beforeLoad",fetchCount:M.fetchCount+1,abortController:h})))},g=()=>{o._nonReactive.beforeLoadPromise?.resolve(),o._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,M=>({...M,isFetching:!1}))};if(!r.options.beforeLoad){ou(()=>{v(),g()});return}o._nonReactive.beforeLoadPromise=hl();const y={...al(e,n,!1),...o.__routeContext},{search:w,params:S,cause:j}=o,N=Lh(e,t),C={search:w,abortController:h,params:S,preload:N,context:y,location:e.location,navigate:M=>e.router.navigate({...M,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:N?"preload":j,matches:e.matches,...e.router.options.additionalContext},_=M=>{if(M===void 0){ou(()=>{v(),g()});return}(Fr(M)||yr(M))&&(v(),$c(e,n,M,"BEFORE_LOAD")),ou(()=>{v(),e.updateMatch(t,A=>({...A,__beforeLoadContext:M})),g()})};let E;try{if(E=r.options.beforeLoad(C),sl(E))return v(),E.catch(M=>{$c(e,n,M,"BEFORE_LOAD")}).then(_)}catch(M){v(),$c(e,n,M,"BEFORE_LOAD")}_(E)},x4=(e,t)=>{const{id:n,routeId:r}=e.matches[t],o=e.router.looseRoutesById[r],l=()=>d(),u=()=>v4(e,n,t,o),d=()=>{if(BN(e,n))return;const h=g4(e,n,o);return sl(h)?h.then(u):u()};return l()},y4=(e,t,n)=>{const r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const o={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(o),n.options.scripts?.(o),n.options.headers?.(o)]).then(([l,u,d])=>{const h=l?.meta,m=l?.links,v=l?.scripts,g=l?.styles;return{meta:h,links:m,headScripts:v,headers:d,scripts:u,styles:g}})},qN=(e,t,n,r)=>{const o=e.matchPromises[n-1],{params:l,loaderDeps:u,abortController:d,cause:h}=e.router.getMatch(t),m=al(e,n),v=Lh(e,t);return{params:l,deps:u,preload:!!v,parentMatchPromise:o,abortController:d,context:m,location:e.location,navigate:g=>e.router.navigate({...g,_fromLocation:e.location}),cause:v?"preload":h,route:r,...e.router.options.additionalContext}},X1=async(e,t,n,r)=>{try{const o=e.router.getMatch(t);try{(!(Pz??e.router.isServer)||o.ssr===!0)&&VN(r);const l=r.options.loader?.(qN(e,t,n,r)),u=r.options.loader&&sl(l);if((u||r._lazyPromise||r._componentsPromise||r.options.head||r.options.scripts||r.options.headers||o._nonReactive.minPendingPromise)&&e.updateMatch(t,m=>({...m,isFetching:"loader"})),r.options.loader){const m=u?await l:l;Va(e,e.router.getMatch(t),m),m!==void 0&&e.updateMatch(t,v=>({...v,loaderData:m}))}r._lazyPromise&&await r._lazyPromise;const h=o._nonReactive.minPendingPromise;h&&await h,r._componentsPromise&&await r._componentsPromise,e.updateMatch(t,m=>({...m,error:void 0,context:al(e,n),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(l){let u=l;if(u?.name==="AbortError"){e.updateMatch(t,h=>({...h,status:h.status==="pending"?"success":h.status,isFetching:!1,context:al(e,n)}));return}const d=o._nonReactive.minPendingPromise;d&&await d,yr(l)&&await r.options.notFoundComponent?.preload?.(),Va(e,e.router.getMatch(t),l);try{r.options.onError?.(l)}catch(h){u=h,Va(e,e.router.getMatch(t),h)}e.updateMatch(t,h=>({...h,error:u,context:al(e,n),status:"error",isFetching:!1}))}}catch(o){const l=e.router.getMatch(t);l&&(l._nonReactive.loaderPromise=void 0),Va(e,l,o)}},b4=async(e,t)=>{const{id:n,routeId:r}=e.matches[t];let o=!1,l=!1;const u=e.router.looseRoutesById[r];if(!BN(e,n)){const m=e.router.getMatch(n);if(m._nonReactive.loaderPromise){if(m.status==="success"&&!e.sync&&!m.preload)return m;await m._nonReactive.loaderPromise;const v=e.router.getMatch(n),g=v._nonReactive.error||v.error;g&&Va(e,v,g)}else{const v=Date.now()-m.updatedAt,g=Lh(e,n),y=g?u.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:u.options.staleTime??e.router.options.defaultStaleTime??0,w=u.options.shouldReload,S=typeof w=="function"?w(qN(e,n,t,u)):w,j=!!g&&!e.router.state.matches.some(E=>E.id===n),N=e.router.getMatch(n);N._nonReactive.loaderPromise=hl(),j!==N.preload&&e.updateMatch(n,E=>({...E,preload:j}));const{status:C,invalid:_}=N;o=C==="success"&&(_||(S??v>y)),g&&u.options.preload===!1||(o&&!e.sync?(l=!0,(async()=>{try{await X1(e,n,t,u);const E=e.router.getMatch(n);E._nonReactive.loaderPromise?.resolve(),E._nonReactive.loadPromise?.resolve(),E._nonReactive.loaderPromise=void 0}catch(E){Fr(E)&&await e.router.navigate(E.options)}})()):(C!=="success"||o&&e.sync)&&await X1(e,n,t,u))}}const d=e.router.getMatch(n);l||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve()),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,l||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;const h=l?d.isFetching:!1;return h!==d.isFetching||d.invalid!==!1?(e.updateMatch(n,m=>({...m,isFetching:h,invalid:!1})),e.router.getMatch(n)):d};async function J1(e){const t=Object.assign(e,{matchPromises:[]});t.router.state.matches.some(n=>n._forcePending)&&qf(t);try{for(let d=0;d<t.matches.length;d++){const h=x4(t,d);sl(h)&&await h}const n=t.firstBadMatchIndex??t.matches.length;for(let d=0;d<n;d++)t.matchPromises.push(b4(t,d));const o=(await Promise.allSettled(t.matchPromises)).filter(d=>d.status==="rejected").map(d=>d.reason);let l;for(const d of o){if(Fr(d))throw d;!l&&yr(d)&&(l=d)}for(const d of t.matches){const{id:h,routeId:m}=d,v=t.router.looseRoutesById[m];try{const g=y4(t,h,v);if(g){const y=await g;t.updateMatch(h,w=>({...w,...y}))}}catch(g){console.error(`Error executing head for route ${m}:`,g)}}if(l)throw l;const u=qf(t);sl(u)&&await u}catch(n){if(yr(n)&&!t.preload){const r=qf(t);throw sl(r)&&await r,n}if(Fr(n))throw n}return t.matches}async function VN(e){if(!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{const{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0),!e._componentsLoaded&&e._componentsPromise===void 0){const t=()=>{const n=[];for(const r of YN){const o=e.options[r]?.preload;o&&n.push(o())}if(n.length)return Promise.all(n).then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0});e._componentsLoaded=!0,e._componentsPromise=void 0};e._componentsPromise=e._lazyPromise?e._lazyPromise.then(t):t()}return e._componentsPromise}function HN(e){for(const t of YN)if(e.options[t]?.preload)return!0;return!1}const YN=["component","errorComponent","pendingComponent","notFoundComponent"];function w4(e){return{input:({url:t})=>{for(const n of e)t=tx(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=WN(e[n],t);return t}}}function S4(e){const t=$N(e.basepath),n=`/${t}`,r=`${n}/`,o=e.caseSensitive?n:n.toLowerCase(),l=e.caseSensitive?r:r.toLowerCase();return{input:({url:u})=>{const d=e.caseSensitive?u.pathname:u.pathname.toLowerCase();return d===o?u.pathname="/":d.startsWith(l)&&(u.pathname=u.pathname.slice(n.length)),u},output:({url:u})=>(u.pathname=Uf(["/",t,u.pathname]),u)}}function tx(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function WN(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function zo(e){const t=e.resolvedLocation,n=e.location,r=t?.pathname!==n.pathname,o=t?.href!==n.href,l=t?.hash!==n.hash;return{fromLocation:t,toLocation:n,pathChanged:r,hrefChanged:o,hashChanged:l}}class j4{constructor(t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=n=>n(),this.update=n=>{n.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const r=this.options,o=this.basepath??r?.basepath??"/",l=this.basepath===void 0,u=r?.rewrite;if(this.options={...r,...n},this.isServer=this.options.isServer??typeof document>"u",this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=e4(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=Dz()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let y;this.resolvePathCache=rh(1e3),y=this.buildRouteTree(),this.setRoutes(y)}!this.__store&&this.latestLocation&&(this.__store=new Az(N4(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(y=>!["redirected"].includes(y.status))}}}),i4(this));let d=!1;const h=this.options.basepath??"/",m=this.options.rewrite;if(l||o!==h||u!==m){this.basepath=h;const y=[],w=$N(h);w&&w!=="/"&&y.push(S4({basepath:h})),m&&y.push(m),this.rewrite=y.length===0?void 0:y.length===1?y[0]:w4(y),this.history&&this.updateLatestLocation(),d=!0}d&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=Gz(this.routeTree,this.options.caseSensitive,(r,o)=>{r.init({originalIndex:o})});return this.options.routeMasks&&qz(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,r)=>{const o={eventType:n,fn:r};return this.subscribers.add(o),()=>{this.subscribers.delete(o)}},this.emit=n=>{this.subscribers.forEach(r=>{r.eventType===n.type&&r.fn(n)})},this.parseLocation=(n,r)=>{const o=({pathname:h,search:m,hash:v,href:g,state:y})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(h)){const _=this.options.parseSearch(m),E=this.options.stringifySearch(_);return{href:h+E+v,publicHref:g,pathname:Lc(h),external:!1,searchStr:E,search:er(r?.search,_),hash:Lc(v.slice(1)),state:er(r?.state,y)}}const w=new URL(g,this.origin),S=tx(this.rewrite,w),j=this.options.parseSearch(S.search),N=this.options.stringifySearch(j);return S.search=N,{href:S.href.replace(S.origin,""),publicHref:g,pathname:Lc(S.pathname),external:!!this.rewrite&&S.origin!==this.origin,searchStr:N,search:er(r?.search,j),hash:Lc(S.hash.slice(1)),state:er(r?.state,y)}},l=o(n),{__tempLocation:u,__tempKey:d}=l.state;if(u&&(!d||d===this.tempLocationKey)){const h=o(u);return h.state.key=l.state.key,h.state.__TSR_key=l.state.__TSR_key,delete h.state.__tempLocation,{...h,maskedLocation:l}}return l},this.resolvePathWithBase=(n,r)=>Jz({base:n,to:Ix(r),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,r,o)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:r},o):this.matchRoutesInternal(n,r),this.getMatchedRoutes=n=>k4({pathname:n,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=n=>{const r=this.getMatch(n);r&&(r.abortController.abort(),clearTimeout(r._nonReactive.pendingTimeout),r._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const n=this.state.matches.filter(l=>l.status==="pending"),r=this.state.matches.filter(l=>l.isFetching==="loader");new Set([...this.state.pendingMatches??[],...n,...r]).forEach(l=>{this.cancelMatch(l.id)})},this.buildLocation=n=>{const r=(l={})=>{const u=l._fromLocation||this.pendingBuiltLocation||this.latestLocation,d=this.matchRoutesLightweight(u);l.from;const h=l.unsafeRelative==="path"?u.pathname:l.from??d.fullPath,m=this.resolvePathWithBase(h,"."),v=d.search,g={...d.params},y=l.to?this.resolvePathWithBase(m,`${l.to}`):this.resolvePathWithBase(m,"."),w=l.params===!1||l.params===null?{}:(l.params??!0)===!0?g:Object.assign(g,qa(l.params,g)),S=ev({path:y,params:w,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath,j=this.getMatchedRoutes(S);let N=j.matchedRoutes;(j.foundRoute?j.foundRoute.path!=="/"&&j.routeParams["**"]:ra(S))&&this.options.notFoundRoute&&(N=[...N,this.options.notFoundRoute]);let _=!1;if(Object.keys(w).length>0)for(const Y of N){const G=Y.options.params?.stringify??Y.options.stringifyParams;G&&(_=!0,Object.assign(w,G(w)))}const E=n.leaveParams?y:Lc(_?ev({path:y,params:w,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath:S);let M=v;if(n._includeValidateSearch&&this.options.search?.strict){const Y={};N.forEach(G=>{if(G.options.validateSearch)try{Object.assign(Y,Vf(G.options.validateSearch,{...Y,...M}))}catch{}}),M=Y}M=_4({search:M,dest:l,destRoutes:N,_includeValidateSearch:n._includeValidateSearch}),M=er(v,M);const A=this.options.stringifySearch(M),R=l.hash===!0?u.hash:l.hash?qa(l.hash,u.hash):void 0,T=R?`#${R}`:"";let O=l.state===!0?u.state:l.state?qa(l.state,u.state):{};O=er(u.state,O);const D=`${E}${A}${T}`;let z,B,V=!1;if(this.rewrite){const Y=new URL(D,this.origin),G=WN(this.rewrite,Y);z=Y.href.replace(Y.origin,""),G.origin!==this.origin?(B=G.href,V=!0):B=G.pathname+G.search+G.hash}else z=Fz(D),B=z;return{publicHref:B,href:z,pathname:E,search:M,searchStr:A,state:O,hash:R??"",external:V,unmaskOnReload:l.unmaskOnReload}},o=(l={},u)=>{const d=r(l);let h=u?r(u):void 0;if(!h){const m={};if(this.options.routeMasks){const v=Vz(d.pathname,this.processedTree);if(v){Object.assign(m,v.rawParams);const{from:g,params:y,...w}=v.route,S=y===!1||y===null?{}:(y??!0)===!0?m:Object.assign(m,qa(y,m));u={from:n.from,...w,params:S},h=r(u)}}}return h&&(d.maskedLocation=h),d};return n.mask?o(n,{from:n.from,...n.mask}):o(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:r,...o})=>{const l=()=>{const h=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];h.forEach(v=>{o.state[v]=this.latestLocation.state[v]});const m=Do(o.state,this.latestLocation.state);return h.forEach(v=>{delete o.state[v]}),m},u=ra(this.latestLocation.href)===ra(o.href),d=this.commitLocationPromise;if(this.commitLocationPromise=hl(()=>{d?.resolve()}),u&&l())this.load();else{let{maskedLocation:h,hashScrollIntoView:m,...v}=o;h&&(v={...h,state:{...h.state,__tempKey:void 0,__tempLocation:{...v,search:v.searchStr,state:{...v.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(v.unmaskOnReload??this.options.unmaskOnReload??!1)&&(v.state.__tempKey=this.tempLocationKey)),v.state.__hashScrollIntoViewOptions=m??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,this.history[o.replace?"replace":"push"](v.publicHref,v.state,{ignoreBlocker:r})}return this.resetNextScroll=o.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:r,hashScrollIntoView:o,viewTransition:l,ignoreBlocker:u,href:d,...h}={})=>{if(d){const g=this.history.location.state.__TSR_index,y=eh(d,{__TSR_index:n?g:g+1}),w=new URL(y.pathname,this.origin),S=tx(this.rewrite,w);h.to=S.pathname,h.search=this.options.parseSearch(y.search),h.hash=y.hash.slice(1)}const m=this.buildLocation({...h,_includeValidateSearch:!0});this.pendingBuiltLocation=m;const v=this.commitLocation({...m,viewTransition:l,replace:n,resetScroll:r,hashScrollIntoView:o,ignoreBlocker:u});return Promise.resolve().then(()=>{this.pendingBuiltLocation===m&&(this.pendingBuiltLocation=void 0)}),v},this.navigate=async({to:n,reloadDocument:r,href:o,publicHref:l,...u})=>{let d=!1;if(o)try{new URL(`${o}`),d=!0}catch{}if(d&&!r&&(r=!0),r){if(n!==void 0||!o){const m=this.buildLocation({to:n,...u});o=o??m.publicHref,l=l??m.publicHref}const h=!d&&l?l:o;if(nh(h))return Promise.resolve();if(!u.ignoreBlocker){const v=this.history.getBlockers?.()??[];for(const g of v)if(g?.blockerFn&&await g.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return u.replace?window.location.replace(h):window.location.href=h,Promise.resolve()}return this.buildAndCommitLocation({...u,href:o,to:n,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const n=this.matchRoutes(this.latestLocation);this.__store.setState(r=>({...r,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:n,cachedMatches:r.cachedMatches.filter(o=>!n.some(l=>l.id===o.id))}))},this.load=async n=>{let r,o,l;for(l=new Promise(d=>{this.startTransition(async()=>{try{this.beforeLoad();const h=this.latestLocation,m=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...zo({resolvedLocation:m,location:h})}),this.emit({type:"onBeforeLoad",...zo({resolvedLocation:m,location:h})}),await J1({router:this,sync:n?.sync,matches:this.state.pendingMatches,location:h,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let v=[],g=[],y=[];ou(()=>{this.__store.setState(w=>{const S=w.matches,j=w.pendingMatches||w.matches;return v=S.filter(N=>!j.some(C=>C.id===N.id)),g=j.filter(N=>!S.some(C=>C.id===N.id)),y=j.filter(N=>S.some(C=>C.id===N.id)),{...w,isLoading:!1,loadedAt:Date.now(),matches:j,pendingMatches:void 0,cachedMatches:[...w.cachedMatches,...v.filter(N=>N.status!=="error"&&N.status!=="notFound")]}}),this.clearExpiredCache()}),[[v,"onLeave"],[g,"onEnter"],[y,"onStay"]].forEach(([w,S])=>{w.forEach(j=>{this.looseRoutesById[j.routeId].options[S]?.(j)})})})})}})}catch(h){Fr(h)?(r=h,this.navigate({...r.options,replace:!0,ignoreBlocker:!0})):yr(h)&&(o=h),this.__store.setState(m=>({...m,statusCode:r?r.status:o?404:m.matches.some(v=>v.status==="error")?500:200,redirect:r}))}this.latestLoadPromise===l&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),d()})}),this.latestLoadPromise=l,await l;this.latestLoadPromise&&l!==this.latestLoadPromise;)await this.latestLoadPromise;let u;this.hasNotFoundMatch()?u=404:this.__store.state.matches.some(d=>d.status==="error")&&(u=500),u!==void 0&&this.__store.setState(d=>({...d,statusCode:u}))},this.startViewTransition=n=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let o;if(typeof r=="object"&&this.isViewTransitionTypesSupported){const l=this.latestLocation,u=this.state.resolvedLocation,d=typeof r.types=="function"?r.types(zo({resolvedLocation:u,location:l})):r.types;if(d===!1){n();return}o={update:n,types:d}}else o=n;document.startViewTransition(o)}else n()},this.updateMatch=(n,r)=>{this.startTransition(()=>{const o=this.state.pendingMatches?.some(l=>l.id===n)?"pendingMatches":this.state.matches.some(l=>l.id===n)?"matches":this.state.cachedMatches.some(l=>l.id===n)?"cachedMatches":"";o&&this.__store.setState(l=>({...l,[o]:l[o]?.map(u=>u.id===n?r(u):u)}))})},this.getMatch=n=>{const r=o=>o.id===n;return this.state.cachedMatches.find(r)??this.state.pendingMatches?.find(r)??this.state.matches.find(r)},this.invalidate=n=>{const r=o=>n?.filter?.(o)??!0?{...o,invalid:!0,...n?.forcePending||o.status==="error"||o.status==="notFound"?{status:"pending",error:void 0}:void 0}:o;return this.__store.setState(o=>({...o,matches:o.matches.map(r),cachedMatches:o.cachedMatches.map(r),pendingMatches:o.pendingMatches?.map(r)})),this.shouldViewTransition=!1,this.load({sync:n?.sync})},this.getParsedLocationHref=n=>n.publicHref||"/",this.resolveRedirect=n=>{const r=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const o=n.options._builtLocation??this.buildLocation(n.options),l=this.getParsedLocationHref(o);n.options.href=l,n.headers.set("Location",l)}else if(r)try{const o=new URL(r);if(this.origin&&o.origin===this.origin){const l=o.pathname+o.search+o.hash;n.options.href=l,n.headers.set("Location",l)}}catch{}return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const r=n?.filter;r!==void 0?this.__store.setState(o=>({...o,cachedMatches:o.cachedMatches.filter(l=>!r(l))})):this.__store.setState(o=>({...o,cachedMatches:[]}))},this.clearExpiredCache=()=>{const n=r=>{const o=this.looseRoutesById[r.routeId];if(!o.options.loader)return!0;const l=(r.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??300*1e3;return r.status==="error"?!0:Date.now()-r.updatedAt>=l};this.clearCache({filter:n})},this.loadRouteChunk=VN,this.preloadRoute=async n=>{const r=this.buildLocation(n);let o=this.matchRoutes(r,{throwOnError:!0,preload:!0,dest:n});const l=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(d=>d.id)),u=new Set([...l,...this.state.cachedMatches.map(d=>d.id)]);ou(()=>{o.forEach(d=>{u.has(d.id)||this.__store.setState(h=>({...h,cachedMatches:[...h.cachedMatches,d]}))})});try{return o=await J1({router:this,matches:o,location:r,preload:!0,updateMatch:(d,h)=>{l.has(d)?o=o.map(m=>m.id===d?h(m):m):this.updateMatch(d,h)}}),o}catch(d){if(Fr(d))return d.options.reloadDocument?void 0:await this.preloadRoute({...d.options,_fromLocation:r});yr(d)||console.error(d);return}},this.matchRoute=(n,r)=>{const o={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},l=this.buildLocation(o);if(r?.pending&&this.state.status!=="pending")return!1;const d=(r?.pending===void 0?!this.state.isLoading:r.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,h=Hz(l.pathname,r?.caseSensitive??!1,r?.fuzzy??!1,d.pathname,this.processedTree);return!h||n.params&&!Do(h.rawParams,n.params,{partial:!0})?!1:r?.includeSearch??!0?Do(d.search,l.search,{partial:!0})?h.rawParams:!1:h.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(n=>n.status==="notFound"||n.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...t,caseSensitive:t.caseSensitive??!1,notFoundMode:t.notFoundMode??"fuzzy",stringifySearch:t.stringifySearch??f4,parseSearch:t.parseSearch??d4}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:t,routesByPath:n,processedTree:r}){this.routesById=t,this.routesByPath=n,this.processedTree=r;const o=this.options.notFoundRoute;o&&(o.init({originalIndex:99999999999}),this.routesById[o.id]=o)}get looseRoutesById(){return this.routesById}matchRoutesInternal(t,n){const r=this.getMatchedRoutes(t.pathname),{foundRoute:o,routeParams:l,parsedParams:u}=r;let{matchedRoutes:d}=r,h=!1;(o?o.path!=="/"&&l["**"]:ra(t.pathname))&&(this.options.notFoundRoute?d=[...d,this.options.notFoundRoute]:h=!0);const m=h?T4(this.options.notFoundMode,d):void 0,v=[],g=y=>y?.id?y.context??this.options.context??void 0:this.options.context??void 0;return d.forEach((y,w)=>{const S=v[w-1],[j,N,C]=(()=>{const G=S?.search??t.search,ae=S?._strictSearch??void 0;try{const L=Vf(y.options.validateSearch,{...G})??void 0;return[{...G,...L},{...ae,...L},void 0]}catch(L){let $=L;if(L instanceof oh||($=new oh(L.message,{cause:L})),n?.throwOnError)throw $;return[G,{},$]}})(),_=y.options.loaderDeps?.({search:j})??"",E=_?JSON.stringify(_):"",{interpolatedPath:M,usedParams:A}=ev({path:y.fullPath,params:l,decoder:this.pathParamsDecoder,server:this.isServer}),R=y.id+M+E,T=this.getMatch(R),O=this.state.matches.find(G=>G.routeId===y.id),D=T?._strictParams??A;let z;if(!T)try{ej(y,A,u,D)}catch(G){if(yr(G)||Fr(G)?z=G:z=new C4(G.message,{cause:G}),n?.throwOnError)throw z}Object.assign(l,D);const B=O?"stay":"enter";let V;if(T)V={...T,cause:B,params:O?er(O.params,l):l,_strictParams:D,search:er(O?O.search:T.search,j),_strictSearch:N};else{const G=y.options.loader||y.options.beforeLoad||y.lazyFn||HN(y)?"pending":"success";V={id:R,ssr:y.options.ssr,index:w,routeId:y.id,params:O?er(O.params,l):l,_strictParams:D,pathname:M,updatedAt:Date.now(),search:O?er(O.search,j):j,_strictSearch:N,searchError:void 0,status:G,isFetching:!1,error:void 0,paramsError:z,__routeContext:void 0,_nonReactive:{loadPromise:hl()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:B,loaderDeps:O?er(O.loaderDeps,_):_,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:y.options.staticData||{},fullPath:y.fullPath}}n?.preload||(V.globalNotFound=m===y.id),V.searchError=C;const Y=g(S);V.context={...Y,...V.__routeContext,...V.__beforeLoadContext},v.push(V)}),v.forEach((y,w)=>{const S=this.looseRoutesById[y.routeId];if(!this.getMatch(y.id)){const N=v[w-1],C=g(N);if(S.options.context){const _={deps:y.loaderDeps,params:y.params,context:C??{},location:t,navigate:E=>this.navigate({...E,_fromLocation:t}),buildLocation:this.buildLocation,cause:y.cause,abortController:y.abortController,preload:!!y.preload,matches:v};y.__routeContext=S.options.context(_)??void 0}y.context={...C,...y.__routeContext,...y.__beforeLoadContext}}}),v}matchRoutesLightweight(t){const{matchedRoutes:n,routeParams:r,parsedParams:o}=this.getMatchedRoutes(t.pathname),l=hu(n),u={...t.search};for(const v of n)try{Object.assign(u,Vf(v.options.validateSearch,u))}catch{}const d=hu(this.state.matches),h=d&&d.routeId===l.id&&t.pathname===this.state.location.pathname;let m;if(h)m=d.params;else{const v={...r};for(const g of n)try{ej(g,r,o??{},v)}catch{}m=v}return{matchedRoutes:n,fullPath:l.fullPath,search:u,params:m}}}class oh extends Error{}class C4 extends Error{}function N4(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function Vf(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new oh("Async validation not supported");if(n.issues)throw new oh(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function k4({pathname:e,routesById:t,processedTree:n}){const r={},o=ra(e);let l,u;const d=Yz(o,n,!0);return d&&(l=d.route,Object.assign(r,d.rawParams),u=Object.assign({},d.parsedParams)),{matchedRoutes:d?.branch||[t[$r]],routeParams:r,foundRoute:l,parsedParams:u}}function _4({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return E4(n)(e,t,r??!1)}function E4(e){const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const o of e){if("search"in o.options)o.options.search?.middlewares&&t.middlewares.push(...o.options.search.middlewares);else if(o.options.preSearchFilters||o.options.postSearchFilters){const l=({search:u,next:d})=>{let h=u;"preSearchFilters"in o.options&&o.options.preSearchFilters&&(h=o.options.preSearchFilters.reduce((v,g)=>g(v),u));const m=d(h);return"postSearchFilters"in o.options&&o.options.postSearchFilters?o.options.postSearchFilters.reduce((v,g)=>g(v),m):m};t.middlewares.push(l)}if(o.options.validateSearch){const l=({search:u,next:d})=>{const h=d(u);if(!t._includeValidateSearch)return h;try{return{...h,...Vf(o.options.validateSearch,h)??void 0}}catch{return h}};t.middlewares.push(l)}}const n=({search:o})=>{const l=t.dest;return l.search?l.search===!0?o:qa(l.search,o):{}};t.middlewares.push(n);const r=(o,l,u)=>{if(o>=u.length)return l;const d=u[o];return d({search:l,next:m=>r(o+1,m,u)})};return function(l,u,d){return t.dest=u,t._includeValidateSearch=d,r(0,l,t.middlewares)}}function T4(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.children)return r.id}return $r}function ej(e,t,n,r){const o=e.options.params?.parse??e.options.parseParams;if(o)if(e.options.skipRouteOnParseError)for(const l in t)l in n&&(r[l]=n[l]);else{const l=o(r);Object.assign(r,l)}}const M4="Error preloading route! ☝️";class GN{constructor(t){if(this.init=n=>{this.originalIndex=n.originalIndex;const r=this.options,o=!r?.path&&!r?.id;this.parentRoute=this.options.getParentRoute?.(),o?this._path=$r:this.parentRoute||da(!1);let l=o?$r:r?.path;l&&l!=="/"&&(l=IN(l));const u=r?.id||l;let d=o?$r:Uf([this.parentRoute.id===$r?"":this.parentRoute.id,u]);l===$r&&(l="/"),d!==$r&&(d=Uf(["/",d]));const h=d===$r?"/":Uf([this.parentRoute.fullPath,l]);this._path=l,this._id=d,this._fullPath=h,this._to=ra(h)},this.addChildren=n=>this._addFileChildren(n),this._addFileChildren=n=>(Array.isArray(n)&&(this.children=n),typeof n=="object"&&n!==null&&(this.children=Object.values(n)),this),this._addFileTypes=()=>this,this.updateLoader=n=>(Object.assign(this.options,n),this),this.update=n=>(Object.assign(this.options,n),this),this.lazy=n=>(this.lazyFn=n,this),this.redirect=n=>p4({from:this.fullPath,...n}),this.options=t||{},this.isRoot=!t?.getParentRoute,t?.id&&t?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class R4 extends GN{constructor(t){super(t)}}const jf=typeof window<"u"?p.useLayoutEffect:p.useEffect;function nv(e){const t=p.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function A4(e,t,n={},r={}){p.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!="function")return;const o=new IntersectionObserver(([l])=>{t(l)},n);return o.observe(e.current),()=>{o.disconnect()}},[t,n,r.disabled,e])}function O4(e){const t=p.useRef(null);return p.useImperativeHandle(e,()=>t.current,[]),t}function $x(e){const t=e.errorComponent??Fx;return i.jsx(D4,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?p.createElement(t,{error:n,reset:r}):e.children})}class D4 extends p.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(t){return{resetKey:t.getResetKey()}}static getDerivedStateFromError(t){return{error:t}}reset(){this.setState({error:null})}componentDidUpdate(t,n){n.error&&n.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(t,n){this.props.onCatch&&this.props.onCatch(t,n)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function Fx({error:e}){const[t,n]=p.useState(!1);return i.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[i.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),i.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(r=>!r),children:t?"Hide Error":"Show Error"})]}),i.jsx("div",{style:{height:".25rem"}}),t?i.jsx("div",{children:i.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?i.jsx("code",{children:e.message}):null})}):null]})}function z4({children:e,fallback:t=null}){return ZN()?i.jsx(ee.Fragment,{children:e}):i.jsx(ee.Fragment,{children:t})}function ZN(){return ee.useSyncExternalStore(P4,()=>!0,()=>!1)}function P4(){return()=>{}}var rv={exports:{}},sv={},av={exports:{}},ov={};var tj;function L4(){if(tj)return ov;tj=1;var e=Pu();function t(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function d(g,y){var w=y(),S=r({inst:{value:w,getSnapshot:y}}),j=S[0].inst,N=S[1];return l(function(){j.value=w,j.getSnapshot=y,h(j)&&N({inst:j})},[g,w,y]),o(function(){return h(j)&&N({inst:j}),g(function(){h(j)&&N({inst:j})})},[g]),u(w),w}function h(g){var y=g.getSnapshot;g=g.value;try{var w=y();return!n(g,w)}catch{return!0}}function m(g,y){return y()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:d;return ov.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,ov}var nj;function QN(){return nj||(nj=1,av.exports=L4()),av.exports}var rj;function I4(){if(rj)return sv;rj=1;var e=Pu(),t=QN();function n(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,l=e.useRef,u=e.useEffect,d=e.useMemo,h=e.useDebugValue;return sv.useSyncExternalStoreWithSelector=function(m,v,g,y,w){var S=l(null);if(S.current===null){var j={hasValue:!1,value:null};S.current=j}else j=S.current;S=d(function(){function C(R){if(!_){if(_=!0,E=R,R=y(R),w!==void 0&&j.hasValue){var T=j.value;if(w(T,R))return M=T}return M=R}if(T=M,r(E,R))return T;var O=y(R);return w!==void 0&&w(T,O)?(E=R,T):(E=R,M=O)}var _=!1,E,M,A=g===void 0?null:g;return[function(){return C(v())},A===null?void 0:function(){return C(A())}]},[v,g,y,w]);var N=o(m,S[0],S[1]);return u(function(){j.hasValue=!0,j.value=N},[N]),h(N),N},sv}var sj;function $4(){return sj||(sj=1,rv.exports=I4()),rv.exports}var F4=$4();function B4(e,t=r=>r,n={}){const r=n.equal??U4;return F4.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function U4(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=aj(e);if(n.length!==aj(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function aj(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const iv=p.createContext(null);function KN(){return typeof document>"u"?iv:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=iv,iv)}function Ur(e){const t=p.useContext(KN());return e?.warn,t}function $n(e){const t=Ur({warn:e?.router===void 0}),n=e?.router||t,r=p.useRef(void 0);return B4(n.__store,o=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){const l=er(r.current,e.select(o));return r.current=l,l}return e.select(o)}return o})}const Ih=p.createContext(void 0),q4=p.createContext(void 0);function _s(e){const t=p.useContext(e.from?q4:Ih);return $n({select:r=>{const o=r.matches.find(l=>e.from?e.from===l.routeId:l.id===t);if(da(!((e.shouldThrow??!0)&&!o),`Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`),o!==void 0)return e.select?e.select(o):o},structuralSharing:e.structuralSharing})}function Bx(e){return _s({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Ux(e){const{select:t,...n}=e;return _s({...n,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function Go(e){return _s({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function qx(e){return _s({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Xa(e){const t=Ur();return p.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}var Ml=xN();const V4=vN(Ml);function H4(e,t){const n=Ur(),r=O4(t),{activeProps:o,inactiveProps:l,activeOptions:u,to:d,preload:h,preloadDelay:m,hashScrollIntoView:v,replace:g,startTransition:y,resetScroll:w,viewTransition:S,children:j,target:N,disabled:C,style:_,className:E,onClick:M,onFocus:A,onMouseEnter:R,onMouseLeave:T,onTouchStart:O,ignoreBlocker:D,params:z,search:B,hash:V,state:Y,mask:G,reloadDocument:ae,unsafeRelative:L,from:$,_fromLocation:U,...H}=e,le=ZN(),I=$n({select:Qe=>Qe.location.search,structuralSharing:!0}),F=e.from,K=p.useMemo(()=>({...e,from:F}),[n,I,F,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),ne=p.useMemo(()=>n.buildLocation({...K}),[n,K]),X=ne.maskedLocation?ne.maskedLocation.publicHref:ne.publicHref,ue=ne.maskedLocation?ne.maskedLocation.external:ne.external,te=p.useMemo(()=>K4(X,ue,n.history,C),[C,ue,X,n.history]),ye=p.useMemo(()=>{if(te?.external)return nh(te.href)?void 0:te.href;if(!X4(d)&&!(typeof d!="string"||d.indexOf(":")===-1))try{return new URL(d),nh(d)?void 0:d}catch{}},[d,te]),Ce=$n({select:Qe=>{if(ye)return!1;if(u?.exact){if(!Xz(Qe.location.pathname,ne.pathname,n.basepath))return!1}else{const bt=sh(Qe.location.pathname,n.basepath),pt=sh(ne.pathname,n.basepath);if(!(bt.startsWith(pt)&&(bt.length===pt.length||bt[pt.length]==="/")))return!1}return(u?.includeSearch??!0)&&!Do(Qe.location.search,ne.search,{partial:!u?.exact,ignoreUndefined:!u?.explicitUndefined})?!1:u?.includeHash?le&&Qe.location.hash===ne.hash:!0}}),_e=Ce?qa(o,{})??Y4:lv,Re=Ce?lv:qa(l,{})??lv,ge=[E,_e.className,Re.className].filter(Boolean).join(" "),Fe=(_||_e.style||Re.style)&&{..._,..._e.style,...Re.style},[be,Be]=p.useState(!1),nt=p.useRef(!1),ot=e.reloadDocument||ye?!1:h??n.options.defaultPreload,yt=m??n.options.defaultPreloadDelay??0,pe=p.useCallback(()=>{n.preloadRoute({...K}).catch(Qe=>{console.warn(Qe),console.warn(M4)})},[n,K]),Le=p.useCallback(Qe=>{Qe?.isIntersecting&&pe()},[pe]);A4(r,Le,Q4,{disabled:!!C||ot!=="viewport"}),p.useEffect(()=>{nt.current||!C&&ot==="render"&&(pe(),nt.current=!0)},[C,pe,ot]);const Ye=Qe=>{const bt=Qe.currentTarget.getAttribute("target"),pt=N!==void 0?N:bt;if(!C&&!J4(Qe)&&!Qe.defaultPrevented&&(!pt||pt==="_self")&&Qe.button===0){Qe.preventDefault(),Ml.flushSync(()=>{Be(!0)});const Vn=n.subscribe("onResolved",()=>{Vn(),Be(!1)});n.navigate({...K,replace:g,resetScroll:w,hashScrollIntoView:v,startTransition:y,viewTransition:S,ignoreBlocker:D})}};if(ye)return{...H,ref:r,href:ye,...j&&{children:j},...N&&{target:N},...C&&{disabled:C},..._&&{style:_},...E&&{className:E},...M&&{onClick:M},...A&&{onFocus:A},...R&&{onMouseEnter:R},...T&&{onMouseLeave:T},...O&&{onTouchStart:O}};const Oe=Qe=>{C||ot&&pe()},dt=Oe,ct=Qe=>{if(!(C||!ot))if(!yt)pe();else{const bt=Qe.target;if(Fc.has(bt))return;const pt=setTimeout(()=>{Fc.delete(bt),pe()},yt);Fc.set(bt,pt)}},Mn=Qe=>{if(C||!ot||!yt)return;const bt=Qe.target,pt=Fc.get(bt);pt&&(clearTimeout(pt),Fc.delete(bt))};return{...H,..._e,...Re,href:te?.href,ref:r,onClick:Bc([M,Ye]),onFocus:Bc([A,Oe]),onMouseEnter:Bc([R,ct]),onMouseLeave:Bc([T,Mn]),onTouchStart:Bc([O,dt]),disabled:!!C,target:N,...Fe&&{style:Fe},...ge&&{className:ge},...C&&W4,...Ce&&G4,...le&&be&&Z4}}const lv={},Y4={className:"active"},W4={role:"link","aria-disabled":!0},G4={"data-status":"active","aria-current":"page"},Z4={"data-transitioning":"transitioning"},Fc=new WeakMap,Q4={rootMargin:"100px"},Bc=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function K4(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function X4(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}const Ss=p.forwardRef((e,t)=>{const{_asChild:n,...r}=e,{type:o,...l}=H4(r,t),u=typeof r.children=="function"?r.children({isActive:l["data-status"]==="active"}):r.children;if(!n){const{disabled:d,...h}=l;return p.createElement("a",h,u)}return p.createElement(n,l,u)});function J4(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}class e3 extends GN{constructor(t){super(t),this.useMatch=n=>_s({select:n?.select,from:this.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>_s({...n,from:this.id,select:r=>n?.select?n.select(r.context):r.context}),this.useSearch=n=>qx({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useParams=n=>Go({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useLoaderDeps=n=>Ux({...n,from:this.id}),this.useLoaderData=n=>Bx({...n,from:this.id}),this.useNavigate=()=>Xa({from:this.fullPath}),this.Link=ee.forwardRef((n,r)=>i.jsx(Ss,{ref:r,from:this.fullPath,...n})),this.$$typeof=Symbol.for("react.memo")}}function os(e){return new e3(e)}class t3 extends R4{constructor(t){super(t),this.useMatch=n=>_s({select:n?.select,from:this.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>_s({...n,from:this.id,select:r=>n?.select?n.select(r.context):r.context}),this.useSearch=n=>qx({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useParams=n=>Go({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useLoaderDeps=n=>Ux({...n,from:this.id}),this.useLoaderData=n=>Bx({...n,from:this.id}),this.useNavigate=()=>Xa({from:this.fullPath}),this.Link=ee.forwardRef((n,r)=>i.jsx(Ss,{ref:r,from:this.fullPath,...n})),this.$$typeof=Symbol.for("react.memo")}}function n3(e){return new t3(e)}function oj(e){return typeof e=="object"?new ij(e,{silent:!0}).createRoute(e):new ij(e,{silent:!0}).createRoute}class ij{constructor(t,n){this.path=t,this.createRoute=r=>{this.silent;const o=os(r);return o.isRoot=!1,o},this.silent=n?.silent}}class lj{constructor(t){this.useMatch=n=>_s({select:n?.select,from:this.options.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>_s({from:this.options.id,select:r=>n?.select?n.select(r.context):r.context}),this.useSearch=n=>qx({select:n?.select,structuralSharing:n?.structuralSharing,from:this.options.id}),this.useParams=n=>Go({select:n?.select,structuralSharing:n?.structuralSharing,from:this.options.id}),this.useLoaderDeps=n=>Ux({...n,from:this.options.id}),this.useLoaderData=n=>Bx({...n,from:this.options.id}),this.useNavigate=()=>{const n=Ur();return Xa({from:n.routesById[this.options.id].fullPath})},this.options=t,this.$$typeof=Symbol.for("react.memo")}}function cj(e){return typeof e=="object"?new lj(e):t=>new lj({id:e,...t})}function r3(){const e=Ur(),t=p.useRef({router:e,mounted:!1}),[n,r]=p.useState(!1),{hasPendingMatches:o,isLoading:l}=$n({select:g=>({isLoading:g.isLoading,hasPendingMatches:g.matches.some(y=>y.status==="pending")}),structuralSharing:!0}),u=nv(l),d=l||n||o,h=nv(d),m=l||o,v=nv(m);return e.startTransition=g=>{r(!0),p.startTransition(()=>{g(),r(!1)})},p.useEffect(()=>{const g=e.history.subscribe(e.load),y=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return ra(e.latestLocation.publicHref)!==ra(y.publicHref)&&e.commitLocation({...y,replace:!0}),()=>{g()}},[e,e.history]),jf(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(y){console.error(y)}})()},[e]),jf(()=>{u&&!l&&e.emit({type:"onLoad",...zo(e.state)})},[u,e,l]),jf(()=>{v&&!m&&e.emit({type:"onBeforeRouteMount",...zo(e.state)})},[m,v,e]),jf(()=>{if(h&&!d){const g=zo(e.state);e.emit({type:"onResolved",...g}),e.__store.setState(y=>({...y,status:"idle",resolvedLocation:y.location})),g.hrefChanged&&l4(e)}},[d,h,e]),null}function s3(e){const t=$n({select:n=>`not-found-${n.location.pathname}-${n.status}`});return i.jsx($x,{getResetKey:()=>t,onCatch:(n,r)=>{if(yr(n))e.onCatch?.(n,r);else throw n},errorComponent:({error:n})=>{if(yr(n))return e.fallback?.(n);throw n},children:e.children})}function a3(){return i.jsx("p",{children:"Not Found"})}function Zi(e){return i.jsx(i.Fragment,{children:e.children})}function XN(e,t,n){return t.options.notFoundComponent?i.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?i.jsx(e.options.defaultNotFoundComponent,{...n}):i.jsx(a3,{})}function o3(){return Ur().isScrollRestoring,null}const JN=p.memo(function({matchId:t}){const n=Ur(),r=$n({select:j=>{const N=j.matches.findIndex(_=>_.id===t),C=j.matches[N];return da(C),{routeId:C.routeId,ssr:C.ssr,_displayPending:C._displayPending,resetKey:j.loadedAt,parentRouteId:j.matches[N-1]?.routeId}},structuralSharing:!0}),o=n.routesById[r.routeId],l=o.options.pendingComponent??n.options.defaultPendingComponent,u=l?i.jsx(l,{}):null,d=o.options.errorComponent??n.options.defaultErrorComponent,h=o.options.onCatch??n.options.defaultOnCatch,m=o.isRoot?o.options.notFoundComponent??n.options.notFoundRoute?.options.component:o.options.notFoundComponent,v=r.ssr===!1||r.ssr==="data-only",g=(!o.isRoot||o.options.wrapInSuspense||v)&&(o.options.wrapInSuspense??l??(o.options.errorComponent?.preload||v))?p.Suspense:Zi,y=d?$x:Zi,w=m?s3:Zi,S=o.isRoot?o.options.shellComponent??Zi:Zi;return i.jsxs(S,{children:[i.jsx(Ih.Provider,{value:t,children:i.jsx(g,{fallback:u,children:i.jsx(y,{getResetKey:()=>r.resetKey,errorComponent:d||Fx,onCatch:(j,N)=>{if(yr(j))throw j;h?.(j,N)},children:i.jsx(w,{fallback:j=>{if(!m||j.routeId&&j.routeId!==r.routeId||!j.routeId&&!o.isRoot)throw j;return p.createElement(m,j)},children:v||r._displayPending?i.jsx(z4,{fallback:u,children:i.jsx(uj,{matchId:t})}):i.jsx(uj,{matchId:t})})})})}),r.parentRouteId===$r&&n.options.scrollRestoration?i.jsxs(i.Fragment,{children:[i.jsx(i3,{}),i.jsx(o3,{})]}):null]})});function i3(){const e=Ur(),t=p.useRef(void 0);return i.jsx("script",{suppressHydrationWarning:!0,ref:n=>{n&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:"onRendered",...zo(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}const uj=p.memo(function({matchId:t}){const n=Ur(),{match:r,key:o,routeId:l}=$n({select:h=>{const m=h.matches.find(S=>S.id===t),v=m.routeId,y=(n.routesById[v].options.remountDeps??n.options.defaultRemountDeps)?.({routeId:v,loaderDeps:m.loaderDeps,params:m._strictParams,search:m._strictSearch});return{key:y?JSON.stringify(y):void 0,routeId:v,match:{id:m.id,status:m.status,error:m.error,invalid:m.invalid,_forcePending:m._forcePending,_displayPending:m._displayPending}}},structuralSharing:!0}),u=n.routesById[l],d=p.useMemo(()=>{const h=u.options.component??n.options.defaultComponent;return h?i.jsx(h,{},o):i.jsx(ek,{})},[o,u.options.component,n.options.defaultComponent]);if(r._displayPending)throw n.getMatch(r.id)?._nonReactive.displayPendingPromise;if(r._forcePending)throw n.getMatch(r.id)?._nonReactive.minPendingPromise;if(r.status==="pending"){const h=u.options.pendingMinMs??n.options.defaultPendingMinMs;if(h){const m=n.getMatch(r.id);if(m&&!m._nonReactive.minPendingPromise){const v=hl();m._nonReactive.minPendingPromise=v,setTimeout(()=>{v.resolve(),m._nonReactive.minPendingPromise=void 0},h)}}throw n.getMatch(r.id)?._nonReactive.loadPromise}if(r.status==="notFound")return da(yr(r.error)),XN(n,u,r.error);if(r.status==="redirected")throw da(Fr(r.error)),n.getMatch(r.id)?._nonReactive.loadPromise;if(r.status==="error")throw r.error;return d}),ek=p.memo(function(){const t=Ur(),n=p.useContext(Ih),r=$n({select:m=>m.matches.find(v=>v.id===n)?.routeId}),o=t.routesById[r],l=$n({select:m=>{const g=m.matches.find(y=>y.id===n);return da(g),g.globalNotFound}}),u=$n({select:m=>{const v=m.matches,g=v.findIndex(y=>y.id===n);return v[g+1]?.id}}),d=t.options.defaultPendingComponent?i.jsx(t.options.defaultPendingComponent,{}):null;if(l)return XN(t,o,void 0);if(!u)return null;const h=i.jsx(JN,{matchId:u});return r===$r?i.jsx(p.Suspense,{fallback:d,children:h}):h});function l3(){const e=Ur(),n=e.routesById[$r].options.pendingComponent??e.options.defaultPendingComponent,r=n?i.jsx(n,{}):null,o=typeof document<"u"&&e.ssr?Zi:p.Suspense,l=i.jsxs(o,{fallback:r,children:[i.jsx(r3,{}),i.jsx(c3,{})]});return e.options.InnerWrap?i.jsx(e.options.InnerWrap,{children:l}):l}function c3(){const e=Ur(),t=$n({select:o=>o.matches[0]?.id}),n=$n({select:o=>o.loadedAt}),r=t?i.jsx(JN,{matchId:t}):null;return i.jsx(Ih.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:i.jsx($x,{getResetKey:()=>n,errorComponent:Fx,onCatch:o=>{o.message||o.toString()},children:r})})}const u3=e=>new d3(e);class d3 extends j4{constructor(t){super(t)}}typeof globalThis<"u"?(globalThis.createFileRoute=oj,globalThis.createLazyFileRoute=cj):typeof window<"u"&&(window.createFileRoute=oj,window.createLazyFileRoute=cj);function f3({router:e,children:t,...n}){Object.keys(n).length>0&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=KN(),o=i.jsx(r.Provider,{value:e,children:t});return e.options.Wrap?i.jsx(e.options.Wrap,{children:o}):o}function h3({router:e,...t}){return i.jsx(f3,{router:e,...t,children:i.jsx(l3,{})})}function m3(e){return $n({select:t=>t.location})}const p3="0.0.16";const tk=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const g3=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const v3=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const dj=e=>{const t=v3(e);return t.charAt(0).toUpperCase()+t.slice(1)};var x3={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const y3=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const b3=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:l,iconNode:u,...d},h)=>p.createElement("svg",{ref:h,...x3,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:tk("lucide",o),...!l&&!y3(d)&&{"aria-hidden":"true"},...d},[...u.map(([m,v])=>p.createElement(m,v)),...Array.isArray(l)?l:[l]]));const ve=(e,t)=>{const n=p.forwardRef(({className:r,...o},l)=>p.createElement(b3,{ref:l,iconNode:t,className:tk(`lucide-${g3(dj(e))}`,`lucide-${e}`,r),...o}));return n.displayName=dj(e),n};const w3=[["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"}]],nk=ve("archive",w3);const S3=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],j3=ve("arrow-down",S3);const C3=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],rk=ve("arrow-left",C3);const N3=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],k3=ve("arrow-right",N3);const _3=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],E3=ve("arrow-up-down",_3);const T3=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],M3=ve("arrow-up",T3);const R3=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],nx=ve("bell",R3);const A3=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],O3=ve("bold",A3);const D3=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]],z3=ve("book",D3);const P3=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],L3=ve("bookmark",P3);const I3=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],Vx=ve("braces",I3);const $3=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],pl=ve("calendar",$3);const F3=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ms=ve("check",F3);const B3=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],vn=ve("chevron-down",B3);const U3=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Hx=ve("chevron-left",U3);const q3=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Rl=ve("chevron-right",q3);const V3=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Iu=ve("chevron-up",V3);const H3=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],Y3=ve("chevrons-up-down",H3);const W3=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],$u=ve("circle-alert",W3);const G3=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Yx=ve("circle-check-big",G3);const Z3=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],sk=ve("circle-question-mark",Z3);const Q3=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],K3=ve("circle-x",Q3);const X3=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ih=ve("clock",X3);const J3=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],rx=ve("code-xml",J3);const eP=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],ak=ve("code",eP);const tP=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],ok=ve("copy",tP);const nP=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],ik=ve("dollar-sign",nP);const rP=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],sx=ve("download",rP);const sP=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],aP=ve("ellipsis-vertical",sP);const oP=[["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"}]],lk=ve("ellipsis",oP);const iP=[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}],["path",{d:"M3 16v5h5",key:"1t08am"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 8V3h5",key:"1ln10m"}],["path",{d:"M9 9 3 3",key:"v551iv"}]],lP=ve("expand",iP);const cP=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],uP=ve("external-link",cP);const dP=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],lh=ve("eye",dP);const fP=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],hP=ve("file-code",fP);const mP=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Sr=ve("file-text",mP);const pP=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M11 18h2",key:"12mj7e"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5",key:"qbrxap"}]],ch=ve("file-type",pP);const gP=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],Wx=ve("file",gP);const vP=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],xP=ve("flag",vP);const yP=[["path",{d:"M2 9V5a2 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 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]],Gx=ve("folder-input",yP);const bP=[["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"}]],Zx=ve("folder-open",bP);const wP=[["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"}]],SP=ve("folder-plus",wP);const jP=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],CP=ve("folder-tree",jP);const NP=[["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"}]],uh=ve("folder",NP);const kP=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]],_P=ve("git-compare",kP);const EP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],TP=ve("globe",EP);const MP=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],RP=ve("grid-3x3",MP);const AP=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Qx=ve("hash",AP);const OP=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],DP=ve("heading-2",OP);const zP=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],PP=ve("heart",zP);const LP=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],ck=ve("history",LP);const IP=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],$h=ve("house",IP);const $P=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],ns=ve("image",$P);const FP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],BP=ve("info",FP);const UP=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],qP=ve("italic",UP);const VP=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Kx=ve("layers",VP);const HP=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],YP=ve("layout-dashboard",HP);const WP=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],pu=ve("link-2",WP);const GP=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],uk=ve("link",GP);const ZP=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],gu=ve("list",ZP);const QP=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],vu=ve("loader-circle",QP);const KP=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Xx=ve("lock",KP);const XP=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],JP=ve("log-out",XP);const e5=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],t5=ve("mail",e5);const n5=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],r5=ve("map-pin",n5);const s5=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],a5=ve("message-square",s5);const o5=[["path",{d:"M5 12h14",key:"1ays0h"}]],i5=ve("minus",o5);const l5=[["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"}]],c5=ve("monitor",l5);const u5=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],d5=ve("moon",u5);const f5=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],Jx=ve("music",f5);const h5=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],m5=ve("package",h5);const p5=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],g5=ve("panel-left",p5);const v5=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],fa=ve("pencil",v5);const x5=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],y5=ve("phone",x5);const b5=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Un=ve("plus",b5);const w5=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],S5=ve("quote",w5);const j5=[["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"}]],ey=ve("refresh-cw",j5);const C5=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],xu=ve("rotate-ccw",C5);const N5=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Al=ve("search",N5);const k5=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],_5=ve("settings-2",k5);const E5=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],dk=ve("settings",E5);const T5=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],M5=ve("square-check-big",T5);const R5=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],A5=ve("square-pen",R5);const O5=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],D5=ve("star",O5);const z5=[["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"}]],P5=ve("sun",z5);const L5=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Po=ve("tag",L5);const I5=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],ty=ve("tags",I5);const $5=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],ny=ve("text-align-start",$5);const F5=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],ry=ve("toggle-left",F5);const B5=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Fn=ve("trash-2",B5);const U5=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],q5=ve("trending-up",U5);const V5=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Fo=ve("triangle-alert",V5);const H5=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],sy=ve("upload",H5);const Y5=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],fk=ve("user",Y5);const W5=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],G5=ve("users",W5);const Z5=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],ay=ve("video",Z5);const Q5=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],At=ve("x",Q5);var xs=[],fj="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Cf=0,K5=fj.length;Cf<K5;++Cf)xs[Cf]=fj[Cf];function X5(e){return xs[e>>18&63]+xs[e>>12&63]+xs[e>>6&63]+xs[e&63]}function J5(e,t,n){for(var r,o=[],l=t;l<n;l+=3)r=(e[l]<<16&16711680)+(e[l+1]<<8&65280)+(e[l+2]&255),o.push(X5(r));return o.join("")}function dh(e){for(var t,n=e.length,r=n%3,o=[],l=16383,u=0,d=n-r;u<d;u+=l)o.push(J5(e,u,u+l>d?d:u+l));return r===1?(t=e[n-1],o.push(xs[t>>2]+xs[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],o.push(xs[t>>10]+xs[t>>4&63]+xs[t<<2&63]+"=")),o.join("")}function eL(e){const t=typeof e=="object",n=Object.getPrototypeOf(e),r=n===null||n===Object.prototype||n?.constructor?.name==="Object";return t&&r}const tL=!0,fh=BigInt("-9223372036854775808"),hk=BigInt("9223372036854775807"),nL=BigInt("0"),rL=BigInt("8");BigInt("256");function sL(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}function aL(e){e<nL&&(e-=fh+fh);let t=e.toString(16);t.length%2===1&&(t="0"+t);const n=new Uint8Array(new ArrayBuffer(8));let r=0;for(const o of t.match(/.{2}/g).reverse())n.set([parseInt(o,16)],r++),e>>=rL;return dh(n)}function oL(e){if(e<fh||hk<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);const t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),dh(new Uint8Array(t))}const iL=DataView.prototype.setBigInt64?oL:aL,hj=1024;function lL(e){if(e.length>hj)throw new Error(`Field name ${e} exceeds maximum field name length ${hj}.`);if(e.startsWith("$"))throw new Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){const n=e.charCodeAt(t);if(n<32||n>=127)throw new Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}const mj=16384;function Hf(e){const t=JSON.stringify(e,(n,r)=>r===void 0?"undefined":typeof r=="bigint"?`${r.toString()}n`:r);if(t.length>mj){const n="[...truncated]";let r=mj-n.length;const o=t.codePointAt(r-1);return o!==void 0&&o>65535&&(r-=1),t.substring(0,r)+n}return t}function ax(e,t,n,r){if(e===void 0){const u=n&&` (present at path ${n} in original object ${Hf(t)})`;throw new Error(`undefined is not a valid Convex value${u}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e=="bigint"){if(e<fh||hk<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:iL(e)}}if(typeof e=="number")if(sL(e)){const u=new ArrayBuffer(8);return new DataView(u).setFloat64(0,e,tL),{$float:dh(new Uint8Array(u))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:dh(new Uint8Array(e))};if(Array.isArray(e))return e.map((u,d)=>ax(u,t,n+`[${d}]`));if(e instanceof Set)throw new Error(cv(n,"Set",[...e],t));if(e instanceof Map)throw new Error(cv(n,"Map",[...e],t));if(!eL(e)){const u=e?.constructor?.name,d=u?`${u} `:"";throw new Error(cv(n,d,e,t))}const o={},l=Object.entries(e);l.sort(([u,d],[h,m])=>u===h?0:u<h?-1:1);for(const[u,d]of l)d!==void 0&&(lL(u),o[u]=ax(d,t,n+`.${u}`));return o}function cv(e,t,n,r){return e?`${t}${Hf(n)} is not a supported Convex type (present at path ${e} in original object ${Hf(r)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${Hf(n)} is not a supported Convex type.`}function cL(e){return ax(e,e,"")}var uL=Object.defineProperty,dL=(e,t,n)=>t in e?uL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lt=(e,t,n)=>dL(e,typeof t!="symbol"?t+"":t,n);const fL="https://docs.convex.dev/error#undefined-validator";function yu(e,t){const n=t!==void 0?` for field "${t}"`:"";throw new Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${fL} for details.`)}class Cr{constructor({isOptional:t}){Lt(this,"type"),Lt(this,"fieldPaths"),Lt(this,"isOptional"),Lt(this,"isConvexValidator"),this.isOptional=t,this.isConvexValidator=!0}}class oy extends Cr{constructor({isOptional:t,tableName:n}){if(super({isOptional:t}),Lt(this,"tableName"),Lt(this,"kind","id"),typeof n!="string")throw new Error("v.id(tableName) requires a string");this.tableName=n}get json(){return{type:"id",tableName:this.tableName}}asOptional(){return new oy({isOptional:"optional",tableName:this.tableName})}}class hh extends Cr{constructor(){super(...arguments),Lt(this,"kind","float64")}get json(){return{type:"number"}}asOptional(){return new hh({isOptional:"optional"})}}class mh extends Cr{constructor(){super(...arguments),Lt(this,"kind","int64")}get json(){return{type:"bigint"}}asOptional(){return new mh({isOptional:"optional"})}}class iy extends Cr{constructor(){super(...arguments),Lt(this,"kind","boolean")}get json(){return{type:this.kind}}asOptional(){return new iy({isOptional:"optional"})}}class ly extends Cr{constructor(){super(...arguments),Lt(this,"kind","bytes")}get json(){return{type:this.kind}}asOptional(){return new ly({isOptional:"optional"})}}class cy extends Cr{constructor(){super(...arguments),Lt(this,"kind","string")}get json(){return{type:this.kind}}asOptional(){return new cy({isOptional:"optional"})}}class uy extends Cr{constructor(){super(...arguments),Lt(this,"kind","null")}get json(){return{type:this.kind}}asOptional(){return new uy({isOptional:"optional"})}}class dy extends Cr{constructor(){super(...arguments),Lt(this,"kind","any")}get json(){return{type:this.kind}}asOptional(){return new dy({isOptional:"optional"})}}class Eo extends Cr{constructor({isOptional:t,fields:n}){super({isOptional:t}),Lt(this,"fields"),Lt(this,"kind","object"),globalThis.Object.entries(n).forEach(([r,o])=>{if(o===void 0&&yu("v.object()",r),!o.isConvexValidator)throw new Error("v.object() entries must be validators")}),this.fields=n}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([t,n])=>[t,{fieldType:n.json,optional:n.isOptional==="optional"}]))}}asOptional(){return new Eo({isOptional:"optional",fields:this.fields})}omit(...t){const n={...this.fields};for(const r of t)delete n[r];return new Eo({isOptional:this.isOptional,fields:n})}pick(...t){const n={};for(const r of t)n[r]=this.fields[r];return new Eo({isOptional:this.isOptional,fields:n})}partial(){const t={};for(const[n,r]of globalThis.Object.entries(this.fields))t[n]=r.asOptional();return new Eo({isOptional:this.isOptional,fields:t})}extend(t){return new Eo({isOptional:this.isOptional,fields:{...this.fields,...t}})}}class fy extends Cr{constructor({isOptional:t,value:n}){if(super({isOptional:t}),Lt(this,"value"),Lt(this,"kind","literal"),typeof n!="string"&&typeof n!="boolean"&&typeof n!="number"&&typeof n!="bigint")throw new Error("v.literal(value) must be a string, number, or boolean");this.value=n}get json(){return{type:this.kind,value:cL(this.value)}}asOptional(){return new fy({isOptional:"optional",value:this.value})}}class hy extends Cr{constructor({isOptional:t,element:n}){super({isOptional:t}),Lt(this,"element"),Lt(this,"kind","array"),n===void 0&&yu("v.array()"),this.element=n}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new hy({isOptional:"optional",element:this.element})}}class my extends Cr{constructor({isOptional:t,key:n,value:r}){if(super({isOptional:t}),Lt(this,"key"),Lt(this,"value"),Lt(this,"kind","record"),n===void 0&&yu("v.record()","key"),r===void 0&&yu("v.record()","value"),n.isOptional==="optional")throw new Error("Record validator cannot have optional keys");if(r.isOptional==="optional")throw new Error("Record validator cannot have optional values");if(!n.isConvexValidator||!r.isConvexValidator)throw new Error("Key and value of v.record() but be validators");this.key=n,this.value=r}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new my({isOptional:"optional",key:this.key,value:this.value})}}class py extends Cr{constructor({isOptional:t,members:n}){super({isOptional:t}),Lt(this,"members"),Lt(this,"kind","union"),n.forEach((r,o)=>{if(r===void 0&&yu("v.union()",`member at index ${o}`),!r.isConvexValidator)throw new Error("All members of v.union() must be validators")}),this.members=n}get json(){return{type:this.kind,value:this.members.map(t=>t.json)}}asOptional(){return new py({isOptional:"optional",members:this.members})}}const Tt={id:e=>new oy({isOptional:"required",tableName:e}),null:()=>new uy({isOptional:"required"}),number:()=>new hh({isOptional:"required"}),float64:()=>new hh({isOptional:"required"}),bigint:()=>new mh({isOptional:"required"}),int64:()=>new mh({isOptional:"required"}),boolean:()=>new iy({isOptional:"required"}),string:()=>new cy({isOptional:"required"}),bytes:()=>new ly({isOptional:"required"}),literal:e=>new fy({isOptional:"required",value:e}),array:e=>new hy({isOptional:"required",element:e}),object:e=>new Eo({isOptional:"required",fields:e}),record:(e,t)=>new my({isOptional:"required",key:e,value:t}),union:(...e)=>new py({isOptional:"required",members:e}),any:()=>new dy({isOptional:"required"}),optional:e=>e.asOptional(),nullable:e=>Tt.union(e,Tt.null())};Tt.union(Tt.literal("admin"),Tt.literal("editor"),Tt.literal("author"),Tt.literal("viewer"));const hL=Tt.union(Tt.literal("contentTypes"),Tt.literal("contentEntries"),Tt.literal("mediaItems"),Tt.literal("settings"),Tt.literal("users")),mL=Tt.union(Tt.literal("create"),Tt.literal("read"),Tt.literal("update"),Tt.literal("delete"),Tt.literal("publish"),Tt.literal("unpublish"),Tt.literal("restore"),Tt.literal("manage"),Tt.literal("move"));Tt.object({resource:hL,action:mL,scope:Tt.optional(Tt.union(Tt.literal("all"),Tt.literal("own")))});function el(e,t="all"){return[{resource:e,action:"create",scope:t},{resource:e,action:"read",scope:t},{resource:e,action:"update",scope:t},{resource:e,action:"delete",scope:t}]}function ol(e,t="all"){return[{resource:e,action:"read",scope:t}]}function mk(e="all"){return[{resource:"contentEntries",action:"publish",scope:e},{resource:"contentEntries",action:"unpublish",scope:e}]}const pL={name:"admin",displayName:"Administrator",description:"Full access to all CMS features including settings and content type management",isSystem:!0,permissions:[...el("contentTypes"),...el("contentEntries"),...mk(),{resource:"contentEntries",action:"restore"},...el("mediaItems"),{resource:"settings",action:"manage"},...ol("settings"),...el("users"),{resource:"users",action:"manage"}]},gL={name:"editor",displayName:"Editor",description:"Can manage all content and media, but cannot modify settings or content types",isSystem:!0,permissions:[...ol("contentTypes"),...el("contentEntries"),...mk(),{resource:"contentEntries",action:"restore"},...el("mediaItems")]},vL={name:"author",displayName:"Author",description:"Can create and manage own content and media",isSystem:!0,permissions:[...ol("contentTypes"),{resource:"contentEntries",action:"create"},{resource:"contentEntries",action:"read",scope:"own"},{resource:"contentEntries",action:"update",scope:"own"},{resource:"contentEntries",action:"delete",scope:"own"},{resource:"contentEntries",action:"publish",scope:"own"},{resource:"contentEntries",action:"unpublish",scope:"own"},{resource:"mediaItems",action:"create"},{resource:"mediaItems",action:"read",scope:"all"},{resource:"mediaItems",action:"update",scope:"own"},{resource:"mediaItems",action:"delete",scope:"own"}]},xL={name:"viewer",displayName:"Viewer",description:"Read-only access to published content and media",isSystem:!0,permissions:[...ol("contentTypes"),...ol("contentEntries"),...ol("mediaItems")]},gy={admin:pL,editor:gL,author:vL,viewer:xL};function yL(e,t){if(e.resource!==t.resource||e.action!==t.action)return!1;const n=e.scope??"all",r=t.scope??"all";return n==="all"?!0:r==="own"}function pk(e,t,n){const r=gy[e]??n?.[e];return r?r.permissions.some(o=>yL(o,t)):!1}function bL(e,t){return(gy[e]??t?.[e])?.permissions??[]}function wL(e,t){return gy[e]??t?.[e]}function gk(e,t,n){return bL(e,n).filter(r=>r.resource===t)}function SL(e,t,n){return gk(e,t,n).length>0}const vk=p.createContext(null);function jL({children:e,getUser:t,getUserRole:n,onLogout:r,autoRedirectToLogin:o=!1,loginUrl:l="/login"}){const[u,d]=p.useState(null),[h,m]=p.useState(null),[v,g]=p.useState("loading"),[y,w]=p.useState(null),S=p.useCallback(async()=>{g("loading"),w(null);try{const E=await t();if(!E){d(null),m(null),g("unauthenticated"),o&&typeof window<"u"&&(window.location.href=l);return}const M=await n({userId:E.id});d(E),m(M),g("authenticated")}catch(E){console.error("Authentication error:",E),d(null),m(null),w(E instanceof Error?E.message:"Authentication failed"),g("error")}},[t,n,o,l]);p.useEffect(()=>{S()},[S]);const j=p.useCallback(E=>h?pk(h,E):!1,[h]),N=p.useCallback(async()=>{try{r&&await r(),d(null),m(null),g("unauthenticated"),o&&typeof window<"u"&&(window.location.href=l)}catch(E){console.error("Logout error:",E),w(E instanceof Error?E.message:"Logout failed")}},[r,o,l]),C=p.useCallback(async()=>{await S()},[S]),_={user:u,role:h,authState:v,isLoading:v==="loading",isAuthenticated:v==="authenticated",error:y,checkPermission:j,logout:N,refresh:C};return i.jsx(vk.Provider,{value:_,children:e})}function vy(){const e=p.useContext(vk);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const xk=p.createContext(null),yk="convex-cms-theme";function pj(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function gj(){if(typeof window>"u")return"system";const e=localStorage.getItem(yk);return e==="light"||e==="dark"||e==="system"?e:"system"}function uv(){return typeof window>"u"?!1:document.documentElement.classList.contains("dark")}function CL({children:e,themeMode:t="isolated",darkModeControl:n="independent"}){const r=t==="isolated"||n==="independent",o=t==="inherit"&&n==="follow-parent",[l,u]=p.useState(()=>o?uv()?"dark":"light":gj()),[d,h]=p.useState(()=>{if(o)return uv()?"dark":"light";const g=gj();return g==="system"?pj():g}),m=p.useCallback(g=>{const y=g==="system"?pj():g;if(h(y),r){const w=document.documentElement;w.classList.remove("light","dark"),w.classList.add(y)}},[r]),v=p.useCallback(g=>{r&&(u(g),localStorage.setItem(yk,g),m(g))},[m,r]);return p.useEffect(()=>{o||m(l)},[l,m,o]),p.useEffect(()=>{if(!o){const g=window.matchMedia("(prefers-color-scheme: dark)"),y=()=>{l==="system"&&m("system")};return g.addEventListener("change",y),()=>g.removeEventListener("change",y)}},[l,m,o]),p.useEffect(()=>{if(!o)return;const g=()=>{const S=uv()?"dark":"light";u(S),h(S)};g();const y=new MutationObserver(w=>{for(const S of w)if(S.type==="attributes"&&S.attributeName==="class"){g();break}});return y.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>y.disconnect()},[o]),i.jsx(xk.Provider,{value:{theme:l,resolvedTheme:d,setTheme:v,canToggleDarkMode:r},children:e})}function NL(){const e=p.useContext(xk);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function fe(e,t,n){function r(d,h){if(d._zod||Object.defineProperty(d,"_zod",{value:{def:h,constr:u,traits:new Set},enumerable:!1}),d._zod.traits.has(e))return;d._zod.traits.add(e),t(d,h);const m=u.prototype,v=Object.keys(m);for(let g=0;g<v.length;g++){const y=v[g];y in d||(d[y]=m[y].bind(d))}}const o=n?.Parent??Object;class l extends o{}Object.defineProperty(l,"name",{value:e});function u(d){var h;const m=n?.Parent?new l:this;r(m,d),(h=m._zod).deferred??(h.deferred=[]);for(const v of m._zod.deferred)v();return m}return Object.defineProperty(u,"init",{value:r}),Object.defineProperty(u,Symbol.hasInstance,{value:d=>n?.Parent&&d instanceof n.Parent?!0:d?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class il extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class bk extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const wk={};function Wa(e){return wk}function Sk(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function ox(e,t){return typeof t=="bigint"?t.toString():t}function xy(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function yy(e){return e==null}function by(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function kL(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const h=r.match(/\d?e-(\d?)/);h?.[1]&&(o=Number.parseInt(h[1]))}const l=n>o?n:o,u=Number.parseInt(e.toFixed(l).replace(".","")),d=Number.parseInt(t.toFixed(l).replace(".",""));return u%d/10**l}const vj=Symbol("evaluating");function Nt(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==vj)return r===void 0&&(r=vj,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Zo(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ja(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function xj(e){return JSON.stringify(e)}function _L(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const jk="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ph(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const EL=xy(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function gl(e){if(ph(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(ph(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Ck(e){return gl(e)?{...e}:Array.isArray(e)?[...e]:e}const TL=new Set(["string","number","symbol"]);function Fh(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eo(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function $e(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ML(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const RL={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function AL(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const l=Ja(e._zod.def,{get shape(){const u={};for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&(u[d]=n.shape[d])}return Zo(this,"shape",u),u},checks:[]});return eo(e,l)}function OL(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const l=Ja(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&delete u[d]}return Zo(this,"shape",u),u},checks:[]});return eo(e,l)}function DL(e,t){if(!gl(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const l=e._zod.def.shape;for(const u in t)if(Object.getOwnPropertyDescriptor(l,u)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Ja(e._zod.def,{get shape(){const l={...e._zod.def.shape,...t};return Zo(this,"shape",l),l}});return eo(e,o)}function zL(e,t){if(!gl(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Ja(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Zo(this,"shape",r),r}});return eo(e,n)}function PL(e,t){const n=Ja(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Zo(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return eo(e,n)}function LL(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=Ja(t._zod.def,{get shape(){const d=t._zod.def.shape,h={...d};if(n)for(const m in n){if(!(m in d))throw new Error(`Unrecognized key: "${m}"`);n[m]&&(h[m]=e?new e({type:"optional",innerType:d[m]}):d[m])}else for(const m in d)h[m]=e?new e({type:"optional",innerType:d[m]}):d[m];return Zo(this,"shape",h),h},checks:[]});return eo(t,u)}function IL(e,t,n){const r=Ja(t._zod.def,{get shape(){const o=t._zod.def.shape,l={...o};if(n)for(const u in n){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(l[u]=new e({type:"nonoptional",innerType:o[u]}))}else for(const u in o)l[u]=new e({type:"nonoptional",innerType:o[u]});return Zo(this,"shape",l),l}});return eo(t,r)}function tl(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function nl(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Nf(e){return typeof e=="string"?e:e?.message}function Ga(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=Nf(e.inst?._zod.def?.error?.(e))??Nf(t?.error?.(e))??Nf(n.customError?.(e))??Nf(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function wy(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function bu(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Nk=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ox,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},kk=fe("$ZodError",Nk),_k=fe("$ZodError",Nk,{Parent:Error});function $L(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function FL(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const l of o.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>r({issues:u}));else if(l.code==="invalid_key")r({issues:l.issues});else if(l.code==="invalid_element")r({issues:l.issues});else if(l.path.length===0)n._errors.push(t(l));else{let u=n,d=0;for(;d<l.path.length;){const h=l.path[d];d===l.path.length-1?(u[h]=u[h]||{_errors:[]},u[h]._errors.push(t(l))):u[h]=u[h]||{_errors:[]},u=u[h],d++}}};return r(e),n}const Sy=e=>(t,n,r,o)=>{const l=r?Object.assign(r,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},l);if(u instanceof Promise)throw new il;if(u.issues.length){const d=new(o?.Err??e)(u.issues.map(h=>Ga(h,l,Wa())));throw jk(d,o?.callee),d}return u.value},jy=e=>async(t,n,r,o)=>{const l=r?Object.assign(r,{async:!0}):{async:!0};let u=t._zod.run({value:n,issues:[]},l);if(u instanceof Promise&&(u=await u),u.issues.length){const d=new(o?.Err??e)(u.issues.map(h=>Ga(h,l,Wa())));throw jk(d,o?.callee),d}return u.value},Bh=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},l=t._zod.run({value:n,issues:[]},o);if(l instanceof Promise)throw new il;return l.issues.length?{success:!1,error:new(e??kk)(l.issues.map(u=>Ga(u,o,Wa())))}:{success:!0,data:l.value}},BL=Bh(_k),Uh=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let l=t._zod.run({value:n,issues:[]},o);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(u=>Ga(u,o,Wa())))}:{success:!0,data:l.value}},UL=Uh(_k),qL=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Sy(e)(t,n,o)},VL=e=>(t,n,r)=>Sy(e)(t,n,r),HL=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return jy(e)(t,n,o)},YL=e=>async(t,n,r)=>jy(e)(t,n,r),WL=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Bh(e)(t,n,o)},GL=e=>(t,n,r)=>Bh(e)(t,n,r),ZL=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Uh(e)(t,n,o)},QL=e=>async(t,n,r)=>Uh(e)(t,n,r),KL=/^[cC][^\s-]{8,}$/,XL=/^[0-9a-z]+$/,JL=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,eI=/^[0-9a-vA-V]{20}$/,tI=/^[A-Za-z0-9]{27}$/,nI=/^[a-zA-Z0-9_-]{21}$/,rI=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,sI=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,yj=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,aI=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,oI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function iI(){return new RegExp(oI,"u")}const lI=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,cI=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,uI=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,dI=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fI=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ek=/^[A-Za-z0-9_-]*$/,hI=/^\+[1-9]\d{6,14}$/,Tk="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",mI=new RegExp(`^${Tk}$`);function Mk(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function pI(e){return new RegExp(`^${Mk(e)}$`)}function gI(e){const t=Mk({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Tk}T(?:${r})$`)}const vI=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},xI=/^-?\d+$/,Rk=/^-?\d+(?:\.\d+)?$/,yI=/^(?:true|false)$/i,bI=/^[^A-Z]*$/,wI=/^[^a-z]*$/,rr=fe("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ak={number:"number",bigint:"bigint",object:"date"},Ok=fe("$ZodCheckLessThan",(e,t)=>{rr.init(e,t);const n=Ak[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,l=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<l&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Dk=fe("$ZodCheckGreaterThan",(e,t)=>{rr.init(e,t);const n=Ak[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,l=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>l&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),SI=fe("$ZodCheckMultipleOf",(e,t)=>{rr.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):kL(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),jI=fe("$ZodCheckNumberFormat",(e,t)=>{rr.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,l]=RL[t.format];e._zod.onattach.push(u=>{const d=u._zod.bag;d.format=t.format,d.minimum=o,d.maximum=l,n&&(d.pattern=xI)}),e._zod.check=u=>{const d=u.value;if(n){if(!Number.isInteger(d)){u.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:d,inst:e});return}if(!Number.isSafeInteger(d)){d>0?u.issues.push({input:d,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):u.issues.push({input:d,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}d<o&&u.issues.push({origin:"number",input:d,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),d>l&&u.issues.push({origin:"number",input:d,code:"too_big",maximum:l,inclusive:!0,inst:e,continue:!t.abort})}}),CI=fe("$ZodCheckMaxLength",(e,t)=>{var n;rr.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!yy(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const u=wy(o);r.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),NI=fe("$ZodCheckMinLength",(e,t)=>{var n;rr.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!yy(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const u=wy(o);r.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),kI=fe("$ZodCheckLengthEquals",(e,t)=>{var n;rr.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!yy(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,l=o.length;if(l===t.length)return;const u=wy(o),d=l>t.length;r.issues.push({origin:u,...d?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),qh=fe("$ZodCheckStringFormat",(e,t)=>{var n,r;rr.init(e,t),e._zod.onattach.push(o=>{const l=o._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),_I=fe("$ZodCheckRegex",(e,t)=>{qh.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),EI=fe("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=bI),qh.init(e,t)}),TI=fe("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=wI),qh.init(e,t)}),MI=fe("$ZodCheckIncludes",(e,t)=>{rr.init(e,t);const n=Fh(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const l=o._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),RI=fe("$ZodCheckStartsWith",(e,t)=>{rr.init(e,t);const n=new RegExp(`^${Fh(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),AI=fe("$ZodCheckEndsWith",(e,t)=>{rr.init(e,t);const n=new RegExp(`.*${Fh(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),OI=fe("$ZodCheckOverwrite",(e,t)=>{rr.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class DI{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
11
- `).filter(u=>u),o=Math.min(...r.map(u=>u.length-u.trimStart().length)),l=r.map(u=>u.slice(o)).map(u=>" ".repeat(this.indent*2)+u);for(const u of l)this.content.push(u)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(l=>` ${l}`)];return new t(...n,o.join(`
12
- `))}}const zI={major:4,minor:3,patch:6},Yt=fe("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=zI;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const l of o._zod.onattach)l(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(u,d,h)=>{let m=tl(u),v;for(const g of d){if(g._zod.def.when){if(!g._zod.def.when(u))continue}else if(m)continue;const y=u.issues.length,w=g._zod.check(u);if(w instanceof Promise&&h?.async===!1)throw new il;if(v||w instanceof Promise)v=(v??Promise.resolve()).then(async()=>{await w,u.issues.length!==y&&(m||(m=tl(u,y)))});else{if(u.issues.length===y)continue;m||(m=tl(u,y))}}return v?v.then(()=>u):u},l=(u,d,h)=>{if(tl(u))return u.aborted=!0,u;const m=o(d,r,h);if(m instanceof Promise){if(h.async===!1)throw new il;return m.then(v=>e._zod.parse(v,h))}return e._zod.parse(m,h)};e._zod.run=(u,d)=>{if(d.skipChecks)return e._zod.parse(u,d);if(d.direction==="backward"){const m=e._zod.parse({value:u.value,issues:[]},{...d,skipChecks:!0});return m instanceof Promise?m.then(v=>l(v,u,d)):l(m,u,d)}const h=e._zod.parse(u,d);if(h instanceof Promise){if(d.async===!1)throw new il;return h.then(m=>o(m,r,d))}return o(h,r,d)}}Nt(e,"~standard",()=>({validate:o=>{try{const l=BL(e,o);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return UL(e,o).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),Cy=fe("$ZodString",(e,t)=>{Yt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??vI(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),It=fe("$ZodStringFormat",(e,t)=>{qh.init(e,t),Cy.init(e,t)}),PI=fe("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=sI),It.init(e,t)}),LI=fe("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=yj(r))}else t.pattern??(t.pattern=yj());It.init(e,t)}),II=fe("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=aI),It.init(e,t)}),$I=fe("$ZodURL",(e,t)=>{It.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),FI=fe("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=iI()),It.init(e,t)}),BI=fe("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=nI),It.init(e,t)}),UI=fe("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=KL),It.init(e,t)}),qI=fe("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=XL),It.init(e,t)}),VI=fe("$ZodULID",(e,t)=>{t.pattern??(t.pattern=JL),It.init(e,t)}),HI=fe("$ZodXID",(e,t)=>{t.pattern??(t.pattern=eI),It.init(e,t)}),YI=fe("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=tI),It.init(e,t)}),WI=fe("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=gI(t)),It.init(e,t)}),GI=fe("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=mI),It.init(e,t)}),ZI=fe("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=pI(t)),It.init(e,t)}),QI=fe("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=rI),It.init(e,t)}),KI=fe("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=lI),It.init(e,t),e._zod.bag.format="ipv4"}),XI=fe("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=cI),It.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),JI=fe("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=uI),It.init(e,t)}),e$=fe("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=dI),It.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,l]=r;if(!l)throw new Error;const u=Number(l);if(`${u}`!==l)throw new Error;if(u<0||u>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function zk(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const t$=fe("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=fI),It.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{zk(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function n$(e){if(!Ek.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return zk(n)}const r$=fe("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ek),It.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{n$(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),s$=fe("$ZodE164",(e,t)=>{t.pattern??(t.pattern=hI),It.init(e,t)});function a$(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const o$=fe("$ZodJWT",(e,t)=>{It.init(e,t),e._zod.check=n=>{a$(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Pk=fe("$ZodNumber",(e,t)=>{Yt.init(e,t),e._zod.pattern=e._zod.bag.pattern??Rk,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const l=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...l?{received:l}:{}}),n}}),i$=fe("$ZodNumberFormat",(e,t)=>{jI.init(e,t),Pk.init(e,t)}),l$=fe("$ZodBoolean",(e,t)=>{Yt.init(e,t),e._zod.pattern=yI,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),c$=fe("$ZodUnknown",(e,t)=>{Yt.init(e,t),e._zod.parse=n=>n}),u$=fe("$ZodNever",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function bj(e,t,n){e.issues.length&&t.issues.push(...nl(n,e.issues)),t.value[n]=e.value}const d$=fe("$ZodArray",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const l=[];for(let u=0;u<o.length;u++){const d=o[u],h=t.element._zod.run({value:d,issues:[]},r);h instanceof Promise?l.push(h.then(m=>bj(m,n,u))):bj(h,n,u)}return l.length?Promise.all(l).then(()=>n):n}});function gh(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...nl(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Lk(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=ML(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ik(e,t,n,r,o,l){const u=[],d=o.keySet,h=o.catchall._zod,m=h.def.type,v=h.optout==="optional";for(const g in t){if(d.has(g))continue;if(m==="never"){u.push(g);continue}const y=h.run({value:t[g],issues:[]},r);y instanceof Promise?e.push(y.then(w=>gh(w,n,g,t,v))):gh(y,n,g,t,v)}return u.length&&n.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:l}),e.length?Promise.all(e).then(()=>n):n}const f$=fe("$ZodObject",(e,t)=>{if(Yt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const d=t.shape;Object.defineProperty(t,"shape",{get:()=>{const h={...d};return Object.defineProperty(t,"shape",{value:h}),h}})}const r=xy(()=>Lk(t));Nt(e._zod,"propValues",()=>{const d=t.shape,h={};for(const m in d){const v=d[m]._zod;if(v.values){h[m]??(h[m]=new Set);for(const g of v.values)h[m].add(g)}}return h});const o=ph,l=t.catchall;let u;e._zod.parse=(d,h)=>{u??(u=r.value);const m=d.value;if(!o(m))return d.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),d;d.value={};const v=[],g=u.shape;for(const y of u.keys){const w=g[y],S=w._zod.optout==="optional",j=w._zod.run({value:m[y],issues:[]},h);j instanceof Promise?v.push(j.then(N=>gh(N,d,y,m,S))):gh(j,d,y,m,S)}return l?Ik(v,m,d,h,r.value,e):v.length?Promise.all(v).then(()=>d):d}}),h$=fe("$ZodObjectJIT",(e,t)=>{f$.init(e,t);const n=e._zod.parse,r=xy(()=>Lk(t)),o=y=>{const w=new DI(["shape","payload","ctx"]),S=r.value,j=E=>{const M=xj(E);return`shape[${M}]._zod.run({ value: input[${M}], issues: [] }, ctx)`};w.write("const input = payload.value;");const N=Object.create(null);let C=0;for(const E of S.keys)N[E]=`key_${C++}`;w.write("const newResult = {};");for(const E of S.keys){const M=N[E],A=xj(E),T=y[E]?._zod?.optout==="optional";w.write(`const ${M} = ${j(E)};`),T?w.write(`
13
- if (${M}.issues.length) {
14
- if (${A} in input) {
15
- payload.issues = payload.issues.concat(${M}.issues.map(iss => ({
16
- ...iss,
17
- path: iss.path ? [${A}, ...iss.path] : [${A}]
18
- })));
19
- }
20
- }
21
-
22
- if (${M}.value === undefined) {
23
- if (${A} in input) {
24
- newResult[${A}] = undefined;
25
- }
26
- } else {
27
- newResult[${A}] = ${M}.value;
28
- }
29
-
30
- `):w.write(`
31
- if (${M}.issues.length) {
32
- payload.issues = payload.issues.concat(${M}.issues.map(iss => ({
33
- ...iss,
34
- path: iss.path ? [${A}, ...iss.path] : [${A}]
35
- })));
36
- }
37
-
38
- if (${M}.value === undefined) {
39
- if (${A} in input) {
40
- newResult[${A}] = undefined;
41
- }
42
- } else {
43
- newResult[${A}] = ${M}.value;
44
- }
45
-
46
- `)}w.write("payload.value = newResult;"),w.write("return payload;");const _=w.compile();return(E,M)=>_(y,E,M)};let l;const u=ph,d=!wk.jitless,m=d&&EL.value,v=t.catchall;let g;e._zod.parse=(y,w)=>{g??(g=r.value);const S=y.value;return u(S)?d&&m&&w?.async===!1&&w.jitless!==!0?(l||(l=o(t.shape)),y=l(y,w),v?Ik([],S,y,w,g,e):y):n(y,w):(y.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),y)}});function wj(e,t,n,r){for(const l of e)if(l.issues.length===0)return t.value=l.value,t;const o=e.filter(l=>!tl(l));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(l=>l.issues.map(u=>Ga(u,r,Wa())))}),t)}const m$=fe("$ZodUnion",(e,t)=>{Yt.init(e,t),Nt(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Nt(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Nt(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Nt(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(l=>l._zod.pattern);return new RegExp(`^(${o.map(l=>by(l.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,l)=>{if(n)return r(o,l);let u=!1;const d=[];for(const h of t.options){const m=h._zod.run({value:o.value,issues:[]},l);if(m instanceof Promise)d.push(m),u=!0;else{if(m.issues.length===0)return m;d.push(m)}}return u?Promise.all(d).then(h=>wj(h,o,e,l)):wj(d,o,e,l)}}),p$=fe("$ZodIntersection",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,l=t.left._zod.run({value:o,issues:[]},r),u=t.right._zod.run({value:o,issues:[]},r);return l instanceof Promise||u instanceof Promise?Promise.all([l,u]).then(([h,m])=>Sj(n,h,m)):Sj(n,l,u)}});function ix(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(gl(e)&&gl(t)){const n=Object.keys(t),r=Object.keys(e).filter(l=>n.indexOf(l)!==-1),o={...e,...t};for(const l of r){const u=ix(e[l],t[l]);if(!u.valid)return{valid:!1,mergeErrorPath:[l,...u.mergeErrorPath]};o[l]=u.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],l=t[r],u=ix(o,l);if(!u.valid)return{valid:!1,mergeErrorPath:[r,...u.mergeErrorPath]};n.push(u.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Sj(e,t,n){const r=new Map;let o;for(const d of t.issues)if(d.code==="unrecognized_keys"){o??(o=d);for(const h of d.keys)r.has(h)||r.set(h,{}),r.get(h).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const h of d.keys)r.has(h)||r.set(h,{}),r.get(h).r=!0;else e.issues.push(d);const l=[...r].filter(([,d])=>d.l&&d.r).map(([d])=>d);if(l.length&&o&&e.issues.push({...o,keys:l}),tl(e))return e;const u=ix(t.value,n.value);if(!u.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`);return e.value=u.data,e}const g$=fe("$ZodRecord",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!gl(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const l=[],u=t.keyType._zod.values;if(u){n.value={};const d=new Set;for(const m of u)if(typeof m=="string"||typeof m=="number"||typeof m=="symbol"){d.add(typeof m=="number"?m.toString():m);const v=t.valueType._zod.run({value:o[m],issues:[]},r);v instanceof Promise?l.push(v.then(g=>{g.issues.length&&n.issues.push(...nl(m,g.issues)),n.value[m]=g.value})):(v.issues.length&&n.issues.push(...nl(m,v.issues)),n.value[m]=v.value)}let h;for(const m in o)d.has(m)||(h=h??[],h.push(m));h&&h.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:h})}else{n.value={};for(const d of Reflect.ownKeys(o)){if(d==="__proto__")continue;let h=t.keyType._zod.run({value:d,issues:[]},r);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&Rk.test(d)&&h.issues.length){const g=t.keyType._zod.run({value:Number(d),issues:[]},r);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(h=g)}if(h.issues.length){t.mode==="loose"?n.value[d]=o[d]:n.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(g=>Ga(g,r,Wa())),input:d,path:[d],inst:e});continue}const v=t.valueType._zod.run({value:o[d],issues:[]},r);v instanceof Promise?l.push(v.then(g=>{g.issues.length&&n.issues.push(...nl(d,g.issues)),n.value[h.value]=g.value})):(v.issues.length&&n.issues.push(...nl(d,v.issues)),n.value[h.value]=v.value)}}return l.length?Promise.all(l).then(()=>n):n}}),v$=fe("$ZodEnum",(e,t)=>{Yt.init(e,t);const n=Sk(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>TL.has(typeof o)).map(o=>typeof o=="string"?Fh(o):o.toString()).join("|")})$`),e._zod.parse=(o,l)=>{const u=o.value;return r.has(u)||o.issues.push({code:"invalid_value",values:n,input:u,inst:e}),o}}),x$=fe("$ZodTransform",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new bk(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(u=>(n.value=u,n));if(o instanceof Promise)throw new il;return n.value=o,n}});function jj(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const $k=fe("$ZodOptional",(e,t)=>{Yt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Nt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Nt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${by(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(l=>jj(l,n.value)):jj(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),y$=fe("$ZodExactOptional",(e,t)=>{$k.init(e,t),Nt(e._zod,"values",()=>t.innerType._zod.values),Nt(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),b$=fe("$ZodNullable",(e,t)=>{Yt.init(e,t),Nt(e._zod,"optin",()=>t.innerType._zod.optin),Nt(e._zod,"optout",()=>t.innerType._zod.optout),Nt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${by(n.source)}|null)$`):void 0}),Nt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),w$=fe("$ZodDefault",(e,t)=>{Yt.init(e,t),e._zod.optin="optional",Nt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(l=>Cj(l,t)):Cj(o,t)}});function Cj(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const S$=fe("$ZodPrefault",(e,t)=>{Yt.init(e,t),e._zod.optin="optional",Nt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),j$=fe("$ZodNonOptional",(e,t)=>{Yt.init(e,t),Nt(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(l=>Nj(l,e)):Nj(o,e)}});function Nj(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const C$=fe("$ZodCatch",(e,t)=>{Yt.init(e,t),Nt(e._zod,"optin",()=>t.innerType._zod.optin),Nt(e._zod,"optout",()=>t.innerType._zod.optout),Nt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(l=>(n.value=l.value,l.issues.length&&(n.value=t.catchValue({...n,error:{issues:l.issues.map(u=>Ga(u,r,Wa()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(l=>Ga(l,r,Wa()))},input:n.value}),n.issues=[]),n)}}),N$=fe("$ZodPipe",(e,t)=>{Yt.init(e,t),Nt(e._zod,"values",()=>t.in._zod.values),Nt(e._zod,"optin",()=>t.in._zod.optin),Nt(e._zod,"optout",()=>t.out._zod.optout),Nt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const l=t.out._zod.run(n,r);return l instanceof Promise?l.then(u=>kf(u,t.in,r)):kf(l,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(l=>kf(l,t.out,r)):kf(o,t.out,r)}});function kf(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const k$=fe("$ZodReadonly",(e,t)=>{Yt.init(e,t),Nt(e._zod,"propValues",()=>t.innerType._zod.propValues),Nt(e._zod,"values",()=>t.innerType._zod.values),Nt(e._zod,"optin",()=>t.innerType?._zod?.optin),Nt(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(kj):kj(o)}});function kj(e){return e.value=Object.freeze(e.value),e}const _$=fe("$ZodCustom",(e,t)=>{rr.init(e,t),Yt.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(l=>_j(l,n,r,e));_j(o,n,r,e)}});function _j(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(bu(o))}}var Ej;class E${constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function T$(){return new E$}(Ej=globalThis).__zod_globalRegistry??(Ej.__zod_globalRegistry=T$());const Qc=globalThis.__zod_globalRegistry;function M$(e,t){return new e({type:"string",...$e(t)})}function R$(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$e(t)})}function Tj(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$e(t)})}function A$(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$e(t)})}function O$(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$e(t)})}function D$(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$e(t)})}function z$(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$e(t)})}function P$(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$e(t)})}function L$(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$e(t)})}function I$(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$e(t)})}function $$(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$e(t)})}function F$(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$e(t)})}function B$(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$e(t)})}function U$(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$e(t)})}function q$(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$e(t)})}function V$(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$e(t)})}function H$(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$e(t)})}function Y$(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$e(t)})}function W$(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$e(t)})}function G$(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...$e(t)})}function Z$(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...$e(t)})}function Q$(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$e(t)})}function K$(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$e(t)})}function X$(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$e(t)})}function J$(e,t){return new e({type:"string",format:"date",check:"string_format",...$e(t)})}function e6(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...$e(t)})}function t6(e,t){return new e({type:"string",format:"duration",check:"string_format",...$e(t)})}function n6(e,t){return new e({type:"number",checks:[],...$e(t)})}function r6(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...$e(t)})}function s6(e,t){return new e({type:"boolean",...$e(t)})}function a6(e){return new e({type:"unknown"})}function o6(e,t){return new e({type:"never",...$e(t)})}function Mj(e,t){return new Ok({check:"less_than",...$e(t),value:e,inclusive:!1})}function dv(e,t){return new Ok({check:"less_than",...$e(t),value:e,inclusive:!0})}function Rj(e,t){return new Dk({check:"greater_than",...$e(t),value:e,inclusive:!1})}function fv(e,t){return new Dk({check:"greater_than",...$e(t),value:e,inclusive:!0})}function Aj(e,t){return new SI({check:"multiple_of",...$e(t),value:e})}function Fk(e,t){return new CI({check:"max_length",...$e(t),maximum:e})}function vh(e,t){return new NI({check:"min_length",...$e(t),minimum:e})}function Bk(e,t){return new kI({check:"length_equals",...$e(t),length:e})}function i6(e,t){return new _I({check:"string_format",format:"regex",...$e(t),pattern:e})}function l6(e){return new EI({check:"string_format",format:"lowercase",...$e(e)})}function c6(e){return new TI({check:"string_format",format:"uppercase",...$e(e)})}function u6(e,t){return new MI({check:"string_format",format:"includes",...$e(t),includes:e})}function d6(e,t){return new RI({check:"string_format",format:"starts_with",...$e(t),prefix:e})}function f6(e,t){return new AI({check:"string_format",format:"ends_with",...$e(t),suffix:e})}function Ol(e){return new OI({check:"overwrite",tx:e})}function h6(e){return Ol(t=>t.normalize(e))}function m6(){return Ol(e=>e.trim())}function p6(){return Ol(e=>e.toLowerCase())}function g6(){return Ol(e=>e.toUpperCase())}function v6(){return Ol(e=>_L(e))}function x6(e,t,n){return new e({type:"array",element:t,...$e(n)})}function y6(e,t,n){return new e({type:"custom",check:"custom",fn:t,...$e(n)})}function b6(e){const t=w6(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(bu(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(bu(o))}},e(n.value,n)));return t}function w6(e,t){const n=new rr({check:"custom",...$e(t)});return n._zod.check=e,n}function Uk(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Qc,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function un(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,l=t.seen.get(e);if(l)return l.count++,n.schemaPath.includes(e)&&(l.cycle=n.path),l.schema;const u={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,u);const d=e._zod.toJSONSchema?.();if(d)u.schema=d;else{const v={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,u.schema,v);else{const y=u.schema,w=t.processors[o.type];if(!w)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);w(e,t,y,v)}const g=e._zod.parent;g&&(u.ref||(u.ref=g),un(g,t,v),t.seen.get(g).isParent=!0)}const h=t.metadataRegistry.get(e);return h&&Object.assign(u.schema,h),t.io==="input"&&In(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&u.schema._prefault&&((r=u.schema).default??(r.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}function qk(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const u of e.seen.entries()){const d=e.metadataRegistry.get(u[0])?.id;if(d){const h=r.get(d);if(h&&h!==u[0])throw new Error(`Duplicate schema id "${d}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(d,u[0])}}const o=u=>{const d=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const g=e.external.registry.get(u[0])?.id,y=e.external.uri??(S=>S);if(g)return{ref:y(g)};const w=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=w,{defId:w,ref:`${y("__shared")}#/${d}/${w}`}}if(u[1]===n)return{ref:"#"};const m=`#/${d}/`,v=u[1].schema.id??`__schema${e.counter++}`;return{defId:v,ref:m+v}},l=u=>{if(u[1].schema.$ref)return;const d=u[1],{ref:h,defId:m}=o(u);d.def={...d.schema},m&&(d.defId=m);const v=d.schema;for(const g in v)delete v[g];v.$ref=h};if(e.cycles==="throw")for(const u of e.seen.entries()){const d=u[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>
47
-
48
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of e.seen.entries()){const d=u[1];if(t===u[0]){l(u);continue}if(e.external){const m=e.external.registry.get(u[0])?.id;if(t!==u[0]&&m){l(u);continue}}if(e.metadataRegistry.get(u[0])?.id){l(u);continue}if(d.cycle){l(u);continue}if(d.count>1&&e.reused==="ref"){l(u);continue}}}function Vk(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=u=>{const d=e.seen.get(u);if(d.ref===null)return;const h=d.def??d.schema,m={...h},v=d.ref;if(d.ref=null,v){r(v);const y=e.seen.get(v),w=y.schema;if(w.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(w)):Object.assign(h,w),Object.assign(h,m),u._zod.parent===v)for(const j in h)j==="$ref"||j==="allOf"||j in m||delete h[j];if(w.$ref&&y.def)for(const j in h)j==="$ref"||j==="allOf"||j in y.def&&JSON.stringify(h[j])===JSON.stringify(y.def[j])&&delete h[j]}const g=u._zod.parent;if(g&&g!==v){r(g);const y=e.seen.get(g);if(y?.schema.$ref&&(h.$ref=y.schema.$ref,y.def))for(const w in h)w==="$ref"||w==="allOf"||w in y.def&&JSON.stringify(h[w])===JSON.stringify(y.def[w])&&delete h[w]}e.override({zodSchema:u,jsonSchema:h,path:d.path??[]})};for(const u of[...e.seen.entries()].reverse())r(u[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const u=e.external.registry.get(t)?.id;if(!u)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(u)}Object.assign(o,n.def??n.schema);const l=e.external?.defs??{};for(const u of e.seen.entries()){const d=u[1];d.def&&d.defId&&(l[d.defId]=d.def)}e.external||Object.keys(l).length>0&&(e.target==="draft-2020-12"?o.$defs=l:o.definitions=l);try{const u=JSON.parse(JSON.stringify(o));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:xh(t,"input",e.processors),output:xh(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function In(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return In(r.element,n);if(r.type==="set")return In(r.valueType,n);if(r.type==="lazy")return In(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return In(r.innerType,n);if(r.type==="intersection")return In(r.left,n)||In(r.right,n);if(r.type==="record"||r.type==="map")return In(r.keyType,n)||In(r.valueType,n);if(r.type==="pipe")return In(r.in,n)||In(r.out,n);if(r.type==="object"){for(const o in r.shape)if(In(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(In(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(In(o,n))return!0;return!!(r.rest&&In(r.rest,n))}return!1}const S6=(e,t={})=>n=>{const r=Uk({...n,processors:t});return un(e,r),qk(r,e),Vk(r,e)},xh=(e,t,n={})=>r=>{const{libraryOptions:o,target:l}=r??{},u=Uk({...o??{},target:l,io:t,processors:n});return un(e,u),qk(u,e),Vk(u,e)},j6={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},C6=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:l,maximum:u,format:d,patterns:h,contentEncoding:m}=e._zod.bag;if(typeof l=="number"&&(o.minLength=l),typeof u=="number"&&(o.maxLength=u),d&&(o.format=j6[d]??d,o.format===""&&delete o.format,d==="time"&&delete o.format),m&&(o.contentEncoding=m),h&&h.size>0){const v=[...h];v.length===1?o.pattern=v[0].source:v.length>1&&(o.allOf=[...v.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},N6=(e,t,n,r)=>{const o=n,{minimum:l,maximum:u,format:d,multipleOf:h,exclusiveMaximum:m,exclusiveMinimum:v}=e._zod.bag;typeof d=="string"&&d.includes("int")?o.type="integer":o.type="number",typeof v=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=v,o.exclusiveMinimum=!0):o.exclusiveMinimum=v),typeof l=="number"&&(o.minimum=l,typeof v=="number"&&t.target!=="draft-04"&&(v>=l?delete o.minimum:delete o.exclusiveMinimum)),typeof m=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=m,o.exclusiveMaximum=!0):o.exclusiveMaximum=m),typeof u=="number"&&(o.maximum=u,typeof m=="number"&&t.target!=="draft-04"&&(m<=u?delete o.maximum:delete o.exclusiveMaximum)),typeof h=="number"&&(o.multipleOf=h)},k6=(e,t,n,r)=>{n.type="boolean"},_6=(e,t,n,r)=>{n.not={}},E6=(e,t,n,r)=>{},T6=(e,t,n,r)=>{const o=e._zod.def,l=Sk(o.entries);l.every(u=>typeof u=="number")&&(n.type="number"),l.every(u=>typeof u=="string")&&(n.type="string"),n.enum=l},M6=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},R6=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},A6=(e,t,n,r)=>{const o=n,l=e._zod.def,{minimum:u,maximum:d}=e._zod.bag;typeof u=="number"&&(o.minItems=u),typeof d=="number"&&(o.maxItems=d),o.type="array",o.items=un(l.element,t,{...r,path:[...r.path,"items"]})},O6=(e,t,n,r)=>{const o=n,l=e._zod.def;o.type="object",o.properties={};const u=l.shape;for(const m in u)o.properties[m]=un(u[m],t,{...r,path:[...r.path,"properties",m]});const d=new Set(Object.keys(u)),h=new Set([...d].filter(m=>{const v=l.shape[m]._zod;return t.io==="input"?v.optin===void 0:v.optout===void 0}));h.size>0&&(o.required=Array.from(h)),l.catchall?._zod.def.type==="never"?o.additionalProperties=!1:l.catchall?l.catchall&&(o.additionalProperties=un(l.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},D6=(e,t,n,r)=>{const o=e._zod.def,l=o.inclusive===!1,u=o.options.map((d,h)=>un(d,t,{...r,path:[...r.path,l?"oneOf":"anyOf",h]}));l?n.oneOf=u:n.anyOf=u},z6=(e,t,n,r)=>{const o=e._zod.def,l=un(o.left,t,{...r,path:[...r.path,"allOf",0]}),u=un(o.right,t,{...r,path:[...r.path,"allOf",1]}),d=m=>"allOf"in m&&Object.keys(m).length===1,h=[...d(l)?l.allOf:[l],...d(u)?u.allOf:[u]];n.allOf=h},P6=(e,t,n,r)=>{const o=n,l=e._zod.def;o.type="object";const u=l.keyType,h=u._zod.bag?.patterns;if(l.mode==="loose"&&h&&h.size>0){const v=un(l.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const g of h)o.patternProperties[g.source]=v}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=un(l.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=un(l.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const m=u._zod.values;if(m){const v=[...m].filter(g=>typeof g=="string"||typeof g=="number");v.length>0&&(o.required=v)}},L6=(e,t,n,r)=>{const o=e._zod.def,l=un(o.innerType,t,r),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=o.innerType,n.nullable=!0):n.anyOf=[l,{type:"null"}]},I6=(e,t,n,r)=>{const o=e._zod.def;un(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType},$6=(e,t,n,r)=>{const o=e._zod.def;un(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},F6=(e,t,n,r)=>{const o=e._zod.def;un(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},B6=(e,t,n,r)=>{const o=e._zod.def;un(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType;let u;try{u=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=u},U6=(e,t,n,r)=>{const o=e._zod.def,l=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;un(l,t,r);const u=t.seen.get(e);u.ref=l},q6=(e,t,n,r)=>{const o=e._zod.def;un(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType,n.readOnly=!0},Hk=(e,t,n,r)=>{const o=e._zod.def;un(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType},V6=fe("ZodISODateTime",(e,t)=>{WI.init(e,t),Ut.init(e,t)});function H6(e){return X$(V6,e)}const Y6=fe("ZodISODate",(e,t)=>{GI.init(e,t),Ut.init(e,t)});function W6(e){return J$(Y6,e)}const G6=fe("ZodISOTime",(e,t)=>{ZI.init(e,t),Ut.init(e,t)});function Z6(e){return e6(G6,e)}const Q6=fe("ZodISODuration",(e,t)=>{QI.init(e,t),Ut.init(e,t)});function K6(e){return t6(Q6,e)}const X6=(e,t)=>{kk.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>FL(e,n)},flatten:{value:n=>$L(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ox,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ox,2)}},isEmpty:{get(){return e.issues.length===0}}})},qr=fe("ZodError",X6,{Parent:Error}),J6=Sy(qr),eF=jy(qr),tF=Bh(qr),nF=Uh(qr),rF=qL(qr),sF=VL(qr),aF=HL(qr),oF=YL(qr),iF=WL(qr),lF=GL(qr),cF=ZL(qr),uF=QL(qr),Wt=fe("ZodType",(e,t)=>(Yt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:xh(e,"input"),output:xh(e,"output")}}),e.toJSONSchema=S6(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Ja(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>eo(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>J6(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>tF(e,n,r),e.parseAsync=async(n,r)=>eF(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>nF(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>rF(e,n,r),e.decode=(n,r)=>sF(e,n,r),e.encodeAsync=async(n,r)=>aF(e,n,r),e.decodeAsync=async(n,r)=>oF(e,n,r),e.safeEncode=(n,r)=>iF(e,n,r),e.safeDecode=(n,r)=>lF(e,n,r),e.safeEncodeAsync=async(n,r)=>cF(e,n,r),e.safeDecodeAsync=async(n,r)=>uF(e,n,r),e.refine=(n,r)=>e.check(aB(n,r)),e.superRefine=n=>e.check(oB(n)),e.overwrite=n=>e.check(Ol(n)),e.optional=()=>Pj(e),e.exactOptional=()=>YF(e),e.nullable=()=>Lj(e),e.nullish=()=>Pj(Lj(e)),e.nonoptional=n=>XF(e,n),e.array=()=>Ny(e),e.or=n=>IF([e,n]),e.and=n=>FF(e,n),e.transform=n=>Ij(e,VF(n)),e.default=n=>ZF(e,n),e.prefault=n=>KF(e,n),e.catch=n=>eB(e,n),e.pipe=n=>Ij(e,n),e.readonly=()=>rB(e),e.describe=n=>{const r=e.clone();return Qc.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return Qc.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Qc.get(e);const r=e.clone();return Qc.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Yk=fe("_ZodString",(e,t)=>{Cy.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(r,o,l)=>C6(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(i6(...r)),e.includes=(...r)=>e.check(u6(...r)),e.startsWith=(...r)=>e.check(d6(...r)),e.endsWith=(...r)=>e.check(f6(...r)),e.min=(...r)=>e.check(vh(...r)),e.max=(...r)=>e.check(Fk(...r)),e.length=(...r)=>e.check(Bk(...r)),e.nonempty=(...r)=>e.check(vh(1,...r)),e.lowercase=r=>e.check(l6(r)),e.uppercase=r=>e.check(c6(r)),e.trim=()=>e.check(m6()),e.normalize=(...r)=>e.check(h6(...r)),e.toLowerCase=()=>e.check(p6()),e.toUpperCase=()=>e.check(g6()),e.slugify=()=>e.check(v6())}),dF=fe("ZodString",(e,t)=>{Cy.init(e,t),Yk.init(e,t),e.email=n=>e.check(R$(fF,n)),e.url=n=>e.check(P$(hF,n)),e.jwt=n=>e.check(K$(EF,n)),e.emoji=n=>e.check(L$(mF,n)),e.guid=n=>e.check(Tj(Oj,n)),e.uuid=n=>e.check(A$(_f,n)),e.uuidv4=n=>e.check(O$(_f,n)),e.uuidv6=n=>e.check(D$(_f,n)),e.uuidv7=n=>e.check(z$(_f,n)),e.nanoid=n=>e.check(I$(pF,n)),e.guid=n=>e.check(Tj(Oj,n)),e.cuid=n=>e.check($$(gF,n)),e.cuid2=n=>e.check(F$(vF,n)),e.ulid=n=>e.check(B$(xF,n)),e.base64=n=>e.check(G$(NF,n)),e.base64url=n=>e.check(Z$(kF,n)),e.xid=n=>e.check(U$(yF,n)),e.ksuid=n=>e.check(q$(bF,n)),e.ipv4=n=>e.check(V$(wF,n)),e.ipv6=n=>e.check(H$(SF,n)),e.cidrv4=n=>e.check(Y$(jF,n)),e.cidrv6=n=>e.check(W$(CF,n)),e.e164=n=>e.check(Q$(_F,n)),e.datetime=n=>e.check(H6(n)),e.date=n=>e.check(W6(n)),e.time=n=>e.check(Z6(n)),e.duration=n=>e.check(K6(n))});function vr(e){return M$(dF,e)}const Ut=fe("ZodStringFormat",(e,t)=>{It.init(e,t),Yk.init(e,t)}),fF=fe("ZodEmail",(e,t)=>{II.init(e,t),Ut.init(e,t)}),Oj=fe("ZodGUID",(e,t)=>{PI.init(e,t),Ut.init(e,t)}),_f=fe("ZodUUID",(e,t)=>{LI.init(e,t),Ut.init(e,t)}),hF=fe("ZodURL",(e,t)=>{$I.init(e,t),Ut.init(e,t)}),mF=fe("ZodEmoji",(e,t)=>{FI.init(e,t),Ut.init(e,t)}),pF=fe("ZodNanoID",(e,t)=>{BI.init(e,t),Ut.init(e,t)}),gF=fe("ZodCUID",(e,t)=>{UI.init(e,t),Ut.init(e,t)}),vF=fe("ZodCUID2",(e,t)=>{qI.init(e,t),Ut.init(e,t)}),xF=fe("ZodULID",(e,t)=>{VI.init(e,t),Ut.init(e,t)}),yF=fe("ZodXID",(e,t)=>{HI.init(e,t),Ut.init(e,t)}),bF=fe("ZodKSUID",(e,t)=>{YI.init(e,t),Ut.init(e,t)}),wF=fe("ZodIPv4",(e,t)=>{KI.init(e,t),Ut.init(e,t)}),SF=fe("ZodIPv6",(e,t)=>{XI.init(e,t),Ut.init(e,t)}),jF=fe("ZodCIDRv4",(e,t)=>{JI.init(e,t),Ut.init(e,t)}),CF=fe("ZodCIDRv6",(e,t)=>{e$.init(e,t),Ut.init(e,t)}),NF=fe("ZodBase64",(e,t)=>{t$.init(e,t),Ut.init(e,t)}),kF=fe("ZodBase64URL",(e,t)=>{r$.init(e,t),Ut.init(e,t)}),_F=fe("ZodE164",(e,t)=>{s$.init(e,t),Ut.init(e,t)}),EF=fe("ZodJWT",(e,t)=>{o$.init(e,t),Ut.init(e,t)}),Wk=fe("ZodNumber",(e,t)=>{Pk.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(r,o,l)=>N6(e,r,o),e.gt=(r,o)=>e.check(Rj(r,o)),e.gte=(r,o)=>e.check(fv(r,o)),e.min=(r,o)=>e.check(fv(r,o)),e.lt=(r,o)=>e.check(Mj(r,o)),e.lte=(r,o)=>e.check(dv(r,o)),e.max=(r,o)=>e.check(dv(r,o)),e.int=r=>e.check(Dj(r)),e.safe=r=>e.check(Dj(r)),e.positive=r=>e.check(Rj(0,r)),e.nonnegative=r=>e.check(fv(0,r)),e.negative=r=>e.check(Mj(0,r)),e.nonpositive=r=>e.check(dv(0,r)),e.multipleOf=(r,o)=>e.check(Aj(r,o)),e.step=(r,o)=>e.check(Aj(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function TF(e){return n6(Wk,e)}const MF=fe("ZodNumberFormat",(e,t)=>{i$.init(e,t),Wk.init(e,t)});function Dj(e){return r6(MF,e)}const RF=fe("ZodBoolean",(e,t)=>{l$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>k6(e,n,r)});function mr(e){return s6(RF,e)}const AF=fe("ZodUnknown",(e,t)=>{c$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>E6()});function zj(){return a6(AF)}const OF=fe("ZodNever",(e,t)=>{u$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_6(e,n,r)});function DF(e){return o6(OF,e)}const zF=fe("ZodArray",(e,t)=>{d$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>A6(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(vh(n,r)),e.nonempty=n=>e.check(vh(1,n)),e.max=(n,r)=>e.check(Fk(n,r)),e.length=(n,r)=>e.check(Bk(n,r)),e.unwrap=()=>e.element});function Ny(e,t){return x6(zF,e,t)}const PF=fe("ZodObject",(e,t)=>{h$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>O6(e,n,r,o),Nt(e,"shape",()=>t.shape),e.keyof=()=>ky(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:zj()}),e.loose=()=>e.clone({...e._zod.def,catchall:zj()}),e.strict=()=>e.clone({...e._zod.def,catchall:DF()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>DL(e,n),e.safeExtend=n=>zL(e,n),e.merge=n=>PL(e,n),e.pick=n=>AL(e,n),e.omit=n=>OL(e,n),e.partial=(...n)=>LL(Gk,e,n[0]),e.required=(...n)=>IL(Zk,e,n[0])});function Qo(e,t){const n={type:"object",shape:e??{},...$e(t)};return new PF(n)}const LF=fe("ZodUnion",(e,t)=>{m$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>D6(e,n,r,o),e.options=t.options});function IF(e,t){return new LF({type:"union",options:e,...$e(t)})}const $F=fe("ZodIntersection",(e,t)=>{p$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>z6(e,n,r,o)});function FF(e,t){return new $F({type:"intersection",left:e,right:t})}const BF=fe("ZodRecord",(e,t)=>{g$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>P6(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function UF(e,t,n){return new BF({type:"record",keyType:e,valueType:t,...$e(n)})}const lx=fe("ZodEnum",(e,t)=>{v$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(r,o,l)=>T6(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const l={};for(const u of r)if(n.has(u))l[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new lx({...t,checks:[],...$e(o),entries:l})},e.exclude=(r,o)=>{const l={...t.entries};for(const u of r)if(n.has(u))delete l[u];else throw new Error(`Key ${u} not found in enum`);return new lx({...t,checks:[],...$e(o),entries:l})}});function ky(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new lx({type:"enum",entries:n,...$e(t)})}const qF=fe("ZodTransform",(e,t)=>{x$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>R6(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new bk(e.constructor.name);n.addIssue=l=>{if(typeof l=="string")n.issues.push(bu(l,n.value,t));else{const u=l;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=n.value),u.inst??(u.inst=e),n.issues.push(bu(u))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(l=>(n.value=l,n)):(n.value=o,n)}});function VF(e){return new qF({type:"transform",transform:e})}const Gk=fe("ZodOptional",(e,t)=>{$k.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hk(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Pj(e){return new Gk({type:"optional",innerType:e})}const HF=fe("ZodExactOptional",(e,t)=>{y$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hk(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function YF(e){return new HF({type:"optional",innerType:e})}const WF=fe("ZodNullable",(e,t)=>{b$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>L6(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Lj(e){return new WF({type:"nullable",innerType:e})}const GF=fe("ZodDefault",(e,t)=>{w$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$6(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ZF(e,t){return new GF({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ck(t)}})}const QF=fe("ZodPrefault",(e,t)=>{S$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>F6(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function KF(e,t){return new QF({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ck(t)}})}const Zk=fe("ZodNonOptional",(e,t)=>{j$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>I6(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function XF(e,t){return new Zk({type:"nonoptional",innerType:e,...$e(t)})}const JF=fe("ZodCatch",(e,t)=>{C$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>B6(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function eB(e,t){return new JF({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const tB=fe("ZodPipe",(e,t)=>{N$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>U6(e,n,r,o),e.in=t.in,e.out=t.out});function Ij(e,t){return new tB({type:"pipe",in:e,out:t})}const nB=fe("ZodReadonly",(e,t)=>{k$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>q6(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function rB(e){return new nB({type:"readonly",innerType:e})}const sB=fe("ZodCustom",(e,t)=>{_$.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>M6(e,n)});function aB(e,t={}){return y6(sB,e,t)}function oB(e){return b6(e)}const iB=Qo({id:vr(),path:vr(),label:vr(),icon:vr(),visible:mr().default(!0),section:ky(["main","config"]).default("main"),badge:vr().optional(),exact:mr().optional()}),$j=Qo({appName:vr().default("Convex CMS"),logo:vr().optional(),favicon:vr().optional()}),Fj=Qo({sidebarWidth:TF().min(200).max(400).default(256),sidebarCollapsible:mr().default(!1)}),Bj=Qo({showDashboard:mr().default(!0),showContent:mr().default(!0),showMedia:mr().default(!0),showTaxonomies:mr().default(!0),showContentTypes:mr().default(!0),showTrash:mr().default(!0),showUsers:mr().default(!0),showSettings:mr().default(!0),customItems:Ny(iB).default([])}),lB=Qo({value:vr(),label:vr(),description:vr().optional()}),Uj=Qo({mode:ky(["light","dark","system"]).default("system"),allowModeSwitch:mr().default(!0),tokens:UF(vr(),vr()).optional()}),cB=Qo({branding:$j.default(()=>$j.parse({})),layout:Fj.default(()=>Fj.parse({})),navigation:Bj.default(()=>Bj.parse({})),theme:Uj.default(()=>Uj.parse({})),customRoles:Ny(lB).default([]),overrideBuiltInRoles:mr().default(!1)}),uB=[{id:"dashboard",path:"/",label:"Dashboard",icon:"LayoutDashboard",section:"main",exact:!0},{id:"content",path:"/content",label:"Content",icon:"FileText",section:"main"},{id:"media",path:"/media",label:"Media",icon:"Image",section:"main"},{id:"taxonomies",path:"/taxonomies",label:"Taxonomies",icon:"Tags",section:"main"},{id:"content-types",path:"/content-types",label:"Content Types",icon:"Layers",section:"config"},{id:"trash",path:"/trash",label:"Trash",icon:"Trash2",section:"config"},{id:"users",path:"/users",label:"Users",icon:"Users",section:"config"},{id:"settings",path:"/settings",label:"Settings",icon:"Settings",section:"config"}];function dB(e){return cB.parse(e??{})}function fB(e){const t={dashboard:e.navigation.showDashboard,content:e.navigation.showContent,media:e.navigation.showMedia,taxonomies:e.navigation.showTaxonomies,"content-types":e.navigation.showContentTypes,trash:e.navigation.showTrash,users:e.navigation.showUsers,settings:e.navigation.showSettings},r=[...uB.filter(o=>t[o.id]!==!1),...e.navigation.customItems.filter(o=>o.visible!==!1)];return{main:r.filter(o=>o.section==="main"),config:r.filter(o=>o.section==="config")}}const Qk=p.createContext(null);function Kk({config:e,children:t}){const n=fB(e),r={...e,navItems:n};return i.jsx(Qk.Provider,{value:r,children:t})}function Vh(){const e=p.useContext(Qk);if(!e)throw new Error("useAdminConfig must be used within AdminConfigProvider");return e}const _y=p.createContext(null);function hB({baseConfig:e,children:t,api:n}){const r=He(n.getSettings,{})??void 0,o=p.useMemo(()=>r?{...e,navigation:{...e.navigation,showMedia:e.navigation.showMedia&&r.features.mediaManagement}}:e,[e,r]),l=p.useMemo(()=>({baseConfig:e,settings:r}),[e,r]);return i.jsx(_y.Provider,{value:l,children:i.jsx(Kk,{config:o,children:t})})}function mB({baseConfig:e,children:t}){const n=p.useMemo(()=>({baseConfig:e,settings:void 0}),[e]);return i.jsx(_y.Provider,{value:n,children:i.jsx(Kk,{config:e,children:t})})}function pB({baseConfig:e,children:t,api:n}){return n?i.jsx(hB,{baseConfig:e,api:n,children:t}):i.jsx(mB,{baseConfig:e,children:t})}function Xk(){const e=p.useContext(_y);if(!e)throw new Error("useSettingsConfig must be used within SettingsConfigProvider");return e}const Jk=p.createContext(null);function gB({children:e}){const[t,n]=p.useState(new Map),r=p.useCallback((u,d)=>{n(h=>{const m=new Map(h);return m.set(u,d),m})},[]),o=p.useCallback(u=>{n(d=>{const h=new Map(d);return h.delete(u),h})},[]),l=p.useMemo(()=>({overrides:t,setOverride:r,clearOverride:o}),[t,r,o]);return i.jsx(Jk.Provider,{value:l,children:e})}function e_(){const e=p.useContext(Jk);if(!e)throw new Error("useBreadcrumbContext must be used within a BreadcrumbProvider");return e}const vB={LayoutDashboard:YP,FileText:Sr,Image:ns,Layers:Kx,Tags:ty,FileCode:hP,Settings:dk,Trash2:Fn,HelpCircle:sk,Home:$h,User:fk,Users:G5,Bell:nx,Lock:Xx,Globe:TP,Calendar:pl,Clock:ih,Link:uk,Hash:Qx,ToggleLeft:ry,ChevronDown:vn,CheckSquare:M5,Braces:Vx,Folder:uh,MapPin:r5,DollarSign:ik,Mail:t5,Phone:y5,Package:m5,Star:D5,Heart:PP,Flag:xP,Bookmark:L3,Archive:nk,Edit:A5,Eye:lh,AlertCircle:$u};function qj({name:e,className:t="size-5"}){const n=vB[e];return n?i.jsx(n,{className:t}):null}const t_=p.createContext(null);function xB({api:e,children:t}){return i.jsx(t_.Provider,{value:e,children:t})}function xn(){const e=p.useContext(t_);if(!e)throw new Error("useApi must be used within ApiProvider");return e}function Se(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}function yB(e,t){const n=p.createContext(t),r=l=>{const{children:u,...d}=l,h=p.useMemo(()=>d,Object.values(d));return i.jsx(n.Provider,{value:h,children:u})};r.displayName=e+"Provider";function o(l){const u=p.useContext(n);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[r,o]}function Dn(e,t=[]){let n=[];function r(l,u){const d=p.createContext(u),h=n.length;n=[...n,u];const m=g=>{const{scope:y,children:w,...S}=g,j=y?.[e]?.[h]||d,N=p.useMemo(()=>S,Object.values(S));return i.jsx(j.Provider,{value:N,children:w})};m.displayName=l+"Provider";function v(g,y){const w=y?.[e]?.[h]||d,S=p.useContext(w);if(S)return S;if(u!==void 0)return u;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[m,v]}const o=()=>{const l=n.map(u=>p.createContext(u));return function(d){const h=d?.[e]||l;return p.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return o.scopeName=e,[r,bB(o,...t)]}function bB(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(l){const u=r.reduce((d,{useScope:h,scopeName:m})=>{const g=h(l)[`__scope${m}`];return{...d,...g}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var Jt=globalThis?.document?p.useLayoutEffect:()=>{},wB=Ax[" useInsertionEffect ".trim().toString()]||Jt;function nr({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,l,u]=SB({defaultProp:t,onChange:n}),d=e!==void 0,h=d?e:o;{const v=p.useRef(e!==void 0);p.useEffect(()=>{const g=v.current;g!==d&&console.warn(`${r} is changing from ${g?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. 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.`),v.current=d},[d,r])}const m=p.useCallback(v=>{if(d){const g=jB(v)?v(e):v;g!==e&&u.current?.(g)}else l(v)},[d,e,l,u]);return[h,m]}function SB({defaultProp:e,onChange:t}){const[n,r]=p.useState(e),o=p.useRef(n),l=p.useRef(t);return wB(()=>{l.current=t},[t]),p.useEffect(()=>{o.current!==n&&(l.current?.(n),o.current=n)},[n,o]),[n,r,l]}function jB(e){return typeof e=="function"}function Vj(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Es(...e){return t=>{let n=!1;const r=e.map(o=>{const l=Vj(o,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let o=0;o<r.length;o++){const l=r[o];typeof l=="function"?l():Vj(e[o],null)}}}}function Ge(...e){return p.useCallback(Es(...e),e)}function Bo(e){const t=CB(e),n=p.forwardRef((r,o)=>{const{children:l,...u}=r,d=p.Children.toArray(l),h=d.find(NB);if(h){const m=h.props.children,v=d.map(g=>g===h?p.Children.count(m)>1?p.Children.only(null):p.isValidElement(m)?m.props.children:null:g);return i.jsx(t,{...u,ref:o,children:p.isValidElement(m)?p.cloneElement(m,void 0,v):null})}return i.jsx(t,{...u,ref:o,children:l})});return n.displayName=`${e}.Slot`,n}function CB(e){const t=p.forwardRef((n,r)=>{const{children:o,...l}=n;if(p.isValidElement(o)){const u=_B(o),d=kB(l,o.props);return o.type!==p.Fragment&&(d.ref=r?Es(r,u):u),p.cloneElement(o,d)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var n_=Symbol("radix.slottable");function r_(e){const t=({children:n})=>i.jsx(i.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=n_,t}function NB(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===n_}function kB(e,t){const n={...t};for(const r in t){const o=e[r],l=t[r];/^on[A-Z]/.test(r)?o&&l?n[r]=(...d)=>{const h=l(...d);return o(...d),h}:o&&(n[r]=o):r==="style"?n[r]={...o,...l}:r==="className"&&(n[r]=[o,l].filter(Boolean).join(" "))}return{...e,...n}}function _B(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var EB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ze=EB.reduce((e,t)=>{const n=Bo(`Primitive.${t}`),r=p.forwardRef((o,l)=>{const{asChild:u,...d}=o,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(h,{...d,ref:l})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function s_(e,t){e&&Ml.flushSync(()=>e.dispatchEvent(t))}function TB(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}var yn=e=>{const{present:t,children:n}=e,r=MB(t),o=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),l=Ge(r.ref,RB(o));return typeof n=="function"||r.isPresent?p.cloneElement(o,{ref:l}):null};yn.displayName="Presence";function MB(e){const[t,n]=p.useState(),r=p.useRef(null),o=p.useRef(e),l=p.useRef("none"),u=e?"mounted":"unmounted",[d,h]=TB(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const m=Ef(r.current);l.current=d==="mounted"?m:"none"},[d]),Jt(()=>{const m=r.current,v=o.current;if(v!==e){const y=l.current,w=Ef(m);e?h("MOUNT"):w==="none"||m?.display==="none"?h("UNMOUNT"):h(v&&y!==w?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,h]),Jt(()=>{if(t){let m;const v=t.ownerDocument.defaultView??window,g=w=>{const j=Ef(r.current).includes(CSS.escape(w.animationName));if(w.target===t&&j&&(h("ANIMATION_END"),!o.current)){const N=t.style.animationFillMode;t.style.animationFillMode="forwards",m=v.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=N)})}},y=w=>{w.target===t&&(l.current=Ef(r.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{v.clearTimeout(m),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:p.useCallback(m=>{r.current=m?getComputedStyle(m):null,n(m)},[])}}function Ef(e){return e?.animationName||"none"}function RB(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var AB=Ax[" useId ".trim().toString()]||(()=>{}),OB=0;function gn(e){const[t,n]=p.useState(AB());return Jt(()=>{n(r=>r??String(OB++))},[e]),e||(t?`radix-${t}`:"")}var Hh="Collapsible",[DB]=Dn(Hh),[zB,Ey]=DB(Hh),a_=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:l,onOpenChange:u,...d}=e,[h,m]=nr({prop:r,defaultProp:o??!1,onChange:u,caller:Hh});return i.jsx(zB,{scope:n,disabled:l,contentId:gn(),open:h,onOpenToggle:p.useCallback(()=>m(v=>!v),[m]),children:i.jsx(ze.div,{"data-state":My(h),"data-disabled":l?"":void 0,...d,ref:t})})});a_.displayName=Hh;var o_="CollapsibleTrigger",i_=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Ey(o_,n);return i.jsx(ze.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":My(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:Se(e.onClick,o.onOpenToggle)})});i_.displayName=o_;var Ty="CollapsibleContent",l_=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Ey(Ty,e.__scopeCollapsible);return i.jsx(yn,{present:n||o.open,children:({present:l})=>i.jsx(PB,{...r,ref:t,present:l})})});l_.displayName=Ty;var PB=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...l}=e,u=Ey(Ty,n),[d,h]=p.useState(r),m=p.useRef(null),v=Ge(t,m),g=p.useRef(0),y=g.current,w=p.useRef(0),S=w.current,j=u.open||d,N=p.useRef(j),C=p.useRef(void 0);return p.useEffect(()=>{const _=requestAnimationFrame(()=>N.current=!1);return()=>cancelAnimationFrame(_)},[]),Jt(()=>{const _=m.current;if(_){C.current=C.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const E=_.getBoundingClientRect();g.current=E.height,w.current=E.width,N.current||(_.style.transitionDuration=C.current.transitionDuration,_.style.animationName=C.current.animationName),h(r)}},[u.open,r]),i.jsx(ze.div,{"data-state":My(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!j,...l,ref:v,style:{"--radix-collapsible-content-height":y?`${y}px`:void 0,"--radix-collapsible-content-width":S?`${S}px`:void 0,...e.style},children:j&&o})});function My(e){return e?"open":"closed"}var LB=a_;function c_(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=c_(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function u_(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=c_(e))&&(r&&(r+=" "),r+=t);return r}const IB=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},$B=(e,t)=>({classGroupId:e,validator:t}),d_=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),yh="-",Hj=[],FB="arbitrary..",BB=e=>{const t=qB(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return UB(u);const d=u.split(yh),h=d[0]===""&&d.length>1?1:0;return f_(d,h,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const h=r[u],m=n[u];return h?m?IB(m,h):h:m||Hj}return n[u]||Hj}}},f_=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],l=n.nextPart.get(o);if(l){const m=f_(e,t+1,l);if(m)return m}const u=n.validators;if(u===null)return;const d=t===0?e.join(yh):e.slice(t).join(yh),h=u.length;for(let m=0;m<h;m++){const v=u[m];if(v.validator(d))return v.classGroupId}},UB=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?FB+r:void 0})(),qB=e=>{const{theme:t,classGroups:n}=e;return VB(n,t)},VB=(e,t)=>{const n=d_();for(const r in e){const o=e[r];Ry(o,n,r,t)}return n},Ry=(e,t,n,r)=>{const o=e.length;for(let l=0;l<o;l++){const u=e[l];HB(u,t,n,r)}},HB=(e,t,n,r)=>{if(typeof e=="string"){YB(e,t,n);return}if(typeof e=="function"){WB(e,t,n,r);return}GB(e,t,n,r)},YB=(e,t,n)=>{const r=e===""?t:h_(t,e);r.classGroupId=n},WB=(e,t,n,r)=>{if(ZB(e)){Ry(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push($B(n,e))},GB=(e,t,n,r)=>{const o=Object.entries(e),l=o.length;for(let u=0;u<l;u++){const[d,h]=o[u];Ry(h,h_(t,d),n,r)}},h_=(e,t)=>{let n=e;const r=t.split(yh),o=r.length;for(let l=0;l<o;l++){const u=r[l];let d=n.nextPart.get(u);d||(d=d_(),n.nextPart.set(u,d)),n=d}return n},ZB=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,QB=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(l,u)=>{n[l]=u,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(l){let u=n[l];if(u!==void 0)return u;if((u=r[l])!==void 0)return o(l,u),u},set(l,u){l in n?n[l]=u:o(l,u)}}},cx="!",Yj=":",KB=[],Wj=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),XB=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const l=[];let u=0,d=0,h=0,m;const v=o.length;for(let j=0;j<v;j++){const N=o[j];if(u===0&&d===0){if(N===Yj){l.push(o.slice(h,j)),h=j+1;continue}if(N==="/"){m=j;continue}}N==="["?u++:N==="]"?u--:N==="("?d++:N===")"&&d--}const g=l.length===0?o:o.slice(h);let y=g,w=!1;g.endsWith(cx)?(y=g.slice(0,-1),w=!0):g.startsWith(cx)&&(y=g.slice(1),w=!0);const S=m&&m>h?m-h:void 0;return Wj(l,w,y,S)};if(t){const o=t+Yj,l=r;r=u=>u.startsWith(o)?l(u.slice(o.length)):Wj(KB,!1,u,void 0,!0)}if(n){const o=r;r=l=>n({className:l,parseClassName:o})}return r},JB=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let l=0;l<n.length;l++){const u=n[l],d=u[0]==="[",h=t.has(u);d||h?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(u)):o.push(u)}return o.length>0&&(o.sort(),r.push(...o)),r}},e8=e=>({cache:QB(e.cacheSize),parseClassName:XB(e),sortModifiers:JB(e),...BB(e)}),t8=/\s+/,n8=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:l}=t,u=[],d=e.trim().split(t8);let h="";for(let m=d.length-1;m>=0;m-=1){const v=d[m],{isExternal:g,modifiers:y,hasImportantModifier:w,baseClassName:S,maybePostfixModifierPosition:j}=n(v);if(g){h=v+(h.length>0?" "+h:h);continue}let N=!!j,C=r(N?S.substring(0,j):S);if(!C){if(!N){h=v+(h.length>0?" "+h:h);continue}if(C=r(S),!C){h=v+(h.length>0?" "+h:h);continue}N=!1}const _=y.length===0?"":y.length===1?y[0]:l(y).join(":"),E=w?_+cx:_,M=E+C;if(u.indexOf(M)>-1)continue;u.push(M);const A=o(C,N);for(let R=0;R<A.length;++R){const T=A[R];u.push(E+T)}h=v+(h.length>0?" "+h:h)}return h},r8=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=m_(n))&&(o&&(o+=" "),o+=r);return o},m_=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=m_(e[r]))&&(n&&(n+=" "),n+=t);return n},s8=(e,...t)=>{let n,r,o,l;const u=h=>{const m=t.reduce((v,g)=>g(v),e());return n=e8(m),r=n.cache.get,o=n.cache.set,l=d,d(h)},d=h=>{const m=r(h);if(m)return m;const v=n8(h,n);return o(h,v),v};return l=u,(...h)=>l(r8(...h))},a8=[],hn=e=>{const t=n=>n[e]||a8;return t.isThemeGetter=!0,t},p_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,g_=/^\((?:(\w[\w-]*):)?(.+)\)$/i,o8=/^\d+\/\d+$/,i8=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,l8=/\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$/,c8=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,u8=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,d8=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bi=e=>o8.test(e),tt=e=>!!e&&!Number.isNaN(Number(e)),$a=e=>!!e&&Number.isInteger(Number(e)),hv=e=>e.endsWith("%")&&tt(e.slice(0,-1)),Js=e=>i8.test(e),f8=()=>!0,h8=e=>l8.test(e)&&!c8.test(e),v_=()=>!1,m8=e=>u8.test(e),p8=e=>d8.test(e),g8=e=>!Te(e)&&!Me(e),v8=e=>Dl(e,b_,v_),Te=e=>p_.test(e),No=e=>Dl(e,w_,h8),mv=e=>Dl(e,S8,tt),Gj=e=>Dl(e,x_,v_),x8=e=>Dl(e,y_,p8),Tf=e=>Dl(e,S_,m8),Me=e=>g_.test(e),Uc=e=>zl(e,w_),y8=e=>zl(e,j8),Zj=e=>zl(e,x_),b8=e=>zl(e,b_),w8=e=>zl(e,y_),Mf=e=>zl(e,S_,!0),Dl=(e,t,n)=>{const r=p_.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},zl=(e,t,n=!1)=>{const r=g_.exec(e);return r?r[1]?t(r[1]):n:!1},x_=e=>e==="position"||e==="percentage",y_=e=>e==="image"||e==="url",b_=e=>e==="length"||e==="size"||e==="bg-size",w_=e=>e==="length",S8=e=>e==="number",j8=e=>e==="family-name",S_=e=>e==="shadow",C8=()=>{const e=hn("color"),t=hn("font"),n=hn("text"),r=hn("font-weight"),o=hn("tracking"),l=hn("leading"),u=hn("breakpoint"),d=hn("container"),h=hn("spacing"),m=hn("radius"),v=hn("shadow"),g=hn("inset-shadow"),y=hn("text-shadow"),w=hn("drop-shadow"),S=hn("blur"),j=hn("perspective"),N=hn("aspect"),C=hn("ease"),_=hn("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],A=()=>[...M(),Me,Te],R=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],O=()=>[Me,Te,h],D=()=>[Bi,"full","auto",...O()],z=()=>[$a,"none","subgrid",Me,Te],B=()=>["auto",{span:["full",$a,Me,Te]},$a,Me,Te],V=()=>[$a,"auto",Me,Te],Y=()=>["auto","min","max","fr",Me,Te],G=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ae=()=>["start","end","center","stretch","center-safe","end-safe"],L=()=>["auto",...O()],$=()=>[Bi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],U=()=>[e,Me,Te],H=()=>[...M(),Zj,Gj,{position:[Me,Te]}],le=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",b8,v8,{size:[Me,Te]}],F=()=>[hv,Uc,No],K=()=>["","none","full",m,Me,Te],ne=()=>["",tt,Uc,No],X=()=>["solid","dashed","dotted","double"],ue=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[tt,hv,Zj,Gj],ye=()=>["","none",S,Me,Te],Ce=()=>["none",tt,Me,Te],_e=()=>["none",tt,Me,Te],Re=()=>[tt,Me,Te],ge=()=>[Bi,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Js],breakpoint:[Js],color:[f8],container:[Js],"drop-shadow":[Js],ease:["in","out","in-out"],font:[g8],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Js],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Js],shadow:[Js],spacing:["px",tt],text:[Js],"text-shadow":[Js],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Bi,Te,Me,N]}],container:["container"],columns:[{columns:[tt,Te,Me,d]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"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"],sr:["sr-only","not-sr-only"],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:A()}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{start:D()}],end:[{end:D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[$a,"auto",Me,Te]}],basis:[{basis:[Bi,"full","auto",d,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[tt,Bi,"auto","initial","none",Te]}],grow:[{grow:["",tt,Me,Te]}],shrink:[{shrink:["",tt,Me,Te]}],order:[{order:[$a,"first","last","none",Me,Te]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Y()}],"auto-rows":[{"auto-rows":Y()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...G(),"normal"]}],"justify-items":[{"justify-items":[...ae(),"normal"]}],"justify-self":[{"justify-self":["auto",...ae()]}],"align-content":[{content:["normal",...G()]}],"align-items":[{items:[...ae(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ae(),{baseline:["","last"]}]}],"place-content":[{"place-content":G()}],"place-items":[{"place-items":[...ae(),"baseline"]}],"place-self":[{"place-self":["auto",...ae()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:L()}],mx:[{mx:L()}],my:[{my:L()}],ms:[{ms:L()}],me:[{me:L()}],mt:[{mt:L()}],mr:[{mr:L()}],mb:[{mb:L()}],ml:[{ml:L()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],w:[{w:[d,"screen",...$()]}],"min-w":[{"min-w":[d,"screen","none",...$()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...$()]}],h:[{h:["screen","lh",...$()]}],"min-h":[{"min-h":["screen","lh","none",...$()]}],"max-h":[{"max-h":["screen","lh",...$()]}],"font-size":[{text:["base",n,Uc,No]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Me,mv]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",hv,Te]}],"font-family":[{font:[y8,Te,t]}],"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:[o,Me,Te]}],"line-clamp":[{"line-clamp":[tt,"none",Me,mv]}],leading:[{leading:[l,...O()]}],"list-image":[{"list-image":["none",Me,Te]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Me,Te]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:[tt,"from-font","auto",Me,No]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[tt,"auto",Me,Te]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Me,Te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Me,Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:le()}],"bg-size":[{bg:I()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$a,Me,Te],radial:["",Me,Te],conic:[$a,Me,Te]},w8,x8]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:F()}],"gradient-via-pos":[{via:F()}],"gradient-to-pos":[{to:F()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:K()}],"rounded-s":[{"rounded-s":K()}],"rounded-e":[{"rounded-e":K()}],"rounded-t":[{"rounded-t":K()}],"rounded-r":[{"rounded-r":K()}],"rounded-b":[{"rounded-b":K()}],"rounded-l":[{"rounded-l":K()}],"rounded-ss":[{"rounded-ss":K()}],"rounded-se":[{"rounded-se":K()}],"rounded-ee":[{"rounded-ee":K()}],"rounded-es":[{"rounded-es":K()}],"rounded-tl":[{"rounded-tl":K()}],"rounded-tr":[{"rounded-tr":K()}],"rounded-br":[{"rounded-br":K()}],"rounded-bl":[{"rounded-bl":K()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...X(),"hidden","none"]}],"divide-style":[{divide:[...X(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...X(),"none","hidden"]}],"outline-offset":[{"outline-offset":[tt,Me,Te]}],"outline-w":[{outline:["",tt,Uc,No]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",v,Mf,Tf]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",g,Mf,Tf]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[tt,No]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",y,Mf,Tf]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[tt,Me,Te]}],"mix-blend":[{"mix-blend":[...ue(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ue()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[tt]}],"mask-image-linear-from-pos":[{"mask-linear-from":te()}],"mask-image-linear-to-pos":[{"mask-linear-to":te()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":te()}],"mask-image-t-to-pos":[{"mask-t-to":te()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":te()}],"mask-image-r-to-pos":[{"mask-r-to":te()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":te()}],"mask-image-b-to-pos":[{"mask-b-to":te()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":te()}],"mask-image-l-to-pos":[{"mask-l-to":te()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":te()}],"mask-image-x-to-pos":[{"mask-x-to":te()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":te()}],"mask-image-y-to-pos":[{"mask-y-to":te()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Me,Te]}],"mask-image-radial-from-pos":[{"mask-radial-from":te()}],"mask-image-radial-to-pos":[{"mask-radial-to":te()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[tt]}],"mask-image-conic-from-pos":[{"mask-conic-from":te()}],"mask-image-conic-to-pos":[{"mask-conic-to":te()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:le()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Me,Te]}],filter:[{filter:["","none",Me,Te]}],blur:[{blur:ye()}],brightness:[{brightness:[tt,Me,Te]}],contrast:[{contrast:[tt,Me,Te]}],"drop-shadow":[{"drop-shadow":["","none",w,Mf,Tf]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",tt,Me,Te]}],"hue-rotate":[{"hue-rotate":[tt,Me,Te]}],invert:[{invert:["",tt,Me,Te]}],saturate:[{saturate:[tt,Me,Te]}],sepia:[{sepia:["",tt,Me,Te]}],"backdrop-filter":[{"backdrop-filter":["","none",Me,Te]}],"backdrop-blur":[{"backdrop-blur":ye()}],"backdrop-brightness":[{"backdrop-brightness":[tt,Me,Te]}],"backdrop-contrast":[{"backdrop-contrast":[tt,Me,Te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",tt,Me,Te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[tt,Me,Te]}],"backdrop-invert":[{"backdrop-invert":["",tt,Me,Te]}],"backdrop-opacity":[{"backdrop-opacity":[tt,Me,Te]}],"backdrop-saturate":[{"backdrop-saturate":[tt,Me,Te]}],"backdrop-sepia":[{"backdrop-sepia":["",tt,Me,Te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Me,Te]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[tt,"initial",Me,Te]}],ease:[{ease:["linear","initial",C,Me,Te]}],delay:[{delay:[tt,Me,Te]}],animate:[{animate:["none",_,Me,Te]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,Me,Te]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:Ce()}],"rotate-x":[{"rotate-x":Ce()}],"rotate-y":[{"rotate-y":Ce()}],"rotate-z":[{"rotate-z":Ce()}],scale:[{scale:_e()}],"scale-x":[{"scale-x":_e()}],"scale-y":[{"scale-y":_e()}],"scale-z":[{"scale-z":_e()}],"scale-3d":["scale-3d"],skew:[{skew:Re()}],"skew-x":[{"skew-x":Re()}],"skew-y":[{"skew-y":Re()}],transform:[{transform:[Me,Te,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ge()}],"translate-x":[{"translate-x":ge()}],"translate-y":[{"translate-y":ge()}],"translate-z":[{"translate-z":ge()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",Me,Te]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"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",Me,Te]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[tt,Uc,No,mv]}],stroke:[{stroke:["none",...U()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},N8=s8(C8);function W(...e){return N8(u_(e))}const Ay=LB,Oy=i_;function Dy({className:e,children:t,...n}){return i.jsx(l_,{className:W("overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",e),...n,children:t})}var k8=Symbol.for("react.lazy"),bh=Ax[" use ".trim().toString()];function _8(e){return typeof e=="object"&&e!==null&&"then"in e}function j_(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===k8&&"_payload"in e&&_8(e._payload)}function C_(e){const t=E8(e),n=p.forwardRef((r,o)=>{let{children:l,...u}=r;j_(l)&&typeof bh=="function"&&(l=bh(l._payload));const d=p.Children.toArray(l),h=d.find(M8);if(h){const m=h.props.children,v=d.map(g=>g===h?p.Children.count(m)>1?p.Children.only(null):p.isValidElement(m)?m.props.children:null:g);return i.jsx(t,{...u,ref:o,children:p.isValidElement(m)?p.cloneElement(m,void 0,v):null})}return i.jsx(t,{...u,ref:o,children:l})});return n.displayName=`${e}.Slot`,n}var Pl=C_("Slot");function E8(e){const t=p.forwardRef((n,r)=>{let{children:o,...l}=n;if(j_(o)&&typeof bh=="function"&&(o=bh(o._payload)),p.isValidElement(o)){const u=A8(o),d=R8(l,o.props);return o.type!==p.Fragment&&(d.ref=r?Es(r,u):u),p.cloneElement(o,d)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var T8=Symbol("radix.slottable");function M8(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===T8}function R8(e,t){const n={...t};for(const r in t){const o=e[r],l=t[r];/^on[A-Z]/.test(r)?o&&l?n[r]=(...d)=>{const h=l(...d);return o(...d),h}:o&&(n[r]=o):r==="style"?n[r]={...o,...l}:r==="className"&&(n[r]=[o,l].filter(Boolean).join(" "))}return{...e,...n}}function A8(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Qj=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Kj=u_,Ko=(e,t)=>n=>{var r;if(t?.variants==null)return Kj(e,n?.class,n?.className);const{variants:o,defaultVariants:l}=t,u=Object.keys(o).map(m=>{const v=n?.[m],g=l?.[m];if(v===null)return null;const y=Qj(v)||Qj(g);return o[m][y]}),d=n&&Object.entries(n).reduce((m,v)=>{let[g,y]=v;return y===void 0||(m[g]=y),m},{}),h=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((m,v)=>{let{class:g,className:y,...w}=v;return Object.entries(w).every(S=>{let[j,N]=S;return Array.isArray(N)?N.includes({...l,...d}[j]):{...l,...d}[j]===N})?[...m,g,y]:m},[]);return Kj(e,u,h,n?.class,n?.className)},pv=768;function O8(){const[e,t]=p.useState(void 0);return p.useEffect(()=>{const n=window.matchMedia(`(max-width: ${pv-1}px)`),r=()=>{t(window.innerWidth<pv)};return n.addEventListener("change",r),t(window.innerWidth<pv),()=>n.removeEventListener("change",r)},[]),!!e}const wu=Ko("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Je({className:e,variant:t="default",size:n="default",asChild:r=!1,...o}){const l=r?Pl:"button";return i.jsx(l,{"data-slot":"button","data-variant":t,"data-size":n,className:W(wu({variant:t,size:n,className:e})),...o})}function mt({className:e,type:t,...n}){return i.jsx("input",{type:t,"data-slot":"input",className:W("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...n})}var D8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],sr=D8.reduce((e,t)=>{const n=C_(`Primitive.${t}`),r=p.forwardRef((o,l)=>{const{asChild:u,...d}=o,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(h,{...d,ref:l})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),z8="Separator",Xj="horizontal",P8=["horizontal","vertical"],N_=p.forwardRef((e,t)=>{const{decorative:n,orientation:r=Xj,...o}=e,l=L8(r)?r:Xj,d=n?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return i.jsx(sr.div,{"data-orientation":l,...d,...o,ref:t})});N_.displayName=z8;function L8(e){return P8.includes(e)}var I8=N_;function wh({className:e,orientation:t="horizontal",decorative:n=!0,...r}){return i.jsx(I8,{"data-slot":"separator",decorative:n,orientation:t,className:W("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...r})}function Nn(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>t.current?.(...n),[])}function $8(e,t=globalThis?.document){const n=Nn(e);p.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var F8="DismissableLayer",ux="dismissableLayer.update",B8="dismissableLayer.pointerDownOutside",U8="dismissableLayer.focusOutside",Jj,k_=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ll=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...h}=e,m=p.useContext(k_),[v,g]=p.useState(null),y=v?.ownerDocument??globalThis?.document,[,w]=p.useState({}),S=Ge(t,T=>g(T)),j=Array.from(m.layers),[N]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),C=j.indexOf(N),_=v?j.indexOf(v):-1,E=m.layersWithOutsidePointerEventsDisabled.size>0,M=_>=C,A=H8(T=>{const O=T.target,D=[...m.branches].some(z=>z.contains(O));!M||D||(o?.(T),u?.(T),T.defaultPrevented||d?.())},y),R=Y8(T=>{const O=T.target;[...m.branches].some(z=>z.contains(O))||(l?.(T),u?.(T),T.defaultPrevented||d?.())},y);return $8(T=>{_===m.layers.size-1&&(r?.(T),!T.defaultPrevented&&d&&(T.preventDefault(),d()))},y),p.useEffect(()=>{if(v)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(Jj=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(v)),m.layers.add(v),eC(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=Jj)}},[v,y,n,m]),p.useEffect(()=>()=>{v&&(m.layers.delete(v),m.layersWithOutsidePointerEventsDisabled.delete(v),eC())},[v,m]),p.useEffect(()=>{const T=()=>w({});return document.addEventListener(ux,T),()=>document.removeEventListener(ux,T)},[]),i.jsx(ze.div,{...h,ref:S,style:{pointerEvents:E?M?"auto":"none":void 0,...e.style},onFocusCapture:Se(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Se(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Se(e.onPointerDownCapture,A.onPointerDownCapture)})});Ll.displayName=F8;var q8="DismissableLayerBranch",V8=p.forwardRef((e,t)=>{const n=p.useContext(k_),r=p.useRef(null),o=Ge(t,r);return p.useEffect(()=>{const l=r.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),i.jsx(ze.div,{...e,ref:o})});V8.displayName=q8;function H8(e,t=globalThis?.document){const n=Nn(e),r=p.useRef(!1),o=p.useRef(()=>{});return p.useEffect(()=>{const l=d=>{if(d.target&&!r.current){let h=function(){__(B8,n,m,{discrete:!0})};const m={originalEvent:d};d.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=h,t.addEventListener("click",o.current,{once:!0})):h()}else t.removeEventListener("click",o.current);r.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",l),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Y8(e,t=globalThis?.document){const n=Nn(e),r=p.useRef(!1);return p.useEffect(()=>{const o=l=>{l.target&&!r.current&&__(U8,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function eC(){const e=new CustomEvent(ux);document.dispatchEvent(e)}function __(e,t,n,{discrete:r}){const o=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?s_(o,l):o.dispatchEvent(l)}var gv="focusScope.autoFocusOnMount",vv="focusScope.autoFocusOnUnmount",tC={bubbles:!1,cancelable:!0},W8="FocusScope",Fu=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:l,...u}=e,[d,h]=p.useState(null),m=Nn(o),v=Nn(l),g=p.useRef(null),y=Ge(t,j=>h(j)),w=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let j=function(E){if(w.paused||!d)return;const M=E.target;d.contains(M)?g.current=M:Ba(g.current,{select:!0})},N=function(E){if(w.paused||!d)return;const M=E.relatedTarget;M!==null&&(d.contains(M)||Ba(g.current,{select:!0}))},C=function(E){if(document.activeElement===document.body)for(const A of E)A.removedNodes.length>0&&Ba(d)};document.addEventListener("focusin",j),document.addEventListener("focusout",N);const _=new MutationObserver(C);return d&&_.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",N),_.disconnect()}}},[r,d,w.paused]),p.useEffect(()=>{if(d){rC.add(w);const j=document.activeElement;if(!d.contains(j)){const C=new CustomEvent(gv,tC);d.addEventListener(gv,m),d.dispatchEvent(C),C.defaultPrevented||(G8(J8(E_(d)),{select:!0}),document.activeElement===j&&Ba(d))}return()=>{d.removeEventListener(gv,m),setTimeout(()=>{const C=new CustomEvent(vv,tC);d.addEventListener(vv,v),d.dispatchEvent(C),C.defaultPrevented||Ba(j??document.body,{select:!0}),d.removeEventListener(vv,v),rC.remove(w)},0)}}},[d,m,v,w]);const S=p.useCallback(j=>{if(!n&&!r||w.paused)return;const N=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,C=document.activeElement;if(N&&C){const _=j.currentTarget,[E,M]=Z8(_);E&&M?!j.shiftKey&&C===M?(j.preventDefault(),n&&Ba(E,{select:!0})):j.shiftKey&&C===E&&(j.preventDefault(),n&&Ba(M,{select:!0})):C===_&&j.preventDefault()}},[n,r,w.paused]);return i.jsx(ze.div,{tabIndex:-1,...u,ref:y,onKeyDown:S})});Fu.displayName=W8;function G8(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ba(r,{select:t}),document.activeElement!==n)return}function Z8(e){const t=E_(e),n=nC(t,e),r=nC(t.reverse(),e);return[n,r]}function E_(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function nC(e,t){for(const n of e)if(!Q8(n,{upTo:t}))return n}function Q8(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function K8(e){return e instanceof HTMLInputElement&&"select"in e}function Ba(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&K8(e)&&t&&e.select()}}var rC=X8();function X8(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=sC(e,t),e.unshift(t)},remove(t){e=sC(e,t),e[0]?.resume()}}}function sC(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function J8(e){return e.filter(t=>t.tagName!=="A")}var eU="Portal",Il=p.forwardRef((e,t)=>{const{container:n,...r}=e,[o,l]=p.useState(!1);Jt(()=>l(!0),[]);const u=n||o&&globalThis?.document?.body;return u?V4.createPortal(i.jsx(ze.div,{...r,ref:t}),u):null});Il.displayName=eU;var xv=0;function Yh(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??aC()),document.body.insertAdjacentElement("beforeend",e[1]??aC()),xv++,()=>{xv===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),xv--}},[])}function aC(){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 ys=function(){return ys=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},ys.apply(this,arguments)};function T_(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,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 tU(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,l;r<o;r++)(l||!(r in t))&&(l||(l=Array.prototype.slice.call(t,0,r)),l[r]=t[r]);return e.concat(l||Array.prototype.slice.call(t))}var Yf="right-scroll-bar-position",Wf="width-before-scroll-bar",nU="with-scroll-bars-hidden",rU="--removed-body-scroll-bar-size";function yv(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function sU(e,t){var n=p.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var aU=typeof window<"u"?p.useLayoutEffect:p.useEffect,oC=new WeakMap;function oU(e,t){var n=sU(null,function(r){return e.forEach(function(o){return yv(o,r)})});return aU(function(){var r=oC.get(n);if(r){var o=new Set(r),l=new Set(e),u=n.current;o.forEach(function(d){l.has(d)||yv(d,null)}),l.forEach(function(d){o.has(d)||yv(d,u)})}oC.set(n,e)},[e]),n}function iU(e){return e}function lU(e,t){t===void 0&&(t=iU);var n=[],r=!1,o={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(l){var u=t(l,r);return n.push(u),function(){n=n.filter(function(d){return d!==u})}},assignSyncMedium:function(l){for(r=!0;n.length;){var u=n;n=[],u.forEach(l)}n={push:function(d){return l(d)},filter:function(){return n}}},assignMedium:function(l){r=!0;var u=[];if(n.length){var d=n;n=[],d.forEach(l),u=n}var h=function(){var v=u;u=[],v.forEach(l)},m=function(){return Promise.resolve().then(h)};m(),n={push:function(v){u.push(v),m()},filter:function(v){return u=u.filter(v),n}}}};return o}function cU(e){e===void 0&&(e={});var t=lU(null);return t.options=ys({async:!0,ssr:!1},e),t}var M_=function(e){var t=e.sideCar,n=T_(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 p.createElement(r,ys({},n))};M_.isSideCarExport=!0;function uU(e,t){return e.useMedium(t),M_}var R_=cU(),bv=function(){},Wh=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:bv,onWheelCapture:bv,onTouchMoveCapture:bv}),o=r[0],l=r[1],u=e.forwardProps,d=e.children,h=e.className,m=e.removeScrollBar,v=e.enabled,g=e.shards,y=e.sideCar,w=e.noRelative,S=e.noIsolation,j=e.inert,N=e.allowPinchZoom,C=e.as,_=C===void 0?"div":C,E=e.gapMode,M=T_(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=y,R=oU([n,t]),T=ys(ys({},M),o);return p.createElement(p.Fragment,null,v&&p.createElement(A,{sideCar:R_,removeScrollBar:m,shards:g,noRelative:w,noIsolation:S,inert:j,setCallbacks:l,allowPinchZoom:!!N,lockRef:n,gapMode:E}),u?p.cloneElement(p.Children.only(d),ys(ys({},T),{ref:R})):p.createElement(_,ys({},T,{className:h,ref:R}),d))});Wh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Wh.classNames={fullWidth:Wf,zeroRight:Yf};var dU=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function fU(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=dU();return t&&e.setAttribute("nonce",t),e}function hU(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function mU(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var pU=function(){var e=0,t=null;return{add:function(n){e==0&&(t=fU())&&(hU(t,n),mU(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},gU=function(){var e=pU();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},A_=function(){var e=gU(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},vU={left:0,top:0,right:0,gap:0},wv=function(e){return parseInt(e||"",10)||0},xU=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[wv(n),wv(r),wv(o)]},yU=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return vU;var t=xU(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])}},bU=A_(),ll="data-scroll-locked",wU=function(e,t,n,r){var o=e.left,l=e.top,u=e.right,d=e.gap;return n===void 0&&(n="margin"),`
49
- .`.concat(nU,` {
50
- overflow: hidden `).concat(r,`;
51
- padding-right: `).concat(d,"px ").concat(r,`;
52
- }
53
- body[`).concat(ll,`] {
54
- overflow: hidden `).concat(r,`;
55
- overscroll-behavior: contain;
56
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
57
- padding-left: `.concat(o,`px;
58
- padding-top: `).concat(l,`px;
59
- padding-right: `).concat(u,`px;
60
- margin-left:0;
61
- margin-top:0;
62
- margin-right: `).concat(d,"px ").concat(r,`;
63
- `),n==="padding"&&"padding-right: ".concat(d,"px ").concat(r,";")].filter(Boolean).join(""),`
64
- }
65
-
66
- .`).concat(Yf,` {
67
- right: `).concat(d,"px ").concat(r,`;
68
- }
69
-
70
- .`).concat(Wf,` {
71
- margin-right: `).concat(d,"px ").concat(r,`;
72
- }
73
-
74
- .`).concat(Yf," .").concat(Yf,` {
75
- right: 0 `).concat(r,`;
76
- }
77
-
78
- .`).concat(Wf," .").concat(Wf,` {
79
- margin-right: 0 `).concat(r,`;
80
- }
81
-
82
- body[`).concat(ll,`] {
83
- `).concat(rU,": ").concat(d,`px;
84
- }
85
- `)},iC=function(){var e=parseInt(document.body.getAttribute(ll)||"0",10);return isFinite(e)?e:0},SU=function(){p.useEffect(function(){return document.body.setAttribute(ll,(iC()+1).toString()),function(){var e=iC()-1;e<=0?document.body.removeAttribute(ll):document.body.setAttribute(ll,e.toString())}},[])},jU=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;SU();var l=p.useMemo(function(){return yU(o)},[o]);return p.createElement(bU,{styles:wU(l,!t,o,n?"":"!important")})},dx=!1;if(typeof window<"u")try{var Rf=Object.defineProperty({},"passive",{get:function(){return dx=!0,!0}});window.addEventListener("test",Rf,Rf),window.removeEventListener("test",Rf,Rf)}catch{dx=!1}var Ui=dx?{passive:!1}:!1,CU=function(e){return e.tagName==="TEXTAREA"},O_=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!CU(e)&&n[t]==="visible")},NU=function(e){return O_(e,"overflowY")},kU=function(e){return O_(e,"overflowX")},lC=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=D_(e,r);if(o){var l=z_(e,r),u=l[1],d=l[2];if(u>d)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},_U=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},EU=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},D_=function(e,t){return e==="v"?NU(t):kU(t)},z_=function(e,t){return e==="v"?_U(t):EU(t)},TU=function(e,t){return e==="h"&&t==="rtl"?-1:1},MU=function(e,t,n,r,o){var l=TU(e,window.getComputedStyle(t).direction),u=l*r,d=n.target,h=t.contains(d),m=!1,v=u>0,g=0,y=0;do{if(!d)break;var w=z_(e,d),S=w[0],j=w[1],N=w[2],C=j-N-l*S;(S||C)&&D_(e,d)&&(g+=C,y+=S);var _=d.parentNode;d=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!h&&d!==document.body||h&&(t.contains(d)||t===d));return(v&&Math.abs(g)<1||!v&&Math.abs(y)<1)&&(m=!0),m},Af=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},cC=function(e){return[e.deltaX,e.deltaY]},uC=function(e){return e&&"current"in e?e.current:e},RU=function(e,t){return e[0]===t[0]&&e[1]===t[1]},AU=function(e){return`
86
- .block-interactivity-`.concat(e,` {pointer-events: none;}
87
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
88
- `)},OU=0,qi=[];function DU(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),o=p.useState(OU++)[0],l=p.useState(A_)[0],u=p.useRef(e);p.useEffect(function(){u.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var j=tU([e.lockRef.current],(e.shards||[]).map(uC),!0).filter(Boolean);return j.forEach(function(N){return N.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),j.forEach(function(N){return N.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var d=p.useCallback(function(j,N){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!u.current.allowPinchZoom;var C=Af(j),_=n.current,E="deltaX"in j?j.deltaX:_[0]-C[0],M="deltaY"in j?j.deltaY:_[1]-C[1],A,R=j.target,T=Math.abs(E)>Math.abs(M)?"h":"v";if("touches"in j&&T==="h"&&R.type==="range")return!1;var O=window.getSelection(),D=O&&O.anchorNode,z=D?D===R||D.contains(R):!1;if(z)return!1;var B=lC(T,R);if(!B)return!0;if(B?A=T:(A=T==="v"?"h":"v",B=lC(T,R)),!B)return!1;if(!r.current&&"changedTouches"in j&&(E||M)&&(r.current=A),!A)return!0;var V=r.current||A;return MU(V,N,j,V==="h"?E:M)},[]),h=p.useCallback(function(j){var N=j;if(!(!qi.length||qi[qi.length-1]!==l)){var C="deltaY"in N?cC(N):Af(N),_=t.current.filter(function(A){return A.name===N.type&&(A.target===N.target||N.target===A.shadowParent)&&RU(A.delta,C)})[0];if(_&&_.should){N.cancelable&&N.preventDefault();return}if(!_){var E=(u.current.shards||[]).map(uC).filter(Boolean).filter(function(A){return A.contains(N.target)}),M=E.length>0?d(N,E[0]):!u.current.noIsolation;M&&N.cancelable&&N.preventDefault()}}},[]),m=p.useCallback(function(j,N,C,_){var E={name:j,delta:N,target:C,should:_,shadowParent:zU(C)};t.current.push(E),setTimeout(function(){t.current=t.current.filter(function(M){return M!==E})},1)},[]),v=p.useCallback(function(j){n.current=Af(j),r.current=void 0},[]),g=p.useCallback(function(j){m(j.type,cC(j),j.target,d(j,e.lockRef.current))},[]),y=p.useCallback(function(j){m(j.type,Af(j),j.target,d(j,e.lockRef.current))},[]);p.useEffect(function(){return qi.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",h,Ui),document.addEventListener("touchmove",h,Ui),document.addEventListener("touchstart",v,Ui),function(){qi=qi.filter(function(j){return j!==l}),document.removeEventListener("wheel",h,Ui),document.removeEventListener("touchmove",h,Ui),document.removeEventListener("touchstart",v,Ui)}},[]);var w=e.removeScrollBar,S=e.inert;return p.createElement(p.Fragment,null,S?p.createElement(l,{styles:AU(o)}):null,w?p.createElement(jU,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function zU(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const PU=uU(R_,DU);var Bu=p.forwardRef(function(e,t){return p.createElement(Wh,ys({},e,{ref:t,sideCar:PU}))});Bu.classNames=Wh.classNames;var LU=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Vi=new WeakMap,Of=new WeakMap,Df={},Sv=0,P_=function(e){return e&&(e.host||P_(e.parentNode))},IU=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=P_(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},$U=function(e,t,n,r){var o=IU(t,Array.isArray(e)?e:[e]);Df[n]||(Df[n]=new WeakMap);var l=Df[n],u=[],d=new Set,h=new Set(o),m=function(g){!g||d.has(g)||(d.add(g),m(g.parentNode))};o.forEach(m);var v=function(g){!g||h.has(g)||Array.prototype.forEach.call(g.children,function(y){if(d.has(y))v(y);else try{var w=y.getAttribute(r),S=w!==null&&w!=="false",j=(Vi.get(y)||0)+1,N=(l.get(y)||0)+1;Vi.set(y,j),l.set(y,N),u.push(y),j===1&&S&&Of.set(y,!0),N===1&&y.setAttribute(n,"true"),S||y.setAttribute(r,"true")}catch(C){console.error("aria-hidden: cannot operate on ",y,C)}})};return v(t),d.clear(),Sv++,function(){u.forEach(function(g){var y=Vi.get(g)-1,w=l.get(g)-1;Vi.set(g,y),l.set(g,w),y||(Of.has(g)||g.removeAttribute(r),Of.delete(g)),w||g.removeAttribute(n)}),Sv--,Sv||(Vi=new WeakMap,Vi=new WeakMap,Of=new WeakMap,Df={})}},Gh=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=LU(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),$U(r,o,n,"aria-hidden")):function(){return null}},Zh="Dialog",[L_,I_]=Dn(Zh),[FU,is]=L_(Zh),$_=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:l,modal:u=!0}=e,d=p.useRef(null),h=p.useRef(null),[m,v]=nr({prop:r,defaultProp:o??!1,onChange:l,caller:Zh});return i.jsx(FU,{scope:t,triggerRef:d,contentRef:h,contentId:gn(),titleId:gn(),descriptionId:gn(),open:m,onOpenChange:v,onOpenToggle:p.useCallback(()=>v(g=>!g),[v]),modal:u,children:n})};$_.displayName=Zh;var F_="DialogTrigger",B_=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=is(F_,n),l=Ge(t,o.triggerRef);return i.jsx(ze.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Ly(o.open),...r,ref:l,onClick:Se(e.onClick,o.onOpenToggle)})});B_.displayName=F_;var zy="DialogPortal",[BU,U_]=L_(zy,{forceMount:void 0}),q_=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,l=is(zy,t);return i.jsx(BU,{scope:t,forceMount:n,children:p.Children.map(r,u=>i.jsx(yn,{present:n||l.open,children:i.jsx(Il,{asChild:!0,container:o,children:u})}))})};q_.displayName=zy;var Sh="DialogOverlay",V_=p.forwardRef((e,t)=>{const n=U_(Sh,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,l=is(Sh,e.__scopeDialog);return l.modal?i.jsx(yn,{present:r||l.open,children:i.jsx(qU,{...o,ref:t})}):null});V_.displayName=Sh;var UU=Bo("DialogOverlay.RemoveScroll"),qU=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=is(Sh,n);return i.jsx(Bu,{as:UU,allowPinchZoom:!0,shards:[o.contentRef],children:i.jsx(ze.div,{"data-state":Ly(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Uo="DialogContent",H_=p.forwardRef((e,t)=>{const n=U_(Uo,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,l=is(Uo,e.__scopeDialog);return i.jsx(yn,{present:r||l.open,children:l.modal?i.jsx(VU,{...o,ref:t}):i.jsx(HU,{...o,ref:t})})});H_.displayName=Uo;var VU=p.forwardRef((e,t)=>{const n=is(Uo,e.__scopeDialog),r=p.useRef(null),o=Ge(t,n.contentRef,r);return p.useEffect(()=>{const l=r.current;if(l)return Gh(l)},[]),i.jsx(Y_,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Se(e.onCloseAutoFocus,l=>{l.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Se(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&l.preventDefault()}),onFocusOutside:Se(e.onFocusOutside,l=>l.preventDefault())})}),HU=p.forwardRef((e,t)=>{const n=is(Uo,e.__scopeDialog),r=p.useRef(!1),o=p.useRef(!1);return i.jsx(Y_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(r.current||n.triggerRef.current?.focus(),l.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(r.current=!0,l.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const u=l.target;n.triggerRef.current?.contains(u)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&o.current&&l.preventDefault()}})}),Y_=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:l,...u}=e,d=is(Uo,n),h=p.useRef(null),m=Ge(t,h);return Yh(),i.jsxs(i.Fragment,{children:[i.jsx(Fu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:l,children:i.jsx(Ll,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":Ly(d.open),...u,ref:m,onDismiss:()=>d.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(WU,{titleId:d.titleId}),i.jsx(ZU,{contentRef:h,descriptionId:d.descriptionId})]})]})}),Py="DialogTitle",W_=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=is(Py,n);return i.jsx(ze.h2,{id:o.titleId,...r,ref:t})});W_.displayName=Py;var G_="DialogDescription",Z_=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=is(G_,n);return i.jsx(ze.p,{id:o.descriptionId,...r,ref:t})});Z_.displayName=G_;var Q_="DialogClose",K_=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=is(Q_,n);return i.jsx(ze.button,{type:"button",...r,ref:t,onClick:Se(e.onClick,()=>o.onOpenChange(!1))})});K_.displayName=Q_;function Ly(e){return e?"open":"closed"}var X_="DialogTitleWarning",[YU,J_]=yB(X_,{contentName:Uo,titleName:Py,docsSlug:"dialog"}),WU=({titleId:e})=>{const t=J_(X_),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
89
-
90
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
91
-
92
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},GU="DialogDescriptionWarning",ZU=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${J_(GU).contentName}}.`;return p.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Uu=$_,QU=B_,qu=q_,Vu=V_,Hu=H_,Qh=W_,Iy=Z_,Kh=K_;function e2({...e}){return i.jsx(Uu,{"data-slot":"sheet",...e})}function KU({...e}){return i.jsx(qu,{"data-slot":"sheet-portal",...e})}function XU({className:e,...t}){return i.jsx(Vu,{"data-slot":"sheet-overlay",className:W("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function t2({className:e,children:t,side:n="right",...r}){return i.jsxs(KU,{children:[i.jsx(XU,{}),i.jsxs(Hu,{"data-slot":"sheet-content",className:W("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",n==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",n==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",n==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",n==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...r,children:[t,i.jsxs(Kh,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[i.jsx(At,{className:"size-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function JU({className:e,...t}){return i.jsx("div",{"data-slot":"sheet-header",className:W("flex flex-col gap-1.5 p-4",e),...t})}function n2({className:e,...t}){return i.jsx(Qh,{"data-slot":"sheet-title",className:W("text-foreground font-semibold",e),...t})}function e9({className:e,...t}){return i.jsx(Iy,{"data-slot":"sheet-description",className:W("text-muted-foreground text-sm",e),...t})}const t9=["top","right","bottom","left"],Za=Math.min,gr=Math.max,jh=Math.round,zf=Math.floor,Ns=e=>({x:e,y:e}),n9={left:"right",right:"left",bottom:"top",top:"bottom"},r9={start:"end",end:"start"};function fx(e,t,n){return gr(e,Za(t,n))}function ha(e,t){return typeof e=="function"?e(t):e}function ma(e){return e.split("-")[0]}function $l(e){return e.split("-")[1]}function $y(e){return e==="x"?"y":"x"}function Fy(e){return e==="y"?"height":"width"}const s9=new Set(["top","bottom"]);function js(e){return s9.has(ma(e))?"y":"x"}function By(e){return $y(js(e))}function a9(e,t,n){n===void 0&&(n=!1);const r=$l(e),o=By(e),l=Fy(o);let u=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=Ch(u)),[u,Ch(u)]}function o9(e){const t=Ch(e);return[hx(e),t,hx(t)]}function hx(e){return e.replace(/start|end/g,t=>r9[t])}const dC=["left","right"],fC=["right","left"],i9=["top","bottom"],l9=["bottom","top"];function c9(e,t,n){switch(e){case"top":case"bottom":return n?t?fC:dC:t?dC:fC;case"left":case"right":return t?i9:l9;default:return[]}}function u9(e,t,n,r){const o=$l(e);let l=c9(ma(e),n==="start",r);return o&&(l=l.map(u=>u+"-"+o),t&&(l=l.concat(l.map(hx)))),l}function Ch(e){return e.replace(/left|right|bottom|top/g,t=>n9[t])}function d9(e){return{top:0,right:0,bottom:0,left:0,...e}}function r2(e){return typeof e!="number"?d9(e):{top:e,right:e,bottom:e,left:e}}function Nh(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 hC(e,t,n){let{reference:r,floating:o}=e;const l=js(t),u=By(t),d=Fy(u),h=ma(t),m=l==="y",v=r.x+r.width/2-o.width/2,g=r.y+r.height/2-o.height/2,y=r[d]/2-o[d]/2;let w;switch(h){case"top":w={x:v,y:r.y-o.height};break;case"bottom":w={x:v,y:r.y+r.height};break;case"right":w={x:r.x+r.width,y:g};break;case"left":w={x:r.x-o.width,y:g};break;default:w={x:r.x,y:r.y}}switch($l(t)){case"start":w[u]-=y*(n&&m?-1:1);break;case"end":w[u]+=y*(n&&m?-1:1);break}return w}async function f9(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:l,rects:u,elements:d,strategy:h}=e,{boundary:m="clippingAncestors",rootBoundary:v="viewport",elementContext:g="floating",altBoundary:y=!1,padding:w=0}=ha(t,e),S=r2(w),N=d[y?g==="floating"?"reference":"floating":g],C=Nh(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(N)))==null||n?N:N.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:m,rootBoundary:v,strategy:h})),_=g==="floating"?{x:r,y:o,width:u.floating.width,height:u.floating.height}:u.reference,E=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),M=await(l.isElement==null?void 0:l.isElement(E))?await(l.getScale==null?void 0:l.getScale(E))||{x:1,y:1}:{x:1,y:1},A=Nh(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:_,offsetParent:E,strategy:h}):_);return{top:(C.top-A.top+S.top)/M.y,bottom:(A.bottom-C.bottom+S.bottom)/M.y,left:(C.left-A.left+S.left)/M.x,right:(A.right-C.right+S.right)/M.x}}const h9=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:l=[],platform:u}=n,d=l.filter(Boolean),h=await(u.isRTL==null?void 0:u.isRTL(t));let m=await u.getElementRects({reference:e,floating:t,strategy:o}),{x:v,y:g}=hC(m,r,h),y=r,w={},S=0;for(let N=0;N<d.length;N++){var j;const{name:C,fn:_}=d[N],{x:E,y:M,data:A,reset:R}=await _({x:v,y:g,initialPlacement:r,placement:y,strategy:o,middlewareData:w,rects:m,platform:{...u,detectOverflow:(j=u.detectOverflow)!=null?j:f9},elements:{reference:e,floating:t}});v=E??v,g=M??g,w={...w,[C]:{...w[C],...A}},R&&S<=50&&(S++,typeof R=="object"&&(R.placement&&(y=R.placement),R.rects&&(m=R.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:o}):R.rects),{x:v,y:g}=hC(m,y,h)),N=-1)}return{x:v,y:g,placement:y,strategy:o,middlewareData:w}},m9=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:l,platform:u,elements:d,middlewareData:h}=t,{element:m,padding:v=0}=ha(e,t)||{};if(m==null)return{};const g=r2(v),y={x:n,y:r},w=By(o),S=Fy(w),j=await u.getDimensions(m),N=w==="y",C=N?"top":"left",_=N?"bottom":"right",E=N?"clientHeight":"clientWidth",M=l.reference[S]+l.reference[w]-y[w]-l.floating[S],A=y[w]-l.reference[w],R=await(u.getOffsetParent==null?void 0:u.getOffsetParent(m));let T=R?R[E]:0;(!T||!await(u.isElement==null?void 0:u.isElement(R)))&&(T=d.floating[E]||l.floating[S]);const O=M/2-A/2,D=T/2-j[S]/2-1,z=Za(g[C],D),B=Za(g[_],D),V=z,Y=T-j[S]-B,G=T/2-j[S]/2+O,ae=fx(V,G,Y),L=!h.arrow&&$l(o)!=null&&G!==ae&&l.reference[S]/2-(G<V?z:B)-j[S]/2<0,$=L?G<V?G-V:G-Y:0;return{[w]:y[w]+$,data:{[w]:ae,centerOffset:G-ae-$,...L&&{alignmentOffset:$}},reset:L}}}),p9=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:l,rects:u,initialPlacement:d,platform:h,elements:m}=t,{mainAxis:v=!0,crossAxis:g=!0,fallbackPlacements:y,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:j=!0,...N}=ha(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const C=ma(o),_=js(d),E=ma(d)===d,M=await(h.isRTL==null?void 0:h.isRTL(m.floating)),A=y||(E||!j?[Ch(d)]:o9(d)),R=S!=="none";!y&&R&&A.push(...u9(d,j,S,M));const T=[d,...A],O=await h.detectOverflow(t,N),D=[];let z=((r=l.flip)==null?void 0:r.overflows)||[];if(v&&D.push(O[C]),g){const G=a9(o,u,M);D.push(O[G[0]],O[G[1]])}if(z=[...z,{placement:o,overflows:D}],!D.every(G=>G<=0)){var B,V;const G=(((B=l.flip)==null?void 0:B.index)||0)+1,ae=T[G];if(ae&&(!(g==="alignment"?_!==js(ae):!1)||z.every(U=>js(U.placement)===_?U.overflows[0]>0:!0)))return{data:{index:G,overflows:z},reset:{placement:ae}};let L=(V=z.filter($=>$.overflows[0]<=0).sort(($,U)=>$.overflows[1]-U.overflows[1])[0])==null?void 0:V.placement;if(!L)switch(w){case"bestFit":{var Y;const $=(Y=z.filter(U=>{if(R){const H=js(U.placement);return H===_||H==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(H=>H>0).reduce((H,le)=>H+le,0)]).sort((U,H)=>U[1]-H[1])[0])==null?void 0:Y[0];$&&(L=$);break}case"initialPlacement":L=d;break}if(o!==L)return{reset:{placement:L}}}return{}}}};function mC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function pC(e){return t9.some(t=>e[t]>=0)}const g9=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...l}=ha(e,t);switch(o){case"referenceHidden":{const u=await r.detectOverflow(t,{...l,elementContext:"reference"}),d=mC(u,n.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:pC(d)}}}case"escaped":{const u=await r.detectOverflow(t,{...l,altBoundary:!0}),d=mC(u,n.floating);return{data:{escapedOffsets:d,escaped:pC(d)}}}default:return{}}}}},s2=new Set(["left","top"]);async function v9(e,t){const{placement:n,platform:r,elements:o}=e,l=await(r.isRTL==null?void 0:r.isRTL(o.floating)),u=ma(n),d=$l(n),h=js(n)==="y",m=s2.has(u)?-1:1,v=l&&h?-1:1,g=ha(t,e);let{mainAxis:y,crossAxis:w,alignmentAxis:S}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return d&&typeof S=="number"&&(w=d==="end"?S*-1:S),h?{x:w*v,y:y*m}:{x:y*m,y:w*v}}const x9=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:l,placement:u,middlewareData:d}=t,h=await v9(t,e);return u===((n=d.offset)==null?void 0:n.placement)&&(r=d.arrow)!=null&&r.alignmentOffset?{}:{x:o+h.x,y:l+h.y,data:{...h,placement:u}}}}},y9=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:l}=t,{mainAxis:u=!0,crossAxis:d=!1,limiter:h={fn:C=>{let{x:_,y:E}=C;return{x:_,y:E}}},...m}=ha(e,t),v={x:n,y:r},g=await l.detectOverflow(t,m),y=js(ma(o)),w=$y(y);let S=v[w],j=v[y];if(u){const C=w==="y"?"top":"left",_=w==="y"?"bottom":"right",E=S+g[C],M=S-g[_];S=fx(E,S,M)}if(d){const C=y==="y"?"top":"left",_=y==="y"?"bottom":"right",E=j+g[C],M=j-g[_];j=fx(E,j,M)}const N=h.fn({...t,[w]:S,[y]:j});return{...N,data:{x:N.x-n,y:N.y-r,enabled:{[w]:u,[y]:d}}}}}},b9=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:l,middlewareData:u}=t,{offset:d=0,mainAxis:h=!0,crossAxis:m=!0}=ha(e,t),v={x:n,y:r},g=js(o),y=$y(g);let w=v[y],S=v[g];const j=ha(d,t),N=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(h){const E=y==="y"?"height":"width",M=l.reference[y]-l.floating[E]+N.mainAxis,A=l.reference[y]+l.reference[E]-N.mainAxis;w<M?w=M:w>A&&(w=A)}if(m){var C,_;const E=y==="y"?"width":"height",M=s2.has(ma(o)),A=l.reference[g]-l.floating[E]+(M&&((C=u.offset)==null?void 0:C[g])||0)+(M?0:N.crossAxis),R=l.reference[g]+l.reference[E]+(M?0:((_=u.offset)==null?void 0:_[g])||0)-(M?N.crossAxis:0);S<A?S=A:S>R&&(S=R)}return{[y]:w,[g]:S}}}},w9=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:l,platform:u,elements:d}=t,{apply:h=()=>{},...m}=ha(e,t),v=await u.detectOverflow(t,m),g=ma(o),y=$l(o),w=js(o)==="y",{width:S,height:j}=l.floating;let N,C;g==="top"||g==="bottom"?(N=g,C=y===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(C=g,N=y==="end"?"top":"bottom");const _=j-v.top-v.bottom,E=S-v.left-v.right,M=Za(j-v[N],_),A=Za(S-v[C],E),R=!t.middlewareData.shift;let T=M,O=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=_),R&&!y){const z=gr(v.left,0),B=gr(v.right,0),V=gr(v.top,0),Y=gr(v.bottom,0);w?O=S-2*(z!==0||B!==0?z+B:gr(v.left,v.right)):T=j-2*(V!==0||Y!==0?V+Y:gr(v.top,v.bottom))}await h({...t,availableWidth:O,availableHeight:T});const D=await u.getDimensions(d.floating);return S!==D.width||j!==D.height?{reset:{rects:!0}}:{}}}};function Xh(){return typeof window<"u"}function Fl(e){return a2(e)?(e.nodeName||"").toLowerCase():"#document"}function br(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rs(e){var t;return(t=(a2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function a2(e){return Xh()?e instanceof Node||e instanceof br(e).Node:!1}function rs(e){return Xh()?e instanceof Element||e instanceof br(e).Element:!1}function Ts(e){return Xh()?e instanceof HTMLElement||e instanceof br(e).HTMLElement:!1}function gC(e){return!Xh()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof br(e).ShadowRoot}const S9=new Set(["inline","contents"]);function Yu(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ss(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!S9.has(o)}const j9=new Set(["table","td","th"]);function C9(e){return j9.has(Fl(e))}const N9=[":popover-open",":modal"];function Jh(e){return N9.some(t=>{try{return e.matches(t)}catch{return!1}})}const k9=["transform","translate","scale","rotate","perspective"],_9=["transform","translate","scale","rotate","perspective","filter"],E9=["paint","layout","strict","content"];function Uy(e){const t=qy(),n=rs(e)?ss(e):e;return k9.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||_9.some(r=>(n.willChange||"").includes(r))||E9.some(r=>(n.contain||"").includes(r))}function T9(e){let t=Qa(e);for(;Ts(t)&&!vl(t);){if(Uy(t))return t;if(Jh(t))return null;t=Qa(t)}return null}function qy(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const M9=new Set(["html","body","#document"]);function vl(e){return M9.has(Fl(e))}function ss(e){return br(e).getComputedStyle(e)}function em(e){return rs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qa(e){if(Fl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gC(e)&&e.host||Rs(e);return gC(t)?t.host:t}function o2(e){const t=Qa(e);return vl(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ts(t)&&Yu(t)?t:o2(t)}function Su(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=o2(e),l=o===((r=e.ownerDocument)==null?void 0:r.body),u=br(o);if(l){const d=mx(u);return t.concat(u,u.visualViewport||[],Yu(o)?o:[],d&&n?Su(d):[])}return t.concat(o,Su(o,[],n))}function mx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function i2(e){const t=ss(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ts(e),l=o?e.offsetWidth:n,u=o?e.offsetHeight:r,d=jh(n)!==l||jh(r)!==u;return d&&(n=l,r=u),{width:n,height:r,$:d}}function Vy(e){return rs(e)?e:e.contextElement}function cl(e){const t=Vy(e);if(!Ts(t))return Ns(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:l}=i2(t);let u=(l?jh(n.width):n.width)/r,d=(l?jh(n.height):n.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const R9=Ns(0);function l2(e){const t=br(e);return!qy()||!t.visualViewport?R9:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function A9(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==br(e)?!1:t}function qo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),l=Vy(e);let u=Ns(1);t&&(r?rs(r)&&(u=cl(r)):u=cl(e));const d=A9(l,n,r)?l2(l):Ns(0);let h=(o.left+d.x)/u.x,m=(o.top+d.y)/u.y,v=o.width/u.x,g=o.height/u.y;if(l){const y=br(l),w=r&&rs(r)?br(r):r;let S=y,j=mx(S);for(;j&&r&&w!==S;){const N=cl(j),C=j.getBoundingClientRect(),_=ss(j),E=C.left+(j.clientLeft+parseFloat(_.paddingLeft))*N.x,M=C.top+(j.clientTop+parseFloat(_.paddingTop))*N.y;h*=N.x,m*=N.y,v*=N.x,g*=N.y,h+=E,m+=M,S=br(j),j=mx(S)}}return Nh({width:v,height:g,x:h,y:m})}function tm(e,t){const n=em(e).scrollLeft;return t?t.left+n:qo(Rs(e)).left+n}function c2(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-tm(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function O9(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const l=o==="fixed",u=Rs(r),d=t?Jh(t.floating):!1;if(r===u||d&&l)return n;let h={scrollLeft:0,scrollTop:0},m=Ns(1);const v=Ns(0),g=Ts(r);if((g||!g&&!l)&&((Fl(r)!=="body"||Yu(u))&&(h=em(r)),Ts(r))){const w=qo(r);m=cl(r),v.x=w.x+r.clientLeft,v.y=w.y+r.clientTop}const y=u&&!g&&!l?c2(u,h):Ns(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-h.scrollLeft*m.x+v.x+y.x,y:n.y*m.y-h.scrollTop*m.y+v.y+y.y}}function D9(e){return Array.from(e.getClientRects())}function z9(e){const t=Rs(e),n=em(e),r=e.ownerDocument.body,o=gr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),l=gr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let u=-n.scrollLeft+tm(e);const d=-n.scrollTop;return ss(r).direction==="rtl"&&(u+=gr(t.clientWidth,r.clientWidth)-o),{width:o,height:l,x:u,y:d}}const vC=25;function P9(e,t){const n=br(e),r=Rs(e),o=n.visualViewport;let l=r.clientWidth,u=r.clientHeight,d=0,h=0;if(o){l=o.width,u=o.height;const v=qy();(!v||v&&t==="fixed")&&(d=o.offsetLeft,h=o.offsetTop)}const m=tm(r);if(m<=0){const v=r.ownerDocument,g=v.body,y=getComputedStyle(g),w=v.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,S=Math.abs(r.clientWidth-g.clientWidth-w);S<=vC&&(l-=S)}else m<=vC&&(l+=m);return{width:l,height:u,x:d,y:h}}const L9=new Set(["absolute","fixed"]);function I9(e,t){const n=qo(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,l=Ts(e)?cl(e):Ns(1),u=e.clientWidth*l.x,d=e.clientHeight*l.y,h=o*l.x,m=r*l.y;return{width:u,height:d,x:h,y:m}}function xC(e,t,n){let r;if(t==="viewport")r=P9(e,n);else if(t==="document")r=z9(Rs(e));else if(rs(t))r=I9(t,n);else{const o=l2(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Nh(r)}function u2(e,t){const n=Qa(e);return n===t||!rs(n)||vl(n)?!1:ss(n).position==="fixed"||u2(n,t)}function $9(e,t){const n=t.get(e);if(n)return n;let r=Su(e,[],!1).filter(d=>rs(d)&&Fl(d)!=="body"),o=null;const l=ss(e).position==="fixed";let u=l?Qa(e):e;for(;rs(u)&&!vl(u);){const d=ss(u),h=Uy(u);!h&&d.position==="fixed"&&(o=null),(l?!h&&!o:!h&&d.position==="static"&&!!o&&L9.has(o.position)||Yu(u)&&!h&&u2(e,u))?r=r.filter(v=>v!==u):o=d,u=Qa(u)}return t.set(e,r),r}function F9(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const u=[...n==="clippingAncestors"?Jh(t)?[]:$9(t,this._c):[].concat(n),r],d=u[0],h=u.reduce((m,v)=>{const g=xC(t,v,o);return m.top=gr(g.top,m.top),m.right=Za(g.right,m.right),m.bottom=Za(g.bottom,m.bottom),m.left=gr(g.left,m.left),m},xC(t,d,o));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function B9(e){const{width:t,height:n}=i2(e);return{width:t,height:n}}function U9(e,t,n){const r=Ts(t),o=Rs(t),l=n==="fixed",u=qo(e,!0,l,t);let d={scrollLeft:0,scrollTop:0};const h=Ns(0);function m(){h.x=tm(o)}if(r||!r&&!l)if((Fl(t)!=="body"||Yu(o))&&(d=em(t)),r){const w=qo(t,!0,l,t);h.x=w.x+t.clientLeft,h.y=w.y+t.clientTop}else o&&m();l&&!r&&o&&m();const v=o&&!r&&!l?c2(o,d):Ns(0),g=u.left+d.scrollLeft-h.x-v.x,y=u.top+d.scrollTop-h.y-v.y;return{x:g,y,width:u.width,height:u.height}}function jv(e){return ss(e).position==="static"}function yC(e,t){if(!Ts(e)||ss(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Rs(e)===n&&(n=n.ownerDocument.body),n}function d2(e,t){const n=br(e);if(Jh(e))return n;if(!Ts(e)){let o=Qa(e);for(;o&&!vl(o);){if(rs(o)&&!jv(o))return o;o=Qa(o)}return n}let r=yC(e,t);for(;r&&C9(r)&&jv(r);)r=yC(r,t);return r&&vl(r)&&jv(r)&&!Uy(r)?n:r||T9(e)||n}const q9=async function(e){const t=this.getOffsetParent||d2,n=this.getDimensions,r=await n(e.floating);return{reference:U9(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function V9(e){return ss(e).direction==="rtl"}const H9={convertOffsetParentRelativeRectToViewportRelativeRect:O9,getDocumentElement:Rs,getClippingRect:F9,getOffsetParent:d2,getElementRects:q9,getClientRects:D9,getDimensions:B9,getScale:cl,isElement:rs,isRTL:V9};function f2(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Y9(e,t){let n=null,r;const o=Rs(e);function l(){var d;clearTimeout(r),(d=n)==null||d.disconnect(),n=null}function u(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),l();const m=e.getBoundingClientRect(),{left:v,top:g,width:y,height:w}=m;if(d||t(),!y||!w)return;const S=zf(g),j=zf(o.clientWidth-(v+y)),N=zf(o.clientHeight-(g+w)),C=zf(v),E={rootMargin:-S+"px "+-j+"px "+-N+"px "+-C+"px",threshold:gr(0,Za(1,h))||1};let M=!0;function A(R){const T=R[0].intersectionRatio;if(T!==h){if(!M)return u();T?u(!1,T):r=setTimeout(()=>{u(!1,1e-7)},1e3)}T===1&&!f2(m,e.getBoundingClientRect())&&u(),M=!1}try{n=new IntersectionObserver(A,{...E,root:o.ownerDocument})}catch{n=new IntersectionObserver(A,E)}n.observe(e)}return u(!0),l}function W9(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,m=Vy(e),v=o||l?[...m?Su(m):[],...Su(t)]:[];v.forEach(C=>{o&&C.addEventListener("scroll",n,{passive:!0}),l&&C.addEventListener("resize",n)});const g=m&&d?Y9(m,n):null;let y=-1,w=null;u&&(w=new ResizeObserver(C=>{let[_]=C;_&&_.target===m&&w&&(w.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var E;(E=w)==null||E.observe(t)})),n()}),m&&!h&&w.observe(m),w.observe(t));let S,j=h?qo(e):null;h&&N();function N(){const C=qo(e);j&&!f2(j,C)&&n(),j=C,S=requestAnimationFrame(N)}return n(),()=>{var C;v.forEach(_=>{o&&_.removeEventListener("scroll",n),l&&_.removeEventListener("resize",n)}),g?.(),(C=w)==null||C.disconnect(),w=null,h&&cancelAnimationFrame(S)}}const G9=x9,Z9=y9,Q9=p9,K9=w9,X9=g9,bC=m9,J9=b9,e7=(e,t,n)=>{const r=new Map,o={platform:H9,...n},l={...o.platform,_c:r};return h9(e,t,{...o,platform:l})};var t7=typeof document<"u",n7=function(){},Gf=t7?p.useLayoutEffect:n7;function kh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!kh(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;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const l=o[r];if(!(l==="_owner"&&e.$$typeof)&&!kh(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function h2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function wC(e,t){const n=h2(e);return Math.round(t*n)/n}function Cv(e){const t=p.useRef(e);return Gf(()=>{t.current=e}),t}function r7(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:l,floating:u}={},transform:d=!0,whileElementsMounted:h,open:m}=e,[v,g]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,w]=p.useState(r);kh(y,r)||w(r);const[S,j]=p.useState(null),[N,C]=p.useState(null),_=p.useCallback(U=>{U!==R.current&&(R.current=U,j(U))},[]),E=p.useCallback(U=>{U!==T.current&&(T.current=U,C(U))},[]),M=l||S,A=u||N,R=p.useRef(null),T=p.useRef(null),O=p.useRef(v),D=h!=null,z=Cv(h),B=Cv(o),V=Cv(m),Y=p.useCallback(()=>{if(!R.current||!T.current)return;const U={placement:t,strategy:n,middleware:y};B.current&&(U.platform=B.current),e7(R.current,T.current,U).then(H=>{const le={...H,isPositioned:V.current!==!1};G.current&&!kh(O.current,le)&&(O.current=le,Ml.flushSync(()=>{g(le)}))})},[y,t,n,B,V]);Gf(()=>{m===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,g(U=>({...U,isPositioned:!1})))},[m]);const G=p.useRef(!1);Gf(()=>(G.current=!0,()=>{G.current=!1}),[]),Gf(()=>{if(M&&(R.current=M),A&&(T.current=A),M&&A){if(z.current)return z.current(M,A,Y);Y()}},[M,A,Y,z,D]);const ae=p.useMemo(()=>({reference:R,floating:T,setReference:_,setFloating:E}),[_,E]),L=p.useMemo(()=>({reference:M,floating:A}),[M,A]),$=p.useMemo(()=>{const U={position:n,left:0,top:0};if(!L.floating)return U;const H=wC(L.floating,v.x),le=wC(L.floating,v.y);return d?{...U,transform:"translate("+H+"px, "+le+"px)",...h2(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:le}},[n,d,L.floating,v.x,v.y]);return p.useMemo(()=>({...v,update:Y,refs:ae,elements:L,floatingStyles:$}),[v,Y,ae,L,$])}const s7=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?bC({element:r.current,padding:o}).fn(n):{}:r?bC({element:r,padding:o}).fn(n):{}}}},a7=(e,t)=>({...G9(e),options:[e,t]}),o7=(e,t)=>({...Z9(e),options:[e,t]}),i7=(e,t)=>({...J9(e),options:[e,t]}),l7=(e,t)=>({...Q9(e),options:[e,t]}),c7=(e,t)=>({...K9(e),options:[e,t]}),u7=(e,t)=>({...X9(e),options:[e,t]}),d7=(e,t)=>({...s7(e),options:[e,t]});var f7="Arrow",m2=p.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...l}=e;return i.jsx(ze.svg,{...l,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});m2.displayName=f7;var h7=m2;function Hy(e){const[t,n]=p.useState(void 0);return Jt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const l=o[0];let u,d;if("borderBoxSize"in l){const h=l.borderBoxSize,m=Array.isArray(h)?h[0]:h;u=m.inlineSize,d=m.blockSize}else u=e.offsetWidth,d=e.offsetHeight;n({width:u,height:d})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Yy="Popper",[p2,to]=Dn(Yy),[m7,g2]=p2(Yy),v2=e=>{const{__scopePopper:t,children:n}=e,[r,o]=p.useState(null);return i.jsx(m7,{scope:t,anchor:r,onAnchorChange:o,children:n})};v2.displayName=Yy;var x2="PopperAnchor",y2=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,l=g2(x2,n),u=p.useRef(null),d=Ge(t,u),h=p.useRef(null);return p.useEffect(()=>{const m=h.current;h.current=r?.current||u.current,m!==h.current&&l.onAnchorChange(h.current)}),r?null:i.jsx(ze.div,{...o,ref:d})});y2.displayName=x2;var Wy="PopperContent",[p7,g7]=p2(Wy),b2=p.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:l="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:h=!0,collisionBoundary:m=[],collisionPadding:v=0,sticky:g="partial",hideWhenDetached:y=!1,updatePositionStrategy:w="optimized",onPlaced:S,...j}=e,N=g2(Wy,n),[C,_]=p.useState(null),E=Ge(t,te=>_(te)),[M,A]=p.useState(null),R=Hy(M),T=R?.width??0,O=R?.height??0,D=r+(l!=="center"?"-"+l:""),z=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},B=Array.isArray(m)?m:[m],V=B.length>0,Y={padding:z,boundary:B.filter(x7),altBoundary:V},{refs:G,floatingStyles:ae,placement:L,isPositioned:$,middlewareData:U}=r7({strategy:"fixed",placement:D,whileElementsMounted:(...te)=>W9(...te,{animationFrame:w==="always"}),elements:{reference:N.anchor},middleware:[a7({mainAxis:o+O,alignmentAxis:u}),h&&o7({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?i7():void 0,...Y}),h&&l7({...Y}),c7({...Y,apply:({elements:te,rects:ye,availableWidth:Ce,availableHeight:_e})=>{const{width:Re,height:ge}=ye.reference,Fe=te.floating.style;Fe.setProperty("--radix-popper-available-width",`${Ce}px`),Fe.setProperty("--radix-popper-available-height",`${_e}px`),Fe.setProperty("--radix-popper-anchor-width",`${Re}px`),Fe.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),M&&d7({element:M,padding:d}),y7({arrowWidth:T,arrowHeight:O}),y&&u7({strategy:"referenceHidden",...Y})]}),[H,le]=j2(L),I=Nn(S);Jt(()=>{$&&I?.()},[$,I]);const F=U.arrow?.x,K=U.arrow?.y,ne=U.arrow?.centerOffset!==0,[X,ue]=p.useState();return Jt(()=>{C&&ue(window.getComputedStyle(C).zIndex)},[C]),i.jsx("div",{ref:G.setFloating,"data-radix-popper-content-wrapper":"",style:{...ae,transform:$?ae.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[U.transformOrigin?.x,U.transformOrigin?.y].join(" "),...U.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:i.jsx(p7,{scope:n,placedSide:H,onArrowChange:A,arrowX:F,arrowY:K,shouldHideArrow:ne,children:i.jsx(ze.div,{"data-side":H,"data-align":le,...j,ref:E,style:{...j.style,animation:$?void 0:"none"}})})})});b2.displayName=Wy;var w2="PopperArrow",v7={top:"bottom",right:"left",bottom:"top",left:"right"},S2=p.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,l=g7(w2,r),u=v7[l.placedSide];return i.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:i.jsx(h7,{...o,ref:n,style:{...o.style,display:"block"}})})});S2.displayName=w2;function x7(e){return e!==null}var y7=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,u=o.arrow?.centerOffset!==0,d=u?0:e.arrowWidth,h=u?0:e.arrowHeight,[m,v]=j2(n),g={start:"0%",center:"50%",end:"100%"}[v],y=(o.arrow?.x??0)+d/2,w=(o.arrow?.y??0)+h/2;let S="",j="";return m==="bottom"?(S=u?g:`${y}px`,j=`${-h}px`):m==="top"?(S=u?g:`${y}px`,j=`${r.floating.height+h}px`):m==="right"?(S=`${-h}px`,j=u?g:`${w}px`):m==="left"&&(S=`${r.floating.width+h}px`,j=u?g:`${w}px`),{data:{x:S,y:j}}}});function j2(e){const[t,n="center"]=e.split("-");return[t,n]}var nm=v2,Wu=y2,rm=b2,sm=S2,C2=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),b7="VisuallyHidden",N2=p.forwardRef((e,t)=>i.jsx(ze.span,{...e,ref:t,style:{...C2,...e.style}}));N2.displayName=b7;var w7=N2,[am]=Dn("Tooltip",[to]),om=to(),k2="TooltipProvider",S7=700,px="tooltip.open",[j7,Gy]=am(k2),_2=e=>{const{__scopeTooltip:t,delayDuration:n=S7,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:l}=e,u=p.useRef(!0),d=p.useRef(!1),h=p.useRef(0);return p.useEffect(()=>{const m=h.current;return()=>window.clearTimeout(m)},[]),i.jsx(j7,{scope:t,isOpenDelayedRef:u,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(h.current),u.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>u.current=!0,r)},[r]),isPointerInTransitRef:d,onPointerInTransitChange:p.useCallback(m=>{d.current=m},[]),disableHoverableContent:o,children:l})};_2.displayName=k2;var ju="Tooltip",[C7,Gu]=am(ju),E2=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:l,disableHoverableContent:u,delayDuration:d}=e,h=Gy(ju,e.__scopeTooltip),m=om(t),[v,g]=p.useState(null),y=gn(),w=p.useRef(0),S=u??h.disableHoverableContent,j=d??h.delayDuration,N=p.useRef(!1),[C,_]=nr({prop:r,defaultProp:o??!1,onChange:T=>{T?(h.onOpen(),document.dispatchEvent(new CustomEvent(px))):h.onClose(),l?.(T)},caller:ju}),E=p.useMemo(()=>C?N.current?"delayed-open":"instant-open":"closed",[C]),M=p.useCallback(()=>{window.clearTimeout(w.current),w.current=0,N.current=!1,_(!0)},[_]),A=p.useCallback(()=>{window.clearTimeout(w.current),w.current=0,_(!1)},[_]),R=p.useCallback(()=>{window.clearTimeout(w.current),w.current=window.setTimeout(()=>{N.current=!0,_(!0),w.current=0},j)},[j,_]);return p.useEffect(()=>()=>{w.current&&(window.clearTimeout(w.current),w.current=0)},[]),i.jsx(nm,{...m,children:i.jsx(C7,{scope:t,contentId:y,open:C,stateAttribute:E,trigger:v,onTriggerChange:g,onTriggerEnter:p.useCallback(()=>{h.isOpenDelayedRef.current?R():M()},[h.isOpenDelayedRef,R,M]),onTriggerLeave:p.useCallback(()=>{S?A():(window.clearTimeout(w.current),w.current=0)},[A,S]),onOpen:M,onClose:A,disableHoverableContent:S,children:n})})};E2.displayName=ju;var gx="TooltipTrigger",T2=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Gu(gx,n),l=Gy(gx,n),u=om(n),d=p.useRef(null),h=Ge(t,d,o.onTriggerChange),m=p.useRef(!1),v=p.useRef(!1),g=p.useCallback(()=>m.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),i.jsx(Wu,{asChild:!0,...u,children:i.jsx(ze.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:h,onPointerMove:Se(e.onPointerMove,y=>{y.pointerType!=="touch"&&!v.current&&!l.isPointerInTransitRef.current&&(o.onTriggerEnter(),v.current=!0)}),onPointerLeave:Se(e.onPointerLeave,()=>{o.onTriggerLeave(),v.current=!1}),onPointerDown:Se(e.onPointerDown,()=>{o.open&&o.onClose(),m.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:Se(e.onFocus,()=>{m.current||o.onOpen()}),onBlur:Se(e.onBlur,o.onClose),onClick:Se(e.onClick,o.onClose)})})});T2.displayName=gx;var Zy="TooltipPortal",[N7,k7]=am(Zy,{forceMount:void 0}),M2=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,l=Gu(Zy,t);return i.jsx(N7,{scope:t,forceMount:n,children:i.jsx(yn,{present:n||l.open,children:i.jsx(Il,{asChild:!0,container:o,children:r})})})};M2.displayName=Zy;var xl="TooltipContent",R2=p.forwardRef((e,t)=>{const n=k7(xl,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...l}=e,u=Gu(xl,e.__scopeTooltip);return i.jsx(yn,{present:r||u.open,children:u.disableHoverableContent?i.jsx(A2,{side:o,...l,ref:t}):i.jsx(_7,{side:o,...l,ref:t})})}),_7=p.forwardRef((e,t)=>{const n=Gu(xl,e.__scopeTooltip),r=Gy(xl,e.__scopeTooltip),o=p.useRef(null),l=Ge(t,o),[u,d]=p.useState(null),{trigger:h,onClose:m}=n,v=o.current,{onPointerInTransitChange:g}=r,y=p.useCallback(()=>{d(null),g(!1)},[g]),w=p.useCallback((S,j)=>{const N=S.currentTarget,C={x:S.clientX,y:S.clientY},_=R7(C,N.getBoundingClientRect()),E=A7(C,_),M=O7(j.getBoundingClientRect()),A=z7([...E,...M]);d(A),g(!0)},[g]);return p.useEffect(()=>()=>y(),[y]),p.useEffect(()=>{if(h&&v){const S=N=>w(N,v),j=N=>w(N,h);return h.addEventListener("pointerleave",S),v.addEventListener("pointerleave",j),()=>{h.removeEventListener("pointerleave",S),v.removeEventListener("pointerleave",j)}}},[h,v,w,y]),p.useEffect(()=>{if(u){const S=j=>{const N=j.target,C={x:j.clientX,y:j.clientY},_=h?.contains(N)||v?.contains(N),E=!D7(C,u);_?y():E&&(y(),m())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[h,v,u,m,y]),i.jsx(A2,{...e,ref:l})}),[E7,T7]=am(ju,{isInside:!1}),M7=r_("TooltipContent"),A2=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:l,onPointerDownOutside:u,...d}=e,h=Gu(xl,n),m=om(n),{onClose:v}=h;return p.useEffect(()=>(document.addEventListener(px,v),()=>document.removeEventListener(px,v)),[v]),p.useEffect(()=>{if(h.trigger){const g=y=>{y.target?.contains(h.trigger)&&v()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[h.trigger,v]),i.jsx(Ll,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:g=>g.preventDefault(),onDismiss:v,children:i.jsxs(rm,{"data-state":h.stateAttribute,...m,...d,ref:t,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[i.jsx(M7,{children:r}),i.jsx(E7,{scope:n,isInside:!0,children:i.jsx(w7,{id:h.contentId,role:"tooltip",children:o||r})})]})})});R2.displayName=xl;var O2="TooltipArrow",D2=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=om(n);return T7(O2,n).isInside?null:i.jsx(sm,{...o,...r,ref:t})});D2.displayName=O2;function R7(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,r,o,l)){case l:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function A7(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function O7(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function D7(e,t){const{x:n,y:r}=e;let o=!1;for(let l=0,u=t.length-1;l<t.length;u=l++){const d=t[l],h=t[u],m=d.x,v=d.y,g=h.x,y=h.y;v>r!=y>r&&n<(g-m)*(r-v)/(y-v)+m&&(o=!o)}return o}function z7(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),P7(t)}function P7(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const l=t[t.length-1],u=t[t.length-2];if((l.x-u.x)*(o.y-u.y)>=(l.y-u.y)*(o.x-u.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const l=n[n.length-1],u=n[n.length-2];if((l.x-u.x)*(o.y-u.y)>=(l.y-u.y)*(o.x-u.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var L7=_2,I7=E2,$7=T2,F7=M2,B7=R2,U7=D2;function z2({delayDuration:e=0,...t}){return i.jsx(L7,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function q7({...e}){return i.jsx(z2,{children:i.jsx(I7,{"data-slot":"tooltip",...e})})}function V7({...e}){return i.jsx($7,{"data-slot":"tooltip-trigger",...e})}function H7({className:e,sideOffset:t=0,children:n,...r}){return i.jsx(F7,{children:i.jsxs(B7,{"data-slot":"tooltip-content",sideOffset:t,className:W("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,i.jsx(U7,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const Y7="sidebar_state",W7=3600*24*7,G7="16rem",Z7="18rem",Q7="3rem",K7="b",P2=p.createContext(null);function im(){const e=p.useContext(P2);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function X7({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:o,children:l,...u}){const d=O8(),[h,m]=p.useState(!1),[v,g]=p.useState(e),y=t??v,w=p.useCallback(C=>{const _=typeof C=="function"?C(y):C;n?n(_):g(_),document.cookie=`${Y7}=${_}; path=/; max-age=${W7}`},[n,y]),S=p.useCallback(()=>d?m(C=>!C):w(C=>!C),[d,w,m]);p.useEffect(()=>{const C=_=>{_.key===K7&&(_.metaKey||_.ctrlKey)&&(_.preventDefault(),S())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[S]);const j=y?"expanded":"collapsed",N=p.useMemo(()=>({state:j,open:y,setOpen:w,isMobile:d,openMobile:h,setOpenMobile:m,toggleSidebar:S}),[j,y,w,d,h,m,S]);return i.jsx(P2.Provider,{value:N,children:i.jsx(z2,{delayDuration:0,children:i.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":G7,"--sidebar-width-icon":Q7,...o},className:W("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",r),...u,children:l})})})}function J7({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:o,...l}){const{isMobile:u,state:d,openMobile:h,setOpenMobile:m}=im();return n==="none"?i.jsx("div",{"data-slot":"sidebar",className:W("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",r),...l,children:o}):u?i.jsx(e2,{open:h,onOpenChange:m,...l,children:i.jsxs(t2,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":Z7},side:e,children:[i.jsxs(JU,{className:"sr-only",children:[i.jsx(n2,{children:"Sidebar"}),i.jsx(e9,{children:"Displays the mobile sidebar."})]}),i.jsx("div",{className:"flex h-full w-full flex-col",children:o})]})}):i.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":d,"data-collapsible":d==="collapsed"?n:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[i.jsx("div",{"data-slot":"sidebar-gap",className:W("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),i.jsx("div",{"data-slot":"sidebar-container",className:W("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...l,children:i.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:o})})]})}function eq({className:e,onClick:t,...n}){const{toggleSidebar:r}=im();return i.jsxs(Je,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:W("size-7",e),onClick:o=>{t?.(o),r()},...n,children:[i.jsx(g5,{}),i.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function tq({className:e,...t}){return i.jsx("main",{"data-slot":"sidebar-inset",className:W("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",e),...t})}function nq({className:e,...t}){return i.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:W("flex flex-col gap-2 p-2",e),...t})}function rq({className:e,...t}){return i.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:W("flex flex-col gap-2 p-2",e),...t})}function sq({className:e,...t}){return i.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:W("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function SC({className:e,...t}){return i.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:W("relative flex w-full min-w-0 flex-col p-2",e),...t})}function jC({className:e,asChild:t=!1,...n}){const r=t?Pl:"div";return i.jsx(r,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:W("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...n})}function CC({className:e,...t}){return i.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:W("flex w-full min-w-0 flex-col gap-1",e),...t})}function NC({className:e,...t}){return i.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:W("group/menu-item relative",e),...t})}const aq=Ko("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function kC({asChild:e=!1,isActive:t=!1,variant:n="default",size:r="default",tooltip:o,className:l,...u}){const d=e?Pl:"button",{isMobile:h,state:m}=im(),v=i.jsx(d,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":r,"data-active":t,className:W(aq({variant:n,size:r}),l),...u});return o?(typeof o=="string"&&(o={children:o}),i.jsxs(q7,{children:[i.jsx(V7,{asChild:!0,children:v}),i.jsx(H7,{side:"right",align:"center",hidden:m!=="collapsed"||h,...o})]})):v}function oq({className:e,...t}){return i.jsx("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:W("border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...t})}function Nv({className:e,...t}){return i.jsx("li",{"data-slot":"sidebar-menu-sub-item","data-sidebar":"menu-sub-item",className:W("group/menu-sub-item relative",e),...t})}function kv({asChild:e=!1,size:t="md",isActive:n=!1,className:r,...o}){const l=e?Pl:"a";return i.jsx(l,{"data-slot":"sidebar-menu-sub-button","data-sidebar":"menu-sub-button","data-size":t,"data-active":n,className:W("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",r),...o})}function yl({...e}){return i.jsx(Uu,{"data-slot":"dialog",...e})}function iq({...e}){return i.jsx(qu,{"data-slot":"dialog-portal",...e})}function lq({className:e,...t}){return i.jsx(Vu,{"data-slot":"dialog-overlay",className:W("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function bl({className:e,children:t,showCloseButton:n=!0,...r}){return i.jsxs(iq,{"data-slot":"dialog-portal",children:[i.jsx(lq,{}),i.jsxs(Hu,{"data-slot":"dialog-content",className:W("bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg",e),...r,children:[t,n&&i.jsxs(Kh,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[i.jsx(At,{}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Cu({className:e,...t}){return i.jsx("div",{"data-slot":"dialog-header",className:W("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Nu({className:e,...t}){return i.jsx("div",{"data-slot":"dialog-footer",className:W("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function wl({className:e,...t}){return i.jsx(Qh,{"data-slot":"dialog-title",className:W("text-lg leading-none font-semibold",e),...t})}function cq({className:e,...t}){return i.jsx(Iy,{"data-slot":"dialog-description",className:W("text-muted-foreground text-sm",e),...t})}function es({className:e,...t}){return i.jsx(vu,{role:"status","aria-label":"Loading",className:W("size-4 animate-spin",e),...t})}const _C={fast:"duration-100 ease-out"},uq={primary:"default",secondary:"secondary",danger:"destructive",ghost:"ghost",outline:"outline",link:"link",success:"default",warning:"default"},dq={success:"bg-success text-success-foreground hover:bg-success/90 focus-visible:ring-success",warning:"bg-warning text-warning-foreground hover:bg-warning/90 focus-visible:ring-warning"};function me({variant:e="primary",loading:t,disabled:n,children:r,className:o,asChild:l,...u}){const d=uq[e],h=dq[e];return l?i.jsx(Je,{variant:d,disabled:n||t,className:W(_C.fast,h,o),asChild:!0,...u,children:r}):i.jsxs(Je,{variant:d,disabled:n||t,className:W(_C.fast,h,o),...u,children:[t&&i.jsx(es,{"data-icon":"inline-start"}),r]})}const fq={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl"};function ls({open:e,onOpenChange:t,title:n,description:r,children:o,footer:l,size:u="md",className:d}){return i.jsx(yl,{open:e,onOpenChange:t,children:i.jsxs(bl,{className:W("flex max-h-[85vh] flex-col overflow-hidden",fq[u],d),children:[i.jsxs(Cu,{className:"shrink-0",children:[i.jsx(wl,{children:n}),r&&i.jsx(cq,{children:r})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-4 [&::-webkit-scrollbar]:hidden",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:o}),l&&i.jsx(Nu,{className:"shrink-0 border-t pt-4",children:l})]})})}function oa({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o="Confirm",cancelLabel:l="Cancel",onConfirm:u,onCancel:d,variant:h="default",loading:m,isLoading:v,error:g}){const y=m??v??!1,w=()=>{d?.(),t(!1)},S=()=>{u()},j=()=>h==="danger"?"danger":h==="warning"?"warning":"primary";return i.jsx(ls,{open:e,onOpenChange:t,title:n,size:"sm",footer:i.jsxs(i.Fragment,{children:[i.jsx(me,{variant:"outline",onClick:w,disabled:y,children:l}),i.jsx(me,{variant:j(),onClick:S,loading:y,children:o})]}),children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:r}),g&&i.jsx("p",{className:"text-sm text-destructive",children:g})]})})}var hq="Label",L2=p.forwardRef((e,t)=>i.jsx(sr.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));L2.displayName=hq;var mq=L2;function rt({className:e,...t}){return i.jsx(mq,{"data-slot":"label",className:W("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function no({className:e,...t}){return i.jsx("textarea",{"data-slot":"textarea",className:W("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}function Qy(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var lm="Checkbox",[pq]=Dn(lm),[gq,Ky]=pq(lm);function vq(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:l,form:u,name:d,onCheckedChange:h,required:m,value:v="on",internal_do_not_use_render:g}=e,[y,w]=nr({prop:n,defaultProp:o??!1,onChange:h,caller:lm}),[S,j]=p.useState(null),[N,C]=p.useState(null),_=p.useRef(!1),E=S?!!u||!!S.closest("form"):!0,M={checked:y,disabled:l,setChecked:w,control:S,setControl:j,name:d,form:u,value:v,hasConsumerStoppedPropagationRef:_,required:m,defaultChecked:Ya(o)?!1:o,isFormControl:E,bubbleInput:N,setBubbleInput:C};return i.jsx(gq,{scope:t,...M,children:xq(g)?g(M):r})}var I2="CheckboxTrigger",$2=p.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:l,value:u,disabled:d,checked:h,required:m,setControl:v,setChecked:g,hasConsumerStoppedPropagationRef:y,isFormControl:w,bubbleInput:S}=Ky(I2,e),j=Ge(o,v),N=p.useRef(h);return p.useEffect(()=>{const C=l?.form;if(C){const _=()=>g(N.current);return C.addEventListener("reset",_),()=>C.removeEventListener("reset",_)}},[l,g]),i.jsx(ze.button,{type:"button",role:"checkbox","aria-checked":Ya(h)?"mixed":h,"aria-required":m,"data-state":H2(h),"data-disabled":d?"":void 0,disabled:d,value:u,...r,ref:j,onKeyDown:Se(t,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:Se(n,C=>{g(_=>Ya(_)?!0:!_),S&&w&&(y.current=C.isPropagationStopped(),y.current||C.stopPropagation())})})});$2.displayName=I2;var F2=p.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:l,required:u,disabled:d,value:h,onCheckedChange:m,form:v,...g}=e;return i.jsx(vq,{__scopeCheckbox:n,checked:o,defaultChecked:l,disabled:d,required:u,onCheckedChange:m,name:r,form:v,value:h,internal_do_not_use_render:({isFormControl:y})=>i.jsxs(i.Fragment,{children:[i.jsx($2,{...g,ref:t,__scopeCheckbox:n}),y&&i.jsx(V2,{__scopeCheckbox:n})]})})});F2.displayName=lm;var B2="CheckboxIndicator",U2=p.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,l=Ky(B2,n);return i.jsx(yn,{present:r||Ya(l.checked)||l.checked===!0,children:i.jsx(ze.span,{"data-state":H2(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});U2.displayName=B2;var q2="CheckboxBubbleInput",V2=p.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:l,defaultChecked:u,required:d,disabled:h,name:m,value:v,form:g,bubbleInput:y,setBubbleInput:w}=Ky(q2,e),S=Ge(n,w),j=Qy(l),N=Hy(r);p.useEffect(()=>{const _=y;if(!_)return;const E=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(E,"checked").set,R=!o.current;if(j!==l&&A){const T=new Event("click",{bubbles:R});_.indeterminate=Ya(l),A.call(_,Ya(l)?!1:l),_.dispatchEvent(T)}},[y,j,l,o]);const C=p.useRef(Ya(l)?!1:l);return i.jsx(ze.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??C.current,required:d,disabled:h,name:m,value:v,form:g,...t,tabIndex:-1,ref:S,style:{...t.style,...N,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});V2.displayName=q2;function xq(e){return typeof e=="function"}function Ya(e){return e==="indeterminate"}function H2(e){return Ya(e)?"indeterminate":e?"checked":"unchecked"}function wr({className:e,...t}){return i.jsx(F2,{"data-slot":"checkbox",className:W("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:i.jsx(U2,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:i.jsx(Ms,{className:"size-3.5"})})})}function vx(e,[t,n]){return Math.min(n,Math.max(t,e))}function Xy(e){const t=e+"CollectionProvider",[n,r]=Dn(t),[o,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),u=j=>{const{scope:N,children:C}=j,_=ee.useRef(null),E=ee.useRef(new Map).current;return i.jsx(o,{scope:N,itemMap:E,collectionRef:_,children:C})};u.displayName=t;const d=e+"CollectionSlot",h=Bo(d),m=ee.forwardRef((j,N)=>{const{scope:C,children:_}=j,E=l(d,C),M=Ge(N,E.collectionRef);return i.jsx(h,{ref:M,children:_})});m.displayName=d;const v=e+"CollectionItemSlot",g="data-radix-collection-item",y=Bo(v),w=ee.forwardRef((j,N)=>{const{scope:C,children:_,...E}=j,M=ee.useRef(null),A=Ge(N,M),R=l(v,C);return ee.useEffect(()=>(R.itemMap.set(M,{ref:M,...E}),()=>{R.itemMap.delete(M)})),i.jsx(y,{[g]:"",ref:A,children:_})});w.displayName=v;function S(j){const N=l(e+"CollectionConsumer",j);return ee.useCallback(()=>{const _=N.collectionRef.current;if(!_)return[];const E=Array.from(_.querySelectorAll(`[${g}]`));return Array.from(N.itemMap.values()).sort((R,T)=>E.indexOf(R.ref.current)-E.indexOf(T.ref.current))},[N.collectionRef,N.itemMap])}return[{Provider:u,Slot:m,ItemSlot:w},S,r]}var yq=p.createContext(void 0);function Bl(e){const t=p.useContext(yq);return e||t||"ltr"}var bq=[" ","Enter","ArrowUp","ArrowDown"],wq=[" ","Enter"],Vo="Select",[cm,um,Sq]=Xy(Vo),[Ul]=Dn(Vo,[Sq,to]),dm=to(),[jq,ro]=Ul(Vo),[Cq,Nq]=Ul(Vo),Y2=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:l,value:u,defaultValue:d,onValueChange:h,dir:m,name:v,autoComplete:g,disabled:y,required:w,form:S}=e,j=dm(t),[N,C]=p.useState(null),[_,E]=p.useState(null),[M,A]=p.useState(!1),R=Bl(m),[T,O]=nr({prop:r,defaultProp:o??!1,onChange:l,caller:Vo}),[D,z]=nr({prop:u,defaultProp:d,onChange:h,caller:Vo}),B=p.useRef(null),V=N?S||!!N.closest("form"):!0,[Y,G]=p.useState(new Set),ae=Array.from(Y).map(L=>L.props.value).join(";");return i.jsx(nm,{...j,children:i.jsxs(jq,{required:w,scope:t,trigger:N,onTriggerChange:C,valueNode:_,onValueNodeChange:E,valueNodeHasChildren:M,onValueNodeHasChildrenChange:A,contentId:gn(),value:D,onValueChange:z,open:T,onOpenChange:O,dir:R,triggerPointerDownPosRef:B,disabled:y,children:[i.jsx(cm.Provider,{scope:t,children:i.jsx(Cq,{scope:e.__scopeSelect,onNativeOptionAdd:p.useCallback(L=>{G($=>new Set($).add(L))},[]),onNativeOptionRemove:p.useCallback(L=>{G($=>{const U=new Set($);return U.delete(L),U})},[]),children:n})}),V?i.jsxs(pE,{"aria-hidden":!0,required:w,tabIndex:-1,name:v,autoComplete:g,value:D,onChange:L=>z(L.target.value),disabled:y,form:S,children:[D===void 0?i.jsx("option",{value:""}):null,Array.from(Y)]},ae):null]})})};Y2.displayName=Vo;var W2="SelectTrigger",G2=p.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,l=dm(n),u=ro(W2,n),d=u.disabled||r,h=Ge(t,u.onTriggerChange),m=um(n),v=p.useRef("touch"),[g,y,w]=vE(j=>{const N=m().filter(E=>!E.disabled),C=N.find(E=>E.value===u.value),_=xE(N,j,C);_!==void 0&&u.onValueChange(_.value)}),S=j=>{d||(u.onOpenChange(!0),w()),j&&(u.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return i.jsx(Wu,{asChild:!0,...l,children:i.jsx(ze.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":gE(u.value)?"":void 0,...o,ref:h,onClick:Se(o.onClick,j=>{j.currentTarget.focus(),v.current!=="mouse"&&S(j)}),onPointerDown:Se(o.onPointerDown,j=>{v.current=j.pointerType;const N=j.target;N.hasPointerCapture(j.pointerId)&&N.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(S(j),j.preventDefault())}),onKeyDown:Se(o.onKeyDown,j=>{const N=g.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&y(j.key),!(N&&j.key===" ")&&bq.includes(j.key)&&(S(),j.preventDefault())})})})});G2.displayName=W2;var Z2="SelectValue",Q2=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:l,placeholder:u="",...d}=e,h=ro(Z2,n),{onValueNodeHasChildrenChange:m}=h,v=l!==void 0,g=Ge(t,h.onValueNodeChange);return Jt(()=>{m(v)},[m,v]),i.jsx(ze.span,{...d,ref:g,style:{pointerEvents:"none"},children:gE(h.value)?i.jsx(i.Fragment,{children:u}):l})});Q2.displayName=Z2;var kq="SelectIcon",K2=p.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return i.jsx(ze.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});K2.displayName=kq;var _q="SelectPortal",X2=e=>i.jsx(Il,{asChild:!0,...e});X2.displayName=_q;var Ho="SelectContent",J2=p.forwardRef((e,t)=>{const n=ro(Ho,e.__scopeSelect),[r,o]=p.useState();if(Jt(()=>{o(new DocumentFragment)},[]),!n.open){const l=r;return l?Ml.createPortal(i.jsx(eE,{scope:e.__scopeSelect,children:i.jsx(cm.Slot,{scope:e.__scopeSelect,children:i.jsx("div",{children:e.children})})}),l):null}return i.jsx(tE,{...e,ref:t})});J2.displayName=Ho;var Xr=10,[eE,so]=Ul(Ho),Eq="SelectContentImpl",Tq=Bo("SelectContent.RemoveScroll"),tE=p.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:l,onPointerDownOutside:u,side:d,sideOffset:h,align:m,alignOffset:v,arrowPadding:g,collisionBoundary:y,collisionPadding:w,sticky:S,hideWhenDetached:j,avoidCollisions:N,...C}=e,_=ro(Ho,n),[E,M]=p.useState(null),[A,R]=p.useState(null),T=Ge(t,te=>M(te)),[O,D]=p.useState(null),[z,B]=p.useState(null),V=um(n),[Y,G]=p.useState(!1),ae=p.useRef(!1);p.useEffect(()=>{if(E)return Gh(E)},[E]),Yh();const L=p.useCallback(te=>{const[ye,...Ce]=V().map(ge=>ge.ref.current),[_e]=Ce.slice(-1),Re=document.activeElement;for(const ge of te)if(ge===Re||(ge?.scrollIntoView({block:"nearest"}),ge===ye&&A&&(A.scrollTop=0),ge===_e&&A&&(A.scrollTop=A.scrollHeight),ge?.focus(),document.activeElement!==Re))return},[V,A]),$=p.useCallback(()=>L([O,E]),[L,O,E]);p.useEffect(()=>{Y&&$()},[Y,$]);const{onOpenChange:U,triggerPointerDownPosRef:H}=_;p.useEffect(()=>{if(E){let te={x:0,y:0};const ye=_e=>{te={x:Math.abs(Math.round(_e.pageX)-(H.current?.x??0)),y:Math.abs(Math.round(_e.pageY)-(H.current?.y??0))}},Ce=_e=>{te.x<=10&&te.y<=10?_e.preventDefault():E.contains(_e.target)||U(!1),document.removeEventListener("pointermove",ye),H.current=null};return H.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",Ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",Ce,{capture:!0})}}},[E,U,H]),p.useEffect(()=>{const te=()=>U(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[U]);const[le,I]=vE(te=>{const ye=V().filter(Re=>!Re.disabled),Ce=ye.find(Re=>Re.ref.current===document.activeElement),_e=xE(ye,te,Ce);_e&&setTimeout(()=>_e.ref.current.focus())}),F=p.useCallback((te,ye,Ce)=>{const _e=!ae.current&&!Ce;(_.value!==void 0&&_.value===ye||_e)&&(D(te),_e&&(ae.current=!0))},[_.value]),K=p.useCallback(()=>E?.focus(),[E]),ne=p.useCallback((te,ye,Ce)=>{const _e=!ae.current&&!Ce;(_.value!==void 0&&_.value===ye||_e)&&B(te)},[_.value]),X=r==="popper"?xx:nE,ue=X===xx?{side:d,sideOffset:h,align:m,alignOffset:v,arrowPadding:g,collisionBoundary:y,collisionPadding:w,sticky:S,hideWhenDetached:j,avoidCollisions:N}:{};return i.jsx(eE,{scope:n,content:E,viewport:A,onViewportChange:R,itemRefCallback:F,selectedItem:O,onItemLeave:K,itemTextRefCallback:ne,focusSelectedItem:$,selectedItemText:z,position:r,isPositioned:Y,searchRef:le,children:i.jsx(Bu,{as:Tq,allowPinchZoom:!0,children:i.jsx(Fu,{asChild:!0,trapped:_.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:Se(o,te=>{_.trigger?.focus({preventScroll:!0}),te.preventDefault()}),children:i.jsx(Ll,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:i.jsx(X,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:te=>te.preventDefault(),...C,...ue,onPlaced:()=>G(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:Se(C.onKeyDown,te=>{const ye=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!ye&&te.key.length===1&&I(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let _e=V().filter(Re=>!Re.disabled).map(Re=>Re.ref.current);if(["ArrowUp","End"].includes(te.key)&&(_e=_e.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const Re=te.target,ge=_e.indexOf(Re);_e=_e.slice(ge+1)}setTimeout(()=>L(_e)),te.preventDefault()}})})})})})})});tE.displayName=Eq;var Mq="SelectItemAlignedPosition",nE=p.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,l=ro(Ho,n),u=so(Ho,n),[d,h]=p.useState(null),[m,v]=p.useState(null),g=Ge(t,T=>v(T)),y=um(n),w=p.useRef(!1),S=p.useRef(!0),{viewport:j,selectedItem:N,selectedItemText:C,focusSelectedItem:_}=u,E=p.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&m&&j&&N&&C){const T=l.trigger.getBoundingClientRect(),O=m.getBoundingClientRect(),D=l.valueNode.getBoundingClientRect(),z=C.getBoundingClientRect();if(l.dir!=="rtl"){const Re=z.left-O.left,ge=D.left-Re,Fe=T.left-ge,be=T.width+Fe,Be=Math.max(be,O.width),nt=window.innerWidth-Xr,ot=vx(ge,[Xr,Math.max(Xr,nt-Be)]);d.style.minWidth=be+"px",d.style.left=ot+"px"}else{const Re=O.right-z.right,ge=window.innerWidth-D.right-Re,Fe=window.innerWidth-T.right-ge,be=T.width+Fe,Be=Math.max(be,O.width),nt=window.innerWidth-Xr,ot=vx(ge,[Xr,Math.max(Xr,nt-Be)]);d.style.minWidth=be+"px",d.style.right=ot+"px"}const B=y(),V=window.innerHeight-Xr*2,Y=j.scrollHeight,G=window.getComputedStyle(m),ae=parseInt(G.borderTopWidth,10),L=parseInt(G.paddingTop,10),$=parseInt(G.borderBottomWidth,10),U=parseInt(G.paddingBottom,10),H=ae+L+Y+U+$,le=Math.min(N.offsetHeight*5,H),I=window.getComputedStyle(j),F=parseInt(I.paddingTop,10),K=parseInt(I.paddingBottom,10),ne=T.top+T.height/2-Xr,X=V-ne,ue=N.offsetHeight/2,te=N.offsetTop+ue,ye=ae+L+te,Ce=H-ye;if(ye<=ne){const Re=B.length>0&&N===B[B.length-1].ref.current;d.style.bottom="0px";const ge=m.clientHeight-j.offsetTop-j.offsetHeight,Fe=Math.max(X,ue+(Re?K:0)+ge+$),be=ye+Fe;d.style.height=be+"px"}else{const Re=B.length>0&&N===B[0].ref.current;d.style.top="0px";const Fe=Math.max(ne,ae+j.offsetTop+(Re?F:0)+ue)+Ce;d.style.height=Fe+"px",j.scrollTop=ye-ne+j.offsetTop}d.style.margin=`${Xr}px 0`,d.style.minHeight=le+"px",d.style.maxHeight=V+"px",r?.(),requestAnimationFrame(()=>w.current=!0)}},[y,l.trigger,l.valueNode,d,m,j,N,C,l.dir,r]);Jt(()=>E(),[E]);const[M,A]=p.useState();Jt(()=>{m&&A(window.getComputedStyle(m).zIndex)},[m]);const R=p.useCallback(T=>{T&&S.current===!0&&(E(),_?.(),S.current=!1)},[E,_]);return i.jsx(Aq,{scope:n,contentWrapper:d,shouldExpandOnScrollRef:w,onScrollButtonChange:R,children:i.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:M},children:i.jsx(ze.div,{...o,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});nE.displayName=Mq;var Rq="SelectPopperPosition",xx=p.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Xr,...l}=e,u=dm(n);return i.jsx(rm,{...u,...l,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});xx.displayName=Rq;var[Aq,Jy]=Ul(Ho,{}),yx="SelectViewport",rE=p.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,l=so(yx,n),u=Jy(yx,n),d=Ge(t,l.onViewportChange),h=p.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),i.jsx(cm.Slot,{scope:n,children:i.jsx(ze.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Se(o.onScroll,m=>{const v=m.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:y}=u;if(y?.current&&g){const w=Math.abs(h.current-v.scrollTop);if(w>0){const S=window.innerHeight-Xr*2,j=parseFloat(g.style.minHeight),N=parseFloat(g.style.height),C=Math.max(j,N);if(C<S){const _=C+w,E=Math.min(S,_),M=_-E;g.style.height=E+"px",g.style.bottom==="0px"&&(v.scrollTop=M>0?M:0,g.style.justifyContent="flex-end")}}}h.current=v.scrollTop})})})]})});rE.displayName=yx;var sE="SelectGroup",[Oq,Dq]=Ul(sE),aE=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=gn();return i.jsx(Oq,{scope:n,id:o,children:i.jsx(ze.div,{role:"group","aria-labelledby":o,...r,ref:t})})});aE.displayName=sE;var oE="SelectLabel",zq=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Dq(oE,n);return i.jsx(ze.div,{id:o.id,...r,ref:t})});zq.displayName=oE;var _h="SelectItem",[Pq,iE]=Ul(_h),lE=p.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:l,...u}=e,d=ro(_h,n),h=so(_h,n),m=d.value===r,[v,g]=p.useState(l??""),[y,w]=p.useState(!1),S=Ge(t,_=>h.itemRefCallback?.(_,r,o)),j=gn(),N=p.useRef("touch"),C=()=>{o||(d.onValueChange(r),d.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return i.jsx(Pq,{scope:n,value:r,disabled:o,textId:j,isSelected:m,onItemTextChange:p.useCallback(_=>{g(E=>E||(_?.textContent??"").trim())},[]),children:i.jsx(cm.ItemSlot,{scope:n,value:r,disabled:o,textValue:v,children:i.jsx(ze.div,{role:"option","aria-labelledby":j,"data-highlighted":y?"":void 0,"aria-selected":m&&y,"data-state":m?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...u,ref:S,onFocus:Se(u.onFocus,()=>w(!0)),onBlur:Se(u.onBlur,()=>w(!1)),onClick:Se(u.onClick,()=>{N.current!=="mouse"&&C()}),onPointerUp:Se(u.onPointerUp,()=>{N.current==="mouse"&&C()}),onPointerDown:Se(u.onPointerDown,_=>{N.current=_.pointerType}),onPointerMove:Se(u.onPointerMove,_=>{N.current=_.pointerType,o?h.onItemLeave?.():N.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Se(u.onPointerLeave,_=>{_.currentTarget===document.activeElement&&h.onItemLeave?.()}),onKeyDown:Se(u.onKeyDown,_=>{h.searchRef?.current!==""&&_.key===" "||(wq.includes(_.key)&&C(),_.key===" "&&_.preventDefault())})})})})});lE.displayName=_h;var Kc="SelectItemText",cE=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...l}=e,u=ro(Kc,n),d=so(Kc,n),h=iE(Kc,n),m=Nq(Kc,n),[v,g]=p.useState(null),y=Ge(t,C=>g(C),h.onItemTextChange,C=>d.itemTextRefCallback?.(C,h.value,h.disabled)),w=v?.textContent,S=p.useMemo(()=>i.jsx("option",{value:h.value,disabled:h.disabled,children:w},h.value),[h.disabled,h.value,w]),{onNativeOptionAdd:j,onNativeOptionRemove:N}=m;return Jt(()=>(j(S),()=>N(S)),[j,N,S]),i.jsxs(i.Fragment,{children:[i.jsx(ze.span,{id:h.textId,...l,ref:y}),h.isSelected&&u.valueNode&&!u.valueNodeHasChildren?Ml.createPortal(l.children,u.valueNode):null]})});cE.displayName=Kc;var uE="SelectItemIndicator",dE=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return iE(uE,n).isSelected?i.jsx(ze.span,{"aria-hidden":!0,...r,ref:t}):null});dE.displayName=uE;var bx="SelectScrollUpButton",fE=p.forwardRef((e,t)=>{const n=so(bx,e.__scopeSelect),r=Jy(bx,e.__scopeSelect),[o,l]=p.useState(!1),u=Ge(t,r.onScrollButtonChange);return Jt(()=>{if(n.viewport&&n.isPositioned){let d=function(){const m=h.scrollTop>0;l(m)};const h=n.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),o?i.jsx(mE,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=n;d&&h&&(d.scrollTop=d.scrollTop-h.offsetHeight)}}):null});fE.displayName=bx;var wx="SelectScrollDownButton",hE=p.forwardRef((e,t)=>{const n=so(wx,e.__scopeSelect),r=Jy(wx,e.__scopeSelect),[o,l]=p.useState(!1),u=Ge(t,r.onScrollButtonChange);return Jt(()=>{if(n.viewport&&n.isPositioned){let d=function(){const m=h.scrollHeight-h.clientHeight,v=Math.ceil(h.scrollTop)<m;l(v)};const h=n.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),o?i.jsx(mE,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=n;d&&h&&(d.scrollTop=d.scrollTop+h.offsetHeight)}}):null});hE.displayName=wx;var mE=p.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,l=so("SelectScrollButton",n),u=p.useRef(null),d=um(n),h=p.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return p.useEffect(()=>()=>h(),[h]),Jt(()=>{d().find(v=>v.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[d]),i.jsx(ze.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Se(o.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(r,50))}),onPointerMove:Se(o.onPointerMove,()=>{l.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(r,50))}),onPointerLeave:Se(o.onPointerLeave,()=>{h()})})}),Lq="SelectSeparator",Iq=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return i.jsx(ze.div,{"aria-hidden":!0,...r,ref:t})});Iq.displayName=Lq;var Sx="SelectArrow",$q=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=dm(n),l=ro(Sx,n),u=so(Sx,n);return l.open&&u.position==="popper"?i.jsx(sm,{...o,...r,ref:t}):null});$q.displayName=Sx;var Fq="SelectBubbleInput",pE=p.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=p.useRef(null),l=Ge(r,o),u=Qy(t);return p.useEffect(()=>{const d=o.current;if(!d)return;const h=window.HTMLSelectElement.prototype,v=Object.getOwnPropertyDescriptor(h,"value").set;if(u!==t&&v){const g=new Event("change",{bubbles:!0});v.call(d,t),d.dispatchEvent(g)}},[u,t]),i.jsx(ze.select,{...n,style:{...C2,...n.style},ref:l,defaultValue:t})});pE.displayName=Fq;function gE(e){return e===""||e===void 0}function vE(e){const t=Nn(e),n=p.useRef(""),r=p.useRef(0),o=p.useCallback(u=>{const d=n.current+u;t(d),(function h(m){n.current=m,window.clearTimeout(r.current),m!==""&&(r.current=window.setTimeout(()=>h(""),1e3))})(d)},[t]),l=p.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,l]}function xE(e,t,n){const o=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let u=Bq(e,Math.max(l,0));o.length===1&&(u=u.filter(m=>m!==n));const h=u.find(m=>m.textValue.toLowerCase().startsWith(o.toLowerCase()));return h!==n?h:void 0}function Bq(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Uq=Y2,qq=G2,Vq=Q2,Hq=K2,Yq=X2,Wq=J2,Gq=rE,Zq=aE,Qq=lE,Kq=cE,Xq=dE,Jq=fE,eV=hE;function ia({...e}){return i.jsx(Uq,{"data-slot":"select",...e})}function yE({...e}){return i.jsx(Zq,{"data-slot":"select-group",...e})}function la({...e}){return i.jsx(Vq,{"data-slot":"select-value",...e})}function ca({className:e,size:t="default",children:n,...r}){return i.jsxs(qq,{"data-slot":"select-trigger","data-size":t,className:W("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,i.jsx(Hq,{asChild:!0,children:i.jsx(vn,{className:"size-4 opacity-50"})})]})}function ua({className:e,children:t,position:n="item-aligned",align:r="center",...o}){return i.jsx(Yq,{children:i.jsxs(Wq,{"data-slot":"select-content",className:W("bg-popover text-popover-foreground 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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,align:r,...o,children:[i.jsx(tV,{}),i.jsx(Gq,{className:W("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),i.jsx(nV,{})]})})}function Xt({className:e,children:t,...n}){return i.jsxs(Qq,{"data-slot":"select-item",className:W("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[i.jsx("span",{"data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:i.jsx(Xq,{children:i.jsx(Ms,{className:"size-4"})})}),i.jsx(Kq,{children:t})]})}function tV({className:e,...t}){return i.jsx(Jq,{"data-slot":"select-scroll-up-button",className:W("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(Iu,{className:"size-4"})})}function nV({className:e,...t}){return i.jsx(eV,{"data-slot":"select-scroll-down-button",className:W("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(vn,{className:"size-4"})})}function rV({isOpen:e,onClose:t,breakingChanges:n,onForceUpdate:r,onCancel:o,isLoading:l}){const u=()=>{o(),t()};return i.jsx(ls,{open:e,onOpenChange:d=>!d&&!l&&u(),title:"Breaking Changes Detected",size:"lg",footer:i.jsxs(i.Fragment,{children:[i.jsx(me,{variant:"outline",onClick:u,disabled:l,children:"Cancel"}),i.jsx(me,{variant:"danger",onClick:r,loading:l,children:"Force Update"})]}),children:i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("div",{className:"diff-modified flex items-start gap-3 rounded-lg border p-3",children:[i.jsx(Fo,{className:"mt-0.5 size-5 shrink-0 text-diff-modified"}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("p",{className:"text-sm font-medium text-diff-modified",children:"These changes may affect existing content"}),i.jsx("p",{className:"text-sm text-diff-modified-foreground",children:"The following changes could cause data loss or validation errors for existing entries. Review carefully before proceeding."})]})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("p",{className:"text-sm font-medium text-foreground",children:[n.length," breaking change",n.length!==1?"s":""," detected:"]}),i.jsx("ul",{className:"flex flex-col gap-2",children:n.map((d,h)=>i.jsxs("li",{className:"flex items-start gap-2 rounded-md border bg-muted/30 px-3 py-2 text-sm",children:[i.jsx("span",{className:"mt-0.5 size-1.5 shrink-0 rounded-full bg-warning"}),i.jsx("span",{className:"text-muted-foreground",children:d})]},h))})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:'Click "Force Update" to apply these changes anyway, or "Cancel" to go back and modify your changes.'})]})})}const _v={text:{label:"Text",icon:i.jsx(ny,{className:"size-4"}),description:"Single line text input"},richText:{label:"Rich Text",icon:i.jsx(ch,{className:"size-4"}),description:"Multi-line formatted text"},number:{label:"Number",icon:i.jsx(Qx,{className:"size-4"}),description:"Numeric value"},boolean:{label:"Boolean",icon:i.jsx(ry,{className:"size-4"}),description:"True/false toggle"},date:{label:"Date",icon:i.jsx(pl,{className:"size-4"}),description:"Date picker"},datetime:{label:"Date & Time",icon:i.jsx(pl,{className:"size-4"}),description:"Date and time picker"},reference:{label:"Reference",icon:i.jsx(pu,{className:"size-4"}),description:"Link to another content entry"},media:{label:"Media",icon:i.jsx(ns,{className:"size-4"}),description:"Image, video, or file"},json:{label:"JSON",icon:i.jsx(Vx,{className:"size-4"}),description:"Custom JSON data"},select:{label:"Select",icon:i.jsx(vn,{className:"size-4"}),description:"Dropdown selection"},multiSelect:{label:"Multi-Select",icon:i.jsx(gu,{className:"size-4"}),description:"Multiple selections"},tags:{label:"Tags",icon:i.jsx(Po,{className:"size-4"}),description:"Free-form tag list"},category:{label:"Category",icon:i.jsx(Zx,{className:"size-4"}),description:"Taxonomy category selection"},money:{label:"Money",icon:i.jsx(ik,{className:"size-4"}),description:"Currency amount in minor units"},arrayObject:{label:"Array of Objects",icon:i.jsx(gu,{className:"size-4"}),description:"Repeatable structured items"}};function EC(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s]/g,"").replace(/\s+/g,"_").replace(/^[0-9]/,"_$&").slice(0,64)}function TC(e){return/^[a-z][a-z0-9_]{0,63}$/.test(e)}function bE({isOpen:e,onClose:t,onCreated:n,onUpdated:r,contentType:o}){const l=!!o,u=o?.source==="code",d=u,[h,m]=p.useState(""),[v,g]=p.useState(""),[y,w]=p.useState(!1),[S,j]=p.useState(""),[N,C]=p.useState(!1),[_,E]=p.useState([{name:"title",label:"Title",type:"text",required:!0}]),[M,A]=p.useState("title"),[R,T]=p.useState("title"),[O,D]=p.useState(!1),[z,B]=p.useState(null),[V,Y]=p.useState(null),[G,ae]=p.useState(!1),[L,$]=p.useState([]),[U,H]=p.useState(!1),[le,I]=p.useState(!1),F=xn(),K=et(F.createContentType),ne=et(F.updateContentType);p.useEffect(()=>{o&&e&&(m(o.displayName),g(o.name),w(!0),j(o.description||""),C(o.singleton||!1),E(o.fields),A(o.titleField||""),T(o.slugField||""))},[o,e]);const X=p.useCallback(()=>{m(""),g(""),w(!1),j(""),C(!1),E([{name:"title",label:"Title",type:"text",required:!0}]),A("title"),T("title"),D(!1),B(null),Y(null),ae(!1),$([]),H(!1),I(!1)},[]),ue=p.useCallback(pe=>{m(pe),y||g(EC(pe))},[y]),te=p.useCallback(pe=>{w(!0),g(pe.toLowerCase().replace(/[^a-z0-9_]/g,""))},[]),ye=p.useCallback(()=>{const pe=`field_${_.length+1}`;E(Le=>[...Le,{name:pe,label:`Field ${Le.length+1}`,type:"text",required:!1}]),Y(_.length),ae(!0)},[_.length]),Ce=p.useCallback(pe=>{const Le=_[pe];if(E(Ye=>Ye.filter((Oe,dt)=>dt!==pe)),M===Le.name){const Ye=_.find((Oe,dt)=>dt!==pe&&Oe.type==="text");A(Ye?.name||"")}if(R===Le.name){const Ye=_.find((Oe,dt)=>dt!==pe&&Oe.type==="text");T(Ye?.name||"")}V===pe?(Y(null),ae(!1)):V!==null&&V>pe&&Y(V-1)},[_,V,M,R]),_e=p.useCallback((pe,Le)=>{E(Ye=>Ye.map((Oe,dt)=>dt===pe?{...Oe,...Le}:Oe))},[]),Re=p.useCallback((pe,Le)=>{E(Ye=>{const Oe=[...Ye],[dt]=Oe.splice(pe,1);return Oe.splice(Le,0,dt),Oe}),Y(Le)},[]),ge=p.useMemo(()=>{const pe=[];h.trim()||pe.push("Display name is required"),v.trim()?TC(v)||pe.push("System Name must start with a letter and contain only lowercase letters, numbers, and underscores"):pe.push("System Name is required"),_.length===0&&pe.push("At least one field is required");const Le=_.map(Oe=>Oe.name),Ye=Le.filter((Oe,dt)=>Le.indexOf(Oe)!==dt);Ye.length>0&&pe.push(`Duplicate field names: ${[...new Set(Ye)].join(", ")}`);for(const Oe of _)Oe.name.trim()?/^[a-z][a-z0-9_]{0,63}$/.test(Oe.name)||pe.push(`Field "${Oe.name}" has an invalid name format`):pe.push(`Field "${Oe.label}" has an empty name`),Oe.label.trim()||pe.push(`Field with name "${Oe.name}" has an empty label`),(Oe.type==="select"||Oe.type==="multiSelect")&&(!Oe.options?.options||Oe.options.options.length===0)&&pe.push(`${Oe.type} field "${Oe.label}" requires at least one option`);return pe},[h,v,_]),Fe=p.useMemo(()=>_.filter(pe=>pe.type==="text"),[_]),be=pe=>pe.split(`
93
- `).filter(Ye=>Ye.trim().startsWith("-")).map(Ye=>Ye.trim().substring(2)),Be=p.useCallback(async(pe,Le=!1)=>{if(pe.preventDefault(),ge.length>0){B(ge.join(". "));return}D(!0),B(null);try{if(l&&o){const Ye=await ne({id:o._id,displayName:h.trim(),description:S.trim()||void 0,fields:_,singleton:N,titleField:M||void 0,slugField:R||void 0,force:Le});r?.(Ye),X(),t()}else{const Ye=await K({name:v,displayName:h.trim(),description:S.trim()||void 0,fields:_,singleton:N,titleField:M||void 0,slugField:R||void 0});n?.(Ye),X(),t()}}catch(Ye){const Oe=Ye instanceof Error?Ye.message:l?"Failed to update content type":"Failed to create content type";if(l&&!Le&&Oe.includes("breaking change")){const dt=be(Oe);$(dt),H(!0)}else B(Oe)}finally{D(!1)}},[ge,l,o,K,ne,v,h,S,_,N,M,R,n,r,X,t]),nt=p.useCallback(async()=>{I(!0);try{if(o){const pe=await ne({id:o._id,displayName:h.trim(),description:S.trim()||void 0,fields:_,singleton:N,titleField:M||void 0,slugField:R||void 0,force:!0});r?.(pe),X(),H(!1),t()}}catch(pe){const Le=pe instanceof Error?pe.message:"Failed to update content type";B(Le),H(!1)}finally{I(!1)}},[o,ne,h,S,_,N,M,R,r,X,t]),ot=p.useCallback(()=>{O||(X(),t())},[O,X,t]);if(!e)return null;const yt=V!==null?_[V]:null;return i.jsxs(i.Fragment,{children:[i.jsx(ls,{open:e,onOpenChange:pe=>!pe&&ot(),title:u?"View Content Type":l?"Edit Content Type":"Create Content Type",size:"2xl",footer:d?i.jsx(me,{variant:"outline",onClick:ot,children:"Close"}):i.jsxs(i.Fragment,{children:[i.jsx(me,{variant:"outline",onClick:ot,disabled:O,children:"Cancel"}),i.jsx(me,{variant:"primary",onClick:Be,disabled:ge.length>0,loading:O,"data-testid":l?"update-content-type-submit":"create-content-type-submit",children:l?"Save Changes":"Create Content Type"})]}),children:i.jsxs("form",{onSubmit:Be,className:"flex flex-col gap-6",children:[u&&i.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-violet-200 bg-violet-50 p-3",children:[i.jsx(rx,{className:"mt-0.5 size-5 shrink-0 text-violet-600"}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("p",{className:"text-sm font-medium text-violet-900",children:"Managed by Code"}),i.jsx("p",{className:"text-sm text-violet-700",children:"This content type is defined in your codebase and cannot be edited through the admin interface. To make changes, update the definition in your code."})]})]}),i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Basic Information"}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs(rt,{htmlFor:"displayName",children:["Display Name ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(mt,{id:"displayName",value:h,onChange:pe=>ue(pe.target.value),placeholder:"e.g., Blog Post",disabled:O||d,autoFocus:!d,"data-testid":"display-name-input"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs(rt,{htmlFor:"machineName",children:["System Name ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(mt,{id:"machineName",value:v,onChange:pe=>te(pe.target.value),placeholder:"e.g., blog_post",disabled:O||l||d,className:W(!TC(v)&&v&&"border-destructive"),"data-testid":"machine-name-input"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:l?"System name cannot be changed after creation":"Lowercase letters, numbers, and underscores only. Used in API queries."})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx(rt,{htmlFor:"description",children:"Description"}),i.jsx(no,{id:"description",value:S,onChange:pe=>j(pe.target.value),placeholder:"Optional description of this content type",disabled:O||d,rows:2})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(wr,{id:"singleton",checked:N,onCheckedChange:pe=>C(pe),disabled:O||d}),i.jsx(rt,{htmlFor:"singleton",className:"cursor-pointer",children:"Singleton (only one entry allowed)"})]})]}),i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Fields"}),!d&&i.jsxs(me,{type:"button",variant:"secondary",size:"sm",onClick:ye,disabled:O,"data-testid":"add-field-button",children:[i.jsx(Un,{className:"size-3.5"}),"Add Field"]})]}),i.jsx("div",{className:"flex flex-col gap-2",children:_.map((pe,Le)=>i.jsxs("div",{className:W("flex items-center gap-2 rounded-lg border p-2 transition-colors",!d&&"cursor-pointer hover:bg-muted/50",V===Le&&"border-primary bg-primary/5"),onClick:()=>{d||(Y(Le),ae(!0))},"data-testid":`field-item-${Le}`,children:[!d&&i.jsxs("div",{className:"flex flex-col gap-0.5",children:[Le>0&&i.jsx("button",{type:"button",onClick:Ye=>{Ye.stopPropagation(),Re(Le,Le-1)},className:"rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:i.jsx(Iu,{className:"size-3"})}),Le<_.length-1&&i.jsx("button",{type:"button",onClick:Ye=>{Ye.stopPropagation(),Re(Le,Le+1)},className:"rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:i.jsx(vn,{className:"size-3"})})]}),i.jsx("div",{className:"flex size-8 items-center justify-center rounded bg-muted text-muted-foreground",children:_v[pe.type].icon}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"truncate text-sm font-medium",children:pe.label}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:[_v[pe.type].label,pe.required&&" *"]})]}),!d&&i.jsx("button",{type:"button",onClick:Ye=>{Ye.stopPropagation(),Ce(Le)},disabled:O||_.length===1,className:"rounded p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive disabled:opacity-50",children:i.jsx(At,{className:"size-4"})})]},Le))}),!d&&G&&yt&&V!==null&&i.jsxs("div",{className:"rounded-lg border bg-muted/30 p-4","data-testid":"field-editor",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsxs("h5",{className:"font-medium",children:["Edit Field: ",yt.label]}),i.jsx("button",{type:"button",onClick:()=>{ae(!1),Y(null)},className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",children:i.jsx(At,{className:"size-4"})})]}),i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs(rt,{htmlFor:"fieldLabel",children:["Label ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(mt,{id:"fieldLabel",value:yt.label,onChange:pe=>_e(V,{label:pe.target.value,name:y?yt.name:EC(pe.target.value)||yt.name}),disabled:O,"data-testid":"field-label-input"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs(rt,{htmlFor:"fieldName",children:["Name ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(mt,{id:"fieldName",value:yt.name,onChange:pe=>_e(V,{name:pe.target.value.toLowerCase().replace(/[^a-z0-9_]/g,"")}),disabled:O,"data-testid":"field-name-input"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs(rt,{htmlFor:"fieldType",children:["Type ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsxs(ia,{value:yt.type,onValueChange:pe=>_e(V,{type:pe,options:void 0}),disabled:O,children:[i.jsx(ca,{"data-testid":"field-type-select",children:i.jsx(la,{})}),i.jsx(ua,{children:Object.entries(_v).map(([pe,Le])=>i.jsx(Xt,{value:pe,children:i.jsxs("div",{className:"flex items-center gap-2",children:[Le.icon,i.jsx("span",{children:Le.label}),i.jsxs("span",{className:"text-muted-foreground",children:["- ",Le.description]})]})},pe))})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(wr,{id:"fieldRequired",checked:yt.required,onCheckedChange:pe=>_e(V,{required:pe}),disabled:O}),i.jsx(rt,{htmlFor:"fieldRequired",className:"cursor-pointer",children:"Required"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx(rt,{htmlFor:"fieldDescription",children:"Help Text"}),i.jsx(mt,{id:"fieldDescription",value:yt.description||"",onChange:pe=>_e(V,{description:pe.target.value||void 0}),placeholder:"Help text shown below the field",disabled:O})]}),(yt.type==="select"||yt.type==="multiSelect")&&i.jsx(sV,{options:yt.options?.options||[],onChange:pe=>_e(V,{options:{...yt.options,options:pe}}),disabled:O})]})]})]}),Fe.length>0&&i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Display Settings"}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx(rt,{htmlFor:"titleField",children:"Title Field"}),i.jsxs(ia,{value:M||"none",onValueChange:pe=>A(pe==="none"?"":pe),disabled:O,children:[i.jsx(ca,{children:i.jsx(la,{placeholder:"None"})}),i.jsxs(ua,{children:[i.jsx(Xt,{value:"none",children:"None"}),Fe.map(pe=>i.jsx(Xt,{value:pe.name,children:pe.label},pe.name))]})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Field to display as the entry title in lists"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx(rt,{htmlFor:"slugField",children:"Slug Field"}),i.jsxs(ia,{value:R||"none",onValueChange:pe=>T(pe==="none"?"":pe),disabled:O,children:[i.jsx(ca,{children:i.jsx(la,{placeholder:"None (auto-generate)"})}),i.jsxs(ua,{children:[i.jsx(Xt,{value:"none",children:"None (auto-generate)"}),Fe.map(pe=>i.jsx(Xt,{value:pe.name,children:pe.label},pe.name))]})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Field to use for generating URL-friendly slugs"})]})]}),z&&i.jsx("div",{className:"diff-removed rounded-lg border px-3 py-2 text-sm",role:"alert","data-testid":"submit-error",children:z})]})}),i.jsx(rV,{isOpen:U,onClose:()=>H(!1),breakingChanges:L,onForceUpdate:nt,onCancel:()=>{H(!1),$([])},isLoading:le})]})}function sV({options:e,onChange:t,disabled:n}){const r=()=>{t([...e,{value:`option_${e.length+1}`,label:""}])},o=u=>{t(e.filter((d,h)=>h!==u))},l=(u,d)=>{t(e.map((h,m)=>m===u?{...h,...d}:h))};return i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs(rt,{children:["Options ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx("div",{className:"flex flex-col gap-2",children:e.map((u,d)=>i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(mt,{value:u.label,onChange:h=>{const m=h.target.value,v=m.toLowerCase().replace(/[^a-z0-9]/g,"_").replace(/^_+|_+$/g,"");l(d,{label:m,value:v})},placeholder:"Option label",disabled:n,className:"flex-1"}),i.jsx(mt,{value:u.value,onChange:h=>l(d,{value:h.target.value.toLowerCase().replace(/[^a-z0-9_]/g,"")}),placeholder:"value",disabled:n,className:"w-32"}),i.jsx("button",{type:"button",onClick:()=>o(d),disabled:n,className:"rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",children:i.jsx(At,{className:"size-4"})})]},d))}),i.jsxs(me,{type:"button",variant:"secondary",size:"sm",onClick:r,disabled:n,children:[i.jsx(Un,{className:"size-3.5"}),"Add Option"]})]})}function aV(){const t=$n().location.pathname,n=Vh(),{navItems:r,branding:o}=n,l=xn(),{setOpenMobile:u,isMobile:d}=im(),[h,m]=p.useState(!1),v=He(l.listContentTypes,{isActive:!0}),g=v?.page??[],y=(C,_)=>_?t===C:t.startsWith(C),w=t==="/content"||t.startsWith("/entries/type/")||t.startsWith("/entries/new/")||t.startsWith("/entries/"),S=()=>{d&&u(!1)},j=C=>C.id==="content"?N(C):i.jsx(NC,{children:i.jsx(kC,{asChild:!0,isActive:y(C.path,C.exact),onClick:S,children:i.jsxs(Ss,{to:C.path,children:[i.jsx(qj,{name:C.icon,className:"size-5"}),i.jsx("span",{children:C.label}),C.badge&&i.jsx("span",{className:"ml-auto rounded-full bg-sidebar-primary px-2 py-0.5 text-xs text-sidebar-primary-foreground",children:C.badge})]})})},C.id),N=C=>i.jsx(Ay,{defaultOpen:w,className:"group/collapsible",children:i.jsxs(NC,{children:[i.jsx(Oy,{asChild:!0,children:i.jsxs(kC,{isActive:w,children:[i.jsx(qj,{name:C.icon,className:"size-5"}),i.jsx("span",{children:C.label}),i.jsx(vn,{className:"ml-auto size-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-180"})]})}),i.jsx(Dy,{children:i.jsxs(oq,{children:[i.jsx(Nv,{children:i.jsx(kv,{asChild:!0,isActive:t==="/content",onClick:S,children:i.jsx(Ss,{to:"/content",children:"All Entries"})})}),g.map(_=>i.jsx(Nv,{children:i.jsx(kv,{asChild:!0,isActive:t===`/entries/type/${_._id}`,onClick:S,children:i.jsx(Ss,{to:"/entries/type/$contentTypeId",params:{contentTypeId:_._id},children:_.displayName})})},_._id)),g.length===0&&v!==void 0&&i.jsx(Nv,{children:i.jsx(kv,{onClick:()=>m(!0),className:"text-sidebar-foreground/60",children:"+ Create content type"})})]})})]})},C.id);return i.jsxs(i.Fragment,{children:[i.jsxs(J7,{collapsible:"offcanvas",className:"bg-sidebar",children:[i.jsx(nq,{className:"border-none",children:i.jsxs(Ss,{to:"/",className:"flex h-14 items-center gap-2 px-2 font-semibold text-sidebar-foreground",onClick:S,children:[o.logo?i.jsx("img",{src:o.logo,alt:o.appName,className:"size-8"}):i.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground",children:i.jsx(Kx,{className:"size-4"})}),i.jsx("span",{className:"text-base",children:o.appName})]})}),i.jsxs(sq,{children:[r.main.length>0&&i.jsxs(SC,{children:[i.jsx(jC,{children:"Main"}),i.jsx(CC,{children:r.main.map(j)})]}),r.config.length>0&&i.jsxs(SC,{children:[i.jsx(jC,{children:"Configuration"}),i.jsx(CC,{children:r.config.map(j)})]})]}),i.jsx(rq,{className:"border-t border-sidebar-border",children:i.jsxs("div",{className:"flex items-center justify-between text-xs text-sidebar-foreground/60",children:[i.jsx("span",{children:"Version"}),i.jsx("span",{className:"font-mono",children:p3})]})})]}),i.jsx(bE,{isOpen:h,onClose:()=>m(!1)})]})}const ku=Symbol.for("functionName"),oV=Symbol.for("toReferencePath");function iV(e){return e[oV]??null}function lV(e){return e.startsWith("function://")}function cV(e){let t;if(typeof e=="string")lV(e)?t={functionHandle:e}:t={name:e};else if(e[ku])t={name:e[ku]};else{const n=iV(e);if(!n)throw new Error(`${e} is not a functionReference`);t={reference:n}}return t}function wE(e){const t=cV(e);if(t.name===void 0)throw t.functionHandle!==void 0?new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`):t.reference!==void 0?new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`):new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`);if(typeof e=="string")return e;const n=e[ku];if(!n)throw new Error(`${e} is not a functionReference`);return n}function uV(e){return{[ku]:e}}function SE(e=[]){const t={get(n,r){if(typeof r=="string"){const o=[...e,r];return SE(o)}else if(r===ku){if(e.length<2){const u=["api",...e].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${u}\``)}const o=e.slice(0,-1).join("/"),l=e[e.length-1];return l==="default"?o:o+":"+l}else return r===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},t)}SE();var dV=Object.defineProperty,fV=(e,t,n)=>t in e?dV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ev=(e,t,n)=>fV(e,typeof t!="symbol"?t+"":t,n);class Jr{constructor(t,n){Ev(this,"low"),Ev(this,"high"),Ev(this,"__isUnsignedLong__"),this.low=t|0,this.high=n|0,this.__isUnsignedLong__=!0}static isLong(t){return(t&&t.__isUnsignedLong__)===!0}static fromBytesLE(t){return new Jr(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24)}toBytesLE(){const t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]}static fromNumber(t){return isNaN(t)||t<0?MC:t>=hV?mV:new Jr(t%iu|0,t/iu|0)}toString(){return(BigInt(this.high)*BigInt(iu)+BigInt(this.low)).toString()}equals(t){return Jr.isLong(t)||(t=Jr.fromValue(t)),this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low}notEquals(t){return!this.equals(t)}comp(t){return Jr.isLong(t)||(t=Jr.fromValue(t)),this.equals(t)?0:t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(t){return this.comp(t)<=0}static fromValue(t){return typeof t=="number"?Jr.fromNumber(t):new Jr(t.low,t.high)}}const MC=new Jr(0,0),RC=65536,iu=RC*RC,hV=iu*iu,mV=new Jr(-1,-1);class pV extends Error{}pV.prototype.name="InvalidTokenError";if(typeof ee>"u")throw new Error("Required dependency 'react' not found");function jE(e,t,n){function r(o){return vV(o),t.mutation(e,o,{optimisticUpdate:n})}return r.withOptimisticUpdate=function(l){if(n!==void 0)throw new Error(`Already specified optimistic update for mutation ${wE(e)}`);return jE(e,t,l)},r}const gV=ee.createContext(void 0);function AC(e){const t=typeof e=="string"?uV(e):e,n=p.useContext(gV);if(n===void 0)throw new Error("Could not find Convex client! `useMutation` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return p.useMemo(()=>jE(t,n),[n,wE(t)])}function vV(e){if(typeof e=="object"&&e!==null&&"bubbles"in e&&"persist"in e&&"isDefaultPrevented"in e)throw new Error("Convex function called with SyntheticEvent object. Did you use a Convex function as an event handler directly? Event handlers like onClick receive an event object as their first argument. These SyntheticEvent objects are not valid Convex values. Try wrapping the function like `const handler = () => myMutation();` and using `handler` in the event handler.")}function xV(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function yV(e,t=5e3){return e.type.startsWith("image/")?new Promise(n=>{const r=new Image;let o=null;const l=setTimeout(()=>{o&&URL.revokeObjectURL(o),n(void 0)},t);r.onload=()=>{clearTimeout(l),o&&URL.revokeObjectURL(o),n({width:r.naturalWidth,height:r.naturalHeight})},r.onerror=()=>{clearTimeout(l),o&&URL.revokeObjectURL(o),n(void 0)},o=URL.createObjectURL(e),r.src=o}):Promise.resolve(void 0)}function bV(e,t,n,r){return new Promise((o,l)=>{const u=new XMLHttpRequest,d=()=>{u.abort(),l(new DOMException("Upload aborted","AbortError"))};n.addEventListener("abort",d),u.upload.onprogress=h=>{if(h.lengthComputable){const m=Math.round(h.loaded/h.total*80);r(10+m)}},u.onload=()=>{if(n.removeEventListener("abort",d),u.status>=200&&u.status<300)try{const h=JSON.parse(u.responseText);o(h.storageId)}catch{l(new Error("Invalid response from upload server"))}else l(new Error(`Upload failed: ${u.statusText||`HTTP ${u.status}`}`))},u.onerror=()=>{n.removeEventListener("abort",d),l(new Error("Network error during upload"))},u.ontimeout=()=>{n.removeEventListener("abort",d),l(new Error("Upload timed out"))},u.open("POST",e),u.setRequestHeader("Content-Type",t.type),u.send(t)})}function wV(e,t){switch(t.type){case"ADD_FILES":{const n=t.files.map(r=>({id:xV(),file:r,status:"pending",progress:0}));return[...e,...n]}case"UPDATE_FILE":return e.map(n=>n.id===t.id?{...n,...t.updates}:n);case"RETRY_FILE":return e.map(n=>n.id===t.id?{...n,status:"pending",progress:0,error:void 0}:n);case"REMOVE_FILE":return e.filter(n=>n.id!==t.id);case"CLEAR_COMPLETED":return e.filter(n=>n.status==="pending"||n.status==="uploading");case"CLEAR_ALL":return[];case"CANCEL_FILE":return e.map(n=>n.id===t.id&&(n.status==="pending"||n.status==="uploading")?{...n,status:"cancelled",error:"Upload cancelled"}:n);case"CANCEL_ALL":return e.map(n=>n.status==="pending"||n.status==="uploading"?{...n,status:"cancelled",error:"Upload cancelled"}:n);default:return e}}function SV(e){const{maxConcurrent:t=3,metadata:n,onComplete:r,onError:o}=e,[l,u]=p.useReducer(wV,[]),d=AC(e.getUploadUrl),h=AC(e.createAsset),m=p.useRef(0),v=p.useRef(new Map),g=p.useRef(!1),y=p.useCallback(async R=>{const T=new AbortController;v.current.set(R.id,T),u({type:"UPDATE_FILE",id:R.id,updates:{status:"uploading",progress:0}});try{const O=await d({});u({type:"UPDATE_FILE",id:R.id,updates:{progress:5}});const D=await bV(O,R.file,T.signal,V=>{u({type:"UPDATE_FILE",id:R.id,updates:{progress:V}})});u({type:"UPDATE_FILE",id:R.id,updates:{progress:90}});const z=await yV(R.file),B=await h({storageId:D,name:R.file.name,mimeType:R.file.type,size:R.file.size,...z,...n});u({type:"UPDATE_FILE",id:R.id,updates:{status:"complete",progress:100,result:B}})}catch(O){const D=O instanceof Error?O:new Error(String(O));if(D.name==="AbortError")u({type:"UPDATE_FILE",id:R.id,updates:{status:"cancelled",error:"Upload cancelled"}});else{const z={...R,status:"error",error:D.message};u({type:"UPDATE_FILE",id:R.id,updates:{status:"error",error:D.message}}),o?.(z)}}finally{v.current.delete(R.id),m.current--}},[d,h,n,o]),w=p.useCallback(()=>{if(g.current)return;g.current=!0;const R=l.filter(T=>T.status==="pending");for(;m.current<t&&R.length>0;){const T=R.shift();m.current++,y(T)}g.current=!1,m.current===0&&l.length>0&&l.every(T=>T.status!=="pending"&&T.status!=="uploading")&&r?.(l)},[l,t,y,r]);p.useEffect(()=>{l.some(R=>R.status==="pending")&&m.current<t&&w()},[l,t,w]);const S=p.useCallback(R=>{u({type:"ADD_FILES",files:R})},[]),j=p.useCallback(R=>{const T=v.current.get(R);T&&T.abort(),u({type:"CANCEL_FILE",id:R})},[]),N=p.useCallback(()=>{v.current.forEach(R=>R.abort()),u({type:"CANCEL_ALL"})},[]),C=p.useCallback(R=>{u({type:"RETRY_FILE",id:R})},[]),_=p.useCallback(()=>{u({type:"CLEAR_COMPLETED"})},[]),E=p.useCallback(()=>{v.current.forEach(R=>R.abort()),u({type:"CLEAR_ALL"})},[]),M=l.some(R=>R.status==="uploading"),A=l.length>0?Math.round(l.reduce((R,T)=>R+T.progress,0)/l.length):0;return{files:l,addFiles:S,cancelFile:j,cancelAll:N,retryFile:C,clearCompleted:_,clearAll:E,isUploading:M,overallProgress:A}}function jV({...e}){return i.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...e})}function CV({className:e,...t}){return i.jsx("ol",{"data-slot":"breadcrumb-list",className:W("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",e),...t})}function NV({className:e,...t}){return i.jsx("li",{"data-slot":"breadcrumb-item",className:W("inline-flex items-center gap-1.5",e),...t})}function kV({asChild:e,className:t,...n}){const r=e?Pl:"a";return i.jsx(r,{"data-slot":"breadcrumb-link",className:W("hover:text-foreground transition-colors",t),...n})}function _V({className:e,...t}){return i.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:W("text-foreground font-normal",e),...t})}function EV({children:e,className:t,...n}){return i.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:W("[&>svg]:size-3.5",t),...n,children:e??i.jsx(Rl,{})})}var Tv="rovingFocusGroup.onEntryFocus",TV={bubbles:!1,cancelable:!0},Zu="RovingFocusGroup",[jx,CE,MV]=Xy(Zu),[RV,ql]=Dn(Zu,[MV]),[AV,OV]=RV(Zu),NE=p.forwardRef((e,t)=>i.jsx(jx.Provider,{scope:e.__scopeRovingFocusGroup,children:i.jsx(jx.Slot,{scope:e.__scopeRovingFocusGroup,children:i.jsx(DV,{...e,ref:t})})}));NE.displayName=Zu;var DV=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:h,onEntryFocus:m,preventScrollOnEntryFocus:v=!1,...g}=e,y=p.useRef(null),w=Ge(t,y),S=Bl(l),[j,N]=nr({prop:u,defaultProp:d??null,onChange:h,caller:Zu}),[C,_]=p.useState(!1),E=Nn(m),M=CE(n),A=p.useRef(!1),[R,T]=p.useState(0);return p.useEffect(()=>{const O=y.current;if(O)return O.addEventListener(Tv,E),()=>O.removeEventListener(Tv,E)},[E]),i.jsx(AV,{scope:n,orientation:r,dir:S,loop:o,currentTabStopId:j,onItemFocus:p.useCallback(O=>N(O),[N]),onItemShiftTab:p.useCallback(()=>_(!0),[]),onFocusableItemAdd:p.useCallback(()=>T(O=>O+1),[]),onFocusableItemRemove:p.useCallback(()=>T(O=>O-1),[]),children:i.jsx(ze.div,{tabIndex:C||R===0?-1:0,"data-orientation":r,...g,ref:w,style:{outline:"none",...e.style},onMouseDown:Se(e.onMouseDown,()=>{A.current=!0}),onFocus:Se(e.onFocus,O=>{const D=!A.current;if(O.target===O.currentTarget&&D&&!C){const z=new CustomEvent(Tv,TV);if(O.currentTarget.dispatchEvent(z),!z.defaultPrevented){const B=M().filter(L=>L.focusable),V=B.find(L=>L.active),Y=B.find(L=>L.id===j),ae=[V,Y,...B].filter(Boolean).map(L=>L.ref.current);EE(ae,v)}}A.current=!1}),onBlur:Se(e.onBlur,()=>_(!1))})})}),kE="RovingFocusGroupItem",_E=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:l,children:u,...d}=e,h=gn(),m=l||h,v=OV(kE,n),g=v.currentTabStopId===m,y=CE(n),{onFocusableItemAdd:w,onFocusableItemRemove:S,currentTabStopId:j}=v;return p.useEffect(()=>{if(r)return w(),()=>S()},[r,w,S]),i.jsx(jx.ItemSlot,{scope:n,id:m,focusable:r,active:o,children:i.jsx(ze.span,{tabIndex:g?0:-1,"data-orientation":v.orientation,...d,ref:t,onMouseDown:Se(e.onMouseDown,N=>{r?v.onItemFocus(m):N.preventDefault()}),onFocus:Se(e.onFocus,()=>v.onItemFocus(m)),onKeyDown:Se(e.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){v.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const C=LV(N,v.orientation,v.dir);if(C!==void 0){if(N.metaKey||N.ctrlKey||N.altKey||N.shiftKey)return;N.preventDefault();let E=y().filter(M=>M.focusable).map(M=>M.ref.current);if(C==="last")E.reverse();else if(C==="prev"||C==="next"){C==="prev"&&E.reverse();const M=E.indexOf(N.currentTarget);E=v.loop?IV(E,M+1):E.slice(M+1)}setTimeout(()=>EE(E))}}),children:typeof u=="function"?u({isCurrentTabStop:g,hasTabStop:j!=null}):u})})});_E.displayName=kE;var zV={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function PV(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function LV(e,t,n){const r=PV(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return zV[r]}function EE(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function IV(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var eb=NE,tb=_E,Cx=["Enter"," "],$V=["ArrowDown","PageUp","Home"],TE=["ArrowUp","PageDown","End"],FV=[...$V,...TE],BV={ltr:[...Cx,"ArrowRight"],rtl:[...Cx,"ArrowLeft"]},UV={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Qu="Menu",[_u,qV,VV]=Xy(Qu),[Xo,ME]=Dn(Qu,[VV,to,ql]),fm=to(),RE=ql(),[HV,Jo]=Xo(Qu),[YV,Ku]=Xo(Qu),AE=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:l,modal:u=!0}=e,d=fm(t),[h,m]=p.useState(null),v=p.useRef(!1),g=Nn(l),y=Bl(o);return p.useEffect(()=>{const w=()=>{v.current=!0,document.addEventListener("pointerdown",S,{capture:!0,once:!0}),document.addEventListener("pointermove",S,{capture:!0,once:!0})},S=()=>v.current=!1;return document.addEventListener("keydown",w,{capture:!0}),()=>{document.removeEventListener("keydown",w,{capture:!0}),document.removeEventListener("pointerdown",S,{capture:!0}),document.removeEventListener("pointermove",S,{capture:!0})}},[]),i.jsx(nm,{...d,children:i.jsx(HV,{scope:t,open:n,onOpenChange:g,content:h,onContentChange:m,children:i.jsx(YV,{scope:t,onClose:p.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:v,dir:y,modal:u,children:r})})})};AE.displayName=Qu;var WV="MenuAnchor",nb=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=fm(n);return i.jsx(Wu,{...o,...r,ref:t})});nb.displayName=WV;var rb="MenuPortal",[GV,OE]=Xo(rb,{forceMount:void 0}),DE=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,l=Jo(rb,t);return i.jsx(GV,{scope:t,forceMount:n,children:i.jsx(yn,{present:n||l.open,children:i.jsx(Il,{asChild:!0,container:o,children:r})})})};DE.displayName=rb;var Br="MenuContent",[ZV,sb]=Xo(Br),zE=p.forwardRef((e,t)=>{const n=OE(Br,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,l=Jo(Br,e.__scopeMenu),u=Ku(Br,e.__scopeMenu);return i.jsx(_u.Provider,{scope:e.__scopeMenu,children:i.jsx(yn,{present:r||l.open,children:i.jsx(_u.Slot,{scope:e.__scopeMenu,children:u.modal?i.jsx(QV,{...o,ref:t}):i.jsx(KV,{...o,ref:t})})})})}),QV=p.forwardRef((e,t)=>{const n=Jo(Br,e.__scopeMenu),r=p.useRef(null),o=Ge(t,r);return p.useEffect(()=>{const l=r.current;if(l)return Gh(l)},[]),i.jsx(ab,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Se(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),KV=p.forwardRef((e,t)=>{const n=Jo(Br,e.__scopeMenu);return i.jsx(ab,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),XV=Bo("MenuContent.ScrollLock"),ab=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:h,onEscapeKeyDown:m,onPointerDownOutside:v,onFocusOutside:g,onInteractOutside:y,onDismiss:w,disableOutsideScroll:S,...j}=e,N=Jo(Br,n),C=Ku(Br,n),_=fm(n),E=RE(n),M=qV(n),[A,R]=p.useState(null),T=p.useRef(null),O=Ge(t,T,N.onContentChange),D=p.useRef(0),z=p.useRef(""),B=p.useRef(0),V=p.useRef(null),Y=p.useRef("right"),G=p.useRef(0),ae=S?Bu:p.Fragment,L=S?{as:XV,allowPinchZoom:!0}:void 0,$=H=>{const le=z.current+H,I=M().filter(te=>!te.disabled),F=document.activeElement,K=I.find(te=>te.ref.current===F)?.textValue,ne=I.map(te=>te.textValue),X=uH(ne,le,K),ue=I.find(te=>te.textValue===X)?.ref.current;(function te(ye){z.current=ye,window.clearTimeout(D.current),ye!==""&&(D.current=window.setTimeout(()=>te(""),1e3))})(le),ue&&setTimeout(()=>ue.focus())};p.useEffect(()=>()=>window.clearTimeout(D.current),[]),Yh();const U=p.useCallback(H=>Y.current===V.current?.side&&fH(H,V.current?.area),[]);return i.jsx(ZV,{scope:n,searchRef:z,onItemEnter:p.useCallback(H=>{U(H)&&H.preventDefault()},[U]),onItemLeave:p.useCallback(H=>{U(H)||(T.current?.focus(),R(null))},[U]),onTriggerLeave:p.useCallback(H=>{U(H)&&H.preventDefault()},[U]),pointerGraceTimerRef:B,onPointerGraceIntentChange:p.useCallback(H=>{V.current=H},[]),children:i.jsx(ae,{...L,children:i.jsx(Fu,{asChild:!0,trapped:o,onMountAutoFocus:Se(l,H=>{H.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:i.jsx(Ll,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:m,onPointerDownOutside:v,onFocusOutside:g,onInteractOutside:y,onDismiss:w,children:i.jsx(eb,{asChild:!0,...E,dir:C.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:R,onEntryFocus:Se(h,H=>{C.isUsingKeyboardRef.current||H.preventDefault()}),preventScrollOnEntryFocus:!0,children:i.jsx(rm,{role:"menu","aria-orientation":"vertical","data-state":KE(N.open),"data-radix-menu-content":"",dir:C.dir,..._,...j,ref:O,style:{outline:"none",...j.style},onKeyDown:Se(j.onKeyDown,H=>{const I=H.target.closest("[data-radix-menu-content]")===H.currentTarget,F=H.ctrlKey||H.altKey||H.metaKey,K=H.key.length===1;I&&(H.key==="Tab"&&H.preventDefault(),!F&&K&&$(H.key));const ne=T.current;if(H.target!==ne||!FV.includes(H.key))return;H.preventDefault();const ue=M().filter(te=>!te.disabled).map(te=>te.ref.current);TE.includes(H.key)&&ue.reverse(),lH(ue)}),onBlur:Se(e.onBlur,H=>{H.currentTarget.contains(H.target)||(window.clearTimeout(D.current),z.current="")}),onPointerMove:Se(e.onPointerMove,Eu(H=>{const le=H.target,I=G.current!==H.clientX;if(H.currentTarget.contains(le)&&I){const F=H.clientX>G.current?"right":"left";Y.current=F,G.current=H.clientX}}))})})})})})})});zE.displayName=Br;var JV="MenuGroup",ob=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(ze.div,{role:"group",...r,ref:t})});ob.displayName=JV;var eH="MenuLabel",PE=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(ze.div,{...r,ref:t})});PE.displayName=eH;var Eh="MenuItem",OC="menu.itemSelect",hm=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,l=p.useRef(null),u=Ku(Eh,e.__scopeMenu),d=sb(Eh,e.__scopeMenu),h=Ge(t,l),m=p.useRef(!1),v=()=>{const g=l.current;if(!n&&g){const y=new CustomEvent(OC,{bubbles:!0,cancelable:!0});g.addEventListener(OC,w=>r?.(w),{once:!0}),s_(g,y),y.defaultPrevented?m.current=!1:u.onClose()}};return i.jsx(LE,{...o,ref:h,disabled:n,onClick:Se(e.onClick,v),onPointerDown:g=>{e.onPointerDown?.(g),m.current=!0},onPointerUp:Se(e.onPointerUp,g=>{m.current||g.currentTarget?.click()}),onKeyDown:Se(e.onKeyDown,g=>{const y=d.searchRef.current!=="";n||y&&g.key===" "||Cx.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});hm.displayName=Eh;var LE=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...l}=e,u=sb(Eh,n),d=RE(n),h=p.useRef(null),m=Ge(t,h),[v,g]=p.useState(!1),[y,w]=p.useState("");return p.useEffect(()=>{const S=h.current;S&&w((S.textContent??"").trim())},[l.children]),i.jsx(_u.ItemSlot,{scope:n,disabled:r,textValue:o??y,children:i.jsx(tb,{asChild:!0,...d,focusable:!r,children:i.jsx(ze.div,{role:"menuitem","data-highlighted":v?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...l,ref:m,onPointerMove:Se(e.onPointerMove,Eu(S=>{r?u.onItemLeave(S):(u.onItemEnter(S),S.defaultPrevented||S.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Se(e.onPointerLeave,Eu(S=>u.onItemLeave(S))),onFocus:Se(e.onFocus,()=>g(!0)),onBlur:Se(e.onBlur,()=>g(!1))})})})}),tH="MenuCheckboxItem",IE=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return i.jsx(qE,{scope:e.__scopeMenu,checked:n,children:i.jsx(hm,{role:"menuitemcheckbox","aria-checked":Th(n)?"mixed":n,...o,ref:t,"data-state":lb(n),onSelect:Se(o.onSelect,()=>r?.(Th(n)?!0:!n),{checkForDefaultPrevented:!1})})})});IE.displayName=tH;var $E="MenuRadioGroup",[nH,rH]=Xo($E,{value:void 0,onValueChange:()=>{}}),FE=p.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,l=Nn(r);return i.jsx(nH,{scope:e.__scopeMenu,value:n,onValueChange:l,children:i.jsx(ob,{...o,ref:t})})});FE.displayName=$E;var BE="MenuRadioItem",UE=p.forwardRef((e,t)=>{const{value:n,...r}=e,o=rH(BE,e.__scopeMenu),l=n===o.value;return i.jsx(qE,{scope:e.__scopeMenu,checked:l,children:i.jsx(hm,{role:"menuitemradio","aria-checked":l,...r,ref:t,"data-state":lb(l),onSelect:Se(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});UE.displayName=BE;var ib="MenuItemIndicator",[qE,sH]=Xo(ib,{checked:!1}),VE=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,l=sH(ib,n);return i.jsx(yn,{present:r||Th(l.checked)||l.checked===!0,children:i.jsx(ze.span,{...o,ref:t,"data-state":lb(l.checked)})})});VE.displayName=ib;var aH="MenuSeparator",HE=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(ze.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});HE.displayName=aH;var oH="MenuArrow",YE=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=fm(n);return i.jsx(sm,{...o,...r,ref:t})});YE.displayName=oH;var iH="MenuSub",[yee,WE]=Xo(iH),Xc="MenuSubTrigger",GE=p.forwardRef((e,t)=>{const n=Jo(Xc,e.__scopeMenu),r=Ku(Xc,e.__scopeMenu),o=WE(Xc,e.__scopeMenu),l=sb(Xc,e.__scopeMenu),u=p.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:h}=l,m={__scopeMenu:e.__scopeMenu},v=p.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return p.useEffect(()=>v,[v]),p.useEffect(()=>{const g=d.current;return()=>{window.clearTimeout(g),h(null)}},[d,h]),i.jsx(nb,{asChild:!0,...m,children:i.jsx(LE,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":KE(n.open),...e,ref:Es(t,o.onTriggerChange),onClick:g=>{e.onClick?.(g),!(e.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Se(e.onPointerMove,Eu(g=>{l.onItemEnter(g),!g.defaultPrevented&&!e.disabled&&!n.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{n.onOpenChange(!0),v()},100))})),onPointerLeave:Se(e.onPointerLeave,Eu(g=>{v();const y=n.content?.getBoundingClientRect();if(y){const w=n.content?.dataset.side,S=w==="right",j=S?-5:5,N=y[S?"left":"right"],C=y[S?"right":"left"];l.onPointerGraceIntentChange({area:[{x:g.clientX+j,y:g.clientY},{x:N,y:y.top},{x:C,y:y.top},{x:C,y:y.bottom},{x:N,y:y.bottom}],side:w}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(g),g.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Se(e.onKeyDown,g=>{const y=l.searchRef.current!=="";e.disabled||y&&g.key===" "||BV[r.dir].includes(g.key)&&(n.onOpenChange(!0),n.content?.focus(),g.preventDefault())})})})});GE.displayName=Xc;var ZE="MenuSubContent",QE=p.forwardRef((e,t)=>{const n=OE(Br,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,l=Jo(Br,e.__scopeMenu),u=Ku(Br,e.__scopeMenu),d=WE(ZE,e.__scopeMenu),h=p.useRef(null),m=Ge(t,h);return i.jsx(_u.Provider,{scope:e.__scopeMenu,children:i.jsx(yn,{present:r||l.open,children:i.jsx(_u.Slot,{scope:e.__scopeMenu,children:i.jsx(ab,{id:d.contentId,"aria-labelledby":d.triggerId,...o,ref:m,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:v=>{u.isUsingKeyboardRef.current&&h.current?.focus(),v.preventDefault()},onCloseAutoFocus:v=>v.preventDefault(),onFocusOutside:Se(e.onFocusOutside,v=>{v.target!==d.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:Se(e.onEscapeKeyDown,v=>{u.onClose(),v.preventDefault()}),onKeyDown:Se(e.onKeyDown,v=>{const g=v.currentTarget.contains(v.target),y=UV[u.dir].includes(v.key);g&&y&&(l.onOpenChange(!1),d.trigger?.focus(),v.preventDefault())})})})})})});QE.displayName=ZE;function KE(e){return e?"open":"closed"}function Th(e){return e==="indeterminate"}function lb(e){return Th(e)?"indeterminate":e?"checked":"unchecked"}function lH(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function cH(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function uH(e,t,n){const o=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let u=cH(e,Math.max(l,0));o.length===1&&(u=u.filter(m=>m!==n));const h=u.find(m=>m.toLowerCase().startsWith(o.toLowerCase()));return h!==n?h:void 0}function dH(e,t){const{x:n,y:r}=e;let o=!1;for(let l=0,u=t.length-1;l<t.length;u=l++){const d=t[l],h=t[u],m=d.x,v=d.y,g=h.x,y=h.y;v>r!=y>r&&n<(g-m)*(r-v)/(y-v)+m&&(o=!o)}return o}function fH(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return dH(n,t)}function Eu(e){return t=>t.pointerType==="mouse"?e(t):void 0}var hH=AE,mH=nb,pH=DE,gH=zE,vH=ob,xH=PE,yH=hm,bH=IE,wH=FE,SH=UE,jH=VE,CH=HE,NH=YE,kH=GE,_H=QE,mm="DropdownMenu",[EH]=Dn(mm,[ME]),qn=ME(),[TH,XE]=EH(mm),JE=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,h=qn(t),m=p.useRef(null),[v,g]=nr({prop:o,defaultProp:l??!1,onChange:u,caller:mm});return i.jsx(TH,{scope:t,triggerId:gn(),triggerRef:m,contentId:gn(),open:v,onOpenChange:g,onOpenToggle:p.useCallback(()=>g(y=>!y),[g]),modal:d,children:i.jsx(hH,{...h,open:v,onOpenChange:g,dir:r,modal:d,children:n})})};JE.displayName=mm;var eT="DropdownMenuTrigger",tT=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,l=XE(eT,n),u=qn(n);return i.jsx(mH,{asChild:!0,...u,children:i.jsx(ze.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:Es(t,l.triggerRef),onPointerDown:Se(e.onPointerDown,d=>{!r&&d.button===0&&d.ctrlKey===!1&&(l.onOpenToggle(),l.open||d.preventDefault())}),onKeyDown:Se(e.onKeyDown,d=>{r||(["Enter"," "].includes(d.key)&&l.onOpenToggle(),d.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})});tT.displayName=eT;var MH="DropdownMenuPortal",nT=e=>{const{__scopeDropdownMenu:t,...n}=e,r=qn(t);return i.jsx(pH,{...r,...n})};nT.displayName=MH;var rT="DropdownMenuContent",sT=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=XE(rT,n),l=qn(n),u=p.useRef(!1);return i.jsx(gH,{id:o.contentId,"aria-labelledby":o.triggerId,...l,...r,ref:t,onCloseAutoFocus:Se(e.onCloseAutoFocus,d=>{u.current||o.triggerRef.current?.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:Se(e.onInteractOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0,v=h.button===2||m;(!o.modal||v)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});sT.displayName=rT;var RH="DropdownMenuGroup",aT=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=qn(n);return i.jsx(vH,{...o,...r,ref:t})});aT.displayName=RH;var AH="DropdownMenuLabel",oT=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=qn(n);return i.jsx(xH,{...o,...r,ref:t})});oT.displayName=AH;var OH="DropdownMenuItem",iT=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=qn(n);return i.jsx(yH,{...o,...r,ref:t})});iT.displayName=OH;var DH="DropdownMenuCheckboxItem",zH=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=qn(n);return i.jsx(bH,{...o,...r,ref:t})});zH.displayName=DH;var PH="DropdownMenuRadioGroup",LH=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=qn(n);return i.jsx(wH,{...o,...r,ref:t})});LH.displayName=PH;var IH="DropdownMenuRadioItem",$H=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=qn(n);return i.jsx(SH,{...o,...r,ref:t})});$H.displayName=IH;var FH="DropdownMenuItemIndicator",BH=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=qn(n);return i.jsx(jH,{...o,...r,ref:t})});BH.displayName=FH;var UH="DropdownMenuSeparator",lT=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=qn(n);return i.jsx(CH,{...o,...r,ref:t})});lT.displayName=UH;var qH="DropdownMenuArrow",VH=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=qn(n);return i.jsx(NH,{...o,...r,ref:t})});VH.displayName=qH;var HH="DropdownMenuSubTrigger",YH=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=qn(n);return i.jsx(kH,{...o,...r,ref:t})});YH.displayName=HH;var WH="DropdownMenuSubContent",GH=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=qn(n);return i.jsx(_H,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});GH.displayName=WH;var ZH=JE,QH=tT,KH=nT,XH=sT,JH=aT,eY=oT,tY=iT,nY=lT;function Sl({...e}){return i.jsx(ZH,{"data-slot":"dropdown-menu",...e})}function jl({...e}){return i.jsx(QH,{"data-slot":"dropdown-menu-trigger",...e})}function Cl({className:e,sideOffset:t=4,...n}){return i.jsx(KH,{children:i.jsx(XH,{"data-slot":"dropdown-menu-content",sideOffset:t,className:W("bg-popover text-popover-foreground 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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function DC({...e}){return i.jsx(JH,{"data-slot":"dropdown-menu-group",...e})}function pn({className:e,inset:t,variant:n="default",...r}){return i.jsx(tY,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:W("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function cT({className:e,inset:t,...n}){return i.jsx(eY,{"data-slot":"dropdown-menu-label","data-inset":t,className:W("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function Yo({className:e,...t}){return i.jsx(nY,{"data-slot":"dropdown-menu-separator",className:W("bg-border -mx-1 my-1 h-px",e),...t})}function rY(e,t=[]){let n=[];function r(l,u){const d=p.createContext(u);d.displayName=l+"Context";const h=n.length;n=[...n,u];const m=g=>{const{scope:y,children:w,...S}=g,j=y?.[e]?.[h]||d,N=p.useMemo(()=>S,Object.values(S));return i.jsx(j.Provider,{value:N,children:w})};m.displayName=l+"Provider";function v(g,y){const w=y?.[e]?.[h]||d,S=p.useContext(w);if(S)return S;if(u!==void 0)return u;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[m,v]}const o=()=>{const l=n.map(u=>p.createContext(u));return function(d){const h=d?.[e]||l;return p.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return o.scopeName=e,[r,sY(o,...t)]}function sY(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(l){const u=r.reduce((d,{useScope:h,scopeName:m})=>{const g=h(l)[`__scope${m}`];return{...d,...g}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var aY=QN();function oY(){return aY.useSyncExternalStore(iY,()=>!0,()=>!1)}function iY(){return()=>{}}var cb="Avatar",[lY]=rY(cb),[cY,uT]=lY(cb),dT=p.forwardRef((e,t)=>{const{__scopeAvatar:n,...r}=e,[o,l]=p.useState("idle");return i.jsx(cY,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:l,children:i.jsx(sr.span,{...r,ref:t})})});dT.displayName=cb;var fT="AvatarImage",hT=p.forwardRef((e,t)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:o=()=>{},...l}=e,u=uT(fT,n),d=uY(r,l),h=Nn(m=>{o(m),u.onImageLoadingStatusChange(m)});return Jt(()=>{d!=="idle"&&h(d)},[d,h]),d==="loaded"?i.jsx(sr.img,{...l,ref:t,src:r}):null});hT.displayName=fT;var mT="AvatarFallback",pT=p.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:r,...o}=e,l=uT(mT,n),[u,d]=p.useState(r===void 0);return p.useEffect(()=>{if(r!==void 0){const h=window.setTimeout(()=>d(!0),r);return()=>window.clearTimeout(h)}},[r]),u&&l.imageLoadingStatus!=="loaded"?i.jsx(sr.span,{...o,ref:t}):null});pT.displayName=mT;function zC(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function uY(e,{referrerPolicy:t,crossOrigin:n}){const r=oY(),o=p.useRef(null),l=r?(o.current||(o.current=new window.Image),o.current):null,[u,d]=p.useState(()=>zC(l,e));return Jt(()=>{d(zC(l,e))},[l,e]),Jt(()=>{const h=g=>()=>{d(g)};if(!l)return;const m=h("loaded"),v=h("error");return l.addEventListener("load",m),l.addEventListener("error",v),t&&(l.referrerPolicy=t),typeof n=="string"&&(l.crossOrigin=n),()=>{l.removeEventListener("load",m),l.removeEventListener("error",v)}},[l,n,t]),u}var dY=dT,fY=hT,hY=pT;function mY({className:e,...t}){return i.jsx(dY,{"data-slot":"avatar",className:W("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function pY({className:e,...t}){return i.jsx(fY,{"data-slot":"avatar-image",className:W("aspect-square size-full",e),...t})}function gY({className:e,...t}){return i.jsx(hY,{"data-slot":"avatar-fallback",className:W("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}var pm="Popover",[gT]=Dn(pm,[to]),Xu=to(),[vY,ao]=gT(pm),vT=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:l,modal:u=!1}=e,d=Xu(t),h=p.useRef(null),[m,v]=p.useState(!1),[g,y]=nr({prop:r,defaultProp:o??!1,onChange:l,caller:pm});return i.jsx(nm,{...d,children:i.jsx(vY,{scope:t,contentId:gn(),triggerRef:h,open:g,onOpenChange:y,onOpenToggle:p.useCallback(()=>y(w=>!w),[y]),hasCustomAnchor:m,onCustomAnchorAdd:p.useCallback(()=>v(!0),[]),onCustomAnchorRemove:p.useCallback(()=>v(!1),[]),modal:u,children:n})})};vT.displayName=pm;var xT="PopoverAnchor",xY=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=ao(xT,n),l=Xu(n),{onCustomAnchorAdd:u,onCustomAnchorRemove:d}=o;return p.useEffect(()=>(u(),()=>d()),[u,d]),i.jsx(Wu,{...l,...r,ref:t})});xY.displayName=xT;var yT="PopoverTrigger",bT=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=ao(yT,n),l=Xu(n),u=Ge(t,o.triggerRef),d=i.jsx(ze.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":NT(o.open),...r,ref:u,onClick:Se(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?d:i.jsx(Wu,{asChild:!0,...l,children:d})});bT.displayName=yT;var ub="PopoverPortal",[yY,bY]=gT(ub,{forceMount:void 0}),wT=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,l=ao(ub,t);return i.jsx(yY,{scope:t,forceMount:n,children:i.jsx(yn,{present:n||l.open,children:i.jsx(Il,{asChild:!0,container:o,children:r})})})};wT.displayName=ub;var Nl="PopoverContent",ST=p.forwardRef((e,t)=>{const n=bY(Nl,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,l=ao(Nl,e.__scopePopover);return i.jsx(yn,{present:r||l.open,children:l.modal?i.jsx(SY,{...o,ref:t}):i.jsx(jY,{...o,ref:t})})});ST.displayName=Nl;var wY=Bo("PopoverContent.RemoveScroll"),SY=p.forwardRef((e,t)=>{const n=ao(Nl,e.__scopePopover),r=p.useRef(null),o=Ge(t,r),l=p.useRef(!1);return p.useEffect(()=>{const u=r.current;if(u)return Gh(u)},[]),i.jsx(Bu,{as:wY,allowPinchZoom:!0,children:i.jsx(jT,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Se(e.onCloseAutoFocus,u=>{u.preventDefault(),l.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Se(e.onPointerDownOutside,u=>{const d=u.detail.originalEvent,h=d.button===0&&d.ctrlKey===!0,m=d.button===2||h;l.current=m},{checkForDefaultPrevented:!1}),onFocusOutside:Se(e.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})}),jY=p.forwardRef((e,t)=>{const n=ao(Nl,e.__scopePopover),r=p.useRef(!1),o=p.useRef(!1);return i.jsx(jT,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(r.current||n.triggerRef.current?.focus(),l.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(r.current=!0,l.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const u=l.target;n.triggerRef.current?.contains(u)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&o.current&&l.preventDefault()}})}),jT=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:v,...g}=e,y=ao(Nl,n),w=Xu(n);return Yh(),i.jsx(Fu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:l,children:i.jsx(Ll,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:v,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:m,onDismiss:()=>y.onOpenChange(!1),children:i.jsx(rm,{"data-state":NT(y.open),role:"dialog",id:y.contentId,...w,...g,ref:t,style:{...g.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)"}})})})}),CT="PopoverClose",CY=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=ao(CT,n);return i.jsx(ze.button,{type:"button",...r,ref:t,onClick:Se(e.onClick,()=>o.onOpenChange(!1))})});CY.displayName=CT;var NY="PopoverArrow",kY=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Xu(n);return i.jsx(sm,{...o,...r,ref:t})});kY.displayName=NY;function NT(e){return e?"open":"closed"}var _Y=vT,EY=bT,TY=wT,MY=ST;function Tu({...e}){return i.jsx(_Y,{"data-slot":"popover",...e})}function Mu({...e}){return i.jsx(EY,{"data-slot":"popover-trigger",...e})}function Ru({className:e,align:t="center",sideOffset:n=4,...r}){return i.jsx(TY,{children:i.jsx(MY,{"data-slot":"popover-content",align:t,sideOffset:n,className:W("bg-popover text-popover-foreground 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 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...r})})}const RY=[{keys:["⌘","S"],description:"Save entry"},{keys:["⌘","⇧","P"],description:"Publish entry"},{keys:["⌘","K"],description:"Quick search"},{keys:["Esc"],description:"Close modal/panel"}],AY=[{label:"Documentation",url:"https://docs.convex.dev",icon:z3},{label:"API Reference",url:"https://docs.convex.dev/api",icon:ak},{label:"Community Discord",url:"https://discord.gg/convex",icon:a5}],OY={"/":"Dashboard","/content":"Content","/media":"Media Library","/content-types":"Content Types","/settings":"Settings","/taxonomies":"Taxonomies","/trash":"Trash","/entries":"Entries","/entries/type":"Content Types","/entries/new":"New Entry"};function DY(e,t,n){const r=[{label:t,to:"/"}],o=decodeURIComponent(e);if(o==="/")return r;const l=o.split("/").filter(Boolean);let u="";return l.forEach((d,h)=>{u+=`/${d}`;const m=h===l.length-1;let v=n.get(u)??OY[u];v||(v=d.charAt(0).toUpperCase()+d.slice(1).replace(/-/g," ")),m?r.push({label:v}):r.push({label:v,to:u})}),r}function zY(){const e=$n(),t=Xa(),{branding:n}=Vh();let r=new Map;try{r=e_().overrides}catch{}const o=DY(e.location.pathname,n.appName,r);let l=null,u=null,d=async()=>{},h=!1;try{const j=vy();l=j.user,u=j.role,d=j.logout,h=j.isAuthenticated}catch{}const v=(u?wL(u):null)?.displayName??u??"No Role",g=l?.name??l?.email??"User",y=j=>{const N=j.split(" ");return N.length>=2?`${N[0][0]}${N[1][0]}`.toUpperCase():j.slice(0,2).toUpperCase()},w=l?.name?y(l.name):"U",S=async()=>{await d()};return i.jsxs("header",{className:"sticky top-0 z-40 flex h-14 items-center justify-between border-b border-border bg-background/95 px-6 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(eq,{className:"md:hidden"}),i.jsx(wh,{orientation:"vertical",className:"mr-2 data-[orientation=vertical]:h-4 md:hidden"})]}),i.jsx(jV,{children:i.jsx(CV,{children:o.map((j,N)=>i.jsxs(p.Fragment,{children:[N>0&&i.jsx(EV,{}),i.jsx(NV,{children:j.to?i.jsx(kV,{asChild:!0,children:i.jsxs(Ss,{to:j.to,className:"flex items-center gap-1.5",children:[N===0&&i.jsx($h,{className:"size-3.5"}),i.jsx("span",{children:j.label})]})}):i.jsx(_V,{children:j.label})})]},N))})}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs(Tu,{children:[i.jsx(Mu,{asChild:!0,children:i.jsxs(Je,{variant:"ghost",size:"icon",className:"size-9",children:[i.jsx(nx,{className:"size-4"}),i.jsx("span",{className:"sr-only",children:"Notifications"})]})}),i.jsxs(Ru,{align:"end",className:"w-80",children:[i.jsx("div",{className:"flex items-center justify-between pb-2",children:i.jsx("h4",{className:"font-medium",children:"Notifications"})}),i.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[i.jsx(nx,{className:"size-8 text-muted-foreground/50"}),i.jsx("p",{className:"mt-2 text-sm font-medium",children:"No notifications yet"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"You're all caught up!"})]})]})]}),i.jsxs(Tu,{children:[i.jsx(Mu,{asChild:!0,children:i.jsxs(Je,{variant:"ghost",size:"icon",className:"size-9",children:[i.jsx(sk,{className:"size-4"}),i.jsx("span",{className:"sr-only",children:"Help"})]})}),i.jsxs(Ru,{align:"end",className:"w-72",children:[i.jsx("div",{className:"pb-2",children:i.jsx("h4",{className:"font-medium",children:"Help & Resources"})}),i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("div",{children:[i.jsx("h5",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Keyboard Shortcuts"}),i.jsx("div",{className:"flex flex-col gap-1",children:RY.map((j,N)=>i.jsxs("div",{className:"flex items-center justify-between text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:j.description}),i.jsx("div",{className:"flex gap-0.5",children:j.keys.map((C,_)=>i.jsx("kbd",{className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-xs",children:C},_))})]},N))})]}),i.jsxs("div",{children:[i.jsx("h5",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Resources"}),i.jsx("div",{className:"flex flex-col gap-1",children:AY.map(j=>i.jsxs("a",{href:j.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-accent",children:[i.jsx(j.icon,{className:"size-4 text-muted-foreground"}),i.jsx("span",{className:"flex-1",children:j.label}),i.jsx(uP,{className:"size-3 text-muted-foreground"})]},j.label))})]})]})]})]}),i.jsxs(Sl,{children:[i.jsx(jl,{asChild:!0,children:i.jsxs(Je,{variant:"ghost",className:"h-9 gap-2 pl-2 pr-3",children:[i.jsxs(mY,{className:"size-6",children:[i.jsx(pY,{src:l?.avatarUrl,alt:g}),i.jsx(gY,{className:"text-xs",children:w})]}),i.jsx("span",{className:"text-sm font-medium",children:g}),i.jsx(vn,{className:"size-3.5 text-muted-foreground"})]})}),i.jsxs(Cl,{align:"end",className:"w-56",children:[i.jsx(cT,{className:"font-normal",children:i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("p",{className:"text-sm font-medium",children:g}),l?.email&&i.jsx("p",{className:"text-xs text-muted-foreground",children:l.email}),i.jsx("p",{className:"text-xs text-muted-foreground",children:v})]})}),i.jsx(Yo,{}),i.jsxs(pn,{onClick:()=>t({to:"/settings"}),children:[i.jsx(fk,{className:"mr-2 size-4"}),i.jsx("span",{children:"Profile & Settings"})]}),h&&i.jsxs(i.Fragment,{children:[i.jsx(Yo,{}),i.jsxs(pn,{onClick:S,className:"text-destructive focus:text-destructive",children:[i.jsx(JP,{className:"mr-2 size-4"}),i.jsx("span",{children:"Logout"})]})]})]})]})]})]})}function PY({children:e}){const{layout:t}=Vh();return i.jsxs(X7,{defaultOpen:!0,style:{"--sidebar-width":`${t.sidebarWidth}px`},children:[i.jsx(aV,{}),i.jsxs(tq,{children:[i.jsx(zY,{}),i.jsx("div",{className:"flex-1 overflow-auto p-3 md:p-6",children:e})]})]})}function LY(){return i.jsx("div",{className:"route-guard route-guard--loading bg-background flex items-center justify-center min-h-screen",children:i.jsx(vu,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function IY(){return i.jsxs("div",{className:"route-guard route-guard--unauthenticated",children:[i.jsx("div",{className:"route-guard-icon",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),i.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}),i.jsx("h2",{children:"Authentication Required"}),i.jsx("p",{children:"Please log in to access the admin panel."})]})}function Mv({requiredRole:e,requiredPermission:t}){return i.jsxs("div",{className:"route-guard route-guard--unauthorized",children:[i.jsx("div",{className:"route-guard-icon",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("line",{x1:"4.93",y1:"4.93",x2:"19.07",y2:"19.07"})]})}),i.jsx("h2",{children:"Access Denied"}),i.jsx("p",{children:"You don't have permission to access this page."}),e&&i.jsxs("p",{className:"route-guard-detail",children:["Required role: ",i.jsx("strong",{children:e})]}),t&&i.jsxs("p",{className:"route-guard-detail",children:["Required permission:"," ",i.jsxs("strong",{children:[t.action," on ",t.resource]})]})]})}function $Y({error:e}){return i.jsxs("div",{className:"route-guard route-guard--error",children:[i.jsx("div",{className:"route-guard-icon",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),i.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}),i.jsx("h2",{children:"Authentication Error"}),i.jsx("p",{children:e})]})}function Mh({children:e,requiredPermission:t,requiredRole:n,loadingComponent:r,unauthenticatedComponent:o,unauthorizedComponent:l,onUnauthenticated:u,onUnauthorized:d}){const{authState:h,role:m,checkPermission:v,error:g}=vy();return h==="loading"?i.jsx(i.Fragment,{children:r??i.jsx(LY,{})}):h==="error"?i.jsx($Y,{error:g??"An error occurred"}):h==="unauthenticated"?(u?.(),i.jsx(i.Fragment,{children:o??i.jsx(IY,{})})):m?n&&m!==n?(d?.(),i.jsx(i.Fragment,{children:l??i.jsx(Mv,{requiredRole:n,requiredPermission:t})})):t&&!v(t)?(d?.(),i.jsx(i.Fragment,{children:l??i.jsx(Mv,{requiredRole:n,requiredPermission:t})})):i.jsx(i.Fragment,{children:e}):(d?.(),i.jsx(i.Fragment,{children:l??i.jsx(Mv,{requiredRole:n,requiredPermission:t})}))}function Rv(e){if(e===0)return"0 B";const t=1024,n=["B","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(1))} ${n[r]}`}function FY(e,t){return t.length===0?!0:t.some(n=>{if(n.endsWith("/*")){const r=n.slice(0,-2);return e.startsWith(r+"/")}return e===n})}function kT({onUploadComplete:e,currentFolderId:t,generateUploadUrl:n,createAsset:r,maxFileSize:o,allowedMimeTypes:l=[],maxConcurrentUploads:u=3,onError:d}){const[h,m]=p.useState(!1),[v,g]=p.useState(new Map),y=p.useRef(null),w=SV({getUploadUrl:n,createAsset:r,maxConcurrent:u,metadata:t?{parentId:t}:void 0,onComplete:z=>{const B=z.map(V=>({filename:V.file.name,storageId:V.result?String(V.result._id||""):"",success:V.status==="complete",error:V.error}));e(B)},onError:z=>{d?.(z.error||"Upload failed",z.file.name)}}),S=p.useCallback(z=>o&&z.size>o?`File exceeds maximum size of ${Rv(o)}`:l.length>0&&!FY(z.type,l)?`File type ${z.type||"unknown"} is not allowed`:null,[o,l]),j=p.useCallback(z=>{const B=Array.from(z),V=new Map,Y=[];for(const G of B){const ae=S(G);ae?V.set(G.name,ae):Y.push(G)}g(V),Y.length>0&&w.addFiles(Y)},[S,w]),N=p.useRef(0),C=p.useCallback(z=>{z.preventDefault(),z.stopPropagation(),N.current++,m(!0)},[]),_=p.useCallback(z=>{z.preventDefault(),z.stopPropagation(),N.current--,N.current===0&&m(!1)},[]),E=p.useCallback(z=>{z.preventDefault(),z.stopPropagation()},[]),M=p.useCallback(z=>{z.preventDefault(),z.stopPropagation(),N.current=0,m(!1),z.dataTransfer.files?.length&&j(z.dataTransfer.files)},[j]),A=p.useCallback(z=>{z.target.files?.length&&(j(z.target.files),z.target.value="")},[j]),R=z=>{switch(z){case"complete":return i.jsx(Ms,{className:"size-4 text-success"});case"error":case"cancelled":return i.jsx(At,{className:"size-4 text-destructive"});case"uploading":return i.jsx("div",{className:"size-4 animate-spin rounded-full border-2 border-muted border-t-primary"});default:return i.jsx("div",{className:"size-4 rounded-full border-2 border-muted"})}},T=w.files.filter(z=>z.status==="complete").length,O=w.files.filter(z=>z.status==="error"||z.status==="cancelled").length,D=T>0||O>0;return i.jsxs("div",{className:"flex flex-col gap-4",children:[v.size>0&&i.jsxs("div",{className:"rounded-md border border-destructive/50 bg-destructive/10 p-3",children:[i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx($u,{className:"mt-0.5 size-4 shrink-0 text-destructive"}),i.jsx("div",{className:"flex flex-col gap-1 flex-1",children:Array.from(v.entries()).map(([z,B])=>i.jsxs("p",{className:"text-sm text-destructive",children:[i.jsxs("span",{className:"font-medium",children:[z,":"]})," ",B]},z))})]}),i.jsx(me,{variant:"ghost",size:"sm",className:"mt-2",onClick:()=>g(new Map),children:"Dismiss"})]}),!w.isUploading&&w.files.length===0&&i.jsxs("div",{className:W("flex cursor-pointer flex-col items-center justify-center gap-3 rounded-lg border-2 border-dashed p-8 text-center transition-colors",h?"border-primary bg-primary/5":"border-muted-foreground/25 hover:border-primary/50 hover:bg-muted/50"),onClick:()=>y.current?.click(),onDragEnter:C,onDragLeave:_,onDragOver:E,onDrop:M,children:[i.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:i.jsx(sy,{className:"size-6 text-muted-foreground"})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium text-foreground",children:h?"Drop files here":"Drag and drop files here"}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"or click to browse"})]}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Supports images, videos, documents, and more",o&&` (max ${Rv(o)} per file)`]})]}),w.files.length>0&&i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsxs("span",{className:"font-medium",children:[w.files.length," file",w.files.length!==1?"s":""]}),w.isUploading&&i.jsxs("span",{className:"text-muted-foreground",children:[w.overallProgress,"% complete"]}),!w.isUploading&&D&&i.jsxs("div",{className:"flex items-center gap-2",children:[T>0&&i.jsxs("span",{className:"text-success",children:[T," completed"]}),O>0&&i.jsxs("span",{className:"text-destructive",children:[O," failed"]})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[!w.isUploading&&i.jsx(me,{variant:"outline",size:"sm",onClick:()=>y.current?.click(),children:"Add More"}),w.isUploading&&i.jsx(me,{variant:"outline",size:"sm",onClick:w.cancelAll,children:"Cancel All"}),D&&!w.isUploading&&i.jsx(me,{variant:"ghost",size:"sm",onClick:w.clearCompleted,children:"Clear Done"})]})]}),w.isUploading&&i.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:i.jsx("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${w.overallProgress}%`}})}),i.jsx("div",{className:"flex max-h-64 flex-col gap-2 overflow-y-auto",children:w.files.map(z=>i.jsxs("div",{className:W("flex items-center gap-3 rounded-lg border bg-card p-3",z.status==="error"&&"border-diff-removed-border bg-diff-removed-bg",z.status==="complete"&&"border-diff-added-border bg-diff-added-bg"),children:[i.jsx("div",{className:"shrink-0",children:R(z.status)}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"truncate text-sm font-medium",title:z.file.name,children:z.file.name}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:Rv(z.file.size)}),z.error&&i.jsx("span",{className:"text-xs text-destructive",children:z.error})]})]}),z.status==="uploading"&&i.jsxs("div",{className:"flex w-20 items-center gap-2",children:[i.jsx("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-muted",children:i.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${z.progress}%`}})}),i.jsxs("span",{className:"text-xs text-muted-foreground",children:[z.progress,"%"]})]}),i.jsxs("div",{className:"shrink-0",children:[z.status==="pending"&&!w.isUploading&&i.jsx(me,{variant:"ghost",size:"icon-sm",onClick:()=>w.cancelFile(z.id),title:"Remove",children:i.jsx(At,{className:"size-4"})}),(z.status==="uploading"||z.status==="pending")&&w.isUploading&&i.jsx(me,{variant:"ghost",size:"icon-sm",onClick:()=>w.cancelFile(z.id),title:"Cancel",children:i.jsx(At,{className:"size-4"})}),(z.status==="error"||z.status==="cancelled")&&!w.isUploading&&i.jsx(me,{variant:"ghost",size:"icon-sm",onClick:()=>w.retryFile(z.id),title:"Retry",children:i.jsx(ey,{className:"size-4"})})]})]},z.id))})]}),i.jsx("input",{ref:y,type:"file",multiple:!0,onChange:A,className:"hidden",accept:l.length>0?l.join(","):void 0})]})}const BY=Symbol.for("functionName");function UY(e){return new Proxy({},{get(t,n){return{[BY]:`${e}:${n}`}}})}const Cn=UY("admin");function qY(){return window.__CMS_CONFIG__?window.__CMS_CONFIG__:{convexUrl:"",authMode:"demo"}}function gm(){const{role:e}=vy();return p.useMemo(()=>{const t=!!e,n=(N,C,_)=>e?pk(e,{resource:N,action:C,scope:_}):!1;return{role:e,hasRole:t,check:n,canAccess:N=>e?SL(e,N):!1,canCreate:N=>n(N,"create"),canRead:(N,C)=>n(N,"read",C),canUpdate:(N,C)=>n(N,"update",C),canDelete:(N,C)=>n(N,"delete",C),canPublish:N=>n("contentEntries","publish",N),canUnpublish:N=>n("contentEntries","unpublish",N),canManageSettings:()=>n("settings","manage"),canManageContentTypes:()=>n("contentTypes","create")||n("contentTypes","update")||n("contentTypes","delete"),getPermissions:N=>e?gk(e,N):[],isAdmin:e==="admin",isEditor:e==="admin"||e==="editor",isAuthor:e==="admin"||e==="editor"||e==="author"}},[e])}function db(e,t){const{setOverride:n,clearOverride:r}=e_();p.useEffect(()=>(t&&n(e,t),()=>{r(e)}),[e,t,n,r])}function _T(e){const t=xn(),n=e?.taxonomyId,r=e?.taxonomyName??n,o=He(t.listTaxonomies,r?{isActive:!0}:"skip");return r?o?.page?.find(u=>u.name===r)?._id??n??null:null}const VY={publish:{title:"Publish Items",description:"This will publish all selected items, making them publicly visible.",confirmLabel:"Publish All",confirmVariant:"success"},unpublish:{title:"Unpublish Items",description:"This will unpublish all selected items, changing them back to draft status.",confirmLabel:"Unpublish All",confirmVariant:"warning"},delete:{title:"Delete Items",description:"This will move all selected items to trash.",warning:"Items in trash can be restored within the retention period.",confirmLabel:"Delete All",confirmVariant:"danger"},archive:{title:"Archive Items",description:"This will archive all selected items.",confirmLabel:"Archive All",confirmVariant:"secondary"}};function HY({action:e,count:t,isProcessing:n,result:r,onConfirm:o,onCancel:l}){const u=VY[e];return i.jsx(ls,{open:!0,onOpenChange:d=>!d&&!n&&l(),title:u.title,size:"sm",footer:r?i.jsx(me,{variant:"primary",onClick:l,children:r.failed===0?"Done":"Close"}):i.jsxs(i.Fragment,{children:[i.jsx(me,{variant:"outline",onClick:l,disabled:n,children:"Cancel"}),i.jsx(me,{variant:u.confirmVariant,onClick:o,loading:n,children:u.confirmLabel})]}),children:r?i.jsx("div",{className:"flex flex-col gap-4",children:r.failed===0?i.jsxs("div",{className:"flex flex-col items-center gap-3 py-4 text-center",children:[i.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-diff-added-bg text-diff-added",children:i.jsx(Yx,{className:"size-6"})}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:["Successfully processed"," ",i.jsx("span",{className:"font-semibold text-foreground",children:r.succeeded})," ",r.succeeded===1?"item":"items"]})]}):i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"diff-added rounded-lg border p-3 text-center",children:[i.jsx("p",{className:"text-2xl font-semibold text-diff-added",children:r.succeeded}),i.jsx("p",{className:"text-xs text-diff-added-foreground",children:"Succeeded"})]}),i.jsxs("div",{className:"diff-removed rounded-lg border p-3 text-center",children:[i.jsx("p",{className:"text-2xl font-semibold text-diff-removed",children:r.failed}),i.jsx("p",{className:"text-xs text-diff-removed-foreground",children:"Failed"})]})]}),r.errors&&r.errors.length>0&&i.jsxs("div",{className:"diff-modified rounded-lg border p-3",children:[i.jsx("p",{className:"mb-2 text-sm font-medium text-diff-modified",children:"Errors:"}),i.jsxs("ul",{className:"flex flex-col gap-1 text-xs text-diff-modified-foreground",children:[r.errors.slice(0,5).map((d,h)=>i.jsxs("li",{className:"truncate",children:["• ",d]},h)),r.errors.length>5&&i.jsxs("li",{className:"text-diff-modified-foreground/80",children:["...and ",r.errors.length-5," more errors"]})]})]})]})}):i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsxs("p",{className:"text-sm text-muted-foreground",children:["You are about to ",e," ",i.jsxs("span",{className:"font-semibold text-foreground",children:[t," ",t===1?"item":"items"]}),"."]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:u.description}),u.warning&&i.jsxs("div",{className:"diff-modified flex items-start gap-2 rounded-lg border p-3",children:[i.jsx(Fo,{className:"mt-0.5 size-4 shrink-0 text-diff-modified"}),i.jsxs("p",{className:"text-sm",children:[i.jsx("span",{className:"font-medium",children:"Note:"})," ",u.warning]})]})]})})}const YY=Ko("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function xt({className:e,variant:t,asChild:n=!1,...r}){const o=n?Pl:"span";return i.jsx(o,{"data-slot":"badge",className:W(YY({variant:t}),e),...r})}function WY({selectedIds:e,onClearSelection:t,onOperationComplete:n}){const r=xn(),[o,l]=p.useState(null),[u,d]=p.useState(!1),[h,m]=p.useState(null),v=et(r.bulkPublish),g=et(r.bulkUnpublish),y=et(r.bulkDelete),w=et(r.bulkUpdate),S=p.useCallback(C=>{l(C),m(null)},[]),j=p.useCallback(async()=>{if(!(!o||e.length===0)){d(!0),m(null);try{let C;switch(o){case"publish":C=await v({ids:e,changeDescription:"Bulk published from admin"});break;case"unpublish":C=await g({ids:e});break;case"delete":C=await y({ids:e,hardDelete:!1});break;case"archive":C=await w({ids:e,status:"archived"});break;default:throw new Error(`Unknown action: ${o}`)}m({succeeded:C.succeeded,failed:C.failed,errors:C.errors?.map(_=>`${_.id}: ${_.error}`)}),C.failed===0&&setTimeout(()=>{l(null),t(),n?.()},1500)}catch(C){const _=C instanceof Error?C.message:"Operation failed";m({succeeded:0,failed:e.length,errors:[_]})}finally{d(!1)}}},[o,e,v,g,y,w,t,n]),N=p.useCallback(()=>{l(null),m(null)},[]);return e.length===0?null:i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-x-0 bottom-0 z-50 border-t bg-background/95 px-6 py-3 shadow-lg backdrop-blur supports-[backdrop-filter]:bg-background/80",children:i.jsxs("div",{className:"mx-auto flex max-w-7xl items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(xt,{variant:"secondary",className:"text-sm font-semibold",children:e.length}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:[e.length===1?"item":"items"," selected"]}),i.jsxs("button",{type:"button",onClick:t,className:"flex items-center gap-1 text-sm text-muted-foreground transition-colors hover:text-foreground",children:[i.jsx(At,{className:"size-3"}),"Clear"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(me,{variant:"success",size:"sm",onClick:()=>S("publish"),children:"Publish"}),i.jsx(me,{variant:"warning",size:"sm",onClick:()=>S("unpublish"),children:"Unpublish"}),i.jsx(me,{variant:"secondary",size:"sm",onClick:()=>S("archive"),children:"Archive"}),i.jsx(me,{variant:"danger",size:"sm",onClick:()=>S("delete"),children:"Delete"})]})]})}),o&&i.jsx(HY,{action:o,count:e.length,isProcessing:u,result:h,onConfirm:j,onCancel:N})]})}const GY={base:"surface-base",elevated:"surface-elevated",floating:"surface-floating"},ZY={none:"",sm:"p-3",md:"p-4",lg:"p-6"},QY={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg"};function xr({elevation:e="base",padding:t="md",rounded:n="lg",className:r,children:o,...l}){return i.jsx("div",{className:W(GY[e],ZY[t],QY[n],r),...l,children:o})}const KY={draft:{label:"Draft",className:"status-draft",icon:i.jsx("svg",{className:"size-3",fill:"currentColor",viewBox:"0 0 8 8",children:i.jsx("circle",{cx:"4",cy:"4",r:"3"})})},published:{label:"Published",className:"status-published",icon:i.jsx("svg",{className:"size-3",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})},scheduled:{label:"Scheduled",className:"status-scheduled",icon:i.jsxs("svg",{className:"size-3",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("path",{strokeLinecap:"round",d:"M12 6v6l4 2"})]})},archived:{label:"Archived",className:"status-archived",icon:i.jsx("svg",{className:"size-3",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4"})})}},PC={gray:"bg-muted text-muted-foreground",yellow:"bg-diff-modified-bg text-diff-modified-foreground",blue:"bg-info-bg text-info-foreground",green:"bg-diff-added-bg text-diff-added-foreground",red:"bg-diff-removed-bg text-diff-removed-foreground",purple:"bg-purple-bg text-purple-foreground",orange:"bg-diff-modified-bg text-diff-modified-foreground"};function LC(){return i.jsx("svg",{className:"size-3",fill:"currentColor",viewBox:"0 0 8 8",children:i.jsx("circle",{cx:"4",cy:"4",r:"3"})})}function Vl({status:e,customConfig:t,className:n,...r}){if(t)return i.jsxs(xt,{variant:"secondary",className:W("gap-1.5 px-2 py-0.5 text-xs font-medium",PC[t.color],n),...r,children:[LC(),t.displayName]});const o=KY[e];return o?i.jsxs(xt,{variant:"secondary",className:W("gap-1.5 px-2 py-0.5 text-xs font-medium",o.className,n),...r,children:[o.icon,o.label]}):i.jsxs(xt,{variant:"secondary",className:W("gap-1.5 px-2 py-0.5 text-xs font-medium",PC.gray,n),...r,children:[LC(),e]})}function Bn({icon:e,title:t,description:n,action:r,className:o,...l}){return i.jsxs("div",{className:W("flex flex-col items-center justify-center py-12 text-center",o),...l,children:[e&&i.jsx("div",{className:"mb-4 flex size-12 items-center justify-center rounded-full bg-muted text-muted-foreground",children:e}),i.jsx("h3",{className:"text-base font-semibold text-foreground",children:t}),n&&i.jsx("p",{className:"mt-1 max-w-sm text-sm text-muted-foreground",children:n}),r&&i.jsx(me,{variant:r.variant??"primary",onClick:r.onClick,className:"mt-4",children:r.label})]})}function as({title:e,description:t,actions:n,breadcrumbs:r,className:o,...l}){return i.jsxs("div",{className:W("mb-6",o),...l,children:[r&&i.jsx("div",{className:"mb-2",children:r}),i.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground sm:text-2xl",children:e}),t&&i.jsx("p",{className:"text-sm text-muted-foreground",children:t})]}),n&&i.jsx("div",{className:"flex items-center gap-2",children:n})]})]})}function XY({left:e,right:t,search:n,filters:r,actions:o,className:l,children:u,...d}){return i.jsxs("div",{className:W("flex flex-wrap items-center justify-between gap-3 pb-4",l),...d,children:[i.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[n&&i.jsxs("div",{className:"relative w-full max-w-xs",children:[i.jsx(Al,{className:"absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),i.jsx(mt,{type:"search",placeholder:n.placeholder??"Search...",value:n.value,onChange:h=>n.onChange(h.target.value),className:"pl-9"})]}),r,e,u]}),(t||o)&&i.jsx("div",{className:"flex items-center gap-2",children:t??o})]})}function JY({className:e,...t}){return i.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:i.jsx("table",{"data-slot":"table",className:W("w-full caption-bottom text-sm",e),...t})})}function eW({className:e,...t}){return i.jsx("thead",{"data-slot":"table-header",className:W("[&_tr]:border-b",e),...t})}function tW({className:e,...t}){return i.jsx("tbody",{"data-slot":"table-body",className:W("[&_tr:last-child]:border-0",e),...t})}function Av({className:e,...t}){return i.jsx("tr",{"data-slot":"table-row",className:W("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function IC({className:e,...t}){return i.jsx("th",{"data-slot":"table-head",className:W("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function Ov({className:e,...t}){return i.jsx("td",{"data-slot":"table-cell",className:W("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function fb({columns:e,data:t,getRowId:n,selectable:r,selectedIds:o=new Set,onSelectionChange:l,sortColumn:u,sortDirection:d,onSort:h,onRowClick:m,emptyMessage:v="No items found",className:g}){const y=t.length>0&&t.every(C=>o.has(n(C))),w=t.some(C=>o.has(n(C))),S=C=>{l&&l(C?new Set(t.map(n)):new Set)},j=(C,_)=>{if(!l)return;const E=new Set(o);_?E.add(C):E.delete(C),l(E)},N=C=>C.sortable?u!==C.key?i.jsx(Y3,{className:"ml-1 inline size-3.5 text-muted-foreground"}):d==="asc"?i.jsx(Iu,{className:"ml-1 inline size-3.5"}):i.jsx(vn,{className:"ml-1 inline size-3.5"}):null;return i.jsx("div",{className:W("rounded-lg border",g),children:i.jsxs(JY,{children:[i.jsx(eW,{children:i.jsxs(Av,{className:"hover:bg-transparent",children:[r&&i.jsx(IC,{className:"w-12",children:i.jsx(wr,{checked:y?!0:w?"indeterminate":!1,onCheckedChange:S,"aria-label":"Select all"})}),e.map(C=>i.jsxs(IC,{className:W(C.sortable&&"cursor-pointer select-none",C.className),onClick:()=>C.sortable&&h?.(C.key),children:[C.header,N(C)]},C.key))]})}),i.jsx(tW,{children:t.length===0?i.jsx(Av,{children:i.jsx(Ov,{colSpan:e.length+(r?1:0),className:"h-24 text-center text-muted-foreground",children:v})}):t.map(C=>{const _=n(C),E=o.has(_);return i.jsxs(Av,{"data-state":E&&"selected",className:W(m&&"cursor-pointer"),onClick:()=>m?.(C),children:[r&&i.jsx(Ov,{onClick:M=>M.stopPropagation(),className:"w-12",children:i.jsx(wr,{checked:E,onCheckedChange:M=>j(_,M===!0),"aria-label":`Select row ${_}`})}),e.map(M=>i.jsx(Ov,{className:M.className,children:M.cell(C)},M.key))]},_)})})]})})}const nW=p.forwardRef(({className:e,error:t,...n},r)=>i.jsx(mt,{ref:r,className:W(t&&"border-destructive focus-visible:ring-destructive",e),"aria-invalid":t,...n}));nW.displayName="CmsInput";function rW({value:e,onValueChange:t,options:n,placeholder:r="Select...",disabled:o,error:l,className:u}){return i.jsxs(ia,{value:e,onValueChange:t,disabled:o,children:[i.jsx(ca,{className:W(l&&"border-destructive focus:ring-destructive",u),"aria-invalid":l,children:i.jsx(la,{placeholder:r})}),i.jsx(ua,{children:n.map(d=>i.jsx(Xt,{value:d.value,disabled:d.disabled,children:d.label},d.value))})]})}function vm({className:e,...t}){return i.jsx("div",{"data-slot":"input-group",role:"group",className:W("group/input-group relative flex w-full items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none dark:bg-input/30","h-9 min-w-0 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50","has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}const sW=Ko("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]","block-start":"order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5 [.border-b]:pb-3","block-end":"order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5 [.border-t]:pt-3"}},defaultVariants:{align:"inline-start"}});function kl({className:e,align:t="inline-start",...n}){return i.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:W(sW({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}function _l({className:e,...t}){return i.jsx("span",{className:W("flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",e),...t})}function xm({className:e,...t}){return i.jsx(mt,{"data-slot":"input-group-control",className:W("flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",e),...t})}function ym({search:e,filters:t,actions:n,onClearFilters:r,hasActiveFilters:o,className:l}){return i.jsxs("div",{className:W("flex flex-wrap items-center gap-3 pb-4",l),children:[i.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[e&&i.jsxs(vm,{className:W("w-full max-w-xs",e.className),children:[i.jsx(kl,{align:"inline-start",children:i.jsx(_l,{children:i.jsx(Al,{})})}),i.jsx(xm,{type:"search",placeholder:e.placeholder??"Search...",value:e.value,onChange:u=>e.onChange(u.target.value)})]}),t?.map(u=>i.jsx(rW,{value:u.value,onValueChange:u.onChange,options:u.options,placeholder:u.placeholder,className:W("w-[150px]",u.className)},u.key)),o&&r&&i.jsxs(me,{variant:"ghost",size:"sm",onClick:r,children:[i.jsx(At,{className:"mr-1 size-4"}),"Clear"]})]}),n&&i.jsx("div",{className:"flex items-center gap-2",children:n})]})}function Pf({title:e,value:t,description:n,icon:r,trend:o,onClick:l,isLoading:u,className:d}){const h=i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:e}),u?i.jsx("div",{className:"h-8 w-16 animate-pulse rounded bg-muted"}):i.jsx("p",{className:"text-2xl font-semibold text-foreground",children:t}),n&&i.jsx("p",{className:"text-xs text-muted-foreground",children:n})]}),r&&i.jsx("div",{className:"flex size-10 items-center justify-center rounded-lg bg-primary/10 text-primary",children:r})]}),o&&!u&&i.jsxs("div",{className:W("mt-2 text-xs font-medium",o.value>=0?"text-diff-added-foreground":"text-diff-removed-foreground"),children:[o.value>=0?"+":"",o.value,"% ",o.label]})]});return l?i.jsx("button",{type:"button",onClick:l,className:W("text-left w-full cursor-pointer transition-colors hover:bg-accent/50",d),children:i.jsx(xr,{elevation:"base",padding:"md",className:"h-full",children:h})}):i.jsx(xr,{elevation:"base",padding:"md",className:W("h-full",d),children:h})}function aW({api:e,navigation:t}){const[n,r]=p.useState(""),[o,l]=p.useState(""),[u,d]=p.useState(""),[h,m]=p.useState(new Set),{canCreate:v,canUpdate:g}=gm();p.useEffect(()=>{const D=t.params?.contentTypeId;if(D){const z=D.startsWith("code:")?D.slice(5):D;r(z)}else r("")},[t.params?.contentTypeId]);const y=He(e.listContentTypes,{isActive:!0}),w=y?.page??[],S=y===void 0,j=He(e.listEntries,{contentTypeName:n||void 0,status:o||void 0,search:u.trim()||void 0,paginationOpts:{numItems:50,cursor:null}}),N=j?.page??[],_=S||j===void 0,E=D=>{t.navigateToNewEntry(D)},M=D=>w.find(B=>B.name===D)?.displayName??D,A=(D,z)=>{const V=w.find(G=>G.name===z)?.titleField??"title",Y=D.data[V];return typeof Y=="string"&&Y?Y:"Untitled"},R=D=>new Date(D).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),T=p.useCallback(()=>{m(new Set)},[]),O=p.useMemo(()=>[{key:"title",header:"Title",cell:D=>i.jsxs("button",{type:"button",onClick:()=>t.navigateToEntry(D._id),className:"block text-left",children:[i.jsx("span",{className:"font-medium text-foreground hover:text-primary",children:A(D,D.contentTypeName)}),i.jsx("span",{className:"block text-xs text-muted-foreground",children:D.slug})]})},{key:"type",header:"Type",cell:D=>i.jsx("span",{className:"text-sm text-muted-foreground",children:M(D.contentTypeName)})},{key:"status",header:"Status",cell:D=>i.jsx(Vl,{status:D.status})},{key:"updated",header:"Updated",cell:D=>i.jsx("span",{className:"text-sm text-muted-foreground",children:R(D._creationTime)})},{key:"actions",header:"Actions",cell:D=>i.jsx(me,{variant:"outline",size:"sm",onClick:()=>t.navigateToEntry(D._id),children:g("contentEntries")?"Edit":"View"})}],[t,w,g]);return _?i.jsxs("div",{className:"flex flex-col gap-4 md:gap-6",children:[i.jsx(as,{title:"Content",description:"Browse and manage content entries across all content types."}),i.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[i.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),i.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading content..."})]})]}):i.jsxs("div",{className:"flex flex-col gap-4 md:gap-6",children:[i.jsx(as,{title:"Content",description:"Browse and manage content entries across all content types."}),i.jsx(ym,{search:{value:u,onChange:d,placeholder:"Search content...",className:"w-full md:w-64"},filters:[{key:"contentType",value:n||"all",onChange:D=>r(D==="all"?"":D),options:[{value:"all",label:"All Content Types"},...w.map(D=>({value:D._id,label:D.displayName}))],className:"w-full sm:w-48"},{key:"status",value:o||"all",onChange:D=>l(D==="all"?"":D),options:[{value:"all",label:"All Statuses"},{value:"draft",label:"Draft"},{value:"published",label:"Published"},{value:"scheduled",label:"Scheduled"},{value:"archived",label:"Archived"}],className:"w-full sm:w-36"}],actions:v("contentEntries")&&i.jsxs(Sl,{children:[i.jsx(jl,{asChild:!0,children:i.jsxs(me,{disabled:w.length===0,children:[i.jsx(Un,{className:"size-4"}),"Create Entry",i.jsx(vn,{className:"size-4"})]})}),i.jsx(Cl,{align:"end",children:w.map(D=>i.jsx(pn,{onClick:()=>E(D._id),children:D.displayName},D._id))})]})}),i.jsx(WY,{selectedIds:Array.from(h),onClearSelection:T,onOperationComplete:T}),N.length===0?i.jsx(Bn,{icon:i.jsx(Sr,{className:"size-6"}),title:"No content entries yet",description:w.length===0?"Create a content type first, then start adding content entries.":'Click "Create Entry" to add your first content entry.'}):i.jsx(fb,{columns:O,data:N,getRowId:D=>D._id,selectable:!0,selectedIds:h,onSelectionChange:m,emptyMessage:"No content entries found"})]})}const oW={text:i.jsx(ny,{className:"size-3"}),richText:i.jsx(ch,{className:"size-3"}),number:i.jsx(Qx,{className:"size-3"}),boolean:i.jsx(ry,{className:"size-3"}),date:i.jsx(pl,{className:"size-3"}),datetime:i.jsx(pl,{className:"size-3"}),reference:i.jsx(pu,{className:"size-3"}),media:i.jsx(ns,{className:"size-3"}),json:i.jsx(Vx,{className:"size-3"}),select:i.jsx(vn,{className:"size-3"}),multiSelect:i.jsx(gu,{className:"size-3"}),tags:i.jsx(Po,{className:"size-3"}),category:i.jsx(Zx,{className:"size-3"})};function iW({api:e,navigation:t}){const[n,r]=p.useState(""),[o,l]=p.useState("grid"),[u,d]=p.useState(!0),[h,m]=p.useState(!1),[v,g]=p.useState(null),y=p.useCallback(()=>{m(!1)},[]),w=p.useCallback(()=>{g(null)},[]),S=He(e.listContentTypes,{isActive:u?!0:void 0,includeEntryCounts:!0}),j=S?.page??[],N=S===void 0,C=p.useMemo(()=>{if(!n.trim())return j;const A=n.toLowerCase();return j.filter(R=>R.name.toLowerCase().includes(A)||R.displayName.toLowerCase().includes(A))},[j,n]),_=A=>new Date(A).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),E=A=>{const T=Date.now()-A,O=Math.floor(T/1e3),D=Math.floor(O/60),z=Math.floor(D/60),B=Math.floor(z/24);return B>30?_(A):B>0?`${B}d ago`:z>0?`${z}h ago`:D>0?`${D}m ago`:"Just now"},M=p.useMemo(()=>[{key:"name",header:"Name",cell:A=>i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"font-medium text-foreground",children:A.displayName}),i.jsx("p",{className:"text-xs text-muted-foreground",children:A.name})]})},{key:"fields",header:"Fields",cell:A=>i.jsx("span",{className:"text-sm text-muted-foreground",children:A.fields.length})},{key:"entries",header:"Entries",cell:A=>i.jsx("span",{className:"text-sm text-muted-foreground",children:A.entryCount??0})},{key:"status",header:"Status",cell:A=>i.jsxs("div",{className:"flex items-center gap-1.5",children:[A.source==="code"&&i.jsxs(xt,{variant:"secondary",className:"border-violet-200 bg-violet-50 text-xs font-normal text-violet-700",title:"Managed by code",children:[i.jsx(rx,{className:"mr-1 size-3"}),"Code"]}),i.jsx(xt,{variant:A.isActive?"default":"secondary",className:W("text-xs font-normal",A.isActive&&"border-diff-added-border bg-diff-added-bg text-diff-added-foreground"),children:A.isActive?"Active":"Inactive"}),A.singleton&&i.jsx(xt,{variant:"secondary",className:"border-diff-modified-border bg-diff-modified-bg text-xs font-normal text-diff-modified-foreground",children:"Singleton"})]})},{key:"updated",header:"Last Updated",cell:A=>i.jsx("span",{className:"text-sm text-muted-foreground",children:_(A._creationTime)})},{key:"actions",header:"Actions",cell:A=>i.jsxs("div",{className:"flex items-center gap-2",children:[A.source==="code"?i.jsxs(me,{variant:"outline",size:"sm",onClick:()=>g(A),title:"View content type (managed by code)",children:[i.jsx(lh,{className:"size-3.5"}),"View"]}):i.jsxs(me,{variant:"outline",size:"sm",onClick:()=>g(A),children:[i.jsx(fa,{className:"size-3.5"}),"Edit"]}),i.jsx(me,{variant:"outline",size:"sm",onClick:()=>t.navigateToContentType(A._id),children:"View Entries"})]})}],[t,_,g]);return i.jsxs("div",{className:"flex flex-col gap-4 md:gap-6",children:[i.jsx(as,{title:"Content Types",description:"Define the structure of your content with custom fields and validation rules."}),i.jsx(ym,{search:{value:n,onChange:r,placeholder:"Search content types...",className:"w-full md:w-64"},actions:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-sm",children:[i.jsx(wr,{checked:u,onCheckedChange:A=>d(A)}),"Active only"]}),i.jsxs("div",{className:"flex rounded-md border bg-muted/30",children:[i.jsx("button",{className:W("rounded-l-md p-2 transition-colors",o==="grid"?"bg-background shadow-sm":"hover:bg-muted/50"),onClick:()=>l("grid"),title:"Grid view","aria-label":"Grid view",children:i.jsx(RP,{className:"size-4"})}),i.jsx("button",{className:W("rounded-r-md p-2 transition-colors",o==="list"?"bg-background shadow-sm":"hover:bg-muted/50"),onClick:()=>l("list"),title:"List view","aria-label":"List view",children:i.jsx(gu,{className:"size-4"})})]}),i.jsxs(me,{onClick:()=>m(!0),"data-testid":"create-content-type-button",children:[i.jsx(Un,{className:"size-4"}),"Create Content Type"]})]})}),N?i.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[i.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),i.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading content types..."})]}):C.length===0?i.jsx(Bn,{icon:i.jsx(ch,{className:"size-6"}),title:n?"No content types match your search":"No content types defined",description:n?"Try adjusting your search query or filters.":"Content types define the schema for your content. Create one to get started."}):o==="grid"?i.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:C.map(A=>i.jsxs("div",{className:"group flex flex-col rounded-lg border bg-card p-4 transition-all hover:border-primary/50 hover:shadow-md",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[i.jsx("div",{className:"flex size-10 items-center justify-center rounded-md bg-muted text-muted-foreground",children:i.jsx(ch,{className:"size-5"})}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[A.source==="code"&&i.jsxs(xt,{variant:"secondary",className:"border-violet-200 bg-violet-50 text-xs font-normal text-violet-700",title:"Managed by code - edit in your codebase",children:[i.jsx(rx,{className:"mr-1 size-3"}),"Code"]}),!A.isActive&&i.jsx(xt,{variant:"secondary",className:"text-xs font-normal",children:"Inactive"}),A.singleton&&i.jsx(xt,{variant:"secondary",className:"border-diff-modified-border bg-diff-modified-bg text-xs font-normal text-diff-modified-foreground",children:"Singleton"}),A.source==="code"?i.jsx("button",{className:"rounded p-1.5 text-muted-foreground opacity-0 transition-all hover:bg-muted hover:text-foreground group-hover:opacity-100",title:"View content type (managed by code)","aria-label":"View content type",onClick:()=>g(A),children:i.jsx(lh,{className:"size-4"})}):i.jsx("button",{onClick:()=>g(A),className:"rounded p-1.5 text-muted-foreground opacity-0 transition-all hover:bg-muted hover:text-foreground group-hover:opacity-100",title:"Edit content type","aria-label":"Edit content type",children:i.jsx(fa,{className:"size-4"})})]})]}),i.jsxs("button",{type:"button",onClick:()=>t.navigateToContentType(A._id),className:"flex flex-1 flex-col text-left",children:[i.jsx("h3",{className:"text-base font-semibold text-foreground",children:A.displayName}),i.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:A.name}),i.jsxs("div",{className:"mt-3 flex items-center gap-4",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("p",{className:"text-lg font-semibold text-foreground",children:A.fields.length}),i.jsx("p",{className:"text-xs text-muted-foreground",children:A.fields.length===1?"Field":"Fields"})]}),i.jsxs("div",{className:"text-center",children:[i.jsx("p",{className:"text-lg font-semibold text-foreground",children:A.entryCount??0}),i.jsx("p",{className:"text-xs text-muted-foreground",children:A.entryCount===1?"Entry":"Entries"})]})]}),i.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[A.fields.slice(0,4).map(R=>i.jsxs("span",{className:"flex items-center gap-1 rounded-md bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",title:R.label,children:[oW[R.type]||i.jsx(ny,{className:"size-3"}),i.jsx("span",{className:"truncate",children:R.label})]},R.name)),A.fields.length>4&&i.jsxs("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:["+",A.fields.length-4," more"]})]}),i.jsxs("p",{className:"mt-auto pt-3 text-xs text-muted-foreground",children:["Updated ",E(A._creationTime)]})]})]},A._id))}):i.jsx(fb,{columns:M,data:C,getRowId:A=>A._id,emptyMessage:"No content types found"}),!N&&C.length>0&&i.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["Showing ",C.length," of ",j.length," content type",j.length!==1?"s":""]}),i.jsx(bE,{isOpen:h||!!v,onClose:()=>{m(!1),g(null)},contentType:v,onCreated:y,onUpdated:w})]})}function Jc({className:e,...t}){return i.jsx("div",{"data-slot":"card",className:W("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Zf({className:e,...t}){return i.jsx("div",{"data-slot":"card-header",className:W("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function Qf({className:e,...t}){return i.jsx("div",{"data-slot":"card-title",className:W("leading-none font-semibold",e),...t})}function lW({className:e,...t}){return i.jsx("div",{"data-slot":"card-description",className:W("text-muted-foreground text-sm",e),...t})}function eu({className:e,...t}){return i.jsx("div",{"data-slot":"card-content",className:W("px-6",e),...t})}const cW=Ko("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function Au({className:e,variant:t,...n}){return i.jsx("div",{"data-slot":"alert",role:"alert",className:W(cW({variant:t}),e),...n})}function $C({className:e,...t}){return i.jsx("div",{"data-slot":"alert-title",className:W("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function Ou({className:e,...t}){return i.jsx("div",{"data-slot":"alert-description",className:W("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}function uW({api:e}){const t=He(e.checkSchemaDrift,{}),n=et(e.syncCodeDefinedTypes),[r,o]=p.useState(!1),[l,u]=p.useState(null);if(t===void 0)return null;if(!t||t.length===0)return l&&(l.created>0||l.updated>0||l.removedOrphans>0)?i.jsxs(Au,{className:"border-success/50 bg-success/10",children:[i.jsx($u,{className:"size-4 text-success"}),i.jsx($C,{className:"text-diff-added-foreground",children:"Sync Complete"}),i.jsxs(Ou,{className:"text-diff-added-foreground/80",children:[l.created>0&&i.jsxs("span",{children:[l.created," content type(s) created. "]}),l.updated>0&&i.jsxs("span",{children:[l.updated," content type(s) updated. "]}),l.removedOrphans>0&&i.jsxs("span",{children:[l.removedOrphans," orphaned type(s) removed."]})]})]}):null;const d=t.filter(w=>w.severity==="error"),h=t.filter(w=>w.severity==="warning"),m=async()=>{o(!0),u(null);try{const w=await n({});u(w)}catch(w){console.error("Sync failed:",w)}finally{o(!1)}},v=d.length>0?"destructive":"default",g=d.length>0?K3:Fo,y=d.length>0?"text-destructive":"text-warning";return i.jsxs(Au,{variant:v,className:d.length===0?"border-warning/50 bg-warning/10":"",children:[i.jsx(g,{className:`size-4 ${y}`}),i.jsx($C,{className:d.length===0?"text-diff-modified-foreground":"",children:"Schema Drift Detected"}),i.jsx(Ou,{className:d.length===0?"text-diff-modified-foreground/80":"",children:i.jsxs("div",{className:"flex flex-col gap-2",children:[d.length>0&&i.jsxs("p",{children:[i.jsxs("strong",{children:[d.length," error(s)"]}),":"," ",d.slice(0,3).map(w=>w.message).join(" "),d.length>3&&` ...and ${d.length-3} more`]}),h.length>0&&i.jsxs("p",{children:[i.jsxs("strong",{children:[h.length," warning(s)"]}),": Code-defined types may need syncing."]}),i.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[i.jsxs(Je,{size:"sm",variant:d.length>0?"destructive":"outline",onClick:m,disabled:r,className:d.length===0?"border-warning/50 text-diff-modified-foreground hover:bg-warning/20":"",children:[i.jsx(ey,{className:`mr-1.5 size-3.5 ${r?"animate-spin":""}`}),r?"Syncing...":"Sync Now"]}),i.jsx("span",{className:"text-xs opacity-75",children:"Syncs code-defined types to the database"})]})]})})]})}function dW({api:e,navigation:t}){const n=He(e.getDashboardStats,{}),r=n===void 0,o=n===null;return i.jsxs("div",{className:"flex flex-col gap-8",children:[i.jsx(as,{title:"Dashboard",description:"Welcome to Convex CMS Admin. Manage your content, media, and publishing workflows."}),i.jsx(uW,{api:e}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsx(Lf,{title:"Content Entries",description:"Create and manage your content",onClick:()=>t.navigate("/content"),icon:i.jsx(Sr,{className:"size-5"})}),i.jsx(Lf,{title:"Media Library",description:"Upload and organize media assets",onClick:()=>t.navigate("/media"),icon:i.jsx(ns,{className:"size-5"})}),i.jsx(Lf,{title:"Content Types",description:"Define content schemas and fields",onClick:()=>t.navigate("/content-types"),icon:i.jsx(Kx,{className:"size-5"})}),i.jsx(Lf,{title:"Settings",description:"Configure CMS settings",onClick:()=>t.navigate("/settings"),icon:i.jsx(dk,{className:"size-5"})})]}),i.jsxs("section",{className:"flex flex-col gap-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(q5,{className:"size-5 text-muted-foreground"}),i.jsx("h2",{className:"text-lg font-semibold",children:"Quick Stats"})]}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsx(Pf,{title:"Content Types",value:o?"—":String(n?.contentTypes??0),isLoading:r}),i.jsx(Pf,{title:"Content Entries",value:o?"—":String(n?.contentEntries??0),isLoading:r}),i.jsx(Pf,{title:"Media Assets",value:o?"—":String(n?.mediaAssets??0),isLoading:r}),i.jsx(Pf,{title:"Published",value:o?"—":String(n?.published??0),isLoading:r})]})]})]})}function Lf({title:e,description:t,onClick:n,icon:r}){return i.jsx("button",{type:"button",onClick:n,className:"text-left",children:i.jsxs(Jc,{className:"h-full transition-colors hover:border-primary/75 hover:cursor-pointer",children:[i.jsxs(Zf,{className:"pb-2",children:[i.jsx("div",{className:"mb-2 flex size-10 items-center justify-center rounded-lg bg-primary/5 text-primary",children:r}),i.jsx(Qf,{className:"text-base",children:e})]}),i.jsx(eu,{children:i.jsx(lW,{children:t})})]})})}var FC=1,fW=.9,hW=.8,mW=.17,Dv=.1,zv=.999,pW=.9999,gW=.99,vW=/[\\\/_+.#"@\[\(\{&]/,xW=/[\\\/_+.#"@\[\(\{&]/g,yW=/[\s-]/,ET=/[\s-]/g;function Nx(e,t,n,r,o,l,u){if(l===t.length)return o===e.length?FC:gW;var d=`${o},${l}`;if(u[d]!==void 0)return u[d];for(var h=r.charAt(l),m=n.indexOf(h,o),v=0,g,y,w,S;m>=0;)g=Nx(e,t,n,r,m+1,l+1,u),g>v&&(m===o?g*=FC:vW.test(e.charAt(m-1))?(g*=hW,w=e.slice(o,m-1).match(xW),w&&o>0&&(g*=Math.pow(zv,w.length))):yW.test(e.charAt(m-1))?(g*=fW,S=e.slice(o,m-1).match(ET),S&&o>0&&(g*=Math.pow(zv,S.length))):(g*=mW,o>0&&(g*=Math.pow(zv,m-o))),e.charAt(m)!==t.charAt(l)&&(g*=pW)),(g<Dv&&n.charAt(m-1)===r.charAt(l+1)||r.charAt(l+1)===r.charAt(l)&&n.charAt(m-1)!==r.charAt(l))&&(y=Nx(e,t,n,r,m+1,l+2,u),y*Dv>g&&(g=y*Dv)),g>v&&(v=g),m=n.indexOf(h,m+1);return u[d]=v,v}function BC(e){return e.toLowerCase().replace(ET," ")}function bW(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Nx(e,t,BC(e),BC(t),0,0,{})}var qc='[cmdk-group=""]',Pv='[cmdk-group-items=""]',wW='[cmdk-group-heading=""]',TT='[cmdk-item=""]',UC=`${TT}:not([aria-disabled="true"])`,kx="cmdk-item-select",Qi="data-value",SW=(e,t,n)=>bW(e,t,n),MT=p.createContext(void 0),Ju=()=>p.useContext(MT),RT=p.createContext(void 0),hb=()=>p.useContext(RT),AT=p.createContext(void 0),OT=p.forwardRef((e,t)=>{let n=Ki(()=>{var F,K;return{search:"",value:(K=(F=e.value)!=null?F:e.defaultValue)!=null?K:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Ki(()=>new Set),o=Ki(()=>new Map),l=Ki(()=>new Map),u=Ki(()=>new Set),d=DT(e),{label:h,children:m,value:v,onValueChange:g,filter:y,shouldFilter:w,loop:S,disablePointerSelection:j=!1,vimBindings:N=!0,...C}=e,_=gn(),E=gn(),M=gn(),A=p.useRef(null),R=OW();Wo(()=>{if(v!==void 0){let F=v.trim();n.current.value=F,T.emit()}},[v]),Wo(()=>{R(6,Y)},[]);let T=p.useMemo(()=>({subscribe:F=>(u.current.add(F),()=>u.current.delete(F)),snapshot:()=>n.current,setState:(F,K,ne)=>{var X,ue,te,ye;if(!Object.is(n.current[F],K)){if(n.current[F]=K,F==="search")V(),z(),R(1,B);else if(F==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Ce=document.getElementById(M);Ce?Ce.focus():(X=document.getElementById(_))==null||X.focus()}if(R(7,()=>{var Ce;n.current.selectedItemId=(Ce=G())==null?void 0:Ce.id,T.emit()}),ne||R(5,Y),((ue=d.current)==null?void 0:ue.value)!==void 0){let Ce=K??"";(ye=(te=d.current).onValueChange)==null||ye.call(te,Ce);return}}T.emit()}},emit:()=>{u.current.forEach(F=>F())}}),[]),O=p.useMemo(()=>({value:(F,K,ne)=>{var X;K!==((X=l.current.get(F))==null?void 0:X.value)&&(l.current.set(F,{value:K,keywords:ne}),n.current.filtered.items.set(F,D(K,ne)),R(2,()=>{z(),T.emit()}))},item:(F,K)=>(r.current.add(F),K&&(o.current.has(K)?o.current.get(K).add(F):o.current.set(K,new Set([F]))),R(3,()=>{V(),z(),n.current.value||B(),T.emit()}),()=>{l.current.delete(F),r.current.delete(F),n.current.filtered.items.delete(F);let ne=G();R(4,()=>{V(),ne?.getAttribute("id")===F&&B(),T.emit()})}),group:F=>(o.current.has(F)||o.current.set(F,new Set),()=>{l.current.delete(F),o.current.delete(F)}),filter:()=>d.current.shouldFilter,label:h||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:_,inputId:M,labelId:E,listInnerRef:A}),[]);function D(F,K){var ne,X;let ue=(X=(ne=d.current)==null?void 0:ne.filter)!=null?X:SW;return F?ue(F,n.current.search,K):0}function z(){if(!n.current.search||d.current.shouldFilter===!1)return;let F=n.current.filtered.items,K=[];n.current.filtered.groups.forEach(X=>{let ue=o.current.get(X),te=0;ue.forEach(ye=>{let Ce=F.get(ye);te=Math.max(Ce,te)}),K.push([X,te])});let ne=A.current;ae().sort((X,ue)=>{var te,ye;let Ce=X.getAttribute("id"),_e=ue.getAttribute("id");return((te=F.get(_e))!=null?te:0)-((ye=F.get(Ce))!=null?ye:0)}).forEach(X=>{let ue=X.closest(Pv);ue?ue.appendChild(X.parentElement===ue?X:X.closest(`${Pv} > *`)):ne.appendChild(X.parentElement===ne?X:X.closest(`${Pv} > *`))}),K.sort((X,ue)=>ue[1]-X[1]).forEach(X=>{var ue;let te=(ue=A.current)==null?void 0:ue.querySelector(`${qc}[${Qi}="${encodeURIComponent(X[0])}"]`);te?.parentElement.appendChild(te)})}function B(){let F=ae().find(ne=>ne.getAttribute("aria-disabled")!=="true"),K=F?.getAttribute(Qi);T.setState("value",K||void 0)}function V(){var F,K,ne,X;if(!n.current.search||d.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let ue=0;for(let te of r.current){let ye=(K=(F=l.current.get(te))==null?void 0:F.value)!=null?K:"",Ce=(X=(ne=l.current.get(te))==null?void 0:ne.keywords)!=null?X:[],_e=D(ye,Ce);n.current.filtered.items.set(te,_e),_e>0&&ue++}for(let[te,ye]of o.current)for(let Ce of ye)if(n.current.filtered.items.get(Ce)>0){n.current.filtered.groups.add(te);break}n.current.filtered.count=ue}function Y(){var F,K,ne;let X=G();X&&(((F=X.parentElement)==null?void 0:F.firstChild)===X&&((ne=(K=X.closest(qc))==null?void 0:K.querySelector(wW))==null||ne.scrollIntoView({block:"nearest"})),X.scrollIntoView({block:"nearest"}))}function G(){var F;return(F=A.current)==null?void 0:F.querySelector(`${TT}[aria-selected="true"]`)}function ae(){var F;return Array.from(((F=A.current)==null?void 0:F.querySelectorAll(UC))||[])}function L(F){let K=ae()[F];K&&T.setState("value",K.getAttribute(Qi))}function $(F){var K;let ne=G(),X=ae(),ue=X.findIndex(ye=>ye===ne),te=X[ue+F];(K=d.current)!=null&&K.loop&&(te=ue+F<0?X[X.length-1]:ue+F===X.length?X[0]:X[ue+F]),te&&T.setState("value",te.getAttribute(Qi))}function U(F){let K=G(),ne=K?.closest(qc),X;for(;ne&&!X;)ne=F>0?RW(ne,qc):AW(ne,qc),X=ne?.querySelector(UC);X?T.setState("value",X.getAttribute(Qi)):$(F)}let H=()=>L(ae().length-1),le=F=>{F.preventDefault(),F.metaKey?H():F.altKey?U(1):$(1)},I=F=>{F.preventDefault(),F.metaKey?L(0):F.altKey?U(-1):$(-1)};return p.createElement(sr.div,{ref:t,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:F=>{var K;(K=C.onKeyDown)==null||K.call(C,F);let ne=F.nativeEvent.isComposing||F.keyCode===229;if(!(F.defaultPrevented||ne))switch(F.key){case"n":case"j":{N&&F.ctrlKey&&le(F);break}case"ArrowDown":{le(F);break}case"p":case"k":{N&&F.ctrlKey&&I(F);break}case"ArrowUp":{I(F);break}case"Home":{F.preventDefault(),L(0);break}case"End":{F.preventDefault(),H();break}case"Enter":{F.preventDefault();let X=G();if(X){let ue=new Event(kx);X.dispatchEvent(ue)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:O.inputId,id:O.labelId,style:zW},h),bm(e,F=>p.createElement(RT.Provider,{value:T},p.createElement(MT.Provider,{value:O},F))))}),jW=p.forwardRef((e,t)=>{var n,r;let o=gn(),l=p.useRef(null),u=p.useContext(AT),d=Ju(),h=DT(e),m=(r=(n=h.current)==null?void 0:n.forceMount)!=null?r:u?.forceMount;Wo(()=>{if(!m)return d.item(o,u?.id)},[m]);let v=zT(o,l,[e.value,e.children,l],e.keywords),g=hb(),y=Ka(R=>R.value&&R.value===v.current),w=Ka(R=>m||d.filter()===!1?!0:R.search?R.filtered.items.get(o)>0:!0);p.useEffect(()=>{let R=l.current;if(!(!R||e.disabled))return R.addEventListener(kx,S),()=>R.removeEventListener(kx,S)},[w,e.onSelect,e.disabled]);function S(){var R,T;j(),(T=(R=h.current).onSelect)==null||T.call(R,v.current)}function j(){g.setState("value",v.current,!0)}if(!w)return null;let{disabled:N,value:C,onSelect:_,forceMount:E,keywords:M,...A}=e;return p.createElement(sr.div,{ref:Es(l,t),...A,id:o,"cmdk-item":"",role:"option","aria-disabled":!!N,"aria-selected":!!y,"data-disabled":!!N,"data-selected":!!y,onPointerMove:N||d.getDisablePointerSelection()?void 0:j,onClick:N?void 0:S},e.children)}),CW=p.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...l}=e,u=gn(),d=p.useRef(null),h=p.useRef(null),m=gn(),v=Ju(),g=Ka(w=>o||v.filter()===!1?!0:w.search?w.filtered.groups.has(u):!0);Wo(()=>v.group(u),[]),zT(u,d,[e.value,e.heading,h]);let y=p.useMemo(()=>({id:u,forceMount:o}),[o]);return p.createElement(sr.div,{ref:Es(d,t),...l,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},n&&p.createElement("div",{ref:h,"cmdk-group-heading":"","aria-hidden":!0,id:m},n),bm(e,w=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?m:void 0},p.createElement(AT.Provider,{value:y},w))))}),NW=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=p.useRef(null),l=Ka(u=>!u.search);return!n&&!l?null:p.createElement(sr.div,{ref:Es(o,t),...r,"cmdk-separator":"",role:"separator"})}),kW=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,l=hb(),u=Ka(m=>m.search),d=Ka(m=>m.selectedItemId),h=Ju();return p.useEffect(()=>{e.value!=null&&l.setState("search",e.value)},[e.value]),p.createElement(sr.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,"aria-activedescendant":d,id:h.inputId,type:"text",value:o?e.value:u,onChange:m=>{o||l.setState("search",m.target.value),n?.(m.target.value)}})}),_W=p.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,l=p.useRef(null),u=p.useRef(null),d=Ka(m=>m.selectedItemId),h=Ju();return p.useEffect(()=>{if(u.current&&l.current){let m=u.current,v=l.current,g,y=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let w=m.offsetHeight;v.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return y.observe(m),()=>{cancelAnimationFrame(g),y.unobserve(m)}}},[]),p.createElement(sr.div,{ref:Es(l,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":r,id:h.listId},bm(e,m=>p.createElement("div",{ref:Es(u,h.listInnerRef),"cmdk-list-sizer":""},m)))}),EW=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:l,container:u,...d}=e;return p.createElement(Uu,{open:n,onOpenChange:r},p.createElement(qu,{container:u},p.createElement(Vu,{"cmdk-overlay":"",className:o}),p.createElement(Hu,{"aria-label":e.label,"cmdk-dialog":"",className:l},p.createElement(OT,{ref:t,...d}))))}),TW=p.forwardRef((e,t)=>Ka(n=>n.filtered.count===0)?p.createElement(sr.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),MW=p.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...l}=e;return p.createElement(sr.div,{ref:t,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},bm(e,u=>p.createElement("div",{"aria-hidden":!0},u)))}),ei=Object.assign(OT,{List:_W,Item:jW,Input:kW,Group:CW,Separator:NW,Dialog:EW,Empty:TW,Loading:MW});function RW(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function AW(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function DT(e){let t=p.useRef(e);return Wo(()=>{t.current=e}),t}var Wo=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Ki(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function Ka(e){let t=hb(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function zT(e,t,n,r=[]){let o=p.useRef(),l=Ju();return Wo(()=>{var u;let d=(()=>{var m;for(let v of n){if(typeof v=="string")return v.trim();if(typeof v=="object"&&"current"in v)return v.current?(m=v.current.textContent)==null?void 0:m.trim():o.current}})(),h=r.map(m=>m.trim());l.value(e,d,h),(u=t.current)==null||u.setAttribute(Qi,d),o.current=d}),o}var OW=()=>{let[e,t]=p.useState(),n=Ki(()=>new Map);return Wo(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function DW(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function bm({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(DW(t),{ref:t.ref},n(t.props.children)):n(t)}var zW={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function PT({className:e,...t}){return i.jsx(ei,{"data-slot":"command",className:W("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function LT({className:e,...t}){return i.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[i.jsx(Al,{className:"size-4 shrink-0 opacity-50"}),i.jsx(ei.Input,{"data-slot":"command-input",className:W("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function IT({className:e,...t}){return i.jsx(ei.List,{"data-slot":"command-list",className:W("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function $T({...e}){return i.jsx(ei.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function FT({className:e,...t}){return i.jsx(ei.Group,{"data-slot":"command-group",className:W("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function PW({className:e,...t}){return i.jsx(ei.Separator,{"data-slot":"command-separator",className:W("bg-border -mx-1 h-px",e),...t})}function BT({className:e,...t}){return i.jsx(ei.Item,{"data-slot":"command-item",className:W("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function UT({selectedTermIds:e,onChange:t,taxonomyId:n,placeholder:r="Filter by tags...",disabled:o=!1,className:l}){const u=xn(),[d,h]=p.useState(!1),[m,v]=p.useState(""),g=He(u.listTaxonomies,{isActive:!0}),y=g?.page??[],w=p.useMemo(()=>n?y.find(D=>D._id===n):null,[n,y]),S=n??y[0]?._id,j=He(u.listTerms,S?{taxonomyId:S,paginationOpts:{numItems:200,cursor:null}}:"skip"),N=j?.page??[],C=p.useMemo(()=>N.filter(D=>e.includes(D._id)),[N,e]),_=p.useMemo(()=>{if(!m.trim())return N;const D=m.toLowerCase();return N.filter(z=>z.name.toLowerCase().includes(D))},[N,m]),E=p.useCallback(D=>{e.includes(D)?t(e.filter(z=>z!==D)):t([...e,D])},[e,t]),M=p.useCallback(()=>{t([]),h(!1)},[t]),A=p.useCallback((D,z)=>{z.stopPropagation(),t(e.filter(B=>B!==D))},[e,t]),R=w?.displayName??y[0]?.displayName??"Tags",T=g===void 0||!!S&&j===void 0;return y.length===0&&g!==void 0?null:i.jsxs(Tu,{open:d,onOpenChange:h,children:[i.jsx(Mu,{asChild:!0,children:i.jsxs(me,{variant:"outline",role:"combobox","aria-expanded":d,disabled:o||T,className:W("h-9 min-w-[140px] justify-between gap-2",e.length>0&&"border-primary/50",l),children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ty,{className:"size-4 text-muted-foreground"}),e.length===0?i.jsx("span",{className:"text-muted-foreground",children:r}):e.length===1?i.jsx("span",{className:"max-w-[100px] truncate",children:C[0]?.name??"Tag"}):i.jsxs("span",{children:[e.length," tags"]})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[e.length>0&&i.jsx(xt,{variant:"secondary",className:"size-5 rounded-full p-0 text-xs",children:e.length}),i.jsx(vn,{className:"size-4 text-muted-foreground"})]})]})}),i.jsx(Ru,{className:"w-[280px] p-0",align:"start",children:i.jsxs(PT,{shouldFilter:!1,children:[i.jsx(LT,{placeholder:`Search ${R.toLowerCase()}...`,value:m,onValueChange:v}),i.jsx(IT,{children:_.length===0?i.jsx($T,{children:N.length===0?`No ${R.toLowerCase()} found`:"No matches"}):i.jsx(FT,{heading:R,children:_.map(D=>i.jsx(LW,{term:D,isSelected:e.includes(D._id),onToggle:()=>E(D._id)},D._id))})}),e.length>0&&i.jsxs(i.Fragment,{children:[i.jsx(PW,{}),i.jsxs("div",{className:"p-2",children:[i.jsx("div",{className:"mb-2 flex flex-wrap gap-1",children:C.map(D=>i.jsxs(xt,{variant:"secondary",className:"gap-1 pr-1",style:D.color?{backgroundColor:D.color,color:"#fff"}:void 0,children:[D.name,i.jsx("button",{type:"button",className:"ml-0.5 rounded-full p-0.5 hover:bg-black/10",onClick:z=>A(D._id,z),"aria-label":`Remove ${D.name}`,children:i.jsx(At,{className:"size-3"})})]},D._id))}),i.jsx(me,{variant:"ghost",size:"sm",className:"w-full",onClick:M,children:"Clear all filters"})]})]})]})})]})}function LW({term:e,isSelected:t,onToggle:n}){return i.jsxs(BT,{onSelect:n,className:"cursor-pointer",children:[i.jsx(wr,{checked:t,className:"mr-2","aria-hidden":"true",tabIndex:-1}),e.color&&i.jsx("span",{className:"size-2.5 shrink-0 rounded-full",style:{backgroundColor:e.color}}),i.jsx("span",{className:"flex-1 truncate",children:e.name}),i.jsx("span",{className:"text-xs text-muted-foreground",children:e.usageCount}),t&&i.jsx(Ms,{className:"ml-1 size-4 text-primary"})]})}var IW=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),$W="VisuallyHidden",qT=p.forwardRef((e,t)=>i.jsx(sr.span,{...e,ref:t,style:{...IW,...e.style}}));qT.displayName=$W;function FW(e){return e?e.startsWith("image/")?"image":e.startsWith("video/")?"video":e.startsWith("audio/")?"audio":e==="application/pdf"||e.includes("document")||e.includes("sheet")||e.includes("presentation")||e.startsWith("text/")?"document":"other":"other"}function BW(e){if(!e||e===0)return"0 B";const t=1024,n=["B","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(1))} ${n[r]}`}function UW(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function qW(e,t="size-16"){const n={className:t};switch(e){case"image":return i.jsx(ns,{...n});case"video":return i.jsx(ay,{...n});case"audio":return i.jsx(Jx,{...n});case"document":return i.jsx(Sr,{...n});default:return i.jsx(Wx,{...n})}}function VW({asset:e,assets:t,currentIndex:n,open:r,onOpenChange:o,onNavigate:l,onEdit:u,onDelete:d}){const h=n>0,m=n<t.length-1,v=p.useCallback(()=>{h&&l(n-1)},[h,n,l]),g=p.useCallback(()=>{m&&l(n+1)},[m,n,l]),y=p.useCallback(_=>{if(r)switch(_.key){case"ArrowLeft":_.preventDefault(),v();break;case"ArrowRight":_.preventDefault(),g();break;case"Escape":_.preventDefault(),o(!1);break}},[r,v,g,o]);p.useEffect(()=>(window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)),[y]);const w=p.useCallback(()=>{if(!e?.url)return;const _=document.createElement("a");_.href=e.url,_.download=e.name,_.target="_blank",document.body.appendChild(_),_.click(),document.body.removeChild(_)},[e]),S=p.useCallback(async()=>{e?.url&&await navigator.clipboard.writeText(e.url)},[e]);if(!e)return null;const j=FW(e.mimeType),N=j==="image",C=!!e.url;return i.jsx(yl,{open:r,onOpenChange:o,children:i.jsxs(bl,{className:"flex h-[90vh] w-[95vw] max-w-[1400px] flex-col gap-0 overflow-hidden p-0 sm:max-w-[1400px]",showCloseButton:!1,children:[i.jsx(qT,{children:i.jsxs(wl,{children:["Preview: ",e.name]})}),i.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("h2",{className:"truncate text-lg font-semibold",title:e.name,children:e.name}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:[n+1," of ",t.length]})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(me,{variant:"ghost",size:"icon",onClick:S,disabled:!e.url,title:"Copy URL",children:i.jsx(ok,{className:"size-4"})}),i.jsx(me,{variant:"ghost",size:"icon",onClick:w,disabled:!e.url,title:"Download",children:i.jsx(sx,{className:"size-4"})}),u&&i.jsx(me,{variant:"ghost",size:"icon",onClick:()=>u(e),title:"Edit",children:i.jsx(fa,{className:"size-4"})}),d&&i.jsx(me,{variant:"ghost",size:"icon",onClick:()=>d(e),title:"Delete",className:"text-destructive hover:text-destructive",children:i.jsx(Fn,{className:"size-4"})}),i.jsx(me,{variant:"ghost",size:"icon",onClick:()=>o(!1),title:"Close (Esc)",children:i.jsx(At,{className:"size-4"})})]})]}),i.jsxs("div",{className:"flex min-h-0 flex-1",children:[i.jsxs("div",{className:"relative flex flex-1 items-center justify-center bg-zinc-950",children:[h&&i.jsx("button",{onClick:v,className:"absolute left-4 z-10 flex size-10 items-center justify-center rounded-full bg-black/50 text-white transition-colors hover:bg-black/70",title:"Previous (←)",children:i.jsx(Hx,{className:"size-6"})}),m&&i.jsx("button",{onClick:g,className:"absolute right-4 z-10 flex size-10 items-center justify-center rounded-full bg-black/50 text-white transition-colors hover:bg-black/70",title:"Next (→)",children:i.jsx(Rl,{className:"size-6"})}),N&&C?i.jsx("img",{src:e.url,alt:e.altText||e.title||e.name,className:"max-h-full max-w-full object-contain"}):i.jsxs("div",{className:"flex flex-col items-center gap-4 text-zinc-400",children:[qW(j),i.jsx("p",{className:"text-sm",children:N&&!C?"Image URL not available":"Preview not available for this file type"}),C&&i.jsxs(me,{variant:"secondary",onClick:w,children:[i.jsx(sx,{className:"mr-2 size-4"}),"Download to view"]})]})]}),i.jsx("div",{className:"w-72 shrink-0 overflow-y-auto border-l bg-background",children:i.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[i.jsx("h3",{className:"font-semibold",children:"File Information"}),i.jsx(ea,{label:"Filename",value:e.name}),e.title&&i.jsx(ea,{label:"Title",value:e.title}),e.description&&i.jsx(ea,{label:"Description",value:e.description}),e.altText&&i.jsx(ea,{label:"Alt Text",value:e.altText}),i.jsxs("div",{className:"border-t pt-4",children:[i.jsx(ea,{label:"Type",value:j,capitalize:!0}),e.mimeType&&i.jsx(ea,{label:"MIME Type",value:e.mimeType}),i.jsx(ea,{label:"Size",value:BW(e.size)}),e.width&&e.height&&i.jsx(ea,{label:"Dimensions",value:`${e.width} × ${e.height} px`})]}),i.jsx("div",{className:"border-t pt-4",children:i.jsx(ea,{label:"Uploaded",value:UW(e._creationTime)})}),e.tags&&e.tags.length>0&&i.jsxs("div",{className:"border-t pt-4",children:[i.jsx("p",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Tags"}),i.jsx("div",{className:"flex flex-wrap gap-1",children:e.tags.map(_=>i.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-xs",children:_},_))})]})]})})]})]})})}function ea({label:e,value:t,capitalize:n}){return i.jsxs("div",{className:"flex flex-col gap-0.5",children:[i.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e}),i.jsx("p",{className:W("break-words text-sm",n&&"capitalize"),children:t})]})}function HW({className:e,...t}){return i.jsx("fieldset",{"data-slot":"field-set",className:W("flex flex-col gap-6","has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",e),...t})}function YW({className:e,variant:t="legend",...n}){return i.jsx("legend",{"data-slot":"field-legend","data-variant":t,className:W("mb-3 font-medium","data-[variant=legend]:text-base","data-[variant=label]:text-sm",e),...n})}const WW=Ko("group/field flex w-full gap-3 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],horizontal:["flex-row items-center","[&>[data-slot=field-label]]:flex-auto","has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"],responsive:["flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto","@md/field-group:[&>[data-slot=field-label]]:flex-auto","@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"]}},defaultVariants:{orientation:"vertical"}});function bs({className:e,orientation:t="vertical",...n}){return i.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:W(WW({orientation:t}),e),...n})}function ws({className:e,...t}){return i.jsx(rt,{"data-slot":"field-label",className:W("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4","has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10",e),...t})}function Ro({className:e,...t}){return i.jsx("p",{"data-slot":"field-description",className:W("text-sm leading-normal font-normal text-muted-foreground group-has-[[data-orientation=horizontal]]/field:text-balance","last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5","[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function VT({className:e,children:t,errors:n,...r}){const o=p.useMemo(()=>{if(t)return t;if(!n?.length)return null;const l=[...new Map(n.map(u=>[u?.message,u])).values()];return l?.length==1?l[0]?.message:i.jsx("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:l.map((u,d)=>u?.message&&i.jsx("li",{children:u.message},d))})},[t,n]);return o?i.jsx("div",{role:"alert","data-slot":"field-error",className:W("text-sm font-normal text-destructive",e),...r,children:o}):null}function GW({mediaId:e,taxonomyId:t,taxonomyName:n="Tags",allowCreate:r=!0,disabled:o=!1,className:l=""}){const u=xn(),[d,h]=p.useState(""),[m,v]=p.useState(!1),[g,y]=p.useState(0),[w,S]=p.useState(!1),[j,N]=p.useState(!1),C=p.useRef(null),_=p.useRef(null),E=p.useRef(null),M=He(u.getTermsByMedia,{mediaId:e,taxonomyId:t}),A=M?.map(L=>L._id)??[],T=He(u.suggestTerms,{taxonomyId:t,query:d,limit:10,excludeIds:A})??[],O=et(u.setMediaTerms),D=et(u.createTermAndAddToMedia);p.useEffect(()=>{function L($){E.current&&!E.current.contains($.target)&&v(!1)}return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]);const z=p.useCallback(async L=>{if(!A.includes(L)){N(!0);try{await O({mediaId:e,taxonomyId:t,termIds:[...A,L]})}catch($){console.error("Failed to add tag:",$)}finally{N(!1),h(""),v(!1),y(0),C.current?.focus()}}},[e,t,A,O]),B=p.useCallback(async L=>{N(!0);try{await O({mediaId:e,taxonomyId:t,termIds:A.filter($=>$!==L)})}catch($){console.error("Failed to remove tag:",$)}finally{N(!1)}},[e,t,A,O]),V=p.useCallback(async()=>{if(!(!d.trim()||!r)){S(!0);try{await D({taxonomyId:t,name:d.trim(),mediaId:e}),h(""),v(!1),y(0)}catch(L){console.error("Failed to create tag:",L)}finally{S(!1)}}},[d,r,t,e,D]),Y=L=>{if(!o)switch(L.key){case"ArrowDown":L.preventDefault(),y($=>$<T.length-1?$+1:$);break;case"ArrowUp":L.preventDefault(),y($=>$>0?$-1:0);break;case"Enter":L.preventDefault(),T.length>0&&g<T.length?z(T[g]._id):d.trim()&&r&&V();break;case"Escape":v(!1);break;case"Backspace":d===""&&A.length>0&&B(A[A.length-1]);break}};p.useEffect(()=>{if(_.current&&m){const L=_.current.querySelector(`[data-index="${g}"]`);L&&L.scrollIntoView({block:"nearest"})}},[g,m]);const G=T.filter(L=>!A.includes(L._id)),ae=r&&d.trim()&&!G.some(L=>L.name.toLowerCase()===d.trim().toLowerCase());return i.jsxs("div",{className:W("flex flex-col gap-2",l),children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:[i.jsx(Po,{className:"size-4"}),n]}),i.jsxs("div",{ref:E,className:W("relative rounded-md border border-input bg-background",o&&"opacity-50"),children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-2",children:[(M??[]).map(L=>i.jsxs(xt,{variant:"secondary",className:"gap-1 pr-1",style:L.color?{backgroundColor:L.color,color:"#fff"}:void 0,children:[L.name,!o&&i.jsx(Je,{type:"button",variant:"ghost",size:"icon",className:"size-4 hover:bg-transparent",onClick:()=>B(L._id),disabled:j,"aria-label":`Remove ${L.name}`,children:i.jsx(At,{className:"size-3"})})]},L._id)),!o&&i.jsx(mt,{ref:C,type:"text",className:"h-7 min-w-[120px] flex-1 border-0 bg-transparent px-1 shadow-none focus-visible:ring-0",value:d,onChange:L=>{h(L.target.value),v(!0),y(0)},onFocus:()=>v(!0),onKeyDown:Y,placeholder:A.length===0?"Add tags...":"",disabled:o||w||j})]}),m&&(G.length>0||ae)&&i.jsxs("div",{ref:_,className:"absolute left-0 right-0 top-full z-50 mt-1 max-h-48 overflow-auto rounded-md border bg-popover shadow-lg",role:"listbox",children:[G.map((L,$)=>i.jsxs("div",{"data-index":$,className:W("flex cursor-pointer items-center gap-2 px-3 py-2 text-sm",$===g&&"bg-accent"),onClick:()=>z(L._id),role:"option","aria-selected":$===g,children:[L.color&&i.jsx("span",{className:"size-2.5 rounded-full",style:{backgroundColor:L.color}}),i.jsx("span",{className:"flex-1",children:L.name}),i.jsxs("span",{className:"text-xs text-muted-foreground",children:[L.usageCount," uses"]})]},L._id)),ae&&i.jsxs("div",{"data-index":G.length,className:W("flex cursor-pointer items-center gap-2 px-3 py-2 text-sm",G.length===g&&"bg-accent"),onClick:V,role:"option","aria-selected":G.length===g,children:[w?i.jsx(vu,{className:"size-4 animate-spin"}):i.jsx(Un,{className:"size-4"}),i.jsxs("span",{children:['Create "',d.trim(),'"']})]})]}),(j||w)&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/50",children:i.jsx(vu,{className:"size-4 animate-spin"})})]})]})}function ZW({asset:e,open:t,onOpenChange:n,onSaved:r}){const o=xn(),[l,u]=p.useState(""),[d,h]=p.useState(""),[m,v]=p.useState(""),[g,y]=p.useState(""),[w,S]=p.useState(""),[j,N]=p.useState(!1),[C,_]=p.useState(""),E=et(o.updateMediaAsset),A=He(o.listTaxonomies,{isActive:!0,paginationOpts:{numItems:50,cursor:null}})?.page??[];p.useEffect(()=>{e&&(u(e.name),h(e.title||""),v(e.description||""),y(e.altText||""),S(e.tags?.join(", ")||""),_(""))},[e]);const R=p.useCallback(async()=>{if(e){if(!l.trim()){_("Filename is required");return}N(!0),_("");try{const T=w.split(",").map(O=>O.trim()).filter(Boolean);await E({id:e._id,name:l.trim(),title:d.trim()||void 0,description:m.trim()||void 0,altText:g.trim()||void 0,tags:T.length>0?T:void 0}),r?.(),n(!1)}catch(T){_(T instanceof Error?T.message:"Failed to update asset")}finally{N(!1)}}},[e,l,d,m,g,w,E,r,n]);return e?i.jsx(ls,{open:t,onOpenChange:n,title:"Edit File",size:"md",footer:i.jsxs(i.Fragment,{children:[i.jsx(me,{variant:"outline",onClick:()=>n(!1),disabled:j,children:"Cancel"}),i.jsx(me,{onClick:R,loading:j,children:"Save Changes"})]}),children:i.jsxs("div",{className:"flex flex-col gap-4",children:[C&&i.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive",children:C}),i.jsxs(bs,{children:[i.jsxs(ws,{htmlFor:"asset-name",children:["Filename",i.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),i.jsx(mt,{id:"asset-name",value:l,onChange:T=>u(T.target.value),placeholder:"Enter filename"})]}),i.jsxs(bs,{children:[i.jsx(ws,{htmlFor:"asset-title",children:"Title"}),i.jsx(mt,{id:"asset-title",value:d,onChange:T=>h(T.target.value),placeholder:"Enter title (optional)"}),i.jsx(Ro,{children:"A human-readable title for the file"})]}),i.jsxs(bs,{children:[i.jsx(ws,{htmlFor:"asset-description",children:"Description"}),i.jsx(no,{id:"asset-description",value:m,onChange:T=>v(T.target.value),placeholder:"Enter description (optional)",rows:3}),i.jsx(Ro,{children:"A brief description of the file"})]}),i.jsxs(bs,{children:[i.jsx(ws,{htmlFor:"asset-alt",children:"Alt Text"}),i.jsx(mt,{id:"asset-alt",value:g,onChange:T=>y(T.target.value),placeholder:"Describe the image content"}),i.jsx(Ro,{children:"Alternative text for accessibility (important for images)"})]}),i.jsxs(bs,{children:[i.jsx(ws,{htmlFor:"asset-tags",children:"Quick Tags"}),i.jsx(mt,{id:"asset-tags",value:w,onChange:T=>S(T.target.value),placeholder:"e.g., hero, blog, product"}),i.jsx(Ro,{children:"Comma-separated tags for simple organization"})]}),A.length>0&&e&&i.jsxs("div",{className:"flex flex-col gap-4 border-t pt-2",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"Organize with taxonomy terms"}),A.map(T=>i.jsx(GW,{mediaId:e._id,taxonomyId:T._id,taxonomyName:T.displayName,allowCreate:T.allowInlineCreation,disabled:j},T._id))]})]})}):null}function QW({folder:e,open:t,onOpenChange:n,onSaved:r}){const o=xn(),[l,u]=p.useState(""),[d,h]=p.useState(""),[m,v]=p.useState(!1),[g,y]=p.useState(""),w=et(o.updateMediaFolder);p.useEffect(()=>{e&&(u(e.name),h(e.description||""),y(""))},[e]);const S=p.useCallback(async()=>{if(e){if(!l.trim()){y("Folder name is required");return}v(!0),y("");try{await w({id:e._id,name:l.trim(),description:d.trim()||void 0}),r?.(),n(!1)}catch(j){y(j instanceof Error?j.message:"Failed to update folder")}finally{v(!1)}}},[e,l,d,w,r,n]);return e?i.jsx(ls,{open:t,onOpenChange:n,title:"Edit Folder",size:"sm",footer:i.jsxs(i.Fragment,{children:[i.jsx(me,{variant:"outline",onClick:()=>n(!1),disabled:m,children:"Cancel"}),i.jsx(me,{onClick:S,loading:m,children:"Save Changes"})]}),children:i.jsxs("div",{className:"flex flex-col gap-4",children:[g&&i.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive",children:g}),i.jsxs(bs,{children:[i.jsxs(ws,{htmlFor:"folder-name",children:["Folder Name",i.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),i.jsx(mt,{id:"folder-name",value:l,onChange:j=>u(j.target.value),placeholder:"Enter folder name"})]}),i.jsxs(bs,{children:[i.jsx(ws,{htmlFor:"folder-description",children:"Description"}),i.jsx(no,{id:"folder-description",value:d,onChange:j=>h(j.target.value),placeholder:"Enter description (optional)",rows:3}),i.jsx(Ro,{children:"A brief description of the folder contents"})]})]})}):null}function KW({asset:e,onView:t,onEdit:n,onMove:r,onDelete:o}){const l=()=>{if(!e.url)return;const d=document.createElement("a");d.href=e.url,d.download=e.name,d.target="_blank",document.body.appendChild(d),d.click(),document.body.removeChild(d)},u=async()=>{e.url&&await navigator.clipboard.writeText(e.url)};return i.jsxs(Sl,{children:[i.jsx(jl,{asChild:!0,children:i.jsx(me,{variant:"ghost",size:"icon-sm",className:"opacity-0 group-hover:opacity-100",onClick:d=>d.stopPropagation(),children:i.jsx(aP,{className:"size-4"})})}),i.jsxs(Cl,{side:"bottom",onClick:d=>d.stopPropagation(),children:[t&&i.jsxs(pn,{onClick:t,children:[i.jsx(lh,{className:"mr-2 size-4"}),"View Details"]}),n&&i.jsxs(pn,{onClick:n,children:[i.jsx(fa,{className:"mr-2 size-4"}),"Edit"]}),r&&i.jsxs(pn,{onClick:r,children:[i.jsx(Gx,{className:"mr-2 size-4"}),"Move to..."]}),i.jsx(Yo,{}),i.jsxs(pn,{onClick:l,disabled:!e.url,children:[i.jsx(sx,{className:"mr-2 size-4"}),"Download"]}),i.jsxs(pn,{onClick:u,disabled:!e.url,children:[i.jsx(pu,{className:"mr-2 size-4"}),"Copy URL"]}),o&&i.jsxs(i.Fragment,{children:[i.jsx(Yo,{}),i.jsxs(pn,{onClick:o,className:"text-destructive focus:text-destructive",children:[i.jsx(Fn,{className:"mr-2 size-4"}),"Delete"]})]})]})]})}function XW({folder:e,onEdit:t,onMove:n,onDelete:r}){return i.jsxs(Sl,{children:[i.jsx(jl,{asChild:!0,children:i.jsx(me,{variant:"ghost",size:"icon-sm",className:"opacity-0 group-hover:opacity-100",onClick:o=>o.stopPropagation(),children:i.jsx(lk,{className:"size-4"})})}),i.jsxs(Cl,{align:"end",onClick:o=>o.stopPropagation(),children:[t&&i.jsxs(pn,{onClick:t,children:[i.jsx(fa,{className:"mr-2 size-4"}),"Rename"]}),n&&i.jsxs(pn,{onClick:n,children:[i.jsx(Gx,{className:"mr-2 size-4"}),"Move to..."]}),r&&i.jsxs(i.Fragment,{children:[i.jsx(Yo,{}),i.jsxs(pn,{onClick:r,className:"text-destructive focus:text-destructive",children:[i.jsx(Fn,{className:"mr-2 size-4"}),"Delete"]})]})]})]})}function JW({selectedCount:e,onClear:t,onMove:n,onDelete:r,isDeleting:o}){return e===0?null:i.jsx("div",{className:"fixed inset-x-0 bottom-0 z-50 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:i.jsxs("div",{className:"mx-auto flex max-w-7xl items-center justify-between px-6 py-3",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("span",{className:"text-sm font-medium",children:[e," ",e===1?"file":"files"," selected"]}),i.jsxs(me,{variant:"ghost",size:"sm",onClick:t,children:[i.jsx(At,{className:"mr-1 size-4"}),"Clear"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(me,{variant:"secondary",onClick:n,disabled:o,children:[i.jsx(Gx,{className:"mr-2 size-4"}),"Move to..."]}),i.jsxs(me,{variant:"danger",onClick:r,loading:o,children:[i.jsx(Fn,{className:"mr-2 size-4"}),"Delete"]})]})]})})}function eG({selectedCount:e,onClear:t,onRestore:n,onPermanentDelete:r,isRestoring:o,isDeleting:l}){return e===0?null:i.jsx("div",{className:"fixed inset-x-0 bottom-0 z-50 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:i.jsxs("div",{className:"mx-auto flex max-w-7xl items-center justify-between px-6 py-3",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("span",{className:"text-sm font-medium",children:[e," ",e===1?"file":"files"," selected"]}),i.jsxs(me,{variant:"ghost",size:"sm",onClick:t,children:[i.jsx(At,{className:"mr-1 size-4"}),"Clear"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(me,{variant:"secondary",onClick:n,loading:o,disabled:l,children:[i.jsx(xu,{className:"mr-2 size-4"}),"Restore"]}),i.jsxs(me,{variant:"danger",onClick:r,loading:l,disabled:o,children:[i.jsx(Fn,{className:"mr-2 size-4"}),"Delete Forever"]})]})]})})}function tG({open:e,onOpenChange:t,assetIds:n,currentFolderId:r,onMoved:o}){const l=xn(),[u,d]=p.useState(void 0),[h,m]=p.useState(!1),[v,g]=p.useState(""),y=He(l.getMediaFolderTree,{}),w=et(l.moveMediaAssets),S=p.useMemo(()=>{if(!y)return[];const _=(E,M)=>y.filter(R=>R.parentId===E).flatMap(R=>[{...R,depth:M},..._(R._id,M+1)]);return _(void 0,0)},[y]),j=async()=>{if(n.length!==0){m(!0),g("");try{await w({assetIds:n,targetFolderId:u}),o?.(),t(!1)}catch(_){g(_ instanceof Error?_.message:"Failed to move files")}finally{m(!1)}}},N=u===r,C=u===void 0;return i.jsx(ls,{open:e,onOpenChange:t,title:"Move Files",description:`Select a destination folder for ${n.length} ${n.length===1?"file":"files"}`,size:"sm",footer:i.jsxs(i.Fragment,{children:[i.jsx(me,{variant:"outline",onClick:()=>t(!1),disabled:h,children:"Cancel"}),i.jsx(me,{onClick:j,loading:h,disabled:N,children:"Move Here"})]}),children:i.jsxs("div",{className:"flex flex-col gap-2",children:[v&&i.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive",children:v}),i.jsxs("div",{className:"max-h-[300px] overflow-y-auto rounded-md border",children:[i.jsxs("button",{type:"button",className:W("flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-muted",C&&"bg-primary/10 text-primary",r===void 0&&"opacity-50"),onClick:()=>d(void 0),children:[i.jsx($h,{className:"size-4"}),i.jsx("span",{className:"font-medium",children:"Root (All Files)"}),r===void 0&&i.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"Current"})]}),S.map(_=>{const E=_._id===r,M=_._id===u;return i.jsxs("button",{type:"button",className:W("flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-muted",M&&"bg-primary/10 text-primary",E&&"opacity-50"),style:{paddingLeft:`${12+_.depth*20}px`},onClick:()=>d(_._id),children:[_.depth>0&&i.jsx(Rl,{className:"size-3 text-muted-foreground"}),i.jsx(uh,{className:"size-4 text-amber-500"}),i.jsx("span",{className:"truncate",children:_.name}),E&&i.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"Current"})]},_._id)}),S.length===0&&i.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No folders yet. Create folders to organize your files."})]}),N&&i.jsx("p",{className:"text-xs text-muted-foreground",children:"Files are already in this folder"})]})})}var wm="Tabs",[nG]=Dn(wm,[ql]),HT=ql(),[rG,mb]=nG(wm),YT=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:l,orientation:u="horizontal",dir:d,activationMode:h="automatic",...m}=e,v=Bl(d),[g,y]=nr({prop:r,onChange:o,defaultProp:l??"",caller:wm});return i.jsx(rG,{scope:n,baseId:gn(),value:g,onValueChange:y,orientation:u,dir:v,activationMode:h,children:i.jsx(ze.div,{dir:v,"data-orientation":u,...m,ref:t})})});YT.displayName=wm;var WT="TabsList",GT=p.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,l=mb(WT,n),u=HT(n);return i.jsx(eb,{asChild:!0,...u,orientation:l.orientation,dir:l.dir,loop:r,children:i.jsx(ze.div,{role:"tablist","aria-orientation":l.orientation,...o,ref:t})})});GT.displayName=WT;var ZT="TabsTrigger",QT=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...l}=e,u=mb(ZT,n),d=HT(n),h=JT(u.baseId,r),m=eM(u.baseId,r),v=r===u.value;return i.jsx(tb,{asChild:!0,...d,focusable:!o,active:v,children:i.jsx(ze.button,{type:"button",role:"tab","aria-selected":v,"aria-controls":m,"data-state":v?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:h,...l,ref:t,onMouseDown:Se(e.onMouseDown,g=>{!o&&g.button===0&&g.ctrlKey===!1?u.onValueChange(r):g.preventDefault()}),onKeyDown:Se(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&u.onValueChange(r)}),onFocus:Se(e.onFocus,()=>{const g=u.activationMode!=="manual";!v&&!o&&g&&u.onValueChange(r)})})})});QT.displayName=ZT;var KT="TabsContent",XT=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:l,...u}=e,d=mb(KT,n),h=JT(d.baseId,r),m=eM(d.baseId,r),v=r===d.value,g=p.useRef(v);return p.useEffect(()=>{const y=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(y)},[]),i.jsx(yn,{present:o||v,children:({present:y})=>i.jsx(ze.div,{"data-state":v?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":h,hidden:!y,id:m,tabIndex:0,...u,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:y&&l})})});XT.displayName=KT;function JT(e,t){return`${e}-trigger-${t}`}function eM(e,t){return`${e}-content-${t}`}var sG=YT,aG=GT,oG=QT,iG=XT;function tM({className:e,...t}){return i.jsx(sG,{"data-slot":"tabs",className:W("flex flex-col gap-2",e),...t})}function nM({className:e,...t}){return i.jsx(aG,{"data-slot":"tabs-list",className:W("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function Rh({className:e,...t}){return i.jsx(oG,{"data-slot":"tabs-trigger",className:W("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function qC({className:e,...t}){return i.jsx(iG,{"data-slot":"tabs-content",className:W("flex-1 outline-none",e),...t})}function lG(e){if(e===0)return"0 B";const t=1024,n=["B","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(1))} ${n[r]}`}function cG(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function uG(e,t="size-6"){const n={className:t};switch(e){case"image":return i.jsx(ns,{...n});case"video":return i.jsx(ay,{...n});case"audio":return i.jsx(Jx,{...n});case"document":return i.jsx(Sr,{...n});default:return i.jsx(Wx,{...n})}}function dG(e){return e?e.startsWith("image/")?"image":e.startsWith("video/")?"video":e.startsWith("audio/")?"audio":e==="application/pdf"||e.includes("document")||e.includes("sheet")||e.includes("presentation")||e.startsWith("text/")?"document":"other":"other"}function fG({api:e,navigation:t,settings:n}){p.useEffect(()=>{n&&!n.features.mediaManagement&&t.navigate("/")},[n,t]);const[r,o]=p.useState(void 0),[l,u]=p.useState(""),[d,h]=p.useState(""),[m,v]=p.useState([]),[g,y]=p.useState(new Set),[w,S]=p.useState(!1),[j,N]=p.useState(!1),[C,_]=p.useState(!1),[E,M]=p.useState(""),[A,R]=p.useState(!1),[T,O]=p.useState(""),[D,z]=p.useState(null),[B,V]=p.useState(null),[Y,G]=p.useState(null),[ae,L]=p.useState(null),[$,U]=p.useState(!1),[H,le]=p.useState(!1),[I,F]=p.useState(!1),[K,ne]=p.useState(!1),[X,ue]=p.useState("library"),[te,ye]=p.useState(!1),[Ce,_e]=p.useState(!1),[Re,ge]=p.useState(!1),[Fe,be]=p.useState(null),Be=X==="trash",nt=He(e.listMediaAssets,{folderId:Be?void 0:r,type:d||void 0,search:l||void 0,deletedOnly:Be?!0:void 0,paginationOpts:{numItems:100,cursor:null}}),ot=He(e.getMediaTrashCount,{}),yt=He(e.getMediaByTerm,m[0]?{termId:m[0]}:"skip"),pe=He(e.getMediaByTerm,m[1]?{termId:m[1]}:"skip"),Le=He(e.getMediaByTerm,m[2]?{termId:m[2]}:"skip"),Ye=p.useMemo(()=>{if(m.length===0)return null;const Q=new Set,je=[yt,pe,Le];for(let Ue=0;Ue<m.length&&Ue<3;Ue++){const gt=je[Ue];if(gt?.page)for(const Ke of gt.page)Q.add(Ke)}return Q},[m,yt,pe,Le]),Oe=He(e.listMediaFolders,{parentId:Be?void 0:r,deletedOnly:Be||void 0}),dt=He(e.getMediaFolder,r?{id:r}:"skip"),ct=He(e.getMediaFolderTree,{}),Mn=et(e.createMediaFolder),Qe=et(e.deleteMediaAsset),bt=et(e.deleteMediaFolder),pt=et(e.restoreMediaAsset),Vn=et(e.restoreMediaFolder),or=et(e.permanentDeleteMediaAsset),Hr=et(e.bulkPermanentDeleteMediaAssets),zn=p.useMemo(()=>{if(!r||!ct)return[];const Q=[];let je=ct.find(Ue=>Ue._id===r);for(;je;){Q.unshift(je);const Ue=je.parentId;je=Ue?ct.find(gt=>gt._id===Ue):void 0}return Q},[r,ct]),Pn=p.useCallback(Q=>{o(Q),u("")},[]),qt=p.useCallback(()=>{dt?.parentId?o(dt.parentId):o(void 0)},[dt]),en=p.useCallback(()=>{o(void 0),u("")},[]),$t=p.useCallback(Q=>{y(je=>{const Ue=new Set(je);return Ue.has(Q)?Ue.delete(Q):Ue.add(Q),Ue})},[]),us=p.useCallback(()=>{nt?.page&&y(new Set(nt.page.map(Q=>Q._id)))},[nt?.page]),Yr=p.useCallback(()=>{y(new Set)},[]),xe=p.useCallback(Q=>{ue(Q),y(new Set),S(!1)},[]),ke=p.useCallback(Q=>{if(w)$t(Q);else{const je=nt?.page?.findIndex(Ue=>Ue._id===Q)??-1;je!==-1&&z(je)}},[w,$t,nt?.page]),we=p.useCallback(Q=>{z(Q)},[]),Ne=p.useCallback(async()=>{if(ae){U(!0);try{ae.type==="asset"?await Qe({id:ae.id}):await bt({id:ae.id}),L(null)}catch(Q){console.error("Delete failed:",Q)}finally{U(!1)}}},[ae,Qe,bt]),Ve=p.useCallback(async()=>{if(g.size!==0){ne(!0);try{const Q=Array.from(g).map(je=>Qe({id:je}));await Promise.all(Q),y(new Set),S(!1),F(!1)}catch(Q){console.error("Bulk delete failed:",Q)}finally{ne(!1)}}},[g,Qe]),De=p.useCallback(()=>{y(new Set),S(!1)},[]),wt=p.useCallback(async Q=>{ye(!0);try{await pt({id:Q})}catch(je){console.error("Restore failed:",je)}finally{ye(!1)}},[pt]),bn=p.useCallback(async()=>{if(g.size!==0){ye(!0);try{const Q=Array.from(g).map(je=>pt({id:je}));await Promise.all(Q),y(new Set),S(!1)}catch(Q){console.error("Bulk restore failed:",Q)}finally{ye(!1)}}},[g,pt]),tn=p.useCallback(async Q=>{ye(!0);try{await Vn({id:Q})}catch(je){console.error("Restore folder failed:",je)}finally{ye(!1)}},[Vn]),Gt=p.useCallback(async()=>{if(Fe){_e(!0);try{Fe==="bulk"?(await Hr({ids:Array.from(g)}),y(new Set),S(!1)):await or({id:Fe}),ge(!1),be(null)}catch(Q){console.error("Permanent delete failed:",Q)}finally{_e(!1)}}},[Fe,or,Hr,g]),Ot=p.useCallback(async()=>{if(!E.trim()){O("Folder name is required");return}R(!0),O("");try{await Mn({name:E.trim(),parentId:r}),N(!1),M("")}catch(Q){O(Q instanceof Error?Q.message:"Failed to create folder")}finally{R(!1)}},[E,r,Mn]),Rn=p.useCallback(Q=>{_(!1)},[]),Hn=nt===void 0||Oe===void 0,wn=p.useMemo(()=>{const Q=nt?.page??[];return Ye===null?Q:Q.filter(je=>Ye.has(je._id))},[nt?.page,Ye]);return i.jsxs("div",{className:"flex flex-col gap-4 md:gap-6",children:[i.jsx(as,{title:"Media Library",description:"Upload, organize, and manage media assets for your content."}),i.jsx(tM,{value:X,onValueChange:Q=>xe(Q),children:i.jsxs(nM,{children:[i.jsxs(Rh,{value:"library",children:[i.jsx(ns,{className:"mr-1.5 size-4"}),"Library"]}),i.jsxs(Rh,{value:"trash",children:[i.jsx(Fn,{className:"mr-1.5 size-4"}),"Trash",ot&&ot.total>0&&i.jsx(xt,{variant:"secondary",className:"ml-1.5",children:ot.total})]})]})}),!Be&&i.jsxs("nav",{className:"flex items-center gap-1","aria-label":"Folder navigation",children:[i.jsxs("button",{className:W("flex items-center gap-1.5 rounded-md px-2 py-1 text-sm transition-colors",r?"text-muted-foreground hover:bg-muted hover:text-foreground":"bg-primary/10 font-medium text-primary"),onClick:en,children:[i.jsx($h,{className:"size-4"}),i.jsx("span",{children:"All Files"})]}),zn.map((Q,je)=>i.jsxs("span",{className:"flex items-center",children:[i.jsx("span",{className:"mx-1 text-muted-foreground",children:"/"}),i.jsx("button",{className:W("rounded-md px-2 py-1 text-sm transition-colors",je===zn.length-1?"bg-primary/10 font-medium text-primary":"text-muted-foreground hover:bg-muted hover:text-foreground"),onClick:()=>Pn(Q._id),children:Q.name})]},Q._id))]}),i.jsx(ym,{search:{value:l,onChange:u,placeholder:"Search files...",className:"w-full md:w-64"},filters:[{key:"type",value:d||"all",onChange:Q=>h(Q==="all"?"":Q),options:[{value:"all",label:"All Types"},{value:"image",label:"Images"},{value:"video",label:"Videos"},{value:"audio",label:"Audio"},{value:"document",label:"Documents"},{value:"other",label:"Other"}],className:"w-full sm:w-36"}],actions:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(UT,{selectedTermIds:m,onChange:v,placeholder:"Tags"}),nt?.page&&nt.page.length>0&&i.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-sm",children:[i.jsx(wr,{checked:w,onCheckedChange:Q=>{S(Q),Q||y(new Set)}}),"Selection Mode"]}),w&&g.size>0&&i.jsxs("span",{className:"text-sm text-muted-foreground",children:[g.size," selected"]}),w&&i.jsxs(i.Fragment,{children:[i.jsx(me,{variant:"secondary",size:"sm",onClick:us,children:"Select All"}),i.jsx(me,{variant:"secondary",size:"sm",onClick:Yr,children:"Clear"})]}),r&&!Be&&i.jsxs(me,{variant:"secondary",onClick:qt,children:[i.jsx(Hx,{className:"size-4"}),"Up"]}),!Be&&i.jsxs(i.Fragment,{children:[i.jsxs(me,{variant:"secondary",onClick:()=>N(!0),children:[i.jsx(SP,{className:"size-4"}),"New Folder"]}),i.jsxs(me,{onClick:()=>_(!0),children:[i.jsx(sy,{className:"size-4"}),"Upload Files"]})]})]})}),Hn?i.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[i.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),i.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading media library..."})]}):i.jsxs(i.Fragment,{children:[!Be&&Oe&&Oe.length>0&&!l&&i.jsxs("section",{children:[i.jsx("h3",{className:"mb-3 text-sm font-medium text-muted-foreground",children:"Folders"}),i.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4 md:grid-cols-6",children:Oe.map(Q=>i.jsxs("div",{className:"group relative flex cursor-pointer flex-col items-center gap-2 rounded-lg border bg-card p-4 text-center transition-colors hover:border-primary/50 hover:bg-muted/50",onClick:()=>Pn(Q._id),children:[i.jsx("div",{className:"absolute right-2 top-2",children:i.jsx(XW,{folder:{_id:Q._id,name:Q.name},onEdit:()=>G({_id:Q._id,name:Q.name,description:Q.description}),onDelete:()=>L({type:"folder",id:Q._id,name:Q.name})})}),i.jsx(uh,{className:"size-10 text-amber-500"}),i.jsx("span",{className:"truncate text-sm font-medium",children:Q.name})]},Q._id))})]}),Be&&Oe&&Oe.length>0&&i.jsxs("section",{children:[i.jsxs("h3",{className:"mb-3 text-sm font-medium text-muted-foreground",children:["Deleted Folders (",Oe.length,")"]}),i.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4 md:grid-cols-6",children:Oe.map(Q=>i.jsxs("div",{className:"group relative flex flex-col items-center gap-2 rounded-lg border border-destructive/20 bg-card p-4 text-center opacity-60",children:[i.jsx(uh,{className:"size-10 text-amber-500/50"}),i.jsx("span",{className:"truncate text-sm font-medium",children:Q.name}),i.jsxs(me,{variant:"secondary",size:"sm",onClick:()=>tn(Q._id),disabled:te,children:[i.jsx(xu,{className:"mr-1 size-3"}),"Restore"]})]},Q._id))})]}),wn.length>0?i.jsxs("section",{children:[!Be&&Oe&&Oe.length>0&&!l&&i.jsx("h3",{className:"mb-3 text-sm font-medium text-muted-foreground",children:"Files"}),Be&&i.jsxs("h3",{className:"mb-3 text-sm font-medium text-muted-foreground",children:["Deleted Files (",wn.length,")"]}),i.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4 md:grid-cols-6",children:wn.map(Q=>{const je=Q._id,Ue=g.has(je),gt=dG(Q.mimeType);return i.jsxs("div",{className:W("group relative flex cursor-pointer flex-col overflow-hidden rounded-lg border bg-card transition-all hover:border-primary/50",Ue&&"border-primary ring-2 ring-primary/20"),onClick:()=>ke(je),children:[w&&i.jsx("div",{className:"absolute left-2 top-2 z-10",children:i.jsx(wr,{checked:Ue,onCheckedChange:()=>$t(je),onClick:Ke=>Ke.stopPropagation(),className:"bg-white/80"})}),!w&&!Be&&i.jsx("div",{className:"absolute right-2 top-2 z-10",children:i.jsx(KW,{asset:{_id:Q._id,name:Q.name,url:Q.url},onView:()=>{const Ke=wn.findIndex(Yn=>Yn._id===Q._id);Ke!==-1&&z(Ke)},onEdit:()=>V({_id:Q._id,name:Q.name,title:Q.title,description:Q.description,altText:Q.altText,tags:Q.tags}),onDelete:()=>L({type:"asset",id:Q._id,name:Q.name})})}),!w&&Be&&i.jsxs("div",{className:"absolute right-2 top-2 z-10 flex gap-1 opacity-0 group-hover:opacity-100",children:[i.jsx(me,{variant:"secondary",size:"icon-sm",onClick:Ke=>{Ke.stopPropagation(),wt(Q._id)},title:"Restore",children:i.jsx(xu,{className:"size-4"})}),i.jsx(me,{variant:"danger",size:"icon-sm",onClick:Ke=>{Ke.stopPropagation(),be(Q._id),ge(!0)},title:"Delete Forever",children:i.jsx(Fn,{className:"size-4"})})]}),i.jsx("div",{className:"aspect-square overflow-hidden bg-muted",children:gt==="image"&&Q.url?i.jsx("img",{src:Q.url,alt:Q.title||Q.name,className:"h-full w-full object-cover"}):i.jsx("div",{className:"flex size-full items-center justify-center text-muted-foreground",children:uG(gt,"size-10")})}),i.jsxs("div",{className:"p-2",children:[i.jsx("p",{className:"truncate text-sm font-medium",title:Q.name,children:Q.name}),i.jsxs("div",{className:"mt-0.5 flex items-center gap-1 text-xs text-muted-foreground",children:[i.jsx("span",{className:"capitalize",children:gt}),i.jsx("span",{children:"•"}),i.jsx("span",{children:lG(Q.size??0)})]}),i.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:cG(Q._creationTime)})]})]},Q._id)})}),!nt.isDone&&i.jsxs("p",{className:"mt-4 text-center text-sm text-muted-foreground",children:["Showing ",nt.page.length," files. More files available."]})]}):Be?i.jsx(Bn,{icon:i.jsx(Fn,{className:"size-8"}),title:"Trash is empty",description:"Deleted files will appear here. You can restore them or permanently delete them."}):!Oe?.length&&i.jsx(Bn,{icon:i.jsx(ns,{className:"size-8"}),title:"No media assets yet",description:"Upload images, videos, documents, and other files to use in your content.",action:{label:"Upload Files",onClick:()=>_(!0)}}),l&&wn.length===0&&!Be&&i.jsx(Bn,{icon:i.jsx(Al,{className:"size-8"}),title:"No results found",description:`No files match "${l}". Try a different search term.`,action:{label:"Clear Search",onClick:()=>u(""),variant:"secondary"}})]}),i.jsx(yl,{open:j,onOpenChange:N,children:i.jsxs(bl,{children:[i.jsx(Cu,{children:i.jsx(wl,{children:"Create New Folder"})}),i.jsx("div",{className:"flex flex-col gap-4 py-4",children:i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx(rt,{htmlFor:"folder-name",children:"Folder Name"}),i.jsx(mt,{id:"folder-name",value:E,onChange:Q=>{M(Q.target.value),O("")},placeholder:"Enter folder name",autoFocus:!0,onKeyDown:Q=>{Q.key==="Enter"&&!A&&Ot()}}),T&&i.jsx("p",{className:"text-sm text-destructive",children:T})]})}),i.jsxs(Nu,{children:[i.jsx(me,{variant:"secondary",onClick:()=>N(!1),disabled:A,children:"Cancel"}),i.jsx(me,{onClick:Ot,disabled:A||!E.trim(),loading:A,children:"Create Folder"})]})]})}),i.jsx(yl,{open:C,onOpenChange:_,children:i.jsxs(bl,{className:"max-w-lg",children:[i.jsx(Cu,{children:i.jsx(wl,{children:"Upload Files"})}),i.jsx("div",{className:"py-4",children:i.jsx(kT,{currentFolderId:r,generateUploadUrl:e.generateUploadUrl,createAsset:e.createMediaAsset,onUploadComplete:Rn,maxFileSize:50*1024*1024,maxConcurrentUploads:3})}),i.jsx(Nu,{children:i.jsx(me,{variant:"secondary",onClick:()=>_(!1),children:"Close"})})]})}),i.jsx(VW,{asset:D!==null&&wn[D]?wn[D]:null,assets:wn,currentIndex:D??0,open:D!==null,onOpenChange:Q=>{Q||z(null)},onNavigate:we,onEdit:Be?void 0:Q=>V({_id:Q._id,name:Q.name,title:Q.title,description:Q.description,altText:Q.altText,tags:Q.tags}),onDelete:Be?void 0:Q=>L({type:"asset",id:Q._id,name:Q.name})}),i.jsx(ZW,{asset:B,open:B!==null,onOpenChange:Q=>{Q||V(null)}}),i.jsx(QW,{folder:Y,open:Y!==null,onOpenChange:Q=>{Q||G(null)}}),i.jsx(oa,{open:ae!==null,onOpenChange:Q=>{Q||L(null)},title:`Delete ${ae?.type==="folder"?"Folder":"File"}?`,description:`Are you sure you want to delete "${ae?.name}"? ${ae?.type==="folder"?"This will also delete all files inside the folder.":"This action can be undone from the trash."}`,confirmLabel:"Delete",onConfirm:Ne,variant:"danger",loading:$}),i.jsx(oa,{open:I,onOpenChange:F,title:"Delete Selected Files?",description:`Are you sure you want to delete ${g.size} ${g.size===1?"file":"files"}? This action can be undone from the trash.`,confirmLabel:"Delete All",onConfirm:Ve,variant:"danger",loading:K}),i.jsx(oa,{open:Re,onOpenChange:Q=>{ge(Q),Q||be(null)},title:Fe==="bulk"?`Delete ${g.size} ${g.size===1?"File":"Files"} Forever?`:"Delete Forever?",description:Fe==="bulk"?`This will permanently delete ${g.size} ${g.size===1?"file":"files"}. This action cannot be undone.`:"This will permanently delete this file. This action cannot be undone.",confirmLabel:"Delete Forever",onConfirm:Gt,variant:"danger",loading:Ce}),i.jsx(tG,{open:H,onOpenChange:le,assetIds:Array.from(g),currentFolderId:r,onMoved:De}),w&&!Be&&i.jsx(JW,{selectedCount:g.size,onClear:Yr,onMove:()=>le(!0),onDelete:()=>F(!0),isDeleting:K}),w&&Be&&i.jsx(eG,{selectedCount:g.size,onClear:Yr,onRestore:bn,onPermanentDelete:()=>{be("bulk"),ge(!0)},isRestoring:te,isDeleting:Ce})]})}var Sm="Switch",[hG]=Dn(Sm),[mG,pG]=hG(Sm),rM=p.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:l,required:u,disabled:d,value:h="on",onCheckedChange:m,form:v,...g}=e,[y,w]=p.useState(null),S=Ge(t,E=>w(E)),j=p.useRef(!1),N=y?v||!!y.closest("form"):!0,[C,_]=nr({prop:o,defaultProp:l??!1,onChange:m,caller:Sm});return i.jsxs(mG,{scope:n,checked:C,disabled:d,children:[i.jsx(ze.button,{type:"button",role:"switch","aria-checked":C,"aria-required":u,"data-state":iM(C),"data-disabled":d?"":void 0,disabled:d,value:h,...g,ref:S,onClick:Se(e.onClick,E=>{_(M=>!M),N&&(j.current=E.isPropagationStopped(),j.current||E.stopPropagation())})}),N&&i.jsx(oM,{control:y,bubbles:!j.current,name:r,value:h,checked:C,required:u,disabled:d,form:v,style:{transform:"translateX(-100%)"}})]})});rM.displayName=Sm;var sM="SwitchThumb",aM=p.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=pG(sM,n);return i.jsx(ze.span,{"data-state":iM(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});aM.displayName=sM;var gG="SwitchBubbleInput",oM=p.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...o},l)=>{const u=p.useRef(null),d=Ge(u,l),h=Qy(n),m=Hy(t);return p.useEffect(()=>{const v=u.current;if(!v)return;const g=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(g,"checked").set;if(h!==n&&w){const S=new Event("click",{bubbles:r});w.call(v,n),v.dispatchEvent(S)}},[h,n,r]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:d,style:{...o.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});oM.displayName=gG;function iM(e){return e?"checked":"unchecked"}var vG=rM,xG=aM;function rl({className:e,...t}){return i.jsx(vG,{"data-slot":"switch",className:W("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:i.jsx(xG,{"data-slot":"switch-thumb",className:W("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}var lM="AlertDialog",[yG]=Dn(lM,[I_]),pa=I_(),cM=e=>{const{__scopeAlertDialog:t,...n}=e,r=pa(t);return i.jsx(Uu,{...r,...n,modal:!0})};cM.displayName=lM;var bG="AlertDialogTrigger",wG=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=pa(n);return i.jsx(QU,{...o,...r,ref:t})});wG.displayName=bG;var SG="AlertDialogPortal",uM=e=>{const{__scopeAlertDialog:t,...n}=e,r=pa(t);return i.jsx(qu,{...r,...n})};uM.displayName=SG;var jG="AlertDialogOverlay",dM=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=pa(n);return i.jsx(Vu,{...o,...r,ref:t})});dM.displayName=jG;var ul="AlertDialogContent",[CG,NG]=yG(ul),kG=r_("AlertDialogContent"),fM=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...o}=e,l=pa(n),u=p.useRef(null),d=Ge(t,u),h=p.useRef(null);return i.jsx(YU,{contentName:ul,titleName:hM,docsSlug:"alert-dialog",children:i.jsx(CG,{scope:n,cancelRef:h,children:i.jsxs(Hu,{role:"alertdialog",...l,...o,ref:d,onOpenAutoFocus:Se(o.onOpenAutoFocus,m=>{m.preventDefault(),h.current?.focus({preventScroll:!0})}),onPointerDownOutside:m=>m.preventDefault(),onInteractOutside:m=>m.preventDefault(),children:[i.jsx(kG,{children:r}),i.jsx(EG,{contentRef:u})]})})})});fM.displayName=ul;var hM="AlertDialogTitle",mM=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=pa(n);return i.jsx(Qh,{...o,...r,ref:t})});mM.displayName=hM;var pM="AlertDialogDescription",gM=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=pa(n);return i.jsx(Iy,{...o,...r,ref:t})});gM.displayName=pM;var _G="AlertDialogAction",vM=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=pa(n);return i.jsx(Kh,{...o,...r,ref:t})});vM.displayName=_G;var xM="AlertDialogCancel",yM=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:o}=NG(xM,n),l=pa(n),u=Ge(t,o);return i.jsx(Kh,{...l,...r,ref:u})});yM.displayName=xM;var EG=({contentRef:e})=>{const t=`\`${ul}\` requires a description for the component to be accessible for screen reader users.
94
-
95
- You can add a description to the \`${ul}\` by passing a \`${pM}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
96
-
97
- Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${ul}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
98
-
99
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return p.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},TG=cM,MG=uM,RG=dM,AG=fM,OG=vM,DG=yM,zG=mM,PG=gM;function LG(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}var pb="ScrollArea",[bM]=Dn(pb),[IG,Vr]=bM(pb),wM=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:l=600,...u}=e,[d,h]=p.useState(null),[m,v]=p.useState(null),[g,y]=p.useState(null),[w,S]=p.useState(null),[j,N]=p.useState(null),[C,_]=p.useState(0),[E,M]=p.useState(0),[A,R]=p.useState(!1),[T,O]=p.useState(!1),D=Ge(t,B=>h(B)),z=Bl(o);return i.jsx(IG,{scope:n,type:r,dir:z,scrollHideDelay:l,scrollArea:d,viewport:m,onViewportChange:v,content:g,onContentChange:y,scrollbarX:w,onScrollbarXChange:S,scrollbarXEnabled:A,onScrollbarXEnabledChange:R,scrollbarY:j,onScrollbarYChange:N,scrollbarYEnabled:T,onScrollbarYEnabledChange:O,onCornerWidthChange:_,onCornerHeightChange:M,children:i.jsx(ze.div,{dir:z,...u,ref:D,style:{position:"relative","--radix-scroll-area-corner-width":C+"px","--radix-scroll-area-corner-height":E+"px",...e.style}})})});wM.displayName=pb;var SM="ScrollAreaViewport",jM=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...l}=e,u=Vr(SM,n),d=p.useRef(null),h=Ge(t,d,u.onViewportChange);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),i.jsx(ze.div,{"data-radix-scroll-area-viewport":"",...l,ref:h,style:{overflowX:u.scrollbarXEnabled?"scroll":"hidden",overflowY:u.scrollbarYEnabled?"scroll":"hidden",...e.style},children:i.jsx("div",{ref:u.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});jM.displayName=SM;var As="ScrollAreaScrollbar",CM=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Vr(As,e.__scopeScrollArea),{onScrollbarXEnabledChange:l,onScrollbarYEnabledChange:u}=o,d=e.orientation==="horizontal";return p.useEffect(()=>(d?l(!0):u(!0),()=>{d?l(!1):u(!1)}),[d,l,u]),o.type==="hover"?i.jsx($G,{...r,ref:t,forceMount:n}):o.type==="scroll"?i.jsx(FG,{...r,ref:t,forceMount:n}):o.type==="auto"?i.jsx(NM,{...r,ref:t,forceMount:n}):o.type==="always"?i.jsx(gb,{...r,ref:t}):null});CM.displayName=As;var $G=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Vr(As,e.__scopeScrollArea),[l,u]=p.useState(!1);return p.useEffect(()=>{const d=o.scrollArea;let h=0;if(d){const m=()=>{window.clearTimeout(h),u(!0)},v=()=>{h=window.setTimeout(()=>u(!1),o.scrollHideDelay)};return d.addEventListener("pointerenter",m),d.addEventListener("pointerleave",v),()=>{window.clearTimeout(h),d.removeEventListener("pointerenter",m),d.removeEventListener("pointerleave",v)}}},[o.scrollArea,o.scrollHideDelay]),i.jsx(yn,{present:n||l,children:i.jsx(NM,{"data-state":l?"visible":"hidden",...r,ref:t})})}),FG=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Vr(As,e.__scopeScrollArea),l=e.orientation==="horizontal",u=Cm(()=>h("SCROLL_END"),100),[d,h]=LG("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return p.useEffect(()=>{if(d==="idle"){const m=window.setTimeout(()=>h("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(m)}},[d,o.scrollHideDelay,h]),p.useEffect(()=>{const m=o.viewport,v=l?"scrollLeft":"scrollTop";if(m){let g=m[v];const y=()=>{const w=m[v];g!==w&&(h("SCROLL"),u()),g=w};return m.addEventListener("scroll",y),()=>m.removeEventListener("scroll",y)}},[o.viewport,l,h,u]),i.jsx(yn,{present:n||d!=="hidden",children:i.jsx(gb,{"data-state":d==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Se(e.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:Se(e.onPointerLeave,()=>h("POINTER_LEAVE"))})})}),NM=p.forwardRef((e,t)=>{const n=Vr(As,e.__scopeScrollArea),{forceMount:r,...o}=e,[l,u]=p.useState(!1),d=e.orientation==="horizontal",h=Cm(()=>{if(n.viewport){const m=n.viewport.offsetWidth<n.viewport.scrollWidth,v=n.viewport.offsetHeight<n.viewport.scrollHeight;u(d?m:v)}},10);return El(n.viewport,h),El(n.content,h),i.jsx(yn,{present:r||l,children:i.jsx(gb,{"data-state":l?"visible":"hidden",...o,ref:t})})}),gb=p.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=Vr(As,e.__scopeScrollArea),l=p.useRef(null),u=p.useRef(0),[d,h]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),m=MM(d.viewport,d.content),v={...r,sizes:d,onSizesChange:h,hasThumb:m>0&&m<1,onThumbChange:y=>l.current=y,onThumbPointerUp:()=>u.current=0,onThumbPointerDown:y=>u.current=y};function g(y,w){return YG(y,u.current,d,w)}return n==="horizontal"?i.jsx(BG,{...v,ref:t,onThumbPositionChange:()=>{if(o.viewport&&l.current){const y=o.viewport.scrollLeft,w=VC(y,d,o.dir);l.current.style.transform=`translate3d(${w}px, 0, 0)`}},onWheelScroll:y=>{o.viewport&&(o.viewport.scrollLeft=y)},onDragScroll:y=>{o.viewport&&(o.viewport.scrollLeft=g(y,o.dir))}}):n==="vertical"?i.jsx(UG,{...v,ref:t,onThumbPositionChange:()=>{if(o.viewport&&l.current){const y=o.viewport.scrollTop,w=VC(y,d);l.current.style.transform=`translate3d(0, ${w}px, 0)`}},onWheelScroll:y=>{o.viewport&&(o.viewport.scrollTop=y)},onDragScroll:y=>{o.viewport&&(o.viewport.scrollTop=g(y))}}):null}),BG=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,l=Vr(As,e.__scopeScrollArea),[u,d]=p.useState(),h=p.useRef(null),m=Ge(t,h,l.onScrollbarXChange);return p.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),i.jsx(_M,{"data-orientation":"horizontal",...o,ref:m,sizes:n,style:{bottom:0,left:l.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:l.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":jm(n)+"px",...e.style},onThumbPointerDown:v=>e.onThumbPointerDown(v.x),onDragScroll:v=>e.onDragScroll(v.x),onWheelScroll:(v,g)=>{if(l.viewport){const y=l.viewport.scrollLeft+v.deltaX;e.onWheelScroll(y),AM(y,g)&&v.preventDefault()}},onResize:()=>{h.current&&l.viewport&&u&&r({content:l.viewport.scrollWidth,viewport:l.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:Oh(u.paddingLeft),paddingEnd:Oh(u.paddingRight)}})}})}),UG=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,l=Vr(As,e.__scopeScrollArea),[u,d]=p.useState(),h=p.useRef(null),m=Ge(t,h,l.onScrollbarYChange);return p.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),i.jsx(_M,{"data-orientation":"vertical",...o,ref:m,sizes:n,style:{top:0,right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":jm(n)+"px",...e.style},onThumbPointerDown:v=>e.onThumbPointerDown(v.y),onDragScroll:v=>e.onDragScroll(v.y),onWheelScroll:(v,g)=>{if(l.viewport){const y=l.viewport.scrollTop+v.deltaY;e.onWheelScroll(y),AM(y,g)&&v.preventDefault()}},onResize:()=>{h.current&&l.viewport&&u&&r({content:l.viewport.scrollHeight,viewport:l.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:Oh(u.paddingTop),paddingEnd:Oh(u.paddingBottom)}})}})}),[qG,kM]=bM(As),_M=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:l,onThumbPointerUp:u,onThumbPointerDown:d,onThumbPositionChange:h,onDragScroll:m,onWheelScroll:v,onResize:g,...y}=e,w=Vr(As,n),[S,j]=p.useState(null),N=Ge(t,D=>j(D)),C=p.useRef(null),_=p.useRef(""),E=w.viewport,M=r.content-r.viewport,A=Nn(v),R=Nn(h),T=Cm(g,10);function O(D){if(C.current){const z=D.clientX-C.current.left,B=D.clientY-C.current.top;m({x:z,y:B})}}return p.useEffect(()=>{const D=z=>{const B=z.target;S?.contains(B)&&A(z,M)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[E,S,M,A]),p.useEffect(R,[r,R]),El(S,T),El(w.content,T),i.jsx(qG,{scope:n,scrollbar:S,hasThumb:o,onThumbChange:Nn(l),onThumbPointerUp:Nn(u),onThumbPositionChange:R,onThumbPointerDown:Nn(d),children:i.jsx(ze.div,{...y,ref:N,style:{position:"absolute",...y.style},onPointerDown:Se(e.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),C.current=S.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w.viewport&&(w.viewport.style.scrollBehavior="auto"),O(D))}),onPointerMove:Se(e.onPointerMove,O),onPointerUp:Se(e.onPointerUp,D=>{const z=D.target;z.hasPointerCapture(D.pointerId)&&z.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=_.current,w.viewport&&(w.viewport.style.scrollBehavior=""),C.current=null})})})}),Ah="ScrollAreaThumb",EM=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=kM(Ah,e.__scopeScrollArea);return i.jsx(yn,{present:n||o.hasThumb,children:i.jsx(VG,{ref:t,...r})})}),VG=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,l=Vr(Ah,n),u=kM(Ah,n),{onThumbPositionChange:d}=u,h=Ge(t,g=>u.onThumbChange(g)),m=p.useRef(void 0),v=Cm(()=>{m.current&&(m.current(),m.current=void 0)},100);return p.useEffect(()=>{const g=l.viewport;if(g){const y=()=>{if(v(),!m.current){const w=WG(g,d);m.current=w,d()}};return d(),g.addEventListener("scroll",y),()=>g.removeEventListener("scroll",y)}},[l.viewport,v,d]),i.jsx(ze.div,{"data-state":u.hasThumb?"visible":"hidden",...o,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Se(e.onPointerDownCapture,g=>{const w=g.target.getBoundingClientRect(),S=g.clientX-w.left,j=g.clientY-w.top;u.onThumbPointerDown({x:S,y:j})}),onPointerUp:Se(e.onPointerUp,u.onThumbPointerUp)})});EM.displayName=Ah;var vb="ScrollAreaCorner",TM=p.forwardRef((e,t)=>{const n=Vr(vb,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?i.jsx(HG,{...e,ref:t}):null});TM.displayName=vb;var HG=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=Vr(vb,n),[l,u]=p.useState(0),[d,h]=p.useState(0),m=!!(l&&d);return El(o.scrollbarX,()=>{const v=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(v),h(v)}),El(o.scrollbarY,()=>{const v=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(v),u(v)}),m?i.jsx(ze.div,{...r,ref:t,style:{width:l,height:d,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Oh(e){return e?parseInt(e,10):0}function MM(e,t){const n=e/t;return isNaN(n)?0:n}function jm(e){const t=MM(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function YG(e,t,n,r="ltr"){const o=jm(n),l=o/2,u=t||l,d=o-u,h=n.scrollbar.paddingStart+u,m=n.scrollbar.size-n.scrollbar.paddingEnd-d,v=n.content-n.viewport,g=r==="ltr"?[0,v]:[v*-1,0];return RM([h,m],g)(e)}function VC(e,t,n="ltr"){const r=jm(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,l=t.scrollbar.size-o,u=t.content-t.viewport,d=l-r,h=n==="ltr"?[0,u]:[u*-1,0],m=vx(e,h);return RM([0,u],[0,d])(m)}function RM(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function AM(e,t){return e>0&&e<t}var WG=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function o(){const l={left:e.scrollLeft,top:e.scrollTop},u=n.left!==l.left,d=n.top!==l.top;(u||d)&&t(),n=l,r=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(r)};function Cm(e,t){const n=Nn(e),r=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(r.current),[]),p.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function El(e,t){const n=Nn(t);Jt(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}var GG=wM,ZG=jM,QG=TM,OM="Toggle",DM=p.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r,onPressedChange:o,...l}=e,[u,d]=nr({prop:n,onChange:o,defaultProp:r??!1,caller:OM});return i.jsx(ze.button,{type:"button","aria-pressed":u,"data-state":u?"on":"off","data-disabled":e.disabled?"":void 0,...l,ref:t,onClick:Se(e.onClick,()=>{e.disabled||d(!u)})})});DM.displayName=OM;var oo="ToggleGroup",[zM]=Dn(oo,[ql]),PM=ql(),xb=ee.forwardRef((e,t)=>{const{type:n,...r}=e;if(n==="single"){const o=r;return i.jsx(KG,{...o,ref:t})}if(n==="multiple"){const o=r;return i.jsx(XG,{...o,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${oo}\``)});xb.displayName=oo;var[LM,IM]=zM(oo),KG=ee.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...l}=e,[u,d]=nr({prop:n,defaultProp:r??"",onChange:o,caller:oo});return i.jsx(LM,{scope:e.__scopeToggleGroup,type:"single",value:ee.useMemo(()=>u?[u]:[],[u]),onItemActivate:d,onItemDeactivate:ee.useCallback(()=>d(""),[d]),children:i.jsx($M,{...l,ref:t})})}),XG=ee.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...l}=e,[u,d]=nr({prop:n,defaultProp:r??[],onChange:o,caller:oo}),h=ee.useCallback(v=>d((g=[])=>[...g,v]),[d]),m=ee.useCallback(v=>d((g=[])=>g.filter(y=>y!==v)),[d]);return i.jsx(LM,{scope:e.__scopeToggleGroup,type:"multiple",value:u,onItemActivate:h,onItemDeactivate:m,children:i.jsx($M,{...l,ref:t})})});xb.displayName=oo;var[JG,eZ]=zM(oo),$M=ee.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:o=!0,orientation:l,dir:u,loop:d=!0,...h}=e,m=PM(n),v=Bl(u),g={role:"group",dir:v,...h};return i.jsx(JG,{scope:n,rovingFocus:o,disabled:r,children:o?i.jsx(eb,{asChild:!0,...m,orientation:l,dir:v,loop:d,children:i.jsx(ze.div,{...g,ref:t})}):i.jsx(ze.div,{...g,ref:t})})}),Dh="ToggleGroupItem",FM=ee.forwardRef((e,t)=>{const n=IM(Dh,e.__scopeToggleGroup),r=eZ(Dh,e.__scopeToggleGroup),o=PM(e.__scopeToggleGroup),l=n.value.includes(e.value),u=r.disabled||e.disabled,d={...e,pressed:l,disabled:u},h=ee.useRef(null);return r.rovingFocus?i.jsx(tb,{asChild:!0,...o,focusable:!u,active:l,ref:h,children:i.jsx(HC,{...d,ref:t})}):i.jsx(HC,{...d,ref:t})});FM.displayName=Dh;var HC=ee.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:r,...o}=e,l=IM(Dh,n),u={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},d=l.type==="single"?u:void 0;return i.jsx(DM,{...d,...o,ref:t,onPressedChange:h=>{h?l.onItemActivate(r):l.onItemDeactivate(r)}})}),tZ=xb,nZ=FM;const rZ=Ko("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 min-w-9 px-2",sm:"h-8 min-w-8 px-1.5",lg:"h-10 min-w-10 px-2.5"}},defaultVariants:{variant:"default",size:"default"}}),BM=p.createContext({size:"default",variant:"default",spacing:0});function sZ({className:e,variant:t,size:n,spacing:r=0,children:o,...l}){return i.jsx(tZ,{"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":r,style:{"--gap":r},className:W("group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",e),...l,children:i.jsx(BM.Provider,{value:{variant:t,size:n,spacing:r},children:o})})}function aZ({className:e,children:t,variant:n,size:r,...o}){const l=p.useContext(BM);return i.jsx(nZ,{"data-slot":"toggle-group-item","data-variant":l.variant||n,"data-size":l.size||r,"data-spacing":l.spacing,className:W(rZ({variant:l.variant||n,size:l.size||r}),"w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10","data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l",e),...o,children:t})}const lu={versioning:!0,scheduling:!0,localization:!1,mediaManagement:!0},Hi={_id:null,defaultLocale:"en",availableLocales:["en","es","fr","de"],features:lu},oZ=[{value:"en",label:"English (en)"},{value:"es",label:"Spanish (es)"},{value:"fr",label:"French (fr)"},{value:"de",label:"German (de)"},{value:"it",label:"Italian (it)"},{value:"pt",label:"Portuguese (pt)"},{value:"zh",label:"Chinese (zh)"},{value:"ja",label:"Japanese (ja)"}],iZ=[{value:"light",label:"Light",icon:i.jsx(P5,{className:"size-4"})},{value:"dark",label:"Dark",icon:i.jsx(d5,{className:"size-4"})},{value:"system",label:"System",icon:i.jsx(c5,{className:"size-4"})}];function UM(){const{theme:e,setTheme:t,canToggleDarkMode:n}=NL();return n?i.jsxs(xr,{elevation:"base",className:"p-6",children:[i.jsx("h2",{className:"mb-4 text-lg font-semibold text-foreground",children:"Appearance"}),i.jsx("div",{className:"flex flex-col gap-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx(rt,{className:"text-sm font-medium",children:"Theme"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose your preferred color theme for the admin interface."})]}),i.jsx(sZ,{type:"single",value:e,onValueChange:r=>r&&t(r),children:iZ.map(r=>i.jsxs(aZ,{value:r.value,children:[r.icon,r.label]},r.value))})]})})]}):null}function lZ(){return i.jsx(Mh,{requiredPermission:{resource:"settings",action:"manage"},children:i.jsxs("div",{className:"flex flex-col gap-4 md:gap-6",children:[i.jsx(as,{title:"Settings",description:"Configure your CMS settings and preferences."}),i.jsxs("div",{className:"flex flex-col gap-6",children:[i.jsx(UM,{}),i.jsxs(Au,{children:[i.jsx(BP,{className:"size-4"}),i.jsxs(Ou,{children:[i.jsx("strong",{children:"Settings not configured."})," To enable CMS settings, export"," ",i.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"getSettings"}),","," ",i.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"updateSettings"}),", and"," ",i.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"resetSettings"})," ","from your"," ",i.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"convex/admin.ts"})," ","file."]})]}),i.jsxs(xr,{elevation:"base",className:"p-6",children:[i.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Features"}),i.jsxs(xt,{variant:"secondary",className:"gap-1",children:[i.jsx(Xx,{className:"size-3"}),"Default values"]})]}),i.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:"Showing default feature flags. Configure settings in your admin API to customize."}),i.jsx("div",{className:"flex flex-col gap-4",children:["versioning","scheduling","localization","mediaManagement"].map(e=>i.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[i.jsx("div",{children:i.jsx(rt,{className:"text-sm font-medium capitalize",children:e})}),i.jsx(rl,{checked:lu[e],disabled:!0})]},e))})]}),i.jsxs(xr,{elevation:"base",className:"p-6",children:[i.jsx("h2",{className:"mb-4 text-lg font-semibold text-foreground",children:"API"}),i.jsx("div",{className:"flex flex-col gap-4",children:i.jsxs("div",{children:[i.jsx(rt,{className:"text-sm font-medium",children:"Convex Deployment URL"}),i.jsx("code",{className:"mt-1 block rounded-md bg-muted px-3 py-2 text-sm",children:"Not configured"})]})})]})]})]})})}function cZ({api:e}){const{canManageSettings:t}=gm(),n=t(),r=Vh(),o=He(e.getSettings,{}),l=et(e.updateSettings??(()=>{})),u=et(e.resetSettings??(()=>{})),[d,h]=p.useState(null),[m,v]=p.useState(!1),[g,y]=p.useState("idle"),[w,S]=p.useState(null),j=p.useMemo(()=>o?{_id:o._id??null,defaultLocale:o.defaultLocale??Hi.defaultLocale,availableLocales:o.availableLocales??Hi.availableLocales,features:{...lu,...o.features??{}},updatedBy:o.updatedBy,_creationTime:o._creationTime}:null,[o]);p.useEffect(()=>{j&&!d&&h(j)},[j,d]),p.useEffect(()=>{j&&!m&&h(j)},[j,m]);const N=p.useCallback(R=>{d&&(h({...d,defaultLocale:R}),v(!0),y("idle"))},[d]),C=p.useCallback(async()=>{if(!(!d||!m||!e.updateSettings)){y("saving"),S(null);try{await l({defaultLocale:d.defaultLocale}),y("saved"),v(!1),setTimeout(()=>{y("idle")},3e3)}catch(R){y("error"),S(R instanceof Error?R.message:"Failed to save settings")}}},[d,m,e.updateSettings,l]),_=p.useCallback(async()=>{if(!(!e.resetSettings||!window.confirm("Are you sure you want to reset all settings to their defaults? This action cannot be undone."))){y("saving"),S(null);try{const T=await u({});h({...Hi,_id:T?._id??null,defaultLocale:T?.defaultLocale??Hi.defaultLocale,availableLocales:T?.availableLocales??Hi.availableLocales,features:{...lu,...T?.features??{}}}),y("saved"),v(!1),setTimeout(()=>{y("idle")},3e3)}catch(T){y("error"),S(T instanceof Error?T.message:"Failed to reset settings")}}},[e.resetSettings,u]),E=p.useCallback(()=>{j&&(h(j),v(!1),y("idle"),S(null))},[j]);if(o===void 0)return i.jsx(Mh,{requiredPermission:{resource:"settings",action:"manage"},children:i.jsxs("div",{className:"flex flex-col gap-4 md:gap-6",children:[i.jsx(as,{title:"Settings",description:"Configure your CMS settings and preferences."}),i.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[i.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),i.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading settings..."})]})]})});const M=d??j??Hi,A=M.features??lu;return i.jsx(Mh,{requiredPermission:{resource:"settings",action:"manage"},children:i.jsxs("div",{className:"flex flex-col gap-4 md:gap-6",children:[i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsx(as,{title:"Settings",description:"Configure your CMS settings and preferences."}),n&&e.updateSettings&&i.jsxs("div",{className:"flex items-center gap-3",children:[g==="saved"&&i.jsxs(xt,{variant:"secondary",className:"gap-1 bg-diff-added-bg text-diff-added-foreground",children:[i.jsx(Ms,{className:"size-3"}),"Settings saved successfully"]}),g==="error"&&i.jsxs(xt,{variant:"destructive",className:"gap-1",children:[i.jsx(At,{className:"size-3"}),w||"An error occurred"]}),m&&i.jsx(me,{variant:"secondary",onClick:E,disabled:g==="saving",children:"Discard Changes"}),i.jsx(me,{onClick:C,disabled:!m,loading:g==="saving",children:"Save Changes"})]})]}),i.jsxs("div",{className:"flex flex-col gap-6",children:[i.jsx(UM,{}),A.localization&&i.jsxs(xr,{elevation:"base",className:"p-6",children:[i.jsx("h2",{className:"mb-4 text-lg font-semibold text-foreground",children:"General"}),i.jsx("div",{className:"flex flex-col gap-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx(rt,{className:"text-sm font-medium",children:"Default Locale"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"The default language for new content entries."})]}),i.jsxs(ia,{value:M.defaultLocale,onValueChange:N,disabled:!n||g==="saving"||!e.updateSettings,children:[i.jsx(ca,{className:"w-48",children:i.jsx(la,{})}),i.jsx(ua,{children:oZ.map(R=>i.jsx(Xt,{value:R.value,children:R.label},R.value))})]})]})})]}),i.jsxs(xr,{elevation:"base",className:"p-6",children:[i.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Features"}),i.jsxs(xt,{variant:"secondary",className:"gap-1",children:[i.jsx(Xx,{className:"size-3"}),"Configured in code"]})]}),i.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:"Feature flags are defined in your Convex configuration and cannot be changed from the UI."}),i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[i.jsxs("div",{children:[i.jsx(rt,{className:"text-sm font-medium",children:"Versioning"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Track content history and enable rollback to previous versions"})]}),i.jsx(rl,{checked:A.versioning,disabled:!0})]}),i.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[i.jsxs("div",{children:[i.jsx(rt,{className:"text-sm font-medium",children:"Scheduling"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Schedule content to publish at a future date and time"})]}),i.jsx(rl,{checked:A.scheduling,disabled:!0})]}),i.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[i.jsxs("div",{children:[i.jsx(rt,{className:"text-sm font-medium",children:"Localization"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Support multiple languages for content entries"})]}),i.jsx(rl,{checked:A.localization,disabled:!0})]}),r.navigation.showMedia&&i.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[i.jsxs("div",{children:[i.jsx(rt,{className:"text-sm font-medium",children:"Media Management"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Use the built-in media library for image and file uploads"})]}),i.jsx(rl,{checked:A.mediaManagement,disabled:!0})]})]})]}),i.jsxs(xr,{elevation:"base",className:"p-6",children:[i.jsx("h2",{className:"mb-4 text-lg font-semibold text-foreground",children:"API"}),i.jsx("div",{className:"flex flex-col gap-4",children:i.jsxs("div",{children:[i.jsx(rt,{className:"text-sm font-medium",children:"Convex Deployment URL"}),i.jsx("code",{className:"mt-1 block rounded-md bg-muted px-3 py-2 text-sm",children:"Not configured"})]})})]}),n&&e.resetSettings&&i.jsxs(xr,{elevation:"base",className:"border-destructive/50 p-6",children:[i.jsx("h2",{className:"mb-4 text-lg font-semibold text-destructive",children:"Danger Zone"}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx(rt,{className:"text-sm font-medium",children:"Reset to Defaults"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Reset all settings to their default values. This cannot be undone."})]}),i.jsx(me,{variant:"danger",onClick:_,disabled:g==="saving",children:"Reset Settings"})]})]})]})]})})}function uZ({api:e,navigation:t}){return e.getSettings?i.jsx(cZ,{api:e}):i.jsx(lZ,{})}function dZ({taxonomy:e,onSave:t,onCancel:n}){const r=!!e,[o,l]=p.useState({name:e?.name??"",displayName:e?.displayName??"",description:e?.description??"",isHierarchical:e?.isHierarchical??!1,allowInlineCreation:e?.allowInlineCreation??!0,isActive:e?.isActive??!0,icon:e?.icon??"",sortOrder:e?.sortOrder??0}),[u,d]=p.useState({}),[h,m]=p.useState(!1),[v,g]=p.useState(null),[y,w]=p.useState(!1),S=xn(),j=et(S.createTaxonomy),N=et(S.updateTaxonomy);p.useEffect(()=>{e&&l({name:e.name,displayName:e.displayName,description:e.description??"",isHierarchical:e.isHierarchical,allowInlineCreation:e.allowInlineCreation,isActive:e.isActive,icon:e.icon??"",sortOrder:e.sortOrder??0})},[e]);const C=p.useCallback((R,T)=>{l(O=>({...O,[R]:T})),d(O=>{const{[R]:D,...z}=O;return z})},[]),_=p.useCallback(R=>R.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),[]),E=p.useCallback(R=>{C("displayName",R),!r&&!y&&C("name",_(R))},[C,r,y,_]),M=p.useCallback(()=>{const R={};return o.name.trim()?/^[a-z][a-z0-9-]*$/.test(o.name)||(R.name="Slug must start with a letter and contain only lowercase letters, numbers, and hyphens"):R.name="Slug is required",o.displayName.trim()||(R.displayName="Display name is required"),d(R),Object.keys(R).length===0},[o]),A=p.useCallback(async R=>{if(R.preventDefault(),!!M()){m(!0),g(null);try{r&&e?await N({id:e._id,displayName:o.displayName,description:o.description||void 0,allowInlineCreation:o.allowInlineCreation,icon:o.icon||void 0,sortOrder:o.sortOrder,isActive:o.isActive}):await j({name:o.name,displayName:o.displayName,description:o.description||void 0,isHierarchical:o.isHierarchical,allowInlineCreation:o.allowInlineCreation,icon:o.icon||void 0,sortOrder:o.sortOrder}),t()}catch(T){const O=T instanceof Error?T.message:"Failed to save taxonomy";g(O)}finally{m(!1)}}},[M,r,e,o,j,N,t]);return i.jsx(ls,{open:!0,onOpenChange:R=>!R&&!h&&n(),title:r?"Edit Taxonomy":"Create Taxonomy",size:"lg",footer:i.jsxs(i.Fragment,{children:[i.jsx(me,{variant:"outline",onClick:n,disabled:h,children:"Cancel"}),i.jsx(me,{variant:"primary",onClick:A,loading:h,children:r?"Save Changes":"Create Taxonomy"})]}),children:i.jsxs("form",{onSubmit:A,className:"flex flex-col gap-4",children:[v&&i.jsx("div",{className:"diff-removed rounded-lg border px-3 py-2 text-sm",children:v}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs(rt,{htmlFor:"displayName",children:["Display Name ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(mt,{id:"displayName",value:o.displayName,onChange:R=>E(R.target.value),placeholder:"e.g., Categories, Tags",disabled:h,className:u.displayName?"border-destructive":""}),u.displayName&&i.jsx("p",{className:"text-xs text-destructive",children:u.displayName})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs(rt,{htmlFor:"name",children:["Slug ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(mt,{id:"name",value:o.name,onChange:R=>{C("name",R.target.value.toLowerCase()),w(!0)},placeholder:"e.g., categories, tags",disabled:h||r,className:u.name?"border-destructive":""}),u.name&&i.jsx("p",{className:"text-xs text-destructive",children:u.name}),r&&i.jsx("p",{className:"text-xs text-muted-foreground",children:"Slug cannot be changed after creation"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx(rt,{htmlFor:"description",children:"Description"}),i.jsx(no,{id:"description",value:o.description,onChange:R=>C("description",R.target.value),placeholder:"Optional description",rows:2,disabled:h})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx(rt,{htmlFor:"icon",children:"Icon"}),i.jsx(mt,{id:"icon",value:o.icon,onChange:R=>C("icon",R.target.value),placeholder:"e.g., 🏷️ or folder",disabled:h}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Emoji or icon name"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx(rt,{htmlFor:"sortOrder",children:"Sort Order"}),i.jsx(mt,{id:"sortOrder",type:"number",value:o.sortOrder,onChange:R=>C("sortOrder",parseInt(R.target.value)||0),disabled:h})]})]}),i.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(wr,{id:"isHierarchical",checked:o.isHierarchical,onCheckedChange:R=>C("isHierarchical",R),disabled:h||r}),i.jsxs("div",{className:"flex flex-col gap-0.5",children:[i.jsx(rt,{htmlFor:"isHierarchical",className:"cursor-pointer font-medium",children:"Hierarchical"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Terms can have parent-child relationships (like categories)"}),r&&i.jsx("p",{className:"text-xs text-warning",children:"Hierarchy type cannot be changed after creation"})]})]}),i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(wr,{id:"allowInlineCreation",checked:o.allowInlineCreation,onCheckedChange:R=>C("allowInlineCreation",R),disabled:h}),i.jsxs("div",{className:"flex flex-col gap-0.5",children:[i.jsx(rt,{htmlFor:"allowInlineCreation",className:"cursor-pointer font-medium",children:"Allow inline creation"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Users can create new terms while editing content"})]})]}),i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(wr,{id:"isActive",checked:o.isActive,onCheckedChange:R=>C("isActive",R),disabled:h}),i.jsxs("div",{className:"flex flex-col gap-0.5",children:[i.jsx(rt,{htmlFor:"isActive",className:"cursor-pointer font-medium",children:"Active"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Inactive taxonomies are hidden from content editors"})]})]})]})]})})}function fZ({taxonomyId:e,isHierarchical:t,allowInlineCreation:n}){const r=xn(),[o,l]=p.useState(new Set),[u,d]=p.useState(null),[h,m]=p.useState(!1),[v,g]=p.useState(),[y,w]=p.useState(null),[S,j]=p.useState(null),N=t?He(r.getTermsHierarchy,{taxonomyId:e}):He(r.listTerms,{taxonomyId:e}),C=et(r.deleteTerm),_=t?N:N?.page,E=_===void 0,M=p.useCallback(D=>{l(z=>{const B=new Set(z);return B.has(D)?B.delete(D):B.add(D),B})},[]),A=p.useCallback(D=>{g(D),d(null),m(!0)},[]),R=p.useCallback(D=>{d(D),m(!0)},[]),T=p.useCallback(async D=>{j(null);try{await C({id:D,cascade:!0}),w(null)}catch(z){const B=z instanceof Error?z.message:"Failed to delete term";j(B)}},[C]),O=(D,z=0)=>{const B=D.children&&D.children.length>0,V=o.has(D._id);return i.jsxs("div",{className:"border-b border-border/50 last:border-0",children:[i.jsxs("div",{className:W("group flex items-center gap-2 py-2 pr-2 transition-colors hover:bg-muted/50",z>0&&"border-l-2 border-muted"),style:{paddingLeft:`${z*24+8}px`},children:[t&&i.jsx("button",{type:"button",onClick:()=>M(D._id),disabled:!B,className:W("flex size-5 items-center justify-center rounded transition-colors",B?"text-muted-foreground hover:bg-muted hover:text-foreground":"invisible"),"aria-expanded":V,children:B&&(V?i.jsx(vn,{className:"size-4"}):i.jsx(Rl,{className:"size-4"}))}),i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[D.color&&i.jsx("span",{className:"size-3 shrink-0 rounded-full",style:{backgroundColor:D.color}}),D.icon&&i.jsx("span",{className:"shrink-0 text-sm",children:D.icon}),i.jsx("span",{className:"truncate font-medium text-foreground",children:D.name}),i.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:["(",D.slug,")"]}),i.jsxs("span",{className:"ml-auto shrink-0 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:[D.usageCount," ",D.usageCount===1?"use":"uses"]})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[t&&n&&i.jsx(me,{variant:"ghost",size:"sm",onClick:()=>A(D._id),title:"Add child term",className:"size-7 p-0",children:i.jsx(Un,{className:"size-3.5"})}),i.jsx(me,{variant:"ghost",size:"sm",onClick:()=>R(D),title:"Edit term",className:"size-7 p-0",children:i.jsx(fa,{className:"size-3.5"})}),i.jsx(me,{variant:"ghost",size:"sm",onClick:()=>w(D._id),title:"Delete term",className:"size-7 p-0 text-destructive hover:text-destructive",children:i.jsx(Fn,{className:"size-3.5"})})]})]}),t&&B&&V&&i.jsx("div",{children:D.children.map(Y=>O(Y,z+1))})]},D._id)};return i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Terms"}),i.jsxs(me,{variant:"secondary",size:"sm",onClick:()=>A(),children:[i.jsx(Un,{className:"size-3.5"}),"Add Term"]})]}),S&&i.jsxs("div",{className:"diff-removed flex items-center justify-between rounded-lg border px-3 py-2 text-sm",children:[S,i.jsx("button",{type:"button",onClick:()=>j(null),className:"text-diff-removed hover:text-diff-removed-foreground",children:"×"})]}),i.jsx("div",{className:"rounded-lg border bg-card",children:E?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx("div",{className:"size-6 animate-spin rounded-full border-2 border-muted border-t-primary"})}):!_||_.length===0?i.jsx(Bn,{icon:i.jsx(ty,{className:"size-8"}),title:"No terms yet",description:"Add your first term to start organizing content.",action:n?{label:"Add your first term",onClick:()=>A(),variant:"secondary"}:void 0}):i.jsx("div",{className:"divide-y divide-border/50",children:_.map(D=>O(D))})}),h&&i.jsx(hZ,{taxonomyId:e,term:u,parentId:v,isHierarchical:t,onSave:()=>{m(!1),d(null),g(void 0)},onCancel:()=>{m(!1),d(null),g(void 0)}}),i.jsx(oa,{open:!!y,onOpenChange:D=>!D&&w(null),title:"Delete Term",description:t?"Are you sure you want to delete this term? All child terms will also be deleted.":"Are you sure you want to delete this term?",confirmLabel:"Delete",variant:"danger",onConfirm:()=>y&&T(y)})]})}function hZ({taxonomyId:e,term:t,parentId:n,isHierarchical:r,onSave:o,onCancel:l}){const u=!!t,[d,h]=p.useState({name:t?.name??"",slug:t?.slug??"",description:t?.description??"",color:t?.color??"",icon:t?.icon??"",sortOrder:t?.sortOrder??0}),[m,v]=p.useState({}),[g,y]=p.useState(!1),[w,S]=p.useState(null),[j,N]=p.useState(!1),C=xn(),_=et(C.createTerm),E=et(C.updateTerm),M=p.useCallback((z,B)=>{h(V=>({...V,[z]:B})),v(V=>{const{[z]:Y,...G}=V;return G})},[]),A=p.useCallback(z=>z.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),[]),R=p.useCallback(z=>{M("name",z),!u&&!j&&M("slug",A(z))},[M,u,j,A]),T=p.useCallback(()=>{const z={};return d.name.trim()||(z.name="Name is required"),d.slug.trim()?/^[a-z0-9-]+$/.test(d.slug)||(z.slug="Slug must contain only lowercase letters, numbers, and hyphens"):z.slug="Slug is required",v(z),Object.keys(z).length===0},[d]),O=p.useCallback(async z=>{if(z.preventDefault(),!!T()){y(!0),S(null);try{u&&t?await E({id:t._id,name:d.name,slug:d.slug,description:d.description||void 0,color:d.color||void 0,icon:d.icon||void 0,sortOrder:d.sortOrder}):await _({taxonomyId:e,name:d.name,slug:d.slug,description:d.description||void 0,parentId:n,color:d.color||void 0,icon:d.icon||void 0,sortOrder:d.sortOrder}),o()}catch(B){const V=B instanceof Error?B.message:"Failed to save term";S(V)}finally{y(!1)}}},[T,u,t,d,e,n,_,E,o]),D=u?"Edit Term":n?"Create Child Term":"Create Term";return i.jsx(ls,{open:!0,onOpenChange:z=>!z&&!g&&l(),title:D,size:"md",footer:i.jsxs(i.Fragment,{children:[i.jsx(me,{variant:"outline",onClick:l,disabled:g,children:"Cancel"}),i.jsx(me,{variant:"primary",onClick:O,loading:g,children:u?"Save Changes":"Create Term"})]}),children:i.jsxs("form",{onSubmit:O,className:"flex flex-col gap-4",children:[w&&i.jsx("div",{className:"diff-removed rounded-lg border px-3 py-2 text-sm",children:w}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs(rt,{htmlFor:"termName",children:["Name ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(mt,{id:"termName",value:d.name,onChange:z=>R(z.target.value),placeholder:"e.g., Technology",disabled:g,className:m.name?"border-destructive":""}),m.name&&i.jsx("p",{className:"text-xs text-destructive",children:m.name})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs(rt,{htmlFor:"termSlug",children:["Slug ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(mt,{id:"termSlug",value:d.slug,onChange:z=>{M("slug",z.target.value.toLowerCase()),N(!0)},placeholder:"e.g., technology",disabled:g,className:m.slug?"border-destructive":""}),m.slug&&i.jsx("p",{className:"text-xs text-destructive",children:m.slug})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx(rt,{htmlFor:"termDescription",children:"Description"}),i.jsx(no,{id:"termDescription",value:d.description,onChange:z=>M("description",z.target.value),placeholder:"Optional description",rows:2,disabled:g})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx(rt,{htmlFor:"termColor",children:"Color"}),i.jsx(mt,{id:"termColor",type:"color",value:d.color||"#6b7280",onChange:z=>M("color",z.target.value),disabled:g,className:"h-9 p-1"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx(rt,{htmlFor:"termIcon",children:"Icon"}),i.jsx(mt,{id:"termIcon",value:d.icon,onChange:z=>M("icon",z.target.value),placeholder:"e.g., 💻",disabled:g})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx(rt,{htmlFor:"termSortOrder",children:"Sort Order"}),i.jsx(mt,{id:"termSortOrder",type:"number",value:d.sortOrder,onChange:z=>M("sortOrder",parseInt(z.target.value)||0),disabled:g})]})]})]})})}function ed({className:e,children:t,...n}){return i.jsxs(GG,{"data-slot":"scroll-area",className:W("relative",e),...n,children:[i.jsx(ZG,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),i.jsx(mZ,{}),i.jsx(QG,{})]})}function mZ({className:e,orientation:t="vertical",...n}){return i.jsx(CM,{"data-slot":"scroll-area-scrollbar",orientation:t,className:W("flex touch-none p-px transition-colors select-none",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...n,children:i.jsx(EM,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function pZ({api:e,navigation:t}){const[n,r]=p.useState(null),[o,l]=p.useState(!1),[u,d]=p.useState(null),[h,m]=p.useState(null),[v,g]=p.useState(null),y=He(e.listTaxonomies,{isActive:void 0,includeDeleted:!1}),w=et(e.deleteTaxonomy),S=y?.page??[],j=y===void 0,N=p.useCallback(()=>{d(null),l(!0)},[]),C=p.useCallback(A=>{d(A),l(!0)},[]),_=p.useCallback(async A=>{g(null);try{await w({id:A}),m(null),n?._id===A&&r(null)}catch(R){const T=R instanceof Error?R.message:"Failed to delete taxonomy";g(T)}},[w,n]),E=p.useCallback(()=>{l(!1),d(null)},[]),M=A=>A.isHierarchical?i.jsx(CP,{className:"size-5"}):i.jsx(Po,{className:"size-5"});return i.jsxs("div",{className:"flex h-[calc(100vh-4rem)] flex-col p-6",children:[i.jsxs("div",{className:"mb-6 flex items-start justify-between",children:[i.jsx(as,{title:"Taxonomies",description:"Manage tags, categories, and other classification systems"}),i.jsxs(me,{onClick:N,children:[i.jsx(Un,{className:"size-4"}),"Create Taxonomy"]})]}),i.jsxs("div",{className:"flex min-h-0 flex-1 gap-6",children:[i.jsx(xr,{elevation:"base",className:"w-80 shrink-0 overflow-hidden",children:j?i.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[i.jsx("div",{className:"size-6 animate-spin rounded-full border-2 border-muted border-t-primary"}),i.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"Loading taxonomies..."})]}):S.length===0?i.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center",children:[i.jsx(Po,{className:"mb-3 size-8 text-muted-foreground"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"No taxonomies created yet."}),i.jsx(me,{variant:"secondary",className:"mt-4",onClick:N,children:"Create your first taxonomy"})]}):i.jsx(ed,{className:"h-full",children:i.jsx("div",{className:"divide-y",children:S.map(A=>i.jsxs("div",{className:W("group flex cursor-pointer items-center gap-3 p-3 transition-colors hover:bg-muted/50",n?._id===A._id&&"bg-primary/5",!A.isActive&&"opacity-60"),onClick:()=>r(A),children:[i.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:M(A)}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:A.displayName}),i.jsx("p",{className:"truncate text-xs text-muted-foreground",children:A.name})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[i.jsx(xt,{variant:"secondary",className:"text-xs font-normal",children:A.isHierarchical?"Hierarchical":"Flat"}),!A.isActive&&i.jsx(xt,{variant:"outline",className:"text-xs font-normal",children:"Inactive"})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[i.jsx(me,{variant:"ghost",size:"icon-sm",onClick:R=>{R.stopPropagation(),C(A)},title:"Edit taxonomy",children:i.jsx(fa,{className:"size-4"})}),i.jsx(me,{variant:"ghost",size:"icon-sm",onClick:R=>{R.stopPropagation(),m(A._id)},title:"Delete taxonomy",className:"text-destructive hover:bg-destructive/10 hover:text-destructive",children:i.jsx(Fn,{className:"size-4"})})]})]},A._id))})})}),i.jsx(xr,{elevation:"base",className:"min-w-0 flex-1 overflow-hidden",children:n?i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsxs("div",{className:"flex items-start justify-between border-b p-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex size-10 items-center justify-center rounded-md bg-muted text-muted-foreground",children:M(n)}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-semibold text-foreground",children:n.displayName}),n.description&&i.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]})]}),i.jsx(me,{variant:"secondary",onClick:()=>C(n),children:"Edit Taxonomy"})]}),i.jsx("div",{className:"flex-1 overflow-auto p-4",children:i.jsx(fZ,{taxonomyId:n._id,isHierarchical:n.isHierarchical,allowInlineCreation:n.allowInlineCreation})})]}):i.jsx(Bn,{icon:i.jsx(Po,{className:"size-6"}),title:"Select a taxonomy",description:"Select a taxonomy to view and manage its terms",className:"h-full"})})]}),o&&i.jsx(dZ,{taxonomy:u,onSave:E,onCancel:()=>{l(!1),d(null)}}),i.jsx(oa,{open:h!==null,onOpenChange:A=>{A||(m(null),g(null))},title:"Delete Taxonomy",description:"Are you sure you want to delete this taxonomy? All associated terms will also be deleted.",confirmLabel:"Delete",onConfirm:()=>h&&_(h),variant:"danger",error:v})]})}function gZ({api:e,navigation:t}){const[n,r]=p.useState(""),[o,l]=p.useState(""),[u,d]=p.useState(new Set),[h,m]=p.useState(null),[v,g]=p.useState(!1),[y,w]=p.useState(!1),[S,j]=p.useState(!1),[N,C]=p.useState(null),_=He(e.listTrash,{contentTypeId:n||void 0,search:o||void 0,paginationOpts:{numItems:50,cursor:null}}),E=He(e.getTrashConfig,{}),M=He(e.getTrashStats,{}),R=He(e.listContentTypes,{})?.page??[],T=et(e.bulkRestore),O=et(e.emptyTrash),D=_?.page??[],z=_===void 0,B=E,V=M,Y=p.useCallback(async H=>{g(!0),m(null);try{await T({ids:H}),d(le=>{const I=new Set(le);return H.forEach(F=>I.delete(F)),I})}catch(le){const I=le instanceof Error?le.message:"Failed to restore";m(I)}finally{g(!1)}},[T]),G=p.useCallback(async()=>{j(!0),C(null);try{await O({}),w(!1),d(new Set)}catch(H){const le=H instanceof Error?H.message:"Failed to empty trash";C(le)}finally{j(!1)}},[O]),ae=H=>new Date(H).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),L=H=>{if(!B?.retentionDays)return null;const le=H+B.retentionDays*24*60*60*1e3,I=Math.ceil((le-Date.now())/(1440*60*1e3));return Math.max(0,I)},$=H=>{if(H.title)return H.title;if(H.name)return H.name;if(H.data){const le=H.data.title||H.data.name;if(le&&typeof le=="string")return le}return H.slug||H._id},U=p.useMemo(()=>[{key:"name",header:"Name",cell:H=>i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"font-medium text-foreground",children:$(H)}),H.slug&&i.jsx("span",{className:"block text-xs text-muted-foreground",children:H.slug})]})},{key:"type",header:"Type",cell:H=>i.jsx("span",{className:"text-sm text-muted-foreground",children:H.contentTypeName||"Unknown"})},{key:"deleted",header:"Deleted",cell:H=>i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-sm text-muted-foreground",children:ae(H.deletedAt)}),H.deletedBy&&i.jsxs("span",{className:"block text-xs text-muted-foreground",children:["by ",H.deletedBy]})]})},{key:"expires",header:"Expires In",cell:H=>{const le=L(H.deletedAt);return le!==null?i.jsxs(xt,{variant:le<=3?"destructive":"secondary",className:"font-normal",children:[le," ",le===1?"day":"days"]}):null}},{key:"actions",header:"Actions",cell:H=>i.jsxs(me,{variant:"outline",size:"sm",onClick:()=>Y([H._id]),loading:v,children:[i.jsx(xu,{className:"size-4"}),"Restore"]})}],[v,Y,B?.retentionDays]);return i.jsxs("div",{className:"flex flex-col gap-4 md:gap-6",children:[i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsx(as,{title:"Trash",description:`Deleted items are kept for ${B?.retentionDays??30} days before permanent deletion`}),D.length>0&&i.jsxs(me,{variant:"danger",onClick:()=>w(!0),children:[i.jsx(Fn,{className:"size-4"}),"Empty Trash"]})]}),V&&i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[i.jsxs(xr,{elevation:"base",className:"p-4",children:[i.jsx("p",{className:"text-2xl font-semibold text-foreground",children:V.totalCount??0}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Items in Trash"})]}),i.jsxs(xr,{elevation:"base",className:"p-4",children:[i.jsx("p",{className:"text-2xl font-semibold text-foreground",children:V.expiredCount??0}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Expired"})]})]}),i.jsx(ym,{search:{value:o,onChange:l,placeholder:"Search deleted items...",className:"w-full md:w-64"},filters:[{key:"contentType",value:n||"all",onChange:H=>r(H==="all"?"":H),options:[{value:"all",label:"All Content Types"},...R.map(H=>({value:H._id,label:H.displayName}))],className:"w-full sm:w-48"}]}),h&&i.jsxs(Au,{variant:"destructive",children:[i.jsx(Fo,{className:"size-4"}),i.jsxs(Ou,{className:"flex items-center justify-between",children:[h,i.jsx(me,{variant:"ghost",size:"icon-sm",onClick:()=>m(null),children:i.jsx(At,{className:"size-4"})})]})]}),N&&i.jsxs(Au,{variant:"destructive",children:[i.jsx(Fo,{className:"size-4"}),i.jsxs(Ou,{className:"flex items-center justify-between",children:[N,i.jsx(me,{variant:"ghost",size:"icon-sm",onClick:()=>C(null),children:i.jsx(At,{className:"size-4"})})]})]}),u.size>0&&i.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-primary/20 bg-primary/5 p-3",children:[i.jsxs("span",{className:"text-sm font-medium",children:[u.size," ",u.size===1?"item":"items"," ","selected"]}),i.jsxs(me,{variant:"primary",size:"sm",onClick:()=>Y(Array.from(u)),loading:v,children:[i.jsx(xu,{className:"size-4"}),"Restore Selected"]}),i.jsx(me,{variant:"secondary",size:"sm",onClick:()=>d(new Set),children:"Clear Selection"})]}),z?i.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[i.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),i.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading trash..."})]}):D.length===0?i.jsx(Bn,{icon:i.jsx(Fn,{className:"size-6"}),title:"Trash is empty",description:"Deleted items will appear here"}):i.jsx(fb,{columns:U,data:D,getRowId:H=>H._id,selectable:!0,selectedIds:u,onSelectionChange:d,emptyMessage:"No items in trash"}),i.jsx(oa,{open:y,onOpenChange:w,title:"Empty Trash",description:"This will permanently delete all items in the trash. This action cannot be undone.",confirmLabel:S?"Deleting...":"Empty Trash",onConfirm:G,variant:"danger",loading:S})]})}function vZ(e){if(typeof document>"u")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))}Array(12).fill(0);let _x=1;class xZ{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...o}=t,l=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:_x++,u=this.toasts.find(h=>h.id===l),d=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),u?this.toasts=this.toasts.map(h=>h.id===l?(this.publish({...h,...t,id:l,title:r}),{...h,...t,id:l,dismissible:d,title:r}):h):this.addToast({title:r,...o,dismissible:d,id:l}),l},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const o=Promise.resolve(t instanceof Function?t():t);let l=r!==void 0,u;const d=o.then(async m=>{if(u=["resolve",m],ee.isValidElement(m))l=!1,this.create({id:r,type:"default",message:m});else if(bZ(m)&&!m.ok){l=!1;const g=typeof n.error=="function"?await n.error(`HTTP error! status: ${m.status}`):n.error,y=typeof n.description=="function"?await n.description(`HTTP error! status: ${m.status}`):n.description,S=typeof g=="object"&&!ee.isValidElement(g)?g:{message:g};this.create({id:r,type:"error",description:y,...S})}else if(m instanceof Error){l=!1;const g=typeof n.error=="function"?await n.error(m):n.error,y=typeof n.description=="function"?await n.description(m):n.description,S=typeof g=="object"&&!ee.isValidElement(g)?g:{message:g};this.create({id:r,type:"error",description:y,...S})}else if(n.success!==void 0){l=!1;const g=typeof n.success=="function"?await n.success(m):n.success,y=typeof n.description=="function"?await n.description(m):n.description,S=typeof g=="object"&&!ee.isValidElement(g)?g:{message:g};this.create({id:r,type:"success",description:y,...S})}}).catch(async m=>{if(u=["reject",m],n.error!==void 0){l=!1;const v=typeof n.error=="function"?await n.error(m):n.error,g=typeof n.description=="function"?await n.description(m):n.description,w=typeof v=="object"&&!ee.isValidElement(v)?v:{message:v};this.create({id:r,type:"error",description:g,...w})}}).finally(()=>{l&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),h=()=>new Promise((m,v)=>d.then(()=>u[0]==="reject"?v(u[1]):m(u[1])).catch(v));return typeof r!="string"&&typeof r!="number"?{unwrap:h}:Object.assign(r,{unwrap:h})},this.custom=(t,n)=>{const r=n?.id||_x++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Lr=new xZ,yZ=(e,t)=>{const n=t?.id||_x++;return Lr.addToast({title:e,...t,id:n}),n},bZ=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",wZ=yZ,SZ=()=>Lr.toasts,jZ=()=>Lr.getActiveToasts(),Qr=Object.assign(wZ,{success:Lr.success,info:Lr.info,warning:Lr.warning,error:Lr.error,custom:Lr.custom,message:Lr.message,promise:Lr.promise,dismiss:Lr.dismiss,loading:Lr.loading},{getHistory:SZ,getToasts:jZ});vZ("[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%)}");function CZ({entryId:e,fromVersion:t,toVersion:n,onClose:r,onRollback:o}){const l=xn(),u=He(l.compareVersions,{entryId:e,fromVersionNumber:t,toVersionNumber:n}),d=u===void 0,h=u,m=S=>S==null?"(empty)":typeof S=="object"?JSON.stringify(S,null,2):String(S),v=S=>{switch(S){case"added":return i.jsx(Un,{className:"size-3"});case"removed":return i.jsx(i5,{className:"size-3"});case"modified":return i.jsx(ey,{className:"size-3"});default:return null}},g=S=>{switch(S){case"added":return"diff-added border";case"removed":return"diff-removed border";case"modified":return"diff-modified border";default:return"border-border bg-card"}},y=S=>{switch(S){case"added":return"diff-icon-added";case"removed":return"diff-icon-removed";case"modified":return"diff-icon-modified";default:return"bg-muted text-muted-foreground"}},w=S=>new Date(S).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return i.jsxs("div",{className:"flex h-full flex-col bg-background",children:[i.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(_P,{className:"size-4 text-muted-foreground"}),i.jsxs("h3",{className:"font-semibold",children:["Comparing v",t," → v",n]})]}),i.jsx("button",{type:"button",onClick:r,className:"rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":"Close comparison",children:i.jsx(At,{className:"size-4"})})]}),i.jsx(ed,{className:"min-h-0 flex-1",children:i.jsx("div",{className:"p-4",children:d?i.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[i.jsx("div",{className:"size-6 animate-spin rounded-full border-2 border-muted border-t-primary"}),i.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Loading comparison..."})]}):h?h.hasChanges?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mb-4 flex items-center justify-center gap-3 rounded-lg border bg-muted/30 p-3",children:[i.jsxs("div",{className:"text-center",children:[i.jsxs(xt,{variant:"secondary",className:"font-mono",children:["v",h.fromVersion.versionNumber]}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:w(h.fromVersion.createdAt)})]}),i.jsx(k3,{className:"size-4 text-muted-foreground"}),i.jsxs("div",{className:"text-center",children:[i.jsxs(xt,{variant:"secondary",className:"font-mono",children:["v",h.toVersion.versionNumber]}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:w(h.toVersion.createdAt)})]})]}),h.changeSummary&&i.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:h.changeSummary}),i.jsx("div",{className:"flex flex-col gap-3",children:h.fieldDiffs.map((S,j)=>i.jsxs("div",{className:W("rounded-lg border p-3",g(S.changeType)),children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:W("flex size-5 items-center justify-center rounded",y(S.changeType)),children:v(S.changeType)}),i.jsx("span",{className:"font-medium text-foreground",children:S.field}),i.jsx(xt,{variant:"outline",className:"text-xs capitalize",children:S.changeType})]}),i.jsxs("div",{className:"mt-2 flex flex-col gap-2",children:[S.changeType!=="added"&&i.jsxs("div",{className:"rounded border border-diff-removed-border bg-card p-2",children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-diff-removed",children:"Before:"}),i.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words font-mono text-xs text-diff-removed-foreground",children:m(S.fromValue)})]}),S.changeType!=="removed"&&i.jsxs("div",{className:"rounded border border-diff-added-border bg-card p-2",children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-diff-added",children:"After:"}),i.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words font-mono text-xs text-diff-added-foreground",children:m(S.toValue)})]})]})]},j))})]}):i.jsx("div",{className:"py-8 text-center",children:i.jsx("p",{className:"text-sm text-muted-foreground",children:"No differences found between these versions"})}):i.jsx("div",{className:"diff-removed rounded-lg border px-4 py-3 text-sm",children:"Could not load version comparison"})})}),i.jsxs("div",{className:"flex items-center justify-between border-t px-4 py-3",children:[i.jsx(me,{variant:"outline",onClick:r,children:"Back to History"}),i.jsxs(me,{variant:"ghost",onClick:()=>o(t),children:["Rollback to v",t]})]})]})}function YC({targetVersion:e,currentVersion:t,isLoading:n,error:r,onConfirm:o,onCancel:l}){return i.jsx(ls,{open:!0,onOpenChange:u=>!u&&!n&&l(),title:"Confirm Rollback",size:"sm",footer:i.jsxs(i.Fragment,{children:[i.jsx(me,{variant:"outline",onClick:l,disabled:n,children:"Cancel"}),i.jsxs(me,{variant:"warning",onClick:o,loading:n,children:["Rollback to v",e]})]}),children:i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("p",{className:"text-sm text-muted-foreground",children:["You are about to rollback from"," ",i.jsxs("span",{className:"font-semibold text-foreground",children:["version ",t]})," ","to"," ",i.jsxs("span",{className:"font-semibold text-foreground",children:["version ",e]}),"."]}),i.jsx("div",{className:"diff-modified rounded-lg border p-3",children:i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Fo,{className:"mt-0.5 size-4 shrink-0 text-diff-modified"}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("p",{className:"text-sm font-medium text-diff-modified",children:"This action will:"}),i.jsxs("ul",{className:"flex flex-col gap-1 text-sm text-diff-modified-foreground",children:[i.jsxs("li",{children:["• Create a new version with the content from version"," ",e]}),i.jsx("li",{children:"• The current version will be preserved in history"}),i.jsx("li",{children:"• Any unsaved changes will be lost"})]})]})]})}),r&&i.jsxs("div",{className:"diff-removed rounded-lg border px-3 py-2 text-sm",children:[i.jsx("span",{className:"font-medium",children:"Error:"})," ",r]})]})})}function NZ({entryId:e,currentVersion:t,onRollbackComplete:n,onClose:r}){const o=xn(),[l,u]=p.useState(null),[d,h]=p.useState(null),[m,v]=p.useState(!1),[g,y]=p.useState(null),[w,S]=p.useState(!1),j=He(o.getVersionHistory,{entryId:e,paginationOpts:{numItems:50,cursor:null}}),N=et(o.rollbackVersion),C=j?.page??[],_=j===void 0,E=p.useCallback((T,O)=>{u([T,O])},[]),M=p.useCallback(T=>{h(T),y(null)},[]),A=p.useCallback(async()=>{if(d!==null){v(!0),y(null);try{await N({entryId:e,versionNumber:d}),h(null),S(!0),setTimeout(()=>{S(!1),n?.()},1500)}catch(T){const O=T instanceof Error?T.message:"Failed to rollback";y(O)}finally{v(!1)}}},[e,d,N,n]),R=T=>new Date(T).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return l?i.jsxs("div",{className:"flex h-full flex-col border-l bg-background",children:[i.jsx(CZ,{entryId:e,fromVersion:l[0],toVersion:l[1],onClose:()=>u(null),onRollback:T=>{u(null),M(T)}}),d!==null&&i.jsx(YC,{targetVersion:d,currentVersion:t,isLoading:m,error:g,onConfirm:A,onCancel:()=>{h(null),y(null)}})]}):i.jsxs("div",{className:"flex h-full flex-col border-l bg-background",children:[i.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ck,{className:"size-4 text-muted-foreground"}),i.jsx("h3",{className:"font-semibold",children:"Version History"})]}),i.jsx("button",{type:"button",onClick:r,className:"rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":"Close version history",children:i.jsx(At,{className:"size-4"})})]}),w&&i.jsxs("div",{className:"flex items-center gap-2 border-b bg-diff-added-bg px-4 py-2 text-sm text-diff-added-foreground",children:[i.jsx(Yx,{className:"size-4"}),"Successfully rolled back to previous version"]}),i.jsx(ed,{className:"min-h-0 flex-1",children:i.jsx("div",{className:"p-4",children:_?i.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[i.jsx("div",{className:"size-6 animate-spin rounded-full border-2 border-muted border-t-primary"}),i.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Loading versions..."})]}):C.length===0?i.jsx("div",{className:"py-8 text-center text-sm text-muted-foreground",children:"Save changes to start building version history"}):i.jsx("div",{className:"flex flex-col gap-3",children:C.map((T,O)=>{const D=T.versionNumber===t,z=C[O+1];return i.jsxs("div",{className:W("rounded-lg border p-3 transition-colors",D?"border-primary/50 bg-primary/5":"bg-card"),children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(xt,{variant:"secondary",className:"font-mono",children:["v",T.versionNumber]}),D&&i.jsx(xt,{variant:"outline",className:"border-primary/50 text-primary",children:"Current"}),T.wasPublished&&i.jsx(xt,{variant:"outline",className:"border-success/50 text-success",children:"Published"})]}),i.jsx(Vl,{status:T.status})]}),i.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[i.jsx("span",{children:R(T._creationTime)}),T.createdBy&&i.jsxs("span",{className:"ml-2",children:["by ",T.createdBy]})]}),T.changeDescription&&i.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:T.changeDescription}),i.jsxs("div",{className:"mt-3 flex gap-2",children:[z&&i.jsxs(me,{variant:"outline",size:"sm",onClick:()=>E(z.versionNumber,T.versionNumber),children:["Compare with v",z.versionNumber]}),!D&&i.jsx(me,{variant:"ghost",size:"sm",onClick:()=>M(T.versionNumber),children:"Rollback"})]})]},T._id)})})})}),d!==null&&i.jsx(YC,{targetVersion:d,currentVersion:t,isLoading:m,error:g,onConfirm:A,onCancel:()=>{h(null),y(null)}})]})}function kZ(e){const t={fieldErrors:{},generalError:null};if(!e)return t;const n=e instanceof Error?e.message:String(e);try{const l=n.match(/\{[\s\S]*\}/);if(l){const u=JSON.parse(l[0]);if(Array.isArray(u.errors)){for(const d of u.errors)d.field&&d.message&&(t.fieldErrors[d.field]={message:d.message,code:d.code??"SERVER_ERROR"});if(Object.keys(t.fieldErrors).length>0)return t}if(u.field&&u.message)return t.fieldErrors[u.field]={message:u.message,code:u.code??"SERVER_ERROR"},t;if(typeof u=="object"&&!Array.isArray(u)){let d=!1;for(const[h,m]of Object.entries(u))typeof m=="string"&&h!=="message"&&h!=="code"&&(t.fieldErrors[h]={message:m,code:"SERVER_ERROR"},d=!0);if(d)return t}}}catch{}const r=/(?:Content validation failed|Validation error|Validation failed):\s*(.+)/i,o=n.match(r);if(o){const u=o[1].trim().split(/;\s*/);for(const d of u){const h=d.indexOf(":");if(h>0&&h<d.length-1){const m=d.substring(0,h).trim(),v=d.substring(h+1).trim();m&&!m.includes(" ")&&m.length<=50&&v&&(t.fieldErrors[m]={message:v,code:"SERVER_ERROR"})}}if(Object.keys(t.fieldErrors).length>0)return t}return t.generalError=n,t}function _Z(e){if(!e)return!1;const t=(e instanceof Error?e.message:String(e)).toLowerCase();return["network","timeout","timed out","connection","fetch failed","failed to fetch","offline","unavailable","rate limit","too many requests","503","504","429"].some(r=>t.includes(r))}function EZ({...e}){return i.jsx(TG,{"data-slot":"alert-dialog",...e})}function TZ({...e}){return i.jsx(MG,{"data-slot":"alert-dialog-portal",...e})}function MZ({className:e,...t}){return i.jsx(RG,{"data-slot":"alert-dialog-overlay",className:W("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function RZ({className:e,...t}){return i.jsxs(TZ,{children:[i.jsx(MZ,{}),i.jsx(AG,{"data-slot":"alert-dialog-content",className:W("bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...t})]})}function AZ({className:e,...t}){return i.jsx("div",{"data-slot":"alert-dialog-header",className:W("flex flex-col gap-2 text-center sm:text-left",e),...t})}function OZ({className:e,...t}){return i.jsx("div",{"data-slot":"alert-dialog-footer",className:W("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function DZ({className:e,...t}){return i.jsx(zG,{"data-slot":"alert-dialog-title",className:W("text-lg font-semibold",e),...t})}function zZ({className:e,...t}){return i.jsx(PG,{"data-slot":"alert-dialog-description",className:W("text-muted-foreground text-sm",e),...t})}function PZ({className:e,...t}){return i.jsx(OG,{className:W(wu(),e),...t})}function LZ({className:e,...t}){return i.jsx(DG,{className:W(wu({variant:"outline"}),e),...t})}function IZ({status:e,error:t,retryCount:n=0,maxRetries:r=3,isDirty:o=!1,onRetry:l}){return e==="idle"&&!o?null:i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e==="saving"&&i.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[i.jsx(es,{}),n>0?`Retrying (${n}/${r})...`:"Saving..."]}),e==="saved"&&i.jsxs("span",{className:"flex items-center gap-1.5 text-success",children:[i.jsx(Yx,{}),"Saved"]}),e==="error"&&i.jsxs("span",{className:"flex items-center gap-1.5 text-destructive",children:[i.jsx($u,{}),t??"Save failed",n===0&&l&&i.jsx(Je,{type:"button",variant:"ghost",size:"sm",onClick:l,className:"h-auto px-1.5 py-0.5 text-xs",children:"Retry"})]}),e==="idle"&&o&&i.jsx("span",{className:"text-sm text-warning",children:"Unsaved changes"})]})}function $Z({contentType:e,entry:t,entryTitle:n,isDirty:r,isSubmitting:o,isPublishing:l,autosaveStatus:u,autosaveError:d,autosaveRetryCount:h,maxAutosaveRetries:m,canDelete:v,hasScheduling:g,siblingEntries:y,onSave:w,onCancel:S,onPublishClick:j,onUnpublishClick:N,onScheduleClick:C,onCancelSchedule:_,onPublishNow:E,onDuplicate:M,onArchive:A,onDelete:R,onAutosaveRetry:T,onToggleProperties:O,onNavigateToEntry:D,onNavigateToNewEntry:z}){const B=o||l,V=y&&y.length>0;return i.jsxs("div",{className:"sticky top-0 z-30 flex items-center justify-between gap-4 border-b bg-background/95 px-6 py-3 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(Je,{type:"button",variant:"ghost",size:"icon",onClick:S,className:"shrink-0",children:i.jsx(rk,{})}),t&&V&&D?i.jsxs(Sl,{children:[i.jsx(jl,{asChild:!0,children:i.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-1.5 rounded-md px-2 py-1 text-left transition-colors hover:bg-muted/60",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"truncate text-lg font-semibold leading-tight",children:n||e.displayName}),i.jsx("span",{className:"text-xs text-muted-foreground",children:e.displayName})]}),i.jsx(vn,{className:"shrink-0 text-muted-foreground"})]})}),i.jsxs(Cl,{align:"start",className:"w-72",children:[i.jsxs(cT,{className:"text-xs text-muted-foreground",children:[e.displayName," entries"]}),i.jsx(ed,{className:"max-h-64",children:i.jsx(DC,{children:y.map(Y=>i.jsxs(pn,{onClick:()=>D(Y._id),className:W("flex items-center justify-between gap-2",Y._id===t._id&&"bg-accent"),children:[i.jsx("span",{className:"truncate",children:Y.title}),Y._id===t._id&&i.jsx(Ms,{className:"shrink-0 text-primary"})]},Y._id))})}),z&&i.jsxs(i.Fragment,{children:[i.jsx(Yo,{}),i.jsxs(pn,{onClick:z,children:[i.jsx(Un,{"data-icon":"inline-start"}),"New ",e.displayName]})]})]})]}):i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"truncate text-lg font-semibold",children:n||(t?"Edit":"Create")+" "+e.displayName}),n&&i.jsx("span",{className:"text-xs text-muted-foreground",children:e.displayName})]}),t&&i.jsx(Vl,{status:t.status}),!V&&z&&t&&i.jsxs(Je,{type:"button",variant:"ghost",size:"sm",onClick:z,className:"shrink-0 text-muted-foreground",children:[i.jsx(Un,{"data-icon":"inline-start"}),"New"]})]}),i.jsx(IZ,{status:u,error:d,retryCount:h,maxRetries:m,isDirty:r,onRetry:T}),i.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[i.jsxs(Je,{type:"button",variant:"outline",onClick:w,disabled:B,children:[o&&i.jsx(es,{"data-icon":"inline-start"}),"Save"]}),t&&t.status==="draft"&&i.jsxs(Je,{type:"button",onClick:j,disabled:B,children:[l&&i.jsx(es,{"data-icon":"inline-start"}),"Publish"]}),t&&t.status==="scheduled"&&i.jsxs(Je,{type:"button",onClick:E,disabled:B,children:[l&&i.jsx(es,{"data-icon":"inline-start"}),"Publish Now"]}),t&&t.status==="published"&&i.jsx(Je,{type:"button",variant:"outline",onClick:N,disabled:B,children:"Unpublish"}),t&&i.jsxs(Sl,{children:[i.jsx(jl,{asChild:!0,children:i.jsx(Je,{type:"button",variant:"ghost",size:"icon",children:i.jsx(lk,{})})}),i.jsx(Cl,{align:"end",children:i.jsxs(DC,{children:[t.status==="draft"&&g&&i.jsxs(pn,{onClick:C,children:[i.jsx(ih,{"data-icon":"inline-start"}),"Schedule"]}),t.status==="scheduled"&&g&&i.jsx(pn,{onClick:_,children:"Cancel Schedule"}),i.jsx(pn,{onClick:M,children:"Duplicate"}),(t.status==="draft"||t.status==="scheduled")&&i.jsx(pn,{onClick:A,children:"Archive"}),v&&i.jsxs(i.Fragment,{children:[i.jsx(Yo,{}),i.jsx(pn,{className:"text-destructive",onClick:R,children:"Delete"})]})]})})]}),O&&i.jsx(Je,{type:"button",variant:"outline",size:"icon",onClick:O,className:"lg:hidden",children:i.jsx(_5,{})})]})]})}function ar({field:e,children:t,error:n,className:r="",id:o,customLabel:l}){return i.jsxs(bs,{"data-invalid":!!n||void 0,className:r,children:[i.jsxs(ws,{htmlFor:o,children:[l??e.label,e.required&&i.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),t,e.description&&!n&&i.jsx(Ro,{id:`${o}-description`,children:e.description}),n&&i.jsx(VT,{id:`${o}-error`,children:n.message})]})}function FZ({field:e,value:t,onChange:n,error:r,disabled:o=!1,readOnly:l=!1,className:u="",id:d,placeholder:h,inputType:m="text"}){const v=p.useId(),g=d??`field-${e.name}-${v}`,y=N=>{n(N.target.value)},{minLength:w,maxLength:S,pattern:j}=e.options??{};return i.jsxs(ar,{field:e,error:r,className:u,id:g,children:[i.jsx(mt,{type:m,id:g,name:e.name,value:t??"",onChange:y,disabled:o,readOnly:l,required:e.required,minLength:w,maxLength:S,pattern:j,placeholder:h,className:W(r&&"border-destructive focus-visible:ring-destructive"),"aria-invalid":!!r,"aria-describedby":r?`${g}-error`:e.description?`${g}-description`:void 0}),S&&i.jsxs("span",{className:"mt-1 block text-right text-xs text-muted-foreground",children:[(t??"").length," / ",S]})]})}function BZ({field:e,value:t,onChange:n,error:r,disabled:o=!1,readOnly:l=!1,className:u="",id:d,placeholder:h}){const m=p.useId(),v=d??`field-${e.name}-${m}`,{min:g,max:y,precision:w,prefix:S,suffix:j}=e.options??{},N=w===void 0||w>0,C=g===void 0||g<0,[_,E]=p.useState(()=>t==null?"":w!==void 0&&w>=0?t.toFixed(w):String(t));p.useEffect(()=>{if(t==null){_!==""&&E("");return}const B=parseFloat(_);!isNaN(B)&&B===t||(w!==void 0&&w>=0?E(t.toFixed(w)):E(String(t)))},[t,w]);const M=B=>{const V=B.target.value;if(E(V),V===""){n(null);return}const Y=parseFloat(V);if(!isNaN(Y))if(w!==void 0&&w>=0){const G=Math.pow(10,w);n(Math.round(Y*G)/G)}else n(Y)},A=B=>{["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(B.key)||(B.ctrlKey||B.metaKey)&&["a","c","v","x","z"].includes(B.key)||B.key>="0"&&B.key<="9"||B.key==="."&&N&&!_.includes(".")||B.key==="-"&&C&&B.currentTarget.selectionStart===0&&!_.includes("-")||B.preventDefault()},R=B=>{B.preventDefault();const V=B.clipboardData.getData("text"),Y=N?/[^\d.\-]/g:/[^\d\-]/g,G=V.replace(Y,""),ae=G.split("."),L=ae.length>1?ae[0]+"."+ae.slice(1).join(""):G;if(L==="")return;const $=B.currentTarget,U=$.selectionStart??0,H=$.selectionEnd??0,le=_.slice(0,U)+L+_.slice(H);E(le);const I=parseFloat(le);if(!isNaN(I))if(w!==void 0&&w>=0){const F=Math.pow(10,w);n(Math.round(I*F)/F)}else n(I)},T=()=>{if(_==="")return;const B=parseFloat(_);isNaN(B)||(w!==void 0&&w>=0?E(B.toFixed(w)):E(String(B)))},O=N?"decimal":"numeric",D=!!(S||j),z={type:"text",inputMode:O,id:v,name:e.name,value:_,onChange:M,onKeyDown:A,onBlur:T,onPaste:R,disabled:o,readOnly:l,required:e.required,placeholder:h,"aria-invalid":!!r||void 0,"aria-describedby":r?`${v}-error`:e.description?`${v}-description`:void 0};return i.jsxs(ar,{field:e,error:r,className:u,id:v,children:[D?i.jsxs(vm,{"data-disabled":o||void 0,children:[S&&i.jsx(kl,{align:"inline-start",children:i.jsx(_l,{children:S})}),i.jsx(xm,{...z}),j&&i.jsx(kl,{align:"inline-end",children:i.jsx(_l,{className:"text-xs font-medium",children:j})})]}):i.jsx(mt,{...z,className:W(r&&"border-destructive focus-visible:ring-destructive")}),(g!==void 0||y!==void 0)&&i.jsx("span",{className:"mt-1 block text-xs text-muted-foreground",children:g!==void 0&&y!==void 0?`Range: ${g} - ${y}`:g!==void 0?`Min: ${g}`:`Max: ${y}`})]})}function UZ({field:e,value:t,onChange:n,error:r,disabled:o=!1,readOnly:l=!1,className:u="",id:d,trueLabel:h="Yes",falseLabel:m="No"}){const v=p.useId(),g=d??`field-${e.name}-${v}`,y=S=>{l||n(S)},w=!!r;return i.jsxs(bs,{orientation:"horizontal","data-invalid":w||void 0,className:u,children:[i.jsxs(ws,{htmlFor:g,children:[e.label,e.required&&i.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(rl,{id:g,checked:t??!1,onCheckedChange:y,disabled:o||l,"aria-invalid":w,"aria-describedby":r?`${g}-error`:e.description?`${g}-description`:void 0}),i.jsx("span",{className:"text-sm text-muted-foreground",children:t?h:m})]}),e.description&&!w&&i.jsx(Ro,{id:`${g}-description`,children:e.description}),w&&i.jsx(VT,{id:`${g}-error`,children:r.message})]})}function qZ(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const VZ={},tu={};function Ao(e,t){try{const r=(VZ[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return r in tu?tu[r]:WC(r,r.split(":"))}catch{if(e in tu)return tu[e];const n=e?.match(HZ);return n?WC(e,n.slice(1)):NaN}}const HZ=/([+-]\d\d):?(\d\d)?/;function WC(e,t){const n=+(t[0]||0),r=+(t[1]||0),o=+(t[2]||0)/60;return tu[e]=n*60+r>0?n*60+r+o:n*60-r-o}class Cs extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(Ao(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),qM(this),Ex(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new Cs(...n,t):new Cs(Date.now(),t)}withTimeZone(t){return new Cs(+this,t)}getTimezoneOffset(){const t=-Ao(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),Ex(this),+this}[Symbol.for("constructDateFrom")](t){return new Cs(+new Date(t),this.timeZone)}}const GC=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!GC.test(e))return;const t=e.replace(GC,"$1UTC");Cs.prototype[t]&&(e.startsWith("get")?Cs.prototype[e]=function(){return this.internal[t]()}:(Cs.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),YZ(this),+this},Cs.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),Ex(this),+this}))});function Ex(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-Ao(e.timeZone,e)*60))}function YZ(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),qM(e)}function qM(e){const t=Ao(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const o=-new Date(+e).getTimezoneOffset(),l=-new Date(+r).getTimezoneOffset(),u=o-l,d=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();u&&d&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+u);const h=o-n;h&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+h);const m=new Date(+e);m.setUTCSeconds(0);const v=o>0?m.getSeconds():(m.getSeconds()-60)%60,g=Math.round(-(Ao(e.timeZone,e)*60))%60;(g||v)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+g),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+g+v));const y=Ao(e.timeZone,e),w=y>0?Math.floor(y):Math.ceil(y),j=-new Date(+e).getTimezoneOffset()-w,N=w!==n,C=j-h;if(N&&C){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+C);const _=Ao(e.timeZone,e),E=_>0?Math.floor(_):Math.ceil(_),M=w-E;M&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+M),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+M))}}class On extends Cs{static tz(t,...n){return n.length?new On(...n,t):new On(Date.now(),t)}toISOString(){const[t,n,r]=this.tzComponents(),o=`${t}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+o}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,r,o]=this.internal.toUTCString().split(" ");return`${t?.slice(0,-1)} ${r} ${n} ${o}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,r,o]=this.tzComponents();return`${t} GMT${n}${r}${o} (${qZ(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",r=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),o=String(Math.abs(t)%60).padStart(2,"0");return[n,r,o]}withTimeZone(t){return new On(+this,t)}[Symbol.for("constructDateFrom")](t){return new On(+new Date(t),this.timeZone)}}const VM=6048e5,WZ=864e5,ZC=Symbol.for("constructDateFrom");function dn(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&ZC in e?e[ZC](t):e instanceof Date?new e.constructor(t):new Date(t)}function Mt(e,t){return dn(t||e,e)}function HM(e,t,n){const r=Mt(e,n?.in);return isNaN(t)?dn(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function YM(e,t,n){const r=Mt(e,n?.in);if(isNaN(t))return dn(e,NaN);if(!t)return r;const o=r.getDate(),l=dn(e,r.getTime());l.setMonth(r.getMonth()+t+1,0);const u=l.getDate();return o>=u?l:(r.setFullYear(l.getFullYear(),l.getMonth(),o),r)}let GZ={};function td(){return GZ}function Tl(e,t){const n=td(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=Mt(e,t?.in),l=o.getDay(),u=(l<r?7:0)+l-r;return o.setDate(o.getDate()-u),o.setHours(0,0,0,0),o}function Du(e,t){return Tl(e,{...t,weekStartsOn:1})}function WM(e,t){const n=Mt(e,t?.in),r=n.getFullYear(),o=dn(n,0);o.setFullYear(r+1,0,4),o.setHours(0,0,0,0);const l=Du(o),u=dn(n,0);u.setFullYear(r,0,4),u.setHours(0,0,0,0);const d=Du(u);return n.getTime()>=l.getTime()?r+1:n.getTime()>=d.getTime()?r:r-1}function QC(e){const t=Mt(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Hl(e,...t){const n=dn.bind(null,t.find(r=>typeof r=="object"));return t.map(n)}function zu(e,t){const n=Mt(e,t?.in);return n.setHours(0,0,0,0),n}function yb(e,t,n){const[r,o]=Hl(n?.in,e,t),l=zu(r),u=zu(o),d=+l-QC(l),h=+u-QC(u);return Math.round((d-h)/WZ)}function ZZ(e,t){const n=WM(e,t),r=dn(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Du(r)}function QZ(e,t,n){return HM(e,t*7,n)}function KZ(e,t,n){return YM(e,t*12,n)}function XZ(e,t){let n,r=t?.in;return e.forEach(o=>{!r&&typeof o=="object"&&(r=dn.bind(null,o));const l=Mt(o,r);(!n||n<l||isNaN(+l))&&(n=l)}),dn(r,n||NaN)}function JZ(e,t){let n,r=t?.in;return e.forEach(o=>{!r&&typeof o=="object"&&(r=dn.bind(null,o));const l=Mt(o,r);(!n||n>l||isNaN(+l))&&(n=l)}),dn(r,n||NaN)}function eQ(e,t,n){const[r,o]=Hl(n?.in,e,t);return+zu(r)==+zu(o)}function GM(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function tQ(e){return!(!GM(e)&&typeof e!="number"||isNaN(+Mt(e)))}function ZM(e,t,n){const[r,o]=Hl(n?.in,e,t),l=r.getFullYear()-o.getFullYear(),u=r.getMonth()-o.getMonth();return l*12+u}function nQ(e,t){const n=Mt(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function QM(e,t){const[n,r]=Hl(e,t.start,t.end);return{start:n,end:r}}function rQ(e,t){const{start:n,end:r}=QM(t?.in,e);let o=+n>+r;const l=o?+n:+r,u=o?r:n;u.setHours(0,0,0,0),u.setDate(1);let d=1;const h=[];for(;+u<=l;)h.push(dn(n,u)),u.setMonth(u.getMonth()+d);return o?h.reverse():h}function sQ(e,t){const n=Mt(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function aQ(e,t){const n=Mt(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function KM(e,t){const n=Mt(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function oQ(e,t){const{start:n,end:r}=QM(t?.in,e);let o=+n>+r;const l=o?+n:+r,u=o?r:n;u.setHours(0,0,0,0),u.setMonth(0,1);let d=1;const h=[];for(;+u<=l;)h.push(dn(n,u)),u.setFullYear(u.getFullYear()+d);return o?h.reverse():h}function XM(e,t){const n=td(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=Mt(e,t?.in),l=o.getDay(),u=(l<r?-7:0)+6-(l-r);return o.setDate(o.getDate()+u),o.setHours(23,59,59,999),o}function iQ(e,t){return XM(e,{...t,weekStartsOn:1})}const lQ={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},cQ=(e,t,n)=>{let r;const o=lQ[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Lv(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const uQ={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},dQ={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},fQ={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},hQ={date:Lv({formats:uQ,defaultWidth:"full"}),time:Lv({formats:dQ,defaultWidth:"full"}),dateTime:Lv({formats:fQ,defaultWidth:"full"})},mQ={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},pQ=(e,t,n,r)=>mQ[e];function Vc(e){return(t,n)=>{const r=n?.context?String(n.context):"standalone";let o;if(r==="formatting"&&e.formattingValues){const u=e.defaultFormattingWidth||e.defaultWidth,d=n?.width?String(n.width):u;o=e.formattingValues[d]||e.formattingValues[u]}else{const u=e.defaultWidth,d=n?.width?String(n.width):e.defaultWidth;o=e.values[d]||e.values[u]}const l=e.argumentCallback?e.argumentCallback(t):t;return o[l]}}const gQ={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},vQ={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},xQ={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},yQ={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},bQ={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},wQ={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},SQ=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},jQ={ordinalNumber:SQ,era:Vc({values:gQ,defaultWidth:"wide"}),quarter:Vc({values:vQ,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Vc({values:xQ,defaultWidth:"wide"}),day:Vc({values:yQ,defaultWidth:"wide"}),dayPeriod:Vc({values:bQ,defaultWidth:"wide",formattingValues:wQ,defaultFormattingWidth:"wide"})};function Hc(e){return(t,n={})=>{const r=n.width,o=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],l=t.match(o);if(!l)return null;const u=l[0],d=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],h=Array.isArray(d)?NQ(d,g=>g.test(u)):CQ(d,g=>g.test(u));let m;m=e.valueCallback?e.valueCallback(h):h,m=n.valueCallback?n.valueCallback(m):m;const v=t.slice(u.length);return{value:m,rest:v}}}function CQ(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function NQ(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function kQ(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const o=r[0],l=t.match(e.parsePattern);if(!l)return null;let u=e.valueCallback?e.valueCallback(l[0]):l[0];u=n.valueCallback?n.valueCallback(u):u;const d=t.slice(o.length);return{value:u,rest:d}}}const _Q=/^(\d+)(th|st|nd|rd)?/i,EQ=/\d+/i,TQ={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},MQ={any:[/^b/i,/^(a|c)/i]},RQ={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},AQ={any:[/1/i,/2/i,/3/i,/4/i]},OQ={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},DQ={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},zQ={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},PQ={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},LQ={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},IQ={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},$Q={ordinalNumber:kQ({matchPattern:_Q,parsePattern:EQ,valueCallback:e=>parseInt(e,10)}),era:Hc({matchPatterns:TQ,defaultMatchWidth:"wide",parsePatterns:MQ,defaultParseWidth:"any"}),quarter:Hc({matchPatterns:RQ,defaultMatchWidth:"wide",parsePatterns:AQ,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Hc({matchPatterns:OQ,defaultMatchWidth:"wide",parsePatterns:DQ,defaultParseWidth:"any"}),day:Hc({matchPatterns:zQ,defaultMatchWidth:"wide",parsePatterns:PQ,defaultParseWidth:"any"}),dayPeriod:Hc({matchPatterns:LQ,defaultMatchWidth:"any",parsePatterns:IQ,defaultParseWidth:"any"})},Xi={code:"en-US",formatDistance:cQ,formatLong:hQ,formatRelative:pQ,localize:jQ,match:$Q,options:{weekStartsOn:0,firstWeekContainsDate:1}};function FQ(e,t){const n=Mt(e,t?.in);return yb(n,KM(n))+1}function bb(e,t){const n=Mt(e,t?.in),r=+Du(n)-+ZZ(n);return Math.round(r/VM)+1}function JM(e,t){const n=Mt(e,t?.in),r=n.getFullYear(),o=td(),l=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,u=dn(t?.in||e,0);u.setFullYear(r+1,0,l),u.setHours(0,0,0,0);const d=Tl(u,t),h=dn(t?.in||e,0);h.setFullYear(r,0,l),h.setHours(0,0,0,0);const m=Tl(h,t);return+n>=+d?r+1:+n>=+m?r:r-1}function BQ(e,t){const n=td(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=JM(e,t),l=dn(t?.in||e,0);return l.setFullYear(o,0,r),l.setHours(0,0,0,0),Tl(l,t)}function wb(e,t){const n=Mt(e,t?.in),r=+Tl(n,t)-+BQ(n,t);return Math.round(r/VM)+1}function Ct(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const Fa={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return Ct(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Ct(n+1,2)},d(e,t){return Ct(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(e,t){return Ct(e.getHours()%12||12,t.length)},H(e,t){return Ct(e.getHours(),t.length)},m(e,t){return Ct(e.getMinutes(),t.length)},s(e,t){return Ct(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),o=Math.trunc(r*Math.pow(10,n-3));return Ct(o,t.length)}},Yi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},KC={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),o=r>0?r:1-r;return n.ordinalNumber(o,{unit:"year"})}return Fa.y(e,t)},Y:function(e,t,n,r){const o=JM(e,r),l=o>0?o:1-o;if(t==="YY"){const u=l%100;return Ct(u,2)}return t==="Yo"?n.ordinalNumber(l,{unit:"year"}):Ct(l,t.length)},R:function(e,t){const n=WM(e);return Ct(n,t.length)},u:function(e,t){const n=e.getFullYear();return Ct(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Ct(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Ct(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return Fa.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return Ct(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const o=wb(e,r);return t==="wo"?n.ordinalNumber(o,{unit:"week"}):Ct(o,t.length)},I:function(e,t,n){const r=bb(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):Ct(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Fa.d(e,t)},D:function(e,t,n){const r=FQ(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Ct(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const o=e.getDay(),l=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(l);case"ee":return Ct(l,2);case"eo":return n.ordinalNumber(l,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const o=e.getDay(),l=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(l);case"cc":return Ct(l,t.length);case"co":return n.ordinalNumber(l,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),o=r===0?7:r;switch(t){case"i":return String(o);case"ii":return Ct(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const o=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let o;switch(r===12?o=Yi.noon:r===0?o=Yi.midnight:o=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let o;switch(r>=17?o=Yi.evening:r>=12?o=Yi.afternoon:r>=4?o=Yi.morning:o=Yi.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Fa.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Fa.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Ct(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):Ct(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Fa.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Fa.s(e,t)},S:function(e,t){return Fa.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return JC(r);case"XXXX":case"XX":return _o(r);default:return _o(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return JC(r);case"xxxx":case"xx":return _o(r);default:return _o(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+XC(r,":");default:return"GMT"+_o(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+XC(r,":");default:return"GMT"+_o(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return Ct(r,t.length)},T:function(e,t,n){return Ct(+e,t.length)}};function XC(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=Math.trunc(r/60),l=r%60;return l===0?n+String(o):n+String(o)+t+Ct(l,2)}function JC(e,t){return e%60===0?(e>0?"-":"+")+Ct(Math.abs(e)/60,2):_o(e,t)}function _o(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=Ct(Math.trunc(r/60),2),l=Ct(r%60,2);return n+o+t+l}const eN=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},eR=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},UQ=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],o=n[2];if(!o)return eN(e,t);let l;switch(r){case"P":l=t.dateTime({width:"short"});break;case"PP":l=t.dateTime({width:"medium"});break;case"PPP":l=t.dateTime({width:"long"});break;default:l=t.dateTime({width:"full"});break}return l.replace("{{date}}",eN(r,t)).replace("{{time}}",eR(o,t))},qQ={p:eR,P:UQ},VQ=/^D+$/,HQ=/^Y+$/,YQ=["D","DD","YY","YYYY"];function WQ(e){return VQ.test(e)}function GQ(e){return HQ.test(e)}function ZQ(e,t,n){const r=QQ(e,t,n);if(console.warn(r),YQ.includes(e))throw new RangeError(r)}function QQ(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const KQ=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,XQ=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,JQ=/^'([^]*?)'?$/,eK=/''/g,tK=/[a-zA-Z]/;function nu(e,t,n){const r=td(),o=n?.locale??r.locale??Xi,l=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,u=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,d=Mt(e,n?.in);if(!tQ(d))throw new RangeError("Invalid time value");let h=t.match(XQ).map(v=>{const g=v[0];if(g==="p"||g==="P"){const y=qQ[g];return y(v,o.formatLong)}return v}).join("").match(KQ).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const g=v[0];if(g==="'")return{isToken:!1,value:nK(v)};if(KC[g])return{isToken:!0,value:v};if(g.match(tK))throw new RangeError("Format string contains an unescaped latin alphabet character `"+g+"`");return{isToken:!1,value:v}});o.localize.preprocessor&&(h=o.localize.preprocessor(d,h));const m={firstWeekContainsDate:l,weekStartsOn:u,locale:o};return h.map(v=>{if(!v.isToken)return v.value;const g=v.value;(!n?.useAdditionalWeekYearTokens&&GQ(g)||!n?.useAdditionalDayOfYearTokens&&WQ(g))&&ZQ(g,t,String(e));const y=KC[g[0]];return y(d,g,o.localize,m)}).join("")}function nK(e){const t=e.match(JQ);return t?t[1].replace(eK,"'"):e}function rK(e,t){const n=Mt(e,t?.in),r=n.getFullYear(),o=n.getMonth(),l=dn(n,0);return l.setFullYear(r,o+1,0),l.setHours(0,0,0,0),l.getDate()}function sK(e,t){return Mt(e,t?.in).getMonth()}function aK(e,t){return Mt(e,t?.in).getFullYear()}function oK(e,t){return+Mt(e)>+Mt(t)}function iK(e,t){return+Mt(e)<+Mt(t)}function lK(e,t,n){const[r,o]=Hl(n?.in,e,t);return r.getFullYear()===o.getFullYear()&&r.getMonth()===o.getMonth()}function cK(e,t,n){const[r,o]=Hl(n?.in,e,t);return r.getFullYear()===o.getFullYear()}function uK(e,t,n){const r=Mt(e,n?.in),o=r.getFullYear(),l=r.getDate(),u=dn(e,0);u.setFullYear(o,t,15),u.setHours(0,0,0,0);const d=rK(u);return r.setMonth(t,Math.min(l,d)),r}function dK(e,t,n){const r=Mt(e,n?.in);return isNaN(+r)?dn(e,NaN):(r.setFullYear(t),r)}const tN=5,fK=4;function hK(e,t){const n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,o=t.addDays(e,-r+1),l=t.addDays(o,tN*7-1);return t.getMonth(e)===t.getMonth(l)?tN:fK}function tR(e,t){const n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function mK(e,t){const n=tR(e,t),r=hK(e,t);return t.addDays(n,r*7-1)}const nR={...Xi,labels:{labelDayButton:(e,t,n,r)=>{let o;r&&typeof r.format=="function"?o=r.format.bind(r):o=(u,d)=>nu(u,d,{locale:Xi,...n});let l=o(e,"PPPP");return t.today&&(l=`Today, ${l}`),t.selected&&(l=`${l}, selected`),l},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:"Choose the Year",labelGrid:(e,t,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(o,l)=>nu(o,l,{locale:Xi,...t}),r(e,"LLLL yyyy")},labelGridcell:(e,t,n,r)=>{let o;r&&typeof r.format=="function"?o=r.format.bind(r):o=(u,d)=>nu(u,d,{locale:Xi,...n});let l=o(e,"PPPP");return t?.today&&(l=`Today, ${l}`),l},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(e,t,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(o,l)=>nu(o,l,{locale:Xi,...t}),r(e,"cccc")}}};class jr{constructor(t,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?On.tz(this.options.timeZone):new this.Date,this.newDate=(r,o,l)=>this.overrides?.newDate?this.overrides.newDate(r,o,l):this.options.timeZone?new On(r,o,l,this.options.timeZone):new Date(r,o,l),this.addDays=(r,o)=>this.overrides?.addDays?this.overrides.addDays(r,o):HM(r,o),this.addMonths=(r,o)=>this.overrides?.addMonths?this.overrides.addMonths(r,o):YM(r,o),this.addWeeks=(r,o)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,o):QZ(r,o),this.addYears=(r,o)=>this.overrides?.addYears?this.overrides.addYears(r,o):KZ(r,o),this.differenceInCalendarDays=(r,o)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,o):yb(r,o),this.differenceInCalendarMonths=(r,o)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,o):ZM(r,o),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):rQ(r),this.eachYearOfInterval=r=>{const o=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):oQ(r),l=new Set(o.map(d=>this.getYear(d)));if(l.size===o.length)return o;const u=[];return l.forEach(d=>{u.push(new Date(d,0,1))}),u},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):mK(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):iQ(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):nQ(r),this.endOfWeek=(r,o)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,o):XM(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):aQ(r),this.format=(r,o,l)=>{const u=this.overrides?.format?this.overrides.format(r,o,this.options):nu(r,o,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(u):u},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):bb(r),this.getMonth=(r,o)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):sK(r,this.options),this.getYear=(r,o)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):aK(r,this.options),this.getWeek=(r,o)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):wb(r,this.options),this.isAfter=(r,o)=>this.overrides?.isAfter?this.overrides.isAfter(r,o):oK(r,o),this.isBefore=(r,o)=>this.overrides?.isBefore?this.overrides.isBefore(r,o):iK(r,o),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):GM(r),this.isSameDay=(r,o)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,o):eQ(r,o),this.isSameMonth=(r,o)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,o):lK(r,o),this.isSameYear=(r,o)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,o):cK(r,o),this.max=r=>this.overrides?.max?this.overrides.max(r):XZ(r),this.min=r=>this.overrides?.min?this.overrides.min(r):JZ(r),this.setMonth=(r,o)=>this.overrides?.setMonth?this.overrides.setMonth(r,o):uK(r,o),this.setYear=(r,o)=>this.overrides?.setYear?this.overrides.setYear(r,o):dK(r,o),this.startOfBroadcastWeek=(r,o)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):tR(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):zu(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Du(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):sQ(r),this.startOfWeek=(r,o)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):Tl(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):KM(r),this.options={locale:nR,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),r={};for(let o=0;o<10;o++)r[o.toString()]=n.format(o);return r}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,r=>n[r]||r)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){const t=this.options.locale?.code;return t&&jr.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:r,numerals:o}=this.options,l=n?.code;if(l&&jr.yearFirstLocales.has(l))try{return new Intl.DateTimeFormat(l,{month:"long",year:"numeric",timeZone:r,numberingSystem:o}).format(t)}catch{}const u=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,u)}}jr.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Os=new jr;class rR{constructor(t,n,r=Os){this.date=t,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(t,n)),this.dateLib=r,this.isoDate=r.format(t,"yyyy-MM-dd"),this.displayMonthId=r.format(n,"yyyy-MM"),this.dateMonthId=r.format(t,"yyyy-MM")}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class pK{constructor(t,n){this.date=t,this.weeks=n}}class gK{constructor(t,n){this.days=n,this.weekNumber=t}}function vK(e){return ee.createElement("button",{...e})}function xK(e){return ee.createElement("span",{...e})}function yK(e){const{size:t=24,orientation:n="left",className:r}=e;return ee.createElement("svg",{className:r,width:t,height:t,viewBox:"0 0 24 24"},n==="up"&&ee.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&ee.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&ee.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&ee.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function bK(e){const{day:t,modifiers:n,...r}=e;return ee.createElement("td",{...r})}function wK(e){const{day:t,modifiers:n,...r}=e,o=ee.useRef(null);return ee.useEffect(()=>{n.focused&&o.current?.focus()},[n.focused]),ee.createElement("button",{ref:o,...r})}var Pe;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(Pe||(Pe={}));var Bt;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(Bt||(Bt={}));var ts;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(ts||(ts={}));var pr;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(pr||(pr={}));function SK(e){const{options:t,className:n,components:r,classNames:o,...l}=e,u=[o[Pe.Dropdown],n].join(" "),d=t?.find(({value:h})=>h===l.value);return ee.createElement("span",{"data-disabled":l.disabled,className:o[Pe.DropdownRoot]},ee.createElement(r.Select,{className:u,...l},t?.map(({value:h,label:m,disabled:v})=>ee.createElement(r.Option,{key:h,value:h,disabled:v},m))),ee.createElement("span",{className:o[Pe.CaptionLabel],"aria-hidden":!0},d?.label,ee.createElement(r.Chevron,{orientation:"down",size:18,className:o[Pe.Chevron]})))}function jK(e){return ee.createElement("div",{...e})}function CK(e){return ee.createElement("div",{...e})}function NK(e){const{calendarMonth:t,displayIndex:n,...r}=e;return ee.createElement("div",{...r},e.children)}function kK(e){const{calendarMonth:t,displayIndex:n,...r}=e;return ee.createElement("div",{...r})}function _K(e){return ee.createElement("table",{...e})}function EK(e){return ee.createElement("div",{...e})}const sR=p.createContext(void 0);function nd(){const e=p.useContext(sR);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function TK(e){const{components:t}=nd();return ee.createElement(t.Dropdown,{...e})}function MK(e){const{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:o,...l}=e,{components:u,classNames:d,labels:{labelPrevious:h,labelNext:m}}=nd(),v=p.useCallback(y=>{o&&n?.(y)},[o,n]),g=p.useCallback(y=>{r&&t?.(y)},[r,t]);return ee.createElement("nav",{...l},ee.createElement(u.PreviousMonthButton,{type:"button",className:d[Pe.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":h(r),onClick:g},ee.createElement(u.Chevron,{disabled:r?void 0:!0,className:d[Pe.Chevron],orientation:"left"})),ee.createElement(u.NextMonthButton,{type:"button",className:d[Pe.NextMonthButton],tabIndex:o?void 0:-1,"aria-disabled":o?void 0:!0,"aria-label":m(o),onClick:v},ee.createElement(u.Chevron,{disabled:o?void 0:!0,orientation:"right",className:d[Pe.Chevron]})))}function RK(e){const{components:t}=nd();return ee.createElement(t.Button,{...e})}function AK(e){return ee.createElement("option",{...e})}function OK(e){const{components:t}=nd();return ee.createElement(t.Button,{...e})}function DK(e){const{rootRef:t,...n}=e;return ee.createElement("div",{...n,ref:t})}function zK(e){return ee.createElement("select",{...e})}function PK(e){const{week:t,...n}=e;return ee.createElement("tr",{...n})}function LK(e){return ee.createElement("th",{...e})}function IK(e){return ee.createElement("thead",{"aria-hidden":!0},ee.createElement("tr",{...e}))}function $K(e){const{week:t,...n}=e;return ee.createElement("th",{...n})}function FK(e){return ee.createElement("th",{...e})}function BK(e){return ee.createElement("tbody",{...e})}function UK(e){const{components:t}=nd();return ee.createElement(t.Dropdown,{...e})}const qK=Object.freeze(Object.defineProperty({__proto__:null,Button:vK,CaptionLabel:xK,Chevron:yK,Day:bK,DayButton:wK,Dropdown:SK,DropdownNav:jK,Footer:CK,Month:NK,MonthCaption:kK,MonthGrid:_K,Months:EK,MonthsDropdown:TK,Nav:MK,NextMonthButton:RK,Option:AK,PreviousMonthButton:OK,Root:DK,Select:zK,Week:PK,WeekNumber:$K,WeekNumberHeader:FK,Weekday:LK,Weekdays:IK,Weeks:BK,YearsDropdown:UK},Symbol.toStringTag,{value:"Module"}));function sa(e,t,n=!1,r=Os){let{from:o,to:l}=e;const{differenceInCalendarDays:u,isSameDay:d}=r;return o&&l?(u(l,o)<0&&([o,l]=[l,o]),u(t,o)>=(n?1:0)&&u(l,t)>=(n?1:0)):!n&&l?d(l,t):!n&&o?d(o,t):!1}function Sb(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Nm(e){return!!(e&&typeof e=="object"&&"from"in e)}function jb(e){return!!(e&&typeof e=="object"&&"after"in e)}function Cb(e){return!!(e&&typeof e=="object"&&"before"in e)}function aR(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function oR(e,t){return Array.isArray(e)&&e.every(t.isDate)}function aa(e,t,n=Os){const r=Array.isArray(t)?t:[t],{isSameDay:o,differenceInCalendarDays:l,isAfter:u}=n;return r.some(d=>{if(typeof d=="boolean")return d;if(n.isDate(d))return o(e,d);if(oR(d,n))return d.some(h=>o(e,h));if(Nm(d))return sa(d,e,!1,n);if(aR(d))return Array.isArray(d.dayOfWeek)?d.dayOfWeek.includes(e.getDay()):d.dayOfWeek===e.getDay();if(Sb(d)){const h=l(d.before,e),m=l(d.after,e),v=h>0,g=m<0;return u(d.before,d.after)?g&&v:v||g}return jb(d)?l(e,d.after)>0:Cb(d)?l(d.before,e)>0:typeof d=="function"?d(e):!1})}function VK(e,t,n,r,o){const{disabled:l,hidden:u,modifiers:d,showOutsideDays:h,broadcastCalendar:m,today:v=o.today()}=t,{isSameDay:g,isSameMonth:y,startOfMonth:w,isBefore:S,endOfMonth:j,isAfter:N}=o,C=n&&w(n),_=r&&j(r),E={[Bt.focused]:[],[Bt.outside]:[],[Bt.disabled]:[],[Bt.hidden]:[],[Bt.today]:[]},M={};for(const A of e){const{date:R,displayMonth:T}=A,O=!!(T&&!y(R,T)),D=!!(C&&S(R,C)),z=!!(_&&N(R,_)),B=!!(l&&aa(R,l,o)),V=!!(u&&aa(R,u,o))||D||z||!m&&!h&&O||m&&h===!1&&O,Y=g(R,v);O&&E.outside.push(A),B&&E.disabled.push(A),V&&E.hidden.push(A),Y&&E.today.push(A),d&&Object.keys(d).forEach(G=>{const ae=d?.[G];ae&&aa(R,ae,o)&&(M[G]?M[G].push(A):M[G]=[A])})}return A=>{const R={[Bt.focused]:!1,[Bt.disabled]:!1,[Bt.hidden]:!1,[Bt.outside]:!1,[Bt.today]:!1},T={};for(const O in E){const D=E[O];R[O]=D.some(z=>z===A)}for(const O in M)T[O]=M[O].some(D=>D===A);return{...R,...T}}}function HK(e,t,n={}){return Object.entries(e).filter(([,o])=>o===!0).reduce((o,[l])=>(n[l]?o.push(n[l]):t[Bt[l]]?o.push(t[Bt[l]]):t[ts[l]]&&o.push(t[ts[l]]),o),[t[Pe.Day]])}function YK(e){return{...qK,...e}}function WK(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,r])=>{n.startsWith("data-")&&(t[n]=r)}),t}function Nb(){const e={};for(const t in Pe)e[Pe[t]]=`rdp-${Pe[t]}`;for(const t in Bt)e[Bt[t]]=`rdp-${Bt[t]}`;for(const t in ts)e[ts[t]]=`rdp-${ts[t]}`;for(const t in pr)e[pr[t]]=`rdp-${pr[t]}`;return e}function iR(e,t,n){return(n??new jr(t)).formatMonthYear(e)}const GK=iR;function ZK(e,t,n){return(n??new jr(t)).format(e,"d")}function QK(e,t=Os){return t.format(e,"LLLL")}function KK(e,t,n){return(n??new jr(t)).format(e,"cccccc")}function XK(e,t=Os){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function JK(){return""}function lR(e,t=Os){return t.format(e,"yyyy")}const eX=lR,tX=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:iR,formatDay:ZK,formatMonthCaption:GK,formatMonthDropdown:QK,formatWeekNumber:XK,formatWeekNumberHeader:JK,formatWeekdayName:KK,formatYearCaption:eX,formatYearDropdown:lR},Symbol.toStringTag,{value:"Module"}));function nX(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...tX,...e}}function kb(e,t,n,r){let o=(r??new jr(n)).format(e,"PPPP");return t.today&&(o=`Today, ${o}`),t.selected&&(o=`${o}, selected`),o}const rX=kb;function _b(e,t,n){return(n??new jr(t)).formatMonthYear(e)}const sX=_b;function cR(e,t,n,r){let o=(r??new jr(n)).format(e,"PPPP");return t?.today&&(o=`Today, ${o}`),o}function uR(e){return"Choose the Month"}function dR(){return""}const aX="Go to the Next Month";function fR(e,t){return aX}function hR(e){return"Go to the Previous Month"}function mR(e,t,n){return(n??new jr(t)).format(e,"cccc")}function pR(e,t){return`Week ${e}`}function gR(e){return"Week Number"}function vR(e){return"Choose the Year"}const oX=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:sX,labelDay:rX,labelDayButton:kb,labelGrid:_b,labelGridcell:cR,labelMonthDropdown:uR,labelNav:dR,labelNext:fR,labelPrevious:hR,labelWeekNumber:pR,labelWeekNumberHeader:gR,labelWeekday:mR,labelYearDropdown:vR},Symbol.toStringTag,{value:"Module"})),Kr=(e,t,n)=>t||(n?typeof n=="function"?n:(...r)=>n:e);function iX(e,t){const n=t.locale?.labels??{};return{...oX,...e??{},labelDayButton:Kr(kb,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:Kr(uR,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:Kr(fR,e?.labelNext,n.labelNext),labelPrevious:Kr(hR,e?.labelPrevious,n.labelPrevious),labelWeekNumber:Kr(pR,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:Kr(vR,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:Kr(_b,e?.labelGrid,n.labelGrid),labelGridcell:Kr(cR,e?.labelGridcell,n.labelGridcell),labelNav:Kr(dR,e?.labelNav,n.labelNav),labelWeekNumberHeader:Kr(gR,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:Kr(mR,e?.labelWeekday,n.labelWeekday)}}function lX(e,t,n,r,o){const{startOfMonth:l,startOfYear:u,endOfYear:d,eachMonthOfInterval:h,getMonth:m}=o;return h({start:u(e),end:d(e)}).map(y=>{const w=r.formatMonthDropdown(y,o),S=m(y),j=t&&y<l(t)||n&&y>l(n)||!1;return{value:S,label:w,disabled:j}})}function cX(e,t={},n={}){let r={...t?.[Pe.Day]};return Object.entries(e).filter(([,o])=>o===!0).forEach(([o])=>{r={...r,...n?.[o]}}),r}function uX(e,t,n,r){const o=r??e.today(),l=n?e.startOfBroadcastWeek(o,e):t?e.startOfISOWeek(o):e.startOfWeek(o),u=[];for(let d=0;d<7;d++){const h=e.addDays(l,d);u.push(h)}return u}function dX(e,t,n,r,o=!1){if(!e||!t)return;const{startOfYear:l,endOfYear:u,eachYearOfInterval:d,getYear:h}=r,m=l(e),v=u(t),g=d({start:m,end:v});return o&&g.reverse(),g.map(y=>{const w=n.formatYearDropdown(y,r);return{value:h(y),label:w,disabled:!1}})}function fX(e,t={}){const{weekStartsOn:n,locale:r}=t,o=n??r?.options?.weekStartsOn??0,l=d=>{const h=typeof d=="number"||typeof d=="string"?new Date(d):d;return new On(h.getFullYear(),h.getMonth(),h.getDate(),12,0,0,e)},u=d=>{const h=l(d);return new Date(h.getFullYear(),h.getMonth(),h.getDate(),0,0,0,0)};return{today:()=>l(On.tz(e)),newDate:(d,h,m)=>new On(d,h,m,12,0,0,e),startOfDay:d=>l(d),startOfWeek:(d,h)=>{const m=l(d),v=h?.weekStartsOn??o,g=(m.getDay()-v+7)%7;return m.setDate(m.getDate()-g),m},startOfISOWeek:d=>{const h=l(d),m=(h.getDay()-1+7)%7;return h.setDate(h.getDate()-m),h},startOfMonth:d=>{const h=l(d);return h.setDate(1),h},startOfYear:d=>{const h=l(d);return h.setMonth(0,1),h},endOfWeek:(d,h)=>{const m=l(d),y=(((h?.weekStartsOn??o)+6)%7-m.getDay()+7)%7;return m.setDate(m.getDate()+y),m},endOfISOWeek:d=>{const h=l(d),m=(7-h.getDay())%7;return h.setDate(h.getDate()+m),h},endOfMonth:d=>{const h=l(d);return h.setMonth(h.getMonth()+1,0),h},endOfYear:d=>{const h=l(d);return h.setMonth(11,31),h},eachMonthOfInterval:d=>{const h=l(d.start),m=l(d.end),v=[],g=new On(h.getFullYear(),h.getMonth(),1,12,0,0,e),y=m.getFullYear()*12+m.getMonth();for(;g.getFullYear()*12+g.getMonth()<=y;)v.push(new On(g,e)),g.setMonth(g.getMonth()+1,1);return v},addDays:(d,h)=>{const m=l(d);return m.setDate(m.getDate()+h),m},addWeeks:(d,h)=>{const m=l(d);return m.setDate(m.getDate()+h*7),m},addMonths:(d,h)=>{const m=l(d);return m.setMonth(m.getMonth()+h),m},addYears:(d,h)=>{const m=l(d);return m.setFullYear(m.getFullYear()+h),m},eachYearOfInterval:d=>{const h=l(d.start),m=l(d.end),v=[],g=new On(h.getFullYear(),0,1,12,0,0,e);for(;g.getFullYear()<=m.getFullYear();)v.push(new On(g,e)),g.setFullYear(g.getFullYear()+1,0,1);return v},getWeek:(d,h)=>{const m=u(d);return wb(m,{weekStartsOn:h?.weekStartsOn??o,firstWeekContainsDate:h?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1})},getISOWeek:d=>{const h=u(d);return bb(h)},differenceInCalendarDays:(d,h)=>{const m=u(d),v=u(h);return yb(m,v)},differenceInCalendarMonths:(d,h)=>{const m=u(d),v=u(h);return ZM(m,v)}}}const rd=e=>e instanceof HTMLElement?e:null,Iv=e=>[...e.querySelectorAll("[data-animated-month]")??[]],hX=e=>rd(e.querySelector("[data-animated-month]")),$v=e=>rd(e.querySelector("[data-animated-caption]")),Fv=e=>rd(e.querySelector("[data-animated-weeks]")),mX=e=>rd(e.querySelector("[data-animated-nav]")),pX=e=>rd(e.querySelector("[data-animated-weekdays]"));function gX(e,t,{classNames:n,months:r,focused:o,dateLib:l}){const u=p.useRef(null),d=p.useRef(r),h=p.useRef(!1);p.useLayoutEffect(()=>{const m=d.current;if(d.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||m.length===0||r.length!==m.length)return;const v=l.isSameMonth(r[0].date,m[0].date),g=l.isAfter(r[0].date,m[0].date),y=g?n[pr.caption_after_enter]:n[pr.caption_before_enter],w=g?n[pr.weeks_after_enter]:n[pr.weeks_before_enter],S=u.current,j=e.current.cloneNode(!0);if(j instanceof HTMLElement?(Iv(j).forEach(E=>{if(!(E instanceof HTMLElement))return;const M=hX(E);M&&E.contains(M)&&E.removeChild(M);const A=$v(E);A&&A.classList.remove(y);const R=Fv(E);R&&R.classList.remove(w)}),u.current=j):u.current=null,h.current||v||o)return;const N=S instanceof HTMLElement?Iv(S):[],C=Iv(e.current);if(C?.every(_=>_ instanceof HTMLElement)&&N&&N.every(_=>_ instanceof HTMLElement)){h.current=!0,e.current.style.isolation="isolate";const _=mX(e.current);_&&(_.style.zIndex="1"),C.forEach((E,M)=>{const A=N[M];if(!A)return;E.style.position="relative",E.style.overflow="hidden";const R=$v(E);R&&R.classList.add(y);const T=Fv(E);T&&T.classList.add(w);const O=()=>{h.current=!1,e.current&&(e.current.style.isolation=""),_&&(_.style.zIndex=""),R&&R.classList.remove(y),T&&T.classList.remove(w),E.style.position="",E.style.overflow="",E.contains(A)&&E.removeChild(A)};A.style.pointerEvents="none",A.style.position="absolute",A.style.overflow="hidden",A.setAttribute("aria-hidden","true");const D=pX(A);D&&(D.style.opacity="0");const z=$v(A);z&&(z.classList.add(g?n[pr.caption_before_exit]:n[pr.caption_after_exit]),z.addEventListener("animationend",O));const B=Fv(A);B&&B.classList.add(g?n[pr.weeks_before_exit]:n[pr.weeks_after_exit]),E.insertBefore(A,E.firstChild)})}})}function vX(e,t,n,r){const o=e[0],l=e[e.length-1],{ISOWeek:u,fixedWeeks:d,broadcastCalendar:h}=n??{},{addDays:m,differenceInCalendarDays:v,differenceInCalendarMonths:g,endOfBroadcastWeek:y,endOfISOWeek:w,endOfMonth:S,endOfWeek:j,isAfter:N,startOfBroadcastWeek:C,startOfISOWeek:_,startOfWeek:E}=r,M=h?C(o,r):u?_(o):E(o),A=h?y(l):u?w(S(l)):j(S(l)),R=t&&(h?y(t):u?w(t):j(t)),T=R&&N(A,R)?R:A,O=v(T,M),D=g(l,o)+1,z=[];for(let Y=0;Y<=O;Y++){const G=m(M,Y);z.push(G)}const V=(h?35:42)*D;if(d&&z.length<V){const Y=V-z.length;for(let G=0;G<Y;G++){const ae=m(z[z.length-1],1);z.push(ae)}}return z}function xX(e){const t=[];return e.reduce((n,r)=>{const o=r.weeks.reduce((l,u)=>l.concat(u.days.slice()),t.slice());return n.concat(o.slice())},t.slice())}function yX(e,t,n,r){const{numberOfMonths:o=1}=n,l=[];for(let u=0;u<o;u++){const d=r.addMonths(e,u);if(t&&d>t)break;l.push(d)}return l}function nN(e,t,n,r){const{month:o,defaultMonth:l,today:u=r.today(),numberOfMonths:d=1}=e;let h=o||l||u;const{differenceInCalendarMonths:m,addMonths:v,startOfMonth:g}=r;if(n&&m(n,h)<d-1){const y=-1*(d-1);h=v(n,y)}return t&&m(h,t)<0&&(h=t),g(h)}function bX(e,t,n,r){const{addDays:o,endOfBroadcastWeek:l,endOfISOWeek:u,endOfMonth:d,endOfWeek:h,getISOWeek:m,getWeek:v,startOfBroadcastWeek:g,startOfISOWeek:y,startOfWeek:w}=r,S=e.reduce((j,N)=>{const C=n.broadcastCalendar?g(N,r):n.ISOWeek?y(N):w(N),_=n.broadcastCalendar?l(N):n.ISOWeek?u(d(N)):h(d(N)),E=t.filter(T=>T>=C&&T<=_),M=n.broadcastCalendar?35:42;if(n.fixedWeeks&&E.length<M){const T=t.filter(O=>{const D=M-E.length;return O>_&&O<=o(_,D)});E.push(...T)}const A=E.reduce((T,O)=>{const D=n.ISOWeek?m(O):v(O),z=T.find(V=>V.weekNumber===D),B=new rR(O,N,r);return z?z.days.push(B):T.push(new gK(D,[B])),T},[]),R=new pK(N,A);return j.push(R),j},[]);return n.reverseMonths?S.reverse():S}function wX(e,t){let{startMonth:n,endMonth:r}=e;const{startOfYear:o,startOfDay:l,startOfMonth:u,endOfMonth:d,addYears:h,endOfYear:m,newDate:v,today:g}=t,{fromYear:y,toYear:w,fromMonth:S,toMonth:j}=e;!n&&S&&(n=S),!n&&y&&(n=t.newDate(y,0,1)),!r&&j&&(r=j),!r&&w&&(r=v(w,11,31));const N=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=u(n):y?n=v(y,0,1):!n&&N&&(n=o(h(e.today??g(),-100))),r?r=d(r):w?r=v(w,11,31):!r&&N&&(r=m(e.today??g())),[n&&l(n),r&&l(r)]}function SX(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:l=1}=n,{startOfMonth:u,addMonths:d,differenceInCalendarMonths:h}=r,m=o?l:1,v=u(e);if(!t)return d(v,m);if(!(h(t,e)<l))return d(v,m)}function jX(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:l}=n,{startOfMonth:u,addMonths:d,differenceInCalendarMonths:h}=r,m=o?l??1:1,v=u(e);if(!t)return d(v,-m);if(!(h(v,t)<=0))return d(v,-m)}function CX(e){const t=[];return e.reduce((n,r)=>n.concat(r.weeks.slice()),t.slice())}function km(e,t){const[n,r]=p.useState(e);return[t===void 0?n:t,r]}function NX(e,t){const[n,r]=wX(e,t),{startOfMonth:o,endOfMonth:l}=t,u=nN(e,n,r,t),[d,h]=km(u,e.month?u:void 0);p.useEffect(()=>{const M=nN(e,n,r,t);h(M)},[e.timeZone]);const{months:m,weeks:v,days:g,previousMonth:y,nextMonth:w}=p.useMemo(()=>{const M=yX(d,r,{numberOfMonths:e.numberOfMonths},t),A=vX(M,e.endMonth?l(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),R=bX(M,A,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t),T=CX(R),O=xX(R),D=jX(d,n,e,t),z=SX(d,r,e,t);return{months:R,weeks:T,days:O,previousMonth:D,nextMonth:z}},[t,d.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:S,onMonthChange:j}=e,N=M=>v.some(A=>A.days.some(R=>R.isEqualTo(M))),C=M=>{if(S)return;let A=o(M);n&&A<o(n)&&(A=o(n)),r&&A>o(r)&&(A=o(r)),h(A),j?.(A)};return{months:m,weeks:v,days:g,navStart:n,navEnd:r,previousMonth:y,nextMonth:w,goToMonth:C,goToDay:M=>{N(M)||C(M.date)}}}var gs;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(gs||(gs={}));function rN(e){return!e[Bt.disabled]&&!e[Bt.hidden]&&!e[Bt.outside]}function kX(e,t,n,r){let o,l=-1;for(const u of e){const d=t(u);rN(d)&&(d[Bt.focused]&&l<gs.FocusedModifier?(o=u,l=gs.FocusedModifier):r?.isEqualTo(u)&&l<gs.LastFocused?(o=u,l=gs.LastFocused):n(u.date)&&l<gs.Selected?(o=u,l=gs.Selected):d[Bt.today]&&l<gs.Today&&(o=u,l=gs.Today))}return o||(o=e.find(u=>rN(t(u)))),o}function _X(e,t,n,r,o,l,u){const{ISOWeek:d,broadcastCalendar:h}=l,{addDays:m,addMonths:v,addWeeks:g,addYears:y,endOfBroadcastWeek:w,endOfISOWeek:S,endOfWeek:j,max:N,min:C,startOfBroadcastWeek:_,startOfISOWeek:E,startOfWeek:M}=u;let R={day:m,week:g,month:v,year:y,startOfWeek:T=>h?_(T,u):d?E(T):M(T),endOfWeek:T=>h?w(T):d?S(T):j(T)}[e](n,t==="after"?1:-1);return t==="before"&&r?R=N([r,R]):t==="after"&&o&&(R=C([o,R])),R}function xR(e,t,n,r,o,l,u,d=0){if(d>365)return;const h=_X(e,t,n.date,r,o,l,u),m=!!(l.disabled&&aa(h,l.disabled,u)),v=!!(l.hidden&&aa(h,l.hidden,u)),g=h,y=new rR(h,g,u);return!m&&!v?y:xR(e,t,y,r,o,l,u,d+1)}function EX(e,t,n,r,o){const{autoFocus:l}=e,[u,d]=p.useState(),h=kX(t.days,n,r||(()=>!1),u),[m,v]=p.useState(l?h:void 0);return{isFocusTarget:j=>!!h?.isEqualTo(j),setFocused:v,focused:m,blur:()=>{d(m),v(void 0)},moveFocus:(j,N)=>{if(!m)return;const C=xR(j,N,m,t.navStart,t.navEnd,e,o);C&&(e.disableNavigation&&!t.days.some(E=>E.isEqualTo(C))||(t.goToDay(C),v(C)))}}}function TX(e,t){const{selected:n,required:r,onSelect:o}=e,[l,u]=km(n,o?n:void 0),d=o?n:l,{isSameDay:h}=t,m=w=>d?.some(S=>h(S,w))??!1,{min:v,max:g}=e;return{selected:d,select:(w,S,j)=>{let N=[...d??[]];if(m(w)){if(d?.length===v||r&&d?.length===1)return;N=d?.filter(C=>!h(C,w))}else d?.length===g?N=[w]:N=[...N,w];return o||u(N),o?.(N,w,S,j),N},isSelected:m}}function MX(e,t,n=0,r=0,o=!1,l=Os){const{from:u,to:d}=t||{},{isSameDay:h,isAfter:m,isBefore:v}=l;let g;if(!u&&!d)g={from:e,to:n>0?void 0:e};else if(u&&!d)h(u,e)?n===0?g={from:u,to:e}:o?g={from:u,to:void 0}:g=void 0:v(e,u)?g={from:e,to:u}:g={from:u,to:e};else if(u&&d)if(h(u,e)&&h(d,e))o?g={from:u,to:d}:g=void 0;else if(h(u,e))g={from:u,to:n>0?void 0:e};else if(h(d,e))g={from:e,to:n>0?void 0:e};else if(v(e,u))g={from:e,to:d};else if(m(e,u))g={from:u,to:e};else if(m(e,d))g={from:u,to:e};else throw new Error("Invalid range");if(g?.from&&g?.to){const y=l.differenceInCalendarDays(g.to,g.from);r>0&&y>r?g={from:e,to:void 0}:n>1&&y<n&&(g={from:e,to:void 0})}return g}function RX(e,t,n=Os){const r=Array.isArray(t)?t:[t];let o=e.from;const l=n.differenceInCalendarDays(e.to,e.from),u=Math.min(l,6);for(let d=0;d<=u;d++){if(r.includes(o.getDay()))return!0;o=n.addDays(o,1)}return!1}function sN(e,t,n=Os){return sa(e,t.from,!1,n)||sa(e,t.to,!1,n)||sa(t,e.from,!1,n)||sa(t,e.to,!1,n)}function AX(e,t,n=Os){const r=Array.isArray(t)?t:[t];if(r.filter(d=>typeof d!="function").some(d=>typeof d=="boolean"?d:n.isDate(d)?sa(e,d,!1,n):oR(d,n)?d.some(h=>sa(e,h,!1,n)):Nm(d)?d.from&&d.to?sN(e,{from:d.from,to:d.to},n):!1:aR(d)?RX(e,d.dayOfWeek,n):Sb(d)?n.isAfter(d.before,d.after)?sN(e,{from:n.addDays(d.after,1),to:n.addDays(d.before,-1)},n):aa(e.from,d,n)||aa(e.to,d,n):jb(d)||Cb(d)?aa(e.from,d,n)||aa(e.to,d,n):!1))return!0;const u=r.filter(d=>typeof d=="function");if(u.length){let d=e.from;const h=n.differenceInCalendarDays(e.to,e.from);for(let m=0;m<=h;m++){if(u.some(v=>v(d)))return!0;d=n.addDays(d,1)}}return!1}function OX(e,t){const{disabled:n,excludeDisabled:r,selected:o,required:l,onSelect:u}=e,[d,h]=km(o,u?o:void 0),m=u?o:d;return{selected:m,select:(y,w,S)=>{const{min:j,max:N}=e,C=y?MX(y,m,j,N,l,t):void 0;return r&&n&&C?.from&&C.to&&AX({from:C.from,to:C.to},n,t)&&(C.from=y,C.to=void 0),u||h(C),u?.(C,y,w,S),C},isSelected:y=>m&&sa(m,y,!1,t)}}function DX(e,t){const{selected:n,required:r,onSelect:o}=e,[l,u]=km(n,o?n:void 0),d=o?n:l,{isSameDay:h}=t;return{selected:d,select:(g,y,w)=>{let S=g;return!r&&d&&d&&h(g,d)&&(S=void 0),o||u(S),o?.(S,g,y,w),S},isSelected:g=>d?h(d,g):!1}}function zX(e,t){const n=DX(e,t),r=TX(e,t),o=OX(e,t);switch(e.mode){case"single":return n;case"multiple":return r;case"range":return o;default:return}}function Ir(e,t){return e instanceof On&&e.timeZone===t?e:new On(e,t)}function Wi(e,t,n){return Ir(e,t)}function aN(e,t,n){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?Wi(e,t):Array.isArray(e)?e.map(r=>r instanceof Date?Wi(r,t):r):Nm(e)?{...e,from:e.from?Ir(e.from,t):e.from,to:e.to?Ir(e.to,t):e.to}:Sb(e)?{before:Wi(e.before,t),after:Wi(e.after,t)}:jb(e)?{after:Wi(e.after,t)}:Cb(e)?{before:Wi(e.before,t)}:e}function Bv(e,t,n){return e&&(Array.isArray(e)?e.map(r=>aN(r,t)):aN(e,t))}function PX(e){let t=e;const n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&(t.today=Ir(t.today,n)),t.month&&(t.month=Ir(t.month,n)),t.defaultMonth&&(t.defaultMonth=Ir(t.defaultMonth,n)),t.startMonth&&(t.startMonth=Ir(t.startMonth,n)),t.endMonth&&(t.endMonth=Ir(t.endMonth,n)),t.mode==="single"&&t.selected?t.selected=Ir(t.selected,n):t.mode==="multiple"&&t.selected?t.selected=t.selected?.map(xe=>Ir(xe,n)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?Ir(t.selected.from,n):t.selected.from,to:t.selected.to?Ir(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=Bv(t.disabled,n)),t.hidden!==void 0&&(t.hidden=Bv(t.hidden,n)),t.modifiers)){const xe={};Object.keys(t.modifiers).forEach(ke=>{xe[ke]=Bv(t.modifiers?.[ke],n)}),t.modifiers=xe}const{components:r,formatters:o,labels:l,dateLib:u,locale:d,classNames:h}=p.useMemo(()=>{const xe={...nR,...t.locale},ke=t.broadcastCalendar?1:t.weekStartsOn,we=t.noonSafe&&t.timeZone?fX(t.timeZone,{weekStartsOn:ke,locale:xe}):void 0,Ne=t.dateLib&&we?{...we,...t.dateLib}:t.dateLib??we,Ve=new jr({locale:xe,weekStartsOn:ke,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},Ne);return{dateLib:Ve,components:YK(t.components),formatters:nX(t.formatters),labels:iX(t.labels,Ve.options),locale:xe,classNames:{...Nb(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:u.today()});const{captionLayout:m,mode:v,navLayout:g,numberOfMonths:y=1,onDayBlur:w,onDayClick:S,onDayFocus:j,onDayKeyDown:N,onDayMouseEnter:C,onDayMouseLeave:_,onNextClick:E,onPrevClick:M,showWeekNumber:A,styles:R}=t,{formatCaption:T,formatDay:O,formatMonthDropdown:D,formatWeekNumber:z,formatWeekNumberHeader:B,formatWeekdayName:V,formatYearDropdown:Y}=o,G=NX(t,u),{days:ae,months:L,navStart:$,navEnd:U,previousMonth:H,nextMonth:le,goToMonth:I}=G,F=VK(ae,t,$,U,u),{isSelected:K,select:ne,selected:X}=zX(t,u)??{},{blur:ue,focused:te,isFocusTarget:ye,moveFocus:Ce,setFocused:_e}=EX(t,G,F,K??(()=>!1),u),{labelDayButton:Re,labelGridcell:ge,labelGrid:Fe,labelMonthDropdown:be,labelNav:Be,labelPrevious:nt,labelNext:ot,labelWeekday:yt,labelWeekNumber:pe,labelWeekNumberHeader:Le,labelYearDropdown:Ye}=l,Oe=p.useMemo(()=>uX(u,t.ISOWeek,t.broadcastCalendar,t.today),[u,t.ISOWeek,t.broadcastCalendar,t.today]),dt=v!==void 0||S!==void 0,ct=p.useCallback(()=>{H&&(I(H),M?.(H))},[H,I,M]),Mn=p.useCallback(()=>{le&&(I(le),E?.(le))},[I,le,E]),Qe=p.useCallback((xe,ke)=>we=>{we.preventDefault(),we.stopPropagation(),_e(xe),!ke.disabled&&(ne?.(xe.date,ke,we),S?.(xe.date,ke,we))},[ne,S,_e]),bt=p.useCallback((xe,ke)=>we=>{_e(xe),j?.(xe.date,ke,we)},[j,_e]),pt=p.useCallback((xe,ke)=>we=>{ue(),w?.(xe.date,ke,we)},[ue,w]),Vn=p.useCallback((xe,ke)=>we=>{const Ne={ArrowLeft:[we.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[we.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[we.shiftKey?"year":"week","after"],ArrowUp:[we.shiftKey?"year":"week","before"],PageUp:[we.shiftKey?"year":"month","before"],PageDown:[we.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ne[we.key]){we.preventDefault(),we.stopPropagation();const[Ve,De]=Ne[we.key];Ce(Ve,De)}N?.(xe.date,ke,we)},[Ce,N,t.dir]),or=p.useCallback((xe,ke)=>we=>{C?.(xe.date,ke,we)},[C]),Hr=p.useCallback((xe,ke)=>we=>{_?.(xe.date,ke,we)},[_]),zn=p.useCallback(xe=>ke=>{const we=Number(ke.target.value),Ne=u.setMonth(u.startOfMonth(xe),we);I(Ne)},[u,I]),Pn=p.useCallback(xe=>ke=>{const we=Number(ke.target.value),Ne=u.setYear(u.startOfMonth(xe),we);I(Ne)},[u,I]),{className:qt,style:en}=p.useMemo(()=>({className:[h[Pe.Root],t.className].filter(Boolean).join(" "),style:{...R?.[Pe.Root],...t.style}}),[h,t.className,t.style,R]),$t=WK(t),us=p.useRef(null);gX(us,!!t.animate,{classNames:h,months:L,focused:te,dateLib:u});const Yr={dayPickerProps:t,selected:X,select:ne,isSelected:K,months:L,nextMonth:le,previousMonth:H,goToMonth:I,getModifiers:F,components:r,classNames:h,styles:R,labels:l,formatters:o};return ee.createElement(sR.Provider,{value:Yr},ee.createElement(r.Root,{rootRef:t.animate?us:void 0,className:qt,style:en,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...$t},ee.createElement(r.Months,{className:h[Pe.Months],style:R?.[Pe.Months]},!t.hideNavigation&&!g&&ee.createElement(r.Nav,{"data-animated-nav":t.animate?"true":void 0,className:h[Pe.Nav],style:R?.[Pe.Nav],"aria-label":Be(),onPreviousClick:ct,onNextClick:Mn,previousMonth:H,nextMonth:le}),L.map((xe,ke)=>ee.createElement(r.Month,{"data-animated-month":t.animate?"true":void 0,className:h[Pe.Month],style:R?.[Pe.Month],key:ke,displayIndex:ke,calendarMonth:xe},g==="around"&&!t.hideNavigation&&ke===0&&ee.createElement(r.PreviousMonthButton,{type:"button",className:h[Pe.PreviousMonthButton],tabIndex:H?void 0:-1,"aria-disabled":H?void 0:!0,"aria-label":nt(H),onClick:ct,"data-animated-button":t.animate?"true":void 0},ee.createElement(r.Chevron,{disabled:H?void 0:!0,className:h[Pe.Chevron],orientation:t.dir==="rtl"?"right":"left"})),ee.createElement(r.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:h[Pe.MonthCaption],style:R?.[Pe.MonthCaption],calendarMonth:xe,displayIndex:ke},m?.startsWith("dropdown")?ee.createElement(r.DropdownNav,{className:h[Pe.Dropdowns],style:R?.[Pe.Dropdowns]},(()=>{const we=m==="dropdown"||m==="dropdown-months"?ee.createElement(r.MonthsDropdown,{key:"month",className:h[Pe.MonthsDropdown],"aria-label":be(),classNames:h,components:r,disabled:!!t.disableNavigation,onChange:zn(xe.date),options:lX(xe.date,$,U,o,u),style:R?.[Pe.Dropdown],value:u.getMonth(xe.date)}):ee.createElement("span",{key:"month"},D(xe.date,u)),Ne=m==="dropdown"||m==="dropdown-years"?ee.createElement(r.YearsDropdown,{key:"year",className:h[Pe.YearsDropdown],"aria-label":Ye(u.options),classNames:h,components:r,disabled:!!t.disableNavigation,onChange:Pn(xe.date),options:dX($,U,o,u,!!t.reverseYears),style:R?.[Pe.Dropdown],value:u.getYear(xe.date)}):ee.createElement("span",{key:"year"},Y(xe.date,u));return u.getMonthYearOrder()==="year-first"?[Ne,we]:[we,Ne]})(),ee.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},T(xe.date,u.options,u))):ee.createElement(r.CaptionLabel,{className:h[Pe.CaptionLabel],role:"status","aria-live":"polite"},T(xe.date,u.options,u))),g==="around"&&!t.hideNavigation&&ke===y-1&&ee.createElement(r.NextMonthButton,{type:"button",className:h[Pe.NextMonthButton],tabIndex:le?void 0:-1,"aria-disabled":le?void 0:!0,"aria-label":ot(le),onClick:Mn,"data-animated-button":t.animate?"true":void 0},ee.createElement(r.Chevron,{disabled:le?void 0:!0,className:h[Pe.Chevron],orientation:t.dir==="rtl"?"left":"right"})),ke===y-1&&g==="after"&&!t.hideNavigation&&ee.createElement(r.Nav,{"data-animated-nav":t.animate?"true":void 0,className:h[Pe.Nav],style:R?.[Pe.Nav],"aria-label":Be(),onPreviousClick:ct,onNextClick:Mn,previousMonth:H,nextMonth:le}),ee.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":v==="multiple"||v==="range","aria-label":Fe(xe.date,u.options,u)||void 0,className:h[Pe.MonthGrid],style:R?.[Pe.MonthGrid]},!t.hideWeekdays&&ee.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:h[Pe.Weekdays],style:R?.[Pe.Weekdays]},A&&ee.createElement(r.WeekNumberHeader,{"aria-label":Le(u.options),className:h[Pe.WeekNumberHeader],style:R?.[Pe.WeekNumberHeader],scope:"col"},B()),Oe.map(we=>ee.createElement(r.Weekday,{"aria-label":yt(we,u.options,u),className:h[Pe.Weekday],key:String(we),style:R?.[Pe.Weekday],scope:"col"},V(we,u.options,u)))),ee.createElement(r.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:h[Pe.Weeks],style:R?.[Pe.Weeks]},xe.weeks.map(we=>ee.createElement(r.Week,{className:h[Pe.Week],key:we.weekNumber,style:R?.[Pe.Week],week:we},A&&ee.createElement(r.WeekNumber,{week:we,style:R?.[Pe.WeekNumber],"aria-label":pe(we.weekNumber,{locale:d}),className:h[Pe.WeekNumber],scope:"row",role:"rowheader"},z(we.weekNumber,u)),we.days.map(Ne=>{const{date:Ve}=Ne,De=F(Ne);if(De[Bt.focused]=!De.hidden&&!!te?.isEqualTo(Ne),De[ts.selected]=K?.(Ve)||De.selected,Nm(X)){const{from:Gt,to:Ot}=X;De[ts.range_start]=!!(Gt&&Ot&&u.isSameDay(Ve,Gt)),De[ts.range_end]=!!(Gt&&Ot&&u.isSameDay(Ve,Ot)),De[ts.range_middle]=sa(X,Ve,!0,u)}const wt=cX(De,R,t.modifiersStyles),bn=HK(De,h,t.modifiersClassNames),tn=!dt&&!De.hidden?ge(Ve,De,u.options,u):void 0;return ee.createElement(r.Day,{key:`${Ne.isoDate}_${Ne.displayMonthId}`,day:Ne,modifiers:De,className:bn.join(" "),style:wt,role:"gridcell","aria-selected":De.selected||void 0,"aria-label":tn,"data-day":Ne.isoDate,"data-month":Ne.outside?Ne.dateMonthId:void 0,"data-selected":De.selected||void 0,"data-disabled":De.disabled||void 0,"data-hidden":De.hidden||void 0,"data-outside":Ne.outside||void 0,"data-focused":De.focused||void 0,"data-today":De.today||void 0},!De.hidden&&dt?ee.createElement(r.DayButton,{className:h[Pe.DayButton],style:R?.[Pe.DayButton],type:"button",day:Ne,modifiers:De,disabled:!De.focused&&De.disabled||void 0,"aria-disabled":De.focused&&De.disabled||void 0,tabIndex:ye(Ne)?0:-1,"aria-label":Re(Ve,De,u.options,u),onClick:Qe(Ne,De),onBlur:pt(Ne,De),onFocus:bt(Ne,De),onKeyDown:Vn(Ne,De),onMouseEnter:or(Ne,De),onMouseLeave:Hr(Ne,De)},O(Ve,u.options,u)):!De.hidden&&O(Ne.date,u.options,u))})))))))),t.footer&&ee.createElement(r.Footer,{className:h[Pe.Footer],style:R?.[Pe.Footer],role:"status","aria-live":"polite"},t.footer)))}function LX({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:o="ghost",formatters:l,components:u,...d}){const h=Nb();return i.jsx(PX,{showOutsideDays:n,className:W("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:r,formatters:{formatMonthDropdown:m=>m.toLocaleString("default",{month:"short"}),...l},classNames:{root:W("w-fit",h.root),months:W("flex gap-4 flex-col md:flex-row relative",h.months),month:W("flex flex-col w-full gap-4",h.month),nav:W("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",h.nav),button_previous:W(wu({variant:o}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",h.button_previous),button_next:W(wu({variant:o}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",h.button_next),month_caption:W("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",h.month_caption),dropdowns:W("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",h.dropdowns),dropdown_root:W("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",h.dropdown_root),dropdown:W("absolute bg-popover inset-0 opacity-0",h.dropdown),caption_label:W("select-none font-medium",r==="label"?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",h.caption_label),table:"w-full border-collapse",weekdays:W("flex",h.weekdays),weekday:W("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",h.weekday),week:W("flex w-full mt-2",h.week),week_number_header:W("select-none w-(--cell-size)",h.week_number_header),week_number:W("text-[0.8rem] select-none text-muted-foreground",h.week_number),day:W("relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",d.showWeekNumber?"[&:nth-child(2)[data-selected=true]_button]:rounded-l-md":"[&:first-child[data-selected=true]_button]:rounded-l-md",h.day),range_start:W("rounded-l-md bg-accent",h.range_start),range_middle:W("rounded-none",h.range_middle),range_end:W("rounded-r-md bg-accent",h.range_end),today:W("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",h.today),outside:W("text-muted-foreground aria-selected:text-muted-foreground",h.outside),disabled:W("text-muted-foreground opacity-50",h.disabled),hidden:W("invisible",h.hidden),...t},components:{Root:({className:m,rootRef:v,...g})=>i.jsx("div",{"data-slot":"calendar",ref:v,className:W(m),...g}),Chevron:({className:m,orientation:v,...g})=>v==="left"?i.jsx(Hx,{className:W("size-4",m),...g}):v==="right"?i.jsx(Rl,{className:W("size-4",m),...g}):i.jsx(vn,{className:W("size-4",m),...g}),DayButton:IX,WeekNumber:({children:m,...v})=>i.jsx("td",{...v,children:i.jsx("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:m})}),...u},...d})}function IX({className:e,day:t,modifiers:n,...r}){const o=Nb(),l=p.useRef(null);return p.useEffect(()=>{n.focused&&l.current?.focus()},[n.focused]),i.jsx(Je,{ref:l,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:W("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",o.day,e),...r})}function Uv(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),o=String(e.getHours()).padStart(2,"0"),l=String(e.getMinutes()).padStart(2,"0");return`${t}-${n}-${r}T${o}:${l}`}function $X(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`}function oN({field:e,value:t,onChange:n,error:r,disabled:o=!1,readOnly:l=!1,className:u="",id:d,includeTime:h=!1}){const m=p.useId(),v=d??`field-${e.name}-${m}`,[g,y]=p.useState(!1),w=h||e.type==="datetime",S=t?new Date(t):void 0,j=S&&!isNaN(S.getTime()),N=t&&w&&t.includes("T")&&t.split("T")[1]?.substring(0,5)||"",C=M=>{if(!M){n(null),y(!1);return}if(w&&N){const[R,T]=N.split(":").map(Number);M.setHours(R||0,T||0)}const A=w?Uv(M):$X(M);n(A),w||y(!1)},_=M=>{const A=M.target.value;if(!A)return;const[R,T]=A.split(":").map(Number);if(j&&S){const O=new Date(S);O.setHours(R||0,T||0),n(Uv(O))}else{const O=new Date;O.setHours(R||0,T||0,0,0),n(Uv(O))}},E=M=>M.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});return i.jsx(ar,{field:e,error:r,className:u,id:v,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(Tu,{open:g,onOpenChange:y,children:[i.jsx(Mu,{asChild:!0,children:i.jsxs(Je,{id:v,type:"button",variant:"outline",disabled:o||l,className:W("justify-between font-normal",w?"w-44":"flex-1",!t&&"text-muted-foreground",r&&"border-destructive focus-visible:ring-destructive"),"aria-invalid":!!r,"aria-describedby":r?`${v}-error`:e.description?`${v}-description`:void 0,children:[i.jsx("span",{children:j&&S?E(S):"Select date"}),i.jsx(pl,{className:"size-4 opacity-50"})]})}),i.jsx(Ru,{className:"w-auto p-0",align:"start",children:i.jsx(LX,{mode:"single",selected:S,onSelect:C,captionLayout:"dropdown",disabled:o||l})})]}),w&&i.jsx(mt,{type:"time",value:N,onChange:_,disabled:o||l,className:W("w-28",r&&"border-destructive focus-visible:ring-destructive"),"aria-label":"Time"}),t&&!l&&!o&&i.jsx(Je,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0",onClick:()=>n(null),"aria-label":"Clear date",children:i.jsx(At,{className:"size-4"})})]})})}const FX=[{label:"Bold",icon:i.jsx(O3,{className:"size-4"}),prefix:"**",suffix:"**"},{label:"Italic",icon:i.jsx(qP,{className:"size-4"}),prefix:"_",suffix:"_"},{label:"Heading",icon:i.jsx(DP,{className:"size-4"}),prefix:"## ",suffix:"",block:!0},{label:"Link",icon:i.jsx(uk,{className:"size-4"}),prefix:"[",suffix:"](url)"},{label:"List",icon:i.jsx(gu,{className:"size-4"}),prefix:"- ",suffix:"",block:!0},{label:"Quote",icon:i.jsx(S5,{className:"size-4"}),prefix:"> ",suffix:"",block:!0},{label:"Code",icon:i.jsx(ak,{className:"size-4"}),prefix:"`",suffix:"`"}];function BX({field:e,value:t,onChange:n,error:r,disabled:o=!1,readOnly:l=!1,className:u="",id:d,placeholder:h="Write your content here... (Markdown supported)",minHeight:m=200}){const v=p.useId(),g=d??`field-${e.name}-${v}`,[y,w]=p.useState(null),S=C=>{n(C.target.value)},j=p.useCallback(C=>{if(!y||o||l)return;const _=y.selectionStart,E=y.selectionEnd,M=t.slice(_,E),A=t;let R,T;if(C.block){const O=A.lastIndexOf(`
100
- `,_-1)+1,D=A.slice(0,O),z=A.slice(O);z.startsWith(C.prefix)?(R=D+z.slice(C.prefix.length),T=_-C.prefix.length):(R=D+C.prefix+z,T=_+C.prefix.length)}else if(M)R=A.slice(0,_)+C.prefix+M+C.suffix+A.slice(E),T=E+C.prefix.length+C.suffix.length;else{const O=C.label.toLowerCase();R=A.slice(0,_)+C.prefix+O+C.suffix+A.slice(E),T=_+C.prefix.length}n(R),requestAnimationFrame(()=>{y&&(y.focus(),y.setSelectionRange(T,T))})},[y,t,n,o,l]),{maxLength:N}=e.options??{};return i.jsx(ar,{field:e,error:r,className:u,id:g,children:i.jsxs("div",{className:W("overflow-hidden rounded-md border border-input",r&&"border-destructive"),children:[!l&&!o&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex flex-wrap gap-1 bg-muted/50 p-1.5",role:"toolbar","aria-label":"Formatting options",children:FX.map(C=>i.jsx(Je,{type:"button",variant:"ghost",size:"icon",className:"size-7",onClick:()=>j(C),title:C.label,"aria-label":C.label,children:C.icon},C.label))}),i.jsx(wh,{})]}),i.jsx(no,{ref:w,id:g,name:e.name,value:t??"",onChange:S,disabled:o,readOnly:l,required:e.required,maxLength:N,placeholder:h,className:"resize-none rounded-none border-0 focus-visible:ring-0",style:{minHeight:`${m}px`},"aria-invalid":!!r,"aria-describedby":r?`${g}-error`:e.description?`${g}-description`:void 0}),i.jsxs("div",{className:"flex items-center justify-between border-t bg-muted/30 px-3 py-1.5 text-xs text-muted-foreground",children:[i.jsx("span",{children:"Markdown supported"}),N&&i.jsxs("span",{children:[(t??"").length," / ",N]})]})]})})}function UX({field:e,value:t,onChange:n,error:r,disabled:o=!1,readOnly:l=!1,className:u="",id:d,placeholder:h="Select an option..."}){const m=p.useId(),v=d??`field-${e.name}-${m}`,g=e.options?.options??[],y=w=>{n(w)};return i.jsx(ar,{field:e,error:r,className:u,id:v,children:i.jsxs(ia,{value:t??"",onValueChange:y,disabled:o||l,required:e.required,children:[i.jsx(ca,{id:v,className:W(r&&"border-destructive focus:ring-destructive"),"aria-invalid":!!r,"aria-describedby":r?`${v}-error`:void 0,children:i.jsx(la,{placeholder:h})}),i.jsx(ua,{children:i.jsx(yE,{children:g.map(w=>i.jsx(Xt,{value:w.value,children:w.label},w.value))})})]})})}function qX({field:e,value:t,onChange:n,error:r,disabled:o=!1,readOnly:l=!1,className:u="",id:d}){const h=p.useId(),m=d??`field-${e.name}-${h}`,v=e.options?.options??[],g=t??[],y=(j,N)=>{n(N?[...g,j]:g.filter(C=>C!==j))},w=()=>{const j=v.map(N=>N.value);n(j)},S=()=>{n([])};return i.jsx(ar,{field:e,error:r,className:u,id:m,children:i.jsx("div",{className:W("rounded-md border border-input p-3",r&&"border-destructive"),children:i.jsxs(HW,{"aria-labelledby":`${m}-label`,children:[i.jsx(YW,{variant:"label",className:"sr-only",children:e.label}),v.length>3&&i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Je,{type:"button",variant:"outline",size:"sm",onClick:w,disabled:o||l,children:"Select all"}),i.jsx(Je,{type:"button",variant:"outline",size:"sm",onClick:S,disabled:o||l||g.length===0,children:"Clear"})]}),i.jsx("div",{className:"flex flex-col gap-2",children:v.map(j=>{const N=`${m}-${j.value}`,C=g.includes(j.value);return i.jsxs(bs,{orientation:"horizontal",className:W("rounded-md p-2",C&&"bg-accent"),children:[i.jsx(wr,{id:N,checked:C,onCheckedChange:_=>y(j.value,_===!0),disabled:o||l}),i.jsx(ws,{htmlFor:N,className:"cursor-pointer font-normal",children:j.label})]},j.value)})}),g.length>0&&i.jsxs("div",{className:"text-xs text-muted-foreground",children:[g.length," of ",v.length," selected"]})]})})})}function VX({field:e,value:t,onChange:n,error:r,disabled:o=!1,readOnly:l=!1,className:u="",id:d,placeholder:h=`{
101
-
102
- }`,rows:m=8}){const v=p.useId(),g=d??`field-${e.name}-${v}`,[y,w]=p.useState(()=>{if(t==null)return"";try{return JSON.stringify(t,null,2)}catch{return""}}),[S,j]=p.useState(null);p.useEffect(()=>{if(t==null){w("");return}try{const M=JSON.stringify(t,null,2),A=y?JSON.parse(y):null;JSON.stringify(A)!==JSON.stringify(t)&&w(M)}catch{}},[t]);const N=p.useCallback(M=>{const A=M.target.value;if(w(A),A.trim()===""){j(null),n(null);return}try{const R=JSON.parse(A);j(null),n(R)}catch(R){const T=R instanceof Error?R.message:"Invalid JSON";j(T)}},[n]),C=p.useCallback(()=>{if(y.trim()!=="")try{const M=JSON.parse(y),A=JSON.stringify(M,null,2);w(A),j(null)}catch{}},[y]),_=p.useCallback(()=>{if(y.trim()!=="")try{const M=JSON.parse(y),A=JSON.stringify(M);w(A),j(null)}catch{}},[y]),E=S?{message:`JSON syntax error: ${S}`,code:"SYNTAX_ERROR"}:r;return i.jsx(ar,{field:e,error:E,className:u,id:g,children:i.jsxs("div",{className:W("overflow-hidden rounded-md border border-input",E&&"border-destructive"),children:[i.jsxs("div",{className:"flex items-center gap-1 border-b bg-muted/50 px-2 py-1.5",children:[i.jsx(Je,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:C,disabled:o||l||!!S,children:"Format"}),i.jsx(Je,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:_,disabled:o||l||!!S,children:"Minify"})]}),i.jsx(no,{id:g,name:e.name,value:y,onChange:N,placeholder:h,rows:m,disabled:o,readOnly:l,required:e.required,"aria-invalid":!!E,"aria-describedby":E?`${g}-error`:void 0,className:"resize-none rounded-none border-0 font-mono text-sm focus-visible:ring-0",spellCheck:!1}),i.jsxs("div",{className:"flex items-center justify-between border-t bg-muted/30 px-3 py-1.5 text-xs text-muted-foreground",children:[i.jsx("span",{children:"Enter valid JSON data"}),S&&i.jsxs("span",{className:"flex items-center gap-1 text-destructive",children:[i.jsx($u,{className:"size-3"}),"Invalid"]}),!S&&y.trim()!==""&&i.jsxs("span",{className:"flex items-center gap-1 text-success",children:[i.jsx(Ms,{className:"size-3"}),"Valid JSON"]})]})]})})}function qv(e,t="size-6"){const n={className:t};switch(e){case"image":return i.jsx(ns,{...n});case"video":return i.jsx(ay,{...n});case"audio":return i.jsx(Jx,{...n});case"document":return i.jsx(Sr,{...n});default:return i.jsx(Wx,{...n})}}function If(e){return e?e.startsWith("image/")?"image":e.startsWith("video/")?"video":e.startsWith("audio/")?"audio":e==="application/pdf"||e.includes("document")||e.includes("sheet")||e.includes("presentation")||e.startsWith("text/")?"document":"other":"other"}function Vv(e){if(e===0)return"0 B";const t=1024,n=["B","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(1))} ${n[r]}`}function HX(e){return e.startsWith("http://")||e.startsWith("https://")}function YX({field:e,value:t,onChange:n,error:r,disabled:o=!1,readOnly:l=!1,className:u="",id:d,placeholder:h="Select media..."}){const m=xn(),v=d||`field-${e.name}`,[g,y]=p.useState(!1),[w,S]=p.useState("browse"),[j,N]=p.useState(""),[C,_]=p.useState(""),[E,M]=p.useState(null),A=e.options?.allowedMimeTypes??[],R=typeof t=="string"&&HX(t),T=He(m.getMediaAsset,t&&!R?{id:t}:"skip"),O=He(m.listMediaAssets,g?{type:C||void 0,search:j||void 0,paginationOpts:{numItems:50,cursor:null}}:"skip"),D=p.useCallback(G=>{n(G),y(!1),M(null)},[n]),z=p.useCallback(()=>{n(null)},[n]),B=p.useCallback(G=>{S("browse")},[]),V=p.useCallback(()=>{y(!1),M(null)},[]),Y=O?.page?.filter(G=>A.length===0?!0:A.some(ae=>{if(ae.endsWith("/*")){const L=ae.slice(0,-1);return G.mimeType?.startsWith(L)}return G.mimeType===ae}));return i.jsxs(ar,{field:e,error:r,className:u,id:v,children:[i.jsx("div",{className:"flex flex-col gap-2",children:t&&R?i.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-yellow-500/50 bg-yellow-500/5 p-3",children:[i.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-md bg-muted",children:i.jsx("img",{src:t,alt:"Unlinked media",className:"size-full object-cover"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(Fo,{className:"size-3.5 shrink-0 text-yellow-500"}),i.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:"Unlinked media"})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"This image is stored as a URL, not a media library asset. Use the picker to relink it."})]}),!o&&!l&&i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.jsx(me,{variant:"ghost",size:"icon-sm",onClick:()=>y(!0),title:"Replace with media asset",children:i.jsx(fa,{className:"size-4"})}),i.jsx(me,{variant:"ghost",size:"icon-sm",onClick:z,title:"Remove media",children:i.jsx(At,{className:"size-4"})})]})]}):t&&T?(()=>{const G=If(T.mimeType);return i.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-card p-3",children:[i.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-md bg-muted",children:G==="image"&&T.url?i.jsx("img",{src:T.url,alt:T.title||T.name,className:"size-full object-cover"}):i.jsx("div",{className:"text-muted-foreground",children:qv(G)})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"truncate text-sm font-medium text-foreground",title:T.name,children:T.name}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[i.jsx("span",{className:"capitalize",children:G}),i.jsx("span",{children:"·"}),i.jsx("span",{children:Vv(T.size??0)})]})]}),!o&&!l&&i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.jsx(me,{variant:"ghost",size:"icon-sm",onClick:()=>y(!0),title:"Change media",children:i.jsx(fa,{className:"size-4"})}),i.jsx(me,{variant:"ghost",size:"icon-sm",onClick:z,title:"Remove media",children:i.jsx(At,{className:"size-4"})})]})]})})():i.jsxs("button",{type:"button",className:W("flex w-full flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed border-border bg-muted/30 p-6 text-center transition-colors","hover:border-primary/50 hover:bg-muted/50","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",o&&"cursor-not-allowed opacity-50"),onClick:()=>y(!0),disabled:o||l,children:[i.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:i.jsx(ns,{className:"size-5 text-muted-foreground"})}),i.jsx("span",{className:"text-sm font-medium text-foreground",children:h}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"Click to browse or upload media"})]})}),i.jsx(yl,{open:g,onOpenChange:V,children:i.jsxs(bl,{className:"max-w-3xl",children:[i.jsx(Cu,{children:i.jsx(wl,{children:E?i.jsxs("button",{type:"button",onClick:()=>M(null),className:"flex items-center gap-2 text-left",children:[i.jsx(rk,{className:"size-4"}),"Back to library"]}):"Select Media"})}),E?i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsx("div",{className:"flex items-center justify-center rounded-lg bg-muted/30 p-2",children:If(E.mimeType)==="image"&&E.url?i.jsx("img",{src:E.url,alt:E.title||E.name,className:"max-h-[60vh] rounded object-contain"}):i.jsxs("div",{className:"flex flex-col items-center gap-3 py-16 text-muted-foreground",children:[qv(If(E.mimeType),"size-12"),i.jsx("span",{className:"text-sm",children:E.name})]})}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"text-sm text-muted-foreground",children:[i.jsx("span",{className:"font-medium text-foreground",children:E.name}),i.jsx("span",{className:"mx-2",children:"·"}),i.jsx("span",{children:Vv(E.size??0)})]}),i.jsx(Je,{onClick:()=>D(E._id),children:"Select this file"})]})]}):i.jsxs(tM,{value:w,onValueChange:S,children:[i.jsxs(nM,{className:"w-full",children:[i.jsxs(Rh,{value:"browse",className:"flex-1 gap-2",children:[i.jsx(Zx,{className:"size-4"}),"Browse Library"]}),i.jsxs(Rh,{value:"upload",className:"flex-1 gap-2",children:[i.jsx(sy,{className:"size-4"}),"Upload New"]})]}),i.jsxs(qC,{value:"browse",className:"mt-4 flex flex-col gap-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(vm,{className:"flex-1",children:[i.jsx(kl,{align:"inline-start",children:i.jsx(_l,{children:i.jsx(Al,{})})}),i.jsx(xm,{type:"search",placeholder:"Search files...",value:j,onChange:G=>N(G.target.value)})]}),i.jsxs(ia,{value:C||"all",onValueChange:G=>_(G==="all"?"":G),children:[i.jsx(ca,{className:"w-[140px]",children:i.jsx(la,{placeholder:"All Types"})}),i.jsx(ua,{children:i.jsxs(yE,{children:[i.jsx(Xt,{value:"all",children:"All Types"}),i.jsx(Xt,{value:"image",children:"Images"}),i.jsx(Xt,{value:"video",children:"Videos"}),i.jsx(Xt,{value:"audio",children:"Audio"}),i.jsx(Xt,{value:"document",children:"Documents"}),i.jsx(Xt,{value:"other",children:"Other"})]})})]})]}),O===void 0?i.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[i.jsx("div",{className:"size-6 animate-spin rounded-full border-2 border-muted border-t-primary"}),i.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Loading media..."})]}):Y&&Y.length>0?i.jsx("div",{className:"grid max-h-[420px] grid-cols-3 gap-3 overflow-y-auto pr-1",children:Y.map(G=>{const ae=If(G.mimeType),L=t===G._id;return i.jsxs("div",{className:W("group relative rounded-lg border bg-card transition-all","hover:border-primary hover:shadow-sm",L&&"border-primary ring-2 ring-primary/20"),children:[i.jsx("button",{type:"button",className:"block w-full",onClick:()=>D(G._id),children:i.jsx("div",{className:"relative w-full overflow-hidden rounded-t-lg bg-muted",style:{paddingBottom:"100%"},children:ae==="image"&&G.url?i.jsx("img",{src:G.url,alt:G.title||G.name,className:"absolute inset-0 size-full object-cover"}):i.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground",children:qv(ae)})})}),ae==="image"&&G.url&&i.jsx("button",{type:"button",className:"absolute right-1.5 top-1.5 flex size-7 items-center justify-center rounded-md bg-black/60 text-white opacity-0 transition-opacity hover:bg-black/80 group-hover:opacity-100",onClick:$=>{$.stopPropagation(),M(G)},title:"Preview full size",children:i.jsx(lP,{className:"size-3.5"})}),L&&i.jsx("div",{className:"absolute left-1.5 top-1.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",children:i.jsx(Ms,{className:"size-3"})}),i.jsxs("div",{className:"p-2",children:[i.jsx("p",{className:"truncate text-xs font-medium",title:G.name,children:G.name}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:Vv(G.size??0)})]})]},G._id)})}):i.jsx(Bn,{icon:i.jsx(ns,{className:"size-6"}),title:"No media found",description:"Upload some media to get started",action:{label:"Upload Media",onClick:()=>S("upload")}})]}),i.jsx(qC,{value:"upload",className:"mt-4",children:i.jsx(kT,{generateUploadUrl:m.generateUploadUrl,createAsset:m.createMediaAsset,onUploadComplete:B,allowedMimeTypes:A,maxFileSize:e.options?.maxFileSize,maxConcurrentUploads:3})})]}),!E&&i.jsx(Nu,{children:i.jsx(me,{variant:"secondary",onClick:V,children:"Cancel"})})]})})]})}function iN(e){const t=["title","name","heading","label"];for(const n of t){const r=e.data?.[n];if(typeof r=="string"&&r.trim())return r}return e.slug||e._id}function WX({field:e,value:t,onChange:n,error:r,disabled:o=!1,readOnly:l=!1,className:u="",id:d,placeholder:h="Select content..."}){const m=xn(),v=d||`field-${e.name}`,[g,y]=p.useState(!1),[w,S]=p.useState(""),[j,N]=p.useState(""),C=e.options?.allowedContentTypes??[],_=e.options?.multiple??!1,E=p.useMemo(()=>t?Array.isArray(t)?t:[t]:[],[t]),M=He(m.listContentTypes,{isActive:!0,includeEntryCounts:!1}),A=p.useMemo(()=>M?.page?C.length===0?M.page:M.page.filter(L=>C.includes(L.name)||C.includes(L._id)):[],[M?.page,C]),R=He(m.getEntry,E.length===1?{id:E[0]}:"skip"),T=He(m.listEntries,E.length>1?{paginationOpts:{numItems:100,cursor:null}}:"skip"),O=p.useMemo(()=>!T?.page||E.length<=1?[]:T.page.filter(L=>E.includes(L._id)),[T?.page,E]),D=He(m.listEntries,g?{contentTypeName:j||void 0,search:w||void 0,paginationOpts:{numItems:50,cursor:null}}:"skip"),z=p.useMemo(()=>{if(!D?.page)return[];if(C.length===0)return D.page;const L=A.map($=>$.name);return D.page.filter($=>L.includes($.contentTypeName))},[D?.page,C,A]),B=p.useCallback(L=>{const $=M?.page?.find(U=>U.name===L);return $?.displayName||$?.name||"Unknown"},[M?.page]),V=p.useCallback(L=>{if(_)if(E.includes(L)){const $=E.filter(U=>U!==L);n($.length>0?$:null)}else n([...E,L]);else n(L),y(!1)},[_,E,n]),Y=p.useCallback(L=>{if(_){const $=E.filter(U=>U!==L);n($.length>0?$:null)}else n(null)},[_,E,n]),G=p.useCallback(()=>{n(null)},[n]),ae=(L,$=!0)=>i.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-card p-3",children:[i.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted",children:i.jsx(Sr,{className:"size-4 text-muted-foreground"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:iN(L)}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:B(L.contentTypeName)}),i.jsx(Vl,{status:L.status})]})]}),$&&!o&&!l&&i.jsx(me,{variant:"ghost",size:"icon-sm",onClick:U=>{U.stopPropagation(),Y(L._id)},title:"Remove reference",children:i.jsx(At,{className:"size-4"})})]},L._id);return i.jsxs(ar,{field:e,error:r,className:u,id:v,children:[i.jsx("div",{className:"flex flex-col gap-2",children:E.length>0?i.jsxs("div",{className:"flex flex-col gap-2",children:[E.length===1&&R&&ae(R),E.length>1&&O.length>0&&i.jsx("div",{className:"flex flex-col gap-2",children:O.map(L=>ae(L))}),!o&&!l&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(me,{variant:"outline",size:"sm",onClick:()=>y(!0),children:[i.jsx(Un,{className:"size-4"}),_?"Add more":"Change"]}),E.length>1&&i.jsx(me,{variant:"ghost",size:"sm",onClick:G,children:"Clear all"})]})]}):i.jsxs("button",{type:"button",className:W("flex w-full flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed border-border bg-muted/30 p-6 text-center transition-colors","hover:border-primary/50 hover:bg-muted/50","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",o&&"cursor-not-allowed opacity-50"),onClick:()=>y(!0),disabled:o||l,children:[i.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:i.jsx(pu,{className:"size-5 text-muted-foreground"})}),i.jsx("span",{className:"text-sm font-medium text-foreground",children:h}),i.jsxs("span",{className:"text-xs text-muted-foreground",children:["Click to select ",_?"content entries":"a content entry"]})]})}),i.jsx(yl,{open:g,onOpenChange:y,children:i.jsxs(bl,{className:"max-w-lg p-0",children:[i.jsx(Cu,{className:"px-4 pt-4",children:i.jsx(wl,{children:"Select Content"})}),i.jsxs(PT,{className:"border-none",children:[i.jsxs("div",{className:"flex items-center gap-2 border-b px-3 pb-2",children:[i.jsx(LT,{placeholder:"Search entries...",value:w,onValueChange:S,className:"border-none shadow-none focus:ring-0"}),A.length>1&&i.jsxs(ia,{value:j||"all",onValueChange:L=>N(L==="all"?"":L),children:[i.jsx(ca,{className:"h-8 w-[120px] shrink-0",children:i.jsx(la,{placeholder:"All Types"})}),i.jsxs(ua,{children:[i.jsx(Xt,{value:"all",children:"All Types"}),A.map(L=>i.jsx(Xt,{value:L._id,children:L.displayName||L.name},L._id))]})]})]}),i.jsx(IT,{className:"max-h-[300px]",children:D===void 0?i.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[i.jsx("div",{className:"size-5 animate-spin rounded-full border-2 border-muted border-t-primary"}),i.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Loading..."})]}):z.length>0?i.jsx(FT,{children:z.map(L=>{const $=E.includes(L._id);return i.jsxs(BT,{value:L._id,onSelect:()=>V(L._id),className:"cursor-pointer",children:[i.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded bg-muted",children:i.jsx(Sr,{className:"size-4 text-muted-foreground"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"truncate text-sm font-medium",children:iN(L)}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:B(L.contentTypeName)}),i.jsx(xt,{variant:"secondary",className:W("px-1.5 py-0 text-[10px]",L.status==="published"&&"status-published",L.status==="draft"&&"status-draft",L.status==="scheduled"&&"status-scheduled",L.status==="archived"&&"status-archived"),children:L.status})]})]}),$&&i.jsx(Ms,{className:"size-4 shrink-0 text-primary"})]},L._id)})}):i.jsx($T,{children:i.jsx(Bn,{icon:i.jsx(pu,{className:"size-6"}),title:"No content found",description:w?"Try adjusting your search":"Create some content entries first",className:"py-6"})})})]}),i.jsxs(Nu,{className:"border-t px-4 py-3",children:[_&&E.length>0&&i.jsxs("span",{className:"mr-auto text-sm text-muted-foreground",children:[E.length," selected"]}),i.jsx(me,{variant:"secondary",onClick:()=>y(!1),children:_?"Done":"Cancel"})]})]})})]})}function GX({field:e,value:t,onChange:n,error:r,disabled:o=!1,readOnly:l=!1,className:u="",id:d,placeholder:h="Add tags..."}){const m=xn(),v=p.useId(),g=d??`field-${e.name}-${v}`,y=_T(e.options),w=e.options?.allowCreate??!1,S=e.options?.maxTags,j=e.options?.minTags,[N,C]=p.useState(""),[_,E]=p.useState(!1),[M,A]=p.useState(0),[R,T]=p.useState(!1),O=p.useRef(null),D=p.useRef(null),z=p.useRef(null),V=He(m.suggestTerms,y?{taxonomyId:y,query:N,limit:10,excludeIds:t||[]}:"skip")??[],Y=He(m.listTerms,y&&t&&t.length>0?{taxonomyId:y,paginationOpts:{numItems:100,cursor:null}}:"skip"),G=new Map;if(Y?.page)for(const X of Y.page)t?.includes(X._id)&&G.set(X._id,X);const ae=et(m.createTerm);p.useEffect(()=>{function X(ue){z.current&&!z.current.contains(ue.target)&&E(!1)}return document.addEventListener("mousedown",X),()=>document.removeEventListener("mousedown",X)},[]);const L=p.useCallback(X=>{if(!t?.includes(X)){if(S&&(t?.length??0)>=S)return;n([...t||[],X])}C(""),E(!1),A(0),O.current?.focus()},[t,n,S]),$=p.useCallback(X=>{n((t||[]).filter(ue=>ue!==X))},[t,n]),U=p.useCallback(async()=>{if(!(!N.trim()||!y||!w)){T(!0);try{const X=await ae({taxonomyId:y,name:N.trim()});L(X)}catch(X){console.error("Failed to create tag:",X)}finally{T(!1)}}},[N,y,w,ae,L]),H=X=>{C(X.target.value),E(!0),A(0)},le=()=>{E(!0)},I=X=>{if(!(o||l))switch(X.key){case"ArrowDown":X.preventDefault(),A(ue=>ue<V.length-1?ue+1:ue);break;case"ArrowUp":X.preventDefault(),A(ue=>ue>0?ue-1:0);break;case"Enter":X.preventDefault(),V.length>0&&M<V.length?L(V[M]._id):N.trim()&&w&&U();break;case"Escape":E(!1),A(0);break;case"Backspace":N===""&&t&&t.length>0&&$(t[t.length-1]);break;case"Tab":_&&V.length>0&&(X.preventDefault(),L(V[M]._id));break}};p.useEffect(()=>{if(D.current&&_){const X=D.current.querySelector(`[data-index="${M}"]`);X&&X.scrollIntoView({block:"nearest"})}},[M,_]);const F=!S||(t?.length??0)<S,K=V.filter(X=>!t?.includes(X._id)),ne=w&&N.trim()&&!K.some(X=>X.name.toLowerCase()===N.trim().toLowerCase());return i.jsx(ar,{field:e,error:r,className:u,id:g,children:i.jsxs("div",{ref:z,className:W("relative rounded-md border border-input bg-background",r&&"border-destructive",o&&"opacity-50"),children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-2",children:[(t||[]).map(X=>{const ue=G.get(X),te=ue?.name??(Y?X:"Loading..."),ye=ue?.color;return i.jsxs(xt,{variant:"secondary",className:"gap-1 pr-1",style:ye?{backgroundColor:ye,color:"#fff"}:void 0,children:[te,!o&&!l&&i.jsx(Je,{type:"button",variant:"ghost",size:"icon",className:"size-4 hover:bg-transparent",onClick:()=>$(X),"aria-label":`Remove ${te}`,children:i.jsx(At,{className:"size-3"})})]},X)}),F&&!o&&!l&&i.jsx(mt,{ref:O,type:"text",id:g,className:"h-7 min-w-[120px] flex-1 border-0 bg-transparent px-1 shadow-none focus-visible:ring-0",value:N,onChange:H,onFocus:le,onKeyDown:I,placeholder:t?.length===0?h:"",disabled:o||R,"aria-autocomplete":"list","aria-controls":`${g}-suggestions`,"aria-expanded":_})]}),_&&(K.length>0||ne)&&i.jsxs("div",{ref:D,id:`${g}-suggestions`,className:"absolute left-0 right-0 top-full z-50 mt-1 max-h-60 overflow-auto rounded-md border bg-popover shadow-lg",role:"listbox",children:[K.map((X,ue)=>i.jsxs("div",{"data-index":ue,className:W("flex cursor-pointer items-center gap-2 px-3 py-2 text-sm",ue===M&&"bg-accent"),onClick:()=>L(X._id),role:"option","aria-selected":ue===M,children:[X.color&&i.jsx("span",{className:"size-2.5 rounded-full",style:{backgroundColor:X.color}}),i.jsx("span",{className:"flex-1",children:X.name}),i.jsxs("span",{className:"text-xs text-muted-foreground",children:[X.usageCount," uses"]})]},X._id)),ne&&i.jsxs("div",{"data-index":K.length,className:W("flex cursor-pointer items-center gap-2 px-3 py-2 text-sm",K.length===M&&"bg-accent"),onClick:U,role:"option","aria-selected":K.length===M,children:[R?i.jsx(vu,{className:"size-4 animate-spin"}):i.jsx(Un,{className:"size-4"}),i.jsxs("span",{children:['Create "',N.trim(),'"']})]})]}),i.jsxs("div",{className:"border-t px-3 py-1.5 text-xs text-muted-foreground",children:[t?.length??0," tag",(t?.length??0)!==1?"s":"",j&&(t?.length??0)<j&&i.jsxs("span",{className:"text-warning",children:[" (minimum ",j,")"]}),S&&i.jsxs("span",{children:[" / ",S," max"]})]})]})})}function ZX({field:e,value:t,onChange:n,error:r,disabled:o=!1,readOnly:l=!1,className:u="",id:d,placeholder:h="Select category..."}){const m=xn(),v=d||`field-${e.name}`,g=_T(e.options),y=e.options?.allowMultiple??!1,[w,S]=p.useState(!1),[j,N]=p.useState(new Set),[C,_]=p.useState(null),E=p.useRef(null),A=He(m.getTermsHierarchy,g?{taxonomyId:g}:"skip")??[],R=p.useCallback(($,U=[])=>{for(const H of $)U.push(H),j.has(H._id)&&H.children.length>0&&R(H.children,U);return U},[j]),T=R(A),O=p.useCallback(()=>{if(!t)return null;const $=Array.isArray(t)?t:[t];if($.length===0)return null;const U=[];for(const H of $){const le=T.find(I=>I._id===H);le&&U.push(le.name)}return U.length===0?"Loading...":U.length===1?U[0]:`${U.length} categories selected`},[t,T]),D=p.useCallback($=>{if(!(o||l))if(y){const U=Array.isArray(t)?t:t?[t]:[];U.includes($)?n(U.filter(H=>H!==$)):n([...U,$])}else n($),S(!1)},[o,l,y,t,n]),z=p.useCallback(($,U)=>{U.stopPropagation(),N(H=>{const le=new Set(H);return le.has($)?le.delete($):le.add($),le})},[]),B=p.useCallback($=>t?(Array.isArray(t)?t:[t]).includes($):!1,[t]),V=$=>{if(!(o||l))switch($.key){case"Enter":case" ":{$.preventDefault(),w?C&&D(C):(S(!0),T.length>0&&_(T[0]._id));break}case"Escape":{S(!1),_(null);break}case"ArrowDown":{if($.preventDefault(),!w)S(!0),T.length>0&&_(T[0]._id);else{const U=T.findIndex(H=>H._id===C);U<T.length-1&&_(T[U+1]._id)}break}case"ArrowUp":{if($.preventDefault(),w){const U=T.findIndex(H=>H._id===C);U>0&&_(T[U-1]._id)}break}case"ArrowRight":{if($.preventDefault(),C){const U=T.find(H=>H._id===C);U&&U.children.length>0&&!j.has(C)&&N(H=>new Set([...H,C]))}break}case"ArrowLeft":{if($.preventDefault(),C){const U=T.find(H=>H._id===C);U&&(j.has(C)?N(H=>{const le=new Set(H);return le.delete(C),le}):U.parentId&&_(U.parentId))}break}}};p.useEffect(()=>{if(E.current&&C){const $=E.current.querySelector(`[data-category-id="${C}"]`);$&&$.scrollIntoView({block:"nearest"})}},[C]);const Y=($,U=0)=>{const H=$.children&&$.children.length>0,le=j.has($._id),I=C===$._id,F=B($._id);return i.jsxs("div",{children:[i.jsxs("div",{"data-category-id":$._id,className:W("flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors","hover:bg-accent",I&&"bg-accent",F&&"font-medium"),style:{paddingLeft:`${U*16+8}px`},onClick:()=>D($._id),onMouseEnter:()=>_($._id),role:"option","aria-selected":F,children:[H?i.jsx("button",{type:"button",className:"flex size-4 items-center justify-center rounded hover:bg-muted",onClick:K=>z($._id,K),"aria-label":le?"Collapse":"Expand",children:le?i.jsx(vn,{className:"size-3"}):i.jsx(Rl,{className:"size-3"})}):i.jsx("span",{className:"size-4"}),y&&i.jsx(wr,{checked:F,className:"pointer-events-none size-4"}),$.color&&i.jsx("span",{className:"size-2.5 shrink-0 rounded-full",style:{backgroundColor:$.color}}),i.jsx("span",{className:"flex-1 truncate",children:$.name}),!y&&F&&i.jsx(Ms,{className:"size-4 text-primary"})]}),H&&le&&i.jsx("div",{children:$.children.map(K=>Y(K,U+1))})]},$._id)},G=$=>{$.stopPropagation(),n(y?[]:null)},ae=O(),L=ae!==null;return i.jsx(ar,{field:e,error:r,className:u,id:v,children:i.jsxs("div",{ref:E,children:[i.jsxs(Tu,{open:w,onOpenChange:S,children:[i.jsx(Mu,{asChild:!0,children:i.jsxs("button",{type:"button",id:v,className:W("flex w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",r&&"border-destructive",!L&&"text-muted-foreground"),onKeyDown:V,disabled:o,"aria-haspopup":"listbox","aria-expanded":w,"data-testid":"category-trigger",children:[i.jsx("span",{className:"truncate",children:ae||h}),i.jsxs("div",{className:"flex items-center gap-1",children:[L&&!o&&!l&&i.jsx("button",{type:"button",className:"rounded p-0.5 hover:bg-muted",onClick:G,"aria-label":"Clear selection",children:i.jsx(At,{className:"size-3"})}),i.jsx(vn,{className:W("size-4 text-muted-foreground transition-transform",w&&"rotate-180")})]})]})}),i.jsx(Ru,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:i.jsx(ed,{className:"max-h-[280px]",children:A.length===0?i.jsxs("div",{className:"flex flex-col items-center justify-center py-6 text-center",children:[i.jsx(Po,{className:"mb-2 size-6 text-muted-foreground"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"No categories available"})]}):i.jsx("div",{className:"p-1",role:"listbox","aria-multiselectable":y,children:A.map($=>Y($))})})})]}),y&&Array.isArray(t)&&t.length>0&&i.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:t.map($=>{const U=T.find(H=>H._id===$);return i.jsxs(xt,{variant:"secondary",className:"gap-1 pr-1",children:[U?.color&&i.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:U.color}}),U?.name??"Loading...",!o&&!l&&i.jsx("button",{type:"button",className:"ml-0.5 rounded-full p-0.5 hover:bg-muted",onClick:()=>D($),"aria-label":`Remove ${U?.name}`,children:i.jsx(At,{className:"size-3"})})]},$)})})]})})}const QX={CAD:"$",USD:"$",EUR:"€",GBP:"£",JPY:"¥",NGN:"₦",AUD:"A$",NZD:"NZ$"},yR=new Set(["JPY","KRW","VND"]);function KX(e){return yR.has(e)?1:100}function XX(e){return QX[e]??e}function JX({field:e,value:t,onChange:n,error:r,disabled:o=!1,readOnly:l=!1,className:u="",id:d,placeholder:h}){const m=p.useId(),v=d??`field-${e.name}-${m}`,g=e.options?.defaultCurrency??"CAD",y=t?.currency??g,w=KX(y),S=XX(y),j=yR.has(y),[N,C]=p.useState(()=>t?.amount==null?"":String(j?t.amount:t.amount/w));p.useEffect(()=>{const R=t?.amount==null?"":String(j?t.amount:t.amount/w),T=parseFloat(N),O=parseFloat(R);N===""&&R===""||!isNaN(T)&&!isNaN(O)&&T===O||(N===""&&R!==""&&C(R),N!==""&&R===""&&C(""))},[t?.amount,y,w,j]);const _=R=>{const T=R.target.value;if(C(T),T===""){n(null);return}const O=parseFloat(T);if(!isNaN(O)){const D=j?O:Math.round(O*w);n({amount:D,currency:y})}},E=R=>{["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(R.key)||(R.ctrlKey||R.metaKey)&&["a","c","v","x","z"].includes(R.key)||R.key>="0"&&R.key<="9"||R.key==="."&&!j&&!N.includes(".")||R.preventDefault()},M=R=>{R.preventDefault();const O=R.clipboardData.getData("text").replace(j?/[^\d]/g:/[^\d.]/g,""),D=O.split("."),z=D.length>1?D[0]+"."+D.slice(1).join(""):O;if(z==="")return;const B=R.currentTarget,V=B.selectionStart??0,Y=B.selectionEnd??0,G=N.slice(0,V)+z+N.slice(Y);C(G);const ae=parseFloat(G);if(!isNaN(ae)){const L=j?ae:Math.round(ae*w);n({amount:L,currency:y})}},A=()=>{if(N==="")return;const R=parseFloat(N);isNaN(R)||C(j?String(Math.round(R)):R.toFixed(2))};return i.jsx(ar,{field:e,error:r,className:u,id:v,children:i.jsxs(vm,{"data-disabled":o||void 0,children:[i.jsx(kl,{align:"inline-start",children:i.jsx(_l,{children:S})}),i.jsx(xm,{type:"text",inputMode:j?"numeric":"decimal",id:v,name:e.name,value:N,onChange:_,onKeyDown:E,onBlur:A,onPaste:M,disabled:o,readOnly:l,required:e.required,placeholder:h??(j?"0":"0.00"),"aria-invalid":!!r,"aria-describedby":r?`${v}-error`:e.description?`${v}-description`:void 0}),i.jsx(kl,{align:"inline-end",children:i.jsx(_l,{className:"text-xs font-medium",children:y})})]})})}function eJ(e,t){return e?e.replace(/\{(\w+)\}/g,(n,r)=>{const o=t[r];return o==null?"":typeof o=="object"?JSON.stringify(o):String(o)}):""}function tJ(e){const t={};for(const n of e)switch(n.type){case"text":case"richText":case"select":t[n.name]="";break;case"number":t[n.name]=0;break;case"boolean":t[n.name]=!1;break;case"money":t[n.name]={amount:0,currency:"CAD"};break;case"arrayObject":t[n.name]=[];break;default:t[n.name]=null;break}return t}function nJ({field:e,value:t,onChange:n,error:r,disabled:o=!1,readOnly:l=!1,className:u="",id:d}){const h=p.useId(),m=d??`field-${e.name}-${h}`,v=e.options?.subFields??[],g=e.options?.itemLabel,y=e.options?.maxItems,w=p.useRef(0),[S,j]=p.useState(()=>(t??[]).map(B=>({key:w.current++,data:B}))),[N,C]=p.useState(()=>{const z=new Set;return(t??[]).length<=3?S.forEach(V=>z.add(V.key)):S.length>0&&z.add(S[0].key),z}),_=p.useCallback(z=>{j(z),n(z.map(B=>B.data))},[n]),E=p.useCallback((z,B,V)=>{j(Y=>{const G=Y.map(ae=>ae.key===z?{...ae,data:{...ae.data,[B]:V}}:ae);return Promise.resolve().then(()=>n(G.map(ae=>ae.data))),G})},[n]),M=p.useCallback(()=>{const z=w.current++,B={key:z,data:tJ(v)},V=[...S,B];C(Y=>new Set([...Y,z])),_(V)},[S,v,_]),A=p.useCallback(z=>{_(S.filter(B=>B.key!==z)),C(B=>{const V=new Set(B);return V.delete(z),V})},[S,_]),R=p.useCallback((z,B)=>{const V=S.findIndex(ae=>ae.key===z);if(V<0)return;const Y=V+B;if(Y<0||Y>=S.length)return;const G=[...S];[G[V],G[Y]]=[G[Y],G[V]],_(G)},[S,_]),T=p.useCallback(z=>{C(B=>{const V=new Set(B);return V.has(z)?V.delete(z):V.add(z),V})},[]),O=y===void 0||S.length<y,D=v.some(z=>z.type==="arrayObject");return i.jsx(ar,{field:e,error:r,className:u,id:m,children:i.jsxs("div",{className:"flex flex-col gap-2",children:[S.length===0&&i.jsx("p",{className:"py-4 text-center text-sm text-muted-foreground",children:"No items yet"}),S.map((z,B)=>{const V=N.has(z.key),Y=eJ(g,z.data)||`Item ${B+1}`;return i.jsx("div",{className:W("rounded-lg border border-border bg-card",D?"border-dashed":""),children:i.jsxs(Ay,{open:V,onOpenChange:()=>T(z.key),children:[i.jsxs("div",{className:"flex items-center gap-1 px-3 py-2",children:[i.jsx(Oy,{asChild:!0,children:i.jsxs("button",{type:"button",className:"flex flex-1 items-center gap-2 text-left text-sm font-medium text-foreground hover:text-foreground/80",disabled:o,children:[V?i.jsx(vn,{className:"size-4 shrink-0 text-muted-foreground"}):i.jsx(Iu,{className:"size-4 shrink-0 text-muted-foreground"}),i.jsx("span",{className:"truncate",children:Y})]})}),!l&&!o&&i.jsxs("div",{className:"flex items-center gap-0.5",children:[i.jsx(Je,{type:"button",variant:"ghost",size:"icon",className:"size-7",onClick:()=>R(z.key,-1),disabled:B===0,"aria-label":"Move up",children:i.jsx(M3,{className:"size-3.5"})}),i.jsx(Je,{type:"button",variant:"ghost",size:"icon",className:"size-7",onClick:()=>R(z.key,1),disabled:B===S.length-1,"aria-label":"Move down",children:i.jsx(j3,{className:"size-3.5"})}),i.jsx(Je,{type:"button",variant:"ghost",size:"icon",className:"size-7 text-destructive hover:text-destructive",onClick:()=>A(z.key),"aria-label":"Remove item",children:i.jsx(Fn,{className:"size-3.5"})})]})]}),i.jsx(Dy,{children:i.jsx("div",{className:"flex flex-col gap-4 border-t border-border px-3 py-3",children:v.map(G=>i.jsx(zh,{field:G,value:z.data[G.name],onChange:ae=>E(z.key,G.name,ae),disabled:o,readOnly:l},G.name))})})]})},z.key)}),!l&&!o&&O&&i.jsxs(Je,{type:"button",variant:"outline",size:"sm",className:"w-full",onClick:M,children:[i.jsx(Un,{className:"mr-1.5 size-3.5"}),"Add ",e.label?e.label.replace(/s$/,""):"Item"]}),y!==void 0&&i.jsxs("p",{className:"text-xs text-muted-foreground",children:[S.length,"/",y," items"]})]})})}function rJ({field:e,value:t,onChange:n,error:r,disabled:o,readOnly:l,className:u}){const h=`field-${p.useId()}`,m=t==null?"":JSON.stringify(t,null,2),v=g=>{if(!l){if(g.trim()===""){n(null);return}try{const y=JSON.parse(g);n(y)}catch{n(g)}}};return i.jsx(ar,{field:e,error:r,id:h,className:u,customLabel:i.jsxs("span",{children:[e.label,i.jsx("span",{className:"ml-2 rounded bg-muted px-1.5 py-0.5 text-xs font-normal text-muted-foreground",children:e.type})]}),children:i.jsx(no,{id:h,value:m,onChange:g=>v(g.target.value),disabled:o,readOnly:l,className:"font-mono text-sm",rows:6,placeholder:`Enter ${e.type} value as JSON...`,"aria-invalid":!!r,"aria-describedby":r?`${h}-error`:e.description?`${h}-desc`:void 0})})}const sJ=new Map;function aJ(e){return sJ.get(e)}function zh({field:e,value:t,onChange:n,error:r,disabled:o=!1,readOnly:l=!1,className:u=""}){const d={field:e,error:r,disabled:o,readOnly:l,className:u};switch(e.type){case"text":return i.jsx(FZ,{...d,value:t??"",onChange:n});case"richText":return i.jsx(BX,{...d,value:t??"",onChange:n});case"number":return i.jsx(BZ,{...d,value:t??null,onChange:n});case"boolean":return i.jsx(UZ,{...d,value:t??!1,onChange:n});case"date":return i.jsx(oN,{...d,value:t??null,onChange:n,includeTime:!1});case"datetime":return i.jsx(oN,{...d,value:t??null,onChange:n,includeTime:!0});case"select":return i.jsx(UX,{...d,value:t??"",onChange:n});case"multiSelect":return i.jsx(qX,{...d,value:t??[],onChange:n});case"json":return i.jsx(VX,{...d,value:t??null,onChange:n});case"media":return i.jsx(YX,{...d,value:t??null,onChange:n});case"reference":return i.jsx(WX,{...d,value:t??null,onChange:n});case"tags":return i.jsx(GX,{...d,value:t??[],onChange:n});case"category":return i.jsx(ZX,{...d,value:t??null,onChange:n});case"money":return i.jsx(JX,{...d,value:t??null,onChange:n});case"arrayObject":return i.jsx(nJ,{...d,value:t??null,onChange:n});default:{const h=aJ(e.type);return h?i.jsx(h,{...d,value:t,onChange:n}):i.jsx(rJ,{...d,value:t,onChange:n})}}}function oJ(e){return e.type==="boolean"||e.type==="number"&&!e.description}function iJ(e){const t=[];let n=[];function r(){n.length>0&&(t.push({type:"grid",fields:n}),n=[])}for(const o of e)oJ(o)?n.push(o):(r(),t.push({type:"full",field:o}));return r(),t}function lJ({group:e,formData:t,fieldErrors:n,isSubmitting:r,onFieldChange:o,initialOpen:l=!1}){const[u,d]=p.useState(l),h=e.fields.filter(v=>n[v.name]).length,m=iJ(e.fields);return i.jsxs(Ay,{open:u,onOpenChange:d,children:[i.jsx(Oy,{asChild:!0,children:i.jsxs("button",{type:"button",className:W("flex w-full items-center justify-between rounded-lg px-4 py-2.5 text-left transition-colors","bg-muted/40 hover:bg-muted/60",h>0&&"ring-1 ring-destructive/20"),children:[i.jsx("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:e.label}),i.jsxs("div",{className:"flex items-center gap-2",children:[h>0&&i.jsx("span",{className:"rounded-full bg-destructive/10 px-2 py-0.5 text-xs font-medium text-destructive",children:h}),i.jsx(vn,{className:W("size-4 text-muted-foreground transition-transform duration-200",u&&"rotate-180")})]})]})}),i.jsx(Dy,{children:i.jsx("div",{className:"flex flex-col gap-4 px-1 pt-4",children:m.map((v,g)=>v.type==="grid"?i.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:v.fields.map(y=>i.jsx(zh,{field:y,value:t[y.name],onChange:w=>o(y.name,w),error:n[y.name],disabled:r},y.name))},`grid-${g}`):i.jsx(zh,{field:v.field,value:t[v.field.name],onChange:y=>o(v.field.name,y),error:n[v.field.name],disabled:r},v.field.name))})})]})}function cJ(e){const t=[],n=new Map;for(const r of e){const o=r.group??"__default__";if(!n.has(o)){const l={name:o,label:o==="__default__"?"General":o.replace(/[_-]/g," ").replace(/\b\w/g,u=>u.toUpperCase()),fields:[]};n.set(o,l),t.push(l)}n.get(o).fields.push(r)}return t}function uJ({fields:e,formData:t,fieldErrors:n,isSubmitting:r,onFieldChange:o}){const l=cJ(e);return l.length===1&&l[0].name==="__default__"?i.jsx("div",{className:"mx-auto w-full max-w-3xl",children:i.jsx("div",{className:"flex flex-col gap-4",children:e.map(d=>i.jsx(zh,{field:d,value:t[d.name],onChange:h=>o(d.name,h),error:n[d.name],disabled:r},d.name))})}):i.jsx("div",{className:"mx-auto w-full max-w-3xl",children:i.jsx("div",{className:"flex flex-col gap-6",children:l.map((d,h)=>i.jsx(lJ,{group:d,formData:t,fieldErrors:n,isSubmitting:r,onFieldChange:o,initialOpen:h===0},d.name))})})}function lN({entry:e,hasScheduling:t,hasVersioning:n,canDelete:r,isSubmitting:o,isPublishing:l,isDuplicating:u,isArchiving:d,isDeleting:h,onPublishClick:m,onUnpublishClick:v,onScheduleClick:g,onCancelSchedule:y,onPublishNow:w,onDuplicate:S,onArchive:j,onDelete:N,onViewHistory:C}){if(!e)return null;const _=o||l||u||d||h;return i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs(Jc,{children:[i.jsx(Zf,{className:"pb-3",children:i.jsx(Qf,{className:"text-sm font-medium",children:"Status"})}),i.jsxs(eu,{className:"flex flex-col gap-3 text-sm",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Status"}),i.jsx(Vl,{status:e.status})]}),e.version>0&&i.jsxs(i.Fragment,{children:[i.jsx(wh,{}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Version"}),i.jsx("span",{className:"font-medium",children:e.version})]})]}),e.lastPublishedAt&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Published"}),i.jsx("span",{className:"text-xs",children:new Date(e.lastPublishedAt).toLocaleDateString()})]}),e.status==="scheduled"&&e.scheduledPublishAt&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Scheduled"}),i.jsxs("span",{className:"flex items-center gap-1 text-xs",children:[i.jsx(ih,{className:"size-3"}),new Date(e.scheduledPublishAt).toLocaleString()]})]})]})]}),i.jsxs(Jc,{children:[i.jsx(Zf,{className:"pb-3",children:i.jsx(Qf,{className:"text-sm font-medium",children:"Publishing"})}),i.jsxs(eu,{className:"flex flex-col gap-2",children:[e.status==="draft"&&i.jsxs(i.Fragment,{children:[i.jsxs(Je,{className:"w-full",onClick:m,disabled:_,children:[l&&i.jsx(es,{"data-icon":"inline-start"}),"Publish Now"]}),t&&i.jsxs(Je,{variant:"outline",className:"w-full",onClick:g,disabled:_,children:[i.jsx(ih,{"data-icon":"inline-start"}),"Schedule"]})]}),e.status==="scheduled"&&i.jsxs(i.Fragment,{children:[i.jsxs(Je,{className:"w-full",onClick:w,disabled:_,children:[l&&i.jsx(es,{"data-icon":"inline-start"}),"Publish Now"]}),t&&i.jsx(Je,{variant:"outline",className:"w-full",onClick:y,disabled:_,children:"Cancel Schedule"})]}),e.status==="published"&&i.jsxs(Je,{variant:"outline",className:"w-full",onClick:v,disabled:_,children:[l&&i.jsx(es,{"data-icon":"inline-start"}),"Unpublish"]})]})]}),n&&i.jsxs(Jc,{children:[i.jsx(Zf,{className:"pb-3",children:i.jsx(Qf,{className:"text-sm font-medium",children:"History"})}),i.jsx(eu,{children:i.jsxs(Je,{variant:"outline",className:"w-full",onClick:C,children:[i.jsx(ck,{"data-icon":"inline-start"}),"Version ",e.version," — View history"]})})]}),i.jsx(Jc,{children:i.jsxs(eu,{className:"flex flex-col gap-2 pt-6",children:[i.jsxs(Je,{variant:"outline",className:"w-full",onClick:S,disabled:_,children:[u&&i.jsx(es,{"data-icon":"inline-start"}),!u&&i.jsx(ok,{"data-icon":"inline-start"}),"Duplicate"]}),(e.status==="draft"||e.status==="scheduled")&&i.jsxs(Je,{variant:"outline",className:"w-full",onClick:j,disabled:_,children:[d&&i.jsx(es,{"data-icon":"inline-start"}),!d&&i.jsx(nk,{"data-icon":"inline-start"}),"Archive"]}),r&&i.jsxs(i.Fragment,{children:[i.jsx(wh,{}),i.jsxs(Je,{variant:"destructive",className:"w-full",onClick:N,disabled:_,children:[h&&i.jsx(es,{"data-icon":"inline-start"}),!h&&i.jsx(Fn,{"data-icon":"inline-start"}),"Delete"]})]})]})})]})}function dJ({open:e,onOpenChange:t,scheduleDateTime:n,onScheduleDateTimeChange:r,onSchedule:o,isPublishing:l,publishError:u,minDateTime:d}){return i.jsx(ls,{open:e,onOpenChange:t,title:"Schedule Publication",size:"sm",footer:i.jsxs(i.Fragment,{children:[i.jsx(me,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),i.jsx(me,{variant:"primary",onClick:o,loading:l,children:"Schedule"})]}),children:i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose when this content should be automatically published:"}),i.jsx(mt,{type:"datetime-local",value:n,onChange:h=>r(h.target.value),min:d}),u&&i.jsx("p",{className:"text-sm text-destructive",children:u})]})})}function fJ({open:e,onOpenChange:t,action:n,onConfirm:r,isPublishing:o}){return i.jsx(oa,{open:e&&n!==null,onOpenChange:t,title:n==="publish"?"Confirm Publish":"Confirm Unpublish",description:n==="publish"?"Are you sure you want to publish this entry? It will become publicly visible.":"Are you sure you want to unpublish this entry? It will no longer be publicly visible.",confirmLabel:n==="publish"?"Publish":"Unpublish",variant:n==="publish"?"primary":"warning",onConfirm:r,isLoading:o})}function hJ({open:e,onOpenChange:t,onConfirm:n,isDeleting:r,error:o}){return i.jsx(oa,{open:e,onOpenChange:t,title:"Delete Entry",description:"Are you sure you want to delete this entry? It will be moved to the trash and can be restored within the retention period.",confirmLabel:"Delete",variant:"danger",onConfirm:n,isLoading:r,error:o})}function mJ(e){if(typeof document>"u")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))}const bR=ee.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),sd=()=>{const e=ee.useContext(bR);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};mJ(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
103
- [data-state=closed]
104
- ){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function pJ(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function gJ(){return Eb(/^Mac/)}function vJ(){return Eb(/^iPhone/)}function cN(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function xJ(){return Eb(/^iPad/)||gJ()&&navigator.maxTouchPoints>1}function wR(){return vJ()||xJ()}function Eb(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const yJ=24,bJ=typeof window<"u"?p.useLayoutEffect:p.useEffect;function uN(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const Hv=typeof document<"u"&&window.visualViewport;function dN(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function SR(e){for(dN(e)&&(e=e.parentElement);e&&!dN(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const wJ=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let $f=0,Yv;function SJ(e={}){let{isDisabled:t}=e;bJ(()=>{if(!t)return $f++,$f===1&&wR()&&(Yv=jJ()),()=>{$f--,$f===0&&Yv?.()}},[t])}function jJ(){let e,t=0,n=g=>{e=SR(g.target),!(e===document.documentElement&&e===document.body)&&(t=g.changedTouches[0].pageY)},r=g=>{if(!e||e===document.documentElement||e===document.body){g.preventDefault();return}let y=g.changedTouches[0].pageY,w=e.scrollTop,S=e.scrollHeight-e.clientHeight;S!==0&&((w<=0&&y>t||w>=S&&y<t)&&g.preventDefault(),t=y)},o=g=>{let y=g.target;Tx(y)&&y!==document.activeElement&&(g.preventDefault(),y.style.transform="translateY(-2000px)",y.focus(),requestAnimationFrame(()=>{y.style.transform=""}))},l=g=>{let y=g.target;Tx(y)&&(y.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{y.style.transform="",Hv&&(Hv.height<window.innerHeight?requestAnimationFrame(()=>{fN(y)}):Hv.addEventListener("resize",()=>fN(y),{once:!0}))}))},u=()=>{window.scrollTo(0,0)},d=window.pageXOffset,h=window.pageYOffset,m=uN(CJ(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let v=uN(Yc(document,"touchstart",n,{passive:!1,capture:!0}),Yc(document,"touchmove",r,{passive:!1,capture:!0}),Yc(document,"touchend",o,{passive:!1,capture:!0}),Yc(document,"focus",l,!0),Yc(window,"scroll",u));return()=>{m(),v(),window.scrollTo(d,h)}}function CJ(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Yc(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function fN(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=SR(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,o=e.getBoundingClientRect().top,l=e.getBoundingClientRect().bottom;const u=n.getBoundingClientRect().bottom+yJ;l>u&&(n.scrollTop+=o-r)}e=n.parentElement}}function Tx(e){return e instanceof HTMLInputElement&&!wJ.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function NJ(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function kJ(...e){return t=>e.forEach(n=>NJ(n,t))}function jR(...e){return p.useCallback(kJ(...e),e)}const CR=new WeakMap;function mn(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([o,l])=>{if(o.startsWith("--")){e.style.setProperty(o,l);return}r[o]=e.style[o],e.style[o]=l}),!n&&CR.set(e,r)}function _J(e,t){if(!e||!(e instanceof HTMLElement))return;let n=CR.get(e);n&&(e.style[t]=n[t])}const cn=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function Ff(e,t){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let o=r.match(/^matrix3d\((.+)\)$/);return o?parseFloat(o[1].split(", ")[cn(t)?13:12]):(o=r.match(/^matrix\((.+)\)$/),o?parseFloat(o[1].split(", ")[cn(t)?5:4]):null)}function EJ(e){return 8*(Math.log(e+1)-2)}function Wv(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function TJ(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const Ft={DURATION:.5,EASE:[.32,.72,0,1]},NR=.4,MJ=.25,RJ=100,kR=8,ko=16,Mx=26,Gv="vaul-dragging";function _R(e){const t=ee.useRef(e);return ee.useEffect(()=>{t.current=e}),ee.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function AJ({defaultProp:e,onChange:t}){const n=ee.useState(e),[r]=n,o=ee.useRef(r),l=_R(t);return ee.useEffect(()=>{o.current!==r&&(l(r),o.current=r)},[r,o,l]),n}function ER({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=AJ({defaultProp:t,onChange:n}),l=e!==void 0,u=l?e:r,d=_R(n),h=ee.useCallback(m=>{if(l){const g=typeof m=="function"?m(e):m;g!==e&&d(g)}else o(m)},[l,e,o,d]);return[u,h]}function OJ({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:o,fadeFromIndex:l,onSnapPointChange:u,direction:d="bottom",container:h,snapToSequentialPoint:m}){const[v,g]=ER({prop:e,defaultProp:n?.[0],onChange:t}),[y,w]=ee.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);ee.useEffect(()=>{function T(){w({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)},[]);const S=ee.useMemo(()=>v===n?.[n.length-1]||null,[n,v]),j=ee.useMemo(()=>{var T;return(T=n?.findIndex(O=>O===v))!=null?T:null},[n,v]),N=n&&n.length>0&&(l||l===0)&&!Number.isNaN(l)&&n[l]===v||!n,C=ee.useMemo(()=>{const T=h?{width:h.getBoundingClientRect().width,height:h.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var O;return(O=n?.map(D=>{const z=typeof D=="string";let B=0;if(z&&(B=parseInt(D,10)),cn(d)){const Y=z?B:y?D*T.height:0;return y?d==="bottom"?T.height-Y:-T.height+Y:Y}const V=z?B:y?D*T.width:0;return y?d==="right"?T.width-V:-T.width+V:V}))!=null?O:[]},[n,y,h]),_=ee.useMemo(()=>j!==null?C?.[j]:null,[C,j]),E=ee.useCallback(T=>{var O;const D=(O=C?.findIndex(z=>z===T))!=null?O:null;u(D),mn(r.current,{transition:`transform ${Ft.DURATION}s cubic-bezier(${Ft.EASE.join(",")})`,transform:cn(d)?`translate3d(0, ${T}px, 0)`:`translate3d(${T}px, 0, 0)`}),C&&D!==C.length-1&&l!==void 0&&D!==l&&D<l?mn(o.current,{transition:`opacity ${Ft.DURATION}s cubic-bezier(${Ft.EASE.join(",")})`,opacity:"0"}):mn(o.current,{transition:`opacity ${Ft.DURATION}s cubic-bezier(${Ft.EASE.join(",")})`,opacity:"1"}),g(n?.[Math.max(D,0)])},[r.current,n,C,l,o,g]);ee.useEffect(()=>{if(v||e){var T;const O=(T=n?.findIndex(D=>D===e||D===v))!=null?T:-1;C&&O!==-1&&typeof C[O]=="number"&&E(C[O])}},[v,e,n,C,E]);function M({draggedDistance:T,closeDrawer:O,velocity:D,dismissible:z}){if(l===void 0)return;const B=d==="bottom"||d==="right"?(_??0)-T:(_??0)+T,V=j===l-1,Y=j===0,G=T>0;if(V&&mn(o.current,{transition:`opacity ${Ft.DURATION}s cubic-bezier(${Ft.EASE.join(",")})`}),!m&&D>2&&!G){z?O():E(C[0]);return}if(!m&&D>2&&G&&C&&n){E(C[n.length-1]);return}const ae=C?.reduce(($,U)=>typeof $!="number"||typeof U!="number"?$:Math.abs(U-B)<Math.abs($-B)?U:$),L=cn(d)?window.innerHeight:window.innerWidth;if(D>NR&&Math.abs(T)<L*.4){const $=G?1:-1;if($>0&&S&&n){E(C[n.length-1]);return}if(Y&&$<0&&z&&O(),j===null)return;E(C[j+$]);return}E(ae)}function A({draggedDistance:T}){if(_===null)return;const O=d==="bottom"||d==="right"?_-T:_+T;(d==="bottom"||d==="right")&&O<C[C.length-1]||(d==="top"||d==="left")&&O>C[C.length-1]||mn(r.current,{transform:cn(d)?`translate3d(0, ${O}px, 0)`:`translate3d(${O}px, 0, 0)`})}function R(T,O){if(!n||typeof j!="number"||!C||l===void 0)return null;const D=j===l-1;if(j>=l&&O)return 0;if(D&&!O)return 1;if(!N&&!D)return null;const B=D?j+1:j-1,V=D?C[B]-C[B-1]:C[B+1]-C[B],Y=T/Math.abs(V);return D?1-Y:Y}return{isLastSnapPoint:S,activeSnapPoint:v,shouldFade:N,getPercentageDragged:R,setActiveSnapPoint:g,activeSnapPointIndex:j,onRelease:M,onDrag:A,snapPointsOffset:C}}const DJ=()=>()=>{};function zJ(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:o}=sd(),l=ee.useRef(null),u=p.useMemo(()=>document.body.style.backgroundColor,[]);function d(){return(window.innerWidth-Mx)/window.innerWidth}ee.useEffect(()=>{if(t&&n){l.current&&clearTimeout(l.current);const h=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!h)return;TJ(r&&!o?Wv(document.body,{background:"black"}):DJ,Wv(h,{transformOrigin:cn(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${Ft.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ft.EASE.join(",")})`}));const m=Wv(h,{borderRadius:`${kR}px`,overflow:"hidden",...cn(e)?{transform:`scale(${d()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${d()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{m(),l.current=window.setTimeout(()=>{u?document.body.style.background=u:document.body.style.removeProperty("background")},Ft.DURATION*1e3)}}},[t,n,u])}let Wc=null;function PJ({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:o,noBodyStyles:l}){const[u,d]=ee.useState(()=>typeof window<"u"?window.location.href:""),h=ee.useRef(0),m=ee.useCallback(()=>{if(cN()&&Wc===null&&e&&!l){Wc={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:g,innerHeight:y}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-h.current}px`,left:`${-g}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const w=y-window.innerHeight;w&&h.current>=y&&(document.body.style.top=`${-(h.current+w)}px`)}),300)}},[e]),v=ee.useCallback(()=>{if(cN()&&Wc!==null&&!l){const g=-parseInt(document.body.style.top,10),y=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Wc),window.requestAnimationFrame(()=>{if(o&&u!==window.location.href){d(window.location.href);return}window.scrollTo(y,g)}),Wc=null}},[u]);return ee.useEffect(()=>{function g(){h.current=window.scrollY}return g(),window.addEventListener("scroll",g),()=>{window.removeEventListener("scroll",g)}},[]),ee.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||v()}},[t,v]),ee.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&m(),t||window.setTimeout(()=>{v()},500)):v())},[e,r,u,t,n,m,v]),{restorePositionSetting:v}}function LJ({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:o,snapPoints:l,shouldScaleBackground:u=!1,setBackgroundColorOnScale:d=!0,closeThreshold:h=MJ,scrollLockTimeout:m=RJ,dismissible:v=!0,handleOnly:g=!1,fadeFromIndex:y=l&&l.length-1,activeSnapPoint:w,setActiveSnapPoint:S,fixed:j,modal:N=!0,onClose:C,nested:_,noBodyStyles:E=!1,direction:M="bottom",defaultOpen:A=!1,disablePreventScroll:R=!0,snapToSequentialPoint:T=!1,preventScrollRestoration:O=!1,repositionInputs:D=!0,onAnimationEnd:z,container:B,autoFocus:V=!1}){var Y,G;const[ae=!1,L]=ER({defaultProp:A,prop:e,onChange:xe=>{t?.(xe),!xe&&!_&&bt(),setTimeout(()=>{z?.(xe)},Ft.DURATION*1e3),xe&&!N&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),xe||(document.body.style.pointerEvents="auto")}}),[$,U]=ee.useState(!1),[H,le]=ee.useState(!1),[I,F]=ee.useState(!1),K=ee.useRef(null),ne=ee.useRef(null),X=ee.useRef(null),ue=ee.useRef(null),te=ee.useRef(null),ye=ee.useRef(!1),Ce=ee.useRef(null),_e=ee.useRef(0),Re=ee.useRef(!1),ge=ee.useRef(!A),Fe=ee.useRef(0),be=ee.useRef(null),Be=ee.useRef(((Y=be.current)==null?void 0:Y.getBoundingClientRect().height)||0),nt=ee.useRef(((G=be.current)==null?void 0:G.getBoundingClientRect().width)||0),ot=ee.useRef(0),yt=ee.useCallback(xe=>{l&&xe===dt.length-1&&(ne.current=new Date)},[]),{activeSnapPoint:pe,activeSnapPointIndex:Le,setActiveSnapPoint:Ye,onRelease:Oe,snapPointsOffset:dt,onDrag:ct,shouldFade:Mn,getPercentageDragged:Qe}=OJ({snapPoints:l,activeSnapPointProp:w,setActiveSnapPointProp:S,drawerRef:be,fadeFromIndex:y,overlayRef:K,onSnapPointChange:yt,direction:M,container:B,snapToSequentialPoint:T});SJ({isDisabled:!ae||H||!N||I||!$||!D||!R});const{restorePositionSetting:bt}=PJ({isOpen:ae,modal:N,nested:_??!1,hasBeenOpened:$,preventScrollRestoration:O,noBodyStyles:E});function pt(){return(window.innerWidth-Mx)/window.innerWidth}function Vn(xe){var ke,we;!v&&!l||be.current&&!be.current.contains(xe.target)||(Be.current=((ke=be.current)==null?void 0:ke.getBoundingClientRect().height)||0,nt.current=((we=be.current)==null?void 0:we.getBoundingClientRect().width)||0,le(!0),X.current=new Date,wR()&&window.addEventListener("touchend",()=>ye.current=!1,{once:!0}),xe.target.setPointerCapture(xe.pointerId),_e.current=cn(M)?xe.pageY:xe.pageX)}function or(xe,ke){var we;let Ne=xe;const Ve=(we=window.getSelection())==null?void 0:we.toString(),De=be.current?Ff(be.current,M):null,wt=new Date;if(Ne.tagName==="SELECT"||Ne.hasAttribute("data-vaul-no-drag")||Ne.closest("[data-vaul-no-drag]"))return!1;if(M==="right"||M==="left")return!0;if(ne.current&&wt.getTime()-ne.current.getTime()<500)return!1;if(De!==null&&(M==="bottom"?De>0:De<0))return!0;if(Ve&&Ve.length>0)return!1;if(te.current&&wt.getTime()-te.current.getTime()<m&&De===0||ke)return te.current=wt,!1;for(;Ne;){if(Ne.scrollHeight>Ne.clientHeight){if(Ne.scrollTop!==0)return te.current=new Date,!1;if(Ne.getAttribute("role")==="dialog")return!0}Ne=Ne.parentNode}return!0}function Hr(xe){if(be.current&&H){const ke=M==="bottom"||M==="right"?1:-1,we=(_e.current-(cn(M)?xe.pageY:xe.pageX))*ke,Ne=we>0,Ve=l&&!v&&!Ne;if(Ve&&Le===0)return;const De=Math.abs(we),wt=document.querySelector("[data-vaul-drawer-wrapper]"),bn=M==="bottom"||M==="top"?Be.current:nt.current;let tn=De/bn;const Gt=Qe(De,Ne);if(Gt!==null&&(tn=Gt),Ve&&tn>=1||!ye.current&&!or(xe.target,Ne))return;if(be.current.classList.add(Gv),ye.current=!0,mn(be.current,{transition:"none"}),mn(K.current,{transition:"none"}),l&&ct({draggedDistance:we}),Ne&&!l){const Rn=EJ(we),Hn=Math.min(Rn*-1,0)*ke;mn(be.current,{transform:cn(M)?`translate3d(0, ${Hn}px, 0)`:`translate3d(${Hn}px, 0, 0)`});return}const Ot=1-tn;if((Mn||y&&Le===y-1)&&(r?.(xe,tn),mn(K.current,{opacity:`${Ot}`,transition:"none"},!0)),wt&&K.current&&u){const Rn=Math.min(pt()+tn*(1-pt()),1),Hn=8-tn*8,wn=Math.max(0,14-tn*14);mn(wt,{borderRadius:`${Hn}px`,transform:cn(M)?`scale(${Rn}) translate3d(0, ${wn}px, 0)`:`scale(${Rn}) translate3d(${wn}px, 0, 0)`,transition:"none"},!0)}if(!l){const Rn=De*ke;mn(be.current,{transform:cn(M)?`translate3d(0, ${Rn}px, 0)`:`translate3d(${Rn}px, 0, 0)`})}}}ee.useEffect(()=>{window.requestAnimationFrame(()=>{ge.current=!0})},[]),ee.useEffect(()=>{var xe;function ke(){if(!be.current||!D)return;const we=document.activeElement;if(Tx(we)||Re.current){var Ne;const Ve=((Ne=window.visualViewport)==null?void 0:Ne.height)||0,De=window.innerHeight;let wt=De-Ve;const bn=be.current.getBoundingClientRect().height||0,tn=bn>De*.8;ot.current||(ot.current=bn);const Gt=be.current.getBoundingClientRect().top;if(Math.abs(Fe.current-wt)>60&&(Re.current=!Re.current),l&&l.length>0&&dt&&Le){const Ot=dt[Le]||0;wt+=Ot}if(Fe.current=wt,bn>Ve||Re.current){const Ot=be.current.getBoundingClientRect().height;let Rn=Ot;Ot>Ve&&(Rn=Ve-(tn?Gt:Mx)),j?be.current.style.height=`${Ot-Math.max(wt,0)}px`:be.current.style.height=`${Math.max(Rn,Ve-Gt)}px`}else pJ()||(be.current.style.height=`${ot.current}px`);l&&l.length>0&&!Re.current?be.current.style.bottom="0px":be.current.style.bottom=`${Math.max(wt,0)}px`}}return(xe=window.visualViewport)==null||xe.addEventListener("resize",ke),()=>{var we;return(we=window.visualViewport)==null?void 0:we.removeEventListener("resize",ke)}},[Le,l,dt]);function zn(xe){qt(),C?.(),xe||L(!1),setTimeout(()=>{l&&Ye(l[0])},Ft.DURATION*1e3)}function Pn(){if(!be.current)return;const xe=document.querySelector("[data-vaul-drawer-wrapper]"),ke=Ff(be.current,M);mn(be.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${Ft.DURATION}s cubic-bezier(${Ft.EASE.join(",")})`}),mn(K.current,{transition:`opacity ${Ft.DURATION}s cubic-bezier(${Ft.EASE.join(",")})`,opacity:"1"}),u&&ke&&ke>0&&ae&&mn(xe,{borderRadius:`${kR}px`,overflow:"hidden",...cn(M)?{transform:`scale(${pt()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${pt()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Ft.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ft.EASE.join(",")})`},!0)}function qt(){!H||!be.current||(be.current.classList.remove(Gv),ye.current=!1,le(!1),ue.current=new Date)}function en(xe){if(!H||!be.current)return;be.current.classList.remove(Gv),ye.current=!1,le(!1),ue.current=new Date;const ke=Ff(be.current,M);if(!xe||!or(xe.target,!1)||!ke||Number.isNaN(ke)||X.current===null)return;const we=ue.current.getTime()-X.current.getTime(),Ne=_e.current-(cn(M)?xe.pageY:xe.pageX),Ve=Math.abs(Ne)/we;if(Ve>.05&&(F(!0),setTimeout(()=>{F(!1)},200)),l){Oe({draggedDistance:Ne*(M==="bottom"||M==="right"?1:-1),closeDrawer:zn,velocity:Ve,dismissible:v}),o?.(xe,!0);return}if(M==="bottom"||M==="right"?Ne>0:Ne<0){Pn(),o?.(xe,!0);return}if(Ve>NR){zn(),o?.(xe,!1);return}var De;const wt=Math.min((De=be.current.getBoundingClientRect().height)!=null?De:0,window.innerHeight);var bn;const tn=Math.min((bn=be.current.getBoundingClientRect().width)!=null?bn:0,window.innerWidth),Gt=M==="left"||M==="right";if(Math.abs(ke)>=(Gt?tn:wt)*h){zn(),o?.(xe,!1);return}o?.(xe,!0),Pn()}ee.useEffect(()=>(ae&&(mn(document.documentElement,{scrollBehavior:"auto"}),ne.current=new Date),()=>{_J(document.documentElement,"scrollBehavior")}),[ae]);function $t(xe){const ke=xe?(window.innerWidth-ko)/window.innerWidth:1,we=xe?-ko:0;Ce.current&&window.clearTimeout(Ce.current),mn(be.current,{transition:`transform ${Ft.DURATION}s cubic-bezier(${Ft.EASE.join(",")})`,transform:cn(M)?`scale(${ke}) translate3d(0, ${we}px, 0)`:`scale(${ke}) translate3d(${we}px, 0, 0)`}),!xe&&be.current&&(Ce.current=setTimeout(()=>{const Ne=Ff(be.current,M);mn(be.current,{transition:"none",transform:cn(M)?`translate3d(0, ${Ne}px, 0)`:`translate3d(${Ne}px, 0, 0)`})},500))}function us(xe,ke){if(ke<0)return;const we=(window.innerWidth-ko)/window.innerWidth,Ne=we+ke*(1-we),Ve=-ko+ke*ko;mn(be.current,{transform:cn(M)?`scale(${Ne}) translate3d(0, ${Ve}px, 0)`:`scale(${Ne}) translate3d(${Ve}px, 0, 0)`,transition:"none"})}function Yr(xe,ke){const we=cn(M)?window.innerHeight:window.innerWidth,Ne=ke?(we-ko)/we:1,Ve=ke?-ko:0;ke&&mn(be.current,{transition:`transform ${Ft.DURATION}s cubic-bezier(${Ft.EASE.join(",")})`,transform:cn(M)?`scale(${Ne}) translate3d(0, ${Ve}px, 0)`:`scale(${Ne}) translate3d(${Ve}px, 0, 0)`})}return ee.useEffect(()=>{N||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[N]),ee.createElement(Uu,{defaultOpen:A,onOpenChange:xe=>{!v&&!xe||(xe?U(!0):zn(!0),L(xe))},open:ae},ee.createElement(bR.Provider,{value:{activeSnapPoint:pe,snapPoints:l,setActiveSnapPoint:Ye,drawerRef:be,overlayRef:K,onOpenChange:t,onPress:Vn,onRelease:en,onDrag:Hr,dismissible:v,shouldAnimate:ge,handleOnly:g,isOpen:ae,isDragging:H,shouldFade:Mn,closeDrawer:zn,onNestedDrag:us,onNestedOpenChange:$t,onNestedRelease:Yr,keyboardIsOpen:Re,modal:N,snapPointsOffset:dt,activeSnapPointIndex:Le,direction:M,shouldScaleBackground:u,setBackgroundColorOnScale:d,noBodyStyles:E,container:B,autoFocus:V}},n))}const TR=ee.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:r,onRelease:o,shouldFade:l,isOpen:u,modal:d,shouldAnimate:h}=sd(),m=jR(t,n),v=r&&r.length>0;if(!d)return null;const g=ee.useCallback(y=>o(y),[o]);return ee.createElement(Vu,{onMouseUp:g,ref:m,"data-vaul-overlay":"","data-vaul-snap-points":u&&v?"true":"false","data-vaul-snap-points-overlay":u&&l?"true":"false","data-vaul-animate":h?.current?"true":"false",...e})});TR.displayName="Drawer.Overlay";const MR=ee.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},o){const{drawerRef:l,onPress:u,onRelease:d,onDrag:h,keyboardIsOpen:m,snapPointsOffset:v,activeSnapPointIndex:g,modal:y,isOpen:w,direction:S,snapPoints:j,container:N,handleOnly:C,shouldAnimate:_,autoFocus:E}=sd(),[M,A]=ee.useState(!1),R=jR(o,l),T=ee.useRef(null),O=ee.useRef(null),D=ee.useRef(!1),z=j&&j.length>0;zJ();const B=(Y,G,ae=0)=>{if(D.current)return!0;const L=Math.abs(Y.y),$=Math.abs(Y.x),U=$>L,H=["bottom","right"].includes(G)?1:-1;if(G==="left"||G==="right"){if(!(Y.x*H<0)&&$>=0&&$<=ae)return U}else if(!(Y.y*H<0)&&L>=0&&L<=ae)return!U;return D.current=!0,!0};ee.useEffect(()=>{z&&window.requestAnimationFrame(()=>{A(!0)})},[]);function V(Y){T.current=null,D.current=!1,d(Y)}return ee.createElement(Hu,{"data-vaul-drawer-direction":S,"data-vaul-drawer":"","data-vaul-delayed-snap-points":M?"true":"false","data-vaul-snap-points":w&&z?"true":"false","data-vaul-custom-container":N?"true":"false","data-vaul-animate":_?.current?"true":"false",...r,ref:R,style:v&&v.length>0?{"--snap-point-height":`${v[g??0]}px`,...t}:t,onPointerDown:Y=>{C||(r.onPointerDown==null||r.onPointerDown.call(r,Y),T.current={x:Y.pageX,y:Y.pageY},u(Y))},onOpenAutoFocus:Y=>{n?.(Y),E||Y.preventDefault()},onPointerDownOutside:Y=>{if(e?.(Y),!y||Y.defaultPrevented){Y.preventDefault();return}m.current&&(m.current=!1)},onFocusOutside:Y=>{if(!y){Y.preventDefault();return}},onPointerMove:Y=>{if(O.current=Y,C||(r.onPointerMove==null||r.onPointerMove.call(r,Y),!T.current))return;const G=Y.pageY-T.current.y,ae=Y.pageX-T.current.x,L=Y.pointerType==="touch"?10:2;B({x:ae,y:G},S,L)?h(Y):(Math.abs(ae)>L||Math.abs(G)>L)&&(T.current=null)},onPointerUp:Y=>{r.onPointerUp==null||r.onPointerUp.call(r,Y),T.current=null,D.current=!1,d(Y)},onPointerOut:Y=>{r.onPointerOut==null||r.onPointerOut.call(r,Y),V(O.current)},onContextMenu:Y=>{r.onContextMenu==null||r.onContextMenu.call(r,Y),O.current&&V(O.current)}})});MR.displayName="Drawer.Content";const IJ=250,$J=120,FJ=ee.forwardRef(function({preventCycle:e=!1,children:t,...n},r){const{closeDrawer:o,isDragging:l,snapPoints:u,activeSnapPoint:d,setActiveSnapPoint:h,dismissible:m,handleOnly:v,isOpen:g,onPress:y,onDrag:w}=sd(),S=ee.useRef(null),j=ee.useRef(!1);function N(){if(j.current){E();return}window.setTimeout(()=>{C()},$J)}function C(){if(l||e||j.current){E();return}if(E(),!u||u.length===0){m||o();return}if(d===u[u.length-1]&&m){o();return}const A=u.findIndex(T=>T===d);if(A===-1)return;const R=u[A+1];h(R)}function _(){S.current=window.setTimeout(()=>{j.current=!0},IJ)}function E(){S.current&&window.clearTimeout(S.current),j.current=!1}return ee.createElement("div",{onClick:N,onPointerCancel:E,onPointerDown:M=>{v&&y(M),_()},onPointerMove:M=>{v&&w(M)},ref:r,"data-vaul-drawer-visible":g?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},ee.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});FJ.displayName="Drawer.Handle";function BJ(e){const t=sd(),{container:n=t.container,...r}=e;return ee.createElement(qu,{container:n,...r})}const ad={Root:LJ,Content:MR,Overlay:TR,Portal:BJ,Title:Qh};function UJ({...e}){return i.jsx(ad.Root,{"data-slot":"drawer",...e})}function qJ({...e}){return i.jsx(ad.Portal,{"data-slot":"drawer-portal",...e})}function VJ({className:e,...t}){return i.jsx(ad.Overlay,{"data-slot":"drawer-overlay",className:W("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",e),...t})}function HJ({className:e,children:t,...n}){return i.jsxs(qJ,{"data-slot":"drawer-portal",children:[i.jsx(VJ,{}),i.jsxs(ad.Content,{"data-slot":"drawer-content",className:W("group/drawer-content fixed z-50 flex h-auto flex-col bg-background","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",e),...n,children:[i.jsx("div",{className:"mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full bg-muted group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),t]})]})}function YJ({className:e,...t}){return i.jsx("div",{"data-slot":"drawer-header",className:W("flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",e),...t})}function WJ({className:e,...t}){return i.jsx(ad.Title,{"data-slot":"drawer-title",className:W("font-semibold text-foreground",e),...t})}function Rx(e){const t=new Date(e),n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),l=String(t.getHours()).padStart(2,"0"),u=String(t.getMinutes()).padStart(2,"0");return`${n}-${r}-${o}T${l}:${u}`}function GJ(e){return new Date(e).getTime()}function ZJ(e){const t=new Date(e),n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0");return`${n}-${r}-${o}`}function QJ(e,t){const n={...e};for(const r of t){const o=e[r.name];(r.type==="date"||r.type==="datetime")&&typeof o=="number"&&(n[r.name]=r.type==="datetime"?Rx(o):ZJ(o))}return n}function hN(e,t){const n={...e};for(const r of t){const o=e[r.name];(r.type==="date"||r.type==="datetime")&&(typeof o=="string"&&o?n[r.name]=new Date(o).getTime():o||(n[r.name]=null))}return n}function RR({contentType:e,entry:t,onSave:n,onCancel:r,onDelete:o,onNavigateToEntry:l,onNavigateToNewEntry:u,siblingEntries:d,autosaveEnabled:h=!0,autosaveInterval:m=3e4,canDelete:v=!1}){const{settings:g}=Xk(),y=p.useCallback(()=>{if(t)return QJ({...t.data},e.fields);const Q={};for(const je of e.fields)if(je.defaultValue!==void 0)Q[je.name]=je.defaultValue;else switch(je.type){case"text":case"richText":Q[je.name]="";break;case"boolean":Q[je.name]=!1;break;case"number":case"date":case"datetime":case"reference":case"media":case"json":Q[je.name]=null;break;case"select":Q[je.name]="";break;case"multiSelect":Q[je.name]=[];break}return Q},[e.fields,t]),[w,S]=p.useState(y),[j,N]=p.useState({}),[C,_]=p.useState(!1),[E,M]=p.useState(!1),[A,R]=p.useState(t?{...t.data}:null),[T,O]=p.useState("idle"),[D,z]=p.useState(null),[B,V]=p.useState(0),Y=3,[G,ae]=p.useState(!1),[L,$]=p.useState(()=>{const Q=new Date;return Q.setDate(Q.getDate()+1),Q.setHours(9,0,0,0),Rx(Q.getTime())}),[U,H]=p.useState(!1),[le,I]=p.useState(null),[F,K]=p.useState(!1),[ne,X]=p.useState(null),[ue,te]=p.useState(!1),[ye,Ce]=p.useState(!1),[_e,Re]=p.useState(null),[ge,Fe]=p.useState(!1),[be,Be]=p.useState(!1),[nt,ot]=p.useState(!1),[yt,pe]=p.useState(!1),[Le,Ye]=p.useState(!1),Oe=p.useRef(null),dt=p.useRef(w);dt.current=w;const ct=xn(),Mn=et(ct.createEntry),Qe=et(ct.updateEntry),bt=et(ct.publishEntry),pt=et(ct.unpublishEntry),Vn=et(ct.scheduleEntry),or=et(ct.cancelScheduledEntry),Hr=et(ct.deleteEntry),zn=et(ct.duplicateEntry);p.useEffect(()=>{const Q=y();S(Q),N({}),M(!1),R(t?{...t.data}:null)},[t?._id,y]);const Pn=p.useCallback((Q,je)=>{S(Ue=>({...Ue,[Q]:je})),M(!0),N(Ue=>{if(Ue[Q]){const{[Q]:gt,...Ke}=Ue;return Ke}return Ue})},[]),qt=p.useCallback(async()=>{const Q={};for(const je of e.fields){const Ue=w[je.name];if(je.required&&(Ue==null||Ue===""||Array.isArray(Ue)&&Ue.length===0)){Q[je.name]={message:`${je.label} is required`,code:"REQUIRED"};continue}if(Ue!=null&&Ue!=="")switch(je.type){case"text":{const gt=String(Ue),Ke=je.options;Ke?.minLength&&gt.length<Ke.minLength?Q[je.name]={message:`Minimum ${Ke.minLength} characters required`,code:"MIN_LENGTH"}:Ke?.maxLength&&gt.length>Ke.maxLength?Q[je.name]={message:`Maximum ${Ke.maxLength} characters allowed`,code:"MAX_LENGTH"}:Ke?.pattern&&(new RegExp(Ke.pattern).test(gt)||(Q[je.name]={message:"Value does not match the required format",code:"PATTERN_MISMATCH"}));break}case"number":{const gt=Number(Ue),Ke=je.options;isNaN(gt)?Q[je.name]={message:"Must be a valid number",code:"INVALID_TYPE"}:Ke?.min!==void 0&&gt<Ke.min?Q[je.name]={message:`Minimum value is ${Ke.min}`,code:"MIN_VALUE"}:Ke?.max!==void 0&&gt>Ke.max?Q[je.name]={message:`Maximum value is ${Ke.max}`,code:"MAX_VALUE"}:Ke?.precision===0&&!Number.isInteger(gt)&&(Q[je.name]={message:"Must be a whole number",code:"NOT_INTEGER"});break}case"select":{const gt=je.options;gt?.options&&!gt.options.some(Ke=>Ke.value===Ue)&&(Q[je.name]={message:"Please select a valid option",code:"INVALID_OPTION"});break}case"multiSelect":{const gt=je.options;if(Array.isArray(Ue)&&gt?.options){const Ke=gt.options.map(Zt=>Zt.value);Ue.filter(Zt=>!Ke.includes(String(Zt))).length>0&&(Q[je.name]={message:"Contains invalid options",code:"INVALID_OPTION"})}break}}}return N(Q),Object.keys(Q).length===0},[e.fields,w]),en=p.useCallback(async(Q=0)=>{if(!(!E||!t)&&t.status==="draft")try{O("saving"),z(null),await Qe({id:t._id,data:hN(dt.current,e.fields)}),R({...dt.current}),O("saved"),M(!1),V(0),setTimeout(()=>O("idle"),3e3)}catch(je){console.error("Autosave failed:",je);const Ue=je instanceof Error?je.message:"Failed to save";if(_Z(je)&&Q<Y){const Ke=Math.min(1e3*Math.pow(2,Q),1e4);O("error"),z(`Save failed, retrying in ${Math.round(Ke/1e3)}s...`),V(Q+1),setTimeout(()=>en(Q+1),Ke)}else O("error"),z(Ue),V(0)}},[E,t,Qe,Y]),$t=p.useCallback(()=>{V(0),en(0)},[en]);p.useEffect(()=>{if(!(!h||!t||t.status!=="draft"))return Oe.current&&clearTimeout(Oe.current),E&&(Oe.current=setTimeout(()=>en(),m)),()=>{Oe.current&&clearTimeout(Oe.current)}},[h,m,E,t,en]);const us=p.useCallback(async()=>{if(await qt()){_(!0);try{let je;const Ue=hN(w,e.fields);t?je=await Qe({id:t._id,data:Ue}):je=await Mn({contentTypeName:e.name,data:Ue}),M(!1),R({...w}),Qr.success("Changes saved"),n?.(je)}catch(je){const{fieldErrors:Ue,generalError:gt}=kZ(je),Ke=gt??(je instanceof Error?je.message:"Failed to save entry");Qr.error("Failed to save",{description:Ke}),Object.keys(Ue).length>0&&N(Yn=>({...Yn,...Ue}))}finally{_(!1)}}},[qt,t,w,e.fields,e.name,e._id,Mn,Qe,n]),Yr=p.useCallback(()=>{if(E){Ye(!0);return}r?.()},[E,r]),xe=p.useCallback(()=>{Ye(!1),r?.()},[r]),ke=p.useCallback(()=>{X("publish"),K(!0)},[]),we=p.useCallback(()=>{X("unpublish"),K(!0)},[]),Ne=p.useCallback(async()=>{if(!(!t||!ne)){K(!1),H(!0),I(null);try{if(ne==="publish"){const Q=await bt({id:t._id,changeDescription:"Published from editor"});Qr.success("Entry published"),n?.(Q)}else{const Q=await pt({id:t._id});Qr.success("Entry unpublished"),n?.(Q)}}catch(Q){Qr.error(`Failed to ${ne}`,{description:Q instanceof Error?Q.message:void 0})}finally{H(!1),X(null)}}},[t,ne,bt,pt,n]),Ve=p.useCallback(async()=>{if(t){H(!0);try{const Q=await bt({id:t._id,changeDescription:"Published from editor"});Qr.success("Entry published"),n?.(Q)}catch(Q){Qr.error("Failed to publish",{description:Q instanceof Error?Q.message:void 0})}finally{H(!1)}}},[t,bt,n]),De=p.useCallback(async()=>{if(!t)return;const Q=GJ(L);if(Q<Date.now()+60*1e3){I("Schedule time must be at least 1 minute in the future");return}H(!0),I(null);try{const je=await Vn({id:t._id,publishAt:Q});ae(!1),n?.(je)}catch(je){I(je instanceof Error?je.message:"Failed to schedule")}finally{H(!1)}},[t,L,Vn,n]),wt=p.useCallback(async()=>{if(t){H(!0),I(null);try{const Q=await or({id:t._id});n?.(Q)}catch(Q){I(Q instanceof Error?Q.message:"Failed to cancel schedule")}finally{H(!1)}}},[t,or,n]),bn=p.useCallback(()=>{Re(null),te(!0)},[]),tn=p.useCallback(async()=>{if(t){Ce(!0),Re(null);try{await Hr({id:t._id,hardDelete:!1}),te(!1),o?.()}catch(Q){Re(Q instanceof Error?Q.message:"Failed to delete entry")}finally{Ce(!1)}}},[t,Hr,o]),Gt=p.useCallback(async()=>{if(t){Fe(!0);try{const Q=await zn({sourceEntryId:t._id});Qr.success("Entry duplicated"),n?.(Q)}catch(Q){Qr.error("Failed to duplicate",{description:Q instanceof Error?Q.message:void 0})}finally{Fe(!1)}}},[t,zn,n]),Ot=p.useCallback(async()=>{if(t){Be(!0);try{const Q=await Qe({id:t._id,status:"archived"});Qr.success("Entry archived"),n?.(Q)}catch(Q){Qr.error("Failed to archive",{description:Q instanceof Error?Q.message:void 0})}finally{Be(!1)}}},[t,Qe,n]),Rn=e.titleField&&w[e.titleField]||void 0,Hn=!!g?.features.scheduling,wn=!!g?.features.versioning;return i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsx($Z,{contentType:e,entry:t,entryTitle:Rn,isDirty:E,isSubmitting:C,isPublishing:U,autosaveStatus:T,autosaveError:D,autosaveRetryCount:B,maxAutosaveRetries:Y,canDelete:v,hasScheduling:Hn,onSave:us,onCancel:Yr,onPublishClick:ke,onUnpublishClick:we,onScheduleClick:()=>ae(!0),onCancelSchedule:wt,onPublishNow:Ve,onDuplicate:Gt,onArchive:Ot,onDelete:bn,onAutosaveRetry:$t,onToggleProperties:()=>pe(!0),siblingEntries:d,onNavigateToEntry:l,onNavigateToNewEntry:u}),i.jsx(EZ,{open:Le,onOpenChange:Ye,children:i.jsxs(RZ,{children:[i.jsxs(AZ,{children:[i.jsx(DZ,{children:"Unsaved changes"}),i.jsx(zZ,{children:"You have unsaved changes that will be lost if you leave."})]}),i.jsxs(OZ,{children:[i.jsx(LZ,{children:"Keep editing"}),i.jsx(PZ,{onClick:xe,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard changes"})]})]})}),i.jsxs("div",{className:"flex min-h-0 flex-1",children:[i.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto p-6",children:i.jsx(uJ,{fields:e.fields,formData:w,fieldErrors:j,isSubmitting:C,onFieldChange:Pn})}),t&&i.jsx("aside",{className:"hidden w-80 shrink-0 overflow-y-auto border-l p-6 lg:block",children:i.jsx(lN,{entry:t,hasScheduling:Hn,hasVersioning:wn,canDelete:v,isSubmitting:C,isPublishing:U,isDuplicating:ge,isArchiving:be,isDeleting:ye,onPublishClick:ke,onUnpublishClick:we,onScheduleClick:()=>ae(!0),onCancelSchedule:wt,onPublishNow:Ve,onDuplicate:Gt,onArchive:Ot,onDelete:bn,onViewHistory:()=>ot(!0)})})]}),t&&i.jsx(UJ,{open:yt,onOpenChange:pe,children:i.jsxs(HJ,{children:[i.jsx(YJ,{children:i.jsx(WJ,{children:"Properties"})}),i.jsx("div",{className:"overflow-y-auto px-4 pb-6",children:i.jsx(lN,{entry:t,hasScheduling:Hn,hasVersioning:wn,canDelete:v,isSubmitting:C,isPublishing:U,isDuplicating:ge,isArchiving:be,isDeleting:ye,onPublishClick:ke,onUnpublishClick:we,onScheduleClick:()=>ae(!0),onCancelSchedule:wt,onPublishNow:Ve,onDuplicate:Gt,onArchive:Ot,onDelete:bn,onViewHistory:()=>ot(!0)})})]})}),wn&&t&&i.jsx(e2,{open:nt,onOpenChange:ot,children:i.jsxs(t2,{side:"right",className:"w-96 sm:w-[420px]",children:[i.jsx(n2,{children:"Version History"}),i.jsx(NZ,{entryId:t._id,currentVersion:t.version,onRollbackComplete:()=>ot(!1),onClose:()=>ot(!1)})]})}),Hn&&i.jsx(dJ,{open:G,onOpenChange:ae,scheduleDateTime:L,onScheduleDateTimeChange:$,onSchedule:De,isPublishing:U,publishError:le,minDateTime:Rx(Date.now()+60*1e3)}),i.jsx(fJ,{open:F,onOpenChange:Q=>{Q||(K(!1),X(null))},action:ne,onConfirm:Ne,isPublishing:U}),i.jsx(hJ,{open:ue,onOpenChange:Q=>{!Q&&!ye&&(te(!1),Re(null))},onConfirm:tn,isDeleting:ye,error:_e})]})}function ti(){const e=Xa(),t=m3(),n=Go({strict:!1}),r=p.useCallback((h,m)=>{let v=h;if(m)for(const[g,y]of Object.entries(m))v=v.replace(`:${g}`,y).replace(`$${g}`,y);e({to:v})},[e]),o=p.useCallback(h=>{e({to:"/entries/$entryId",params:{entryId:h}})},[e]),l=p.useCallback(h=>{e({to:"/entries/type/$contentTypeId",params:{contentTypeId:h}})},[e]),u=p.useCallback(h=>{e({to:"/entries/new/$contentTypeId",params:{contentTypeId:h}})},[e]),d=p.useCallback(()=>{window.history.back()},[]);return p.useMemo(()=>({navigate:r,currentRoute:t.pathname,params:n??{},canGoBack:window.history.length>1,goBack:d,navigateToEntry:o,navigateToContentType:l,navigateToNewEntry:u}),[r,t.pathname,n,d,o,l,u])}const cs=n3({component:()=>i.jsx(PY,{children:i.jsx(ek,{})})}),KJ=os({getParentRoute:()=>cs,path:"/",component:()=>{const e=ti();return i.jsx(dW,{api:Cn,navigation:e})}}),XJ=os({getParentRoute:()=>cs,path:"/content",component:()=>{const e=ti();return i.jsx(aW,{api:Cn,navigation:e})}}),JJ=os({getParentRoute:()=>cs,path:"/content-types",component:()=>{const e=ti();return i.jsx(iW,{api:Cn,navigation:e})}}),eee=os({getParentRoute:()=>cs,path:"/media",component:()=>{const e=ti(),{settings:t}=Xk();return i.jsx(fG,{api:Cn,navigation:e,settings:t})}}),tee=os({getParentRoute:()=>cs,path:"/settings",component:()=>{const e=ti();return i.jsx(uZ,{api:Cn,navigation:e})}}),nee=os({getParentRoute:()=>cs,path:"/taxonomies",component:()=>{const e=ti();return i.jsx(pZ,{api:Cn,navigation:e})}}),ree=os({getParentRoute:()=>cs,path:"/trash",component:()=>{const e=ti();return i.jsx(gZ,{api:Cn,navigation:e})}});function see(){const{entryId:e}=Go({from:"/entries/$entryId"}),t=Xa(),{canDelete:n}=gm(),r=He(Cn.getEntry,{id:e}),o=He(Cn.getContentType,r?{name:r.contentTypeName}:"skip"),l=()=>{if(!r||!o)return;const m=o.titleField??"title",v=r.data[m];return typeof v=="string"&&v?v:"Untitled"};if(db(`/entries/${e}`,l()),r===void 0||r&&o===void 0)return i.jsx("div",{className:"space-y-6 p-6",children:i.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[i.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),i.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading entry..."})]})});if(r===null)return i.jsx("div",{className:"space-y-6 p-6",children:i.jsx(Bn,{icon:i.jsx(Sr,{className:"size-6"}),title:"Entry Not Found",description:"The content entry you're looking for doesn't exist or has been deleted.",action:{label:"Back to Content",onClick:()=>t({to:"/content-types"})}})});if(o===null)return i.jsx("div",{className:"space-y-6 p-6",children:i.jsx(Bn,{icon:i.jsx(Sr,{className:"size-6"}),title:"Content Type Not Found",description:"The content type for this entry doesn't exist or has been deleted.",action:{label:"Back to Content",onClick:()=>t({to:"/content-types"})}})});const u=m=>{},d=()=>t({to:"/content"}),h=()=>t({to:"/content"});return i.jsx("div",{className:"space-y-6 p-6",children:i.jsx(RR,{contentType:o,entry:r,onSave:u,onCancel:d,onDelete:h,canDelete:n("contentEntries")})})}const aee=os({getParentRoute:()=>cs,path:"/entries/$entryId",component:see});function oee(){const{contentTypeId:e}=Go({from:"/entries/new/$contentTypeId"}),t=Xa(),n=He(Cn.getContentType,{id:e});if(db(`/entries/new/${e}`,n?`New ${n.displayName}`:void 0),n===void 0)return i.jsx("div",{className:"space-y-6 p-6",children:i.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[i.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),i.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading content type..."})]})});if(n===null)return i.jsx("div",{className:"space-y-6 p-6",children:i.jsx(Bn,{icon:i.jsx(Sr,{className:"size-6"}),title:"Content Type Not Found",description:"The content type you're looking for doesn't exist or has been deleted.",action:{label:"Back to Content Types",onClick:()=>t({to:"/content-types"})}})});const r=l=>{t({to:"/entries/$entryId",params:{entryId:l._id}})},o=()=>{t({to:"/entries/type/$contentTypeId",params:{contentTypeId:e}})};return i.jsx("div",{className:"space-y-6 p-6",children:i.jsx(RR,{contentType:n,onSave:r,onCancel:o})})}const iee=os({getParentRoute:()=>cs,path:"/entries/new/$contentTypeId",component:oee});function lee(){const{contentTypeId:e}=Go({from:"/entries/type/$contentTypeId"}),t=Xa(),[n,r]=p.useState("all"),[o,l]=p.useState(""),[u,d]=p.useState(""),[h,m]=p.useState("updatedAt"),[v,g]=p.useState("desc"),[y,w]=p.useState(0),[S,j]=p.useState([]),N=25,{canCreate:C,canUpdate:_,canDelete:E}=gm(),M=et(Cn.deleteEntry),[A,R]=p.useState(!1),[T,O]=p.useState(null),[D,z]=p.useState(!1),[B,V]=p.useState(null);p.useEffect(()=>{const ge=setTimeout(()=>{d(o),w(0)},300);return()=>clearTimeout(ge)},[o]);const Y=He(Cn.getContentType,{id:e});db(`/entries/type/${e}`,Y?.displayName);const G=He(Cn.listEntries,{contentTypeName:Y?.name,status:n==="all"?void 0:n,search:u||void 0,paginationOpts:{numItems:250,cursor:null}}),ae=G?.page??[],L=He(Cn.getEntriesByTerm,S[0]?{termId:S[0]}:"skip"),$=He(Cn.getEntriesByTerm,S[1]?{termId:S[1]}:"skip"),U=He(Cn.getEntriesByTerm,S[2]?{termId:S[2]}:"skip"),H=p.useMemo(()=>{if(S.length===0)return null;const ge=new Set,Fe=[L,$,U];for(let be=0;be<S.length&&be<3;be++){const Be=Fe[be];if(Be?.page)for(const nt of Be.page)ge.add(nt)}return ge},[S,L,$,U]),le=p.useCallback(ge=>{const Fe=Y?.titleField??"title",be=ge.data[Fe];return typeof be=="string"&&be?be:"Untitled"},[Y?.titleField]),I=p.useMemo(()=>{let ge=[...ae];return H!==null&&(ge=ge.filter(Fe=>H.has(Fe._id))),ge.sort((Fe,be)=>{let Be=0;switch(h){case"title":{const nt=le(Fe).toLowerCase(),ot=le(be).toLowerCase();Be=nt.localeCompare(ot);break}case"status":Be=Fe.status.localeCompare(be.status);break;case"updatedAt":{const nt=Fe.lastPublishedAt??Fe._creationTime??0,ot=be.lastPublishedAt??be._creationTime??0;Be=nt-ot;break}case"createdAt":Be=(Fe._creationTime??0)-(be._creationTime??0);break;default:Be=0}return v==="desc"?-Be:Be}),ge},[ae,h,v,le,H]),F=p.useMemo(()=>{const ge=y*N;return I.slice(ge,ge+N)},[I,y,N]),K=Math.ceil(I.length/N),ne=ge=>new Date(ge).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),X=ge=>{h===ge?g(v==="asc"?"desc":"asc"):(m(ge),g("desc"))},ue=ge=>h!==ge?i.jsx(E3,{className:"size-3.5 text-muted-foreground/50"}):v==="asc"?i.jsx(Iu,{className:"size-3.5"}):i.jsx(vn,{className:"size-3.5"}),te=p.useCallback(ge=>{const Fe=le(ge);O({_id:ge._id,title:Fe}),V(null),R(!0)},[le]),ye=p.useCallback(async()=>{if(T){z(!0),V(null);try{await M({id:T._id,hardDelete:!1}),R(!1),O(null)}catch(ge){const Fe=ge instanceof Error?ge.message:"Failed to delete entry";V(Fe)}finally{z(!1)}}},[T,M]),Ce=p.useCallback(ge=>{!ge&&!D&&(R(!1),O(null),V(null))},[D]),_e=p.useCallback(()=>{l(""),d(""),r("all"),j([]),w(0)},[]);if(Y===void 0||G===void 0)return i.jsx("div",{className:"space-y-6 p-6",children:i.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[i.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),i.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading entries..."})]})});if(Y===null)return i.jsx("div",{className:"space-y-6 p-6",children:i.jsx(Bn,{icon:i.jsx(Sr,{className:"size-6"}),title:"Content Type Not Found",description:"The content type you're looking for doesn't exist or has been deleted.",action:{label:"Back to Content Types",onClick:()=>t({to:"/content-types"})}})});const Re=o||n!=="all"||S.length>0;return i.jsxs("div",{className:"space-y-6 p-6",children:[i.jsx(as,{title:Y.displayName,description:Y.description,actions:C("contentEntries")&&i.jsx(me,{asChild:!0,children:i.jsxs(Ss,{to:"/entries/new/$contentTypeId",params:{contentTypeId:e},children:[i.jsx(Un,{className:"size-4"}),"Create ",Y.displayName]})})}),i.jsx(XY,{left:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"relative",children:[i.jsx(Al,{className:"absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),i.jsx(mt,{type:"search",placeholder:"Search entries...",value:o,onChange:ge=>l(ge.target.value),className:"w-64 pl-9"})]}),i.jsxs(ia,{value:n,onValueChange:ge=>{r(ge),w(0)},children:[i.jsx(ca,{className:"w-36",children:i.jsx(la,{placeholder:"All Statuses"})}),i.jsxs(ua,{children:[i.jsx(Xt,{value:"all",children:"All Statuses"}),i.jsx(Xt,{value:"draft",children:"Draft"}),i.jsx(Xt,{value:"published",children:"Published"}),i.jsx(Xt,{value:"scheduled",children:"Scheduled"}),i.jsx(Xt,{value:"archived",children:"Archived"})]})]}),i.jsx(UT,{selectedTermIds:S,onChange:ge=>{j(ge),w(0)},placeholder:"Tags"})]}),right:i.jsxs("span",{className:"text-sm text-muted-foreground",children:[I.length," ",I.length===1?"entry":"entries"]})}),I.length===0?i.jsx(Bn,{icon:i.jsx(Sr,{className:"size-6"}),title:Re?"No matching entries":`No ${Y.displayName} entries yet`,description:Re?"Try adjusting your search or filter criteria.":`Click "Create ${Y.displayName}" to add your first entry.`,action:Re?{label:"Clear Filters",onClick:_e,variant:"secondary"}:void 0}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"rounded-lg border bg-card",children:i.jsxs("table",{className:"w-full",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b",children:[i.jsx("th",{className:"p-3 text-left",children:i.jsxs("button",{className:"flex items-center gap-1.5 text-sm font-medium text-muted-foreground hover:text-foreground",onClick:()=>X("title"),children:["Title",ue("title")]})}),i.jsx("th",{className:"p-3 text-left",children:i.jsxs("button",{className:"flex items-center gap-1.5 text-sm font-medium text-muted-foreground hover:text-foreground",onClick:()=>X("status"),children:["Status",ue("status")]})}),i.jsx("th",{className:"p-3 text-left",children:i.jsxs("button",{className:"flex items-center gap-1.5 text-sm font-medium text-muted-foreground hover:text-foreground",onClick:()=>X("updatedAt"),children:["Updated",ue("updatedAt")]})}),i.jsx("th",{className:"p-3 text-left text-sm font-medium text-muted-foreground",children:"Actions"})]})}),i.jsx("tbody",{children:F.map(ge=>i.jsxs("tr",{className:"border-b last:border-0 transition-colors hover:bg-muted/50",children:[i.jsxs("td",{className:"p-3",children:[i.jsx(Ss,{to:"/entries/$entryId",params:{entryId:ge._id},className:"font-medium text-foreground hover:text-primary hover:underline",children:le(ge)}),i.jsx("p",{className:"text-xs text-muted-foreground",children:ge.slug})]}),i.jsx("td",{className:"p-3",children:i.jsx(Vl,{status:ge.status})}),i.jsx("td",{className:"p-3 text-sm text-muted-foreground",children:ne(ge.lastPublishedAt??ge._creationTime)}),i.jsx("td",{className:"p-3",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(me,{variant:"outline",size:"sm",asChild:!0,children:i.jsx(Ss,{to:"/entries/$entryId",params:{entryId:ge._id},children:_("contentEntries")?"Edit":"View"})}),E("contentEntries")&&i.jsx(me,{variant:"danger",size:"sm",onClick:()=>te(ge),"data-testid":`delete-entry-${ge._id}`,children:"Delete"})]})})]},ge._id))})]})}),K>1&&i.jsxs("div",{className:"flex items-center justify-center gap-2",children:[i.jsx(me,{variant:"outline",size:"sm",onClick:()=>w(0),disabled:y===0,children:"First"}),i.jsx(me,{variant:"outline",size:"sm",onClick:()=>w(ge=>Math.max(0,ge-1)),disabled:y===0,children:"Previous"}),i.jsxs("span",{className:"px-3 text-sm text-muted-foreground",children:["Page ",y+1," of ",K]}),i.jsx(me,{variant:"outline",size:"sm",onClick:()=>w(ge=>Math.min(K-1,ge+1)),disabled:y>=K-1,children:"Next"}),i.jsx(me,{variant:"outline",size:"sm",onClick:()=>w(K-1),disabled:y>=K-1,children:"Last"})]})]}),I.length>0&&i.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["Showing ",F.length," of"," ",I.length," ",I.length===1?"entry":"entries"]}),i.jsx(oa,{open:A,onOpenChange:Ce,title:"Delete Entry",description:T?`Are you sure you want to delete "${T.title}"? It will be moved to the trash and can be restored within the retention period.`:"Are you sure you want to delete this entry?",confirmLabel:"Delete",variant:"danger",onConfirm:ye,isLoading:D,error:B})]})}const cee=os({getParentRoute:()=>cs,path:"/entries/type/$contentTypeId",component:lee}),uee=cs.addChildren([KJ,XJ,JJ,eee,tee,nee,ree,aee,iee,cee]),dee=u3({routeTree:uee,defaultPreload:"intent"}),mN=()=>({id:"mock_user_123",name:"Demo Admin",email:"admin@example.com"}),pN=()=>"admin",gN=()=>{console.log("Logout called (mock mode)")},fee=()=>null,hee=()=>null,mee=()=>{};function pee(e){switch(e){case"mock":case"demo":return{getUser:mN,getUserRole:pN,onLogout:gN};case"none":case"disabled":return{getUser:fee,getUserRole:hee,onLogout:mee};default:return{getUser:mN,getUserRole:pN,onLogout:gN}}}function gee(){const e=qY(),t=p.useMemo(()=>pee(e.authMode),[e.authMode]),n=p.useMemo(()=>dB(e.adminConfig),[e.adminConfig]);return i.jsx(CL,{children:i.jsx(gB,{children:i.jsx(vee,{convexUrl:e.convexUrl,adminConfig:n,children:i.jsx(jL,{getUser:t.getUser,getUserRole:t.getUserRole,onLogout:t.onLogout,children:i.jsx(Mh,{children:i.jsx(h3,{router:dee})})})})})})}function vee({children:e,convexUrl:t,adminConfig:n}){const r=p.useMemo(()=>t?new xz(t):null,[t]);return r?i.jsx(bz,{client:r,children:i.jsx(xB,{api:Cn,children:i.jsx(pB,{baseConfig:n,api:{getSettings:Cn.getSettings},children:e})})}):i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-6",children:i.jsxs("div",{className:"diff-modified max-w-lg space-y-4 rounded-lg border p-6 text-center",children:[i.jsx("h2",{className:"text-xl font-semibold text-diff-modified",children:"Convex Configuration Required"}),i.jsx("p",{className:"text-sm text-diff-modified-foreground",children:"Please provide a Convex deployment URL to connect to your backend."}),i.jsxs("div",{className:"space-y-2 text-left text-sm text-diff-modified-foreground",children:[i.jsx("p",{className:"font-medium",children:"Options:"}),i.jsxs("ul",{className:"list-inside list-disc space-y-1",children:[i.jsxs("li",{children:["Run with URL:"," ",i.jsx("code",{className:"rounded bg-diff-modified-bg/50 px-1",children:"npx convex-cms admin --url YOUR_URL"})]}),i.jsxs("li",{children:["Set environment variable:"," ",i.jsx("code",{className:"rounded bg-diff-modified-bg/50 px-1",children:"CONVEX_URL=YOUR_URL"})]})]})]})]})})}XO.createRoot(document.getElementById("root")).render(i.jsx(p.StrictMode,{children:i.jsx(gee,{})}));