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
@@ -0,0 +1,104 @@
1
+ function CO(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in e)){const l=Object.getOwnPropertyDescriptor(s,o);l&&Object.defineProperty(e,o,l.get?l:{enumerable:!0,get:()=>s[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"]'))s(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"&&s(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 s(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();function eN(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tg={exports:{}},zc={};var l1;function NO(){if(l1)return zc;l1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,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:s,key:u,ref:o!==void 0?o:null,props:l}}return zc.Fragment=t,zc.jsx=n,zc.jsxs=n,zc}var c1;function kO(){return c1||(c1=1,Tg.exports=NO()),Tg.exports}var i=kO(),Mg={exports:{}},Ge={};var u1;function _O(){if(u1)return Ge;u1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=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 q(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?q(""+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 Ge.Activity=g,Ge.Children=le,Ge.Component=C,Ge.Fragment=n,Ge.Profiler=o,Ge.PureComponent=E,Ge.StrictMode=s,Ge.Suspense=h,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(I){return T.H.useMemoCache(I)}},Ge.cache=function(I){return function(){return I.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.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)},Ge.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},Ge.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)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(I){return{$$typeof:d,render:I}},Ge.isValidElement=B,Ge.lazy=function(I){return{$$typeof:v,_payload:{_status:-1,_result:I},_init:U}},Ge.memo=function(I,F){return{$$typeof:m,type:I,compare:F===void 0?null:F}},Ge.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}},Ge.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},Ge.use=function(I){return T.H.use(I)},Ge.useActionState=function(I,F,K){return T.H.useActionState(I,F,K)},Ge.useCallback=function(I,F){return T.H.useCallback(I,F)},Ge.useContext=function(I){return T.H.useContext(I)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(I,F){return T.H.useDeferredValue(I,F)},Ge.useEffect=function(I,F){return T.H.useEffect(I,F)},Ge.useEffectEvent=function(I){return T.H.useEffectEvent(I)},Ge.useId=function(){return T.H.useId()},Ge.useImperativeHandle=function(I,F,K){return T.H.useImperativeHandle(I,F,K)},Ge.useInsertionEffect=function(I,F){return T.H.useInsertionEffect(I,F)},Ge.useLayoutEffect=function(I,F){return T.H.useLayoutEffect(I,F)},Ge.useMemo=function(I,F){return T.H.useMemo(I,F)},Ge.useOptimistic=function(I,F){return T.H.useOptimistic(I,F)},Ge.useReducer=function(I,F,K){return T.H.useReducer(I,F,K)},Ge.useRef=function(I){return T.H.useRef(I)},Ge.useState=function(I){return T.H.useState(I)},Ge.useSyncExternalStore=function(I,F,K){return T.H.useSyncExternalStore(I,F,K)},Ge.useTransition=function(){return T.H.useTransition()},Ge.version="19.2.4",Ge}var d1;function Du(){return d1||(d1=1,Mg.exports=_O()),Mg.exports}var p=Du();const ee=eN(p),Sx=CO({__proto__:null,default:ee},[p]);var Rg={exports:{}},Pc={},Ag={exports:{}},Og={};var f1;function EO(){return f1||(f1=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 s(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)s(m);else if($.startTime<=L)s(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,q());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)&&s(h),M(L)}else s(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{$?q():R=!1}}}var q;if(typeof E=="function")q=function(){E(B)};else if(typeof MessageChannel<"u"){var Y=new MessageChannel,G=Y.port2;Y.port1.onmessage=B,q=function(){G.postMessage(null)}}else q=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,q()))),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}}}})(Og)),Og}var h1;function TO(){return h1||(h1=1,Ag.exports=EO()),Ag.exports}var Dg={exports:{}},An={};var m1;function MO(){if(m1)return An;m1=1;var e=Du();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 s={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=s,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=s.p;try{if(u.T=null,s.p=2,h)return h()}finally{u.T=m,s.p=v,s.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,s.d.C(h,m))},An.prefetchDNS=function(h){typeof h=="string"&&s.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"?s.d.S(h,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:y,fetchPriority:w}):v==="script"&&s.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);s.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&&s.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);s.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);s.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 s.d.m(h)},An.requestFormReset=function(h){s.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 p1;function tN(){if(p1)return Dg.exports;p1=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(),Dg.exports=MO(),Dg.exports}var g1;function RO(){if(g1)return Pc;g1=1;var e=TO(),t=Du(),n=tN();function s(r){var a="https://react.dev/errors/"+r;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 #"+r+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function l(r){var a=r,c=r;if(r.alternate)for(;a.return;)a=a.return;else{r=a;do a=r,(a.flags&4098)!==0&&(c=a.return),r=a.return;while(r)}return a.tag===3?c:null}function u(r){if(r.tag===13){var a=r.memoizedState;if(a===null&&(r=r.alternate,r!==null&&(a=r.memoizedState)),a!==null)return a.dehydrated}return null}function d(r){if(r.tag===31){var a=r.memoizedState;if(a===null&&(r=r.alternate,r!==null&&(a=r.memoizedState)),a!==null)return a.dehydrated}return null}function h(r){if(l(r)!==r)throw Error(s(188))}function m(r){var a=r.alternate;if(!a){if(a=l(r),a===null)throw Error(s(188));return a!==r?null:r}for(var c=r,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),r;if(b===f)return h(x),a;b=b.sibling}throw Error(s(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(s(189))}}if(c.alternate!==f)throw Error(s(190))}if(c.tag!==3)throw Error(s(188));return c.stateNode.current===c?r:a}function v(r){var a=r.tag;if(a===5||a===26||a===27||a===6)return r;for(r=r.child;r!==null;){if(a=v(r),a!==null)return a;r=r.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 q(r){return r===null||typeof r!="object"?null:(r=B&&r[B]||r["@@iterator"],typeof r=="function"?r:null)}var Y=Symbol.for("react.client.reference");function G(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===Y?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){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 r=="object")switch(r.$$typeof){case S:return"Portal";case E:return r.displayName||"Context";case _:return(r._context.displayName||"Context")+".Consumer";case M:var a=r.render;return r=r.displayName,r||(r=a.displayName||a.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case T:return a=r.displayName||null,a!==null?a:G(r.type)||"Memo";case O:a=r._payload,r=r._init;try{return G(r(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(r){return{current:r}}function F(r){0>le||(r.current=H[le],H[le]=null,le--)}function K(r,a){le++,H[le]=r.current,r.current=a}var ne=I(null),X=I(null),ue=I(null),te=I(null);function ye(r,a){switch(K(ue,a),K(X,r),K(ne,null),a.nodeType){case 9:case 11:r=(r=a.documentElement)&&(r=r.namespaceURI)?RS(r):0;break;default:if(r=a.tagName,a=a.namespaceURI)a=RS(a),r=AS(a,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}F(ne),K(ne,r)}function Ce(){F(ne),F(X),F(ue)}function _e(r){r.memoizedState!==null&&K(te,r);var a=ne.current,c=AS(a,r.type);a!==c&&(K(X,r),K(ne,c))}function Re(r){X.current===r&&(F(ne),F(X)),te.current===r&&(F(te),Rc._currentValue=U)}var ge,Be;function be(r){if(ge===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);ge=a&&a[1]||"",Be=-1<c.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+ge+r+Be}var Ue=!1;function rt(r,a){if(!r||Ue)return"";Ue=!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(r,[],he)}else{try{he.call()}catch(ie){oe=ie}r.call(he.prototype)}}else{try{throw Error()}catch(ie){oe=ie}(he=r())&&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 V=k.split(`
4
+ `),se=P.split(`
5
+ `);for(x=f=0;f<V.length&&!V[f].includes("DetermineComponentFrameRoot");)f++;for(;x<se.length&&!se[x].includes("DetermineComponentFrameRoot");)x++;if(f===V.length||x===se.length)for(f=V.length-1,x=se.length-1;1<=f&&0<=x&&V[f]!==se[x];)x--;for(;1<=f&&0<=x;f--,x--)if(V[f]!==se[x]){if(f!==1||x!==1)do if(f--,x--,0>x||V[f]!==se[x]){var ce=`
6
+ `+V[f].replace(" at new "," at ");return r.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",r.displayName)),ce}while(1<=f&&0<=x);break}}}finally{Ue=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?be(c):""}function it(r,a){switch(r.tag){case 26:case 27:case 5:return be(r.type);case 16:return be("Lazy");case 13:return r.child!==a&&a!==null?be("Suspense Fallback"):be("Suspense");case 19:return be("SuspenseList");case 0:case 15:return rt(r.type,!1);case 11:return rt(r.type.render,!1);case 1:return rt(r.type,!0);case 31:return be("Activity");default:return""}}function bt(r){try{var a="",c=null;do a+=it(r,c),c=r,r=r.return;while(r);return a}catch(f){return`
7
+ Error generating stack: `+f.message+`
8
+ `+f.stack}}var pe=Object.prototype.hasOwnProperty,Le=e.unstable_scheduleCallback,We=e.unstable_cancelCallback,Oe=e.unstable_shouldYield,ft=e.unstable_requestPaint,ut=e.unstable_now,Mn=e.unstable_getCurrentPriorityLevel,Xe=e.unstable_ImmediatePriority,wt=e.unstable_UserBlockingPriority,gt=e.unstable_NormalPriority,qn=e.unstable_LowPriority,ir=e.unstable_IdlePriority,Yr=e.log,zn=e.unstable_setDisableYieldValue,Pn=null,Vt=null;function en(r){if(typeof Yr=="function"&&zn(r),Vt&&typeof Vt.setStrictMode=="function")try{Vt.setStrictMode(Pn,r)}catch{}}var $t=Math.clz32?Math.clz32:xe,ds=Math.log,Wr=Math.LN2;function xe(r){return r>>>=0,r===0?32:31-(ds(r)/Wr|0)|0}var ke=256,we=262144,Ne=4194304;function He(r){var a=r&42;if(a!==0)return a;switch(r&-r){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 r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function De(r,a,c){var f=r.pendingLanes;if(f===0)return 0;var x=0,b=r.suspendedLanes,k=r.pingedLanes;r=r.warmLanes;var P=f&134217727;return P!==0?(f=P&~b,f!==0?x=He(f):(k&=P,k!==0?x=He(k):c||(c=P&~r,c!==0&&(x=He(c))))):(P=f&~b,P!==0?x=He(P):k!==0?x=He(k):c||(c=f&~r,c!==0&&(x=He(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 St(r,a){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&a)===0}function bn(r,a){switch(r){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 r=Ne;return Ne<<=1,(Ne&62914560)===0&&(Ne=4194304),r}function Gt(r){for(var a=[],c=0;31>c;c++)a.push(r);return a}function Ot(r,a){r.pendingLanes|=a,a!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Rn(r,a,c,f,x,b){var k=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var P=r.entanglements,V=r.expirationTimes,se=r.hiddenUpdates;for(c=k&~c;0<c;){var ce=31-$t(c),he=1<<ce;P[ce]=0,V[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(r,f,0),b!==0&&x===0&&r.tag!==0&&(r.suspendedLanes|=b&~(k&~a))}function Hn(r,a,c){r.pendingLanes|=a,r.suspendedLanes&=~a;var f=31-$t(a);r.entangledLanes|=a,r.entanglements[f]=r.entanglements[f]|1073741824|c&261930}function wn(r,a){var c=r.entangledLanes|=a;for(r=r.entanglements;c;){var f=31-$t(c),x=1<<f;x&a|r[f]&a&&(r[f]|=a),c&=~x}}function Q(r,a){var c=a&-a;return c=(c&42)!==0?1:je(c),(c&(r.suspendedLanes|a))!==0?0:c}function je(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Ve(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function vt(){var r=$.p;return r!==0?r:(r=window.event,r===void 0?32:t1(r.type))}function Je(r,a){var c=$.p;try{return $.p=r,a()}finally{$.p=c}}var Yn=Math.random().toString(36).slice(2),Zt="__reactFiber$"+Yn,Wn="__reactProps$"+Yn,ei="__reactContainer$"+Yn,bm="__reactEvents$"+Yn,hR="__reactListeners$"+Yn,mR="__reactHandles$"+Yn,xb="__reactResources$"+Yn,Yl="__reactMarker$"+Yn;function wm(r){delete r[Zt],delete r[Wn],delete r[bm],delete r[hR],delete r[mR]}function ti(r){var a=r[Zt];if(a)return a;for(var c=r.parentNode;c;){if(a=c[ei]||c[Zt]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(r=$S(r);r!==null;){if(c=r[Zt])return c;r=$S(r)}return a}r=c,c=r.parentNode}return null}function ni(r){if(r=r[Zt]||r[ei]){var a=r.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return r}return null}function Wl(r){var a=r.tag;if(a===5||a===26||a===27||a===6)return r.stateNode;throw Error(s(33))}function ri(r){var a=r[xb];return a||(a=r[xb]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Sn(r){r[Yl]=!0}var yb=new Set,bb={};function ao(r,a){si(r,a),si(r+"Capture",a)}function si(r,a){for(bb[r]=a,r=0;r<a.length;r++)yb.add(a[r])}var pR=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]*$"),wb={},Sb={};function gR(r){return pe.call(Sb,r)?!0:pe.call(wb,r)?!1:pR.test(r)?Sb[r]=!0:(wb[r]=!0,!1)}function rd(r,a,c){if(gR(a))if(c===null)r.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":r.removeAttribute(a);return;case"boolean":var f=a.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){r.removeAttribute(a);return}}r.setAttribute(a,""+c)}}function sd(r,a,c){if(c===null)r.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(a);return}r.setAttribute(a,""+c)}}function Os(r,a,c,f){if(f===null)r.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttributeNS(a,c,""+f)}}function kr(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function jb(r){var a=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function vR(r,a,c){var f=Object.getOwnPropertyDescriptor(r.constructor.prototype,a);if(!r.hasOwnProperty(a)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var x=f.get,b=f.set;return Object.defineProperty(r,a,{configurable:!0,get:function(){return x.call(this)},set:function(k){c=""+k,b.call(this,k)}}),Object.defineProperty(r,a,{enumerable:f.enumerable}),{getValue:function(){return c},setValue:function(k){c=""+k},stopTracking:function(){r._valueTracker=null,delete r[a]}}}}function Sm(r){if(!r._valueTracker){var a=jb(r)?"checked":"value";r._valueTracker=vR(r,a,""+r[a])}}function Cb(r){if(!r)return!1;var a=r._valueTracker;if(!a)return!0;var c=a.getValue(),f="";return r&&(f=jb(r)?r.checked?"true":"false":r.value),r=f,r!==c?(a.setValue(r),!0):!1}function ad(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var xR=/[\n"\\]/g;function _r(r){return r.replace(xR,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function jm(r,a,c,f,x,b,k,P){r.name="",k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?r.type=k:r.removeAttribute("type"),a!=null?k==="number"?(a===0&&r.value===""||r.value!=a)&&(r.value=""+kr(a)):r.value!==""+kr(a)&&(r.value=""+kr(a)):k!=="submit"&&k!=="reset"||r.removeAttribute("value"),a!=null?Cm(r,k,kr(a)):c!=null?Cm(r,k,kr(c)):f!=null&&r.removeAttribute("value"),x==null&&b!=null&&(r.defaultChecked=!!b),x!=null&&(r.checked=x&&typeof x!="function"&&typeof x!="symbol"),P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?r.name=""+kr(P):r.removeAttribute("name")}function Nb(r,a,c,f,x,b,k,P){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(r.type=b),a!=null||c!=null){if(!(b!=="submit"&&b!=="reset"||a!=null)){Sm(r);return}c=c!=null?""+kr(c):"",a=a!=null?""+kr(a):c,P||a===r.value||(r.value=a),r.defaultValue=a}f=f??x,f=typeof f!="function"&&typeof f!="symbol"&&!!f,r.checked=P?r.checked:!!f,r.defaultChecked=!!f,k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(r.name=k),Sm(r)}function Cm(r,a,c){a==="number"&&ad(r.ownerDocument)===r||r.defaultValue===""+c||(r.defaultValue=""+c)}function ai(r,a,c,f){if(r=r.options,a){a={};for(var x=0;x<c.length;x++)a["$"+c[x]]=!0;for(c=0;c<r.length;c++)x=a.hasOwnProperty("$"+r[c].value),r[c].selected!==x&&(r[c].selected=x),x&&f&&(r[c].defaultSelected=!0)}else{for(c=""+kr(c),a=null,x=0;x<r.length;x++){if(r[x].value===c){r[x].selected=!0,f&&(r[x].defaultSelected=!0);return}a!==null||r[x].disabled||(a=r[x])}a!==null&&(a.selected=!0)}}function kb(r,a,c){if(a!=null&&(a=""+kr(a),a!==r.value&&(r.value=a),c==null)){r.defaultValue!==a&&(r.defaultValue=a);return}r.defaultValue=c!=null?""+kr(c):""}function _b(r,a,c,f){if(a==null){if(f!=null){if(c!=null)throw Error(s(92));if(ae(f)){if(1<f.length)throw Error(s(93));f=f[0]}c=f}c==null&&(c=""),a=c}c=kr(a),r.defaultValue=c,f=r.textContent,f===c&&f!==""&&f!==null&&(r.value=f),Sm(r)}function oi(r,a){if(a){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=a;return}}r.textContent=a}var yR=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 Eb(r,a,c){var f=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?f?r.setProperty(a,""):a==="float"?r.cssFloat="":r[a]="":f?r.setProperty(a,c):typeof c!="number"||c===0||yR.has(a)?a==="float"?r.cssFloat=c:r[a]=(""+c).trim():r[a]=c+"px"}function Tb(r,a,c){if(a!=null&&typeof a!="object")throw Error(s(62));if(r=r.style,c!=null){for(var f in c)!c.hasOwnProperty(f)||a!=null&&a.hasOwnProperty(f)||(f.indexOf("--")===0?r.setProperty(f,""):f==="float"?r.cssFloat="":r[f]="");for(var x in a)f=a[x],a.hasOwnProperty(x)&&c[x]!==f&&Eb(r,x,f)}else for(var b in a)a.hasOwnProperty(b)&&Eb(r,b,a[b])}function Nm(r){if(r.indexOf("-")===-1)return!1;switch(r){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 bR=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"]]),wR=/^[\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 od(r){return wR.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Ds(){}var km=null;function _m(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var ii=null,li=null;function Mb(r){var a=ni(r);if(a&&(r=a.stateNode)){var c=r[Wn]||null;e:switch(r=a.stateNode,a.type){case"input":if(jm(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+_r(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var f=c[a];if(f!==r&&f.form===r.form){var x=f[Wn]||null;if(!x)throw Error(s(90));jm(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===r.form&&Cb(f)}break e;case"textarea":kb(r,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&ai(r,!!c.multiple,a,!1)}}}var Em=!1;function Rb(r,a,c){if(Em)return r(a,c);Em=!0;try{var f=r(a);return f}finally{if(Em=!1,(ii!==null||li!==null)&&(Wd(),ii&&(a=ii,r=li,li=ii=null,Mb(a),r)))for(a=0;a<r.length;a++)Mb(r[a])}}function Gl(r,a){var c=r.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)||(r=r.type,f=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!f;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(s(231,a,typeof c));return c}var zs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Tm=!1;if(zs)try{var Zl={};Object.defineProperty(Zl,"passive",{get:function(){Tm=!0}}),window.addEventListener("test",Zl,Zl),window.removeEventListener("test",Zl,Zl)}catch{Tm=!1}var ma=null,Mm=null,id=null;function Ab(){if(id)return id;var r,a=Mm,c=a.length,f,x="value"in ma?ma.value:ma.textContent,b=x.length;for(r=0;r<c&&a[r]===x[r];r++);var k=c-r;for(f=1;f<=k&&a[c-f]===x[b-f];f++);return id=x.slice(r,1<f?1-f:void 0)}function ld(r){var a=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&a===13&&(r=13)):r=a,r===10&&(r=13),32<=r||r===13?r:0}function cd(){return!0}function Ob(){return!1}function Gn(r){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 r)r.hasOwnProperty(P)&&(c=r[P],this[P]=c?c(b):b[P]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?cd:Ob,this.isPropagationStopped=Ob,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=cd)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=cd)},persist:function(){},isPersistent:cd}),a}var oo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ud=Gn(oo),Ql=g({},oo,{view:0,detail:0}),SR=Gn(Ql),Rm,Am,Kl,dd=g({},Ql,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Dm,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Kl&&(Kl&&r.type==="mousemove"?(Rm=r.screenX-Kl.screenX,Am=r.screenY-Kl.screenY):Am=Rm=0,Kl=r),Rm)},movementY:function(r){return"movementY"in r?r.movementY:Am}}),Db=Gn(dd),jR=g({},dd,{dataTransfer:0}),CR=Gn(jR),NR=g({},Ql,{relatedTarget:0}),Om=Gn(NR),kR=g({},oo,{animationName:0,elapsedTime:0,pseudoElement:0}),_R=Gn(kR),ER=g({},oo,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),TR=Gn(ER),MR=g({},oo,{data:0}),zb=Gn(MR),RR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},AR={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"},OR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function DR(r){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(r):(r=OR[r])?!!a[r]:!1}function Dm(){return DR}var zR=g({},Ql,{key:function(r){if(r.key){var a=RR[r.key]||r.key;if(a!=="Unidentified")return a}return r.type==="keypress"?(r=ld(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?AR[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Dm,charCode:function(r){return r.type==="keypress"?ld(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?ld(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),PR=Gn(zR),LR=g({},dd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Pb=Gn(LR),IR=g({},Ql,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Dm}),$R=Gn(IR),FR=g({},oo,{propertyName:0,elapsedTime:0,pseudoElement:0}),BR=Gn(FR),UR=g({},dd,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),VR=Gn(UR),qR=g({},oo,{newState:0,oldState:0}),HR=Gn(qR),YR=[9,13,27,32],zm=zs&&"CompositionEvent"in window,Xl=null;zs&&"documentMode"in document&&(Xl=document.documentMode);var WR=zs&&"TextEvent"in window&&!Xl,Lb=zs&&(!zm||Xl&&8<Xl&&11>=Xl),Ib=" ",$b=!1;function Fb(r,a){switch(r){case"keyup":return YR.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bb(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var ci=!1;function GR(r,a){switch(r){case"compositionend":return Bb(a);case"keypress":return a.which!==32?null:($b=!0,Ib);case"textInput":return r=a.data,r===Ib&&$b?null:r;default:return null}}function ZR(r,a){if(ci)return r==="compositionend"||!zm&&Fb(r,a)?(r=Ab(),id=Mm=ma=null,ci=!1,r):null;switch(r){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 Lb&&a.locale!=="ko"?null:a.data;default:return null}}var QR={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 Ub(r){var a=r&&r.nodeName&&r.nodeName.toLowerCase();return a==="input"?!!QR[r.type]:a==="textarea"}function Vb(r,a,c,f){ii?li?li.push(f):li=[f]:ii=f,a=ef(a,"onChange"),0<a.length&&(c=new ud("onChange","change",null,c,f),r.push({event:c,listeners:a}))}var Jl=null,ec=null;function KR(r){NS(r,0)}function fd(r){var a=Wl(r);if(Cb(a))return r}function qb(r,a){if(r==="change")return a}var Hb=!1;if(zs){var Pm;if(zs){var Lm="oninput"in document;if(!Lm){var Yb=document.createElement("div");Yb.setAttribute("oninput","return;"),Lm=typeof Yb.oninput=="function"}Pm=Lm}else Pm=!1;Hb=Pm&&(!document.documentMode||9<document.documentMode)}function Wb(){Jl&&(Jl.detachEvent("onpropertychange",Gb),ec=Jl=null)}function Gb(r){if(r.propertyName==="value"&&fd(ec)){var a=[];Vb(a,ec,r,_m(r)),Rb(KR,a)}}function XR(r,a,c){r==="focusin"?(Wb(),Jl=a,ec=c,Jl.attachEvent("onpropertychange",Gb)):r==="focusout"&&Wb()}function JR(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return fd(ec)}function eA(r,a){if(r==="click")return fd(a)}function tA(r,a){if(r==="input"||r==="change")return fd(a)}function nA(r,a){return r===a&&(r!==0||1/r===1/a)||r!==r&&a!==a}var lr=typeof Object.is=="function"?Object.is:nA;function tc(r,a){if(lr(r,a))return!0;if(typeof r!="object"||r===null||typeof a!="object"||a===null)return!1;var c=Object.keys(r),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)||!lr(r[x],a[x]))return!1}return!0}function Zb(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Qb(r,a){var c=Zb(r);r=0;for(var f;c;){if(c.nodeType===3){if(f=r+c.textContent.length,r<=a&&f>=a)return{node:c,offset:a-r};r=f}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Zb(c)}}function Kb(r,a){return r&&a?r===a?!0:r&&r.nodeType===3?!1:a&&a.nodeType===3?Kb(r,a.parentNode):"contains"in r?r.contains(a):r.compareDocumentPosition?!!(r.compareDocumentPosition(a)&16):!1:!1}function Xb(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var a=ad(r.document);a instanceof r.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)r=a.contentWindow;else break;a=ad(r.document)}return a}function Im(r){var a=r&&r.nodeName&&r.nodeName.toLowerCase();return a&&(a==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||a==="textarea"||r.contentEditable==="true")}var rA=zs&&"documentMode"in document&&11>=document.documentMode,ui=null,$m=null,nc=null,Fm=!1;function Jb(r,a,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Fm||ui==null||ui!==ad(f)||(f=ui,"selectionStart"in f&&Im(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=ef($m,"onSelect"),0<f.length&&(a=new ud("onSelect","select",null,a,c),r.push({event:a,listeners:f}),a.target=ui)))}function io(r,a){var c={};return c[r.toLowerCase()]=a.toLowerCase(),c["Webkit"+r]="webkit"+a,c["Moz"+r]="moz"+a,c}var di={animationend:io("Animation","AnimationEnd"),animationiteration:io("Animation","AnimationIteration"),animationstart:io("Animation","AnimationStart"),transitionrun:io("Transition","TransitionRun"),transitionstart:io("Transition","TransitionStart"),transitioncancel:io("Transition","TransitionCancel"),transitionend:io("Transition","TransitionEnd")},Bm={},e0={};zs&&(e0=document.createElement("div").style,"AnimationEvent"in window||(delete di.animationend.animation,delete di.animationiteration.animation,delete di.animationstart.animation),"TransitionEvent"in window||delete di.transitionend.transition);function lo(r){if(Bm[r])return Bm[r];if(!di[r])return r;var a=di[r],c;for(c in a)if(a.hasOwnProperty(c)&&c in e0)return Bm[r]=a[c];return r}var t0=lo("animationend"),n0=lo("animationiteration"),r0=lo("animationstart"),sA=lo("transitionrun"),aA=lo("transitionstart"),oA=lo("transitioncancel"),s0=lo("transitionend"),a0=new Map,Um="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(" ");Um.push("scrollEnd");function Gr(r,a){a0.set(r,a),ao(a,[r])}var hd=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Er=[],fi=0,Vm=0;function md(){for(var r=fi,a=Vm=fi=0;a<r;){var c=Er[a];Er[a++]=null;var f=Er[a];Er[a++]=null;var x=Er[a];Er[a++]=null;var b=Er[a];if(Er[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&&o0(c,x,b)}}function pd(r,a,c,f){Er[fi++]=r,Er[fi++]=a,Er[fi++]=c,Er[fi++]=f,Vm|=f,r.lanes|=f,r=r.alternate,r!==null&&(r.lanes|=f)}function qm(r,a,c,f){return pd(r,a,c,f),gd(r)}function co(r,a){return pd(r,null,null,a),gd(r)}function o0(r,a,c){r.lanes|=c;var f=r.alternate;f!==null&&(f.lanes|=c);for(var x=!1,b=r.return;b!==null;)b.childLanes|=c,f=b.alternate,f!==null&&(f.childLanes|=c),b.tag===22&&(r=b.stateNode,r===null||r._visibility&1||(x=!0)),r=b,b=b.return;return r.tag===3?(b=r.stateNode,x&&a!==null&&(x=31-$t(c),r=b.hiddenUpdates,f=r[x],f===null?r[x]=[a]:f.push(a),a.lane=c|536870912),b):null}function gd(r){if(50<Cc)throw Cc=0,Jp=null,Error(s(185));for(var a=r.return;a!==null;)r=a,a=r.return;return r.tag===3?r.stateNode:null}var hi={};function iA(r,a,c,f){this.tag=r,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 cr(r,a,c,f){return new iA(r,a,c,f)}function Hm(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ps(r,a){var c=r.alternate;return c===null?(c=cr(r.tag,a,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=a,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&65011712,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,a=r.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function i0(r,a){r.flags&=65011714;var c=r.alternate;return c===null?(r.childLanes=0,r.lanes=a,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,a=c.dependencies,r.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),r}function vd(r,a,c,f,x,b){var k=0;if(f=r,typeof r=="function")Hm(r)&&(k=1);else if(typeof r=="string")k=fO(r,c,ne.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case D:return r=cr(31,c,a,x),r.elementType=D,r.lanes=b,r;case j:return uo(c.children,x,b,a);case N:k=8,x|=24;break;case C:return r=cr(12,c,a,x|2),r.elementType=C,r.lanes=b,r;case A:return r=cr(13,c,a,x),r.elementType=A,r.lanes=b,r;case R:return r=cr(19,c,a,x),r.elementType=R,r.lanes=b,r;default:if(typeof r=="object"&&r!==null)switch(r.$$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(s(130,r===null?"null":typeof r,"")),f=null}return a=cr(k,c,a,x),a.elementType=r,a.type=f,a.lanes=b,a}function uo(r,a,c,f){return r=cr(7,r,f,a),r.lanes=c,r}function Ym(r,a,c){return r=cr(6,r,null,a),r.lanes=c,r}function l0(r){var a=cr(18,null,null,0);return a.stateNode=r,a}function Wm(r,a,c){return a=cr(4,r.children!==null?r.children:[],r.key,a),a.lanes=c,a.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},a}var c0=new WeakMap;function Tr(r,a){if(typeof r=="object"&&r!==null){var c=c0.get(r);return c!==void 0?c:(a={value:r,source:a,stack:bt(a)},c0.set(r,a),a)}return{value:r,source:a,stack:bt(a)}}var mi=[],pi=0,xd=null,rc=0,Mr=[],Rr=0,pa=null,fs=1,hs="";function Ls(r,a){mi[pi++]=rc,mi[pi++]=xd,xd=r,rc=a}function u0(r,a,c){Mr[Rr++]=fs,Mr[Rr++]=hs,Mr[Rr++]=pa,pa=r;var f=fs;r=hs;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,fs=1<<32-$t(a)+x|c<<x|f,hs=b+r}else fs=1<<b|c<<x|f,hs=r}function Gm(r){r.return!==null&&(Ls(r,1),u0(r,1,0))}function Zm(r){for(;r===xd;)xd=mi[--pi],mi[pi]=null,rc=mi[--pi],mi[pi]=null;for(;r===pa;)pa=Mr[--Rr],Mr[Rr]=null,hs=Mr[--Rr],Mr[Rr]=null,fs=Mr[--Rr],Mr[Rr]=null}function d0(r,a){Mr[Rr++]=fs,Mr[Rr++]=hs,Mr[Rr++]=pa,fs=a.id,hs=a.overflow,pa=r}var kn=null,Dt=null,dt=!1,ga=null,Ar=!1,Qm=Error(s(519));function va(r){var a=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw sc(Tr(a,r)),Qm}function f0(r){var a=r.stateNode,c=r.type,f=r.memoizedProps;switch(a[Zt]=r,a[Wn]=f,c){case"dialog":ot("cancel",a),ot("close",a);break;case"iframe":case"object":case"embed":ot("load",a);break;case"video":case"audio":for(c=0;c<kc.length;c++)ot(kc[c],a);break;case"source":ot("error",a);break;case"img":case"image":case"link":ot("error",a),ot("load",a);break;case"details":ot("toggle",a);break;case"input":ot("invalid",a),Nb(a,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":ot("invalid",a);break;case"textarea":ot("invalid",a),_b(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||TS(a.textContent,c)?(f.popover!=null&&(ot("beforetoggle",a),ot("toggle",a)),f.onScroll!=null&&ot("scroll",a),f.onScrollEnd!=null&&ot("scrollend",a),f.onClick!=null&&(a.onclick=Ds),a=!0):a=!1,a||va(r,!0)}function h0(r){for(kn=r.return;kn;)switch(kn.tag){case 5:case 31:case 13:Ar=!1;return;case 27:case 3:Ar=!0;return;default:kn=kn.return}}function gi(r){if(r!==kn)return!1;if(!dt)return h0(r),dt=!0,!1;var a=r.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=r.type,c=!(c!=="form"&&c!=="button")||mg(r.type,r.memoizedProps)),c=!c),c&&Dt&&va(r),h0(r),a===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(317));Dt=IS(r)}else if(a===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(317));Dt=IS(r)}else a===27?(a=Dt,Ra(r.type)?(r=yg,yg=null,Dt=r):Dt=a):Dt=kn?Dr(r.stateNode.nextSibling):null;return!0}function fo(){Dt=kn=null,dt=!1}function Km(){var r=ga;return r!==null&&(Xn===null?Xn=r:Xn.push.apply(Xn,r),ga=null),r}function sc(r){ga===null?ga=[r]:ga.push(r)}var Xm=I(null),ho=null,Is=null;function xa(r,a,c){K(Xm,a._currentValue),a._currentValue=c}function $s(r){r._currentValue=Xm.current,F(Xm)}function Jm(r,a,c){for(;r!==null;){var f=r.alternate;if((r.childLanes&a)!==a?(r.childLanes|=a,f!==null&&(f.childLanes|=a)):f!==null&&(f.childLanes&a)!==a&&(f.childLanes|=a),r===c)break;r=r.return}}function ep(r,a,c,f){var x=r.child;for(x!==null&&(x.return=r);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 V=0;V<a.length;V++)if(P.context===a[V]){b.lanes|=c,P=b.alternate,P!==null&&(P.lanes|=c),Jm(b.return,c,r),f||(k=null);break e}b=P.next}}else if(x.tag===18){if(k=x.return,k===null)throw Error(s(341));k.lanes|=c,b=k.alternate,b!==null&&(b.lanes|=c),Jm(k,c,r),k=null}else k=x.child;if(k!==null)k.return=x;else for(k=x;k!==null;){if(k===r){k=null;break}if(x=k.sibling,x!==null){x.return=k.return,k=x;break}k=k.return}x=k}}function vi(r,a,c,f){r=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(s(387));if(k=k.memoizedProps,k!==null){var P=x.type;lr(x.pendingProps.value,k.value)||(r!==null?r.push(P):r=[P])}}else if(x===te.current){if(k=x.alternate,k===null)throw Error(s(387));k.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(r!==null?r.push(Rc):r=[Rc])}x=x.return}r!==null&&ep(a,r,c,f),a.flags|=262144}function yd(r){for(r=r.firstContext;r!==null;){if(!lr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function mo(r){ho=r,Is=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function _n(r){return m0(ho,r)}function bd(r,a){return ho===null&&mo(r),m0(r,a)}function m0(r,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},Is===null){if(r===null)throw Error(s(308));Is=a,r.dependencies={lanes:0,firstContext:a},r.flags|=524288}else Is=Is.next=a;return c}var lA=typeof AbortController<"u"?AbortController:function(){var r=[],a=this.signal={aborted:!1,addEventListener:function(c,f){r.push(f)}};this.abort=function(){a.aborted=!0,r.forEach(function(c){return c()})}},cA=e.unstable_scheduleCallback,uA=e.unstable_NormalPriority,nn={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function tp(){return{controller:new lA,data:new Map,refCount:0}}function ac(r){r.refCount--,r.refCount===0&&cA(uA,function(){r.controller.abort()})}var oc=null,np=0,xi=0,yi=null;function dA(r,a){if(oc===null){var c=oc=[];np=0,xi=ag(),yi={status:"pending",value:void 0,then:function(f){c.push(f)}}}return np++,a.then(p0,p0),a}function p0(){if(--np===0&&oc!==null){yi!==null&&(yi.status="fulfilled");var r=oc;oc=null,xi=0,yi=null;for(var a=0;a<r.length;a++)(0,r[a])()}}function fA(r,a){var c=[],f={status:"pending",value:null,reason:null,then:function(x){c.push(x)}};return r.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 g0=L.S;L.S=function(r,a){Jw=ut(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&dA(r,a),g0!==null&&g0(r,a)};var po=I(null);function rp(){var r=po.current;return r!==null?r:Rt.pooledCache}function wd(r,a){a===null?K(po,po.current):K(po,a.pool)}function v0(){var r=rp();return r===null?null:{parent:nn._currentValue,pool:r}}var bi=Error(s(460)),sp=Error(s(474)),Sd=Error(s(542)),jd={then:function(){}};function x0(r){return r=r.status,r==="fulfilled"||r==="rejected"}function y0(r,a,c){switch(c=r[c],c===void 0?r.push(a):c!==a&&(a.then(Ds,Ds),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw r=a.reason,w0(r),r;default:if(typeof a.status=="string")a.then(Ds,Ds);else{if(r=Rt,r!==null&&100<r.shellSuspendCounter)throw Error(s(482));r=a,r.status="pending",r.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 r=a.reason,w0(r),r}throw vo=a,bi}}function go(r){try{var a=r._init;return a(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(vo=c,bi):c}}var vo=null;function b0(){if(vo===null)throw Error(s(459));var r=vo;return vo=null,r}function w0(r){if(r===bi||r===Sd)throw Error(s(483))}var wi=null,ic=0;function Cd(r){var a=ic;return ic+=1,wi===null&&(wi=[]),y0(wi,r,a)}function lc(r,a){a=a.props.ref,r.ref=a!==void 0?a:null}function Nd(r,a){throw a.$$typeof===y?Error(s(525)):(r=Object.prototype.toString.call(a),Error(s(31,r==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":r)))}function S0(r){function a(J,Z){if(r){var re=J.deletions;re===null?(J.deletions=[Z],J.flags|=16):re.push(Z)}}function c(J,Z){if(!r)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=Ps(J,Z),J.index=0,J.sibling=null,J}function b(J,Z,re){return J.index=re,r?(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 r&&J.alternate===null&&(J.flags|=67108866),J}function P(J,Z,re,de){return Z===null||Z.tag!==6?(Z=Ym(re,J.mode,de),Z.return=J,Z):(Z=x(Z,re),Z.return=J,Z)}function V(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&&go(Ie)===Z.type)?(Z=x(Z,re.props),lc(Z,re),Z.return=J,Z):(Z=vd(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=Wm(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=uo(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=Ym(""+Z,J.mode,re),Z.return=J,Z;if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case w:return re=vd(Z.type,Z.key,Z.props,null,J.mode,re),lc(re,Z),re.return=J,re;case S:return Z=Wm(Z,J.mode,re),Z.return=J,Z;case O:return Z=go(Z),he(J,Z,re)}if(ae(Z)||q(Z))return Z=uo(Z,J.mode,re,null),Z.return=J,Z;if(typeof Z.then=="function")return he(J,Cd(Z),re);if(Z.$$typeof===E)return he(J,bd(J,Z),re);Nd(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?V(J,Z,re,de):null;case S:return re.key===Ie?se(J,Z,re,de):null;case O:return re=go(re),oe(J,Z,re,de)}if(ae(re)||q(re))return Ie!==null?null:ce(J,Z,re,de,null);if(typeof re.then=="function")return oe(J,Z,Cd(re),de);if(re.$$typeof===E)return oe(J,Z,bd(J,re),de);Nd(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,V(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=go(de),ie(J,Z,re,de,Ie)}if(ae(de)||q(de))return J=J.get(re)||null,ce(Z,J,de,Ie,null);if(typeof de.then=="function")return ie(J,Z,re,Cd(de),Ie);if(de.$$typeof===E)return ie(J,Z,re,bd(Z,de),Ie);Nd(Z,de)}return null}function Ee(J,Z,re,de){for(var Ie=null,ht=null,Ae=Z,et=Z=0,ct=null;Ae!==null&&et<re.length;et++){Ae.index>et?(ct=Ae,Ae=null):ct=Ae.sibling;var mt=oe(J,Ae,re[et],de);if(mt===null){Ae===null&&(Ae=ct);break}r&&Ae&&mt.alternate===null&&a(J,Ae),Z=b(mt,Z,et),ht===null?Ie=mt:ht.sibling=mt,ht=mt,Ae=ct}if(et===re.length)return c(J,Ae),dt&&Ls(J,et),Ie;if(Ae===null){for(;et<re.length;et++)Ae=he(J,re[et],de),Ae!==null&&(Z=b(Ae,Z,et),ht===null?Ie=Ae:ht.sibling=Ae,ht=Ae);return dt&&Ls(J,et),Ie}for(Ae=f(Ae);et<re.length;et++)ct=ie(Ae,J,et,re[et],de),ct!==null&&(r&&ct.alternate!==null&&Ae.delete(ct.key===null?et:ct.key),Z=b(ct,Z,et),ht===null?Ie=ct:ht.sibling=ct,ht=ct);return r&&Ae.forEach(function(Pa){return a(J,Pa)}),dt&&Ls(J,et),Ie}function qe(J,Z,re,de){if(re==null)throw Error(s(151));for(var Ie=null,ht=null,Ae=Z,et=Z=0,ct=null,mt=re.next();Ae!==null&&!mt.done;et++,mt=re.next()){Ae.index>et?(ct=Ae,Ae=null):ct=Ae.sibling;var Pa=oe(J,Ae,mt.value,de);if(Pa===null){Ae===null&&(Ae=ct);break}r&&Ae&&Pa.alternate===null&&a(J,Ae),Z=b(Pa,Z,et),ht===null?Ie=Pa:ht.sibling=Pa,ht=Pa,Ae=ct}if(mt.done)return c(J,Ae),dt&&Ls(J,et),Ie;if(Ae===null){for(;!mt.done;et++,mt=re.next())mt=he(J,mt.value,de),mt!==null&&(Z=b(mt,Z,et),ht===null?Ie=mt:ht.sibling=mt,ht=mt);return dt&&Ls(J,et),Ie}for(Ae=f(Ae);!mt.done;et++,mt=re.next())mt=ie(Ae,J,et,mt.value,de),mt!==null&&(r&&mt.alternate!==null&&Ae.delete(mt.key===null?et:mt.key),Z=b(mt,Z,et),ht===null?Ie=mt:ht.sibling=mt,ht=mt);return r&&Ae.forEach(function(jO){return a(J,jO)}),dt&&Ls(J,et),Ie}function Tt(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&&go(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=uo(re.props.children,J.mode,de,re.key),de.return=J,J=de):(de=vd(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=Wm(re,J.mode,de),de.return=J,J=de}return k(J);case O:return re=go(re),Tt(J,Z,re,de)}if(ae(re))return Ee(J,Z,re,de);if(q(re)){if(Ie=q(re),typeof Ie!="function")throw Error(s(150));return re=Ie.call(re),qe(J,Z,re,de)}if(typeof re.then=="function")return Tt(J,Z,Cd(re),de);if(re.$$typeof===E)return Tt(J,Z,bd(J,re),de);Nd(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=Ym(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=Tt(J,Z,re,de);return wi=null,Ie}catch(Ae){if(Ae===bi||Ae===Sd)throw Ae;var ht=cr(29,Ae,null,J.mode);return ht.lanes=de,ht.return=J,ht}}}var xo=S0(!0),j0=S0(!1),ya=!1;function ap(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function op(r,a){r=r.updateQueue,a.updateQueue===r&&(a.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function ba(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function wa(r,a,c){var f=r.updateQueue;if(f===null)return null;if(f=f.shared,(xt&2)!==0){var x=f.pending;return x===null?a.next=a:(a.next=x.next,x.next=a),f.pending=a,a=gd(r),o0(r,null,c),a}return pd(r,f,a,c),gd(r)}function cc(r,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var f=a.lanes;f&=r.pendingLanes,c|=f,a.lanes=c,wn(r,c)}}function ip(r,a){var c=r.updateQueue,f=r.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},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=a:r.next=a,c.lastBaseUpdate=a}var lp=!1;function uc(){if(lp){var r=yi;if(r!==null)throw r}}function dc(r,a,c,f){lp=!1;var x=r.updateQueue;ya=!1;var b=x.firstBaseUpdate,k=x.lastBaseUpdate,P=x.shared.pending;if(P!==null){x.shared.pending=null;var V=P,se=V.next;V.next=null,k===null?b=se:k.next=se,k=V;var ce=r.alternate;ce!==null&&(ce=ce.updateQueue,P=ce.lastBaseUpdate,P!==k&&(P===null?ce.firstBaseUpdate=se:P.next=se,ce.lastBaseUpdate=V))}if(b!==null){var he=x.baseState;k=0,ce=se=V=null,P=b;do{var oe=P.lane&-536870913,ie=oe!==P.lane;if(ie?(lt&oe)===oe:(f&oe)===oe){oe!==0&&oe===xi&&(lp=!0),ce!==null&&(ce=ce.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});e:{var Ee=r,qe=P;oe=a;var Tt=c;switch(qe.tag){case 1:if(Ee=qe.payload,typeof Ee=="function"){he=Ee.call(Tt,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(Tt,he,oe):Ee,oe==null)break e;he=g({},he,oe);break e;case 2:ya=!0}}oe=P.callback,oe!==null&&(r.flags|=64,ie&&(r.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,V=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&&(V=he),x.baseState=V,x.firstBaseUpdate=se,x.lastBaseUpdate=ce,b===null&&(x.shared.lanes=0),ka|=k,r.lanes=k,r.memoizedState=he}}function C0(r,a){if(typeof r!="function")throw Error(s(191,r));r.call(a)}function N0(r,a){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)C0(c[r],a)}var Si=I(null),kd=I(0);function k0(r,a){r=Gs,K(kd,r),K(Si,a),Gs=r|a.baseLanes}function cp(){K(kd,Gs),K(Si,Si.current)}function up(){Gs=kd.current,F(Si),F(kd)}var ur=I(null),Or=null;function Sa(r){var a=r.alternate;K(Qt,Qt.current&1),K(ur,r),Or===null&&(a===null||Si.current!==null||a.memoizedState!==null)&&(Or=r)}function dp(r){K(Qt,Qt.current),K(ur,r),Or===null&&(Or=r)}function _0(r){r.tag===22?(K(Qt,Qt.current),K(ur,r),Or===null&&(Or=r)):ja()}function ja(){K(Qt,Qt.current),K(ur,ur.current)}function dr(r){F(ur),Or===r&&(Or=null),F(Qt)}var Qt=I(0);function _d(r){for(var a=r;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||vg(c)||xg(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===r)break;for(;a.sibling===null;){if(a.return===null||a.return===r)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Fs=0,Qe=null,_t=null,rn=null,Ed=!1,ji=!1,yo=!1,Td=0,fc=0,Ci=null,hA=0;function qt(){throw Error(s(321))}function fp(r,a){if(a===null)return!1;for(var c=0;c<a.length&&c<r.length;c++)if(!lr(r[c],a[c]))return!1;return!0}function hp(r,a,c,f,x,b){return Fs=b,Qe=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,L.H=r===null||r.memoizedState===null?uw:Ep,yo=!1,b=c(f,x),yo=!1,ji&&(b=T0(a,c,f,x)),E0(r),b}function E0(r){L.H=pc;var a=_t!==null&&_t.next!==null;if(Fs=0,rn=_t=Qe=null,Ed=!1,fc=0,Ci=null,a)throw Error(s(300));r===null||sn||(r=r.dependencies,r!==null&&yd(r)&&(sn=!0))}function T0(r,a,c,f){Qe=r;var x=0;do{if(ji&&(Ci=null),fc=0,ji=!1,25<=x)throw Error(s(301));if(x+=1,rn=_t=null,r.updateQueue!=null){var b=r.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}L.H=dw,b=a(c,f)}while(ji);return b}function mA(){var r=L.H,a=r.useState()[0];return a=typeof a.then=="function"?hc(a):a,r=r.useState()[0],(_t!==null?_t.memoizedState:null)!==r&&(Qe.flags|=1024),a}function mp(){var r=Td!==0;return Td=0,r}function pp(r,a,c){a.updateQueue=r.updateQueue,a.flags&=-2053,r.lanes&=~c}function gp(r){if(Ed){for(r=r.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}Ed=!1}Fs=0,rn=_t=Qe=null,ji=!1,fc=Td=0,Ci=null}function Ln(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rn===null?Qe.memoizedState=rn=r:rn=rn.next=r,rn}function Kt(){if(_t===null){var r=Qe.alternate;r=r!==null?r.memoizedState:null}else r=_t.next;var a=rn===null?Qe.memoizedState:rn.next;if(a!==null)rn=a,_t=r;else{if(r===null)throw Qe.alternate===null?Error(s(467)):Error(s(310));_t=r,r={memoizedState:_t.memoizedState,baseState:_t.baseState,baseQueue:_t.baseQueue,queue:_t.queue,next:null},rn===null?Qe.memoizedState=rn=r:rn=rn.next=r}return rn}function Md(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function hc(r){var a=fc;return fc+=1,Ci===null&&(Ci=[]),r=y0(Ci,r,a),a=Qe,(rn===null?a.memoizedState:rn.next)===null&&(a=a.alternate,L.H=a===null||a.memoizedState===null?uw:Ep),r}function Rd(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return hc(r);if(r.$$typeof===E)return _n(r)}throw Error(s(438,String(r)))}function vp(r){var a=null,c=Qe.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var f=Qe.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=Md(),Qe.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(r),f=0;f<r;f++)c[f]=z;return a.index++,c}function Bs(r,a){return typeof a=="function"?a(r):a}function Ad(r){var a=Kt();return xp(a,_t,r)}function xp(r,a,c){var f=r.queue;if(f===null)throw Error(s(311));f.lastRenderedReducer=c;var x=r.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=r.baseState,x===null)r.memoizedState=b;else{a=x.next;var P=k=null,V=null,se=a,ce=!1;do{var he=se.lane&-536870913;if(he!==se.lane?(lt&he)===he:(Fs&he)===he){var oe=se.revertLane;if(oe===0)V!==null&&(V=V.next={lane:0,revertLane:0,gesture:null,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null}),he===xi&&(ce=!0);else if((Fs&oe)===oe){se=se.next,oe===xi&&(ce=!0);continue}else he={lane:0,revertLane:se.revertLane,gesture:null,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},V===null?(P=V=he,k=b):V=V.next=he,Qe.lanes|=oe,ka|=oe;he=se.action,yo&&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},V===null?(P=V=oe,k=b):V=V.next=oe,Qe.lanes|=he,ka|=he;se=se.next}while(se!==null&&se!==a);if(V===null?k=b:V.next=P,!lr(b,r.memoizedState)&&(sn=!0,ce&&(c=yi,c!==null)))throw c;r.memoizedState=b,r.baseState=k,r.baseQueue=V,f.lastRenderedState=b}return x===null&&(f.lanes=0),[r.memoizedState,f.dispatch]}function yp(r){var a=Kt(),c=a.queue;if(c===null)throw Error(s(311));c.lastRenderedReducer=r;var f=c.dispatch,x=c.pending,b=a.memoizedState;if(x!==null){c.pending=null;var k=x=x.next;do b=r(b,k.action),k=k.next;while(k!==x);lr(b,a.memoizedState)||(sn=!0),a.memoizedState=b,a.baseQueue===null&&(a.baseState=b),c.lastRenderedState=b}return[b,f]}function M0(r,a,c){var f=Qe,x=Kt(),b=dt;if(b){if(c===void 0)throw Error(s(407));c=c()}else c=a();var k=!lr((_t||x).memoizedState,c);if(k&&(x.memoizedState=c,sn=!0),x=x.queue,Sp(O0.bind(null,f,x,r),[r]),x.getSnapshot!==a||k||rn!==null&&rn.memoizedState.tag&1){if(f.flags|=2048,Ni(9,{destroy:void 0},A0.bind(null,f,x,c,a),null),Rt===null)throw Error(s(349));b||(Fs&127)!==0||R0(f,a,c)}return c}function R0(r,a,c){r.flags|=16384,r={getSnapshot:a,value:c},a=Qe.updateQueue,a===null?(a=Md(),Qe.updateQueue=a,a.stores=[r]):(c=a.stores,c===null?a.stores=[r]:c.push(r))}function A0(r,a,c,f){a.value=c,a.getSnapshot=f,D0(a)&&z0(r)}function O0(r,a,c){return c(function(){D0(a)&&z0(r)})}function D0(r){var a=r.getSnapshot;r=r.value;try{var c=a();return!lr(r,c)}catch{return!0}}function z0(r){var a=co(r,2);a!==null&&Jn(a,r,2)}function bp(r){var a=Ln();if(typeof r=="function"){var c=r;if(r=c(),yo){en(!0);try{c()}finally{en(!1)}}}return a.memoizedState=a.baseState=r,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bs,lastRenderedState:r},a}function P0(r,a,c,f){return r.baseState=c,xp(r,_t,typeof f=="function"?f:Bs)}function pA(r,a,c,f,x){if(zd(r))throw Error(s(485));if(r=a.action,r!==null){var b={payload:x,action:r,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,L0(a,b)):(b.next=c.next,a.pending=c.next=b)}}function L0(r,a){var c=a.action,f=a.payload,x=r.state;if(a.isTransition){var b=L.T,k={};L.T=k;try{var P=c(x,f),V=L.S;V!==null&&V(k,P),I0(r,a,P)}catch(se){wp(r,a,se)}finally{b!==null&&k.types!==null&&(b.types=k.types),L.T=b}}else try{b=c(x,f),I0(r,a,b)}catch(se){wp(r,a,se)}}function I0(r,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){$0(r,a,f)},function(f){return wp(r,a,f)}):$0(r,a,c)}function $0(r,a,c){a.status="fulfilled",a.value=c,F0(a),r.state=c,a=r.pending,a!==null&&(c=a.next,c===a?r.pending=null:(c=c.next,a.next=c,L0(r,c)))}function wp(r,a,c){var f=r.pending;if(r.pending=null,f!==null){f=f.next;do a.status="rejected",a.reason=c,F0(a),a=a.next;while(a!==f)}r.action=null}function F0(r){r=r.listeners;for(var a=0;a<r.length;a++)(0,r[a])()}function B0(r,a){return a}function U0(r,a){if(dt){var c=Rt.formState;if(c!==null){e:{var f=Qe;if(dt){if(Dt){t:{for(var x=Dt,b=Ar;x.nodeType!==8;){if(!b){x=null;break t}if(x=Dr(x.nextSibling),x===null){x=null;break t}}b=x.data,x=b==="F!"||b==="F"?x:null}if(x){Dt=Dr(x.nextSibling),f=x.data==="F!";break e}}va(f)}f=!1}f&&(a=c[0])}}return c=Ln(),c.memoizedState=c.baseState=a,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:B0,lastRenderedState:a},c.queue=f,c=iw.bind(null,Qe,f),f.dispatch=c,f=bp(!1),b=_p.bind(null,Qe,!1,f.queue),f=Ln(),x={state:a,dispatch:null,action:r,pending:null},f.queue=x,c=pA.bind(null,Qe,x,b,c),x.dispatch=c,f.memoizedState=r,[a,c,!1]}function V0(r){var a=Kt();return q0(a,_t,r)}function q0(r,a,c){if(a=xp(r,a,B0)[0],r=Ad(Bs)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var f=hc(a)}catch(k){throw k===bi?Sd:k}else f=a;a=Kt();var x=a.queue,b=x.dispatch;return c!==a.memoizedState&&(Qe.flags|=2048,Ni(9,{destroy:void 0},gA.bind(null,x,c),null)),[f,b,r]}function gA(r,a){r.action=a}function H0(r){var a=Kt(),c=_t;if(c!==null)return q0(a,c,r);Kt(),a=a.memoizedState,c=Kt();var f=c.queue.dispatch;return c.memoizedState=r,[a,f,!1]}function Ni(r,a,c,f){return r={tag:r,create:c,deps:f,inst:a,next:null},a=Qe.updateQueue,a===null&&(a=Md(),Qe.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=r.next=r:(f=c.next,c.next=r,r.next=f,a.lastEffect=r),r}function Y0(){return Kt().memoizedState}function Od(r,a,c,f){var x=Ln();Qe.flags|=r,x.memoizedState=Ni(1|a,{destroy:void 0},c,f===void 0?null:f)}function Dd(r,a,c,f){var x=Kt();f=f===void 0?null:f;var b=x.memoizedState.inst;_t!==null&&f!==null&&fp(f,_t.memoizedState.deps)?x.memoizedState=Ni(a,b,c,f):(Qe.flags|=r,x.memoizedState=Ni(1|a,b,c,f))}function W0(r,a){Od(8390656,8,r,a)}function Sp(r,a){Dd(2048,8,r,a)}function vA(r){Qe.flags|=4;var a=Qe.updateQueue;if(a===null)a=Md(),Qe.updateQueue=a,a.events=[r];else{var c=a.events;c===null?a.events=[r]:c.push(r)}}function G0(r){var a=Kt().memoizedState;return vA({ref:a,nextImpl:r}),function(){if((xt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}function Z0(r,a){return Dd(4,2,r,a)}function Q0(r,a){return Dd(4,4,r,a)}function K0(r,a){if(typeof a=="function"){r=r();var c=a(r);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return r=r(),a.current=r,function(){a.current=null}}function X0(r,a,c){c=c!=null?c.concat([r]):null,Dd(4,4,K0.bind(null,a,r),c)}function jp(){}function J0(r,a){var c=Kt();a=a===void 0?null:a;var f=c.memoizedState;return a!==null&&fp(a,f[1])?f[0]:(c.memoizedState=[r,a],r)}function ew(r,a){var c=Kt();a=a===void 0?null:a;var f=c.memoizedState;if(a!==null&&fp(a,f[1]))return f[0];if(f=r(),yo){en(!0);try{r()}finally{en(!1)}}return c.memoizedState=[f,a],f}function Cp(r,a,c){return c===void 0||(Fs&1073741824)!==0&&(lt&261930)===0?r.memoizedState=a:(r.memoizedState=c,r=tS(),Qe.lanes|=r,ka|=r,c)}function tw(r,a,c,f){return lr(c,a)?c:Si.current!==null?(r=Cp(r,c,f),lr(r,a)||(sn=!0),r):(Fs&42)===0||(Fs&1073741824)!==0&&(lt&261930)===0?(sn=!0,r.memoizedState=c):(r=tS(),Qe.lanes|=r,ka|=r,a)}function nw(r,a,c,f,x){var b=$.p;$.p=b!==0&&8>b?b:8;var k=L.T,P={};L.T=P,_p(r,!1,a,c);try{var V=x(),se=L.S;if(se!==null&&se(P,V),V!==null&&typeof V=="object"&&typeof V.then=="function"){var ce=fA(V,f);mc(r,a,ce,mr(r))}else mc(r,a,f,mr(r))}catch(he){mc(r,a,{then:function(){},status:"rejected",reason:he},mr())}finally{$.p=b,k!==null&&P.types!==null&&(k.types=P.types),L.T=k}}function xA(){}function Np(r,a,c,f){if(r.tag!==5)throw Error(s(476));var x=rw(r).queue;nw(r,x,a,U,c===null?xA:function(){return sw(r),c(f)})}function rw(r){var a=r.memoizedState;if(a!==null)return a;a={memoizedState:U,baseState:U,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bs,lastRenderedState:U},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bs,lastRenderedState:c},next:null},r.memoizedState=a,r=r.alternate,r!==null&&(r.memoizedState=a),a}function sw(r){var a=rw(r);a.next===null&&(a=r.alternate.memoizedState),mc(r,a.next.queue,{},mr())}function kp(){return _n(Rc)}function aw(){return Kt().memoizedState}function ow(){return Kt().memoizedState}function yA(r){for(var a=r.return;a!==null;){switch(a.tag){case 24:case 3:var c=mr();r=ba(c);var f=wa(a,r,c);f!==null&&(Jn(f,a,c),cc(f,a,c)),a={cache:tp()},r.payload=a;return}a=a.return}}function bA(r,a,c){var f=mr();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},zd(r)?lw(a,c):(c=qm(r,a,c,f),c!==null&&(Jn(c,r,f),cw(c,a,f)))}function iw(r,a,c){var f=mr();mc(r,a,c,f)}function mc(r,a,c,f){var x={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(zd(r))lw(a,x);else{var b=r.alternate;if(r.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,lr(P,k))return pd(r,a,x,0),Rt===null&&md(),!1}catch{}if(c=qm(r,a,x,f),c!==null)return Jn(c,r,f),cw(c,a,f),!0}return!1}function _p(r,a,c,f){if(f={lane:2,revertLane:ag(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},zd(r)){if(a)throw Error(s(479))}else a=qm(r,c,f,2),a!==null&&Jn(a,r,2)}function zd(r){var a=r.alternate;return r===Qe||a!==null&&a===Qe}function lw(r,a){ji=Ed=!0;var c=r.pending;c===null?a.next=a:(a.next=c.next,c.next=a),r.pending=a}function cw(r,a,c){if((c&4194048)!==0){var f=a.lanes;f&=r.pendingLanes,c|=f,a.lanes=c,wn(r,c)}}var pc={readContext:_n,use:Rd,useCallback:qt,useContext:qt,useEffect:qt,useImperativeHandle:qt,useLayoutEffect:qt,useInsertionEffect:qt,useMemo:qt,useReducer:qt,useRef:qt,useState:qt,useDebugValue:qt,useDeferredValue:qt,useTransition:qt,useSyncExternalStore:qt,useId:qt,useHostTransitionStatus:qt,useFormState:qt,useActionState:qt,useOptimistic:qt,useMemoCache:qt,useCacheRefresh:qt};pc.useEffectEvent=qt;var uw={readContext:_n,use:Rd,useCallback:function(r,a){return Ln().memoizedState=[r,a===void 0?null:a],r},useContext:_n,useEffect:W0,useImperativeHandle:function(r,a,c){c=c!=null?c.concat([r]):null,Od(4194308,4,K0.bind(null,a,r),c)},useLayoutEffect:function(r,a){return Od(4194308,4,r,a)},useInsertionEffect:function(r,a){Od(4,2,r,a)},useMemo:function(r,a){var c=Ln();a=a===void 0?null:a;var f=r();if(yo){en(!0);try{r()}finally{en(!1)}}return c.memoizedState=[f,a],f},useReducer:function(r,a,c){var f=Ln();if(c!==void 0){var x=c(a);if(yo){en(!0);try{c(a)}finally{en(!1)}}}else x=a;return f.memoizedState=f.baseState=x,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:x},f.queue=r,r=r.dispatch=bA.bind(null,Qe,r),[f.memoizedState,r]},useRef:function(r){var a=Ln();return r={current:r},a.memoizedState=r},useState:function(r){r=bp(r);var a=r.queue,c=iw.bind(null,Qe,a);return a.dispatch=c,[r.memoizedState,c]},useDebugValue:jp,useDeferredValue:function(r,a){var c=Ln();return Cp(c,r,a)},useTransition:function(){var r=bp(!1);return r=nw.bind(null,Qe,r.queue,!0,!1),Ln().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,a,c){var f=Qe,x=Ln();if(dt){if(c===void 0)throw Error(s(407));c=c()}else{if(c=a(),Rt===null)throw Error(s(349));(lt&127)!==0||R0(f,a,c)}x.memoizedState=c;var b={value:c,getSnapshot:a};return x.queue=b,W0(O0.bind(null,f,b,r),[r]),f.flags|=2048,Ni(9,{destroy:void 0},A0.bind(null,f,b,c,a),null),c},useId:function(){var r=Ln(),a=Rt.identifierPrefix;if(dt){var c=hs,f=fs;c=(f&~(1<<32-$t(f)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Td++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=hA++,a="_"+a+"r_"+c.toString(32)+"_";return r.memoizedState=a},useHostTransitionStatus:kp,useFormState:U0,useActionState:U0,useOptimistic:function(r){var a=Ln();a.memoizedState=a.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=_p.bind(null,Qe,!0,c),c.dispatch=a,[r,a]},useMemoCache:vp,useCacheRefresh:function(){return Ln().memoizedState=yA.bind(null,Qe)},useEffectEvent:function(r){var a=Ln(),c={impl:r};return a.memoizedState=c,function(){if((xt&2)!==0)throw Error(s(440));return c.impl.apply(void 0,arguments)}}},Ep={readContext:_n,use:Rd,useCallback:J0,useContext:_n,useEffect:Sp,useImperativeHandle:X0,useInsertionEffect:Z0,useLayoutEffect:Q0,useMemo:ew,useReducer:Ad,useRef:Y0,useState:function(){return Ad(Bs)},useDebugValue:jp,useDeferredValue:function(r,a){var c=Kt();return tw(c,_t.memoizedState,r,a)},useTransition:function(){var r=Ad(Bs)[0],a=Kt().memoizedState;return[typeof r=="boolean"?r:hc(r),a]},useSyncExternalStore:M0,useId:aw,useHostTransitionStatus:kp,useFormState:V0,useActionState:V0,useOptimistic:function(r,a){var c=Kt();return P0(c,_t,r,a)},useMemoCache:vp,useCacheRefresh:ow};Ep.useEffectEvent=G0;var dw={readContext:_n,use:Rd,useCallback:J0,useContext:_n,useEffect:Sp,useImperativeHandle:X0,useInsertionEffect:Z0,useLayoutEffect:Q0,useMemo:ew,useReducer:yp,useRef:Y0,useState:function(){return yp(Bs)},useDebugValue:jp,useDeferredValue:function(r,a){var c=Kt();return _t===null?Cp(c,r,a):tw(c,_t.memoizedState,r,a)},useTransition:function(){var r=yp(Bs)[0],a=Kt().memoizedState;return[typeof r=="boolean"?r:hc(r),a]},useSyncExternalStore:M0,useId:aw,useHostTransitionStatus:kp,useFormState:H0,useActionState:H0,useOptimistic:function(r,a){var c=Kt();return _t!==null?P0(c,_t,r,a):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:vp,useCacheRefresh:ow};dw.useEffectEvent=G0;function Tp(r,a,c,f){a=r.memoizedState,c=c(f,a),c=c==null?a:g({},a,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var Mp={enqueueSetState:function(r,a,c){r=r._reactInternals;var f=mr(),x=ba(f);x.payload=a,c!=null&&(x.callback=c),a=wa(r,x,f),a!==null&&(Jn(a,r,f),cc(a,r,f))},enqueueReplaceState:function(r,a,c){r=r._reactInternals;var f=mr(),x=ba(f);x.tag=1,x.payload=a,c!=null&&(x.callback=c),a=wa(r,x,f),a!==null&&(Jn(a,r,f),cc(a,r,f))},enqueueForceUpdate:function(r,a){r=r._reactInternals;var c=mr(),f=ba(c);f.tag=2,a!=null&&(f.callback=a),a=wa(r,f,c),a!==null&&(Jn(a,r,c),cc(a,r,c))}};function fw(r,a,c,f,x,b,k){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(f,b,k):a.prototype&&a.prototype.isPureReactComponent?!tc(c,f)||!tc(x,b):!0}function hw(r,a,c,f){r=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,f),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,f),a.state!==r&&Mp.enqueueReplaceState(a,a.state,null)}function bo(r,a){var c=a;if("ref"in a){c={};for(var f in a)f!=="ref"&&(c[f]=a[f])}if(r=r.defaultProps){c===a&&(c=g({},c));for(var x in r)c[x]===void 0&&(c[x]=r[x])}return c}function mw(r){hd(r)}function pw(r){console.error(r)}function gw(r){hd(r)}function Pd(r,a){try{var c=r.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(f){setTimeout(function(){throw f})}}function vw(r,a,c){try{var f=r.onCaughtError;f(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Rp(r,a,c){return c=ba(c),c.tag=3,c.payload={element:null},c.callback=function(){Pd(r,a)},c}function xw(r){return r=ba(r),r.tag=3,r}function yw(r,a,c,f){var x=c.type.getDerivedStateFromError;if(typeof x=="function"){var b=f.value;r.payload=function(){return x(b)},r.callback=function(){vw(a,c,f)}}var k=c.stateNode;k!==null&&typeof k.componentDidCatch=="function"&&(r.callback=function(){vw(a,c,f),typeof x!="function"&&(_a===null?_a=new Set([this]):_a.add(this));var P=f.stack;this.componentDidCatch(f.value,{componentStack:P!==null?P:""})})}function wA(r,a,c,f,x){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(a=c.alternate,a!==null&&vi(a,c,x,!0),c=ur.current,c!==null){switch(c.tag){case 31:case 13:return Or===null?Gd():c.alternate===null&&Ht===0&&(Ht=3),c.flags&=-257,c.flags|=65536,c.lanes=x,f===jd?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([f]):a.add(f),ng(r,f,x)),!1;case 22:return c.flags|=65536,f===jd?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)),ng(r,f,x)),!1}throw Error(s(435,c.tag))}return ng(r,f,x),Gd(),!1}if(dt)return a=ur.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,f!==Qm&&(r=Error(s(422),{cause:f}),sc(Tr(r,c)))):(f!==Qm&&(a=Error(s(423),{cause:f}),sc(Tr(a,c))),r=r.current.alternate,r.flags|=65536,x&=-x,r.lanes|=x,f=Tr(f,c),x=Rp(r.stateNode,f,x),ip(r,x),Ht!==4&&(Ht=2)),!1;var b=Error(s(520),{cause:f});if(b=Tr(b,c),jc===null?jc=[b]:jc.push(b),Ht!==4&&(Ht=2),a===null)return!0;f=Tr(f,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,r=x&-x,c.lanes|=r,r=Rp(c.stateNode,f,r),ip(c,r),!1;case 1:if(a=c.type,b=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(_a===null||!_a.has(b))))return c.flags|=65536,x&=-x,c.lanes|=x,x=xw(x),yw(x,r,c,f),ip(c,x),!1}c=c.return}while(c!==null);return!1}var Ap=Error(s(461)),sn=!1;function En(r,a,c,f){a.child=r===null?j0(a,null,c,f):xo(a,r.child,c,f)}function bw(r,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 mo(a),f=hp(r,a,c,k,b,x),P=mp(),r!==null&&!sn?(pp(r,a,x),Us(r,a,x)):(dt&&P&&Gm(a),a.flags|=1,En(r,a,f,x),a.child)}function ww(r,a,c,f,x){if(r===null){var b=c.type;return typeof b=="function"&&!Hm(b)&&b.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=b,Sw(r,a,b,f,x)):(r=vd(c.type,null,f,a,a.mode,x),r.ref=a.ref,r.return=a,a.child=r)}if(b=r.child,!Fp(r,x)){var k=b.memoizedProps;if(c=c.compare,c=c!==null?c:tc,c(k,f)&&r.ref===a.ref)return Us(r,a,x)}return a.flags|=1,r=Ps(b,f),r.ref=a.ref,r.return=a,a.child=r}function Sw(r,a,c,f,x){if(r!==null){var b=r.memoizedProps;if(tc(b,f)&&r.ref===a.ref)if(sn=!1,a.pendingProps=f=b,Fp(r,x))(r.flags&131072)!==0&&(sn=!0);else return a.lanes=r.lanes,Us(r,a,x)}return Op(r,a,c,f,x)}function jw(r,a,c,f){var x=f.children,b=r!==null?r.memoizedState:null;if(r===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,r!==null){for(f=a.child=r.child,x=0;f!==null;)x=x|f.lanes|f.childLanes,f=f.sibling;f=x&~b}else f=0,a.child=null;return Cw(r,a,b,c,f)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},r!==null&&wd(a,b!==null?b.cachePool:null),b!==null?k0(a,b):cp(),_0(a);else return f=a.lanes=536870912,Cw(r,a,b!==null?b.baseLanes|c:c,c,f)}else b!==null?(wd(a,b.cachePool),k0(a,b),ja(),a.memoizedState=null):(r!==null&&wd(a,null),cp(),ja());return En(r,a,x,c),a.child}function gc(r,a){return r!==null&&r.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Cw(r,a,c,f,x){var b=rp();return b=b===null?null:{parent:nn._currentValue,pool:b},a.memoizedState={baseLanes:c,cachePool:b},r!==null&&wd(a,null),cp(),_0(a),r!==null&&vi(r,a,f,!0),a.childLanes=x,null}function Ld(r,a){return a=$d({mode:a.mode,children:a.children},r.mode),a.ref=r.ref,r.child=a,a.return=r,a}function Nw(r,a,c){return xo(a,r.child,null,c),r=Ld(a,a.pendingProps),r.flags|=2,dr(a),a.memoizedState=null,r}function SA(r,a,c){var f=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,r===null){if(dt){if(f.mode==="hidden")return r=Ld(a,f),a.lanes=536870912,gc(null,r);if(dp(a),(r=Dt)?(r=LS(r,Ar),r=r!==null&&r.data==="&"?r:null,r!==null&&(a.memoizedState={dehydrated:r,treeContext:pa!==null?{id:fs,overflow:hs}:null,retryLane:536870912,hydrationErrors:null},c=l0(r),c.return=a,a.child=c,kn=a,Dt=null)):r=null,r===null)throw va(a);return a.lanes=536870912,null}return Ld(a,f)}var b=r.memoizedState;if(b!==null){var k=b.dehydrated;if(dp(a),x)if(a.flags&256)a.flags&=-257,a=Nw(r,a,c);else if(a.memoizedState!==null)a.child=r.child,a.flags|=128,a=null;else throw Error(s(558));else if(sn||vi(r,a,c,!1),x=(c&r.childLanes)!==0,sn||x){if(f=Rt,f!==null&&(k=Q(f,c),k!==0&&k!==b.retryLane))throw b.retryLane=k,co(r,k),Jn(f,r,k),Ap;Gd(),a=Nw(r,a,c)}else r=b.treeContext,Dt=Dr(k.nextSibling),kn=a,dt=!0,ga=null,Ar=!1,r!==null&&d0(a,r),a=Ld(a,f),a.flags|=4096;return a}return r=Ps(r.child,{mode:f.mode,children:f.children}),r.ref=a.ref,a.child=r,r.return=a,r}function Id(r,a){var c=a.ref;if(c===null)r!==null&&r.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(s(284));(r===null||r.ref!==c)&&(a.flags|=4194816)}}function Op(r,a,c,f,x){return mo(a),c=hp(r,a,c,f,void 0,x),f=mp(),r!==null&&!sn?(pp(r,a,x),Us(r,a,x)):(dt&&f&&Gm(a),a.flags|=1,En(r,a,c,x),a.child)}function kw(r,a,c,f,x,b){return mo(a),a.updateQueue=null,c=T0(a,f,c,x),E0(r),f=mp(),r!==null&&!sn?(pp(r,a,b),Us(r,a,b)):(dt&&f&&Gm(a),a.flags|=1,En(r,a,c,b),a.child)}function _w(r,a,c,f,x){if(mo(a),a.stateNode===null){var b=hi,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=Mp,a.stateNode=b,b._reactInternals=a,b=a.stateNode,b.props=f,b.state=a.memoizedState,b.refs={},ap(a),k=c.contextType,b.context=typeof k=="object"&&k!==null?_n(k):hi,b.state=a.memoizedState,k=c.getDerivedStateFromProps,typeof k=="function"&&(Tp(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&&Mp.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(r===null){b=a.stateNode;var P=a.memoizedProps,V=bo(c,P);b.props=V;var se=b.context,ce=c.contextType;k=hi,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)&&hw(a,b,f,k),ya=!1;var oe=a.memoizedState;b.state=oe,dc(a,f,b,x),uc(),se=a.memoizedState,P||oe!==se||ya?(typeof he=="function"&&(Tp(a,c,he,f),se=a.memoizedState),(V=ya||fw(a,c,V,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=V):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),f=!1)}else{b=a.stateNode,op(r,a),k=a.memoizedProps,ce=bo(c,k),b.props=ce,he=a.pendingProps,oe=b.context,se=c.contextType,V=hi,typeof se=="object"&&se!==null&&(V=_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!==V)&&hw(a,b,f,V),ya=!1,oe=a.memoizedState,b.state=oe,dc(a,f,b,x),uc();var ie=a.memoizedState;k!==he||oe!==ie||ya||r!==null&&r.dependencies!==null&&yd(r.dependencies)?(typeof P=="function"&&(Tp(a,c,P,f),ie=a.memoizedState),(ce=ya||fw(a,c,ce,f,oe,ie,V)||r!==null&&r.dependencies!==null&&yd(r.dependencies))?(se||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(f,ie,V),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(f,ie,V)),typeof b.componentDidUpdate=="function"&&(a.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof b.componentDidUpdate!="function"||k===r.memoizedProps&&oe===r.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||k===r.memoizedProps&&oe===r.memoizedState||(a.flags|=1024),a.memoizedProps=f,a.memoizedState=ie),b.props=f,b.state=ie,b.context=V,f=ce):(typeof b.componentDidUpdate!="function"||k===r.memoizedProps&&oe===r.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||k===r.memoizedProps&&oe===r.memoizedState||(a.flags|=1024),f=!1)}return b=f,Id(r,a),f=(a.flags&128)!==0,b||f?(b=a.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:b.render(),a.flags|=1,r!==null&&f?(a.child=xo(a,r.child,null,x),a.child=xo(a,null,c,x)):En(r,a,c,x),a.memoizedState=b.state,r=a.child):r=Us(r,a,x),r}function Ew(r,a,c,f){return fo(),a.flags|=256,En(r,a,c,f),a.child}var Dp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function zp(r){return{baseLanes:r,cachePool:v0()}}function Pp(r,a,c){return r=r!==null?r.childLanes&~c:0,a&&(r|=hr),r}function Tw(r,a,c){var f=a.pendingProps,x=!1,b=(a.flags&128)!==0,k;if((k=b)||(k=r!==null&&r.memoizedState===null?!1:(Qt.current&2)!==0),k&&(x=!0,a.flags&=-129),k=(a.flags&32)!==0,a.flags&=-33,r===null){if(dt){if(x?Sa(a):ja(),(r=Dt)?(r=LS(r,Ar),r=r!==null&&r.data!=="&"?r:null,r!==null&&(a.memoizedState={dehydrated:r,treeContext:pa!==null?{id:fs,overflow:hs}:null,retryLane:536870912,hydrationErrors:null},c=l0(r),c.return=a,a.child=c,kn=a,Dt=null)):r=null,r===null)throw va(a);return xg(r)?a.lanes=32:a.lanes=536870912,null}var P=f.children;return f=f.fallback,x?(ja(),x=a.mode,P=$d({mode:"hidden",children:P},x),f=uo(f,x,c,null),P.return=a,f.return=a,P.sibling=f,a.child=P,f=a.child,f.memoizedState=zp(c),f.childLanes=Pp(r,k,c),a.memoizedState=Dp,gc(null,f)):(Sa(a),Lp(a,P))}var V=r.memoizedState;if(V!==null&&(P=V.dehydrated,P!==null)){if(b)a.flags&256?(Sa(a),a.flags&=-257,a=Ip(r,a,c)):a.memoizedState!==null?(ja(),a.child=r.child,a.flags|=128,a=null):(ja(),P=f.fallback,x=a.mode,f=$d({mode:"visible",children:f.children},x),P=uo(P,x,c,null),P.flags|=2,f.return=a,P.return=a,f.sibling=P,a.child=f,xo(a,r.child,null,c),f=a.child,f.memoizedState=zp(c),f.childLanes=Pp(r,k,c),a.memoizedState=Dp,a=gc(null,f));else if(Sa(a),xg(P)){if(k=P.nextSibling&&P.nextSibling.dataset,k)var se=k.dgst;k=se,f=Error(s(419)),f.stack="",f.digest=k,sc({value:f,source:null,stack:null}),a=Ip(r,a,c)}else if(sn||vi(r,a,c,!1),k=(c&r.childLanes)!==0,sn||k){if(k=Rt,k!==null&&(f=Q(k,c),f!==0&&f!==V.retryLane))throw V.retryLane=f,co(r,f),Jn(k,r,f),Ap;vg(P)||Gd(),a=Ip(r,a,c)}else vg(P)?(a.flags|=192,a.child=r.child,a=null):(r=V.treeContext,Dt=Dr(P.nextSibling),kn=a,dt=!0,ga=null,Ar=!1,r!==null&&d0(a,r),a=Lp(a,f.children),a.flags|=4096);return a}return x?(ja(),P=f.fallback,x=a.mode,V=r.child,se=V.sibling,f=Ps(V,{mode:"hidden",children:f.children}),f.subtreeFlags=V.subtreeFlags&65011712,se!==null?P=Ps(se,P):(P=uo(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=r.child.memoizedState,P===null?P=zp(c):(x=P.cachePool,x!==null?(V=nn._currentValue,x=x.parent!==V?{parent:V,pool:V}:x):x=v0(),P={baseLanes:P.baseLanes|c,cachePool:x}),f.memoizedState=P,f.childLanes=Pp(r,k,c),a.memoizedState=Dp,gc(r.child,f)):(Sa(a),c=r.child,r=c.sibling,c=Ps(c,{mode:"visible",children:f.children}),c.return=a,c.sibling=null,r!==null&&(k=a.deletions,k===null?(a.deletions=[r],a.flags|=16):k.push(r)),a.child=c,a.memoizedState=null,c)}function Lp(r,a){return a=$d({mode:"visible",children:a},r.mode),a.return=r,r.child=a}function $d(r,a){return r=cr(22,r,null,a),r.lanes=0,r}function Ip(r,a,c){return xo(a,r.child,null,c),r=Lp(a,a.pendingProps.children),r.flags|=2,a.memoizedState=null,r}function Mw(r,a,c){r.lanes|=a;var f=r.alternate;f!==null&&(f.lanes|=a),Jm(r.return,a,c)}function $p(r,a,c,f,x,b){var k=r.memoizedState;k===null?r.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 Rw(r,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(r,a,f,c),f=dt?rc:0,!P&&r!==null&&(r.flags&128)!==0)e:for(r=a.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Mw(r,c,a);else if(r.tag===19)Mw(r,c,a);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===a)break e;for(;r.sibling===null;){if(r.return===null||r.return===a)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(x){case"forwards":for(c=a.child,x=null;c!==null;)r=c.alternate,r!==null&&_d(r)===null&&(x=c),c=c.sibling;c=x,c===null?(x=a.child,a.child=null):(x=c.sibling,c.sibling=null),$p(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(r=x.alternate,r!==null&&_d(r)===null){a.child=x;break}r=x.sibling,x.sibling=c,c=x,x=r}$p(a,!0,c,null,b,f);break;case"together":$p(a,!1,null,null,void 0,f);break;default:a.memoizedState=null}return a.child}function Us(r,a,c){if(r!==null&&(a.dependencies=r.dependencies),ka|=a.lanes,(c&a.childLanes)===0)if(r!==null){if(vi(r,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(r!==null&&a.child!==r.child)throw Error(s(153));if(a.child!==null){for(r=a.child,c=Ps(r,r.pendingProps),a.child=c,c.return=a;r.sibling!==null;)r=r.sibling,c=c.sibling=Ps(r,r.pendingProps),c.return=a;c.sibling=null}return a.child}function Fp(r,a){return(r.lanes&a)!==0?!0:(r=r.dependencies,!!(r!==null&&yd(r)))}function jA(r,a,c){switch(a.tag){case 3:ye(a,a.stateNode.containerInfo),xa(a,nn,r.memoizedState.cache),fo();break;case 27:case 5:_e(a);break;case 4:ye(a,a.stateNode.containerInfo);break;case 10:xa(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,dp(a),null;break;case 13:var f=a.memoizedState;if(f!==null)return f.dehydrated!==null?(Sa(a),a.flags|=128,null):(c&a.child.childLanes)!==0?Tw(r,a,c):(Sa(a),r=Us(r,a,c),r!==null?r.sibling:null);Sa(a);break;case 19:var x=(r.flags&128)!==0;if(f=(c&a.childLanes)!==0,f||(vi(r,a,c,!1),f=(c&a.childLanes)!==0),x){if(f)return Rw(r,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,jw(r,a,c,a.pendingProps);case 24:xa(a,nn,r.memoizedState.cache)}return Us(r,a,c)}function Aw(r,a,c){if(r!==null)if(r.memoizedProps!==a.pendingProps)sn=!0;else{if(!Fp(r,c)&&(a.flags&128)===0)return sn=!1,jA(r,a,c);sn=(r.flags&131072)!==0}else sn=!1,dt&&(a.flags&1048576)!==0&&u0(a,rc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var f=a.pendingProps;if(r=go(a.elementType),a.type=r,typeof r=="function")Hm(r)?(f=bo(r,f),a.tag=1,a=_w(null,a,r,f,c)):(a.tag=0,a=Op(null,a,r,f,c));else{if(r!=null){var x=r.$$typeof;if(x===M){a.tag=11,a=bw(null,a,r,f,c);break e}else if(x===T){a.tag=14,a=ww(null,a,r,f,c);break e}}throw a=G(r)||r,Error(s(306,a,""))}}return a;case 0:return Op(r,a,a.type,a.pendingProps,c);case 1:return f=a.type,x=bo(f,a.pendingProps),_w(r,a,f,x,c);case 3:e:{if(ye(a,a.stateNode.containerInfo),r===null)throw Error(s(387));f=a.pendingProps;var b=a.memoizedState;x=b.element,op(r,a),dc(a,f,null,c);var k=a.memoizedState;if(f=k.cache,xa(a,nn,f),f!==b.cache&&ep(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=Ew(r,a,f,c);break e}else if(f!==x){x=Tr(Error(s(424)),a),sc(x),a=Ew(r,a,f,c);break e}else for(r=a.stateNode.containerInfo,r.nodeType===9?r=r.body:r=r.nodeName==="HTML"?r.ownerDocument.body:r,Dt=Dr(r.firstChild),kn=a,dt=!0,ga=null,Ar=!0,c=j0(a,null,f,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(fo(),f===x){a=Us(r,a,c);break e}En(r,a,f,c)}a=a.child}return a;case 26:return Id(r,a),r===null?(c=VS(a.type,null,a.pendingProps,null))?a.memoizedState=c:dt||(c=a.type,r=a.pendingProps,f=tf(ue.current).createElement(c),f[Zt]=a,f[Wn]=r,Tn(f,c,r),Sn(f),a.stateNode=f):a.memoizedState=VS(a.type,r.memoizedProps,a.pendingProps,r.memoizedState),null;case 27:return _e(a),r===null&&dt&&(f=a.stateNode=FS(a.type,a.pendingProps,ue.current),kn=a,Ar=!0,x=Dt,Ra(a.type)?(yg=x,Dt=Dr(f.firstChild)):Dt=x),En(r,a,a.pendingProps.children,c),Id(r,a),r===null&&(a.flags|=4194304),a.child;case 5:return r===null&&dt&&((x=f=Dt)&&(f=JA(f,a.type,a.pendingProps,Ar),f!==null?(a.stateNode=f,kn=a,Dt=Dr(f.firstChild),Ar=!1,x=!0):x=!1),x||va(a)),_e(a),x=a.type,b=a.pendingProps,k=r!==null?r.memoizedProps:null,f=b.children,mg(x,b)?f=null:k!==null&&mg(x,k)&&(a.flags|=32),a.memoizedState!==null&&(x=hp(r,a,mA,null,null,c),Rc._currentValue=x),Id(r,a),En(r,a,f,c),a.child;case 6:return r===null&&dt&&((r=c=Dt)&&(c=eO(c,a.pendingProps,Ar),c!==null?(a.stateNode=c,kn=a,Dt=null,r=!0):r=!1),r||va(a)),null;case 13:return Tw(r,a,c);case 4:return ye(a,a.stateNode.containerInfo),f=a.pendingProps,r===null?a.child=xo(a,null,f,c):En(r,a,f,c),a.child;case 11:return bw(r,a,a.type,a.pendingProps,c);case 7:return En(r,a,a.pendingProps,c),a.child;case 8:return En(r,a,a.pendingProps.children,c),a.child;case 12:return En(r,a,a.pendingProps.children,c),a.child;case 10:return f=a.pendingProps,xa(a,a.type,f.value),En(r,a,f.children,c),a.child;case 9:return x=a.type._context,f=a.pendingProps.children,mo(a),x=_n(x),f=f(x),a.flags|=1,En(r,a,f,c),a.child;case 14:return ww(r,a,a.type,a.pendingProps,c);case 15:return Sw(r,a,a.type,a.pendingProps,c);case 19:return Rw(r,a,c);case 31:return SA(r,a,c);case 22:return jw(r,a,c,a.pendingProps);case 24:return mo(a),f=_n(nn),r===null?(x=rp(),x===null&&(x=Rt,b=tp(),x.pooledCache=b,b.refCount++,b!==null&&(x.pooledCacheLanes|=c),x=b),a.memoizedState={parent:f,cache:x},ap(a),xa(a,nn,x)):((r.lanes&c)!==0&&(op(r,a),dc(a,null,null,c),uc()),x=r.memoizedState,b=a.memoizedState,x.parent!==f?(x={parent:f,cache:f},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),xa(a,nn,f)):(f=b.cache,xa(a,nn,f),f!==x.cache&&ep(a,[nn],c,!0))),En(r,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(s(156,a.tag))}function Vs(r){r.flags|=4}function Bp(r,a,c,f,x){if((a=(r.mode&32)!==0)&&(a=!1),a){if(r.flags|=16777216,(x&335544128)===x)if(r.stateNode.complete)r.flags|=8192;else if(aS())r.flags|=8192;else throw vo=jd,sp}else r.flags&=-16777217}function Ow(r,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!GS(a))if(aS())r.flags|=8192;else throw vo=jd,sp}function Fd(r,a){a!==null&&(r.flags|=4),r.flags&16384&&(a=r.tag!==22?tn():536870912,r.lanes|=a,Ti|=a)}function vc(r,a){if(!dt)switch(r.tailMode){case"hidden":a=r.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?a||r.tail===null?r.tail=null:r.tail.sibling=null:f.sibling=null}}function zt(r){var a=r.alternate!==null&&r.alternate.child===r.child,c=0,f=0;if(a)for(var x=r.child;x!==null;)c|=x.lanes|x.childLanes,f|=x.subtreeFlags&65011712,f|=x.flags&65011712,x.return=r,x=x.sibling;else for(x=r.child;x!==null;)c|=x.lanes|x.childLanes,f|=x.subtreeFlags,f|=x.flags,x.return=r,x=x.sibling;return r.subtreeFlags|=f,r.childLanes=c,a}function CA(r,a,c){var f=a.pendingProps;switch(Zm(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,r!==null&&(f=r.memoizedState.cache),a.memoizedState.cache!==f&&(a.flags|=2048),$s(nn),Ce(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(gi(a)?Vs(a):r===null||r.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Km())),zt(a),null;case 26:var x=a.type,b=a.memoizedState;return r===null?(Vs(a),b!==null?(zt(a),Ow(a,b)):(zt(a),Bp(a,x,null,f,c))):b?b!==r.memoizedState?(Vs(a),zt(a),Ow(a,b)):(zt(a),a.flags&=-16777217):(r=r.memoizedProps,r!==f&&Vs(a),zt(a),Bp(a,x,r,f,c)),null;case 27:if(Re(a),c=ue.current,x=a.type,r!==null&&a.stateNode!=null)r.memoizedProps!==f&&Vs(a);else{if(!f){if(a.stateNode===null)throw Error(s(166));return zt(a),null}r=ne.current,gi(a)?f0(a):(r=FS(x,f,c),a.stateNode=r,Vs(a))}return zt(a),null;case 5:if(Re(a),x=a.type,r!==null&&a.stateNode!=null)r.memoizedProps!==f&&Vs(a);else{if(!f){if(a.stateNode===null)throw Error(s(166));return zt(a),null}if(b=ne.current,gi(a))f0(a);else{var k=tf(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),Bp(a,a.type,r===null?null:r.memoizedProps,a.pendingProps,c),null;case 6:if(r&&a.stateNode!=null)r.memoizedProps!==f&&Vs(a);else{if(typeof f!="string"&&a.stateNode===null)throw Error(s(166));if(r=ue.current,gi(a)){if(r=a.stateNode,c=a.memoizedProps,f=null,x=kn,x!==null)switch(x.tag){case 27:case 5:f=x.memoizedProps}r[Zt]=a,r=!!(r.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||TS(r.nodeValue,c)),r||va(a,!0)}else r=tf(r).createTextNode(f),r[Zt]=a,a.stateNode=r}return zt(a),null;case 31:if(c=a.memoizedState,r===null||r.memoizedState!==null){if(f=gi(a),c!==null){if(r===null){if(!f)throw Error(s(318));if(r=a.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(557));r[Zt]=a}else fo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;zt(a),r=!1}else c=Km(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return a.flags&256?(dr(a),a):(dr(a),null);if((a.flags&128)!==0)throw Error(s(558))}return zt(a),null;case 13:if(f=a.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(x=gi(a),f!==null&&f.dehydrated!==null){if(r===null){if(!x)throw Error(s(318));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(s(317));x[Zt]=a}else fo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;zt(a),x=!1}else x=Km(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(dr(a),a):(dr(a),null)}return dr(a),(a.flags&128)!==0?(a.lanes=c,a):(c=f!==null,r=r!==null&&r.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!==r&&c&&(a.child.flags|=8192),Fd(a,a.updateQueue),zt(a),null);case 4:return Ce(),r===null&&cg(a.stateNode.containerInfo),zt(a),null;case 10:return $s(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||r!==null&&(r.flags&128)!==0)for(r=a.child;r!==null;){if(b=_d(r),b!==null){for(a.flags|=128,vc(f,!1),r=b.updateQueue,a.updateQueue=r,Fd(a,r),a.subtreeFlags=0,r=c,c=a.child;c!==null;)i0(c,r),c=c.sibling;return K(Qt,Qt.current&1|2),dt&&Ls(a,f.treeForkCount),a.child}r=r.sibling}f.tail!==null&&ut()>Hd&&(a.flags|=128,x=!0,vc(f,!1),a.lanes=4194304)}else{if(!x)if(r=_d(b),r!==null){if(a.flags|=128,x=!0,r=r.updateQueue,a.updateQueue=r,Fd(a,r),vc(f,!0),f.tail===null&&f.tailMode==="hidden"&&!b.alternate&&!dt)return zt(a),null}else 2*ut()-f.renderingStartTime>Hd&&c!==536870912&&(a.flags|=128,x=!0,vc(f,!1),a.lanes=4194304);f.isBackwards?(b.sibling=a.child,a.child=b):(r=f.last,r!==null?r.sibling=b:a.child=b,f.last=b)}return f.tail!==null?(r=f.tail,f.rendering=r,f.tail=r.sibling,f.renderingStartTime=ut(),r.sibling=null,c=Qt.current,K(Qt,x?c&1|2:c&1),dt&&Ls(a,f.treeForkCount),r):(zt(a),null);case 22:case 23:return dr(a),up(),f=a.memoizedState!==null,r!==null?r.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&&Fd(a,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),f=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),f!==c&&(a.flags|=2048),r!==null&&F(po),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),$s(nn),zt(a),null;case 25:return null;case 30:return null}throw Error(s(156,a.tag))}function NA(r,a){switch(Zm(a),a.tag){case 1:return r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 3:return $s(nn),Ce(),r=a.flags,(r&65536)!==0&&(r&128)===0?(a.flags=r&-65537|128,a):null;case 26:case 27:case 5:return Re(a),null;case 31:if(a.memoizedState!==null){if(dr(a),a.alternate===null)throw Error(s(340));fo()}return r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 13:if(dr(a),r=a.memoizedState,r!==null&&r.dehydrated!==null){if(a.alternate===null)throw Error(s(340));fo()}return r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 19:return F(Qt),null;case 4:return Ce(),null;case 10:return $s(a.type),null;case 22:case 23:return dr(a),up(),r!==null&&F(po),r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 24:return $s(nn),null;case 25:return null;default:return null}}function Dw(r,a){switch(Zm(a),a.tag){case 3:$s(nn),Ce();break;case 26:case 27:case 5:Re(a);break;case 4:Ce();break;case 31:a.memoizedState!==null&&dr(a);break;case 13:dr(a);break;case 19:F(Qt);break;case 10:$s(a.type);break;case 22:case 23:dr(a),up(),r!==null&&F(po);break;case 24:$s(nn)}}function xc(r,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&r)===r){f=void 0;var b=c.create,k=c.inst;f=b(),k.destroy=f}c=c.next}while(c!==x)}}catch(P){Ct(a,a.return,P)}}function Ca(r,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&r)===r){var k=f.inst,P=k.destroy;if(P!==void 0){k.destroy=void 0,x=a;var V=c,se=P;try{se()}catch(ce){Ct(x,V,ce)}}}f=f.next}while(f!==b)}}catch(ce){Ct(a,a.return,ce)}}function zw(r){var a=r.updateQueue;if(a!==null){var c=r.stateNode;try{N0(a,c)}catch(f){Ct(r,r.return,f)}}}function Pw(r,a,c){c.props=bo(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(f){Ct(r,a,f)}}function yc(r,a){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var f=r.stateNode;break;case 30:f=r.stateNode;break;default:f=r.stateNode}typeof c=="function"?r.refCleanup=c(f):c.current=f}}catch(x){Ct(r,a,x)}}function ms(r,a){var c=r.ref,f=r.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(x){Ct(r,a,x)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(x){Ct(r,a,x)}else c.current=null}function Lw(r){var a=r.type,c=r.memoizedProps,f=r.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){Ct(r,r.return,x)}}function Up(r,a,c){try{var f=r.stateNode;WA(f,r.type,c,a),f[Wn]=a}catch(x){Ct(r,r.return,x)}}function Iw(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Ra(r.type)||r.tag===4}function Vp(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Iw(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&Ra(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function qp(r,a,c){var f=r.tag;if(f===5||f===6)r=r.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(r,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(r),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=Ds));else if(f!==4&&(f===27&&Ra(r.type)&&(c=r.stateNode,a=null),r=r.child,r!==null))for(qp(r,a,c),r=r.sibling;r!==null;)qp(r,a,c),r=r.sibling}function Bd(r,a,c){var f=r.tag;if(f===5||f===6)r=r.stateNode,a?c.insertBefore(r,a):c.appendChild(r);else if(f!==4&&(f===27&&Ra(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(Bd(r,a,c),r=r.sibling;r!==null;)Bd(r,a,c),r=r.sibling}function $w(r){var a=r.stateNode,c=r.memoizedProps;try{for(var f=r.type,x=a.attributes;x.length;)a.removeAttributeNode(x[0]);Tn(a,f,c),a[Zt]=r,a[Wn]=c}catch(b){Ct(r,r.return,b)}}var qs=!1,an=!1,Hp=!1,Fw=typeof WeakSet=="function"?WeakSet:Set,jn=null;function kA(r,a){if(r=r.containerInfo,fg=cf,r=Xb(r),Im(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.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,V=-1,se=0,ce=0,he=r,oe=null;t:for(;;){for(var ie;he!==c||x!==0&&he.nodeType!==3||(P=k+x),he!==b||f!==0&&he.nodeType!==3||(V=k+f),he.nodeType===3&&(k+=he.nodeValue.length),(ie=he.firstChild)!==null;)oe=he,he=ie;for(;;){if(he===r)break t;if(oe===c&&++se===x&&(P=k),oe===b&&++ce===f&&(V=k),(ie=he.nextSibling)!==null)break;he=oe,oe=he.parentNode}he=ie}c=P===-1||V===-1?null:{start:P,end:V}}else c=null}c=c||{start:0,end:0}}else c=null;for(hg={focusedElem:r,selectionRange:c},cf=!1,jn=a;jn!==null;)if(a=jn,r=a.child,(a.subtreeFlags&1028)!==0&&r!==null)r.return=a,jn=r;else for(;jn!==null;){switch(a=jn,b=a.alternate,r=a.flags,a.tag){case 0:if((r&4)!==0&&(r=a.updateQueue,r=r!==null?r.events:null,r!==null))for(c=0;c<r.length;c++)x=r[c],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&b!==null){r=void 0,c=a,x=b.memoizedProps,b=b.memoizedState,f=c.stateNode;try{var Ee=bo(c.type,x);r=f.getSnapshotBeforeUpdate(Ee,b),f.__reactInternalSnapshotBeforeUpdate=r}catch(qe){Ct(c,c.return,qe)}}break;case 3:if((r&1024)!==0){if(r=a.stateNode.containerInfo,c=r.nodeType,c===9)gg(r);else if(c===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":gg(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(s(163))}if(r=a.sibling,r!==null){r.return=a.return,jn=r;break}jn=a.return}}function Bw(r,a,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:Ys(r,c),f&4&&xc(5,c);break;case 1:if(Ys(r,c),f&4)if(r=c.stateNode,a===null)try{r.componentDidMount()}catch(k){Ct(c,c.return,k)}else{var x=bo(c.type,a.memoizedProps);a=a.memoizedState;try{r.componentDidUpdate(x,a,r.__reactInternalSnapshotBeforeUpdate)}catch(k){Ct(c,c.return,k)}}f&64&&zw(c),f&512&&yc(c,c.return);break;case 3:if(Ys(r,c),f&64&&(r=c.updateQueue,r!==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{N0(r,a)}catch(k){Ct(c,c.return,k)}}break;case 27:a===null&&f&4&&$w(c);case 26:case 5:Ys(r,c),a===null&&f&4&&Lw(c),f&512&&yc(c,c.return);break;case 12:Ys(r,c);break;case 31:Ys(r,c),f&4&&qw(r,c);break;case 13:Ys(r,c),f&4&&Hw(r,c),f&64&&(r=c.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(c=zA.bind(null,c),tO(r,c))));break;case 22:if(f=c.memoizedState!==null||qs,!f){a=a!==null&&a.memoizedState!==null||an,x=qs;var b=an;qs=f,(an=a)&&!b?Ws(r,c,(c.subtreeFlags&8772)!==0):Ys(r,c),qs=x,an=b}break;case 30:break;default:Ys(r,c)}}function Uw(r){var a=r.alternate;a!==null&&(r.alternate=null,Uw(a)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(a=r.stateNode,a!==null&&wm(a)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Pt=null,Zn=!1;function Hs(r,a,c){for(c=c.child;c!==null;)Vw(r,a,c),c=c.sibling}function Vw(r,a,c){if(Vt&&typeof Vt.onCommitFiberUnmount=="function")try{Vt.onCommitFiberUnmount(Pn,c)}catch{}switch(c.tag){case 26:an||ms(c,a),Hs(r,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:an||ms(c,a);var f=Pt,x=Zn;Ra(c.type)&&(Pt=c.stateNode,Zn=!1),Hs(r,a,c),Ec(c.stateNode),Pt=f,Zn=x;break;case 5:an||ms(c,a);case 6:if(f=Pt,x=Zn,Pt=null,Hs(r,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){Ct(c,a,b)}else try{Pt.removeChild(c.stateNode)}catch(b){Ct(c,a,b)}break;case 18:Pt!==null&&(Zn?(r=Pt,zS(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,c.stateNode),Li(r)):zS(Pt,c.stateNode));break;case 4:f=Pt,x=Zn,Pt=c.stateNode.containerInfo,Zn=!0,Hs(r,a,c),Pt=f,Zn=x;break;case 0:case 11:case 14:case 15:Ca(2,c,a),an||Ca(4,c,a),Hs(r,a,c);break;case 1:an||(ms(c,a),f=c.stateNode,typeof f.componentWillUnmount=="function"&&Pw(c,a,f)),Hs(r,a,c);break;case 21:Hs(r,a,c);break;case 22:an=(f=an)||c.memoizedState!==null,Hs(r,a,c),an=f;break;default:Hs(r,a,c)}}function qw(r,a){if(a.memoizedState===null&&(r=a.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Li(r)}catch(c){Ct(a,a.return,c)}}}function Hw(r,a){if(a.memoizedState===null&&(r=a.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{Li(r)}catch(c){Ct(a,a.return,c)}}function _A(r){switch(r.tag){case 31:case 13:case 19:var a=r.stateNode;return a===null&&(a=r.stateNode=new Fw),a;case 22:return r=r.stateNode,a=r._retryCache,a===null&&(a=r._retryCache=new Fw),a;default:throw Error(s(435,r.tag))}}function Ud(r,a){var c=_A(r);a.forEach(function(f){if(!c.has(f)){c.add(f);var x=PA.bind(null,r,f);f.then(x,x)}})}function Qn(r,a){var c=a.deletions;if(c!==null)for(var f=0;f<c.length;f++){var x=c[f],b=r,k=a,P=k;e:for(;P!==null;){switch(P.tag){case 27:if(Ra(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(s(160));Vw(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;)Yw(a,r),a=a.sibling}var Zr=null;function Yw(r,a){var c=r.alternate,f=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Qn(a,r),Kn(r),f&4&&(Ca(3,r,r.return),xc(3,r),Ca(5,r,r.return));break;case 1:Qn(a,r),Kn(r),f&512&&(an||c===null||ms(c,c.return)),f&64&&qs&&(r=r.updateQueue,r!==null&&(f=r.callbacks,f!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var x=Zr;if(Qn(a,r),Kn(r),f&512&&(an||c===null||ms(c,c.return)),f&4){var b=c!==null?c.memoizedState:null;if(f=r.memoizedState,c===null)if(f===null)if(r.stateNode===null){e:{f=r.type,c=r.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]=r,Sn(b),f=b;break e;case"link":var k=YS("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=YS("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(s(468,f))}b[Zt]=r,Sn(b),f=b}r.stateNode=f}else WS(x,r.type,r.stateNode);else r.stateNode=HS(x,f,r.memoizedProps);else b!==f?(b===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):b.count--,f===null?WS(x,r.type,r.stateNode):HS(x,f,r.memoizedProps)):f===null&&r.stateNode!==null&&Up(r,r.memoizedProps,c.memoizedProps)}break;case 27:Qn(a,r),Kn(r),f&512&&(an||c===null||ms(c,c.return)),c!==null&&f&4&&Up(r,r.memoizedProps,c.memoizedProps);break;case 5:if(Qn(a,r),Kn(r),f&512&&(an||c===null||ms(c,c.return)),r.flags&32){x=r.stateNode;try{oi(x,"")}catch(Ee){Ct(r,r.return,Ee)}}f&4&&r.stateNode!=null&&(x=r.memoizedProps,Up(r,x,c!==null?c.memoizedProps:x)),f&1024&&(Hp=!0);break;case 6:if(Qn(a,r),Kn(r),f&4){if(r.stateNode===null)throw Error(s(162));f=r.memoizedProps,c=r.stateNode;try{c.nodeValue=f}catch(Ee){Ct(r,r.return,Ee)}}break;case 3:if(sf=null,x=Zr,Zr=nf(a.containerInfo),Qn(a,r),Zr=x,Kn(r),f&4&&c!==null&&c.memoizedState.isDehydrated)try{Li(a.containerInfo)}catch(Ee){Ct(r,r.return,Ee)}Hp&&(Hp=!1,Ww(r));break;case 4:f=Zr,Zr=nf(r.stateNode.containerInfo),Qn(a,r),Kn(r),Zr=f;break;case 12:Qn(a,r),Kn(r);break;case 31:Qn(a,r),Kn(r),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,Ud(r,f)));break;case 13:Qn(a,r),Kn(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(qd=ut()),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,Ud(r,f)));break;case 22:x=r.memoizedState!==null;var V=c!==null&&c.memoizedState!==null,se=qs,ce=an;if(qs=se||x,an=ce||V,Qn(a,r),an=ce,qs=se,Kn(r),f&8192)e:for(a=r.stateNode,a._visibility=x?a._visibility&-2:a._visibility|1,x&&(c===null||V||qs||an||wo(r)),c=null,a=r;;){if(a.tag===5||a.tag===26){if(c===null){V=c=a;try{if(b=V.stateNode,x)k=b.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none";else{P=V.stateNode;var he=V.memoizedProps.style,oe=he!=null&&he.hasOwnProperty("display")?he.display:null;P.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(Ee){Ct(V,V.return,Ee)}}}else if(a.tag===6){if(c===null){V=a;try{V.stateNode.nodeValue=x?"":V.memoizedProps}catch(Ee){Ct(V,V.return,Ee)}}}else if(a.tag===18){if(c===null){V=a;try{var ie=V.stateNode;x?PS(ie,!0):PS(V.stateNode,!1)}catch(Ee){Ct(V,V.return,Ee)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===r)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===r)break e;for(;a.sibling===null;){if(a.return===null||a.return===r)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}f&4&&(f=r.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,Ud(r,c))));break;case 19:Qn(a,r),Kn(r),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,Ud(r,f)));break;case 30:break;case 21:break;default:Qn(a,r),Kn(r)}}function Kn(r){var a=r.flags;if(a&2){try{for(var c,f=r.return;f!==null;){if(Iw(f)){c=f;break}f=f.return}if(c==null)throw Error(s(160));switch(c.tag){case 27:var x=c.stateNode,b=Vp(r);Bd(r,b,x);break;case 5:var k=c.stateNode;c.flags&32&&(oi(k,""),c.flags&=-33);var P=Vp(r);Bd(r,P,k);break;case 3:case 4:var V=c.stateNode.containerInfo,se=Vp(r);qp(r,se,V);break;default:throw Error(s(161))}}catch(ce){Ct(r,r.return,ce)}r.flags&=-3}a&4096&&(r.flags&=-4097)}function Ww(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var a=r;Ww(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),r=r.sibling}}function Ys(r,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Bw(r,a.alternate,a),a=a.sibling}function wo(r){for(r=r.child;r!==null;){var a=r;switch(a.tag){case 0:case 11:case 14:case 15:Ca(4,a,a.return),wo(a);break;case 1:ms(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&Pw(a,a.return,c),wo(a);break;case 27:Ec(a.stateNode);case 26:case 5:ms(a,a.return),wo(a);break;case 22:a.memoizedState===null&&wo(a);break;case 30:wo(a);break;default:wo(a)}r=r.sibling}}function Ws(r,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var f=a.alternate,x=r,b=a,k=b.flags;switch(b.tag){case 0:case 11:case 15:Ws(x,b,c),xc(4,b);break;case 1:if(Ws(x,b,c),f=b,x=f.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(se){Ct(f,f.return,se)}if(f=b,x=f.updateQueue,x!==null){var P=f.stateNode;try{var V=x.shared.hiddenCallbacks;if(V!==null)for(x.shared.hiddenCallbacks=null,x=0;x<V.length;x++)C0(V[x],P)}catch(se){Ct(f,f.return,se)}}c&&k&64&&zw(b),yc(b,b.return);break;case 27:$w(b);case 26:case 5:Ws(x,b,c),c&&f===null&&k&4&&Lw(b),yc(b,b.return);break;case 12:Ws(x,b,c);break;case 31:Ws(x,b,c),c&&k&4&&qw(x,b);break;case 13:Ws(x,b,c),c&&k&4&&Hw(x,b);break;case 22:b.memoizedState===null&&Ws(x,b,c),yc(b,b.return);break;case 30:break;default:Ws(x,b,c)}a=a.sibling}}function Yp(r,a){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(r=a.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&ac(c))}function Wp(r,a){r=null,a.alternate!==null&&(r=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==r&&(a.refCount++,r!=null&&ac(r))}function Qr(r,a,c,f){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Gw(r,a,c,f),a=a.sibling}function Gw(r,a,c,f){var x=a.flags;switch(a.tag){case 0:case 11:case 15:Qr(r,a,c,f),x&2048&&xc(9,a);break;case 1:Qr(r,a,c,f);break;case 3:Qr(r,a,c,f),x&2048&&(r=null,a.alternate!==null&&(r=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==r&&(a.refCount++,r!=null&&ac(r)));break;case 12:if(x&2048){Qr(r,a,c,f),r=a.stateNode;try{var b=a.memoizedProps,k=b.id,P=b.onPostCommit;typeof P=="function"&&P(k,a.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(V){Ct(a,a.return,V)}}else Qr(r,a,c,f);break;case 31:Qr(r,a,c,f);break;case 13:Qr(r,a,c,f);break;case 23:break;case 22:b=a.stateNode,k=a.alternate,a.memoizedState!==null?b._visibility&2?Qr(r,a,c,f):bc(r,a):b._visibility&2?Qr(r,a,c,f):(b._visibility|=2,ki(r,a,c,f,(a.subtreeFlags&10256)!==0||!1)),x&2048&&Yp(k,a);break;case 24:Qr(r,a,c,f),x&2048&&Wp(a.alternate,a);break;default:Qr(r,a,c,f)}}function ki(r,a,c,f,x){for(x=x&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var b=r,k=a,P=c,V=f,se=k.flags;switch(k.tag){case 0:case 11:case 15:ki(b,k,P,V,x),xc(8,k);break;case 23:break;case 22:var ce=k.stateNode;k.memoizedState!==null?ce._visibility&2?ki(b,k,P,V,x):bc(b,k):(ce._visibility|=2,ki(b,k,P,V,x)),x&&se&2048&&Yp(k.alternate,k);break;case 24:ki(b,k,P,V,x),x&&se&2048&&Wp(k.alternate,k);break;default:ki(b,k,P,V,x)}a=a.sibling}}function bc(r,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=r,f=a,x=f.flags;switch(f.tag){case 22:bc(c,f),x&2048&&Yp(f.alternate,f);break;case 24:bc(c,f),x&2048&&Wp(f.alternate,f);break;default:bc(c,f)}a=a.sibling}}var wc=8192;function _i(r,a,c){if(r.subtreeFlags&wc)for(r=r.child;r!==null;)Zw(r,a,c),r=r.sibling}function Zw(r,a,c){switch(r.tag){case 26:_i(r,a,c),r.flags&wc&&r.memoizedState!==null&&hO(c,Zr,r.memoizedState,r.memoizedProps);break;case 5:_i(r,a,c);break;case 3:case 4:var f=Zr;Zr=nf(r.stateNode.containerInfo),_i(r,a,c),Zr=f;break;case 22:r.memoizedState===null&&(f=r.alternate,f!==null&&f.memoizedState!==null?(f=wc,wc=16777216,_i(r,a,c),wc=f):_i(r,a,c));break;default:_i(r,a,c)}}function Qw(r){var a=r.alternate;if(a!==null&&(r=a.child,r!==null)){a.child=null;do a=r.sibling,r.sibling=null,r=a;while(r!==null)}}function Sc(r){var a=r.deletions;if((r.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];jn=f,Xw(f,r)}Qw(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Kw(r),r=r.sibling}function Kw(r){switch(r.tag){case 0:case 11:case 15:Sc(r),r.flags&2048&&Ca(9,r,r.return);break;case 3:Sc(r);break;case 12:Sc(r);break;case 22:var a=r.stateNode;r.memoizedState!==null&&a._visibility&2&&(r.return===null||r.return.tag!==13)?(a._visibility&=-3,Vd(r)):Sc(r);break;default:Sc(r)}}function Vd(r){var a=r.deletions;if((r.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];jn=f,Xw(f,r)}Qw(r)}for(r=r.child;r!==null;){switch(a=r,a.tag){case 0:case 11:case 15:Ca(8,a,a.return),Vd(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,Vd(a));break;default:Vd(a)}r=r.sibling}}function Xw(r,a){for(;jn!==null;){var c=jn;switch(c.tag){case 0:case 11:case 15:Ca(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=r;jn!==null;){f=jn;var x=f.sibling,b=f.return;if(Uw(f),f===c){jn=null;break e}if(x!==null){x.return=b,jn=x;break e}jn=b}}}var EA={getCacheForType:function(r){var a=_n(nn),c=a.data.get(r);return c===void 0&&(c=r(),a.data.set(r,c)),c},cacheSignal:function(){return _n(nn).controller.signal}},TA=typeof WeakMap=="function"?WeakMap:Map,xt=0,Rt=null,at=null,lt=0,jt=0,fr=null,Na=!1,Ei=!1,Gp=!1,Gs=0,Ht=0,ka=0,So=0,Zp=0,hr=0,Ti=0,jc=null,Xn=null,Qp=!1,qd=0,Jw=0,Hd=1/0,Yd=null,_a=null,fn=0,Ea=null,Mi=null,Zs=0,Kp=0,Xp=null,eS=null,Cc=0,Jp=null;function mr(){return(xt&2)!==0&&lt!==0?lt&-lt:L.T!==null?ag():vt()}function tS(){if(hr===0)if((lt&536870912)===0||dt){var r=we;we<<=1,(we&3932160)===0&&(we=262144),hr=r}else hr=536870912;return r=ur.current,r!==null&&(r.flags|=32),hr}function Jn(r,a,c){(r===Rt&&(jt===2||jt===9)||r.cancelPendingCommit!==null)&&(Ri(r,0),Ta(r,lt,hr,!1)),Ot(r,c),((xt&2)===0||r!==Rt)&&(r===Rt&&((xt&2)===0&&(So|=c),Ht===4&&Ta(r,lt,hr,!1)),ps(r))}function nS(r,a,c){if((xt&6)!==0)throw Error(s(327));var f=!c&&(a&127)===0&&(a&r.expiredLanes)===0||St(r,a),x=f?AA(r,a):tg(r,a,!0),b=f;do{if(x===0){Ei&&!f&&Ta(r,a,0,!1);break}else{if(c=r.current.alternate,b&&!MA(c)){x=tg(r,a,!1),b=!1;continue}if(x===2){if(b=a,r.errorRecoveryDisabledLanes&b)var k=0;else k=r.pendingLanes&-536870913,k=k!==0?k:k&536870912?536870912:0;if(k!==0){a=k;e:{var P=r;x=jc;var V=P.current.memoizedState.isDehydrated;if(V&&(Ri(P,k).flags|=256),k=tg(P,k,!1),k!==2){if(Gp&&!V){P.errorRecoveryDisabledLanes|=b,So|=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){Ri(r,0),Ta(r,a,0,!0);break}e:{switch(f=r,b=x,b){case 0:case 1:throw Error(s(345));case 4:if((a&4194048)!==a)break;case 6:Ta(f,a,hr,!Na);break e;case 2:Xn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((a&62914560)===a&&(x=qd+300-ut(),10<x)){if(Ta(f,a,hr,!Na),De(f,0,!0)!==0)break e;Zs=a,f.timeoutHandle=OS(rS.bind(null,f,c,Xn,Yd,Qp,a,hr,So,Ti,Na,b,"Throttled",-0,0),x);break e}rS(f,c,Xn,Yd,Qp,a,hr,So,Ti,Na,b,null,-0,0)}}break}while(!0);ps(r)}function rS(r,a,c,f,x,b,k,P,V,se,ce,he,oe,ie){if(r.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:Ds},Zw(a,b,he);var Ee=(b&62914560)===b?qd-ut():(b&4194048)===b?Jw-ut():0;if(Ee=mO(he,Ee),Ee!==null){Zs=b,r.cancelPendingCommit=Ee(dS.bind(null,r,a,b,c,f,x,k,P,V,ce,he,null,oe,ie)),Ta(r,b,k,!se);return}}dS(r,a,b,c,f,x,k,P,V)}function MA(r){for(var a=r;;){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(!lr(b(),x))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===r)break;for(;a.sibling===null;){if(a.return===null||a.return===r)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Ta(r,a,c,f){a&=~Zp,a&=~So,r.suspendedLanes|=a,r.pingedLanes&=~a,f&&(r.warmLanes|=a),f=r.expirationTimes;for(var x=a;0<x;){var b=31-$t(x),k=1<<b;f[b]=-1,x&=~k}c!==0&&Hn(r,c,a)}function Wd(){return(xt&6)===0?(Nc(0),!1):!0}function eg(){if(at!==null){if(jt===0)var r=at.return;else r=at,Is=ho=null,gp(r),wi=null,ic=0,r=at;for(;r!==null;)Dw(r.alternate,r),r=r.return;at=null}}function Ri(r,a){var c=r.timeoutHandle;c!==-1&&(r.timeoutHandle=-1,QA(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),Zs=0,eg(),Rt=r,at=c=Ps(r.current,null),lt=a,jt=0,fr=null,Na=!1,Ei=St(r,a),Gp=!1,Ti=hr=Zp=So=ka=Ht=0,Xn=jc=null,Qp=!1,(a&8)!==0&&(a|=a&32);var f=r.entangledLanes;if(f!==0)for(r=r.entanglements,f&=a;0<f;){var x=31-$t(f),b=1<<x;a|=r[x],f&=~b}return Gs=a,md(),c}function sS(r,a){Qe=null,L.H=pc,a===bi||a===Sd?(a=b0(),jt=3):a===sp?(a=b0(),jt=4):jt=a===Ap?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,fr=a,at===null&&(Ht=1,Pd(r,Tr(a,r.current)))}function aS(){var r=ur.current;return r===null?!0:(lt&4194048)===lt?Or===null:(lt&62914560)===lt||(lt&536870912)!==0?r===Or:!1}function oS(){var r=L.H;return L.H=pc,r===null?pc:r}function iS(){var r=L.A;return L.A=EA,r}function Gd(){Ht=4,Na||(lt&4194048)!==lt&&ur.current!==null||(Ei=!0),(ka&134217727)===0&&(So&134217727)===0||Rt===null||Ta(Rt,lt,hr,!1)}function tg(r,a,c){var f=xt;xt|=2;var x=oS(),b=iS();(Rt!==r||lt!==a)&&(Yd=null,Ri(r,a)),a=!1;var k=Ht;e:do try{if(jt!==0&&at!==null){var P=at,V=fr;switch(jt){case 8:eg(),k=6;break e;case 3:case 2:case 9:case 6:ur.current===null&&(a=!0);var se=jt;if(jt=0,fr=null,Ai(r,P,V,se),c&&Ei){k=0;break e}break;default:se=jt,jt=0,fr=null,Ai(r,P,V,se)}}RA(),k=Ht;break}catch(ce){sS(r,ce)}while(!0);return a&&r.shellSuspendCounter++,Is=ho=null,xt=f,L.H=x,L.A=b,at===null&&(Rt=null,lt=0,md()),k}function RA(){for(;at!==null;)lS(at)}function AA(r,a){var c=xt;xt|=2;var f=oS(),x=iS();Rt!==r||lt!==a?(Yd=null,Hd=ut()+500,Ri(r,a)):Ei=St(r,a);e:do try{if(jt!==0&&at!==null){a=at;var b=fr;t:switch(jt){case 1:jt=0,fr=null,Ai(r,a,b,1);break;case 2:case 9:if(x0(b)){jt=0,fr=null,cS(a);break}a=function(){jt!==2&&jt!==9||Rt!==r||(jt=7),ps(r)},b.then(a,a);break e;case 3:jt=7;break e;case 4:jt=5;break e;case 7:x0(b)?(jt=0,fr=null,cS(a)):(jt=0,fr=null,Ai(r,a,b,7));break;case 5:var k=null;switch(at.tag){case 26:k=at.memoizedState;case 5:case 27:var P=at;if(k?GS(k):P.stateNode.complete){jt=0,fr=null;var V=P.sibling;if(V!==null)at=V;else{var se=P.return;se!==null?(at=se,Zd(se)):at=null}break t}}jt=0,fr=null,Ai(r,a,b,5);break;case 6:jt=0,fr=null,Ai(r,a,b,6);break;case 8:eg(),Ht=6;break e;default:throw Error(s(462))}}OA();break}catch(ce){sS(r,ce)}while(!0);return Is=ho=null,L.H=f,L.A=x,xt=c,at!==null?0:(Rt=null,lt=0,md(),Ht)}function OA(){for(;at!==null&&!Oe();)lS(at)}function lS(r){var a=Aw(r.alternate,r,Gs);r.memoizedProps=r.pendingProps,a===null?Zd(r):at=a}function cS(r){var a=r,c=a.alternate;switch(a.tag){case 15:case 0:a=kw(c,a,a.pendingProps,a.type,void 0,lt);break;case 11:a=kw(c,a,a.pendingProps,a.type.render,a.ref,lt);break;case 5:gp(a);default:Dw(c,a),a=at=i0(a,Gs),a=Aw(c,a,Gs)}r.memoizedProps=r.pendingProps,a===null?Zd(r):at=a}function Ai(r,a,c,f){Is=ho=null,gp(a),wi=null,ic=0;var x=a.return;try{if(wA(r,x,a,c,lt)){Ht=1,Pd(r,Tr(c,r.current)),at=null;return}}catch(b){if(x!==null)throw at=x,b;Ht=1,Pd(r,Tr(c,r.current)),at=null;return}a.flags&32768?(dt||f===1?r=!0:Ei||(lt&536870912)!==0?r=!1:(Na=r=!0,(f===2||f===9||f===3||f===6)&&(f=ur.current,f!==null&&f.tag===13&&(f.flags|=16384))),uS(a,r)):Zd(a)}function Zd(r){var a=r;do{if((a.flags&32768)!==0){uS(a,Na);return}r=a.return;var c=CA(a.alternate,a,Gs);if(c!==null){at=c;return}if(a=a.sibling,a!==null){at=a;return}at=a=r}while(a!==null);Ht===0&&(Ht=5)}function uS(r,a){do{var c=NA(r.alternate,r);if(c!==null){c.flags&=32767,at=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(r=r.sibling,r!==null)){at=r;return}at=r=c}while(r!==null);Ht=6,at=null}function dS(r,a,c,f,x,b,k,P,V){r.cancelPendingCommit=null;do Qd();while(fn!==0);if((xt&6)!==0)throw Error(s(327));if(a!==null){if(a===r.current)throw Error(s(177));if(b=a.lanes|a.childLanes,b|=Vm,Rn(r,c,b,k,P,V),r===Rt&&(at=Rt=null,lt=0),Mi=a,Ea=r,Zs=c,Kp=b,Xp=x,eS=f,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,LA(gt,function(){return gS(),null})):(r.callbackNode=null,r.callbackPriority=0),f=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||f){f=L.T,L.T=null,x=$.p,$.p=2,k=xt,xt|=4;try{kA(r,a,c)}finally{xt=k,$.p=x,L.T=f}}fn=1,fS(),hS(),mS()}}function fS(){if(fn===1){fn=0;var r=Ea,a=Mi,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=L.T,L.T=null;var f=$.p;$.p=2;var x=xt;xt|=4;try{Yw(a,r);var b=hg,k=Xb(r.containerInfo),P=b.focusedElem,V=b.selectionRange;if(k!==P&&P&&P.ownerDocument&&Kb(P.ownerDocument.documentElement,P)){if(V!==null&&Im(P)){var se=V.start,ce=V.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(V.start,Ee),Tt=V.end===void 0?qe:Math.min(V.end,Ee);!ie.extend&&qe>Tt&&(k=Tt,Tt=qe,qe=k);var J=Qb(P,qe),Z=Qb(P,Tt);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>Tt?(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}}cf=!!fg,hg=fg=null}finally{xt=x,$.p=f,L.T=c}}r.current=a,fn=2}}function hS(){if(fn===2){fn=0;var r=Ea,a=Mi,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=L.T,L.T=null;var f=$.p;$.p=2;var x=xt;xt|=4;try{Bw(r,a.alternate,a)}finally{xt=x,$.p=f,L.T=c}}fn=3}}function mS(){if(fn===4||fn===3){fn=0,ft();var r=Ea,a=Mi,c=Zs,f=eS;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?fn=5:(fn=0,Mi=Ea=null,pS(r,r.pendingLanes));var x=r.pendingLanes;if(x===0&&(_a=null),Ve(c),a=a.stateNode,Vt&&typeof Vt.onCommitFiberRoot=="function")try{Vt.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=r.onRecoverableError,k=0;k<f.length;k++){var P=f[k];b(P.value,{componentStack:P.stack})}}finally{L.T=a,$.p=x}}(Zs&3)!==0&&Qd(),ps(r),x=r.pendingLanes,(c&261930)!==0&&(x&42)!==0?r===Jp?Cc++:(Cc=0,Jp=r):Cc=0,Nc(0)}}function pS(r,a){(r.pooledCacheLanes&=a)===0&&(a=r.pooledCache,a!=null&&(r.pooledCache=null,ac(a)))}function Qd(){return fS(),hS(),mS(),gS()}function gS(){if(fn!==5)return!1;var r=Ea,a=Kp;Kp=0;var c=Ve(Zs),f=L.T,x=$.p;try{$.p=32>c?32:c,L.T=null,c=Xp,Xp=null;var b=Ea,k=Zs;if(fn=0,Mi=Ea=null,Zs=0,(xt&6)!==0)throw Error(s(331));var P=xt;if(xt|=4,Kw(b.current),Gw(b,b.current,k,c),xt=P,Nc(0,!1),Vt&&typeof Vt.onPostCommitFiberRoot=="function")try{Vt.onPostCommitFiberRoot(Pn,b)}catch{}return!0}finally{$.p=x,L.T=f,pS(r,a)}}function vS(r,a,c){a=Tr(c,a),a=Rp(r.stateNode,a,2),r=wa(r,a,2),r!==null&&(Ot(r,2),ps(r))}function Ct(r,a,c){if(r.tag===3)vS(r,r,c);else for(;a!==null;){if(a.tag===3){vS(a,r,c);break}else if(a.tag===1){var f=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(_a===null||!_a.has(f))){r=Tr(c,r),c=xw(2),f=wa(a,c,2),f!==null&&(yw(c,f,a,r),Ot(f,2),ps(f));break}}a=a.return}}function ng(r,a,c){var f=r.pingCache;if(f===null){f=r.pingCache=new TA;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)||(Gp=!0,x.add(c),r=DA.bind(null,r,a,c),a.then(r,r))}function DA(r,a,c){var f=r.pingCache;f!==null&&f.delete(a),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,Rt===r&&(lt&c)===c&&(Ht===4||Ht===3&&(lt&62914560)===lt&&300>ut()-qd?(xt&2)===0&&Ri(r,0):Zp|=c,Ti===lt&&(Ti=0)),ps(r)}function xS(r,a){a===0&&(a=tn()),r=co(r,a),r!==null&&(Ot(r,a),ps(r))}function zA(r){var a=r.memoizedState,c=0;a!==null&&(c=a.retryLane),xS(r,c)}function PA(r,a){var c=0;switch(r.tag){case 31:case 13:var f=r.stateNode,x=r.memoizedState;x!==null&&(c=x.retryLane);break;case 19:f=r.stateNode;break;case 22:f=r.stateNode._retryCache;break;default:throw Error(s(314))}f!==null&&f.delete(a),xS(r,c)}function LA(r,a){return Le(r,a)}var Kd=null,Oi=null,rg=!1,Xd=!1,sg=!1,Ma=0;function ps(r){r!==Oi&&r.next===null&&(Oi===null?Kd=Oi=r:Oi=Oi.next=r),Xd=!0,rg||(rg=!0,$A())}function Nc(r,a){if(!sg&&Xd){sg=!0;do for(var c=!1,f=Kd;f!==null;){if(r!==0){var x=f.pendingLanes;if(x===0)var b=0;else{var k=f.suspendedLanes,P=f.pingedLanes;b=(1<<31-$t(42|r)+1)-1,b&=x&~(k&~P),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(c=!0,SS(f,b))}else b=lt,b=De(f,f===Rt?b:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(b&3)===0||St(f,b)||(c=!0,SS(f,b));f=f.next}while(c);sg=!1}}function IA(){yS()}function yS(){Xd=rg=!1;var r=0;Ma!==0&&ZA()&&(r=Ma);for(var a=ut(),c=null,f=Kd;f!==null;){var x=f.next,b=bS(f,a);b===0?(f.next=null,c===null?Kd=x:c.next=x,x===null&&(Oi=c)):(c=f,(r!==0||(b&3)!==0)&&(Xd=!0)),f=x}fn!==0&&fn!==5||Nc(r),Ma!==0&&(Ma=0)}function bS(r,a){for(var c=r.suspendedLanes,f=r.pingedLanes,x=r.expirationTimes,b=r.pendingLanes&-62914561;0<b;){var k=31-$t(b),P=1<<k,V=x[k];V===-1?((P&c)===0||(P&f)!==0)&&(x[k]=bn(P,a)):V<=a&&(r.expiredLanes|=P),b&=~P}if(a=Rt,c=lt,c=De(r,r===a?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),f=r.callbackNode,c===0||r===a&&(jt===2||jt===9)||r.cancelPendingCommit!==null)return f!==null&&f!==null&&We(f),r.callbackNode=null,r.callbackPriority=0;if((c&3)===0||St(r,c)){if(a=c&-c,a===r.callbackPriority)return a;switch(f!==null&&We(f),Ve(c)){case 2:case 8:c=wt;break;case 32:c=gt;break;case 268435456:c=ir;break;default:c=gt}return f=wS.bind(null,r),c=Le(c,f),r.callbackPriority=a,r.callbackNode=c,a}return f!==null&&f!==null&&We(f),r.callbackPriority=2,r.callbackNode=null,2}function wS(r,a){if(fn!==0&&fn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(Qd()&&r.callbackNode!==c)return null;var f=lt;return f=De(r,r===Rt?f:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),f===0?null:(nS(r,f,a),bS(r,ut()),r.callbackNode!=null&&r.callbackNode===c?wS.bind(null,r):null)}function SS(r,a){if(Qd())return null;nS(r,a,!0)}function $A(){KA(function(){(xt&6)!==0?Le(Xe,IA):yS()})}function ag(){if(Ma===0){var r=xi;r===0&&(r=ke,ke<<=1,(ke&261888)===0&&(ke=256)),Ma=r}return Ma}function jS(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:od(""+r)}function CS(r,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,r.id&&c.setAttribute("form",r.id),a.parentNode.insertBefore(c,a),r=new FormData(r),c.parentNode.removeChild(c),r}function FA(r,a,c,f,x){if(a==="submit"&&c&&c.stateNode===x){var b=jS((x[Wn]||null).action),k=f.submitter;k&&(a=(a=k[Wn]||null)?jS(a.formAction):k.getAttribute("formAction"),a!==null&&(b=a,k=null));var P=new ud("action","action",null,f,x);r.push({event:P,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(Ma!==0){var V=k?CS(x,k):new FormData(x);Np(c,{pending:!0,data:V,method:x.method,action:b},null,V)}}else typeof b=="function"&&(P.preventDefault(),V=k?CS(x,k):new FormData(x),Np(c,{pending:!0,data:V,method:x.method,action:b},b,V))},currentTarget:x}]})}}for(var og=0;og<Um.length;og++){var ig=Um[og],BA=ig.toLowerCase(),UA=ig[0].toUpperCase()+ig.slice(1);Gr(BA,"on"+UA)}Gr(t0,"onAnimationEnd"),Gr(n0,"onAnimationIteration"),Gr(r0,"onAnimationStart"),Gr("dblclick","onDoubleClick"),Gr("focusin","onFocus"),Gr("focusout","onBlur"),Gr(sA,"onTransitionRun"),Gr(aA,"onTransitionStart"),Gr(oA,"onTransitionCancel"),Gr(s0,"onTransitionEnd"),si("onMouseEnter",["mouseout","mouseover"]),si("onMouseLeave",["mouseout","mouseover"]),si("onPointerEnter",["pointerout","pointerover"]),si("onPointerLeave",["pointerout","pointerover"]),ao("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ao("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ao("onBeforeInput",["compositionend","keypress","textInput","paste"]),ao("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ao("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ao("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(" "),VA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(kc));function NS(r,a){a=(a&4)!==0;for(var c=0;c<r.length;c++){var f=r[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],V=P.instance,se=P.currentTarget;if(P=P.listener,V!==b&&x.isPropagationStopped())break e;b=P,x.currentTarget=se;try{b(x)}catch(ce){hd(ce)}x.currentTarget=null,b=V}else for(k=0;k<f.length;k++){if(P=f[k],V=P.instance,se=P.currentTarget,P=P.listener,V!==b&&x.isPropagationStopped())break e;b=P,x.currentTarget=se;try{b(x)}catch(ce){hd(ce)}x.currentTarget=null,b=V}}}}function ot(r,a){var c=a[bm];c===void 0&&(c=a[bm]=new Set);var f=r+"__bubble";c.has(f)||(kS(a,r,2,!1),c.add(f))}function lg(r,a,c){var f=0;a&&(f|=4),kS(c,r,f,a)}var Jd="_reactListening"+Math.random().toString(36).slice(2);function cg(r){if(!r[Jd]){r[Jd]=!0,yb.forEach(function(c){c!=="selectionchange"&&(VA.has(c)||lg(c,!1,r),lg(c,!0,r))});var a=r.nodeType===9?r:r.ownerDocument;a===null||a[Jd]||(a[Jd]=!0,lg("selectionchange",!1,a))}}function kS(r,a,c,f){switch(t1(a)){case 2:var x=vO;break;case 8:x=xO;break;default:x=Cg}c=x.bind(null,a,c,r),x=void 0,!Tm||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(x=!0),f?x!==void 0?r.addEventListener(a,c,{capture:!0,passive:x}):r.addEventListener(a,c,!0):x!==void 0?r.addEventListener(a,c,{passive:x}):r.addEventListener(a,c,!1)}function ug(r,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 V=k.tag;if((V===3||V===4)&&k.stateNode.containerInfo===x)return;k=k.return}for(;P!==null;){if(k=ti(P),k===null)return;if(V=k.tag,V===5||V===6||V===26||V===27){f=b=k;continue e}P=P.parentNode}}f=f.return}Rb(function(){var se=b,ce=_m(c),he=[];e:{var oe=a0.get(r);if(oe!==void 0){var ie=ud,Ee=r;switch(r){case"keypress":if(ld(c)===0)break e;case"keydown":case"keyup":ie=PR;break;case"focusin":Ee="focus",ie=Om;break;case"focusout":Ee="blur",ie=Om;break;case"beforeblur":case"afterblur":ie=Om;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=Db;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=CR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=$R;break;case t0:case n0:case r0:ie=_R;break;case s0:ie=BR;break;case"scroll":case"scrollend":ie=SR;break;case"wheel":ie=VR;break;case"copy":case"cut":case"paste":ie=TR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=Pb;break;case"toggle":case"beforetoggle":ie=HR}var qe=(a&4)!==0,Tt=!qe&&(r==="scroll"||r==="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))),Tt)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=r==="mouseover"||r==="pointerover",ie=r==="mouseout"||r==="pointerout",oe&&c!==km&&(Ee=c.relatedTarget||c.fromElement)&&(ti(Ee)||Ee[ei]))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?ti(Ee):null,Ee!==null&&(Tt=l(Ee),qe=Ee.tag,Ee!==Tt||qe!==5&&qe!==27&&qe!==6)&&(Ee=null)):(ie=null,Ee=se),ie!==Ee)){if(qe=Db,de="onMouseLeave",J="onMouseEnter",Z="mouse",(r==="pointerout"||r==="pointerover")&&(qe=Pb,de="onPointerLeave",J="onPointerEnter",Z="pointer"),Tt=ie==null?oe:Wl(ie),re=Ee==null?oe:Wl(Ee),oe=new qe(de,Z+"leave",ie,c,ce),oe.target=Tt,oe.relatedTarget=re,de=null,ti(ce)===se&&(qe=new qe(J,Z+"enter",Ee,c,ce),qe.target=re,qe.relatedTarget=Tt,de=qe),Tt=de,ie&&Ee)t:{for(qe=qA,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&&_S(he,oe,ie,qe,!1),Ee!==null&&Tt!==null&&_S(he,Tt,Ee,qe,!0)}}e:{if(oe=se?Wl(se):window,ie=oe.nodeName&&oe.nodeName.toLowerCase(),ie==="select"||ie==="input"&&oe.type==="file")var ht=qb;else if(Ub(oe))if(Hb)ht=tA;else{ht=JR;var Ae=XR}else ie=oe.nodeName,!ie||ie.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?se&&Nm(se.elementType)&&(ht=qb):ht=eA;if(ht&&(ht=ht(r,se))){Vb(he,ht,c,ce);break e}Ae&&Ae(r,oe,se),r==="focusout"&&se&&oe.type==="number"&&se.memoizedProps.value!=null&&Cm(oe,"number",oe.value)}switch(Ae=se?Wl(se):window,r){case"focusin":(Ub(Ae)||Ae.contentEditable==="true")&&(ui=Ae,$m=se,nc=null);break;case"focusout":nc=$m=ui=null;break;case"mousedown":Fm=!0;break;case"contextmenu":case"mouseup":case"dragend":Fm=!1,Jb(he,c,ce);break;case"selectionchange":if(rA)break;case"keydown":case"keyup":Jb(he,c,ce)}var et;if(zm)e:{switch(r){case"compositionstart":var ct="onCompositionStart";break e;case"compositionend":ct="onCompositionEnd";break e;case"compositionupdate":ct="onCompositionUpdate";break e}ct=void 0}else ci?Fb(r,c)&&(ct="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(ct="onCompositionStart");ct&&(Lb&&c.locale!=="ko"&&(ci||ct!=="onCompositionStart"?ct==="onCompositionEnd"&&ci&&(et=Ab()):(ma=ce,Mm="value"in ma?ma.value:ma.textContent,ci=!0)),Ae=ef(se,ct),0<Ae.length&&(ct=new zb(ct,r,null,c,ce),he.push({event:ct,listeners:Ae}),et?ct.data=et:(et=Bb(c),et!==null&&(ct.data=et)))),(et=WR?GR(r,c):ZR(r,c))&&(ct=ef(se,"onBeforeInput"),0<ct.length&&(Ae=new zb("onBeforeInput","beforeinput",null,c,ce),he.push({event:Ae,listeners:ct}),Ae.data=et)),FA(he,r,se,c,ce)}NS(he,a)})}function _c(r,a,c){return{instance:r,listener:a,currentTarget:c}}function ef(r,a){for(var c=a+"Capture",f=[];r!==null;){var x=r,b=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||b===null||(x=Gl(r,c),x!=null&&f.unshift(_c(r,x,b)),x=Gl(r,a),x!=null&&f.push(_c(r,x,b))),r.tag===3)return f;r=r.return}return[]}function qA(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function _S(r,a,c,f,x){for(var b=a._reactName,k=[];c!==null&&c!==f;){var P=c,V=P.alternate,se=P.stateNode;if(P=P.tag,V!==null&&V===f)break;P!==5&&P!==26&&P!==27||se===null||(V=se,x?(se=Gl(c,b),se!=null&&k.unshift(_c(c,se,V))):x||(se=Gl(c,b),se!=null&&k.push(_c(c,se,V)))),c=c.return}k.length!==0&&r.push({event:a,listeners:k})}var HA=/\r\n?/g,YA=/\u0000|\uFFFD/g;function ES(r){return(typeof r=="string"?r:""+r).replace(HA,`
9
+ `).replace(YA,"")}function TS(r,a){return a=ES(a),ES(r)===a}function Et(r,a,c,f,x,b){switch(c){case"children":typeof f=="string"?a==="body"||a==="textarea"&&f===""||oi(r,f):(typeof f=="number"||typeof f=="bigint")&&a!=="body"&&oi(r,""+f);break;case"className":sd(r,"class",f);break;case"tabIndex":sd(r,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":sd(r,c,f);break;case"style":Tb(r,f,b);break;case"data":if(a!=="object"){sd(r,"data",f);break}case"src":case"href":if(f===""&&(a!=="a"||c!=="href")){r.removeAttribute(c);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){r.removeAttribute(c);break}f=od(""+f),r.setAttribute(c,f);break;case"action":case"formAction":if(typeof f=="function"){r.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"&&Et(r,a,"name",x.name,x,null),Et(r,a,"formEncType",x.formEncType,x,null),Et(r,a,"formMethod",x.formMethod,x,null),Et(r,a,"formTarget",x.formTarget,x,null)):(Et(r,a,"encType",x.encType,x,null),Et(r,a,"method",x.method,x,null),Et(r,a,"target",x.target,x,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){r.removeAttribute(c);break}f=od(""+f),r.setAttribute(c,f);break;case"onClick":f!=null&&(r.onclick=Ds);break;case"onScroll":f!=null&&ot("scroll",r);break;case"onScrollEnd":f!=null&&ot("scrollend",r);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(s(61));if(c=f.__html,c!=null){if(x.children!=null)throw Error(s(60));r.innerHTML=c}}break;case"multiple":r.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":r.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"){r.removeAttribute("xlink:href");break}c=od(""+f),r.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"?r.setAttribute(c,""+f):r.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"?r.setAttribute(c,""):r.removeAttribute(c);break;case"capture":case"download":f===!0?r.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?r.setAttribute(c,f):r.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?r.setAttribute(c,f):r.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?r.removeAttribute(c):r.setAttribute(c,f);break;case"popover":ot("beforetoggle",r),ot("toggle",r),rd(r,"popover",f);break;case"xlinkActuate":Os(r,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Os(r,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Os(r,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Os(r,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Os(r,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Os(r,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Os(r,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Os(r,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Os(r,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":rd(r,"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=bR.get(c)||c,rd(r,c,f))}}function dg(r,a,c,f,x,b){switch(c){case"style":Tb(r,f,b);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(s(61));if(c=f.__html,c!=null){if(x.children!=null)throw Error(s(60));r.innerHTML=c}}break;case"children":typeof f=="string"?oi(r,f):(typeof f=="number"||typeof f=="bigint")&&oi(r,""+f);break;case"onScroll":f!=null&&ot("scroll",r);break;case"onScrollEnd":f!=null&&ot("scrollend",r);break;case"onClick":f!=null&&(r.onclick=Ds);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!bb.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=r[Wn]||null,b=b!=null?b[c]:null,typeof b=="function"&&r.removeEventListener(a,b,x),typeof f=="function")){typeof b!="function"&&b!==null&&(c in r?r[c]=null:r.hasAttribute(c)&&r.removeAttribute(c)),r.addEventListener(a,f,x);break e}c in r?r[c]=f:f===!0?r.setAttribute(c,""):rd(r,c,f)}}}function Tn(r,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ot("error",r),ot("load",r);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(s(137,a));default:Et(r,a,b,k,c,null)}}x&&Et(r,a,"srcSet",c.srcSet,c,null),f&&Et(r,a,"src",c.src,c,null);return;case"input":ot("invalid",r);var P=b=k=x=null,V=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":V=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(s(137,a));break;default:Et(r,a,f,ce,c,null)}}Nb(r,b,P,V,se,k,x,!1);return;case"select":ot("invalid",r),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:Et(r,a,x,P,c,null)}a=b,c=k,r.multiple=!!f,a!=null?ai(r,!!f,a,!1):c!=null&&ai(r,!!f,c,!0);return;case"textarea":ot("invalid",r),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(s(91));break;default:Et(r,a,k,P,c,null)}_b(r,f,x,b);return;case"option":for(V in c)c.hasOwnProperty(V)&&(f=c[V],f!=null)&&(V==="selected"?r.selected=f&&typeof f!="function"&&typeof f!="symbol":Et(r,a,V,f,c,null));return;case"dialog":ot("beforetoggle",r),ot("toggle",r),ot("cancel",r),ot("close",r);break;case"iframe":case"object":ot("load",r);break;case"video":case"audio":for(f=0;f<kc.length;f++)ot(kc[f],r);break;case"image":ot("error",r),ot("load",r);break;case"details":ot("toggle",r);break;case"embed":case"source":case"link":ot("error",r),ot("load",r);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(s(137,a));default:Et(r,a,se,f,c,null)}return;default:if(Nm(a)){for(ce in c)c.hasOwnProperty(ce)&&(f=c[ce],f!==void 0&&dg(r,a,ce,f,c,void 0));return}}for(P in c)c.hasOwnProperty(P)&&(f=c[P],f!=null&&Et(r,a,P,f,c,null))}function WA(r,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,V=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":V=he;default:f.hasOwnProperty(ie)||Et(r,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(s(137,a));break;default:ie!==he&&Et(r,a,oe,ie,f,he)}}jm(r,k,P,V,se,ce,b,x);return;case"select":ie=k=P=oe=null;for(b in c)if(V=c[b],c.hasOwnProperty(b)&&V!=null)switch(b){case"value":break;case"multiple":ie=V;default:f.hasOwnProperty(b)||Et(r,a,b,null,f,V)}for(x in f)if(b=f[x],V=c[x],f.hasOwnProperty(x)&&(b!=null||V!=null))switch(x){case"value":oe=b;break;case"defaultValue":P=b;break;case"multiple":k=b;default:b!==V&&Et(r,a,x,b,f,V)}a=P,c=k,f=ie,oe!=null?ai(r,!!c,oe,!1):!!f!=!!c&&(a!=null?ai(r,!!c,a,!0):ai(r,!!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:Et(r,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(s(91));break;default:x!==b&&Et(r,a,k,x,f,b)}kb(r,oe,ie);return;case"option":for(var Ee in c)oe=c[Ee],c.hasOwnProperty(Ee)&&oe!=null&&!f.hasOwnProperty(Ee)&&(Ee==="selected"?r.selected=!1:Et(r,a,Ee,null,f,oe));for(V in f)oe=f[V],ie=c[V],f.hasOwnProperty(V)&&oe!==ie&&(oe!=null||ie!=null)&&(V==="selected"?r.selected=oe&&typeof oe!="function"&&typeof oe!="symbol":Et(r,a,V,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)&&Et(r,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(s(137,a));break;default:Et(r,a,se,oe,f,ie)}return;default:if(Nm(a)){for(var Tt in c)oe=c[Tt],c.hasOwnProperty(Tt)&&oe!==void 0&&!f.hasOwnProperty(Tt)&&dg(r,a,Tt,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||dg(r,a,ce,oe,f,ie);return}}for(var J in c)oe=c[J],c.hasOwnProperty(J)&&oe!=null&&!f.hasOwnProperty(J)&&Et(r,a,J,null,f,oe);for(he in f)oe=f[he],ie=c[he],!f.hasOwnProperty(he)||oe===ie||oe==null&&ie==null||Et(r,a,he,oe,f,ie)}function MS(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function GA(){if(typeof performance.getEntriesByType=="function"){for(var r=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&&MS(k)){for(k=0,P=x.responseEnd,f+=1;f<c.length;f++){var V=c[f],se=V.startTime;if(se>P)break;var ce=V.transferSize,he=V.initiatorType;ce&&MS(he)&&(V=V.responseEnd,k+=ce*(V<P?1:(P-se)/(V-se)))}if(--f,a+=8*(b+k)/(x.duration/1e3),r++,10<r)break}}if(0<r)return a/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var fg=null,hg=null;function tf(r){return r.nodeType===9?r:r.ownerDocument}function RS(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function AS(r,a){if(r===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&a==="foreignObject"?0:r}function mg(r,a){return r==="textarea"||r==="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 pg=null;function ZA(){var r=window.event;return r&&r.type==="popstate"?r===pg?!1:(pg=r,!0):(pg=null,!1)}var OS=typeof setTimeout=="function"?setTimeout:void 0,QA=typeof clearTimeout=="function"?clearTimeout:void 0,DS=typeof Promise=="function"?Promise:void 0,KA=typeof queueMicrotask=="function"?queueMicrotask:typeof DS<"u"?function(r){return DS.resolve(null).then(r).catch(XA)}:OS;function XA(r){setTimeout(function(){throw r})}function Ra(r){return r==="head"}function zS(r,a){var c=a,f=0;do{var x=c.nextSibling;if(r.removeChild(c),x&&x.nodeType===8)if(c=x.data,c==="/$"||c==="/&"){if(f===0){r.removeChild(x),Li(a);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")Ec(r.ownerDocument.documentElement);else if(c==="head"){c=r.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(r.ownerDocument.body);c=x}while(c);Li(a)}function PS(r,a){var c=r;r=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(r===0)break;r--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||r++;c=f}while(c)}function gg(r){var a=r.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":gg(c),wm(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}r.removeChild(c)}}function JA(r,a,c,f){for(;r.nodeType===1;){var x=c;if(r.nodeName.toLowerCase()!==a.toLowerCase()){if(!f&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(f){if(!r[Yl])switch(a){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(b=r.getAttribute("rel"),b==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(b!==x.rel||r.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||r.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||r.getAttribute("title")!==(x.title==null?null:x.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(b=r.getAttribute("src"),(b!==(x.src==null?null:x.src)||r.getAttribute("type")!==(x.type==null?null:x.type)||r.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&b&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(a==="input"&&r.type==="hidden"){var b=x.name==null?null:""+x.name;if(x.type==="hidden"&&r.getAttribute("name")===b)return r}else return r;if(r=Dr(r.nextSibling),r===null)break}return null}function eO(r,a,c){if(a==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!c||(r=Dr(r.nextSibling),r===null))return null;return r}function LS(r,a){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!a||(r=Dr(r.nextSibling),r===null))return null;return r}function vg(r){return r.data==="$?"||r.data==="$~"}function xg(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function tO(r,a){var c=r.ownerDocument;if(r.data==="$~")r._reactRetry=a;else if(r.data!=="$?"||c.readyState!=="loading")a();else{var f=function(){a(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),r._reactRetry=f}}function Dr(r){for(;r!=null;r=r.nextSibling){var a=r.nodeType;if(a===1||a===3)break;if(a===8){if(a=r.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return r}var yg=null;function IS(r){r=r.nextSibling;for(var a=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"||c==="/&"){if(a===0)return Dr(r.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}r=r.nextSibling}return null}function $S(r){r=r.previousSibling;for(var a=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return r;a--}else c!=="/$"&&c!=="/&"||a++}r=r.previousSibling}return null}function FS(r,a,c){switch(a=tf(c),r){case"html":if(r=a.documentElement,!r)throw Error(s(452));return r;case"head":if(r=a.head,!r)throw Error(s(453));return r;case"body":if(r=a.body,!r)throw Error(s(454));return r;default:throw Error(s(451))}}function Ec(r){for(var a=r.attributes;a.length;)r.removeAttributeNode(a[0]);wm(r)}var zr=new Map,BS=new Set;function nf(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Qs=$.d;$.d={f:nO,r:rO,D:sO,C:aO,L:oO,m:iO,X:cO,S:lO,M:uO};function nO(){var r=Qs.f(),a=Wd();return r||a}function rO(r){var a=ni(r);a!==null&&a.tag===5&&a.type==="form"?sw(a):Qs.r(r)}var Di=typeof document>"u"?null:document;function US(r,a,c){var f=Di;if(f&&typeof a=="string"&&a){var x=_r(a);x='link[rel="'+r+'"][href="'+x+'"]',typeof c=="string"&&(x+='[crossorigin="'+c+'"]'),BS.has(x)||(BS.add(x),r={rel:r,crossOrigin:c,href:a},f.querySelector(x)===null&&(a=f.createElement("link"),Tn(a,"link",r),Sn(a),f.head.appendChild(a)))}}function sO(r){Qs.D(r),US("dns-prefetch",r,null)}function aO(r,a){Qs.C(r,a),US("preconnect",r,a)}function oO(r,a,c){Qs.L(r,a,c);var f=Di;if(f&&r&&a){var x='link[rel="preload"][as="'+_r(a)+'"]';a==="image"&&c&&c.imageSrcSet?(x+='[imagesrcset="'+_r(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(x+='[imagesizes="'+_r(c.imageSizes)+'"]')):x+='[href="'+_r(r)+'"]';var b=x;switch(a){case"style":b=zi(r);break;case"script":b=Pi(r)}zr.has(b)||(r=g({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:r,as:a},c),zr.set(b,r),f.querySelector(x)!==null||a==="style"&&f.querySelector(Tc(b))||a==="script"&&f.querySelector(Mc(b))||(a=f.createElement("link"),Tn(a,"link",r),Sn(a),f.head.appendChild(a)))}}function iO(r,a){Qs.m(r,a);var c=Di;if(c&&r){var f=a&&typeof a.as=="string"?a.as:"script",x='link[rel="modulepreload"][as="'+_r(f)+'"][href="'+_r(r)+'"]',b=x;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Pi(r)}if(!zr.has(b)&&(r=g({rel:"modulepreload",href:r},a),zr.set(b,r),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",r),Sn(f),c.head.appendChild(f)}}}function lO(r,a,c){Qs.S(r,a,c);var f=Di;if(f&&r){var x=ri(f).hoistableStyles,b=zi(r);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{r=g({rel:"stylesheet",href:r,"data-precedence":a},c),(c=zr.get(b))&&bg(r,c);var V=k=f.createElement("link");Sn(V),Tn(V,"link",r),V._p=new Promise(function(se,ce){V.onload=se,V.onerror=ce}),V.addEventListener("load",function(){P.loading|=1}),V.addEventListener("error",function(){P.loading|=2}),P.loading|=4,rf(k,a,f)}k={type:"stylesheet",instance:k,count:1,state:P},x.set(b,k)}}}function cO(r,a){Qs.X(r,a);var c=Di;if(c&&r){var f=ri(c).hoistableScripts,x=Pi(r),b=f.get(x);b||(b=c.querySelector(Mc(x)),b||(r=g({src:r,async:!0},a),(a=zr.get(x))&&wg(r,a),b=c.createElement("script"),Sn(b),Tn(b,"link",r),c.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},f.set(x,b))}}function uO(r,a){Qs.M(r,a);var c=Di;if(c&&r){var f=ri(c).hoistableScripts,x=Pi(r),b=f.get(x);b||(b=c.querySelector(Mc(x)),b||(r=g({src:r,async:!0,type:"module"},a),(a=zr.get(x))&&wg(r,a),b=c.createElement("script"),Sn(b),Tn(b,"link",r),c.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},f.set(x,b))}}function VS(r,a,c,f){var x=(x=ue.current)?nf(x):null;if(!x)throw Error(s(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=zi(c.href),c=ri(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"){r=zi(c.href);var b=ri(x).hoistableStyles,k=b.get(r);if(k||(x=x.ownerDocument||x,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(r,k),(b=x.querySelector(Tc(r)))&&!b._p&&(k.instance=b,k.state.loading=5),zr.has(r)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},zr.set(r,c),b||dO(x,r,c,k.state))),a&&f===null)throw Error(s(528,""));return k}if(a&&f!==null)throw Error(s(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Pi(c),c=ri(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(s(444,r))}}function zi(r){return'href="'+_r(r)+'"'}function Tc(r){return'link[rel="stylesheet"]['+r+"]"}function qS(r){return g({},r,{"data-precedence":r.precedence,precedence:null})}function dO(r,a,c,f){r.querySelector('link[rel="preload"][as="style"]['+a+"]")?f.loading=1:(a=r.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),r.head.appendChild(a))}function Pi(r){return'[src="'+_r(r)+'"]'}function Mc(r){return"script[async]"+r}function HS(r,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var f=r.querySelector('style[data-href~="'+_r(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=(r.ownerDocument||r).createElement("style"),Sn(f),Tn(f,"style",x),rf(f,c.precedence,r),a.instance=f;case"stylesheet":x=zi(c.href);var b=r.querySelector(Tc(x));if(b)return a.state.loading|=4,a.instance=b,Sn(b),b;f=qS(c),(x=zr.get(x))&&bg(f,x),b=(r.ownerDocument||r).createElement("link"),Sn(b);var k=b;return k._p=new Promise(function(P,V){k.onload=P,k.onerror=V}),Tn(b,"link",f),a.state.loading|=4,rf(b,c.precedence,r),a.instance=b;case"script":return b=Pi(c.src),(x=r.querySelector(Mc(b)))?(a.instance=x,Sn(x),x):(f=c,(x=zr.get(b))&&(f=g({},c),wg(f,x)),r=r.ownerDocument||r,x=r.createElement("script"),Sn(x),Tn(x,"link",f),r.head.appendChild(x),a.instance=x);case"void":return null;default:throw Error(s(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(f=a.instance,a.state.loading|=4,rf(f,c.precedence,r));return a.instance}function rf(r,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(r,b.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(r,a.firstChild))}function bg(r,a){r.crossOrigin==null&&(r.crossOrigin=a.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=a.referrerPolicy),r.title==null&&(r.title=a.title)}function wg(r,a){r.crossOrigin==null&&(r.crossOrigin=a.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=a.referrerPolicy),r.integrity==null&&(r.integrity=a.integrity)}var sf=null;function YS(r,a,c){if(sf===null){var f=new Map,x=sf=new Map;x.set(c,f)}else x=sf,f=x.get(c),f||(f=new Map,x.set(c,f));if(f.has(r))return f;for(f.set(r,null),c=c.getElementsByTagName(r),x=0;x<c.length;x++){var b=c[x];if(!(b[Yl]||b[Zt]||r==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var k=b.getAttribute(a)||"";k=r+k;var P=f.get(k);P?P.push(b):f.set(k,[b])}}return f}function WS(r,a,c){r=r.ownerDocument||r,r.head.insertBefore(c,a==="title"?r.querySelector("head > title"):null)}function fO(r,a,c){if(c===1||a.itemProp!=null)return!1;switch(r){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"?(r=a.disabled,typeof a.precedence=="string"&&r==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 GS(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function hO(r,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=zi(f.href),b=a.querySelector(Tc(x));if(b){a=b._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(r.count++,r=af.bind(r),a.then(r,r)),c.state.loading|=4,c.instance=b,Sn(b);return}b=a.ownerDocument||a,f=qS(f),(x=zr.get(x))&&bg(f,x),b=b.createElement("link"),Sn(b);var k=b;k._p=new Promise(function(P,V){k.onload=P,k.onerror=V}),Tn(b,"link",f),c.instance=b}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=af.bind(r),a.addEventListener("load",c),a.addEventListener("error",c))}}var Sg=0;function mO(r,a){return r.stylesheets&&r.count===0&&lf(r,r.stylesheets),0<r.count||0<r.imgCount?function(c){var f=setTimeout(function(){if(r.stylesheets&&lf(r,r.stylesheets),r.unsuspend){var b=r.unsuspend;r.unsuspend=null,b()}},6e4+a);0<r.imgBytes&&Sg===0&&(Sg=62500*GA());var x=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&lf(r,r.stylesheets),r.unsuspend)){var b=r.unsuspend;r.unsuspend=null,b()}},(r.imgBytes>Sg?50:800)+a);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(f),clearTimeout(x)}}:null}function af(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)lf(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var of=null;function lf(r,a){r.stylesheets=null,r.unsuspend!==null&&(r.count++,of=new Map,a.forEach(pO,r),of=null,af.call(r))}function pO(r,a){if(!(a.state.loading&4)){var c=of.get(r);if(c)var f=c.get(null);else{c=new Map,of.set(r,c);for(var x=r.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=af.bind(this),x.addEventListener("load",f),x.addEventListener("error",f),b?b.parentNode.insertBefore(x,b.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(x,r.firstChild)),a.state.loading|=4}}var Rc={$$typeof:E,Provider:null,Consumer:null,_currentValue:U,_currentValue2:U,_threadCount:0};function gO(r,a,c,f,x,b,k,P,V){this.tag=1,this.containerInfo=r,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=V,this.incompleteTransitions=new Map}function ZS(r,a,c,f,x,b,k,P,V,se,ce,he){return r=new gO(r,a,c,k,V,se,ce,he,P),a=1,b===!0&&(a|=24),b=cr(3,null,null,a),r.current=b,b.stateNode=r,a=tp(),a.refCount++,r.pooledCache=a,a.refCount++,b.memoizedState={element:f,isDehydrated:c,cache:a},ap(b),r}function QS(r){return r?(r=hi,r):hi}function KS(r,a,c,f,x,b){x=QS(x),f.context===null?f.context=x:f.pendingContext=x,f=ba(a),f.payload={element:c},b=b===void 0?null:b,b!==null&&(f.callback=b),c=wa(r,f,a),c!==null&&(Jn(c,r,a),cc(c,r,a))}function XS(r,a){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<a?c:a}}function jg(r,a){XS(r,a),(r=r.alternate)&&XS(r,a)}function JS(r){if(r.tag===13||r.tag===31){var a=co(r,67108864);a!==null&&Jn(a,r,67108864),jg(r,67108864)}}function e1(r){if(r.tag===13||r.tag===31){var a=mr();a=je(a);var c=co(r,a);c!==null&&Jn(c,r,a),jg(r,a)}}var cf=!0;function vO(r,a,c,f){var x=L.T;L.T=null;var b=$.p;try{$.p=2,Cg(r,a,c,f)}finally{$.p=b,L.T=x}}function xO(r,a,c,f){var x=L.T;L.T=null;var b=$.p;try{$.p=8,Cg(r,a,c,f)}finally{$.p=b,L.T=x}}function Cg(r,a,c,f){if(cf){var x=Ng(f);if(x===null)ug(r,a,f,uf,c),n1(r,f);else if(bO(x,r,a,c,f))f.stopPropagation();else if(n1(r,f),a&4&&-1<yO.indexOf(r)){for(;x!==null;){var b=ni(x);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var k=He(b.pendingLanes);if(k!==0){var P=b;for(P.pendingLanes|=2,P.entangledLanes|=2;k;){var V=1<<31-$t(k);P.entanglements[1]|=V,k&=~V}ps(b),(xt&6)===0&&(Hd=ut()+500,Nc(0))}}break;case 31:case 13:P=co(b,2),P!==null&&Jn(P,b,2),Wd(),jg(b,2)}if(b=Ng(f),b===null&&ug(r,a,f,uf,c),b===x)break;x=b}x!==null&&f.stopPropagation()}else ug(r,a,f,null,c)}}function Ng(r){return r=_m(r),kg(r)}var uf=null;function kg(r){if(uf=null,r=ti(r),r!==null){var a=l(r);if(a===null)r=null;else{var c=a.tag;if(c===13){if(r=u(a),r!==null)return r;r=null}else if(c===31){if(r=d(a),r!==null)return r;r=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;r=null}else a!==r&&(r=null)}}return uf=r,null}function t1(r){switch(r){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 Xe:return 2;case wt:return 8;case gt:case qn:return 32;case ir:return 268435456;default:return 32}default:return 32}}var _g=!1,Aa=null,Oa=null,Da=null,Ac=new Map,Oc=new Map,za=[],yO="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 n1(r,a){switch(r){case"focusin":case"focusout":Aa=null;break;case"dragenter":case"dragleave":Oa=null;break;case"mouseover":case"mouseout":Da=null;break;case"pointerover":case"pointerout":Ac.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oc.delete(a.pointerId)}}function Dc(r,a,c,f,x,b){return r===null||r.nativeEvent!==b?(r={blockedOn:a,domEventName:c,eventSystemFlags:f,nativeEvent:b,targetContainers:[x]},a!==null&&(a=ni(a),a!==null&&JS(a)),r):(r.eventSystemFlags|=f,a=r.targetContainers,x!==null&&a.indexOf(x)===-1&&a.push(x),r)}function bO(r,a,c,f,x){switch(a){case"focusin":return Aa=Dc(Aa,r,a,c,f,x),!0;case"dragenter":return Oa=Dc(Oa,r,a,c,f,x),!0;case"mouseover":return Da=Dc(Da,r,a,c,f,x),!0;case"pointerover":var b=x.pointerId;return Ac.set(b,Dc(Ac.get(b)||null,r,a,c,f,x)),!0;case"gotpointercapture":return b=x.pointerId,Oc.set(b,Dc(Oc.get(b)||null,r,a,c,f,x)),!0}return!1}function r1(r){var a=ti(r.target);if(a!==null){var c=l(a);if(c!==null){if(a=c.tag,a===13){if(a=u(c),a!==null){r.blockedOn=a,Je(r.priority,function(){e1(c)});return}}else if(a===31){if(a=d(c),a!==null){r.blockedOn=a,Je(r.priority,function(){e1(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function df(r){if(r.blockedOn!==null)return!1;for(var a=r.targetContainers;0<a.length;){var c=Ng(r.nativeEvent);if(c===null){c=r.nativeEvent;var f=new c.constructor(c.type,c);km=f,c.target.dispatchEvent(f),km=null}else return a=ni(c),a!==null&&JS(a),r.blockedOn=c,!1;a.shift()}return!0}function s1(r,a,c){df(r)&&c.delete(a)}function wO(){_g=!1,Aa!==null&&df(Aa)&&(Aa=null),Oa!==null&&df(Oa)&&(Oa=null),Da!==null&&df(Da)&&(Da=null),Ac.forEach(s1),Oc.forEach(s1)}function ff(r,a){r.blockedOn===a&&(r.blockedOn=null,_g||(_g=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,wO)))}var hf=null;function a1(r){hf!==r&&(hf=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){hf===r&&(hf=null);for(var a=0;a<r.length;a+=3){var c=r[a],f=r[a+1],x=r[a+2];if(typeof f!="function"){if(kg(f||c)===null)continue;break}var b=ni(c);b!==null&&(r.splice(a,3),a-=3,Np(b,{pending:!0,data:x,method:c.method,action:f},f,x))}}))}function Li(r){function a(V){return ff(V,r)}Aa!==null&&ff(Aa,r),Oa!==null&&ff(Oa,r),Da!==null&&ff(Da,r),Ac.forEach(a),Oc.forEach(a);for(var c=0;c<za.length;c++){var f=za[c];f.blockedOn===r&&(f.blockedOn=null)}for(;0<za.length&&(c=za[0],c.blockedOn===null);)r1(c),c.blockedOn===null&&za.shift();if(c=(r.ownerDocument||r).$$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||a1(c);else if(k){var P=null;if(b&&b.hasAttribute("formAction")){if(x=b,k=b[Wn]||null)P=k.formAction;else if(kg(x)!==null)continue}else P=k.action;typeof P=="function"?c[f+1]=P:(c.splice(f,3),f-=3),a1(c)}}}function o1(){function r(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",r),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){f=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),x!==null&&(x(),x=null)}}}function Eg(r){this._internalRoot=r}mf.prototype.render=Eg.prototype.render=function(r){var a=this._internalRoot;if(a===null)throw Error(s(409));var c=a.current,f=mr();KS(c,f,r,a,null,null)},mf.prototype.unmount=Eg.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var a=r.containerInfo;KS(r.current,2,null,r,null,null),Wd(),a[ei]=null}};function mf(r){this._internalRoot=r}mf.prototype.unstable_scheduleHydration=function(r){if(r){var a=vt();r={blockedOn:null,target:r,priority:a};for(var c=0;c<za.length&&a!==0&&a<za[c].priority;c++);za.splice(c,0,r),c===0&&r1(r)}};var i1=t.version;if(i1!=="19.2.4")throw Error(s(527,i1,"19.2.4"));$.findDOMNode=function(r){var a=r._reactInternals;if(a===void 0)throw typeof r.render=="function"?Error(s(188)):(r=Object.keys(r).join(","),Error(s(268,r)));return r=m(a),r=r!==null?v(r):null,r=r===null?null:r.stateNode,r};var SO={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var pf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!pf.isDisabled&&pf.supportsFiber)try{Pn=pf.inject(SO),Vt=pf}catch{}}return Pc.createRoot=function(r,a){if(!o(r))throw Error(s(299));var c=!1,f="",x=mw,b=pw,k=gw;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=ZS(r,1,!1,null,null,c,f,null,x,b,k,o1),r[ei]=a.current,cg(r),new Eg(a)},Pc.hydrateRoot=function(r,a,c){if(!o(r))throw Error(s(299));var f=!1,x="",b=mw,k=pw,P=gw,V=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&&(V=c.formState)),a=ZS(r,1,!0,a,c??null,f,x,V,b,k,P,o1),a.context=QS(null),c=a.current,f=mr(),f=je(f),x=ba(f),x.callback=null,wa(c,x,f),c=f,a.current.lanes=c,Ot(a,c),ps(a),r[ei]=a.current,cg(r),new mf(a)},Pc.version="19.2.4",Pc}var v1;function AO(){if(v1)return Rg.exports;v1=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(),Rg.exports=RO(),Rg.exports}var OO=AO(),xs=[],Lr=[],DO=Uint8Array,zg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Ii=0,zO=zg.length;Ii<zO;++Ii)xs[Ii]=zg[Ii],Lr[zg.charCodeAt(Ii)]=Ii;Lr[45]=62;Lr[95]=63;function PO(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 s=n===t?0:4-n%4;return[n,s]}function LO(e,t,n){return(t+n)*3/4-n}function lu(e){var t,n=PO(e),s=n[0],o=n[1],l=new DO(LO(e,s,o)),u=0,d=o>0?s-4:s,h;for(h=0;h<d;h+=4)t=Lr[e.charCodeAt(h)]<<18|Lr[e.charCodeAt(h+1)]<<12|Lr[e.charCodeAt(h+2)]<<6|Lr[e.charCodeAt(h+3)],l[u++]=t>>16&255,l[u++]=t>>8&255,l[u++]=t&255;return o===2&&(t=Lr[e.charCodeAt(h)]<<2|Lr[e.charCodeAt(h+1)]>>4,l[u++]=t&255),o===1&&(t=Lr[e.charCodeAt(h)]<<10|Lr[e.charCodeAt(h+1)]<<4|Lr[e.charCodeAt(h+2)]>>2,l[u++]=t>>8&255,l[u++]=t&255),l}function IO(e){return xs[e>>18&63]+xs[e>>12&63]+xs[e>>6&63]+xs[e&63]}function $O(e,t,n){for(var s,o=[],l=t;l<n;l+=3)s=(e[l]<<16&16711680)+(e[l+1]<<8&65280)+(e[l+2]&255),o.push(IO(s));return o.join("")}function cu(e){for(var t,n=e.length,s=n%3,o=[],l=16383,u=0,d=n-s;u<d;u+=l)o.push($O(e,u,u+l>d?d:u+l));return s===1?(t=e[n-1],o.push(xs[t>>2]+xs[t<<4&63]+"==")):s===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 ea(e){if(e===void 0)return{};if(!nN(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}function FO(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 nN(e){const t=typeof e=="object",n=Object.getPrototypeOf(e),s=n===null||n===Object.prototype||n?.constructor?.name==="Object";return t&&s}const rN=!0,dl=BigInt("-9223372036854775808"),jx=BigInt("9223372036854775807"),Fv=BigInt("0"),BO=BigInt("8"),UO=BigInt("256");function sN(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}function VO(e){e<Fv&&(e-=dl+dl);let t=e.toString(16);t.length%2===1&&(t="0"+t);const n=new Uint8Array(new ArrayBuffer(8));let s=0;for(const o of t.match(/.{2}/g).reverse())n.set([parseInt(o,16)],s++),e>>=BO;return cu(n)}function qO(e){const t=lu(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let n=Fv,s=Fv;for(const o of t)n+=BigInt(o)*UO**s,s++;return n>jx&&(n+=dl+dl),n}function HO(e){if(e<dl||jx<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),cu(new Uint8Array(t))}function YO(e){const t=lu(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 WO=DataView.prototype.setBigInt64?HO:VO,GO=DataView.prototype.getBigInt64?YO:qO,x1=1024;function aN(e){if(e.length>x1)throw new Error(`Field name ${e} exceeds maximum field name length ${x1}.`);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(s=>fl(s));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);const t=Object.entries(e);if(t.length===1){const s=t[0][0];if(s==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return lu(e.$bytes).buffer}if(s==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return GO(e.$integer)}if(s==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);const o=lu(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,rN);if(!sN(u))throw new Error(`Float ${u} should be encoded as a number`);return u}if(s==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(s==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}const n={};for(const[s,o]of Object.entries(e))aN(s),n[s]=fl(o);return n}const y1=16384;function ru(e){const t=JSON.stringify(e,(n,s)=>s===void 0?"undefined":typeof s=="bigint"?`${s.toString()}n`:s);if(t.length>y1){const n="[...truncated]";let s=y1-n.length;const o=t.codePointAt(s-1);return o!==void 0&&o>65535&&(s-=1),t.substring(0,s)+n}return t}function Bv(e,t,n,s){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||jx<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:WO(e)}}if(typeof e=="number")if(sN(e)){const u=new ArrayBuffer(8);return new DataView(u).setFloat64(0,e,rN),{$float:cu(new Uint8Array(u))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:cu(new Uint8Array(e))};if(Array.isArray(e))return e.map((u,d)=>Bv(u,t,n+`[${d}]`));if(e instanceof Set)throw new Error(Pg(n,"Set",[...e],t));if(e instanceof Map)throw new Error(Pg(n,"Map",[...e],t));if(!nN(e)){const u=e?.constructor?.name,d=u?`${u} `:"";throw new Error(Pg(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&&(aN(u),o[u]=Bv(d,t,n+`.${u}`));return o}function Pg(e,t,n,s){return e?`${t}${ru(n)} is not a supported Convex type (present at path ${e} in original object ${ru(s)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${ru(n)} is not a supported Convex type.`}function ns(e){return Bv(e,e,"")}var ZO=Object.defineProperty,QO=(e,t,n)=>t in e?ZO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lt=(e,t,n)=>QO(e,typeof t!="symbol"?t+"":t,n);const KO="https://docs.convex.dev/error#undefined-validator";function uu(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 ${KO} for details.`)}class Nr{constructor({isOptional:t}){Lt(this,"type"),Lt(this,"fieldPaths"),Lt(this,"isOptional"),Lt(this,"isConvexValidator"),this.isOptional=t,this.isConvexValidator=!0}}class Cx extends Nr{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 Cx({isOptional:"optional",tableName:this.tableName})}}class Yf extends Nr{constructor(){super(...arguments),Lt(this,"kind","float64")}get json(){return{type:"number"}}asOptional(){return new Yf({isOptional:"optional"})}}class Wf extends Nr{constructor(){super(...arguments),Lt(this,"kind","int64")}get json(){return{type:"bigint"}}asOptional(){return new Wf({isOptional:"optional"})}}class Nx extends Nr{constructor(){super(...arguments),Lt(this,"kind","boolean")}get json(){return{type:this.kind}}asOptional(){return new Nx({isOptional:"optional"})}}class kx extends Nr{constructor(){super(...arguments),Lt(this,"kind","bytes")}get json(){return{type:this.kind}}asOptional(){return new kx({isOptional:"optional"})}}class _x extends Nr{constructor(){super(...arguments),Lt(this,"kind","string")}get json(){return{type:this.kind}}asOptional(){return new _x({isOptional:"optional"})}}class Ex extends Nr{constructor(){super(...arguments),Lt(this,"kind","null")}get json(){return{type:this.kind}}asOptional(){return new Ex({isOptional:"optional"})}}class Tx extends Nr{constructor(){super(...arguments),Lt(this,"kind","any")}get json(){return{type:this.kind}}asOptional(){return new Tx({isOptional:"optional"})}}class ko extends Nr{constructor({isOptional:t,fields:n}){super({isOptional:t}),Lt(this,"fields"),Lt(this,"kind","object"),globalThis.Object.entries(n).forEach(([s,o])=>{if(o===void 0&&uu("v.object()",s),!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 ko({isOptional:"optional",fields:this.fields})}omit(...t){const n={...this.fields};for(const s of t)delete n[s];return new ko({isOptional:this.isOptional,fields:n})}pick(...t){const n={};for(const s of t)n[s]=this.fields[s];return new ko({isOptional:this.isOptional,fields:n})}partial(){const t={};for(const[n,s]of globalThis.Object.entries(this.fields))t[n]=s.asOptional();return new ko({isOptional:this.isOptional,fields:t})}extend(t){return new ko({isOptional:this.isOptional,fields:{...this.fields,...t}})}}class Mx extends Nr{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:ns(this.value)}}asOptional(){return new Mx({isOptional:"optional",value:this.value})}}class Rx extends Nr{constructor({isOptional:t,element:n}){super({isOptional:t}),Lt(this,"element"),Lt(this,"kind","array"),n===void 0&&uu("v.array()"),this.element=n}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new Rx({isOptional:"optional",element:this.element})}}class Ax extends Nr{constructor({isOptional:t,key:n,value:s}){if(super({isOptional:t}),Lt(this,"key"),Lt(this,"value"),Lt(this,"kind","record"),n===void 0&&uu("v.record()","key"),s===void 0&&uu("v.record()","value"),n.isOptional==="optional")throw new Error("Record validator cannot have optional keys");if(s.isOptional==="optional")throw new Error("Record validator cannot have optional values");if(!n.isConvexValidator||!s.isConvexValidator)throw new Error("Key and value of v.record() but be validators");this.key=n,this.value=s}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new Ax({isOptional:"optional",key:this.key,value:this.value})}}class Ox extends Nr{constructor({isOptional:t,members:n}){super({isOptional:t}),Lt(this,"members"),Lt(this,"kind","union"),n.forEach((s,o)=>{if(s===void 0&&uu("v.union()",`member at index ${o}`),!s.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 Ox({isOptional:"optional",members:this.members})}}const Fe={id:e=>new Cx({isOptional:"required",tableName:e}),null:()=>new Ex({isOptional:"required"}),number:()=>new Yf({isOptional:"required"}),float64:()=>new Yf({isOptional:"required"}),bigint:()=>new Wf({isOptional:"required"}),int64:()=>new Wf({isOptional:"required"}),boolean:()=>new Nx({isOptional:"required"}),string:()=>new _x({isOptional:"required"}),bytes:()=>new kx({isOptional:"required"}),literal:e=>new Mx({isOptional:"required",value:e}),array:e=>new Rx({isOptional:"required",element:e}),object:e=>new ko({isOptional:"required",fields:e}),record:(e,t)=>new Ax({isOptional:"required",key:e,value:t}),union:(...e)=>new Ox({isOptional:"required",members:e}),any:()=>new Tx({isOptional:"required"}),optional:e=>e.asOptional(),nullable:e=>Fe.union(e,Fe.null())};var XO=Object.defineProperty,JO=(e,t,n)=>t in e?XO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lg=(e,t,n)=>JO(e,typeof t!="symbol"?t+"":t,n),b1,w1;const eD=Symbol.for("ConvexError");class Uv extends(w1=Error,b1=eD,w1){constructor(t){super(typeof t=="string"?t:ru(t)),Lg(this,"name","ConvexError"),Lg(this,"data"),Lg(this,b1,!0),this.data=t}}const oN=()=>Array.from({length:4},()=>0);oN();oN();const S1="1.34.1";var tD=Object.defineProperty,nD=(e,t,n)=>t in e?tD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j1=(e,t,n)=>nD(e,typeof t!="symbol"?t+"":t,n);const rD="color:rgb(0, 145, 255)";function iN(e){switch(e){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}class lN{constructor(t){j1(this,"_onLogLineFuncs"),j1(this,"_verbose"),this._onLogLineFuncs={},this._verbose=t.verbose}addLogLineListener(t){let n=Math.random().toString(36).substring(2,15);for(let s=0;s<10&&this._onLogLineFuncs[n]!==void 0;s++)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 cN(e){const t=new lN(e);return t.addLogLineListener((n,...s)=>{switch(n){case"debug":console.debug(...s);break;case"info":console.log(...s);break;case"warn":console.warn(...s);break;case"error":console.error(...s);break;default:console.log(...s)}}),t}function uN(e){return new lN(e)}function Gf(e,t,n,s,o){const l=iN(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}(${s})] 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}(${s})] [${d}]`,rD,h)}else e.error(`[CONVEX ${l}(${s})] ${o}`)}function sD(e,t){const n=`[CONVEX FATAL ERROR] ${t}`;return e.error(n),new Error(n)}function Ki(e,t,n){return`[CONVEX ${iN(e)}(${t})] ${n.errorMessage}
10
+ Called by client`}function Vv(e,t){return t.data=e.errorData,t}function zo(e){const t=e.split(":");let n,s;return t.length===1?(n=t[0],s="default"):(n=t.slice(0,t.length-1).join(":"),s=t[t.length-1]),n.endsWith(".js")&&(n=n.slice(0,-3)),`${n}:${s}`}function Ro(e,t){return JSON.stringify({udfPath:zo(e),args:ns(t)})}function C1(e,t,n){const{initialNumItems:s,id:o}=n;return JSON.stringify({type:"paginated",udfPath:zo(e),args:ns(t),options:ns({initialNumItems:s,id:o})})}var aD=Object.defineProperty,oD=(e,t,n)=>t in e?aD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gs=(e,t,n)=>oD(e,typeof t!="symbol"?t+"":t,n);class iD{constructor(){gs(this,"nextQueryId"),gs(this,"querySetVersion"),gs(this,"querySet"),gs(this,"queryIdToToken"),gs(this,"identityVersion"),gs(this,"auth"),gs(this,"outstandingQueriesOlderThanRestart"),gs(this,"outstandingAuthOlderThanRestart"),gs(this,"paused"),gs(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,s,o){const l=zo(t),u=Ro(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:s,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:[ns(n)],journal:s,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 s=n.journal;if(s!==void 0){const o=this.queryIdToToken.get(n.queryId);o!==void 0&&(this.querySet.get(o).journal=s)}break}case"QueryRemoved":{this.outstandingQueriesOlderThanRestart.delete(n.queryId);break}default:throw new Error(`Invalid modification ${n.type}`)}}queryId(t,n){const s=zo(t),o=Ro(s,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 s={tokenType:"Admin",value:t,impersonating:n};this.auth=s;const o=this.identityVersion;return this.paused||(this.identityVersion=o+1),{type:"Authenticate",baseVersion:o,...s}}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(){this.unpause(),this.outstandingQueriesOlderThanRestart.clear();const t=[];for(const o of this.querySet.values()){const l={type:"Add",queryId:o.id,udfPath:o.canonicalizedUdfPath,args:[ns(o.args)],journal:o.journal,componentPath:o.componentPath};t.push(l),this.outstandingQueriesOlderThanRestart.add(o.id)}this.querySetVersion=1;const n={type:"ModifyQuerySet",baseVersion:0,newVersion:1,modifications:t};if(!this.auth)return this.identityVersion=0,[n,void 0];this.outstandingAuthOlderThanRestart=!0;const s={type:"Authenticate",baseVersion:0,...this.auth};return this.identityVersion=1,[n,s]}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 s=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:s,newVersion:o,modifications:[l]}}}}var lD=Object.defineProperty,cD=(e,t,n)=>t in e?lD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gf=(e,t,n)=>cD(e,typeof t!="symbol"?t+"":t,n);class uD{constructor(t,n){this.logger=t,this.markConnectionStateDirty=n,gf(this,"inflightRequests"),gf(this,"requestsOlderThanRestart"),gf(this,"inflightMutationsCount",0),gf(this,"inflightActionsCount",0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(t,n){const s=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(),s}onResponse(t){const n=this.inflightRequests.get(t.requestId);if(n===void 0||n.status.status==="Completed")return null;const s=n.message.type==="Mutation"?"mutation":"action",o=n.message.udfPath;for(const h of t.logLines)Gf(this.logger,"info",s,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;Gf(this.logger,"error",s,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[s,o]of this.inflightRequests.entries()){const l=o.status;l.status==="Completed"&&l.ts.lessThanOrEqual(t)&&(l.onResolve(),n.set(s,l.result),o.message.type==="Mutation"?this.inflightMutationsCount--:o.message.type==="Action"&&this.inflightActionsCount--,this.inflightRequests.delete(s),this.requestsOlderThanRestart.delete(s))}return n.size>0&&this.markConnectionStateDirty(),n}restart(){this.requestsOlderThanRestart=new Set(this.inflightRequests.keys());const t=[];for(const[n,s]of this.inflightRequests){if(s.status.status==="NotSent"){s.status.status="Requested",t.push(s.message);continue}if(s.message.type==="Mutation")t.push(s.message);else if(s.message.type==="Action"){if(this.inflightRequests.delete(n),this.requestsOlderThanRestart.delete(n),this.inflightActionsCount--,s.status.status==="Completed")throw new Error("Action should never be in 'Completed' state");s.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"),dD=Symbol.for("toReferencePath");function fD(e){return e[dD]??null}function hD(e){return e.startsWith("function://")}function mD(e){let t;if(typeof e=="string")hD(e)?t={functionHandle:e}:t={name:e};else if(e[du])t={name:e[du]};else{const n=fD(e);if(!n)throw new Error(`${e} is not a functionReference`);t={reference:n}}return t}function nr(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 dN(e){return{[du]:e}}function fN(e=[]){const t={get(n,s){if(typeof s=="string"){const o=[...e,s];return fN(o)}else if(s===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 s===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},t)}fN();var pD=Object.defineProperty,gD=(e,t,n)=>t in e?pD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zf=(e,t,n)=>gD(e,typeof t!="symbol"?t+"":t,n);class fu{constructor(t){Zf(this,"queryResults"),Zf(this,"modifiedQueries"),this.queryResults=t,this.modifiedQueries=[]}getQuery(t,...n){const s=ea(n[0]),o=nr(t),l=this.queryResults.get(Ro(o,s));if(l!==void 0)return fu.queryValue(l.result)}getAllQueries(t){const n=[],s=nr(t);for(const o of this.queryResults.values())o.udfPath===zo(s)&&n.push({args:o.args,value:fu.queryValue(o.result)});return n}setQuery(t,n,s){const o=ea(n),l=nr(t),u=Ro(l,o);let d;s===void 0?d=void 0:d={success:!0,value:s,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 vD{constructor(){Zf(this,"queryResults"),Zf(this,"optimisticUpdates"),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(t,n){this.optimisticUpdates=this.optimisticUpdates.filter(u=>!n.has(u.mutationId));const s=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=s.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 s=new fu(this.queryResults);return t(s),s.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 s=n.result;if(s!==void 0){if(s.success)return s.value;throw s.errorData!==void 0?Vv(s,new Uv(Ki("query",n.udfPath,s))):new Error(Ki("query",n.udfPath,s))}}hasQueryResult(t){return this.queryResults.get(t)!==void 0}queryLogs(t){return this.queryResults.get(t)?.result?.logLines}}var xD=Object.defineProperty,yD=(e,t,n)=>t in e?xD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ig=(e,t,n)=>yD(e,typeof t!="symbol"?t+"":t,n);class tr{constructor(t,n){Ig(this,"low"),Ig(this,"high"),Ig(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 tr(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?N1:t>=bD?wD:new tr(t%su|0,t/su|0)}toString(){return(BigInt(this.high)*BigInt(su)+BigInt(this.low)).toString()}equals(t){return tr.isLong(t)||(t=tr.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 tr.isLong(t)||(t=tr.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"?tr.fromNumber(t):new tr(t.low,t.high)}}const N1=new tr(0,0),k1=65536,su=k1*k1,bD=su*su,wD=new tr(-1,-1);var SD=Object.defineProperty,jD=(e,t,n)=>t in e?SD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vf=(e,t,n)=>jD(e,typeof t!="symbol"?t+"":t,n);class _1{constructor(t,n){vf(this,"version"),vf(this,"remoteQuerySet"),vf(this,"queryPath"),vf(this,"logger"),this.version={querySet:0,ts:tr.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 s of t.modifications)switch(s.type){case"QueryUpdated":{const o=this.queryPath(s.queryId);if(o)for(const u of s.logLines)Gf(this.logger,"info","query",o,u);const l=fl(s.value??null);this.remoteQuerySet.set(s.queryId,{success:!0,value:l,logLines:s.logLines});break}case"QueryFailed":{const o=this.queryPath(s.queryId);if(o)for(const u of s.logLines)Gf(this.logger,"info","query",o,u);const{errorData:l}=s;this.remoteQuerySet.set(s.queryId,{success:!1,errorMessage:s.errorMessage,errorData:l!==void 0?fl(l):void 0,logLines:s.logLines});break}case"QueryRemoved":{this.remoteQuerySet.delete(s.queryId);break}default:throw new Error(`Invalid modification ${s.type}`)}this.version=t.endVersion}remoteQueryResults(){return this.remoteQuerySet}timestamp(){return this.version.ts}}function $g(e){const t=lu(e);return tr.fromBytesLE(Array.from(t))}function CD(e){const t=new Uint8Array(e.toBytesLE());return cu(t)}function E1(e){switch(e.type){case"FatalError":case"AuthError":case"ActionResponse":case"TransitionChunk":case"Ping":return{...e};case"MutationResponse":return e.success?{...e,ts:$g(e.ts)}:{...e};case"Transition":return{...e,startVersion:{...e.startVersion,ts:$g(e.startVersion.ts)},endVersion:{...e.endVersion,ts:$g(e.endVersion.ts)}}}}function ND(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:CD(e.maxObservedTimestamp)}:{...e,maxObservedTimestamp:void 0}}}var kD=Object.defineProperty,_D=(e,t,n)=>t in e?kD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,on=(e,t,n)=>_D(e,typeof t!="symbol"?t+"":t,n);const ED=1e3,TD=1001,MD=1005,RD=4040;let Lf;function Yi(){return Lf===void 0&&(Lf=Date.now()),typeof performance>"u"||!performance.now?Date.now():Math.round(Lf+performance.now())}function T1(){return`t=${Math.round((Yi()-Lf)/100)/10}s`}const hN={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 AD(e){if(e===void 0)return"Unknown";for(const t of Object.keys(hN))if(e.startsWith(t))return t;return"Unknown"}class OD{constructor(t,n,s,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=s,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 s=E1(JSON.parse(n));if(s.type!=="Transition")throw new Error(`Expected Transition, got ${s.type} after assembling chunks`);return s}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:Yi()})),this.lastCloseReason!=="InitialConnect"&&(this.lastCloseReason?this.logger.log("WebSocket reconnected at",T1(),"after disconnect due to",this.lastCloseReason):this.logger.log("WebSocket reconnected at",T1())),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 s=n.message;s&&this.logger.log(`WebSocket error message: ${s}`)},t.onmessage=n=>{this.resetServerInactivityTimeout();const s=n.data.length;let o=E1(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:s,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!==ED&&n.code!==TD&&n.code!==MD&&n.code!==RD){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 s=AD(n.reason);this.scheduleReconnect(s)}}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 s=ND(t),o=JSON.stringify(s);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 s=Yi(),o=setTimeout(()=>{this.scheduledReconnect?.timeout===o&&(this.scheduledReconnect=null,this.connect())},n);this.scheduledReconnect={timeout:o,scheduledAt:s,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=s=>{this._logVerbose("Ignoring message received after close")};const n=new Promise(s=>{t.onclose=()=>{s()}});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=Yi()-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:Yi()})):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 s=(t==="client"?100:t==="Unknown"?this.defaultInitialBackoff:hN[t].timeout)*Math.pow(2,this.retries);this.retries+=1;const o=Math.min(s,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 s=Yi()-t.clientClockSkew-t.serverTs/1e6,o=`${Math.round(s)}ms`,l=`${Math.round(n/1e4)/100}MB`,u=n/(s/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`):s>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:s,messageLength:n}})}}function DD(){return zD()}function zD(){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)})}class Gc extends Error{}Gc.prototype.name="InvalidTokenError";function PD(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let s=n.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function LD(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 PD(t)}catch{return atob(t)}}function mN(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,s=e.split(".")[n];if(typeof s!="string")throw new Gc(`Invalid token specified: missing part #${n+1}`);let o;try{o=LD(s)}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 ID=Object.defineProperty,$D=(e,t,n)=>t in e?ID(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pr=(e,t,n)=>$D(e,typeof t!="symbol"?t+"":t,n);const FD=480*60*60*1e3,M1=2;class BD{constructor(t,n,s){Pr(this,"authState",{state:"noAuth"}),Pr(this,"configVersion",0),Pr(this,"syncState"),Pr(this,"authenticate"),Pr(this,"stopSocket"),Pr(this,"tryRestartSocket"),Pr(this,"pauseSocket"),Pr(this,"resumeSocket"),Pr(this,"clearAuth"),Pr(this,"logger"),Pr(this,"refreshTokenLeewaySeconds"),Pr(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=s.logger,this.refreshTokenLeewaySeconds=s.refreshTokenLeewaySeconds}async setConfig(t,n){this.resetAuthState(),this._logVerbose("pausing WS for auth token fetch"),this.pauseSocket();const s=await this.fetchTokenAndGuardAgainstRace(t,{forceRefreshToken:!1});s.isFromOutdatedConfig||(s.value?(this.setAuthState({state:"waitingForServerConfirmationOfCachedToken",config:{fetchToken:t,onAuthChange:n},hasRetried:!1}),this.authenticate(s.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._logVerbose(`auth state is ${this.authState.state} when handling transition`),this.syncState.markAuthCompletion(),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>=M1){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, ${M1-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:s,exp:o}=n;if(!s||!o){this.logger.error("Auth token does not have required fields, cannot refetch the token");return}const l=o-s;if(l<=2){this.logger.error("Auth token does not live long enough, cannot refetch the token");return}let u=Math.min(FD,(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 s=++this.configVersion;this._logVerbose(`fetching token with config version ${s}`);const o=await t(n);return this.configVersion!==s?(this._logVerbose(`stale config version, expected ${s}, 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.authState=t}decodeToken(t){try{return mN(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 UD=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function VD(e,t){const n={sessionId:t};typeof performance>"u"||!performance.mark||performance.mark(e,{detail:n})}function qD(e){let t=e.name.slice(6);return t=t.charAt(0).toLowerCase()+t.slice(1),{name:t,startTime:e.startTime}}function HD(e){if(typeof performance>"u"||!performance.getEntriesByName)return[];const t=[];for(const n of UD){const s=performance.getEntriesByName(n).filter(o=>o.entryType==="mark").filter(o=>o.detail.sessionId===e);t.push(...s)}return t.map(qD)}var YD=Object.defineProperty,WD=(e,t,n)=>t in e?YD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ln=(e,t,n)=>WD(e,typeof t!="symbol"?t+"":t,n);class GD{constructor(t,n,s){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&&VD(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.");s?.skipConvexDeploymentUrlCheck!==!0&&FO(t),s={...s};const o=s.authRefreshTokenLeewaySeconds??10;let l=s.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=s.reportDebugInfoToConvex??!1,this.address=t,this.logger=s.logger===!1?uN({verbose:s.verbose??!1}):s.logger!==!0&&s.logger?s.logger:cN({verbose:s.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/${S1}/sync`;this.state=new iD,this.remoteQuerySet=new _1(w=>this.state.queryPath(w),this.logger),this.requestManager=new uD(this.logger,this.markConnectionStateDirty);const g=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new BD(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 vD,this.addOnTransitionHandler(w=>{n(w.queries.map(S=>S.token))}),this._nextRequestId=0,this._sessionId=DD();const{unsavedChangesWarning:y}=s;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 OD(v,{onOpen:w=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({...w,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp}),this.remoteQuerySet=new _1(N=>this.state.queryPath(N),this.logger);const[S,j]=this.state.restart();j&&this.webSocketManager.sendMessage(j),this.webSocketManager.sendMessage(S);for(const N of this.requestManager.restart())this.webSocketManager.sendMessage(N)},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=sD(this.logger,w.error);throw this.webSocketManager.terminate(),S}}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:s.onServerDisconnectError},l,this.logger,this.markConnectionStateDirty,this.debug),this.mark("convexClientConstructed"),s.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(),s=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)};s.set(d,h)}}const o=this.optimisticQueryResults.ingestQueryResultsFromServer(s,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?mN(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 s=this.state.setAdminAuth(t,n);this.webSocketManager.sendMessage(s)}clearAuth(){const t=this.state.clearAuth();this.webSocketManager.sendMessage(t)}subscribe(t,n,s){const o=ea(n),{modification:l,queryToken:u,unsubscribe:d}=this.state.subscribe(t,o,s?.journal,s?.componentPath);return l!==null&&this.webSocketManager.sendMessage(l),{queryToken:u,unsubscribe:()=>{const h=d();h&&this.webSocketManager.sendMessage(h)}}}localQueryResult(t,n){const s=ea(n),o=Ro(t,s);return this.optimisticQueryResults.queryResult(o)}localQueryResultByToken(t){return this.optimisticQueryResults.queryResult(t)}hasLocalQueryResultByToken(t){return this.optimisticQueryResults.hasQueryResult(t)}localQueryLogs(t,n){const s=ea(n),o=Ro(t,s);return this.optimisticQueryResults.queryLogs(o)}queryJournal(t,n){const s=ea(n),o=Ro(t,s);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,s){const o=await this.mutationInternal(t,n,s);if(!o.success)throw o.errorData!==void 0?Vv(o,new Uv(Ki("mutation",t,o))):new Error(Ki("mutation",t,o));return o.value}async mutationInternal(t,n,s,o){const{mutationPromise:l}=this.enqueueMutation(t,n,s,o);return l}enqueueMutation(t,n,s,o){const l=ea(n);this.tryReportLongDisconnect();const u=this.nextRequestId;if(this._nextRequestId++,s!==void 0){const v=s.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:[ns(l)]},h=this.webSocketManager.sendMessage(d),m=this.requestManager.request(d,h);return{requestId:u,mutationPromise:m}}async action(t,n){const s=await this.actionInternal(t,n);if(!s.success)throw s.errorData!==void 0?Vv(s,new Uv(Ki("action",t,s))):new Error(Ki("action",t,s));return s.value}async actionInternal(t,n,s){const o=ea(n),l=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();const u={type:"Action",requestId:l,udfPath:t,componentPath:s,args:[ns(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=HD(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-${S1}`},body:JSON.stringify({event:"LongWebsocketDisconnect"})}).then(s=>{s.ok||this.logger.warn("Analytics request failed with response:",s.body)}).catch(s=>{this.logger.warn("Analytics response failed with error:",s)})}}function Fg(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 ZD=Object.defineProperty,QD=(e,t,n)=>t in e?ZD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R1=(e,t,n)=>QD(e,typeof t!="symbol"?t+"":t,n);class KD{constructor(t,n){this.client=t,this.onTransition=n,R1(this,"paginatedQuerySet",new Map),R1(this,"lastTransitionTs"),this.lastTransitionTs=tr.fromNumber(0),this.client.addOnTransitionHandler(s=>this.onBaseTransition(s))}subscribe(t,n,s){const o=zo(t),l=C1(o,n,s),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:s.initialNumItems},nextPageKey:0,pageKeys:[],pageKeyToQuery:new Map,ongoingSplits:new Map,skip:!1,id:s.id}),this.addPageToPaginatedQuery(l,null,s.initialNumItems),{paginatedQueryToken:l,unsubscribe:u})}localQueryResult(t,n,s){const o=zo(t),l=C1(o,n,s);return this.localQueryResultByToken(l)}localQueryResultByToken(t){const n=this.paginatedQuerySet.get(t);if(!n)return;const s=this.activePageQueryTokens(n);if(s.length===0)return{results:[],status:"LoadingFirstPage",loadMore:h=>this.loadMoreOfPaginatedQuery(t,h)};let o=[],l=!1,u=!1;for(const h of s){const m=this.client.localQueryResultByToken(h);if(m===void 0){l=!0,u=!1;continue}const v=Fg(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),s=this.queriesContainingTokens(n);let o=[];s.length>0&&(this.processPaginatedQuerySplits(s,u=>this.client.localQueryResultByToken(u)),o=s.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 s=this.queryTokenForLastPageOfPaginatedQuery(t),o=this.client.localQueryResultByToken(s);if(!o)return!1;const l=Fg(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=[],s=new Set(t);for(const[o,l]of this.paginatedQuerySet)for(const u of this.allQueryTokens(l))if(s.has(u)){n.push(o);break}return n}processPaginatedQuerySplits(t,n){for(const s of t){const o=this.mustGetPaginatedQuery(s),{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=Fg(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,s,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:s}});t.pageKeyToQuery.set(l,h);const m=this.client.subscribe(t.canonicalizedUdfPath,{...t.args,paginationOpts:{...d,cursor:s,endCursor:o}});t.pageKeyToQuery.set(u,m),t.ongoingSplits.set(n,[l,u])}addPageToPaginatedQuery(t,n,s){const o=this.mustGetPaginatedQuery(t),l=o.nextPageKey++,u={cursor:n,numItems:s,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 s of n.pageKeyToQuery.values())s.unsubscribe();this.paginatedQuerySet.delete(t)}}completePaginatedQuerySplit(t,n,s,o){const l=t.pageKeyToQuery.get(n);t.pageKeyToQuery.delete(n);const u=t.pageKeys.indexOf(n);t.pageKeys.splice(u,1,s,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),s=n.pageKeys[n.pageKeys.length-1];if(s===void 0)throw new Error(`No pages for paginated query ${t}`);return n.pageKeyToQuery.get(s).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 XD({getCurrentValue:e,subscribe:t}){const[n,s]=p.useState(()=>({getCurrentValue:e,subscribe:t,value:e()}));let o=n.value;return(n.getCurrentValue!==e||n.subscribe!==t)&&(o=e(),s({getCurrentValue:e,subscribe:t,value:o})),p.useEffect(()=>{let l=!1;const u=()=>{l||s(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 JD=Object.defineProperty,ez=(e,t,n)=>t in e?JD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ks=(e,t,n)=>ez(e,typeof t!="symbol"?t+"":t,n);const tz=5e3;if(typeof ee>"u")throw new Error("Required dependency 'react' not found");function pN(e,t,n){function s(o){return az(o),t.mutation(e,o,{optimisticUpdate:n})}return s.withOptimisticUpdate=function(l){if(n!==void 0)throw new Error(`Already specified optimistic update for mutation ${nr(e)}`);return pN(e,t,l)},s}class nz{constructor(t,n){if(Ks(this,"address"),Ks(this,"cachedSync"),Ks(this,"cachedPaginatedQueryClient"),Ks(this,"listeners"),Ks(this,"options"),Ks(this,"closed",!1),Ks(this,"_logger"),Ks(this,"adminAuth"),Ks(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?uN({verbose:n?.verbose??!1}):n?.logger!==!0&&n?.logger?n.logger:cN({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 GD(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new KD(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[s,o]=n,l=nr(t);return{onUpdate:u=>{const{queryToken:d,unsubscribe:h}=this.sync.subscribe(l,s,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,s)},localQueryLogs:()=>{if(this.cachedSync)return this.cachedSync.localQueryLogs(l,s)},journal:()=>{if(this.cachedSync)return this.cachedSync.queryJournal(l,s)}}}prewarmQuery(t){const n=t.extendSubscriptionFor??tz,o=this.watchQuery(t.query,t.args||{}).onUpdate(()=>{});setTimeout(o,n)}watchPaginatedQuery(t,n,s){const o=nr(t);return{onUpdate:l=>{const{paginatedQueryToken:u,unsubscribe:d}=this.paginatedQueryClient.subscribe(o,n||{},s),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,s)}}mutation(t,...n){const[s,o]=n,l=nr(t);return this.sync.mutation(l,s,o)}action(t,...n){const s=nr(t);return this.sync.action(s,...n)}query(t,...n){const s=this.watchQuery(t,...n),o=s.localQueryResult();return o!==void 0?Promise.resolve(o):new Promise((l,u)=>{const d=s.onUpdate(()=>{d();try{l(s.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),s=t.paginatedQueries.map(o=>o.token);this.transition([...n,...s])}transition(t){for(const n of t){const s=this.listeners.get(n);if(s)for(const o of s)o()}}}const Dx=ee.createContext(void 0);function rz(){return p.useContext(Dx)}const sz=({client:e,children:t})=>ee.createElement(Dx.Provider,{value:e},t);function Ye(e,...t){const n=t[0]==="skip",s=t[0]==="skip"?{}:ea(t[0]),o=typeof e=="string"?dN(e):e,l=nr(o),u=p.useMemo(()=>n?{}:{query:{query:o,args:s}},[JSON.stringify(ns(s)),l,n]),h=cz(u).query;if(h instanceof Error)throw h;return h}function Ke(e){const t=typeof e=="string"?dN(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(()=>pN(t,n),[n,nr(t)])}function az(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 oz=Object.defineProperty,iz=(e,t,n)=>t in e?oz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bg=(e,t,n)=>iz(e,typeof t!="symbol"?t+"":t,n);class lz{constructor(t){Bg(this,"createWatch"),Bg(this,"queries"),Bg(this,"listeners"),this.createWatch=t,this.queries={},this.listeners=new Set}setQueries(t){for(const n of Object.keys(t)){const{query:s,args:o,paginationOptions:l}=t[n];if(nr(s),this.queries[n]===void 0)this.addQuery(n,s,o,l?{paginationOptions:l}:{});else{const u=this.queries[n];(nr(s)!==nr(u.query)||JSON.stringify(ns(o))!==JSON.stringify(ns(u.args))||JSON.stringify(l)!==JSON.stringify(u.paginationOptions))&&(this.removeQuery(n),this.addQuery(n,s,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 s of Object.keys(t)){const{query:o,args:l}=t[s],u=t[s].paginationOptions;nr(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[s]=h}return n}setCreateWatch(t){this.createWatch=t;for(const n of Object.keys(this.queries)){const{query:s,args:o,watch:l,paginationOptions:u}=this.queries[n],d="journal"in l?l.journal():void 0;this.removeQuery(n),this.addQuery(n,s,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,s,{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,s,{...l?{journal:l}:[],...o?{paginationOptions:o}:{}}),d=u.onUpdate(()=>this.notifyListeners());this.queries[t]={query:n,args:s,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 cz(e){const t=rz();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(()=>(s,o,{journal:l,paginationOptions:u})=>u?t.watchPaginatedQuery(s,o,u):t.watchQuery(s,o,l?{journal:l}:{}),[t]);return uz(e,n)}function uz(e,t){const[n]=p.useState(()=>new lz(t));n.createWatch!==t&&n.setCreateWatch(t),p.useEffect(()=>()=>n.destroy(),[n]);const s=p.useMemo(()=>({getCurrentValue:()=>n.getLocalResults(e),subscribe:o=>(n.setQueries(e),n.subscribe(o))}),[n,e]);return XD(s)}const qv=new WeakMap,dz=new WeakMap,Qf={current:[]};let Ug=!1,au=0;const Zc=new Set,xf=new Map;function gN(e){for(const t of e){if(Qf.current.includes(t))continue;Qf.current.push(t),t.recompute();const n=dz.get(t);if(n)for(const s of n){const o=qv.get(s);o?.length&&gN(o)}}}function fz(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function hz(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function vN(e){if(au>0&&!xf.has(e)&&xf.set(e,e.prevState),Zc.add(e),!(au>0)&&!Ug)try{for(Ug=!0;Zc.size>0;){const t=Array.from(Zc);Zc.clear();for(const n of t){const s=xf.get(n)??n.prevState;n.prevState=s,fz(n)}for(const n of t){const s=qv.get(n);s&&(Qf.current.push(n),gN(s))}for(const n of t){const s=qv.get(n);if(s)for(const o of s)hz(o)}}}finally{Ug=!1,Qf.current=[],xf.clear()}}function mz(e){au++;try{e()}finally{if(au--,au===0){const t=Zc.values().next().value;t&&vN(t)}}}function pz(e){return typeof e=="function"}class gz{constructor(t,n){this.listeners=new Set,this.subscribe=s=>{var o,l;this.listeners.add(s);const u=(l=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:l.call(o,s,this);return()=>{this.listeners.delete(s),u?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,s,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):pz(t)?this.state=t(this.prevState):this.state=t,(o=(s=this.options)==null?void 0:s.onUpdate)==null||o.call(s),vN(this)}}const Va="__TSR_index",A1="popstate",O1="beforeunload";function vz(e){let t=e.getLocation();const n=new Set,s=u=>{t=e.getLocation(),n.forEach(d=>d({location:t,action:u}))},o=u=>{e.notifyOnIndexChange??!0?s(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=Kf(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[Va];d=D1(m+1,d),l({task:()=>{e.pushState(u,d),s({type:"PUSH"})},navigateOpts:h,type:"PUSH",path:u,state:d})},replace:(u,d,h)=>{const m=t.state[Va];d=D1(m,d),l({task:()=>{e.replaceState(u,d),s({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[Va]!==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:s}}function D1(e,t){t||(t={});const n=zx();return{...t,key:n,__TSR_key:n,[Va]:e}}function xz(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,s=t.history.replaceState;let o=[];const l=()=>o,u=O=>o=O,d=(O=>O),h=(()=>Kf(`${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({[Va]: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=Kf(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[Va]-m.state[Va],z=D===1,B=D===-1,q=!z&&!B||g;g=!1;const Y=q?"GO":B?"BACK":"FORWARD",G=q?{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 q=B.enableBeforeUnload??!0;if(q===!0){D=!0;break}if(typeof q=="function"&&q()===!0){D=!0;break}}if(D)return O.preventDefault(),O.returnValue=""},T=vz({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=s,t.removeEventListener(O1,R,{capture:!0}),t.removeEventListener(A1,A)},onBlocked:()=>{v&&m!==v&&(m=v)},getBlockers:l,setBlockers:u,notifyOnIndexChange:!1});return t.addEventListener(O1,R,{capture:!0}),t.addEventListener(A1,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=s.apply(t.history,O);return T._ignoreSubscribers||M("REPLACE"),D},T}function yz(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function Kf(e,t){const n=yz(e),s=n.indexOf("#"),o=n.indexOf("?"),l=zx();return{href:n,pathname:n.substring(0,s>0?o>0?Math.min(s,o):s:o>0?o:n.length),hash:s>-1?n.substring(s):"",search:o>-1?n.slice(o,s===-1?void 0:s):"",state:t||{[Va]:0,key:l,__TSR_key:l}}}function zx(){return(Math.random()+1).toString(36).substring(7)}const bz=!1;function ou(e){let t;return mz(()=>{t=e()}),t}function hu(e){return e[e.length-1]}function wz(e){return typeof e=="function"}function Ba(e,t){return wz(e)?e(t):e}const Sz=Object.prototype.hasOwnProperty,z1=Object.prototype.propertyIsEnumerable;function er(e,t,n=0){if(e===t)return e;if(n>500)return t;const s=t,o=I1(e)&&I1(s);if(!o&&!(Xf(e)&&Xf(s)))return s;const l=o?e:P1(e);if(!l)return s;const u=o?s:P1(s);if(!u)return s;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=s[y];if(w===S){m[y]=w,(o?g<d:Sz.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 P1(e){const t=Object.getOwnPropertyNames(e);for(const o of t)if(!z1.call(e,o))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const s=t;for(const o of n){if(!z1.call(e,o))return!1;s.push(o)}return s}function Xf(e){if(!L1(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!L1(n)||!n.hasOwnProperty("isPrototypeOf"))}function L1(e){return Object.prototype.toString.call(e)==="[object Object]"}function I1(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ao(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 s=0,o=e.length;s<o;s++)if(!Ao(e[s],t[s],n))return!1;return!0}if(Xf(e)&&Xf(t)){const s=n?.ignoreUndefined??!0;if(n?.partial){for(const u in t)if((!s||t[u]!==void 0)&&!Ao(e[u],t[u],n))return!1;return!0}let o=0;if(!s)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((!s||t[u]!==void 0)&&(l++,l>o||!Ao(e[u],t[u],n)))return!1;return o===l}return!1}function hl(e){let t,n;const s=new Promise((o,l)=>{t=o,n=l});return s.status="pending",s.resolve=o=>{s.status="resolved",s.value=o,t(o),e?.(o)},s.reject=o=>{s.status="rejected",n(o)},s}function rl(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function jz(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function $1(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 jz(t)}const xN=["http:","https:","mailto:","tel:"];function Jf(e){if(!e)return!1;try{const t=new URL(e);return!xN.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 s=0,o="",l;for(;(l=n.exec(e))!==null;)o+=$1(e.slice(s,l.index))+l[0],s=n.lastIndex;return o=o+$1(s?e.slice(s):e),o.startsWith("//")&&(o="/"+o.replace(/^\/+/,"")),o}function Cz(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}var Nz="Invariant failed";function ca(e,t){if(!e)throw new Error(Nz)}function eh(e){const t=new Map;let n,s;const o=l=>{l.next&&(l.prev?(l.prev.next=l.next,l.next.prev=l.prev,l.next=void 0,s&&(s.next=l,l.prev=s)):(l.next.prev=void 0,n=l.next,l.next=void 0,s&&(l.prev=s,s.next=l)),s=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===s&&(s=void 0)}const d=t.get(l);if(d)d.value=u,o(d);else{const h={key:l,value:u,prev:s};s&&(s.next=h),s=h,n||(n=h),t.set(l,h)}},clear(){t.clear(),n=void 0,s=void 0}}}const ml=0,Po=1,Lo=2,mu=3,_o=4,yN=5;function kz(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 s=e.indexOf("/",t),o=s===-1?e.length:s,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]=Lo,n[1]=t,n[2]=t,n[3]=d,n[4]=d,n[5]=d,n}if(l.charCodeAt(0)===36)return n[0]=Po,n[1]=t,n[2]=t+1,n[3]=o,n[4]=o,n[5]=o,n;const u=kz(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]=Lo,n[1]=t+d,n[2]=t+v,n[3]=t+g,n[4]=t+h+1,n[5]=e.length,n):(n[0]=Po,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 Th(e,t,n,s,o,l,u){u?.(n);let d=s;{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=Eo(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=Eo(n.fullPath??n.from);A.parent=o,A.depth=l,S=A,o.staticInsensitive.set(E,A)}}break}case Po:{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=qg(Po,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=qg(mu,n.fullPath??n.from,M,A,R);S=O,O.parent=o,O.depth=l,o.optional??=[],o.optional.push(O)}break}case Lo:{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=qg(Lo,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=Eo(n.fullPath??n.from);w.kind=yN,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=Eo(n.fullPath??n.from);w.kind=_o,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)Th(e,t,h,d,o,l,u)}function Vg(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 Fa(e){if(e.pathless)for(const t of e.pathless)Fa(t);if(e.static)for(const t of e.static.values())Fa(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())Fa(t);if(e.dynamic?.length){e.dynamic.sort(Vg);for(const t of e.dynamic)Fa(t)}if(e.optional?.length){e.optional.sort(Vg);for(const t of e.optional)Fa(t)}if(e.wildcard?.length){e.wildcard.sort(Vg);for(const t of e.wildcard)Fa(t)}}function Eo(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 qg(e,t,n,s,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:s,suffix:o}}function _z(e,t){const n=Eo("/"),s=new Uint16Array(6);for(const o of e)Th(!1,s,o,1,n,0);Fa(n),t.masksTree=n,t.flatCache=eh(1e3)}function Ez(e,t){e||="/";const n=t.flatCache.get(e);if(n)return n;const s=Lx(e,t.masksTree);return t.flatCache.set(e,s),s}function Tz(e,t,n,s,o){e||="/",s||="/";const l=t?`case\0${e}`:e;let u=o.singleCache.get(l);if(!u){u=Eo("/");const d=new Uint16Array(6);Th(t,d,{from:e},1,u,0),o.singleCache.set(l,u)}return Lx(s,u,n)}function Mz(e,t,n=!1){const s=n?e:`nofuzz\0${e}`,o=t.matchCache.get(s);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=Oz(l.route)),t.matchCache.set(s,l),l}function Rz(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function Az(e,t=!1,n){const s=Eo(e.fullPath),o=new Uint16Array(6),l={},u={};let d=0;return Th(t,o,e,1,s,0,m=>{if(n?.(m,d),ca(!(m.id in l),`Duplicate routes found with id: ${String(m.id)}`),l[m.id]=m,d!==0&&m.path){const v=Rz(m.fullPath);(!u[v]||m.fullPath.endsWith("/"))&&(u[v]=m)}d++}),Fa(s),{processedTree:{segmentTree:s,singleCache:eh(1e3),matchCache:eh(1e3),flatCache:null,masksTree:null},routesById:l,routesByPath:u}}function Lx(e,t,n=!1){const s=e.split("/"),o=zz(e,s,t,n);if(!o)return null;const[l]=bN(e,s,o);return{route:o.node.route,rawParams:l,parsedParams:o.parsedParams}}function bN(e,t,n){const s=Dz(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<s.length;u++,d++,h++,m++){const v=s[d];if(v.kind===_o)break;if(v.kind===yN){m--,u--,h--;continue}const g=t[u],y=h;if(g&&(h+=g.length),v.kind===Po){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===Lo){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 Oz(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Dz(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function zz(e,t,n,s){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(!Hg(e,t,g))continue;M=g.rawParams,E=g.extract,A=g.parsedParams}s&&y.route&&y.kind!==_o&&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&&(Hg(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 q={node:D,index:u,skipped:S,depth:j,statics:N,dynamics:C,optionals:_,extract:E,rawParams:M,parsedParams:A};if(!(D.skipOnParamError&&!Hg(e,t,q))){h=q;break}}if(y.optional){const D=S|1<<j,z=j+1;for(let B=y.optional.length-1;B>=0;B--){const q=y.optional[B];d.push({node:q,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 q=y.optional[B],{prefix:Y,suffix:G}=q;if(Y||G){const ae=q.caseSensitive?T:O??=T.toLowerCase();if(Y&&!ae.startsWith(Y)||G&&!ae.endsWith(G))continue}d.push({node:q,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:q}=z;if(B||q){const Y=z.caseSensitive?T:O??=T.toLowerCase();if(B&&!Y.startsWith(B)||q&&!Y.endsWith(q))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(s&&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 Hg(e,t,n){try{const[s,o]=bN(e,t,n);n.rawParams=s,n.extract=o;const l=n.node.parse(s);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===_o)>(e.node.kind===_o)||t.node.kind===_o==(e.node.kind===_o)&&t.depth>e.depth))):!0}function If(e){return Ix(e.filter(t=>t!==void 0).join("/"))}function Ix(e){return e.replace(/\/{2,}/g,"/")}function wN(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function ta(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function SN(e){return ta(wN(e))}function th(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Pz(e,t,n){return th(e,n)===th(t,n)}function Lz({base:e,to:t,trailingSlash:n="never",cache:s}){const o=t.startsWith("/"),l=!o&&t===".";let u;if(s){u=o?t:l?e:e+"\0"+t;const g=s.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===Po?m+=j||N?`${j}{$${C}}${N}`:`$${C}`:w===Lo?m+=j||N?`${j}{$}${N}`:"$":m+=`${j}{-$${C}}${N}`}m=Ix(m);const v=m||"/";return u&&s&&s.set(u,v),v}function Iz(e){const t=new Map(e.map(o=>[encodeURIComponent(o),o])),n=Array.from(t.keys()).map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),s=new RegExp(n,"g");return o=>o.replace(s,l=>t.get(l)??l)}function Yg(e,t,n){const s=t[e];return typeof s!="string"?s:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(s)?s:s.split("/").map(o=>F1(o,n)).join("/"):F1(s,n)}function Wg({path:e,params:t,decoder:n,server:s}){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===Lo){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=Yg("_splat",t,n);m+="/"+j+C+N;continue}if(w===Po){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=Yg(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),_=Yg(S,t,n)??"";m+="/"+N+_+C;continue}}return e.endsWith("/")&&(m+="/"),{usedParams:l,interpolatedPath:m||"/",isMissingParams:o}}function F1(e,t){const n=encodeURIComponent(e);return t?.(n)??n}function br(e){return!!e?.isNotFound}function $z(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}const Hv="tsr-scroll-restoration-v1_3",Fz=(e,t)=>{let n;return(...s)=>{n||(n=setTimeout(()=>{e(...s),n=null},t))}};function Bz(){const e=$z();if(!e)return null;const t=e.getItem(Hv);let n=t?JSON.parse(t):{};return{state:n,set:s=>{n=Ba(s,n)||n;try{e.setItem(Hv,JSON.stringify(n))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}const yf=Bz(),Uz=e=>e.state.__TSR_key||e.href;function Vz(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 nh=!1;function qz({storageKey:e,key:t,behavior:n,shouldScrollRestoration:s,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];nh=!0;e:{if(s&&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)}}nh=!1}function Hz(e,t){if(!yf||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!yf))return;e.isScrollRestorationSetup=!0,nh=!1;const s=e.options.getScrollRestorationKey||Uz;window.history.scrollRestoration="manual";const o=l=>{if(nh||!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=Vz(l.target)}const d=s(e.state.location);yf.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",Fz(o,100),!0),e.subscribe("onRendered",l=>{const u=s(l.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(qz({storageKey:Hv,key:u,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&yf.set(d=>(d[u]||={},d)))})}function Yz(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 Wz(e,t=String){const n=new URLSearchParams;for(const s in e){const o=e[s];o!==void 0&&n.set(s,t(o))}return n.toString()}function Gg(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function Gz(e){const t=new URLSearchParams(e),n={};for(const[s,o]of t.entries()){const l=n[s];l==null?n[s]=Gg(o):Array.isArray(l)?l.push(Gg(o)):n[s]=[l,Gg(o)]}return n}const Zz=Kz(JSON.parse),Qz=Xz(JSON.stringify,JSON.parse);function Kz(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=Gz(t);for(const s in n){const o=n[s];if(typeof o=="string")try{n[s]=e(o)}catch{}}return n}}function Xz(e,t){const n=typeof t=="function";function s(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=Wz(o,s);return l?`?${l}`:""}}const Fr="__root__";function Jz(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&typeof e.href=="string"&&Jf(e.href))throw new Error(`Redirect blocked: unsafe protocol in href "${e.href}". Only ${xN.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 Br(e){return e instanceof Response&&!!e.options}const $f=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Mh=(e,t)=>!!(e.preload&&!e.router.state.matches.some(n=>n.id===t)),sl=(e,t,n=!0)=>{const s={...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(s,d.__routeContext,d.__beforeLoadContext)}return s},jN=(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),ca(n.options.notFoundComponent);const s=e.matches.find(o=>o.routeId===n.id);ca(s,"Could not find match for route: "+n.id),e.updateMatch(s.id,o=>({...o,status:"notFound",error:t,isFetching:!1})),t.routerCode==="BEFORE_LOAD"&&n.parentRoute&&(t.routeId=n.parentRoute.id,jN(e,t))},Ua=(e,t,n)=>{if(!(!Br(n)&&!br(n))){if(Br(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 s=Br(n)?"redirected":"notFound";t._nonReactive.error=n,e.updateMatch(t.id,o=>({...o,status:s,context:sl(e,t.index),isFetching:!1,error:n})),br(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()}throw Br(n)?(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n),n):(jN(e,n),n)}},CN=(e,t)=>!!e.router.getMatch(t)._nonReactive.dehydrated,$c=(e,t,n,s)=>{const{id:o,routeId:l}=e.matches[t],u=e.router.looseRoutesById[l];if(n instanceof Promise)throw n;n.routerCode=s,e.firstBadMatchIndex??=t,Ua(e,e.router.getMatch(o),n);try{u.options.onError?.(n)}catch(d){n=d,Ua(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}))},NN=(e,t,n,s)=>{if(s._nonReactive.pendingTimeout!==void 0)return;const o=n.options.pendingMs??e.router.options.defaultPendingMs;if(!!(e.onReady&&!Mh(e,t)&&(n.options.loader||n.options.beforeLoad||EN(n))&&typeof o=="number"&&o!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent))){const u=setTimeout(()=>{$f(e)},o);s._nonReactive.pendingTimeout=u}},e4=(e,t,n)=>{const s=e.router.getMatch(t);if(!s._nonReactive.beforeLoadPromise&&!s._nonReactive.loaderPromise)return;NN(e,t,n,s);const o=()=>{const l=e.router.getMatch(t);l.preload&&(l.status==="redirected"||l.status==="notFound")&&Ua(e,l,l.error)};return s._nonReactive.beforeLoadPromise?s._nonReactive.beforeLoadPromise.then(o):o()},t4=(e,t,n,s)=>{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"),NN(e,t,s,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(!s.options.beforeLoad){ou(()=>{v(),g()});return}o._nonReactive.beforeLoadPromise=hl();const y={...sl(e,n,!1),...o.__routeContext},{search:w,params:S,cause:j}=o,N=Mh(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}(Br(M)||br(M))&&(v(),$c(e,n,M,"BEFORE_LOAD")),ou(()=>{v(),e.updateMatch(t,A=>({...A,__beforeLoadContext:M})),g()})};let E;try{if(E=s.options.beforeLoad(C),rl(E))return v(),E.catch(M=>{$c(e,n,M,"BEFORE_LOAD")}).then(_)}catch(M){v(),$c(e,n,M,"BEFORE_LOAD")}_(E)},n4=(e,t)=>{const{id:n,routeId:s}=e.matches[t],o=e.router.looseRoutesById[s],l=()=>d(),u=()=>t4(e,n,t,o),d=()=>{if(CN(e,n))return;const h=e4(e,n,o);return rl(h)?h.then(u):u()};return l()},r4=(e,t,n)=>{const s=e.router.getMatch(t);if(!s||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const o={ssr:e.router.options.ssr,matches:e.matches,match:s,params:s.params,loaderData:s.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}})},kN=(e,t,n,s)=>{const o=e.matchPromises[n-1],{params:l,loaderDeps:u,abortController:d,cause:h}=e.router.getMatch(t),m=sl(e,n),v=Mh(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:s,...e.router.options.additionalContext}},B1=async(e,t,n,s)=>{try{const o=e.router.getMatch(t);try{(!(bz??e.router.isServer)||o.ssr===!0)&&_N(s);const l=s.options.loader?.(kN(e,t,n,s)),u=s.options.loader&&rl(l);if((u||s._lazyPromise||s._componentsPromise||s.options.head||s.options.scripts||s.options.headers||o._nonReactive.minPendingPromise)&&e.updateMatch(t,m=>({...m,isFetching:"loader"})),s.options.loader){const m=u?await l:l;Ua(e,e.router.getMatch(t),m),m!==void 0&&e.updateMatch(t,v=>({...v,loaderData:m}))}s._lazyPromise&&await s._lazyPromise;const h=o._nonReactive.minPendingPromise;h&&await h,s._componentsPromise&&await s._componentsPromise,e.updateMatch(t,m=>({...m,error:void 0,context:sl(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:sl(e,n)}));return}const d=o._nonReactive.minPendingPromise;d&&await d,br(l)&&await s.options.notFoundComponent?.preload?.(),Ua(e,e.router.getMatch(t),l);try{s.options.onError?.(l)}catch(h){u=h,Ua(e,e.router.getMatch(t),h)}e.updateMatch(t,h=>({...h,error:u,context:sl(e,n),status:"error",isFetching:!1}))}}catch(o){const l=e.router.getMatch(t);l&&(l._nonReactive.loaderPromise=void 0),Ua(e,l,o)}},s4=async(e,t)=>{const{id:n,routeId:s}=e.matches[t];let o=!1,l=!1;const u=e.router.looseRoutesById[s];if(!CN(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&&Ua(e,v,g)}else{const v=Date.now()-m.updatedAt,g=Mh(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(kN(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 B1(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){Br(E)&&await e.router.navigate(E.options)}})()):(C!=="success"||o&&e.sync)&&await B1(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 U1(e){const t=Object.assign(e,{matchPromises:[]});t.router.state.matches.some(n=>n._forcePending)&&$f(t);try{for(let d=0;d<t.matches.length;d++){const h=n4(t,d);rl(h)&&await h}const n=t.firstBadMatchIndex??t.matches.length;for(let d=0;d<n;d++)t.matchPromises.push(s4(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(Br(d))throw d;!l&&br(d)&&(l=d)}for(const d of t.matches){const{id:h,routeId:m}=d,v=t.router.looseRoutesById[m];try{const g=r4(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=$f(t);rl(u)&&await u}catch(n){if(br(n)&&!t.preload){const s=$f(t);throw rl(s)&&await s,n}if(Br(n))throw n}return t.matches}async function _N(e){if(!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{const{id:n,...s}=t.options;Object.assign(e.options,s),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0),!e._componentsLoaded&&e._componentsPromise===void 0){const t=()=>{const n=[];for(const s of TN){const o=e.options[s]?.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 EN(e){for(const t of TN)if(e.options[t]?.preload)return!0;return!1}const TN=["component","errorComponent","pendingComponent","notFoundComponent"];function a4(e){return{input:({url:t})=>{for(const n of e)t=Yv(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=MN(e[n],t);return t}}}function o4(e){const t=SN(e.basepath),n=`/${t}`,s=`${n}/`,o=e.caseSensitive?n:n.toLowerCase(),l=e.caseSensitive?s:s.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=If(["/",t,u.pathname]),u)}}function Yv(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 MN(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 Oo(e){const t=e.resolvedLocation,n=e.location,s=t?.pathname!==n.pathname,o=t?.href!==n.href,l=t?.hash!==n.hash;return{fromLocation:t,toLocation:n,pathChanged:s,hrefChanged:o,hashChanged:l}}class i4{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 s=this.options,o=this.basepath??s?.basepath??"/",l=this.basepath===void 0,u=s?.rewrite;if(this.options={...s,...n},this.isServer=this.options.isServer??typeof document>"u",this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Iz(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=xz()),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=eh(1e3),y=this.buildRouteTree(),this.setRoutes(y)}!this.__store&&this.latestLocation&&(this.__store=new gz(c4(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(y=>!["redirected"].includes(y.status))}}}),Hz(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=SN(h);w&&w!=="/"&&y.push(o4({basepath:h})),m&&y.push(m),this.rewrite=y.length===0?void 0:y.length===1?y[0]:a4(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=Az(this.routeTree,this.options.caseSensitive,(s,o)=>{s.init({originalIndex:o})});return this.options.routeMasks&&_z(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,s)=>{const o={eventType:n,fn:s};return this.subscribers.add(o),()=>{this.subscribers.delete(o)}},this.emit=n=>{this.subscribers.forEach(s=>{s.eventType===n.type&&s.fn(n)})},this.parseLocation=(n,s)=>{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(s?.search,_),hash:Lc(v.slice(1)),state:er(s?.state,y)}}const w=new URL(g,this.origin),S=Yv(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(s?.search,j),hash:Lc(S.hash.slice(1)),state:er(s?.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,s)=>Lz({base:n,to:Ix(s),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,s,o)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:s},o):this.matchRoutesInternal(n,s),this.getMatchedRoutes=n=>u4({pathname:n,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=n=>{const s=this.getMatch(n);s&&(s.abortController.abort(),clearTimeout(s._nonReactive.pendingTimeout),s._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const n=this.state.matches.filter(l=>l.status==="pending"),s=this.state.matches.filter(l=>l.isFetching==="loader");new Set([...this.state.pendingMatches??[],...n,...s]).forEach(l=>{this.cancelMatch(l.id)})},this.buildLocation=n=>{const s=(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,Ba(l.params,g)),S=Wg({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["**"]:ta(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(_?Wg({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,Ff(G.options.validateSearch,{...Y,...M}))}catch{}}),M=Y}M=d4({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?Ba(l.hash,u.hash):void 0,T=R?`#${R}`:"";let O=l.state===!0?u.state:l.state?Ba(l.state,u.state):{};O=er(u.state,O);const D=`${E}${A}${T}`;let z,B,q=!1;if(this.rewrite){const Y=new URL(D,this.origin),G=MN(this.rewrite,Y);z=Y.href.replace(Y.origin,""),G.origin!==this.origin?(B=G.href,q=!0):B=G.pathname+G.search+G.hash}else z=Cz(D),B=z;return{publicHref:B,href:z,pathname:E,search:M,searchStr:A,state:O,hash:R??"",external:q,unmaskOnReload:l.unmaskOnReload}},o=(l={},u)=>{const d=s(l);let h=u?s(u):void 0;if(!h){const m={};if(this.options.routeMasks){const v=Ez(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,Ba(y,m));u={from:n.from,...w,params:S},h=s(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:s,...o})=>{const l=()=>{const h=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];h.forEach(v=>{o.state[v]=this.latestLocation.state[v]});const m=Ao(o.state,this.latestLocation.state);return h.forEach(v=>{delete o.state[v]}),m},u=ta(this.latestLocation.href)===ta(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:s})}return this.resetNextScroll=o.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:s,hashScrollIntoView:o,viewTransition:l,ignoreBlocker:u,href:d,...h}={})=>{if(d){const g=this.history.location.state.__TSR_index,y=Kf(d,{__TSR_index:n?g:g+1}),w=new URL(y.pathname,this.origin),S=Yv(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:s,hashScrollIntoView:o,ignoreBlocker:u});return Promise.resolve().then(()=>{this.pendingBuiltLocation===m&&(this.pendingBuiltLocation=void 0)}),v},this.navigate=async({to:n,reloadDocument:s,href:o,publicHref:l,...u})=>{let d=!1;if(o)try{new URL(`${o}`),d=!0}catch{}if(d&&!s&&(s=!0),s){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(Jf(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(s=>({...s,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:n,cachedMatches:s.cachedMatches.filter(o=>!n.some(l=>l.id===o.id))}))},this.load=async n=>{let s,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",...Oo({resolvedLocation:m,location:h})}),this.emit({type:"onBeforeLoad",...Oo({resolvedLocation:m,location:h})}),await U1({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){Br(h)?(s=h,this.navigate({...s.options,replace:!0,ignoreBlocker:!0})):br(h)&&(o=h),this.__store.setState(m=>({...m,statusCode:s?s.status:o?404:m.matches.some(v=>v.status==="error")?500:200,redirect:s}))}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 s=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,s&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let o;if(typeof s=="object"&&this.isViewTransitionTypesSupported){const l=this.latestLocation,u=this.state.resolvedLocation,d=typeof s.types=="function"?s.types(Oo({resolvedLocation:u,location:l})):s.types;if(d===!1){n();return}o={update:n,types:d}}else o=n;document.startViewTransition(o)}else n()},this.updateMatch=(n,s)=>{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?s(u):u)}))})},this.getMatch=n=>{const s=o=>o.id===n;return this.state.cachedMatches.find(s)??this.state.pendingMatches?.find(s)??this.state.matches.find(s)},this.invalidate=n=>{const s=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(s),cachedMatches:o.cachedMatches.map(s),pendingMatches:o.pendingMatches?.map(s)})),this.shouldViewTransition=!1,this.load({sync:n?.sync})},this.getParsedLocationHref=n=>n.publicHref||"/",this.resolveRedirect=n=>{const s=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(s)try{const o=new URL(s);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 s=n?.filter;s!==void 0?this.__store.setState(o=>({...o,cachedMatches:o.cachedMatches.filter(l=>!s(l))})):this.__store.setState(o=>({...o,cachedMatches:[]}))},this.clearExpiredCache=()=>{const n=s=>{const o=this.looseRoutesById[s.routeId];if(!o.options.loader)return!0;const l=(s.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??300*1e3;return s.status==="error"?!0:Date.now()-s.updatedAt>=l};this.clearCache({filter:n})},this.loadRouteChunk=_N,this.preloadRoute=async n=>{const s=this.buildLocation(n);let o=this.matchRoutes(s,{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 U1({router:this,matches:o,location:s,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(Br(d))return d.options.reloadDocument?void 0:await this.preloadRoute({...d.options,_fromLocation:s});br(d)||console.error(d);return}},this.matchRoute=(n,s)=>{const o={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},l=this.buildLocation(o);if(s?.pending&&this.state.status!=="pending")return!1;const d=(s?.pending===void 0?!this.state.isLoading:s.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,h=Tz(l.pathname,s?.caseSensitive??!1,s?.fuzzy??!1,d.pathname,this.processedTree);return!h||n.params&&!Ao(h.rawParams,n.params,{partial:!0})?!1:s?.includeSearch??!0?Ao(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??Qz,parseSearch:t.parseSearch??Zz}),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:s}){this.routesById=t,this.routesByPath=n,this.processedTree=s;const o=this.options.notFoundRoute;o&&(o.init({originalIndex:99999999999}),this.routesById[o.id]=o)}get looseRoutesById(){return this.routesById}matchRoutesInternal(t,n){const s=this.getMatchedRoutes(t.pathname),{foundRoute:o,routeParams:l,parsedParams:u}=s;let{matchedRoutes:d}=s,h=!1;(o?o.path!=="/"&&l["**"]:ta(t.pathname))&&(this.options.notFoundRoute?d=[...d,this.options.notFoundRoute]:h=!0);const m=h?h4(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=Ff(y.options.validateSearch,{...G})??void 0;return[{...G,...L},{...ae,...L},void 0]}catch(L){let $=L;if(L instanceof rh||($=new rh(L.message,{cause:L})),n?.throwOnError)throw $;return[G,{},$]}})(),_=y.options.loaderDeps?.({search:j})??"",E=_?JSON.stringify(_):"",{interpolatedPath:M,usedParams:A}=Wg({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{V1(y,A,u,D)}catch(G){if(br(G)||Br(G)?z=G:z=new l4(G.message,{cause:G}),n?.throwOnError)throw z}Object.assign(l,D);const B=O?"stay":"enter";let q;if(T)q={...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||EN(y)?"pending":"success";q={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||(q.globalNotFound=m===y.id),q.searchError=C;const Y=g(S);q.context={...Y,...q.__routeContext,...q.__beforeLoadContext},v.push(q)}),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:s,parsedParams:o}=this.getMatchedRoutes(t.pathname),l=hu(n),u={...t.search};for(const v of n)try{Object.assign(u,Ff(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={...s};for(const g of n)try{V1(g,s,o??{},v)}catch{}m=v}return{matchedRoutes:n,fullPath:l.fullPath,search:u,params:m}}}class rh extends Error{}class l4 extends Error{}function c4(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function Ff(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new rh("Async validation not supported");if(n.issues)throw new rh(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 u4({pathname:e,routesById:t,processedTree:n}){const s={},o=ta(e);let l,u;const d=Mz(o,n,!0);return d&&(l=d.route,Object.assign(s,d.rawParams),u=Object.assign({},d.parsedParams)),{matchedRoutes:d?.branch||[t[Fr]],routeParams:s,foundRoute:l,parsedParams:u}}function d4({search:e,dest:t,destRoutes:n,_includeValidateSearch:s}){return f4(n)(e,t,s??!1)}function f4(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,...Ff(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:Ba(l.search,o):{}};t.middlewares.push(n);const s=(o,l,u)=>{if(o>=u.length)return l;const d=u[o];return d({search:l,next:m=>s(o+1,m,u)})};return function(l,u,d){return t.dest=u,t._includeValidateSearch=d,s(0,l,t.middlewares)}}function h4(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const s=t[n];if(s.children)return s.id}return Fr}function V1(e,t,n,s){const o=e.options.params?.parse??e.options.parseParams;if(o)if(e.options.skipRouteOnParseError)for(const l in t)l in n&&(s[l]=n[l]);else{const l=o(s);Object.assign(s,l)}}const m4="Error preloading route! ☝️";class RN{constructor(t){if(this.init=n=>{this.originalIndex=n.originalIndex;const s=this.options,o=!s?.path&&!s?.id;this.parentRoute=this.options.getParentRoute?.(),o?this._path=Fr:this.parentRoute||ca(!1);let l=o?Fr:s?.path;l&&l!=="/"&&(l=wN(l));const u=s?.id||l;let d=o?Fr:If([this.parentRoute.id===Fr?"":this.parentRoute.id,u]);l===Fr&&(l="/"),d!==Fr&&(d=If(["/",d]));const h=d===Fr?"/":If([this.parentRoute.fullPath,l]);this._path=l,this._id=d,this._fullPath=h,this._to=ta(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=>Jz({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 p4 extends RN{constructor(t){super(t)}}const bf=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Zg(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 g4(e,t,n={},s={}){p.useEffect(()=>{if(!e.current||s.disabled||typeof IntersectionObserver!="function")return;const o=new IntersectionObserver(([l])=>{t(l)},n);return o.observe(e.current),()=>{o.disconnect()}},[t,n,s.disabled,e])}function v4(e){const t=p.useRef(null);return p.useImperativeHandle(e,()=>t.current,[]),t}function $x(e){const t=e.errorComponent??Fx;return i.jsx(x4,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:s})=>n?p.createElement(t,{error:n,reset:s}):e.children})}class x4 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(s=>!s),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 y4({children:e,fallback:t=null}){return AN()?i.jsx(ee.Fragment,{children:e}):i.jsx(ee.Fragment,{children:t})}function AN(){return ee.useSyncExternalStore(b4,()=>!0,()=>!1)}function b4(){return()=>{}}var Qg={exports:{}},Kg={},Xg={exports:{}},Jg={};var q1;function w4(){if(q1)return Jg;q1=1;var e=Du();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,s=e.useState,o=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function d(g,y){var w=y(),S=s({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 Jg.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,Jg}var H1;function ON(){return H1||(H1=1,Xg.exports=w4()),Xg.exports}var Y1;function S4(){if(Y1)return Kg;Y1=1;var e=Du(),t=ON();function n(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}var s=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,l=e.useRef,u=e.useEffect,d=e.useMemo,h=e.useDebugValue;return Kg.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,s(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},Kg}var W1;function j4(){return W1||(W1=1,Qg.exports=S4()),Qg.exports}var C4=j4();function N4(e,t=s=>s,n={}){const s=n.equal??k4;return C4.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,s)}function k4(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[s,o]of e)if(!t.has(s)||!Object.is(o,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=G1(e);if(n.length!==G1(t).length)return!1;for(let s=0;s<n.length;s++)if(!Object.prototype.hasOwnProperty.call(t,n[s])||!Object.is(e[n[s]],t[n[s]]))return!1;return!0}function G1(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const ev=p.createContext(null);function DN(){return typeof document>"u"?ev:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=ev,ev)}function Vr(e){const t=p.useContext(DN());return e?.warn,t}function $n(e){const t=Vr({warn:e?.router===void 0}),n=e?.router||t,s=p.useRef(void 0);return N4(n.__store,o=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){const l=er(s.current,e.select(o));return s.current=l,l}return e.select(o)}return o})}const Rh=p.createContext(void 0),_4=p.createContext(void 0);function ks(e){const t=p.useContext(e.from?_4:Rh);return $n({select:s=>{const o=s.matches.find(l=>e.from?e.from===l.routeId:l.id===t);if(ca(!((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 ks({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 ks({...n,select:s=>t?t(s.loaderDeps):s.loaderDeps})}function Yo(e){return ks({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 Vx(e){return ks({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Qa(e){const t=Vr();return p.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}var Ml=tN();const E4=eN(Ml);function T4(e,t){const n=Vr(),s=v4(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:q,state:Y,mask:G,reloadDocument:ae,unsafeRelative:L,from:$,_fromLocation:U,...H}=e,le=AN(),I=$n({select:Xe=>Xe.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(()=>z4(X,ue,n.history,C),[C,ue,X,n.history]),ye=p.useMemo(()=>{if(te?.external)return Jf(te.href)?void 0:te.href;if(!P4(d)&&!(typeof d!="string"||d.indexOf(":")===-1))try{return new URL(d),Jf(d)?void 0:d}catch{}},[d,te]),Ce=$n({select:Xe=>{if(ye)return!1;if(u?.exact){if(!Pz(Xe.location.pathname,ne.pathname,n.basepath))return!1}else{const wt=th(Xe.location.pathname,n.basepath),gt=th(ne.pathname,n.basepath);if(!(wt.startsWith(gt)&&(wt.length===gt.length||wt[gt.length]==="/")))return!1}return(u?.includeSearch??!0)&&!Ao(Xe.location.search,ne.search,{partial:!u?.exact,ignoreUndefined:!u?.explicitUndefined})?!1:u?.includeHash?le&&Xe.location.hash===ne.hash:!0}}),_e=Ce?Ba(o,{})??M4:tv,Re=Ce?tv:Ba(l,{})??tv,ge=[E,_e.className,Re.className].filter(Boolean).join(" "),Be=(_||_e.style||Re.style)&&{..._,..._e.style,...Re.style},[be,Ue]=p.useState(!1),rt=p.useRef(!1),it=e.reloadDocument||ye?!1:h??n.options.defaultPreload,bt=m??n.options.defaultPreloadDelay??0,pe=p.useCallback(()=>{n.preloadRoute({...K}).catch(Xe=>{console.warn(Xe),console.warn(m4)})},[n,K]),Le=p.useCallback(Xe=>{Xe?.isIntersecting&&pe()},[pe]);g4(s,Le,D4,{disabled:!!C||it!=="viewport"}),p.useEffect(()=>{rt.current||!C&&it==="render"&&(pe(),rt.current=!0)},[C,pe,it]);const We=Xe=>{const wt=Xe.currentTarget.getAttribute("target"),gt=N!==void 0?N:wt;if(!C&&!L4(Xe)&&!Xe.defaultPrevented&&(!gt||gt==="_self")&&Xe.button===0){Xe.preventDefault(),Ml.flushSync(()=>{Ue(!0)});const qn=n.subscribe("onResolved",()=>{qn(),Ue(!1)});n.navigate({...K,replace:g,resetScroll:w,hashScrollIntoView:v,startTransition:y,viewTransition:S,ignoreBlocker:D})}};if(ye)return{...H,ref:s,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=Xe=>{C||it&&pe()},ft=Oe,ut=Xe=>{if(!(C||!it))if(!bt)pe();else{const wt=Xe.target;if(Fc.has(wt))return;const gt=setTimeout(()=>{Fc.delete(wt),pe()},bt);Fc.set(wt,gt)}},Mn=Xe=>{if(C||!it||!bt)return;const wt=Xe.target,gt=Fc.get(wt);gt&&(clearTimeout(gt),Fc.delete(wt))};return{...H,..._e,...Re,href:te?.href,ref:s,onClick:Bc([M,We]),onFocus:Bc([A,Oe]),onMouseEnter:Bc([R,ut]),onMouseLeave:Bc([T,Mn]),onTouchStart:Bc([O,ft]),disabled:!!C,target:N,...Be&&{style:Be},...ge&&{className:ge},...C&&R4,...Ce&&A4,...le&&be&&O4}}const tv={},M4={className:"active"},R4={role:"link","aria-disabled":!0},A4={"data-status":"active","aria-current":"page"},O4={"data-transitioning":"transitioning"},Fc=new WeakMap,D4={rootMargin:"100px"},Bc=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function z4(e,t,n,s){if(!s)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function P4(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,...s}=e,{type:o,...l}=T4(s,t),u=typeof s.children=="function"?s.children({isActive:l["data-status"]==="active"}):s.children;if(!n){const{disabled:d,...h}=l;return p.createElement("a",h,u)}return p.createElement(n,l,u)});function L4(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}class I4 extends RN{constructor(t){super(t),this.useMatch=n=>ks({select:n?.select,from:this.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>ks({...n,from:this.id,select:s=>n?.select?n.select(s.context):s.context}),this.useSearch=n=>Vx({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useParams=n=>Yo({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=()=>Qa({from:this.fullPath}),this.Link=ee.forwardRef((n,s)=>i.jsx(Ss,{ref:s,from:this.fullPath,...n})),this.$$typeof=Symbol.for("react.memo")}}function is(e){return new I4(e)}class $4 extends p4{constructor(t){super(t),this.useMatch=n=>ks({select:n?.select,from:this.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>ks({...n,from:this.id,select:s=>n?.select?n.select(s.context):s.context}),this.useSearch=n=>Vx({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useParams=n=>Yo({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=()=>Qa({from:this.fullPath}),this.Link=ee.forwardRef((n,s)=>i.jsx(Ss,{ref:s,from:this.fullPath,...n})),this.$$typeof=Symbol.for("react.memo")}}function F4(e){return new $4(e)}function Z1(e){return typeof e=="object"?new Q1(e,{silent:!0}).createRoute(e):new Q1(e,{silent:!0}).createRoute}class Q1{constructor(t,n){this.path=t,this.createRoute=s=>{this.silent;const o=is(s);return o.isRoot=!1,o},this.silent=n?.silent}}class K1{constructor(t){this.useMatch=n=>ks({select:n?.select,from:this.options.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>ks({from:this.options.id,select:s=>n?.select?n.select(s.context):s.context}),this.useSearch=n=>Vx({select:n?.select,structuralSharing:n?.structuralSharing,from:this.options.id}),this.useParams=n=>Yo({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=Vr();return Qa({from:n.routesById[this.options.id].fullPath})},this.options=t,this.$$typeof=Symbol.for("react.memo")}}function X1(e){return typeof e=="object"?new K1(e):t=>new K1({id:e,...t})}function B4(){const e=Vr(),t=p.useRef({router:e,mounted:!1}),[n,s]=p.useState(!1),{hasPendingMatches:o,isLoading:l}=$n({select:g=>({isLoading:g.isLoading,hasPendingMatches:g.matches.some(y=>y.status==="pending")}),structuralSharing:!0}),u=Zg(l),d=l||n||o,h=Zg(d),m=l||o,v=Zg(m);return e.startTransition=g=>{s(!0),p.startTransition(()=>{g(),s(!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 ta(e.latestLocation.publicHref)!==ta(y.publicHref)&&e.commitLocation({...y,replace:!0}),()=>{g()}},[e,e.history]),bf(()=>{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]),bf(()=>{u&&!l&&e.emit({type:"onLoad",...Oo(e.state)})},[u,e,l]),bf(()=>{v&&!m&&e.emit({type:"onBeforeRouteMount",...Oo(e.state)})},[m,v,e]),bf(()=>{if(h&&!d){const g=Oo(e.state);e.emit({type:"onResolved",...g}),e.__store.setState(y=>({...y,status:"idle",resolvedLocation:y.location})),g.hrefChanged&&Yz(e)}},[d,h,e]),null}function U4(e){const t=$n({select:n=>`not-found-${n.location.pathname}-${n.status}`});return i.jsx($x,{getResetKey:()=>t,onCatch:(n,s)=>{if(br(n))e.onCatch?.(n,s);else throw n},errorComponent:({error:n})=>{if(br(n))return e.fallback?.(n);throw n},children:e.children})}function V4(){return i.jsx("p",{children:"Not Found"})}function Wi(e){return i.jsx(i.Fragment,{children:e.children})}function zN(e,t,n){return t.options.notFoundComponent?i.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?i.jsx(e.options.defaultNotFoundComponent,{...n}):i.jsx(V4,{})}function q4(){return Vr().isScrollRestoring,null}const PN=p.memo(function({matchId:t}){const n=Vr(),s=$n({select:j=>{const N=j.matches.findIndex(_=>_.id===t),C=j.matches[N];return ca(C),{routeId:C.routeId,ssr:C.ssr,_displayPending:C._displayPending,resetKey:j.loadedAt,parentRouteId:j.matches[N-1]?.routeId}},structuralSharing:!0}),o=n.routesById[s.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=s.ssr===!1||s.ssr==="data-only",g=(!o.isRoot||o.options.wrapInSuspense||v)&&(o.options.wrapInSuspense??l??(o.options.errorComponent?.preload||v))?p.Suspense:Wi,y=d?$x:Wi,w=m?U4:Wi,S=o.isRoot?o.options.shellComponent??Wi:Wi;return i.jsxs(S,{children:[i.jsx(Rh.Provider,{value:t,children:i.jsx(g,{fallback:u,children:i.jsx(y,{getResetKey:()=>s.resetKey,errorComponent:d||Fx,onCatch:(j,N)=>{if(br(j))throw j;h?.(j,N)},children:i.jsx(w,{fallback:j=>{if(!m||j.routeId&&j.routeId!==s.routeId||!j.routeId&&!o.isRoot)throw j;return p.createElement(m,j)},children:v||s._displayPending?i.jsx(y4,{fallback:u,children:i.jsx(J1,{matchId:t})}):i.jsx(J1,{matchId:t})})})})}),s.parentRouteId===Fr&&n.options.scrollRestoration?i.jsxs(i.Fragment,{children:[i.jsx(H4,{}),i.jsx(q4,{})]}):null]})});function H4(){const e=Vr(),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",...Oo(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}const J1=p.memo(function({matchId:t}){const n=Vr(),{match:s,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(LN,{})},[o,u.options.component,n.options.defaultComponent]);if(s._displayPending)throw n.getMatch(s.id)?._nonReactive.displayPendingPromise;if(s._forcePending)throw n.getMatch(s.id)?._nonReactive.minPendingPromise;if(s.status==="pending"){const h=u.options.pendingMinMs??n.options.defaultPendingMinMs;if(h){const m=n.getMatch(s.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(s.id)?._nonReactive.loadPromise}if(s.status==="notFound")return ca(br(s.error)),zN(n,u,s.error);if(s.status==="redirected")throw ca(Br(s.error)),n.getMatch(s.id)?._nonReactive.loadPromise;if(s.status==="error")throw s.error;return d}),LN=p.memo(function(){const t=Vr(),n=p.useContext(Rh),s=$n({select:m=>m.matches.find(v=>v.id===n)?.routeId}),o=t.routesById[s],l=$n({select:m=>{const g=m.matches.find(y=>y.id===n);return ca(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 zN(t,o,void 0);if(!u)return null;const h=i.jsx(PN,{matchId:u});return s===Fr?i.jsx(p.Suspense,{fallback:d,children:h}):h});function Y4(){const e=Vr(),n=e.routesById[Fr].options.pendingComponent??e.options.defaultPendingComponent,s=n?i.jsx(n,{}):null,o=typeof document<"u"&&e.ssr?Wi:p.Suspense,l=i.jsxs(o,{fallback:s,children:[i.jsx(B4,{}),i.jsx(W4,{})]});return e.options.InnerWrap?i.jsx(e.options.InnerWrap,{children:l}):l}function W4(){const e=Vr(),t=$n({select:o=>o.matches[0]?.id}),n=$n({select:o=>o.loadedAt}),s=t?i.jsx(PN,{matchId:t}):null;return i.jsx(Rh.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?s:i.jsx($x,{getResetKey:()=>n,errorComponent:Fx,onCatch:o=>{o.message||o.toString()},children:s})})}const G4=e=>new Z4(e);class Z4 extends i4{constructor(t){super(t)}}typeof globalThis<"u"?(globalThis.createFileRoute=Z1,globalThis.createLazyFileRoute=X1):typeof window<"u"&&(window.createFileRoute=Z1,window.createLazyFileRoute=X1);function Q4({router:e,children:t,...n}){Object.keys(n).length>0&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const s=DN(),o=i.jsx(s.Provider,{value:e,children:t});return e.options.Wrap?i.jsx(e.options.Wrap,{children:o}):o}function K4({router:e,...t}){return i.jsx(Q4,{router:e,...t,children:i.jsx(Y4,{})})}function X4(e){return $n({select:t=>t.location})}const J4="0.0.17";const IN=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();const e3=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const t3=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase());const ej=e=>{const t=t3(e);return t.charAt(0).toUpperCase()+t.slice(1)};var n3={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 r3=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const s3=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:o="",children:l,iconNode:u,...d},h)=>p.createElement("svg",{ref:h,...n3,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:IN("lucide",o),...!l&&!r3(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:s,...o},l)=>p.createElement(s3,{ref:l,iconNode:t,className:IN(`lucide-${e3(ej(e))}`,`lucide-${e}`,s),...o}));return n.displayName=ej(e),n};const a3=[["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"}]],$N=ve("archive",a3);const o3=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],i3=ve("arrow-down",o3);const l3=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],FN=ve("arrow-left",l3);const c3=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],u3=ve("arrow-right",c3);const d3=[["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"}]],f3=ve("arrow-up-down",d3);const h3=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],m3=ve("arrow-up",h3);const p3=[["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"}]],Wv=ve("bell",p3);const g3=[["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"}]],v3=ve("bold",g3);const x3=[["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"}]],y3=ve("book",x3);const b3=[["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"}]],w3=ve("bookmark",b3);const S3=[["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"}]],qx=ve("braces",S3);const j3=[["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",j3);const C3=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ts=ve("check",C3);const N3=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],vn=ve("chevron-down",N3);const k3=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Hx=ve("chevron-left",k3);const _3=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Rl=ve("chevron-right",_3);const E3=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],zu=ve("chevron-up",E3);const T3=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],M3=ve("chevrons-up-down",T3);const R3=[["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"}]],Pu=ve("circle-alert",R3);const A3=[["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",A3);const O3=[["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"}]],BN=ve("circle-question-mark",O3);const D3=[["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"}]],z3=ve("circle-x",D3);const P3=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],sh=ve("clock",P3);const L3=[["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"}]],Gv=ve("code-xml",L3);const I3=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],UN=ve("code",I3);const $3=[["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"}]],VN=ve("copy",$3);const F3=[["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"}]],qN=ve("dollar-sign",F3);const B3=[["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"}]],Zv=ve("download",B3);const U3=[["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"}]],V3=ve("ellipsis-vertical",U3);const q3=[["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"}]],HN=ve("ellipsis",q3);const H3=[["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"}]],Y3=ve("expand",H3);const W3=[["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"}]],G3=ve("external-link",W3);const Z3=[["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"}]],ah=ve("eye",Z3);const Q3=[["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"}]],K3=ve("file-code",Q3);const X3=[["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"}]],jr=ve("file-text",X3);const J3=[["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"}]],oh=ve("file-type",J3);const eP=[["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",eP);const tP=[["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"}]],nP=ve("flag",tP);const rP=[["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",rP);const sP=[["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",sP);const aP=[["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"}]],oP=ve("folder-plus",aP);const iP=[["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"}]],lP=ve("folder-tree",iP);const cP=[["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"}]],ih=ve("folder",cP);const uP=[["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"}]],dP=ve("git-compare",uP);const fP=[["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"}]],hP=ve("globe",fP);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"}]],pP=ve("grid-3x3",mP);const gP=[["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",gP);const vP=[["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"}]],xP=ve("heading-2",vP);const yP=[["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"}]],bP=ve("heart",yP);const wP=[["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"}]],YN=ve("history",wP);const SP=[["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"}]],Ah=ve("house",SP);const jP=[["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"}]],rs=ve("image",jP);const CP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],NP=ve("info",CP);const kP=[["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"}]],_P=ve("italic",kP);const EP=[["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",EP);const TP=[["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"}]],MP=ve("layout-dashboard",TP);const RP=[["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",RP);const AP=[["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"}]],WN=ve("link",AP);const OP=[["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",OP);const DP=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],vu=ve("loader-circle",DP);const zP=[["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",zP);const PP=[["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"}]],LP=ve("log-out",PP);const IP=[["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"}]],$P=ve("mail",IP);const FP=[["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"}]],BP=ve("map-pin",FP);const UP=[["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"}]],VP=ve("message-square",UP);const qP=[["path",{d:"M5 12h14",key:"1ays0h"}]],HP=ve("minus",qP);const YP=[["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"}]],WP=ve("monitor",YP);const GP=[["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"}]],ZP=ve("moon",GP);const QP=[["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",QP);const KP=[["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"}]],XP=ve("package",KP);const JP=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],e5=ve("panel-left",JP);const t5=[["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"}]],ua=ve("pencil",t5);const n5=[["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"}]],r5=ve("phone",n5);const s5=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Un=ve("plus",s5);const a5=[["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"}]],o5=ve("quote",a5);const i5=[["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",i5);const l5=[["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",l5);const c5=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Al=ve("search",c5);const u5=[["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"}]],d5=ve("settings-2",u5);const f5=[["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"}]],GN=ve("settings",f5);const h5=[["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",h5);const p5=[["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"}]],g5=ve("square-pen",p5);const v5=[["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"}]],x5=ve("star",v5);const y5=[["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"}]],b5=ve("sun",y5);const w5=[["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"}]],Do=ve("tag",w5);const S5=[["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",S5);const j5=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],ny=ve("text-align-start",j5);const C5=[["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",C5);const N5=[["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",N5);const k5=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],_5=ve("trending-up",k5);const E5=[["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"}]],Io=ve("triangle-alert",E5);const T5=[["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",T5);const M5=[["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"}]],ZN=ve("user",M5);const R5=[["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"}]],A5=ve("users",R5);const O5=[["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",O5);const D5=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],At=ve("x",D5);Fe.union(Fe.literal("admin"),Fe.literal("editor"),Fe.literal("author"),Fe.literal("viewer"));const z5=Fe.union(Fe.literal("contentTypes"),Fe.literal("contentEntries"),Fe.literal("mediaItems"),Fe.literal("settings"),Fe.literal("users")),P5=Fe.union(Fe.literal("create"),Fe.literal("read"),Fe.literal("update"),Fe.literal("delete"),Fe.literal("publish"),Fe.literal("unpublish"),Fe.literal("restore"),Fe.literal("manage"),Fe.literal("move"));Fe.object({resource:z5,action:P5,scope:Fe.optional(Fe.union(Fe.literal("all"),Fe.literal("own")))});function Xi(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 al(e,t="all"){return[{resource:e,action:"read",scope:t}]}function QN(e="all"){return[{resource:"contentEntries",action:"publish",scope:e},{resource:"contentEntries",action:"unpublish",scope:e}]}const L5={name:"admin",displayName:"Administrator",description:"Full access to all CMS features including settings and content type management",isSystem:!0,permissions:[...Xi("contentTypes"),...Xi("contentEntries"),...QN(),{resource:"contentEntries",action:"restore"},...Xi("mediaItems"),{resource:"settings",action:"manage"},...al("settings"),...Xi("users"),{resource:"users",action:"manage"}]},I5={name:"editor",displayName:"Editor",description:"Can manage all content and media, but cannot modify settings or content types",isSystem:!0,permissions:[...al("contentTypes"),...Xi("contentEntries"),...QN(),{resource:"contentEntries",action:"restore"},...Xi("mediaItems")]},$5={name:"author",displayName:"Author",description:"Can create and manage own content and media",isSystem:!0,permissions:[...al("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"}]},F5={name:"viewer",displayName:"Viewer",description:"Read-only access to published content and media",isSystem:!0,permissions:[...al("contentTypes"),...al("contentEntries"),...al("mediaItems")]},KN={admin:L5,editor:I5,author:$5,viewer:F5};function B5(e,t){if(e.resource!==t.resource||e.action!==t.action)return!1;const n=e.scope??"all",s=t.scope??"all";return n==="all"?!0:s==="own"}function XN(e,t,n){const s=KN[e]??n?.[e];return s?s.permissions.some(o=>B5(o,t)):!1}function U5(e,t){return(KN[e]??t?.[e])?.permissions??[]}function JN(e,t,n){return U5(e,n).filter(s=>s.resource===t)}function V5(e,t,n){return JN(e,t,n).length>0}const ek=p.createContext(null);function q5({children:e,getUser:t,getUserRole:n,onLogout:s,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?XN(h,E):!1,[h]),N=p.useCallback(async()=>{try{s&&await s(),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")}},[s,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(ek.Provider,{value:_,children:e})}function oy(){const e=p.useContext(ek);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const tk=p.createContext(null),nk="convex-cms-theme";function tj(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function nj(){if(typeof window>"u")return"system";const e=localStorage.getItem(nk);return e==="light"||e==="dark"||e==="system"?e:"system"}function nv(){return typeof window>"u"?!1:document.documentElement.classList.contains("dark")}function H5({children:e,themeMode:t="isolated",darkModeControl:n="independent"}){const s=t==="isolated"||n==="independent",o=t==="inherit"&&n==="follow-parent",[l,u]=p.useState(()=>o?nv()?"dark":"light":nj()),[d,h]=p.useState(()=>{if(o)return nv()?"dark":"light";const g=nj();return g==="system"?tj():g}),m=p.useCallback(g=>{const y=g==="system"?tj():g;if(h(y),s){const w=document.documentElement;w.classList.remove("light","dark"),w.classList.add(y)}},[s]),v=p.useCallback(g=>{s&&(u(g),localStorage.setItem(nk,g),m(g))},[m,s]);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=nv()?"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(tk.Provider,{value:{theme:l,resolvedTheme:d,setTheme:v,canToggleDarkMode:s},children:e})}function Y5(){const e=p.useContext(tk);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function fe(e,t,n){function s(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;s(m,d),(h=m._zod).deferred??(h.deferred=[]);for(const v of m._zod.deferred)v();return m}return Object.defineProperty(u,"init",{value:s}),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 ol extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class rk extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const sk={};function Ha(e){return sk}function ak(e){const t=Object.values(e).filter(s=>typeof s=="number");return Object.entries(e).filter(([s,o])=>t.indexOf(+s)===-1).map(([s,o])=>o)}function Qv(e,t){return typeof t=="bigint"?t.toString():t}function iy(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ly(e){return e==null}function cy(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function W5(e,t){const n=(e.toString().split(".")[1]||"").length,s=t.toString();let o=(s.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(s)){const h=s.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 rj=Symbol("evaluating");function kt(e,t,n){let s;Object.defineProperty(e,t,{get(){if(s!==rj)return s===void 0&&(s=rj,s=n()),s},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Wo(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ka(...e){const t={};for(const n of e){const s=Object.getOwnPropertyDescriptors(n);Object.assign(t,s)}return Object.defineProperties({},t)}function sj(e){return JSON.stringify(e)}function G5(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ok="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function lh(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Z5=iy(()=>{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(lh(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(lh(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ik(e){return gl(e)?{...e}:Array.isArray(e)?[...e]:e}const Q5=new Set(["string","number","symbol"]);function Oh(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xa(e,t,n){const s=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(s._zod.parent=e),s}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 K5(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const X5={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 J5(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const l=Ka(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 Wo(this,"shape",u),u},checks:[]});return Xa(e,l)}function eL(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const l=Ka(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 Wo(this,"shape",u),u},checks:[]});return Xa(e,l)}function tL(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=Ka(e._zod.def,{get shape(){const l={...e._zod.def.shape,...t};return Wo(this,"shape",l),l}});return Xa(e,o)}function nL(e,t){if(!gl(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Ka(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Wo(this,"shape",s),s}});return Xa(e,n)}function rL(e,t){const n=Ka(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t._zod.def.shape};return Wo(this,"shape",s),s},get catchall(){return t._zod.def.catchall},checks:[]});return Xa(e,n)}function sL(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=Ka(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 Wo(this,"shape",h),h},checks:[]});return Xa(t,u)}function aL(e,t,n){const s=Ka(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 Wo(this,"shape",l),l}});return Xa(t,s)}function Ji(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 el(e,t){return t.map(n=>{var s;return(s=n).path??(s.path=[]),n.path.unshift(e),n})}function wf(e){return typeof e=="string"?e:e?.message}function Ya(e,t,n){const s={...e,path:e.path??[]};if(!e.message){const o=wf(e.inst?._zod.def?.error?.(e))??wf(t?.error?.(e))??wf(n.customError?.(e))??wf(n.localeError?.(e))??"Invalid input";s.message=o}return delete s.inst,delete s.continue,t?.reportInput||delete s.input,s}function uy(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function yu(...e){const[t,n,s]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:s}:{...t}}const lk=(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,Qv,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ck=fe("$ZodError",lk),uk=fe("$ZodError",lk,{Parent:Error});function oL(e,t=n=>n.message){const n={},s=[];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))):s.push(t(o));return{formErrors:s,fieldErrors:n}}function iL(e,t=n=>n.message){const n={_errors:[]},s=o=>{for(const l of o.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>s({issues:u}));else if(l.code==="invalid_key")s({issues:l.issues});else if(l.code==="invalid_element")s({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 s(e),n}const dy=e=>(t,n,s,o)=>{const l=s?Object.assign(s,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},l);if(u instanceof Promise)throw new ol;if(u.issues.length){const d=new(o?.Err??e)(u.issues.map(h=>Ya(h,l,Ha())));throw ok(d,o?.callee),d}return u.value},fy=e=>async(t,n,s,o)=>{const l=s?Object.assign(s,{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=>Ya(h,l,Ha())));throw ok(d,o?.callee),d}return u.value},Dh=e=>(t,n,s)=>{const o=s?{...s,async:!1}:{async:!1},l=t._zod.run({value:n,issues:[]},o);if(l instanceof Promise)throw new ol;return l.issues.length?{success:!1,error:new(e??ck)(l.issues.map(u=>Ya(u,o,Ha())))}:{success:!0,data:l.value}},lL=Dh(uk),zh=e=>async(t,n,s)=>{const o=s?Object.assign(s,{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=>Ya(u,o,Ha())))}:{success:!0,data:l.value}},cL=zh(uk),uL=e=>(t,n,s)=>{const o=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return dy(e)(t,n,o)},dL=e=>(t,n,s)=>dy(e)(t,n,s),fL=e=>async(t,n,s)=>{const o=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return fy(e)(t,n,o)},hL=e=>async(t,n,s)=>fy(e)(t,n,s),mL=e=>(t,n,s)=>{const o=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return Dh(e)(t,n,o)},pL=e=>(t,n,s)=>Dh(e)(t,n,s),gL=e=>async(t,n,s)=>{const o=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return zh(e)(t,n,o)},vL=e=>async(t,n,s)=>zh(e)(t,n,s),xL=/^[cC][^\s-]{8,}$/,yL=/^[0-9a-z]+$/,bL=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wL=/^[0-9a-vA-V]{20}$/,SL=/^[A-Za-z0-9]{27}$/,jL=/^[a-zA-Z0-9_-]{21}$/,CL=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,NL=/^([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})$/,aj=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)$/,kL=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_L="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function EL(){return new RegExp(_L,"u")}const TL=/^(?:(?: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])$/,ML=/^(([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}|:))$/,RL=/^((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])$/,AL=/^(([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])$/,OL=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dk=/^[A-Za-z0-9_-]*$/,DL=/^\+[1-9]\d{6,14}$/,fk="(?:(?:\\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])))",zL=new RegExp(`^${fk}$`);function hk(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 PL(e){return new RegExp(`^${hk(e)}$`)}function LL(e){const t=hk({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const s=`${t}(?:${n.join("|")})`;return new RegExp(`^${fk}T(?:${s})$`)}const IL=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},$L=/^-?\d+$/,mk=/^-?\d+(?:\.\d+)?$/,FL=/^(?:true|false)$/i,BL=/^[^A-Z]*$/,UL=/^[^a-z]*$/,sr=fe("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),pk={number:"number",bigint:"bigint",object:"date"},gk=fe("$ZodCheckLessThan",(e,t)=>{sr.init(e,t);const n=pk[typeof t.value];e._zod.onattach.push(s=>{const o=s._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=s=>{(t.inclusive?s.value<=t.value:s.value<t.value)||s.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vk=fe("$ZodCheckGreaterThan",(e,t)=>{sr.init(e,t);const n=pk[typeof t.value];e._zod.onattach.push(s=>{const o=s._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=s=>{(t.inclusive?s.value>=t.value:s.value>t.value)||s.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),VL=fe("$ZodCheckMultipleOf",(e,t)=>{sr.init(e,t),e._zod.onattach.push(n=>{var s;(s=n._zod.bag).multipleOf??(s.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):W5(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})}}),qL=fe("$ZodCheckNumberFormat",(e,t)=>{sr.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),s=n?"int":"number",[o,l]=X5[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=$L)}),e._zod.check=u=>{const d=u.value;if(n){if(!Number.isInteger(d)){u.issues.push({expected:s,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:s,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:s,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})}}),HL=fe("$ZodCheckMaxLength",(e,t)=>{var n;sr.init(e,t),(n=e._zod.def).when??(n.when=s=>{const o=s.value;return!ly(o)&&o.length!==void 0}),e._zod.onattach.push(s=>{const o=s._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(s._zod.bag.maximum=t.maximum)}),e._zod.check=s=>{const o=s.value;if(o.length<=t.maximum)return;const u=uy(o);s.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),YL=fe("$ZodCheckMinLength",(e,t)=>{var n;sr.init(e,t),(n=e._zod.def).when??(n.when=s=>{const o=s.value;return!ly(o)&&o.length!==void 0}),e._zod.onattach.push(s=>{const o=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(s._zod.bag.minimum=t.minimum)}),e._zod.check=s=>{const o=s.value;if(o.length>=t.minimum)return;const u=uy(o);s.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),WL=fe("$ZodCheckLengthEquals",(e,t)=>{var n;sr.init(e,t),(n=e._zod.def).when??(n.when=s=>{const o=s.value;return!ly(o)&&o.length!==void 0}),e._zod.onattach.push(s=>{const o=s._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=s=>{const o=s.value,l=o.length;if(l===t.length)return;const u=uy(o),d=l>t.length;s.issues.push({origin:u,...d?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:s.value,inst:e,continue:!t.abort})}}),Ph=fe("$ZodCheckStringFormat",(e,t)=>{var n,s;sr.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})}):(s=e._zod).check??(s.check=()=>{})}),GL=fe("$ZodCheckRegex",(e,t)=>{Ph.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})}}),ZL=fe("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=BL),Ph.init(e,t)}),QL=fe("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=UL),Ph.init(e,t)}),KL=fe("$ZodCheckIncludes",(e,t)=>{sr.init(e,t);const n=Oh(t.includes),s=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=s,e._zod.onattach.push(o=>{const l=o._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(s)}),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})}}),XL=fe("$ZodCheckStartsWith",(e,t)=>{sr.init(e,t);const n=new RegExp(`^${Oh(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=s=>{s.value.startsWith(t.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:s.value,inst:e,continue:!t.abort})}}),JL=fe("$ZodCheckEndsWith",(e,t)=>{sr.init(e,t);const n=new RegExp(`.*${Oh(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=s=>{s.value.endsWith(t.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:s.value,inst:e,continue:!t.abort})}}),eI=fe("$ZodCheckOverwrite",(e,t)=>{sr.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class tI{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 s=t.split(`
11
+ `).filter(u=>u),o=Math.min(...s.map(u=>u.length-u.trimStart().length)),l=s.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 nI={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=nI;const s=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&s.unshift(e);for(const o of s)for(const l of o._zod.onattach)l(e);if(s.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=Ji(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 ol;if(v||w instanceof Promise)v=(v??Promise.resolve()).then(async()=>{await w,u.issues.length!==y&&(m||(m=Ji(u,y)))});else{if(u.issues.length===y)continue;m||(m=Ji(u,y))}}return v?v.then(()=>u):u},l=(u,d,h)=>{if(Ji(u))return u.aborted=!0,u;const m=o(d,s,h);if(m instanceof Promise){if(h.async===!1)throw new ol;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 ol;return h.then(m=>o(m,s,d))}return o(h,s,d)}}kt(e,"~standard",()=>({validate:o=>{try{const l=lL(e,o);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return cL(e,o).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),hy=fe("$ZodString",(e,t)=>{Yt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??IL(e._zod.bag),e._zod.parse=(n,s)=>{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)=>{Ph.init(e,t),hy.init(e,t)}),rI=fe("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=NL),It.init(e,t)}),sI=fe("$ZodUUID",(e,t)=>{if(t.version){const s={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(s===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=aj(s))}else t.pattern??(t.pattern=aj());It.init(e,t)}),aI=fe("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=kL),It.init(e,t)}),oI=fe("$ZodURL",(e,t)=>{It.init(e,t),e._zod.check=n=>{try{const s=n.value.trim(),o=new URL(s);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=s;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),iI=fe("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=EL()),It.init(e,t)}),lI=fe("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=jL),It.init(e,t)}),cI=fe("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=xL),It.init(e,t)}),uI=fe("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=yL),It.init(e,t)}),dI=fe("$ZodULID",(e,t)=>{t.pattern??(t.pattern=bL),It.init(e,t)}),fI=fe("$ZodXID",(e,t)=>{t.pattern??(t.pattern=wL),It.init(e,t)}),hI=fe("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=SL),It.init(e,t)}),mI=fe("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=LL(t)),It.init(e,t)}),pI=fe("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=zL),It.init(e,t)}),gI=fe("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=PL(t)),It.init(e,t)}),vI=fe("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=CL),It.init(e,t)}),xI=fe("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=TL),It.init(e,t),e._zod.bag.format="ipv4"}),yI=fe("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ML),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})}}}),bI=fe("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=RL),It.init(e,t)}),wI=fe("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=AL),It.init(e,t),e._zod.check=n=>{const s=n.value.split("/");try{if(s.length!==2)throw new Error;const[o,l]=s;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 xk(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const SI=fe("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=OL),It.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{xk(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function jI(e){if(!dk.test(e))return!1;const t=e.replace(/[-_]/g,s=>s==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return xk(n)}const CI=fe("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=dk),It.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{jI(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),NI=fe("$ZodE164",(e,t)=>{t.pattern??(t.pattern=DL),It.init(e,t)});function kI(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[s]=n;if(!s)return!1;const o=JSON.parse(atob(s));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const _I=fe("$ZodJWT",(e,t)=>{It.init(e,t),e._zod.check=n=>{kI(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),yk=fe("$ZodNumber",(e,t)=>{Yt.init(e,t),e._zod.pattern=e._zod.bag.pattern??mk,e._zod.parse=(n,s)=>{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}}),EI=fe("$ZodNumberFormat",(e,t)=>{qL.init(e,t),yk.init(e,t)}),TI=fe("$ZodBoolean",(e,t)=>{Yt.init(e,t),e._zod.pattern=FL,e._zod.parse=(n,s)=>{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}}),MI=fe("$ZodUnknown",(e,t)=>{Yt.init(e,t),e._zod.parse=n=>n}),RI=fe("$ZodNever",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,s)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function oj(e,t,n){e.issues.length&&t.issues.push(...el(n,e.issues)),t.value[n]=e.value}const AI=fe("$ZodArray",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,s)=>{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:[]},s);h instanceof Promise?l.push(h.then(m=>oj(m,n,u))):oj(h,n,u)}return l.length?Promise.all(l).then(()=>n):n}});function ch(e,t,n,s,o){if(e.issues.length){if(o&&!(n in s))return;t.issues.push(...el(n,e.issues))}e.value===void 0?n in s&&(t.value[n]=void 0):t.value[n]=e.value}function bk(e){const t=Object.keys(e.shape);for(const s of t)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${s}": expected a Zod schema`);const n=K5(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function wk(e,t,n,s,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:[]},s);y instanceof Promise?e.push(y.then(w=>ch(w,n,g,t,v))):ch(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 OI=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 s=iy(()=>bk(t));kt(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=lh,l=t.catchall;let u;e._zod.parse=(d,h)=>{u??(u=s.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=>ch(N,d,y,m,S))):ch(j,d,y,m,S)}return l?wk(v,m,d,h,s.value,e):v.length?Promise.all(v).then(()=>d):d}}),DI=fe("$ZodObjectJIT",(e,t)=>{OI.init(e,t);const n=e._zod.parse,s=iy(()=>bk(t)),o=y=>{const w=new tI(["shape","payload","ctx"]),S=s.value,j=E=>{const M=sj(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=sj(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=lh,d=!sk.jitless,m=d&&Z5.value,v=t.catchall;let g;e._zod.parse=(y,w)=>{g??(g=s.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?wk([],S,y,w,g,e):y):n(y,w):(y.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),y)}});function ij(e,t,n,s){for(const l of e)if(l.issues.length===0)return t.value=l.value,t;const o=e.filter(l=>!Ji(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=>Ya(u,s,Ha())))}),t)}const zI=fe("$ZodUnion",(e,t)=>{Yt.init(e,t),kt(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),kt(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),kt(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),kt(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=>cy(l.source)).join("|")})$`)}});const n=t.options.length===1,s=t.options[0]._zod.run;e._zod.parse=(o,l)=>{if(n)return s(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=>ij(h,o,e,l)):ij(d,o,e,l)}}),PI=fe("$ZodIntersection",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,s)=>{const o=n.value,l=t.left._zod.run({value:o,issues:[]},s),u=t.right._zod.run({value:o,issues:[]},s);return l instanceof Promise||u instanceof Promise?Promise.all([l,u]).then(([h,m])=>lj(n,h,m)):lj(n,l,u)}});function Kv(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),s=Object.keys(e).filter(l=>n.indexOf(l)!==-1),o={...e,...t};for(const l of s){const u=Kv(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 s=0;s<e.length;s++){const o=e[s],l=t[s],u=Kv(o,l);if(!u.valid)return{valid:!1,mergeErrorPath:[s,...u.mergeErrorPath]};n.push(u.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function lj(e,t,n){const s=new Map;let o;for(const d of t.issues)if(d.code==="unrecognized_keys"){o??(o=d);for(const h of d.keys)s.has(h)||s.set(h,{}),s.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)s.has(h)||s.set(h,{}),s.get(h).r=!0;else e.issues.push(d);const l=[...s].filter(([,d])=>d.l&&d.r).map(([d])=>d);if(l.length&&o&&e.issues.push({...o,keys:l}),Ji(e))return e;const u=Kv(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 LI=fe("$ZodRecord",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,s)=>{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:[]},s);v instanceof Promise?l.push(v.then(g=>{g.issues.length&&n.issues.push(...el(m,g.issues)),n.value[m]=g.value})):(v.issues.length&&n.issues.push(...el(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:[]},s);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&mk.test(d)&&h.issues.length){const g=t.keyType._zod.run({value:Number(d),issues:[]},s);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=>Ya(g,s,Ha())),input:d,path:[d],inst:e});continue}const v=t.valueType._zod.run({value:o[d],issues:[]},s);v instanceof Promise?l.push(v.then(g=>{g.issues.length&&n.issues.push(...el(d,g.issues)),n.value[h.value]=g.value})):(v.issues.length&&n.issues.push(...el(d,v.issues)),n.value[h.value]=v.value)}}return l.length?Promise.all(l).then(()=>n):n}}),II=fe("$ZodEnum",(e,t)=>{Yt.init(e,t);const n=ak(t.entries),s=new Set(n);e._zod.values=s,e._zod.pattern=new RegExp(`^(${n.filter(o=>Q5.has(typeof o)).map(o=>typeof o=="string"?Oh(o):o.toString()).join("|")})$`),e._zod.parse=(o,l)=>{const u=o.value;return s.has(u)||o.issues.push({code:"invalid_value",values:n,input:u,inst:e}),o}}),$I=fe("$ZodTransform",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new rk(e.constructor.name);const o=t.transform(n.value,n);if(s.async)return(o instanceof Promise?o:Promise.resolve(o)).then(u=>(n.value=u,n));if(o instanceof Promise)throw new ol;return n.value=o,n}});function cj(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Sk=fe("$ZodOptional",(e,t)=>{Yt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",kt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),kt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${cy(n.source)})?$`):void 0}),e._zod.parse=(n,s)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(l=>cj(l,n.value)):cj(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,s)}}),FI=fe("$ZodExactOptional",(e,t)=>{Sk.init(e,t),kt(e._zod,"values",()=>t.innerType._zod.values),kt(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,s)=>t.innerType._zod.run(n,s)}),BI=fe("$ZodNullable",(e,t)=>{Yt.init(e,t),kt(e._zod,"optin",()=>t.innerType._zod.optin),kt(e._zod,"optout",()=>t.innerType._zod.optout),kt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${cy(n.source)}|null)$`):void 0}),kt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,s)=>n.value===null?n:t.innerType._zod.run(n,s)}),UI=fe("$ZodDefault",(e,t)=>{Yt.init(e,t),e._zod.optin="optional",kt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(l=>uj(l,t)):uj(o,t)}});function uj(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const VI=fe("$ZodPrefault",(e,t)=>{Yt.init(e,t),e._zod.optin="optional",kt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>(s.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,s))}),qI=fe("$ZodNonOptional",(e,t)=>{Yt.init(e,t),kt(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(s=>s!==void 0)):void 0}),e._zod.parse=(n,s)=>{const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(l=>dj(l,e)):dj(o,e)}});function dj(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 HI=fe("$ZodCatch",(e,t)=>{Yt.init(e,t),kt(e._zod,"optin",()=>t.innerType._zod.optin),kt(e._zod,"optout",()=>t.innerType._zod.optout),kt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);const o=t.innerType._zod.run(n,s);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=>Ya(u,s,Ha()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(l=>Ya(l,s,Ha()))},input:n.value}),n.issues=[]),n)}}),YI=fe("$ZodPipe",(e,t)=>{Yt.init(e,t),kt(e._zod,"values",()=>t.in._zod.values),kt(e._zod,"optin",()=>t.in._zod.optin),kt(e._zod,"optout",()=>t.out._zod.optout),kt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,s)=>{if(s.direction==="backward"){const l=t.out._zod.run(n,s);return l instanceof Promise?l.then(u=>Sf(u,t.in,s)):Sf(l,t.in,s)}const o=t.in._zod.run(n,s);return o instanceof Promise?o.then(l=>Sf(l,t.out,s)):Sf(o,t.out,s)}});function Sf(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const WI=fe("$ZodReadonly",(e,t)=>{Yt.init(e,t),kt(e._zod,"propValues",()=>t.innerType._zod.propValues),kt(e._zod,"values",()=>t.innerType._zod.values),kt(e._zod,"optin",()=>t.innerType?._zod?.optin),kt(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(fj):fj(o)}});function fj(e){return e.value=Object.freeze(e.value),e}const GI=fe("$ZodCustom",(e,t)=>{sr.init(e,t),Yt.init(e,t),e._zod.parse=(n,s)=>n,e._zod.check=n=>{const s=n.value,o=t.fn(s);if(o instanceof Promise)return o.then(l=>hj(l,n,s,e));hj(o,n,s,e)}});function hj(e,t,n,s){if(!e){const o={code:"custom",input:n,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(o.params=s._zod.def.params),t.issues.push(yu(o))}}var mj;class ZI{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const s=n[0];return this._map.set(t,s),s&&typeof s=="object"&&"id"in s&&this._idmap.set(s.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 s={...this.get(n)??{}};delete s.id;const o={...s,...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 QI(){return new ZI}(mj=globalThis).__zod_globalRegistry??(mj.__zod_globalRegistry=QI());const Qc=globalThis.__zod_globalRegistry;function KI(e,t){return new e({type:"string",...$e(t)})}function XI(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$e(t)})}function pj(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$e(t)})}function JI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$e(t)})}function e6(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$e(t)})}function t6(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$e(t)})}function n6(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$e(t)})}function r6(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$e(t)})}function s6(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$e(t)})}function a6(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$e(t)})}function o6(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$e(t)})}function i6(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$e(t)})}function l6(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$e(t)})}function c6(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$e(t)})}function u6(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$e(t)})}function d6(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$e(t)})}function f6(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$e(t)})}function h6(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$e(t)})}function m6(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$e(t)})}function p6(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...$e(t)})}function g6(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...$e(t)})}function v6(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$e(t)})}function x6(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$e(t)})}function y6(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$e(t)})}function b6(e,t){return new e({type:"string",format:"date",check:"string_format",...$e(t)})}function w6(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...$e(t)})}function S6(e,t){return new e({type:"string",format:"duration",check:"string_format",...$e(t)})}function j6(e,t){return new e({type:"number",checks:[],...$e(t)})}function C6(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...$e(t)})}function N6(e,t){return new e({type:"boolean",...$e(t)})}function k6(e){return new e({type:"unknown"})}function _6(e,t){return new e({type:"never",...$e(t)})}function gj(e,t){return new gk({check:"less_than",...$e(t),value:e,inclusive:!1})}function rv(e,t){return new gk({check:"less_than",...$e(t),value:e,inclusive:!0})}function vj(e,t){return new vk({check:"greater_than",...$e(t),value:e,inclusive:!1})}function sv(e,t){return new vk({check:"greater_than",...$e(t),value:e,inclusive:!0})}function xj(e,t){return new VL({check:"multiple_of",...$e(t),value:e})}function jk(e,t){return new HL({check:"max_length",...$e(t),maximum:e})}function uh(e,t){return new YL({check:"min_length",...$e(t),minimum:e})}function Ck(e,t){return new WL({check:"length_equals",...$e(t),length:e})}function E6(e,t){return new GL({check:"string_format",format:"regex",...$e(t),pattern:e})}function T6(e){return new ZL({check:"string_format",format:"lowercase",...$e(e)})}function M6(e){return new QL({check:"string_format",format:"uppercase",...$e(e)})}function R6(e,t){return new KL({check:"string_format",format:"includes",...$e(t),includes:e})}function A6(e,t){return new XL({check:"string_format",format:"starts_with",...$e(t),prefix:e})}function O6(e,t){return new JL({check:"string_format",format:"ends_with",...$e(t),suffix:e})}function Ol(e){return new eI({check:"overwrite",tx:e})}function D6(e){return Ol(t=>t.normalize(e))}function z6(){return Ol(e=>e.trim())}function P6(){return Ol(e=>e.toLowerCase())}function L6(){return Ol(e=>e.toUpperCase())}function I6(){return Ol(e=>G5(e))}function $6(e,t,n){return new e({type:"array",element:t,...$e(n)})}function F6(e,t,n){return new e({type:"custom",check:"custom",fn:t,...$e(n)})}function B6(e){const t=U6(n=>(n.addIssue=s=>{if(typeof s=="string")n.issues.push(yu(s,n.value,t._zod.def));else{const o=s;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(yu(o))}},e(n.value,n)));return t}function U6(e,t){const n=new sr({check:"custom",...$e(t)});return n._zod.check=e,n}function Nk(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 s;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&&((s=u.schema).default??(s.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}function kk(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=new Map;for(const u of e.seen.entries()){const d=e.metadataRegistry.get(u[0])?.id;if(d){const h=s.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.`);s.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 _k(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=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){s(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){s(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())s(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:dh(t,"input",e.processors),output:dh(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 s=e._zod.def;if(s.type==="transform")return!0;if(s.type==="array")return In(s.element,n);if(s.type==="set")return In(s.valueType,n);if(s.type==="lazy")return In(s.getter(),n);if(s.type==="promise"||s.type==="optional"||s.type==="nonoptional"||s.type==="nullable"||s.type==="readonly"||s.type==="default"||s.type==="prefault")return In(s.innerType,n);if(s.type==="intersection")return In(s.left,n)||In(s.right,n);if(s.type==="record"||s.type==="map")return In(s.keyType,n)||In(s.valueType,n);if(s.type==="pipe")return In(s.in,n)||In(s.out,n);if(s.type==="object"){for(const o in s.shape)if(In(s.shape[o],n))return!0;return!1}if(s.type==="union"){for(const o of s.options)if(In(o,n))return!0;return!1}if(s.type==="tuple"){for(const o of s.items)if(In(o,n))return!0;return!!(s.rest&&In(s.rest,n))}return!1}const V6=(e,t={})=>n=>{const s=Nk({...n,processors:t});return un(e,s),kk(s,e),_k(s,e)},dh=(e,t,n={})=>s=>{const{libraryOptions:o,target:l}=s??{},u=Nk({...o??{},target:l,io:t,processors:n});return un(e,u),kk(u,e),_k(u,e)},q6={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},H6=(e,t,n,s)=>{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=q6[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}))])}},Y6=(e,t,n,s)=>{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)},W6=(e,t,n,s)=>{n.type="boolean"},G6=(e,t,n,s)=>{n.not={}},Z6=(e,t,n,s)=>{},Q6=(e,t,n,s)=>{const o=e._zod.def,l=ak(o.entries);l.every(u=>typeof u=="number")&&(n.type="number"),l.every(u=>typeof u=="string")&&(n.type="string"),n.enum=l},K6=(e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},X6=(e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},J6=(e,t,n,s)=>{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,{...s,path:[...s.path,"items"]})},e$=(e,t,n,s)=>{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,{...s,path:[...s.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,{...s,path:[...s.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},t$=(e,t,n,s)=>{const o=e._zod.def,l=o.inclusive===!1,u=o.options.map((d,h)=>un(d,t,{...s,path:[...s.path,l?"oneOf":"anyOf",h]}));l?n.oneOf=u:n.anyOf=u},n$=(e,t,n,s)=>{const o=e._zod.def,l=un(o.left,t,{...s,path:[...s.path,"allOf",0]}),u=un(o.right,t,{...s,path:[...s.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},r$=(e,t,n,s)=>{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,{...s,path:[...s.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,{...s,path:[...s.path,"propertyNames"]})),o.additionalProperties=un(l.valueType,t,{...s,path:[...s.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)}},s$=(e,t,n,s)=>{const o=e._zod.def,l=un(o.innerType,t,s),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=o.innerType,n.nullable=!0):n.anyOf=[l,{type:"null"}]},a$=(e,t,n,s)=>{const o=e._zod.def;un(o.innerType,t,s);const l=t.seen.get(e);l.ref=o.innerType},o$=(e,t,n,s)=>{const o=e._zod.def;un(o.innerType,t,s);const l=t.seen.get(e);l.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},i$=(e,t,n,s)=>{const o=e._zod.def;un(o.innerType,t,s);const l=t.seen.get(e);l.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},l$=(e,t,n,s)=>{const o=e._zod.def;un(o.innerType,t,s);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},c$=(e,t,n,s)=>{const o=e._zod.def,l=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;un(l,t,s);const u=t.seen.get(e);u.ref=l},u$=(e,t,n,s)=>{const o=e._zod.def;un(o.innerType,t,s);const l=t.seen.get(e);l.ref=o.innerType,n.readOnly=!0},Ek=(e,t,n,s)=>{const o=e._zod.def;un(o.innerType,t,s);const l=t.seen.get(e);l.ref=o.innerType},d$=fe("ZodISODateTime",(e,t)=>{mI.init(e,t),Ut.init(e,t)});function f$(e){return y6(d$,e)}const h$=fe("ZodISODate",(e,t)=>{pI.init(e,t),Ut.init(e,t)});function m$(e){return b6(h$,e)}const p$=fe("ZodISOTime",(e,t)=>{gI.init(e,t),Ut.init(e,t)});function g$(e){return w6(p$,e)}const v$=fe("ZodISODuration",(e,t)=>{vI.init(e,t),Ut.init(e,t)});function x$(e){return S6(v$,e)}const y$=(e,t)=>{ck.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>iL(e,n)},flatten:{value:n=>oL(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Qv,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Qv,2)}},isEmpty:{get(){return e.issues.length===0}}})},qr=fe("ZodError",y$,{Parent:Error}),b$=dy(qr),w$=fy(qr),S$=Dh(qr),j$=zh(qr),C$=uL(qr),N$=dL(qr),k$=fL(qr),_$=hL(qr),E$=mL(qr),T$=pL(qr),M$=gL(qr),R$=vL(qr),Wt=fe("ZodType",(e,t)=>(Yt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:dh(e,"input"),output:dh(e,"output")}}),e.toJSONSchema=V6(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Ka(t,{checks:[...t.checks??[],...n.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0}),e.with=e.check,e.clone=(n,s)=>Xa(e,n,s),e.brand=()=>e,e.register=((n,s)=>(n.add(e,s),e)),e.parse=(n,s)=>b$(e,n,s,{callee:e.parse}),e.safeParse=(n,s)=>S$(e,n,s),e.parseAsync=async(n,s)=>w$(e,n,s,{callee:e.parseAsync}),e.safeParseAsync=async(n,s)=>j$(e,n,s),e.spa=e.safeParseAsync,e.encode=(n,s)=>C$(e,n,s),e.decode=(n,s)=>N$(e,n,s),e.encodeAsync=async(n,s)=>k$(e,n,s),e.decodeAsync=async(n,s)=>_$(e,n,s),e.safeEncode=(n,s)=>E$(e,n,s),e.safeDecode=(n,s)=>T$(e,n,s),e.safeEncodeAsync=async(n,s)=>M$(e,n,s),e.safeDecodeAsync=async(n,s)=>R$(e,n,s),e.refine=(n,s)=>e.check(kF(n,s)),e.superRefine=n=>e.check(_F(n)),e.overwrite=n=>e.check(Ol(n)),e.optional=()=>Sj(e),e.exactOptional=()=>hF(e),e.nullable=()=>jj(e),e.nullish=()=>Sj(jj(e)),e.nonoptional=n=>yF(e,n),e.array=()=>my(e),e.or=n=>aF([e,n]),e.and=n=>iF(e,n),e.transform=n=>Cj(e,dF(n)),e.default=n=>gF(e,n),e.prefault=n=>xF(e,n),e.catch=n=>wF(e,n),e.pipe=n=>Cj(e,n),e.readonly=()=>CF(e),e.describe=n=>{const s=e.clone();return Qc.add(s,{description:n}),s},Object.defineProperty(e,"description",{get(){return Qc.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Qc.get(e);const s=e.clone();return Qc.add(s,n[0]),s},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Tk=fe("_ZodString",(e,t)=>{hy.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(s,o,l)=>H6(e,s,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...s)=>e.check(E6(...s)),e.includes=(...s)=>e.check(R6(...s)),e.startsWith=(...s)=>e.check(A6(...s)),e.endsWith=(...s)=>e.check(O6(...s)),e.min=(...s)=>e.check(uh(...s)),e.max=(...s)=>e.check(jk(...s)),e.length=(...s)=>e.check(Ck(...s)),e.nonempty=(...s)=>e.check(uh(1,...s)),e.lowercase=s=>e.check(T6(s)),e.uppercase=s=>e.check(M6(s)),e.trim=()=>e.check(z6()),e.normalize=(...s)=>e.check(D6(...s)),e.toLowerCase=()=>e.check(P6()),e.toUpperCase=()=>e.check(L6()),e.slugify=()=>e.check(I6())}),A$=fe("ZodString",(e,t)=>{hy.init(e,t),Tk.init(e,t),e.email=n=>e.check(XI(O$,n)),e.url=n=>e.check(r6(D$,n)),e.jwt=n=>e.check(x6(Z$,n)),e.emoji=n=>e.check(s6(z$,n)),e.guid=n=>e.check(pj(yj,n)),e.uuid=n=>e.check(JI(jf,n)),e.uuidv4=n=>e.check(e6(jf,n)),e.uuidv6=n=>e.check(t6(jf,n)),e.uuidv7=n=>e.check(n6(jf,n)),e.nanoid=n=>e.check(a6(P$,n)),e.guid=n=>e.check(pj(yj,n)),e.cuid=n=>e.check(o6(L$,n)),e.cuid2=n=>e.check(i6(I$,n)),e.ulid=n=>e.check(l6($$,n)),e.base64=n=>e.check(p6(Y$,n)),e.base64url=n=>e.check(g6(W$,n)),e.xid=n=>e.check(c6(F$,n)),e.ksuid=n=>e.check(u6(B$,n)),e.ipv4=n=>e.check(d6(U$,n)),e.ipv6=n=>e.check(f6(V$,n)),e.cidrv4=n=>e.check(h6(q$,n)),e.cidrv6=n=>e.check(m6(H$,n)),e.e164=n=>e.check(v6(G$,n)),e.datetime=n=>e.check(f$(n)),e.date=n=>e.check(m$(n)),e.time=n=>e.check(g$(n)),e.duration=n=>e.check(x$(n))});function xr(e){return KI(A$,e)}const Ut=fe("ZodStringFormat",(e,t)=>{It.init(e,t),Tk.init(e,t)}),O$=fe("ZodEmail",(e,t)=>{aI.init(e,t),Ut.init(e,t)}),yj=fe("ZodGUID",(e,t)=>{rI.init(e,t),Ut.init(e,t)}),jf=fe("ZodUUID",(e,t)=>{sI.init(e,t),Ut.init(e,t)}),D$=fe("ZodURL",(e,t)=>{oI.init(e,t),Ut.init(e,t)}),z$=fe("ZodEmoji",(e,t)=>{iI.init(e,t),Ut.init(e,t)}),P$=fe("ZodNanoID",(e,t)=>{lI.init(e,t),Ut.init(e,t)}),L$=fe("ZodCUID",(e,t)=>{cI.init(e,t),Ut.init(e,t)}),I$=fe("ZodCUID2",(e,t)=>{uI.init(e,t),Ut.init(e,t)}),$$=fe("ZodULID",(e,t)=>{dI.init(e,t),Ut.init(e,t)}),F$=fe("ZodXID",(e,t)=>{fI.init(e,t),Ut.init(e,t)}),B$=fe("ZodKSUID",(e,t)=>{hI.init(e,t),Ut.init(e,t)}),U$=fe("ZodIPv4",(e,t)=>{xI.init(e,t),Ut.init(e,t)}),V$=fe("ZodIPv6",(e,t)=>{yI.init(e,t),Ut.init(e,t)}),q$=fe("ZodCIDRv4",(e,t)=>{bI.init(e,t),Ut.init(e,t)}),H$=fe("ZodCIDRv6",(e,t)=>{wI.init(e,t),Ut.init(e,t)}),Y$=fe("ZodBase64",(e,t)=>{SI.init(e,t),Ut.init(e,t)}),W$=fe("ZodBase64URL",(e,t)=>{CI.init(e,t),Ut.init(e,t)}),G$=fe("ZodE164",(e,t)=>{NI.init(e,t),Ut.init(e,t)}),Z$=fe("ZodJWT",(e,t)=>{_I.init(e,t),Ut.init(e,t)}),Mk=fe("ZodNumber",(e,t)=>{yk.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(s,o,l)=>Y6(e,s,o),e.gt=(s,o)=>e.check(vj(s,o)),e.gte=(s,o)=>e.check(sv(s,o)),e.min=(s,o)=>e.check(sv(s,o)),e.lt=(s,o)=>e.check(gj(s,o)),e.lte=(s,o)=>e.check(rv(s,o)),e.max=(s,o)=>e.check(rv(s,o)),e.int=s=>e.check(bj(s)),e.safe=s=>e.check(bj(s)),e.positive=s=>e.check(vj(0,s)),e.nonnegative=s=>e.check(sv(0,s)),e.negative=s=>e.check(gj(0,s)),e.nonpositive=s=>e.check(rv(0,s)),e.multipleOf=(s,o)=>e.check(xj(s,o)),e.step=(s,o)=>e.check(xj(s,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 Q$(e){return j6(Mk,e)}const K$=fe("ZodNumberFormat",(e,t)=>{EI.init(e,t),Mk.init(e,t)});function bj(e){return C6(K$,e)}const X$=fe("ZodBoolean",(e,t)=>{TI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>W6(e,n,s)});function pr(e){return N6(X$,e)}const J$=fe("ZodUnknown",(e,t)=>{MI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Z6()});function wj(){return k6(J$)}const eF=fe("ZodNever",(e,t)=>{RI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>G6(e,n,s)});function tF(e){return _6(eF,e)}const nF=fe("ZodArray",(e,t)=>{AI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>J6(e,n,s,o),e.element=t.element,e.min=(n,s)=>e.check(uh(n,s)),e.nonempty=n=>e.check(uh(1,n)),e.max=(n,s)=>e.check(jk(n,s)),e.length=(n,s)=>e.check(Ck(n,s)),e.unwrap=()=>e.element});function my(e,t){return $6(nF,e,t)}const rF=fe("ZodObject",(e,t)=>{DI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>e$(e,n,s,o),kt(e,"shape",()=>t.shape),e.keyof=()=>py(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:wj()}),e.loose=()=>e.clone({...e._zod.def,catchall:wj()}),e.strict=()=>e.clone({...e._zod.def,catchall:tF()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>tL(e,n),e.safeExtend=n=>nL(e,n),e.merge=n=>rL(e,n),e.pick=n=>J5(e,n),e.omit=n=>eL(e,n),e.partial=(...n)=>sL(Rk,e,n[0]),e.required=(...n)=>aL(Ak,e,n[0])});function Go(e,t){const n={type:"object",shape:e??{},...$e(t)};return new rF(n)}const sF=fe("ZodUnion",(e,t)=>{zI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>t$(e,n,s,o),e.options=t.options});function aF(e,t){return new sF({type:"union",options:e,...$e(t)})}const oF=fe("ZodIntersection",(e,t)=>{PI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>n$(e,n,s,o)});function iF(e,t){return new oF({type:"intersection",left:e,right:t})}const lF=fe("ZodRecord",(e,t)=>{LI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>r$(e,n,s,o),e.keyType=t.keyType,e.valueType=t.valueType});function cF(e,t,n){return new lF({type:"record",keyType:e,valueType:t,...$e(n)})}const Xv=fe("ZodEnum",(e,t)=>{II.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(s,o,l)=>Q6(e,s,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(s,o)=>{const l={};for(const u of s)if(n.has(u))l[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Xv({...t,checks:[],...$e(o),entries:l})},e.exclude=(s,o)=>{const l={...t.entries};for(const u of s)if(n.has(u))delete l[u];else throw new Error(`Key ${u} not found in enum`);return new Xv({...t,checks:[],...$e(o),entries:l})}});function py(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new Xv({type:"enum",entries:n,...$e(t)})}const uF=fe("ZodTransform",(e,t)=>{$I.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>X6(e,n),e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new rk(e.constructor.name);n.addIssue=l=>{if(typeof l=="string")n.issues.push(yu(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(yu(u))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(l=>(n.value=l,n)):(n.value=o,n)}});function dF(e){return new uF({type:"transform",transform:e})}const Rk=fe("ZodOptional",(e,t)=>{Sk.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ek(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function Sj(e){return new Rk({type:"optional",innerType:e})}const fF=fe("ZodExactOptional",(e,t)=>{FI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ek(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function hF(e){return new fF({type:"optional",innerType:e})}const mF=fe("ZodNullable",(e,t)=>{BI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>s$(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function jj(e){return new mF({type:"nullable",innerType:e})}const pF=fe("ZodDefault",(e,t)=>{UI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>o$(e,n,s,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function gF(e,t){return new pF({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ik(t)}})}const vF=fe("ZodPrefault",(e,t)=>{VI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>i$(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function xF(e,t){return new vF({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ik(t)}})}const Ak=fe("ZodNonOptional",(e,t)=>{qI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>a$(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function yF(e,t){return new Ak({type:"nonoptional",innerType:e,...$e(t)})}const bF=fe("ZodCatch",(e,t)=>{HI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>l$(e,n,s,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wF(e,t){return new bF({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const SF=fe("ZodPipe",(e,t)=>{YI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>c$(e,n,s,o),e.in=t.in,e.out=t.out});function Cj(e,t){return new SF({type:"pipe",in:e,out:t})}const jF=fe("ZodReadonly",(e,t)=>{WI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>u$(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function CF(e){return new jF({type:"readonly",innerType:e})}const NF=fe("ZodCustom",(e,t)=>{GI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,s,o)=>K6(e,n)});function kF(e,t={}){return F6(NF,e,t)}function _F(e){return B6(e)}const EF=Go({id:xr(),path:xr(),label:xr(),icon:xr(),visible:pr().default(!0),section:py(["main","config"]).default("main"),badge:xr().optional(),exact:pr().optional()}),Nj=Go({appName:xr().default("Convex CMS"),logo:xr().optional(),favicon:xr().optional()}),kj=Go({sidebarWidth:Q$().min(200).max(400).default(256),sidebarCollapsible:pr().default(!1)}),_j=Go({showDashboard:pr().default(!0),showContent:pr().default(!0),showMedia:pr().default(!0),showTaxonomies:pr().default(!0),showContentTypes:pr().default(!0),showTrash:pr().default(!0),showUsers:pr().default(!0),showSettings:pr().default(!0),customItems:my(EF).default([])}),TF=Go({value:xr(),label:xr(),description:xr().optional()}),Ej=Go({mode:py(["light","dark","system"]).default("system"),allowModeSwitch:pr().default(!0),tokens:cF(xr(),xr()).optional()}),MF=Go({branding:Nj.default(()=>Nj.parse({})),layout:kj.default(()=>kj.parse({})),navigation:_j.default(()=>_j.parse({})),theme:Ej.default(()=>Ej.parse({})),customRoles:my(TF).default([]),overrideBuiltInRoles:pr().default(!1)}),RF=[{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 AF(e){return MF.parse(e??{})}function OF(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},s=[...RF.filter(o=>t[o.id]!==!1),...e.navigation.customItems.filter(o=>o.visible!==!1)];return{main:s.filter(o=>o.section==="main"),config:s.filter(o=>o.section==="config")}}const Ok=p.createContext(null);function Dk({config:e,children:t}){const n=OF(e),s={...e,navItems:n};return i.jsx(Ok.Provider,{value:s,children:t})}function Lh(){const e=p.useContext(Ok);if(!e)throw new Error("useAdminConfig must be used within AdminConfigProvider");return e}const gy=p.createContext(null);function DF({baseConfig:e,children:t,api:n}){const s=Ye(n.getSettings,{})??void 0,o=p.useMemo(()=>s?{...e,navigation:{...e.navigation,showMedia:e.navigation.showMedia&&s.features.mediaManagement}}:e,[e,s]),l=p.useMemo(()=>({baseConfig:e,settings:s}),[e,s]);return i.jsx(gy.Provider,{value:l,children:i.jsx(Dk,{config:o,children:t})})}function zF({baseConfig:e,children:t}){const n=p.useMemo(()=>({baseConfig:e,settings:void 0}),[e]);return i.jsx(gy.Provider,{value:n,children:i.jsx(Dk,{config:e,children:t})})}function PF({baseConfig:e,children:t,api:n}){return n?i.jsx(DF,{baseConfig:e,api:n,children:t}):i.jsx(zF,{baseConfig:e,children:t})}function zk(){const e=p.useContext(gy);if(!e)throw new Error("useSettingsConfig must be used within SettingsConfigProvider");return e}const Pk=p.createContext(null);function LF({children:e}){const[t,n]=p.useState(new Map),s=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:s,clearOverride:o}),[t,s,o]);return i.jsx(Pk.Provider,{value:l,children:e})}function Lk(){const e=p.useContext(Pk);if(!e)throw new Error("useBreadcrumbContext must be used within a BreadcrumbProvider");return e}const IF={LayoutDashboard:MP,FileText:jr,Image:rs,Layers:Kx,Tags:ty,FileCode:K3,Settings:GN,Trash2:Fn,HelpCircle:BN,Home:Ah,User:ZN,Users:A5,Bell:Wv,Lock:Xx,Globe:hP,Calendar:pl,Clock:sh,Link:WN,Hash:Qx,ToggleLeft:ry,ChevronDown:vn,CheckSquare:m5,Braces:qx,Folder:ih,MapPin:BP,DollarSign:qN,Mail:$P,Phone:r5,Package:XP,Star:x5,Heart:bP,Flag:nP,Bookmark:w3,Archive:$N,Edit:g5,Eye:ah,AlertCircle:Pu};function Tj({name:e,className:t="size-5"}){const n=IF[e];return n?i.jsx(n,{className:t}):null}const Ik=p.createContext(null);function $F({api:e,children:t}){return i.jsx(Ik.Provider,{value:e,children:t})}function xn(){const e=p.useContext(Ik);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 FF(e,t){const n=p.createContext(t),s=l=>{const{children:u,...d}=l,h=p.useMemo(()=>d,Object.values(d));return i.jsx(n.Provider,{value:h,children:u})};s.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[s,o]}function Dn(e,t=[]){let n=[];function s(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,[s,BF(o,...t)]}function BF(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(l){const u=s.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:()=>{},UF=Sx[" useInsertionEffect ".trim().toString()]||Jt;function rr({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[o,l,u]=VF({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(`${s} 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,s])}const m=p.useCallback(v=>{if(d){const g=qF(v)?v(e):v;g!==e&&u.current?.(g)}else l(v)},[d,e,l,u]);return[h,m]}function VF({defaultProp:e,onChange:t}){const[n,s]=p.useState(e),o=p.useRef(n),l=p.useRef(t);return UF(()=>{l.current=t},[t]),p.useEffect(()=>{o.current!==n&&(l.current?.(n),o.current=n)},[n,o]),[n,s,l]}function qF(e){return typeof e=="function"}function Mj(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function _s(...e){return t=>{let n=!1;const s=e.map(o=>{const l=Mj(o,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let o=0;o<s.length;o++){const l=s[o];typeof l=="function"?l():Mj(e[o],null)}}}}function Ze(...e){return p.useCallback(_s(...e),e)}function $o(e){const t=HF(e),n=p.forwardRef((s,o)=>{const{children:l,...u}=s,d=p.Children.toArray(l),h=d.find(YF);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 HF(e){const t=p.forwardRef((n,s)=>{const{children:o,...l}=n;if(p.isValidElement(o)){const u=GF(o),d=WF(l,o.props);return o.type!==p.Fragment&&(d.ref=s?_s(s,u):u),p.cloneElement(o,d)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $k=Symbol("radix.slottable");function Fk(e){const t=({children:n})=>i.jsx(i.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=$k,t}function YF(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$k}function WF(e,t){const n={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?n[s]=(...d)=>{const h=l(...d);return o(...d),h}:o&&(n[s]=o):s==="style"?n[s]={...o,...l}:s==="className"&&(n[s]=[o,l].filter(Boolean).join(" "))}return{...e,...n}}function GF(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 ZF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ze=ZF.reduce((e,t)=>{const n=$o(`Primitive.${t}`),s=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 s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function Bk(e,t){e&&Ml.flushSync(()=>e.dispatchEvent(t))}function QF(e,t){return p.useReducer((n,s)=>t[n][s]??n,e)}var yn=e=>{const{present:t,children:n}=e,s=KF(t),o=typeof n=="function"?n({present:s.isPresent}):p.Children.only(n),l=Ze(s.ref,XF(o));return typeof n=="function"||s.isPresent?p.cloneElement(o,{ref:l}):null};yn.displayName="Presence";function KF(e){const[t,n]=p.useState(),s=p.useRef(null),o=p.useRef(e),l=p.useRef("none"),u=e?"mounted":"unmounted",[d,h]=QF(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const m=Cf(s.current);l.current=d==="mounted"?m:"none"},[d]),Jt(()=>{const m=s.current,v=o.current;if(v!==e){const y=l.current,w=Cf(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=Cf(s.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=Cf(s.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=>{s.current=m?getComputedStyle(m):null,n(m)},[])}}function Cf(e){return e?.animationName||"none"}function XF(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 JF=Sx[" useId ".trim().toString()]||(()=>{}),e8=0;function gn(e){const[t,n]=p.useState(JF());return Jt(()=>{n(s=>s??String(e8++))},[e]),e||(t?`radix-${t}`:"")}var Ih="Collapsible",[t8]=Dn(Ih),[n8,vy]=t8(Ih),Uk=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:s,defaultOpen:o,disabled:l,onOpenChange:u,...d}=e,[h,m]=rr({prop:s,defaultProp:o??!1,onChange:u,caller:Ih});return i.jsx(n8,{scope:n,disabled:l,contentId:gn(),open:h,onOpenToggle:p.useCallback(()=>m(v=>!v),[m]),children:i.jsx(ze.div,{"data-state":yy(h),"data-disabled":l?"":void 0,...d,ref:t})})});Uk.displayName=Ih;var Vk="CollapsibleTrigger",qk=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...s}=e,o=vy(Vk,n);return i.jsx(ze.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":yy(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...s,ref:t,onClick:Se(e.onClick,o.onOpenToggle)})});qk.displayName=Vk;var xy="CollapsibleContent",Hk=p.forwardRef((e,t)=>{const{forceMount:n,...s}=e,o=vy(xy,e.__scopeCollapsible);return i.jsx(yn,{present:n||o.open,children:({present:l})=>i.jsx(r8,{...s,ref:t,present:l})})});Hk.displayName=xy;var r8=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:s,children:o,...l}=e,u=vy(xy,n),[d,h]=p.useState(s),m=p.useRef(null),v=Ze(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(s)}},[u.open,s]),i.jsx(ze.div,{"data-state":yy(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 yy(e){return e?"open":"closed"}var s8=Uk;function Yk(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Yk(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function Wk(){for(var e,t,n=0,s="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Yk(e))&&(s&&(s+=" "),s+=t);return s}const a8=(e,t)=>{const n=new Array(e.length+t.length);for(let s=0;s<e.length;s++)n[s]=e[s];for(let s=0;s<t.length;s++)n[e.length+s]=t[s];return n},o8=(e,t)=>({classGroupId:e,validator:t}),Gk=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),fh="-",Rj=[],i8="arbitrary..",l8=e=>{const t=u8(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return c8(u);const d=u.split(fh),h=d[0]===""&&d.length>1?1:0;return Zk(d,h,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const h=s[u],m=n[u];return h?m?a8(m,h):h:m||Rj}return n[u]||Rj}}},Zk=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],l=n.nextPart.get(o);if(l){const m=Zk(e,t+1,l);if(m)return m}const u=n.validators;if(u===null)return;const d=t===0?e.join(fh):e.slice(t).join(fh),h=u.length;for(let m=0;m<h;m++){const v=u[m];if(v.validator(d))return v.classGroupId}},c8=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),s=t.slice(0,n);return s?i8+s:void 0})(),u8=e=>{const{theme:t,classGroups:n}=e;return d8(n,t)},d8=(e,t)=>{const n=Gk();for(const s in e){const o=e[s];by(o,n,s,t)}return n},by=(e,t,n,s)=>{const o=e.length;for(let l=0;l<o;l++){const u=e[l];f8(u,t,n,s)}},f8=(e,t,n,s)=>{if(typeof e=="string"){h8(e,t,n);return}if(typeof e=="function"){m8(e,t,n,s);return}p8(e,t,n,s)},h8=(e,t,n)=>{const s=e===""?t:Qk(t,e);s.classGroupId=n},m8=(e,t,n,s)=>{if(g8(e)){by(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(o8(n,e))},p8=(e,t,n,s)=>{const o=Object.entries(e),l=o.length;for(let u=0;u<l;u++){const[d,h]=o[u];by(h,Qk(t,d),n,s)}},Qk=(e,t)=>{let n=e;const s=t.split(fh),o=s.length;for(let l=0;l<o;l++){const u=s[l];let d=n.nextPart.get(u);d||(d=Gk(),n.nextPart.set(u,d)),n=d}return n},g8=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,v8=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),s=Object.create(null);const o=(l,u)=>{n[l]=u,t++,t>e&&(t=0,s=n,n=Object.create(null))};return{get(l){let u=n[l];if(u!==void 0)return u;if((u=s[l])!==void 0)return o(l,u),u},set(l,u){l in n?n[l]=u:o(l,u)}}},Jv="!",Aj=":",x8=[],Oj=(e,t,n,s,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:o}),y8=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=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===Aj){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(Jv)?(y=g.slice(0,-1),w=!0):g.startsWith(Jv)&&(y=g.slice(1),w=!0);const S=m&&m>h?m-h:void 0;return Oj(l,w,y,S)};if(t){const o=t+Aj,l=s;s=u=>u.startsWith(o)?l(u.slice(o.length)):Oj(x8,!1,u,void 0,!0)}if(n){const o=s;s=l=>n({className:l,parseClassName:o})}return s},b8=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,s)=>{t.set(n,1e6+s)}),n=>{const s=[];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(),s.push(...o),o=[]),s.push(u)):o.push(u)}return o.length>0&&(o.sort(),s.push(...o)),s}},w8=e=>({cache:v8(e.cacheSize),parseClassName:y8(e),sortModifiers:b8(e),...l8(e)}),S8=/\s+/,j8=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o,sortModifiers:l}=t,u=[],d=e.trim().split(S8);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=s(N?S.substring(0,j):S);if(!C){if(!N){h=v+(h.length>0?" "+h:h);continue}if(C=s(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?_+Jv:_,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},C8=(...e)=>{let t=0,n,s,o="";for(;t<e.length;)(n=e[t++])&&(s=Kk(n))&&(o&&(o+=" "),o+=s);return o},Kk=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Kk(e[s]))&&(n&&(n+=" "),n+=t);return n},N8=(e,...t)=>{let n,s,o,l;const u=h=>{const m=t.reduce((v,g)=>g(v),e());return n=w8(m),s=n.cache.get,o=n.cache.set,l=d,d(h)},d=h=>{const m=s(h);if(m)return m;const v=j8(h,n);return o(h,v),v};return l=u,(...h)=>l(C8(...h))},k8=[],hn=e=>{const t=n=>n[e]||k8;return t.isThemeGetter=!0,t},Xk=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Jk=/^\((?:(\w[\w-]*):)?(.+)\)$/i,_8=/^\d+\/\d+$/,E8=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,T8=/\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$/,M8=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,R8=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,A8=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$i=e=>_8.test(e),nt=e=>!!e&&!Number.isNaN(Number(e)),La=e=>!!e&&Number.isInteger(Number(e)),av=e=>e.endsWith("%")&&nt(e.slice(0,-1)),Xs=e=>E8.test(e),O8=()=>!0,D8=e=>T8.test(e)&&!M8.test(e),e_=()=>!1,z8=e=>R8.test(e),P8=e=>A8.test(e),L8=e=>!Te(e)&&!Me(e),I8=e=>Dl(e,r_,e_),Te=e=>Xk.test(e),jo=e=>Dl(e,s_,D8),ov=e=>Dl(e,V8,nt),Dj=e=>Dl(e,t_,e_),$8=e=>Dl(e,n_,P8),Nf=e=>Dl(e,a_,z8),Me=e=>Jk.test(e),Uc=e=>zl(e,s_),F8=e=>zl(e,q8),zj=e=>zl(e,t_),B8=e=>zl(e,r_),U8=e=>zl(e,n_),kf=e=>zl(e,a_,!0),Dl=(e,t,n)=>{const s=Xk.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},zl=(e,t,n=!1)=>{const s=Jk.exec(e);return s?s[1]?t(s[1]):n:!1},t_=e=>e==="position"||e==="percentage",n_=e=>e==="image"||e==="url",r_=e=>e==="length"||e==="size"||e==="bg-size",s_=e=>e==="length",V8=e=>e==="number",q8=e=>e==="family-name",a_=e=>e==="shadow",H8=()=>{const e=hn("color"),t=hn("font"),n=hn("text"),s=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=()=>[$i,"full","auto",...O()],z=()=>[La,"none","subgrid",Me,Te],B=()=>["auto",{span:["full",La,Me,Te]},La,Me,Te],q=()=>[La,"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()],$=()=>[$i,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],U=()=>[e,Me,Te],H=()=>[...M(),zj,Dj,{position:[Me,Te]}],le=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",B8,I8,{size:[Me,Te]}],F=()=>[av,Uc,jo],K=()=>["","none","full",m,Me,Te],ne=()=>["",nt,Uc,jo],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=()=>[nt,av,zj,Dj],ye=()=>["","none",S,Me,Te],Ce=()=>["none",nt,Me,Te],_e=()=>["none",nt,Me,Te],Re=()=>[nt,Me,Te],ge=()=>[$i,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xs],breakpoint:[Xs],color:[O8],container:[Xs],"drop-shadow":[Xs],ease:["in","out","in-out"],font:[L8],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xs],shadow:[Xs],spacing:["px",nt],text:[Xs],"text-shadow":[Xs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$i,Te,Me,N]}],container:["container"],columns:[{columns:[nt,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:[La,"auto",Me,Te]}],basis:[{basis:[$i,"full","auto",d,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[nt,$i,"auto","initial","none",Te]}],grow:[{grow:["",nt,Me,Te]}],shrink:[{shrink:["",nt,Me,Te]}],order:[{order:[La,"first","last","none",Me,Te]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"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,jo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,Me,ov]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",av,Te]}],"font-family":[{font:[F8,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":[nt,"none",Me,ov]}],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:[nt,"from-font","auto",Me,jo]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[nt,"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"]},La,Me,Te],radial:["",Me,Te],conic:[La,Me,Te]},U8,$8]}],"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":[nt,Me,Te]}],"outline-w":[{outline:["",nt,Uc,jo]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",v,kf,Nf]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",g,kf,Nf]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[nt,jo]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",y,kf,Nf]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[nt,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":[nt]}],"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":[nt]}],"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:[nt,Me,Te]}],contrast:[{contrast:[nt,Me,Te]}],"drop-shadow":[{"drop-shadow":["","none",w,kf,Nf]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",nt,Me,Te]}],"hue-rotate":[{"hue-rotate":[nt,Me,Te]}],invert:[{invert:["",nt,Me,Te]}],saturate:[{saturate:[nt,Me,Te]}],sepia:[{sepia:["",nt,Me,Te]}],"backdrop-filter":[{"backdrop-filter":["","none",Me,Te]}],"backdrop-blur":[{"backdrop-blur":ye()}],"backdrop-brightness":[{"backdrop-brightness":[nt,Me,Te]}],"backdrop-contrast":[{"backdrop-contrast":[nt,Me,Te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",nt,Me,Te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[nt,Me,Te]}],"backdrop-invert":[{"backdrop-invert":["",nt,Me,Te]}],"backdrop-opacity":[{"backdrop-opacity":[nt,Me,Te]}],"backdrop-saturate":[{"backdrop-saturate":[nt,Me,Te]}],"backdrop-sepia":[{"backdrop-sepia":["",nt,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:[nt,"initial",Me,Te]}],ease:[{ease:["linear","initial",C,Me,Te]}],delay:[{delay:[nt,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:[nt,Uc,jo,ov]}],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"]}},Y8=N8(H8);function W(...e){return Y8(Wk(e))}const wy=s8,Sy=qk;function jy({className:e,children:t,...n}){return i.jsx(Hk,{className:W("overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",e),...n,children:t})}var W8=Symbol.for("react.lazy"),hh=Sx[" use ".trim().toString()];function G8(e){return typeof e=="object"&&e!==null&&"then"in e}function o_(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===W8&&"_payload"in e&&G8(e._payload)}function i_(e){const t=Z8(e),n=p.forwardRef((s,o)=>{let{children:l,...u}=s;o_(l)&&typeof hh=="function"&&(l=hh(l._payload));const d=p.Children.toArray(l),h=d.find(K8);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=i_("Slot");function Z8(e){const t=p.forwardRef((n,s)=>{let{children:o,...l}=n;if(o_(o)&&typeof hh=="function"&&(o=hh(o._payload)),p.isValidElement(o)){const u=J8(o),d=X8(l,o.props);return o.type!==p.Fragment&&(d.ref=s?_s(s,u):u),p.cloneElement(o,d)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Q8=Symbol("radix.slottable");function K8(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Q8}function X8(e,t){const n={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?n[s]=(...d)=>{const h=l(...d);return o(...d),h}:o&&(n[s]=o):s==="style"?n[s]={...o,...l}:s==="className"&&(n[s]=[o,l].filter(Boolean).join(" "))}return{...e,...n}}function J8(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 Pj=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Lj=Wk,Zo=(e,t)=>n=>{var s;if(t?.variants==null)return Lj(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=Pj(v)||Pj(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||(s=t.compoundVariants)===null||s===void 0?void 0:s.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 Lj(e,u,h,n?.class,n?.className)},iv=768;function eB(){const[e,t]=p.useState(void 0);return p.useEffect(()=>{const n=window.matchMedia(`(max-width: ${iv-1}px)`),s=()=>{t(window.innerWidth<iv)};return n.addEventListener("change",s),t(window.innerWidth<iv),()=>n.removeEventListener("change",s)},[]),!!e}const bu=Zo("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 tt({className:e,variant:t="default",size:n="default",asChild:s=!1,...o}){const l=s?Pl:"button";return i.jsx(l,{"data-slot":"button","data-variant":t,"data-size":n,className:W(bu({variant:t,size:n,className:e})),...o})}function pt({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 tB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ar=tB.reduce((e,t)=>{const n=i_(`Primitive.${t}`),s=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 s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),nB="Separator",Ij="horizontal",rB=["horizontal","vertical"],l_=p.forwardRef((e,t)=>{const{decorative:n,orientation:s=Ij,...o}=e,l=sB(s)?s:Ij,d=n?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return i.jsx(ar.div,{"data-orientation":l,...d,...o,ref:t})});l_.displayName=nB;function sB(e){return rB.includes(e)}var aB=l_;function mh({className:e,orientation:t="horizontal",decorative:n=!0,...s}){return i.jsx(aB,{"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),...s})}function Nn(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>t.current?.(...n),[])}function oB(e,t=globalThis?.document){const n=Nn(e);p.useEffect(()=>{const s=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var iB="DismissableLayer",ex="dismissableLayer.update",lB="dismissableLayer.pointerDownOutside",cB="dismissableLayer.focusOutside",$j,c_=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ll=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...h}=e,m=p.useContext(c_),[v,g]=p.useState(null),y=v?.ownerDocument??globalThis?.document,[,w]=p.useState({}),S=Ze(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=fB(T=>{const O=T.target,D=[...m.branches].some(z=>z.contains(O));!M||D||(o?.(T),u?.(T),T.defaultPrevented||d?.())},y),R=hB(T=>{const O=T.target;[...m.branches].some(z=>z.contains(O))||(l?.(T),u?.(T),T.defaultPrevented||d?.())},y);return oB(T=>{_===m.layers.size-1&&(s?.(T),!T.defaultPrevented&&d&&(T.preventDefault(),d()))},y),p.useEffect(()=>{if(v)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&($j=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(v)),m.layers.add(v),Fj(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=$j)}},[v,y,n,m]),p.useEffect(()=>()=>{v&&(m.layers.delete(v),m.layersWithOutsidePointerEventsDisabled.delete(v),Fj())},[v,m]),p.useEffect(()=>{const T=()=>w({});return document.addEventListener(ex,T),()=>document.removeEventListener(ex,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=iB;var uB="DismissableLayerBranch",dB=p.forwardRef((e,t)=>{const n=p.useContext(c_),s=p.useRef(null),o=Ze(t,s);return p.useEffect(()=>{const l=s.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),i.jsx(ze.div,{...e,ref:o})});dB.displayName=uB;function fB(e,t=globalThis?.document){const n=Nn(e),s=p.useRef(!1),o=p.useRef(()=>{});return p.useEffect(()=>{const l=d=>{if(d.target&&!s.current){let h=function(){u_(lB,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);s.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:()=>s.current=!0}}function hB(e,t=globalThis?.document){const n=Nn(e),s=p.useRef(!1);return p.useEffect(()=>{const o=l=>{l.target&&!s.current&&u_(cB,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function Fj(){const e=new CustomEvent(ex);document.dispatchEvent(e)}function u_(e,t,n,{discrete:s}){const o=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),s?Bk(o,l):o.dispatchEvent(l)}var lv="focusScope.autoFocusOnMount",cv="focusScope.autoFocusOnUnmount",Bj={bubbles:!1,cancelable:!0},mB="FocusScope",Lu=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:l,...u}=e,[d,h]=p.useState(null),m=Nn(o),v=Nn(l),g=p.useRef(null),y=Ze(t,j=>h(j)),w=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(s){let j=function(E){if(w.paused||!d)return;const M=E.target;d.contains(M)?g.current=M:$a(g.current,{select:!0})},N=function(E){if(w.paused||!d)return;const M=E.relatedTarget;M!==null&&(d.contains(M)||$a(g.current,{select:!0}))},C=function(E){if(document.activeElement===document.body)for(const A of E)A.removedNodes.length>0&&$a(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()}}},[s,d,w.paused]),p.useEffect(()=>{if(d){Vj.add(w);const j=document.activeElement;if(!d.contains(j)){const C=new CustomEvent(lv,Bj);d.addEventListener(lv,m),d.dispatchEvent(C),C.defaultPrevented||(pB(bB(d_(d)),{select:!0}),document.activeElement===j&&$a(d))}return()=>{d.removeEventListener(lv,m),setTimeout(()=>{const C=new CustomEvent(cv,Bj);d.addEventListener(cv,v),d.dispatchEvent(C),C.defaultPrevented||$a(j??document.body,{select:!0}),d.removeEventListener(cv,v),Vj.remove(w)},0)}}},[d,m,v,w]);const S=p.useCallback(j=>{if(!n&&!s||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]=gB(_);E&&M?!j.shiftKey&&C===M?(j.preventDefault(),n&&$a(E,{select:!0})):j.shiftKey&&C===E&&(j.preventDefault(),n&&$a(M,{select:!0})):C===_&&j.preventDefault()}},[n,s,w.paused]);return i.jsx(ze.div,{tabIndex:-1,...u,ref:y,onKeyDown:S})});Lu.displayName=mB;function pB(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if($a(s,{select:t}),document.activeElement!==n)return}function gB(e){const t=d_(e),n=Uj(t,e),s=Uj(t.reverse(),e);return[n,s]}function d_(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const o=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||o?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Uj(e,t){for(const n of e)if(!vB(n,{upTo:t}))return n}function vB(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 xB(e){return e instanceof HTMLInputElement&&"select"in e}function $a(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&xB(e)&&t&&e.select()}}var Vj=yB();function yB(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=qj(e,t),e.unshift(t)},remove(t){e=qj(e,t),e[0]?.resume()}}}function qj(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function bB(e){return e.filter(t=>t.tagName!=="A")}var wB="Portal",Il=p.forwardRef((e,t)=>{const{container:n,...s}=e,[o,l]=p.useState(!1);Jt(()=>l(!0),[]);const u=n||o&&globalThis?.document?.body;return u?E4.createPortal(i.jsx(ze.div,{...s,ref:t}),u):null});Il.displayName=wB;var uv=0;function $h(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Hj()),document.body.insertAdjacentElement("beforeend",e[1]??Hj()),uv++,()=>{uv===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),uv--}},[])}function Hj(){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,s=1,o=arguments.length;s<o;s++){n=arguments[s];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},ys.apply(this,arguments)};function f_(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(e);o<s.length;o++)t.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(e,s[o])&&(n[s[o]]=e[s[o]]);return n}function SB(e,t,n){if(n||arguments.length===2)for(var s=0,o=t.length,l;s<o;s++)(l||!(s in t))&&(l||(l=Array.prototype.slice.call(t,0,s)),l[s]=t[s]);return e.concat(l||Array.prototype.slice.call(t))}var Bf="right-scroll-bar-position",Uf="width-before-scroll-bar",jB="with-scroll-bars-hidden",CB="--removed-body-scroll-bar-size";function dv(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function NB(e,t){var n=p.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var o=n.value;o!==s&&(n.value=s,n.callback(s,o))}}}})[0];return n.callback=t,n.facade}var kB=typeof window<"u"?p.useLayoutEffect:p.useEffect,Yj=new WeakMap;function _B(e,t){var n=NB(null,function(s){return e.forEach(function(o){return dv(o,s)})});return kB(function(){var s=Yj.get(n);if(s){var o=new Set(s),l=new Set(e),u=n.current;o.forEach(function(d){l.has(d)||dv(d,null)}),l.forEach(function(d){o.has(d)||dv(d,u)})}Yj.set(n,e)},[e]),n}function EB(e){return e}function TB(e,t){t===void 0&&(t=EB);var n=[],s=!1,o={read:function(){if(s)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,s);return n.push(u),function(){n=n.filter(function(d){return d!==u})}},assignSyncMedium:function(l){for(s=!0;n.length;){var u=n;n=[],u.forEach(l)}n={push:function(d){return l(d)},filter:function(){return n}}},assignMedium:function(l){s=!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 MB(e){e===void 0&&(e={});var t=TB(null);return t.options=ys({async:!0,ssr:!1},e),t}var h_=function(e){var t=e.sideCar,n=f_(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return p.createElement(s,ys({},n))};h_.isSideCarExport=!0;function RB(e,t){return e.useMedium(t),h_}var m_=MB(),fv=function(){},Fh=p.forwardRef(function(e,t){var n=p.useRef(null),s=p.useState({onScrollCapture:fv,onWheelCapture:fv,onTouchMoveCapture:fv}),o=s[0],l=s[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=f_(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=y,R=_B([n,t]),T=ys(ys({},M),o);return p.createElement(p.Fragment,null,v&&p.createElement(A,{sideCar:m_,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))});Fh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Fh.classNames={fullWidth:Uf,zeroRight:Bf};var AB=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function OB(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=AB();return t&&e.setAttribute("nonce",t),e}function DB(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function zB(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var PB=function(){var e=0,t=null;return{add:function(n){e==0&&(t=OB())&&(DB(t,n),zB(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},LB=function(){var e=PB();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},p_=function(){var e=LB(),t=function(n){var s=n.styles,o=n.dynamic;return e(s,o),null};return t},IB={left:0,top:0,right:0,gap:0},hv=function(e){return parseInt(e||"",10)||0},$B=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[hv(n),hv(s),hv(o)]},FB=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return IB;var t=$B(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},BB=p_(),il="data-scroll-locked",UB=function(e,t,n,s){var o=e.left,l=e.top,u=e.right,d=e.gap;return n===void 0&&(n="margin"),`
49
+ .`.concat(jB,` {
50
+ overflow: hidden `).concat(s,`;
51
+ padding-right: `).concat(d,"px ").concat(s,`;
52
+ }
53
+ body[`).concat(il,`] {
54
+ overflow: hidden `).concat(s,`;
55
+ overscroll-behavior: contain;
56
+ `).concat([t&&"position: relative ".concat(s,";"),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(s,`;
63
+ `),n==="padding"&&"padding-right: ".concat(d,"px ").concat(s,";")].filter(Boolean).join(""),`
64
+ }
65
+
66
+ .`).concat(Bf,` {
67
+ right: `).concat(d,"px ").concat(s,`;
68
+ }
69
+
70
+ .`).concat(Uf,` {
71
+ margin-right: `).concat(d,"px ").concat(s,`;
72
+ }
73
+
74
+ .`).concat(Bf," .").concat(Bf,` {
75
+ right: 0 `).concat(s,`;
76
+ }
77
+
78
+ .`).concat(Uf," .").concat(Uf,` {
79
+ margin-right: 0 `).concat(s,`;
80
+ }
81
+
82
+ body[`).concat(il,`] {
83
+ `).concat(CB,": ").concat(d,`px;
84
+ }
85
+ `)},Wj=function(){var e=parseInt(document.body.getAttribute(il)||"0",10);return isFinite(e)?e:0},VB=function(){p.useEffect(function(){return document.body.setAttribute(il,(Wj()+1).toString()),function(){var e=Wj()-1;e<=0?document.body.removeAttribute(il):document.body.setAttribute(il,e.toString())}},[])},qB=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,o=s===void 0?"margin":s;VB();var l=p.useMemo(function(){return FB(o)},[o]);return p.createElement(BB,{styles:UB(l,!t,o,n?"":"!important")})},tx=!1;if(typeof window<"u")try{var _f=Object.defineProperty({},"passive",{get:function(){return tx=!0,!0}});window.addEventListener("test",_f,_f),window.removeEventListener("test",_f,_f)}catch{tx=!1}var Fi=tx?{passive:!1}:!1,HB=function(e){return e.tagName==="TEXTAREA"},g_=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!HB(e)&&n[t]==="visible")},YB=function(e){return g_(e,"overflowY")},WB=function(e){return g_(e,"overflowX")},Gj=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var o=v_(e,s);if(o){var l=x_(e,s),u=l[1],d=l[2];if(u>d)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},GB=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},ZB=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},v_=function(e,t){return e==="v"?YB(t):WB(t)},x_=function(e,t){return e==="v"?GB(t):ZB(t)},QB=function(e,t){return e==="h"&&t==="rtl"?-1:1},KB=function(e,t,n,s,o){var l=QB(e,window.getComputedStyle(t).direction),u=l*s,d=n.target,h=t.contains(d),m=!1,v=u>0,g=0,y=0;do{if(!d)break;var w=x_(e,d),S=w[0],j=w[1],N=w[2],C=j-N-l*S;(S||C)&&v_(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},Ef=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Zj=function(e){return[e.deltaX,e.deltaY]},Qj=function(e){return e&&"current"in e?e.current:e},XB=function(e,t){return e[0]===t[0]&&e[1]===t[1]},JB=function(e){return`
86
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
87
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
88
+ `)},eU=0,Bi=[];function tU(e){var t=p.useRef([]),n=p.useRef([0,0]),s=p.useRef(),o=p.useState(eU++)[0],l=p.useState(p_)[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=SB([e.lockRef.current],(e.shards||[]).map(Qj),!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=Ef(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=Gj(T,R);if(!B)return!0;if(B?A=T:(A=T==="v"?"h":"v",B=Gj(T,R)),!B)return!1;if(!s.current&&"changedTouches"in j&&(E||M)&&(s.current=A),!A)return!0;var q=s.current||A;return KB(q,N,j,q==="h"?E:M)},[]),h=p.useCallback(function(j){var N=j;if(!(!Bi.length||Bi[Bi.length-1]!==l)){var C="deltaY"in N?Zj(N):Ef(N),_=t.current.filter(function(A){return A.name===N.type&&(A.target===N.target||N.target===A.shadowParent)&&XB(A.delta,C)})[0];if(_&&_.should){N.cancelable&&N.preventDefault();return}if(!_){var E=(u.current.shards||[]).map(Qj).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:nU(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=Ef(j),s.current=void 0},[]),g=p.useCallback(function(j){m(j.type,Zj(j),j.target,d(j,e.lockRef.current))},[]),y=p.useCallback(function(j){m(j.type,Ef(j),j.target,d(j,e.lockRef.current))},[]);p.useEffect(function(){return Bi.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",h,Fi),document.addEventListener("touchmove",h,Fi),document.addEventListener("touchstart",v,Fi),function(){Bi=Bi.filter(function(j){return j!==l}),document.removeEventListener("wheel",h,Fi),document.removeEventListener("touchmove",h,Fi),document.removeEventListener("touchstart",v,Fi)}},[]);var w=e.removeScrollBar,S=e.inert;return p.createElement(p.Fragment,null,S?p.createElement(l,{styles:JB(o)}):null,w?p.createElement(qB,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function nU(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const rU=RB(m_,tU);var Iu=p.forwardRef(function(e,t){return p.createElement(Fh,ys({},e,{ref:t,sideCar:rU}))});Iu.classNames=Fh.classNames;var sU=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ui=new WeakMap,Tf=new WeakMap,Mf={},mv=0,y_=function(e){return e&&(e.host||y_(e.parentNode))},aU=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=y_(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},oU=function(e,t,n,s){var o=aU(t,Array.isArray(e)?e:[e]);Mf[n]||(Mf[n]=new WeakMap);var l=Mf[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(s),S=w!==null&&w!=="false",j=(Ui.get(y)||0)+1,N=(l.get(y)||0)+1;Ui.set(y,j),l.set(y,N),u.push(y),j===1&&S&&Tf.set(y,!0),N===1&&y.setAttribute(n,"true"),S||y.setAttribute(s,"true")}catch(C){console.error("aria-hidden: cannot operate on ",y,C)}})};return v(t),d.clear(),mv++,function(){u.forEach(function(g){var y=Ui.get(g)-1,w=l.get(g)-1;Ui.set(g,y),l.set(g,w),y||(Tf.has(g)||g.removeAttribute(s),Tf.delete(g)),w||g.removeAttribute(n)}),mv--,mv||(Ui=new WeakMap,Ui=new WeakMap,Tf=new WeakMap,Mf={})}},Bh=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),o=sU(e);return o?(s.push.apply(s,Array.from(o.querySelectorAll("[aria-live], script"))),oU(s,o,n,"aria-hidden")):function(){return null}},Uh="Dialog",[b_,w_]=Dn(Uh),[iU,ls]=b_(Uh),S_=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:o,onOpenChange:l,modal:u=!0}=e,d=p.useRef(null),h=p.useRef(null),[m,v]=rr({prop:s,defaultProp:o??!1,onChange:l,caller:Uh});return i.jsx(iU,{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})};S_.displayName=Uh;var j_="DialogTrigger",C_=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=ls(j_,n),l=Ze(t,o.triggerRef);return i.jsx(ze.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":ky(o.open),...s,ref:l,onClick:Se(e.onClick,o.onOpenToggle)})});C_.displayName=j_;var Cy="DialogPortal",[lU,N_]=b_(Cy,{forceMount:void 0}),k_=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:o}=e,l=ls(Cy,t);return i.jsx(lU,{scope:t,forceMount:n,children:p.Children.map(s,u=>i.jsx(yn,{present:n||l.open,children:i.jsx(Il,{asChild:!0,container:o,children:u})}))})};k_.displayName=Cy;var ph="DialogOverlay",__=p.forwardRef((e,t)=>{const n=N_(ph,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,l=ls(ph,e.__scopeDialog);return l.modal?i.jsx(yn,{present:s||l.open,children:i.jsx(uU,{...o,ref:t})}):null});__.displayName=ph;var cU=$o("DialogOverlay.RemoveScroll"),uU=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=ls(ph,n);return i.jsx(Iu,{as:cU,allowPinchZoom:!0,shards:[o.contentRef],children:i.jsx(ze.div,{"data-state":ky(o.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),Fo="DialogContent",E_=p.forwardRef((e,t)=>{const n=N_(Fo,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,l=ls(Fo,e.__scopeDialog);return i.jsx(yn,{present:s||l.open,children:l.modal?i.jsx(dU,{...o,ref:t}):i.jsx(fU,{...o,ref:t})})});E_.displayName=Fo;var dU=p.forwardRef((e,t)=>{const n=ls(Fo,e.__scopeDialog),s=p.useRef(null),o=Ze(t,n.contentRef,s);return p.useEffect(()=>{const l=s.current;if(l)return Bh(l)},[]),i.jsx(T_,{...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())})}),fU=p.forwardRef((e,t)=>{const n=ls(Fo,e.__scopeDialog),s=p.useRef(!1),o=p.useRef(!1);return i.jsx(T_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(s.current||n.triggerRef.current?.focus(),l.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(s.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()}})}),T_=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:l,...u}=e,d=ls(Fo,n),h=p.useRef(null),m=Ze(t,h);return $h(),i.jsxs(i.Fragment,{children:[i.jsx(Lu,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:l,children:i.jsx(Ll,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":ky(d.open),...u,ref:m,onDismiss:()=>d.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(mU,{titleId:d.titleId}),i.jsx(gU,{contentRef:h,descriptionId:d.descriptionId})]})]})}),Ny="DialogTitle",M_=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=ls(Ny,n);return i.jsx(ze.h2,{id:o.titleId,...s,ref:t})});M_.displayName=Ny;var R_="DialogDescription",A_=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=ls(R_,n);return i.jsx(ze.p,{id:o.descriptionId,...s,ref:t})});A_.displayName=R_;var O_="DialogClose",D_=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=ls(O_,n);return i.jsx(ze.button,{type:"button",...s,ref:t,onClick:Se(e.onClick,()=>o.onOpenChange(!1))})});D_.displayName=O_;function ky(e){return e?"open":"closed"}var z_="DialogTitleWarning",[hU,P_]=FF(z_,{contentName:Fo,titleName:Ny,docsSlug:"dialog"}),mU=({titleId:e})=>{const t=P_(z_),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},pU="DialogDescriptionWarning",gU=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${P_(pU).contentName}}.`;return p.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},$u=S_,vU=C_,Fu=k_,Bu=__,Uu=E_,Vh=M_,_y=A_,qh=D_;function L_({...e}){return i.jsx($u,{"data-slot":"sheet",...e})}function xU({...e}){return i.jsx(Fu,{"data-slot":"sheet-portal",...e})}function yU({className:e,...t}){return i.jsx(Bu,{"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 I_({className:e,children:t,side:n="right",...s}){return i.jsxs(xU,{children:[i.jsx(yU,{}),i.jsxs(Uu,{"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),...s,children:[t,i.jsxs(qh,{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 bU({className:e,...t}){return i.jsx("div",{"data-slot":"sheet-header",className:W("flex flex-col gap-1.5 p-4",e),...t})}function $_({className:e,...t}){return i.jsx(Vh,{"data-slot":"sheet-title",className:W("text-foreground font-semibold",e),...t})}function wU({className:e,...t}){return i.jsx(_y,{"data-slot":"sheet-description",className:W("text-muted-foreground text-sm",e),...t})}const SU=["top","right","bottom","left"],Wa=Math.min,vr=Math.max,gh=Math.round,Rf=Math.floor,Ns=e=>({x:e,y:e}),jU={left:"right",right:"left",bottom:"top",top:"bottom"},CU={start:"end",end:"start"};function nx(e,t,n){return vr(e,Wa(t,n))}function da(e,t){return typeof e=="function"?e(t):e}function fa(e){return e.split("-")[0]}function $l(e){return e.split("-")[1]}function Ey(e){return e==="x"?"y":"x"}function Ty(e){return e==="y"?"height":"width"}const NU=new Set(["top","bottom"]);function js(e){return NU.has(fa(e))?"y":"x"}function My(e){return Ey(js(e))}function kU(e,t,n){n===void 0&&(n=!1);const s=$l(e),o=My(e),l=Ty(o);let u=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=vh(u)),[u,vh(u)]}function _U(e){const t=vh(e);return[rx(e),t,rx(t)]}function rx(e){return e.replace(/start|end/g,t=>CU[t])}const Kj=["left","right"],Xj=["right","left"],EU=["top","bottom"],TU=["bottom","top"];function MU(e,t,n){switch(e){case"top":case"bottom":return n?t?Xj:Kj:t?Kj:Xj;case"left":case"right":return t?EU:TU;default:return[]}}function RU(e,t,n,s){const o=$l(e);let l=MU(fa(e),n==="start",s);return o&&(l=l.map(u=>u+"-"+o),t&&(l=l.concat(l.map(rx)))),l}function vh(e){return e.replace(/left|right|bottom|top/g,t=>jU[t])}function AU(e){return{top:0,right:0,bottom:0,left:0,...e}}function F_(e){return typeof e!="number"?AU(e):{top:e,right:e,bottom:e,left:e}}function xh(e){const{x:t,y:n,width:s,height:o}=e;return{width:s,height:o,top:n,left:t,right:t+s,bottom:n+o,x:t,y:n}}function Jj(e,t,n){let{reference:s,floating:o}=e;const l=js(t),u=My(t),d=Ty(u),h=fa(t),m=l==="y",v=s.x+s.width/2-o.width/2,g=s.y+s.height/2-o.height/2,y=s[d]/2-o[d]/2;let w;switch(h){case"top":w={x:v,y:s.y-o.height};break;case"bottom":w={x:v,y:s.y+s.height};break;case"right":w={x:s.x+s.width,y:g};break;case"left":w={x:s.x-o.width,y:g};break;default:w={x:s.x,y:s.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 OU(e,t){var n;t===void 0&&(t={});const{x:s,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}=da(t,e),S=F_(w),N=d[y?g==="floating"?"reference":"floating":g],C=xh(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:s,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=xh(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 DU=async(e,t,n)=>{const{placement:s="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}=Jj(m,s,h),y=s,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:s,placement:y,strategy:o,middlewareData:w,rects:m,platform:{...u,detectOverflow:(j=u.detectOverflow)!=null?j:OU},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}=Jj(m,y,h)),N=-1)}return{x:v,y:g,placement:y,strategy:o,middlewareData:w}},zU=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:o,rects:l,platform:u,elements:d,middlewareData:h}=t,{element:m,padding:v=0}=da(e,t)||{};if(m==null)return{};const g=F_(v),y={x:n,y:s},w=My(o),S=Ty(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=Wa(g[C],D),B=Wa(g[_],D),q=z,Y=T-j[S]-B,G=T/2-j[S]/2+O,ae=nx(q,G,Y),L=!h.arrow&&$l(o)!=null&&G!==ae&&l.reference[S]/2-(G<q?z:B)-j[S]/2<0,$=L?G<q?G-q:G-Y:0;return{[w]:y[w]+$,data:{[w]:ae,centerOffset:G-ae-$,...L&&{alignmentOffset:$}},reset:L}}}),PU=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;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}=da(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const C=fa(o),_=js(d),E=fa(d)===d,M=await(h.isRTL==null?void 0:h.isRTL(m.floating)),A=y||(E||!j?[vh(d)]:_U(d)),R=S!=="none";!y&&R&&A.push(...RU(d,j,S,M));const T=[d,...A],O=await h.detectOverflow(t,N),D=[];let z=((s=l.flip)==null?void 0:s.overflows)||[];if(v&&D.push(O[C]),g){const G=kU(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,q;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=(q=z.filter($=>$.overflows[0]<=0).sort(($,U)=>$.overflows[1]-U.overflows[1])[0])==null?void 0:q.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 eC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function tC(e){return SU.some(t=>e[t]>=0)}const LU=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:o="referenceHidden",...l}=da(e,t);switch(o){case"referenceHidden":{const u=await s.detectOverflow(t,{...l,elementContext:"reference"}),d=eC(u,n.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:tC(d)}}}case"escaped":{const u=await s.detectOverflow(t,{...l,altBoundary:!0}),d=eC(u,n.floating);return{data:{escapedOffsets:d,escaped:tC(d)}}}default:return{}}}}},B_=new Set(["left","top"]);async function IU(e,t){const{placement:n,platform:s,elements:o}=e,l=await(s.isRTL==null?void 0:s.isRTL(o.floating)),u=fa(n),d=$l(n),h=js(n)==="y",m=B_.has(u)?-1:1,v=l&&h?-1:1,g=da(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 $U=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:o,y:l,placement:u,middlewareData:d}=t,h=await IU(t,e);return u===((n=d.offset)==null?void 0:n.placement)&&(s=d.arrow)!=null&&s.alignmentOffset?{}:{x:o+h.x,y:l+h.y,data:{...h,placement:u}}}}},FU=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,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}=da(e,t),v={x:n,y:s},g=await l.detectOverflow(t,m),y=js(fa(o)),w=Ey(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=nx(E,S,M)}if(d){const C=y==="y"?"top":"left",_=y==="y"?"bottom":"right",E=j+g[C],M=j-g[_];j=nx(E,j,M)}const N=h.fn({...t,[w]:S,[y]:j});return{...N,data:{x:N.x-n,y:N.y-s,enabled:{[w]:u,[y]:d}}}}}},BU=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:o,rects:l,middlewareData:u}=t,{offset:d=0,mainAxis:h=!0,crossAxis:m=!0}=da(e,t),v={x:n,y:s},g=js(o),y=Ey(g);let w=v[y],S=v[g];const j=da(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=B_.has(fa(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}}}},UU=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:o,rects:l,platform:u,elements:d}=t,{apply:h=()=>{},...m}=da(e,t),v=await u.detectOverflow(t,m),g=fa(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=Wa(j-v[N],_),A=Wa(S-v[C],E),R=!t.middlewareData.shift;let T=M,O=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=E),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(T=_),R&&!y){const z=vr(v.left,0),B=vr(v.right,0),q=vr(v.top,0),Y=vr(v.bottom,0);w?O=S-2*(z!==0||B!==0?z+B:vr(v.left,v.right)):T=j-2*(q!==0||Y!==0?q+Y:vr(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 Hh(){return typeof window<"u"}function Fl(e){return U_(e)?(e.nodeName||"").toLowerCase():"#document"}function wr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ms(e){var t;return(t=(U_(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function U_(e){return Hh()?e instanceof Node||e instanceof wr(e).Node:!1}function ss(e){return Hh()?e instanceof Element||e instanceof wr(e).Element:!1}function Es(e){return Hh()?e instanceof HTMLElement||e instanceof wr(e).HTMLElement:!1}function nC(e){return!Hh()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof wr(e).ShadowRoot}const VU=new Set(["inline","contents"]);function Vu(e){const{overflow:t,overflowX:n,overflowY:s,display:o}=as(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!VU.has(o)}const qU=new Set(["table","td","th"]);function HU(e){return qU.has(Fl(e))}const YU=[":popover-open",":modal"];function Yh(e){return YU.some(t=>{try{return e.matches(t)}catch{return!1}})}const WU=["transform","translate","scale","rotate","perspective"],GU=["transform","translate","scale","rotate","perspective","filter"],ZU=["paint","layout","strict","content"];function Ry(e){const t=Ay(),n=ss(e)?as(e):e;return WU.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||GU.some(s=>(n.willChange||"").includes(s))||ZU.some(s=>(n.contain||"").includes(s))}function QU(e){let t=Ga(e);for(;Es(t)&&!vl(t);){if(Ry(t))return t;if(Yh(t))return null;t=Ga(t)}return null}function Ay(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const KU=new Set(["html","body","#document"]);function vl(e){return KU.has(Fl(e))}function as(e){return wr(e).getComputedStyle(e)}function Wh(e){return ss(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ga(e){if(Fl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||nC(e)&&e.host||Ms(e);return nC(t)?t.host:t}function V_(e){const t=Ga(e);return vl(t)?e.ownerDocument?e.ownerDocument.body:e.body:Es(t)&&Vu(t)?t:V_(t)}function wu(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=V_(e),l=o===((s=e.ownerDocument)==null?void 0:s.body),u=wr(o);if(l){const d=sx(u);return t.concat(u,u.visualViewport||[],Vu(o)?o:[],d&&n?wu(d):[])}return t.concat(o,wu(o,[],n))}function sx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function q_(e){const t=as(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=Es(e),l=o?e.offsetWidth:n,u=o?e.offsetHeight:s,d=gh(n)!==l||gh(s)!==u;return d&&(n=l,s=u),{width:n,height:s,$:d}}function Oy(e){return ss(e)?e:e.contextElement}function ll(e){const t=Oy(e);if(!Es(t))return Ns(1);const n=t.getBoundingClientRect(),{width:s,height:o,$:l}=q_(t);let u=(l?gh(n.width):n.width)/s,d=(l?gh(n.height):n.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const XU=Ns(0);function H_(e){const t=wr(e);return!Ay()||!t.visualViewport?XU:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function JU(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==wr(e)?!1:t}function Bo(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),l=Oy(e);let u=Ns(1);t&&(s?ss(s)&&(u=ll(s)):u=ll(e));const d=JU(l,n,s)?H_(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=wr(l),w=s&&ss(s)?wr(s):s;let S=y,j=sx(S);for(;j&&s&&w!==S;){const N=ll(j),C=j.getBoundingClientRect(),_=as(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=wr(j),j=sx(S)}}return xh({width:v,height:g,x:h,y:m})}function Gh(e,t){const n=Wh(e).scrollLeft;return t?t.left+n:Bo(Ms(e)).left+n}function Y_(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Gh(e,n),o=n.top+t.scrollTop;return{x:s,y:o}}function e9(e){let{elements:t,rect:n,offsetParent:s,strategy:o}=e;const l=o==="fixed",u=Ms(s),d=t?Yh(t.floating):!1;if(s===u||d&&l)return n;let h={scrollLeft:0,scrollTop:0},m=Ns(1);const v=Ns(0),g=Es(s);if((g||!g&&!l)&&((Fl(s)!=="body"||Vu(u))&&(h=Wh(s)),Es(s))){const w=Bo(s);m=ll(s),v.x=w.x+s.clientLeft,v.y=w.y+s.clientTop}const y=u&&!g&&!l?Y_(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 t9(e){return Array.from(e.getClientRects())}function n9(e){const t=Ms(e),n=Wh(e),s=e.ownerDocument.body,o=vr(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=vr(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let u=-n.scrollLeft+Gh(e);const d=-n.scrollTop;return as(s).direction==="rtl"&&(u+=vr(t.clientWidth,s.clientWidth)-o),{width:o,height:l,x:u,y:d}}const rC=25;function r9(e,t){const n=wr(e),s=Ms(e),o=n.visualViewport;let l=s.clientWidth,u=s.clientHeight,d=0,h=0;if(o){l=o.width,u=o.height;const v=Ay();(!v||v&&t==="fixed")&&(d=o.offsetLeft,h=o.offsetTop)}const m=Gh(s);if(m<=0){const v=s.ownerDocument,g=v.body,y=getComputedStyle(g),w=v.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,S=Math.abs(s.clientWidth-g.clientWidth-w);S<=rC&&(l-=S)}else m<=rC&&(l+=m);return{width:l,height:u,x:d,y:h}}const s9=new Set(["absolute","fixed"]);function a9(e,t){const n=Bo(e,!0,t==="fixed"),s=n.top+e.clientTop,o=n.left+e.clientLeft,l=Es(e)?ll(e):Ns(1),u=e.clientWidth*l.x,d=e.clientHeight*l.y,h=o*l.x,m=s*l.y;return{width:u,height:d,x:h,y:m}}function sC(e,t,n){let s;if(t==="viewport")s=r9(e,n);else if(t==="document")s=n9(Ms(e));else if(ss(t))s=a9(t,n);else{const o=H_(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return xh(s)}function W_(e,t){const n=Ga(e);return n===t||!ss(n)||vl(n)?!1:as(n).position==="fixed"||W_(n,t)}function o9(e,t){const n=t.get(e);if(n)return n;let s=wu(e,[],!1).filter(d=>ss(d)&&Fl(d)!=="body"),o=null;const l=as(e).position==="fixed";let u=l?Ga(e):e;for(;ss(u)&&!vl(u);){const d=as(u),h=Ry(u);!h&&d.position==="fixed"&&(o=null),(l?!h&&!o:!h&&d.position==="static"&&!!o&&s9.has(o.position)||Vu(u)&&!h&&W_(e,u))?s=s.filter(v=>v!==u):o=d,u=Ga(u)}return t.set(e,s),s}function i9(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const u=[...n==="clippingAncestors"?Yh(t)?[]:o9(t,this._c):[].concat(n),s],d=u[0],h=u.reduce((m,v)=>{const g=sC(t,v,o);return m.top=vr(g.top,m.top),m.right=Wa(g.right,m.right),m.bottom=Wa(g.bottom,m.bottom),m.left=vr(g.left,m.left),m},sC(t,d,o));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function l9(e){const{width:t,height:n}=q_(e);return{width:t,height:n}}function c9(e,t,n){const s=Es(t),o=Ms(t),l=n==="fixed",u=Bo(e,!0,l,t);let d={scrollLeft:0,scrollTop:0};const h=Ns(0);function m(){h.x=Gh(o)}if(s||!s&&!l)if((Fl(t)!=="body"||Vu(o))&&(d=Wh(t)),s){const w=Bo(t,!0,l,t);h.x=w.x+t.clientLeft,h.y=w.y+t.clientTop}else o&&m();l&&!s&&o&&m();const v=o&&!s&&!l?Y_(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 pv(e){return as(e).position==="static"}function aC(e,t){if(!Es(e)||as(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ms(e)===n&&(n=n.ownerDocument.body),n}function G_(e,t){const n=wr(e);if(Yh(e))return n;if(!Es(e)){let o=Ga(e);for(;o&&!vl(o);){if(ss(o)&&!pv(o))return o;o=Ga(o)}return n}let s=aC(e,t);for(;s&&HU(s)&&pv(s);)s=aC(s,t);return s&&vl(s)&&pv(s)&&!Ry(s)?n:s||QU(e)||n}const u9=async function(e){const t=this.getOffsetParent||G_,n=this.getDimensions,s=await n(e.floating);return{reference:c9(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function d9(e){return as(e).direction==="rtl"}const f9={convertOffsetParentRelativeRectToViewportRelativeRect:e9,getDocumentElement:Ms,getClippingRect:i9,getOffsetParent:G_,getElementRects:u9,getClientRects:t9,getDimensions:l9,getScale:ll,isElement:ss,isRTL:d9};function Z_(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function h9(e,t){let n=null,s;const o=Ms(e);function l(){var d;clearTimeout(s),(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=Rf(g),j=Rf(o.clientWidth-(v+y)),N=Rf(o.clientHeight-(g+w)),C=Rf(v),E={rootMargin:-S+"px "+-j+"px "+-N+"px "+-C+"px",threshold:vr(0,Wa(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):s=setTimeout(()=>{u(!1,1e-7)},1e3)}T===1&&!Z_(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 m9(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:h=!1}=s,m=Oy(e),v=o||l?[...m?wu(m):[],...wu(t)]:[];v.forEach(C=>{o&&C.addEventListener("scroll",n,{passive:!0}),l&&C.addEventListener("resize",n)});const g=m&&d?h9(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?Bo(e):null;h&&N();function N(){const C=Bo(e);j&&!Z_(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 p9=$U,g9=FU,v9=PU,x9=UU,y9=LU,oC=zU,b9=BU,w9=(e,t,n)=>{const s=new Map,o={platform:f9,...n},l={...o.platform,_c:s};return DU(e,t,{...o,platform:l})};var S9=typeof document<"u",j9=function(){},Vf=S9?p.useLayoutEffect:j9;function yh(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,s,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!yh(e[s],t[s]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,o[s]))return!1;for(s=n;s--!==0;){const l=o[s];if(!(l==="_owner"&&e.$$typeof)&&!yh(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function Q_(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function iC(e,t){const n=Q_(e);return Math.round(t*n)/n}function gv(e){const t=p.useRef(e);return Vf(()=>{t.current=e}),t}function C9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],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(s);yh(y,s)||w(s);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=gv(h),B=gv(o),q=gv(m),Y=p.useCallback(()=>{if(!R.current||!T.current)return;const U={placement:t,strategy:n,middleware:y};B.current&&(U.platform=B.current),w9(R.current,T.current,U).then(H=>{const le={...H,isPositioned:q.current!==!1};G.current&&!yh(O.current,le)&&(O.current=le,Ml.flushSync(()=>{g(le)}))})},[y,t,n,B,q]);Vf(()=>{m===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,g(U=>({...U,isPositioned:!1})))},[m]);const G=p.useRef(!1);Vf(()=>(G.current=!0,()=>{G.current=!1}),[]),Vf(()=>{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=iC(L.floating,v.x),le=iC(L.floating,v.y);return d?{...U,transform:"translate("+H+"px, "+le+"px)",...Q_(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 N9=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:o}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?oC({element:s.current,padding:o}).fn(n):{}:s?oC({element:s,padding:o}).fn(n):{}}}},k9=(e,t)=>({...p9(e),options:[e,t]}),_9=(e,t)=>({...g9(e),options:[e,t]}),E9=(e,t)=>({...b9(e),options:[e,t]}),T9=(e,t)=>({...v9(e),options:[e,t]}),M9=(e,t)=>({...x9(e),options:[e,t]}),R9=(e,t)=>({...y9(e),options:[e,t]}),A9=(e,t)=>({...N9(e),options:[e,t]});var O9="Arrow",K_=p.forwardRef((e,t)=>{const{children:n,width:s=10,height:o=5,...l}=e;return i.jsx(ze.svg,{...l,ref:t,width:s,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});K_.displayName=O9;var D9=K_;function Dy(e){const[t,n]=p.useState(void 0);return Jt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=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 s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var zy="Popper",[X_,Ja]=Dn(zy),[z9,J_]=X_(zy),e2=e=>{const{__scopePopper:t,children:n}=e,[s,o]=p.useState(null);return i.jsx(z9,{scope:t,anchor:s,onAnchorChange:o,children:n})};e2.displayName=zy;var t2="PopperAnchor",n2=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...o}=e,l=J_(t2,n),u=p.useRef(null),d=Ze(t,u),h=p.useRef(null);return p.useEffect(()=>{const m=h.current;h.current=s?.current||u.current,m!==h.current&&l.onAnchorChange(h.current)}),s?null:i.jsx(ze.div,{...o,ref:d})});n2.displayName=t2;var Py="PopperContent",[P9,L9]=X_(Py),r2=p.forwardRef((e,t)=>{const{__scopePopper:n,side:s="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=J_(Py,n),[C,_]=p.useState(null),E=Ze(t,te=>_(te)),[M,A]=p.useState(null),R=Dy(M),T=R?.width??0,O=R?.height??0,D=s+(l!=="center"?"-"+l:""),z=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},B=Array.isArray(m)?m:[m],q=B.length>0,Y={padding:z,boundary:B.filter($9),altBoundary:q},{refs:G,floatingStyles:ae,placement:L,isPositioned:$,middlewareData:U}=C9({strategy:"fixed",placement:D,whileElementsMounted:(...te)=>m9(...te,{animationFrame:w==="always"}),elements:{reference:N.anchor},middleware:[k9({mainAxis:o+O,alignmentAxis:u}),h&&_9({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?E9():void 0,...Y}),h&&T9({...Y}),M9({...Y,apply:({elements:te,rects:ye,availableWidth:Ce,availableHeight:_e})=>{const{width:Re,height:ge}=ye.reference,Be=te.floating.style;Be.setProperty("--radix-popper-available-width",`${Ce}px`),Be.setProperty("--radix-popper-available-height",`${_e}px`),Be.setProperty("--radix-popper-anchor-width",`${Re}px`),Be.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),M&&A9({element:M,padding:d}),F9({arrowWidth:T,arrowHeight:O}),y&&R9({strategy:"referenceHidden",...Y})]}),[H,le]=o2(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(P9,{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"}})})})});r2.displayName=Py;var s2="PopperArrow",I9={top:"bottom",right:"left",bottom:"top",left:"right"},a2=p.forwardRef(function(t,n){const{__scopePopper:s,...o}=t,l=L9(s2,s),u=I9[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(D9,{...o,ref:n,style:{...o.style,display:"block"}})})});a2.displayName=s2;function $9(e){return e!==null}var F9=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:s,middlewareData:o}=t,u=o.arrow?.centerOffset!==0,d=u?0:e.arrowWidth,h=u?0:e.arrowHeight,[m,v]=o2(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=`${s.floating.height+h}px`):m==="right"?(S=`${-h}px`,j=u?g:`${w}px`):m==="left"&&(S=`${s.floating.width+h}px`,j=u?g:`${w}px`),{data:{x:S,y:j}}}});function o2(e){const[t,n="center"]=e.split("-");return[t,n]}var Zh=e2,qu=n2,Qh=r2,Kh=a2,i2=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"}),B9="VisuallyHidden",l2=p.forwardRef((e,t)=>i.jsx(ze.span,{...e,ref:t,style:{...i2,...e.style}}));l2.displayName=B9;var U9=l2,[Xh]=Dn("Tooltip",[Ja]),Jh=Ja(),c2="TooltipProvider",V9=700,ax="tooltip.open",[q9,Ly]=Xh(c2),u2=e=>{const{__scopeTooltip:t,delayDuration:n=V9,skipDelayDuration:s=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(q9,{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,s)},[s]),isPointerInTransitRef:d,onPointerInTransitChange:p.useCallback(m=>{d.current=m},[]),disableHoverableContent:o,children:l})};u2.displayName=c2;var Su="Tooltip",[H9,Hu]=Xh(Su),d2=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:o,onOpenChange:l,disableHoverableContent:u,delayDuration:d}=e,h=Ly(Su,e.__scopeTooltip),m=Jh(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,_]=rr({prop:s,defaultProp:o??!1,onChange:T=>{T?(h.onOpen(),document.dispatchEvent(new CustomEvent(ax))):h.onClose(),l?.(T)},caller:Su}),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(Zh,{...m,children:i.jsx(H9,{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})})};d2.displayName=Su;var ox="TooltipTrigger",f2=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=Hu(ox,n),l=Ly(ox,n),u=Jh(n),d=p.useRef(null),h=Ze(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(qu,{asChild:!0,...u,children:i.jsx(ze.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...s,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)})})});f2.displayName=ox;var Iy="TooltipPortal",[Y9,W9]=Xh(Iy,{forceMount:void 0}),h2=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:o}=e,l=Hu(Iy,t);return i.jsx(Y9,{scope:t,forceMount:n,children:i.jsx(yn,{present:n||l.open,children:i.jsx(Il,{asChild:!0,container:o,children:s})})})};h2.displayName=Iy;var xl="TooltipContent",m2=p.forwardRef((e,t)=>{const n=W9(xl,e.__scopeTooltip),{forceMount:s=n.forceMount,side:o="top",...l}=e,u=Hu(xl,e.__scopeTooltip);return i.jsx(yn,{present:s||u.open,children:u.disableHoverableContent?i.jsx(p2,{side:o,...l,ref:t}):i.jsx(G9,{side:o,...l,ref:t})})}),G9=p.forwardRef((e,t)=>{const n=Hu(xl,e.__scopeTooltip),s=Ly(xl,e.__scopeTooltip),o=p.useRef(null),l=Ze(t,o),[u,d]=p.useState(null),{trigger:h,onClose:m}=n,v=o.current,{onPointerInTransitChange:g}=s,y=p.useCallback(()=>{d(null),g(!1)},[g]),w=p.useCallback((S,j)=>{const N=S.currentTarget,C={x:S.clientX,y:S.clientY},_=X9(C,N.getBoundingClientRect()),E=J9(C,_),M=e7(j.getBoundingClientRect()),A=n7([...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=!t7(C,u);_?y():E&&(y(),m())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[h,v,u,m,y]),i.jsx(p2,{...e,ref:l})}),[Z9,Q9]=Xh(Su,{isInside:!1}),K9=Fk("TooltipContent"),p2=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":o,onEscapeKeyDown:l,onPointerDownOutside:u,...d}=e,h=Hu(xl,n),m=Jh(n),{onClose:v}=h;return p.useEffect(()=>(document.addEventListener(ax,v),()=>document.removeEventListener(ax,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(Qh,{"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(K9,{children:s}),i.jsx(Z9,{scope:n,isInside:!0,children:i.jsx(U9,{id:h.contentId,role:"tooltip",children:o||s})})]})})});m2.displayName=xl;var g2="TooltipArrow",v2=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=Jh(n);return Q9(g2,n).isInside?null:i.jsx(Kh,{...o,...s,ref:t})});v2.displayName=g2;function X9(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,s,o,l)){case l:return"left";case o:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function J9(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function e7(e){const{top:t,right:n,bottom:s,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:s},{x:o,y:s}]}function t7(e,t){const{x:n,y:s}=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>s!=y>s&&n<(g-m)*(s-v)/(y-v)+m&&(o=!o)}return o}function n7(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),r7(t)}function r7(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const o=e[s];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 s=e.length-1;s>=0;s--){const o=e[s];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 s7=u2,a7=d2,o7=f2,i7=h2,l7=m2,c7=v2;function x2({delayDuration:e=0,...t}){return i.jsx(s7,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function u7({...e}){return i.jsx(x2,{children:i.jsx(a7,{"data-slot":"tooltip",...e})})}function d7({...e}){return i.jsx(o7,{"data-slot":"tooltip-trigger",...e})}function f7({className:e,sideOffset:t=0,children:n,...s}){return i.jsx(i7,{children:i.jsxs(l7,{"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),...s,children:[n,i.jsx(c7,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const h7="sidebar_state",m7=3600*24*7,p7="16rem",g7="18rem",v7="3rem",x7="b",y2=p.createContext(null);function em(){const e=p.useContext(y2);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function y7({defaultOpen:e=!0,open:t,onOpenChange:n,className:s,style:o,children:l,...u}){const d=eB(),[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=`${h7}=${_}; path=/; max-age=${m7}`},[n,y]),S=p.useCallback(()=>d?m(C=>!C):w(C=>!C),[d,w,m]);p.useEffect(()=>{const C=_=>{_.key===x7&&(_.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(y2.Provider,{value:N,children:i.jsx(x2,{delayDuration:0,children:i.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":p7,"--sidebar-width-icon":v7,...o},className:W("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",s),...u,children:l})})})}function b7({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:s,children:o,...l}){const{isMobile:u,state:d,openMobile:h,setOpenMobile:m}=em();return n==="none"?i.jsx("div",{"data-slot":"sidebar",className:W("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",s),...l,children:o}):u?i.jsx(L_,{open:h,onOpenChange:m,...l,children:i.jsxs(I_,{"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":g7},side:e,children:[i.jsxs(bU,{className:"sr-only",children:[i.jsx($_,{children:"Sidebar"}),i.jsx(wU,{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",s),...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 w7({className:e,onClick:t,...n}){const{toggleSidebar:s}=em();return i.jsxs(tt,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:W("size-7",e),onClick:o=>{t?.(o),s()},...n,children:[i.jsx(e5,{}),i.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function S7({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 j7({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 C7({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 N7({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 lC({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 cC({className:e,asChild:t=!1,...n}){const s=t?Pl:"div";return i.jsx(s,{"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 uC({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 dC({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 k7=Zo("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 fC({asChild:e=!1,isActive:t=!1,variant:n="default",size:s="default",tooltip:o,className:l,...u}){const d=e?Pl:"button",{isMobile:h,state:m}=em(),v=i.jsx(d,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":s,"data-active":t,className:W(k7({variant:n,size:s}),l),...u});return o?(typeof o=="string"&&(o={children:o}),i.jsxs(u7,{children:[i.jsx(d7,{asChild:!0,children:v}),i.jsx(f7,{side:"right",align:"center",hidden:m!=="collapsed"||h,...o})]})):v}function _7({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 vv({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 xv({asChild:e=!1,size:t="md",isActive:n=!1,className:s,...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",s),...o})}function yl({...e}){return i.jsx($u,{"data-slot":"dialog",...e})}function E7({...e}){return i.jsx(Fu,{"data-slot":"dialog-portal",...e})}function T7({className:e,...t}){return i.jsx(Bu,{"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,...s}){return i.jsxs(E7,{"data-slot":"dialog-portal",children:[i.jsx(T7,{}),i.jsxs(Uu,{"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),...s,children:[t,n&&i.jsxs(qh,{"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 ju({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 Cu({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(Vh,{"data-slot":"dialog-title",className:W("text-lg leading-none font-semibold",e),...t})}function M7({className:e,...t}){return i.jsx(_y,{"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 hC={fast:"duration-100 ease-out"},R7={primary:"default",secondary:"secondary",danger:"destructive",ghost:"ghost",outline:"outline",link:"link",success:"default",warning:"default"},A7={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:s,className:o,asChild:l,...u}){const d=R7[e],h=A7[e];return l?i.jsx(tt,{variant:d,disabled:n||t,className:W(hC.fast,h,o),asChild:!0,...u,children:s}):i.jsxs(tt,{variant:d,disabled:n||t,className:W(hC.fast,h,o),...u,children:[t&&i.jsx(es,{"data-icon":"inline-start"}),s]})}const O7={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl"};function cs({open:e,onOpenChange:t,title:n,description:s,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",O7[u],d),children:[i.jsxs(ju,{className:"shrink-0",children:[i.jsx(wl,{children:n}),s&&i.jsx(M7,{children:s})]}),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(Cu,{className:"shrink-0 border-t pt-4",children:l})]})})}function sa({open:e,onOpenChange:t,title:n,description:s,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(cs,{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:s}),g&&i.jsx("p",{className:"text-sm text-destructive",children:g})]})})}var D7="Label",b2=p.forwardRef((e,t)=>i.jsx(ar.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));b2.displayName=D7;var z7=b2;function st({className:e,...t}){return i.jsx(z7,{"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 eo({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 $y(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 tm="Checkbox",[P7]=Dn(tm),[L7,Fy]=P7(tm);function I7(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:o,disabled:l,form:u,name:d,onCheckedChange:h,required:m,value:v="on",internal_do_not_use_render:g}=e,[y,w]=rr({prop:n,defaultProp:o??!1,onChange:h,caller:tm}),[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:qa(o)?!1:o,isFormControl:E,bubbleInput:N,setBubbleInput:C};return i.jsx(L7,{scope:t,...M,children:$7(g)?g(M):s})}var w2="CheckboxTrigger",S2=p.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},o)=>{const{control:l,value:u,disabled:d,checked:h,required:m,setControl:v,setChecked:g,hasConsumerStoppedPropagationRef:y,isFormControl:w,bubbleInput:S}=Fy(w2,e),j=Ze(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":qa(h)?"mixed":h,"aria-required":m,"data-state":E2(h),"data-disabled":d?"":void 0,disabled:d,value:u,...s,ref:j,onKeyDown:Se(t,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:Se(n,C=>{g(_=>qa(_)?!0:!_),S&&w&&(y.current=C.isPropagationStopped(),y.current||C.stopPropagation())})})});S2.displayName=w2;var j2=p.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:o,defaultChecked:l,required:u,disabled:d,value:h,onCheckedChange:m,form:v,...g}=e;return i.jsx(I7,{__scopeCheckbox:n,checked:o,defaultChecked:l,disabled:d,required:u,onCheckedChange:m,name:s,form:v,value:h,internal_do_not_use_render:({isFormControl:y})=>i.jsxs(i.Fragment,{children:[i.jsx(S2,{...g,ref:t,__scopeCheckbox:n}),y&&i.jsx(_2,{__scopeCheckbox:n})]})})});j2.displayName=tm;var C2="CheckboxIndicator",N2=p.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...o}=e,l=Fy(C2,n);return i.jsx(yn,{present:s||qa(l.checked)||l.checked===!0,children:i.jsx(ze.span,{"data-state":E2(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});N2.displayName=C2;var k2="CheckboxBubbleInput",_2=p.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:o,checked:l,defaultChecked:u,required:d,disabled:h,name:m,value:v,form:g,bubbleInput:y,setBubbleInput:w}=Fy(k2,e),S=Ze(n,w),j=$y(l),N=Dy(s);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=qa(l),A.call(_,qa(l)?!1:l),_.dispatchEvent(T)}},[y,j,l,o]);const C=p.useRef(qa(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%)"}})});_2.displayName=k2;function $7(e){return typeof e=="function"}function qa(e){return e==="indeterminate"}function E2(e){return qa(e)?"indeterminate":e?"checked":"unchecked"}function Sr({className:e,...t}){return i.jsx(j2,{"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(N2,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:i.jsx(Ts,{className:"size-3.5"})})})}function ix(e,[t,n]){return Math.min(n,Math.max(t,e))}function By(e){const t=e+"CollectionProvider",[n,s]=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=$o(d),m=ee.forwardRef((j,N)=>{const{scope:C,children:_}=j,E=l(d,C),M=Ze(N,E.collectionRef);return i.jsx(h,{ref:M,children:_})});m.displayName=d;const v=e+"CollectionItemSlot",g="data-radix-collection-item",y=$o(v),w=ee.forwardRef((j,N)=>{const{scope:C,children:_,...E}=j,M=ee.useRef(null),A=Ze(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,s]}var F7=p.createContext(void 0);function Bl(e){const t=p.useContext(F7);return e||t||"ltr"}var B7=[" ","Enter","ArrowUp","ArrowDown"],U7=[" ","Enter"],Uo="Select",[nm,rm,V7]=By(Uo),[Ul]=Dn(Uo,[V7,Ja]),sm=Ja(),[q7,to]=Ul(Uo),[H7,Y7]=Ul(Uo),T2=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:o,onOpenChange:l,value:u,defaultValue:d,onValueChange:h,dir:m,name:v,autoComplete:g,disabled:y,required:w,form:S}=e,j=sm(t),[N,C]=p.useState(null),[_,E]=p.useState(null),[M,A]=p.useState(!1),R=Bl(m),[T,O]=rr({prop:s,defaultProp:o??!1,onChange:l,caller:Uo}),[D,z]=rr({prop:u,defaultProp:d,onChange:h,caller:Uo}),B=p.useRef(null),q=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(Zh,{...j,children:i.jsxs(q7,{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(nm.Provider,{scope:t,children:i.jsx(H7,{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})}),q?i.jsxs(X2,{"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]})})};T2.displayName=Uo;var M2="SelectTrigger",R2=p.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...o}=e,l=sm(n),u=to(M2,n),d=u.disabled||s,h=Ze(t,u.onTriggerChange),m=rm(n),v=p.useRef("touch"),[g,y,w]=eE(j=>{const N=m().filter(E=>!E.disabled),C=N.find(E=>E.value===u.value),_=tE(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(qu,{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":J2(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===" ")&&B7.includes(j.key)&&(S(),j.preventDefault())})})})});R2.displayName=M2;var A2="SelectValue",O2=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:o,children:l,placeholder:u="",...d}=e,h=to(A2,n),{onValueNodeHasChildrenChange:m}=h,v=l!==void 0,g=Ze(t,h.onValueNodeChange);return Jt(()=>{m(v)},[m,v]),i.jsx(ze.span,{...d,ref:g,style:{pointerEvents:"none"},children:J2(h.value)?i.jsx(i.Fragment,{children:u}):l})});O2.displayName=A2;var W7="SelectIcon",D2=p.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...o}=e;return i.jsx(ze.span,{"aria-hidden":!0,...o,ref:t,children:s||"▼"})});D2.displayName=W7;var G7="SelectPortal",z2=e=>i.jsx(Il,{asChild:!0,...e});z2.displayName=G7;var Vo="SelectContent",P2=p.forwardRef((e,t)=>{const n=to(Vo,e.__scopeSelect),[s,o]=p.useState();if(Jt(()=>{o(new DocumentFragment)},[]),!n.open){const l=s;return l?Ml.createPortal(i.jsx(L2,{scope:e.__scopeSelect,children:i.jsx(nm.Slot,{scope:e.__scopeSelect,children:i.jsx("div",{children:e.children})})}),l):null}return i.jsx(I2,{...e,ref:t})});P2.displayName=Vo;var Jr=10,[L2,no]=Ul(Vo),Z7="SelectContentImpl",Q7=$o("SelectContent.RemoveScroll"),I2=p.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="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,_=to(Vo,n),[E,M]=p.useState(null),[A,R]=p.useState(null),T=Ze(t,te=>M(te)),[O,D]=p.useState(null),[z,B]=p.useState(null),q=rm(n),[Y,G]=p.useState(!1),ae=p.useRef(!1);p.useEffect(()=>{if(E)return Bh(E)},[E]),$h();const L=p.useCallback(te=>{const[ye,...Ce]=q().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},[q,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]=eE(te=>{const ye=q().filter(Re=>!Re.disabled),Ce=ye.find(Re=>Re.ref.current===document.activeElement),_e=tE(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=s==="popper"?lx:$2,ue=X===lx?{side:d,sideOffset:h,align:m,alignOffset:v,arrowPadding:g,collisionBoundary:y,collisionPadding:w,sticky:S,hideWhenDetached:j,avoidCollisions:N}:{};return i.jsx(L2,{scope:n,content:E,viewport:A,onViewportChange:R,itemRefCallback:F,selectedItem:O,onItemLeave:K,itemTextRefCallback:ne,focusSelectedItem:$,selectedItemText:z,position:s,isPositioned:Y,searchRef:le,children:i.jsx(Iu,{as:Q7,allowPinchZoom:!0,children:i.jsx(Lu,{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=q().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()}})})})})})})});I2.displayName=Z7;var K7="SelectItemAlignedPosition",$2=p.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...o}=e,l=to(Vo,n),u=no(Vo,n),[d,h]=p.useState(null),[m,v]=p.useState(null),g=Ze(t,T=>v(T)),y=rm(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,Be=T.left-ge,be=T.width+Be,Ue=Math.max(be,O.width),rt=window.innerWidth-Jr,it=ix(ge,[Jr,Math.max(Jr,rt-Ue)]);d.style.minWidth=be+"px",d.style.left=it+"px"}else{const Re=O.right-z.right,ge=window.innerWidth-D.right-Re,Be=window.innerWidth-T.right-ge,be=T.width+Be,Ue=Math.max(be,O.width),rt=window.innerWidth-Jr,it=ix(ge,[Jr,Math.max(Jr,rt-Ue)]);d.style.minWidth=be+"px",d.style.right=it+"px"}const B=y(),q=window.innerHeight-Jr*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-Jr,X=q-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,Be=Math.max(X,ue+(Re?K:0)+ge+$),be=ye+Be;d.style.height=be+"px"}else{const Re=B.length>0&&N===B[0].ref.current;d.style.top="0px";const Be=Math.max(ne,ae+j.offsetTop+(Re?F:0)+ue)+Ce;d.style.height=Be+"px",j.scrollTop=ye-ne+j.offsetTop}d.style.margin=`${Jr}px 0`,d.style.minHeight=le+"px",d.style.maxHeight=q+"px",s?.(),requestAnimationFrame(()=>w.current=!0)}},[y,l.trigger,l.valueNode,d,m,j,N,C,l.dir,s]);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(J7,{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}})})})});$2.displayName=K7;var X7="SelectPopperPosition",lx=p.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:o=Jr,...l}=e,u=sm(n);return i.jsx(Qh,{...u,...l,ref:t,align:s,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)"}})});lx.displayName=X7;var[J7,Uy]=Ul(Vo,{}),cx="SelectViewport",F2=p.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...o}=e,l=no(cx,n),u=Uy(cx,n),d=Ze(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:s}),i.jsx(nm.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-Jr*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})})})]})});F2.displayName=cx;var B2="SelectGroup",[eV,tV]=Ul(B2),U2=p.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=gn();return i.jsx(eV,{scope:n,id:o,children:i.jsx(ze.div,{role:"group","aria-labelledby":o,...s,ref:t})})});U2.displayName=B2;var V2="SelectLabel",nV=p.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=tV(V2,n);return i.jsx(ze.div,{id:o.id,...s,ref:t})});nV.displayName=V2;var bh="SelectItem",[rV,q2]=Ul(bh),H2=p.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:o=!1,textValue:l,...u}=e,d=to(bh,n),h=no(bh,n),m=d.value===s,[v,g]=p.useState(l??""),[y,w]=p.useState(!1),S=Ze(t,_=>h.itemRefCallback?.(_,s,o)),j=gn(),N=p.useRef("touch"),C=()=>{o||(d.onValueChange(s),d.onOpenChange(!1))};if(s==="")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(rV,{scope:n,value:s,disabled:o,textId:j,isSelected:m,onItemTextChange:p.useCallback(_=>{g(E=>E||(_?.textContent??"").trim())},[]),children:i.jsx(nm.ItemSlot,{scope:n,value:s,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===" "||(U7.includes(_.key)&&C(),_.key===" "&&_.preventDefault())})})})})});H2.displayName=bh;var Kc="SelectItemText",Y2=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:o,...l}=e,u=to(Kc,n),d=no(Kc,n),h=q2(Kc,n),m=Y7(Kc,n),[v,g]=p.useState(null),y=Ze(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]})});Y2.displayName=Kc;var W2="SelectItemIndicator",G2=p.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return q2(W2,n).isSelected?i.jsx(ze.span,{"aria-hidden":!0,...s,ref:t}):null});G2.displayName=W2;var ux="SelectScrollUpButton",Z2=p.forwardRef((e,t)=>{const n=no(ux,e.__scopeSelect),s=Uy(ux,e.__scopeSelect),[o,l]=p.useState(!1),u=Ze(t,s.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(K2,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=n;d&&h&&(d.scrollTop=d.scrollTop-h.offsetHeight)}}):null});Z2.displayName=ux;var dx="SelectScrollDownButton",Q2=p.forwardRef((e,t)=>{const n=no(dx,e.__scopeSelect),s=Uy(dx,e.__scopeSelect),[o,l]=p.useState(!1),u=Ze(t,s.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(K2,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=n;d&&h&&(d.scrollTop=d.scrollTop+h.offsetHeight)}}):null});Q2.displayName=dx;var K2=p.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...o}=e,l=no("SelectScrollButton",n),u=p.useRef(null),d=rm(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(s,50))}),onPointerMove:Se(o.onPointerMove,()=>{l.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(s,50))}),onPointerLeave:Se(o.onPointerLeave,()=>{h()})})}),sV="SelectSeparator",aV=p.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return i.jsx(ze.div,{"aria-hidden":!0,...s,ref:t})});aV.displayName=sV;var fx="SelectArrow",oV=p.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=sm(n),l=to(fx,n),u=no(fx,n);return l.open&&u.position==="popper"?i.jsx(Kh,{...o,...s,ref:t}):null});oV.displayName=fx;var iV="SelectBubbleInput",X2=p.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const o=p.useRef(null),l=Ze(s,o),u=$y(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:{...i2,...n.style},ref:l,defaultValue:t})});X2.displayName=iV;function J2(e){return e===""||e===void 0}function eE(e){const t=Nn(e),n=p.useRef(""),s=p.useRef(0),o=p.useCallback(u=>{const d=n.current+u;t(d),(function h(m){n.current=m,window.clearTimeout(s.current),m!==""&&(s.current=window.setTimeout(()=>h(""),1e3))})(d)},[t]),l=p.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,o,l]}function tE(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=lV(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 lV(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var cV=T2,uV=R2,dV=O2,fV=D2,hV=z2,mV=P2,pV=F2,gV=U2,vV=H2,xV=Y2,yV=G2,bV=Z2,wV=Q2;function aa({...e}){return i.jsx(cV,{"data-slot":"select",...e})}function nE({...e}){return i.jsx(gV,{"data-slot":"select-group",...e})}function oa({...e}){return i.jsx(dV,{"data-slot":"select-value",...e})}function ia({className:e,size:t="default",children:n,...s}){return i.jsxs(uV,{"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),...s,children:[n,i.jsx(fV,{asChild:!0,children:i.jsx(vn,{className:"size-4 opacity-50"})})]})}function la({className:e,children:t,position:n="item-aligned",align:s="center",...o}){return i.jsx(hV,{children:i.jsxs(mV,{"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:s,...o,children:[i.jsx(SV,{}),i.jsx(pV,{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(jV,{})]})})}function Xt({className:e,children:t,...n}){return i.jsxs(vV,{"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(yV,{children:i.jsx(Ts,{className:"size-4"})})}),i.jsx(xV,{children:t})]})}function SV({className:e,...t}){return i.jsx(bV,{"data-slot":"select-scroll-up-button",className:W("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(zu,{className:"size-4"})})}function jV({className:e,...t}){return i.jsx(wV,{"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 CV({isOpen:e,onClose:t,breakingChanges:n,onForceUpdate:s,onCancel:o,isLoading:l}){const u=()=>{o(),t()};return i.jsx(cs,{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:s,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(Io,{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 yv={text:{label:"Text",icon:i.jsx(ny,{className:"size-4"}),description:"Single line text input"},richText:{label:"Rich Text",icon:i.jsx(oh,{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(rs,{className:"size-4"}),description:"Image, video, or file"},json:{label:"JSON",icon:i.jsx(qx,{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(Do,{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(qN,{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 mC(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s]/g,"").replace(/\s+/g,"_").replace(/^[0-9]/,"_$&").slice(0,64)}function pC(e){return/^[a-z][a-z0-9_]{0,63}$/.test(e)}function rE({isOpen:e,onClose:t,onCreated:n,onUpdated:s,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),[q,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=Ke(F.createContentType),ne=Ke(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(mC(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(We=>We.filter((Oe,ft)=>ft!==pe)),M===Le.name){const We=_.find((Oe,ft)=>ft!==pe&&Oe.type==="text");A(We?.name||"")}if(R===Le.name){const We=_.find((Oe,ft)=>ft!==pe&&Oe.type==="text");T(We?.name||"")}q===pe?(Y(null),ae(!1)):q!==null&&q>pe&&Y(q-1)},[_,q,M,R]),_e=p.useCallback((pe,Le)=>{E(We=>We.map((Oe,ft)=>ft===pe?{...Oe,...Le}:Oe))},[]),Re=p.useCallback((pe,Le)=>{E(We=>{const Oe=[...We],[ft]=Oe.splice(pe,1);return Oe.splice(Le,0,ft),Oe}),Y(Le)},[]),ge=p.useMemo(()=>{const pe=[];h.trim()||pe.push("Display name is required"),v.trim()?pC(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),We=Le.filter((Oe,ft)=>Le.indexOf(Oe)!==ft);We.length>0&&pe.push(`Duplicate field names: ${[...new Set(We)].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,_]),Be=p.useMemo(()=>_.filter(pe=>pe.type==="text"),[_]),be=pe=>pe.split(`
93
+ `).filter(We=>We.trim().startsWith("-")).map(We=>We.trim().substring(2)),Ue=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 We=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});s?.(We),X(),t()}else{const We=await K({name:v,displayName:h.trim(),description:S.trim()||void 0,fields:_,singleton:N,titleField:M||void 0,slugField:R||void 0});n?.(We),X(),t()}}catch(We){const Oe=We instanceof Error?We.message:l?"Failed to update content type":"Failed to create content type";if(l&&!Le&&Oe.includes("breaking change")){const ft=be(Oe);$(ft),H(!0)}else B(Oe)}finally{D(!1)}},[ge,l,o,K,ne,v,h,S,_,N,M,R,n,s,X,t]),rt=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});s?.(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,s,X,t]),it=p.useCallback(()=>{O||(X(),t())},[O,X,t]);if(!e)return null;const bt=q!==null?_[q]:null;return i.jsxs(i.Fragment,{children:[i.jsx(cs,{open:e,onOpenChange:pe=>!pe&&it(),title:u?"View Content Type":l?"Edit Content Type":"Create Content Type",size:"2xl",footer:d?i.jsx(me,{variant:"outline",onClick:it,children:"Close"}):i.jsxs(i.Fragment,{children:[i.jsx(me,{variant:"outline",onClick:it,disabled:O,children:"Cancel"}),i.jsx(me,{variant:"primary",onClick:Ue,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:Ue,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(Gv,{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(st,{htmlFor:"displayName",children:["Display Name ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(pt,{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(st,{htmlFor:"machineName",children:["System Name ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(pt,{id:"machineName",value:v,onChange:pe=>te(pe.target.value),placeholder:"e.g., blog_post",disabled:O||l||d,className:W(!pC(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(st,{htmlFor:"description",children:"Description"}),i.jsx(eo,{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(Sr,{id:"singleton",checked:N,onCheckedChange:pe=>C(pe),disabled:O||d}),i.jsx(st,{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",q===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:We=>{We.stopPropagation(),Re(Le,Le-1)},className:"rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:i.jsx(zu,{className:"size-3"})}),Le<_.length-1&&i.jsx("button",{type:"button",onClick:We=>{We.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:yv[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:[yv[pe.type].label,pe.required&&" *"]})]}),!d&&i.jsx("button",{type:"button",onClick:We=>{We.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&&bt&&q!==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: ",bt.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(st,{htmlFor:"fieldLabel",children:["Label ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(pt,{id:"fieldLabel",value:bt.label,onChange:pe=>_e(q,{label:pe.target.value,name:y?bt.name:mC(pe.target.value)||bt.name}),disabled:O,"data-testid":"field-label-input"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs(st,{htmlFor:"fieldName",children:["Name ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(pt,{id:"fieldName",value:bt.name,onChange:pe=>_e(q,{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(st,{htmlFor:"fieldType",children:["Type ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsxs(aa,{value:bt.type,onValueChange:pe=>_e(q,{type:pe,options:void 0}),disabled:O,children:[i.jsx(ia,{"data-testid":"field-type-select",children:i.jsx(oa,{})}),i.jsx(la,{children:Object.entries(yv).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(Sr,{id:"fieldRequired",checked:bt.required,onCheckedChange:pe=>_e(q,{required:pe}),disabled:O}),i.jsx(st,{htmlFor:"fieldRequired",className:"cursor-pointer",children:"Required"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx(st,{htmlFor:"fieldDescription",children:"Help Text"}),i.jsx(pt,{id:"fieldDescription",value:bt.description||"",onChange:pe=>_e(q,{description:pe.target.value||void 0}),placeholder:"Help text shown below the field",disabled:O})]}),(bt.type==="select"||bt.type==="multiSelect")&&i.jsx(NV,{options:bt.options?.options||[],onChange:pe=>_e(q,{options:{...bt.options,options:pe}}),disabled:O})]})]})]}),Be.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(st,{htmlFor:"titleField",children:"Title Field"}),i.jsxs(aa,{value:M||"none",onValueChange:pe=>A(pe==="none"?"":pe),disabled:O,children:[i.jsx(ia,{children:i.jsx(oa,{placeholder:"None"})}),i.jsxs(la,{children:[i.jsx(Xt,{value:"none",children:"None"}),Be.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(st,{htmlFor:"slugField",children:"Slug Field"}),i.jsxs(aa,{value:R||"none",onValueChange:pe=>T(pe==="none"?"":pe),disabled:O,children:[i.jsx(ia,{children:i.jsx(oa,{placeholder:"None (auto-generate)"})}),i.jsxs(la,{children:[i.jsx(Xt,{value:"none",children:"None (auto-generate)"}),Be.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(CV,{isOpen:U,onClose:()=>H(!1),breakingChanges:L,onForceUpdate:rt,onCancel:()=>{H(!1),$([])},isLoading:le})]})}function NV({options:e,onChange:t,disabled:n}){const s=()=>{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(st,{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(pt,{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(pt,{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:s,disabled:n,children:[i.jsx(Un,{className:"size-3.5"}),"Add Option"]})]})}function kV(){const t=$n().location.pathname,n=Lh(),{navItems:s,branding:o}=n,l=xn(),{setOpenMobile:u,isMobile:d}=em(),[h,m]=p.useState(!1),v=Ye(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(dC,{children:i.jsx(fC,{asChild:!0,isActive:y(C.path,C.exact),onClick:S,children:i.jsxs(Ss,{to:C.path,children:[i.jsx(Tj,{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(wy,{defaultOpen:w,className:"group/collapsible",children:i.jsxs(dC,{children:[i.jsx(Sy,{asChild:!0,children:i.jsxs(fC,{isActive:w,children:[i.jsx(Tj,{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(jy,{children:i.jsxs(_7,{children:[i.jsx(vv,{children:i.jsx(xv,{asChild:!0,isActive:t==="/content",onClick:S,children:i.jsx(Ss,{to:"/content",children:"All Entries"})})}),g.map(_=>i.jsx(vv,{children:i.jsx(xv,{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(vv,{children:i.jsx(xv,{onClick:()=>m(!0),className:"text-sidebar-foreground/60",children:"+ Create content type"})})]})})]})},C.id);return i.jsxs(i.Fragment,{children:[i.jsxs(b7,{collapsible:"offcanvas",className:"bg-sidebar",children:[i.jsx(j7,{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(N7,{children:[s.main.length>0&&i.jsxs(lC,{children:[i.jsx(cC,{children:"Main"}),i.jsx(uC,{children:s.main.map(j)})]}),s.config.length>0&&i.jsxs(lC,{children:[i.jsx(cC,{children:"Configuration"}),i.jsx(uC,{children:s.config.map(j)})]})]}),i.jsx(C7,{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:J4})]})})]}),i.jsx(rE,{isOpen:h,onClose:()=>m(!1)})]})}Fe.union(Fe.literal("admin"),Fe.literal("editor"),Fe.literal("author"),Fe.literal("viewer"));const _V=Fe.union(Fe.literal("contentTypes"),Fe.literal("contentEntries"),Fe.literal("mediaItems"),Fe.literal("settings"),Fe.literal("users")),EV=Fe.union(Fe.literal("create"),Fe.literal("read"),Fe.literal("update"),Fe.literal("delete"),Fe.literal("publish"),Fe.literal("unpublish"),Fe.literal("restore"),Fe.literal("manage"),Fe.literal("move"));Fe.object({resource:_V,action:EV,scope:Fe.optional(Fe.union(Fe.literal("all"),Fe.literal("own")))});function tl(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 cl(e,t="all"){return[{resource:e,action:"read",scope:t}]}function sE(e="all"){return[{resource:"contentEntries",action:"publish",scope:e},{resource:"contentEntries",action:"unpublish",scope:e}]}const TV={name:"admin",displayName:"Administrator",description:"Full access to all CMS features including settings and content type management",isSystem:!0,permissions:[...tl("contentTypes"),...tl("contentEntries"),...sE(),{resource:"contentEntries",action:"restore"},...tl("mediaItems"),{resource:"settings",action:"manage"},...cl("settings"),...tl("users"),{resource:"users",action:"manage"}]},MV={name:"editor",displayName:"Editor",description:"Can manage all content and media, but cannot modify settings or content types",isSystem:!0,permissions:[...cl("contentTypes"),...tl("contentEntries"),...sE(),{resource:"contentEntries",action:"restore"},...tl("mediaItems")]},RV={name:"author",displayName:"Author",description:"Can create and manage own content and media",isSystem:!0,permissions:[...cl("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"}]},AV={name:"viewer",displayName:"Viewer",description:"Read-only access to published content and media",isSystem:!0,permissions:[...cl("contentTypes"),...cl("contentEntries"),...cl("mediaItems")]},OV={admin:TV,editor:MV,author:RV,viewer:AV};function DV(e,t){return OV[e]??t?.[e]}function zV(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function PV(e,t=5e3){return e.type.startsWith("image/")?new Promise(n=>{const s=new Image;let o=null;const l=setTimeout(()=>{o&&URL.revokeObjectURL(o),n(void 0)},t);s.onload=()=>{clearTimeout(l),o&&URL.revokeObjectURL(o),n({width:s.naturalWidth,height:s.naturalHeight})},s.onerror=()=>{clearTimeout(l),o&&URL.revokeObjectURL(o),n(void 0)},o=URL.createObjectURL(e),s.src=o}):Promise.resolve(void 0)}function LV(e,t,n,s){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);s(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 IV(e,t){switch(t.type){case"ADD_FILES":{const n=t.files.map(s=>({id:zV(),file:s,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 $V(e){const{maxConcurrent:t=3,metadata:n,onComplete:s,onError:o}=e,[l,u]=p.useReducer(IV,[]),d=Ke(e.getUploadUrl),h=Ke(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 LV(O,R.file,T.signal,q=>{u({type:"UPDATE_FILE",id:R.id,updates:{progress:q}})});u({type:"UPDATE_FILE",id:R.id,updates:{progress:90}});const z=await PV(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")&&s?.(l)},[l,t,y,s]);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 FV({...e}){return i.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...e})}function BV({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 UV({className:e,...t}){return i.jsx("li",{"data-slot":"breadcrumb-item",className:W("inline-flex items-center gap-1.5",e),...t})}function VV({asChild:e,className:t,...n}){const s=e?Pl:"a";return i.jsx(s,{"data-slot":"breadcrumb-link",className:W("hover:text-foreground transition-colors",t),...n})}function qV({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 HV({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 bv="rovingFocusGroup.onEntryFocus",YV={bubbles:!1,cancelable:!0},Yu="RovingFocusGroup",[hx,aE,WV]=By(Yu),[GV,Vl]=Dn(Yu,[WV]),[ZV,QV]=GV(Yu),oE=p.forwardRef((e,t)=>i.jsx(hx.Provider,{scope:e.__scopeRovingFocusGroup,children:i.jsx(hx.Slot,{scope:e.__scopeRovingFocusGroup,children:i.jsx(KV,{...e,ref:t})})}));oE.displayName=Yu;var KV=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:h,onEntryFocus:m,preventScrollOnEntryFocus:v=!1,...g}=e,y=p.useRef(null),w=Ze(t,y),S=Bl(l),[j,N]=rr({prop:u,defaultProp:d??null,onChange:h,caller:Yu}),[C,_]=p.useState(!1),E=Nn(m),M=aE(n),A=p.useRef(!1),[R,T]=p.useState(0);return p.useEffect(()=>{const O=y.current;if(O)return O.addEventListener(bv,E),()=>O.removeEventListener(bv,E)},[E]),i.jsx(ZV,{scope:n,orientation:s,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":s,...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(bv,YV);if(O.currentTarget.dispatchEvent(z),!z.defaultPrevented){const B=M().filter(L=>L.focusable),q=B.find(L=>L.active),Y=B.find(L=>L.id===j),ae=[q,Y,...B].filter(Boolean).map(L=>L.ref.current);cE(ae,v)}}A.current=!1}),onBlur:Se(e.onBlur,()=>_(!1))})})}),iE="RovingFocusGroupItem",lE=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:l,children:u,...d}=e,h=gn(),m=l||h,v=QV(iE,n),g=v.currentTabStopId===m,y=aE(n),{onFocusableItemAdd:w,onFocusableItemRemove:S,currentTabStopId:j}=v;return p.useEffect(()=>{if(s)return w(),()=>S()},[s,w,S]),i.jsx(hx.ItemSlot,{scope:n,id:m,focusable:s,active:o,children:i.jsx(ze.span,{tabIndex:g?0:-1,"data-orientation":v.orientation,...d,ref:t,onMouseDown:Se(e.onMouseDown,N=>{s?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=eq(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?tq(E,M+1):E.slice(M+1)}setTimeout(()=>cE(E))}}),children:typeof u=="function"?u({isCurrentTabStop:g,hasTabStop:j!=null}):u})})});lE.displayName=iE;var XV={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function JV(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function eq(e,t,n){const s=JV(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return XV[s]}function cE(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function tq(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var Vy=oE,qy=lE,mx=["Enter"," "],nq=["ArrowDown","PageUp","Home"],uE=["ArrowUp","PageDown","End"],rq=[...nq,...uE],sq={ltr:[...mx,"ArrowRight"],rtl:[...mx,"ArrowLeft"]},aq={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Wu="Menu",[Nu,oq,iq]=By(Wu),[Qo,dE]=Dn(Wu,[iq,Ja,Vl]),am=Ja(),fE=Vl(),[lq,Ko]=Qo(Wu),[cq,Gu]=Qo(Wu),hE=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:o,onOpenChange:l,modal:u=!0}=e,d=am(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(Zh,{...d,children:i.jsx(lq,{scope:t,open:n,onOpenChange:g,content:h,onContentChange:m,children:i.jsx(cq,{scope:t,onClose:p.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:v,dir:y,modal:u,children:s})})})};hE.displayName=Wu;var uq="MenuAnchor",Hy=p.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,o=am(n);return i.jsx(qu,{...o,...s,ref:t})});Hy.displayName=uq;var Yy="MenuPortal",[dq,mE]=Qo(Yy,{forceMount:void 0}),pE=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:o}=e,l=Ko(Yy,t);return i.jsx(dq,{scope:t,forceMount:n,children:i.jsx(yn,{present:n||l.open,children:i.jsx(Il,{asChild:!0,container:o,children:s})})})};pE.displayName=Yy;var Ur="MenuContent",[fq,Wy]=Qo(Ur),gE=p.forwardRef((e,t)=>{const n=mE(Ur,e.__scopeMenu),{forceMount:s=n.forceMount,...o}=e,l=Ko(Ur,e.__scopeMenu),u=Gu(Ur,e.__scopeMenu);return i.jsx(Nu.Provider,{scope:e.__scopeMenu,children:i.jsx(yn,{present:s||l.open,children:i.jsx(Nu.Slot,{scope:e.__scopeMenu,children:u.modal?i.jsx(hq,{...o,ref:t}):i.jsx(mq,{...o,ref:t})})})})}),hq=p.forwardRef((e,t)=>{const n=Ko(Ur,e.__scopeMenu),s=p.useRef(null),o=Ze(t,s);return p.useEffect(()=>{const l=s.current;if(l)return Bh(l)},[]),i.jsx(Gy,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Se(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),mq=p.forwardRef((e,t)=>{const n=Ko(Ur,e.__scopeMenu);return i.jsx(Gy,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),pq=$o("MenuContent.ScrollLock"),Gy=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!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=Ko(Ur,n),C=Gu(Ur,n),_=am(n),E=fE(n),M=oq(n),[A,R]=p.useState(null),T=p.useRef(null),O=Ze(t,T,N.onContentChange),D=p.useRef(0),z=p.useRef(""),B=p.useRef(0),q=p.useRef(null),Y=p.useRef("right"),G=p.useRef(0),ae=S?Iu:p.Fragment,L=S?{as:pq,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=_q(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),[]),$h();const U=p.useCallback(H=>Y.current===q.current?.side&&Tq(H,q.current?.area),[]);return i.jsx(fq,{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=>{q.current=H},[]),children:i.jsx(ae,{...L,children:i.jsx(Lu,{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(Vy,{asChild:!0,...E,dir:C.dir,orientation:"vertical",loop:s,currentTabStopId:A,onCurrentTabStopIdChange:R,onEntryFocus:Se(h,H=>{C.isUsingKeyboardRef.current||H.preventDefault()}),preventScrollOnEntryFocus:!0,children:i.jsx(Qh,{role:"menu","aria-orientation":"vertical","data-state":AE(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||!rq.includes(H.key))return;H.preventDefault();const ue=M().filter(te=>!te.disabled).map(te=>te.ref.current);uE.includes(H.key)&&ue.reverse(),Nq(ue)}),onBlur:Se(e.onBlur,H=>{H.currentTarget.contains(H.target)||(window.clearTimeout(D.current),z.current="")}),onPointerMove:Se(e.onPointerMove,ku(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}}))})})})})})})});gE.displayName=Ur;var gq="MenuGroup",Zy=p.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return i.jsx(ze.div,{role:"group",...s,ref:t})});Zy.displayName=gq;var vq="MenuLabel",vE=p.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return i.jsx(ze.div,{...s,ref:t})});vE.displayName=vq;var wh="MenuItem",gC="menu.itemSelect",om=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...o}=e,l=p.useRef(null),u=Gu(wh,e.__scopeMenu),d=Wy(wh,e.__scopeMenu),h=Ze(t,l),m=p.useRef(!1),v=()=>{const g=l.current;if(!n&&g){const y=new CustomEvent(gC,{bubbles:!0,cancelable:!0});g.addEventListener(gC,w=>s?.(w),{once:!0}),Bk(g,y),y.defaultPrevented?m.current=!1:u.onClose()}};return i.jsx(xE,{...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===" "||mx.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});om.displayName=wh;var xE=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:o,...l}=e,u=Wy(wh,n),d=fE(n),h=p.useRef(null),m=Ze(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(Nu.ItemSlot,{scope:n,disabled:s,textValue:o??y,children:i.jsx(qy,{asChild:!0,...d,focusable:!s,children:i.jsx(ze.div,{role:"menuitem","data-highlighted":v?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...l,ref:m,onPointerMove:Se(e.onPointerMove,ku(S=>{s?u.onItemLeave(S):(u.onItemEnter(S),S.defaultPrevented||S.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Se(e.onPointerLeave,ku(S=>u.onItemLeave(S))),onFocus:Se(e.onFocus,()=>g(!0)),onBlur:Se(e.onBlur,()=>g(!1))})})})}),xq="MenuCheckboxItem",yE=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...o}=e;return i.jsx(CE,{scope:e.__scopeMenu,checked:n,children:i.jsx(om,{role:"menuitemcheckbox","aria-checked":Sh(n)?"mixed":n,...o,ref:t,"data-state":Ky(n),onSelect:Se(o.onSelect,()=>s?.(Sh(n)?!0:!n),{checkForDefaultPrevented:!1})})})});yE.displayName=xq;var bE="MenuRadioGroup",[yq,bq]=Qo(bE,{value:void 0,onValueChange:()=>{}}),wE=p.forwardRef((e,t)=>{const{value:n,onValueChange:s,...o}=e,l=Nn(s);return i.jsx(yq,{scope:e.__scopeMenu,value:n,onValueChange:l,children:i.jsx(Zy,{...o,ref:t})})});wE.displayName=bE;var SE="MenuRadioItem",jE=p.forwardRef((e,t)=>{const{value:n,...s}=e,o=bq(SE,e.__scopeMenu),l=n===o.value;return i.jsx(CE,{scope:e.__scopeMenu,checked:l,children:i.jsx(om,{role:"menuitemradio","aria-checked":l,...s,ref:t,"data-state":Ky(l),onSelect:Se(s.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});jE.displayName=SE;var Qy="MenuItemIndicator",[CE,wq]=Qo(Qy,{checked:!1}),NE=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...o}=e,l=wq(Qy,n);return i.jsx(yn,{present:s||Sh(l.checked)||l.checked===!0,children:i.jsx(ze.span,{...o,ref:t,"data-state":Ky(l.checked)})})});NE.displayName=Qy;var Sq="MenuSeparator",kE=p.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return i.jsx(ze.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});kE.displayName=Sq;var jq="MenuArrow",_E=p.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,o=am(n);return i.jsx(Kh,{...o,...s,ref:t})});_E.displayName=jq;var Cq="MenuSub",[zJ,EE]=Qo(Cq),Xc="MenuSubTrigger",TE=p.forwardRef((e,t)=>{const n=Ko(Xc,e.__scopeMenu),s=Gu(Xc,e.__scopeMenu),o=EE(Xc,e.__scopeMenu),l=Wy(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(Hy,{asChild:!0,...m,children:i.jsx(xE,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":AE(n.open),...e,ref:_s(t,o.onTriggerChange),onClick:g=>{e.onClick?.(g),!(e.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Se(e.onPointerMove,ku(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,ku(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===" "||sq[s.dir].includes(g.key)&&(n.onOpenChange(!0),n.content?.focus(),g.preventDefault())})})})});TE.displayName=Xc;var ME="MenuSubContent",RE=p.forwardRef((e,t)=>{const n=mE(Ur,e.__scopeMenu),{forceMount:s=n.forceMount,...o}=e,l=Ko(Ur,e.__scopeMenu),u=Gu(Ur,e.__scopeMenu),d=EE(ME,e.__scopeMenu),h=p.useRef(null),m=Ze(t,h);return i.jsx(Nu.Provider,{scope:e.__scopeMenu,children:i.jsx(yn,{present:s||l.open,children:i.jsx(Nu.Slot,{scope:e.__scopeMenu,children:i.jsx(Gy,{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=aq[u.dir].includes(v.key);g&&y&&(l.onOpenChange(!1),d.trigger?.focus(),v.preventDefault())})})})})})});RE.displayName=ME;function AE(e){return e?"open":"closed"}function Sh(e){return e==="indeterminate"}function Ky(e){return Sh(e)?"indeterminate":e?"checked":"unchecked"}function Nq(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function kq(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function _q(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=kq(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 Eq(e,t){const{x:n,y:s}=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>s!=y>s&&n<(g-m)*(s-v)/(y-v)+m&&(o=!o)}return o}function Tq(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Eq(n,t)}function ku(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Mq=hE,Rq=Hy,Aq=pE,Oq=gE,Dq=Zy,zq=vE,Pq=om,Lq=yE,Iq=wE,$q=jE,Fq=NE,Bq=kE,Uq=_E,Vq=TE,qq=RE,im="DropdownMenu",[Hq]=Dn(im,[dE]),Vn=dE(),[Yq,OE]=Hq(im),DE=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:o,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,h=Vn(t),m=p.useRef(null),[v,g]=rr({prop:o,defaultProp:l??!1,onChange:u,caller:im});return i.jsx(Yq,{scope:t,triggerId:gn(),triggerRef:m,contentId:gn(),open:v,onOpenChange:g,onOpenToggle:p.useCallback(()=>g(y=>!y),[g]),modal:d,children:i.jsx(Mq,{...h,open:v,onOpenChange:g,dir:s,modal:d,children:n})})};DE.displayName=im;var zE="DropdownMenuTrigger",PE=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...o}=e,l=OE(zE,n),u=Vn(n);return i.jsx(Rq,{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":s?"":void 0,disabled:s,...o,ref:_s(t,l.triggerRef),onPointerDown:Se(e.onPointerDown,d=>{!s&&d.button===0&&d.ctrlKey===!1&&(l.onOpenToggle(),l.open||d.preventDefault())}),onKeyDown:Se(e.onKeyDown,d=>{s||(["Enter"," "].includes(d.key)&&l.onOpenToggle(),d.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})});PE.displayName=zE;var Wq="DropdownMenuPortal",LE=e=>{const{__scopeDropdownMenu:t,...n}=e,s=Vn(t);return i.jsx(Aq,{...s,...n})};LE.displayName=Wq;var IE="DropdownMenuContent",$E=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=OE(IE,n),l=Vn(n),u=p.useRef(!1);return i.jsx(Oq,{id:o.contentId,"aria-labelledby":o.triggerId,...l,...s,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)"}})});$E.displayName=IE;var Gq="DropdownMenuGroup",FE=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Vn(n);return i.jsx(Dq,{...o,...s,ref:t})});FE.displayName=Gq;var Zq="DropdownMenuLabel",BE=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Vn(n);return i.jsx(zq,{...o,...s,ref:t})});BE.displayName=Zq;var Qq="DropdownMenuItem",UE=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Vn(n);return i.jsx(Pq,{...o,...s,ref:t})});UE.displayName=Qq;var Kq="DropdownMenuCheckboxItem",Xq=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Vn(n);return i.jsx(Lq,{...o,...s,ref:t})});Xq.displayName=Kq;var Jq="DropdownMenuRadioGroup",eH=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Vn(n);return i.jsx(Iq,{...o,...s,ref:t})});eH.displayName=Jq;var tH="DropdownMenuRadioItem",nH=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Vn(n);return i.jsx($q,{...o,...s,ref:t})});nH.displayName=tH;var rH="DropdownMenuItemIndicator",sH=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Vn(n);return i.jsx(Fq,{...o,...s,ref:t})});sH.displayName=rH;var aH="DropdownMenuSeparator",VE=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Vn(n);return i.jsx(Bq,{...o,...s,ref:t})});VE.displayName=aH;var oH="DropdownMenuArrow",iH=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Vn(n);return i.jsx(Uq,{...o,...s,ref:t})});iH.displayName=oH;var lH="DropdownMenuSubTrigger",cH=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Vn(n);return i.jsx(Vq,{...o,...s,ref:t})});cH.displayName=lH;var uH="DropdownMenuSubContent",dH=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Vn(n);return i.jsx(qq,{...o,...s,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)"}})});dH.displayName=uH;var fH=DE,hH=PE,mH=LE,pH=$E,gH=FE,vH=BE,xH=UE,yH=VE;function Sl({...e}){return i.jsx(fH,{"data-slot":"dropdown-menu",...e})}function jl({...e}){return i.jsx(hH,{"data-slot":"dropdown-menu-trigger",...e})}function Cl({className:e,sideOffset:t=4,...n}){return i.jsx(mH,{children:i.jsx(pH,{"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 vC({...e}){return i.jsx(gH,{"data-slot":"dropdown-menu-group",...e})}function pn({className:e,inset:t,variant:n="default",...s}){return i.jsx(xH,{"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),...s})}function qE({className:e,inset:t,...n}){return i.jsx(vH,{"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 qo({className:e,...t}){return i.jsx(yH,{"data-slot":"dropdown-menu-separator",className:W("bg-border -mx-1 my-1 h-px",e),...t})}function bH(e,t=[]){let n=[];function s(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,[s,wH(o,...t)]}function wH(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(l){const u=s.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 SH=ON();function jH(){return SH.useSyncExternalStore(CH,()=>!0,()=>!1)}function CH(){return()=>{}}var Xy="Avatar",[NH]=bH(Xy),[kH,HE]=NH(Xy),YE=p.forwardRef((e,t)=>{const{__scopeAvatar:n,...s}=e,[o,l]=p.useState("idle");return i.jsx(kH,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:l,children:i.jsx(ar.span,{...s,ref:t})})});YE.displayName=Xy;var WE="AvatarImage",GE=p.forwardRef((e,t)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:o=()=>{},...l}=e,u=HE(WE,n),d=_H(s,l),h=Nn(m=>{o(m),u.onImageLoadingStatusChange(m)});return Jt(()=>{d!=="idle"&&h(d)},[d,h]),d==="loaded"?i.jsx(ar.img,{...l,ref:t,src:s}):null});GE.displayName=WE;var ZE="AvatarFallback",QE=p.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:s,...o}=e,l=HE(ZE,n),[u,d]=p.useState(s===void 0);return p.useEffect(()=>{if(s!==void 0){const h=window.setTimeout(()=>d(!0),s);return()=>window.clearTimeout(h)}},[s]),u&&l.imageLoadingStatus!=="loaded"?i.jsx(ar.span,{...o,ref:t}):null});QE.displayName=ZE;function xC(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function _H(e,{referrerPolicy:t,crossOrigin:n}){const s=jH(),o=p.useRef(null),l=s?(o.current||(o.current=new window.Image),o.current):null,[u,d]=p.useState(()=>xC(l,e));return Jt(()=>{d(xC(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 EH=YE,TH=GE,MH=QE;function RH({className:e,...t}){return i.jsx(EH,{"data-slot":"avatar",className:W("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function AH({className:e,...t}){return i.jsx(TH,{"data-slot":"avatar-image",className:W("aspect-square size-full",e),...t})}function OH({className:e,...t}){return i.jsx(MH,{"data-slot":"avatar-fallback",className:W("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}var lm="Popover",[KE]=Dn(lm,[Ja]),Zu=Ja(),[DH,ro]=KE(lm),XE=e=>{const{__scopePopover:t,children:n,open:s,defaultOpen:o,onOpenChange:l,modal:u=!1}=e,d=Zu(t),h=p.useRef(null),[m,v]=p.useState(!1),[g,y]=rr({prop:s,defaultProp:o??!1,onChange:l,caller:lm});return i.jsx(Zh,{...d,children:i.jsx(DH,{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})})};XE.displayName=lm;var JE="PopoverAnchor",zH=p.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,o=ro(JE,n),l=Zu(n),{onCustomAnchorAdd:u,onCustomAnchorRemove:d}=o;return p.useEffect(()=>(u(),()=>d()),[u,d]),i.jsx(qu,{...l,...s,ref:t})});zH.displayName=JE;var eT="PopoverTrigger",tT=p.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,o=ro(eT,n),l=Zu(n),u=Ze(t,o.triggerRef),d=i.jsx(ze.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":oT(o.open),...s,ref:u,onClick:Se(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?d:i.jsx(qu,{asChild:!0,...l,children:d})});tT.displayName=eT;var Jy="PopoverPortal",[PH,LH]=KE(Jy,{forceMount:void 0}),nT=e=>{const{__scopePopover:t,forceMount:n,children:s,container:o}=e,l=ro(Jy,t);return i.jsx(PH,{scope:t,forceMount:n,children:i.jsx(yn,{present:n||l.open,children:i.jsx(Il,{asChild:!0,container:o,children:s})})})};nT.displayName=Jy;var Nl="PopoverContent",rT=p.forwardRef((e,t)=>{const n=LH(Nl,e.__scopePopover),{forceMount:s=n.forceMount,...o}=e,l=ro(Nl,e.__scopePopover);return i.jsx(yn,{present:s||l.open,children:l.modal?i.jsx($H,{...o,ref:t}):i.jsx(FH,{...o,ref:t})})});rT.displayName=Nl;var IH=$o("PopoverContent.RemoveScroll"),$H=p.forwardRef((e,t)=>{const n=ro(Nl,e.__scopePopover),s=p.useRef(null),o=Ze(t,s),l=p.useRef(!1);return p.useEffect(()=>{const u=s.current;if(u)return Bh(u)},[]),i.jsx(Iu,{as:IH,allowPinchZoom:!0,children:i.jsx(sT,{...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})})})}),FH=p.forwardRef((e,t)=>{const n=ro(Nl,e.__scopePopover),s=p.useRef(!1),o=p.useRef(!1);return i.jsx(sT,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(s.current||n.triggerRef.current?.focus(),l.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(s.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()}})}),sT=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:v,...g}=e,y=ro(Nl,n),w=Zu(n);return $h(),i.jsx(Lu,{asChild:!0,loop:!0,trapped:s,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(Qh,{"data-state":oT(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)"}})})})}),aT="PopoverClose",BH=p.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,o=ro(aT,n);return i.jsx(ze.button,{type:"button",...s,ref:t,onClick:Se(e.onClick,()=>o.onOpenChange(!1))})});BH.displayName=aT;var UH="PopoverArrow",VH=p.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,o=Zu(n);return i.jsx(Kh,{...o,...s,ref:t})});VH.displayName=UH;function oT(e){return e?"open":"closed"}var qH=XE,HH=tT,YH=nT,WH=rT;function _u({...e}){return i.jsx(qH,{"data-slot":"popover",...e})}function Eu({...e}){return i.jsx(HH,{"data-slot":"popover-trigger",...e})}function Tu({className:e,align:t="center",sideOffset:n=4,...s}){return i.jsx(YH,{children:i.jsx(WH,{"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),...s})})}const GH=[{keys:["⌘","S"],description:"Save entry"},{keys:["⌘","⇧","P"],description:"Publish entry"},{keys:["⌘","K"],description:"Quick search"},{keys:["Esc"],description:"Close modal/panel"}],ZH=[{label:"Documentation",url:"https://docs.convex.dev",icon:y3},{label:"API Reference",url:"https://docs.convex.dev/api",icon:UN},{label:"Community Discord",url:"https://discord.gg/convex",icon:VP}],QH={"/":"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 KH(e,t,n){const s=[{label:t,to:"/"}],o=decodeURIComponent(e);if(o==="/")return s;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)??QH[u];v||(v=d.charAt(0).toUpperCase()+d.slice(1).replace(/-/g," ")),m?s.push({label:v}):s.push({label:v,to:u})}),s}function XH(){const e=$n(),t=Qa(),{branding:n}=Lh();let s=new Map;try{s=Lk().overrides}catch{}const o=KH(e.location.pathname,n.appName,s);let l=null,u=null,d=async()=>{},h=!1;try{const j=oy();l=j.user,u=j.role,d=j.logout,h=j.isAuthenticated}catch{}const v=(u?DV(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(w7,{className:"md:hidden"}),i.jsx(mh,{orientation:"vertical",className:"mr-2 data-[orientation=vertical]:h-4 md:hidden"})]}),i.jsx(FV,{children:i.jsx(BV,{children:o.map((j,N)=>i.jsxs(p.Fragment,{children:[N>0&&i.jsx(HV,{}),i.jsx(UV,{children:j.to?i.jsx(VV,{asChild:!0,children:i.jsxs(Ss,{to:j.to,className:"flex items-center gap-1.5",children:[N===0&&i.jsx(Ah,{className:"size-3.5"}),i.jsx("span",{children:j.label})]})}):i.jsx(qV,{children:j.label})})]},N))})}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs(_u,{children:[i.jsx(Eu,{asChild:!0,children:i.jsxs(tt,{variant:"ghost",size:"icon",className:"size-9",children:[i.jsx(Wv,{className:"size-4"}),i.jsx("span",{className:"sr-only",children:"Notifications"})]})}),i.jsxs(Tu,{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(Wv,{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(_u,{children:[i.jsx(Eu,{asChild:!0,children:i.jsxs(tt,{variant:"ghost",size:"icon",className:"size-9",children:[i.jsx(BN,{className:"size-4"}),i.jsx("span",{className:"sr-only",children:"Help"})]})}),i.jsxs(Tu,{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:GH.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:ZH.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(G3,{className:"size-3 text-muted-foreground"})]},j.label))})]})]})]})]}),i.jsxs(Sl,{children:[i.jsx(jl,{asChild:!0,children:i.jsxs(tt,{variant:"ghost",className:"h-9 gap-2 pl-2 pr-3",children:[i.jsxs(RH,{className:"size-6",children:[i.jsx(AH,{src:l?.avatarUrl,alt:g}),i.jsx(OH,{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(qE,{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(qo,{}),i.jsxs(pn,{onClick:()=>t({to:"/settings"}),children:[i.jsx(ZN,{className:"mr-2 size-4"}),i.jsx("span",{children:"Profile & Settings"})]}),h&&i.jsxs(i.Fragment,{children:[i.jsx(qo,{}),i.jsxs(pn,{onClick:S,className:"text-destructive focus:text-destructive",children:[i.jsx(LP,{className:"mr-2 size-4"}),i.jsx("span",{children:"Logout"})]})]})]})]})]})]})}function JH({children:e}){const{layout:t}=Lh();return i.jsxs(y7,{defaultOpen:!0,style:{"--sidebar-width":`${t.sidebarWidth}px`},children:[i.jsx(kV,{}),i.jsxs(S7,{children:[i.jsx(XH,{}),i.jsx("div",{className:"flex-1 overflow-auto p-3 md:p-6",children:e})]})]})}function eY(){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 tY(){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 wv({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 nY({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 jh({children:e,requiredPermission:t,requiredRole:n,loadingComponent:s,unauthenticatedComponent:o,unauthorizedComponent:l,onUnauthenticated:u,onUnauthorized:d}){const{authState:h,role:m,checkPermission:v,error:g}=oy();return h==="loading"?i.jsx(i.Fragment,{children:s??i.jsx(eY,{})}):h==="error"?i.jsx(nY,{error:g??"An error occurred"}):h==="unauthenticated"?(u?.(),i.jsx(i.Fragment,{children:o??i.jsx(tY,{})})):m?n&&m!==n?(d?.(),i.jsx(i.Fragment,{children:l??i.jsx(wv,{requiredRole:n,requiredPermission:t})})):t&&!v(t)?(d?.(),i.jsx(i.Fragment,{children:l??i.jsx(wv,{requiredRole:n,requiredPermission:t})})):i.jsx(i.Fragment,{children:e}):(d?.(),i.jsx(i.Fragment,{children:l??i.jsx(wv,{requiredRole:n,requiredPermission:t})}))}function Sv(e){if(e===0)return"0 B";const t=1024,n=["B","KB","MB","GB"],s=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,s)).toFixed(1))} ${n[s]}`}function rY(e,t){return t.length===0?!0:t.some(n=>{if(n.endsWith("/*")){const s=n.slice(0,-2);return e.startsWith(s+"/")}return e===n})}function iT({onUploadComplete:e,currentFolderId:t,generateUploadUrl:n,createAsset:s,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=$V({getUploadUrl:n,createAsset:s,maxConcurrent:u,metadata:t?{parentId:t}:void 0,onComplete:z=>{const B=z.map(q=>({filename:q.file.name,storageId:q.result?String(q.result._id||""):"",success:q.status==="complete",error:q.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 ${Sv(o)}`:l.length>0&&!rY(z.type,l)?`File type ${z.type||"unknown"} is not allowed`:null,[o,l]),j=p.useCallback(z=>{const B=Array.from(z),q=new Map,Y=[];for(const G of B){const ae=S(G);ae?q.set(G.name,ae):Y.push(G)}g(q),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(Ts,{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(Pu,{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 ${Sv(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:Sv(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 sY=Symbol.for("functionName");function aY(e){return new Proxy({},{get(t,n){return{[sY]:`${e}:${n}`}}})}const Cn=aY("admin");function oY(){return window.__CMS_CONFIG__?window.__CMS_CONFIG__:{convexUrl:"",authMode:"demo"}}function cm(){const{role:e}=oy();return p.useMemo(()=>{const t=!!e,n=(N,C,_)=>e?XN(e,{resource:N,action:C,scope:_}):!1;return{role:e,hasRole:t,check:n,canAccess:N=>e?V5(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?JN(e,N):[],isAdmin:e==="admin",isEditor:e==="admin"||e==="editor",isAuthor:e==="admin"||e==="editor"||e==="author"}},[e])}function eb(e,t){const{setOverride:n,clearOverride:s}=Lk();p.useEffect(()=>(t&&n(e,t),()=>{s(e)}),[e,t,n,s])}function lT(e){const t=xn(),n=e?.taxonomyId,s=e?.taxonomyName??n,o=Ye(t.listTaxonomies,s?{isActive:!0}:"skip");return s?o?.page?.find(u=>u.name===s)?._id??n??null:null}const iY={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 lY({action:e,count:t,isProcessing:n,result:s,onConfirm:o,onCancel:l}){const u=iY[e];return i.jsx(cs,{open:!0,onOpenChange:d=>!d&&!n&&l(),title:u.title,size:"sm",footer:s?i.jsx(me,{variant:"primary",onClick:l,children:s.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:s?i.jsx("div",{className:"flex flex-col gap-4",children:s.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:s.succeeded})," ",s.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:s.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:s.failed}),i.jsx("p",{className:"text-xs text-diff-removed-foreground",children:"Failed"})]})]}),s.errors&&s.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:[s.errors.slice(0,5).map((d,h)=>i.jsxs("li",{className:"truncate",children:["• ",d]},h)),s.errors.length>5&&i.jsxs("li",{className:"text-diff-modified-foreground/80",children:["...and ",s.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(Io,{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 cY=Zo("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 yt({className:e,variant:t,asChild:n=!1,...s}){const o=n?Pl:"span";return i.jsx(o,{"data-slot":"badge",className:W(cY({variant:t}),e),...s})}function uY({selectedIds:e,onClearSelection:t,onOperationComplete:n}){const s=xn(),[o,l]=p.useState(null),[u,d]=p.useState(!1),[h,m]=p.useState(null),v=Ke(s.bulkPublish),g=Ke(s.bulkUnpublish),y=Ke(s.bulkDelete),w=Ke(s.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(yt,{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(lY,{action:o,count:e.length,isProcessing:u,result:h,onConfirm:j,onCancel:N})]})}const dY={base:"surface-base",elevated:"surface-elevated",floating:"surface-floating"},fY={none:"",sm:"p-3",md:"p-4",lg:"p-6"},hY={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg"};function yr({elevation:e="base",padding:t="md",rounded:n="lg",className:s,children:o,...l}){return i.jsx("div",{className:W(dY[e],fY[t],hY[n],s),...l,children:o})}const mY={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"})})}},yC={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 bC(){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 ql({status:e,customConfig:t,className:n,...s}){if(t)return i.jsxs(yt,{variant:"secondary",className:W("gap-1.5 px-2 py-0.5 text-xs font-medium",yC[t.color],n),...s,children:[bC(),t.displayName]});const o=mY[e];return o?i.jsxs(yt,{variant:"secondary",className:W("gap-1.5 px-2 py-0.5 text-xs font-medium",o.className,n),...s,children:[o.icon,o.label]}):i.jsxs(yt,{variant:"secondary",className:W("gap-1.5 px-2 py-0.5 text-xs font-medium",yC.gray,n),...s,children:[bC(),e]})}function Bn({icon:e,title:t,description:n,action:s,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}),s&&i.jsx(me,{variant:s.variant??"primary",onClick:s.onClick,className:"mt-4",children:s.label})]})}function os({title:e,description:t,actions:n,breadcrumbs:s,className:o,...l}){return i.jsxs("div",{className:W("mb-6",o),...l,children:[s&&i.jsx("div",{className:"mb-2",children:s}),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 pY({left:e,right:t,search:n,filters:s,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(pt,{type:"search",placeholder:n.placeholder??"Search...",value:n.value,onChange:h=>n.onChange(h.target.value),className:"pl-9"})]}),s,e,u]}),(t||o)&&i.jsx("div",{className:"flex items-center gap-2",children:t??o})]})}function gY({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 vY({className:e,...t}){return i.jsx("thead",{"data-slot":"table-header",className:W("[&_tr]:border-b",e),...t})}function xY({className:e,...t}){return i.jsx("tbody",{"data-slot":"table-body",className:W("[&_tr:last-child]:border-0",e),...t})}function jv({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 wC({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 Cv({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 tb({columns:e,data:t,getRowId:n,selectable:s,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(M3,{className:"ml-1 inline size-3.5 text-muted-foreground"}):d==="asc"?i.jsx(zu,{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(gY,{children:[i.jsx(vY,{children:i.jsxs(jv,{className:"hover:bg-transparent",children:[s&&i.jsx(wC,{className:"w-12",children:i.jsx(Sr,{checked:y?!0:w?"indeterminate":!1,onCheckedChange:S,"aria-label":"Select all"})}),e.map(C=>i.jsxs(wC,{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(xY,{children:t.length===0?i.jsx(jv,{children:i.jsx(Cv,{colSpan:e.length+(s?1:0),className:"h-24 text-center text-muted-foreground",children:v})}):t.map(C=>{const _=n(C),E=o.has(_);return i.jsxs(jv,{"data-state":E&&"selected",className:W(m&&"cursor-pointer"),onClick:()=>m?.(C),children:[s&&i.jsx(Cv,{onClick:M=>M.stopPropagation(),className:"w-12",children:i.jsx(Sr,{checked:E,onCheckedChange:M=>j(_,M===!0),"aria-label":`Select row ${_}`})}),e.map(M=>i.jsx(Cv,{className:M.className,children:M.cell(C)},M.key))]},_)})})]})})}const yY=p.forwardRef(({className:e,error:t,...n},s)=>i.jsx(pt,{ref:s,className:W(t&&"border-destructive focus-visible:ring-destructive",e),"aria-invalid":t,...n}));yY.displayName="CmsInput";function bY({value:e,onValueChange:t,options:n,placeholder:s="Select...",disabled:o,error:l,className:u}){return i.jsxs(aa,{value:e,onValueChange:t,disabled:o,children:[i.jsx(ia,{className:W(l&&"border-destructive focus:ring-destructive",u),"aria-invalid":l,children:i.jsx(oa,{placeholder:s})}),i.jsx(la,{children:n.map(d=>i.jsx(Xt,{value:d.value,disabled:d.disabled,children:d.label},d.value))})]})}function um({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 wY=Zo("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(wY({align:t}),e),onClick:s=>{s.target.closest("button")||s.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 dm({className:e,...t}){return i.jsx(pt,{"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 fm({search:e,filters:t,actions:n,onClearFilters:s,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(um,{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(dm,{type:"search",placeholder:e.placeholder??"Search...",value:e.value,onChange:u=>e.onChange(u.target.value)})]}),t?.map(u=>i.jsx(bY,{value:u.value,onValueChange:u.onChange,options:u.options,placeholder:u.placeholder,className:W("w-[150px]",u.className)},u.key)),o&&s&&i.jsxs(me,{variant:"ghost",size:"sm",onClick:s,children:[i.jsx(At,{className:"mr-1 size-4"}),"Clear"]})]}),n&&i.jsx("div",{className:"flex items-center gap-2",children:n})]})}function Af({title:e,value:t,description:n,icon:s,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})]}),s&&i.jsx("div",{className:"flex size-10 items-center justify-center rounded-lg bg-primary/10 text-primary",children:s})]}),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(yr,{elevation:"base",padding:"md",className:"h-full",children:h})}):i.jsx(yr,{elevation:"base",padding:"md",className:W("h-full",d),children:h})}function SY({api:e,navigation:t}){const[n,s]=p.useState(""),[o,l]=p.useState(""),[u,d]=p.useState(""),[h,m]=p.useState(new Set),{canCreate:v,canUpdate:g}=cm();p.useEffect(()=>{const D=t.params?.contentTypeId;if(D){const z=D.startsWith("code:")?D.slice(5):D;s(z)}else s("")},[t.params?.contentTypeId]);const y=Ye(e.listContentTypes,{isActive:!0}),w=y?.page??[],S=y===void 0,j=Ye(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 q=w.find(G=>G.name===z)?.titleField??"title",Y=D.data[q];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(ql,{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(os,{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(os,{title:"Content",description:"Browse and manage content entries across all content types."}),i.jsx(fm,{search:{value:u,onChange:d,placeholder:"Search content...",className:"w-full md:w-64"},filters:[{key:"contentType",value:n||"all",onChange:D=>s(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(uY,{selectedIds:Array.from(h),onClearSelection:T,onOperationComplete:T}),N.length===0?i.jsx(Bn,{icon:i.jsx(jr,{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(tb,{columns:O,data:N,getRowId:D=>D._id,selectable:!0,selectedIds:h,onSelectionChange:m,emptyMessage:"No content entries found"})]})}const jY={text:i.jsx(ny,{className:"size-3"}),richText:i.jsx(oh,{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(rs,{className:"size-3"}),json:i.jsx(qx,{className:"size-3"}),select:i.jsx(vn,{className:"size-3"}),multiSelect:i.jsx(gu,{className:"size-3"}),tags:i.jsx(Do,{className:"size-3"}),category:i.jsx(Zx,{className:"size-3"})};function CY({api:e,navigation:t}){const[n,s]=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=Ye(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(yt,{variant:"secondary",className:"border-violet-200 bg-violet-50 text-xs font-normal text-violet-700",title:"Managed by code",children:[i.jsx(Gv,{className:"mr-1 size-3"}),"Code"]}),i.jsx(yt,{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(yt,{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(ah,{className:"size-3.5"}),"View"]}):i.jsxs(me,{variant:"outline",size:"sm",onClick:()=>g(A),children:[i.jsx(ua,{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(os,{title:"Content Types",description:"Define the structure of your content with custom fields and validation rules."}),i.jsx(fm,{search:{value:n,onChange:s,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(Sr,{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(pP,{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(oh,{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(oh,{className:"size-5"})}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[A.source==="code"&&i.jsxs(yt,{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(Gv,{className:"mr-1 size-3"}),"Code"]}),!A.isActive&&i.jsx(yt,{variant:"secondary",className:"text-xs font-normal",children:"Inactive"}),A.singleton&&i.jsx(yt,{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(ah,{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(ua,{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:[jY[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(tb,{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(rE,{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 qf({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 Hf({className:e,...t}){return i.jsx("div",{"data-slot":"card-title",className:W("leading-none font-semibold",e),...t})}function NY({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 kY=Zo("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 Mu({className:e,variant:t,...n}){return i.jsx("div",{"data-slot":"alert",role:"alert",className:W(kY({variant:t}),e),...n})}function SC({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 Ru({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 _Y({api:e}){const t=Ye(e.checkSchemaDrift,{}),n=Ke(e.syncCodeDefinedTypes),[s,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(Mu,{className:"border-success/50 bg-success/10",children:[i.jsx(Pu,{className:"size-4 text-success"}),i.jsx(SC,{className:"text-diff-added-foreground",children:"Sync Complete"}),i.jsxs(Ru,{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?z3:Io,y=d.length>0?"text-destructive":"text-warning";return i.jsxs(Mu,{variant:v,className:d.length===0?"border-warning/50 bg-warning/10":"",children:[i.jsx(g,{className:`size-4 ${y}`}),i.jsx(SC,{className:d.length===0?"text-diff-modified-foreground":"",children:"Schema Drift Detected"}),i.jsx(Ru,{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(tt,{size:"sm",variant:d.length>0?"destructive":"outline",onClick:m,disabled:s,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 ${s?"animate-spin":""}`}),s?"Syncing...":"Sync Now"]}),i.jsx("span",{className:"text-xs opacity-75",children:"Syncs code-defined types to the database"})]})]})})]})}function EY({api:e,navigation:t}){const n=Ye(e.getDashboardStats,{}),s=n===void 0,o=n===null;return i.jsxs("div",{className:"flex flex-col gap-8",children:[i.jsx(os,{title:"Dashboard",description:"Welcome to Convex CMS Admin. Manage your content, media, and publishing workflows."}),i.jsx(_Y,{api:e}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsx(Of,{title:"Content Entries",description:"Create and manage your content",onClick:()=>t.navigate("/content"),icon:i.jsx(jr,{className:"size-5"})}),i.jsx(Of,{title:"Media Library",description:"Upload and organize media assets",onClick:()=>t.navigate("/media"),icon:i.jsx(rs,{className:"size-5"})}),i.jsx(Of,{title:"Content Types",description:"Define content schemas and fields",onClick:()=>t.navigate("/content-types"),icon:i.jsx(Kx,{className:"size-5"})}),i.jsx(Of,{title:"Settings",description:"Configure CMS settings",onClick:()=>t.navigate("/settings"),icon:i.jsx(GN,{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(_5,{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(Af,{title:"Content Types",value:o?"—":String(n?.contentTypes??0),isLoading:s}),i.jsx(Af,{title:"Content Entries",value:o?"—":String(n?.contentEntries??0),isLoading:s}),i.jsx(Af,{title:"Media Assets",value:o?"—":String(n?.mediaAssets??0),isLoading:s}),i.jsx(Af,{title:"Published",value:o?"—":String(n?.published??0),isLoading:s})]})]})]})}function Of({title:e,description:t,onClick:n,icon:s}){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(qf,{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:s}),i.jsx(Hf,{className:"text-base",children:e})]}),i.jsx(eu,{children:i.jsx(NY,{children:t})})]})})}var jC=1,TY=.9,MY=.8,RY=.17,Nv=.1,kv=.999,AY=.9999,OY=.99,DY=/[\\\/_+.#"@\[\(\{&]/,zY=/[\\\/_+.#"@\[\(\{&]/g,PY=/[\s-]/,cT=/[\s-]/g;function px(e,t,n,s,o,l,u){if(l===t.length)return o===e.length?jC:OY;var d=`${o},${l}`;if(u[d]!==void 0)return u[d];for(var h=s.charAt(l),m=n.indexOf(h,o),v=0,g,y,w,S;m>=0;)g=px(e,t,n,s,m+1,l+1,u),g>v&&(m===o?g*=jC:DY.test(e.charAt(m-1))?(g*=MY,w=e.slice(o,m-1).match(zY),w&&o>0&&(g*=Math.pow(kv,w.length))):PY.test(e.charAt(m-1))?(g*=TY,S=e.slice(o,m-1).match(cT),S&&o>0&&(g*=Math.pow(kv,S.length))):(g*=RY,o>0&&(g*=Math.pow(kv,m-o))),e.charAt(m)!==t.charAt(l)&&(g*=AY)),(g<Nv&&n.charAt(m-1)===s.charAt(l+1)||s.charAt(l+1)===s.charAt(l)&&n.charAt(m-1)!==s.charAt(l))&&(y=px(e,t,n,s,m+1,l+2,u),y*Nv>g&&(g=y*Nv)),g>v&&(v=g),m=n.indexOf(h,m+1);return u[d]=v,v}function CC(e){return e.toLowerCase().replace(cT," ")}function LY(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,px(e,t,CC(e),CC(t),0,0,{})}var Vc='[cmdk-group=""]',_v='[cmdk-group-items=""]',IY='[cmdk-group-heading=""]',uT='[cmdk-item=""]',NC=`${uT}:not([aria-disabled="true"])`,gx="cmdk-item-select",Gi="data-value",$Y=(e,t,n)=>LY(e,t,n),dT=p.createContext(void 0),Qu=()=>p.useContext(dT),fT=p.createContext(void 0),nb=()=>p.useContext(fT),hT=p.createContext(void 0),mT=p.forwardRef((e,t)=>{let n=Zi(()=>{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}}}),s=Zi(()=>new Set),o=Zi(()=>new Map),l=Zi(()=>new Map),u=Zi(()=>new Set),d=pT(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=QY();Ho(()=>{if(v!==void 0){let F=v.trim();n.current.value=F,T.emit()}},[v]),Ho(()=>{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")q(),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)=>(s.current.add(F),K&&(o.current.has(K)?o.current.get(K).add(F):o.current.set(K,new Set([F]))),R(3,()=>{q(),z(),n.current.value||B(),T.emit()}),()=>{l.current.delete(F),s.current.delete(F),n.current.filtered.items.delete(F);let ne=G();R(4,()=>{q(),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:$Y;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(_v);ue?ue.appendChild(X.parentElement===ue?X:X.closest(`${_v} > *`)):ne.appendChild(X.parentElement===ne?X:X.closest(`${_v} > *`))}),K.sort((X,ue)=>ue[1]-X[1]).forEach(X=>{var ue;let te=(ue=A.current)==null?void 0:ue.querySelector(`${Vc}[${Gi}="${encodeURIComponent(X[0])}"]`);te?.parentElement.appendChild(te)})}function B(){let F=ae().find(ne=>ne.getAttribute("aria-disabled")!=="true"),K=F?.getAttribute(Gi);T.setState("value",K||void 0)}function q(){var F,K,ne,X;if(!n.current.search||d.current.shouldFilter===!1){n.current.filtered.count=s.current.size;return}n.current.filtered.groups=new Set;let ue=0;for(let te of s.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(Vc))==null?void 0:K.querySelector(IY))==null||ne.scrollIntoView({block:"nearest"})),X.scrollIntoView({block:"nearest"}))}function G(){var F;return(F=A.current)==null?void 0:F.querySelector(`${uT}[aria-selected="true"]`)}function ae(){var F;return Array.from(((F=A.current)==null?void 0:F.querySelectorAll(NC))||[])}function L(F){let K=ae()[F];K&&T.setState("value",K.getAttribute(Gi))}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(Gi))}function U(F){let K=G(),ne=K?.closest(Vc),X;for(;ne&&!X;)ne=F>0?GY(ne,Vc):ZY(ne,Vc),X=ne?.querySelector(NC);X?T.setState("value",X.getAttribute(Gi)):$(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(ar.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(gx);X.dispatchEvent(ue)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:O.inputId,id:O.labelId,style:XY},h),hm(e,F=>p.createElement(fT.Provider,{value:T},p.createElement(dT.Provider,{value:O},F))))}),FY=p.forwardRef((e,t)=>{var n,s;let o=gn(),l=p.useRef(null),u=p.useContext(hT),d=Qu(),h=pT(e),m=(s=(n=h.current)==null?void 0:n.forceMount)!=null?s:u?.forceMount;Ho(()=>{if(!m)return d.item(o,u?.id)},[m]);let v=gT(o,l,[e.value,e.children,l],e.keywords),g=nb(),y=Za(R=>R.value&&R.value===v.current),w=Za(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(gx,S),()=>R.removeEventListener(gx,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(ar.div,{ref:_s(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)}),BY=p.forwardRef((e,t)=>{let{heading:n,children:s,forceMount:o,...l}=e,u=gn(),d=p.useRef(null),h=p.useRef(null),m=gn(),v=Qu(),g=Za(w=>o||v.filter()===!1?!0:w.search?w.filtered.groups.has(u):!0);Ho(()=>v.group(u),[]),gT(u,d,[e.value,e.heading,h]);let y=p.useMemo(()=>({id:u,forceMount:o}),[o]);return p.createElement(ar.div,{ref:_s(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),hm(e,w=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?m:void 0},p.createElement(hT.Provider,{value:y},w))))}),UY=p.forwardRef((e,t)=>{let{alwaysRender:n,...s}=e,o=p.useRef(null),l=Za(u=>!u.search);return!n&&!l?null:p.createElement(ar.div,{ref:_s(o,t),...s,"cmdk-separator":"",role:"separator"})}),VY=p.forwardRef((e,t)=>{let{onValueChange:n,...s}=e,o=e.value!=null,l=nb(),u=Za(m=>m.search),d=Za(m=>m.selectedItemId),h=Qu();return p.useEffect(()=>{e.value!=null&&l.setState("search",e.value)},[e.value]),p.createElement(ar.input,{ref:t,...s,"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)}})}),qY=p.forwardRef((e,t)=>{let{children:n,label:s="Suggestions",...o}=e,l=p.useRef(null),u=p.useRef(null),d=Za(m=>m.selectedItemId),h=Qu();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(ar.div,{ref:_s(l,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":s,id:h.listId},hm(e,m=>p.createElement("div",{ref:_s(u,h.listInnerRef),"cmdk-list-sizer":""},m)))}),HY=p.forwardRef((e,t)=>{let{open:n,onOpenChange:s,overlayClassName:o,contentClassName:l,container:u,...d}=e;return p.createElement($u,{open:n,onOpenChange:s},p.createElement(Fu,{container:u},p.createElement(Bu,{"cmdk-overlay":"",className:o}),p.createElement(Uu,{"aria-label":e.label,"cmdk-dialog":"",className:l},p.createElement(mT,{ref:t,...d}))))}),YY=p.forwardRef((e,t)=>Za(n=>n.filtered.count===0)?p.createElement(ar.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),WY=p.forwardRef((e,t)=>{let{progress:n,children:s,label:o="Loading...",...l}=e;return p.createElement(ar.div,{ref:t,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},hm(e,u=>p.createElement("div",{"aria-hidden":!0},u)))}),Xo=Object.assign(mT,{List:qY,Item:FY,Input:VY,Group:BY,Separator:UY,Dialog:HY,Empty:YY,Loading:WY});function GY(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ZY(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function pT(e){let t=p.useRef(e);return Ho(()=>{t.current=e}),t}var Ho=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Zi(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function Za(e){let t=nb(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function gT(e,t,n,s=[]){let o=p.useRef(),l=Qu();return Ho(()=>{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=s.map(m=>m.trim());l.value(e,d,h),(u=t.current)==null||u.setAttribute(Gi,d),o.current=d}),o}var QY=()=>{let[e,t]=p.useState(),n=Zi(()=>new Map);return Ho(()=>{n.current.forEach(s=>s()),n.current=new Map},[e]),(s,o)=>{n.current.set(s,o),t({})}};function KY(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function hm({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(KY(t),{ref:t.ref},n(t.props.children)):n(t)}var XY={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function vT({className:e,...t}){return i.jsx(Xo,{"data-slot":"command",className:W("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function xT({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(Xo.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 yT({className:e,...t}){return i.jsx(Xo.List,{"data-slot":"command-list",className:W("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function bT({...e}){return i.jsx(Xo.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function wT({className:e,...t}){return i.jsx(Xo.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 JY({className:e,...t}){return i.jsx(Xo.Separator,{"data-slot":"command-separator",className:W("bg-border -mx-1 h-px",e),...t})}function ST({className:e,...t}){return i.jsx(Xo.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 jT({selectedTermIds:e,onChange:t,taxonomyId:n,placeholder:s="Filter by tags...",disabled:o=!1,className:l}){const u=xn(),[d,h]=p.useState(!1),[m,v]=p.useState(""),g=Ye(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=Ye(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(_u,{open:d,onOpenChange:h,children:[i.jsx(Eu,{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:s}):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(yt,{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(Tu,{className:"w-[280px] p-0",align:"start",children:i.jsxs(vT,{shouldFilter:!1,children:[i.jsx(xT,{placeholder:`Search ${R.toLowerCase()}...`,value:m,onValueChange:v}),i.jsx(yT,{children:_.length===0?i.jsx(bT,{children:N.length===0?`No ${R.toLowerCase()} found`:"No matches"}):i.jsx(wT,{heading:R,children:_.map(D=>i.jsx(eW,{term:D,isSelected:e.includes(D._id),onToggle:()=>E(D._id)},D._id))})}),e.length>0&&i.jsxs(i.Fragment,{children:[i.jsx(JY,{}),i.jsxs("div",{className:"p-2",children:[i.jsx("div",{className:"mb-2 flex flex-wrap gap-1",children:C.map(D=>i.jsxs(yt,{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 eW({term:e,isSelected:t,onToggle:n}){return i.jsxs(ST,{onSelect:n,className:"cursor-pointer",children:[i.jsx(Sr,{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(Ts,{className:"ml-1 size-4 text-primary"})]})}var tW=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"}),nW="VisuallyHidden",CT=p.forwardRef((e,t)=>i.jsx(ar.span,{...e,ref:t,style:{...tW,...e.style}}));CT.displayName=nW;function rW(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 sW(e){if(!e||e===0)return"0 B";const t=1024,n=["B","KB","MB","GB"],s=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,s)).toFixed(1))} ${n[s]}`}function aW(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function oW(e,t="size-16"){const n={className:t};switch(e){case"image":return i.jsx(rs,{...n});case"video":return i.jsx(ay,{...n});case"audio":return i.jsx(Jx,{...n});case"document":return i.jsx(jr,{...n});default:return i.jsx(Wx,{...n})}}function iW({asset:e,assets:t,currentIndex:n,open:s,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(s)switch(_.key){case"ArrowLeft":_.preventDefault(),v();break;case"ArrowRight":_.preventDefault(),g();break;case"Escape":_.preventDefault(),o(!1);break}},[s,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=rW(e.mimeType),N=j==="image",C=!!e.url;return i.jsx(yl,{open:s,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(CT,{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(VN,{className:"size-4"})}),i.jsx(me,{variant:"ghost",size:"icon",onClick:w,disabled:!e.url,title:"Download",children:i.jsx(Zv,{className:"size-4"})}),u&&i.jsx(me,{variant:"ghost",size:"icon",onClick:()=>u(e),title:"Edit",children:i.jsx(ua,{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:[oW(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(Zv,{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(Js,{label:"Filename",value:e.name}),e.title&&i.jsx(Js,{label:"Title",value:e.title}),e.description&&i.jsx(Js,{label:"Description",value:e.description}),e.altText&&i.jsx(Js,{label:"Alt Text",value:e.altText}),i.jsxs("div",{className:"border-t pt-4",children:[i.jsx(Js,{label:"Type",value:j,capitalize:!0}),e.mimeType&&i.jsx(Js,{label:"MIME Type",value:e.mimeType}),i.jsx(Js,{label:"Size",value:sW(e.size)}),e.width&&e.height&&i.jsx(Js,{label:"Dimensions",value:`${e.width} × ${e.height} px`})]}),i.jsx("div",{className:"border-t pt-4",children:i.jsx(Js,{label:"Uploaded",value:aW(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 Js({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 lW({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 cW({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 uW=Zo("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(uW({orientation:t}),e),...n})}function ws({className:e,...t}){return i.jsx(st,{"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 To({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 NT({className:e,children:t,errors:n,...s}){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),...s,children:o}):null}function dW({mediaId:e,taxonomyId:t,taxonomyName:n="Tags",allowCreate:s=!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=Ye(u.getTermsByMedia,{mediaId:e,taxonomyId:t}),A=M?.map(L=>L._id)??[],T=Ye(u.suggestTerms,{taxonomyId:t,query:d,limit:10,excludeIds:A})??[],O=Ke(u.setMediaTerms),D=Ke(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]),q=p.useCallback(async()=>{if(!(!d.trim()||!s)){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,s,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()&&s&&q();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=s&&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(Do,{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(yt,{variant:"secondary",className:"gap-1 pr-1",style:L.color?{backgroundColor:L.color,color:"#fff"}:void 0,children:[L.name,!o&&i.jsx(tt,{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(pt,{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:q,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 fW({asset:e,open:t,onOpenChange:n,onSaved:s}){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=Ke(o.updateMediaAsset),A=Ye(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}),s?.(),n(!1)}catch(T){_(T instanceof Error?T.message:"Failed to update asset")}finally{N(!1)}}},[e,l,d,m,g,w,E,s,n]);return e?i.jsx(cs,{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(pt,{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(pt,{id:"asset-title",value:d,onChange:T=>h(T.target.value),placeholder:"Enter title (optional)"}),i.jsx(To,{children:"A human-readable title for the file"})]}),i.jsxs(bs,{children:[i.jsx(ws,{htmlFor:"asset-description",children:"Description"}),i.jsx(eo,{id:"asset-description",value:m,onChange:T=>v(T.target.value),placeholder:"Enter description (optional)",rows:3}),i.jsx(To,{children:"A brief description of the file"})]}),i.jsxs(bs,{children:[i.jsx(ws,{htmlFor:"asset-alt",children:"Alt Text"}),i.jsx(pt,{id:"asset-alt",value:g,onChange:T=>y(T.target.value),placeholder:"Describe the image content"}),i.jsx(To,{children:"Alternative text for accessibility (important for images)"})]}),i.jsxs(bs,{children:[i.jsx(ws,{htmlFor:"asset-tags",children:"Quick Tags"}),i.jsx(pt,{id:"asset-tags",value:w,onChange:T=>S(T.target.value),placeholder:"e.g., hero, blog, product"}),i.jsx(To,{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(dW,{mediaId:e._id,taxonomyId:T._id,taxonomyName:T.displayName,allowCreate:T.allowInlineCreation,disabled:j},T._id))]})]})}):null}function hW({folder:e,open:t,onOpenChange:n,onSaved:s}){const o=xn(),[l,u]=p.useState(""),[d,h]=p.useState(""),[m,v]=p.useState(!1),[g,y]=p.useState(""),w=Ke(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}),s?.(),n(!1)}catch(j){y(j instanceof Error?j.message:"Failed to update folder")}finally{v(!1)}}},[e,l,d,w,s,n]);return e?i.jsx(cs,{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(pt,{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(eo,{id:"folder-description",value:d,onChange:j=>h(j.target.value),placeholder:"Enter description (optional)",rows:3}),i.jsx(To,{children:"A brief description of the folder contents"})]})]})}):null}function mW({asset:e,onView:t,onEdit:n,onMove:s,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(V3,{className:"size-4"})})}),i.jsxs(Cl,{side:"bottom",onClick:d=>d.stopPropagation(),children:[t&&i.jsxs(pn,{onClick:t,children:[i.jsx(ah,{className:"mr-2 size-4"}),"View Details"]}),n&&i.jsxs(pn,{onClick:n,children:[i.jsx(ua,{className:"mr-2 size-4"}),"Edit"]}),s&&i.jsxs(pn,{onClick:s,children:[i.jsx(Gx,{className:"mr-2 size-4"}),"Move to..."]}),i.jsx(qo,{}),i.jsxs(pn,{onClick:l,disabled:!e.url,children:[i.jsx(Zv,{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(qo,{}),i.jsxs(pn,{onClick:o,className:"text-destructive focus:text-destructive",children:[i.jsx(Fn,{className:"mr-2 size-4"}),"Delete"]})]})]})]})}function pW({folder:e,onEdit:t,onMove:n,onDelete:s}){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(HN,{className:"size-4"})})}),i.jsxs(Cl,{align:"end",onClick:o=>o.stopPropagation(),children:[t&&i.jsxs(pn,{onClick:t,children:[i.jsx(ua,{className:"mr-2 size-4"}),"Rename"]}),n&&i.jsxs(pn,{onClick:n,children:[i.jsx(Gx,{className:"mr-2 size-4"}),"Move to..."]}),s&&i.jsxs(i.Fragment,{children:[i.jsx(qo,{}),i.jsxs(pn,{onClick:s,className:"text-destructive focus:text-destructive",children:[i.jsx(Fn,{className:"mr-2 size-4"}),"Delete"]})]})]})]})}function gW({selectedCount:e,onClear:t,onMove:n,onDelete:s,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:s,loading:o,children:[i.jsx(Fn,{className:"mr-2 size-4"}),"Delete"]})]})]})})}function vW({selectedCount:e,onClear:t,onRestore:n,onPermanentDelete:s,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:s,loading:l,disabled:o,children:[i.jsx(Fn,{className:"mr-2 size-4"}),"Delete Forever"]})]})]})})}function xW({open:e,onOpenChange:t,assetIds:n,currentFolderId:s,onMoved:o}){const l=xn(),[u,d]=p.useState(void 0),[h,m]=p.useState(!1),[v,g]=p.useState(""),y=Ye(l.getMediaFolderTree,{}),w=Ke(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===s,C=u===void 0;return i.jsx(cs,{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",s===void 0&&"opacity-50"),onClick:()=>d(void 0),children:[i.jsx(Ah,{className:"size-4"}),i.jsx("span",{className:"font-medium",children:"Root (All Files)"}),s===void 0&&i.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"Current"})]}),S.map(_=>{const E=_._id===s,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(ih,{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 mm="Tabs",[yW]=Dn(mm,[Vl]),kT=Vl(),[bW,rb]=yW(mm),_T=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:o,defaultValue:l,orientation:u="horizontal",dir:d,activationMode:h="automatic",...m}=e,v=Bl(d),[g,y]=rr({prop:s,onChange:o,defaultProp:l??"",caller:mm});return i.jsx(bW,{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})})});_T.displayName=mm;var ET="TabsList",TT=p.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...o}=e,l=rb(ET,n),u=kT(n);return i.jsx(Vy,{asChild:!0,...u,orientation:l.orientation,dir:l.dir,loop:s,children:i.jsx(ze.div,{role:"tablist","aria-orientation":l.orientation,...o,ref:t})})});TT.displayName=ET;var MT="TabsTrigger",RT=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:o=!1,...l}=e,u=rb(MT,n),d=kT(n),h=DT(u.baseId,s),m=zT(u.baseId,s),v=s===u.value;return i.jsx(qy,{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(s):g.preventDefault()}),onKeyDown:Se(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&u.onValueChange(s)}),onFocus:Se(e.onFocus,()=>{const g=u.activationMode!=="manual";!v&&!o&&g&&u.onValueChange(s)})})})});RT.displayName=MT;var AT="TabsContent",OT=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:o,children:l,...u}=e,d=rb(AT,n),h=DT(d.baseId,s),m=zT(d.baseId,s),v=s===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})})});OT.displayName=AT;function DT(e,t){return`${e}-trigger-${t}`}function zT(e,t){return`${e}-content-${t}`}var wW=_T,SW=TT,jW=RT,CW=OT;function PT({className:e,...t}){return i.jsx(wW,{"data-slot":"tabs",className:W("flex flex-col gap-2",e),...t})}function LT({className:e,...t}){return i.jsx(SW,{"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 Ch({className:e,...t}){return i.jsx(jW,{"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 kC({className:e,...t}){return i.jsx(CW,{"data-slot":"tabs-content",className:W("flex-1 outline-none",e),...t})}function NW(e){if(e===0)return"0 B";const t=1024,n=["B","KB","MB","GB"],s=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,s)).toFixed(1))} ${n[s]}`}function kW(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function _W(e,t="size-6"){const n={className:t};switch(e){case"image":return i.jsx(rs,{...n});case"video":return i.jsx(ay,{...n});case"audio":return i.jsx(Jx,{...n});case"document":return i.jsx(jr,{...n});default:return i.jsx(Wx,{...n})}}function EW(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 TW({api:e,navigation:t,settings:n}){p.useEffect(()=>{n&&!n.features.mediaManagement&&t.navigate("/")},[n,t]);const[s,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,q]=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),[Be,be]=p.useState(null),Ue=X==="trash",rt=Ye(e.listMediaAssets,{folderId:Ue?void 0:s,type:d||void 0,search:l||void 0,deletedOnly:Ue?!0:void 0,paginationOpts:{numItems:100,cursor:null}}),it=Ye(e.getMediaTrashCount,{}),bt=Ye(e.getMediaByTerm,m[0]?{termId:m[0]}:"skip"),pe=Ye(e.getMediaByTerm,m[1]?{termId:m[1]}:"skip"),Le=Ye(e.getMediaByTerm,m[2]?{termId:m[2]}:"skip"),We=p.useMemo(()=>{if(m.length===0)return null;const Q=new Set,je=[bt,pe,Le];for(let Ve=0;Ve<m.length&&Ve<3;Ve++){const vt=je[Ve];if(vt?.page)for(const Je of vt.page)Q.add(Je)}return Q},[m,bt,pe,Le]),Oe=Ye(e.listMediaFolders,{parentId:Ue?void 0:s,deletedOnly:Ue||void 0}),ft=Ye(e.getMediaFolder,s?{id:s}:"skip"),ut=Ye(e.getMediaFolderTree,{}),Mn=Ke(e.createMediaFolder),Xe=Ke(e.deleteMediaAsset),wt=Ke(e.deleteMediaFolder),gt=Ke(e.restoreMediaAsset),qn=Ke(e.restoreMediaFolder),ir=Ke(e.permanentDeleteMediaAsset),Yr=Ke(e.bulkPermanentDeleteMediaAssets),zn=p.useMemo(()=>{if(!s||!ut)return[];const Q=[];let je=ut.find(Ve=>Ve._id===s);for(;je;){Q.unshift(je);const Ve=je.parentId;je=Ve?ut.find(vt=>vt._id===Ve):void 0}return Q},[s,ut]),Pn=p.useCallback(Q=>{o(Q),u("")},[]),Vt=p.useCallback(()=>{ft?.parentId?o(ft.parentId):o(void 0)},[ft]),en=p.useCallback(()=>{o(void 0),u("")},[]),$t=p.useCallback(Q=>{y(je=>{const Ve=new Set(je);return Ve.has(Q)?Ve.delete(Q):Ve.add(Q),Ve})},[]),ds=p.useCallback(()=>{rt?.page&&y(new Set(rt.page.map(Q=>Q._id)))},[rt?.page]),Wr=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=rt?.page?.findIndex(Ve=>Ve._id===Q)??-1;je!==-1&&z(je)}},[w,$t,rt?.page]),we=p.useCallback(Q=>{z(Q)},[]),Ne=p.useCallback(async()=>{if(ae){U(!0);try{ae.type==="asset"?await Xe({id:ae.id}):await wt({id:ae.id}),L(null)}catch(Q){console.error("Delete failed:",Q)}finally{U(!1)}}},[ae,Xe,wt]),He=p.useCallback(async()=>{if(g.size!==0){ne(!0);try{const Q=Array.from(g).map(je=>Xe({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,Xe]),De=p.useCallback(()=>{y(new Set),S(!1)},[]),St=p.useCallback(async Q=>{ye(!0);try{await gt({id:Q})}catch(je){console.error("Restore failed:",je)}finally{ye(!1)}},[gt]),bn=p.useCallback(async()=>{if(g.size!==0){ye(!0);try{const Q=Array.from(g).map(je=>gt({id:je}));await Promise.all(Q),y(new Set),S(!1)}catch(Q){console.error("Bulk restore failed:",Q)}finally{ye(!1)}}},[g,gt]),tn=p.useCallback(async Q=>{ye(!0);try{await qn({id:Q})}catch(je){console.error("Restore folder failed:",je)}finally{ye(!1)}},[qn]),Gt=p.useCallback(async()=>{if(Be){_e(!0);try{Be==="bulk"?(await Yr({ids:Array.from(g)}),y(new Set),S(!1)):await ir({id:Be}),ge(!1),be(null)}catch(Q){console.error("Permanent delete failed:",Q)}finally{_e(!1)}}},[Be,ir,Yr,g]),Ot=p.useCallback(async()=>{if(!E.trim()){O("Folder name is required");return}R(!0),O("");try{await Mn({name:E.trim(),parentId:s}),N(!1),M("")}catch(Q){O(Q instanceof Error?Q.message:"Failed to create folder")}finally{R(!1)}},[E,s,Mn]),Rn=p.useCallback(Q=>{_(!1)},[]),Hn=rt===void 0||Oe===void 0,wn=p.useMemo(()=>{const Q=rt?.page??[];return We===null?Q:Q.filter(je=>We.has(je._id))},[rt?.page,We]);return i.jsxs("div",{className:"flex flex-col gap-4 md:gap-6",children:[i.jsx(os,{title:"Media Library",description:"Upload, organize, and manage media assets for your content."}),i.jsx(PT,{value:X,onValueChange:Q=>xe(Q),children:i.jsxs(LT,{children:[i.jsxs(Ch,{value:"library",children:[i.jsx(rs,{className:"mr-1.5 size-4"}),"Library"]}),i.jsxs(Ch,{value:"trash",children:[i.jsx(Fn,{className:"mr-1.5 size-4"}),"Trash",it&&it.total>0&&i.jsx(yt,{variant:"secondary",className:"ml-1.5",children:it.total})]})]})}),!Ue&&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",s?"text-muted-foreground hover:bg-muted hover:text-foreground":"bg-primary/10 font-medium text-primary"),onClick:en,children:[i.jsx(Ah,{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(fm,{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(jT,{selectedTermIds:m,onChange:v,placeholder:"Tags"}),rt?.page&&rt.page.length>0&&i.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-sm",children:[i.jsx(Sr,{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:ds,children:"Select All"}),i.jsx(me,{variant:"secondary",size:"sm",onClick:Wr,children:"Clear"})]}),s&&!Ue&&i.jsxs(me,{variant:"secondary",onClick:Vt,children:[i.jsx(Hx,{className:"size-4"}),"Up"]}),!Ue&&i.jsxs(i.Fragment,{children:[i.jsxs(me,{variant:"secondary",onClick:()=>N(!0),children:[i.jsx(oP,{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:[!Ue&&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(pW,{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(ih,{className:"size-10 text-amber-500"}),i.jsx("span",{className:"truncate text-sm font-medium",children:Q.name})]},Q._id))})]}),Ue&&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(ih,{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:[!Ue&&Oe&&Oe.length>0&&!l&&i.jsx("h3",{className:"mb-3 text-sm font-medium text-muted-foreground",children:"Files"}),Ue&&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,Ve=g.has(je),vt=EW(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",Ve&&"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(Sr,{checked:Ve,onCheckedChange:()=>$t(je),onClick:Je=>Je.stopPropagation(),className:"bg-white/80"})}),!w&&!Ue&&i.jsx("div",{className:"absolute right-2 top-2 z-10",children:i.jsx(mW,{asset:{_id:Q._id,name:Q.name,url:Q.url},onView:()=>{const Je=wn.findIndex(Yn=>Yn._id===Q._id);Je!==-1&&z(Je)},onEdit:()=>q({_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&&Ue&&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:Je=>{Je.stopPropagation(),St(Q._id)},title:"Restore",children:i.jsx(xu,{className:"size-4"})}),i.jsx(me,{variant:"danger",size:"icon-sm",onClick:Je=>{Je.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:vt==="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:_W(vt,"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:vt}),i.jsx("span",{children:"•"}),i.jsx("span",{children:NW(Q.size??0)})]}),i.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:kW(Q._creationTime)})]})]},Q._id)})}),!rt.isDone&&i.jsxs("p",{className:"mt-4 text-center text-sm text-muted-foreground",children:["Showing ",rt.page.length," files. More files available."]})]}):Ue?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(rs,{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&&!Ue&&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(ju,{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(st,{htmlFor:"folder-name",children:"Folder Name"}),i.jsx(pt,{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(Cu,{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(ju,{children:i.jsx(wl,{children:"Upload Files"})}),i.jsx("div",{className:"py-4",children:i.jsx(iT,{currentFolderId:s,generateUploadUrl:e.generateUploadUrl,createAsset:e.createMediaAsset,onUploadComplete:Rn,maxFileSize:50*1024*1024,maxConcurrentUploads:3})}),i.jsx(Cu,{children:i.jsx(me,{variant:"secondary",onClick:()=>_(!1),children:"Close"})})]})}),i.jsx(iW,{asset:D!==null&&wn[D]?wn[D]:null,assets:wn,currentIndex:D??0,open:D!==null,onOpenChange:Q=>{Q||z(null)},onNavigate:we,onEdit:Ue?void 0:Q=>q({_id:Q._id,name:Q.name,title:Q.title,description:Q.description,altText:Q.altText,tags:Q.tags}),onDelete:Ue?void 0:Q=>L({type:"asset",id:Q._id,name:Q.name})}),i.jsx(fW,{asset:B,open:B!==null,onOpenChange:Q=>{Q||q(null)}}),i.jsx(hW,{folder:Y,open:Y!==null,onOpenChange:Q=>{Q||G(null)}}),i.jsx(sa,{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(sa,{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:He,variant:"danger",loading:K}),i.jsx(sa,{open:Re,onOpenChange:Q=>{ge(Q),Q||be(null)},title:Be==="bulk"?`Delete ${g.size} ${g.size===1?"File":"Files"} Forever?`:"Delete Forever?",description:Be==="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(xW,{open:H,onOpenChange:le,assetIds:Array.from(g),currentFolderId:s,onMoved:De}),w&&!Ue&&i.jsx(gW,{selectedCount:g.size,onClear:Wr,onMove:()=>le(!0),onDelete:()=>F(!0),isDeleting:K}),w&&Ue&&i.jsx(vW,{selectedCount:g.size,onClear:Wr,onRestore:bn,onPermanentDelete:()=>{be("bulk"),ge(!0)},isRestoring:te,isDeleting:Ce})]})}var pm="Switch",[MW]=Dn(pm),[RW,AW]=MW(pm),IT=p.forwardRef((e,t)=>{const{__scopeSwitch:n,name:s,checked:o,defaultChecked:l,required:u,disabled:d,value:h="on",onCheckedChange:m,form:v,...g}=e,[y,w]=p.useState(null),S=Ze(t,E=>w(E)),j=p.useRef(!1),N=y?v||!!y.closest("form"):!0,[C,_]=rr({prop:o,defaultProp:l??!1,onChange:m,caller:pm});return i.jsxs(RW,{scope:n,checked:C,disabled:d,children:[i.jsx(ze.button,{type:"button",role:"switch","aria-checked":C,"aria-required":u,"data-state":UT(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(BT,{control:y,bubbles:!j.current,name:s,value:h,checked:C,required:u,disabled:d,form:v,style:{transform:"translateX(-100%)"}})]})});IT.displayName=pm;var $T="SwitchThumb",FT=p.forwardRef((e,t)=>{const{__scopeSwitch:n,...s}=e,o=AW($T,n);return i.jsx(ze.span,{"data-state":UT(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t})});FT.displayName=$T;var OW="SwitchBubbleInput",BT=p.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:s=!0,...o},l)=>{const u=p.useRef(null),d=Ze(u,l),h=$y(n),m=Dy(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:s});w.call(v,n),v.dispatchEvent(S)}},[h,n,s]),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}})});BT.displayName=OW;function UT(e){return e?"checked":"unchecked"}var DW=IT,zW=FT;function nl({className:e,...t}){return i.jsx(DW,{"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(zW,{"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 VT="AlertDialog",[PW]=Dn(VT,[w_]),ha=w_(),qT=e=>{const{__scopeAlertDialog:t,...n}=e,s=ha(t);return i.jsx($u,{...s,...n,modal:!0})};qT.displayName=VT;var LW="AlertDialogTrigger",IW=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=ha(n);return i.jsx(vU,{...o,...s,ref:t})});IW.displayName=LW;var $W="AlertDialogPortal",HT=e=>{const{__scopeAlertDialog:t,...n}=e,s=ha(t);return i.jsx(Fu,{...s,...n})};HT.displayName=$W;var FW="AlertDialogOverlay",YT=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=ha(n);return i.jsx(Bu,{...o,...s,ref:t})});YT.displayName=FW;var ul="AlertDialogContent",[BW,UW]=PW(ul),VW=Fk("AlertDialogContent"),WT=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...o}=e,l=ha(n),u=p.useRef(null),d=Ze(t,u),h=p.useRef(null);return i.jsx(hU,{contentName:ul,titleName:GT,docsSlug:"alert-dialog",children:i.jsx(BW,{scope:n,cancelRef:h,children:i.jsxs(Uu,{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(VW,{children:s}),i.jsx(HW,{contentRef:u})]})})})});WT.displayName=ul;var GT="AlertDialogTitle",ZT=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=ha(n);return i.jsx(Vh,{...o,...s,ref:t})});ZT.displayName=GT;var QT="AlertDialogDescription",KT=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=ha(n);return i.jsx(_y,{...o,...s,ref:t})});KT.displayName=QT;var qW="AlertDialogAction",XT=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=ha(n);return i.jsx(qh,{...o,...s,ref:t})});XT.displayName=qW;var JT="AlertDialogCancel",eM=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:o}=UW(JT,n),l=ha(n),u=Ze(t,o);return i.jsx(qh,{...l,...s,ref:u})});eM.displayName=JT;var HW=({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 \`${QT}\` 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},YW=qT,WW=HT,GW=YT,ZW=WT,QW=XT,KW=eM,XW=ZT,JW=KT;function eG(e,t){return p.useReducer((n,s)=>t[n][s]??n,e)}var sb="ScrollArea",[tM]=Dn(sb),[tG,Hr]=tM(sb),nM=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:s="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=Ze(t,B=>h(B)),z=Bl(o);return i.jsx(tG,{scope:n,type:s,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}})})});nM.displayName=sb;var rM="ScrollAreaViewport",sM=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:s,nonce:o,...l}=e,u=Hr(rM,n),d=p.useRef(null),h=Ze(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:s})})]})});sM.displayName=rM;var Rs="ScrollAreaScrollbar",aM=p.forwardRef((e,t)=>{const{forceMount:n,...s}=e,o=Hr(Rs,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(nG,{...s,ref:t,forceMount:n}):o.type==="scroll"?i.jsx(rG,{...s,ref:t,forceMount:n}):o.type==="auto"?i.jsx(oM,{...s,ref:t,forceMount:n}):o.type==="always"?i.jsx(ab,{...s,ref:t}):null});aM.displayName=Rs;var nG=p.forwardRef((e,t)=>{const{forceMount:n,...s}=e,o=Hr(Rs,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(oM,{"data-state":l?"visible":"hidden",...s,ref:t})})}),rG=p.forwardRef((e,t)=>{const{forceMount:n,...s}=e,o=Hr(Rs,e.__scopeScrollArea),l=e.orientation==="horizontal",u=vm(()=>h("SCROLL_END"),100),[d,h]=eG("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(ab,{"data-state":d==="hidden"?"hidden":"visible",...s,ref:t,onPointerEnter:Se(e.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:Se(e.onPointerLeave,()=>h("POINTER_LEAVE"))})})}),oM=p.forwardRef((e,t)=>{const n=Hr(Rs,e.__scopeScrollArea),{forceMount:s,...o}=e,[l,u]=p.useState(!1),d=e.orientation==="horizontal",h=vm(()=>{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:s||l,children:i.jsx(ab,{"data-state":l?"visible":"hidden",...o,ref:t})})}),ab=p.forwardRef((e,t)=>{const{orientation:n="vertical",...s}=e,o=Hr(Rs,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=dM(d.viewport,d.content),v={...s,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 cG(y,u.current,d,w)}return n==="horizontal"?i.jsx(sG,{...v,ref:t,onThumbPositionChange:()=>{if(o.viewport&&l.current){const y=o.viewport.scrollLeft,w=_C(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(aG,{...v,ref:t,onThumbPositionChange:()=>{if(o.viewport&&l.current){const y=o.viewport.scrollTop,w=_C(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}),sG=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:s,...o}=e,l=Hr(Rs,e.__scopeScrollArea),[u,d]=p.useState(),h=p.useRef(null),m=Ze(t,h,l.onScrollbarXChange);return p.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),i.jsx(lM,{"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":gm(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),hM(y,g)&&v.preventDefault()}},onResize:()=>{h.current&&l.viewport&&u&&s({content:l.viewport.scrollWidth,viewport:l.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:kh(u.paddingLeft),paddingEnd:kh(u.paddingRight)}})}})}),aG=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:s,...o}=e,l=Hr(Rs,e.__scopeScrollArea),[u,d]=p.useState(),h=p.useRef(null),m=Ze(t,h,l.onScrollbarYChange);return p.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),i.jsx(lM,{"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":gm(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),hM(y,g)&&v.preventDefault()}},onResize:()=>{h.current&&l.viewport&&u&&s({content:l.viewport.scrollHeight,viewport:l.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:kh(u.paddingTop),paddingEnd:kh(u.paddingBottom)}})}})}),[oG,iM]=tM(Rs),lM=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:o,onThumbChange:l,onThumbPointerUp:u,onThumbPointerDown:d,onThumbPositionChange:h,onDragScroll:m,onWheelScroll:v,onResize:g,...y}=e,w=Hr(Rs,n),[S,j]=p.useState(null),N=Ze(t,D=>j(D)),C=p.useRef(null),_=p.useRef(""),E=w.viewport,M=s.content-s.viewport,A=Nn(v),R=Nn(h),T=vm(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,[s,R]),El(S,T),El(w.content,T),i.jsx(oG,{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})})})}),Nh="ScrollAreaThumb",cM=p.forwardRef((e,t)=>{const{forceMount:n,...s}=e,o=iM(Nh,e.__scopeScrollArea);return i.jsx(yn,{present:n||o.hasThumb,children:i.jsx(iG,{ref:t,...s})})}),iG=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:s,...o}=e,l=Hr(Nh,n),u=iM(Nh,n),{onThumbPositionChange:d}=u,h=Ze(t,g=>u.onThumbChange(g)),m=p.useRef(void 0),v=vm(()=>{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=uG(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)",...s},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)})});cM.displayName=Nh;var ob="ScrollAreaCorner",uM=p.forwardRef((e,t)=>{const n=Hr(ob,e.__scopeScrollArea),s=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&s?i.jsx(lG,{...e,ref:t}):null});uM.displayName=ob;var lG=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,...s}=e,o=Hr(ob,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,{...s,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 kh(e){return e?parseInt(e,10):0}function dM(e,t){const n=e/t;return isNaN(n)?0:n}function gm(e){const t=dM(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=(e.scrollbar.size-n)*t;return Math.max(s,18)}function cG(e,t,n,s="ltr"){const o=gm(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=s==="ltr"?[0,v]:[v*-1,0];return fM([h,m],g)(e)}function _C(e,t,n="ltr"){const s=gm(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,l=t.scrollbar.size-o,u=t.content-t.viewport,d=l-s,h=n==="ltr"?[0,u]:[u*-1,0],m=ix(e,h);return fM([0,u],[0,d])(m)}function fM(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(n-e[0])}}function hM(e,t){return e>0&&e<t}var uG=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},s=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,s=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(s)};function vm(e,t){const n=Nn(e),s=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(s.current),[]),p.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(n,t)},[n,t])}function El(e,t){const n=Nn(t);Jt(()=>{let s=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(s),o.unobserve(e)}}},[e,n])}var dG=nM,fG=sM,hG=uM,mM="Toggle",pM=p.forwardRef((e,t)=>{const{pressed:n,defaultPressed:s,onPressedChange:o,...l}=e,[u,d]=rr({prop:n,onChange:o,defaultProp:s??!1,caller:mM});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)})})});pM.displayName=mM;var so="ToggleGroup",[gM]=Dn(so,[Vl]),vM=Vl(),ib=ee.forwardRef((e,t)=>{const{type:n,...s}=e;if(n==="single"){const o=s;return i.jsx(mG,{...o,ref:t})}if(n==="multiple"){const o=s;return i.jsx(pG,{...o,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${so}\``)});ib.displayName=so;var[xM,yM]=gM(so),mG=ee.forwardRef((e,t)=>{const{value:n,defaultValue:s,onValueChange:o=()=>{},...l}=e,[u,d]=rr({prop:n,defaultProp:s??"",onChange:o,caller:so});return i.jsx(xM,{scope:e.__scopeToggleGroup,type:"single",value:ee.useMemo(()=>u?[u]:[],[u]),onItemActivate:d,onItemDeactivate:ee.useCallback(()=>d(""),[d]),children:i.jsx(bM,{...l,ref:t})})}),pG=ee.forwardRef((e,t)=>{const{value:n,defaultValue:s,onValueChange:o=()=>{},...l}=e,[u,d]=rr({prop:n,defaultProp:s??[],onChange:o,caller:so}),h=ee.useCallback(v=>d((g=[])=>[...g,v]),[d]),m=ee.useCallback(v=>d((g=[])=>g.filter(y=>y!==v)),[d]);return i.jsx(xM,{scope:e.__scopeToggleGroup,type:"multiple",value:u,onItemActivate:h,onItemDeactivate:m,children:i.jsx(bM,{...l,ref:t})})});ib.displayName=so;var[gG,vG]=gM(so),bM=ee.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:s=!1,rovingFocus:o=!0,orientation:l,dir:u,loop:d=!0,...h}=e,m=vM(n),v=Bl(u),g={role:"group",dir:v,...h};return i.jsx(gG,{scope:n,rovingFocus:o,disabled:s,children:o?i.jsx(Vy,{asChild:!0,...m,orientation:l,dir:v,loop:d,children:i.jsx(ze.div,{...g,ref:t})}):i.jsx(ze.div,{...g,ref:t})})}),_h="ToggleGroupItem",wM=ee.forwardRef((e,t)=>{const n=yM(_h,e.__scopeToggleGroup),s=vG(_h,e.__scopeToggleGroup),o=vM(e.__scopeToggleGroup),l=n.value.includes(e.value),u=s.disabled||e.disabled,d={...e,pressed:l,disabled:u},h=ee.useRef(null);return s.rovingFocus?i.jsx(qy,{asChild:!0,...o,focusable:!u,active:l,ref:h,children:i.jsx(EC,{...d,ref:t})}):i.jsx(EC,{...d,ref:t})});wM.displayName=_h;var EC=ee.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:s,...o}=e,l=yM(_h,n),u={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},d=l.type==="single"?u:void 0;return i.jsx(pM,{...d,...o,ref:t,onPressedChange:h=>{h?l.onItemActivate(s):l.onItemDeactivate(s)}})}),xG=ib,yG=wM;const bG=Zo("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"}}),SM=p.createContext({size:"default",variant:"default",spacing:0});function wG({className:e,variant:t,size:n,spacing:s=0,children:o,...l}){return i.jsx(xG,{"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":s,style:{"--gap":s},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(SM.Provider,{value:{variant:t,size:n,spacing:s},children:o})})}function SG({className:e,children:t,variant:n,size:s,...o}){const l=p.useContext(SM);return i.jsx(yG,{"data-slot":"toggle-group-item","data-variant":l.variant||n,"data-size":l.size||s,"data-spacing":l.spacing,className:W(bG({variant:l.variant||n,size:l.size||s}),"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 iu={versioning:!0,scheduling:!0,localization:!1,mediaManagement:!0},Vi={_id:null,defaultLocale:"en",availableLocales:["en","es","fr","de"],features:iu},jG=[{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)"}],CG=[{value:"light",label:"Light",icon:i.jsx(b5,{className:"size-4"})},{value:"dark",label:"Dark",icon:i.jsx(ZP,{className:"size-4"})},{value:"system",label:"System",icon:i.jsx(WP,{className:"size-4"})}];function jM(){const{theme:e,setTheme:t,canToggleDarkMode:n}=Y5();return n?i.jsxs(yr,{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(st,{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(wG,{type:"single",value:e,onValueChange:s=>s&&t(s),children:CG.map(s=>i.jsxs(SG,{value:s.value,children:[s.icon,s.label]},s.value))})]})})]}):null}function NG(){return i.jsx(jh,{requiredPermission:{resource:"settings",action:"manage"},children:i.jsxs("div",{className:"flex flex-col gap-4 md:gap-6",children:[i.jsx(os,{title:"Settings",description:"Configure your CMS settings and preferences."}),i.jsxs("div",{className:"flex flex-col gap-6",children:[i.jsx(jM,{}),i.jsxs(Mu,{children:[i.jsx(NP,{className:"size-4"}),i.jsxs(Ru,{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(yr,{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(yt,{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(st,{className:"text-sm font-medium capitalize",children:e})}),i.jsx(nl,{checked:iu[e],disabled:!0})]},e))})]}),i.jsxs(yr,{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(st,{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 kG({api:e}){const{canManageSettings:t}=cm(),n=t(),s=Lh(),o=Ye(e.getSettings,{}),l=Ke(e.updateSettings??(()=>{})),u=Ke(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??Vi.defaultLocale,availableLocales:o.availableLocales??Vi.availableLocales,features:{...iu,...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({...Vi,_id:T?._id??null,defaultLocale:T?.defaultLocale??Vi.defaultLocale,availableLocales:T?.availableLocales??Vi.availableLocales,features:{...iu,...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(jh,{requiredPermission:{resource:"settings",action:"manage"},children:i.jsxs("div",{className:"flex flex-col gap-4 md:gap-6",children:[i.jsx(os,{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??Vi,A=M.features??iu;return i.jsx(jh,{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(os,{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(yt,{variant:"secondary",className:"gap-1 bg-diff-added-bg text-diff-added-foreground",children:[i.jsx(Ts,{className:"size-3"}),"Settings saved successfully"]}),g==="error"&&i.jsxs(yt,{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(jM,{}),A.localization&&i.jsxs(yr,{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(st,{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(aa,{value:M.defaultLocale,onValueChange:N,disabled:!n||g==="saving"||!e.updateSettings,children:[i.jsx(ia,{className:"w-48",children:i.jsx(oa,{})}),i.jsx(la,{children:jG.map(R=>i.jsx(Xt,{value:R.value,children:R.label},R.value))})]})]})})]}),i.jsxs(yr,{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(yt,{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(st,{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(nl,{checked:A.versioning,disabled:!0})]}),i.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[i.jsxs("div",{children:[i.jsx(st,{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(nl,{checked:A.scheduling,disabled:!0})]}),i.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[i.jsxs("div",{children:[i.jsx(st,{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(nl,{checked:A.localization,disabled:!0})]}),s.navigation.showMedia&&i.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[i.jsxs("div",{children:[i.jsx(st,{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(nl,{checked:A.mediaManagement,disabled:!0})]})]})]}),i.jsxs(yr,{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(st,{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(yr,{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(st,{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 _G({api:e,navigation:t}){return e.getSettings?i.jsx(kG,{api:e}):i.jsx(NG,{})}function EG({taxonomy:e,onSave:t,onCancel:n}){const s=!!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=Ke(S.createTaxonomy),N=Ke(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),!s&&!y&&C("name",_(R))},[C,s,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{s&&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,s,e,o,j,N,t]);return i.jsx(cs,{open:!0,onOpenChange:R=>!R&&!h&&n(),title:s?"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:s?"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(st,{htmlFor:"displayName",children:["Display Name ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(pt,{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(st,{htmlFor:"name",children:["Slug ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(pt,{id:"name",value:o.name,onChange:R=>{C("name",R.target.value.toLowerCase()),w(!0)},placeholder:"e.g., categories, tags",disabled:h||s,className:u.name?"border-destructive":""}),u.name&&i.jsx("p",{className:"text-xs text-destructive",children:u.name}),s&&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(st,{htmlFor:"description",children:"Description"}),i.jsx(eo,{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(st,{htmlFor:"icon",children:"Icon"}),i.jsx(pt,{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(st,{htmlFor:"sortOrder",children:"Sort Order"}),i.jsx(pt,{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(Sr,{id:"isHierarchical",checked:o.isHierarchical,onCheckedChange:R=>C("isHierarchical",R),disabled:h||s}),i.jsxs("div",{className:"flex flex-col gap-0.5",children:[i.jsx(st,{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)"}),s&&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(Sr,{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(st,{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(Sr,{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(st,{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 TG({taxonomyId:e,isHierarchical:t,allowInlineCreation:n}){const s=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?Ye(s.getTermsHierarchy,{taxonomyId:e}):Ye(s.listTerms,{taxonomyId:e}),C=Ke(s.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,q=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":q,children:B&&(q?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(ua,{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&&q&&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(MG,{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(sa,{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 MG({taxonomyId:e,term:t,parentId:n,isHierarchical:s,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(),_=Ke(C.createTerm),E=Ke(C.updateTerm),M=p.useCallback((z,B)=>{h(q=>({...q,[z]:B})),v(q=>{const{[z]:Y,...G}=q;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 q=B instanceof Error?B.message:"Failed to save term";S(q)}finally{y(!1)}}},[T,u,t,d,e,n,_,E,o]),D=u?"Edit Term":n?"Create Child Term":"Create Term";return i.jsx(cs,{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(st,{htmlFor:"termName",children:["Name ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(pt,{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(st,{htmlFor:"termSlug",children:["Slug ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(pt,{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(st,{htmlFor:"termDescription",children:"Description"}),i.jsx(eo,{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(st,{htmlFor:"termColor",children:"Color"}),i.jsx(pt,{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(st,{htmlFor:"termIcon",children:"Icon"}),i.jsx(pt,{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(st,{htmlFor:"termSortOrder",children:"Sort Order"}),i.jsx(pt,{id:"termSortOrder",type:"number",value:d.sortOrder,onChange:z=>M("sortOrder",parseInt(z.target.value)||0),disabled:g})]})]})]})})}function Ku({className:e,children:t,...n}){return i.jsxs(dG,{"data-slot":"scroll-area",className:W("relative",e),...n,children:[i.jsx(fG,{"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(RG,{}),i.jsx(hG,{})]})}function RG({className:e,orientation:t="vertical",...n}){return i.jsx(aM,{"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(cM,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function AG({api:e,navigation:t}){const[n,s]=p.useState(null),[o,l]=p.useState(!1),[u,d]=p.useState(null),[h,m]=p.useState(null),[v,g]=p.useState(null),y=Ye(e.listTaxonomies,{isActive:void 0,includeDeleted:!1}),w=Ke(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&&s(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(lP,{className:"size-5"}):i.jsx(Do,{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(os,{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(yr,{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(Do,{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(Ku,{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:()=>s(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(yt,{variant:"secondary",className:"text-xs font-normal",children:A.isHierarchical?"Hierarchical":"Flat"}),!A.isActive&&i.jsx(yt,{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(ua,{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(yr,{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(TG,{taxonomyId:n._id,isHierarchical:n.isHierarchical,allowInlineCreation:n.allowInlineCreation})})]}):i.jsx(Bn,{icon:i.jsx(Do,{className:"size-6"}),title:"Select a taxonomy",description:"Select a taxonomy to view and manage its terms",className:"h-full"})})]}),o&&i.jsx(EG,{taxonomy:u,onSave:E,onCancel:()=>{l(!1),d(null)}}),i.jsx(sa,{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 OG({api:e,navigation:t}){const[n,s]=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),_=Ye(e.listTrash,{contentTypeId:n||void 0,search:o||void 0,paginationOpts:{numItems:50,cursor:null}}),E=Ye(e.getTrashConfig,{}),M=Ye(e.getTrashStats,{}),R=Ye(e.listContentTypes,{})?.page??[],T=Ke(e.bulkRestore),O=Ke(e.emptyTrash),D=_?.page??[],z=_===void 0,B=E,q=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(yt,{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(os,{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"]})]}),q&&i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[i.jsxs(yr,{elevation:"base",className:"p-4",children:[i.jsx("p",{className:"text-2xl font-semibold text-foreground",children:q.totalCount??0}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Items in Trash"})]}),i.jsxs(yr,{elevation:"base",className:"p-4",children:[i.jsx("p",{className:"text-2xl font-semibold text-foreground",children:q.expiredCount??0}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Expired"})]})]}),i.jsx(fm,{search:{value:o,onChange:l,placeholder:"Search deleted items...",className:"w-full md:w-64"},filters:[{key:"contentType",value:n||"all",onChange:H=>s(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(Mu,{variant:"destructive",children:[i.jsx(Io,{className:"size-4"}),i.jsxs(Ru,{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(Mu,{variant:"destructive",children:[i.jsx(Io,{className:"size-4"}),i.jsxs(Ru,{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(tb,{columns:U,data:D,getRowId:H=>H._id,selectable:!0,selectedIds:u,onSelectionChange:d,emptyMessage:"No items in trash"}),i.jsx(sa,{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 DG(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 vx=1;class zG{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:s,...o}=t,l=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:vx++,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:s}),{...h,...t,id:l,dismissible:d,title:s}):h):this.addToast({title:s,...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(s=>s({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 s;n.loading!==void 0&&(s=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=s!==void 0,u;const d=o.then(async m=>{if(u=["resolve",m],ee.isValidElement(m))l=!1,this.create({id:s,type:"default",message:m});else if(LG(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:s,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:s,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:s,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:s,type:"error",description:g,...w})}}).finally(()=>{l&&(this.dismiss(s),s=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 s!="string"&&typeof s!="number"?{unwrap:h}:Object.assign(s,{unwrap:h})},this.custom=(t,n)=>{const s=n?.id||vx++;return this.create({jsx:t(s),id:s,...n}),s},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Ir=new zG,PG=(e,t)=>{const n=t?.id||vx++;return Ir.addToast({title:e,...t,id:n}),n},LG=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",IG=PG,$G=()=>Ir.toasts,FG=()=>Ir.getActiveToasts(),Kr=Object.assign(IG,{success:Ir.success,info:Ir.info,warning:Ir.warning,error:Ir.error,custom:Ir.custom,message:Ir.message,promise:Ir.promise,dismiss:Ir.dismiss,loading:Ir.loading},{getHistory:$G,getToasts:FG});DG("[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 BG({entryId:e,fromVersion:t,toVersion:n,onClose:s,onRollback:o}){const l=xn(),u=Ye(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(HP,{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(dP,{className:"size-4 text-muted-foreground"}),i.jsxs("h3",{className:"font-semibold",children:["Comparing v",t," → v",n]})]}),i.jsx("button",{type:"button",onClick:s,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(Ku,{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(yt,{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(u3,{className:"size-4 text-muted-foreground"}),i.jsxs("div",{className:"text-center",children:[i.jsxs(yt,{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(yt,{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:s,children:"Back to History"}),i.jsxs(me,{variant:"ghost",onClick:()=>o(t),children:["Rollback to v",t]})]})]})}function TC({targetVersion:e,currentVersion:t,isLoading:n,error:s,onConfirm:o,onCancel:l}){return i.jsx(cs,{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(Io,{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"})]})]})]})}),s&&i.jsxs("div",{className:"diff-removed rounded-lg border px-3 py-2 text-sm",children:[i.jsx("span",{className:"font-medium",children:"Error:"})," ",s]})]})})}function UG({entryId:e,currentVersion:t,onRollbackComplete:n,onClose:s}){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=Ye(o.getVersionHistory,{entryId:e,paginationOpts:{numItems:50,cursor:null}}),N=Ke(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(BG,{entryId:e,fromVersion:l[0],toVersion:l[1],onClose:()=>u(null),onRollback:T=>{u(null),M(T)}}),d!==null&&i.jsx(TC,{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(YN,{className:"size-4 text-muted-foreground"}),i.jsx("h3",{className:"font-semibold",children:"Version History"})]}),i.jsx("button",{type:"button",onClick:s,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(Ku,{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(yt,{variant:"secondary",className:"font-mono",children:["v",T.versionNumber]}),D&&i.jsx(yt,{variant:"outline",className:"border-primary/50 text-primary",children:"Current"}),T.wasPublished&&i.jsx(yt,{variant:"outline",className:"border-success/50 text-success",children:"Published"})]}),i.jsx(ql,{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(TC,{targetVersion:d,currentVersion:t,isLoading:m,error:g,onConfirm:A,onCancel:()=>{h(null),y(null)}})]})}function VG(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 s=/(?:Content validation failed|Validation error|Validation failed):\s*(.+)/i,o=n.match(s);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 qG(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(s=>t.includes(s))}function HG({...e}){return i.jsx(YW,{"data-slot":"alert-dialog",...e})}function YG({...e}){return i.jsx(WW,{"data-slot":"alert-dialog-portal",...e})}function WG({className:e,...t}){return i.jsx(GW,{"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 GG({className:e,...t}){return i.jsxs(YG,{children:[i.jsx(WG,{}),i.jsx(ZW,{"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 ZG({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 QG({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 KG({className:e,...t}){return i.jsx(XW,{"data-slot":"alert-dialog-title",className:W("text-lg font-semibold",e),...t})}function XG({className:e,...t}){return i.jsx(JW,{"data-slot":"alert-dialog-description",className:W("text-muted-foreground text-sm",e),...t})}function JG({className:e,...t}){return i.jsx(QW,{className:W(bu(),e),...t})}function eZ({className:e,...t}){return i.jsx(KW,{className:W(bu({variant:"outline"}),e),...t})}function tZ({status:e,error:t,retryCount:n=0,maxRetries:s=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}/${s})...`:"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(Pu,{}),t??"Save failed",n===0&&l&&i.jsx(tt,{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 nZ({contentType:e,entry:t,entryTitle:n,isDirty:s,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,q=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(tt,{type:"button",variant:"ghost",size:"icon",onClick:S,className:"shrink-0",children:i.jsx(FN,{})}),t&&q&&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(qE,{className:"text-xs text-muted-foreground",children:[e.displayName," entries"]}),i.jsx(Ku,{className:"max-h-64",children:i.jsx(vC,{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(Ts,{className:"shrink-0 text-primary"})]},Y._id))})}),z&&i.jsxs(i.Fragment,{children:[i.jsx(qo,{}),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(ql,{status:t.status}),!q&&z&&t&&i.jsxs(tt,{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(tZ,{status:u,error:d,retryCount:h,maxRetries:m,isDirty:s,onRetry:T}),i.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[i.jsxs(tt,{type:"button",variant:"outline",onClick:w,disabled:B,children:[o&&i.jsx(es,{"data-icon":"inline-start"}),"Save"]}),t&&t.status==="draft"&&i.jsxs(tt,{type:"button",onClick:j,disabled:B,children:[l&&i.jsx(es,{"data-icon":"inline-start"}),"Publish"]}),t&&t.status==="scheduled"&&i.jsxs(tt,{type:"button",onClick:E,disabled:B,children:[l&&i.jsx(es,{"data-icon":"inline-start"}),"Publish Now"]}),t&&t.status==="published"&&i.jsx(tt,{type:"button",variant:"outline",onClick:N,disabled:B,children:"Unpublish"}),t&&i.jsxs(Sl,{children:[i.jsx(jl,{asChild:!0,children:i.jsx(tt,{type:"button",variant:"ghost",size:"icon",children:i.jsx(HN,{})})}),i.jsx(Cl,{align:"end",children:i.jsxs(vC,{children:[t.status==="draft"&&g&&i.jsxs(pn,{onClick:C,children:[i.jsx(sh,{"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(qo,{}),i.jsx(pn,{className:"text-destructive",onClick:R,children:"Delete"})]})]})})]}),O&&i.jsx(tt,{type:"button",variant:"outline",size:"icon",onClick:O,className:"lg:hidden",children:i.jsx(d5,{})})]})]})}function or({field:e,children:t,error:n,className:s="",id:o,customLabel:l}){return i.jsxs(bs,{"data-invalid":!!n||void 0,className:s,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(To,{id:`${o}-description`,children:e.description}),n&&i.jsx(NT,{id:`${o}-error`,children:n.message})]})}function rZ({field:e,value:t,onChange:n,error:s,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(or,{field:e,error:s,className:u,id:g,children:[i.jsx(pt,{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(s&&"border-destructive focus-visible:ring-destructive"),"aria-invalid":!!s,"aria-describedby":s?`${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 sZ({field:e,value:t,onChange:n,error:s,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 q=B.target.value;if(E(q),q===""){n(null);return}const Y=parseFloat(q);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 q=B.clipboardData.getData("text"),Y=N?/[^\d.\-]/g:/[^\d\-]/g,G=q.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":!!s||void 0,"aria-describedby":s?`${v}-error`:e.description?`${v}-description`:void 0};return i.jsxs(or,{field:e,error:s,className:u,id:v,children:[D?i.jsxs(um,{"data-disabled":o||void 0,children:[S&&i.jsx(kl,{align:"inline-start",children:i.jsx(_l,{children:S})}),i.jsx(dm,{...z}),j&&i.jsx(kl,{align:"inline-end",children:i.jsx(_l,{className:"text-xs font-medium",children:j})})]}):i.jsx(pt,{...z,className:W(s&&"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 aZ({field:e,value:t,onChange:n,error:s,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=!!s;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(nl,{id:g,checked:t??!1,onCheckedChange:y,disabled:o||l,"aria-invalid":w,"aria-describedby":s?`${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(To,{id:`${g}-description`,children:e.description}),w&&i.jsx(NT,{id:`${g}-error`,children:s.message})]})}function oZ(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 iZ={},tu={};function Mo(e,t){try{const s=(iZ[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return s in tu?tu[s]:MC(s,s.split(":"))}catch{if(e in tu)return tu[e];const n=e?.match(lZ);return n?MC(e,n.slice(1)):NaN}}const lZ=/([+-]\d\d):?(\d\d)?/;function MC(e,t){const n=+(t[0]||0),s=+(t[1]||0),o=+(t[2]||0)/60;return tu[e]=n*60+s>0?n*60+s+o:n*60-s-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(Mo(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)),CM(this),xx(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=-Mo(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),xx(this),+this}[Symbol.for("constructDateFrom")](t){return new Cs(+new Date(t),this.timeZone)}}const RC=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!RC.test(e))return;const t=e.replace(RC,"$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),cZ(this),+this},Cs.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),xx(this),+this}))});function xx(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-Mo(e.timeZone,e)*60))}function cZ(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()),CM(e)}function CM(e){const t=Mo(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),s=new Date(+e);s.setUTCHours(s.getUTCHours()-1);const o=-new Date(+e).getTimezoneOffset(),l=-new Date(+s).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(-(Mo(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=Mo(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 _=Mo(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,s]=this.tzComponents(),o=`${t}${n}:${s}`;return this.internal.toISOString().slice(0,-1)+o}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,s,o]=this.internal.toUTCString().split(" ");return`${t?.slice(0,-1)} ${s} ${n} ${o}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,s,o]=this.tzComponents();return`${t} GMT${n}${s}${o} (${oZ(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?"-":"+",s=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),o=String(Math.abs(t)%60).padStart(2,"0");return[n,s,o]}withTimeZone(t){return new On(+this,t)}[Symbol.for("constructDateFrom")](t){return new On(+new Date(t),this.timeZone)}}const NM=6048e5,uZ=864e5,AC=Symbol.for("constructDateFrom");function dn(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&AC in e?e[AC](t):e instanceof Date?new e.constructor(t):new Date(t)}function Mt(e,t){return dn(t||e,e)}function kM(e,t,n){const s=Mt(e,n?.in);return isNaN(t)?dn(e,NaN):(t&&s.setDate(s.getDate()+t),s)}function _M(e,t,n){const s=Mt(e,n?.in);if(isNaN(t))return dn(e,NaN);if(!t)return s;const o=s.getDate(),l=dn(e,s.getTime());l.setMonth(s.getMonth()+t+1,0);const u=l.getDate();return o>=u?l:(s.setFullYear(l.getFullYear(),l.getMonth(),o),s)}let dZ={};function Xu(){return dZ}function Tl(e,t){const n=Xu(),s=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=Mt(e,t?.in),l=o.getDay(),u=(l<s?7:0)+l-s;return o.setDate(o.getDate()-u),o.setHours(0,0,0,0),o}function Au(e,t){return Tl(e,{...t,weekStartsOn:1})}function EM(e,t){const n=Mt(e,t?.in),s=n.getFullYear(),o=dn(n,0);o.setFullYear(s+1,0,4),o.setHours(0,0,0,0);const l=Au(o),u=dn(n,0);u.setFullYear(s,0,4),u.setHours(0,0,0,0);const d=Au(u);return n.getTime()>=l.getTime()?s+1:n.getTime()>=d.getTime()?s:s-1}function OC(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(s=>typeof s=="object"));return t.map(n)}function Ou(e,t){const n=Mt(e,t?.in);return n.setHours(0,0,0,0),n}function lb(e,t,n){const[s,o]=Hl(n?.in,e,t),l=Ou(s),u=Ou(o),d=+l-OC(l),h=+u-OC(u);return Math.round((d-h)/uZ)}function fZ(e,t){const n=EM(e,t),s=dn(e,0);return s.setFullYear(n,0,4),s.setHours(0,0,0,0),Au(s)}function hZ(e,t,n){return kM(e,t*7,n)}function mZ(e,t,n){return _M(e,t*12,n)}function pZ(e,t){let n,s=t?.in;return e.forEach(o=>{!s&&typeof o=="object"&&(s=dn.bind(null,o));const l=Mt(o,s);(!n||n<l||isNaN(+l))&&(n=l)}),dn(s,n||NaN)}function gZ(e,t){let n,s=t?.in;return e.forEach(o=>{!s&&typeof o=="object"&&(s=dn.bind(null,o));const l=Mt(o,s);(!n||n>l||isNaN(+l))&&(n=l)}),dn(s,n||NaN)}function vZ(e,t,n){const[s,o]=Hl(n?.in,e,t);return+Ou(s)==+Ou(o)}function TM(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function xZ(e){return!(!TM(e)&&typeof e!="number"||isNaN(+Mt(e)))}function MM(e,t,n){const[s,o]=Hl(n?.in,e,t),l=s.getFullYear()-o.getFullYear(),u=s.getMonth()-o.getMonth();return l*12+u}function yZ(e,t){const n=Mt(e,t?.in),s=n.getMonth();return n.setFullYear(n.getFullYear(),s+1,0),n.setHours(23,59,59,999),n}function RM(e,t){const[n,s]=Hl(e,t.start,t.end);return{start:n,end:s}}function bZ(e,t){const{start:n,end:s}=RM(t?.in,e);let o=+n>+s;const l=o?+n:+s,u=o?s: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 wZ(e,t){const n=Mt(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function SZ(e,t){const n=Mt(e,t?.in),s=n.getFullYear();return n.setFullYear(s+1,0,0),n.setHours(23,59,59,999),n}function AM(e,t){const n=Mt(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function jZ(e,t){const{start:n,end:s}=RM(t?.in,e);let o=+n>+s;const l=o?+n:+s,u=o?s: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 OM(e,t){const n=Xu(),s=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=Mt(e,t?.in),l=o.getDay(),u=(l<s?-7:0)+6-(l-s);return o.setDate(o.getDate()+u),o.setHours(23,59,59,999),o}function CZ(e,t){return OM(e,{...t,weekStartsOn:1})}const NZ={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"}},kZ=(e,t,n)=>{let s;const o=NZ[e];return typeof o=="string"?s=o:t===1?s=o.one:s=o.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function Ev(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const _Z={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},EZ={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},TZ={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},MZ={date:Ev({formats:_Z,defaultWidth:"full"}),time:Ev({formats:EZ,defaultWidth:"full"}),dateTime:Ev({formats:TZ,defaultWidth:"full"})},RZ={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},AZ=(e,t,n,s)=>RZ[e];function qc(e){return(t,n)=>{const s=n?.context?String(n.context):"standalone";let o;if(s==="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 OZ={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},DZ={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},zZ={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"]},PZ={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"]},LZ={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"}},IZ={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"}},$Z=(e,t)=>{const n=Number(e),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},FZ={ordinalNumber:$Z,era:qc({values:OZ,defaultWidth:"wide"}),quarter:qc({values:DZ,defaultWidth:"wide",argumentCallback:e=>e-1}),month:qc({values:zZ,defaultWidth:"wide"}),day:qc({values:PZ,defaultWidth:"wide"}),dayPeriod:qc({values:LZ,defaultWidth:"wide",formattingValues:IZ,defaultFormattingWidth:"wide"})};function Hc(e){return(t,n={})=>{const s=n.width,o=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],l=t.match(o);if(!l)return null;const u=l[0],d=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],h=Array.isArray(d)?UZ(d,g=>g.test(u)):BZ(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 BZ(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function UZ(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function VZ(e){return(t,n={})=>{const s=t.match(e.matchPattern);if(!s)return null;const o=s[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 qZ=/^(\d+)(th|st|nd|rd)?/i,HZ=/\d+/i,YZ={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},WZ={any:[/^b/i,/^(a|c)/i]},GZ={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ZZ={any:[/1/i,/2/i,/3/i,/4/i]},QZ={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},KZ={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]},XZ={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},JZ={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]},eQ={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},tQ={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}},nQ={ordinalNumber:VZ({matchPattern:qZ,parsePattern:HZ,valueCallback:e=>parseInt(e,10)}),era:Hc({matchPatterns:YZ,defaultMatchWidth:"wide",parsePatterns:WZ,defaultParseWidth:"any"}),quarter:Hc({matchPatterns:GZ,defaultMatchWidth:"wide",parsePatterns:ZZ,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Hc({matchPatterns:QZ,defaultMatchWidth:"wide",parsePatterns:KZ,defaultParseWidth:"any"}),day:Hc({matchPatterns:XZ,defaultMatchWidth:"wide",parsePatterns:JZ,defaultParseWidth:"any"}),dayPeriod:Hc({matchPatterns:eQ,defaultMatchWidth:"any",parsePatterns:tQ,defaultParseWidth:"any"})},Qi={code:"en-US",formatDistance:kZ,formatLong:MZ,formatRelative:AZ,localize:FZ,match:nQ,options:{weekStartsOn:0,firstWeekContainsDate:1}};function rQ(e,t){const n=Mt(e,t?.in);return lb(n,AM(n))+1}function cb(e,t){const n=Mt(e,t?.in),s=+Au(n)-+fZ(n);return Math.round(s/NM)+1}function DM(e,t){const n=Mt(e,t?.in),s=n.getFullYear(),o=Xu(),l=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,u=dn(t?.in||e,0);u.setFullYear(s+1,0,l),u.setHours(0,0,0,0);const d=Tl(u,t),h=dn(t?.in||e,0);h.setFullYear(s,0,l),h.setHours(0,0,0,0);const m=Tl(h,t);return+n>=+d?s+1:+n>=+m?s:s-1}function sQ(e,t){const n=Xu(),s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=DM(e,t),l=dn(t?.in||e,0);return l.setFullYear(o,0,s),l.setHours(0,0,0,0),Tl(l,t)}function ub(e,t){const n=Mt(e,t?.in),s=+Tl(n,t)-+sQ(n,t);return Math.round(s/NM)+1}function Nt(e,t){const n=e<0?"-":"",s=Math.abs(e).toString().padStart(t,"0");return n+s}const Ia={y(e,t){const n=e.getFullYear(),s=n>0?n:1-n;return Nt(t==="yy"?s%100:s,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Nt(n+1,2)},d(e,t){return Nt(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 Nt(e.getHours()%12||12,t.length)},H(e,t){return Nt(e.getHours(),t.length)},m(e,t){return Nt(e.getMinutes(),t.length)},s(e,t){return Nt(e.getSeconds(),t.length)},S(e,t){const n=t.length,s=e.getMilliseconds(),o=Math.trunc(s*Math.pow(10,n-3));return Nt(o,t.length)}},qi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},DC={G:function(e,t,n){const s=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});default:return n.era(s,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const s=e.getFullYear(),o=s>0?s:1-s;return n.ordinalNumber(o,{unit:"year"})}return Ia.y(e,t)},Y:function(e,t,n,s){const o=DM(e,s),l=o>0?o:1-o;if(t==="YY"){const u=l%100;return Nt(u,2)}return t==="Yo"?n.ordinalNumber(l,{unit:"year"}):Nt(l,t.length)},R:function(e,t){const n=EM(e);return Nt(n,t.length)},u:function(e,t){const n=e.getFullYear();return Nt(n,t.length)},Q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return Nt(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return Nt(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(e,t,n){const s=e.getMonth();switch(t){case"M":case"MM":return Ia.M(e,t);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(e,t,n){const s=e.getMonth();switch(t){case"L":return String(s+1);case"LL":return Nt(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(e,t,n,s){const o=ub(e,s);return t==="wo"?n.ordinalNumber(o,{unit:"week"}):Nt(o,t.length)},I:function(e,t,n){const s=cb(e);return t==="Io"?n.ordinalNumber(s,{unit:"week"}):Nt(s,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Ia.d(e,t)},D:function(e,t,n){const s=rQ(e);return t==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):Nt(s,t.length)},E:function(e,t,n){const s=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(e,t,n,s){const o=e.getDay(),l=(o-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(l);case"ee":return Nt(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,s){const o=e.getDay(),l=(o-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(l);case"cc":return Nt(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 s=e.getDay(),o=s===0?7:s;switch(t){case"i":return String(o);case"ii":return Nt(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{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 s=e.getHours();let o;switch(s===12?o=qi.noon:s===0?o=qi.midnight:o=s/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 s=e.getHours();let o;switch(s>=17?o=qi.evening:s>=12?o=qi.afternoon:s>=4?o=qi.morning:o=qi.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 s=e.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return Ia.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Ia.H(e,t)},K:function(e,t,n){const s=e.getHours()%12;return t==="Ko"?n.ordinalNumber(s,{unit:"hour"}):Nt(s,t.length)},k:function(e,t,n){let s=e.getHours();return s===0&&(s=24),t==="ko"?n.ordinalNumber(s,{unit:"hour"}):Nt(s,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Ia.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Ia.s(e,t)},S:function(e,t){return Ia.S(e,t)},X:function(e,t,n){const s=e.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return PC(s);case"XXXX":case"XX":return No(s);default:return No(s,":")}},x:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"x":return PC(s);case"xxxx":case"xx":return No(s);default:return No(s,":")}},O:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+zC(s,":");default:return"GMT"+No(s,":")}},z:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+zC(s,":");default:return"GMT"+No(s,":")}},t:function(e,t,n){const s=Math.trunc(+e/1e3);return Nt(s,t.length)},T:function(e,t,n){return Nt(+e,t.length)}};function zC(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),o=Math.trunc(s/60),l=s%60;return l===0?n+String(o):n+String(o)+t+Nt(l,2)}function PC(e,t){return e%60===0?(e>0?"-":"+")+Nt(Math.abs(e)/60,2):No(e,t)}function No(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),o=Nt(Math.trunc(s/60),2),l=Nt(s%60,2);return n+o+t+l}const LC=(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"})}},zM=(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"})}},aQ=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],s=n[1],o=n[2];if(!o)return LC(e,t);let l;switch(s){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}}",LC(s,t)).replace("{{time}}",zM(o,t))},oQ={p:zM,P:aQ},iQ=/^D+$/,lQ=/^Y+$/,cQ=["D","DD","YY","YYYY"];function uQ(e){return iQ.test(e)}function dQ(e){return lQ.test(e)}function fQ(e,t,n){const s=hQ(e,t,n);if(console.warn(s),cQ.includes(e))throw new RangeError(s)}function hQ(e,t,n){const s=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const mQ=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,pQ=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,gQ=/^'([^]*?)'?$/,vQ=/''/g,xQ=/[a-zA-Z]/;function nu(e,t,n){const s=Xu(),o=n?.locale??s.locale??Qi,l=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,u=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,d=Mt(e,n?.in);if(!xZ(d))throw new RangeError("Invalid time value");let h=t.match(pQ).map(v=>{const g=v[0];if(g==="p"||g==="P"){const y=oQ[g];return y(v,o.formatLong)}return v}).join("").match(mQ).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const g=v[0];if(g==="'")return{isToken:!1,value:yQ(v)};if(DC[g])return{isToken:!0,value:v};if(g.match(xQ))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&&dQ(g)||!n?.useAdditionalDayOfYearTokens&&uQ(g))&&fQ(g,t,String(e));const y=DC[g[0]];return y(d,g,o.localize,m)}).join("")}function yQ(e){const t=e.match(gQ);return t?t[1].replace(vQ,"'"):e}function bQ(e,t){const n=Mt(e,t?.in),s=n.getFullYear(),o=n.getMonth(),l=dn(n,0);return l.setFullYear(s,o+1,0),l.setHours(0,0,0,0),l.getDate()}function wQ(e,t){return Mt(e,t?.in).getMonth()}function SQ(e,t){return Mt(e,t?.in).getFullYear()}function jQ(e,t){return+Mt(e)>+Mt(t)}function CQ(e,t){return+Mt(e)<+Mt(t)}function NQ(e,t,n){const[s,o]=Hl(n?.in,e,t);return s.getFullYear()===o.getFullYear()&&s.getMonth()===o.getMonth()}function kQ(e,t,n){const[s,o]=Hl(n?.in,e,t);return s.getFullYear()===o.getFullYear()}function _Q(e,t,n){const s=Mt(e,n?.in),o=s.getFullYear(),l=s.getDate(),u=dn(e,0);u.setFullYear(o,t,15),u.setHours(0,0,0,0);const d=bQ(u);return s.setMonth(t,Math.min(l,d)),s}function EQ(e,t,n){const s=Mt(e,n?.in);return isNaN(+s)?dn(e,NaN):(s.setFullYear(t),s)}const IC=5,TQ=4;function MQ(e,t){const n=t.startOfMonth(e),s=n.getDay()>0?n.getDay():7,o=t.addDays(e,-s+1),l=t.addDays(o,IC*7-1);return t.getMonth(e)===t.getMonth(l)?IC:TQ}function PM(e,t){const n=t.startOfMonth(e),s=n.getDay();return s===1?n:s===0?t.addDays(n,-6):t.addDays(n,-1*(s-1))}function RQ(e,t){const n=PM(e,t),s=MQ(e,t);return t.addDays(n,s*7-1)}const LM={...Qi,labels:{labelDayButton:(e,t,n,s)=>{let o;s&&typeof s.format=="function"?o=s.format.bind(s):o=(u,d)=>nu(u,d,{locale:Qi,...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 s;return n&&typeof n.format=="function"?s=n.format.bind(n):s=(o,l)=>nu(o,l,{locale:Qi,...t}),s(e,"LLLL yyyy")},labelGridcell:(e,t,n,s)=>{let o;s&&typeof s.format=="function"?o=s.format.bind(s):o=(u,d)=>nu(u,d,{locale:Qi,...n});let l=o(e,"PPPP");return t?.today&&(l=`Today, ${l}`),l},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(e,t,n)=>{let s;return n&&typeof n.format=="function"?s=n.format.bind(n):s=(o,l)=>nu(o,l,{locale:Qi,...t}),s(e,"cccc")}}};class Cr{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=(s,o,l)=>this.overrides?.newDate?this.overrides.newDate(s,o,l):this.options.timeZone?new On(s,o,l,this.options.timeZone):new Date(s,o,l),this.addDays=(s,o)=>this.overrides?.addDays?this.overrides.addDays(s,o):kM(s,o),this.addMonths=(s,o)=>this.overrides?.addMonths?this.overrides.addMonths(s,o):_M(s,o),this.addWeeks=(s,o)=>this.overrides?.addWeeks?this.overrides.addWeeks(s,o):hZ(s,o),this.addYears=(s,o)=>this.overrides?.addYears?this.overrides.addYears(s,o):mZ(s,o),this.differenceInCalendarDays=(s,o)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(s,o):lb(s,o),this.differenceInCalendarMonths=(s,o)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(s,o):MM(s,o),this.eachMonthOfInterval=s=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(s):bZ(s),this.eachYearOfInterval=s=>{const o=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(s):jZ(s),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=s=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(s):RQ(s,this),this.endOfISOWeek=s=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(s):CZ(s),this.endOfMonth=s=>this.overrides?.endOfMonth?this.overrides.endOfMonth(s):yZ(s),this.endOfWeek=(s,o)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(s,o):OM(s,this.options),this.endOfYear=s=>this.overrides?.endOfYear?this.overrides.endOfYear(s):SZ(s),this.format=(s,o,l)=>{const u=this.overrides?.format?this.overrides.format(s,o,this.options):nu(s,o,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(u):u},this.getISOWeek=s=>this.overrides?.getISOWeek?this.overrides.getISOWeek(s):cb(s),this.getMonth=(s,o)=>this.overrides?.getMonth?this.overrides.getMonth(s,this.options):wQ(s,this.options),this.getYear=(s,o)=>this.overrides?.getYear?this.overrides.getYear(s,this.options):SQ(s,this.options),this.getWeek=(s,o)=>this.overrides?.getWeek?this.overrides.getWeek(s,this.options):ub(s,this.options),this.isAfter=(s,o)=>this.overrides?.isAfter?this.overrides.isAfter(s,o):jQ(s,o),this.isBefore=(s,o)=>this.overrides?.isBefore?this.overrides.isBefore(s,o):CQ(s,o),this.isDate=s=>this.overrides?.isDate?this.overrides.isDate(s):TM(s),this.isSameDay=(s,o)=>this.overrides?.isSameDay?this.overrides.isSameDay(s,o):vZ(s,o),this.isSameMonth=(s,o)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(s,o):NQ(s,o),this.isSameYear=(s,o)=>this.overrides?.isSameYear?this.overrides.isSameYear(s,o):kQ(s,o),this.max=s=>this.overrides?.max?this.overrides.max(s):pZ(s),this.min=s=>this.overrides?.min?this.overrides.min(s):gZ(s),this.setMonth=(s,o)=>this.overrides?.setMonth?this.overrides.setMonth(s,o):_Q(s,o),this.setYear=(s,o)=>this.overrides?.setYear?this.overrides.setYear(s,o):EQ(s,o),this.startOfBroadcastWeek=(s,o)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(s,this):PM(s,this),this.startOfDay=s=>this.overrides?.startOfDay?this.overrides.startOfDay(s):Ou(s),this.startOfISOWeek=s=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(s):Au(s),this.startOfMonth=s=>this.overrides?.startOfMonth?this.overrides.startOfMonth(s):wZ(s),this.startOfWeek=(s,o)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(s,this.options):Tl(s,this.options),this.startOfYear=s=>this.overrides?.startOfYear?this.overrides.startOfYear(s):AM(s),this.options={locale:LM,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),s={};for(let o=0;o<10;o++)s[o.toString()]=n.format(o);return s}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,s=>n[s]||s)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){const t=this.options.locale?.code;return t&&Cr.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:s,numerals:o}=this.options,l=n?.code;if(l&&Cr.yearFirstLocales.has(l))try{return new Intl.DateTimeFormat(l,{month:"long",year:"numeric",timeZone:s,numberingSystem:o}).format(t)}catch{}const u=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,u)}}Cr.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 As=new Cr;class IM{constructor(t,n,s=As){this.date=t,this.displayMonth=n,this.outside=!!(n&&!s.isSameMonth(t,n)),this.dateLib=s,this.isoDate=s.format(t,"yyyy-MM-dd"),this.displayMonthId=s.format(n,"yyyy-MM"),this.dateMonthId=s.format(t,"yyyy-MM")}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class AQ{constructor(t,n){this.date=t,this.weeks=n}}class OQ{constructor(t,n){this.days=n,this.weekNumber=t}}function DQ(e){return ee.createElement("button",{...e})}function zQ(e){return ee.createElement("span",{...e})}function PQ(e){const{size:t=24,orientation:n="left",className:s}=e;return ee.createElement("svg",{className:s,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 LQ(e){const{day:t,modifiers:n,...s}=e;return ee.createElement("td",{...s})}function IQ(e){const{day:t,modifiers:n,...s}=e,o=ee.useRef(null);return ee.useEffect(()=>{n.focused&&o.current?.focus()},[n.focused]),ee.createElement("button",{ref:o,...s})}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 gr;(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"})(gr||(gr={}));function $Q(e){const{options:t,className:n,components:s,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(s.Select,{className:u,...l},t?.map(({value:h,label:m,disabled:v})=>ee.createElement(s.Option,{key:h,value:h,disabled:v},m))),ee.createElement("span",{className:o[Pe.CaptionLabel],"aria-hidden":!0},d?.label,ee.createElement(s.Chevron,{orientation:"down",size:18,className:o[Pe.Chevron]})))}function FQ(e){return ee.createElement("div",{...e})}function BQ(e){return ee.createElement("div",{...e})}function UQ(e){const{calendarMonth:t,displayIndex:n,...s}=e;return ee.createElement("div",{...s},e.children)}function VQ(e){const{calendarMonth:t,displayIndex:n,...s}=e;return ee.createElement("div",{...s})}function qQ(e){return ee.createElement("table",{...e})}function HQ(e){return ee.createElement("div",{...e})}const $M=p.createContext(void 0);function Ju(){const e=p.useContext($M);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function YQ(e){const{components:t}=Ju();return ee.createElement(t.Dropdown,{...e})}function WQ(e){const{onPreviousClick:t,onNextClick:n,previousMonth:s,nextMonth:o,...l}=e,{components:u,classNames:d,labels:{labelPrevious:h,labelNext:m}}=Ju(),v=p.useCallback(y=>{o&&n?.(y)},[o,n]),g=p.useCallback(y=>{s&&t?.(y)},[s,t]);return ee.createElement("nav",{...l},ee.createElement(u.PreviousMonthButton,{type:"button",className:d[Pe.PreviousMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":h(s),onClick:g},ee.createElement(u.Chevron,{disabled:s?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 GQ(e){const{components:t}=Ju();return ee.createElement(t.Button,{...e})}function ZQ(e){return ee.createElement("option",{...e})}function QQ(e){const{components:t}=Ju();return ee.createElement(t.Button,{...e})}function KQ(e){const{rootRef:t,...n}=e;return ee.createElement("div",{...n,ref:t})}function XQ(e){return ee.createElement("select",{...e})}function JQ(e){const{week:t,...n}=e;return ee.createElement("tr",{...n})}function eK(e){return ee.createElement("th",{...e})}function tK(e){return ee.createElement("thead",{"aria-hidden":!0},ee.createElement("tr",{...e}))}function nK(e){const{week:t,...n}=e;return ee.createElement("th",{...n})}function rK(e){return ee.createElement("th",{...e})}function sK(e){return ee.createElement("tbody",{...e})}function aK(e){const{components:t}=Ju();return ee.createElement(t.Dropdown,{...e})}const oK=Object.freeze(Object.defineProperty({__proto__:null,Button:DQ,CaptionLabel:zQ,Chevron:PQ,Day:LQ,DayButton:IQ,Dropdown:$Q,DropdownNav:FQ,Footer:BQ,Month:UQ,MonthCaption:VQ,MonthGrid:qQ,Months:HQ,MonthsDropdown:YQ,Nav:WQ,NextMonthButton:GQ,Option:ZQ,PreviousMonthButton:QQ,Root:KQ,Select:XQ,Week:JQ,WeekNumber:nK,WeekNumberHeader:rK,Weekday:eK,Weekdays:tK,Weeks:sK,YearsDropdown:aK},Symbol.toStringTag,{value:"Module"}));function na(e,t,n=!1,s=As){let{from:o,to:l}=e;const{differenceInCalendarDays:u,isSameDay:d}=s;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 db(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function xm(e){return!!(e&&typeof e=="object"&&"from"in e)}function fb(e){return!!(e&&typeof e=="object"&&"after"in e)}function hb(e){return!!(e&&typeof e=="object"&&"before"in e)}function FM(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function BM(e,t){return Array.isArray(e)&&e.every(t.isDate)}function ra(e,t,n=As){const s=Array.isArray(t)?t:[t],{isSameDay:o,differenceInCalendarDays:l,isAfter:u}=n;return s.some(d=>{if(typeof d=="boolean")return d;if(n.isDate(d))return o(e,d);if(BM(d,n))return d.some(h=>o(e,h));if(xm(d))return na(d,e,!1,n);if(FM(d))return Array.isArray(d.dayOfWeek)?d.dayOfWeek.includes(e.getDay()):d.dayOfWeek===e.getDay();if(db(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 fb(d)?l(e,d.after)>0:hb(d)?l(d.before,e)>0:typeof d=="function"?d(e):!1})}function iK(e,t,n,s,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),_=s&&j(s),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&&ra(R,l,o)),q=!!(u&&ra(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),q&&E.hidden.push(A),Y&&E.today.push(A),d&&Object.keys(d).forEach(G=>{const ae=d?.[G];ae&&ra(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 lK(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 cK(e){return{...oK,...e}}function uK(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,s])=>{n.startsWith("data-")&&(t[n]=s)}),t}function mb(){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 gr)e[gr[t]]=`rdp-${gr[t]}`;return e}function UM(e,t,n){return(n??new Cr(t)).formatMonthYear(e)}const dK=UM;function fK(e,t,n){return(n??new Cr(t)).format(e,"d")}function hK(e,t=As){return t.format(e,"LLLL")}function mK(e,t,n){return(n??new Cr(t)).format(e,"cccccc")}function pK(e,t=As){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function gK(){return""}function VM(e,t=As){return t.format(e,"yyyy")}const vK=VM,xK=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:UM,formatDay:fK,formatMonthCaption:dK,formatMonthDropdown:hK,formatWeekNumber:pK,formatWeekNumberHeader:gK,formatWeekdayName:mK,formatYearCaption:vK,formatYearDropdown:VM},Symbol.toStringTag,{value:"Module"}));function yK(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...xK,...e}}function pb(e,t,n,s){let o=(s??new Cr(n)).format(e,"PPPP");return t.today&&(o=`Today, ${o}`),t.selected&&(o=`${o}, selected`),o}const bK=pb;function gb(e,t,n){return(n??new Cr(t)).formatMonthYear(e)}const wK=gb;function qM(e,t,n,s){let o=(s??new Cr(n)).format(e,"PPPP");return t?.today&&(o=`Today, ${o}`),o}function HM(e){return"Choose the Month"}function YM(){return""}const SK="Go to the Next Month";function WM(e,t){return SK}function GM(e){return"Go to the Previous Month"}function ZM(e,t,n){return(n??new Cr(t)).format(e,"cccc")}function QM(e,t){return`Week ${e}`}function KM(e){return"Week Number"}function XM(e){return"Choose the Year"}const jK=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:wK,labelDay:bK,labelDayButton:pb,labelGrid:gb,labelGridcell:qM,labelMonthDropdown:HM,labelNav:YM,labelNext:WM,labelPrevious:GM,labelWeekNumber:QM,labelWeekNumberHeader:KM,labelWeekday:ZM,labelYearDropdown:XM},Symbol.toStringTag,{value:"Module"})),Xr=(e,t,n)=>t||(n?typeof n=="function"?n:(...s)=>n:e);function CK(e,t){const n=t.locale?.labels??{};return{...jK,...e??{},labelDayButton:Xr(pb,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:Xr(HM,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:Xr(WM,e?.labelNext,n.labelNext),labelPrevious:Xr(GM,e?.labelPrevious,n.labelPrevious),labelWeekNumber:Xr(QM,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:Xr(XM,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:Xr(gb,e?.labelGrid,n.labelGrid),labelGridcell:Xr(qM,e?.labelGridcell,n.labelGridcell),labelNav:Xr(YM,e?.labelNav,n.labelNav),labelWeekNumberHeader:Xr(KM,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:Xr(ZM,e?.labelWeekday,n.labelWeekday)}}function NK(e,t,n,s,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=s.formatMonthDropdown(y,o),S=m(y),j=t&&y<l(t)||n&&y>l(n)||!1;return{value:S,label:w,disabled:j}})}function kK(e,t={},n={}){let s={...t?.[Pe.Day]};return Object.entries(e).filter(([,o])=>o===!0).forEach(([o])=>{s={...s,...n?.[o]}}),s}function _K(e,t,n,s){const o=s??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 EK(e,t,n,s,o=!1){if(!e||!t)return;const{startOfYear:l,endOfYear:u,eachYearOfInterval:d,getYear:h}=s,m=l(e),v=u(t),g=d({start:m,end:v});return o&&g.reverse(),g.map(y=>{const w=n.formatYearDropdown(y,s);return{value:h(y),label:w,disabled:!1}})}function TK(e,t={}){const{weekStartsOn:n,locale:s}=t,o=n??s?.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 ub(m,{weekStartsOn:h?.weekStartsOn??o,firstWeekContainsDate:h?.firstWeekContainsDate??s?.options?.firstWeekContainsDate??1})},getISOWeek:d=>{const h=u(d);return cb(h)},differenceInCalendarDays:(d,h)=>{const m=u(d),v=u(h);return lb(m,v)},differenceInCalendarMonths:(d,h)=>{const m=u(d),v=u(h);return MM(m,v)}}}const ed=e=>e instanceof HTMLElement?e:null,Tv=e=>[...e.querySelectorAll("[data-animated-month]")??[]],MK=e=>ed(e.querySelector("[data-animated-month]")),Mv=e=>ed(e.querySelector("[data-animated-caption]")),Rv=e=>ed(e.querySelector("[data-animated-weeks]")),RK=e=>ed(e.querySelector("[data-animated-nav]")),AK=e=>ed(e.querySelector("[data-animated-weekdays]"));function OK(e,t,{classNames:n,months:s,focused:o,dateLib:l}){const u=p.useRef(null),d=p.useRef(s),h=p.useRef(!1);p.useLayoutEffect(()=>{const m=d.current;if(d.current=s,!t||!e.current||!(e.current instanceof HTMLElement)||s.length===0||m.length===0||s.length!==m.length)return;const v=l.isSameMonth(s[0].date,m[0].date),g=l.isAfter(s[0].date,m[0].date),y=g?n[gr.caption_after_enter]:n[gr.caption_before_enter],w=g?n[gr.weeks_after_enter]:n[gr.weeks_before_enter],S=u.current,j=e.current.cloneNode(!0);if(j instanceof HTMLElement?(Tv(j).forEach(E=>{if(!(E instanceof HTMLElement))return;const M=MK(E);M&&E.contains(M)&&E.removeChild(M);const A=Mv(E);A&&A.classList.remove(y);const R=Rv(E);R&&R.classList.remove(w)}),u.current=j):u.current=null,h.current||v||o)return;const N=S instanceof HTMLElement?Tv(S):[],C=Tv(e.current);if(C?.every(_=>_ instanceof HTMLElement)&&N&&N.every(_=>_ instanceof HTMLElement)){h.current=!0,e.current.style.isolation="isolate";const _=RK(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=Mv(E);R&&R.classList.add(y);const T=Rv(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=AK(A);D&&(D.style.opacity="0");const z=Mv(A);z&&(z.classList.add(g?n[gr.caption_before_exit]:n[gr.caption_after_exit]),z.addEventListener("animationend",O));const B=Rv(A);B&&B.classList.add(g?n[gr.weeks_before_exit]:n[gr.weeks_after_exit]),E.insertBefore(A,E.firstChild)})}})}function DK(e,t,n,s){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}=s,M=h?C(o,s):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 q=(h?35:42)*D;if(d&&z.length<q){const Y=q-z.length;for(let G=0;G<Y;G++){const ae=m(z[z.length-1],1);z.push(ae)}}return z}function zK(e){const t=[];return e.reduce((n,s)=>{const o=s.weeks.reduce((l,u)=>l.concat(u.days.slice()),t.slice());return n.concat(o.slice())},t.slice())}function PK(e,t,n,s){const{numberOfMonths:o=1}=n,l=[];for(let u=0;u<o;u++){const d=s.addMonths(e,u);if(t&&d>t)break;l.push(d)}return l}function $C(e,t,n,s){const{month:o,defaultMonth:l,today:u=s.today(),numberOfMonths:d=1}=e;let h=o||l||u;const{differenceInCalendarMonths:m,addMonths:v,startOfMonth:g}=s;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 LK(e,t,n,s){const{addDays:o,endOfBroadcastWeek:l,endOfISOWeek:u,endOfMonth:d,endOfWeek:h,getISOWeek:m,getWeek:v,startOfBroadcastWeek:g,startOfISOWeek:y,startOfWeek:w}=s,S=e.reduce((j,N)=>{const C=n.broadcastCalendar?g(N,s):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(q=>q.weekNumber===D),B=new IM(O,N,s);return z?z.days.push(B):T.push(new OQ(D,[B])),T},[]),R=new AQ(N,A);return j.push(R),j},[]);return n.reverseMonths?S.reverse():S}function IK(e,t){let{startMonth:n,endMonth:s}=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)),!s&&j&&(s=j),!s&&w&&(s=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))),s?s=d(s):w?s=v(w,11,31):!s&&N&&(s=m(e.today??g())),[n&&l(n),s&&l(s)]}function $K(e,t,n,s){if(n.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:l=1}=n,{startOfMonth:u,addMonths:d,differenceInCalendarMonths:h}=s,m=o?l:1,v=u(e);if(!t)return d(v,m);if(!(h(t,e)<l))return d(v,m)}function FK(e,t,n,s){if(n.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:l}=n,{startOfMonth:u,addMonths:d,differenceInCalendarMonths:h}=s,m=o?l??1:1,v=u(e);if(!t)return d(v,-m);if(!(h(v,t)<=0))return d(v,-m)}function BK(e){const t=[];return e.reduce((n,s)=>n.concat(s.weeks.slice()),t.slice())}function ym(e,t){const[n,s]=p.useState(e);return[t===void 0?n:t,s]}function UK(e,t){const[n,s]=IK(e,t),{startOfMonth:o,endOfMonth:l}=t,u=$C(e,n,s,t),[d,h]=ym(u,e.month?u:void 0);p.useEffect(()=>{const M=$C(e,n,s,t);h(M)},[e.timeZone]);const{months:m,weeks:v,days:g,previousMonth:y,nextMonth:w}=p.useMemo(()=>{const M=PK(d,s,{numberOfMonths:e.numberOfMonths},t),A=DK(M,e.endMonth?l(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),R=LK(M,A,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t),T=BK(R),O=zK(R),D=FK(d,n,e,t),z=$K(d,s,e,t);return{months:R,weeks:T,days:O,previousMonth:D,nextMonth:z}},[t,d.getTime(),s?.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)),s&&A>o(s)&&(A=o(s)),h(A),j?.(A)};return{months:m,weeks:v,days:g,navStart:n,navEnd:s,previousMonth:y,nextMonth:w,goToMonth:C,goToDay:M=>{N(M)||C(M.date)}}}var vs;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(vs||(vs={}));function FC(e){return!e[Bt.disabled]&&!e[Bt.hidden]&&!e[Bt.outside]}function VK(e,t,n,s){let o,l=-1;for(const u of e){const d=t(u);FC(d)&&(d[Bt.focused]&&l<vs.FocusedModifier?(o=u,l=vs.FocusedModifier):s?.isEqualTo(u)&&l<vs.LastFocused?(o=u,l=vs.LastFocused):n(u.date)&&l<vs.Selected?(o=u,l=vs.Selected):d[Bt.today]&&l<vs.Today&&(o=u,l=vs.Today))}return o||(o=e.find(u=>FC(t(u)))),o}function qK(e,t,n,s,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"&&s?R=N([s,R]):t==="after"&&o&&(R=C([o,R])),R}function JM(e,t,n,s,o,l,u,d=0){if(d>365)return;const h=qK(e,t,n.date,s,o,l,u),m=!!(l.disabled&&ra(h,l.disabled,u)),v=!!(l.hidden&&ra(h,l.hidden,u)),g=h,y=new IM(h,g,u);return!m&&!v?y:JM(e,t,y,s,o,l,u,d+1)}function HK(e,t,n,s,o){const{autoFocus:l}=e,[u,d]=p.useState(),h=VK(t.days,n,s||(()=>!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=JM(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 YK(e,t){const{selected:n,required:s,onSelect:o}=e,[l,u]=ym(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||s&&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 WK(e,t,n=0,s=0,o=!1,l=As){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);s>0&&y>s?g={from:e,to:void 0}:n>1&&y<n&&(g={from:e,to:void 0})}return g}function GK(e,t,n=As){const s=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(s.includes(o.getDay()))return!0;o=n.addDays(o,1)}return!1}function BC(e,t,n=As){return na(e,t.from,!1,n)||na(e,t.to,!1,n)||na(t,e.from,!1,n)||na(t,e.to,!1,n)}function ZK(e,t,n=As){const s=Array.isArray(t)?t:[t];if(s.filter(d=>typeof d!="function").some(d=>typeof d=="boolean"?d:n.isDate(d)?na(e,d,!1,n):BM(d,n)?d.some(h=>na(e,h,!1,n)):xm(d)?d.from&&d.to?BC(e,{from:d.from,to:d.to},n):!1:FM(d)?GK(e,d.dayOfWeek,n):db(d)?n.isAfter(d.before,d.after)?BC(e,{from:n.addDays(d.after,1),to:n.addDays(d.before,-1)},n):ra(e.from,d,n)||ra(e.to,d,n):fb(d)||hb(d)?ra(e.from,d,n)||ra(e.to,d,n):!1))return!0;const u=s.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 QK(e,t){const{disabled:n,excludeDisabled:s,selected:o,required:l,onSelect:u}=e,[d,h]=ym(o,u?o:void 0),m=u?o:d;return{selected:m,select:(y,w,S)=>{const{min:j,max:N}=e,C=y?WK(y,m,j,N,l,t):void 0;return s&&n&&C?.from&&C.to&&ZK({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&&na(m,y,!1,t)}}function KK(e,t){const{selected:n,required:s,onSelect:o}=e,[l,u]=ym(n,o?n:void 0),d=o?n:l,{isSameDay:h}=t;return{selected:d,select:(g,y,w)=>{let S=g;return!s&&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 XK(e,t){const n=KK(e,t),s=YK(e,t),o=QK(e,t);switch(e.mode){case"single":return n;case"multiple":return s;case"range":return o;default:return}}function $r(e,t){return e instanceof On&&e.timeZone===t?e:new On(e,t)}function Hi(e,t,n){return $r(e,t)}function UC(e,t,n){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?Hi(e,t):Array.isArray(e)?e.map(s=>s instanceof Date?Hi(s,t):s):xm(e)?{...e,from:e.from?$r(e.from,t):e.from,to:e.to?$r(e.to,t):e.to}:db(e)?{before:Hi(e.before,t),after:Hi(e.after,t)}:fb(e)?{after:Hi(e.after,t)}:hb(e)?{before:Hi(e.before,t)}:e}function Av(e,t,n){return e&&(Array.isArray(e)?e.map(s=>UC(s,t)):UC(e,t))}function JK(e){let t=e;const n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&(t.today=$r(t.today,n)),t.month&&(t.month=$r(t.month,n)),t.defaultMonth&&(t.defaultMonth=$r(t.defaultMonth,n)),t.startMonth&&(t.startMonth=$r(t.startMonth,n)),t.endMonth&&(t.endMonth=$r(t.endMonth,n)),t.mode==="single"&&t.selected?t.selected=$r(t.selected,n):t.mode==="multiple"&&t.selected?t.selected=t.selected?.map(xe=>$r(xe,n)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?$r(t.selected.from,n):t.selected.from,to:t.selected.to?$r(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=Av(t.disabled,n)),t.hidden!==void 0&&(t.hidden=Av(t.hidden,n)),t.modifiers)){const xe={};Object.keys(t.modifiers).forEach(ke=>{xe[ke]=Av(t.modifiers?.[ke],n)}),t.modifiers=xe}const{components:s,formatters:o,labels:l,dateLib:u,locale:d,classNames:h}=p.useMemo(()=>{const xe={...LM,...t.locale},ke=t.broadcastCalendar?1:t.weekStartsOn,we=t.noonSafe&&t.timeZone?TK(t.timeZone,{weekStartsOn:ke,locale:xe}):void 0,Ne=t.dateLib&&we?{...we,...t.dateLib}:t.dateLib??we,He=new Cr({locale:xe,weekStartsOn:ke,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},Ne);return{dateLib:He,components:cK(t.components),formatters:yK(t.formatters),labels:CK(t.labels,He.options),locale:xe,classNames:{...mb(),...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:q,formatYearDropdown:Y}=o,G=UK(t,u),{days:ae,months:L,navStart:$,navEnd:U,previousMonth:H,nextMonth:le,goToMonth:I}=G,F=iK(ae,t,$,U,u),{isSelected:K,select:ne,selected:X}=XK(t,u)??{},{blur:ue,focused:te,isFocusTarget:ye,moveFocus:Ce,setFocused:_e}=HK(t,G,F,K??(()=>!1),u),{labelDayButton:Re,labelGridcell:ge,labelGrid:Be,labelMonthDropdown:be,labelNav:Ue,labelPrevious:rt,labelNext:it,labelWeekday:bt,labelWeekNumber:pe,labelWeekNumberHeader:Le,labelYearDropdown:We}=l,Oe=p.useMemo(()=>_K(u,t.ISOWeek,t.broadcastCalendar,t.today),[u,t.ISOWeek,t.broadcastCalendar,t.today]),ft=v!==void 0||S!==void 0,ut=p.useCallback(()=>{H&&(I(H),M?.(H))},[H,I,M]),Mn=p.useCallback(()=>{le&&(I(le),E?.(le))},[I,le,E]),Xe=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]),wt=p.useCallback((xe,ke)=>we=>{_e(xe),j?.(xe.date,ke,we)},[j,_e]),gt=p.useCallback((xe,ke)=>we=>{ue(),w?.(xe.date,ke,we)},[ue,w]),qn=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[He,De]=Ne[we.key];Ce(He,De)}N?.(xe.date,ke,we)},[Ce,N,t.dir]),ir=p.useCallback((xe,ke)=>we=>{C?.(xe.date,ke,we)},[C]),Yr=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:Vt,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=uK(t),ds=p.useRef(null);OK(ds,!!t.animate,{classNames:h,months:L,focused:te,dateLib:u});const Wr={dayPickerProps:t,selected:X,select:ne,isSelected:K,months:L,nextMonth:le,previousMonth:H,goToMonth:I,getModifiers:F,components:s,classNames:h,styles:R,labels:l,formatters:o};return ee.createElement($M.Provider,{value:Wr},ee.createElement(s.Root,{rootRef:t.animate?ds:void 0,className:Vt,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(s.Months,{className:h[Pe.Months],style:R?.[Pe.Months]},!t.hideNavigation&&!g&&ee.createElement(s.Nav,{"data-animated-nav":t.animate?"true":void 0,className:h[Pe.Nav],style:R?.[Pe.Nav],"aria-label":Ue(),onPreviousClick:ut,onNextClick:Mn,previousMonth:H,nextMonth:le}),L.map((xe,ke)=>ee.createElement(s.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(s.PreviousMonthButton,{type:"button",className:h[Pe.PreviousMonthButton],tabIndex:H?void 0:-1,"aria-disabled":H?void 0:!0,"aria-label":rt(H),onClick:ut,"data-animated-button":t.animate?"true":void 0},ee.createElement(s.Chevron,{disabled:H?void 0:!0,className:h[Pe.Chevron],orientation:t.dir==="rtl"?"right":"left"})),ee.createElement(s.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(s.DropdownNav,{className:h[Pe.Dropdowns],style:R?.[Pe.Dropdowns]},(()=>{const we=m==="dropdown"||m==="dropdown-months"?ee.createElement(s.MonthsDropdown,{key:"month",className:h[Pe.MonthsDropdown],"aria-label":be(),classNames:h,components:s,disabled:!!t.disableNavigation,onChange:zn(xe.date),options:NK(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(s.YearsDropdown,{key:"year",className:h[Pe.YearsDropdown],"aria-label":We(u.options),classNames:h,components:s,disabled:!!t.disableNavigation,onChange:Pn(xe.date),options:EK($,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(s.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(s.NextMonthButton,{type:"button",className:h[Pe.NextMonthButton],tabIndex:le?void 0:-1,"aria-disabled":le?void 0:!0,"aria-label":it(le),onClick:Mn,"data-animated-button":t.animate?"true":void 0},ee.createElement(s.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(s.Nav,{"data-animated-nav":t.animate?"true":void 0,className:h[Pe.Nav],style:R?.[Pe.Nav],"aria-label":Ue(),onPreviousClick:ut,onNextClick:Mn,previousMonth:H,nextMonth:le}),ee.createElement(s.MonthGrid,{role:"grid","aria-multiselectable":v==="multiple"||v==="range","aria-label":Be(xe.date,u.options,u)||void 0,className:h[Pe.MonthGrid],style:R?.[Pe.MonthGrid]},!t.hideWeekdays&&ee.createElement(s.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:h[Pe.Weekdays],style:R?.[Pe.Weekdays]},A&&ee.createElement(s.WeekNumberHeader,{"aria-label":Le(u.options),className:h[Pe.WeekNumberHeader],style:R?.[Pe.WeekNumberHeader],scope:"col"},B()),Oe.map(we=>ee.createElement(s.Weekday,{"aria-label":bt(we,u.options,u),className:h[Pe.Weekday],key:String(we),style:R?.[Pe.Weekday],scope:"col"},q(we,u.options,u)))),ee.createElement(s.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:h[Pe.Weeks],style:R?.[Pe.Weeks]},xe.weeks.map(we=>ee.createElement(s.Week,{className:h[Pe.Week],key:we.weekNumber,style:R?.[Pe.Week],week:we},A&&ee.createElement(s.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:He}=Ne,De=F(Ne);if(De[Bt.focused]=!De.hidden&&!!te?.isEqualTo(Ne),De[ts.selected]=K?.(He)||De.selected,xm(X)){const{from:Gt,to:Ot}=X;De[ts.range_start]=!!(Gt&&Ot&&u.isSameDay(He,Gt)),De[ts.range_end]=!!(Gt&&Ot&&u.isSameDay(He,Ot)),De[ts.range_middle]=na(X,He,!0,u)}const St=kK(De,R,t.modifiersStyles),bn=lK(De,h,t.modifiersClassNames),tn=!ft&&!De.hidden?ge(He,De,u.options,u):void 0;return ee.createElement(s.Day,{key:`${Ne.isoDate}_${Ne.displayMonthId}`,day:Ne,modifiers:De,className:bn.join(" "),style:St,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&&ft?ee.createElement(s.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(He,De,u.options,u),onClick:Xe(Ne,De),onBlur:gt(Ne,De),onFocus:wt(Ne,De),onKeyDown:qn(Ne,De),onMouseEnter:ir(Ne,De),onMouseLeave:Yr(Ne,De)},O(He,u.options,u)):!De.hidden&&O(Ne.date,u.options,u))})))))))),t.footer&&ee.createElement(s.Footer,{className:h[Pe.Footer],style:R?.[Pe.Footer],role:"status","aria-live":"polite"},t.footer)))}function eX({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:s="label",buttonVariant:o="ghost",formatters:l,components:u,...d}){const h=mb();return i.jsx(JK,{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:s,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(bu({variant:o}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",h.button_previous),button_next:W(bu({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",s==="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:tX,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 tX({className:e,day:t,modifiers:n,...s}){const o=mb(),l=p.useRef(null);return p.useEffect(()=>{n.focused&&l.current?.focus()},[n.focused]),i.jsx(tt,{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),...s})}function Ov(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0"),o=String(e.getHours()).padStart(2,"0"),l=String(e.getMinutes()).padStart(2,"0");return`${t}-${n}-${s}T${o}:${l}`}function nX(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${s}`}function VC({field:e,value:t,onChange:n,error:s,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?Ov(M):nX(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(Ov(O))}else{const O=new Date;O.setHours(R||0,T||0,0,0),n(Ov(O))}},E=M=>M.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});return i.jsx(or,{field:e,error:s,className:u,id:v,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(_u,{open:g,onOpenChange:y,children:[i.jsx(Eu,{asChild:!0,children:i.jsxs(tt,{id:v,type:"button",variant:"outline",disabled:o||l,className:W("justify-between font-normal",w?"w-44":"flex-1",!t&&"text-muted-foreground",s&&"border-destructive focus-visible:ring-destructive"),"aria-invalid":!!s,"aria-describedby":s?`${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(Tu,{className:"w-auto p-0",align:"start",children:i.jsx(eX,{mode:"single",selected:S,onSelect:C,captionLayout:"dropdown",disabled:o||l})})]}),w&&i.jsx(pt,{type:"time",value:N,onChange:_,disabled:o||l,className:W("w-28",s&&"border-destructive focus-visible:ring-destructive"),"aria-label":"Time"}),t&&!l&&!o&&i.jsx(tt,{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 rX=[{label:"Bold",icon:i.jsx(v3,{className:"size-4"}),prefix:"**",suffix:"**"},{label:"Italic",icon:i.jsx(_P,{className:"size-4"}),prefix:"_",suffix:"_"},{label:"Heading",icon:i.jsx(xP,{className:"size-4"}),prefix:"## ",suffix:"",block:!0},{label:"Link",icon:i.jsx(WN,{className:"size-4"}),prefix:"[",suffix:"](url)"},{label:"List",icon:i.jsx(gu,{className:"size-4"}),prefix:"- ",suffix:"",block:!0},{label:"Quote",icon:i.jsx(o5,{className:"size-4"}),prefix:"> ",suffix:"",block:!0},{label:"Code",icon:i.jsx(UN,{className:"size-4"}),prefix:"`",suffix:"`"}];function sX({field:e,value:t,onChange:n,error:s,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(or,{field:e,error:s,className:u,id:g,children:i.jsxs("div",{className:W("overflow-hidden rounded-md border border-input",s&&"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:rX.map(C=>i.jsx(tt,{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(mh,{})]}),i.jsx(eo,{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":!!s,"aria-describedby":s?`${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 aX({field:e,value:t,onChange:n,error:s,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(or,{field:e,error:s,className:u,id:v,children:i.jsxs(aa,{value:t??"",onValueChange:y,disabled:o||l,required:e.required,children:[i.jsx(ia,{id:v,className:W(s&&"border-destructive focus:ring-destructive"),"aria-invalid":!!s,"aria-describedby":s?`${v}-error`:void 0,children:i.jsx(oa,{placeholder:h})}),i.jsx(la,{children:i.jsx(nE,{children:g.map(w=>i.jsx(Xt,{value:w.value,children:w.label},w.value))})})]})})}function oX({field:e,value:t,onChange:n,error:s,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(or,{field:e,error:s,className:u,id:m,children:i.jsx("div",{className:W("rounded-md border border-input p-3",s&&"border-destructive"),children:i.jsxs(lW,{"aria-labelledby":`${m}-label`,children:[i.jsx(cW,{variant:"label",className:"sr-only",children:e.label}),v.length>3&&i.jsxs("div",{className:"flex gap-2",children:[i.jsx(tt,{type:"button",variant:"outline",size:"sm",onClick:w,disabled:o||l,children:"Select all"}),i.jsx(tt,{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(Sr,{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 iX({field:e,value:t,onChange:n,error:s,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"}:s;return i.jsx(or,{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(tt,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:C,disabled:o||l||!!S,children:"Format"}),i.jsx(tt,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:_,disabled:o||l||!!S,children:"Minify"})]}),i.jsx(eo,{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(Pu,{className:"size-3"}),"Invalid"]}),!S&&y.trim()!==""&&i.jsxs("span",{className:"flex items-center gap-1 text-success",children:[i.jsx(Ts,{className:"size-3"}),"Valid JSON"]})]})]})})}function Dv(e,t="size-6"){const n={className:t};switch(e){case"image":return i.jsx(rs,{...n});case"video":return i.jsx(ay,{...n});case"audio":return i.jsx(Jx,{...n});case"document":return i.jsx(jr,{...n});default:return i.jsx(Wx,{...n})}}function Df(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 zv(e){if(e===0)return"0 B";const t=1024,n=["B","KB","MB","GB"],s=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,s)).toFixed(1))} ${n[s]}`}function lX(e){return e.startsWith("http://")||e.startsWith("https://")}function cX({field:e,value:t,onChange:n,error:s,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"&&lX(t),T=Ye(m.getMediaAsset,t&&!R?{id:t}:"skip"),O=Ye(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")},[]),q=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(or,{field:e,error:s,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(Io,{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(ua,{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=Df(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:Dv(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:zv(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(ua,{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(rs,{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:q,children:i.jsxs(bl,{className:"max-w-3xl",children:[i.jsx(ju,{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(FN,{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:Df(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:[Dv(Df(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:zv(E.size??0)})]}),i.jsx(tt,{onClick:()=>D(E._id),children:"Select this file"})]})]}):i.jsxs(PT,{value:w,onValueChange:S,children:[i.jsxs(LT,{className:"w-full",children:[i.jsxs(Ch,{value:"browse",className:"flex-1 gap-2",children:[i.jsx(Zx,{className:"size-4"}),"Browse Library"]}),i.jsxs(Ch,{value:"upload",className:"flex-1 gap-2",children:[i.jsx(sy,{className:"size-4"}),"Upload New"]})]}),i.jsxs(kC,{value:"browse",className:"mt-4 flex flex-col gap-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(um,{className:"flex-1",children:[i.jsx(kl,{align:"inline-start",children:i.jsx(_l,{children:i.jsx(Al,{})})}),i.jsx(dm,{type:"search",placeholder:"Search files...",value:j,onChange:G=>N(G.target.value)})]}),i.jsxs(aa,{value:C||"all",onValueChange:G=>_(G==="all"?"":G),children:[i.jsx(ia,{className:"w-[140px]",children:i.jsx(oa,{placeholder:"All Types"})}),i.jsx(la,{children:i.jsxs(nE,{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=Df(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:Dv(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(Y3,{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(Ts,{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:zv(G.size??0)})]})]},G._id)})}):i.jsx(Bn,{icon:i.jsx(rs,{className:"size-6"}),title:"No media found",description:"Upload some media to get started",action:{label:"Upload Media",onClick:()=>S("upload")}})]}),i.jsx(kC,{value:"upload",className:"mt-4",children:i.jsx(iT,{generateUploadUrl:m.generateUploadUrl,createAsset:m.createMediaAsset,onUploadComplete:B,allowedMimeTypes:A,maxFileSize:e.options?.maxFileSize,maxConcurrentUploads:3})})]}),!E&&i.jsx(Cu,{children:i.jsx(me,{variant:"secondary",onClick:q,children:"Cancel"})})]})})]})}function qC(e){const t=["title","name","heading","label"];for(const n of t){const s=e.data?.[n];if(typeof s=="string"&&s.trim())return s}return e.slug||e._id}function uX({field:e,value:t,onChange:n,error:s,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=Ye(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=Ye(m.getEntry,E.length===1?{id:E[0]}:"skip"),T=Ye(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=Ye(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]),q=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(jr,{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:qC(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(ql,{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(or,{field:e,error:s,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(ju,{className:"px-4 pt-4",children:i.jsx(wl,{children:"Select Content"})}),i.jsxs(vT,{className:"border-none",children:[i.jsxs("div",{className:"flex items-center gap-2 border-b px-3 pb-2",children:[i.jsx(xT,{placeholder:"Search entries...",value:w,onValueChange:S,className:"border-none shadow-none focus:ring-0"}),A.length>1&&i.jsxs(aa,{value:j||"all",onValueChange:L=>N(L==="all"?"":L),children:[i.jsx(ia,{className:"h-8 w-[120px] shrink-0",children:i.jsx(oa,{placeholder:"All Types"})}),i.jsxs(la,{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(yT,{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(wT,{children:z.map(L=>{const $=E.includes(L._id);return i.jsxs(ST,{value:L._id,onSelect:()=>q(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(jr,{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:qC(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(yt,{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(Ts,{className:"size-4 shrink-0 text-primary"})]},L._id)})}):i.jsx(bT,{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(Cu,{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 dX({field:e,value:t,onChange:n,error:s,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=lT(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),q=Ye(m.suggestTerms,y?{taxonomyId:y,query:N,limit:10,excludeIds:t||[]}:"skip")??[],Y=Ye(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=Ke(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<q.length-1?ue+1:ue);break;case"ArrowUp":X.preventDefault(),A(ue=>ue>0?ue-1:0);break;case"Enter":X.preventDefault(),q.length>0&&M<q.length?L(q[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":_&&q.length>0&&(X.preventDefault(),L(q[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=q.filter(X=>!t?.includes(X._id)),ne=w&&N.trim()&&!K.some(X=>X.name.toLowerCase()===N.trim().toLowerCase());return i.jsx(or,{field:e,error:s,className:u,id:g,children:i.jsxs("div",{ref:z,className:W("relative rounded-md border border-input bg-background",s&&"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(yt,{variant:"secondary",className:"gap-1 pr-1",style:ye?{backgroundColor:ye,color:"#fff"}:void 0,children:[te,!o&&!l&&i.jsx(tt,{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(pt,{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 fX({field:e,value:t,onChange:n,error:s,disabled:o=!1,readOnly:l=!1,className:u="",id:d,placeholder:h="Select category..."}){const m=xn(),v=d||`field-${e.name}`,g=lT(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=Ye(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]),q=$=>{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(Sr,{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(Ts,{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(or,{field:e,error:s,className:u,id:v,children:i.jsxs("div",{ref:E,children:[i.jsxs(_u,{open:w,onOpenChange:S,children:[i.jsx(Eu,{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",s&&"border-destructive",!L&&"text-muted-foreground"),onKeyDown:q,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(Tu,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:i.jsx(Ku,{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(Do,{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(yt,{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 hX={CAD:"$",USD:"$",EUR:"€",GBP:"£",JPY:"¥",NGN:"₦",AUD:"A$",NZD:"NZ$"},eR=new Set(["JPY","KRW","VND"]);function mX(e){return eR.has(e)?1:100}function pX(e){return hX[e]??e}function gX({field:e,value:t,onChange:n,error:s,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=mX(y),S=pX(y),j=eR.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,q=B.selectionStart??0,Y=B.selectionEnd??0,G=N.slice(0,q)+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(or,{field:e,error:s,className:u,id:v,children:i.jsxs(um,{"data-disabled":o||void 0,children:[i.jsx(kl,{align:"inline-start",children:i.jsx(_l,{children:S})}),i.jsx(dm,{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":!!s,"aria-describedby":s?`${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 vX(e,t){return e?e.replace(/\{(\w+)\}/g,(n,s)=>{const o=t[s];return o==null?"":typeof o=="object"?JSON.stringify(o):String(o)}):""}function xX(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 yX({field:e,value:t,onChange:n,error:s,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(q=>z.add(q.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,q)=>{j(Y=>{const G=Y.map(ae=>ae.key===z?{...ae,data:{...ae.data,[B]:q}}:ae);return Promise.resolve().then(()=>n(G.map(ae=>ae.data))),G})},[n]),M=p.useCallback(()=>{const z=w.current++,B={key:z,data:xX(v)},q=[...S,B];C(Y=>new Set([...Y,z])),_(q)},[S,v,_]),A=p.useCallback(z=>{_(S.filter(B=>B.key!==z)),C(B=>{const q=new Set(B);return q.delete(z),q})},[S,_]),R=p.useCallback((z,B)=>{const q=S.findIndex(ae=>ae.key===z);if(q<0)return;const Y=q+B;if(Y<0||Y>=S.length)return;const G=[...S];[G[q],G[Y]]=[G[Y],G[q]],_(G)},[S,_]),T=p.useCallback(z=>{C(B=>{const q=new Set(B);return q.has(z)?q.delete(z):q.add(z),q})},[]),O=y===void 0||S.length<y,D=v.some(z=>z.type==="arrayObject");return i.jsx(or,{field:e,error:s,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 q=N.has(z.key),Y=vX(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(wy,{open:q,onOpenChange:()=>T(z.key),children:[i.jsxs("div",{className:"flex items-center gap-1 px-3 py-2",children:[i.jsx(Sy,{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:[q?i.jsx(vn,{className:"size-4 shrink-0 text-muted-foreground"}):i.jsx(zu,{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(tt,{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(tt,{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(i3,{className:"size-3.5"})}),i.jsx(tt,{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(jy,{children:i.jsx("div",{className:"flex flex-col gap-4 border-t border-border px-3 py-3",children:v.map(G=>i.jsx(Eh,{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(tt,{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 bX({field:e,value:t,onChange:n,error:s,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(or,{field:e,error:s,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(eo,{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":!!s,"aria-describedby":s?`${h}-error`:e.description?`${h}-desc`:void 0})})}const wX=new Map;function SX(e){return wX.get(e)}function Eh({field:e,value:t,onChange:n,error:s,disabled:o=!1,readOnly:l=!1,className:u=""}){const d={field:e,error:s,disabled:o,readOnly:l,className:u};switch(e.type){case"text":return i.jsx(rZ,{...d,value:t??"",onChange:n});case"richText":return i.jsx(sX,{...d,value:t??"",onChange:n});case"number":return i.jsx(sZ,{...d,value:t??null,onChange:n});case"boolean":return i.jsx(aZ,{...d,value:t??!1,onChange:n});case"date":return i.jsx(VC,{...d,value:t??null,onChange:n,includeTime:!1});case"datetime":return i.jsx(VC,{...d,value:t??null,onChange:n,includeTime:!0});case"select":return i.jsx(aX,{...d,value:t??"",onChange:n});case"multiSelect":return i.jsx(oX,{...d,value:t??[],onChange:n});case"json":return i.jsx(iX,{...d,value:t??null,onChange:n});case"media":return i.jsx(cX,{...d,value:t??null,onChange:n});case"reference":return i.jsx(uX,{...d,value:t??null,onChange:n});case"tags":return i.jsx(dX,{...d,value:t??[],onChange:n});case"category":return i.jsx(fX,{...d,value:t??null,onChange:n});case"money":return i.jsx(gX,{...d,value:t??null,onChange:n});case"arrayObject":return i.jsx(yX,{...d,value:t??null,onChange:n});default:{const h=SX(e.type);return h?i.jsx(h,{...d,value:t,onChange:n}):i.jsx(bX,{...d,value:t,onChange:n})}}}function jX(e){return e.type==="boolean"||e.type==="number"&&!e.description}function CX(e){const t=[];let n=[];function s(){n.length>0&&(t.push({type:"grid",fields:n}),n=[])}for(const o of e)jX(o)?n.push(o):(s(),t.push({type:"full",field:o}));return s(),t}function NX({group:e,formData:t,fieldErrors:n,isSubmitting:s,onFieldChange:o,initialOpen:l=!1}){const[u,d]=p.useState(l),h=e.fields.filter(v=>n[v.name]).length,m=CX(e.fields);return i.jsxs(wy,{open:u,onOpenChange:d,children:[i.jsx(Sy,{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(jy,{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(Eh,{field:y,value:t[y.name],onChange:w=>o(y.name,w),error:n[y.name],disabled:s},y.name))},`grid-${g}`):i.jsx(Eh,{field:v.field,value:t[v.field.name],onChange:y=>o(v.field.name,y),error:n[v.field.name],disabled:s},v.field.name))})})]})}function kX(e){const t=[],n=new Map;for(const s of e){const o=s.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(s)}return t}function _X({fields:e,formData:t,fieldErrors:n,isSubmitting:s,onFieldChange:o}){const l=kX(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(Eh,{field:d,value:t[d.name],onChange:h=>o(d.name,h),error:n[d.name],disabled:s},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(NX,{group:d,formData:t,fieldErrors:n,isSubmitting:s,onFieldChange:o,initialOpen:h===0},d.name))})})}function HC({entry:e,hasScheduling:t,hasVersioning:n,canDelete:s,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(qf,{className:"pb-3",children:i.jsx(Hf,{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(ql,{status:e.status})]}),e.version>0&&i.jsxs(i.Fragment,{children:[i.jsx(mh,{}),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(sh,{className:"size-3"}),new Date(e.scheduledPublishAt).toLocaleString()]})]})]})]}),i.jsxs(Jc,{children:[i.jsx(qf,{className:"pb-3",children:i.jsx(Hf,{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(tt,{className:"w-full",onClick:m,disabled:_,children:[l&&i.jsx(es,{"data-icon":"inline-start"}),"Publish Now"]}),t&&i.jsxs(tt,{variant:"outline",className:"w-full",onClick:g,disabled:_,children:[i.jsx(sh,{"data-icon":"inline-start"}),"Schedule"]})]}),e.status==="scheduled"&&i.jsxs(i.Fragment,{children:[i.jsxs(tt,{className:"w-full",onClick:w,disabled:_,children:[l&&i.jsx(es,{"data-icon":"inline-start"}),"Publish Now"]}),t&&i.jsx(tt,{variant:"outline",className:"w-full",onClick:y,disabled:_,children:"Cancel Schedule"})]}),e.status==="published"&&i.jsxs(tt,{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(qf,{className:"pb-3",children:i.jsx(Hf,{className:"text-sm font-medium",children:"History"})}),i.jsx(eu,{children:i.jsxs(tt,{variant:"outline",className:"w-full",onClick:C,children:[i.jsx(YN,{"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(tt,{variant:"outline",className:"w-full",onClick:S,disabled:_,children:[u&&i.jsx(es,{"data-icon":"inline-start"}),!u&&i.jsx(VN,{"data-icon":"inline-start"}),"Duplicate"]}),(e.status==="draft"||e.status==="scheduled")&&i.jsxs(tt,{variant:"outline",className:"w-full",onClick:j,disabled:_,children:[d&&i.jsx(es,{"data-icon":"inline-start"}),!d&&i.jsx($N,{"data-icon":"inline-start"}),"Archive"]}),s&&i.jsxs(i.Fragment,{children:[i.jsx(mh,{}),i.jsxs(tt,{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 EX({open:e,onOpenChange:t,scheduleDateTime:n,onScheduleDateTimeChange:s,onSchedule:o,isPublishing:l,publishError:u,minDateTime:d}){return i.jsx(cs,{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(pt,{type:"datetime-local",value:n,onChange:h=>s(h.target.value),min:d}),u&&i.jsx("p",{className:"text-sm text-destructive",children:u})]})})}function TX({open:e,onOpenChange:t,action:n,onConfirm:s,isPublishing:o}){return i.jsx(sa,{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:s,isLoading:o})}function MX({open:e,onOpenChange:t,onConfirm:n,isDeleting:s,error:o}){return i.jsx(sa,{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:s,error:o})}function RX(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 tR=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}),td=()=>{const e=ee.useContext(tR);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};RX(`[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 AX(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function OX(){return vb(/^Mac/)}function DX(){return vb(/^iPhone/)}function YC(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function zX(){return vb(/^iPad/)||OX()&&navigator.maxTouchPoints>1}function nR(){return DX()||zX()}function vb(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const PX=24,LX=typeof window<"u"?p.useLayoutEffect:p.useEffect;function WC(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const Pv=typeof document<"u"&&window.visualViewport;function GC(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function rR(e){for(GC(e)&&(e=e.parentElement);e&&!GC(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const IX=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let zf=0,Lv;function $X(e={}){let{isDisabled:t}=e;LX(()=>{if(!t)return zf++,zf===1&&nR()&&(Lv=FX()),()=>{zf--,zf===0&&Lv?.()}},[t])}function FX(){let e,t=0,n=g=>{e=rR(g.target),!(e===document.documentElement&&e===document.body)&&(t=g.changedTouches[0].pageY)},s=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;yx(y)&&y!==document.activeElement&&(g.preventDefault(),y.style.transform="translateY(-2000px)",y.focus(),requestAnimationFrame(()=>{y.style.transform=""}))},l=g=>{let y=g.target;yx(y)&&(y.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{y.style.transform="",Pv&&(Pv.height<window.innerHeight?requestAnimationFrame(()=>{ZC(y)}):Pv.addEventListener("resize",()=>ZC(y),{once:!0}))}))},u=()=>{window.scrollTo(0,0)},d=window.pageXOffset,h=window.pageYOffset,m=WC(BX(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let v=WC(Yc(document,"touchstart",n,{passive:!1,capture:!0}),Yc(document,"touchmove",s,{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 BX(e,t,n){let s=e.style[t];return e.style[t]=n,()=>{e.style[t]=s}}function Yc(e,t,n,s){return e.addEventListener(t,n,s),()=>{e.removeEventListener(t,n,s)}}function ZC(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=rR(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let s=n.getBoundingClientRect().top,o=e.getBoundingClientRect().top,l=e.getBoundingClientRect().bottom;const u=n.getBoundingClientRect().bottom+PX;l>u&&(n.scrollTop+=o-s)}e=n.parentElement}}function yx(e){return e instanceof HTMLInputElement&&!IX.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function UX(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function VX(...e){return t=>e.forEach(n=>UX(n,t))}function sR(...e){return p.useCallback(VX(...e),e)}const aR=new WeakMap;function mn(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let s={};Object.entries(t).forEach(([o,l])=>{if(o.startsWith("--")){e.style.setProperty(o,l);return}s[o]=e.style[o],e.style[o]=l}),!n&&aR.set(e,s)}function qX(e,t){if(!e||!(e instanceof HTMLElement))return;let n=aR.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 Pf(e,t){if(!e)return null;const n=window.getComputedStyle(e),s=n.transform||n.webkitTransform||n.mozTransform;let o=s.match(/^matrix3d\((.+)\)$/);return o?parseFloat(o[1].split(", ")[cn(t)?13:12]):(o=s.match(/^matrix\((.+)\)$/),o?parseFloat(o[1].split(", ")[cn(t)?5:4]):null)}function HX(e){return 8*(Math.log(e+1)-2)}function Iv(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function YX(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const Ft={DURATION:.5,EASE:[.32,.72,0,1]},oR=.4,WX=.25,GX=100,iR=8,Co=16,bx=26,$v="vaul-dragging";function lR(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 ZX({defaultProp:e,onChange:t}){const n=ee.useState(e),[s]=n,o=ee.useRef(s),l=lR(t);return ee.useEffect(()=>{o.current!==s&&(l(s),o.current=s)},[s,o,l]),n}function cR({prop:e,defaultProp:t,onChange:n=()=>{}}){const[s,o]=ZX({defaultProp:t,onChange:n}),l=e!==void 0,u=l?e:s,d=lR(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 QX({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:s,overlayRef:o,fadeFromIndex:l,onSnapPointChange:u,direction:d="bottom",container:h,snapToSequentialPoint:m}){const[v,g]=cR({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 q=z?B:y?D*T.width:0;return y?d==="right"?T.width-q:-T.width+q:q}))!=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(s.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)])},[s.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,q=j===l-1,Y=j===0,G=T>0;if(q&&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>oR&&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(s.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,q=D?C[B]-C[B-1]:C[B+1]-C[B],Y=T/Math.abs(q);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 KX=()=>()=>{};function XX(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:s,noBodyStyles:o}=td(),l=ee.useRef(null),u=p.useMemo(()=>document.body.style.backgroundColor,[]);function d(){return(window.innerWidth-bx)/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;YX(s&&!o?Iv(document.body,{background:"black"}):KX,Iv(h,{transformOrigin:cn(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${Ft.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ft.EASE.join(",")})`}));const m=Iv(h,{borderRadius:`${iR}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 JX({isOpen:e,modal:t,nested:n,hasBeenOpened:s,preventScrollRestoration:o,noBodyStyles:l}){const[u,d]=ee.useState(()=>typeof window<"u"?window.location.href:""),h=ee.useRef(0),m=ee.useCallback(()=>{if(YC()&&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(YC()&&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||!s||(e?(!window.matchMedia("(display-mode: standalone)").matches&&m(),t||window.setTimeout(()=>{v()},500)):v())},[e,s,u,t,n,m,v]),{restorePositionSetting:v}}function eJ({open:e,onOpenChange:t,children:n,onDrag:s,onRelease:o,snapPoints:l,shouldScaleBackground:u=!1,setBackgroundColorOnScale:d=!0,closeThreshold:h=WX,scrollLockTimeout:m=GX,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:q=!1}){var Y,G;const[ae=!1,L]=cR({defaultProp:A,prop:e,onChange:xe=>{t?.(xe),!xe&&!_&&wt(),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),Be=ee.useRef(0),be=ee.useRef(null),Ue=ee.useRef(((Y=be.current)==null?void 0:Y.getBoundingClientRect().height)||0),rt=ee.useRef(((G=be.current)==null?void 0:G.getBoundingClientRect().width)||0),it=ee.useRef(0),bt=ee.useCallback(xe=>{l&&xe===ft.length-1&&(ne.current=new Date)},[]),{activeSnapPoint:pe,activeSnapPointIndex:Le,setActiveSnapPoint:We,onRelease:Oe,snapPointsOffset:ft,onDrag:ut,shouldFade:Mn,getPercentageDragged:Xe}=QX({snapPoints:l,activeSnapPointProp:w,setActiveSnapPointProp:S,drawerRef:be,fadeFromIndex:y,overlayRef:K,onSnapPointChange:bt,direction:M,container:B,snapToSequentialPoint:T});$X({isDisabled:!ae||H||!N||I||!$||!D||!R});const{restorePositionSetting:wt}=JX({isOpen:ae,modal:N,nested:_??!1,hasBeenOpened:$,preventScrollRestoration:O,noBodyStyles:E});function gt(){return(window.innerWidth-bx)/window.innerWidth}function qn(xe){var ke,we;!v&&!l||be.current&&!be.current.contains(xe.target)||(Ue.current=((ke=be.current)==null?void 0:ke.getBoundingClientRect().height)||0,rt.current=((we=be.current)==null?void 0:we.getBoundingClientRect().width)||0,le(!0),X.current=new Date,nR()&&window.addEventListener("touchend",()=>ye.current=!1,{once:!0}),xe.target.setPointerCapture(xe.pointerId),_e.current=cn(M)?xe.pageY:xe.pageX)}function ir(xe,ke){var we;let Ne=xe;const He=(we=window.getSelection())==null?void 0:we.toString(),De=be.current?Pf(be.current,M):null,St=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&&St.getTime()-ne.current.getTime()<500)return!1;if(De!==null&&(M==="bottom"?De>0:De<0))return!0;if(He&&He.length>0)return!1;if(te.current&&St.getTime()-te.current.getTime()<m&&De===0||ke)return te.current=St,!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 Yr(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,He=l&&!v&&!Ne;if(He&&Le===0)return;const De=Math.abs(we),St=document.querySelector("[data-vaul-drawer-wrapper]"),bn=M==="bottom"||M==="top"?Ue.current:rt.current;let tn=De/bn;const Gt=Xe(De,Ne);if(Gt!==null&&(tn=Gt),He&&tn>=1||!ye.current&&!ir(xe.target,Ne))return;if(be.current.classList.add($v),ye.current=!0,mn(be.current,{transition:"none"}),mn(K.current,{transition:"none"}),l&&ut({draggedDistance:we}),Ne&&!l){const Rn=HX(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)&&(s?.(xe,tn),mn(K.current,{opacity:`${Ot}`,transition:"none"},!0)),St&&K.current&&u){const Rn=Math.min(gt()+tn*(1-gt()),1),Hn=8-tn*8,wn=Math.max(0,14-tn*14);mn(St,{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(yx(we)||Re.current){var Ne;const He=((Ne=window.visualViewport)==null?void 0:Ne.height)||0,De=window.innerHeight;let St=De-He;const bn=be.current.getBoundingClientRect().height||0,tn=bn>De*.8;it.current||(it.current=bn);const Gt=be.current.getBoundingClientRect().top;if(Math.abs(Be.current-St)>60&&(Re.current=!Re.current),l&&l.length>0&&ft&&Le){const Ot=ft[Le]||0;St+=Ot}if(Be.current=St,bn>He||Re.current){const Ot=be.current.getBoundingClientRect().height;let Rn=Ot;Ot>He&&(Rn=He-(tn?Gt:bx)),j?be.current.style.height=`${Ot-Math.max(St,0)}px`:be.current.style.height=`${Math.max(Rn,He-Gt)}px`}else AX()||(be.current.style.height=`${it.current}px`);l&&l.length>0&&!Re.current?be.current.style.bottom="0px":be.current.style.bottom=`${Math.max(St,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,ft]);function zn(xe){Vt(),C?.(),xe||L(!1),setTimeout(()=>{l&&We(l[0])},Ft.DURATION*1e3)}function Pn(){if(!be.current)return;const xe=document.querySelector("[data-vaul-drawer-wrapper]"),ke=Pf(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:`${iR}px`,overflow:"hidden",...cn(M)?{transform:`scale(${gt()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${gt()}) 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 Vt(){!H||!be.current||(be.current.classList.remove($v),ye.current=!1,le(!1),ue.current=new Date)}function en(xe){if(!H||!be.current)return;be.current.classList.remove($v),ye.current=!1,le(!1),ue.current=new Date;const ke=Pf(be.current,M);if(!xe||!ir(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),He=Math.abs(Ne)/we;if(He>.05&&(F(!0),setTimeout(()=>{F(!1)},200)),l){Oe({draggedDistance:Ne*(M==="bottom"||M==="right"?1:-1),closeDrawer:zn,velocity:He,dismissible:v}),o?.(xe,!0);return}if(M==="bottom"||M==="right"?Ne>0:Ne<0){Pn(),o?.(xe,!0);return}if(He>oR){zn(),o?.(xe,!1);return}var De;const St=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:St)*h){zn(),o?.(xe,!1);return}o?.(xe,!0),Pn()}ee.useEffect(()=>(ae&&(mn(document.documentElement,{scrollBehavior:"auto"}),ne.current=new Date),()=>{qX(document.documentElement,"scrollBehavior")}),[ae]);function $t(xe){const ke=xe?(window.innerWidth-Co)/window.innerWidth:1,we=xe?-Co: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=Pf(be.current,M);mn(be.current,{transition:"none",transform:cn(M)?`translate3d(0, ${Ne}px, 0)`:`translate3d(${Ne}px, 0, 0)`})},500))}function ds(xe,ke){if(ke<0)return;const we=(window.innerWidth-Co)/window.innerWidth,Ne=we+ke*(1-we),He=-Co+ke*Co;mn(be.current,{transform:cn(M)?`scale(${Ne}) translate3d(0, ${He}px, 0)`:`scale(${Ne}) translate3d(${He}px, 0, 0)`,transition:"none"})}function Wr(xe,ke){const we=cn(M)?window.innerHeight:window.innerWidth,Ne=ke?(we-Co)/we:1,He=ke?-Co:0;ke&&mn(be.current,{transition:`transform ${Ft.DURATION}s cubic-bezier(${Ft.EASE.join(",")})`,transform:cn(M)?`scale(${Ne}) translate3d(0, ${He}px, 0)`:`scale(${Ne}) translate3d(${He}px, 0, 0)`})}return ee.useEffect(()=>{N||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[N]),ee.createElement($u,{defaultOpen:A,onOpenChange:xe=>{!v&&!xe||(xe?U(!0):zn(!0),L(xe))},open:ae},ee.createElement(tR.Provider,{value:{activeSnapPoint:pe,snapPoints:l,setActiveSnapPoint:We,drawerRef:be,overlayRef:K,onOpenChange:t,onPress:qn,onRelease:en,onDrag:Yr,dismissible:v,shouldAnimate:ge,handleOnly:g,isOpen:ae,isDragging:H,shouldFade:Mn,closeDrawer:zn,onNestedDrag:ds,onNestedOpenChange:$t,onNestedRelease:Wr,keyboardIsOpen:Re,modal:N,snapPointsOffset:ft,activeSnapPointIndex:Le,direction:M,shouldScaleBackground:u,setBackgroundColorOnScale:d,noBodyStyles:E,container:B,autoFocus:q}},n))}const uR=ee.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:s,onRelease:o,shouldFade:l,isOpen:u,modal:d,shouldAnimate:h}=td(),m=sR(t,n),v=s&&s.length>0;if(!d)return null;const g=ee.useCallback(y=>o(y),[o]);return ee.createElement(Bu,{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})});uR.displayName="Drawer.Overlay";const dR=ee.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...s},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}=td(),[M,A]=ee.useState(!1),R=sR(o,l),T=ee.useRef(null),O=ee.useRef(null),D=ee.useRef(!1),z=j&&j.length>0;XX();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 q(Y){T.current=null,D.current=!1,d(Y)}return ee.createElement(Uu,{"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",...s,ref:R,style:v&&v.length>0?{"--snap-point-height":`${v[g??0]}px`,...t}:t,onPointerDown:Y=>{C||(s.onPointerDown==null||s.onPointerDown.call(s,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||(s.onPointerMove==null||s.onPointerMove.call(s,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=>{s.onPointerUp==null||s.onPointerUp.call(s,Y),T.current=null,D.current=!1,d(Y)},onPointerOut:Y=>{s.onPointerOut==null||s.onPointerOut.call(s,Y),q(O.current)},onContextMenu:Y=>{s.onContextMenu==null||s.onContextMenu.call(s,Y),O.current&&q(O.current)}})});dR.displayName="Drawer.Content";const tJ=250,nJ=120,rJ=ee.forwardRef(function({preventCycle:e=!1,children:t,...n},s){const{closeDrawer:o,isDragging:l,snapPoints:u,activeSnapPoint:d,setActiveSnapPoint:h,dismissible:m,handleOnly:v,isOpen:g,onPress:y,onDrag:w}=td(),S=ee.useRef(null),j=ee.useRef(!1);function N(){if(j.current){E();return}window.setTimeout(()=>{C()},nJ)}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},tJ)}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:s,"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))});rJ.displayName="Drawer.Handle";function sJ(e){const t=td(),{container:n=t.container,...s}=e;return ee.createElement(Fu,{container:n,...s})}const nd={Root:eJ,Content:dR,Overlay:uR,Portal:sJ,Title:Vh};function aJ({...e}){return i.jsx(nd.Root,{"data-slot":"drawer",...e})}function oJ({...e}){return i.jsx(nd.Portal,{"data-slot":"drawer-portal",...e})}function iJ({className:e,...t}){return i.jsx(nd.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 lJ({className:e,children:t,...n}){return i.jsxs(oJ,{"data-slot":"drawer-portal",children:[i.jsx(iJ,{}),i.jsxs(nd.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 cJ({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 uJ({className:e,...t}){return i.jsx(nd.Title,{"data-slot":"drawer-title",className:W("font-semibold text-foreground",e),...t})}function wx(e){const t=new Date(e),n=t.getFullYear(),s=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}-${s}-${o}T${l}:${u}`}function dJ(e){return new Date(e).getTime()}function fJ(e){const t=new Date(e),n=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0");return`${n}-${s}-${o}`}function hJ(e,t){const n={...e};for(const s of t){const o=e[s.name];(s.type==="date"||s.type==="datetime")&&typeof o=="number"&&(n[s.name]=s.type==="datetime"?wx(o):fJ(o))}return n}function QC(e,t){const n={...e};for(const s of t){const o=e[s.name];(s.type==="date"||s.type==="datetime")&&(typeof o=="string"&&o?n[s.name]=new Date(o).getTime():o||(n[s.name]=null))}return n}function fR({contentType:e,entry:t,onSave:n,onCancel:s,onDelete:o,onNavigateToEntry:l,onNavigateToNewEntry:u,siblingEntries:d,autosaveEnabled:h=!0,autosaveInterval:m=3e4,canDelete:v=!1}){const{settings:g}=zk(),y=p.useCallback(()=>{if(t)return hJ({...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,q]=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),wx(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,Be]=p.useState(!1),[be,Ue]=p.useState(!1),[rt,it]=p.useState(!1),[bt,pe]=p.useState(!1),[Le,We]=p.useState(!1),Oe=p.useRef(null),ft=p.useRef(w);ft.current=w;const ut=xn(),Mn=Ke(ut.createEntry),Xe=Ke(ut.updateEntry),wt=Ke(ut.publishEntry),gt=Ke(ut.unpublishEntry),qn=Ke(ut.scheduleEntry),ir=Ke(ut.cancelScheduledEntry),Yr=Ke(ut.deleteEntry),zn=Ke(ut.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(Ve=>({...Ve,[Q]:je})),M(!0),N(Ve=>{if(Ve[Q]){const{[Q]:vt,...Je}=Ve;return Je}return Ve})},[]),Vt=p.useCallback(async()=>{const Q={};for(const je of e.fields){const Ve=w[je.name];if(je.required&&(Ve==null||Ve===""||Array.isArray(Ve)&&Ve.length===0)){Q[je.name]={message:`${je.label} is required`,code:"REQUIRED"};continue}if(Ve!=null&&Ve!=="")switch(je.type){case"text":{const vt=String(Ve),Je=je.options;Je?.minLength&&vt.length<Je.minLength?Q[je.name]={message:`Minimum ${Je.minLength} characters required`,code:"MIN_LENGTH"}:Je?.maxLength&&vt.length>Je.maxLength?Q[je.name]={message:`Maximum ${Je.maxLength} characters allowed`,code:"MAX_LENGTH"}:Je?.pattern&&(new RegExp(Je.pattern).test(vt)||(Q[je.name]={message:"Value does not match the required format",code:"PATTERN_MISMATCH"}));break}case"number":{const vt=Number(Ve),Je=je.options;isNaN(vt)?Q[je.name]={message:"Must be a valid number",code:"INVALID_TYPE"}:Je?.min!==void 0&&vt<Je.min?Q[je.name]={message:`Minimum value is ${Je.min}`,code:"MIN_VALUE"}:Je?.max!==void 0&&vt>Je.max?Q[je.name]={message:`Maximum value is ${Je.max}`,code:"MAX_VALUE"}:Je?.precision===0&&!Number.isInteger(vt)&&(Q[je.name]={message:"Must be a whole number",code:"NOT_INTEGER"});break}case"select":{const vt=je.options;vt?.options&&!vt.options.some(Je=>Je.value===Ve)&&(Q[je.name]={message:"Please select a valid option",code:"INVALID_OPTION"});break}case"multiSelect":{const vt=je.options;if(Array.isArray(Ve)&&vt?.options){const Je=vt.options.map(Zt=>Zt.value);Ve.filter(Zt=>!Je.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 Xe({id:t._id,data:QC(ft.current,e.fields)}),R({...ft.current}),O("saved"),M(!1),q(0),setTimeout(()=>O("idle"),3e3)}catch(je){console.error("Autosave failed:",je);const Ve=je instanceof Error?je.message:"Failed to save";if(qG(je)&&Q<Y){const Je=Math.min(1e3*Math.pow(2,Q),1e4);O("error"),z(`Save failed, retrying in ${Math.round(Je/1e3)}s...`),q(Q+1),setTimeout(()=>en(Q+1),Je)}else O("error"),z(Ve),q(0)}},[E,t,Xe,Y]),$t=p.useCallback(()=>{q(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 ds=p.useCallback(async()=>{if(await Vt()){_(!0);try{let je;const Ve=QC(w,e.fields);t?je=await Xe({id:t._id,data:Ve}):je=await Mn({contentTypeName:e.name,data:Ve}),M(!1),R({...w}),Kr.success("Changes saved"),n?.(je)}catch(je){const{fieldErrors:Ve,generalError:vt}=VG(je),Je=vt??(je instanceof Error?je.message:"Failed to save entry");Kr.error("Failed to save",{description:Je}),Object.keys(Ve).length>0&&N(Yn=>({...Yn,...Ve}))}finally{_(!1)}}},[Vt,t,w,e.fields,e.name,e._id,Mn,Xe,n]),Wr=p.useCallback(()=>{if(E){We(!0);return}s?.()},[E,s]),xe=p.useCallback(()=>{We(!1),s?.()},[s]),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 wt({id:t._id,changeDescription:"Published from editor"});Kr.success("Entry published"),n?.(Q)}else{const Q=await gt({id:t._id});Kr.success("Entry unpublished"),n?.(Q)}}catch(Q){Kr.error(`Failed to ${ne}`,{description:Q instanceof Error?Q.message:void 0})}finally{H(!1),X(null)}}},[t,ne,wt,gt,n]),He=p.useCallback(async()=>{if(t){H(!0);try{const Q=await wt({id:t._id,changeDescription:"Published from editor"});Kr.success("Entry published"),n?.(Q)}catch(Q){Kr.error("Failed to publish",{description:Q instanceof Error?Q.message:void 0})}finally{H(!1)}}},[t,wt,n]),De=p.useCallback(async()=>{if(!t)return;const Q=dJ(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 qn({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,qn,n]),St=p.useCallback(async()=>{if(t){H(!0),I(null);try{const Q=await ir({id:t._id});n?.(Q)}catch(Q){I(Q instanceof Error?Q.message:"Failed to cancel schedule")}finally{H(!1)}}},[t,ir,n]),bn=p.useCallback(()=>{Re(null),te(!0)},[]),tn=p.useCallback(async()=>{if(t){Ce(!0),Re(null);try{await Yr({id:t._id,hardDelete:!1}),te(!1),o?.()}catch(Q){Re(Q instanceof Error?Q.message:"Failed to delete entry")}finally{Ce(!1)}}},[t,Yr,o]),Gt=p.useCallback(async()=>{if(t){Be(!0);try{const Q=await zn({sourceEntryId:t._id});Kr.success("Entry duplicated"),n?.(Q)}catch(Q){Kr.error("Failed to duplicate",{description:Q instanceof Error?Q.message:void 0})}finally{Be(!1)}}},[t,zn,n]),Ot=p.useCallback(async()=>{if(t){Ue(!0);try{const Q=await Xe({id:t._id,status:"archived"});Kr.success("Entry archived"),n?.(Q)}catch(Q){Kr.error("Failed to archive",{description:Q instanceof Error?Q.message:void 0})}finally{Ue(!1)}}},[t,Xe,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(nZ,{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:ds,onCancel:Wr,onPublishClick:ke,onUnpublishClick:we,onScheduleClick:()=>ae(!0),onCancelSchedule:St,onPublishNow:He,onDuplicate:Gt,onArchive:Ot,onDelete:bn,onAutosaveRetry:$t,onToggleProperties:()=>pe(!0),siblingEntries:d,onNavigateToEntry:l,onNavigateToNewEntry:u}),i.jsx(HG,{open:Le,onOpenChange:We,children:i.jsxs(GG,{children:[i.jsxs(ZG,{children:[i.jsx(KG,{children:"Unsaved changes"}),i.jsx(XG,{children:"You have unsaved changes that will be lost if you leave."})]}),i.jsxs(QG,{children:[i.jsx(eZ,{children:"Keep editing"}),i.jsx(JG,{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(_X,{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(HC,{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:St,onPublishNow:He,onDuplicate:Gt,onArchive:Ot,onDelete:bn,onViewHistory:()=>it(!0)})})]}),t&&i.jsx(aJ,{open:bt,onOpenChange:pe,children:i.jsxs(lJ,{children:[i.jsx(cJ,{children:i.jsx(uJ,{children:"Properties"})}),i.jsx("div",{className:"overflow-y-auto px-4 pb-6",children:i.jsx(HC,{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:St,onPublishNow:He,onDuplicate:Gt,onArchive:Ot,onDelete:bn,onViewHistory:()=>it(!0)})})]})}),wn&&t&&i.jsx(L_,{open:rt,onOpenChange:it,children:i.jsxs(I_,{side:"right",className:"w-96 sm:w-[420px]",children:[i.jsx($_,{children:"Version History"}),i.jsx(UG,{entryId:t._id,currentVersion:t.version,onRollbackComplete:()=>it(!1),onClose:()=>it(!1)})]})}),Hn&&i.jsx(EX,{open:G,onOpenChange:ae,scheduleDateTime:L,onScheduleDateTimeChange:$,onSchedule:De,isPublishing:U,publishError:le,minDateTime:wx(Date.now()+60*1e3)}),i.jsx(TX,{open:F,onOpenChange:Q=>{Q||(K(!1),X(null))},action:ne,onConfirm:Ne,isPublishing:U}),i.jsx(MX,{open:ue,onOpenChange:Q=>{!Q&&!ye&&(te(!1),Re(null))},onConfirm:tn,isDeleting:ye,error:_e})]})}function Jo(){const e=Qa(),t=X4(),n=Yo({strict:!1}),s=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:s,currentRoute:t.pathname,params:n??{},canGoBack:window.history.length>1,goBack:d,navigateToEntry:o,navigateToContentType:l,navigateToNewEntry:u}),[s,t.pathname,n,d,o,l,u])}const us=F4({component:()=>i.jsx(JH,{children:i.jsx(LN,{})})}),mJ=is({getParentRoute:()=>us,path:"/",component:()=>{const e=Jo();return i.jsx(EY,{api:Cn,navigation:e})}}),pJ=is({getParentRoute:()=>us,path:"/content",component:()=>{const e=Jo();return i.jsx(SY,{api:Cn,navigation:e})}}),gJ=is({getParentRoute:()=>us,path:"/content-types",component:()=>{const e=Jo();return i.jsx(CY,{api:Cn,navigation:e})}}),vJ=is({getParentRoute:()=>us,path:"/media",component:()=>{const e=Jo(),{settings:t}=zk();return i.jsx(TW,{api:Cn,navigation:e,settings:t})}}),xJ=is({getParentRoute:()=>us,path:"/settings",component:()=>{const e=Jo();return i.jsx(_G,{api:Cn,navigation:e})}}),yJ=is({getParentRoute:()=>us,path:"/taxonomies",component:()=>{const e=Jo();return i.jsx(AG,{api:Cn,navigation:e})}}),bJ=is({getParentRoute:()=>us,path:"/trash",component:()=>{const e=Jo();return i.jsx(OG,{api:Cn,navigation:e})}});function wJ(){const{entryId:e}=Yo({from:"/entries/$entryId"}),t=Qa(),{canDelete:n}=cm(),s=Ye(Cn.getEntry,{id:e}),o=Ye(Cn.getContentType,s?{name:s.contentTypeName}:"skip"),l=()=>{if(!s||!o)return;const m=o.titleField??"title",v=s.data[m];return typeof v=="string"&&v?v:"Untitled"};if(eb(`/entries/${e}`,l()),s===void 0||s&&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(s===null)return i.jsx("div",{className:"space-y-6 p-6",children:i.jsx(Bn,{icon:i.jsx(jr,{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(jr,{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(fR,{contentType:o,entry:s,onSave:u,onCancel:d,onDelete:h,canDelete:n("contentEntries")})})}const SJ=is({getParentRoute:()=>us,path:"/entries/$entryId",component:wJ});function jJ(){const{contentTypeId:e}=Yo({from:"/entries/new/$contentTypeId"}),t=Qa(),n=Ye(Cn.getContentType,{id:e});if(eb(`/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(jr,{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 s=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(fR,{contentType:n,onSave:s,onCancel:o})})}const CJ=is({getParentRoute:()=>us,path:"/entries/new/$contentTypeId",component:jJ});function NJ(){const{contentTypeId:e}=Yo({from:"/entries/type/$contentTypeId"}),t=Qa(),[n,s]=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}=cm(),M=Ke(Cn.deleteEntry),[A,R]=p.useState(!1),[T,O]=p.useState(null),[D,z]=p.useState(!1),[B,q]=p.useState(null);p.useEffect(()=>{const ge=setTimeout(()=>{d(o),w(0)},300);return()=>clearTimeout(ge)},[o]);const Y=Ye(Cn.getContentType,{id:e});eb(`/entries/type/${e}`,Y?.displayName);const G=Ye(Cn.listEntries,{contentTypeName:Y?.name,status:n==="all"?void 0:n,search:u||void 0,paginationOpts:{numItems:250,cursor:null}}),ae=G?.page??[],L=Ye(Cn.getEntriesByTerm,S[0]?{termId:S[0]}:"skip"),$=Ye(Cn.getEntriesByTerm,S[1]?{termId:S[1]}:"skip"),U=Ye(Cn.getEntriesByTerm,S[2]?{termId:S[2]}:"skip"),H=p.useMemo(()=>{if(S.length===0)return null;const ge=new Set,Be=[L,$,U];for(let be=0;be<S.length&&be<3;be++){const Ue=Be[be];if(Ue?.page)for(const rt of Ue.page)ge.add(rt)}return ge},[S,L,$,U]),le=p.useCallback(ge=>{const Be=Y?.titleField??"title",be=ge.data[Be];return typeof be=="string"&&be?be:"Untitled"},[Y?.titleField]),I=p.useMemo(()=>{let ge=[...ae];return H!==null&&(ge=ge.filter(Be=>H.has(Be._id))),ge.sort((Be,be)=>{let Ue=0;switch(h){case"title":{const rt=le(Be).toLowerCase(),it=le(be).toLowerCase();Ue=rt.localeCompare(it);break}case"status":Ue=Be.status.localeCompare(be.status);break;case"updatedAt":{const rt=Be.lastPublishedAt??Be._creationTime??0,it=be.lastPublishedAt??be._creationTime??0;Ue=rt-it;break}case"createdAt":Ue=(Be._creationTime??0)-(be._creationTime??0);break;default:Ue=0}return v==="desc"?-Ue:Ue}),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(f3,{className:"size-3.5 text-muted-foreground/50"}):v==="asc"?i.jsx(zu,{className:"size-3.5"}):i.jsx(vn,{className:"size-3.5"}),te=p.useCallback(ge=>{const Be=le(ge);O({_id:ge._id,title:Be}),q(null),R(!0)},[le]),ye=p.useCallback(async()=>{if(T){z(!0),q(null);try{await M({id:T._id,hardDelete:!1}),R(!1),O(null)}catch(ge){const Be=ge instanceof Error?ge.message:"Failed to delete entry";q(Be)}finally{z(!1)}}},[T,M]),Ce=p.useCallback(ge=>{!ge&&!D&&(R(!1),O(null),q(null))},[D]),_e=p.useCallback(()=>{l(""),d(""),s("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(jr,{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(os,{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(pY,{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(pt,{type:"search",placeholder:"Search entries...",value:o,onChange:ge=>l(ge.target.value),className:"w-64 pl-9"})]}),i.jsxs(aa,{value:n,onValueChange:ge=>{s(ge),w(0)},children:[i.jsx(ia,{className:"w-36",children:i.jsx(oa,{placeholder:"All Statuses"})}),i.jsxs(la,{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(jT,{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(jr,{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(ql,{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(sa,{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 kJ=is({getParentRoute:()=>us,path:"/entries/type/$contentTypeId",component:NJ}),_J=us.addChildren([mJ,pJ,gJ,vJ,xJ,yJ,bJ,SJ,CJ,kJ]),EJ=G4({routeTree:_J,defaultPreload:"intent"}),KC=()=>({id:"mock_user_123",name:"Demo Admin",email:"admin@example.com"}),XC=()=>"admin",JC=()=>{console.log("Logout called (mock mode)")},TJ=()=>null,MJ=()=>null,RJ=()=>{};function AJ(e){switch(e){case"mock":case"demo":return{getUser:KC,getUserRole:XC,onLogout:JC};case"none":case"disabled":return{getUser:TJ,getUserRole:MJ,onLogout:RJ};default:return{getUser:KC,getUserRole:XC,onLogout:JC}}}function OJ(){const e=oY(),t=p.useMemo(()=>AJ(e.authMode),[e.authMode]),n=p.useMemo(()=>AF(e.adminConfig),[e.adminConfig]);return i.jsx(H5,{children:i.jsx(LF,{children:i.jsx(DJ,{convexUrl:e.convexUrl,adminConfig:n,children:i.jsx(q5,{getUser:t.getUser,getUserRole:t.getUserRole,onLogout:t.onLogout,children:i.jsx(jh,{children:i.jsx(K4,{router:EJ})})})})})})}function DJ({children:e,convexUrl:t,adminConfig:n}){const s=p.useMemo(()=>t?new nz(t):null,[t]);return s?i.jsx(sz,{client:s,children:i.jsx($F,{api:Cn,children:i.jsx(PF,{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"})]})]})]})]})})}OO.createRoot(document.getElementById("root")).render(i.jsx(p.StrictMode,{children:i.jsx(OJ,{})}));