@nest-my-admin/ui 0.8.0 → 0.9.0

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.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./rich-text-input-CuSUMUx9.js","./rich-text-input-CmZdYwUT.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./rich-text-input-yOiXiDm7.js","./rich-text-input-CmZdYwUT.css"])))=>i.map(i=>d[i]);
2
2
  var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function A(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var j=/\/+/g;function M(e,t){return typeof e==`object`&&e&&e.key!=null?A(``+e.key):t.toString(36)}function N(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function ee(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,ee(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+M(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(j,`$&/`)+`/`),ee(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(j,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+M(a,u),c+=ee(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+M(a,u++),c+=ee(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ee(N(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return ee(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var te=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function ne(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,te)}catch(e){te(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function re(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else ne(re.bind(null,e))}var ie={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ie,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=re,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!E.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return D(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)E.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return D(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=k,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=ne,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.0`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.0`})),m=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=f(),n=u(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}function h(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&h(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function g(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function _(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function v(e){var t=[null,null],n=g(e);return n===null||y(t,e,n.child,{foundSelf:!1}),t}function y(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&y(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var x=null,S=null;function C(e,t,n){return e===n||e===t&&(x=e,!0)}function w(e,t,n){return e===n?(S=e,!1):e===t&&(S!==null&&(x=e),!0)}function T(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function E(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var D=Object.assign,O=Symbol.for(`react.element`),k=Symbol.for(`react.transitional.element`),A=Symbol.for(`react.portal`),j=Symbol.for(`react.fragment`),M=Symbol.for(`react.strict_mode`),N=Symbol.for(`react.profiler`),ee=Symbol.for(`react.consumer`),P=Symbol.for(`react.context`),F=Symbol.for(`react.forward_ref`),te=Symbol.for(`react.suspense`),ne=Symbol.for(`react.suspense_list`),re=Symbol.for(`react.memo`),ie=Symbol.for(`react.lazy`),ae=Symbol.for(`react.activity`),oe=Symbol.for(`react.legacy_hidden`),se=Symbol.for(`react.memo_cache_sentinel`),ce=Symbol.for(`react.view_transition`),le=Symbol.for(`react.recoverable`),ue=Symbol.iterator;function de(e){return typeof e!=`object`||!e?null:(e=ue&&e[ue]||e[`@@iterator`],typeof e==`function`?e:null)}var fe=Symbol.for(`react.client.reference`);function pe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===fe?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case j:return`Fragment`;case N:return`Profiler`;case M:return`StrictMode`;case te:return`Suspense`;case ne:return`SuspenseList`;case ae:return`Activity`;case ce:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case A:return`Portal`;case P:return e.displayName||`Context`;case ee:return(e._context.displayName||`Context`)+`.Consumer`;case F:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case re:return t=e.displayName||null,t===null?pe(e.type)||`Memo`:t;case ie:t=e._payload,e=e._init;try{return pe(e(t))}catch{}}return null}var me=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},ge=[],_e=-1;function ve(e){return{current:e}}function ye(e){0>_e||(e.current=ge[_e],ge[_e]=null,_e--)}function be(e,t){_e++,ge[_e]=e.current,e.current=t}var xe=ve(null),Se=ve(null),Ce=ve(null),we=ve(null);function Te(e,t){switch(be(Ce,t),be(Se,e),be(xe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?_p(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=_p(t),e=vp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ye(xe),be(xe,e)}function Ee(){ye(xe),ye(Se),ye(Ce)}function De(e){var t=e.memoizedState;t!==null&&(mh._currentValue=t.memoizedState,be(we,e)),t=xe.current;var n=vp(t,e.type);t!==n&&(be(Se,e),be(xe,n))}function Oe(e){Se.current===e&&(ye(xe),ye(Se)),we.current===e&&(ye(we),mh._currentValue=he)}var ke,Ae;function je(e){if(ke===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ke=t&&t[1]||``,Ae=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+ke+e+Ae}var Me=!1;function Ne(e,t){if(!e||Me)return``;Me=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
@@ -47,11 +47,11 @@ Error generating stack: `+e.message+`
47
47
  `},Vu=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Hu=function(){y.useEffect(function(){return document.body.setAttribute(zu,(Vu()+1).toString()),function(){var e=Vu()-1;e<=0?document.body.removeAttribute(zu):document.body.setAttribute(zu,e.toString())}},[])},Uu=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Hu();var a=y.useMemo(function(){return Lu(i)},[i]);return y.createElement(Ru,{styles:Bu(a,!t,i,n?``:`!important`)})},Wu=!1;if(typeof window<`u`)try{var Gu=Object.defineProperty({},"passive",{get:function(){return Wu=!0,!0}});window.addEventListener(`test`,Gu,Gu),window.removeEventListener(`test`,Gu,Gu)}catch{Wu=!1}var Ku=Wu?{passive:!1}:!1,qu=function(e){return e.tagName===`TEXTAREA`},Ju=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!qu(e)&&n[t]===`visible`)},Yu=function(e){return Ju(e,`overflowY`)},Xu=function(e){return Ju(e,`overflowX`)},Zu=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),ed(e,r)){var i=td(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Qu=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},$u=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},ed=function(e,t){return e===`v`?Yu(t):Xu(t)},td=function(e,t){return e===`v`?Qu(t):$u(t)},nd=function(e,t){return e===`h`&&t===`rtl`?-1:1},rd=function(e,t,n,r,i){var a=nd(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=td(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&ed(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},id=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ad=function(e){return[e.deltaX,e.deltaY]},od=function(e){return e&&`current`in e?e.current:e},sd=function(e,t){return e[0]===t[0]&&e[1]===t[1]},cd=function(e){return`
48
48
  .block-interactivity-${e} {pointer-events: none;}
49
49
  .allow-interactivity-${e} {pointer-events: all;}
50
- `},ld=0,ud=[];function dd(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),i=y.useState(ld++)[0],a=y.useState(Nu)[0],o=y.useRef(e);y.useEffect(function(){o.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=lu([e.lockRef.current],(e.shards||[]).map(od),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=y.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=id(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Zu(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Zu(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return rd(h,t,e,h===`h`?s:c,!0)},[]),c=y.useCallback(function(e){var n=e;if(ud.length&&ud[ud.length-1]===a){var r=`deltaY`in n?ad(n):id(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&sd(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(od).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=y.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:fd(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=y.useCallback(function(e){n.current=id(e),r.current=void 0},[]),d=y.useCallback(function(t){l(t.type,ad(t),t.target,s(t,e.lockRef.current))},[]),f=y.useCallback(function(t){l(t.type,id(t),t.target,s(t,e.lockRef.current))},[]);y.useEffect(function(){return ud.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Ku),document.addEventListener(`touchmove`,c,Ku),document.addEventListener(`touchstart`,u,Ku),function(){ud=ud.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Ku),document.removeEventListener(`touchmove`,c,Ku),document.removeEventListener(`touchstart`,u,Ku)}},[]);var p=e.removeScrollBar,m=e.inert;return y.createElement(y.Fragment,null,m?y.createElement(a,{styles:cd(i)}):null,p?y.createElement(Uu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function fd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var pd=Cu(wu,dd),md=y.forwardRef(function(e,t){return y.createElement(Eu,su({},e,{ref:t,sideCar:pd}))});md.classNames=Eu.classNames;var hd=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},gd=new WeakMap,_d=new WeakMap,vd={},yd=0,bd=function(e){return e&&(e.host||bd(e.parentNode))},xd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=bd(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Sd=function(e,t,n,r){var i=xd(t,Array.isArray(e)?e:[e]);vd[n]||(vd[n]=new WeakMap);var a=vd[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(gd.get(e)||0)+1,l=(a.get(e)||0)+1;gd.set(e,c),a.set(e,l),o.push(e),c===1&&i&&_d.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),yd++,function(){o.forEach(function(e){var t=gd.get(e)-1,i=a.get(e)-1;gd.set(e,t),a.set(e,i),t||(_d.has(e)||e.removeAttribute(r),_d.delete(e)),i||e.removeAttribute(n)}),yd--,yd||(gd=new WeakMap,gd=new WeakMap,_d=new WeakMap,vd={})}},Cd=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||hd(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Sd(r,i,n,`aria-hidden`)):function(){return null}},wd=Object.defineProperty,Td=(e,t)=>wd(e,`name`,{value:t,configurable:!0}),Ed=`Dialog`,[Dd,Od]=Pc(Ed),[kd,Ad]=Dd(Ed),jd=Td(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=y.useRef(null),c=y.useRef(null),[l,u]=$c({prop:r,defaultProp:i??!1,onChange:a,caller:Ed}),[d,f]=y.useState(0),[p,m]=y.useState(0);return(0,b.jsx)(kd,{scope:t,triggerRef:s,contentRef:c,contentId:_l(),titleId:_l(),descriptionId:_l(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:y.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Md=`DialogTrigger`,Nd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,...r}=e,i=Ad(Md,n),a=lc(t,i.triggerRef);return(0,b.jsx)(kc.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Zd(i.open),...r,ref:a,onClick:zc(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),Pd=`DialogPortal`,[Fd,Id]=Dd(Pd,{forceMount:void 0}),Ld=Td(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Ad(Pd,t);return(0,b.jsx)(Fd,{scope:t,forceMount:n,children:y.Children.map(r,e=>(0,b.jsx)(sl,{present:n||a.open,children:(0,b.jsx)($l,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Rd=`DialogOverlay`,zd=y.forwardRef(Td(function(e,t){let n=Id(Rd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ad(Rd,e.__scopeDialog);return a.modal?(0,b.jsx)(sl,{present:r||a.open,children:(0,b.jsx)(Vd,{...i,ref:t})}):null},`DialogOverlay`)),Bd=fc(`DialogOverlay.RemoveScroll`),Vd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,...r}=e,i=Ad(Rd,n),a=lc(t,kl());return(0,b.jsx)(md,{as:Bd,allowPinchZoom:!0,shards:[i.contentRef],children:(0,b.jsx)(kc.div,{"data-state":Zd(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Hd=`DialogContent`,Ud=y.forwardRef(Td(function(e,t){let n=Id(Hd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ad(Hd,e.__scopeDialog);return(0,b.jsx)(sl,{present:r||a.open,children:a.modal?(0,b.jsx)(Wd,{...i,ref:t}):(0,b.jsx)(Gd,{...i,ref:t})})},`DialogContent`)),Wd=y.forwardRef(Td(function(e,t){let n=Ad(Hd,e.__scopeDialog),r=y.useRef(null),i=lc(t,n.contentRef,r);return y.useEffect(()=>{let e=r.current;if(e)return Cd(e)},[]),(0,b.jsx)(Kd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:zc(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:zc(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:zc(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Gd=y.forwardRef(Td(function(e,t){let n=Ad(Hd,e.__scopeDialog),r=y.useRef(!1),i=y.useRef(!1);return(0,b.jsx)(Kd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Kd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Ad(Hd,n);return au(),(0,b.jsx)(b.Fragment,{children:(0,b.jsx)(Bl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,b.jsx)(Ol,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Zd(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),qd=`DialogTitle`,Jd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,...r}=e,i=Ad(qd,n),{setTitleCount:a}=i;return Wc(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,b.jsx)(kc.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Yd=`DialogClose`,Xd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,...r}=e,i=Ad(Yd,n);return(0,b.jsx)(kc.button,{type:`button`,...r,ref:t,onClick:zc(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Zd(e){return e?`open`:`closed`}Td(Zd,`getState`);var Qd=Object.defineProperty,$d=(e,t)=>Qd(e,`name`,{value:t,configurable:!0});function ef(e){let[t,n]=y.useState(void 0);return Wc(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}$d(ef,`useSize`);var tf=Object.defineProperty,nf=(e,t)=>tf(e,`name`,{value:t,configurable:!0}),rf=`Checkbox`,[af,of]=Pc(rf),[sf,cf]=af(rf);function lf(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=$c({prop:n,defaultProp:i??!1,onChange:c,caller:rf}),[m,h]=y.useState(null),[g,_]=y.useState(null),v=y.useRef(!1),[x,S]=y.useReducer(e=>e+1,0),C=!m||!!o||!!m.closest(`form`),w={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:x,onUserInteraction:S,required:l,defaultChecked:!vf(i)&&i,isFormControl:C,bubbleInput:g,setBubbleInput:_};return(0,b.jsx)(sf,{scope:t,...w,children:_f(d)?d(w):r})}nf(lf,`CheckboxProvider`);var uf=`CheckboxTrigger`,df=y.forwardRef(nf(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=cf(uf,e),g=lc(i,u),_=y.useRef(c);return y.useEffect(()=>{let e=a?.form;if(e){let t=nf(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,b.jsx)(kc.button,{type:`button`,role:`checkbox`,"aria-checked":vf(c)?`mixed`:c,"aria-required":l,"data-state":yf(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:zc(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:zc(n,e=>{p(),d(e=>vf(e)?!0:!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),ff=y.forwardRef(nf(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,b.jsx)(lf,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(df,{...d,ref:t,__scopeCheckbox:n}),e&&(0,b.jsx)(gf,{__scopeCheckbox:n})]})})},`Checkbox`)),pf=`CheckboxIndicator`,mf=y.forwardRef(nf(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=cf(pf,n);return(0,b.jsx)(sl,{present:r||vf(a.checked)||a.checked===!0,children:(0,b.jsx)(kc.span,{"data-state":yf(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),hf=`CheckboxBubbleInput`,gf=y.forwardRef(nf(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=cf(hf,e),g=lc(r,h),_=ef(i),v=y.useRef(!1),x=y.useRef(s),S=y.useRef(o);y.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==S.current;S.current=o;let i=x.current!==s;x.current=s;let c=!(r&&a.current);if(i&&n){v.current=!r;let t=new Event(`click`,{bubbles:c});e.indeterminate=vf(s),n.call(e,!vf(s)&&s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let C=y.useRef(!vf(s)&&s);return(0,b.jsx)(kc.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??C.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:zc(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function _f(e){return typeof e==`function`}nf(_f,`isFunction`);function vf(e){return e===`indeterminate`}nf(vf,`isIndeterminate`);function yf(e){return vf(e)?`indeterminate`:e?`checked`:`unchecked`}nf(yf,`getState`);var bf=[`top`,`right`,`bottom`,`left`],xf=Math.min,Sf=Math.max,Cf=Math.round,wf=Math.floor,Tf=e=>({x:e,y:e}),Ef={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Df(e,t,n){return Sf(e,xf(t,n))}function Of(e,t){return typeof e==`function`?e(t):e}function kf(e){return e.split(`-`)[0]}function Af(e){return e.split(`-`)[1]}function jf(e){return e===`x`?`y`:`x`}function Mf(e){return e===`y`?`height`:`width`}function Nf(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Pf(e){return jf(Nf(e))}function Ff(e,t,n){n===void 0&&(n=!1);let r=Af(e),i=Pf(e),a=Mf(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Wf(o)),[o,Wf(o)]}function If(e){let t=Wf(e);return[Lf(e),t,Lf(t)]}function Lf(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Rf=[`left`,`right`],zf=[`right`,`left`],Bf=[`top`,`bottom`],Vf=[`bottom`,`top`];function Hf(e,t,n){switch(e){case`top`:case`bottom`:return n?t?zf:Rf:t?Rf:zf;case`left`:case`right`:return t?Bf:Vf;default:return[]}}function Uf(e,t,n,r){let i=Af(e),a=Hf(kf(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Lf)))),a}function Wf(e){let t=kf(e);return Ef[t]+e.slice(t.length)}function Gf(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Kf(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Gf(e)}function qf(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function K(e,t,n){let{reference:r,floating:i}=e,a=Nf(t),o=Pf(t),s=Mf(o),c=kf(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Af(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Jf(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Of(t,e),p=Kf(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=qf(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=qf(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Yf=50,Xf=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Jf},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=K(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Yf&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=K(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Zf=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Of(e,t)||{};if(l==null)return{};let d=Kf(u),f={x:n,y:r},p=Pf(i),m=Mf(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=xf(d[_],T),D=xf(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=Df(E,k,O),j=!c.arrow&&Af(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Qf=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Of(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=kf(r),_=Nf(o),v=kf(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Wf(o)]:If(o)),x=p!==`none`;!d&&x&&b.push(...Uf(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ff(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Nf(t)||T.every(e=>Nf(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Nf(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function $f(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ep(e){return bf.some(t=>e[t]>=0)}var tp=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Of(e,t);switch(i){case`referenceHidden`:{let e=$f(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ep(e)}}}case`escaped`:{let e=$f(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ep(e)}}}default:return{}}}}},np=new Set([`left`,`top`]);async function rp(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=kf(n),s=Af(n),c=Nf(n)===`y`,l=np.has(o)?-1:1,u=a&&c?-1:1,d=Of(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ip=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await rp(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ap=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Of(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Nf(i),p=jf(f),m=u[p],h=u[f],g=(e,t)=>Df(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},op=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Of(e,t),u={x:n,y:r},d=Nf(i),f=jf(d),p=u[f],m=u[d],h=Of(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=np.has(kf(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},sp=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Of(e,t),c=await i.detectOverflow(t,s),l=kf(n),u=Af(n),d=Nf(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=xf(p-c[m],g),y=xf(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Sf(c.left,c.right):S=p-2*Sf(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function cp(){return typeof window<`u`}function lp(e){return fp(e)?(e.nodeName||``).toLowerCase():`#document`}function up(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dp(e){return((fp(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function fp(e){return cp()?e instanceof Node||e instanceof up(e).Node:!1}function pp(e){return cp()?e instanceof Element||e instanceof up(e).Element:!1}function mp(e){return cp()?e instanceof HTMLElement||e instanceof up(e).HTMLElement:!1}function hp(e){return!cp()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof up(e).ShadowRoot}function gp(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Dp(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function _p(e){return/^(table|td|th)$/.test(lp(e))}function vp(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var yp=/transform|translate|scale|rotate|perspective|filter/,bp=/paint|layout|strict|content/,xp=e=>!!e&&e!==`none`,Sp;function Cp(e){let t=pp(e)?Dp(e):e;return xp(t.transform)||xp(t.translate)||xp(t.scale)||xp(t.rotate)||xp(t.perspective)||!Tp()&&(xp(t.backdropFilter)||xp(t.filter))||yp.test(t.willChange||``)||bp.test(t.contain||``)}function wp(e){let t=kp(e);for(;mp(t)&&!Ep(t);){if(Cp(t))return t;if(vp(t))return null;t=kp(t)}return null}function Tp(){return Sp??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Sp}function Ep(e){return/^(html|body|#document)$/.test(lp(e))}function Dp(e){return up(e).getComputedStyle(e)}function Op(e){return pp(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function kp(e){if(lp(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||hp(e)&&e.host||dp(e);return hp(t)?t.host:t}function Ap(e){let t=kp(e);return Ep(t)?(e.ownerDocument||e).body:mp(t)&&gp(t)?t:Ap(t)}function jp(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ap(e),i=r===e.ownerDocument?.body,a=up(r);if(i){let e=Mp(a);return t.concat(a,a.visualViewport||[],gp(r)?r:[],e&&n?jp(e):[])}return t.concat(r,jp(r,[],n))}function Mp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Np(e){let t=Dp(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=mp(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Cf(n)!==a||Cf(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Pp(e){return pp(e)?e:e.contextElement}function Fp(e){let t=Pp(e);if(!mp(t))return Tf(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Np(t),o=(a?Cf(n.width):n.width)/r,s=(a?Cf(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ip=Tf(0);function Lp(e){let t=up(e);return!Tp()||!t.visualViewport?Ip:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Rp(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===up(e)}function zp(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Pp(e),o=Tf(1);t&&(r?pp(r)&&(o=Fp(r)):o=Fp(e));let s=Rp(a,n,r)?Lp(a):Tf(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=up(a),t=pp(r)?up(r):r,n=e,i=Mp(n);for(;i&&t!==n;){let e=Fp(i),t=i.getBoundingClientRect(),r=Dp(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=up(i),i=Mp(n)}}return qf({width:u,height:d,x:c,y:l})}function Bp(e,t){let n=Op(e).scrollLeft;return t?t.left+n:zp(dp(e)).left+n}function Vp(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Bp(e,n),y:n.top+t.scrollTop}}function Hp(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=dp(r),s=t?vp(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Tf(1),u=Tf(0),d=mp(r);if((d||!a)&&((lp(r)!==`body`||gp(o))&&(c=Op(r)),d)){let e=zp(r);l=Fp(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Vp(o,c):Tf(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Up(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Wp(e){let t=Op(e),n=e.ownerDocument.body,r=Sf(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Sf(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Bp(e),o=-t.scrollTop;return Dp(n).direction===`rtl`&&(a+=Sf(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Gp=25;function Kp(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=up(e),a=dp(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Tp()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Bp(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Gp&&(s-=o)}return{width:s,height:c,x:l,y:u}}function qp(e,t){let n=zp(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Fp(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Jp(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Kp(e,n,t);else if(t===`document`)r=Wp(dp(e));else if(pp(t))r=qp(t,n);else{let n=Lp(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return qf(r)}function Yp(e,t){let n=t.get(e);if(n)return n;let r=jp(e,[],!1).filter(e=>pp(e)&&lp(e)!==`body`),i=null,a=Dp(e).position===`fixed`,o=a?kp(e):e;for(;pp(o)&&!Ep(o);){let e=Dp(o),t=Cp(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=kp(o)}return t.set(e,r),r}function Xp(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?vp(t)?[]:Yp(t,this._c):[].concat(n),r],o=Jp(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Jp(t,a[e],i);s=Sf(n.top,s),c=xf(n.right,c),l=xf(n.bottom,l),u=Sf(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Zp(e){let{width:t,height:n}=Np(e);return{width:t,height:n}}function Qp(e,t,n){let r=mp(t),i=dp(t),a=n===`fixed`,o=zp(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Tf(0);if((r||!a)&&((lp(t)!==`body`||gp(i))&&(s=Op(t)),r)){let e=zp(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Bp(i));let l=i&&!r&&!a?Vp(i,s):Tf(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function $p(e){return Dp(e).position===`static`}function em(e,t){if(!mp(e)||Dp(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return dp(e)===n&&(n=n.ownerDocument.body),n}function tm(e,t){let n=up(e);if(vp(e))return n;if(!mp(e)){let t=kp(e);for(;t&&!Ep(t);){if(pp(t)&&!$p(t))return t;t=kp(t)}return n}let r=em(e,t);for(;r&&_p(r)&&$p(r);)r=em(r,t);return r&&Ep(r)&&$p(r)&&!Cp(r)?n:r||wp(e)||n}var nm=async function(e){let t=this.getOffsetParent||tm,n=this.getDimensions,r=await n(e.floating);return{reference:Qp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function rm(e){return Dp(e).direction===`rtl`}var im={convertOffsetParentRelativeRectToViewportRelativeRect:Hp,getDocumentElement:dp,getClippingRect:Xp,getOffsetParent:tm,getElementRects:nm,getClientRects:Up,getDimensions:Zp,getScale:Fp,isElement:pp,isRTL:rm};function am(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function om(e,t,n){let r=null,i,a=dp(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=wf(d),h=wf(a.clientWidth-(u+f)),g=wf(a.clientHeight-(d+p)),_=wf(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Sf(0,xf(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!am(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=up(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function sm(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Pp(e),u=i||a?[...l?jp(l):[],...t?jp(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?om(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?zp(e):null;c&&g();function g(){let t=zp(e);h&&!am(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var cm=ip,lm=ap,um=Qf,dm=sp,fm=tp,pm=Zf,mm=op,hm=(e,t,n)=>{let r=new Map,i=n??{},a={...im,...i.platform,_c:r};return Xf(e,t,{...i,platform:a})},gm=typeof document<`u`?y.useLayoutEffect:function(){};function _m(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!_m(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!_m(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function vm(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ym(e,t){let n=vm(e);return Math.round(t*n)/n}function bm(e){let t=y.useRef(e);return gm(()=>{t.current=e}),t}function xm(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=y.useState(r);_m(f,r)||p(r);let[m,h]=y.useState(null),[g,_]=y.useState(null),v=y.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=y.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=y.useRef(null),w=y.useRef(null),T=y.useRef(u),E=c!=null,D=bm(c),O=bm(i),k=bm(l),A=y.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),hm(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!_m(T.current,t)&&(T.current=t,Ec.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);gm(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=y.useRef(!1);gm(()=>(j.current=!0,()=>{j.current=!1}),[]),gm(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=y.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:b}),[v,b]),N=y.useMemo(()=>({reference:x,floating:S}),[x,S]),ee=y.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=ym(N.floating,u.x),r=ym(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...vm(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:ee}),[u,A,M,N,ee])}var Sm=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:pm({element:r.current,padding:i}).fn(n):r?pm({element:r,padding:i}).fn(n):{}}}},Cm=(e,t)=>{let n=cm(e);return{name:n.name,fn:n.fn,options:[e,t]}},wm=(e,t)=>{let n=lm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tm=(e,t)=>({fn:mm(e).fn,options:[e,t]}),Em=(e,t)=>{let n=um(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dm=(e,t)=>{let n=dm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Om=(e,t)=>{let n=fm(e);return{name:n.name,fn:n.fn,options:[e,t]}},km=(e,t)=>{let n=Sm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Am=Object.defineProperty,jm=(e,t)=>Am(e,`name`,{value:t,configurable:!0}),Mm=`Popper`,[Nm,Pm]=Pc(Mm),[Fm,Im]=Nm(Mm),Lm=jm(e=>{let{__scopePopper:t,children:n}=e,[r,i]=y.useState(null),[a,o]=y.useState(void 0);return(0,b.jsx)(Fm,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Rm=`PopperAnchor`,zm=y.forwardRef(jm(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Im(Rm,n),o=y.useRef(null),s=a.onAnchorChange,c=lc(t,y.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=y.useRef(null);y.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&Km(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,b.jsx)(kc.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),Bm=`PopperContent`,[Vm,Hm]=Nm(Bm),Um=y.forwardRef(jm(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Im(Bm,n),[_,v]=y.useState(null),x=lc(t,v),[S,C]=y.useState(null),w=ef(S),T=w?.width??0,E=w?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],A=k.length>0,j={padding:O,boundary:k.filter(Wm),altBoundary:A},{refs:M,floatingStyles:N,placement:ee,isPositioned:P,middlewareData:F}=xm({strategy:`fixed`,placement:D,whileElementsMounted:jm((...e)=>sm(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[Cm({mainAxis:i+E,alignmentAxis:o}),c&&wm({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Tm():void 0,...j}),c&&Em({...j}),Dm({...j,apply:jm(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),S&&km({element:S,padding:s}),Gm({arrowWidth:T,arrowHeight:E}),f&&Om({strategy:`referenceHidden`,...j,boundary:A?j.boundary:void 0})]}),te=g.setPlacementState;Wc(()=>(te(ee),()=>{te(void 0)}),[ee,te]);let[ne,re]=Km(ee),ie=bl(m);Wc(()=>{P&&ie?.()},[P,ie]);let ae=F.arrow?.x,oe=F.arrow?.y,se=F.arrow?.centerOffset!==0,[ce,le]=y.useState();return Wc(()=>{_&&le(window.getComputedStyle(_).zIndex)},[_]),(0,b.jsx)(`div`,{ref:M.setFloating,"data-radix-popper-content-wrapper":``,style:{...N,transform:P?N.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ce,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,b.jsx)(Vm,{scope:n,placedSide:ne,placedAlign:re,onArrowChange:C,arrowX:ae,arrowY:oe,shouldHideArrow:se,children:(0,b.jsx)(kc.div,{"data-side":ne,"data-align":re,...h,ref:x,style:{...h.style,animation:P?h.style?.animation:`none`}})})})},`PopperContent`));function Wm(e){return e!==null}jm(Wm,`isNotNull`);var Gm=jm(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Km(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Km(e){let[t,n=`center`]=e.split(`-`);return[t,n]}jm(Km,`getSideAndAlignFromPlacement`);var qm=Lm,Jm=zm,Ym=Um,Xm=Object.defineProperty,Zm=y.forwardRef(((e,t)=>Xm(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,b.jsx)(kc.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),Qm=Object.defineProperty,$m=(e,t)=>Qm(e,`name`,{value:t,configurable:!0}),eh=`Popover`,[th,nh]=Pc(eh,[Pm]),rh=Pm(),[ih,ah]=th(eh),oh=$m(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=rh(t),c=y.useRef(null),[l,u]=y.useState(!1),[d,f]=$c({prop:r,defaultProp:i??!1,onChange:a,caller:eh});return(0,b.jsx)(qm,{...s,children:(0,b.jsx)(ih,{scope:t,contentId:_l(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:y.useCallback(()=>u(!0),[]),onCustomAnchorRemove:y.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),sh=`PopoverTrigger`,ch=y.forwardRef($m(function(e,t){let{__scopePopover:n,...r}=e,i=ah(sh,n),a=rh(n),o=lc(t,i.triggerRef),s=(0,b.jsx)(kc.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":xh(i.open),...r,ref:o,onClick:zc(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,b.jsx)(Jm,{asChild:!0,...a,children:s})},`PopoverTrigger`)),lh=`PopoverPortal`,[uh,dh]=th(lh,{forceMount:void 0}),fh=$m(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=ah(lh,t);return(0,b.jsx)(uh,{scope:t,forceMount:n,children:(0,b.jsx)(sl,{present:n||a.open,children:(0,b.jsx)($l,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),ph=`PopoverContent`,mh=y.forwardRef($m(function(e,t){let n=dh(ph,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=ah(ph,e.__scopePopover);return(0,b.jsx)(sl,{present:r||a.open,children:a.modal?(0,b.jsx)(gh,{...i,ref:t}):(0,b.jsx)(_h,{...i,ref:t})})},`PopoverContent`)),hh=fc(`PopoverContent.RemoveScroll`),gh=y.forwardRef($m(function(e,t){let n=ah(ph,e.__scopePopover),r=y.useRef(null),i=lc(t,r),a=y.useRef(!1);return y.useEffect(()=>{let e=r.current;if(e)return Cd(e)},[]),(0,b.jsx)(md,{as:hh,allowPinchZoom:!0,children:(0,b.jsx)(vh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:zc(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:zc(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:zc(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),_h=y.forwardRef($m(function(e,t){let n=ah(ph,e.__scopePopover),r=y.useRef(!1),i=y.useRef(!1);return(0,b.jsx)(vh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),vh=y.forwardRef($m(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=ah(ph,n),p=rh(n);return au(),(0,b.jsx)(Bl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,b.jsx)(Ol,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,b.jsx)(Ym,{"data-state":xh(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`)),yh=`PopoverClose`,bh=y.forwardRef($m(function(e,t){let{__scopePopover:n,...r}=e,i=ah(yh,n);return(0,b.jsx)(kc.button,{type:`button`,...r,ref:t,onClick:zc(e.onClick,()=>i.onOpenChange(!1))})},`PopoverClose`));function xh(e){return e?`open`:`closed`}$m(xh,`getState`);var Sh=oh,Ch=ch,wh=fh,Th=mh,Eh=bh,Dh=ic(`group/button inline-flex shrink-0 items-center justify-center rounded-control border border-transparent bg-clip-padding text-[13px] font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 cursor-pointer`,{variants:{variant:{default:`border-primary bg-primary text-primary-foreground hover:opacity-92`,outline:`border-input bg-card hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`border-input bg-card text-bad hover:bg-muted focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 gap-1.5 px-3.5 has-data-[icon=inline-end]:pe-3 has-data-[icon=inline-start]:ps-3`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1.5 px-2.5 text-[12.5px] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2`,icon:`size-9`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8 in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function q({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?pc:`button`;return(0,b.jsx)(a,{"data-slot":`button`,"data-variant":t,"data-size":n,className:W(Dh({variant:t,size:n,className:e})),...i})}function Oh({className:e,type:t,...n}){return(0,b.jsx)(`input`,{type:t,"data-slot":`input`,className:W(`h-9 w-full min-w-0 rounded-control border border-input bg-card px-3 py-1 text-[13px] transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function kh({className:e,...t}){return(0,b.jsx)(Zm,{"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})}var Ah=`۰۱۲۳۴۵۶۷۸۹`,jh=`٠١٢٣٤٥٦٧٨٩`;function Mh(e){return e.replace(/[۰-۹٠-٩]/g,e=>String(Math.max(Ah.indexOf(e),jh.indexOf(e))))}function Nh(e){return Mh(e).replace(/٫/g,`.`).replace(/٬/g,`,`)}function Ph(e){return e.replace(/[0-9]/g,e=>Ah[Number(e)])}function Fh(e){return Ph(e).replace(/\./g,`٫`).replace(/,/g,`٬`)}var Ih=`nma.calendar`,Lh=`nma.digits`;function Rh(e){try{return localStorage.getItem(e)}catch{return null}}function zh(e){let t=Rh(Ih),n=Rh(Lh);return{calendar:t===`gregorian`||t===`persian`?t:e.split(`-`)[0]===`fa`?`persian`:`gregorian`,digits:n===`latn`||n===`arabext`?n:e.split(`-`)[0]===`fa`?`arabext`:`latn`}}function Bh(e){try{e.calendar&&localStorage.setItem(Ih,e.calendar),e.digits&&localStorage.setItem(Lh,e.digits)}catch{}}var Vh={"common.loading":`Loading…`,"common.yes":`Yes`,"common.no":`No`,"common.empty":`—`,"common.all":`All`,"common.cancel":`Cancel`,"common.pageNotFound":`Page not found.`,"common.requestFailed":`Request failed ({status})`,"common.reference":`{message} (reference: {id})`,"shell.adminPanel":`Admin panel`,"palette.move":`Move`,"palette.openItem":`Open`,"palette.close":`Close`,"shell.menu":`Menu`,"shell.closeMenu":`Close menu`,"shell.resources":`Resources`,"shell.filterResources":`Filter resources`,"shell.pinned":`Pinned`,"shell.recent":`Recent`,"shell.pin":`Pin {name}`,"shell.unpin":`Unpin {name}`,"shell.collapseGroup":`Collapse {name}`,"shell.expandGroup":`Expand {name}`,"shell.collapseSidebar":`Collapse sidebar`,"shell.expandSidebar":`Expand sidebar`,"shell.breadcrumbs":`Breadcrumbs`,"shell.home":`Home`,"shell.dashboard":`Dashboard`,"shell.noMatches":`No resources match.`,"shell.theme":`Theme`,"shell.themeLight":`Light`,"shell.themeDark":`Dark`,"shell.themeSystem":`System`,"shell.language":`Language`,"shell.noResources":`No admin resources are registered yet. Decorate a provider with @AdminResource.`,"shell.records":`{count} records`,"shell.aboutRecords":`about {count} records`,"list.select":`Select`,"list.done":`Done`,"list.loadMore":`Load more`,"list.showing":`{shown} shown`,"list.showingOf":`{shown} of {total}`,"list.new":`New`,"list.trash":`Trash`,"list.trashNote":`Records in the trash. Restore one to edit it again.`,"list.restore":`Restore`,"list.restoreRecord":`Restore {name}`,"list.actions":`Actions`,"list.noMatches":`No records match.`,"list.noRecords":`No records yet.`,"list.total":`{count} total`,"list.about":`about {count}`,"list.page":`Page {page}`,"list.pageOf":`Page {page} of {pages}`,"list.range":`Showing {from} to {to} of {total}`,"list.rowsPerPage":`Rows per page`,"list.toggleRow":`{column}: {name}`,"list.previousPage":`Previous page`,"list.nextPage":`Next page`,"list.columns":`Columns`,"list.density":`Density`,"list.comfortable":`Comfortable`,"list.compact":`Compact`,"list.moveUp":`Move {name} up`,"list.moveDown":`Move {name} down`,"list.resetColumns":`Reset columns`,"list.resize":`Resize {name}`,"list.retry":`Try again`,"list.loadFailed":`The list could not be loaded.`,"list.selectPage":`Select all on this page`,"list.selectRow":`Select {name}`,"print.open":`Print {name}`,"list.export":`Export to Excel`,"list.exporting":`Exporting…`,"list.exportTruncated":`Only the first {count} rows were exported.`,"list.exportDone":`{file} downloaded.`,"list.selected":`{count} selected`,"list.deleteSelected":`Delete selected`,"list.confirmDeleteSelected":`Delete {count}`,"list.clearSelection":`Clear selection`,"list.bulkDeleted":`{count} deleted`,"list.bulkFailed":`{count} failed`,"list.quickView":`Quick view: {name}`,"list.edit":`Edit`,"list.close":`Close`,"list.editCell":`Edit {name}: {value}`,"action.running":`Running…`,"action.confirm":`Run “{action}”?`,"action.confirmRecord":`Run “{action}” on {name}?`,"action.confirmSelected":`Run “{action}” on {count} records?`,"action.eachNote":`Each of the {count} records is handled on its own: one that fails does not stop the others.`,"action.atomicNote":`All or nothing: if one of the {count} records fails, none is changed.`,"action.done":`“{action}” done.`,"action.doneGone":`“{action}” done. The record is no longer in your view.`,"action.bulkDone":`{action}: {count} done`,"action.saveFirst":`Save or discard your changes first.`,"action.more":`More actions`,"toast.region":`Notifications`,"toast.dismiss":`Dismiss`,"settings.viewOnly":`You can view these settings but not change them.`,"settings.discard":`Discard changes`,"secret.set":`Set`,"secret.notSet":`Not set`,"secret.replace":`Replace`,"secret.replaceName":`Replace {name}`,"secret.clear":`Clear`,"secret.clearName":`Clear {name}`,"secret.keep":`Keep the current value`,"secret.willClear":`Will be cleared when you save.`,"secret.undo":`Undo`,"filters.search":`Search`,"filters.searchIn":`Search {fields}`,"filters.filtersAndSort":`Filters and sort`,"filters.showResults":`Show results`,"filters.sortBy":`Sort by`,"filters.ascending":`{name}, ascending`,"filters.descending":`{name}, descending`,"filters.filters":`Filters`,"filters.clear":`Clear filters`,"filters.from":`From`,"filters.to":`To`,"filters.contains":`{field} contains`,"filters.empty":`empty`,"filters.notEmpty":`not empty`,"filters.not":`not `,"filters.removeChip":`Remove filter {label}`,"filters.active":`Active filters`,"filters.any":`Any`,"filters.onlyEmpty":`Empty`,"filters.hideEmpty":`Not empty`,"filters.emptyValues":`{field}: empty values`,"filters.selected":`{count} selected`,"date.placeholder":`yyyy/mm/dd`,"date.openCalendar":`Choose {name} from a calendar`,"date.calendar":`{name} calendar`,"date.previous":`Previous`,"date.next":`Next`,"date.chooseMonth":`Choose a month`,"date.chooseYear":`Choose a year`,"date.today":`Today`,"date.clear":`Clear`,"date.time":`{name} time`,"auth.title":`Sign in`,"auth.username":`Username`,"auth.password":`Password`,"auth.signIn":`Sign in`,"auth.signingIn":`Signing in…`,"auth.required":`Enter your username and password.`,"auth.failed":`Signing in failed. Try again.`,"auth.userMenu":`Account menu for {name}`,"auth.account":`Account`,"auth.signOut":`Sign out`,"auth.changePassword":`Change password`,"auth.currentPassword":`Current password`,"auth.newPassword":`New password`,"auth.confirmPassword":`New password again`,"auth.mismatch":`does not match the new password`,"auth.passwordChanged":`Password changed. Your other sessions were signed out.`,"auth.sessions":`Signed-in devices`,"auth.signOutOthers":`Sign out everywhere else`,"auth.thisDevice":`This device`,"auth.unknownDevice":`Unknown device`,"auth.lastSeen":`Last active {when}`,"auth.revoke":`Sign out`,"auth.revokeSession":`Sign out {name}`,"rbac.administration":`Administration`,"rbac.users":`Users`,"rbac.groups":`Groups`,"rbac.roles":`Roles`,"rbac.user":`User`,"rbac.group":`Group`,"rbac.role":`Role`,"rbac.newUser":`New user`,"rbac.newGroup":`New group`,"rbac.newRole":`New role`,"rbac.createUser":`Create user`,"rbac.export":`Export`,"rbac.import":`Import`,"rbac.importFile":`Roles file to import`,"rbac.imported":`{count} roles imported.`,"rbac.notJson":`That file is not JSON.`,"rbac.permissionCount":`{count} permissions`,"rbac.system":`System`,"rbac.systemNote":`This role is defined in code: change it there.`,"rbac.name":`Name`,"rbac.labelIn":`Label ({language})`,"rbac.matrix":`Permissions`,"rbac.resource":`Resource`,"rbac.op.view":`View`,"rbac.op.create":`Create`,"rbac.op.update":`Change`,"rbac.op.delete":`Delete`,"rbac.op.purge":`Purge`,"rbac.grant":`{operation} {resource}`,"rbac.details":`Fields and scopes of {resource}`,"rbac.fields":`Fields`,"rbac.restricted":`restricted`,"rbac.fieldRule":`Access to {field}`,"rbac.rule.default":`As the permissions allow`,"rbac.rule.defaultHidden":`Hidden (restricted)`,"rbac.rule.hidden":`Hidden`,"rbac.rule.readonly":`Read-only`,"rbac.rule.edit":`Editable`,"rbac.scopes":`Rows`,"rbac.allRows":`all rows`,"rbac.custom":`Other permissions`,"rbac.global":`General permissions`,"rbac.actions":`Actions`,"rbac.actionNote":`Actions on records also need Change.`,"rbac.pages":`Settings pages`,"rbac.page":`Page`,"rbac.viewImplied":`Whoever may change a page may view it.`,"rbac.noGroups":`No groups yet.`,"rbac.groupSummary":`{roles} roles · {members} members`,"rbac.members":`Members`,"rbac.noMembers":`No members yet.`,"rbac.addMember":`Add a member`,"rbac.searchUsers":`Search users`,"rbac.searchResults":`Matching users`,"rbac.usersFromMemberships":`Your sign-in adapter cannot list users: these are the users that have roles or groups here.`,"rbac.superuser":`Superuser`,"rbac.superuserNote":`Only superusers can change a superuser.`,"rbac.inactive":`Inactive`,"rbac.active":`Active`,"rbac.displayName":`Display name`,"rbac.email":`Email`,"rbac.saved":`Saved.`,"rbac.setPassword":`Set password`,"rbac.setPasswordNote":`The user is signed out everywhere.`,"rbac.passwordSet":`Password set; the user was signed out everywhere.`,"auth.otpTitle":`Two-step verification`,"auth.otp":`Code`,"auth.otpHelp":`Enter the 6-digit code from your authenticator app, or one of your recovery codes.`,"auth.verify":`Verify`,"auth.otpRequired":`Enter the code.`,"auth.startOver":`Use another account`,"twoFactor.title":`Two-factor sign-in`,"twoFactor.on":`On`,"twoFactor.off":`Off`,"twoFactor.intro":`Ask for a code from an authenticator app after the password.`,"twoFactor.setUp":`Set up`,"twoFactor.scan":`Scan the code with your authenticator app, or type the key into it. Then enter the code the app shows.`,"twoFactor.qr":`QR code for your authenticator app`,"twoFactor.key":`Key`,"twoFactor.code":`Code from the app`,"twoFactor.turnOn":`Turn on`,"twoFactor.recoveryTitle":`Recovery codes`,"twoFactor.recoveryIntro":`Keep these somewhere safe. Each one signs you in once if you lose your device. They are not shown again.`,"twoFactor.copy":`Copy codes`,"twoFactor.copied":`Copied`,"twoFactor.done":`I saved them`,"twoFactor.left":`{count} unused recovery codes.`,"twoFactor.newCodes":`New recovery codes`,"twoFactor.turnOff":`Turn off`,"twoFactor.password":`Your password`,"twoFactor.enabledNote":`Two-factor sign-in is on. Your other sessions were signed out.`,"twoFactor.disabledNote":`Two-factor sign-in is off.`,"viewAs.start":`View as this user`,"viewAs.banner":`Viewing as {name}. Read-only.`,"viewAs.stop":`Stop viewing`,"rbac.twoFactor":`2FA`,"rbac.resetTwoFactor":`Reset two-factor sign-in`,"rbac.resetTwoFactorNote":`Turns off their second factor (a lost phone) and signs them out everywhere.`,"rbac.twoFactorReset":`Two-factor sign-in is off for this user.`,"debugger.title":`Permission debugger`,"debugger.intro":`Why a user can or cannot see and change things.`,"debugger.user":`User`,"debugger.resource":`Resource`,"debugger.record":`Record id (optional)`,"debugger.explain":`Explain`,"debugger.pick":`Choose a user and a resource.`,"debugger.roles":`Roles`,"debugger.noRoles":`No roles: nothing is allowed.`,"debugger.superuser":`A superuser may do everything.`,"debugger.source.direct":`assigned directly`,"debugger.source.group":`through group {group}`,"debugger.source.resolveRoles":`from resolveRoles`,"debugger.source.adapter":`from the sign-in adapter`,"debugger.unknownRole":`not a role, grants nothing`,"debugger.operations":`Operations`,"debugger.allowed":`Allowed`,"debugger.denied":`Denied`,"debugger.noGrant":`No role grants it`,"debugger.viaUpdate":`{pattern} in {role} (changing implies viewing)`,"debugger.grant":`{pattern} in {role}`,"debugger.fields":`Fields`,"debugger.field":`Field`,"debugger.result":`Result`,"debugger.byRole":`Per role`,"debugger.forced":`Always shown: keys and the version`,"debugger.scopes":`Rows`,"debugger.allRows":`All rows`,"debugger.noRows":`No rows`,"debugger.someRows":`Rows of {scopes}`,"debugger.globalScopes":`Also limited by {scopes}`,"debugger.recordTitle":`Record {id}`,"debugger.reason.permission":`no permission`,"debugger.reason.scope":`outside their rows`,"debugger.reason.rule":`a rule on this record says no`,"debugger.reason.missing":`no such record`,"debugger.actions":`Actions`,"debugger.needsUpdate":`actions on records also need Change`,"debugger.noRecordActions":`none on this record`,"debugger.pages":`Settings pages`,"audit.title":`Audit log`,"audit.history":`History`,"audit.details":`Details`,"audit.recordTabs":`Record and its history`,"audit.entries":`Recorded changes`,"audit.notAllowed":`You may not read the audit log`,"audit.off":`The audit log is not enabled in this admin`,"audit.empty":`Nothing has been recorded yet.`,"audit.noMatches":`No entries match.`,"audit.noActor":`Nobody signed in`,"audit.viewAsBy":`while user {id} was viewing as them`,"audit.filterByActor":`Show only what {name} did`,"audit.changedFields":`Changed fields`,"audit.before":`Before`,"audit.after":`After`,"audit.becomes":`became`,"audit.field.changed":`changed`,"audit.field.hidden":`hidden`,"audit.field.dropped":`too large to keep`,"audit.field.truncated":`cut short`,"audit.showMore":`Show more`,"audit.showLess":`Show less`,"audit.input":`Input`,"audit.inputTruncated":`The input was too large to keep.`,"audit.restrictedRecord":`A record you cannot see: its details are withheld.`,"audit.restrictedChanges":`You may not see what was changed.`,"audit.suppressedNote":`They came in the same minute and were not recorded one by one.`,"audit.limitedNote":`Further failures in this minute are only counted.`,"audit.actionDeleted":`The action deleted the record.`,"audit.filter.actor":`Actor (user id)`,"audit.filter.event":`Event`,"audit.filter.eventHint":`order.updated or auth.*`,"audit.filter.resource":`Resource`,"audit.filter.record":`Record id`,"audit.filter.recordHint":`Choose a resource first`,"audit.event.unseen":`A change you cannot see`,"audit.event.created":`Created`,"audit.event.updated":`Changed`,"audit.event.deleted":`Deleted`,"audit.event.trashed":`Moved to trash`,"audit.event.restored":`Restored`,"audit.event.purged":`Deleted for good`,"audit.event.action":`Ran “{action}”`,"audit.event.page":`Changed {page}`,"audit.event.login":`Signed in`,"audit.event.logout":`Signed out`,"audit.event.loginFailed":`Failed sign-in`,"audit.event.loginFailedCode":`Failed sign-in: wrong two-factor code`,"audit.event.loginFailedLimited":`Failed sign-in: too many attempts`,"audit.event.loginFailedMore":`{count} more failed sign-ins`,"audit.event.viewAs":`Viewed the admin as a user`,"audit.event.roleChanged":`Role changed`,"audit.event.groupChanged":`Group changed`,"audit.event.userRolesChanged":`Roles and groups of a user changed`,"audit.event.userCreated":`User created`,"audit.event.userChanged":`User changed`,"audit.event.passwordChanged":`Password changed`,"audit.event.passwordReset":`Password set by an administrator`,"audit.event.twoFactorEnabled":`Two-factor sign-in turned on`,"audit.event.twoFactorDisabled":`Two-factor sign-in turned off`,"audit.event.twoFactorReset":`Two-factor sign-in reset`,"audit.event.recoveryCodes":`New recovery codes`,"audit.event.sessions":`Sessions signed out`,"audit.event.sessionsOthers":`Signed out everywhere else`,"audit.event.sessionsOne":`Signed out one device`,"display.title":`Display settings`,"display.calendar":`Calendar`,"display.gregorian":`Gregorian`,"display.jalali":`Jalali`,"display.digits":`Digits`,"display.accent":`Accent colour`,"display.customAccent":`Another colour`,"display.defaultAccent":`Default`,"display.accentForEveryone":`Use for everyone`,"display.resetForEveryone":`Reset for everyone`,"display.latinDigits":`Latin 123`,"display.persianDigits":`Persian ۱۲۳`,"inline.row":`{name} row {index}`,"inline.newRow":`New {name} {index}`,"inline.moveUp":`Move {name} up`,"inline.moveDown":`Move {name} down`,"inline.remove":`Remove {name}`,"inline.rowActions":`Row actions`,"inline.empty":`None yet.`,"inline.limitsMax":`{count} · at most {max}`,"inline.limitsBetween":`{count} · {min} to {max}`,"inline.countMin":`Needs at least {min} (has {count}).`,"inline.countMax":`Can have at most {max} (has {count}).`,"inline.truncated":`{count} more are not shown here, so these cannot be edited in this form.`,"inline.openList":`Open the list`,"inline.duplicateNote":`Duplicate copies this record only, not its {names}.`,"form.new":`New {name}`,"form.back":`Back`,"form.edit":`Edit`,"dashboard.title":`Dashboard`,"dashboard.subtitle":`Your shop over the chosen period`,"dashboard.period":`Period`,"dashboard.day":`Today`,"dashboard.week":`Week`,"dashboard.month":`Month`,"dashboard.year":`Year`,"dashboard.range":`Choose dates`,"dashboard.apply":`Show`,"dashboard.failed":`This widget could not load.`,"dashboard.retry":`Try again`,"dashboard.viewAll":`View all`,"dashboard.thisPeriod":`This period`,"dashboard.previousPeriod":`Previous period`,"stepper.since":`since {time}`,"form.viewProfile":`View`,"form.viewOnly":`You can view this record but not change it.`,"form.save":`Save`,"form.saving":`Saving…`,"form.delete":`Delete`,"form.confirmDelete":`Confirm delete`,"form.moveToTrash":`Move to trash`,"form.confirmMoveToTrash":`Confirm move to trash`,"form.deleting":`Deleting…`,"form.keep":`Keep`,"form.related":`Related`,"form.add":`Add {name}`,"form.remove":`Remove {name} {index}`,"form.conflictTitle":`Someone else saved this record while you were editing it.`,"form.conflictNone":`None of the fields on this form changed.`,"form.keepMine":`Keep my changes`,"form.loadTheirs":`Load theirs`,"form.saveAndNew":`Save & new`,"form.duplicate":`Duplicate`,"form.savedName":`“{name}” saved.`,"form.leaveTitle":`Leave without saving? Your changes will be lost.`,"form.stay":`Stay`,"form.leave":`Leave`,"form.unsaved":`Unsaved changes`,"form.formatJson":`Format`,"form.tabHasErrors":`(has errors)`,"form.readOnly":`Read-only`,"form.externalLink":`{name} (opens in a new tab)`,"form.colorCode":`{name} colour code`,"upload.choose":`Choose a file`,"upload.chooseMany":`Choose files`,"upload.chooseImage":`Choose an image`,"upload.chooseImages":`Choose images`,"upload.replace":`Replace`,"upload.drop":`or drop it here`,"upload.dropMany":`or drop them here`,"upload.limit":`Up to {max}`,"upload.uploading":`Uploading {name}`,"upload.cancel":`Cancel uploading {name}`,"upload.remove":`Remove {name}`,"upload.open":`Open {name}`,"upload.more":`+{count}`,"upload.failed":`{name}: {message}`,"upload.busy":`Wait for the uploads to finish, then save.`,"upload.tooLarge":`The file is too large.`,"upload.tooLargeMax":`The file is too large (at most {max}).`,"upload.typeRefused":`This type of file is not accepted here.`,"upload.empty":`The file is empty.`,"upload.network":`The upload failed. Check your connection and try again.`,"upload.bytes":`{value} B`,"upload.kilobytes":`{value} KB`,"upload.megabytes":`{value} MB`,"upload.gigabytes":`{value} GB`,"upload.terabytes":`{value} TB`,"editor.loading":`Loading the editor…`,"editor.toolbar":`{name} formatting`,"editor.paragraph":`Paragraph`,"editor.heading":`Heading {level}`,"editor.bold":`Bold`,"editor.italic":`Italic`,"editor.strike":`Strikethrough`,"editor.bulletList":`Bulleted list`,"editor.orderedList":`Numbered list`,"editor.blockquote":`Quote`,"editor.rule":`Horizontal line`,"editor.link":`Link`,"editor.linkAddress":`Link address`,"editor.linkApply":`Apply`,"editor.unlink":`Remove link`,"editor.image":`Insert image`,"editor.imageNoAddress":`the server gave no address to show the image from`,"editor.table":`Insert table`,"editor.addRow":`Add row`,"editor.addColumn":`Add column`,"editor.deleteRow":`Delete row`,"editor.deleteColumn":`Delete column`,"editor.deleteTable":`Delete table`,"editor.undo":`Undo`,"editor.redo":`Redo`,"palette.open":`Search and go to`,"palette.placeholder":`Go to, create, or find records…`,"palette.results":`Results`,"palette.goTo":`Go to`,"palette.actions":`Actions`,"palette.toggleTheme":`Toggle theme`,"palette.records":`Records`,"palette.new":`New {name}`,"palette.searching":`Searching…`,"palette.noResults":`Nothing found`,"picker.typeToSearch":`Type to search…`,"picker.typeToAdd":`Type to add…`,"picker.searching":`Searching…`,"picker.noMatches":`No matches`,"picker.remove":`Remove {name}`,"picker.clear":`Clear {name}`,"picker.selected":`Selected {name}`,"validation.required":`is required`,"validation.number":`must be a number`,"validation.json":`must be valid JSON`,"validation.date":`must be a valid date`,"validation.datetime":`must be a valid date and time`,"validation.minLength":`must be at least {min} characters`,"validation.maxLength":`must be at most {max} characters`,"validation.pattern":`is not in the expected format`,"validation.email":`must be an email address`,"validation.url":`must be a URL`,"validation.uuid":`must be a UUID`,"validation.oneOf":`must be one of: {values}`,"validation.integer":`must be an integer`,"validation.min":`must be at least {min}`,"validation.max":`must be at most {max}`},Hh={en:Vh,fa:{"common.loading":`در حال بارگذاری…`,"common.yes":`بله`,"common.no":`خیر`,"common.empty":`—`,"common.all":`همه`,"common.cancel":`انصراف`,"common.pageNotFound":`صفحه پیدا نشد.`,"common.requestFailed":`درخواست ناموفق بود ({status})`,"common.reference":`{message} (کد پیگیری: {id})`,"shell.adminPanel":`پنل مدیریت`,"palette.move":`جابه‌جایی`,"palette.openItem":`باز کردن`,"palette.close":`بستن`,"shell.menu":`منو`,"shell.closeMenu":`بستن منو`,"shell.resources":`بخش‌ها`,"shell.filterResources":`جست‌وجوی بخش‌ها`,"shell.pinned":`سنجاق‌شده`,"shell.recent":`اخیر`,"shell.pin":`سنجاق کردن {name}`,"shell.unpin":`برداشتن سنجاق {name}`,"shell.collapseGroup":`بستن {name}`,"shell.expandGroup":`باز کردن {name}`,"shell.collapseSidebar":`جمع کردن نوار کناری`,"shell.expandSidebar":`باز کردن نوار کناری`,"shell.breadcrumbs":`مسیر صفحه`,"shell.home":`خانه`,"shell.dashboard":`داشبورد`,"shell.noMatches":`بخشی پیدا نشد.`,"shell.theme":`پوسته`,"shell.themeLight":`روشن`,"shell.themeDark":`تیره`,"shell.themeSystem":`سیستم`,"shell.language":`زبان`,"shell.noResources":`هنوز بخشی ثبت نشده است. یک provider را با ‎@AdminResource‎ علامت بزنید.`,"shell.records":`{count} رکورد`,"shell.aboutRecords":`حدود {count} رکورد`,"list.select":`انتخاب`,"list.done":`تمام`,"list.loadMore":`بیشتر`,"list.showing":`{shown} مورد`,"list.showingOf":`{shown} از {total}`,"list.new":`جدید`,"list.trash":`سطل زباله`,"list.trashNote":`رکوردهای سطل زباله. برای ویرایش دوباره، آن را بازگردانید.`,"list.restore":`بازگردانی`,"list.restoreRecord":`بازگردانی {name}`,"list.actions":`عملیات`,"list.noMatches":`رکوردی با این شرایط نیست.`,"list.noRecords":`هنوز رکوردی نیست.`,"list.total":`{count} مورد`,"list.about":`حدود {count}`,"list.page":`صفحه {page}`,"list.pageOf":`صفحه {page} از {pages}`,"list.range":`نمایش {from} تا {to} از {total}`,"list.rowsPerPage":`ردیف در صفحه`,"list.toggleRow":`{column}: {name}`,"list.previousPage":`صفحه قبل`,"list.nextPage":`صفحه بعد`,"list.columns":`ستون‌ها`,"list.density":`تراکم`,"list.comfortable":`راحت`,"list.compact":`فشرده`,"list.moveUp":`جابه‌جایی {name} به بالا`,"list.moveDown":`جابه‌جایی {name} به پایین`,"list.resetColumns":`بازنشانی ستون‌ها`,"list.resize":`تغییر اندازه‌ی {name}`,"list.retry":`تلاش دوباره`,"list.loadFailed":`فهرست بارگذاری نشد.`,"list.selectPage":`انتخاب همه‌ی این صفحه`,"list.selectRow":`انتخاب {name}`,"print.open":`چاپ {name}`,"list.export":`خروجی Excel`,"list.exporting":`در حال ساخت فایل…`,"list.exportTruncated":`فقط {count} ردیف اول در فایل آمد.`,"list.exportDone":`{file} دانلود شد.`,"list.selected":`{count} مورد انتخاب شده`,"list.deleteSelected":`حذف انتخاب‌شده‌ها`,"list.confirmDeleteSelected":`حذف {count} مورد`,"list.clearSelection":`لغو انتخاب`,"list.bulkDeleted":`{count} مورد حذف شد`,"list.bulkFailed":`{count} مورد ناموفق`,"list.quickView":`نمای سریع: {name}`,"list.edit":`ویرایش`,"list.close":`بستن`,"list.editCell":`ویرایش {name}: {value}`,"action.running":`در حال اجرا…`,"action.confirm":`«{action}» اجرا شود؟`,"action.confirmRecord":`«{action}» روی {name} اجرا شود؟`,"action.confirmSelected":`«{action}» روی {count} رکورد اجرا شود؟`,"action.eachNote":`هر یک از {count} رکورد جداگانه انجام می‌شود: خطای یکی بقیه را متوقف نمی‌کند.`,"action.atomicNote":`همه یا هیچ: اگر یکی از {count} رکورد خطا بدهد، هیچ‌کدام تغییر نمی‌کند.`,"action.done":`«{action}» انجام شد.`,"action.doneGone":`«{action}» انجام شد. این رکورد دیگر در دسترس شما نیست.`,"action.bulkDone":`{action}: {count} مورد انجام شد`,"action.saveFirst":`ابتدا تغییرات را ذخیره یا لغو کنید.`,"action.more":`کارهای بیشتر`,"toast.region":`اعلان‌ها`,"toast.dismiss":`بستن`,"settings.viewOnly":`می‌توانید این تنظیمات را ببینید ولی نمی‌توانید تغییرشان دهید.`,"settings.discard":`لغو تغییرات`,"secret.set":`تنظیم شده`,"secret.notSet":`تنظیم نشده`,"secret.replace":`جایگزینی`,"secret.replaceName":`جایگزینی {name}`,"secret.clear":`پاک کردن`,"secret.clearName":`پاک کردن {name}`,"secret.keep":`نگه داشتن مقدار فعلی`,"secret.willClear":`هنگام ذخیره پاک می‌شود.`,"secret.undo":`بازگردانی`,"filters.search":`جست‌وجو`,"filters.searchIn":`جست‌وجو در {fields}`,"filters.filtersAndSort":`فیلتر و مرتب‌سازی`,"filters.showResults":`نمایش نتایج`,"filters.sortBy":`مرتب‌سازی بر اساس`,"filters.ascending":`{name}، صعودی`,"filters.descending":`{name}، نزولی`,"filters.filters":`فیلترها`,"filters.clear":`پاک کردن فیلترها`,"filters.from":`از`,"filters.to":`تا`,"filters.contains":`{field} شامل`,"filters.empty":`خالی`,"filters.notEmpty":`غیرخالی`,"filters.not":`به‌جز `,"filters.removeChip":`حذف فیلتر {label}`,"filters.active":`فیلترهای فعال`,"filters.any":`همه`,"filters.onlyEmpty":`خالی`,"filters.hideEmpty":`غیرخالی`,"filters.emptyValues":`{field}: مقدارهای خالی`,"filters.selected":`{count} مورد`,"date.placeholder":`yyyy/mm/dd`,"date.openCalendar":`انتخاب {name} از تقویم`,"date.calendar":`تقویم {name}`,"date.previous":`قبلی`,"date.next":`بعدی`,"date.chooseMonth":`انتخاب ماه`,"date.chooseYear":`انتخاب سال`,"date.today":`امروز`,"date.clear":`پاک کردن`,"date.time":`ساعت {name}`,"auth.title":`ورود`,"auth.username":`نام کاربری`,"auth.password":`گذرواژه`,"auth.signIn":`ورود`,"auth.signingIn":`در حال ورود…`,"auth.required":`نام کاربری و گذرواژه را وارد کنید.`,"auth.failed":`ورود انجام نشد. دوباره تلاش کنید.`,"auth.userMenu":`منوی حساب {name}`,"auth.account":`حساب کاربری`,"auth.signOut":`خروج`,"auth.changePassword":`تغییر گذرواژه`,"auth.currentPassword":`گذرواژه‌ی فعلی`,"auth.newPassword":`گذرواژه‌ی جدید`,"auth.confirmPassword":`تکرار گذرواژه‌ی جدید`,"auth.mismatch":`با گذرواژه‌ی جدید یکسان نیست`,"auth.passwordChanged":`گذرواژه تغییر کرد. نشست‌های دیگر شما بسته شدند.`,"auth.sessions":`دستگاه‌های واردشده`,"auth.signOutOthers":`خروج از همه‌ی دستگاه‌های دیگر`,"auth.thisDevice":`همین دستگاه`,"auth.unknownDevice":`دستگاه ناشناخته`,"auth.lastSeen":`آخرین فعالیت {when}`,"auth.revoke":`خروج`,"auth.revokeSession":`خروج {name}`,"rbac.administration":`مدیریت`,"rbac.users":`کاربران`,"rbac.groups":`گروه‌ها`,"rbac.roles":`نقش‌ها`,"rbac.user":`کاربر`,"rbac.group":`گروه`,"rbac.role":`نقش`,"rbac.newUser":`کاربر جدید`,"rbac.newGroup":`گروه جدید`,"rbac.newRole":`نقش جدید`,"rbac.createUser":`ساختن کاربر`,"rbac.export":`خروجی`,"rbac.import":`ورود`,"rbac.importFile":`پرونده‌ی نقش‌ها برای ورود`,"rbac.imported":`{count} نقش وارد شد.`,"rbac.notJson":`این پرونده JSON نیست.`,"rbac.permissionCount":`{count} مجوز`,"rbac.system":`سیستمی`,"rbac.systemNote":`این نقش در کد تعریف شده است؛ آن را همان‌جا تغییر دهید.`,"rbac.name":`نام`,"rbac.labelIn":`عنوان ({language})`,"rbac.matrix":`مجوزها`,"rbac.resource":`بخش`,"rbac.op.view":`دیدن`,"rbac.op.create":`ساختن`,"rbac.op.update":`تغییر`,"rbac.op.delete":`حذف`,"rbac.op.purge":`حذف دائمی`,"rbac.grant":`{operation} {resource}`,"rbac.details":`فیلدها و ردیف‌های {resource}`,"rbac.fields":`فیلدها`,"rbac.restricted":`محدود`,"rbac.fieldRule":`دسترسی به {field}`,"rbac.rule.default":`مطابق مجوزها`,"rbac.rule.defaultHidden":`پنهان (محدود)`,"rbac.rule.hidden":`پنهان`,"rbac.rule.readonly":`فقط خواندنی`,"rbac.rule.edit":`قابل ویرایش`,"rbac.scopes":`ردیف‌ها`,"rbac.allRows":`همه‌ی ردیف‌ها`,"rbac.custom":`مجوزهای دیگر`,"rbac.global":`مجوزهای عمومی`,"rbac.actions":`عملیات`,"rbac.actionNote":`عملیات روی رکوردها به مجوز تغییر هم نیاز دارد.`,"rbac.pages":`صفحه‌های تنظیمات`,"rbac.page":`صفحه`,"rbac.viewImplied":`هر کس بتواند صفحه‌ای را تغییر دهد، می‌تواند آن را ببیند.`,"rbac.noGroups":`هنوز گروهی نیست.`,"rbac.groupSummary":`{roles} نقش · {members} عضو`,"rbac.members":`اعضا`,"rbac.noMembers":`هنوز عضوی نیست.`,"rbac.addMember":`افزودن عضو`,"rbac.searchUsers":`جست‌وجوی کاربران`,"rbac.searchResults":`کاربران یافته‌شده`,"rbac.usersFromMemberships":`سامانه‌ی ورود شما نمی‌تواند کاربران را فهرست کند: این‌ها کاربرانی هستند که این‌جا نقش یا گروه دارند.`,"rbac.superuser":`ابرکاربر`,"rbac.superuserNote":`فقط ابرکاربرها می‌توانند ابرکاربر را تغییر دهند.`,"rbac.inactive":`غیرفعال`,"rbac.active":`فعال`,"rbac.displayName":`نام نمایشی`,"rbac.email":`ایمیل`,"rbac.saved":`ذخیره شد.`,"rbac.setPassword":`تعیین گذرواژه`,"rbac.setPasswordNote":`کاربر از همه‌جا خارج می‌شود.`,"rbac.passwordSet":`گذرواژه تعیین شد؛ کاربر از همه‌جا خارج شد.`,"auth.otpTitle":`تأیید دومرحله‌ای`,"auth.otp":`کد`,"auth.otpHelp":`کد ۶ رقمی برنامهٔ احراز هویت یا یکی از کدهای بازیابی را وارد کنید.`,"auth.verify":`تأیید`,"auth.otpRequired":`کد را وارد کنید.`,"auth.startOver":`ورود با حساب دیگر`,"twoFactor.title":`ورود دومرحله‌ای`,"twoFactor.on":`روشن`,"twoFactor.off":`خاموش`,"twoFactor.intro":`پس از گذرواژه، کدی از برنامهٔ احراز هویت خواسته شود.`,"twoFactor.setUp":`راه‌اندازی`,"twoFactor.scan":`کد را با برنامهٔ احراز هویت اسکن کنید یا کلید را در آن وارد کنید. سپس کدی را که برنامه نشان می‌دهد بنویسید.`,"twoFactor.qr":`کد QR برای برنامهٔ احراز هویت`,"twoFactor.key":`کلید`,"twoFactor.code":`کد برنامه`,"twoFactor.turnOn":`روشن کردن`,"twoFactor.recoveryTitle":`کدهای بازیابی`,"twoFactor.recoveryIntro":`این کدها را جای امنی نگه دارید. اگر دستگاهتان را گم کنید، هر کد یک بار شما را وارد می‌کند. دوباره نشان داده نمی‌شوند.`,"twoFactor.copy":`کپی کدها`,"twoFactor.copied":`کپی شد`,"twoFactor.done":`ذخیره‌شان کردم`,"twoFactor.left":`{count} کد بازیابی استفاده‌نشده.`,"twoFactor.newCodes":`کدهای بازیابی تازه`,"twoFactor.turnOff":`خاموش کردن`,"twoFactor.password":`گذرواژهٔ شما`,"twoFactor.enabledNote":`ورود دومرحله‌ای روشن شد. نشست‌های دیگر شما بسته شدند.`,"twoFactor.disabledNote":`ورود دومرحله‌ای خاموش است.`,"viewAs.start":`دیدن از نگاه این کاربر`,"viewAs.banner":`از نگاه {name}. فقط خواندنی.`,"viewAs.stop":`پایان`,"rbac.twoFactor":`ورود دومرحله‌ای`,"rbac.resetTwoFactor":`بازنشانی ورود دومرحله‌ای`,"rbac.resetTwoFactorNote":`عامل دوم کاربر را (مثلاً گوشی گم‌شده) خاموش می‌کند و او را از همه‌جا خارج می‌کند.`,"rbac.twoFactorReset":`ورود دومرحله‌ای این کاربر خاموش شد.`,"debugger.title":`اشکال‌یاب دسترسی`,"debugger.intro":`چرا کاربری چیزی را می‌بیند یا نمی‌بیند، تغییر می‌دهد یا نمی‌دهد.`,"debugger.user":`کاربر`,"debugger.resource":`منبع`,"debugger.record":`شناسهٔ رکورد (اختیاری)`,"debugger.explain":`توضیح بده`,"debugger.pick":`یک کاربر و یک منبع انتخاب کنید.`,"debugger.roles":`نقش‌ها`,"debugger.noRoles":`بدون نقش: هیچ کاری مجاز نیست.`,"debugger.superuser":`ابرکاربر همه‌کاری می‌تواند بکند.`,"debugger.source.direct":`مستقیم داده شده`,"debugger.source.group":`از گروه {group}`,"debugger.source.resolveRoles":`از resolveRoles`,"debugger.source.adapter":`از سامانهٔ ورود`,"debugger.unknownRole":`نقشی با این نام نیست؛ چیزی نمی‌دهد`,"debugger.operations":`عملیات`,"debugger.allowed":`مجاز`,"debugger.denied":`غیرمجاز`,"debugger.noGrant":`هیچ نقشی آن را نمی‌دهد`,"debugger.viaUpdate":`{pattern} در {role} (تغییر، دیدن را هم می‌دهد)`,"debugger.grant":`{pattern} در {role}`,"debugger.fields":`فیلدها`,"debugger.field":`فیلد`,"debugger.result":`نتیجه`,"debugger.byRole":`به تفکیک نقش`,"debugger.forced":`همیشه دیده می‌شود: کلیدها و نسخه`,"debugger.scopes":`ردیف‌ها`,"debugger.allRows":`همهٔ ردیف‌ها`,"debugger.noRows":`هیچ ردیفی`,"debugger.someRows":`ردیف‌های {scopes}`,"debugger.globalScopes":`محدود به {scopes} نیز`,"debugger.recordTitle":`رکورد {id}`,"debugger.reason.permission":`بدون مجوز`,"debugger.reason.scope":`بیرون از ردیف‌هایش`,"debugger.reason.rule":`قاعدهٔ این رکورد اجازه نمی‌دهد`,"debugger.reason.missing":`چنین رکوردی نیست`,"debugger.actions":`عملیات`,"debugger.needsUpdate":`عملیات روی رکوردها به مجوز تغییر هم نیاز دارد`,"debugger.noRecordActions":`هیچ‌کدام روی این رکورد`,"debugger.pages":`صفحه‌های تنظیمات`,"audit.title":`گزارش تغییرات`,"audit.history":`تاریخچه`,"audit.details":`جزئیات`,"audit.recordTabs":`رکورد و تاریخچه‌ی آن`,"audit.entries":`تغییرهای ثبت‌شده`,"audit.notAllowed":`اجازه‌ی خواندن گزارش تغییرات را ندارید`,"audit.off":`گزارش تغییرات در این پنل فعال نیست`,"audit.empty":`هنوز چیزی ثبت نشده است.`,"audit.noMatches":`موردی پیدا نشد.`,"audit.noActor":`بدون ورود`,"audit.viewAsBy":`هنگامی که کاربر {id} از دید او نگاه می‌کرد`,"audit.filterByActor":`فقط کارهای {name} را نشان بده`,"audit.changedFields":`فیلدهای تغییرکرده`,"audit.before":`قبل`,"audit.after":`بعد`,"audit.becomes":`شد`,"audit.field.changed":`تغییر کرد`,"audit.field.hidden":`پنهان`,"audit.field.dropped":`بزرگ‌تر از آن بود که نگه داشته شود`,"audit.field.truncated":`کوتاه‌شده`,"audit.showMore":`بیشتر`,"audit.showLess":`کمتر`,"audit.input":`ورودی`,"audit.inputTruncated":`ورودی بزرگ‌تر از آن بود که نگه داشته شود.`,"audit.restrictedRecord":`رکوردی که نمی‌توانید ببینید: جزئیات آن نشان داده نمی‌شود.`,"audit.restrictedChanges":`اجازه‌ی دیدن تغییرها را ندارید.`,"audit.suppressedNote":`در همان دقیقه رخ دادند و تک‌تک ثبت نشدند.`,"audit.limitedNote":`ورودهای ناموفق بعدی در این دقیقه فقط شمرده می‌شوند.`,"audit.actionDeleted":`این عملیات رکورد را حذف کرد.`,"audit.filter.actor":`انجام‌دهنده (شناسه‌ی کاربر)`,"audit.filter.event":`رویداد`,"audit.filter.eventHint":`order.updated یا auth.*`,"audit.filter.resource":`بخش`,"audit.filter.record":`شناسه‌ی رکورد`,"audit.filter.recordHint":`نخست یک بخش انتخاب کنید`,"audit.event.unseen":`تغییری که نمی‌توانید ببینید`,"audit.event.created":`ایجاد شد`,"audit.event.updated":`تغییر کرد`,"audit.event.deleted":`حذف شد`,"audit.event.trashed":`به سطل زباله رفت`,"audit.event.restored":`بازیابی شد`,"audit.event.purged":`برای همیشه حذف شد`,"audit.event.action":`«{action}» اجرا شد`,"audit.event.page":`{page} تغییر کرد`,"audit.event.login":`وارد شد`,"audit.event.logout":`خارج شد`,"audit.event.loginFailed":`ورود ناموفق`,"audit.event.loginFailedCode":`ورود ناموفق: کد دومرحله‌ای نادرست`,"audit.event.loginFailedLimited":`ورود ناموفق: تلاش‌های بیش از حد`,"audit.event.loginFailedMore":`{count} ورود ناموفق دیگر`,"audit.event.viewAs":`پنل را از دید یک کاربر دید`,"audit.event.roleChanged":`نقش تغییر کرد`,"audit.event.groupChanged":`گروه تغییر کرد`,"audit.event.userRolesChanged":`نقش‌ها و گروه‌های یک کاربر تغییر کرد`,"audit.event.userCreated":`کاربر ایجاد شد`,"audit.event.userChanged":`کاربر تغییر کرد`,"audit.event.passwordChanged":`رمز عبور تغییر کرد`,"audit.event.passwordReset":`مدیر رمز عبور را تعیین کرد`,"audit.event.twoFactorEnabled":`ورود دومرحله‌ای روشن شد`,"audit.event.twoFactorDisabled":`ورود دومرحله‌ای خاموش شد`,"audit.event.twoFactorReset":`ورود دومرحله‌ای بازنشانی شد`,"audit.event.recoveryCodes":`کدهای بازیابی تازه`,"audit.event.sessions":`نشست‌ها بسته شدند`,"audit.event.sessionsOthers":`از همه‌ی دستگاه‌های دیگر خارج شد`,"audit.event.sessionsOne":`از یک دستگاه خارج شد`,"display.title":`تنظیمات نمایش`,"display.calendar":`تقویم`,"display.gregorian":`میلادی`,"display.jalali":`شمسی`,"display.digits":`ارقام`,"display.accent":`رنگ اصلی`,"display.customAccent":`رنگ دیگر`,"display.defaultAccent":`پیش‌فرض`,"display.accentForEveryone":`برای همه`,"display.resetForEveryone":`بازگشت برای همه`,"display.latinDigits":`لاتین 123`,"display.persianDigits":`فارسی ۱۲۳`,"inline.row":`{name} ردیف {index}`,"inline.newRow":`{name} جدید {index}`,"inline.moveUp":`بردن {name} به بالا`,"inline.moveDown":`بردن {name} به پایین`,"inline.remove":`حذف {name}`,"inline.rowActions":`کارهای ردیف`,"inline.empty":`هنوز چیزی نیست.`,"inline.limitsMax":`{count} · حداکثر {max}`,"inline.limitsBetween":`{count} · از {min} تا {max}`,"inline.countMin":`دست‌کم {min} لازم است ({count} هست).`,"inline.countMax":`حداکثر {max} می‌تواند باشد ({count} هست).`,"inline.truncated":`{count} مورد دیگر اینجا نشان داده نمی‌شود، پس این‌ها در این فرم ویرایش نمی‌شوند.`,"inline.openList":`باز کردن فهرست`,"inline.duplicateNote":`تکثیر فقط همین رکورد را کپی می‌کند، نه {names} آن را.`,"form.new":`{name} جدید`,"form.back":`بازگشت`,"form.edit":`ویرایش`,"dashboard.title":`داشبورد`,"dashboard.subtitle":`وضعیت فروشگاه در بازه انتخاب‌شده`,"dashboard.period":`بازه زمانی`,"dashboard.day":`امروز`,"dashboard.week":`هفته`,"dashboard.month":`ماه`,"dashboard.year":`سال`,"dashboard.range":`انتخاب بازه تاریخ`,"dashboard.apply":`نمایش`,"dashboard.failed":`این ویجت بارگذاری نشد.`,"dashboard.retry":`تلاش دوباره`,"dashboard.viewAll":`مشاهده همه`,"dashboard.thisPeriod":`این دوره`,"dashboard.previousPeriod":`دوره قبل`,"stepper.since":`از {time}`,"form.viewProfile":`مشاهده پروفایل`,"form.viewOnly":`می‌توانید این رکورد را ببینید اما نمی‌توانید آن را تغییر دهید.`,"form.save":`ذخیره`,"form.saving":`در حال ذخیره…`,"form.delete":`حذف`,"form.confirmDelete":`تأیید حذف`,"form.moveToTrash":`انتقال به سطل زباله`,"form.confirmMoveToTrash":`تأیید انتقال به سطل زباله`,"form.deleting":`در حال حذف…`,"form.keep":`نگه‌داشتن`,"form.related":`مرتبط`,"form.add":`افزودن {name}`,"form.remove":`حذف {name} {index}`,"form.conflictTitle":`در حین ویرایش شما، شخص دیگری این رکورد را ذخیره کرد.`,"form.conflictNone":`هیچ‌یک از فیلدهای این فرم تغییر نکرده است.`,"form.keepMine":`تغییرات من بماند`,"form.loadTheirs":`نسخه‌ی آن‌ها را بارگذاری کن`,"form.saveAndNew":`ذخیره و مورد جدید`,"form.duplicate":`تکثیر`,"form.savedName":`«{name}» ذخیره شد.`,"form.leaveTitle":`بدون ذخیره خارج می‌شوید؟ تغییرات از دست می‌رود.`,"form.stay":`بمان`,"form.leave":`خروج`,"form.unsaved":`تغییرات ذخیره نشده`,"form.formatJson":`مرتب‌سازی`,"form.tabHasErrors":`(دارای خطا)`,"form.readOnly":`فقط خواندنی`,"form.externalLink":`{name} (در زبانه‌ی جدید باز می‌شود)`,"form.colorCode":`کد رنگ {name}`,"upload.choose":`انتخاب فایل`,"upload.chooseMany":`انتخاب فایل‌ها`,"upload.chooseImage":`انتخاب تصویر`,"upload.chooseImages":`انتخاب تصویرها`,"upload.replace":`جایگزینی`,"upload.drop":`یا آن را اینجا رها کنید`,"upload.dropMany":`یا آن‌ها را اینجا رها کنید`,"upload.limit":`حداکثر {max}`,"upload.uploading":`در حال بارگذاری {name}`,"upload.cancel":`لغو بارگذاری {name}`,"upload.remove":`حذف {name}`,"upload.open":`باز کردن {name}`,"upload.more":`+{count}`,"upload.failed":`{name}: {message}`,"upload.busy":`تا پایان بارگذاری‌ها صبر کنید، سپس ذخیره کنید.`,"upload.tooLarge":`فایل بیش از حد بزرگ است.`,"upload.tooLargeMax":`فایل بیش از حد بزرگ است (حداکثر {max}).`,"upload.typeRefused":`این نوع فایل اینجا پذیرفته نمی‌شود.`,"upload.empty":`فایل خالی است.`,"upload.network":`بارگذاری ناموفق بود. اتصال خود را بررسی کنید و دوباره تلاش کنید.`,"upload.bytes":`{value} بایت`,"upload.kilobytes":`{value} کیلوبایت`,"upload.megabytes":`{value} مگابایت`,"upload.gigabytes":`{value} گیگابایت`,"upload.terabytes":`{value} ترابایت`,"editor.loading":`در حال بارگذاری ویرایشگر…`,"editor.toolbar":`قالب‌بندی {name}`,"editor.paragraph":`پاراگراف`,"editor.heading":`عنوان {level}`,"editor.bold":`پررنگ`,"editor.italic":`کج`,"editor.strike":`خط‌خورده`,"editor.bulletList":`فهرست نشانه‌دار`,"editor.orderedList":`فهرست شماره‌دار`,"editor.blockquote":`نقل‌قول`,"editor.rule":`خط افقی`,"editor.link":`پیوند`,"editor.linkAddress":`نشانی پیوند`,"editor.linkApply":`اعمال`,"editor.unlink":`حذف پیوند`,"editor.image":`درج تصویر`,"editor.imageNoAddress":`سرور نشانی‌ای برای نمایش تصویر نداد`,"editor.table":`درج جدول`,"editor.addRow":`افزودن سطر`,"editor.addColumn":`افزودن ستون`,"editor.deleteRow":`حذف سطر`,"editor.deleteColumn":`حذف ستون`,"editor.deleteTable":`حذف جدول`,"editor.undo":`واگرد`,"editor.redo":`ازنو`,"palette.open":`جست‌وجو و رفتن به`,"palette.placeholder":`رفتن به، ساختن، یا یافتن رکورد…`,"palette.results":`نتایج`,"palette.goTo":`رفتن به`,"palette.actions":`کارها`,"palette.toggleTheme":`تغییر تم`,"palette.records":`رکوردها`,"palette.new":`{name} جدید`,"palette.searching":`در حال جست‌وجو…`,"palette.noResults":`چیزی پیدا نشد`,"picker.typeToSearch":`برای جست‌وجو تایپ کنید…`,"picker.typeToAdd":`برای افزودن تایپ کنید…`,"picker.searching":`در حال جست‌وجو…`,"picker.noMatches":`موردی پیدا نشد`,"picker.remove":`حذف {name}`,"picker.clear":`پاک کردن {name}`,"picker.selected":`{name} انتخاب‌شده`,"validation.required":`الزامی است`,"validation.number":`باید عدد باشد`,"validation.json":`باید JSON معتبر باشد`,"validation.date":`باید تاریخ معتبری باشد`,"validation.datetime":`باید تاریخ و زمان معتبر باشد`,"validation.minLength":`باید دست‌کم {min} نویسه باشد`,"validation.maxLength":`باید حداکثر {max} نویسه باشد`,"validation.pattern":`قالب آن درست نیست`,"validation.email":`باید نشانی ایمیل باشد`,"validation.url":`باید نشانی اینترنتی باشد`,"validation.uuid":`باید UUID باشد`,"validation.oneOf":`باید یکی از این‌ها باشد: {values}`,"validation.integer":`باید عدد صحیح باشد`,"validation.min":`باید دست‌کم {min} باشد`,"validation.max":`باید حداکثر {max} باشد`}},Uh=new Set([`fa`,`ar`,`he`,`ur`]),Wh=`nma.locale`,Gh=`en`,Kh={calendar:`gregorian`,digits:`latn`};function qh(){return Kh}function Jh(e){Kh=e}function Yh(){return Gh}var Xh={};function Zh(e){Xh=e??{}}function J(e,t={},n=Gh){return(Xh[n]?.[e]??(Hh[n]??Vh)[e]??Vh[e]).replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e)}function Qh(e){return Uh.has(e.split(`-`)[0])}var $h=e=>`-u-ca-${e.calendar===`persian`?`persian`:`gregory`}-nu-${e.digits}`;function eg(e,t=Gh){return new Intl.NumberFormat(`${t}-u-nu-${Kh.digits}`).format(e)}function tg(e){return Kh.digits===`arabext`?Fh(e):e}function ng(e,t=Gh){return new Intl.DateTimeFormat(`${t}${$h(Kh)}`,{dateStyle:`medium`,timeStyle:`short`}).format(e)}function rg(e,t=Gh){return new Intl.DateTimeFormat(`${t}${$h(Kh)}`,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).format(e)}function ig(e,t=Gh){let n=Date.parse(`${e}T00:00:00Z`);return!/^\d{4}-\d{2}-\d{2}$/.test(e)||Number.isNaN(n)?e:new Intl.DateTimeFormat(`${t}${$h(Kh)}`,{dateStyle:`medium`,timeZone:`UTC`}).format(n)}function ag(e,t=new Date,n=Gh){let r=Math.min(0,Math.round((e.getTime()-t.getTime())/1e3)),i=new Intl.RelativeTimeFormat(`${n}-u-nu-${Kh.digits}`,{numeric:`auto`});for(let[e,t]of[[`year`,31536e3],[`month`,2592e3],[`day`,86400],[`hour`,3600],[`minute`,60]])if(Math.abs(r)>=t)return i.format(Math.trunc(r/t),e);return i.format(Math.abs(r)<10?0:r,`second`)}function og(e){Gh=e,typeof document<`u`&&(document.documentElement.lang=e,document.documentElement.dir=Qh(e)?`rtl`:`ltr`)}function sg(e,t){try{let t=localStorage.getItem(Wh);if(t&&e.includes(t))return t}catch{}return t}var cg=(0,y.createContext)(void 0);function lg({locales:e,fallback:t,children:n}){let[r,i]=(0,y.useState)(()=>{let n=sg(e,t);return og(n),n}),[a,o]=(0,y.useState)(()=>{let e=zh(r);return Jh(e),e});return(0,b.jsx)(cg.Provider,{value:{locale:r,locales:e,setLocale:e=>{og(e);try{localStorage.setItem(Wh,e)}catch{}let t=zh(e);Jh(t),o(t),i(e)},t:(e,t)=>J(e,t,r),calendar:a.calendar,digits:a.digits,setDisplay:e=>{Bh(e);let t={...a,...e};Jh(t),o(t)}},children:n})}function Y(){let e=(0,y.useContext)(cg);if(!e)throw Error(`useLocale() outside LocaleProvider`);return e}function X(){return Y().t}function ug(){let e=document.getElementById(`nma-config`)?.textContent;if(e)return JSON.parse(e);throw Error(`nest-my-admin: runtime config missing`)}var dg=ug(),fg=class extends Error{status;body;constructor(e,t){super(t.code===`INTERNAL`&&t.correlationId?J(`common.reference`,{message:t.message,id:t.correlationId}):t.message),this.status=e,this.body=t,this.name=`ApiError`}get fields(){return this.body.fields??{}}};function pg(e){if(!(e instanceof fg))return e.message;let t=Object.entries(e.fields).map(([e,t])=>`${e}: ${t.join(`, `)}`);return[e.message,...t].join(` — `)}var mg,hg;function gg(e){mg=e}function _g(){return mg}function vg(e){hg=e}function yg(){mg=void 0,hg?.()}function bg(e,t){let n=t.replace(/\/+$/,``);return n===``||e!==n&&!e.startsWith(`${n}/`)?e:e.slice(n.length)||`/`}function xg(e,t=``){if(!e||!e.startsWith(`/`)||e.startsWith(`//`)||e.startsWith(`/\\`))return`/`;let n=bg(e,t);return n.startsWith(`/login`)?`/`:n}var Sg=`nma-view-as`;function Cg(){try{return sessionStorage.getItem(Sg)??void 0}catch{return}}function wg(e){try{e===void 0?sessionStorage.removeItem(Sg):sessionStorage.setItem(Sg,e)}catch{}}var Tg=class extends Error{constructor(){super(`Upload aborted`),this.name=`UploadAbortedError`}},Eg=`application/octet-stream`;function Dg(e){return typeof e==`object`&&!!e&&`code`in e&&`message`in e}function Og(e){return typeof e==`object`&&!!e&&typeof e.token==`string`}function kg(e,t,n,r){let i=n.createXhr?n.createXhr():new XMLHttpRequest,a=!1;return{promise:new Promise((o,s)=>{let c=e=>{a||(a=!0,e())};i.open(`POST`,`${n.apiBase}/uploads?${new URLSearchParams({resource:t.resource,field:t.field})}`),i.setRequestHeader(`Accept`,`application/json`),i.setRequestHeader(`Accept-Language`,n.locale),i.setRequestHeader(`Content-Type`,Eg),i.setRequestHeader(`X-File-Name`,encodeURIComponent(e.name)),n.csrfToken&&i.setRequestHeader(`X-CSRF-Token`,n.csrfToken),n.viewAs&&i.setRequestHeader(`X-View-As`,n.viewAs),i.upload.onprogress=e=>{e.lengthComputable&&e.total>0&&r?.(e.loaded/e.total)},i.onload=()=>{let e;try{e=i.responseText?JSON.parse(i.responseText):void 0}catch{e=void 0}let t=i.status>=200&&i.status<300&&Og(e);i.status===401&&n.onSignedOut?.(),c(()=>{t?(r?.(1),o(e)):Dg(e)?s(new fg(i.status,e)):i.status===413?s(new fg(413,{code:`BAD_REQUEST`,message:J(`upload.tooLarge`,{},n.locale),correlationId:``})):s(new fg(i.status,{code:`INTERNAL`,message:J(`common.requestFailed`,{status:i.status},n.locale),correlationId:``}))})},i.onerror=()=>c(()=>s(Error(J(`upload.network`,{},n.locale)))),i.onabort=()=>c(()=>s(new Tg)),i.send(e)}),abort:()=>{a||i.abort()}}}function Ag(e){if(e instanceof fg){let t=Object.values(e.fields).flat();if(t.length>0)return t.join(` `)}return e instanceof Error?e.message:String(e)}function jg(e,t){if(t.length===0)return!0;let n=e.toLowerCase();return t.some(e=>{let t=e.trim().toLowerCase();return t===`*`||t===`*/*`?!0:t.endsWith(`/*`)?n.startsWith(t.slice(0,-1)):n===t})}function Mg(e,t,n){if(e.size===0)return J(`upload.empty`,{},n);if(e.size>t.maxBytes)return J(`upload.tooLargeMax`,{max:Pg(t.maxBytes,n)},n);if(e.type!==``&&!jg(e.type.split(`;`)[0].trim(),t.accept))return J(`upload.typeRefused`,{},n)}var Ng=[`upload.bytes`,`upload.kilobytes`,`upload.megabytes`,`upload.gigabytes`,`upload.terabytes`];function Pg(e,t){let n=e,r=0;for(;n>=1024&&r<Ng.length-1;)n/=1024,r+=1;let i=new Intl.NumberFormat(t??`${Yh()}-u-nu-${qh().digits}`,{maximumFractionDigits:r===0?0:1}).format(n);return J(Ng[r],{value:i},t)}function Fg(e,t,n){let r=[...e];if(t<0||t>=r.length||n<0||n>=r.length||t===n)return r;let[i]=r.splice(t,1);return r.splice(n,0,i),r}function Ig(e){return{...e,creatable:!1,actions:[],prints:[],permissions:{create:!1,update:!1,delete:!1,purge:!1},list:{...e.list,editable:[]},form:{...e.form,create:[],update:[],requiredOnCreate:[],readonly:[...new Set([...e.form.readonly,...e.form.update,...e.form.create])]},...e.inlines?{inlines:Object.fromEntries(Object.entries(e.inlines).map(([e,t])=>[e,Ig(t)]))}:{}}}function Lg(e){return e.schema.readonly?e:{...e,schema:{...e.schema,readonly:!0}}}function Rg(e){return e.viewAs?{...e,rbac:{...e.rbac,manage:!1}}:e}function zg(e){return typeof e==`object`&&!!e&&`code`in e&&`message`in e}async function Z(e,t={}){let n=t.method??`GET`,r=_g(),i=e===`/session`&&n===`POST`?void 0:Cg(),a=await fetch(`${dg.apiBase}${e}`,{...t,credentials:`same-origin`,headers:{Accept:`application/json`,"Accept-Language":Yh(),...t.body?{"Content-Type":`application/json`}:{},...n!==`GET`&&r?{"X-CSRF-Token":r}:{},...i?{"X-View-As":i}:{},...t.headers}});a.status===401&&!e.startsWith(`/session`)&&yg();let o=await a.text(),s;try{s=o?JSON.parse(o):void 0}catch{s=void 0}if(!a.ok)throw new fg(a.status,zg(s)?s:{code:`INTERNAL`,message:J(`common.requestFailed`,{status:a.status}),correlationId:``});return s}var Bg=encodeURIComponent,Vg=e=>typeof e==`number`||typeof e==`string`?{"If-Match":`"${e}"`}:{};function Hg(e,t,n){let r=new URLSearchParams([...n.map(e=>[`id`,e]),[`lang`,Yh()]]);return`${dg.apiBase}/resources/${encodeURIComponent(e)}/print/${encodeURIComponent(t)}?${r}`}async function Ug(e,t){let n=new URLSearchParams(t);n.set(`offset`,String(-new Date().getTimezoneOffset()));let r=Cg(),i=await fetch(`${dg.apiBase}/resources/${encodeURIComponent(e)}/export?${n}`,{credentials:`same-origin`,headers:{"Accept-Language":Yh(),...r?{"X-View-As":r}:{}}});if(i.status===401&&yg(),!i.ok){let e=await i.json().catch(()=>void 0);throw new fg(i.status,zg(e)?e:{code:`INTERNAL`,message:J(`common.requestFailed`,{status:i.status}),correlationId:``})}let a=/filename="([^"]+)"/.exec(i.headers.get(`Content-Disposition`)??``)?.[1]??`${e}.xlsx`,o=i.headers.get(`X-Export-Truncated`);return{blob:await i.blob(),filename:a,...o?{truncated:Number(o)}:{}}}var Q={exportList:Ug,session:async()=>Rg(await Z(`/session`)),login:(e,t,n)=>Z(`/session`,{method:`POST`,body:JSON.stringify({username:e,password:t,...n?{otp:n}:{}})}),logout:()=>Z(`/session`,{method:`DELETE`}),sessions:()=>Z(`/account/sessions`),revokeSession:e=>Z(`/account/sessions/${Bg(e)}`,{method:`DELETE`}),revokeOtherSessions:()=>Z(`/account/sessions`,{method:`DELETE`}),changePassword:(e,t)=>Z(`/account/password`,{method:`POST`,body:JSON.stringify({current:e,next:t})}),twoFactor:{status:()=>Z(`/account/2fa`),setup:()=>Z(`/account/2fa/setup`,{method:`POST`,body:`{}`}),confirm:e=>Z(`/account/2fa/confirm`,{method:`POST`,body:JSON.stringify({code:e})}),disable:e=>Z(`/account/2fa/disable`,{method:`POST`,body:JSON.stringify({password:e})}),recoveryCodes:e=>Z(`/account/2fa/recovery-codes`,{method:`POST`,body:JSON.stringify({password:e})})},meta:()=>Z(`/meta`),menuBadges:()=>Z(`/menu/badges`),dashboard:()=>Z(`/dashboard`),setAppearance:e=>Z(`/appearance`,{method:`PUT`,body:JSON.stringify({accent:e})}),widget:(e,t)=>Z(`/dashboard/${encodeURIComponent(e)}?${new URLSearchParams({...t})}`),tabCounts:e=>Z(`/resources/${encodeURIComponent(e)}/tab-counts`),rbac:{catalog:()=>Z(`/rbac/catalog`),roles:()=>Z(`/rbac/roles`),role:e=>Z(`/rbac/roles/${Bg(e)}`),createRole:e=>Z(`/rbac/roles`,{method:`POST`,body:JSON.stringify(e)}),updateRole:(e,t)=>Z(`/rbac/roles/${Bg(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteRole:e=>Z(`/rbac/roles/${Bg(e)}`,{method:`DELETE`}),exportRoles:()=>Z(`/rbac/roles/export`),importRoles:e=>Z(`/rbac/roles/import`,{method:`POST`,body:JSON.stringify(e)}),groups:()=>Z(`/rbac/groups`),group:e=>Z(`/rbac/groups/${e}`),saveGroup:(e,t)=>Z(t===void 0?`/rbac/groups`:`/rbac/groups/${t}`,{method:t===void 0?`POST`:`PATCH`,body:JSON.stringify(e)}),deleteGroup:e=>Z(`/rbac/groups/${e}`,{method:`DELETE`}),users:e=>Z(`/rbac/users?${new URLSearchParams(Object.entries(e).filter(([,e])=>e!==void 0&&e!==``).map(([e,t])=>[e,String(t)]))}`),user:e=>Z(`/rbac/users/${Bg(e)}`),createUser:e=>Z(`/rbac/users`,{method:`POST`,body:JSON.stringify(e)}),updateUser:(e,t)=>Z(`/rbac/users/${Bg(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),setPassword:(e,t)=>Z(`/rbac/users/${Bg(e)}/password`,{method:`POST`,body:JSON.stringify({password:t})}),resetTwoFactor:e=>Z(`/rbac/users/${Bg(e)}/2fa/reset`,{method:`POST`,body:`{}`}),explain:e=>Z(`/rbac/explain?${new URLSearchParams(Object.entries(e).filter(([,e])=>e!==void 0&&e!==``))}`)},upload:(e,t,n)=>kg(e,t,{apiBase:dg.apiBase,csrfToken:_g(),viewAs:Cg(),locale:Yh(),onSignedOut:yg},n),search:e=>Z(`/search?${new URLSearchParams({q:e})}`),schema:async e=>{let t=await Z(`/meta/resources/${Bg(e)}`);return Cg()?Ig(t):t},list:(e,t)=>Z(`/resources/${Bg(e)}?${t}`),remove:(e,t,n)=>Z(`/resources/${Bg(e)}/${Bg(t)}`,{method:`DELETE`,headers:Vg(n)}),options:(e,t,n)=>{let r=new URLSearchParams;return n.ids?r.set(`ids`,n.ids.join(`,`)):n.search&&r.set(`search`,n.search),n.values&&r.set(`values`,n.values),n.parent&&n.values&&r.set(`parent`,n.parent),Z(`/resources/${Bg(e)}/fields/${Bg(t)}/options${r.size?`?${r}`:``}`)},bulkDelete:(e,t)=>Z(`/resources/${Bg(e)}/bulk-delete`,{method:`POST`,body:JSON.stringify({ids:t})}),runAction:(e,t,n)=>Z(`/resources/${Bg(e)}/actions/${Bg(t)}`,{method:`POST`,body:JSON.stringify(n)}),page:async e=>{let t=await Z(`/pages/${Bg(e)}`);return Cg()?Lg(t):t},savePage:(e,t)=>Z(`/pages/${Bg(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),history:(e,t,n)=>Z(`/resources/${Bg(e)}/${Bg(t)}/history${n?`?${new URLSearchParams({before:n})}`:``}`),audit:(e,t)=>{let n=new URLSearchParams(e);return t&&n.set(`before`,t),Z(`/audit${n.size?`?${n}`:``}`)},restore:(e,t)=>Z(`/resources/${Bg(e)}/${Bg(t)}/restore`,{method:`POST`,body:`{}`}),get:(e,t)=>Z(`/resources/${Bg(e)}/${Bg(t)}`),create:(e,t)=>Z(`/resources/${Bg(e)}`,{method:`POST`,body:JSON.stringify(t)}),update:(e,t,n,r)=>Z(`/resources/${Bg(e)}/${Bg(t)}`,{method:`PATCH`,body:JSON.stringify(n),headers:Vg(r)})},Wg=()=>ft({queryKey:[`session`],queryFn:async()=>{let e=await Q.session();return gg(e.csrfToken),e},retry:!1,staleTime:3e5}),Gg=()=>{let{locale:e}=Y();return ft({queryKey:[`meta`,e],queryFn:Q.meta})},Kg=(e,t=!0)=>{let{locale:n}=Y();return ft({queryKey:[`schema`,e,n],queryFn:()=>Q.schema(e),enabled:t})},qg=e=>ft({queryKey:[`menu-badges`],queryFn:Q.menuBadges,enabled:e,refetchInterval:6e4,refetchOnWindowFocus:!0}),Jg=e=>{let{locale:t}=Y();return ft({queryKey:[`page`,e,t],queryFn:()=>Q.page(e)})},Yg=(e,t,n=!0)=>ft({queryKey:[`list`,e,t],queryFn:()=>Q.list(e,new URLSearchParams(t)),placeholderData:ue,enabled:n}),Xg=(e,t)=>ft({queryKey:[`record`,e,t],queryFn:()=>Q.get(e,t),enabled:t!==void 0}),Zg=(e,t,n,r,i,a)=>ft({queryKey:[`options`,e,t,n,i??``,a??``],queryFn:()=>Q.options(e,t,{search:n,values:i,parent:a}),enabled:r,placeholderData:ue}),Qg=(e,t,n)=>ft({queryKey:[`options`,e,t,`ids`,n],queryFn:()=>Q.options(e,t,{ids:n}),enabled:n.length>0}),$g=function(e,t){let n=e,r=t_[t],i=null,a=0,o=null,s=[],c={},l=function(e,t){a=n*4+17,i=function(e){let t=Array(e);for(let n=0;n<e;n+=1){t[n]=Array(e);for(let r=0;r<e;r+=1)t[n][r]=null}return t}(a),u(0,0),u(a-7,0),u(0,a-7),p(),f(),h(e,t),n>=7&&m(e),o??=v(n,r,s),g(o,t)},u=function(e,t){for(let n=-1;n<=7;n+=1)if(!(e+n<=-1||a<=e+n))for(let r=-1;r<=7;r+=1)t+r<=-1||a<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?i[e+n][t+r]=!0:i[e+n][t+r]=!1)},d=function(){let e=0,t=0;for(let n=0;n<8;n+=1){l(!0,n);let r=r_.getLostPoint(c);(n==0||e>r)&&(e=r,t=n)}return t},f=function(){for(let e=8;e<a-8;e+=1)i[e][6]??(i[e][6]=e%2==0);for(let e=8;e<a-8;e+=1)i[6][e]??(i[6][e]=e%2==0)},p=function(){let e=r_.getPatternPosition(n);for(let t=0;t<e.length;t+=1)for(let n=0;n<e.length;n+=1){let r=e[t],a=e[n];if(i[r][a]==null)for(let e=-2;e<=2;e+=1)for(let t=-2;t<=2;t+=1)e==-2||e==2||t==-2||t==2||e==0&&t==0?i[r+e][a+t]=!0:i[r+e][a+t]=!1}},m=function(e){let t=r_.getBCHTypeNumber(n);for(let n=0;n<18;n+=1){let r=!e&&(t>>n&1)==1;i[Math.floor(n/3)][n%3+a-8-3]=r}for(let n=0;n<18;n+=1){let r=!e&&(t>>n&1)==1;i[n%3+a-8-3][Math.floor(n/3)]=r}},h=function(e,t){let n=r<<3|t,o=r_.getBCHTypeInfo(n);for(let t=0;t<15;t+=1){let n=!e&&(o>>t&1)==1;t<6?i[t][8]=n:t<8?i[t+1][8]=n:i[a-15+t][8]=n}for(let t=0;t<15;t+=1){let n=!e&&(o>>t&1)==1;t<8?i[8][a-t-1]=n:t<9?i[8][15-t-1+1]=n:i[8][15-t-1]=n}i[a-8][8]=!e},g=function(e,t){let n=-1,r=a-1,o=7,s=0,c=r_.getMaskFunction(t);for(let t=a-1;t>0;t-=2)for(t==6&&--t;;){for(let n=0;n<2;n+=1)if(i[r][t-n]==null){let a=!1;s<e.length&&(a=(e[s]>>>o&1)==1),c(r,t-n)&&(a=!a),i[r][t-n]=a,--o,o==-1&&(s+=1,o=7)}if(r+=n,r<0||a<=r){r-=n,n=-n;break}}},_=function(e,t){let n=0,r=0,i=0,a=Array(t.length),o=Array(t.length);for(let s=0;s<t.length;s+=1){let c=t[s].dataCount,l=t[s].totalCount-c;r=Math.max(r,c),i=Math.max(i,l),a[s]=Array(c);for(let t=0;t<a[s].length;t+=1)a[s][t]=255&e.getBuffer()[t+n];n+=c;let u=r_.getErrorCorrectPolynomial(l),d=a_(a[s],u.getLength()-1).mod(u);o[s]=Array(u.getLength()-1);for(let e=0;e<o[s].length;e+=1){let t=e+d.getLength()-o[s].length;o[s][e]=t>=0?d.getAt(t):0}}let s=0;for(let e=0;e<t.length;e+=1)s+=t[e].totalCount;let c=Array(s),l=0;for(let e=0;e<r;e+=1)for(let n=0;n<t.length;n+=1)e<a[n].length&&(c[l]=a[n][e],l+=1);for(let e=0;e<i;e+=1)for(let n=0;n<t.length;n+=1)e<o[n].length&&(c[l]=o[n][e],l+=1);return c},v=function(e,t,n){let r=o_.getRSBlocks(e,t),i=s_();for(let t=0;t<n.length;t+=1){let r=n[t];i.put(r.getMode(),4),i.put(r.getLength(),r_.getLengthInBits(r.getMode(),e)),r.write(i)}let a=0;for(let e=0;e<r.length;e+=1)a+=r[e].dataCount;if(i.getLengthInBits()>a*8)throw`code length overflow. (`+i.getLengthInBits()+`>`+a*8+`)`;for(i.getLengthInBits()+4<=a*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=a*8||(i.put(236,8),i.getLengthInBits()>=a*8));)i.put(17,8);return _(i,r)};c.addData=function(e,t){t||=`Byte`;let n=null;switch(t){case`Numeric`:n=c_(e);break;case`Alphanumeric`:n=l_(e);break;case`Byte`:n=u_(e);break;case`Kanji`:n=d_(e);break;default:throw`mode:`+t}s.push(n),o=null},c.isDark=function(e,t){if(e<0||a<=e||t<0||a<=t)throw e+`,`+t;return i[e][t]},c.getModuleCount=function(){return a},c.make=function(){if(n<1){let e=1;for(;e<40;e++){let t=o_.getRSBlocks(e,r),n=s_();for(let t=0;t<s.length;t++){let r=s[t];n.put(r.getMode(),4),n.put(r.getLength(),r_.getLengthInBits(r.getMode(),e)),r.write(n)}let i=0;for(let e=0;e<t.length;e++)i+=t[e].dataCount;if(n.getLengthInBits()<=i*8)break}n=e}l(!1,d())},c.createTableTag=function(e,t){e||=2,t=t===void 0?e*4:t;let n=``;n+=`<table style="`,n+=` border-width: 0px; border-style: none;`,n+=` border-collapse: collapse;`,n+=` padding: 0px; margin: `+t+`px;`,n+=`">`,n+=`<tbody>`;for(let t=0;t<c.getModuleCount();t+=1){n+=`<tr>`;for(let r=0;r<c.getModuleCount();r+=1)n+=`<td style="`,n+=` border-width: 0px; border-style: none;`,n+=` border-collapse: collapse;`,n+=` padding: 0px; margin: 0px;`,n+=` width: `+e+`px;`,n+=` height: `+e+`px;`,n+=` background-color: `,n+=c.isDark(t,r)?`#000000`:`#ffffff`,n+=`;`,n+=`"/>`;n+=`</tr>`}return n+=`</tbody>`,n+=`</table>`,n},c.createSvgTag=function(e,t,n,r){let i={};typeof arguments[0]==`object`&&(i=arguments[0],e=i.cellSize,t=i.margin,n=i.alt,r=i.title),e||=2,t=t===void 0?e*4:t,n=typeof n==`string`?{text:n}:n||{},n.text=n.text||null,n.id=n.text?n.id||`qrcode-description`:null,r=typeof r==`string`?{text:r}:r||{},r.text=r.text||null,r.id=r.text?r.id||`qrcode-title`:null;let a=c.getModuleCount()*e+t*2,o,s,l,u,d=``,f;for(f=`l`+e+`,0 0,`+e+` -`+e+`,0 0,-`+e+`z `,d+=`<svg version="1.1" xmlns="http://www.w3.org/2000/svg"`,d+=i.scalable?``:` width="`+a+`px" height="`+a+`px"`,d+=` viewBox="0 0 `+a+` `+a+`" `,d+=` preserveAspectRatio="xMinYMin meet"`,d+=r.text||n.text?` role="img" aria-labelledby="`+y([r.id,n.id].join(` `).trim())+`"`:``,d+=`>`,d+=r.text?`<title id="`+y(r.id)+`">`+y(r.text)+`</title>`:``,d+=n.text?`<description id="`+y(n.id)+`">`+y(n.text)+`</description>`:``,d+=`<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>`,d+=`<path d="`,l=0;l<c.getModuleCount();l+=1)for(u=l*e+t,o=0;o<c.getModuleCount();o+=1)c.isDark(l,o)&&(s=o*e+t,d+=`M`+s+`,`+u+f);return d+=`" stroke="transparent" fill="black"/>`,d+=`</svg>`,d},c.createDataURL=function(e,t){e||=2,t=t===void 0?e*4:t;let n=c.getModuleCount()*e+t*2,r=t,i=n-t;return g_(n,n,function(t,n){if(r<=t&&t<i&&r<=n&&n<i){let i=Math.floor((t-r)/e),a=Math.floor((n-r)/e);return+!c.isDark(a,i)}return 1})},c.createImgTag=function(e,t,n){e||=2,t=t===void 0?e*4:t;let r=c.getModuleCount()*e+t*2,i=``;return i+=`<img`,i+=` src="`,i+=c.createDataURL(e,t),i+=`"`,i+=` width="`,i+=r,i+=`"`,i+=` height="`,i+=r,i+=`"`,n&&(i+=` alt="`,i+=y(n),i+=`"`),i+=`/>`,i};let y=function(e){let t=``;for(let n=0;n<e.length;n+=1){let r=e.charAt(n);switch(r){case`<`:t+=`&lt;`;break;case`>`:t+=`&gt;`;break;case`&`:t+=`&amp;`;break;case`"`:t+=`&quot;`;break;default:t+=r}}return t},b=function(e){e=e===void 0?2:e;let t=c.getModuleCount()*1+e*2,n=e,r=t-e,i,a,o,s,l,u={"██":`█`,"█ ":`▀`," █":`▄`," ":` `},d={"██":`▀`,"█ ":`▀`," █":` `," ":` `},f=``;for(i=0;i<t;i+=2){for(o=Math.floor((i-n)/1),s=Math.floor((i+1-n)/1),a=0;a<t;a+=1)l=`█`,n<=a&&a<r&&n<=i&&i<r&&c.isDark(o,Math.floor((a-n)/1))&&(l=` `),n<=a&&a<r&&n<=i+1&&i+1<r&&c.isDark(s,Math.floor((a-n)/1))?l+=` `:l+=`█`,f+=e<1&&i+1>=r?d[l]:u[l];f+=`
50
+ `},ld=0,ud=[];function dd(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),i=y.useState(ld++)[0],a=y.useState(Nu)[0],o=y.useRef(e);y.useEffect(function(){o.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=lu([e.lockRef.current],(e.shards||[]).map(od),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=y.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=id(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Zu(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Zu(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return rd(h,t,e,h===`h`?s:c,!0)},[]),c=y.useCallback(function(e){var n=e;if(ud.length&&ud[ud.length-1]===a){var r=`deltaY`in n?ad(n):id(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&sd(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(od).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=y.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:fd(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=y.useCallback(function(e){n.current=id(e),r.current=void 0},[]),d=y.useCallback(function(t){l(t.type,ad(t),t.target,s(t,e.lockRef.current))},[]),f=y.useCallback(function(t){l(t.type,id(t),t.target,s(t,e.lockRef.current))},[]);y.useEffect(function(){return ud.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Ku),document.addEventListener(`touchmove`,c,Ku),document.addEventListener(`touchstart`,u,Ku),function(){ud=ud.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Ku),document.removeEventListener(`touchmove`,c,Ku),document.removeEventListener(`touchstart`,u,Ku)}},[]);var p=e.removeScrollBar,m=e.inert;return y.createElement(y.Fragment,null,m?y.createElement(a,{styles:cd(i)}):null,p?y.createElement(Uu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function fd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var pd=Cu(wu,dd),md=y.forwardRef(function(e,t){return y.createElement(Eu,su({},e,{ref:t,sideCar:pd}))});md.classNames=Eu.classNames;var hd=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},gd=new WeakMap,_d=new WeakMap,vd={},yd=0,bd=function(e){return e&&(e.host||bd(e.parentNode))},xd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=bd(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Sd=function(e,t,n,r){var i=xd(t,Array.isArray(e)?e:[e]);vd[n]||(vd[n]=new WeakMap);var a=vd[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(gd.get(e)||0)+1,l=(a.get(e)||0)+1;gd.set(e,c),a.set(e,l),o.push(e),c===1&&i&&_d.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),yd++,function(){o.forEach(function(e){var t=gd.get(e)-1,i=a.get(e)-1;gd.set(e,t),a.set(e,i),t||(_d.has(e)||e.removeAttribute(r),_d.delete(e)),i||e.removeAttribute(n)}),yd--,yd||(gd=new WeakMap,gd=new WeakMap,_d=new WeakMap,vd={})}},Cd=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||hd(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Sd(r,i,n,`aria-hidden`)):function(){return null}},wd=Object.defineProperty,Td=(e,t)=>wd(e,`name`,{value:t,configurable:!0}),Ed=`Dialog`,[Dd,Od]=Pc(Ed),[kd,Ad]=Dd(Ed),jd=Td(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=y.useRef(null),c=y.useRef(null),[l,u]=$c({prop:r,defaultProp:i??!1,onChange:a,caller:Ed}),[d,f]=y.useState(0),[p,m]=y.useState(0);return(0,b.jsx)(kd,{scope:t,triggerRef:s,contentRef:c,contentId:_l(),titleId:_l(),descriptionId:_l(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:y.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Md=`DialogTrigger`,Nd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,...r}=e,i=Ad(Md,n),a=lc(t,i.triggerRef);return(0,b.jsx)(kc.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Zd(i.open),...r,ref:a,onClick:zc(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),Pd=`DialogPortal`,[Fd,Id]=Dd(Pd,{forceMount:void 0}),Ld=Td(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Ad(Pd,t);return(0,b.jsx)(Fd,{scope:t,forceMount:n,children:y.Children.map(r,e=>(0,b.jsx)(sl,{present:n||a.open,children:(0,b.jsx)($l,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Rd=`DialogOverlay`,zd=y.forwardRef(Td(function(e,t){let n=Id(Rd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ad(Rd,e.__scopeDialog);return a.modal?(0,b.jsx)(sl,{present:r||a.open,children:(0,b.jsx)(Vd,{...i,ref:t})}):null},`DialogOverlay`)),Bd=fc(`DialogOverlay.RemoveScroll`),Vd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,...r}=e,i=Ad(Rd,n),a=lc(t,kl());return(0,b.jsx)(md,{as:Bd,allowPinchZoom:!0,shards:[i.contentRef],children:(0,b.jsx)(kc.div,{"data-state":Zd(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Hd=`DialogContent`,Ud=y.forwardRef(Td(function(e,t){let n=Id(Hd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ad(Hd,e.__scopeDialog);return(0,b.jsx)(sl,{present:r||a.open,children:a.modal?(0,b.jsx)(Wd,{...i,ref:t}):(0,b.jsx)(Gd,{...i,ref:t})})},`DialogContent`)),Wd=y.forwardRef(Td(function(e,t){let n=Ad(Hd,e.__scopeDialog),r=y.useRef(null),i=lc(t,n.contentRef,r);return y.useEffect(()=>{let e=r.current;if(e)return Cd(e)},[]),(0,b.jsx)(Kd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:zc(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:zc(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:zc(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Gd=y.forwardRef(Td(function(e,t){let n=Ad(Hd,e.__scopeDialog),r=y.useRef(!1),i=y.useRef(!1);return(0,b.jsx)(Kd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Kd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Ad(Hd,n);return au(),(0,b.jsx)(b.Fragment,{children:(0,b.jsx)(Bl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,b.jsx)(Ol,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Zd(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),qd=`DialogTitle`,Jd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,...r}=e,i=Ad(qd,n),{setTitleCount:a}=i;return Wc(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,b.jsx)(kc.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Yd=`DialogClose`,Xd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,...r}=e,i=Ad(Yd,n);return(0,b.jsx)(kc.button,{type:`button`,...r,ref:t,onClick:zc(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Zd(e){return e?`open`:`closed`}Td(Zd,`getState`);var Qd=Object.defineProperty,$d=(e,t)=>Qd(e,`name`,{value:t,configurable:!0});function ef(e){let[t,n]=y.useState(void 0);return Wc(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}$d(ef,`useSize`);var tf=Object.defineProperty,nf=(e,t)=>tf(e,`name`,{value:t,configurable:!0}),rf=`Checkbox`,[af,of]=Pc(rf),[sf,cf]=af(rf);function lf(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=$c({prop:n,defaultProp:i??!1,onChange:c,caller:rf}),[m,h]=y.useState(null),[g,_]=y.useState(null),v=y.useRef(!1),[x,S]=y.useReducer(e=>e+1,0),C=!m||!!o||!!m.closest(`form`),w={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:x,onUserInteraction:S,required:l,defaultChecked:!vf(i)&&i,isFormControl:C,bubbleInput:g,setBubbleInput:_};return(0,b.jsx)(sf,{scope:t,...w,children:_f(d)?d(w):r})}nf(lf,`CheckboxProvider`);var uf=`CheckboxTrigger`,df=y.forwardRef(nf(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=cf(uf,e),g=lc(i,u),_=y.useRef(c);return y.useEffect(()=>{let e=a?.form;if(e){let t=nf(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,b.jsx)(kc.button,{type:`button`,role:`checkbox`,"aria-checked":vf(c)?`mixed`:c,"aria-required":l,"data-state":yf(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:zc(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:zc(n,e=>{p(),d(e=>vf(e)?!0:!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),ff=y.forwardRef(nf(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,b.jsx)(lf,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(df,{...d,ref:t,__scopeCheckbox:n}),e&&(0,b.jsx)(gf,{__scopeCheckbox:n})]})})},`Checkbox`)),pf=`CheckboxIndicator`,mf=y.forwardRef(nf(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=cf(pf,n);return(0,b.jsx)(sl,{present:r||vf(a.checked)||a.checked===!0,children:(0,b.jsx)(kc.span,{"data-state":yf(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),hf=`CheckboxBubbleInput`,gf=y.forwardRef(nf(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=cf(hf,e),g=lc(r,h),_=ef(i),v=y.useRef(!1),x=y.useRef(s),S=y.useRef(o);y.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==S.current;S.current=o;let i=x.current!==s;x.current=s;let c=!(r&&a.current);if(i&&n){v.current=!r;let t=new Event(`click`,{bubbles:c});e.indeterminate=vf(s),n.call(e,!vf(s)&&s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let C=y.useRef(!vf(s)&&s);return(0,b.jsx)(kc.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??C.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:zc(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function _f(e){return typeof e==`function`}nf(_f,`isFunction`);function vf(e){return e===`indeterminate`}nf(vf,`isIndeterminate`);function yf(e){return vf(e)?`indeterminate`:e?`checked`:`unchecked`}nf(yf,`getState`);var bf=[`top`,`right`,`bottom`,`left`],xf=Math.min,Sf=Math.max,Cf=Math.round,wf=Math.floor,Tf=e=>({x:e,y:e}),Ef={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Df(e,t,n){return Sf(e,xf(t,n))}function Of(e,t){return typeof e==`function`?e(t):e}function kf(e){return e.split(`-`)[0]}function Af(e){return e.split(`-`)[1]}function jf(e){return e===`x`?`y`:`x`}function Mf(e){return e===`y`?`height`:`width`}function Nf(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Pf(e){return jf(Nf(e))}function Ff(e,t,n){n===void 0&&(n=!1);let r=Af(e),i=Pf(e),a=Mf(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Wf(o)),[o,Wf(o)]}function If(e){let t=Wf(e);return[Lf(e),t,Lf(t)]}function Lf(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Rf=[`left`,`right`],zf=[`right`,`left`],Bf=[`top`,`bottom`],Vf=[`bottom`,`top`];function Hf(e,t,n){switch(e){case`top`:case`bottom`:return n?t?zf:Rf:t?Rf:zf;case`left`:case`right`:return t?Bf:Vf;default:return[]}}function Uf(e,t,n,r){let i=Af(e),a=Hf(kf(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Lf)))),a}function Wf(e){let t=kf(e);return Ef[t]+e.slice(t.length)}function Gf(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Kf(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Gf(e)}function qf(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function K(e,t,n){let{reference:r,floating:i}=e,a=Nf(t),o=Pf(t),s=Mf(o),c=kf(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Af(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Jf(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Of(t,e),p=Kf(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=qf(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=qf(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Yf=50,Xf=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Jf},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=K(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Yf&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=K(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Zf=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Of(e,t)||{};if(l==null)return{};let d=Kf(u),f={x:n,y:r},p=Pf(i),m=Mf(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=xf(d[_],T),D=xf(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=Df(E,k,O),j=!c.arrow&&Af(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Qf=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Of(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=kf(r),_=Nf(o),v=kf(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Wf(o)]:If(o)),x=p!==`none`;!d&&x&&b.push(...Uf(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ff(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Nf(t)||T.every(e=>Nf(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Nf(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function $f(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ep(e){return bf.some(t=>e[t]>=0)}var tp=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Of(e,t);switch(i){case`referenceHidden`:{let e=$f(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ep(e)}}}case`escaped`:{let e=$f(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ep(e)}}}default:return{}}}}},np=new Set([`left`,`top`]);async function rp(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=kf(n),s=Af(n),c=Nf(n)===`y`,l=np.has(o)?-1:1,u=a&&c?-1:1,d=Of(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ip=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await rp(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ap=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Of(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Nf(i),p=jf(f),m=u[p],h=u[f],g=(e,t)=>Df(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},op=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Of(e,t),u={x:n,y:r},d=Nf(i),f=jf(d),p=u[f],m=u[d],h=Of(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=np.has(kf(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},sp=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Of(e,t),c=await i.detectOverflow(t,s),l=kf(n),u=Af(n),d=Nf(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=xf(p-c[m],g),y=xf(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Sf(c.left,c.right):S=p-2*Sf(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function cp(){return typeof window<`u`}function lp(e){return fp(e)?(e.nodeName||``).toLowerCase():`#document`}function up(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dp(e){return((fp(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function fp(e){return cp()?e instanceof Node||e instanceof up(e).Node:!1}function pp(e){return cp()?e instanceof Element||e instanceof up(e).Element:!1}function mp(e){return cp()?e instanceof HTMLElement||e instanceof up(e).HTMLElement:!1}function hp(e){return!cp()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof up(e).ShadowRoot}function gp(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Dp(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function _p(e){return/^(table|td|th)$/.test(lp(e))}function vp(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var yp=/transform|translate|scale|rotate|perspective|filter/,bp=/paint|layout|strict|content/,xp=e=>!!e&&e!==`none`,Sp;function Cp(e){let t=pp(e)?Dp(e):e;return xp(t.transform)||xp(t.translate)||xp(t.scale)||xp(t.rotate)||xp(t.perspective)||!Tp()&&(xp(t.backdropFilter)||xp(t.filter))||yp.test(t.willChange||``)||bp.test(t.contain||``)}function wp(e){let t=kp(e);for(;mp(t)&&!Ep(t);){if(Cp(t))return t;if(vp(t))return null;t=kp(t)}return null}function Tp(){return Sp??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Sp}function Ep(e){return/^(html|body|#document)$/.test(lp(e))}function Dp(e){return up(e).getComputedStyle(e)}function Op(e){return pp(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function kp(e){if(lp(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||hp(e)&&e.host||dp(e);return hp(t)?t.host:t}function Ap(e){let t=kp(e);return Ep(t)?(e.ownerDocument||e).body:mp(t)&&gp(t)?t:Ap(t)}function jp(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ap(e),i=r===e.ownerDocument?.body,a=up(r);if(i){let e=Mp(a);return t.concat(a,a.visualViewport||[],gp(r)?r:[],e&&n?jp(e):[])}return t.concat(r,jp(r,[],n))}function Mp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Np(e){let t=Dp(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=mp(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Cf(n)!==a||Cf(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Pp(e){return pp(e)?e:e.contextElement}function Fp(e){let t=Pp(e);if(!mp(t))return Tf(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Np(t),o=(a?Cf(n.width):n.width)/r,s=(a?Cf(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ip=Tf(0);function Lp(e){let t=up(e);return!Tp()||!t.visualViewport?Ip:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Rp(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===up(e)}function zp(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Pp(e),o=Tf(1);t&&(r?pp(r)&&(o=Fp(r)):o=Fp(e));let s=Rp(a,n,r)?Lp(a):Tf(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=up(a),t=pp(r)?up(r):r,n=e,i=Mp(n);for(;i&&t!==n;){let e=Fp(i),t=i.getBoundingClientRect(),r=Dp(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=up(i),i=Mp(n)}}return qf({width:u,height:d,x:c,y:l})}function Bp(e,t){let n=Op(e).scrollLeft;return t?t.left+n:zp(dp(e)).left+n}function Vp(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Bp(e,n),y:n.top+t.scrollTop}}function Hp(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=dp(r),s=t?vp(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Tf(1),u=Tf(0),d=mp(r);if((d||!a)&&((lp(r)!==`body`||gp(o))&&(c=Op(r)),d)){let e=zp(r);l=Fp(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Vp(o,c):Tf(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Up(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Wp(e){let t=Op(e),n=e.ownerDocument.body,r=Sf(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Sf(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Bp(e),o=-t.scrollTop;return Dp(n).direction===`rtl`&&(a+=Sf(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Gp=25;function Kp(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=up(e),a=dp(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Tp()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Bp(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Gp&&(s-=o)}return{width:s,height:c,x:l,y:u}}function qp(e,t){let n=zp(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Fp(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Jp(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Kp(e,n,t);else if(t===`document`)r=Wp(dp(e));else if(pp(t))r=qp(t,n);else{let n=Lp(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return qf(r)}function Yp(e,t){let n=t.get(e);if(n)return n;let r=jp(e,[],!1).filter(e=>pp(e)&&lp(e)!==`body`),i=null,a=Dp(e).position===`fixed`,o=a?kp(e):e;for(;pp(o)&&!Ep(o);){let e=Dp(o),t=Cp(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=kp(o)}return t.set(e,r),r}function Xp(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?vp(t)?[]:Yp(t,this._c):[].concat(n),r],o=Jp(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Jp(t,a[e],i);s=Sf(n.top,s),c=xf(n.right,c),l=xf(n.bottom,l),u=Sf(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Zp(e){let{width:t,height:n}=Np(e);return{width:t,height:n}}function Qp(e,t,n){let r=mp(t),i=dp(t),a=n===`fixed`,o=zp(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Tf(0);if((r||!a)&&((lp(t)!==`body`||gp(i))&&(s=Op(t)),r)){let e=zp(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Bp(i));let l=i&&!r&&!a?Vp(i,s):Tf(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function $p(e){return Dp(e).position===`static`}function em(e,t){if(!mp(e)||Dp(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return dp(e)===n&&(n=n.ownerDocument.body),n}function tm(e,t){let n=up(e);if(vp(e))return n;if(!mp(e)){let t=kp(e);for(;t&&!Ep(t);){if(pp(t)&&!$p(t))return t;t=kp(t)}return n}let r=em(e,t);for(;r&&_p(r)&&$p(r);)r=em(r,t);return r&&Ep(r)&&$p(r)&&!Cp(r)?n:r||wp(e)||n}var nm=async function(e){let t=this.getOffsetParent||tm,n=this.getDimensions,r=await n(e.floating);return{reference:Qp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function rm(e){return Dp(e).direction===`rtl`}var im={convertOffsetParentRelativeRectToViewportRelativeRect:Hp,getDocumentElement:dp,getClippingRect:Xp,getOffsetParent:tm,getElementRects:nm,getClientRects:Up,getDimensions:Zp,getScale:Fp,isElement:pp,isRTL:rm};function am(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function om(e,t,n){let r=null,i,a=dp(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=wf(d),h=wf(a.clientWidth-(u+f)),g=wf(a.clientHeight-(d+p)),_=wf(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Sf(0,xf(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!am(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=up(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function sm(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Pp(e),u=i||a?[...l?jp(l):[],...t?jp(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?om(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?zp(e):null;c&&g();function g(){let t=zp(e);h&&!am(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var cm=ip,lm=ap,um=Qf,dm=sp,fm=tp,pm=Zf,mm=op,hm=(e,t,n)=>{let r=new Map,i=n??{},a={...im,...i.platform,_c:r};return Xf(e,t,{...i,platform:a})},gm=typeof document<`u`?y.useLayoutEffect:function(){};function _m(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!_m(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!_m(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function vm(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ym(e,t){let n=vm(e);return Math.round(t*n)/n}function bm(e){let t=y.useRef(e);return gm(()=>{t.current=e}),t}function xm(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=y.useState(r);_m(f,r)||p(r);let[m,h]=y.useState(null),[g,_]=y.useState(null),v=y.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=y.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=y.useRef(null),w=y.useRef(null),T=y.useRef(u),E=c!=null,D=bm(c),O=bm(i),k=bm(l),A=y.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),hm(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!_m(T.current,t)&&(T.current=t,Ec.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);gm(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=y.useRef(!1);gm(()=>(j.current=!0,()=>{j.current=!1}),[]),gm(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=y.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:b}),[v,b]),N=y.useMemo(()=>({reference:x,floating:S}),[x,S]),ee=y.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=ym(N.floating,u.x),r=ym(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...vm(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:ee}),[u,A,M,N,ee])}var Sm=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:pm({element:r.current,padding:i}).fn(n):r?pm({element:r,padding:i}).fn(n):{}}}},Cm=(e,t)=>{let n=cm(e);return{name:n.name,fn:n.fn,options:[e,t]}},wm=(e,t)=>{let n=lm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tm=(e,t)=>({fn:mm(e).fn,options:[e,t]}),Em=(e,t)=>{let n=um(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dm=(e,t)=>{let n=dm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Om=(e,t)=>{let n=fm(e);return{name:n.name,fn:n.fn,options:[e,t]}},km=(e,t)=>{let n=Sm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Am=Object.defineProperty,jm=(e,t)=>Am(e,`name`,{value:t,configurable:!0}),Mm=`Popper`,[Nm,Pm]=Pc(Mm),[Fm,Im]=Nm(Mm),Lm=jm(e=>{let{__scopePopper:t,children:n}=e,[r,i]=y.useState(null),[a,o]=y.useState(void 0);return(0,b.jsx)(Fm,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Rm=`PopperAnchor`,zm=y.forwardRef(jm(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Im(Rm,n),o=y.useRef(null),s=a.onAnchorChange,c=lc(t,y.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=y.useRef(null);y.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&Km(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,b.jsx)(kc.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),Bm=`PopperContent`,[Vm,Hm]=Nm(Bm),Um=y.forwardRef(jm(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Im(Bm,n),[_,v]=y.useState(null),x=lc(t,v),[S,C]=y.useState(null),w=ef(S),T=w?.width??0,E=w?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],A=k.length>0,j={padding:O,boundary:k.filter(Wm),altBoundary:A},{refs:M,floatingStyles:N,placement:ee,isPositioned:P,middlewareData:F}=xm({strategy:`fixed`,placement:D,whileElementsMounted:jm((...e)=>sm(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[Cm({mainAxis:i+E,alignmentAxis:o}),c&&wm({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Tm():void 0,...j}),c&&Em({...j}),Dm({...j,apply:jm(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),S&&km({element:S,padding:s}),Gm({arrowWidth:T,arrowHeight:E}),f&&Om({strategy:`referenceHidden`,...j,boundary:A?j.boundary:void 0})]}),te=g.setPlacementState;Wc(()=>(te(ee),()=>{te(void 0)}),[ee,te]);let[ne,re]=Km(ee),ie=bl(m);Wc(()=>{P&&ie?.()},[P,ie]);let ae=F.arrow?.x,oe=F.arrow?.y,se=F.arrow?.centerOffset!==0,[ce,le]=y.useState();return Wc(()=>{_&&le(window.getComputedStyle(_).zIndex)},[_]),(0,b.jsx)(`div`,{ref:M.setFloating,"data-radix-popper-content-wrapper":``,style:{...N,transform:P?N.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ce,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,b.jsx)(Vm,{scope:n,placedSide:ne,placedAlign:re,onArrowChange:C,arrowX:ae,arrowY:oe,shouldHideArrow:se,children:(0,b.jsx)(kc.div,{"data-side":ne,"data-align":re,...h,ref:x,style:{...h.style,animation:P?h.style?.animation:`none`}})})})},`PopperContent`));function Wm(e){return e!==null}jm(Wm,`isNotNull`);var Gm=jm(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Km(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Km(e){let[t,n=`center`]=e.split(`-`);return[t,n]}jm(Km,`getSideAndAlignFromPlacement`);var qm=Lm,Jm=zm,Ym=Um,Xm=Object.defineProperty,Zm=y.forwardRef(((e,t)=>Xm(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,b.jsx)(kc.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),Qm=Object.defineProperty,$m=(e,t)=>Qm(e,`name`,{value:t,configurable:!0}),eh=`Popover`,[th,nh]=Pc(eh,[Pm]),rh=Pm(),[ih,ah]=th(eh),oh=$m(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=rh(t),c=y.useRef(null),[l,u]=y.useState(!1),[d,f]=$c({prop:r,defaultProp:i??!1,onChange:a,caller:eh});return(0,b.jsx)(qm,{...s,children:(0,b.jsx)(ih,{scope:t,contentId:_l(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:y.useCallback(()=>u(!0),[]),onCustomAnchorRemove:y.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),sh=`PopoverTrigger`,ch=y.forwardRef($m(function(e,t){let{__scopePopover:n,...r}=e,i=ah(sh,n),a=rh(n),o=lc(t,i.triggerRef),s=(0,b.jsx)(kc.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":xh(i.open),...r,ref:o,onClick:zc(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,b.jsx)(Jm,{asChild:!0,...a,children:s})},`PopoverTrigger`)),lh=`PopoverPortal`,[uh,dh]=th(lh,{forceMount:void 0}),fh=$m(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=ah(lh,t);return(0,b.jsx)(uh,{scope:t,forceMount:n,children:(0,b.jsx)(sl,{present:n||a.open,children:(0,b.jsx)($l,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),ph=`PopoverContent`,mh=y.forwardRef($m(function(e,t){let n=dh(ph,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=ah(ph,e.__scopePopover);return(0,b.jsx)(sl,{present:r||a.open,children:a.modal?(0,b.jsx)(gh,{...i,ref:t}):(0,b.jsx)(_h,{...i,ref:t})})},`PopoverContent`)),hh=fc(`PopoverContent.RemoveScroll`),gh=y.forwardRef($m(function(e,t){let n=ah(ph,e.__scopePopover),r=y.useRef(null),i=lc(t,r),a=y.useRef(!1);return y.useEffect(()=>{let e=r.current;if(e)return Cd(e)},[]),(0,b.jsx)(md,{as:hh,allowPinchZoom:!0,children:(0,b.jsx)(vh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:zc(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:zc(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:zc(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),_h=y.forwardRef($m(function(e,t){let n=ah(ph,e.__scopePopover),r=y.useRef(!1),i=y.useRef(!1);return(0,b.jsx)(vh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),vh=y.forwardRef($m(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=ah(ph,n),p=rh(n);return au(),(0,b.jsx)(Bl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,b.jsx)(Ol,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,b.jsx)(Ym,{"data-state":xh(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`)),yh=`PopoverClose`,bh=y.forwardRef($m(function(e,t){let{__scopePopover:n,...r}=e,i=ah(yh,n);return(0,b.jsx)(kc.button,{type:`button`,...r,ref:t,onClick:zc(e.onClick,()=>i.onOpenChange(!1))})},`PopoverClose`));function xh(e){return e?`open`:`closed`}$m(xh,`getState`);var Sh=oh,Ch=ch,wh=fh,Th=mh,Eh=bh,Dh=ic(`group/button inline-flex shrink-0 items-center justify-center rounded-control border border-transparent bg-clip-padding text-[13px] font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 cursor-pointer`,{variants:{variant:{default:`border-primary bg-primary text-primary-foreground hover:opacity-92`,outline:`border-input bg-card hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`border-input bg-card text-bad hover:bg-muted focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 gap-1.5 px-3.5 has-data-[icon=inline-end]:pe-3 has-data-[icon=inline-start]:ps-3`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1.5 px-2.5 text-[12.5px] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2`,icon:`size-9`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8 in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function q({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?pc:`button`;return(0,b.jsx)(a,{"data-slot":`button`,"data-variant":t,"data-size":n,className:W(Dh({variant:t,size:n,className:e})),...i})}function Oh({className:e,type:t,...n}){return(0,b.jsx)(`input`,{type:t,"data-slot":`input`,className:W(`h-9 w-full min-w-0 rounded-control border border-input bg-card px-3 py-1 text-[13px] transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function kh({className:e,...t}){return(0,b.jsx)(Zm,{"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})}var Ah=`۰۱۲۳۴۵۶۷۸۹`,jh=`٠١٢٣٤٥٦٧٨٩`;function Mh(e){return e.replace(/[۰-۹٠-٩]/g,e=>String(Math.max(Ah.indexOf(e),jh.indexOf(e))))}function Nh(e){return Mh(e).replace(/٫/g,`.`).replace(/٬/g,`,`)}function Ph(e){return e.replace(/[0-9]/g,e=>Ah[Number(e)])}function Fh(e){return Ph(e).replace(/\./g,`٫`).replace(/,/g,`٬`)}var Ih=`nma.calendar`,Lh=`nma.digits`;function Rh(e){try{return localStorage.getItem(e)}catch{return null}}function zh(e){let t=Rh(Ih),n=Rh(Lh);return{calendar:t===`gregorian`||t===`persian`?t:e.split(`-`)[0]===`fa`?`persian`:`gregorian`,digits:n===`latn`||n===`arabext`?n:e.split(`-`)[0]===`fa`?`arabext`:`latn`}}function Bh(e){try{e.calendar&&localStorage.setItem(Ih,e.calendar),e.digits&&localStorage.setItem(Lh,e.digits)}catch{}}var Vh={"common.loading":`Loading…`,"common.yes":`Yes`,"common.no":`No`,"common.empty":`—`,"common.all":`All`,"common.cancel":`Cancel`,"common.pageNotFound":`Page not found.`,"common.requestFailed":`Request failed ({status})`,"common.reference":`{message} (reference: {id})`,"shell.adminPanel":`Admin panel`,"palette.move":`Move`,"palette.openItem":`Open`,"palette.close":`Close`,"shell.menu":`Menu`,"shell.closeMenu":`Close menu`,"shell.resources":`Resources`,"shell.filterResources":`Filter resources`,"shell.pinned":`Pinned`,"shell.recent":`Recent`,"shell.pin":`Pin {name}`,"shell.unpin":`Unpin {name}`,"shell.collapseGroup":`Collapse {name}`,"shell.expandGroup":`Expand {name}`,"shell.collapseSidebar":`Collapse sidebar`,"shell.expandSidebar":`Expand sidebar`,"shell.breadcrumbs":`Breadcrumbs`,"shell.home":`Home`,"shell.dashboard":`Dashboard`,"shell.noMatches":`No resources match.`,"shell.theme":`Theme`,"shell.themeLight":`Light`,"shell.themeDark":`Dark`,"shell.themeSystem":`System`,"shell.language":`Language`,"shell.noResources":`No admin resources are registered yet. Decorate a provider with @AdminResource.`,"shell.records":`{count} records`,"shell.aboutRecords":`about {count} records`,"list.select":`Select`,"list.done":`Done`,"list.loadMore":`Load more`,"list.showing":`{shown} shown`,"list.showingOf":`{shown} of {total}`,"list.new":`New`,"list.trash":`Trash`,"list.trashNote":`Records in the trash. Restore one to edit it again.`,"list.restore":`Restore`,"list.restoreRecord":`Restore {name}`,"list.actions":`Actions`,"list.noMatches":`No records match.`,"list.noRecords":`No records yet.`,"list.total":`{count} total`,"list.about":`about {count}`,"list.page":`Page {page}`,"list.pageOf":`Page {page} of {pages}`,"list.range":`Showing {from} to {to} of {total}`,"list.rowsPerPage":`Rows per page`,"list.toggleRow":`{column}: {name}`,"list.previousPage":`Previous page`,"list.nextPage":`Next page`,"list.columns":`Columns`,"list.density":`Density`,"list.comfortable":`Comfortable`,"list.compact":`Compact`,"list.moveUp":`Move {name} up`,"list.moveDown":`Move {name} down`,"list.resetColumns":`Reset columns`,"list.resize":`Resize {name}`,"list.retry":`Try again`,"list.loadFailed":`The list could not be loaded.`,"list.selectPage":`Select all on this page`,"list.selectRow":`Select {name}`,"print.open":`Print {name}`,"list.export":`Export to Excel`,"list.exporting":`Exporting…`,"list.exportTruncated":`Only the first {count} rows were exported.`,"list.exportDone":`{file} downloaded.`,"list.selected":`{count} selected`,"list.deleteSelected":`Delete selected`,"list.confirmDeleteSelected":`Delete {count}`,"list.clearSelection":`Clear selection`,"list.bulkDeleted":`{count} deleted`,"list.bulkFailed":`{count} failed`,"list.quickView":`Quick view: {name}`,"list.edit":`Edit`,"list.close":`Close`,"list.editCell":`Edit {name}: {value}`,"action.running":`Running…`,"action.confirm":`Run “{action}”?`,"action.confirmRecord":`Run “{action}” on {name}?`,"action.confirmSelected":`Run “{action}” on {count} records?`,"action.eachNote":`Each of the {count} records is handled on its own: one that fails does not stop the others.`,"action.atomicNote":`All or nothing: if one of the {count} records fails, none is changed.`,"action.done":`“{action}” done.`,"action.doneGone":`“{action}” done. The record is no longer in your view.`,"action.bulkDone":`{action}: {count} done`,"action.saveFirst":`Save or discard your changes first.`,"action.more":`More actions`,"toast.region":`Notifications`,"toast.dismiss":`Dismiss`,"settings.viewOnly":`You can view these settings but not change them.`,"settings.discard":`Discard changes`,"secret.set":`Set`,"secret.notSet":`Not set`,"secret.replace":`Replace`,"secret.replaceName":`Replace {name}`,"secret.clear":`Clear`,"secret.clearName":`Clear {name}`,"secret.keep":`Keep the current value`,"secret.willClear":`Will be cleared when you save.`,"secret.undo":`Undo`,"filters.search":`Search`,"filters.searchIn":`Search {fields}`,"filters.filtersAndSort":`Filters and sort`,"filters.showResults":`Show results`,"filters.sortBy":`Sort by`,"filters.ascending":`{name}, ascending`,"filters.descending":`{name}, descending`,"filters.filters":`Filters`,"filters.clear":`Clear filters`,"filters.from":`From`,"filters.to":`To`,"filters.contains":`{field} contains`,"filters.empty":`empty`,"filters.notEmpty":`not empty`,"filters.not":`not `,"filters.removeChip":`Remove filter {label}`,"filters.active":`Active filters`,"filters.any":`Any`,"filters.onlyEmpty":`Empty`,"filters.hideEmpty":`Not empty`,"filters.emptyValues":`{field}: empty values`,"filters.selected":`{count} selected`,"date.placeholder":`yyyy/mm/dd`,"date.openCalendar":`Choose {name} from a calendar`,"date.calendar":`{name} calendar`,"date.previous":`Previous`,"date.next":`Next`,"date.chooseMonth":`Choose a month`,"date.chooseYear":`Choose a year`,"date.today":`Today`,"date.clear":`Clear`,"date.time":`{name} time`,"auth.title":`Sign in`,"auth.username":`Username`,"auth.password":`Password`,"auth.signIn":`Sign in`,"auth.signingIn":`Signing in…`,"auth.required":`Enter your username and password.`,"auth.failed":`Signing in failed. Try again.`,"auth.userMenu":`Account menu for {name}`,"auth.account":`Account`,"auth.signOut":`Sign out`,"auth.changePassword":`Change password`,"auth.currentPassword":`Current password`,"auth.newPassword":`New password`,"auth.confirmPassword":`New password again`,"auth.mismatch":`does not match the new password`,"auth.passwordChanged":`Password changed. Your other sessions were signed out.`,"auth.sessions":`Signed-in devices`,"auth.signOutOthers":`Sign out everywhere else`,"auth.thisDevice":`This device`,"auth.unknownDevice":`Unknown device`,"auth.lastSeen":`Last active {when}`,"auth.revoke":`Sign out`,"auth.revokeSession":`Sign out {name}`,"rbac.administration":`Administration`,"rbac.users":`Users`,"rbac.groups":`Groups`,"rbac.roles":`Roles`,"rbac.user":`User`,"rbac.group":`Group`,"rbac.role":`Role`,"rbac.newUser":`New user`,"rbac.newGroup":`New group`,"rbac.newRole":`New role`,"rbac.createUser":`Create user`,"rbac.export":`Export`,"rbac.import":`Import`,"rbac.importFile":`Roles file to import`,"rbac.imported":`{count} roles imported.`,"rbac.notJson":`That file is not JSON.`,"rbac.permissionCount":`{count} permissions`,"rbac.system":`System`,"rbac.systemNote":`This role is defined in code: change it there.`,"rbac.name":`Name`,"rbac.labelIn":`Label ({language})`,"rbac.matrix":`Permissions`,"rbac.resource":`Resource`,"rbac.op.view":`View`,"rbac.op.create":`Create`,"rbac.op.update":`Change`,"rbac.op.delete":`Delete`,"rbac.op.purge":`Purge`,"rbac.grant":`{operation} {resource}`,"rbac.details":`Fields and scopes of {resource}`,"rbac.fields":`Fields`,"rbac.restricted":`restricted`,"rbac.fieldRule":`Access to {field}`,"rbac.rule.default":`As the permissions allow`,"rbac.rule.defaultHidden":`Hidden (restricted)`,"rbac.rule.hidden":`Hidden`,"rbac.rule.readonly":`Read-only`,"rbac.rule.edit":`Editable`,"rbac.scopes":`Rows`,"rbac.allRows":`all rows`,"rbac.custom":`Other permissions`,"rbac.global":`General permissions`,"rbac.actions":`Actions`,"rbac.actionNote":`Actions on records also need Change.`,"rbac.pages":`Settings pages`,"rbac.page":`Page`,"rbac.viewImplied":`Whoever may change a page may view it.`,"rbac.noGroups":`No groups yet.`,"rbac.groupSummary":`{roles} roles · {members} members`,"rbac.members":`Members`,"rbac.noMembers":`No members yet.`,"rbac.addMember":`Add a member`,"rbac.searchUsers":`Search users`,"rbac.searchResults":`Matching users`,"rbac.usersFromMemberships":`Your sign-in adapter cannot list users: these are the users that have roles or groups here.`,"rbac.superuser":`Superuser`,"rbac.superuserNote":`Only superusers can change a superuser.`,"rbac.inactive":`Inactive`,"rbac.active":`Active`,"rbac.displayName":`Display name`,"rbac.email":`Email`,"rbac.saved":`Saved.`,"rbac.setPassword":`Set password`,"rbac.setPasswordNote":`The user is signed out everywhere.`,"rbac.passwordSet":`Password set; the user was signed out everywhere.`,"auth.otpTitle":`Two-step verification`,"auth.otp":`Code`,"auth.otpHelp":`Enter the 6-digit code from your authenticator app, or one of your recovery codes.`,"auth.verify":`Verify`,"auth.otpRequired":`Enter the code.`,"auth.startOver":`Use another account`,"twoFactor.title":`Two-factor sign-in`,"twoFactor.on":`On`,"twoFactor.off":`Off`,"twoFactor.intro":`Ask for a code from an authenticator app after the password.`,"twoFactor.setUp":`Set up`,"twoFactor.scan":`Scan the code with your authenticator app, or type the key into it. Then enter the code the app shows.`,"twoFactor.qr":`QR code for your authenticator app`,"twoFactor.key":`Key`,"twoFactor.code":`Code from the app`,"twoFactor.turnOn":`Turn on`,"twoFactor.recoveryTitle":`Recovery codes`,"twoFactor.recoveryIntro":`Keep these somewhere safe. Each one signs you in once if you lose your device. They are not shown again.`,"twoFactor.copy":`Copy codes`,"twoFactor.copied":`Copied`,"twoFactor.done":`I saved them`,"twoFactor.left":`{count} unused recovery codes.`,"twoFactor.newCodes":`New recovery codes`,"twoFactor.turnOff":`Turn off`,"twoFactor.password":`Your password`,"twoFactor.enabledNote":`Two-factor sign-in is on. Your other sessions were signed out.`,"twoFactor.disabledNote":`Two-factor sign-in is off.`,"viewAs.start":`View as this user`,"viewAs.banner":`Viewing as {name}. Read-only.`,"viewAs.stop":`Stop viewing`,"rbac.twoFactor":`2FA`,"rbac.resetTwoFactor":`Reset two-factor sign-in`,"rbac.resetTwoFactorNote":`Turns off their second factor (a lost phone) and signs them out everywhere.`,"rbac.twoFactorReset":`Two-factor sign-in is off for this user.`,"debugger.title":`Permission debugger`,"debugger.intro":`Why a user can or cannot see and change things.`,"debugger.user":`User`,"debugger.resource":`Resource`,"debugger.record":`Record id (optional)`,"debugger.explain":`Explain`,"debugger.pick":`Choose a user and a resource.`,"debugger.roles":`Roles`,"debugger.noRoles":`No roles: nothing is allowed.`,"debugger.superuser":`A superuser may do everything.`,"debugger.source.direct":`assigned directly`,"debugger.source.group":`through group {group}`,"debugger.source.resolveRoles":`from resolveRoles`,"debugger.source.adapter":`from the sign-in adapter`,"debugger.unknownRole":`not a role, grants nothing`,"debugger.operations":`Operations`,"debugger.allowed":`Allowed`,"debugger.denied":`Denied`,"debugger.noGrant":`No role grants it`,"debugger.viaUpdate":`{pattern} in {role} (changing implies viewing)`,"debugger.grant":`{pattern} in {role}`,"debugger.fields":`Fields`,"debugger.field":`Field`,"debugger.result":`Result`,"debugger.byRole":`Per role`,"debugger.forced":`Always shown: keys and the version`,"debugger.scopes":`Rows`,"debugger.allRows":`All rows`,"debugger.noRows":`No rows`,"debugger.someRows":`Rows of {scopes}`,"debugger.globalScopes":`Also limited by {scopes}`,"debugger.recordTitle":`Record {id}`,"debugger.reason.permission":`no permission`,"debugger.reason.scope":`outside their rows`,"debugger.reason.rule":`a rule on this record says no`,"debugger.reason.missing":`no such record`,"debugger.actions":`Actions`,"debugger.needsUpdate":`actions on records also need Change`,"debugger.noRecordActions":`none on this record`,"debugger.pages":`Settings pages`,"audit.title":`Audit log`,"audit.history":`History`,"audit.details":`Details`,"audit.recordTabs":`Record and its history`,"audit.entries":`Recorded changes`,"audit.notAllowed":`You may not read the audit log`,"audit.off":`The audit log is not enabled in this admin`,"audit.empty":`Nothing has been recorded yet.`,"audit.noMatches":`No entries match.`,"audit.noActor":`Nobody signed in`,"audit.viewAsBy":`while user {id} was viewing as them`,"audit.filterByActor":`Show only what {name} did`,"audit.changedFields":`Changed fields`,"audit.before":`Before`,"audit.after":`After`,"audit.becomes":`became`,"audit.field.changed":`changed`,"audit.field.hidden":`hidden`,"audit.field.dropped":`too large to keep`,"audit.field.truncated":`cut short`,"audit.showMore":`Show more`,"audit.showLess":`Show less`,"audit.input":`Input`,"audit.inputTruncated":`The input was too large to keep.`,"audit.restrictedRecord":`A record you cannot see: its details are withheld.`,"audit.restrictedChanges":`You may not see what was changed.`,"audit.suppressedNote":`They came in the same minute and were not recorded one by one.`,"audit.limitedNote":`Further failures in this minute are only counted.`,"audit.actionDeleted":`The action deleted the record.`,"audit.filter.actor":`Actor (user id)`,"audit.filter.event":`Event`,"audit.filter.eventHint":`order.updated or auth.*`,"audit.filter.resource":`Resource`,"audit.filter.record":`Record id`,"audit.filter.recordHint":`Choose a resource first`,"audit.event.unseen":`A change you cannot see`,"audit.event.created":`Created`,"audit.event.updated":`Changed`,"audit.event.deleted":`Deleted`,"audit.event.trashed":`Moved to trash`,"audit.event.restored":`Restored`,"audit.event.purged":`Deleted for good`,"audit.event.action":`Ran “{action}”`,"audit.event.page":`Changed {page}`,"audit.event.login":`Signed in`,"audit.event.logout":`Signed out`,"audit.event.loginFailed":`Failed sign-in`,"audit.event.loginFailedCode":`Failed sign-in: wrong two-factor code`,"audit.event.loginFailedLimited":`Failed sign-in: too many attempts`,"audit.event.loginFailedMore":`{count} more failed sign-ins`,"audit.event.viewAs":`Viewed the admin as a user`,"audit.event.roleChanged":`Role changed`,"audit.event.groupChanged":`Group changed`,"audit.event.userRolesChanged":`Roles and groups of a user changed`,"audit.event.userCreated":`User created`,"audit.event.userChanged":`User changed`,"audit.event.passwordChanged":`Password changed`,"audit.event.passwordReset":`Password set by an administrator`,"audit.event.twoFactorEnabled":`Two-factor sign-in turned on`,"audit.event.twoFactorDisabled":`Two-factor sign-in turned off`,"audit.event.twoFactorReset":`Two-factor sign-in reset`,"audit.event.recoveryCodes":`New recovery codes`,"audit.event.sessions":`Sessions signed out`,"audit.event.sessionsOthers":`Signed out everywhere else`,"audit.event.sessionsOne":`Signed out one device`,"display.title":`Display settings`,"display.calendar":`Calendar`,"display.gregorian":`Gregorian`,"display.jalali":`Jalali`,"display.digits":`Digits`,"display.accent":`Accent colour`,"display.customAccent":`Another colour`,"display.defaultAccent":`Default`,"display.accentForEveryone":`Use for everyone`,"display.resetForEveryone":`Reset for everyone`,"display.logo":`Logo`,"display.favicon":`Tab icon`,"display.uploadPicture":`Upload`,"display.removePicture":`Remove`,"display.latinDigits":`Latin 123`,"display.persianDigits":`Persian ۱۲۳`,"inline.row":`{name} row {index}`,"inline.newRow":`New {name} {index}`,"inline.moveUp":`Move {name} up`,"inline.moveDown":`Move {name} down`,"inline.remove":`Remove {name}`,"inline.rowActions":`Row actions`,"inline.empty":`None yet.`,"inline.limitsMax":`{count} · at most {max}`,"inline.limitsBetween":`{count} · {min} to {max}`,"inline.countMin":`Needs at least {min} (has {count}).`,"inline.countMax":`Can have at most {max} (has {count}).`,"inline.truncated":`{count} more are not shown here, so these cannot be edited in this form.`,"inline.openList":`Open the list`,"inline.duplicateNote":`Duplicate copies this record only, not its {names}.`,"form.new":`New {name}`,"form.back":`Back`,"form.edit":`Edit`,"dashboard.title":`Dashboard`,"dashboard.subtitle":`Your shop over the chosen period`,"dashboard.period":`Period`,"dashboard.day":`Today`,"dashboard.week":`Week`,"dashboard.month":`Month`,"dashboard.year":`Year`,"dashboard.range":`Choose dates`,"dashboard.apply":`Show`,"dashboard.failed":`This widget could not load.`,"dashboard.retry":`Try again`,"dashboard.viewAll":`View all`,"dashboard.thisPeriod":`This period`,"dashboard.previousPeriod":`Previous period`,"stepper.since":`since {time}`,"form.viewProfile":`View`,"form.viewOnly":`You can view this record but not change it.`,"form.save":`Save`,"form.saving":`Saving…`,"form.delete":`Delete`,"form.confirmDelete":`Confirm delete`,"form.moveToTrash":`Move to trash`,"form.confirmMoveToTrash":`Confirm move to trash`,"form.deleting":`Deleting…`,"form.keep":`Keep`,"form.related":`Related`,"form.add":`Add {name}`,"form.remove":`Remove {name} {index}`,"form.conflictTitle":`Someone else saved this record while you were editing it.`,"form.conflictNone":`None of the fields on this form changed.`,"form.keepMine":`Keep my changes`,"form.loadTheirs":`Load theirs`,"form.saveAndNew":`Save & new`,"form.duplicate":`Duplicate`,"form.savedName":`“{name}” saved.`,"form.leaveTitle":`Leave without saving? Your changes will be lost.`,"form.stay":`Stay`,"form.leave":`Leave`,"form.unsaved":`Unsaved changes`,"form.formatJson":`Format`,"form.tabHasErrors":`(has errors)`,"form.readOnly":`Read-only`,"form.externalLink":`{name} (opens in a new tab)`,"form.colorCode":`{name} colour code`,"upload.choose":`Choose a file`,"upload.chooseMany":`Choose files`,"upload.chooseImage":`Choose an image`,"upload.chooseImages":`Choose images`,"upload.replace":`Replace`,"upload.drop":`or drop it here`,"upload.dropMany":`or drop them here`,"upload.limit":`Up to {max}`,"upload.uploading":`Uploading {name}`,"upload.cancel":`Cancel uploading {name}`,"upload.remove":`Remove {name}`,"upload.open":`Open {name}`,"upload.more":`+{count}`,"upload.failed":`{name}: {message}`,"upload.busy":`Wait for the uploads to finish, then save.`,"upload.tooLarge":`The file is too large.`,"upload.tooLargeMax":`The file is too large (at most {max}).`,"upload.typeRefused":`This type of file is not accepted here.`,"upload.empty":`The file is empty.`,"upload.network":`The upload failed. Check your connection and try again.`,"upload.bytes":`{value} B`,"upload.kilobytes":`{value} KB`,"upload.megabytes":`{value} MB`,"upload.gigabytes":`{value} GB`,"upload.terabytes":`{value} TB`,"editor.loading":`Loading the editor…`,"editor.toolbar":`{name} formatting`,"editor.paragraph":`Paragraph`,"editor.heading":`Heading {level}`,"editor.bold":`Bold`,"editor.italic":`Italic`,"editor.strike":`Strikethrough`,"editor.bulletList":`Bulleted list`,"editor.orderedList":`Numbered list`,"editor.blockquote":`Quote`,"editor.rule":`Horizontal line`,"editor.link":`Link`,"editor.linkAddress":`Link address`,"editor.linkApply":`Apply`,"editor.unlink":`Remove link`,"editor.image":`Insert image`,"editor.imageNoAddress":`the server gave no address to show the image from`,"editor.table":`Insert table`,"editor.addRow":`Add row`,"editor.addColumn":`Add column`,"editor.deleteRow":`Delete row`,"editor.deleteColumn":`Delete column`,"editor.deleteTable":`Delete table`,"editor.undo":`Undo`,"editor.redo":`Redo`,"palette.open":`Search and go to`,"palette.placeholder":`Go to, create, or find records…`,"palette.results":`Results`,"palette.goTo":`Go to`,"palette.actions":`Actions`,"palette.toggleTheme":`Toggle theme`,"palette.records":`Records`,"palette.new":`New {name}`,"palette.searching":`Searching…`,"palette.noResults":`Nothing found`,"picker.typeToSearch":`Type to search…`,"picker.typeToAdd":`Type to add…`,"picker.searching":`Searching…`,"picker.noMatches":`No matches`,"picker.remove":`Remove {name}`,"picker.clear":`Clear {name}`,"picker.selected":`Selected {name}`,"validation.required":`is required`,"validation.number":`must be a number`,"validation.json":`must be valid JSON`,"validation.date":`must be a valid date`,"validation.datetime":`must be a valid date and time`,"validation.minLength":`must be at least {min} characters`,"validation.maxLength":`must be at most {max} characters`,"validation.pattern":`is not in the expected format`,"validation.email":`must be an email address`,"validation.url":`must be a URL`,"validation.uuid":`must be a UUID`,"validation.oneOf":`must be one of: {values}`,"validation.integer":`must be an integer`,"validation.min":`must be at least {min}`,"validation.max":`must be at most {max}`},Hh={en:Vh,fa:{"common.loading":`در حال بارگذاری…`,"common.yes":`بله`,"common.no":`خیر`,"common.empty":`—`,"common.all":`همه`,"common.cancel":`انصراف`,"common.pageNotFound":`صفحه پیدا نشد.`,"common.requestFailed":`درخواست ناموفق بود ({status})`,"common.reference":`{message} (کد پیگیری: {id})`,"shell.adminPanel":`پنل مدیریت`,"palette.move":`جابه‌جایی`,"palette.openItem":`باز کردن`,"palette.close":`بستن`,"shell.menu":`منو`,"shell.closeMenu":`بستن منو`,"shell.resources":`بخش‌ها`,"shell.filterResources":`جست‌وجوی بخش‌ها`,"shell.pinned":`سنجاق‌شده`,"shell.recent":`اخیر`,"shell.pin":`سنجاق کردن {name}`,"shell.unpin":`برداشتن سنجاق {name}`,"shell.collapseGroup":`بستن {name}`,"shell.expandGroup":`باز کردن {name}`,"shell.collapseSidebar":`جمع کردن نوار کناری`,"shell.expandSidebar":`باز کردن نوار کناری`,"shell.breadcrumbs":`مسیر صفحه`,"shell.home":`خانه`,"shell.dashboard":`داشبورد`,"shell.noMatches":`بخشی پیدا نشد.`,"shell.theme":`پوسته`,"shell.themeLight":`روشن`,"shell.themeDark":`تیره`,"shell.themeSystem":`سیستم`,"shell.language":`زبان`,"shell.noResources":`هنوز بخشی ثبت نشده است. یک provider را با ‎@AdminResource‎ علامت بزنید.`,"shell.records":`{count} رکورد`,"shell.aboutRecords":`حدود {count} رکورد`,"list.select":`انتخاب`,"list.done":`تمام`,"list.loadMore":`بیشتر`,"list.showing":`{shown} مورد`,"list.showingOf":`{shown} از {total}`,"list.new":`جدید`,"list.trash":`سطل زباله`,"list.trashNote":`رکوردهای سطل زباله. برای ویرایش دوباره، آن را بازگردانید.`,"list.restore":`بازگردانی`,"list.restoreRecord":`بازگردانی {name}`,"list.actions":`عملیات`,"list.noMatches":`رکوردی با این شرایط نیست.`,"list.noRecords":`هنوز رکوردی نیست.`,"list.total":`{count} مورد`,"list.about":`حدود {count}`,"list.page":`صفحه {page}`,"list.pageOf":`صفحه {page} از {pages}`,"list.range":`نمایش {from} تا {to} از {total}`,"list.rowsPerPage":`ردیف در صفحه`,"list.toggleRow":`{column}: {name}`,"list.previousPage":`صفحه قبل`,"list.nextPage":`صفحه بعد`,"list.columns":`ستون‌ها`,"list.density":`تراکم`,"list.comfortable":`راحت`,"list.compact":`فشرده`,"list.moveUp":`جابه‌جایی {name} به بالا`,"list.moveDown":`جابه‌جایی {name} به پایین`,"list.resetColumns":`بازنشانی ستون‌ها`,"list.resize":`تغییر اندازه‌ی {name}`,"list.retry":`تلاش دوباره`,"list.loadFailed":`فهرست بارگذاری نشد.`,"list.selectPage":`انتخاب همه‌ی این صفحه`,"list.selectRow":`انتخاب {name}`,"print.open":`چاپ {name}`,"list.export":`خروجی Excel`,"list.exporting":`در حال ساخت فایل…`,"list.exportTruncated":`فقط {count} ردیف اول در فایل آمد.`,"list.exportDone":`{file} دانلود شد.`,"list.selected":`{count} مورد انتخاب شده`,"list.deleteSelected":`حذف انتخاب‌شده‌ها`,"list.confirmDeleteSelected":`حذف {count} مورد`,"list.clearSelection":`لغو انتخاب`,"list.bulkDeleted":`{count} مورد حذف شد`,"list.bulkFailed":`{count} مورد ناموفق`,"list.quickView":`نمای سریع: {name}`,"list.edit":`ویرایش`,"list.close":`بستن`,"list.editCell":`ویرایش {name}: {value}`,"action.running":`در حال اجرا…`,"action.confirm":`«{action}» اجرا شود؟`,"action.confirmRecord":`«{action}» روی {name} اجرا شود؟`,"action.confirmSelected":`«{action}» روی {count} رکورد اجرا شود؟`,"action.eachNote":`هر یک از {count} رکورد جداگانه انجام می‌شود: خطای یکی بقیه را متوقف نمی‌کند.`,"action.atomicNote":`همه یا هیچ: اگر یکی از {count} رکورد خطا بدهد، هیچ‌کدام تغییر نمی‌کند.`,"action.done":`«{action}» انجام شد.`,"action.doneGone":`«{action}» انجام شد. این رکورد دیگر در دسترس شما نیست.`,"action.bulkDone":`{action}: {count} مورد انجام شد`,"action.saveFirst":`ابتدا تغییرات را ذخیره یا لغو کنید.`,"action.more":`کارهای بیشتر`,"toast.region":`اعلان‌ها`,"toast.dismiss":`بستن`,"settings.viewOnly":`می‌توانید این تنظیمات را ببینید ولی نمی‌توانید تغییرشان دهید.`,"settings.discard":`لغو تغییرات`,"secret.set":`تنظیم شده`,"secret.notSet":`تنظیم نشده`,"secret.replace":`جایگزینی`,"secret.replaceName":`جایگزینی {name}`,"secret.clear":`پاک کردن`,"secret.clearName":`پاک کردن {name}`,"secret.keep":`نگه داشتن مقدار فعلی`,"secret.willClear":`هنگام ذخیره پاک می‌شود.`,"secret.undo":`بازگردانی`,"filters.search":`جست‌وجو`,"filters.searchIn":`جست‌وجو در {fields}`,"filters.filtersAndSort":`فیلتر و مرتب‌سازی`,"filters.showResults":`نمایش نتایج`,"filters.sortBy":`مرتب‌سازی بر اساس`,"filters.ascending":`{name}، صعودی`,"filters.descending":`{name}، نزولی`,"filters.filters":`فیلترها`,"filters.clear":`پاک کردن فیلترها`,"filters.from":`از`,"filters.to":`تا`,"filters.contains":`{field} شامل`,"filters.empty":`خالی`,"filters.notEmpty":`غیرخالی`,"filters.not":`به‌جز `,"filters.removeChip":`حذف فیلتر {label}`,"filters.active":`فیلترهای فعال`,"filters.any":`همه`,"filters.onlyEmpty":`خالی`,"filters.hideEmpty":`غیرخالی`,"filters.emptyValues":`{field}: مقدارهای خالی`,"filters.selected":`{count} مورد`,"date.placeholder":`yyyy/mm/dd`,"date.openCalendar":`انتخاب {name} از تقویم`,"date.calendar":`تقویم {name}`,"date.previous":`قبلی`,"date.next":`بعدی`,"date.chooseMonth":`انتخاب ماه`,"date.chooseYear":`انتخاب سال`,"date.today":`امروز`,"date.clear":`پاک کردن`,"date.time":`ساعت {name}`,"auth.title":`ورود`,"auth.username":`نام کاربری`,"auth.password":`گذرواژه`,"auth.signIn":`ورود`,"auth.signingIn":`در حال ورود…`,"auth.required":`نام کاربری و گذرواژه را وارد کنید.`,"auth.failed":`ورود انجام نشد. دوباره تلاش کنید.`,"auth.userMenu":`منوی حساب {name}`,"auth.account":`حساب کاربری`,"auth.signOut":`خروج`,"auth.changePassword":`تغییر گذرواژه`,"auth.currentPassword":`گذرواژه‌ی فعلی`,"auth.newPassword":`گذرواژه‌ی جدید`,"auth.confirmPassword":`تکرار گذرواژه‌ی جدید`,"auth.mismatch":`با گذرواژه‌ی جدید یکسان نیست`,"auth.passwordChanged":`گذرواژه تغییر کرد. نشست‌های دیگر شما بسته شدند.`,"auth.sessions":`دستگاه‌های واردشده`,"auth.signOutOthers":`خروج از همه‌ی دستگاه‌های دیگر`,"auth.thisDevice":`همین دستگاه`,"auth.unknownDevice":`دستگاه ناشناخته`,"auth.lastSeen":`آخرین فعالیت {when}`,"auth.revoke":`خروج`,"auth.revokeSession":`خروج {name}`,"rbac.administration":`مدیریت`,"rbac.users":`کاربران`,"rbac.groups":`گروه‌ها`,"rbac.roles":`نقش‌ها`,"rbac.user":`کاربر`,"rbac.group":`گروه`,"rbac.role":`نقش`,"rbac.newUser":`کاربر جدید`,"rbac.newGroup":`گروه جدید`,"rbac.newRole":`نقش جدید`,"rbac.createUser":`ساختن کاربر`,"rbac.export":`خروجی`,"rbac.import":`ورود`,"rbac.importFile":`پرونده‌ی نقش‌ها برای ورود`,"rbac.imported":`{count} نقش وارد شد.`,"rbac.notJson":`این پرونده JSON نیست.`,"rbac.permissionCount":`{count} مجوز`,"rbac.system":`سیستمی`,"rbac.systemNote":`این نقش در کد تعریف شده است؛ آن را همان‌جا تغییر دهید.`,"rbac.name":`نام`,"rbac.labelIn":`عنوان ({language})`,"rbac.matrix":`مجوزها`,"rbac.resource":`بخش`,"rbac.op.view":`دیدن`,"rbac.op.create":`ساختن`,"rbac.op.update":`تغییر`,"rbac.op.delete":`حذف`,"rbac.op.purge":`حذف دائمی`,"rbac.grant":`{operation} {resource}`,"rbac.details":`فیلدها و ردیف‌های {resource}`,"rbac.fields":`فیلدها`,"rbac.restricted":`محدود`,"rbac.fieldRule":`دسترسی به {field}`,"rbac.rule.default":`مطابق مجوزها`,"rbac.rule.defaultHidden":`پنهان (محدود)`,"rbac.rule.hidden":`پنهان`,"rbac.rule.readonly":`فقط خواندنی`,"rbac.rule.edit":`قابل ویرایش`,"rbac.scopes":`ردیف‌ها`,"rbac.allRows":`همه‌ی ردیف‌ها`,"rbac.custom":`مجوزهای دیگر`,"rbac.global":`مجوزهای عمومی`,"rbac.actions":`عملیات`,"rbac.actionNote":`عملیات روی رکوردها به مجوز تغییر هم نیاز دارد.`,"rbac.pages":`صفحه‌های تنظیمات`,"rbac.page":`صفحه`,"rbac.viewImplied":`هر کس بتواند صفحه‌ای را تغییر دهد، می‌تواند آن را ببیند.`,"rbac.noGroups":`هنوز گروهی نیست.`,"rbac.groupSummary":`{roles} نقش · {members} عضو`,"rbac.members":`اعضا`,"rbac.noMembers":`هنوز عضوی نیست.`,"rbac.addMember":`افزودن عضو`,"rbac.searchUsers":`جست‌وجوی کاربران`,"rbac.searchResults":`کاربران یافته‌شده`,"rbac.usersFromMemberships":`سامانه‌ی ورود شما نمی‌تواند کاربران را فهرست کند: این‌ها کاربرانی هستند که این‌جا نقش یا گروه دارند.`,"rbac.superuser":`ابرکاربر`,"rbac.superuserNote":`فقط ابرکاربرها می‌توانند ابرکاربر را تغییر دهند.`,"rbac.inactive":`غیرفعال`,"rbac.active":`فعال`,"rbac.displayName":`نام نمایشی`,"rbac.email":`ایمیل`,"rbac.saved":`ذخیره شد.`,"rbac.setPassword":`تعیین گذرواژه`,"rbac.setPasswordNote":`کاربر از همه‌جا خارج می‌شود.`,"rbac.passwordSet":`گذرواژه تعیین شد؛ کاربر از همه‌جا خارج شد.`,"auth.otpTitle":`تأیید دومرحله‌ای`,"auth.otp":`کد`,"auth.otpHelp":`کد ۶ رقمی برنامهٔ احراز هویت یا یکی از کدهای بازیابی را وارد کنید.`,"auth.verify":`تأیید`,"auth.otpRequired":`کد را وارد کنید.`,"auth.startOver":`ورود با حساب دیگر`,"twoFactor.title":`ورود دومرحله‌ای`,"twoFactor.on":`روشن`,"twoFactor.off":`خاموش`,"twoFactor.intro":`پس از گذرواژه، کدی از برنامهٔ احراز هویت خواسته شود.`,"twoFactor.setUp":`راه‌اندازی`,"twoFactor.scan":`کد را با برنامهٔ احراز هویت اسکن کنید یا کلید را در آن وارد کنید. سپس کدی را که برنامه نشان می‌دهد بنویسید.`,"twoFactor.qr":`کد QR برای برنامهٔ احراز هویت`,"twoFactor.key":`کلید`,"twoFactor.code":`کد برنامه`,"twoFactor.turnOn":`روشن کردن`,"twoFactor.recoveryTitle":`کدهای بازیابی`,"twoFactor.recoveryIntro":`این کدها را جای امنی نگه دارید. اگر دستگاهتان را گم کنید، هر کد یک بار شما را وارد می‌کند. دوباره نشان داده نمی‌شوند.`,"twoFactor.copy":`کپی کدها`,"twoFactor.copied":`کپی شد`,"twoFactor.done":`ذخیره‌شان کردم`,"twoFactor.left":`{count} کد بازیابی استفاده‌نشده.`,"twoFactor.newCodes":`کدهای بازیابی تازه`,"twoFactor.turnOff":`خاموش کردن`,"twoFactor.password":`گذرواژهٔ شما`,"twoFactor.enabledNote":`ورود دومرحله‌ای روشن شد. نشست‌های دیگر شما بسته شدند.`,"twoFactor.disabledNote":`ورود دومرحله‌ای خاموش است.`,"viewAs.start":`دیدن از نگاه این کاربر`,"viewAs.banner":`از نگاه {name}. فقط خواندنی.`,"viewAs.stop":`پایان`,"rbac.twoFactor":`ورود دومرحله‌ای`,"rbac.resetTwoFactor":`بازنشانی ورود دومرحله‌ای`,"rbac.resetTwoFactorNote":`عامل دوم کاربر را (مثلاً گوشی گم‌شده) خاموش می‌کند و او را از همه‌جا خارج می‌کند.`,"rbac.twoFactorReset":`ورود دومرحله‌ای این کاربر خاموش شد.`,"debugger.title":`اشکال‌یاب دسترسی`,"debugger.intro":`چرا کاربری چیزی را می‌بیند یا نمی‌بیند، تغییر می‌دهد یا نمی‌دهد.`,"debugger.user":`کاربر`,"debugger.resource":`منبع`,"debugger.record":`شناسهٔ رکورد (اختیاری)`,"debugger.explain":`توضیح بده`,"debugger.pick":`یک کاربر و یک منبع انتخاب کنید.`,"debugger.roles":`نقش‌ها`,"debugger.noRoles":`بدون نقش: هیچ کاری مجاز نیست.`,"debugger.superuser":`ابرکاربر همه‌کاری می‌تواند بکند.`,"debugger.source.direct":`مستقیم داده شده`,"debugger.source.group":`از گروه {group}`,"debugger.source.resolveRoles":`از resolveRoles`,"debugger.source.adapter":`از سامانهٔ ورود`,"debugger.unknownRole":`نقشی با این نام نیست؛ چیزی نمی‌دهد`,"debugger.operations":`عملیات`,"debugger.allowed":`مجاز`,"debugger.denied":`غیرمجاز`,"debugger.noGrant":`هیچ نقشی آن را نمی‌دهد`,"debugger.viaUpdate":`{pattern} در {role} (تغییر، دیدن را هم می‌دهد)`,"debugger.grant":`{pattern} در {role}`,"debugger.fields":`فیلدها`,"debugger.field":`فیلد`,"debugger.result":`نتیجه`,"debugger.byRole":`به تفکیک نقش`,"debugger.forced":`همیشه دیده می‌شود: کلیدها و نسخه`,"debugger.scopes":`ردیف‌ها`,"debugger.allRows":`همهٔ ردیف‌ها`,"debugger.noRows":`هیچ ردیفی`,"debugger.someRows":`ردیف‌های {scopes}`,"debugger.globalScopes":`محدود به {scopes} نیز`,"debugger.recordTitle":`رکورد {id}`,"debugger.reason.permission":`بدون مجوز`,"debugger.reason.scope":`بیرون از ردیف‌هایش`,"debugger.reason.rule":`قاعدهٔ این رکورد اجازه نمی‌دهد`,"debugger.reason.missing":`چنین رکوردی نیست`,"debugger.actions":`عملیات`,"debugger.needsUpdate":`عملیات روی رکوردها به مجوز تغییر هم نیاز دارد`,"debugger.noRecordActions":`هیچ‌کدام روی این رکورد`,"debugger.pages":`صفحه‌های تنظیمات`,"audit.title":`گزارش تغییرات`,"audit.history":`تاریخچه`,"audit.details":`جزئیات`,"audit.recordTabs":`رکورد و تاریخچه‌ی آن`,"audit.entries":`تغییرهای ثبت‌شده`,"audit.notAllowed":`اجازه‌ی خواندن گزارش تغییرات را ندارید`,"audit.off":`گزارش تغییرات در این پنل فعال نیست`,"audit.empty":`هنوز چیزی ثبت نشده است.`,"audit.noMatches":`موردی پیدا نشد.`,"audit.noActor":`بدون ورود`,"audit.viewAsBy":`هنگامی که کاربر {id} از دید او نگاه می‌کرد`,"audit.filterByActor":`فقط کارهای {name} را نشان بده`,"audit.changedFields":`فیلدهای تغییرکرده`,"audit.before":`قبل`,"audit.after":`بعد`,"audit.becomes":`شد`,"audit.field.changed":`تغییر کرد`,"audit.field.hidden":`پنهان`,"audit.field.dropped":`بزرگ‌تر از آن بود که نگه داشته شود`,"audit.field.truncated":`کوتاه‌شده`,"audit.showMore":`بیشتر`,"audit.showLess":`کمتر`,"audit.input":`ورودی`,"audit.inputTruncated":`ورودی بزرگ‌تر از آن بود که نگه داشته شود.`,"audit.restrictedRecord":`رکوردی که نمی‌توانید ببینید: جزئیات آن نشان داده نمی‌شود.`,"audit.restrictedChanges":`اجازه‌ی دیدن تغییرها را ندارید.`,"audit.suppressedNote":`در همان دقیقه رخ دادند و تک‌تک ثبت نشدند.`,"audit.limitedNote":`ورودهای ناموفق بعدی در این دقیقه فقط شمرده می‌شوند.`,"audit.actionDeleted":`این عملیات رکورد را حذف کرد.`,"audit.filter.actor":`انجام‌دهنده (شناسه‌ی کاربر)`,"audit.filter.event":`رویداد`,"audit.filter.eventHint":`order.updated یا auth.*`,"audit.filter.resource":`بخش`,"audit.filter.record":`شناسه‌ی رکورد`,"audit.filter.recordHint":`نخست یک بخش انتخاب کنید`,"audit.event.unseen":`تغییری که نمی‌توانید ببینید`,"audit.event.created":`ایجاد شد`,"audit.event.updated":`تغییر کرد`,"audit.event.deleted":`حذف شد`,"audit.event.trashed":`به سطل زباله رفت`,"audit.event.restored":`بازیابی شد`,"audit.event.purged":`برای همیشه حذف شد`,"audit.event.action":`«{action}» اجرا شد`,"audit.event.page":`{page} تغییر کرد`,"audit.event.login":`وارد شد`,"audit.event.logout":`خارج شد`,"audit.event.loginFailed":`ورود ناموفق`,"audit.event.loginFailedCode":`ورود ناموفق: کد دومرحله‌ای نادرست`,"audit.event.loginFailedLimited":`ورود ناموفق: تلاش‌های بیش از حد`,"audit.event.loginFailedMore":`{count} ورود ناموفق دیگر`,"audit.event.viewAs":`پنل را از دید یک کاربر دید`,"audit.event.roleChanged":`نقش تغییر کرد`,"audit.event.groupChanged":`گروه تغییر کرد`,"audit.event.userRolesChanged":`نقش‌ها و گروه‌های یک کاربر تغییر کرد`,"audit.event.userCreated":`کاربر ایجاد شد`,"audit.event.userChanged":`کاربر تغییر کرد`,"audit.event.passwordChanged":`رمز عبور تغییر کرد`,"audit.event.passwordReset":`مدیر رمز عبور را تعیین کرد`,"audit.event.twoFactorEnabled":`ورود دومرحله‌ای روشن شد`,"audit.event.twoFactorDisabled":`ورود دومرحله‌ای خاموش شد`,"audit.event.twoFactorReset":`ورود دومرحله‌ای بازنشانی شد`,"audit.event.recoveryCodes":`کدهای بازیابی تازه`,"audit.event.sessions":`نشست‌ها بسته شدند`,"audit.event.sessionsOthers":`از همه‌ی دستگاه‌های دیگر خارج شد`,"audit.event.sessionsOne":`از یک دستگاه خارج شد`,"display.title":`تنظیمات نمایش`,"display.calendar":`تقویم`,"display.gregorian":`میلادی`,"display.jalali":`شمسی`,"display.digits":`ارقام`,"display.accent":`رنگ اصلی`,"display.customAccent":`رنگ دیگر`,"display.defaultAccent":`پیش‌فرض`,"display.accentForEveryone":`برای همه`,"display.resetForEveryone":`بازگشت برای همه`,"display.logo":`لوگو`,"display.favicon":`آیکون زبانه`,"display.uploadPicture":`بارگذاری`,"display.removePicture":`حذف`,"display.latinDigits":`لاتین 123`,"display.persianDigits":`فارسی ۱۲۳`,"inline.row":`{name} ردیف {index}`,"inline.newRow":`{name} جدید {index}`,"inline.moveUp":`بردن {name} به بالا`,"inline.moveDown":`بردن {name} به پایین`,"inline.remove":`حذف {name}`,"inline.rowActions":`کارهای ردیف`,"inline.empty":`هنوز چیزی نیست.`,"inline.limitsMax":`{count} · حداکثر {max}`,"inline.limitsBetween":`{count} · از {min} تا {max}`,"inline.countMin":`دست‌کم {min} لازم است ({count} هست).`,"inline.countMax":`حداکثر {max} می‌تواند باشد ({count} هست).`,"inline.truncated":`{count} مورد دیگر اینجا نشان داده نمی‌شود، پس این‌ها در این فرم ویرایش نمی‌شوند.`,"inline.openList":`باز کردن فهرست`,"inline.duplicateNote":`تکثیر فقط همین رکورد را کپی می‌کند، نه {names} آن را.`,"form.new":`{name} جدید`,"form.back":`بازگشت`,"form.edit":`ویرایش`,"dashboard.title":`داشبورد`,"dashboard.subtitle":`وضعیت فروشگاه در بازه انتخاب‌شده`,"dashboard.period":`بازه زمانی`,"dashboard.day":`امروز`,"dashboard.week":`هفته`,"dashboard.month":`ماه`,"dashboard.year":`سال`,"dashboard.range":`انتخاب بازه تاریخ`,"dashboard.apply":`نمایش`,"dashboard.failed":`این ویجت بارگذاری نشد.`,"dashboard.retry":`تلاش دوباره`,"dashboard.viewAll":`مشاهده همه`,"dashboard.thisPeriod":`این دوره`,"dashboard.previousPeriod":`دوره قبل`,"stepper.since":`از {time}`,"form.viewProfile":`مشاهده پروفایل`,"form.viewOnly":`می‌توانید این رکورد را ببینید اما نمی‌توانید آن را تغییر دهید.`,"form.save":`ذخیره`,"form.saving":`در حال ذخیره…`,"form.delete":`حذف`,"form.confirmDelete":`تأیید حذف`,"form.moveToTrash":`انتقال به سطل زباله`,"form.confirmMoveToTrash":`تأیید انتقال به سطل زباله`,"form.deleting":`در حال حذف…`,"form.keep":`نگه‌داشتن`,"form.related":`مرتبط`,"form.add":`افزودن {name}`,"form.remove":`حذف {name} {index}`,"form.conflictTitle":`در حین ویرایش شما، شخص دیگری این رکورد را ذخیره کرد.`,"form.conflictNone":`هیچ‌یک از فیلدهای این فرم تغییر نکرده است.`,"form.keepMine":`تغییرات من بماند`,"form.loadTheirs":`نسخه‌ی آن‌ها را بارگذاری کن`,"form.saveAndNew":`ذخیره و مورد جدید`,"form.duplicate":`تکثیر`,"form.savedName":`«{name}» ذخیره شد.`,"form.leaveTitle":`بدون ذخیره خارج می‌شوید؟ تغییرات از دست می‌رود.`,"form.stay":`بمان`,"form.leave":`خروج`,"form.unsaved":`تغییرات ذخیره نشده`,"form.formatJson":`مرتب‌سازی`,"form.tabHasErrors":`(دارای خطا)`,"form.readOnly":`فقط خواندنی`,"form.externalLink":`{name} (در زبانه‌ی جدید باز می‌شود)`,"form.colorCode":`کد رنگ {name}`,"upload.choose":`انتخاب فایل`,"upload.chooseMany":`انتخاب فایل‌ها`,"upload.chooseImage":`انتخاب تصویر`,"upload.chooseImages":`انتخاب تصویرها`,"upload.replace":`جایگزینی`,"upload.drop":`یا آن را اینجا رها کنید`,"upload.dropMany":`یا آن‌ها را اینجا رها کنید`,"upload.limit":`حداکثر {max}`,"upload.uploading":`در حال بارگذاری {name}`,"upload.cancel":`لغو بارگذاری {name}`,"upload.remove":`حذف {name}`,"upload.open":`باز کردن {name}`,"upload.more":`+{count}`,"upload.failed":`{name}: {message}`,"upload.busy":`تا پایان بارگذاری‌ها صبر کنید، سپس ذخیره کنید.`,"upload.tooLarge":`فایل بیش از حد بزرگ است.`,"upload.tooLargeMax":`فایل بیش از حد بزرگ است (حداکثر {max}).`,"upload.typeRefused":`این نوع فایل اینجا پذیرفته نمی‌شود.`,"upload.empty":`فایل خالی است.`,"upload.network":`بارگذاری ناموفق بود. اتصال خود را بررسی کنید و دوباره تلاش کنید.`,"upload.bytes":`{value} بایت`,"upload.kilobytes":`{value} کیلوبایت`,"upload.megabytes":`{value} مگابایت`,"upload.gigabytes":`{value} گیگابایت`,"upload.terabytes":`{value} ترابایت`,"editor.loading":`در حال بارگذاری ویرایشگر…`,"editor.toolbar":`قالب‌بندی {name}`,"editor.paragraph":`پاراگراف`,"editor.heading":`عنوان {level}`,"editor.bold":`پررنگ`,"editor.italic":`کج`,"editor.strike":`خط‌خورده`,"editor.bulletList":`فهرست نشانه‌دار`,"editor.orderedList":`فهرست شماره‌دار`,"editor.blockquote":`نقل‌قول`,"editor.rule":`خط افقی`,"editor.link":`پیوند`,"editor.linkAddress":`نشانی پیوند`,"editor.linkApply":`اعمال`,"editor.unlink":`حذف پیوند`,"editor.image":`درج تصویر`,"editor.imageNoAddress":`سرور نشانی‌ای برای نمایش تصویر نداد`,"editor.table":`درج جدول`,"editor.addRow":`افزودن سطر`,"editor.addColumn":`افزودن ستون`,"editor.deleteRow":`حذف سطر`,"editor.deleteColumn":`حذف ستون`,"editor.deleteTable":`حذف جدول`,"editor.undo":`واگرد`,"editor.redo":`ازنو`,"palette.open":`جست‌وجو و رفتن به`,"palette.placeholder":`رفتن به، ساختن، یا یافتن رکورد…`,"palette.results":`نتایج`,"palette.goTo":`رفتن به`,"palette.actions":`کارها`,"palette.toggleTheme":`تغییر تم`,"palette.records":`رکوردها`,"palette.new":`{name} جدید`,"palette.searching":`در حال جست‌وجو…`,"palette.noResults":`چیزی پیدا نشد`,"picker.typeToSearch":`برای جست‌وجو تایپ کنید…`,"picker.typeToAdd":`برای افزودن تایپ کنید…`,"picker.searching":`در حال جست‌وجو…`,"picker.noMatches":`موردی پیدا نشد`,"picker.remove":`حذف {name}`,"picker.clear":`پاک کردن {name}`,"picker.selected":`{name} انتخاب‌شده`,"validation.required":`الزامی است`,"validation.number":`باید عدد باشد`,"validation.json":`باید JSON معتبر باشد`,"validation.date":`باید تاریخ معتبری باشد`,"validation.datetime":`باید تاریخ و زمان معتبر باشد`,"validation.minLength":`باید دست‌کم {min} نویسه باشد`,"validation.maxLength":`باید حداکثر {max} نویسه باشد`,"validation.pattern":`قالب آن درست نیست`,"validation.email":`باید نشانی ایمیل باشد`,"validation.url":`باید نشانی اینترنتی باشد`,"validation.uuid":`باید UUID باشد`,"validation.oneOf":`باید یکی از این‌ها باشد: {values}`,"validation.integer":`باید عدد صحیح باشد`,"validation.min":`باید دست‌کم {min} باشد`,"validation.max":`باید حداکثر {max} باشد`}},Uh=new Set([`fa`,`ar`,`he`,`ur`]),Wh=`nma.locale`,Gh=`en`,Kh={calendar:`gregorian`,digits:`latn`};function qh(){return Kh}function Jh(e){Kh=e}function Yh(){return Gh}var Xh={};function Zh(e){Xh=e??{}}function J(e,t={},n=Gh){return(Xh[n]?.[e]??(Hh[n]??Vh)[e]??Vh[e]).replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e)}function Qh(e){return Uh.has(e.split(`-`)[0])}var $h=e=>`-u-ca-${e.calendar===`persian`?`persian`:`gregory`}-nu-${e.digits}`;function eg(e,t=Gh){return new Intl.NumberFormat(`${t}-u-nu-${Kh.digits}`).format(e)}function tg(e){return Kh.digits===`arabext`?Fh(e):e}function ng(e,t=Gh){return new Intl.DateTimeFormat(`${t}${$h(Kh)}`,{dateStyle:`medium`,timeStyle:`short`}).format(e)}function rg(e,t=Gh){return new Intl.DateTimeFormat(`${t}${$h(Kh)}`,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).format(e)}function ig(e,t=Gh){let n=Date.parse(`${e}T00:00:00Z`);return!/^\d{4}-\d{2}-\d{2}$/.test(e)||Number.isNaN(n)?e:new Intl.DateTimeFormat(`${t}${$h(Kh)}`,{dateStyle:`medium`,timeZone:`UTC`}).format(n)}function ag(e,t=new Date,n=Gh){let r=Math.min(0,Math.round((e.getTime()-t.getTime())/1e3)),i=new Intl.RelativeTimeFormat(`${n}-u-nu-${Kh.digits}`,{numeric:`auto`});for(let[e,t]of[[`year`,31536e3],[`month`,2592e3],[`day`,86400],[`hour`,3600],[`minute`,60]])if(Math.abs(r)>=t)return i.format(Math.trunc(r/t),e);return i.format(Math.abs(r)<10?0:r,`second`)}function og(e){Gh=e,typeof document<`u`&&(document.documentElement.lang=e,document.documentElement.dir=Qh(e)?`rtl`:`ltr`)}function sg(e,t){try{let t=localStorage.getItem(Wh);if(t&&e.includes(t))return t}catch{}return t}var cg=(0,y.createContext)(void 0);function lg({locales:e,fallback:t,children:n}){let[r,i]=(0,y.useState)(()=>{let n=sg(e,t);return og(n),n}),[a,o]=(0,y.useState)(()=>{let e=zh(r);return Jh(e),e});return(0,b.jsx)(cg.Provider,{value:{locale:r,locales:e,setLocale:e=>{og(e);try{localStorage.setItem(Wh,e)}catch{}let t=zh(e);Jh(t),o(t),i(e)},t:(e,t)=>J(e,t,r),calendar:a.calendar,digits:a.digits,setDisplay:e=>{Bh(e);let t={...a,...e};Jh(t),o(t)}},children:n})}function Y(){let e=(0,y.useContext)(cg);if(!e)throw Error(`useLocale() outside LocaleProvider`);return e}function X(){return Y().t}function ug(){let e=document.getElementById(`nma-config`)?.textContent;if(e)return JSON.parse(e);throw Error(`nest-my-admin: runtime config missing`)}var dg=ug(),fg=class extends Error{status;body;constructor(e,t){super(t.code===`INTERNAL`&&t.correlationId?J(`common.reference`,{message:t.message,id:t.correlationId}):t.message),this.status=e,this.body=t,this.name=`ApiError`}get fields(){return this.body.fields??{}}};function pg(e){if(!(e instanceof fg))return e.message;let t=Object.entries(e.fields).map(([e,t])=>`${e}: ${t.join(`, `)}`);return[e.message,...t].join(` — `)}var mg,hg;function gg(e){mg=e}function _g(){return mg}function vg(e){hg=e}function yg(){mg=void 0,hg?.()}function bg(e,t){let n=t.replace(/\/+$/,``);return n===``||e!==n&&!e.startsWith(`${n}/`)?e:e.slice(n.length)||`/`}function xg(e,t=``){if(!e||!e.startsWith(`/`)||e.startsWith(`//`)||e.startsWith(`/\\`))return`/`;let n=bg(e,t);return n.startsWith(`/login`)?`/`:n}var Sg=`nma-view-as`;function Cg(){try{return sessionStorage.getItem(Sg)??void 0}catch{return}}function wg(e){try{e===void 0?sessionStorage.removeItem(Sg):sessionStorage.setItem(Sg,e)}catch{}}var Tg=class extends Error{constructor(){super(`Upload aborted`),this.name=`UploadAbortedError`}},Eg=`application/octet-stream`;function Dg(e){return typeof e==`object`&&!!e&&`code`in e&&`message`in e}function Og(e){return typeof e==`object`&&!!e&&typeof e.token==`string`}function kg(e,t,n,r){let i=n.createXhr?n.createXhr():new XMLHttpRequest,a=!1;return{promise:new Promise((o,s)=>{let c=e=>{a||(a=!0,e())};i.open(`POST`,`${n.apiBase}/uploads?${new URLSearchParams({resource:t.resource,field:t.field})}`),i.setRequestHeader(`Accept`,`application/json`),i.setRequestHeader(`Accept-Language`,n.locale),i.setRequestHeader(`Content-Type`,Eg),i.setRequestHeader(`X-File-Name`,encodeURIComponent(e.name)),n.csrfToken&&i.setRequestHeader(`X-CSRF-Token`,n.csrfToken),n.viewAs&&i.setRequestHeader(`X-View-As`,n.viewAs),i.upload.onprogress=e=>{e.lengthComputable&&e.total>0&&r?.(e.loaded/e.total)},i.onload=()=>{let e;try{e=i.responseText?JSON.parse(i.responseText):void 0}catch{e=void 0}let t=i.status>=200&&i.status<300&&Og(e);i.status===401&&n.onSignedOut?.(),c(()=>{t?(r?.(1),o(e)):Dg(e)?s(new fg(i.status,e)):i.status===413?s(new fg(413,{code:`BAD_REQUEST`,message:J(`upload.tooLarge`,{},n.locale),correlationId:``})):s(new fg(i.status,{code:`INTERNAL`,message:J(`common.requestFailed`,{status:i.status},n.locale),correlationId:``}))})},i.onerror=()=>c(()=>s(Error(J(`upload.network`,{},n.locale)))),i.onabort=()=>c(()=>s(new Tg)),i.send(e)}),abort:()=>{a||i.abort()}}}function Ag(e){if(e instanceof fg){let t=Object.values(e.fields).flat();if(t.length>0)return t.join(` `)}return e instanceof Error?e.message:String(e)}function jg(e,t){if(t.length===0)return!0;let n=e.toLowerCase();return t.some(e=>{let t=e.trim().toLowerCase();return t===`*`||t===`*/*`?!0:t.endsWith(`/*`)?n.startsWith(t.slice(0,-1)):n===t})}function Mg(e,t,n){if(e.size===0)return J(`upload.empty`,{},n);if(e.size>t.maxBytes)return J(`upload.tooLargeMax`,{max:Pg(t.maxBytes,n)},n);if(e.type!==``&&!jg(e.type.split(`;`)[0].trim(),t.accept))return J(`upload.typeRefused`,{},n)}var Ng=[`upload.bytes`,`upload.kilobytes`,`upload.megabytes`,`upload.gigabytes`,`upload.terabytes`];function Pg(e,t){let n=e,r=0;for(;n>=1024&&r<Ng.length-1;)n/=1024,r+=1;let i=new Intl.NumberFormat(t??`${Yh()}-u-nu-${qh().digits}`,{maximumFractionDigits:r===0?0:1}).format(n);return J(Ng[r],{value:i},t)}function Fg(e,t,n){let r=[...e];if(t<0||t>=r.length||n<0||n>=r.length||t===n)return r;let[i]=r.splice(t,1);return r.splice(n,0,i),r}function Ig(e){return{...e,creatable:!1,actions:[],prints:[],permissions:{create:!1,update:!1,delete:!1,purge:!1},list:{...e.list,editable:[]},form:{...e.form,create:[],update:[],requiredOnCreate:[],readonly:[...new Set([...e.form.readonly,...e.form.update,...e.form.create])]},...e.inlines?{inlines:Object.fromEntries(Object.entries(e.inlines).map(([e,t])=>[e,Ig(t)]))}:{}}}function Lg(e){return e.schema.readonly?e:{...e,schema:{...e.schema,readonly:!0}}}function Rg(e){return e.viewAs?{...e,rbac:{...e.rbac,manage:!1}}:e}function zg(e){return typeof e==`object`&&!!e&&`code`in e&&`message`in e}async function Z(e,t={}){let n=t.method??`GET`,r=_g(),i=e===`/session`&&n===`POST`?void 0:Cg(),a=await fetch(`${dg.apiBase}${e}`,{...t,credentials:`same-origin`,headers:{Accept:`application/json`,"Accept-Language":Yh(),...t.body?{"Content-Type":`application/json`}:{},...n!==`GET`&&r?{"X-CSRF-Token":r}:{},...i?{"X-View-As":i}:{},...t.headers}});a.status===401&&!e.startsWith(`/session`)&&yg();let o=await a.text(),s;try{s=o?JSON.parse(o):void 0}catch{s=void 0}if(!a.ok)throw new fg(a.status,zg(s)?s:{code:`INTERNAL`,message:J(`common.requestFailed`,{status:a.status}),correlationId:``});return s}var Bg=encodeURIComponent,Vg=e=>typeof e==`number`||typeof e==`string`?{"If-Match":`"${e}"`}:{};function Hg(e,t,n){let r=new URLSearchParams([...n.map(e=>[`id`,e]),[`lang`,Yh()]]);return`${dg.apiBase}/resources/${encodeURIComponent(e)}/print/${encodeURIComponent(t)}?${r}`}async function Ug(e,t){let n=new URLSearchParams(t);n.set(`offset`,String(-new Date().getTimezoneOffset()));let r=Cg(),i=await fetch(`${dg.apiBase}/resources/${encodeURIComponent(e)}/export?${n}`,{credentials:`same-origin`,headers:{"Accept-Language":Yh(),...r?{"X-View-As":r}:{}}});if(i.status===401&&yg(),!i.ok){let e=await i.json().catch(()=>void 0);throw new fg(i.status,zg(e)?e:{code:`INTERNAL`,message:J(`common.requestFailed`,{status:i.status}),correlationId:``})}let a=/filename="([^"]+)"/.exec(i.headers.get(`Content-Disposition`)??``)?.[1]??`${e}.xlsx`,o=i.headers.get(`X-Export-Truncated`);return{blob:await i.blob(),filename:a,...o?{truncated:Number(o)}:{}}}var Q={exportList:Ug,session:async()=>Rg(await Z(`/session`)),login:(e,t,n)=>Z(`/session`,{method:`POST`,body:JSON.stringify({username:e,password:t,...n?{otp:n}:{}})}),logout:()=>Z(`/session`,{method:`DELETE`}),sessions:()=>Z(`/account/sessions`),revokeSession:e=>Z(`/account/sessions/${Bg(e)}`,{method:`DELETE`}),revokeOtherSessions:()=>Z(`/account/sessions`,{method:`DELETE`}),changePassword:(e,t)=>Z(`/account/password`,{method:`POST`,body:JSON.stringify({current:e,next:t})}),twoFactor:{status:()=>Z(`/account/2fa`),setup:()=>Z(`/account/2fa/setup`,{method:`POST`,body:`{}`}),confirm:e=>Z(`/account/2fa/confirm`,{method:`POST`,body:JSON.stringify({code:e})}),disable:e=>Z(`/account/2fa/disable`,{method:`POST`,body:JSON.stringify({password:e})}),recoveryCodes:e=>Z(`/account/2fa/recovery-codes`,{method:`POST`,body:JSON.stringify({password:e})})},meta:()=>Z(`/meta`),menuBadges:()=>Z(`/menu/badges`),dashboard:()=>Z(`/dashboard`),setPicture:(e,t)=>Z(`/appearance/${e}`,{method:`PUT`,body:t,headers:{"Content-Type":Wg(t)}}),removePicture:e=>Z(`/appearance/${e}`,{method:`DELETE`}),setAppearance:e=>Z(`/appearance`,{method:`PUT`,body:JSON.stringify({accent:e})}),widget:(e,t)=>Z(`/dashboard/${encodeURIComponent(e)}?${new URLSearchParams({...t})}`),tabCounts:e=>Z(`/resources/${encodeURIComponent(e)}/tab-counts`),rbac:{catalog:()=>Z(`/rbac/catalog`),roles:()=>Z(`/rbac/roles`),role:e=>Z(`/rbac/roles/${Bg(e)}`),createRole:e=>Z(`/rbac/roles`,{method:`POST`,body:JSON.stringify(e)}),updateRole:(e,t)=>Z(`/rbac/roles/${Bg(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteRole:e=>Z(`/rbac/roles/${Bg(e)}`,{method:`DELETE`}),exportRoles:()=>Z(`/rbac/roles/export`),importRoles:e=>Z(`/rbac/roles/import`,{method:`POST`,body:JSON.stringify(e)}),groups:()=>Z(`/rbac/groups`),group:e=>Z(`/rbac/groups/${e}`),saveGroup:(e,t)=>Z(t===void 0?`/rbac/groups`:`/rbac/groups/${t}`,{method:t===void 0?`POST`:`PATCH`,body:JSON.stringify(e)}),deleteGroup:e=>Z(`/rbac/groups/${e}`,{method:`DELETE`}),users:e=>Z(`/rbac/users?${new URLSearchParams(Object.entries(e).filter(([,e])=>e!==void 0&&e!==``).map(([e,t])=>[e,String(t)]))}`),user:e=>Z(`/rbac/users/${Bg(e)}`),createUser:e=>Z(`/rbac/users`,{method:`POST`,body:JSON.stringify(e)}),updateUser:(e,t)=>Z(`/rbac/users/${Bg(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),setPassword:(e,t)=>Z(`/rbac/users/${Bg(e)}/password`,{method:`POST`,body:JSON.stringify({password:t})}),resetTwoFactor:e=>Z(`/rbac/users/${Bg(e)}/2fa/reset`,{method:`POST`,body:`{}`}),explain:e=>Z(`/rbac/explain?${new URLSearchParams(Object.entries(e).filter(([,e])=>e!==void 0&&e!==``))}`)},upload:(e,t,n)=>kg(e,t,{apiBase:dg.apiBase,csrfToken:_g(),viewAs:Cg(),locale:Yh(),onSignedOut:yg},n),search:e=>Z(`/search?${new URLSearchParams({q:e})}`),schema:async e=>{let t=await Z(`/meta/resources/${Bg(e)}`);return Cg()?Ig(t):t},list:(e,t)=>Z(`/resources/${Bg(e)}?${t}`),remove:(e,t,n)=>Z(`/resources/${Bg(e)}/${Bg(t)}`,{method:`DELETE`,headers:Vg(n)}),options:(e,t,n)=>{let r=new URLSearchParams;return n.ids?r.set(`ids`,n.ids.join(`,`)):n.search&&r.set(`search`,n.search),n.values&&r.set(`values`,n.values),n.parent&&n.values&&r.set(`parent`,n.parent),Z(`/resources/${Bg(e)}/fields/${Bg(t)}/options${r.size?`?${r}`:``}`)},bulkDelete:(e,t)=>Z(`/resources/${Bg(e)}/bulk-delete`,{method:`POST`,body:JSON.stringify({ids:t})}),runAction:(e,t,n)=>Z(`/resources/${Bg(e)}/actions/${Bg(t)}`,{method:`POST`,body:JSON.stringify(n)}),page:async e=>{let t=await Z(`/pages/${Bg(e)}`);return Cg()?Lg(t):t},savePage:(e,t)=>Z(`/pages/${Bg(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),history:(e,t,n)=>Z(`/resources/${Bg(e)}/${Bg(t)}/history${n?`?${new URLSearchParams({before:n})}`:``}`),audit:(e,t)=>{let n=new URLSearchParams(e);return t&&n.set(`before`,t),Z(`/audit${n.size?`?${n}`:``}`)},restore:(e,t)=>Z(`/resources/${Bg(e)}/${Bg(t)}/restore`,{method:`POST`,body:`{}`}),get:(e,t)=>Z(`/resources/${Bg(e)}/${Bg(t)}`),create:(e,t)=>Z(`/resources/${Bg(e)}`,{method:`POST`,body:JSON.stringify(t)}),update:(e,t,n,r)=>Z(`/resources/${Bg(e)}/${Bg(t)}`,{method:`PATCH`,body:JSON.stringify(n),headers:Vg(r)})};function Wg(e){return/\.ico$/i.test(e.name)?`image/x-icon`:e.type?e.type:/\.svg$/i.test(e.name)?`image/svg+xml`:`application/octet-stream`}var Gg=()=>ft({queryKey:[`session`],queryFn:async()=>{let e=await Q.session();return gg(e.csrfToken),e},retry:!1,staleTime:3e5}),Kg=()=>{let{locale:e}=Y();return ft({queryKey:[`meta`,e],queryFn:Q.meta})},qg=(e,t=!0)=>{let{locale:n}=Y();return ft({queryKey:[`schema`,e,n],queryFn:()=>Q.schema(e),enabled:t})},Jg=e=>ft({queryKey:[`menu-badges`],queryFn:Q.menuBadges,enabled:e,refetchInterval:6e4,refetchOnWindowFocus:!0}),Yg=e=>{let{locale:t}=Y();return ft({queryKey:[`page`,e,t],queryFn:()=>Q.page(e)})},Xg=(e,t,n=!0)=>ft({queryKey:[`list`,e,t],queryFn:()=>Q.list(e,new URLSearchParams(t)),placeholderData:ue,enabled:n}),Zg=(e,t)=>ft({queryKey:[`record`,e,t],queryFn:()=>Q.get(e,t),enabled:t!==void 0}),Qg=(e,t,n,r,i,a)=>ft({queryKey:[`options`,e,t,n,i??``,a??``],queryFn:()=>Q.options(e,t,{search:n,values:i,parent:a}),enabled:r,placeholderData:ue}),$g=(e,t,n)=>ft({queryKey:[`options`,e,t,`ids`,n],queryFn:()=>Q.options(e,t,{ids:n}),enabled:n.length>0}),e_=function(e,t){let n=e,r=n_[t],i=null,a=0,o=null,s=[],c={},l=function(e,t){a=n*4+17,i=function(e){let t=Array(e);for(let n=0;n<e;n+=1){t[n]=Array(e);for(let r=0;r<e;r+=1)t[n][r]=null}return t}(a),u(0,0),u(a-7,0),u(0,a-7),p(),f(),h(e,t),n>=7&&m(e),o??=v(n,r,s),g(o,t)},u=function(e,t){for(let n=-1;n<=7;n+=1)if(!(e+n<=-1||a<=e+n))for(let r=-1;r<=7;r+=1)t+r<=-1||a<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?i[e+n][t+r]=!0:i[e+n][t+r]=!1)},d=function(){let e=0,t=0;for(let n=0;n<8;n+=1){l(!0,n);let r=i_.getLostPoint(c);(n==0||e>r)&&(e=r,t=n)}return t},f=function(){for(let e=8;e<a-8;e+=1)i[e][6]??(i[e][6]=e%2==0);for(let e=8;e<a-8;e+=1)i[6][e]??(i[6][e]=e%2==0)},p=function(){let e=i_.getPatternPosition(n);for(let t=0;t<e.length;t+=1)for(let n=0;n<e.length;n+=1){let r=e[t],a=e[n];if(i[r][a]==null)for(let e=-2;e<=2;e+=1)for(let t=-2;t<=2;t+=1)e==-2||e==2||t==-2||t==2||e==0&&t==0?i[r+e][a+t]=!0:i[r+e][a+t]=!1}},m=function(e){let t=i_.getBCHTypeNumber(n);for(let n=0;n<18;n+=1){let r=!e&&(t>>n&1)==1;i[Math.floor(n/3)][n%3+a-8-3]=r}for(let n=0;n<18;n+=1){let r=!e&&(t>>n&1)==1;i[n%3+a-8-3][Math.floor(n/3)]=r}},h=function(e,t){let n=r<<3|t,o=i_.getBCHTypeInfo(n);for(let t=0;t<15;t+=1){let n=!e&&(o>>t&1)==1;t<6?i[t][8]=n:t<8?i[t+1][8]=n:i[a-15+t][8]=n}for(let t=0;t<15;t+=1){let n=!e&&(o>>t&1)==1;t<8?i[8][a-t-1]=n:t<9?i[8][15-t-1+1]=n:i[8][15-t-1]=n}i[a-8][8]=!e},g=function(e,t){let n=-1,r=a-1,o=7,s=0,c=i_.getMaskFunction(t);for(let t=a-1;t>0;t-=2)for(t==6&&--t;;){for(let n=0;n<2;n+=1)if(i[r][t-n]==null){let a=!1;s<e.length&&(a=(e[s]>>>o&1)==1),c(r,t-n)&&(a=!a),i[r][t-n]=a,--o,o==-1&&(s+=1,o=7)}if(r+=n,r<0||a<=r){r-=n,n=-n;break}}},_=function(e,t){let n=0,r=0,i=0,a=Array(t.length),o=Array(t.length);for(let s=0;s<t.length;s+=1){let c=t[s].dataCount,l=t[s].totalCount-c;r=Math.max(r,c),i=Math.max(i,l),a[s]=Array(c);for(let t=0;t<a[s].length;t+=1)a[s][t]=255&e.getBuffer()[t+n];n+=c;let u=i_.getErrorCorrectPolynomial(l),d=o_(a[s],u.getLength()-1).mod(u);o[s]=Array(u.getLength()-1);for(let e=0;e<o[s].length;e+=1){let t=e+d.getLength()-o[s].length;o[s][e]=t>=0?d.getAt(t):0}}let s=0;for(let e=0;e<t.length;e+=1)s+=t[e].totalCount;let c=Array(s),l=0;for(let e=0;e<r;e+=1)for(let n=0;n<t.length;n+=1)e<a[n].length&&(c[l]=a[n][e],l+=1);for(let e=0;e<i;e+=1)for(let n=0;n<t.length;n+=1)e<o[n].length&&(c[l]=o[n][e],l+=1);return c},v=function(e,t,n){let r=s_.getRSBlocks(e,t),i=c_();for(let t=0;t<n.length;t+=1){let r=n[t];i.put(r.getMode(),4),i.put(r.getLength(),i_.getLengthInBits(r.getMode(),e)),r.write(i)}let a=0;for(let e=0;e<r.length;e+=1)a+=r[e].dataCount;if(i.getLengthInBits()>a*8)throw`code length overflow. (`+i.getLengthInBits()+`>`+a*8+`)`;for(i.getLengthInBits()+4<=a*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=a*8||(i.put(236,8),i.getLengthInBits()>=a*8));)i.put(17,8);return _(i,r)};c.addData=function(e,t){t||=`Byte`;let n=null;switch(t){case`Numeric`:n=l_(e);break;case`Alphanumeric`:n=u_(e);break;case`Byte`:n=d_(e);break;case`Kanji`:n=f_(e);break;default:throw`mode:`+t}s.push(n),o=null},c.isDark=function(e,t){if(e<0||a<=e||t<0||a<=t)throw e+`,`+t;return i[e][t]},c.getModuleCount=function(){return a},c.make=function(){if(n<1){let e=1;for(;e<40;e++){let t=s_.getRSBlocks(e,r),n=c_();for(let t=0;t<s.length;t++){let r=s[t];n.put(r.getMode(),4),n.put(r.getLength(),i_.getLengthInBits(r.getMode(),e)),r.write(n)}let i=0;for(let e=0;e<t.length;e++)i+=t[e].dataCount;if(n.getLengthInBits()<=i*8)break}n=e}l(!1,d())},c.createTableTag=function(e,t){e||=2,t=t===void 0?e*4:t;let n=``;n+=`<table style="`,n+=` border-width: 0px; border-style: none;`,n+=` border-collapse: collapse;`,n+=` padding: 0px; margin: `+t+`px;`,n+=`">`,n+=`<tbody>`;for(let t=0;t<c.getModuleCount();t+=1){n+=`<tr>`;for(let r=0;r<c.getModuleCount();r+=1)n+=`<td style="`,n+=` border-width: 0px; border-style: none;`,n+=` border-collapse: collapse;`,n+=` padding: 0px; margin: 0px;`,n+=` width: `+e+`px;`,n+=` height: `+e+`px;`,n+=` background-color: `,n+=c.isDark(t,r)?`#000000`:`#ffffff`,n+=`;`,n+=`"/>`;n+=`</tr>`}return n+=`</tbody>`,n+=`</table>`,n},c.createSvgTag=function(e,t,n,r){let i={};typeof arguments[0]==`object`&&(i=arguments[0],e=i.cellSize,t=i.margin,n=i.alt,r=i.title),e||=2,t=t===void 0?e*4:t,n=typeof n==`string`?{text:n}:n||{},n.text=n.text||null,n.id=n.text?n.id||`qrcode-description`:null,r=typeof r==`string`?{text:r}:r||{},r.text=r.text||null,r.id=r.text?r.id||`qrcode-title`:null;let a=c.getModuleCount()*e+t*2,o,s,l,u,d=``,f;for(f=`l`+e+`,0 0,`+e+` -`+e+`,0 0,-`+e+`z `,d+=`<svg version="1.1" xmlns="http://www.w3.org/2000/svg"`,d+=i.scalable?``:` width="`+a+`px" height="`+a+`px"`,d+=` viewBox="0 0 `+a+` `+a+`" `,d+=` preserveAspectRatio="xMinYMin meet"`,d+=r.text||n.text?` role="img" aria-labelledby="`+y([r.id,n.id].join(` `).trim())+`"`:``,d+=`>`,d+=r.text?`<title id="`+y(r.id)+`">`+y(r.text)+`</title>`:``,d+=n.text?`<description id="`+y(n.id)+`">`+y(n.text)+`</description>`:``,d+=`<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>`,d+=`<path d="`,l=0;l<c.getModuleCount();l+=1)for(u=l*e+t,o=0;o<c.getModuleCount();o+=1)c.isDark(l,o)&&(s=o*e+t,d+=`M`+s+`,`+u+f);return d+=`" stroke="transparent" fill="black"/>`,d+=`</svg>`,d},c.createDataURL=function(e,t){e||=2,t=t===void 0?e*4:t;let n=c.getModuleCount()*e+t*2,r=t,i=n-t;return __(n,n,function(t,n){if(r<=t&&t<i&&r<=n&&n<i){let i=Math.floor((t-r)/e),a=Math.floor((n-r)/e);return+!c.isDark(a,i)}return 1})},c.createImgTag=function(e,t,n){e||=2,t=t===void 0?e*4:t;let r=c.getModuleCount()*e+t*2,i=``;return i+=`<img`,i+=` src="`,i+=c.createDataURL(e,t),i+=`"`,i+=` width="`,i+=r,i+=`"`,i+=` height="`,i+=r,i+=`"`,n&&(i+=` alt="`,i+=y(n),i+=`"`),i+=`/>`,i};let y=function(e){let t=``;for(let n=0;n<e.length;n+=1){let r=e.charAt(n);switch(r){case`<`:t+=`&lt;`;break;case`>`:t+=`&gt;`;break;case`&`:t+=`&amp;`;break;case`"`:t+=`&quot;`;break;default:t+=r}}return t},b=function(e){e=e===void 0?2:e;let t=c.getModuleCount()*1+e*2,n=e,r=t-e,i,a,o,s,l,u={"██":`█`,"█ ":`▀`," █":`▄`," ":` `},d={"██":`▀`,"█ ":`▀`," █":` `," ":` `},f=``;for(i=0;i<t;i+=2){for(o=Math.floor((i-n)/1),s=Math.floor((i+1-n)/1),a=0;a<t;a+=1)l=`█`,n<=a&&a<r&&n<=i&&i<r&&c.isDark(o,Math.floor((a-n)/1))&&(l=` `),n<=a&&a<r&&n<=i+1&&i+1<r&&c.isDark(s,Math.floor((a-n)/1))?l+=` `:l+=`█`,f+=e<1&&i+1>=r?d[l]:u[l];f+=`
51
51
  `}return t%2&&e>0?f.substring(0,f.length-t-1)+Array(t+1).join(`▀`):f.substring(0,f.length-1)};return c.createASCII=function(e,t){if(e||=1,e<2)return b(t);--e,t=t===void 0?e*2:t;let n=c.getModuleCount()*e+t*2,r=t,i=n-t,a,o,s,l,u=Array(e+1).join(`██`),d=Array(e+1).join(` `),f=``,p=``;for(a=0;a<n;a+=1){for(s=Math.floor((a-r)/e),p=``,o=0;o<n;o+=1)l=1,r<=o&&o<i&&r<=a&&a<i&&c.isDark(s,Math.floor((o-r)/e))&&(l=0),p+=l?u:d;for(s=0;s<e;s+=1)f+=p+`
52
- `}return f.substring(0,f.length-1)},c.renderTo2dContext=function(e,t){t||=2;let n=c.getModuleCount();for(let r=0;r<n;r++)for(let i=0;i<n;i++)e.fillStyle=c.isDark(r,i)?`black`:`white`,e.fillRect(i*t,r*t,t,t)},c};$g.stringToBytes=function(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);t.push(r&255)}return t},$g.createStringToBytes=function(e,t){let n=function(){let n=m_(e),r=function(){let e=n.read();if(e==-1)throw`eof`;return e},i=0,a={};for(;;){let e=n.read();if(e==-1)break;let t=r(),o=r(),s=r(),c=String.fromCharCode(e<<8|t);a[c]=o<<8|s,i+=1}if(i!=t)throw i+` != `+t;return a}();return function(e){let t=[];for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);if(i<128)t.push(i);else{let i=n[e.charAt(r)];typeof i==`number`?(i&255)==i?t.push(i):(t.push(i>>>8),t.push(i&255)):t.push(63)}}return t}};var e_={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},t_={L:1,M:0,Q:3,H:2},n_={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},r_=function(){let e=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],t=1335,n=7973,r={},i=function(e){let t=0;for(;e!=0;)t+=1,e>>>=1;return t};return r.getBCHTypeInfo=function(e){let n=e<<10;for(;i(n)-i(t)>=0;)n^=t<<i(n)-i(t);return(e<<10|n)^21522},r.getBCHTypeNumber=function(e){let t=e<<12;for(;i(t)-i(n)>=0;)t^=n<<i(t)-i(n);return e<<12|t},r.getPatternPosition=function(t){return e[t-1]},r.getMaskFunction=function(e){switch(e){case n_.PATTERN000:return function(e,t){return(e+t)%2==0};case n_.PATTERN001:return function(e,t){return e%2==0};case n_.PATTERN010:return function(e,t){return t%3==0};case n_.PATTERN011:return function(e,t){return(e+t)%3==0};case n_.PATTERN100:return function(e,t){return(Math.floor(e/2)+Math.floor(t/3))%2==0};case n_.PATTERN101:return function(e,t){return e*t%2+e*t%3==0};case n_.PATTERN110:return function(e,t){return(e*t%2+e*t%3)%2==0};case n_.PATTERN111:return function(e,t){return(e*t%3+(e+t)%2)%2==0};default:throw`bad maskPattern:`+e}},r.getErrorCorrectPolynomial=function(e){let t=a_([1],0);for(let n=0;n<e;n+=1)t=t.multiply(a_([1,i_.gexp(n)],0));return t},r.getLengthInBits=function(e,t){if(1<=t&&t<10)switch(e){case e_.MODE_NUMBER:return 10;case e_.MODE_ALPHA_NUM:return 9;case e_.MODE_8BIT_BYTE:return 8;case e_.MODE_KANJI:return 8;default:throw`mode:`+e}else if(t<27)switch(e){case e_.MODE_NUMBER:return 12;case e_.MODE_ALPHA_NUM:return 11;case e_.MODE_8BIT_BYTE:return 16;case e_.MODE_KANJI:return 10;default:throw`mode:`+e}else if(t<41)switch(e){case e_.MODE_NUMBER:return 14;case e_.MODE_ALPHA_NUM:return 13;case e_.MODE_8BIT_BYTE:return 16;case e_.MODE_KANJI:return 12;default:throw`mode:`+e}else throw`type:`+t},r.getLostPoint=function(e){let t=e.getModuleCount(),n=0;for(let r=0;r<t;r+=1)for(let i=0;i<t;i+=1){let a=0,o=e.isDark(r,i);for(let n=-1;n<=1;n+=1)if(!(r+n<0||t<=r+n))for(let s=-1;s<=1;s+=1)i+s<0||t<=i+s||(n!=0||s!=0)&&o==e.isDark(r+n,i+s)&&(a+=1);a>5&&(n+=3+a-5)}for(let r=0;r<t-1;r+=1)for(let i=0;i<t-1;i+=1){let t=0;e.isDark(r,i)&&(t+=1),e.isDark(r+1,i)&&(t+=1),e.isDark(r,i+1)&&(t+=1),e.isDark(r+1,i+1)&&(t+=1),(t==0||t==4)&&(n+=3)}for(let r=0;r<t;r+=1)for(let i=0;i<t-6;i+=1)e.isDark(r,i)&&!e.isDark(r,i+1)&&e.isDark(r,i+2)&&e.isDark(r,i+3)&&e.isDark(r,i+4)&&!e.isDark(r,i+5)&&e.isDark(r,i+6)&&(n+=40);for(let r=0;r<t;r+=1)for(let i=0;i<t-6;i+=1)e.isDark(i,r)&&!e.isDark(i+1,r)&&e.isDark(i+2,r)&&e.isDark(i+3,r)&&e.isDark(i+4,r)&&!e.isDark(i+5,r)&&e.isDark(i+6,r)&&(n+=40);let r=0;for(let n=0;n<t;n+=1)for(let i=0;i<t;i+=1)e.isDark(i,n)&&(r+=1);let i=Math.abs(100*r/t/t-50)/5;return n+=i*10,n},r}(),i_=function(){let e=Array(256),t=Array(256);for(let t=0;t<8;t+=1)e[t]=1<<t;for(let t=8;t<256;t+=1)e[t]=e[t-4]^e[t-5]^e[t-6]^e[t-8];for(let n=0;n<255;n+=1)t[e[n]]=n;let n={};return n.glog=function(e){if(e<1)throw`glog(`+e+`)`;return t[e]},n.gexp=function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return e[t]},n}(),a_=function(e,t){if(e.length===void 0)throw e.length+`/`+t;let n=function(){let n=0;for(;n<e.length&&e[n]==0;)n+=1;let r=Array(e.length-n+t);for(let t=0;t<e.length-n;t+=1)r[t]=e[t+n];return r}(),r={};return r.getAt=function(e){return n[e]},r.getLength=function(){return n.length},r.multiply=function(e){let t=Array(r.getLength()+e.getLength()-1);for(let n=0;n<r.getLength();n+=1)for(let i=0;i<e.getLength();i+=1)t[n+i]^=i_.gexp(i_.glog(r.getAt(n))+i_.glog(e.getAt(i)));return a_(t,0)},r.mod=function(e){if(r.getLength()-e.getLength()<0)return r;let t=i_.glog(r.getAt(0))-i_.glog(e.getAt(0)),n=Array(r.getLength());for(let e=0;e<r.getLength();e+=1)n[e]=r.getAt(e);for(let r=0;r<e.getLength();r+=1)n[r]^=i_.gexp(i_.glog(e.getAt(r))+t);return a_(n,0).mod(e)},r},o_=function(){let e=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],t=function(e,t){let n={};return n.totalCount=e,n.dataCount=t,n},n={},r=function(t,n){switch(n){case t_.L:return e[(t-1)*4+0];case t_.M:return e[(t-1)*4+1];case t_.Q:return e[(t-1)*4+2];case t_.H:return e[(t-1)*4+3];default:return}};return n.getRSBlocks=function(e,n){let i=r(e,n);if(i===void 0)throw`bad rs block @ typeNumber:`+e+`/errorCorrectionLevel:`+n;let a=i.length/3,o=[];for(let e=0;e<a;e+=1){let n=i[e*3+0],r=i[e*3+1],a=i[e*3+2];for(let e=0;e<n;e+=1)o.push(t(r,a))}return o},n}(),s_=function(){let e=[],t=0,n={};return n.getBuffer=function(){return e},n.getAt=function(t){let n=Math.floor(t/8);return(e[n]>>>7-t%8&1)==1},n.put=function(e,t){for(let r=0;r<t;r+=1)n.putBit((e>>>t-r-1&1)==1)},n.getLengthInBits=function(){return t},n.putBit=function(n){let r=Math.floor(t/8);e.length<=r&&e.push(0),n&&(e[r]|=128>>>t%8),t+=1},n},c_=function(e){let t=e_.MODE_NUMBER,n=e,r={};r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){let t=n,r=0;for(;r+2<t.length;)e.put(i(t.substring(r,r+3)),10),r+=3;r<t.length&&(t.length-r==1?e.put(i(t.substring(r,r+1)),4):t.length-r==2&&e.put(i(t.substring(r,r+2)),7))};let i=function(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*10+a(e.charAt(n));return t},a=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;throw`illegal char :`+e};return r},l_=function(e){let t=e_.MODE_ALPHA_NUM,n=e,r={};r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){let t=n,r=0;for(;r+1<t.length;)e.put(i(t.charAt(r))*45+i(t.charAt(r+1)),11),r+=2;r<t.length&&e.put(i(t.charAt(r)),6)};let i=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;if(`A`<=e&&e<=`Z`)return e.charCodeAt(0)-65+10;switch(e){case` `:return 36;case`$`:return 37;case`%`:return 38;case`*`:return 39;case`+`:return 40;case`-`:return 41;case`.`:return 42;case`/`:return 43;case`:`:return 44;default:throw`illegal char :`+e}};return r},u_=function(e){let t=e_.MODE_8BIT_BYTE,n=$g.stringToBytes(e),r={};return r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){for(let t=0;t<n.length;t+=1)e.put(n[t],8)},r},d_=function(e){let t=e_.MODE_KANJI,n=$g.stringToBytes;(function(e,t){let r=n(e);if(r.length!=2||(r[0]<<8|r[1])!=t)throw`sjis not supported.`})(`友`,38726);let r=n(e),i={};return i.getMode=function(){return t},i.getLength=function(e){return~~(r.length/2)},i.write=function(e){let t=r,n=0;for(;n+1<t.length;){let r=(255&t[n])<<8|255&t[n+1];if(33088<=r&&r<=40956)r-=33088;else if(57408<=r&&r<=60351)r-=49472;else throw`illegal char at `+(n+1)+`/`+r;r=(r>>>8&255)*192+(r&255),e.put(r,13),n+=2}if(n<t.length)throw`illegal char at `+(n+1)},i},f_=function(){let e=[],t={};return t.writeByte=function(t){e.push(t&255)},t.writeShort=function(e){t.writeByte(e),t.writeByte(e>>>8)},t.writeBytes=function(e,n,r){n||=0,r||=e.length;for(let i=0;i<r;i+=1)t.writeByte(e[i+n])},t.writeString=function(e){for(let n=0;n<e.length;n+=1)t.writeByte(e.charCodeAt(n))},t.toByteArray=function(){return e},t.toString=function(){let t=``;t+=`[`;for(let n=0;n<e.length;n+=1)n>0&&(t+=`,`),t+=e[n];return t+=`]`,t},t},p_=function(){let e=0,t=0,n=0,r=``,i={},a=function(e){r+=String.fromCharCode(o(e&63))},o=function(e){if(e<0)throw`n:`+e;if(e<26)return 65+e;if(e<52)return 97+(e-26);if(e<62)return 48+(e-52);if(e==62)return 43;if(e==63)return 47;throw`n:`+e};return i.writeByte=function(r){for(e=e<<8|r&255,t+=8,n+=1;t>=6;)a(e>>>t-6),t-=6},i.flush=function(){if(t>0&&(a(e<<6-t),e=0,t=0),n%3!=0){let e=3-n%3;for(let t=0;t<e;t+=1)r+=`=`}},i.toString=function(){return r},i},m_=function(e){let t=e,n=0,r=0,i=0,a={};a.read=function(){for(;i<8;){if(n>=t.length){if(i==0)return-1;throw`unexpected end of file./`+i}let e=t.charAt(n);if(n+=1,e==`=`)return i=0,-1;e.match(/^\s$/)||(r=r<<6|o(e.charCodeAt(0)),i+=6)}let e=r>>>i-8&255;return i-=8,e};let o=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(e==43)return 62;if(e==47)return 63;throw`c:`+e};return a},h_=function(e,t){let n=e,r=t,i=Array(e*t),a={};a.setPixel=function(e,t,r){i[t*n+e]=r},a.write=function(e){e.writeString(`GIF87a`),e.writeShort(n),e.writeShort(r),e.writeByte(128),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(255),e.writeByte(255),e.writeByte(255),e.writeString(`,`),e.writeShort(0),e.writeShort(0),e.writeShort(n),e.writeShort(r),e.writeByte(0);let t=s(2);e.writeByte(2);let i=0;for(;t.length-i>255;)e.writeByte(255),e.writeBytes(t,i,255),i+=255;e.writeByte(t.length-i),e.writeBytes(t,i,t.length-i),e.writeByte(0),e.writeString(`;`)};let o=function(e){let t=e,n=0,r=0,i={};return i.write=function(e,i){if(e>>>i)throw`length over`;for(;n+i>=8;)t.writeByte(255&(e<<n|r)),i-=8-n,e>>>=8-n,r=0,n=0;r=e<<n|r,n+=i},i.flush=function(){n>0&&t.writeByte(r)},i},s=function(e){let t=1<<e,n=(1<<e)+1,r=e+1,a=c();for(let e=0;e<t;e+=1)a.add(String.fromCharCode(e));a.add(String.fromCharCode(t)),a.add(String.fromCharCode(n));let s=f_(),l=o(s);l.write(t,r);let u=0,d=String.fromCharCode(i[u]);for(u+=1;u<i.length;){let e=String.fromCharCode(i[u]);u+=1,a.contains(d+e)?d+=e:(l.write(a.indexOf(d),r),a.size()<4095&&(a.size()==1<<r&&(r+=1),a.add(d+e)),d=e)}return l.write(a.indexOf(d),r),l.write(n,r),l.flush(),s.toByteArray()},c=function(){let e={},t=0,n={};return n.add=function(r){if(n.contains(r))throw`dup key:`+r;e[r]=t,t+=1},n.size=function(){return t},n.indexOf=function(t){return e[t]},n.contains=function(t){return e[t]!==void 0},n};return a},g_=function(e,t,n){let r=h_(e,t);for(let i=0;i<t;i+=1)for(let t=0;t<e;t+=1)r.setPixel(t,i,n(t,i));let i=f_();r.write(i);let a=p_(),o=i.toByteArray();for(let e=0;e<o.length;e+=1)a.writeByte(o[e]);return a.flush(),`data:image/gif;base64,`+a};$g.stringToBytes;function __({text:e,label:t}){let{size:n,path:r}=(0,y.useMemo)(()=>{let t=$g(0,`M`);t.addData(e),t.make();let n=t.getModuleCount(),r=``;for(let e=0;e<n;e++)for(let i=0;i<n;i++)t.isDark(e,i)&&(r+=`M${i} ${e}h1v1h-1z`);return{size:n,path:r}},[e]);return(0,b.jsx)(`svg`,{viewBox:`-3 -3 ${n+6} ${n+6}`,role:`img`,"aria-label":t,className:`size-44 rounded-md bg-white`,shapeRendering:`crispEdges`,children:(0,b.jsx)(`path`,{d:r,fill:`#000`})})}function v_(){let{t:e}=Y(),t=Wg();if(t.isPending)return(0,b.jsx)(G,{children:e(`common.loading`)});if(!t.data)return null;if(t.data.viewAs)return(0,b.jsx)(Da,{to:`/`,replace:!0});let{user:n,auth:r}=t.data;return(0,b.jsxs)(`div`,{className:`flex max-w-2xl flex-col gap-8`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:e(`auth.account`)}),(0,b.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[n.displayName,n.username?` · ${n.username}`:``]})]}),r.password&&(0,b.jsx)(y_,{}),r.twoFactor&&(0,b.jsx)(b_,{}),r.sessions&&(0,b.jsx)(S_,{revokeOthers:r.revokeOthers})]})}function y_(){let{t:e}=Y(),t=S(),[n,r]=(0,y.useState)(``),[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)({}),[u,d]=(0,y.useState)(!1),f=pt({mutationFn:()=>Q.changePassword(n,i),onSuccess:async()=>{r(``),a(``),s(``),l({}),d(!0),await t.invalidateQueries({queryKey:[`account-sessions`]})},onError:e=>l(e instanceof fg&&Object.keys(e.fields).length>0?e.fields:{form:[pg(e)]})});function p(t){t.preventDefault(),d(!1);let r={};n||(r.current=[e(`validation.required`)]),i?i!==o&&(r.confirm=[e(`auth.mismatch`)]):r.next=[e(`validation.required`)],l(r),Object.keys(r).length===0&&f.mutate()}let m=(e,t,n,r,i)=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`password-${e}`,children:t}),(0,b.jsx)(Oh,{id:`password-${e}`,type:`password`,autoComplete:i,value:n,onChange:e=>r(e.target.value),"aria-invalid":c[e]?!0:void 0,"aria-describedby":c[e]?`password-${e}-error`:void 0}),c[e]&&(0,b.jsx)(`p`,{id:`password-${e}-error`,className:`text-sm text-destructive`,children:c[e].join(` `)})]});return(0,b.jsxs)(`section`,{"aria-labelledby":`password-title`,className:`flex flex-col gap-4 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsx)(`h2`,{id:`password-title`,className:`font-medium`,children:e(`auth.changePassword`)}),(0,b.jsxs)(`form`,{onSubmit:p,noValidate:!0,className:`flex flex-col gap-4`,children:[c.form&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:c.form.join(` `)}),u&&(0,b.jsx)(`p`,{role:`status`,className:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:e(`auth.passwordChanged`)}),m(`current`,e(`auth.currentPassword`),n,r,`current-password`),m(`next`,e(`auth.newPassword`),i,a,`new-password`),m(`confirm`,e(`auth.confirmPassword`),o,s,`new-password`),(0,b.jsx)(`div`,{children:(0,b.jsx)(q,{type:`submit`,disabled:f.isPending,children:e(`auth.changePassword`)})})]})]})}function b_(){let{t:e}=Y(),t=S(),n=ft({queryKey:[`account-2fa`],queryFn:Q.twoFactor.status}),[r,i]=(0,y.useState)(``),[a,o]=(0,y.useState)(``),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(!1),[d,f]=(0,y.useState)(null),[p,m]=(0,y.useState)(null),h=e=>m(e instanceof fg&&Object.keys(e.fields).length>0?Object.values(e.fields).flat().join(` `):pg(e)),g=async()=>{await t.invalidateQueries({queryKey:[`account-2fa`]}),await t.invalidateQueries({queryKey:[`account-sessions`]})},_=pt({mutationFn:Q.twoFactor.setup,onMutate:()=>m(null),onError:h}),v=pt({mutationFn:()=>Q.twoFactor.confirm(r.trim()),onMutate:()=>m(null),onSuccess:async t=>{c(t.recoveryCodes),i(``),_.reset(),f(e(`twoFactor.enabledNote`)),await g()},onError:h}),x=pt({mutationFn:()=>Q.twoFactor.recoveryCodes(a),onMutate:()=>m(null),onSuccess:async e=>{c(e.recoveryCodes),o(``),await g()},onError:h}),C=pt({mutationFn:()=>Q.twoFactor.disable(a),onMutate:()=>m(null),onSuccess:async()=>{o(``),c(null),f(e(`twoFactor.disabledNote`)),await g()},onError:h}),w=n.data?.enabled===!0,T=_.data;return(0,b.jsxs)(`section`,{"aria-labelledby":`two-factor-title`,className:`flex flex-col gap-3 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`h2`,{id:`two-factor-title`,className:`font-medium`,children:e(`twoFactor.title`)}),n.data&&(0,b.jsx)(`span`,{className:w?`rounded-full bg-green-500/15 px-2 py-0.5 text-xs text-green-800 dark:text-green-300`:`rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground`,children:e(w?`twoFactor.on`:`twoFactor.off`)})]}),p&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:p}),d&&!p&&(0,b.jsx)(`p`,{role:`status`,className:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:d}),s&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border bg-muted/40 p-3`,children:[(0,b.jsx)(`h3`,{className:`text-sm font-medium`,children:e(`twoFactor.recoveryTitle`)}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`twoFactor.recoveryIntro`)}),(0,b.jsx)(`ul`,{"aria-label":e(`twoFactor.recoveryTitle`),dir:`ltr`,className:`grid grid-cols-2 gap-1 font-mono text-sm`,children:s.map(e=>(0,b.jsx)(`li`,{children:e},e))}),(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{navigator.clipboard?.writeText(s.join(`
53
- `)).then(()=>u(!0),()=>void 0)},children:e(l?`twoFactor.copied`:`twoFactor.copy`)}),(0,b.jsx)(q,{type:`button`,size:`sm`,onClick:()=>{c(null),u(!1)},children:e(`twoFactor.done`)})]})]}),n.data&&!w&&!T&&(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`twoFactor.intro`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:_.isPending,onClick:()=>_.mutate(),children:e(`twoFactor.setUp`)})]}),!w&&T&&(0,b.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),r.trim()&&v.mutate()},children:[(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`twoFactor.scan`)}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,b.jsx)(__,{text:T.otpauthUrl,label:e(`twoFactor.qr`)}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 text-sm`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e(`twoFactor.key`)}),(0,b.jsx)(`code`,{dir:`ltr`,"data-testid":`two-factor-key`,className:`break-all font-mono`,children:T.secret.match(/.{1,4}/g).join(` `)})]})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`two-factor-code`,children:e(`twoFactor.code`)}),(0,b.jsx)(Oh,{id:`two-factor-code`,autoComplete:`one-time-code`,inputMode:`numeric`,dir:`ltr`,maxLength:10,value:r,onChange:e=>i(e.target.value)})]}),(0,b.jsx)(q,{type:`submit`,disabled:v.isPending||!r.trim(),children:e(`twoFactor.turnOn`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>_.reset(),children:e(`common.cancel`)})]})]}),w&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`twoFactor.left`,{count:n.data.recoveryCodesLeft})}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`two-factor-password`,children:e(`twoFactor.password`)}),(0,b.jsx)(Oh,{id:`two-factor-password`,type:`password`,autoComplete:`current-password`,value:a,onChange:e=>o(e.target.value)})]}),(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:!a||x.isPending,onClick:()=>x.mutate(),children:e(`twoFactor.newCodes`)}),(0,b.jsx)(q,{type:`button`,variant:`destructive`,disabled:!a||C.isPending,onClick:()=>C.mutate(),children:e(`twoFactor.turnOff`)})]})]})]})}function x_(e,t){return e?[/Edg\//.test(e)?`Edge`:/Firefox\//.test(e)?`Firefox`:/Chrome\//.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:void 0,/Android/.test(e)?`Android`:/iPhone|iPad/.test(e)?`iOS`:/Mac OS X/.test(e)?`macOS`:/Windows/.test(e)?`Windows`:/Linux/.test(e)?`Linux`:void 0].filter(Boolean).join(` · `)||e.slice(0,40):t}function S_({revokeOthers:e}){let{t}=Y(),n=S(),r=ft({queryKey:[`account-sessions`],queryFn:Q.sessions}),i=()=>n.invalidateQueries({queryKey:[`account-sessions`]}),a=pt({mutationFn:e=>Q.revokeSession(e),onSuccess:i}),o=pt({mutationFn:()=>Q.revokeOtherSessions(),onSuccess:i}),s=r.data?.items??[],c=a.error??o.error??r.error;return(0,b.jsxs)(`section`,{"aria-labelledby":`sessions-title`,className:`flex flex-col gap-3 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`h2`,{id:`sessions-title`,className:`font-medium`,children:t(`auth.sessions`)}),e&&s.length>1&&(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(),children:t(`auth.signOutOthers`)})]}),c&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:pg(c)}),(0,b.jsx)(`ul`,{"aria-label":t(`auth.sessions`),className:`flex flex-col divide-y`,children:s.map(e=>(0,b.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 py-2 text-sm`,children:[(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,b.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,title:e.userAgent,children:[x_(e.userAgent,t(`auth.unknownDevice`)),e.current&&(0,b.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs text-primary`,children:t(`auth.thisDevice`)})]}),(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[t(`auth.lastSeen`,{when:ng(new Date(e.lastSeenAt))}),e.ip?` · ${e.ip}`:``]})]}),!e.current&&(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(e.id),"aria-label":t(`auth.revokeSession`,{name:x_(e.userAgent,t(`auth.unknownDevice`))}),children:t(`auth.revoke`)})]},e.id))})]})}function C_(e,t){return e==null?``:typeof e==`string`?e:e[t]??e[dg.locale]??Object.values(e)[0]??``}function w_(e){let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e.trim()!==``).map(([e,t])=>[e,t.trim()])),n=Object.keys(t);if(n.length!==0)return dg.locales.length===1?t[n[0]]:t}function T_(e){let t=Object.fromEntries(dg.locales.map(e=>[e,``]));return typeof e==`string`?t[dg.locale]=e:e&&Object.assign(t,e),t}function E_({children:e,actions:t}){return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:e}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t})]})}function D_({children:e,tone:t=`error`}){return(0,b.jsx)(`p`,{role:t===`error`?`alert`:`status`,className:t===`error`?`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:e})}var O_=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function k_(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:O_(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var A_=e=>{let t=``,n=!1;for(let r of e){if(r===`-`||r===`_`||r<=` `){n=t.length>0;continue}t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1}return t},j_=e=>{let t=A_(e);return t.charAt(0).toUpperCase()+t.slice(1)},M_=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),N_={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function P_(e){return e!=null}function F_(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??N_.width,a=e.size??e.height??N_.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?M_(...c):M_(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??N_[`stroke-width`])*Number(e.size??e.width??N_.width)/Number(t.size??t.width??N_.width):t.strokeWidth??N_[`stroke-width`];return[`svg`,{...Object.entries(N_).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&P_(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&P_(t.width)&&{[r(`width`)]:t.width},...`height`in t&&P_(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function I_(e,t={}){return F_(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var L_=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},R_=(0,y.createContext)({}),z_=()=>(0,y.useContext)(R_),B_=(0,y.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=z_()??{},b=!!c||L_(d),[x,S,C=[]]=I_(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:M_(v,s),hasA11yProp:b,attributes:d});return(0,y.createElement)(x,{ref:f,...S},[...C.map(([e,t])=>(0,y.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function $(e,t=[],n=[]){let r=typeof e==`string`?k_(e,t,n):e,i=(0,y.forwardRef)(({className:e,...t},n)=>(0,y.createElement)(B_,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=j_(r.name)),i}var V_={name:`archive`,size:24,node:[[`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`}]]};V_.node;var H_=$(V_),U_={name:`arrow-down-up`,size:24,node:[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`m21 8-4-4-4 4`,key:`1c9v7m`}],[`path`,{d:`M17 4v16`,key:`7dpous`}]]};U_.node;var W_=$(U_),G_={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};G_.node;var K_=$(G_),q_={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};q_.node;var J_=$(q_),Y_={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Y_.node;var X_=$(Y_),Z_={name:`ban`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]};Z_.node;var Q_=$(Z_),$_={name:`bell`,size:24,node:[[`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`}]]};$_.node;var ev=$($_),tv={name:`book-open`,size:24,node:[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]};tv.node;var nv=$(tv),rv={name:`box`,size:24,node:[[`path`,{d:`M21 8a2 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]};rv.node;var iv=$(rv),av={name:`boxes`,size:24,node:[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]};av.node;var ov=$(av),sv={name:`briefcase`,size:24,node:[[`path`,{d:`M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16`,key:`jecpp`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]};sv.node;var cv=$(sv),lv={name:`building-complex`,size:24,node:[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]],aliases:[`building-2`]};lv.node;var uv=$(lv),dv={name:`calendar-days`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 13h.01`,key:`1sbv64`}],[`path`,{d:`M12 13h.01`,key:`y0uutt`}],[`path`,{d:`M16 13h.01`,key:`wip0gl`}],[`path`,{d:`M8 17h.01`,key:`p3bg7i`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M16 17h.01`,key:`ql8jdd`}]]};dv.node;var fv=$(dv),pv={name:`calendar-range`,size:24,node:[[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M17 13h-6`,key:`1qbiup`}],[`path`,{d:`M13 17H7`,key:`1x38vv`}],[`path`,{d:`M7 13h.01`,key:`1vezk1`}],[`path`,{d:`M17 17h.01`,key:`1sd3ek`}]]};pv.node;var mv=$(pv),hv={name:`calendar`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};hv.node;var gv=$(hv),_v={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};_v.node;var vv=$(_v),yv={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};yv.node;var bv=$(yv),xv={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};xv.node;var Sv=$(xv),Cv={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};Cv.node;var wv=$(Cv),Tv={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Tv.node;var Ev=$(Tv),Dv={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};Dv.node;var Ov=$(Dv),kv={name:`circle-plus`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]],aliases:[`plus-circle`]};kv.node;var Av=$(kv),jv={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};jv.node;var Mv=$(jv),Nv={name:`columns-3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]],aliases:[`panels-left-right`]};Nv.node;var Pv=$(Nv),Fv={name:`copy`,size:24,node:[[`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`}]]};Fv.node;var Iv=$(Fv),Lv={name:`credit-card`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}],[`path`,{d:`M6 14h2`,key:`mk7k0u`}]]};Lv.node;var Rv=$(Lv),zv={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};zv.node;var Bv=$(zv),Vv={name:`dollar-sign`,size:24,node:[[`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`}]]};Vv.node;var Hv=$(Vv),Uv={name:`download`,size:24,node:[[`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`}]]};Uv.node;var Wv=$(Uv),Gv={name:`ellipsis-vertical`,size:24,node:[[`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`}]],aliases:[`more-vertical`]};Gv.node;var Kv=$(Gv),qv={name:`ellipsis`,size:24,node:[[`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`}]],aliases:[`more-horizontal`]};qv.node;var Jv=$(qv),Yv={name:`external-link`,size:24,node:[[`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`}]]};Yv.node;var Xv=$(Yv),Zv={name:`eye`,size:24,node:[[`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`}]]};Zv.node;var Qv=$(Zv),$v={name:`file-spreadsheet`,size:24,node:[[`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:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};$v.node;var ey=$($v),ty={name:`file-text`,size:24,node:[[`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`}]]};ty.node;var ny=$(ty),ry={name:`file`,size:24,node:[[`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`}]]};ry.node;var iy=$(ry),ay={name:`folder`,size:24,node:[[`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`}]]};ay.node;var oy=$(ay),sy={name:`globe`,size:24,node:[[`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`}]]};sy.node;var cy=$(sy),ly={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};ly.node;var uy=$(ly),dy={name:`heart`,size:24,node:[[`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`}]]};dy.node;var fy=$(dy),py={name:`house`,size:24,node:[[`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`}]],aliases:[`home`]};py.node;var my=$(py),hy={name:`image-off`,size:24,node:[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]};hy.node;var gy=$(hy),_y={name:`image`,size:24,node:[[`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`}]]};_y.node;var vy=$(_y),yy={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};yy.node;var by=$(yy),xy={name:`key`,size:24,node:[[`path`,{d:`m2 21 9.6-9.6`,key:`9l79m3`}],[`path`,{d:`m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19`,key:`fw8biw`}],[`circle`,{cx:`15.5`,cy:`7.5`,r:`5.5`,key:`4wxmhb`}]]};xy.node;var Sy=$(xy),Cy={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};Cy.node;var wy=$(Cy),Ty={name:`layers`,size:24,node:[[`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`}]],aliases:[`layers-3`]};Ty.node;var Ey=$(Ty),Dy={name:`layout-dashboard`,size:24,node:[[`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`}]]};Dy.node;var Oy=$(Dy),ky={name:`link`,size:24,node:[[`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`}]]};ky.node;var Ay=$(ky),jy={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};jy.node;var My=$(jy),Ny={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};Ny.node;var Py=$(Ny),Fy={name:`list`,size:24,node:[[`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`}]]};Fy.node;var Iy=$(Fy),Ly={name:`lock`,size:24,node:[[`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`}]]};Ly.node;var Ry=$(Ly),zy={name:`log-out`,size:24,node:[[`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`}]]};zy.node;var By=$(zy),Vy={name:`mail`,size:24,node:[[`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`}]]};Vy.node;var Hy=$(Vy),Uy={name:`map-pin`,size:24,node:[[`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`}]]};Uy.node;var Wy=$(Uy),Gy={name:`map`,size:24,node:[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]};Gy.node;var Ky=$(Gy),qy={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};qy.node;var Jy=$(qy),Yy={name:`message-square`,size:24,node:[[`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`}]]};Yy.node;var Xy=$(Yy),Zy={name:`monitor`,size:24,node:[[`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`}]]};Zy.node;var Qy=$(Zy),$y={name:`moon`,size:24,node:[[`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`}]]};$y.node;var eb=$($y),tb={name:`package`,size:24,node:[[`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`}]]};tb.node;var nb=$(tb),rb={name:`panel-right`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]};rb.node;var ib=$(rb),ab={name:`pencil`,size:24,node:[[`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`}]]};ab.node;var ob=$(ab),sb={name:`phone`,size:24,node:[[`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`}]]};sb.node;var cb=$(sb),lb={name:`pin-off`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]};lb.node;var ub=$(lb),db={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]};db.node;var fb=$(db),pb={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};pb.node;var mb=$(pb),hb={name:`printer`,size:24,node:[[`path`,{d:`M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`,key:`143wyd`}],[`path`,{d:`M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6`,key:`1itne7`}],[`rect`,{x:`6`,y:`14`,width:`12`,height:`8`,rx:`1`,key:`1ue0tg`}]]};hb.node;var gb=$(hb),_b={name:`receipt`,size:24,node:[[`path`,{d:`M12 17V7`,key:`pyj7ub`}],[`path`,{d:`M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8`,key:`1elt7d`}],[`path`,{d:`M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z`,key:`ycz6yz`}]]};_b.node;var vb=$(_b),yb={name:`refresh-cw`,size:24,node:[[`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`}]]};yb.node;var bb=$(yb),xb={name:`rotate-ccw-clock`,size:24,node:[[`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`}]],aliases:[`history`]};xb.node;var Sb=$(xb),Cb={name:`rotate-ccw`,size:24,node:[[`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`}]]};Cb.node;var wb=$(Cb),Tb={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Tb.node;var Eb=$(Tb),Db={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};Db.node;var Ob=$(Db),kb={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};kb.node;var Ab=$(kb),jb={name:`settings`,size:24,node:[[`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`}]]};jb.node;var Mb=$(jb),Nb={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};Nb.node;var Pb=$(Nb),Fb={name:`shield`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]};Fb.node;var Ib=$(Fb),Lb={name:`shopping-bag`,size:24,node:[[`path`,{d:`M16 10a4 4 0 0 1-8 0`,key:`1ltviw`}],[`path`,{d:`M3.103 6.034h17.794`,key:`awc11p`}],[`path`,{d:`M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z`,key:`o988cm`}]]};Lb.node;var Rb=$(Lb),zb={name:`shopping-cart`,size:24,node:[[`path`,{d:`m2.05 2.05 1.099-.028a1 1 0 0 1 1.008.815l2.69 14.347A1 1 0 0 0 7.83 18H18`,key:`uebgi3`}],[`path`,{d:`M4.563 5h16.435a1 1 0 0 1 .981 1.204l-1.026 6.226A2 2 0 0 1 18.962 14H6.25`,key:`1j7c9p`}],[`circle`,{cx:`18`,cy:`20`,r:`2`,key:`t9985n`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]};zb.node;var Bb=$(zb),Vb={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};Vb.node;var Hb=$(Vb),Ub={name:`star`,size:24,node:[[`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`}]]};Ub.node;var Wb=$(Ub),Gb={name:`store`,size:24,node:[[`path`,{d:`M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5`,key:`slp6dd`}],[`path`,{d:`M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244`,key:`o0xfot`}],[`path`,{d:`M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05`,key:`wn3emo`}]]};Gb.node;var Kb=$(Gb),qb={name:`sun`,size:24,node:[[`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`}]]};qb.node;var Jb=$(qb),Yb={name:`tag`,size:24,node:[[`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`}]]};Yb.node;var Xb=$(Yb),Zb={name:`tags`,size:24,node:[[`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`}]]};Zb.node;var Qb=$(Zb),$b={name:`ticket`,size:24,node:[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]};$b.node;var ex=$($b),tx={name:`trash`,size:24,node:[[`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`}]],aliases:[`trash-2`]};tx.node;var nx=$(tx),rx={name:`triangle-alert`,size:24,node:[[`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`}]],aliases:[`alert-triangle`]};rx.node;var ix=$(rx),ax={name:`truck`,size:24,node:[[`path`,{d:`M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2`,key:`wrbu53`}],[`path`,{d:`M15 18H9`,key:`1lyqi6`}],[`path`,{d:`M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14`,key:`lysw3i`}],[`circle`,{cx:`17`,cy:`18`,r:`2`,key:`332jqn`}],[`circle`,{cx:`7`,cy:`18`,r:`2`,key:`19iecd`}]]};ax.node;var ox=$(ax),sx={name:`upload`,size:24,node:[[`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`}]]};sx.node;var cx=$(sx),lx={name:`user-round`,size:24,node:[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]],aliases:[`user-2`]};lx.node;var ux=$(lx),dx={name:`user`,size:24,node:[[`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`}]]};dx.node;var fx=$(dx),px={name:`users`,size:24,node:[[`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`}]]};px.node;var mx=$(px),hx={name:`video`,size:24,node:[[`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`}]]};hx.node;var gx=$(hx),_x={name:`wallet`,size:24,node:[[`path`,{d:`M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1`,key:`18etb6`}],[`path`,{d:`M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4`,key:`xoc0q4`}]]};_x.node;var vx=$(_x),yx={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};yx.node;var bx=$(yx),xx={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};xx.node;var Sx=$(xx),Cx={name:`zap`,size:24,node:[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]};Cx.node;var wx=$(Cx),Tx=/^(-?)(\d+)(?:\.(\d*))?$/,Ex=/^-?\d{1,3}(,\d{3})+(\.\d*)?$/;function Dx(e,t){let n=Nh(e).trim(),r=Tx.exec(Ex.test(n)?n.replace(/,/g,``):n);if(!r)return e;let[,i,a,o]=r,s=a.replace(/^0+(?=\d)/,``).replace(/\B(?=(\d{3})+$)/g,`,`),c=t===void 0?o??``:(o??``).padEnd(t,`0`);return`${i}${s}${c?`.${c}`:``}`}var Ox;function kx(e){Ox=e}function Ax(){if(!Ox)return;let{unit:e,position:t}=Ox,n=Yh(),r=typeof e==`string`?e:e[n]??e[n.split(`-`)[0]]??Object.values(e)[0];return r?{unit:r,position:t}:void 0}function jx(e,t={}){let n=t.currency??Ax(),r=e=>tg(Dx(e,t.scale));return{main:r(e),...n?{unit:n.unit,position:n.position}:{},...t.previous===void 0?{}:{previous:r(t.previous)}}}function Mx(e){return e.unit?e.position===`before`?`${e.unit} ${e.main}`:`${e.main} ${e.unit}`:e.main}function Nx(e,t){if(e==null)return`—`;if(t.type===`relation`){let t=Array.isArray(e)?e:[e];return t.length===0?`—`:t.map(e=>String(e.title)).join(`, `)}if(t.file)return(Array.isArray(e)?e:[e]).map(e=>String(e).split(`/`).pop()).join(`, `)||`—`;if(t.widget===`richtext`)return Fx(String(e))||`—`;if(t.type===`boolean`)return J(e?`common.yes`:`common.no`);if(t.type===`enum`)return t.enumLabels?.[String(e)]??String(e);if(t.widget===`money`)return Mx(jx(String(e),{currency:t.currency,scale:t.scale}));if(t.type===`number`||t.type===`decimal`||t.type===`bigint`)return tg(String(e));if(t.type===`date`)return ig(String(e));if(t.type===`json`||t.type===`object`)return JSON.stringify(e);if(t.type===`datetime`){let t=new Date(String(e));return Number.isNaN(t.getTime())?String(e):ng(t)}return String(e)}var Px={amp:`&`,lt:`<`,gt:`>`,quot:`"`,"#39":`'`,nbsp:` `};function Fx(e,t=120){let n=e.replace(/<[^>]*>/g,` `).replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(e,t)=>Px[t]).replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t).trimEnd()}…`:n}function Ix(e,t){let n=e?.groups??[];return{resource:e=>t(e)?.label??n.flatMap(e=>e.resources).find(t=>t.name===e)?.label,page:e=>n.flatMap(e=>e.pages).find(t=>t.name===e)?.label,action:(e,n)=>t(e)?.actions?.find(e=>e.name===n)?.label,softDelete:e=>t(e)?.softDelete}}var Lx={created:`audit.event.created`,updated:`audit.event.updated`,deleted:`audit.event.deleted`,restored:`audit.event.restored`,purged:`audit.event.purged`},Rx={"auth.login":`audit.event.login`,"auth.logout":`audit.event.logout`,"auth.view_as":`audit.event.viewAs`,"auth.password_changed":`audit.event.passwordChanged`,"auth.two_factor_enabled":`audit.event.twoFactorEnabled`,"auth.two_factor_disabled":`audit.event.twoFactorDisabled`,"auth.recovery_codes_regenerated":`audit.event.recoveryCodes`,"rbac.role.changed":`audit.event.roleChanged`,"rbac.group.changed":`audit.event.groupChanged`,"rbac.user_roles.changed":`audit.event.userRolesChanged`,"rbac.user.created":`audit.event.userCreated`,"rbac.user.changed":`audit.event.userChanged`,"rbac.user.password_reset":`audit.event.passwordReset`,"rbac.user.two_factor_reset":`audit.event.twoFactorReset`},zx={WRONG_CODE:`audit.event.loginFailedCode`,RATE_LIMITED:`audit.event.loginFailedLimited`};function Bx(e){return e.event.startsWith(`*.`)||e.event.startsWith(`page.*.`)}function Vx(e){return e.resource!==void 0&&e.event.startsWith(`${e.resource}.`)?e.event.slice(e.resource.length+1):void 0}var Hx=/^page\.(.+)\.updated$/;function Ux(e,t={}){if(Bx(e))return J(`audit.event.unseen`);let n=Vx(e);if(n!==void 0){if(n.startsWith(`action.`)&&n.length>7){let r=n.slice(7);return J(`audit.event.action`,{action:t.action?.(e.resource,r)??r})}if(n===`deleted`&&t.softDelete?.(e.resource))return J(`audit.event.trashed`);let r=Lx[n];return r?J(r):e.event}let r=Hx.exec(e.event)?.[1];if(r!==void 0)return J(`audit.event.page`,{page:t.page?.(r)??r});if(e.event===`auth.login_failed`){let t=e.meta?.reason;return t===`SUPPRESSED`?J(`audit.event.loginFailedMore`,{count:e.meta?.suppressed??0}):J(t&&zx[t]||`audit.event.loginFailed`)}if(e.event===`auth.sessions_revoked`){let t=e.meta?.sessions;return J(t===`others`?`audit.event.sessionsOthers`:t===`one`?`audit.event.sessionsOne`:`audit.event.sessions`)}let i=Rx[e.event];return i?J(i):e.event}function Wx(e){if(e.event===`auth.login_failed`){if(e.meta?.reason===`SUPPRESSED`)return J(`audit.suppressedNote`);if(e.meta?.limited)return J(`audit.limitedNote`)}if(e.meta?.action!==void 0&&e.meta.deleted)return J(`audit.actionDeleted`)}function Gx(e,t={}){if(!Bx(e)){if(e.resource!==void 0){let n=t.resource?.(e.resource)??e.resource;return e.recordId===void 0?n:e.recordTitle!==void 0&&e.recordTitle!==``?`${n}: ${e.recordTitle}`:`${n} #${e.recordId}`}if(e.recordTitle!==void 0&&e.recordTitle!==``)return e.recordTitle;if(e.recordId!==void 0)return e.recordId;if(e.event===`auth.login_failed`&&e.meta?.username)return e.meta.username}}function Kx(e){if(e.restricted&&!Bx(e))return J(e.resource===void 0?`audit.restrictedChanges`:`audit.restrictedRecord`)}function qx(e,t,n){let r={field:e.field,label:t?.label??e.field};if(`hidden`in e&&e.hidden)return{...r,state:`hidden`,truncated:!1};if(`changed`in e&&e.changed)return{...r,state:`changed`,truncated:!1};let i=e,a=i.truncated===!0;return a&&!(`before`in i)&&!(`after`in i)?{...r,state:`dropped`,truncated:a}:{...r,state:`values`,before:`before`in i&&i.before!==void 0?Zx(i.before,t,n):void 0,after:`after`in i&&i.after!==void 0?Zx(i.after,t,n):void 0,truncated:a}}var Jx=`—`,Yx=1e5;function Xx(e){return e==null||e===``?Jx:typeof e==`boolean`?J(e?`common.yes`:`common.no`):typeof e==`string`?e:Array.isArray(e)?e.length===0?Jx:e.every(e=>typeof e!=`object`||!e)?e.map(String).join(`, `):JSON.stringify(e):typeof e==`object`?JSON.stringify(e):String(e)}function Zx(e,t,n){if(e==null||e===``)return Jx;if(!t)return Xx(e);if(t.type===`relation`){let t=Array.isArray(e)?e:[e],r=e=>typeof e==`object`&&e?e.id:e;if(t.some(e=>![`string`,`number`,`bigint`].includes(typeof r(e))))return Xx(e);let i=t.map(e=>String(r(e)));return i.length===0?Jx:i.map(e=>{let t=n?.(e);return t!==void 0&&t!==``&&t!==`#${e}`?`${t} (#${e})`:`#${e}`}).join(`, `)}return t.file?typeof e==`string`||Array.isArray(e)?Nx(e,t):Xx(e):t.type===`json`||t.type===`object`?typeof e==`string`?e:JSON.stringify(e):typeof e==`object`?Xx(e):t.widget===`richtext`?Fx(String(e),Yx)||Jx:Nx(e,t)}var Qx=[`actor`,`event`,`resource`,`record`,`from`,`to`],$x=/^(\d{4})-(\d{2})-(\d{2})$/;function eS(e,t){let n=$x.exec(e);if(!n)return e;let[r,i,a]=[Number(n[1]),Number(n[2]),Number(n[3])],o=t?new Date(r,i-1,a,23,59,59,999):new Date(r,i-1,a,0,0,0,0);return o.getFullYear()===r&&o.getMonth()===i-1&&o.getDate()===a?o.toISOString():e}function tS(e){let t=new URLSearchParams;for(let n of Qx){let r=e.get(n);r!==null&&r!==``&&(n!==`record`||e.get(`resource`))&&t.set(n,n===`from`?eS(r,!1):n===`to`?eS(r,!0):r)}return t.sort(),t.toString()}function nS(e){return tS(e)!==``}function rS(e,t){let n=t.trim();return e===`resource`?{resource:n||null,record:null}:{[e]:n||null}}function iS(){return Object.fromEntries(Qx.map(e=>[e,null]))}function aS({entries:e,now:t,names:n,schemaOf:r,pageFieldsOf:i,titleOf:a,onActor:o,showSubject:s=!1}){let{t:c}=Y();return(0,b.jsx)(`ol`,{"aria-label":c(`audit.entries`),className:`flex flex-col divide-y rounded-card border bg-card shadow-card`,children:e.map(e=>(0,b.jsx)(sS,{entry:e,now:t,names:n,schema:e.resource===void 0?void 0:r(e.resource),pageFields:e.resource===void 0&&e.meta?.page!==void 0?i?.(e.meta.page):void 0,titleOf:a,onActor:o,showSubject:s},e.id))})}var oS=/\.(deleted|purged)$/;function sS({entry:e,now:t,names:n,schema:r,pageFields:i,titleOf:a,onActor:o,showSubject:s}){let c=r?.fields??i,{t:l}=Y(),u=new Date(e.at),d=!Number.isNaN(u.getTime()),f=s?Gx(e,n):void 0,p=s&&e.resource!==void 0&&e.recordId!==void 0&&!oS.test(e.event)&&!e.meta?.deleted,m=Kx(e),h=Wx(e),g=e.actor?e.actor.name??`#${e.actor.id}`:l(`audit.noActor`),_=e.meta?.input?Object.entries(e.meta.input):[],v=e.meta?.action===void 0?void 0:r?.actions?.find(t=>t.name===cS(e))?.input?.fields,y=[e.meta?.ip,e.meta?.userAgent].filter(Boolean).join(` · `);return(0,b.jsxs)(`li`,{className:`flex flex-col gap-2 px-4 py-3 text-sm`,"data-event":e.event,"data-actor":e.actor?.id??``,"data-anonymous":Bx(e)||void 0,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:Ux(e,n)}),f!==void 0&&(p?(0,b.jsx)(bo,{to:`/${e.resource}/${encodeURIComponent(e.recordId)}`,className:`text-primary hover:underline`,children:f}):(0,b.jsx)(`span`,{children:f}))]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[e.actor&&o?(0,b.jsx)(`button`,{type:`button`,className:`font-medium text-foreground hover:underline`,"aria-label":l(`audit.filterByActor`,{name:g}),onClick:()=>o(e.actor.id),children:g}):(0,b.jsx)(`span`,{className:`font-medium text-foreground`,children:g}),e.viewAsBy!==void 0&&(0,b.jsx)(`span`,{children:l(`audit.viewAsBy`,{id:e.viewAsBy})}),d?(0,b.jsxs)(`time`,{dateTime:e.at,children:[ag(u,t),` · `,ng(u)]}):(0,b.jsx)(`span`,{children:e.at})]}),h!==void 0&&(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:h}),m!==void 0&&(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:m}),e.changes!==void 0&&e.changes.length>0&&(0,b.jsx)(`dl`,{"aria-label":l(`audit.changedFields`),className:`grid grid-cols-1 gap-x-4 gap-y-1.5 sm:grid-cols-[minmax(6rem,auto)_1fr]`,children:e.changes.map(e=>{let t=c?.find(t=>t.name===e.field);return(0,b.jsx)(lS,{row:qx(e,t,a?t=>a(e.field,t):void 0)},e.field)})}),_.length>0&&(0,b.jsx)(`dl`,{"aria-label":l(`audit.input`),className:`grid grid-cols-1 gap-x-4 gap-y-1.5 sm:grid-cols-[minmax(6rem,auto)_1fr]`,children:_.map(([e,t])=>{let n=v?.find(t=>t.name===e);return(0,b.jsxs)(`div`,{className:`contents`,"data-input":e,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:n?.label??e}),(0,b.jsx)(`dd`,{className:`min-w-0`,children:(0,b.jsx)(dS,{text:Zx(t,n)})})]},e)})}),e.meta?.inputTruncated&&(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:l(`audit.inputTruncated`)}),y!==``&&(0,b.jsx)(`p`,{className:`text-xs break-all text-muted-foreground`,dir:`ltr`,"data-client":!0,children:y})]})}function cS(e){let t=`${e.resource}.action.`;return e.event.startsWith(t)?e.event.slice(t.length):void 0}function lS({row:e}){let{t}=Y();return(0,b.jsxs)(`div`,{className:`contents`,"data-change":e.field,"data-state":e.state,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:e.state===`values`?(0,b.jsxs)(b.Fragment,{children:[e.before!==void 0&&(0,b.jsxs)(`span`,{className:`min-w-0 text-muted-foreground line-through decoration-muted-foreground/50`,"data-before":!0,children:[(0,b.jsxs)(`span`,{className:`sr-only`,children:[t(`audit.before`),`: `]}),(0,b.jsx)(dS,{text:e.before})]}),e.before!==void 0&&e.after!==void 0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(J_,{className:`size-3.5 shrink-0 self-center text-muted-foreground rtl:-scale-x-100`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`sr-only`,children:t(`audit.becomes`)})]}),e.after!==void 0&&(0,b.jsxs)(`span`,{className:`min-w-0`,"data-after":!0,children:[e.before===void 0&&(0,b.jsxs)(`span`,{className:`sr-only`,children:[t(`audit.after`),`: `]}),(0,b.jsx)(dS,{text:e.after})]}),e.truncated&&(0,b.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t(`audit.field.truncated`),`)`]})]}):(0,b.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground`,children:t(`audit.field.${e.state}`)})})]})}var uS=160;function dS({text:e}){let{t}=Y(),[n,r]=(0,y.useState)(!1);return e.length<=uS?(0,b.jsx)(`span`,{dir:`auto`,className:`break-words whitespace-pre-wrap`,children:e}):(0,b.jsxs)(`span`,{dir:`auto`,className:`break-words whitespace-pre-wrap`,children:[n?e:`${e.slice(0,uS).trimEnd()}…`,` `,(0,b.jsx)(q,{type:`button`,variant:`link`,size:`sm`,className:`h-auto p-0 text-xs`,"aria-expanded":n,onClick:()=>r(e=>!e),children:t(n?`audit.showLess`:`audit.showMore`)})]})}var fS=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178],pS=(e,t)=>Math.trunc(e/t),mS=(e,t)=>e-Math.trunc(e/t)*t;function hS(e){let t=e+621,n=-14,r=fS[0];if(e<r||e>=fS[fS.length-1])throw RangeError(`Jalali year ${e} is out of range`);let i=0;for(let t=1;t<fS.length;t++){let a=fS[t];if(i=a-r,e<a)break;n+=pS(i,33)*8+pS(mS(i,33),4),r=a}let a=e-r;n+=pS(a,33)*8+pS(mS(a,33)+3,4),mS(i,33)===4&&i-a===4&&(n+=1);let o=pS(t,4)-pS((pS(t,100)+1)*3,4)-150,s=20+n-o;i-a<6&&(a=a-i+pS(i+4,33)*33);let c=mS(mS(a+1,33)-1,4);return c===-1&&(c=4),{leap:c,gy:t,march:s}}function gS(e,t,n){return pS((e+pS(t-8,6)+100100)*1461,4)+pS(153*mS(t+9,12)+2,5)+n-34840408-pS(pS(e+100100+pS(t-8,6),100)*3,4)+752}function _S(e){let t=4*e+139361631;t=t+pS(pS(4*e+183187720,146097)*3,4)*4-3908;let n=pS(mS(t,1461),4)*5+308,r=pS(mS(n,153),5)+1,i=mS(pS(n,153),12)+1;return{gy:pS(t,1461)-100100+pS(8-i,6),gm:i,gd:r}}function vS(e,t,n){let{gy:r,march:i}=hS(e);return gS(r,3,i)+(t-1)*31-pS(t,7)*(t-7)+n-1}function yS(e){let{gy:t}=_S(e),n=t-621,r=hS(n),i=e-gS(t,3,r.march);if(i>=0){if(i<=185)return{jy:n,jm:1+pS(i,31),jd:mS(i,31)+1};i-=186}else--n,i+=179,r.leap===1&&(i+=1);return{jy:n,jm:7+pS(i,30),jd:mS(i,30)+1}}var bS=(e,t=2)=>String(e).padStart(t,`0`),xS=/^(\d{4})-(\d{2})-(\d{2})$/;function SS(e){return hS(e).leap===0}function CS(e,t){return t<=6?31:t<=11||SS(e)?30:29}function wS(e){let t=xS.exec(e);if(!t)throw RangeError(`not an ISO date: ${e}`);return yS(gS(Number(t[1]),Number(t[2]),Number(t[3])))}function TS(e,t,n){let{gy:r,gm:i,gd:a}=_S(vS(e,t,n));return`${bS(r,4)}-${bS(i)}-${bS(a)}`}function ES(e,t,n){return Number.isInteger(e)&&e>=1&&e<3178&&t>=1&&t<=12&&n>=1&&n<=CS(e,t)}function DS(e){let{jy:t,jm:n,jd:r}=wS(e);return`${t}/${bS(n)}/${bS(r)}`}function OS(e){let t=/^(\d{4})[/\-.](\d{1,2})[/\-.](\d{1,2})$/.exec(Mh(e.trim()));if(!t)return;let[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])];return ES(n,r,i)?TS(n,r,i):void 0}function kS(e,t){let{jy:n,jm:r,jd:i}=wS(e),a=n*12+(r-1)+t,o=Math.floor(a/12),s=a%12+1;return TS(o,s,Math.min(i,CS(o,s)))}function AS(e,t){return new Date(Date.parse(`${e}T00:00:00Z`)+t*864e5).toISOString().slice(0,10)}function jS(){let e=new Date;return`${bS(e.getFullYear(),4)}-${bS(e.getMonth()+1)}-${bS(e.getDate())}`}var MS=(e,t=2)=>String(e).padStart(t,`0`),NS=(e,t)=>new Date(Date.UTC(e,t,0)).getUTCDate(),PS={intl:`persian`,parts:e=>{let{jy:t,jm:n,jd:r}=wS(e);return{year:t,month:n,day:r}},fromParts:TS,monthLength:CS,addMonths:kS,format:DS,parse:OS,weekStart:6},FS={intl:`gregory`,parts:e=>({year:Number(e.slice(0,4)),month:Number(e.slice(5,7)),day:Number(e.slice(8,10))}),fromParts:(e,t,n)=>`${MS(e,4)}-${MS(t)}-${MS(n)}`,monthLength:NS,addMonths:(e,t)=>{let{year:n,month:r,day:i}=FS.parts(e),a=n*12+(r-1)+t,o=Math.floor(a/12),s=a%12+1;return FS.fromParts(o,s,Math.min(i,NS(o,s)))},format:e=>e,parse:e=>{let t=/^(\d{4})[/\-.](\d{1,2})[/\-.](\d{1,2})$/.exec(Mh(e.trim()));if(!t)return;let[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])];return n>=1&&r>=1&&r<=12&&i>=1&&i<=NS(n,r)?FS.fromParts(n,r,i):void 0},weekStart:1},IS=e=>e===`persian`?PS:FS,LS=/^\d{4}-\d{2}-\d{2}$/;function RS(e){let{calendar:t}=Y();return(0,b.jsx)(zS,{...e,system:IS(t)})}function zS({id:e,value:t,onChange:n,label:r,live:i,className:a,system:o,...s}){let{t:c,digits:l}=Y(),u=e=>LS.test(e)?tg(o.format(e)):e,[d,f]=(0,y.useState)(()=>u(t)),[p,m]=(0,y.useState)(!1),h=(0,y.useRef)(t);(0,y.useEffect)(()=>{t!==h.current&&(h.current=t,f(u(t)))},[t,l,o]);function g(e){h.current=e,n(e)}function _(){let e=d.trim();if(e===``)return t!==``&&g(``);let n=o.parse(e);n?(f(u(n)),n!==t&&g(n)):i&&g(Mh(e))}function v(e){f(u(e)),m(!1),g(e)}return(0,b.jsxs)(`div`,{className:W(`flex items-center gap-1`,a),children:[(0,b.jsx)(Oh,{id:e,dir:`ltr`,inputMode:`numeric`,placeholder:c(`date.placeholder`),value:d,...s,onChange:e=>{if(f(e.target.value),!i)return;let t=e.target.value.trim();g((t===``?``:o.parse(t))??Mh(t))},onBlur:()=>{_(),s.onBlur?.()},onKeyDown:e=>{e.key===`Enter`&&(_(),i||e.preventDefault()),s.onKeyDown?.(e)}}),(0,b.jsxs)(Sh,{open:p,onOpenChange:m,children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c(`date.openCalendar`,{name:r}),children:(0,b.jsx)(fv,{})})}),(0,b.jsx)(wh,{children:(0,b.jsx)(Th,{align:`end`,sideOffset:4,className:`z-50 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md`,"aria-label":c(`date.calendar`,{name:r}),children:(0,b.jsx)(BS,{system:o,value:LS.test(t)?t:void 0,onPick:v,onClear:()=>v(``)})})})]})]})}function BS({system:e,value:t,onPick:n,onClear:r}){let{t:i,locale:a}=Y(),o=jS(),[s,c]=(0,y.useState)(t??o),[l,u]=(0,y.useState)(`days`),d=(0,y.useRef)(null),f=(0,y.useRef)(!1),{year:p,month:m}=e.parts(s),h=Qh(a);(0,y.useEffect)(()=>{f.current&&(f.current=!1,d.current?.querySelector(`[data-iso="${s}"]`)?.focus())},[s]);let g=t=>new Intl.DateTimeFormat(`${a}-u-ca-${e.intl}`,{month:`long`,timeZone:`UTC`}).format(Date.parse(`${e.fromParts(p,t,1)}T00:00:00Z`)),_=e=>tg(String(e)),v=AS(`2024-01-07`,e.weekStart),x=Array.from({length:7},(e,t)=>new Intl.DateTimeFormat(a,{weekday:`narrow`,timeZone:`UTC`}).format(Date.parse(`${AS(v,t)}T00:00:00Z`))),S=e.fromParts(p,m,1),C=(new Date(`${S}T00:00:00Z`).getUTCDay()-e.weekStart+7)%7,w=e.monthLength(p,m),T=[...Array.from({length:C},()=>null),...Array.from({length:w},(e,t)=>AS(S,t))];function E(t){let n={ArrowRight:h?-1:1,ArrowLeft:h?1:-1,ArrowDown:7,ArrowUp:-7},r;t.key in n?r=AS(s,n[t.key]):t.key===`PageDown`?r=e.addMonths(s,t.shiftKey?12:1):t.key===`PageUp`&&(r=e.addMonths(s,t.shiftKey?-12:-1)),r&&(t.preventDefault(),f.current=!0,c(r))}let D=(e,t,n,r)=>(0,b.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":i(`date.previous`),onClick:()=>n(-1),children:(0,b.jsx)(wv,{className:`rtl:rotate-180`})}),t?(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":r,onClick:t,children:e}):(0,b.jsx)(`span`,{className:`text-sm font-medium`,children:e}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":i(`date.next`),onClick:()=>n(1),children:(0,b.jsx)(Ev,{className:`rtl:rotate-180`})})]}),O;if(l===`years`){let t=p-p%12;O=(0,b.jsxs)(b.Fragment,{children:[D(`${_(t)}–${_(t+11)}`,void 0,t=>c(e.addMonths(s,t*144)),``),(0,b.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:Array.from({length:12},(e,n)=>t+n).map(t=>(0,b.jsx)(q,{type:`button`,variant:t===p?`secondary`:`ghost`,size:`sm`,onClick:()=>{c(e.fromParts(t,m,Math.min(e.parts(s).day,e.monthLength(t,m)))),u(`months`)},children:_(t)},t))})]})}else O=l===`months`?(0,b.jsxs)(b.Fragment,{children:[D(_(p),()=>u(`years`),t=>c(e.addMonths(s,t*12)),i(`date.chooseYear`)),(0,b.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:Array.from({length:12},(e,t)=>t+1).map(t=>(0,b.jsx)(q,{type:`button`,variant:t===m?`secondary`:`ghost`,size:`sm`,onClick:()=>{c(e.fromParts(p,t,Math.min(e.parts(s).day,e.monthLength(p,t)))),u(`days`)},children:g(t)},t))})]}):(0,b.jsxs)(b.Fragment,{children:[D(`${g(m)} ${_(p)}`,()=>u(`months`),t=>c(e.addMonths(s,t)),i(`date.chooseMonth`)),(0,b.jsxs)(`div`,{ref:d,role:`grid`,"aria-label":`${g(m)} ${_(p)}`,onKeyDown:E,className:`grid grid-cols-7 gap-0.5 text-center`,children:[(0,b.jsx)(`div`,{role:`row`,className:`contents`,children:x.map((e,t)=>(0,b.jsx)(`div`,{role:`columnheader`,className:`py-1 text-xs text-muted-foreground`,children:e},t))}),Array.from({length:Math.ceil(T.length/7)},(r,i)=>(0,b.jsx)(`div`,{role:`row`,className:`contents`,children:T.slice(i*7,i*7+7).map((r,a)=>r?(0,b.jsx)(`div`,{role:`gridcell`,"aria-selected":r===t,children:(0,b.jsx)(`button`,{type:`button`,"data-iso":r,tabIndex:r===s?0:-1,"aria-label":ig(r),"aria-current":r===o?`date`:void 0,onClick:()=>n(r),className:W(`size-8 rounded-md text-sm hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none`,r===o&&`font-semibold text-primary`,r===t&&`bg-primary text-primary-foreground hover:bg-primary/90`),children:_(e.parts(r).day)})},r):(0,b.jsx)(`div`,{role:`gridcell`},`empty-${i}-${a}`))},i))]})]});return(0,b.jsxs)(`div`,{className:`flex w-64 flex-col`,children:[O,(0,b.jsxs)(`div`,{className:`mt-2 flex justify-between gap-2 border-t pt-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>n(o),children:i(`date.today`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:i(`date.clear`)})]})]})}function VS({id:e,value:t,onChange:n,label:r,...i}){let{t:a}=Y(),[o=``,s=``]=t.split(`T`),c=(e,t)=>n(e===``?``:`${e}T${t||`00:00`}`);return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(RS,{id:e,live:!0,value:o,label:r,onChange:e=>c(e,s),className:`min-w-44 flex-1`,...i}),(0,b.jsx)(Oh,{type:`time`,dir:`ltr`,"aria-label":a(`date.time`,{name:r}),className:`w-28`,value:s,onChange:e=>c(o,e.target.value)})]})}var HS=`fixed inset-0 z-40 bg-black/40 backdrop-blur-sm dark:bg-black/60 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150`;function US(e,t){let[n,r]=(0,y.useState)(e);return(0,y.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var WS=(e,t)=>String(e.id)===String(t.id);function GS({id:e,resource:t,field:n,value:r,onChange:i,clearable:a,values:o,parent:s,invalid:c,describedBy:l}){let u=X(),d=n.relation?.kind===`to-many`,f=d&&Array.isArray(r)?r:[],p=!d&&r&&!Array.isArray(r)?r:null,[m,h]=(0,y.useState)(``),[g,_]=(0,y.useState)(!1),[v,x]=(0,y.useState)(0),S=US(m.trim(),250),C=Zg(t,n.optionsField??n.name,S,g,o,s),w=(C.data?.items??[]).filter(e=>!f.some(t=>WS(t,e))),T=`${e}-options`,E=t=>`${e}-option-${t}`;(0,y.useEffect)(()=>{x(0)},[S,C.data]);function D(e){h(``),_(!1),i(d?[...f,e]:e)}function O(e){e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),g?x(t=>Math.max(0,Math.min(w.length-1,t+(e.key===`ArrowDown`?1:-1)))):_(!0)):e.key===`Enter`&&g?(e.preventDefault(),w[v]&&D(w[v])):e.key===`Escape`&&g?(e.preventDefault(),_(!1),h(``)):e.key===`Backspace`&&d&&m===``&&f.length>0&&i(f.slice(0,-1))}return(0,b.jsxs)(`div`,{className:`relative flex flex-col gap-1.5`,children:[d&&f.length>0&&(0,b.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,"aria-label":u(`picker.selected`,{name:n.label}),children:f.map(e=>(0,b.jsxs)(`li`,{className:`inline-flex items-center gap-1 rounded-md bg-muted py-0.5 ps-2 pe-1 text-sm`,children:[e.title,(0,b.jsx)(`button`,{type:`button`,className:`rounded-sm p-0.5 text-muted-foreground hover:text-foreground`,"aria-label":u(`picker.remove`,{name:e.title}),onClick:()=>i(f.filter(t=>!WS(t,e))),children:(0,b.jsx)(Sx,{className:`size-3.5`})})]},String(e.id)))}),(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(Oh,{id:e,role:`combobox`,autoComplete:`off`,"aria-autocomplete":`list`,"aria-expanded":g,"aria-controls":T,"aria-activedescendant":g&&w[v]?E(v):void 0,"aria-invalid":c||void 0,"aria-describedby":l,className:W(p&&a&&`pe-8`),placeholder:p?p.title:u(d?`picker.typeToAdd`:`picker.typeToSearch`),value:g||m?m:p?.title??``,onChange:e=>{h(e.target.value),_(!0)},onFocus:()=>_(!0),onBlur:()=>{_(!1),h(``)},onKeyDown:O}),p&&a&&(0,b.jsx)(`button`,{type:`button`,className:`absolute inset-y-0 end-0 flex items-center px-2 text-muted-foreground hover:text-foreground`,"aria-label":u(`picker.clear`,{name:n.label}),onClick:()=>i(null),children:(0,b.jsx)(Sx,{className:`size-4`})})]}),g&&(0,b.jsxs)(`div`,{className:`absolute inset-x-0 top-full z-20 mt-1 max-h-60 overflow-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:[(0,b.jsx)(`ul`,{id:T,role:`listbox`,"aria-label":n.label,children:w.map((e,t)=>(0,b.jsx)(`li`,{id:E(t),role:`option`,"aria-selected":t===v,className:W(`cursor-pointer rounded-md px-2 py-1.5 text-sm`,t===v&&`bg-accent text-accent-foreground`),onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>x(t),onClick:()=>D(e),children:e.title},String(e.id)))}),w.length===0&&(0,b.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,children:C.isError?pg(C.error):u(C.isFetching||C.isPending?`picker.searching`:`picker.noMatches`)})]})]})}var KS=new Set([`page`,`pageSize`,`sort`,`search`,`trashed`,`after`,`tab`]),qS=e=>KS.has(e)||e.startsWith(`filter[`);function JS(e){let t=new URLSearchParams;for(let[n,r]of e)r!==``&&qS(n)&&t.append(n,r);return t.sort(),t.toString()}function YS(e,t){return`filter[${e}][${t}]`}function XS(e){return[...e.keys()].some(e=>e===`search`||e.startsWith(`filter[`))}function ZS(e){let t={};for(let n of e.keys())(n===`search`||n.startsWith(`filter[`))&&(t[n]=null);return t}function QS(e,t){let n=new URLSearchParams(e);Object.keys(t).some(e=>e!==`page`&&e!==`after`)&&(n.delete(`page`),n.delete(`after`));for(let[e,r]of Object.entries(t))r===null?n.delete(e):n.set(e,r);return n}function $S(e,t){if(!e)return{summary:``,label:J(`list.page`,{page:t}),hasNext:!1};if(e.total===null)return{summary:``,label:J(`list.page`,{page:t}),hasNext:e.hasMore===!0};let n=Math.max(1,Math.ceil(e.total/e.pageSize)),r=eg(e.total);return{summary:J(e.estimated?`list.about`:`list.total`,{count:r}),label:e.estimated?J(`list.page`,{page:t}):J(`list.pageOf`,{page:t,pages:n}),hasNext:t<n}}function eC(e,t,n){if(!e||e.total===null||e.total===0)return``;if(e.estimated)return J(`list.about`,{count:eg(e.total)});let r=(t-1)*e.pageSize+1;return J(`list.range`,{from:eg(r),to:eg(r+Math.max(n,1)-1),total:eg(e.total)})}function tC(e){return[...new Set([10,20,50,100,e])].filter(e=>e<=100).sort((e,t)=>e-t)}function nC(e){let t=new Set;for(let[n,r]of e){let e=/^filter\[([^\][]+)\]/.exec(n);e&&r!==``&&t.add(e[1])}return t.size}function rC(e,t){let n=e=>e===`search`||e===`sort`||e.startsWith(`filter[`),r={};for(let i of new Set([...e.keys(),...t.keys()]))n(i)&&e.get(i)!==t.get(i)&&(r[i]=t.get(i));return Object.fromEntries(Object.entries(r).sort(([e],[t])=>e.localeCompare(t)))}function iC(e){return new Map([...e].filter(([e,t])=>e.startsWith(`filter[`)&&t!==``))}function aC(e,t){let n=iC(t),r=t.get(`tab`);return e?.find(e=>{if((e.where?e.key:null)!==r)return!1;let t=Object.entries(e.filter);return t.length===n.size&&t.every(([e,t])=>n.get(e)===t)})}function oC(e,t){let n={};for(let e of iC(t).keys())n[e]=null;return t.has(`tab`)&&(n.tab=null),Object.assign(n,e.filter),e.where?n.tab=e.key:t.has(`tab`)&&(n.tab=null),n}var sC=/^filter\[([^\][]+)\]\[([^\][]+)\]$/;function cC(e,t){if(e.type===`boolean`)return J(t===`true`?`common.yes`:`common.no`);if(e.type===`enum`)return e.enumLabels?.[t]??t;if(e.type===`date`)return ig(t);if(e.type===`number`||e.type===`decimal`||e.type===`bigint`)return tg(t);if(e.type===`datetime`){let e=new Date(t);return Number.isNaN(e.getTime())?t:ng(e)}return t}function lC(e,t){let n=[],r=t.get(`search`);r&&n.push({key:`search`,label:J(`filters.search`),value:`“${r}”`,remove:[`search`]});let i=uC(e,t),a=new Map;for(let[e,n]of t){if(i[e]===n)continue;let t=sC.exec(e);if(!t||n===``)continue;let[,r,o]=t;a.set(r,[...a.get(r)??[],{operator:o,raw:n,key:e}])}for(let[t,r]of a){let i=e.fields.find(e=>e.name===t);if(!i)continue;let a=[],o,s=r.find(e=>e.operator===`gte`||e.operator===`gt`),c=r.find(e=>e.operator===`lte`||e.operator===`lt`);s&&c&&a.push(`${cC(i,s.raw)} – ${cC(i,c.raw)}`);for(let{operator:e,raw:n}of r){if((e===`gte`||e===`gt`||e===`lte`||e===`lt`)&&s&&c)continue;let r=n.split(`,`).map(e=>cC(i,e));if(i.type===`relation`&&[`eq`,`ne`,`in`,`nin`].includes(e)){let r=e===`ne`||e===`nin`?J(`filters.not`):``;o={field:t,ids:n.split(`,`),prefix:r},a.push(`${r}${n.split(`,`).map(e=>`#${e}`).join(`, `)}`);continue}switch(e){case`isNull`:a.push(J(n===`true`?`filters.empty`:`filters.notEmpty`));break;case`ne`:case`nin`:a.push(`${J(`filters.not`)}${r.join(`, `)}`);break;case`gte`:case`gt`:a.push(`≥ ${r[0]}`);break;case`lte`:case`lt`:a.push(`≤ ${r[0]}`);break;case`between`:a.push(r.join(` – `));break;case`contains`:a.push(`“${n}”`);break;case`startsWith`:a.push(`${n}…`);break;default:a.push(r.join(`, `))}}n.push({key:`filter:${t}`,label:i.label,value:a.join(`; `),...o?{ref:o}:{},remove:r.map(e=>e.key)})}return n}function uC(e,t){return aC(e.list?.tabs,t)?.filter??{}}var dC=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{},fC=e=>Array.isArray(e)?e:[];function pC(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`id`in e&&`title`in e}function mC(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`name`in e&&`size`in e&&(`key`in e||`token`in e)}function hC(e){return(Array.isArray(e)?e:[e]).filter(mC)}function gC(e,t){let n=e?._files?.[t];return n==null?[]:Array.isArray(n)?n:[n]}var _C=e=>e.token===void 0?`key:${e.key}`:`token:${e.token}`,vC=e=>e.token===void 0?{key:e.key}:{token:e.token},yC=(e,t)=>{let n=new Set(e.map(e=>String(e.id)));return e.length===t.length&&t.every(e=>n.has(String(e.id)))},bC=/<img\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;function xC(e){return e.replace(bC,``)}var SC=e=>String(e).padStart(2,`0`);function CC(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.getFullYear()}-${SC(t.getMonth()+1)}-${SC(t.getDate())}T${SC(t.getHours())}:${SC(t.getMinutes())}`}function wC(e,t){let n={};for(let r of e){let e=t?t[r.name]:r.default;if(r.file){let e=gC(t,r.name).map(({key:e,name:t,size:n,contentType:r,url:i})=>({key:e,name:t,size:n,contentType:r,url:i}));n[r.name]=r.file.many?e:e[0]??null}else if(r.type===`object`){let t=r.fields??[];n[r.name]=r.many?(Array.isArray(e)?e:[]).map(e=>wC(t,e)):wC(t,e??void 0)}else r.relation?.kind===`to-many`?n[r.name]=Array.isArray(e)?e.filter(pC):[]:r.type===`relation`?n[r.name]=pC(e)?e:null:r.type===`boolean`?n[r.name]=e===!0:e==null?n[r.name]=``:r.type===`json`?n[r.name]=JSON.stringify(e,null,2):r.type===`datetime`?n[r.name]=CC(String(e)):r.widget===`money`?n[r.name]=Dx(String(e),r.scale):n[r.name]=String(e)}return n}function TC(e,t){let n=/^-?\d{1,3}(,\d{3})+(\.\d+)?$/.test(e)?e.replace(/,/g,``):e;if((t?/^-?\d+$/:/^-?\d+(\.\d+)?$/).test(n))return n}function EC(e,t,n,r=``){let i={},a={};for(let o of e){let e=t[o.name];if(n&&e===n[o.name])continue;let s=`${r}${o.name}`;if(o.type===`object`){let t=o.fields??[];if(o.many){let r=fC(e).map((e,n)=>EC(t,e,void 0,`${s}.${n}.`));for(let e of r)Object.assign(a,e.errors);let c=r.map(e=>e.payload),l=n?fC(n[o.name]).map(e=>EC(t,e).payload):void 0;(l?JSON.stringify(l)!==JSON.stringify(c):c.length>0)&&(i[o.name]=c);continue}let r=EC(t,dC(e),n?dC(n[o.name]):void 0,`${s}.`);Object.assign(a,r.errors),(Object.keys(r.payload).length>0||!n&&!o.nullable)&&(i[o.name]=r.payload);continue}if(o.file){let t=hC(e),r=n?hC(n[o.name]):void 0;if(r&&t.map(_C).join(`
54
- `)===r.map(_C).join(`
55
- `))continue;o.file.many?(r||t.length>0)&&(i[o.name]=t.map(vC)):t[0]?i[o.name]=vC(t[0]):(o.nullable||n)&&(i[o.name]=null);continue}if(o.relation?.kind===`to-many`){let t=Array.isArray(e)?e.filter(pC):[],r=n?.[o.name];(n?!yC(t,Array.isArray(r)?r.filter(pC):[]):t.length>0)&&(i[o.name]=t.map(e=>e.id));continue}if(o.type===`relation`){let t=pC(e)?e:null,r=n?.[o.name];if(n&&String(t?.id)===String(pC(r)?r.id:void 0))continue;t?i[o.name]=t.id:(o.nullable||n)&&(i[o.name]=null);continue}if(o.type===`boolean`){i[o.name]=e===!0;continue}let c=typeof e==`string`?e:``,l=c.trim();if(l===``){(o.nullable||n)&&(i[o.name]=null);continue}switch(o.type){case`number`:case`decimal`:case`bigint`:{let e=TC(Nh(l),o.type===`bigint`);e===void 0?a[s]=[J(`validation.number`)]:i[o.name]=o.type===`number`?Number(e):e;break}case`json`:try{i[o.name]=JSON.parse(l)}catch{a[s]=[J(`validation.json`)]}break;case`date`:{let e=Mh(l);!/^\d{4}-\d{2}-\d{2}$/.test(e)||Number.isNaN(Date.parse(`${e}T00:00:00Z`))||new Date(`${e}T00:00:00Z`).toISOString().slice(0,10)!==e?a[s]=[J(`validation.date`)]:i[o.name]=e;break}case`datetime`:{let e=new Date(Mh(l));Number.isNaN(e.getTime())?a[s]=[J(`validation.datetime`)]:i[o.name]=e.toISOString();break}default:i[o.name]=c}}return{payload:i,errors:a}}function DC(e,t){let{payload:n}=EC(e,t),r=e=>Array.isArray(e)?e.every(e=>typeof e==`string`||typeof e==`number`):typeof e==`string`?e.length<=100:typeof e!=`object`||!e,i=Object.fromEntries(Object.entries(n).filter(([,e])=>r(e))),a=JSON.stringify(i);return a.length<=4e3?a:void 0}var OC=`(max-width: 767px)`;function kC(e){let t=window.matchMedia(OC);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function AC(){return(0,y.useSyncExternalStore)(kC,()=>window.matchMedia(OC).matches,()=>!1)}function jC(e,t){if(e.widget===`stepper`)return`select`;if(e.widget)return e.widget;switch(e.type){case`boolean`:return`checkbox`;case`enum`:return`select`;case`text`:return`textarea`;case`json`:case`object`:return`json`;case`number`:case`decimal`:case`bigint`:return`number`;case`date`:return`date`;case`datetime`:return`datetime`;default:return t?.format===`email`?`email`:t?.format===`url`?`url`:`text`}}function MC(e,t){return e.enumLabels?.[t]??t}var NC=`h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,PC=new Set([`number`,`decimal`,`bigint`,`date`,`datetime`]);function FC({schema:e,params:t,onChange:n,trailing:r}){let i=X(),a=AC(),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(),u=t.get(`search`)??``,[d,f]=(0,y.useState)(u);(0,y.useEffect)(()=>{f(u)},[u]);let p=e.list.filters.map(t=>({operators:t.operators,field:e.fields.find(e=>e.name===t.field)})).filter(e=>e.field!==void 0),m=e.list.search.length>0,h=a&&(p.length>0||e.list.sortable.length>0);if(p.length===0&&!m&&!h&&!r)return null;let g=e.list.search.map(t=>e.fields.find(e=>e.name===t)?.label??t);if(!a){let a=new Map(lC(e,t).map(e=>[e.key,e]));return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[m&&(0,b.jsx)(qC,{label:i(`filters.search`),placeholder:i(`filters.searchIn`,{fields:g.join(`, `)}),value:d,onChange:f,onSubmit:()=>n({search:d.trim()||null})}),p.length>0&&(0,b.jsx)(`ul`,{"aria-label":i(`filters.filters`),className:`contents`,children:p.map(({field:r,operators:i})=>(0,b.jsx)(`li`,{className:`contents`,children:(0,b.jsx)(JC,{resource:e.name,field:r,operators:i,params:t,onChange:n,chip:a.get(`filter:${r.name}`)})},r.name))}),XS(t)&&(0,b.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>n(ZS(t)),children:[i(`filters.clear`),(0,b.jsx)(Sx,{className:`size-3.5`})]}),r&&(0,b.jsx)(`div`,{className:`ms-auto flex items-center gap-2`,children:r})]})}let _=nC(t),v=lC(e,t).length>0,x=IC(e,t,i),S=()=>{l(new URLSearchParams(t)),s(!0)};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[m&&(0,b.jsx)(qC,{className:`flex-1`,label:i(`filters.search`),placeholder:i(`filters.searchIn`,{fields:g.join(`, `)}),value:d,onChange:f,onSubmit:()=>n({search:d.trim()||null})}),h&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,"aria-haspopup":`dialog`,onClick:S,children:[(0,b.jsx)(Hb,{}),i(`filters.filters`),_>0&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1.5 text-xs text-primary-foreground`,children:eg(_)})]})]}),(v||h&&x)&&(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[v&&(0,b.jsx)(UC,{schema:e,params:t,onChange:n}),h&&x&&(0,b.jsxs)(`button`,{type:`button`,className:`inline-flex h-9 items-center gap-1.5 rounded-full border border-input bg-card px-3 text-[13px]`,"aria-haspopup":`dialog`,onClick:S,children:[(0,b.jsx)(W_,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),x]})]}),h&&(0,b.jsx)(jd,{open:o,onOpenChange:s,children:(0,b.jsxs)(Ld,{children:[(0,b.jsx)(zd,{className:HS}),(0,b.jsxs)(Ud,{"aria-describedby":void 0,className:`fixed inset-x-0 bottom-0 z-50 flex max-h-[85dvh] flex-col rounded-t-[18px] bg-card shadow-xl outline-none`,children:[(0,b.jsx)(`div`,{className:`flex justify-center pt-2`,"aria-hidden":!0,children:(0,b.jsx)(`span`,{className:`h-1.5 w-10 rounded-full bg-input`})}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 ps-4 pe-2 pt-1.5 pb-2`,children:[(0,b.jsx)(Jd,{className:`flex-1 text-[17px] font-bold`,children:i(`filters.filtersAndSort`)}),XS(t)&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,className:`text-primary`,onClick:()=>n(ZS(t)),children:i(`filters.clear`)})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-5 overflow-y-auto px-4 py-1`,children:[p.map(({field:r,operators:i})=>(0,b.jsx)(RC,{resource:e.name,field:r,operators:i,params:t,onChange:n,touch:!0},r.name)),e.list.sortable.length>0&&(0,b.jsx)(LC,{schema:e,params:t,onChange:n})]}),(0,b.jsxs)(`div`,{className:`flex gap-2.5 border-t px-4 pt-3 pb-5`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>{c&&n(rC(t,c)),s(!1)},children:i(`common.cancel`)}),(0,b.jsx)(Xd,{asChild:!0,children:(0,b.jsx)(q,{className:`flex-1`,children:i(`filters.showResults`)})})]})]})]})})]})}function IC(e,t,n){if(e.list.sortable.length===0)return``;let{field:r,direction:i}=e.list.defaultSort,a=t.get(`sort`)??(i===`desc`?`-${r}`:r),o=a.replace(/^-/,``),s=e.fields.find(e=>e.name===o)?.label??o;return n(a.startsWith(`-`)?`filters.descending`:`filters.ascending`,{name:s})}function LC({schema:e,params:t,onChange:n}){let r=X(),{field:i,direction:a}=e.list.defaultSort,o=t.get(`sort`)??(a===`desc`?`-${i}`:i),s=t=>e.fields.find(e=>e.name===t)?.label??t;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`list-sort`,children:r(`filters.sortBy`)}),(0,b.jsx)(`select`,{id:`list-sort`,className:NC,value:o,onChange:e=>n({sort:e.target.value,page:null,after:null}),children:e.list.sortable.flatMap(e=>[(0,b.jsx)(`option`,{value:e,children:r(`filters.ascending`,{name:s(e)})},e),(0,b.jsx)(`option`,{value:`-${e}`,children:r(`filters.descending`,{name:s(e)})},`-${e}`)])})]})}function RC(e){let t=(0,b.jsx)(HC,{...e}),{field:n,operators:r,params:i,onChange:a}=e;return!n.nullable||!r.includes(`isNull`)||n.type===`relation`?t:(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[t,(0,b.jsx)(zC,{field:n,params:i,onChange:a})]})}function zC({field:e,params:t,onChange:n}){let r=X(),i=YS(e.name,`isNull`);return(0,b.jsxs)(`select`,{"aria-label":r(`filters.emptyValues`,{field:e.label}),className:W(NC,`h-7 text-xs text-muted-foreground`),value:t.get(i)??``,onChange:e=>n({[i]:e.target.value||null}),children:[(0,b.jsx)(`option`,{value:``,children:r(`filters.any`)}),(0,b.jsx)(`option`,{value:`true`,children:r(`filters.onlyEmpty`)}),(0,b.jsx)(`option`,{value:`false`,children:r(`filters.hideEmpty`)})]})}function BC({id:e,inline:t,field:n,params:r,onChange:i}){let a=X(),o=YS(n.name,`in`),s=(r.get(o)??``).split(`,`).filter(Boolean),c=e=>{let t=s.includes(e)?s.filter(t=>t!==e):[...s,e];i({[o]:t.length>0?t.join(`,`):null})};return t?(0,b.jsx)(VC,{field:n,selected:s,onToggle:c}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:e,children:n.label}),(0,b.jsxs)(Sh,{children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsxs)(q,{id:e,type:`button`,variant:`outline`,className:`justify-between font-normal`,children:[(0,b.jsx)(`span`,{className:`truncate`,children:s.length===0?a(`common.all`):s.length<=2?s.map(e=>MC(n,e)).join(`, `):a(`filters.selected`,{count:s.length})}),(0,b.jsx)(Sv,{className:`size-4 opacity-60`,"aria-hidden":!0})]})}),(0,b.jsx)(wh,{children:(0,b.jsx)(Th,{align:`start`,sideOffset:4,className:`z-50 min-w-48 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:(0,b.jsx)(VC,{field:n,selected:s,onToggle:c})})})]})]})}function VC({field:e,selected:t,onToggle:n}){return(0,b.jsx)(`ul`,{"aria-label":e.label,children:(e.enumValues??[]).map(r=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-accent`,children:[(0,b.jsx)(ff,{checked:t.includes(r),onCheckedChange:()=>n(r),className:`flex size-4 items-center justify-center rounded border border-input data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,children:(0,b.jsx)(mf,{children:(0,b.jsx)(bv,{className:`size-3`})})}),MC(e,r)]})},r))})}function HC({inline:e,touch:t,resource:n,field:r,operators:i,params:a,onChange:o}){let{t:s,calendar:c}=Y(),l=`filter-${r.name}`;if(t&&r.type===`enum`&&i.includes(`in`))return(0,b.jsx)(XC,{field:r,params:a,onChange:o});if(r.type===`enum`&&i.includes(`in`))return(0,b.jsx)(BC,{id:l,inline:e,field:r,params:a,onChange:o});if(r.type===`relation`){let e=r.relation?.kind===`to-many`?`in`:`eq`;return i.includes(e)?(0,b.jsx)(GC,{id:l,resource:n,field:r,operator:e,params:a,onChange:o}):null}if((r.type===`enum`||r.type===`boolean`)&&i.includes(`eq`)){let e=YS(r.name,`eq`),n=r.type===`boolean`?[[`true`,s(`common.yes`)],[`false`,s(`common.no`)]]:(r.enumValues??[]).map(e=>[e,MC(r,e)]);return t&&n.length<=3?(0,b.jsx)(ZC,{label:r.label,options:[[``,s(`common.all`)],...n],value:a.get(e)??``,onChange:t=>o({[e]:t||null})}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:l,children:r.label}),(0,b.jsxs)(`select`,{id:l,className:NC,value:a.get(e)??``,onChange:t=>o({[e]:t.target.value||null}),children:[(0,b.jsx)(`option`,{value:``,children:s(`common.all`)}),n.map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))]})]})}if((r.type===`date`||r.type===`datetime`)&&i.includes(`gte`)&&i.includes(`lte`)){let e=(e,t)=>r.type===`date`||!t?t:new Date(`${t}T${e===`gte`?`00:00:00.000`:`23:59:59.999`}`).toISOString(),t=e=>e&&r.type===`datetime`?CC(e).slice(0,10):e??``;return(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:r.label}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`gte`,`lte`].map(n=>{let i=YS(r.name,n),c=`${l}-${n}`,u=s(n===`gte`?`filters.from`:`filters.to`);return(0,b.jsxs)(`div`,{className:`flex min-w-36 flex-1 flex-col gap-1`,children:[(0,b.jsx)(kh,{htmlFor:c,className:`text-xs text-muted-foreground`,children:u}),(0,b.jsx)(RS,{id:c,label:`${r.label} ${u}`,value:t(a.get(i)),onChange:t=>o({[i]:e(n,t)||null})})]},n)})})]})}if(PC.has(r.type)&&i.includes(`gte`)&&i.includes(`lte`)){let e=r.type===`date`?`date`:r.type===`datetime`?`datetime-local`:`text`,t=e=>r.type===`datetime`&&e?new Date(e).toISOString():Nh(e.trim()).replace(/,/g,``),n=e=>e&&r.type===`datetime`?CC(e):e??``;return(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:r.label}),(0,b.jsx)(`div`,{className:`flex gap-2`,children:[`gte`,`lte`].map(i=>{let c=YS(r.name,i),u=`${l}-${i}`;return(0,b.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1`,children:[(0,b.jsx)(kh,{htmlFor:u,className:`text-xs text-muted-foreground`,children:s(i===`gte`?`filters.from`:`filters.to`)}),(0,b.jsx)(KC,{id:u,type:e,inputMode:e===`text`?`decimal`:void 0,value:n(a.get(c)),onCommit:e=>o({[c]:t(e)||null})})]},i)})})]})}let u=i.includes(`contains`)?`contains`:i.includes(`eq`)?`eq`:void 0;if(!u)return null;let d=YS(r.name,u);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:l,children:u===`contains`?s(`filters.contains`,{field:r.label}):r.label}),(0,b.jsx)(KC,{id:l,value:a.get(d)??``,onCommit:e=>o({[d]:e.trim()||null})})]})}function UC({schema:e,params:t,onChange:n}){let r=X(),i=lC(e,t);return(0,b.jsx)(`ul`,{"aria-label":r(`filters.active`),className:`flex flex-wrap gap-2`,children:i.map(t=>(0,b.jsxs)(`li`,{className:`inline-flex h-9 items-center gap-1 rounded-full border border-primary bg-primary-soft ps-3 pe-1.5 text-[13px] font-semibold text-primary`,children:[(0,b.jsxs)(`span`,{className:`font-medium`,children:[t.label,`:`]}),t.ref?(0,b.jsx)(WC,{resource:e.name,chip:t}):(0,b.jsx)(`span`,{children:t.value}),(0,b.jsx)(`button`,{type:`button`,className:`rounded-full p-1 hover:bg-primary-soft`,"aria-label":r(`filters.removeChip`,{label:t.label}),onClick:()=>n(Object.fromEntries(t.remove.map(e=>[e,null]))),children:(0,b.jsx)(Sx,{className:`size-3.5`})})]},t.key))})}function WC({resource:e,chip:t}){let n=Qg(e,t.ref.field,t.ref.ids);if(!n.data)return(0,b.jsx)(`span`,{children:t.value});let r=new Map(n.data.items.map(e=>[String(e.id),e.title]));return(0,b.jsx)(`span`,{children:t.ref.prefix+t.ref.ids.map(e=>r.get(e)??`#${e}`).join(`, `)})}function GC({id:e,resource:t,field:n,operator:r,params:i,onChange:a}){let o=YS(n.name,r),s=(i.get(o)??``).split(`,`).filter(Boolean),c=Qg(t,n.name,s),l=new Map((c.data?.items??[]).map(e=>[String(e.id),e])),u=s.map(e=>l.get(e)??{id:e,title:`#${e}`});return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:e,children:n.label}),(0,b.jsx)(GS,{id:e,resource:t,field:n,clearable:!0,value:r===`in`?u:u[0]??null,onChange:e=>{let t=Array.isArray(e)?e:e?[e]:[];a({[o]:t.length>0?t.map(e=>e.id).join(`,`):null})}})]})}function KC({id:e,value:t,type:n=`text`,inputMode:r,onCommit:i}){let[a,o]=(0,y.useState)(t);(0,y.useEffect)(()=>{o(t)},[t]);let s=()=>{a!==t&&i(a)};return(0,b.jsx)(Oh,{id:e,type:n,inputMode:r,value:a,onChange:e=>o(e.target.value),onBlur:s,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),s())}})}function qC({label:e,placeholder:t,value:n,className:r,onChange:i,onSubmit:a}){return(0,b.jsxs)(`form`,{role:`search`,className:W(`relative w-[300px] max-w-full`,r),onSubmit:e=>{e.preventDefault(),a()},children:[(0,b.jsx)(Eb,{className:`pointer-events-none absolute start-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(Oh,{"aria-label":e,placeholder:t,value:n,className:`ps-8`,onChange:e=>i(e.target.value)})]})}function JC({chip:e,...t}){let n=X(),{field:r,onChange:i}=t,a=e&&(()=>i(Object.fromEntries(e.remove.map(e=>[e,null]))));return(0,b.jsxs)(Sh,{children:[(0,b.jsxs)(`span`,{className:W(`inline-flex h-8 items-center rounded-lg border border-dashed border-input`,e&&`border-solid bg-card`),children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsxs)(`button`,{type:`button`,className:`inline-flex h-full items-center gap-1.5 rounded-lg px-2.5 text-[12.5px] font-medium outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50`,children:[e?(0,b.jsx)(Py,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}):(0,b.jsx)(Av,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),r.label,e&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`sr-only`,children:`:`}),(0,b.jsx)(`span`,{className:`h-4 w-px bg-border`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`max-w-48 truncate rounded-[5px] bg-muted px-1.5 text-xs font-medium`,children:e.ref?(0,b.jsx)(WC,{resource:t.resource,chip:e}):e.value})]})]})}),a&&(0,b.jsx)(`button`,{type:`button`,className:`-ms-1 me-1 rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":n(`filters.removeChip`,{label:r.label}),onClick:a,children:(0,b.jsx)(Sx,{className:`size-3.5`})})]}),(0,b.jsx)(wh,{children:(0,b.jsx)(Th,{align:`start`,sideOffset:6,onOpenAutoFocus:r.type===`relation`?e=>e.preventDefault():void 0,className:`z-50 flex w-72 flex-col gap-3 rounded-[10px] border bg-popover p-3 text-popover-foreground shadow-lg outline-none`,children:(0,b.jsx)(RC,{...t,inline:!0})})})]})}var YC=`inline-flex h-9 items-center gap-1.5 rounded-full border border-input bg-card px-3 text-[13px] outline-none focus-visible:ring-3 focus-visible:ring-ring/50 data-[state=checked]:border-primary data-[state=checked]:bg-primary-soft data-[state=checked]:font-semibold data-[state=checked]:text-primary`;function XC({field:e,params:t,onChange:n}){let r=YS(e.name,`in`),i=(t.get(r)??``).split(`,`).filter(Boolean),a=e=>{let t=i.includes(e)?i.filter(t=>t!==e):[...i,e];n({[r]:t.length>0?t.join(`,`):null})};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,b.jsx)(`span`,{className:`text-sm font-medium`,"aria-hidden":!0,children:e.label}),(0,b.jsx)(`ul`,{"aria-label":e.label,className:`flex flex-wrap gap-2`,children:(e.enumValues??[]).map(t=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(ff,{checked:i.includes(t),onCheckedChange:()=>a(t),className:YC,children:[(0,b.jsx)(mf,{children:(0,b.jsx)(bv,{className:`size-3.5`})}),MC(e,t)]})},t))})]})}function ZC({label:e,options:t,value:n,onChange:r}){return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,b.jsx)(`span`,{className:`text-sm font-medium`,"aria-hidden":!0,children:e}),(0,b.jsx)(`div`,{role:`radiogroup`,"aria-label":e,className:`grid auto-cols-fr grid-flow-col gap-0.5 rounded-[10px] bg-muted p-[3px]`,children:t.map(([e,t])=>(0,b.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n===e,className:W(`h-9 rounded-lg text-[13px] text-muted-foreground`,n===e&&`bg-card font-semibold text-foreground shadow-sm`),onClick:()=>r(e),children:t},e))})]})}var QC=[`auth.*`,`auth.login`,`auth.login_failed`,`auth.view_as`,`rbac.*`,`rbac.role.changed`,`rbac.user_roles.changed`,`page.*`],$C=[`*`,`created`,`updated`,`deleted`,`restored`,`purged`,`action.*`];function ew(){let{t:e,locale:t}=Y(),[n,r]=wo(),i=Gg(),a=Wg(),o=a.data?.audit.view===!0,s=tS(n),c=mt({queryKey:[`audit`,s],initialPageParam:void 0,queryFn:({pageParam:e})=>Q.audit(s,e),getNextPageParam:e=>e.next,staleTime:0,enabled:o,retry:!1}),l=c.data?.pages.flatMap(e=>e.entries)??[],u=new Set((i.data?.groups??[]).flatMap(e=>e.resources.map(e=>e.name))),d=[...new Set(l.map(e=>e.resource).filter(e=>e!==void 0&&u.has(e)))].sort(),f=ut({queries:d.map(e=>({queryKey:[`schema`,e,t],queryFn:()=>Q.schema(e),retry:!1}))}),p=e=>f[d.indexOf(e)]?.data,m=new Set((i.data?.groups??[]).flatMap(e=>e.pages.map(e=>e.name))),h=[...new Set(l.map(e=>e.meta?.page).filter(e=>e!==void 0&&m.has(e)))].sort(),g=ut({queries:h.map(e=>({queryKey:[`page`,e,t],queryFn:()=>Q.page(e),retry:!1}))}),_=e=>g[h.indexOf(e)]?.data?.schema.fields,v=(e,t)=>r(n=>QS(n,rS(e,t))),y=c.error instanceof fg&&(c.error.status===403||c.error.status===404);if(a.isPending)return(0,b.jsx)(G,{children:e(`common.loading`)});if(!o||y)return(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(E_,{children:e(`audit.title`)}),(0,b.jsx)(G,{tone:`error`,children:y?pg(c.error):e(a.data?.audit.enabled?`audit.notAllowed`:`audit.off`)})]});let x=(i.data?.groups??[]).flatMap(e=>e.resources),S=n.get(`resource`)??``;return(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(E_,{children:e(`audit.title`)}),(0,b.jsxs)(`fieldset`,{className:`grid gap-3 rounded-card border bg-card shadow-card p-3 sm:grid-cols-2 lg:grid-cols-3`,children:[(0,b.jsx)(`legend`,{className:`px-1 text-xs font-medium text-muted-foreground`,children:e(`filters.filters`)}),(0,b.jsx)(tw,{label:e(`audit.filter.actor`),value:n.get(`actor`)??``,onCommit:e=>v(`actor`,e)}),(0,b.jsx)(tw,{label:e(`audit.filter.event`),placeholder:e(`audit.filter.eventHint`),value:n.get(`event`)??``,onCommit:e=>v(`event`,e),hints:[...S?$C.map(e=>`${S}.${e}`):[],...QC]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`audit-resource`,children:e(`audit.filter.resource`)}),(0,b.jsxs)(`select`,{id:`audit-resource`,className:NC,value:S,onChange:e=>v(`resource`,e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:e(`common.all`)}),S&&!x.some(e=>e.name===S)&&(0,b.jsx)(`option`,{value:S,children:S}),x.map(e=>(0,b.jsx)(`option`,{value:e.name,children:e.label},e.name))]})]}),(0,b.jsx)(tw,{label:e(`audit.filter.record`),placeholder:S?void 0:e(`audit.filter.recordHint`),value:S?n.get(`record`)??``:``,disabled:!S,onCommit:e=>v(`record`,e)}),[`from`,`to`].map(t=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`audit-${t}`,children:e(`filters.${t}`)}),(0,b.jsx)(RS,{id:`audit-${t}`,label:e(`filters.${t}`),value:n.get(t)??``,onChange:e=>v(t,e)})]},t)),nS(n)&&(0,b.jsx)(`div`,{className:`flex items-end sm:col-span-2 lg:col-span-3`,children:(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>r(e=>QS(e,iS())),children:e(`filters.clear`)})})]}),c.isError&&(0,b.jsx)(D_,{children:pg(c.error)}),c.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):l.length===0?!c.isError&&(0,b.jsx)(G,{children:e(nS(n)?`audit.noMatches`:`audit.empty`)}):(0,b.jsx)(aS,{entries:l,now:new Date(c.dataUpdatedAt),names:Ix(i.data,p),schemaOf:p,pageFieldsOf:_,onActor:e=>v(`actor`,e),showSubject:!0}),c.hasNextPage&&(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`self-center`,disabled:c.isFetchingNextPage,onClick:()=>void c.fetchNextPage(),children:e(c.isFetchingNextPage?`common.loading`:`list.loadMore`)})]})}function tw({label:e,value:t,onCommit:n,placeholder:r,disabled:i,hints:a}){let o=(0,y.useId)(),[s,c]=(0,y.useState)(t);(0,y.useEffect)(()=>c(t),[t]);let l=()=>{s.trim()!==t&&n(s)};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:o,children:e}),(0,b.jsx)(Oh,{id:o,type:`text`,dir:`auto`,value:s,placeholder:r,disabled:i,list:a?`${o}-hints`:void 0,autoComplete:`off`,spellCheck:!1,onChange:e=>c(e.target.value),onBlur:l,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),l())}}),a&&(0,b.jsx)(`datalist`,{id:`${o}-hints`,children:a.map(e=>(0,b.jsx)(`option`,{value:e},e))})]})}var nw={hidden:`rbac.rule.hidden`,view:`rbac.rule.readonly`,edit:`rbac.rule.edit`};function rw(){let{t:e}=Y(),[t,n]=wo(),r=t.get(`user`)??``,i=t.get(`resource`)??``,a=t.get(`record`)??``,o=ft({queryKey:[`rbac`,`catalog`],queryFn:Q.rbac.catalog}),s=ft({queryKey:[`rbac`,`user`,r],queryFn:()=>Q.rbac.user(r),enabled:r!==``}),[c,l]=(0,y.useState)(``),[u,d]=(0,y.useState)(i),[f,p]=(0,y.useState)(a),[m,h]=(0,y.useState)(r),g=ft({queryKey:[`rbac`,`users`,c,1],queryFn:()=>Q.rbac.users({search:c}),enabled:c.trim().length>0}),_=ft({queryKey:[`rbac`,`explain`,r,i,a],queryFn:()=>Q.rbac.explain({user:r,resource:i,record:a||void 0}),enabled:r!==``&&i!==``});function v(e){e.preventDefault();let t={};m&&(t.user=m),u&&(t.resource=u),f.trim()&&(t.record=f.trim()),n(t)}let x=m===r?s.data?.displayName:void 0;return(0,b.jsxs)(`div`,{className:`flex max-w-5xl flex-col gap-5`,children:[(0,b.jsx)(E_,{children:e(`debugger.title`)}),(0,b.jsx)(`p`,{className:`-mt-3 text-sm text-muted-foreground`,children:e(`debugger.intro`)}),(0,b.jsxs)(`form`,{onSubmit:v,className:`grid gap-4 rounded-card border bg-card shadow-card p-4 md:grid-cols-3`,"aria-label":e(`debugger.title`),children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`debug-user`,children:e(`debugger.user`)}),(0,b.jsx)(Oh,{id:`debug-user`,placeholder:e(`rbac.searchUsers`),value:c,onChange:e=>l(e.target.value),autoComplete:`off`}),c.trim()&&(0,b.jsx)(`ul`,{"aria-label":e(`rbac.searchResults`),className:`flex flex-col rounded-md border text-sm`,children:(g.data?.items??[]).slice(0,6).map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`button`,{type:`button`,className:`w-full px-2 py-1.5 text-start hover:bg-accent`,onClick:()=>{h(e.id),l(``)},children:[e.displayName,e.username&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e.username]})]})},e.id))}),m&&(0,b.jsx)(`p`,{className:`text-sm`,"data-testid":`debug-chosen-user`,children:x??m})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`debug-resource`,children:e(`debugger.resource`)}),(0,b.jsxs)(`select`,{id:`debug-resource`,className:`h-9 rounded-md border bg-background px-2 text-sm`,value:u,onChange:e=>d(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`—`}),(o.data?.resources??[]).map(e=>(0,b.jsx)(`option`,{value:e.name,children:e.label},e.name))]})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`debug-record`,children:e(`debugger.record`)}),(0,b.jsx)(Oh,{id:`debug-record`,dir:`ltr`,value:f,onChange:e=>p(e.target.value)})]}),(0,b.jsx)(`div`,{className:`md:col-span-3`,children:(0,b.jsx)(q,{type:`submit`,disabled:!m||!u,children:e(`debugger.explain`)})})]}),!r||!i?(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`debugger.pick`)}):_.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):_.isError?(0,b.jsx)(G,{tone:`error`,children:pg(_.error)}):(0,b.jsx)(aw,{data:_.data})]})}function iw({allowed:e}){let{t}=Y();return(0,b.jsx)(`span`,{className:W(`rounded-full px-2 py-0.5 text-xs font-medium`,e?`bg-green-500/15 text-green-800 dark:text-green-300`:`bg-destructive/10 text-destructive`),children:t(e?`debugger.allowed`:`debugger.denied`)})}function aw({data:e}){let{t,locale:n}=Y(),r=e=>e.kind===`group`?t(`debugger.source.group`,{group:e.group??``}):t(`debugger.source.${e.kind}`),i=e=>e===`all`?t(`debugger.allRows`):e.length===0?t(`debugger.noRows`):t(`debugger.someRows`,{scopes:e.join(`, `)});return(0,b.jsxs)(`div`,{className:`flex flex-col gap-5`,"data-testid":`explanation`,children:[(0,b.jsxs)(`section`,{"aria-labelledby":`debug-roles`,className:`flex flex-col gap-2`,children:[(0,b.jsxs)(`h2`,{id:`debug-roles`,className:`font-medium`,children:[t(`debugger.roles`),` · `,e.user.displayName]}),e.superuser?(0,b.jsx)(`p`,{className:`text-sm`,children:t(`debugger.superuser`)}):e.roles.length===0?(0,b.jsx)(`p`,{className:`text-sm`,children:t(`debugger.noRoles`)}):(0,b.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:e.roles.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsx)(`span`,{className:`font-medium`,children:C_(e.label,n)||e.name}),` `,(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.sources.map(r).join(`, `),`)`]}),!e.known&&(0,b.jsx)(`span`,{className:`ms-2 text-destructive`,children:t(`debugger.unknownRole`)})]},e.name))})]}),(0,b.jsxs)(`section`,{"aria-labelledby":`debug-operations`,className:`flex flex-col gap-2`,children:[(0,b.jsxs)(`h2`,{id:`debug-operations`,className:`font-medium`,children:[t(`debugger.operations`),` · `,e.resource.label]}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsx)(`table`,{className:`w-full text-sm`,children:(0,b.jsx)(`tbody`,{className:`divide-y`,children:e.operations.map(n=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{scope:`row`,className:`w-32 px-3 py-2 text-start font-medium`,children:t(`rbac.op.${n.operation}`)}),(0,b.jsx)(`td`,{className:`w-24 px-3 py-2`,children:(0,b.jsx)(iw,{allowed:n.allowed})}),(0,b.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.superuser?``:n.grantedBy.length===0?t(`debugger.noGrant`):n.grantedBy.map(e=>t(e.via?`debugger.viaUpdate`:`debugger.grant`,{pattern:e.pattern,role:e.role})).join(` · `)})]},n.operation))})})})]}),e.actions.length>0&&(0,b.jsxs)(`section`,{"aria-labelledby":`debug-actions`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-actions`,className:`font-medium`,children:t(`debugger.actions`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsx)(`table`,{className:`w-full text-sm`,children:(0,b.jsx)(`tbody`,{className:`divide-y`,children:e.actions.map(n=>(0,b.jsxs)(`tr`,{"data-action":n.name,children:[(0,b.jsx)(`th`,{scope:`row`,className:`w-32 px-3 py-2 text-start font-medium`,children:n.label}),(0,b.jsx)(`td`,{className:`w-24 px-3 py-2`,children:(0,b.jsx)(iw,{allowed:n.allowed})}),(0,b.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.superuser?``:[n.grantedBy.length===0?t(`debugger.noGrant`):n.grantedBy.map(e=>t(`debugger.grant`,{pattern:e.pattern,role:e.role})).join(` · `),...n.needsUpdate?[t(`debugger.needsUpdate`)]:[]].join(` — `)})]},n.name))})})})]}),(0,b.jsxs)(`section`,{"aria-labelledby":`debug-fields`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-fields`,className:`font-medium`,children:t(`debugger.fields`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{className:`bg-muted/40 text-xs text-muted-foreground`,children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`debugger.field`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`debugger.result`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`debugger.byRole`)})]})}),(0,b.jsx)(`tbody`,{className:`divide-y`,children:e.fields.map(e=>(0,b.jsxs)(`tr`,{"data-field":e.name,children:[(0,b.jsxs)(`th`,{scope:`row`,className:`px-3 py-2 text-start font-medium`,children:[e.label,e.restricted&&(0,b.jsx)(`span`,{className:`ms-2 rounded-full border px-1.5 text-xs font-normal text-muted-foreground`,children:t(`rbac.restricted`)})]}),(0,b.jsxs)(`td`,{className:`px-3 py-2`,children:[t(nw[e.level]),e.forced&&(0,b.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:t(`debugger.forced`)})]}),(0,b.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.byRole.map(e=>`${e.role}: ${t(nw[e.level])}${e.rule?` (${e.rule})`:``}${e.code?` (${e.code})`:``}`).join(` · `)})]},e.name))})]})})]}),(0,b.jsxs)(`section`,{"aria-labelledby":`debug-scopes`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-scopes`,className:`font-medium`,children:t(`debugger.scopes`)}),(0,b.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:e.scopes.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`span`,{className:`font-medium`,children:[t(`rbac.op.${e.operation}`),`:`]}),` `,i(e.result),e.byRole.length>0&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[` (`,e.byRole.map(e=>`${e.role}: ${i(e.scopes)}`).join(` · `),`)`]}),e.global.length>0&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,t(`debugger.globalScopes`,{scopes:e.global.join(`, `)})]})]},e.operation))})]}),e.record&&(0,b.jsxs)(`section`,{"aria-labelledby":`debug-record-title`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-record-title`,className:`font-medium`,children:t(`debugger.recordTitle`,{id:e.record.id})}),(0,b.jsxs)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:[[`view`,`update`,`delete`].map(n=>(0,b.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,"data-operation":n,children:[(0,b.jsx)(`span`,{className:`w-24 font-medium`,children:t(`rbac.op.${n}`)}),(0,b.jsx)(iw,{allowed:e.record[n]}),e.record.reasons[n]&&(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:t(`debugger.reason.${e.record.reasons[n]}`)})]},n)),e.record.actions&&(0,b.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,"data-operation":`actions`,children:[(0,b.jsx)(`span`,{className:`w-24 font-medium`,children:t(`debugger.actions`)}),(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e.record.actions.length===0?t(`debugger.noRecordActions`):e.record.actions.map(t=>e.actions.find(e=>e.name===t)?.label??t).join(`, `)})]})]})]}),e.pages.length>0&&(0,b.jsxs)(`section`,{"aria-labelledby":`debug-pages`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-pages`,className:`font-medium`,children:t(`debugger.pages`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{className:`bg-muted/40 text-xs text-muted-foreground`,children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`rbac.page`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`rbac.op.view`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`rbac.op.update`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`debugger.byRole`)})]})}),(0,b.jsx)(`tbody`,{className:`divide-y`,children:e.pages.map(n=>(0,b.jsxs)(`tr`,{"data-page":n.name,children:[(0,b.jsx)(`th`,{scope:`row`,className:`px-3 py-2 text-start font-medium`,children:n.label}),(0,b.jsx)(`td`,{className:`px-3 py-2`,"data-operation":`view`,children:(0,b.jsx)(iw,{allowed:n.view})}),(0,b.jsx)(`td`,{className:`px-3 py-2`,"data-operation":`update`,children:(0,b.jsx)(iw,{allowed:n.update})}),(0,b.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.superuser?``:n.grantedBy.length===0?t(`debugger.noGrant`):n.grantedBy.map(e=>`${t(`debugger.grant`,{pattern:e.pattern,role:e.role})} (${e.code})`).join(` · `)})]},n.name))})]})})]})]})}function ow(){let{t:e,locale:t}=Y(),n=Wg(),r=ft({queryKey:[`rbac`,`groups`],queryFn:Q.rbac.groups});return r.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(G,{tone:`error`,children:pg(r.error)}):(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(E_,{actions:n.data?.rbac.manage&&(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/-/groups/new`,children:[(0,b.jsx)(mb,{}),e(`rbac.newGroup`)]})}),children:e(`rbac.groups`)}),r.data.items.length===0&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`rbac.noGroups`)}),(0,b.jsx)(`ul`,{"aria-label":e(`rbac.groups`),className:`flex flex-col divide-y rounded-card border bg-card shadow-card empty:hidden`,children:r.data.items.map(n=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{to:`/-/groups/${n.id}`,className:`flex flex-wrap items-center justify-between gap-2 px-4 py-3 hover:bg-muted/50`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:C_(n.label,t)||n.name}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`rbac.groupSummary`,{roles:n.roles.length,members:n.members.length})})]})},n.id))})]})}function sw(){let{t:e}=Y(),{id:t}=$i(),n=t===void 0,r=ft({queryKey:[`rbac`,`roles`],queryFn:Q.rbac.roles}),i=ft({queryKey:[`rbac`,`group`,t],queryFn:()=>Q.rbac.group(Number(t)),enabled:!n});return r.isPending||!n&&i.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(G,{tone:`error`,children:pg(r.error)}):!n&&i.isError?(0,b.jsx)(G,{tone:`error`,children:pg(i.error)}):(0,b.jsx)(cw,{roles:r.data.items,group:n?void 0:i.data},t??`new`)}function cw({roles:e,group:t}){let{t:n,locale:r}=Y(),i=Yi(),a=S(),o=Wg().data?.rbac.manage!==!0,[s,c]=(0,y.useState)(t?.name??``),[l,u]=(0,y.useState)(T_(t?.label)),[d,f]=(0,y.useState)(t?.roles??[]),[p,m]=(0,y.useState)(t?.members??[]),[h,g]=(0,y.useState)(``),_=ft({queryKey:[`rbac`,`users`,h],queryFn:()=>Q.rbac.users({search:h}),enabled:h.trim().length>0}),v=ft({queryKey:[`rbac`,`users`,``,1],queryFn:()=>Q.rbac.users({})}),[x,C]=(0,y.useState)({}),w=e=>x[e]??v.data?.items.find(t=>t.id===e)?.displayName??e,[T,E]=(0,y.useState)(null),D=pt({mutationFn:()=>Q.rbac.saveGroup({name:s.trim(),label:w_(l)??null,roles:d,members:p},t?.id),onSuccess:async e=>{await a.invalidateQueries({queryKey:[`rbac`]}),await a.invalidateQueries({queryKey:[`session`]}),i(`/-/groups/${e.id}`,{replace:!0}),E(null)},onError:e=>E(pg(e))}),O=pt({mutationFn:()=>Q.rbac.deleteGroup(t.id),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`rbac`]}),i(`/-/groups`)},onError:e=>E(pg(e))});function k(e){e.preventDefault(),o||D.mutate()}return(0,b.jsxs)(`form`,{onSubmit:k,className:`flex max-w-3xl flex-col gap-5`,"aria-label":n(`rbac.group`),children:[(0,b.jsx)(E_,{children:t?C_(t.label,r)||t.name:n(`rbac.newGroup`)}),T&&(0,b.jsx)(D_,{children:T}),(0,b.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`group-name`,children:n(`rbac.name`)}),(0,b.jsx)(Oh,{id:`group-name`,dir:`ltr`,value:s,disabled:o,onChange:e=>c(e.target.value)})]}),dg.locales.map(e=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`group-label-${e}`,children:n(`rbac.labelIn`,{language:e})}),(0,b.jsx)(Oh,{id:`group-label-${e}`,value:l[e]??``,disabled:o,onChange:t=>u({...l,[e]:t.target.value})})]},e))]}),(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`legend`,{className:`mb-1 font-medium`,children:n(`rbac.roles`)}),e.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:d.includes(e.name),disabled:o,onChange:t=>f(t.target.checked?[...d,e.name]:d.filter(t=>t!==e.name))}),C_(e.label,r)||e.name]},e.name))]}),(0,b.jsxs)(`section`,{"aria-labelledby":`members-title`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`members-title`,className:`font-medium`,children:n(`rbac.members`)}),(0,b.jsxs)(`ul`,{"aria-label":n(`rbac.members`),className:`flex flex-wrap gap-2`,children:[p.map(e=>(0,b.jsxs)(`li`,{className:`flex items-center gap-1 rounded-full border px-2 py-0.5 text-sm`,children:[w(e),!o&&(0,b.jsx)(`button`,{type:`button`,"aria-label":n(`picker.remove`,{name:w(e)}),onClick:()=>m(p.filter(t=>t!==e)),children:(0,b.jsx)(Sx,{className:`size-3.5`})})]},e)),p.length===0&&(0,b.jsx)(`li`,{className:`text-sm text-muted-foreground`,children:n(`rbac.noMembers`)})]}),!o&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`member-search`,children:n(`rbac.addMember`)}),(0,b.jsx)(Oh,{id:`member-search`,value:h,placeholder:n(`rbac.searchUsers`),onChange:e=>g(e.target.value)}),(0,b.jsx)(`ul`,{"aria-label":n(`rbac.searchResults`),className:`flex flex-wrap gap-2`,children:(_.data?.items??[]).filter(e=>!p.includes(e.id)).map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{C({...x,[e.id]:e.displayName}),m([...p,e.id])},children:[(0,b.jsx)(mb,{}),e.displayName,e.username?` (${e.username})`:``]})},e.id))})]})]}),!o&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`submit`,disabled:D.isPending||!s.trim(),children:n(D.isPending?`form.saving`:`form.save`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>i(`/-/groups`),children:n(`common.cancel`)}),t&&(0,b.jsx)(q,{type:`button`,variant:`outline`,className:`ms-auto`,disabled:O.isPending,onClick:()=>O.mutate(),children:n(`form.delete`)})]})]})}var lw=[`view`,`create`,`update`,`delete`,`purge`,`field`,`action`];function uw(e,t){let n=e.split(`.`),r=t.split(`.`),i=r[0]===`page`&&!lw.includes(r[1]??``)&&(r.length===2||r.length===3&&r[2]===`update`);if(n[0]===`*`&&n.length>1&&i)return!1;for(let e=0;e<n.length;e++){let t=n[e];if(t===`*`&&e===n.length-1)return r.length>e;if(e>=r.length||t!==`*`&&t!==r[e])return!1}return n.length===r.length}function dw(e){let t=[...e.global];for(let n of e.resources){for(let r of e.operations)t.push(`${n.name}.${r}`);for(let e of n.custom)t.push(`${n.name}.${e}`);for(let e of n.actions)t.push(`${n.name}.action.${e.name}`)}for(let n of e.pages)t.push(`page.${n.name}`,`page.${n.name}.update`);return t}function fw(e,t){return e.some(e=>uw(e,t))}function pw(e,t,n,r){if(n)return fw(e,t)?e:[...e,t];let i=[];for(let n of e)if(n!==t){if(n.includes(`*`)&&uw(n,t)){for(let e of r)e!==t&&uw(n,e)&&!i.includes(e)&&i.push(e);continue}i.push(n)}return i.filter(e=>e===t||!uw(e,t))}var mw=[`view`,`update`,`delete`];function hw(){let{t:e}=Y(),{name:t}=$i(),n=t===void 0,r=ft({queryKey:[`rbac`,`catalog`],queryFn:Q.rbac.catalog}),i=ft({queryKey:[`rbac`,`role`,t],queryFn:()=>Q.rbac.role(t),enabled:!n});return r.isPending||!n&&i.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(G,{tone:`error`,children:pg(r.error)}):!n&&i.isError?(0,b.jsx)(G,{tone:`error`,children:pg(i.error)}):(0,b.jsx)(gw,{catalog:r.data,role:n?void 0:i.data},t??`new`)}function gw({catalog:e,role:t}){let{t:n,locale:r}=Y(),i=Yi(),a=S(),o=Wg(),s=t?.system===!0||o.data?.rbac.manage!==!0,c=dw(e),[l,u]=(0,y.useState)(t?.name??``),[d,f]=(0,y.useState)(T_(t?.label)),[p,m]=(0,y.useState)(t?.permissions??[]),[h,g]=(0,y.useState)(t?.fields??{}),[_,v]=(0,y.useState)(t?.scopes??{}),[x,C]=(0,y.useState)(null),[w,T]=(0,y.useState)(null),E=pt({mutationFn:()=>{let e={label:w_(d),permissions:p,fields:_w(h),scopes:_w(_)};return t?Q.rbac.updateRole(t.name,e):Q.rbac.createRole({name:l.trim(),...e})},onSuccess:async e=>{await a.invalidateQueries({queryKey:[`rbac`]}),await a.invalidateQueries({queryKey:[`session`]}),i(`/-/roles/${encodeURIComponent(e.name)}`,{replace:!0}),T(null)},onError:e=>T(e instanceof fg?[e.message,...Object.values(e.fields).flat()].join(` — `):pg(e))}),D=pt({mutationFn:()=>Q.rbac.deleteRole(t.name),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`rbac`]}),i(`/-/roles`)},onError:e=>T(pg(e))}),O=(e,t)=>m(n=>pw(n,e,t,c)),k=(e,t,n)=>g(r=>{let i={...r,[e]:{...r[e]}};return n===``?delete i[e][t]:i[e][t]=n,i}),A=(e,t,n,r)=>v(i=>{let a=i[e]?.[t],o=new Set(Array.isArray(a)?a:a?[a]:[]);return r?o.add(n):o.delete(n),{...i,[e]:{...i[e],[t]:[...o]}}});function j(e){e.preventDefault(),s||E.mutate()}let M=[...new Set(e.resources.map(e=>e.group))];return(0,b.jsxs)(`form`,{onSubmit:j,className:`flex max-w-5xl flex-col gap-5`,"aria-label":n(`rbac.role`),children:[(0,b.jsx)(E_,{children:t?C_(t.label,r)||t.name:n(`rbac.newRole`)}),t?.system&&(0,b.jsx)(D_,{tone:`success`,children:n(`rbac.systemNote`)}),w&&(0,b.jsx)(D_,{children:w}),(0,b.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`role-name`,children:n(`rbac.name`)}),(0,b.jsx)(Oh,{id:`role-name`,dir:`ltr`,value:l,disabled:!!t,onChange:e=>u(e.target.value)})]}),dg.locales.map(e=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`role-label-${e}`,children:n(`rbac.labelIn`,{language:e})}),(0,b.jsx)(Oh,{id:`role-label-${e}`,value:d[e]??``,disabled:s,onChange:t=>f({...d,[e]:t.target.value})})]},e))]}),(0,b.jsxs)(`section`,{"aria-labelledby":`matrix-title`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`matrix-title`,className:`font-medium`,children:n(`rbac.matrix`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`border-b bg-muted/40`,children:[(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:n(`rbac.resource`)}),e.operations.map(e=>(0,b.jsx)(`th`,{className:`px-2 py-2 text-center font-medium`,children:n(`rbac.op.${e}`)},e)),(0,b.jsx)(`th`,{className:`w-0`})]})}),(0,b.jsx)(`tbody`,{children:M.map(t=>(0,b.jsx)(y.Fragment,{children:e.resources.filter(e=>e.group===t).map(t=>{let r=x===t.name,i=`role-details-${t.name}`;return(0,b.jsxs)(y.Fragment,{children:[(0,b.jsxs)(`tr`,{className:`border-b last:border-0`,children:[(0,b.jsx)(`th`,{scope:`row`,className:`px-3 py-2 text-start font-normal`,children:t.label}),e.operations.map(e=>{let r=`${t.name}.${e}`;return(0,b.jsx)(`td`,{className:`px-2 py-2 text-center`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":n(`rbac.grant`,{operation:n(`rbac.op.${e}`),resource:t.label}),checked:fw(p,r),disabled:s,onChange:e=>O(r,e.target.checked)})},e)}),(0,b.jsx)(`td`,{className:`px-2`,children:(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-expanded":r,"aria-controls":i,"aria-label":n(`rbac.details`,{resource:t.label}),onClick:()=>C(r?null:t.name),children:(0,b.jsx)(Sv,{className:W(`transition-transform`,r&&`rotate-180`)})})})]}),r&&(0,b.jsx)(`tr`,{id:i,className:`border-b bg-muted/20`,children:(0,b.jsx)(`td`,{colSpan:e.operations.length+2,className:`px-3 py-3`,children:(0,b.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n(`rbac.fields`)}),t.fields.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[(0,b.jsxs)(`span`,{children:[e.label,e.restricted&&(0,b.jsx)(`span`,{className:`ms-2 rounded-full bg-amber-500/15 px-2 py-0.5 text-xs text-amber-800 dark:text-amber-300`,children:n(`rbac.restricted`)})]}),(0,b.jsxs)(`select`,{className:`h-8 rounded-lg border border-input bg-transparent px-2 text-sm`,value:h[t.name]?.[e.name]??``,disabled:s,"aria-label":n(`rbac.fieldRule`,{field:e.label}),onChange:n=>k(t.name,e.name,n.target.value),children:[(0,b.jsx)(`option`,{value:``,children:n(e.restricted?`rbac.rule.defaultHidden`:`rbac.rule.default`)}),(0,b.jsx)(`option`,{value:`hidden`,children:n(`rbac.rule.hidden`)}),(0,b.jsx)(`option`,{value:`readonly`,children:n(`rbac.rule.readonly`)}),(0,b.jsx)(`option`,{value:`edit`,children:n(`rbac.rule.edit`)})]})]},e.name))]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t.scopes.length>0&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n(`rbac.scopes`)}),mw.map(e=>{let r=_[t.name]?.[e],i=Array.isArray(r)?r:r?[r]:[];return(0,b.jsxs)(`fieldset`,{className:`flex flex-wrap items-center gap-3`,children:[(0,b.jsxs)(`legend`,{className:`me-2 text-sm`,children:[n(`rbac.op.${e}`),`:`]}),t.scopes.map(n=>(0,b.jsxs)(`label`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:i.includes(n),disabled:s,onChange:r=>A(t.name,e,n,r.target.checked)}),n]},n)),i.length===0&&(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`rbac.allRows`)})]},e)})]}),t.actions.length>0&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,"data-actions":t.name,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n(`rbac.actions`)}),t.actions.map(e=>{let n=`${t.name}.action.${e.name}`;return(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:fw(p,n),disabled:s,onChange:e=>O(n,e.target.checked)}),e.label,(0,b.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:n})]},e.name)}),t.actions.some(e=>e.target===`record`)&&(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`rbac.actionNote`)})]}),t.custom.length>0&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n(`rbac.custom`)}),t.custom.map(e=>{let n=`${t.name}.${e}`;return(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:fw(p,n),disabled:s,onChange:e=>O(n,e.target.checked)}),(0,b.jsx)(`code`,{className:`text-xs`,children:n})]},e)})]})]})]})})})]},t.name)})},t))})]})})]}),e.pages.length>0&&(0,b.jsxs)(`section`,{"aria-labelledby":`pages-title`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`pages-title`,className:`font-medium`,children:n(`rbac.pages`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`border-b bg-muted/40`,children:[(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:n(`rbac.page`)}),(0,b.jsx)(`th`,{className:`px-2 py-2 text-center font-medium`,children:n(`rbac.op.view`)}),(0,b.jsx)(`th`,{className:`px-2 py-2 text-center font-medium`,children:n(`rbac.op.update`)})]})}),(0,b.jsx)(`tbody`,{children:e.pages.map(e=>{let t=`page.${e.name}`,r=`${t}.update`,i=fw(p,r)&&!fw(p,t);return(0,b.jsxs)(`tr`,{className:`border-b last:border-0`,children:[(0,b.jsx)(`th`,{scope:`row`,className:`px-3 py-2 text-start font-normal`,children:e.label}),(0,b.jsx)(`td`,{className:`px-2 py-2 text-center`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":n(`rbac.grant`,{operation:n(`rbac.op.view`),resource:e.label}),title:i?n(`rbac.viewImplied`):void 0,checked:i||fw(p,t),disabled:s||i,onChange:e=>O(t,e.target.checked)})}),(0,b.jsx)(`td`,{className:`px-2 py-2 text-center`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":n(`rbac.grant`,{operation:n(`rbac.op.update`),resource:e.label}),checked:fw(p,r),disabled:s,onChange:e=>O(r,e.target.checked)})})]},e.name)})})]})})]}),e.global.length>0&&(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`legend`,{className:`mb-1 font-medium`,children:n(`rbac.global`)}),e.global.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:fw(p,e),disabled:s,onChange:t=>O(e,t.target.checked)}),(0,b.jsx)(`code`,{className:`text-xs`,children:e})]},e))]}),!s&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`submit`,disabled:E.isPending||!t&&!l.trim(),children:n(E.isPending?`form.saving`:`form.save`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>i(`/-/roles`),children:n(`common.cancel`)}),t&&(0,b.jsx)(q,{type:`button`,variant:`outline`,className:`ms-auto`,disabled:D.isPending,onClick:()=>D.mutate(),children:n(`form.delete`)})]})]})}function _w(e){let t=Object.entries(e).map(([e,t])=>[e,Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0&&!(Array.isArray(e)&&e.length===0)))]).filter(([,e])=>Object.keys(e).length>0);return t.length>0?Object.fromEntries(t):void 0}function vw(){let{t:e,locale:t}=Y(),n=Wg(),r=S(),i=ft({queryKey:[`rbac`,`roles`],queryFn:Q.rbac.roles}),a=(0,y.useRef)(null),[o,s]=(0,y.useState)(null),c=n.data?.rbac.manage===!0,l=pt({mutationFn:async e=>Q.rbac.importRoles(JSON.parse(await e.text())),onSuccess:async t=>{s(e(`rbac.imported`,{count:t.imported.length})),await r.invalidateQueries({queryKey:[`rbac`]})}});async function u(){let e=await Q.rbac.exportRoles(),t=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:`application/json`})),n=document.createElement(`a`);n.href=t,n.download=`roles.json`,n.click(),URL.revokeObjectURL(t)}return i.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):i.isError?(0,b.jsx)(G,{tone:`error`,children:pg(i.error)}):(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(E_,{actions:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(q,{variant:`outline`,onClick:()=>void u(),children:[(0,b.jsx)(Wv,{}),e(`rbac.export`)]}),c&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`input`,{ref:a,type:`file`,accept:`application/json,.json`,className:`hidden`,"aria-label":e(`rbac.importFile`),onChange:e=>{let t=e.target.files?.[0];t&&l.mutate(t),e.target.value=``}}),(0,b.jsxs)(q,{variant:`outline`,onClick:()=>a.current?.click(),children:[(0,b.jsx)(cx,{}),e(`rbac.import`)]}),(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/-/roles/new`,children:[(0,b.jsx)(mb,{}),e(`rbac.newRole`)]})})]})]}),children:e(`rbac.roles`)}),o&&(0,b.jsx)(D_,{tone:`success`,children:o}),l.isError&&(0,b.jsx)(D_,{children:l.error instanceof SyntaxError?e(`rbac.notJson`):pg(l.error)}),(0,b.jsx)(`ul`,{"aria-label":e(`rbac.roles`),className:`flex flex-col divide-y rounded-card border bg-card shadow-card`,children:i.data.items.map(n=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{to:`/-/roles/${encodeURIComponent(n.name)}`,className:`flex flex-wrap items-center justify-between gap-2 px-4 py-3 hover:bg-muted/50`,children:[(0,b.jsxs)(`span`,{className:`flex flex-col`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:C_(n.label,t)||n.name}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.name})]}),(0,b.jsxs)(`span`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e(`rbac.permissionCount`,{count:n.permissions.length}),n.system&&(0,b.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5`,children:e(`rbac.system`)})]})]})},n.name))})]})}function yw(){let{t:e}=Y(),t=Wg(),[n,r]=wo(),i=n.get(`search`)??``,a=Math.max(1,Number(n.get(`page`))||1),[o,s]=(0,y.useState)(i),c=ft({queryKey:[`rbac`,`users`,i,a],queryFn:()=>Q.rbac.users({search:i,page:a})});if(c.isPending)return(0,b.jsx)(G,{children:e(`common.loading`)});if(c.isError)return(0,b.jsx)(G,{tone:`error`,children:pg(c.error)});let{items:l,total:u,pageSize:d,capabilities:f}=c.data;return(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(E_,{actions:t.data?.rbac.manage&&f.create&&(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/-/users/new`,children:[(0,b.jsx)(mb,{}),e(`rbac.newUser`)]})}),children:e(`rbac.users`)}),!f.list&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`rbac.usersFromMemberships`)}),(0,b.jsxs)(`form`,{role:`search`,className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),r(o.trim()?{search:o.trim()}:{})},children:[(0,b.jsx)(Oh,{"aria-label":e(`rbac.searchUsers`),placeholder:e(`rbac.searchUsers`),value:o,onChange:e=>s(e.target.value)}),(0,b.jsx)(q,{type:`submit`,variant:`outline`,children:e(`filters.search`)})]}),(0,b.jsxs)(`ul`,{"aria-label":e(`rbac.users`),className:`flex flex-col divide-y rounded-card border bg-card shadow-card`,children:[l.map(t=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{to:`/-/users/${encodeURIComponent(t.id)}`,className:`flex flex-wrap items-center justify-between gap-2 px-4 py-3 hover:bg-muted/50`,children:[(0,b.jsxs)(`span`,{className:`flex flex-col`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:t.displayName}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:[t.username,t.email].filter(Boolean).join(` · `)})]}),(0,b.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-xs`,children:[t.isSuperuser&&(0,b.jsx)(`span`,{className:`rounded-full bg-purple-500/15 px-2 py-0.5 text-purple-800 dark:text-purple-300`,children:e(`rbac.superuser`)}),t.isActive===!1&&(0,b.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-muted-foreground`,children:e(`rbac.inactive`)}),t.twoFactor&&(0,b.jsx)(`span`,{className:`rounded-full bg-green-500/15 px-2 py-0.5 text-green-800 dark:text-green-300`,children:e(`rbac.twoFactor`)}),t.roles.map(e=>(0,b.jsx)(`span`,{className:`rounded-full border px-2 py-0.5`,children:e},e))]})]})},t.id)),l.length===0&&(0,b.jsx)(`li`,{className:`px-4 py-3 text-sm text-muted-foreground`,children:e(`list.noMatches`)})]}),u>d&&(0,b.jsxs)(`div`,{className:`flex items-center justify-end gap-2 text-sm`,children:[(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:a<=1,onClick:()=>r({...i?{search:i}:{},page:String(a-1)}),children:e(`list.previousPage`)}),(0,b.jsx)(`span`,{children:e(`list.pageOf`,{page:a,pages:Math.ceil(u/d)})}),(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:a*d>=u,onClick:()=>r({...i?{search:i}:{},page:String(a+1)}),children:e(`list.nextPage`)})]})]})}function bw(){let{t:e}=Y(),{id:t}=$i(),n=t===void 0,r=ft({queryKey:[`rbac`,`roles`],queryFn:Q.rbac.roles}),i=ft({queryKey:[`rbac`,`groups`],queryFn:Q.rbac.groups}),a=ft({queryKey:[`rbac`,`user`,t],queryFn:()=>Q.rbac.user(t),enabled:!n}),o=ft({queryKey:[`rbac`,`users`,``,1],queryFn:()=>Q.rbac.users({})});if(r.isPending||i.isPending||o.isPending||!n&&a.isPending)return(0,b.jsx)(G,{children:e(`common.loading`)});let s=r.error??i.error??o.error??(n?null:a.error);return s?(0,b.jsx)(G,{tone:`error`,children:pg(s)}):(0,b.jsx)(xw,{user:n?void 0:a.data,roles:r.data.items,groups:i.data.items,capabilities:o.data.capabilities},t??`new`)}function xw({user:e,roles:t,groups:n,capabilities:r}){let{t:i,locale:a}=Y(),o=Yi(),s=S(),c=Wg(),l=c.data?.rbac.manage===!0,u=c.data?.user.isSuperuser===!0,[d,f]=(0,y.useState)(``),[p,m]=(0,y.useState)(e?.displayName??``),[h,g]=(0,y.useState)(e?.email??``),[_,v]=(0,y.useState)(e?.isActive!==!1),[x,C]=(0,y.useState)(e?.isSuperuser===!0),[w,T]=(0,y.useState)(e?.roles??[]),[E,D]=(0,y.useState)(e?.groups??[]),[O,k]=(0,y.useState)(``),[A,j]=(0,y.useState)({}),[M,N]=(0,y.useState)(null),[ee,P]=(0,y.useState)(null),F=l&&(!e?.isSuperuser||u),te=e=>{e instanceof fg&&Object.keys(e.fields).length>0?(j(e.fields),N(e.message)):(j({}),N(pg(e)))},ne=pt({mutationFn:()=>{let t=r.update||!e?{displayName:p,email:h||null,isActive:_,...u?{isSuperuser:x}:{}}:{};return e?Q.rbac.updateUser(e.id,{...t,roles:w,groups:E}):Q.rbac.createUser({username:d,displayName:p,email:h||null,password:O,...u?{isSuperuser:x}:{},roles:w,groups:E})},onSuccess:async e=>{await s.invalidateQueries({queryKey:[`rbac`]}),j({}),N(null),P(i(`rbac.saved`)),o(`/-/users/${encodeURIComponent(e.id)}`,{replace:!0})},onError:te}),re=pt({mutationFn:()=>Q.rbac.resetTwoFactor(e.id),onSuccess:async()=>{await s.invalidateQueries({queryKey:[`rbac`]}),N(null),P(i(`rbac.twoFactorReset`))},onError:te}),ie=!!e&&u&&!c.data?.viewAs&&e.id!==c.data?.user.id&&e.isActive!==!1,ae=pt({mutationFn:()=>Q.rbac.setPassword(e.id,O),onSuccess:()=>{k(``),j({}),N(null),P(i(`rbac.passwordSet`))},onError:te});function oe(e){e.preventDefault(),P(null),F&&ne.mutate()}let se=(t,n,i,a,o={})=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:t,children:n}),(0,b.jsx)(Oh,{id:t,value:i,disabled:!F||!!e&&!r.update,onChange:e=>a(e.target.value),"aria-invalid":A[t.replace(`user-`,``)]?!0:void 0,...o}),A[t.replace(`user-`,``)]&&(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:A[t.replace(`user-`,``)].join(` `)})]});return(0,b.jsxs)(`form`,{onSubmit:oe,className:`flex max-w-3xl flex-col gap-5`,"aria-label":i(`rbac.user`),children:[(0,b.jsx)(E_,{actions:ie&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,onClick:()=>{wg(e.id),s.clear(),o(`/`)},children:[(0,b.jsx)(Qv,{}),i(`viewAs.start`)]}),children:e?e.displayName:i(`rbac.newUser`)}),M&&(0,b.jsx)(D_,{children:M}),ee&&(0,b.jsx)(D_,{tone:`success`,children:ee}),e?.isSuperuser&&!u&&(0,b.jsx)(D_,{tone:`success`,children:i(`rbac.superuserNote`)}),(0,b.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[!e&&se(`user-username`,i(`auth.username`),d,f,{dir:`ltr`,autoComplete:`off`}),se(`user-displayName`,i(`rbac.displayName`),p,m),se(`user-email`,i(`rbac.email`),h,g,{type:`email`,dir:`ltr`}),!e&&se(`user-password`,i(`auth.password`),O,k,{type:`password`,autoComplete:`new-password`})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-6 text-sm`,children:[(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:_,disabled:!F||!!e&&!r.update,onChange:e=>v(e.target.checked)}),i(`rbac.active`)]}),u&&(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:x,disabled:!F,onChange:e=>C(e.target.checked)}),i(`rbac.superuser`)]})]}),(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`legend`,{className:`mb-1 font-medium`,children:i(`rbac.roles`)}),t.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:w.includes(e.name),disabled:!F,onChange:t=>T(t.target.checked?[...w,e.name]:w.filter(t=>t!==e.name))}),C_(e.label,a)||e.name]},e.name))]}),n.length>0&&(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`legend`,{className:`mb-1 font-medium`,children:i(`rbac.groups`)}),n.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:E.includes(e.id),disabled:!F,onChange:t=>D(t.target.checked?[...E,e.id]:E.filter(t=>t!==e.id))}),C_(e.label,a)||e.name]},e.id))]}),F&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`submit`,disabled:ne.isPending,children:i(ne.isPending?`form.saving`:e?`form.save`:`rbac.createUser`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>o(`/-/users`),children:i(`common.cancel`)})]}),e&&F&&r.password&&(0,b.jsxs)(`section`,{"aria-labelledby":`set-password`,className:`flex flex-col gap-2 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsx)(`h2`,{id:`set-password`,className:`font-medium`,children:i(`rbac.setPassword`)}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`user-new-password`,children:i(`auth.newPassword`)}),(0,b.jsx)(Oh,{id:`user-new-password`,type:`password`,autoComplete:`new-password`,value:O,onChange:e=>k(e.target.value)})]}),(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:!O||ae.isPending,onClick:()=>ae.mutate(),children:i(`rbac.setPassword`)})]}),A.password&&e&&(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:A.password.join(` `)}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`rbac.setPasswordNote`)})]}),e?.twoFactor&&F&&r.resetTwoFactor&&(0,b.jsxs)(`section`,{"aria-labelledby":`reset-two-factor`,className:`flex flex-col gap-2 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsx)(`h2`,{id:`reset-two-factor`,className:`font-medium`,children:i(`rbac.resetTwoFactor`)}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`rbac.resetTwoFactorNote`)}),(0,b.jsx)(`div`,{children:(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:re.isPending,onClick:()=>re.mutate(),children:i(`rbac.resetTwoFactor`)})})]})]})}function Sw(e){if(!e.menu)return e.groups.map(e=>({...e,items:[...e.resources.map(e=>({kind:`resource`,name:e.name,label:e.label,...e.icon?{icon:e.icon}:{}})),...e.pages.map(e=>({kind:`page`,name:e.name,label:e.label,...e.icon?{icon:e.icon}:{}}))]}));let{sections:t,advanced:n}=e.menu;return[...t,...n.items.length>0?[n]:[]].map(e=>{let t=[],r=[],i=e.items.map(n=>n.kind===`resource`?(t.push({name:n.resource,label:n.label,...n.icon?{icon:n.icon}:{},creatable:n.creatable,searchable:n.searchable}),{kind:`resource`,name:n.resource,label:n.label,...n.icon?{icon:n.icon}:{},...n.badge?{badge:`${e.key}.${n.resource}`}:{}}):n.kind===`page`?(r.push({name:n.page,label:n.label,...n.icon?{icon:n.icon}:{}}),{kind:`page`,name:n.page,label:n.label,...n.icon?{icon:n.icon}:{}}):n);return{key:e.key,label:e.label,...e.icon?{icon:e.icon}:{},resources:t,pages:r,items:i,...e===n?{advanced:!0}:{}}})}function Cw(e,t){let n=e.flatMap(e=>e.kind===`resource`&&e.badge&&t?.[e.badge]?[t[e.badge]]:[]);if(n.length!==0)return{count:n.reduce((e,t)=>e+t.count,0),estimate:n.some(e=>e.estimate)}}function ww({menu:e,current:t}){return e&&!t}function Tw(e){return Mh(e).toLocaleLowerCase().replace(/[يى]/g,`ی`).replace(/ك/g,`ک`).replace(/‌/g,` `)}function Ew(e,t){let n=Tw(e);return Tw(t).split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function Dw(e,t,n,r=[]){let i=[],a=[],o=Sw(e),s=t.trim()!==``;for(let r of o){o.length>1&&Ew(r.label,t)&&i.push({id:`group:${r.key}`,section:`go`,label:r.label,to:`/g/${r.key}`,...r.icon?{icon:r.icon}:{}});for(let o of r.resources){let c=o.icon??r.icon;Ew(`${o.label} ${r.label}`,t)&&i.push({id:`go:${o.name}`,section:`go`,label:o.label,detail:r.label,to:`/${o.name}`,...c?{icon:c}:{}});let l=n(o.label),u=s||e.menu!==void 0&&!r.advanced&&a.length<3;o.creatable&&u&&Ew(l,t)&&a.push({id:`new:${o.name}`,section:`actions`,label:l,to:`/${o.name}/new`})}for(let e of r.pages){let n=e.icon??r.icon;Ew(`${e.label} ${r.label}`,t)&&i.push({id:`page:${e.name}`,section:`go`,label:e.label,detail:r.label,to:`/p/${e.name}`,...n?{icon:n}:{}})}}let c=r.filter(e=>Ew(e.label,t)).map(e=>({id:e.id,section:`actions`,label:e.label}));return[...i,...a,...c]}var Ow=`nma.theme`,kw=`oklch(0.145 0 0)`,Aw=`oklch(0.985 0 0)`;function jw(){try{let e=localStorage.getItem(Ow);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}function Mw(e,t){return e===`system`?t?`dark`:`light`:e}var Nw=()=>typeof matchMedia==`function`&&matchMedia(`(prefers-color-scheme: dark)`).matches;function Pw(e){let t=Mw(e,Nw());document.documentElement.classList.toggle(`dark`,t===`dark`),document.documentElement.style.colorScheme=t}var Fw=`nma-theme`;function Iw(e){try{localStorage.setItem(Ow,e)}catch{}Pw(e),typeof window<`u`&&window.dispatchEvent(new Event(Fw))}function Lw(){Iw(Mw(jw(),Nw())===`dark`?`light`:`dark`)}function Rw(e){if(typeof matchMedia!=`function`)return()=>void 0;let t=matchMedia(`(prefers-color-scheme: dark)`),n=()=>{e()===`system`&&Pw(`system`)};return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)}function zw(e){let t,n=/^#([0-9a-f]{3,8})$/i.exec(e.trim())?.[1];if(n){let e=n.length<=4?[...n.slice(0,3)].map(e=>e+e).join(``):n.slice(0,6);t=[0,2,4].map(t=>parseInt(e.slice(t,t+2),16))}else{let n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(e.trim());n&&(t=n.slice(1,4).map(Number))}if(!t)return;let[r,i,a]=t.map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*r+.7152*i+.0722*a}function Bw(e){let t={};if(e.primaryColor){let n=zw(e.primaryColor),r=e.primaryForeground??(n!==void 0&&n>.45?kw:Aw);Object.assign(t,{"--primary":e.primaryColor,"--primary-foreground":r,"--ring":e.primaryColor,"--sidebar-primary":e.primaryColor,"--sidebar-primary-foreground":r})}return e.radius&&Object.assign(t,{"--nma-radius-control":e.radius,"--nma-radius-card":`calc(${e.radius} * 1.5)`}),t}function Vw(e){for(let[t,n]of Object.entries(Bw(e)))document.documentElement.style.setProperty(t,n)}var Hw=`nma.accent`,Uw=`nma-accent`,Ww=/^(#[0-9a-f]{3,8}|(rgb|rgba|hsl|hsla|oklch|oklab|lch|lab)\([0-9.,%\s/+-]+(deg|turn|rad)?[0-9.,%\s/+-]*\))$/i;function Gw(e){return(e.personal&&Ww.test(e.personal.trim())?e.personal:null)??e.admin??e.branding??void 0}function Kw(){try{return localStorage.getItem(Hw)}catch{return null}}function qw(e){try{e===null?localStorage.removeItem(Hw):localStorage.setItem(Hw,e)}catch{}}var Jw=null,Yw;function Xw(e={}){`admin`in e&&(Jw=e.admin??null),`branding`in e&&(Yw=e.branding);let t=Gw({personal:Kw(),admin:Jw,branding:Yw}),n=[`--primary`,`--primary-foreground`,`--ring`,`--sidebar-primary`,`--sidebar-primary-foreground`];if(t)for(let[e,n]of Object.entries(Bw({primaryColor:t})))document.documentElement.style.setProperty(e,n);else for(let e of n)document.documentElement.style.removeProperty(e);typeof window<`u`&&window.dispatchEvent(new Event(Uw))}var Zw={archive:H_,ban:Q_,bell:ev,book:nv,box:iv,boxes:ov,briefcase:cv,building:uv,calendar:gv,chart:vv,check:bv,clock:Mv,"credit-card":Rv,database:Bv,dollar:Hv,file:iy,"file-text":ny,folder:oy,globe:cy,heart:fy,history:Sb,home:my,image:vy,inbox:by,key:Sy,layers:Ey,link:Ay,list:Iy,lock:Ry,mail:Hy,map:Ky,"map-pin":Wy,message:Xy,package:nb,phone:cb,printer:gb,receipt:vb,refresh:bb,send:Ob,server:Ab,settings:Mb,shield:Ib,"shopping-bag":Rb,cart:Bb,"shopping-cart":Bb,star:Wb,store:Kb,tag:Xb,tags:Qb,ticket:ex,truck:ox,user:fx,users:mx,video:gx,wallet:vx,wrench:bx,x:Sx,zap:wx};Object.keys(Zw);function Qw(e,t){return $w(e)??(t===`group`?oy:t===`page`?Mb:ny)}function $w(e){return e&&Object.hasOwn(Zw,e)?Zw[e]:void 0}function eT(e,t){let[n,r]=(0,y.useState)(e);return(0,y.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function tT(){let{t:e}=Y(),t=Yi(),n=Gg(),r=Wg(),[i,a]=(0,y.useState)(!1),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)(0),u=(0,y.useId)(),d=(0,y.useRef)(null);(0,y.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`k`&&(e.preventDefault(),a(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let f=eT(o.trim(),250),p=f.length>=2&&(n.data?.groups.some(e=>e.resources.some(e=>e.searchable))??!1),m=ft({queryKey:[`search`,f],queryFn:()=>Q.search(f),enabled:i&&p,staleTime:1e4}),h=e=>{let t=n.data?Sw(n.data).find(t=>t.resources.some(t=>t.name===e)):void 0;return t?.resources.find(t=>t.name===e)?.icon??t?.icon},g=n.data?Dw(n.data,o,t=>e(`palette.new`,{name:t}),[{id:`theme`,label:e(`palette.toggleTheme`)}]):[],_=[...p&&o.trim()===f?(m.data?.groups??[]).flatMap(e=>e.items.map(t=>({id:`record:${e.resource}:${t._id}`,section:`records`,...h(e.resource)?{icon:h(e.resource)}:{},label:t._title,detail:e.label,to:`/${e.resource}/${encodeURIComponent(t._id)}`}))):[],...g.filter(e=>e.section===`actions`),...g.filter(e=>e.section===`go`),...r.data?.audit.view&&Ew(e(`audit.title`),o)?[{id:`audit`,section:`go`,label:e(`audit.title`),to:`/-/audit`}]:[]],v=Math.min(c,Math.max(0,_.length-1));(0,y.useEffect)(()=>l(0),[o,m.data]),(0,y.useEffect)(()=>{d.current?.querySelector(`[data-index="${v}"]`)?.scrollIntoView({block:`nearest`})},[v]);function x(e){e&&(a(!1),e.to?t(e.to):e.id===`theme`&&Lw())}function S(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),_.length===0)return;l((v+(e.key===`ArrowDown`?1:-1)+_.length)%_.length)}else e.key===`Enter`&&(e.preventDefault(),x(_[v]))}let C=[[`records`,e(`palette.records`)],[`actions`,e(`palette.actions`)],[`go`,e(`palette.goTo`)]],w=e=>`${u}-${e}`,T=p&&(m.isFetching||o.trim()!==f)?e(`palette.searching`):_.length===0?e(`palette.noResults`):``;return(0,b.jsxs)(jd,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,b.jsx)(Nd,{asChild:!0,children:(0,b.jsxs)(q,{variant:`outline`,className:`w-9 justify-start px-0 font-normal text-muted-foreground max-sm:justify-center sm:w-[260px] sm:px-3.5`,"aria-keyshortcuts":`Control+K Meta+K`,"aria-label":e(`palette.open`),children:[(0,b.jsx)(Eb,{}),(0,b.jsx)(`span`,{className:`hidden min-w-0 flex-1 truncate text-start sm:inline`,children:e(`palette.placeholder`)}),(0,b.jsx)(`kbd`,{className:`hidden shrink-0 rounded-[5px] border border-border bg-muted px-[5px] py-px font-mono text-[11px] text-muted-foreground sm:inline`,dir:`ltr`,children:`⌘K`})]})}),(0,b.jsxs)(Ld,{children:[(0,b.jsx)(zd,{className:HS}),(0,b.jsxs)(Ud,{"aria-describedby":void 0,className:`fixed inset-x-3 top-[12vh] z-50 mx-auto flex max-h-[70vh] max-w-[540px] flex-col overflow-hidden rounded-card border border-border bg-card text-card-foreground shadow-[0_24px_48px_rgba(0,0,0,.18)] outline-none`,children:[(0,b.jsx)(Jd,{className:`sr-only`,children:e(`palette.open`)}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b border-border px-4`,children:[(0,b.jsx)(Eb,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(`input`,{role:`combobox`,"aria-expanded":!0,"aria-controls":u,"aria-autocomplete":`list`,"aria-activedescendant":_.length>0?w(v):void 0,"aria-label":e(`palette.open`),placeholder:e(`palette.placeholder`),className:`h-[52px] flex-1 bg-transparent text-sm outline-none`,value:o,onChange:e=>s(e.target.value),onKeyDown:S}),(0,b.jsx)(`kbd`,{className:`rounded-[5px] border border-border bg-muted px-[5px] py-px font-mono text-[11px] text-muted-foreground`,dir:`ltr`,children:`Esc`})]}),(0,b.jsx)(`ul`,{ref:d,id:u,role:`listbox`,"aria-label":e(`palette.results`),className:`flex-1 overflow-y-auto p-1.5`,children:C.map(([e,t])=>{let n=_.map((e,t)=>({item:e,index:t})).filter(({item:t})=>t.section===e);return n.length===0?null:(0,b.jsxs)(`li`,{role:`presentation`,children:[(0,b.jsx)(`div`,{className:`px-2.5 pt-2.5 pb-1 text-xs font-medium text-muted-foreground`,"aria-hidden":!0,children:t}),(0,b.jsx)(`ul`,{role:`group`,"aria-label":t,children:n.map(({item:e,index:t})=>(0,b.jsxs)(`li`,{id:w(t),role:`option`,"aria-selected":t===v,"data-index":t,className:W(`flex h-10 cursor-pointer items-center gap-3 rounded-control px-2.5 text-[13.5px]`,t===v&&`bg-muted`),onMouseMove:()=>l(t),onClick:()=>x(e),children:[(0,b.jsx)(nT,{item:e}),(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:e.section===`go`&&e.detail?`${e.detail} › ${e.label}`:e.label}),e.section===`records`&&e.detail&&(0,b.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.detail})]},e.id))})]},e)})}),(0,b.jsx)(`p`,{role:`status`,className:W(`px-4 text-sm text-muted-foreground`,T&&`border-t border-border py-2`),children:T}),(0,b.jsxs)(`div`,{className:`flex items-center gap-4 border-t border-border px-4 py-2.5 text-xs text-muted-foreground`,"aria-hidden":!0,children:[(0,b.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`kbd`,{className:`rounded-[5px] border border-border bg-muted px-[5px] font-mono text-[11px]`,children:`↑↓`}),e(`palette.move`)]}),(0,b.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`kbd`,{className:`rounded-[5px] border border-border bg-muted px-[5px] font-mono text-[11px]`,children:`↵`}),e(`palette.openItem`)]}),(0,b.jsxs)(`span`,{className:`ms-auto flex items-center gap-1.5`,children:[(0,b.jsx)(`kbd`,{className:`rounded-[5px] border border-border bg-muted px-[5px] font-mono text-[11px]`,dir:`ltr`,children:`⌘K`}),e(`palette.close`)]})]})]})]})]})}function nT({item:e}){let t=e.id.startsWith(`new:`)?mb:e.id===`theme`?eb:Qw(e.icon,e.section===`records`?`resource`:`group`);return(0,b.jsx)(t,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})}var rT={en:`English`,fa:`فارسی`};function iT(){let{t:e}=Y(),[t,n]=(0,y.useState)(jw),r=[[`light`,e(`shell.themeLight`),Jb],[`dark`,e(`shell.themeDark`),eb],[`system`,e(`shell.themeSystem`),Qy]];return(0,b.jsx)(`div`,{role:`radiogroup`,"aria-label":e(`shell.theme`),className:`flex items-center rounded-control border border-border p-0.5`,children:r.map(([e,r,i])=>(0,b.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":t===e,"aria-label":r,title:r,className:W(`rounded-md p-1.5 text-muted-foreground hover:text-foreground`,t===e&&`bg-muted text-foreground`),onClick:()=>{Iw(e),n(e)},children:(0,b.jsx)(i,{className:`size-4`})},e))})}function aT(){let{t:e,locale:t,locales:n,setLocale:r}=Y();return n.length<2?null:(0,b.jsxs)(`label`,{className:`flex items-center gap-1.5 text-[13px]`,children:[(0,b.jsx)(wy,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`sr-only`,children:e(`shell.language`)}),(0,b.jsx)(`select`,{className:`h-8 flex-1 rounded-control border border-input bg-card px-2 text-[13px]`,value:t,onChange:e=>r(e.target.value),children:n.map(e=>(0,b.jsx)(`option`,{value:e,lang:e,children:rT[e]??e},e))})]})}function oT(){let{t:e,calendar:t,digits:n,setDisplay:r}=Y(),i=(e,t,n,r)=>(0,b.jsxs)(`div`,{role:`radiogroup`,"aria-label":e,className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,b.jsx)(`div`,{className:`flex rounded-control border border-border p-0.5`,children:n.map(([e,n])=>(0,b.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":t===e,className:W(`flex-1 cursor-pointer rounded-md px-2 py-1 text-[13px] text-muted-foreground hover:text-foreground`,t===e&&`bg-muted text-foreground`),onClick:()=>r(e),children:n},e))})]});return(0,b.jsxs)(b.Fragment,{children:[i(e(`display.calendar`),t,[[`gregorian`,e(`display.gregorian`)],[`persian`,e(`display.jalali`)]],e=>r({calendar:e})),i(e(`display.digits`),n,[[`latn`,e(`display.latinDigits`)],[`arabext`,e(`display.persianDigits`)]],e=>r({digits:e}))]})}function sT(){let{t:e}=Y(),[t,n]=(0,y.useState)(jw);(0,y.useEffect)(()=>{let e=()=>n(jw());return window.addEventListener(Fw,e),()=>window.removeEventListener(Fw,e)},[]);let r=t===`dark`||t===`system`&&typeof matchMedia==`function`&&matchMedia(`(prefers-color-scheme: dark)`).matches;return(0,b.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":e(`shell.theme`),title:e(`shell.theme`),onClick:Lw,children:r?(0,b.jsx)(Jb,{}):(0,b.jsx)(eb,{})})}var cT=[`#5B5BD6`,`#2563EB`,`#0E7490`,`#0F766E`,`#9333EA`,`#DB2777`,`#EA580C`];function lT(){let{t:e}=Y(),t=Wg(),n=S(),[r,i]=(0,y.useState)(Kw);(0,y.useEffect)(()=>{let e=()=>i(Kw());return window.addEventListener(Uw,e),()=>window.removeEventListener(Uw,e)},[]);let a=t.data?.appearance,o=pt({mutationFn:e=>Q.setAppearance(e),onSuccess:async({accent:e})=>{qw(null),Xw({admin:e}),await n.invalidateQueries({queryKey:[`session`]})}}),s=e=>{qw(e),Xw()},c=r??a?.accent??null;return(0,b.jsxs)(`div`,{role:`group`,"aria-label":e(`display.accent`),className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:e(`display.accent`)}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[cT.map(e=>(0,b.jsx)(`button`,{type:`button`,"aria-label":e,"aria-pressed":c?.toLowerCase()===e.toLowerCase(),className:W(`size-6 cursor-pointer rounded-full border-2 border-transparent outline-none focus-visible:ring-2 focus-visible:ring-ring`,c?.toLowerCase()===e.toLowerCase()&&`border-foreground`),style:{background:e},onClick:()=>s(e)},e)),(0,b.jsx)(`button`,{type:`button`,className:`size-6 cursor-pointer overflow-hidden rounded-full border border-border bg-[conic-gradient(red,yellow,lime,aqua,blue,magenta,red)]`,"aria-label":e(`display.customAccent`),title:e(`display.customAccent`),onClick:()=>dT(c)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-6 px-1.5 text-xs`,"aria-pressed":r===null,onClick:()=>s(null),children:e(`display.defaultAccent`)})]}),a?.manage&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 text-xs`,disabled:o.isPending||!r||r===a.accent,onClick:()=>o.mutate(r),children:e(`display.accentForEveryone`)}),a.accent&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-xs`,disabled:o.isPending,onClick:()=>o.mutate(null),children:e(`display.resetForEveryone`)})]}),o.isError&&(0,b.jsx)(`p`,{className:`text-xs text-destructive`,children:pg(o.error)})]})}var uT=null;function dT(e){uT&&(e&&/^#[0-9a-f]{6}$/i.test(e)&&(uT.value=e),uT.click())}function fT(){return(0,b.jsx)(`input`,{ref:e=>{uT=e},type:`color`,tabIndex:-1,"aria-hidden":!0,className:`pointer-events-none fixed bottom-0 start-0 size-px opacity-0`,onInput:e=>{qw(e.currentTarget.value),Xw()}})}var pT=`nma.nav`,mT={pinned:[],recent:[],collapsedGroups:[],expandedGroups:[],railCollapsed:!1};function hT(e){let t=mT;try{let n=e?.getItem(pT);n&&(t={...mT,...JSON.parse(n)})}catch{t=mT}let n=new Set,r=r=>{t=r;try{e?.setItem(pT,JSON.stringify(r))}catch{}for(let e of n)e()},i=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t];return{get:()=>t,subscribe(e){return n.add(e),()=>n.delete(e)},togglePin:e=>r({...t,pinned:i(t.pinned,e)}),visit:e=>{t.recent[0]!==e&&r({...t,recent:[e,...t.recent.filter(t=>t!==e)].slice(0,5)})},toggleGroup:(e,n=!1)=>{let i=bT(t,e,n),a=t=>t.filter(t=>t!==e);r({...t,collapsedGroups:i?a(t.collapsedGroups):[...a(t.collapsedGroups),e],expandedGroups:i?[...a(t.expandedGroups),e]:a(t.expandedGroups)})},toggleRail:()=>r({...t,railCollapsed:!t.railCollapsed})}}function gT(){try{return typeof localStorage>`u`?void 0:localStorage}catch{return}}var _T=hT(gT());function vT(){return(0,y.useSyncExternalStore)(_T.subscribe,_T.get)}function yT(e,t){return e.filter(e=>t.has(e))}function bT(e,t,n){return e.collapsedGroups.includes(t)?!0:!e.expandedGroups.includes(t)&&n}function xT(e){let{t}=Y(),[n,r,i]=qi().pathname.split(`/`).filter(Boolean).map(e=>decodeURIComponent(e)),a=n&&n!==`g`&&n!==`p`&&n!==`-`&&r&&r!==`new`?r:void 0,o=Xg(n??``,a),s=!!n&&![`g`,`p`,`-`,`account`].includes(n),c=Kg(n??``,s&&e!==void 0&&!Sw(e).some(e=>e.resources.some(e=>e.name===n))),l=[{label:t(e?.dashboard?`shell.dashboard`:`shell.home`),to:`/`}];if(n===`account`&&!r)return[...l,{label:t(`auth.account`)}];if(n===`-`&&(r===`users`||r===`groups`||r===`roles`||r===`debugger`||r===`audit`)){let e={users:t(`rbac.users`),groups:t(`rbac.groups`),roles:t(`rbac.roles`),debugger:t(`debugger.title`),audit:t(`audit.title`)}[r];return l.push({label:t(`rbac.administration`)},{label:e,to:`/-/${r}`}),i&&l.push({label:i===`new`?t(`list.new`):i}),l}if(!n||!e)return l;let u=Sw(e);if(n===`g`){let e=u.find(e=>e.key===r);return e&&l.push({label:e.label}),l}if(n===`p`){let e=u.find(e=>e.pages.some(e=>e.name===r)),t=e?.pages.find(e=>e.name===r);return e&&t&&l.push({label:e.label,to:`/g/${e.key}`},{label:t.label}),l}let d=u.find(e=>e.resources.some(e=>e.name===n)),f=d?.resources.find(e=>e.name===n);return!d||!f?c.data?(l.push({label:c.data.label,to:`/${n}`}),a&&l.push({label:typeof o.data?._title==`string`?o.data._title:`#${a}`}),l):l:(l.push({label:d.label,to:`/g/${d.key}`},{label:f.label,to:`/${f.name}`}),r===`new`?l.push({label:t(`form.new`,{name:f.label})}):a&&l.push({label:typeof o.data?._title==`string`?o.data._title:`#${a}`}),l)}function ST({meta:e,onOpenMenu:t}){let{t:n}=Y(),r=vT(),i=xT(e),a=i.length-1;return(0,b.jsxs)(`header`,{className:`flex h-14 items-center gap-2 border-b border-border bg-card px-5`,children:[(0,b.jsx)(q,{variant:`ghost`,size:`icon`,className:`md:hidden`,"aria-label":n(`shell.menu`),onClick:t,"data-sidebar-toggle":``,children:(0,b.jsx)(Jy,{})}),(0,b.jsx)(q,{variant:`ghost`,size:`icon`,className:`hidden md:inline-flex`,"aria-label":n(r.railCollapsed?`shell.expandSidebar`:`shell.collapseSidebar`),"aria-pressed":r.railCollapsed,onClick:()=>_T.toggleRail(),"data-sidebar-toggle":``,children:(0,b.jsx)(ib,{className:`ltr:-scale-x-100`})}),(0,b.jsx)(`div`,{className:`hidden h-5 w-px bg-border md:block`,"aria-hidden":!0}),(0,b.jsx)(`nav`,{"aria-label":n(`shell.breadcrumbs`),className:`min-w-0 flex-1 ps-1`,children:(0,b.jsx)(`ol`,{className:`flex min-w-0 items-center gap-1.5 text-sm text-muted-foreground`,children:i.map((e,t)=>(0,b.jsxs)(y.Fragment,{children:[t>0&&(0,b.jsx)(wv,{className:`size-3.5 shrink-0 ltr:rotate-180`,"aria-hidden":!0}),(0,b.jsx)(`li`,{className:t===a?`truncate font-medium text-foreground`:`hidden truncate sm:block`,children:e.to&&t!==a?(0,b.jsx)(bo,{to:e.to,className:`hover:text-foreground`,children:e.label}):(0,b.jsx)(`span`,{"aria-current":t===a?`page`:void 0,children:e.label})})]},`${t}:${e.label}`))})}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(tT,{}),(0,b.jsx)(sT,{})]})]})}function CT({rail:e=!1}){let{t}=Y(),n=Wg(),r=Yi(),i=S(),a=n.data;if(!a)return null;let{user:o,auth:s}=a,c=o.displayName.split(/\s+/).filter(Boolean).slice(0,2).map(e=>[...e][0].toUpperCase()).join(``);async function l(){try{await Q.logout()}finally{gg(void 0),wg(void 0),i.clear(),r(`/login`,{replace:!0})}}return(0,b.jsxs)(Sh,{children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsxs)(`button`,{type:`button`,"aria-label":t(`auth.userMenu`,{name:o.displayName}),"data-user-block":``,className:W(`flex cursor-pointer items-center gap-2.5 rounded-control text-start hover:bg-muted`,e?`size-10 justify-center`:`px-2.5 py-2`),children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-[13px] font-semibold`,children:c||(0,b.jsx)(ux,{className:`size-4`})}),!e&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`span`,{className:`min-w-0 flex-1 leading-[1.35]`,children:[(0,b.jsx)(`span`,{className:`block truncate text-[13px] font-medium`,children:o.displayName}),(o.username||o.email)&&(0,b.jsx)(`span`,{className:`block truncate text-[11.5px] text-muted-foreground`,children:o.email??o.username})]}),(0,b.jsx)(Kv,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})]})]})}),(0,b.jsx)(wh,{children:(0,b.jsxs)(Th,{side:`top`,align:`start`,sideOffset:6,className:`z-50 flex w-64 flex-col gap-1 rounded-[10px] border border-border bg-popover p-1.5 text-popover-foreground shadow-[0_12px_32px_rgba(0,0,0,.12)]`,children:[(s.password||s.sessions||s.twoFactor)&&!a.viewAs&&(0,b.jsx)(Eh,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/account`,className:`flex h-[34px] items-center gap-2.5 rounded-md px-2 text-[13px] hover:bg-muted`,children:[(0,b.jsx)(ux,{className:`size-4`}),t(`auth.account`)]})}),a.audit.view&&(0,b.jsx)(Eh,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/-/audit`,className:`flex h-[34px] items-center gap-2.5 rounded-md px-2 text-[13px] hover:bg-muted`,children:[(0,b.jsx)(Sb,{className:`size-4`}),t(`audit.title`)]})}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 border-y border-border px-2 py-2`,children:[(0,b.jsx)(aT,{}),(0,b.jsx)(oT,{}),(0,b.jsx)(iT,{}),(0,b.jsx)(lT,{})]}),s.logout&&!a.open&&(0,b.jsxs)(`button`,{type:`button`,className:`flex h-[34px] items-center gap-2.5 rounded-md px-2 text-start text-[13px] hover:bg-muted`,onClick:()=>void l(),children:[(0,b.jsx)(By,{className:`size-4 rtl:-scale-x-100`}),t(`auth.signOut`)]})]})})]})}var wT=`flex h-9 w-full cursor-pointer items-center gap-2.5 rounded-control px-2.5 text-start text-[13.5px] text-sidebar-foreground hover:bg-muted`,TT=({isActive:e})=>W(`flex h-8 items-center rounded-[7px] px-2.5 text-[13px] text-muted-foreground hover:bg-muted hover:text-foreground`,e&&`bg-primary-soft font-semibold text-primary-text hover:bg-primary-soft hover:text-primary-text`);function ET(e){return e.kind===`resource`?{key:e.name,to:`/${e.name}`,label:e.label,pin:e.name,...e.badge?{badge:e.badge}:{}}:e.kind===`page`?{key:`page:${e.name}`,to:`/p/${e.name}`,label:e.label}:{key:`link:${e.href}`,to:e.href,label:e.label,external:/^https?:\/\//i.test(e.href)}}var DT=(e,t)=>!t.external&&(e===t.to||e.startsWith(`${t.to}/`));function OT(e,t,n,r,i){let a=e.map(e=>{let r=e.items.map(ET);return{key:e.key,label:e.label,icon:Qw(e.icon,`group`),entries:r,collapsedByDefault:ww({menu:t,current:r.some(e=>DT(n,e))}),asLink:t&&!e.advanced&&r.length===1}});return r.length>0?[{key:`~pinned`,label:i,icon:fb,entries:r},...a]:a}function kT({title:e,logo:t,groups:n,menu:r,rail:i=!1,onClose:a}){let{t:o}=Y(),s=vT(),{pathname:c}=qi(),l=qg(r).data,u=new Map(n.flatMap(e=>e.items.flatMap(e=>e.kind===`resource`?[[e.name,ET(e)]]:[]))),d=OT(n,r,c,yT(s.pinned,new Set(u.keys())).map(e=>u.get(e)),o(`shell.pinned`)),f=d.find(e=>n.some(t=>t.advanced&&t.key===e.key)),p=d.filter(e=>e!==f),m=IT(),h=(e,t=!1)=>i?(0,b.jsx)(PT,{section:e,muted:t},e.key):(0,b.jsx)(NT,{section:e,collapsed:bT(s,e.key,e.collapsedByDefault??!1),badges:l,muted:t,large:!!a},e.key);return(0,b.jsxs)(`nav`,{"aria-label":o(`shell.resources`),className:`flex h-full flex-col`,children:[(0,b.jsx)(MT,{title:e,logo:t,rail:i,onClose:a}),(0,b.jsxs)(`div`,{className:W(`flex flex-1 flex-col gap-0.5 overflow-y-auto`,i?`items-center px-0 py-2.5`:`p-2.5`),children:[r&&(0,b.jsx)(AT,{to:`/`,label:o(`shell.dashboard`),icon:Oy,rail:i,large:!!a,end:!0}),p.map(e=>h(e))]}),(0,b.jsxs)(`div`,{className:W(`flex flex-col gap-1 border-t border-sidebar-border`,i?`items-center px-0 py-2.5`:`p-2.5`),children:[f&&h(f,!0),m&&h(m,!0),(0,b.jsx)(CT,{rail:i})]})]})}function AT({to:e,label:t,icon:n,rail:r,large:i,end:a,external:o,count:s}){let c=({isActive:e})=>r?W(`flex size-10 items-center justify-center rounded-control hover:bg-muted`,e&&`bg-primary-soft text-primary-text hover:bg-primary-soft`):W(wT,i&&`h-11 text-[15px]`,e&&`bg-primary-soft font-semibold text-primary-text hover:bg-primary-soft`),l=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":!0}),!r&&(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:t}),!r&&s&&(0,b.jsx)(jT,{count:s})]});return o?(0,b.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,"aria-label":r?t:void 0,title:r?t:void 0,className:c({isActive:!1}),children:l}):(0,b.jsx)(xo,{to:e,end:a,"aria-label":r?t:void 0,title:r?t:void 0,className:c,children:l})}function jT({count:e,strong:t}){return(0,b.jsxs)(`span`,{className:W(`inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full px-1.5 text-[11px]`,t?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:[e.estimate?`~`:``,eg(e.count)]})}function MT({title:e,logo:t,rail:n,onClose:r}){let{t:i}=Y(),a=t?(0,b.jsx)(`img`,{src:t,alt:``,className:`size-[30px] shrink-0 rounded-control object-contain`}):(0,b.jsx)(`span`,{"aria-hidden":!0,className:`flex size-[30px] shrink-0 items-center justify-center rounded-control bg-primary font-bold text-primary-foreground`,children:[...e.trim()][0]??``});return(0,b.jsxs)(`div`,{className:W(`flex h-14 shrink-0 items-center gap-2.5 border-b border-sidebar-border`,n?`justify-center`:`px-4`),children:[a,!n&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1 leading-[1.3]`,children:[(0,b.jsx)(`div`,{className:W(`truncate font-semibold`,r?`text-[15px]`:`text-sm`),children:e}),!r&&(0,b.jsx)(`div`,{className:`text-[11.5px] text-muted-foreground`,children:i(`shell.adminPanel`)})]}),r?(0,b.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":i(`shell.closeMenu`),onClick:r,children:(0,b.jsx)(Sx,{})}):(0,b.jsx)(Ov,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})]})]})}function NT({section:e,collapsed:t,badges:n,muted:r,large:i}){let{t:a}=Y(),o=e.icon,s=`nav-group-${e.key}`,c=Cw(e.entries.flatMap(e=>e.badge?[{kind:`resource`,name:e.key,label:e.label,badge:e.badge}]:[]),n);if(e.asLink){let[t]=e.entries;return(0,b.jsx)(AT,{to:t.to,label:e.label,icon:o,rail:!1,large:i,external:t.external,count:t.badge?n?.[t.badge]:void 0})}return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`button`,{type:`button`,className:W(wT,i&&`h-11 text-[15px]`,r&&`text-muted-foreground`),"aria-expanded":!t,"aria-controls":s,"aria-label":a(t?`shell.expandGroup`:`shell.collapseGroup`,{name:e.label}),onClick:()=>_T.toggleGroup(e.key,e.collapsedByDefault??!1),children:[(0,b.jsx)(o,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),t&&c&&(0,b.jsx)(jT,{count:c}),(0,b.jsx)(Sv,{className:W(`size-4 shrink-0 text-muted-foreground transition-transform`,t&&`rotate-90 rtl:rotate-90 ltr:-rotate-90`),"aria-hidden":!0})]}),!t&&(0,b.jsx)(`ul`,{id:s,"aria-label":e.label,className:`ms-[18px] mt-0.5 mb-1 flex flex-col gap-px border-s border-sidebar-border ps-2.5`,children:e.entries.map(e=>(0,b.jsxs)(`li`,{className:`group/item flex items-center`,children:[e.external?(0,b.jsx)(`a`,{href:e.to,target:`_blank`,rel:`noopener noreferrer`,className:W(TT({isActive:!1}),`min-w-0 flex-1`),children:(0,b.jsx)(`span`,{className:`truncate`,children:e.label})}):(0,b.jsxs)(xo,{to:e.to,className:e=>W(TT(e),`min-w-0 flex-1 gap-2`),children:[(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.badge&&n?.[e.badge]&&(0,b.jsx)(jT,{count:n[e.badge]})]}),e.pin&&(0,b.jsx)(FT,{name:e.pin,label:e.label})]},e.key))})]})}function PT({section:e,muted:t}){let[n,r]=(0,y.useState)(!1),{pathname:i}=qi(),a=e.icon,o=e.entries.some(e=>DT(i,e));return(0,b.jsxs)(Sh,{open:n,onOpenChange:r,children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsx)(`button`,{type:`button`,"aria-label":e.label,title:e.label,onMouseEnter:()=>r(!0),"data-nav-section":``,className:W(`flex size-10 cursor-pointer items-center justify-center rounded-control hover:bg-muted`,t&&`text-muted-foreground`,o&&`bg-primary-soft text-primary-text hover:bg-primary-soft`),children:(0,b.jsx)(a,{className:`size-4`,"aria-hidden":!0})})}),(0,b.jsx)(wh,{children:(0,b.jsxs)(Th,{side:`right`,align:`start`,sideOffset:8,onMouseLeave:()=>r(!1),className:`z-50 flex flex-col items-start gap-1.5`,children:[(0,b.jsx)(`span`,{className:`rounded-control bg-foreground px-3 py-1.5 text-[13px] font-medium text-background`,children:e.label}),(0,b.jsx)(`div`,{className:`flex min-w-40 flex-col gap-px rounded-[10px] border border-border bg-card p-1.5 shadow-[0_12px_32px_rgba(0,0,0,.12)]`,children:e.entries.map(e=>e.external?(0,b.jsx)(`a`,{href:e.to,target:`_blank`,rel:`noopener noreferrer`,className:TT({isActive:!1}),onClick:()=>r(!1),children:e.label},e.key):(0,b.jsx)(xo,{to:e.to,className:TT,onClick:()=>r(!1),children:e.label},e.key))})]})})]})}function FT({name:e,label:t}){let{t:n}=Y(),r=vT().pinned.includes(e);return(0,b.jsx)(`button`,{type:`button`,className:W(`cursor-pointer rounded-md p-1 text-muted-foreground opacity-0 hover:text-foreground focus-visible:opacity-100 group-hover/item:opacity-100`,r&&`opacity-100`),"aria-label":n(r?`shell.unpin`:`shell.pin`,{name:t}),"aria-pressed":r,onClick:()=>_T.togglePin(e),children:r?(0,b.jsx)(ub,{className:`size-3.5`}):(0,b.jsx)(fb,{className:`size-3.5`})})}function IT(){let{t:e}=Y();if(Wg().data?.rbac.view)return{key:`~administration`,label:e(`rbac.administration`),icon:Pb,entries:[{key:`users`,to:`/-/users`,label:e(`rbac.users`)},{key:`groups`,to:`/-/groups`,label:e(`rbac.groups`)},{key:`roles`,to:`/-/roles`,label:e(`rbac.roles`)},{key:`debugger`,to:`/-/debugger`,label:e(`debugger.title`)}]}}var LT={success:5e3,error:1e4},RT=4;function zT(e=globalThis){let t=[],n=1,r=new Map,i=new Set,a=e=>{t=e;for(let e of i)e()},o=n=>{let i=r.get(n);i!==void 0&&e.clearTimeout(i),r.delete(n),t.some(e=>e.id===n)&&a(t.filter(e=>e.id!==n))};return{get:()=>t,subscribe(e){return i.add(e),()=>i.delete(e)},show(i,s=`success`){let c=n++,l=[...t,{id:c,message:i,tone:s}];for(let e of l.slice(0,Math.max(0,l.length-RT)))o(e.id);return a([...t,{id:c,message:i,tone:s}]),r.set(c,e.setTimeout(()=>o(c),LT[s])),c},dismiss:o}}var BT=zT(),VT=(e,t=`success`)=>BT.show(e,t);function HT(){return(0,y.useSyncExternalStore)(BT.subscribe,BT.get)}function UT(){let e=X(),t=HT();return(0,b.jsx)(`div`,{role:`region`,"aria-label":e(`toast.region`),className:`pointer-events-none fixed inset-x-4 bottom-4 z-[60] flex flex-col items-end gap-2 sm:start-auto sm:w-96`,children:t.map(t=>(0,b.jsxs)(`div`,{role:t.tone===`error`?`alert`:`status`,className:W(`pointer-events-auto flex w-full items-start gap-2 rounded-lg border bg-popover px-3 py-2 text-sm text-popover-foreground shadow-lg`,t.tone===`error`?`border-destructive/50`:`border-green-600/40`),children:[(0,b.jsx)(`span`,{className:W(`min-w-0 flex-1 break-words`,t.tone===`error`&&`text-destructive`),children:t.message}),(0,b.jsx)(`button`,{type:`button`,className:`rounded-md p-0.5 text-muted-foreground hover:text-foreground`,"aria-label":e(`toast.dismiss`),onClick:()=>BT.dismiss(t.id),children:(0,b.jsx)(Sx,{className:`size-4`,"aria-hidden":!0})})]},t.id))})}function WT(e,t){return e===void 0||typeof e==`string`?e:e[t]??e[dg.locale]??Object.values(e)[0]}function GT(){let{t:e}=Y(),t=Wg(),n=qi(),r=S(),i=t.isError&&Cg()!==void 0&&t.error instanceof fg&&(t.error.status===403||t.error.status===404);return(0,y.useEffect)(()=>{i&&(wg(void 0),r.clear())},[i,r]),t.isPending||i?(0,b.jsx)(G,{children:e(`common.loading`)}):t.isError?t.error instanceof fg&&t.error.status===401?(0,b.jsx)(Da,{to:`/login?${new URLSearchParams({next:n.pathname+n.search})}`,replace:!0}):(0,b.jsxs)(G,{tone:`error`,children:[pg(t.error),` `,(0,b.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:e(`list.retry`)})]}):(0,b.jsx)(qT,{})}function KT(){let{t:e}=Y(),t=Wg(),n=S(),r=Yi(),i=t.data;return i?.viewAs?(0,b.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center justify-center gap-3 bg-amber-400 px-4 py-2 text-sm font-medium text-amber-950`,children:[(0,b.jsx)(Qv,{className:`size-4`,"aria-hidden":!0}),(0,b.jsx)(`span`,{children:e(`viewAs.banner`,{name:i.user.displayName})}),(0,b.jsx)(q,{size:`sm`,variant:`outline`,className:`h-7 border-amber-950/30 bg-amber-50 text-amber-950 hover:bg-amber-100`,onClick:()=>{let e=i.user.id;wg(void 0),n.clear(),r(`/-/users/${encodeURIComponent(e)}`)},children:e(`viewAs.stop`)})]}):null}function qT(){let e=Gg(),{t,locale:n}=Y(),r=vT(),i=qi(),[a,o]=(0,y.useState)(!1),s=(0,y.useRef)(null),c=Wg().data?.appearance?.accent;(0,y.useEffect)(()=>{c!==void 0&&Xw({admin:c})},[c]);let l=(0,y.useMemo)(()=>e.data?Sw(e.data):[],[e.data]),u=e.data?.menu!==void 0,d=WT(dg.branding.name,n)??e.data?.title??dg.title,f=dg.branding.logo;return(0,y.useEffect)(()=>{o(!1);let e=decodeURIComponent(i.pathname.split(`/`).filter(Boolean)[0]??``);l.some(t=>t.resources.some(t=>t.name===e))&&_T.visit(e)},[i.pathname,l]),(0,y.useEffect)(()=>{e.data&&(document.title=e.data.title)},[e.data]),(0,y.useEffect)(()=>{if(!a)return;s.current?.querySelector(`a, button, input`)?.focus();let e=e=>{e.key===`Escape`&&o(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),(0,b.jsxs)(`div`,{className:`flex min-h-svh bg-background text-foreground`,children:[(0,b.jsx)(fT,{}),(0,b.jsx)(`aside`,{className:W(`sticky top-0 hidden h-svh shrink-0 border-e border-sidebar-border bg-sidebar text-sidebar-foreground md:block`,r.railCollapsed?`w-16`:`w-64`),children:(0,b.jsx)(kT,{title:d,logo:f,groups:l,menu:u,rail:r.railCollapsed})}),a&&(0,b.jsxs)(`div`,{className:`fixed inset-0 z-40 md:hidden`,role:`dialog`,"aria-modal":`true`,"aria-label":t(`shell.menu`),ref:s,children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-black/40 backdrop-blur-sm dark:bg-black/60 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150`,"aria-hidden":!0,onClick:()=>o(!1)}),(0,b.jsx)(`aside`,{className:`absolute inset-y-0 start-0 flex w-[300px] max-w-[85vw] flex-col border-e border-sidebar-border bg-sidebar text-sidebar-foreground shadow-xl`,onClick:e=>{e.target.closest(`a`)&&o(!1)},children:(0,b.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,b.jsx)(kT,{title:d,logo:f,groups:l,menu:u,onClose:()=>o(!1)})})})]}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,inert:a||void 0,children:[(0,b.jsxs)(`div`,{className:`sticky top-0 z-30 bg-background`,children:[(0,b.jsx)(KT,{}),(0,b.jsx)(ST,{meta:e.data,onOpenMenu:()=>o(!0)})]}),(0,b.jsx)(`main`,{className:`flex-1 p-4 md:p-7`,children:(0,b.jsx)(`div`,{className:`mx-auto w-full max-w-[1400px]`,children:(0,b.jsx)(Oa,{})})})]}),(0,b.jsx)(UT,{})]})}function JT(e){let t=dg.branding.name;return t===void 0?dg.title:typeof t==`string`?t:t[e]??t[dg.locale]??Object.values(t)[0]??dg.title}function YT(){let{t:e,locale:t}=Y(),n=Yi(),r=S(),[i]=wo(),a=xg(i.get(`next`),dg.basePath),o=Wg(),[s,c]=(0,y.useState)(``),[l,u]=(0,y.useState)(``),[d,f]=(0,y.useState)(`password`),[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(null),[_,v]=(0,y.useState)(!1);if(o.isSuccess)return(0,b.jsx)(Da,{to:a,replace:!0});async function x(t){if(t.preventDefault(),!s.trim()||!l){g(e(`auth.required`));return}if(d===`otp`&&!p.trim()){g(e(`auth.otpRequired`));return}v(!0),g(null);try{let e=await Q.login(s.trim(),l,d===`otp`?p.trim():void 0);gg(e.csrfToken),wg(void 0),r.clear(),r.setQueryData([`session`],e),n(a,{replace:!0})}catch(t){if(t instanceof fg&&t.body.code===`TWO_FACTOR_REQUIRED`){g(d===`otp`?t.message:null),f(`otp`),m(``);return}f(`password`),m(``),u(``),g(t instanceof fg&&(t.status===401||t.status===429||t.status===404)?t.message:e(`auth.failed`))}finally{v(!1)}}let C=dg.branding.logo;return(0,b.jsxs)(`main`,{className:`flex min-h-dvh flex-col bg-muted/30`,children:[(0,b.jsxs)(`div`,{className:`flex justify-end gap-2 p-4`,children:[(0,b.jsx)(aT,{}),(0,b.jsx)(iT,{})]}),(0,b.jsx)(`div`,{className:`flex flex-1 items-start justify-center px-4 pt-[10vh]`,children:(0,b.jsxs)(`form`,{onSubmit:x,noValidate:!0,className:`flex w-full max-w-sm flex-col gap-4 rounded-xl border bg-background p-6 shadow-sm`,"aria-labelledby":`login-title`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[C&&(0,b.jsx)(`img`,{src:C,alt:``,className:`size-10 rounded-md object-contain`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:JT(t)}),(0,b.jsx)(`h1`,{id:`login-title`,className:`text-[22px] font-bold`,children:e(d===`otp`?`auth.otpTitle`:`auth.title`)})]}),h&&(0,b.jsx)(`p`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:h}),d===`otp`?(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`login-otp`,children:e(`auth.otp`)}),(0,b.jsx)(Oh,{id:`login-otp`,autoComplete:`one-time-code`,inputMode:`text`,autoCapitalize:`none`,spellCheck:!1,autoFocus:!0,dir:`ltr`,maxLength:40,value:p,onChange:e=>m(e.target.value),"aria-describedby":`login-otp-help`}),(0,b.jsx)(`p`,{id:`login-otp-help`,className:`text-sm text-muted-foreground`,children:e(`auth.otpHelp`)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`login-username`,children:e(`auth.username`)}),(0,b.jsx)(Oh,{id:`login-username`,autoComplete:`username`,autoCapitalize:`none`,spellCheck:!1,autoFocus:!0,value:s,onChange:e=>c(e.target.value)})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`login-password`,children:e(`auth.password`)}),(0,b.jsx)(Oh,{id:`login-password`,type:`password`,autoComplete:`current-password`,value:l,onChange:e=>u(e.target.value)})]})]}),(0,b.jsx)(q,{type:`submit`,disabled:_,children:e(_?`auth.signingIn`:d===`otp`?`auth.verify`:`auth.signIn`)}),d===`otp`&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>{f(`password`),m(``),u(``),g(null)},children:e(`auth.startOver`)})]})})]})}var XT=3;function ZT({field:e,files:t,detailed:n=!1,plain:r=!1}){let i=X();if(t.length===0)return(0,b.jsx)(b.Fragment,{children:`—`});let a=t=>e.widget===`image`&&t.contentType.startsWith(`image/`),o=n?t:t.slice(0,XT);return(0,b.jsxs)(`span`,{className:W(`inline-flex flex-wrap items-center`,n?`gap-2`:`gap-1 align-middle`),children:[o.map(e=>{let t=a(e)?(0,b.jsx)(`img`,{src:e.url,alt:e.name,loading:`lazy`,className:W(`rounded-md border bg-muted object-cover`,n?`size-24`:`size-8`)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(iy,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(`bdi`,{className:`max-w-48 truncate`,children:e.name}),n&&(0,b.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:Pg(e.size)})]});return r?(0,b.jsx)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:t},e.key):(0,b.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":i(`upload.open`,{name:e.name}),title:e.name,className:`inline-flex min-w-0 items-center gap-1 hover:underline`,onClick:e=>e.stopPropagation(),children:t},e.key)}),t.length>o.length&&(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i(`upload.more`,{count:t.length-o.length})})]})}var QT={ok:`bg-ok-bg text-ok`,warn:`bg-warn-bg text-warn`,bad:`bg-bad-bg text-bad`,info:`bg-info-bg text-info`,neutral:`bg-muted text-muted-foreground`,primary:`bg-primary-soft text-primary-text`};function $T({tone:e=`neutral`,className:t,...n}){return(0,b.jsx)(`span`,{"data-slot":`badge`,"data-tone":e,className:W(`inline-flex h-[22px] items-center gap-1 rounded-full px-2 text-xs leading-none font-medium whitespace-nowrap`,QT[e],t),...n})}var eE={gray:`neutral`,red:`bad`,amber:`warn`,green:`ok`,blue:`info`,purple:`primary`,pink:`bad`};function tE(e){return eE[e]??`neutral`}function nE({value:e,field:t,className:n}){if(e==null)return(0,b.jsx)(b.Fragment,{children:Nx(e,t)});let r=t.colors?.[String(e)]??`gray`;return(0,b.jsx)($T,{"data-color":r,tone:tE(r),className:n,children:Nx(e,t)})}function rE({value:e,field:t,record:n,detailed:r,plain:i}){return t.file&&n?(0,b.jsx)(ZT,{field:t,files:gC(n,t.name),detailed:r,plain:i}):t.widget===`badge`?(0,b.jsx)(nE,{value:e,field:t}):(0,b.jsx)(b.Fragment,{children:Nx(e,t)})}function iE({title:e,subtitle:t,icon:n,actions:r,footer:i,className:a,bodyClassName:o,children:s,...c}){let l=(0,y.useId)(),u=e!==void 0&&c[`aria-labelledby`]===void 0?{"aria-labelledby":l}:{};return(0,b.jsxs)(`section`,{"data-slot":`card`,className:W(`rounded-card border border-border bg-card text-card-foreground shadow-card`,a),...u,...c,children:[e!==void 0&&(0,b.jsxs)(`header`,{className:`flex min-h-14 items-center gap-2 border-b border-border px-5 py-3`,children:[n&&(0,b.jsx)(`span`,{className:`text-muted-foreground [&_svg]:size-4`,children:n}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`h2`,{id:l,className:`text-[15px] font-semibold`,children:e}),t&&(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t})]}),r&&(0,b.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:r})]}),(0,b.jsx)(`div`,{className:W(e!==void 0&&`p-5`,o),children:s}),i&&(0,b.jsx)(`footer`,{className:`border-t border-border px-5 py-3`,children:i})]})}function aE({card:e,values:t,schema:n}){let r=X(),i=Kg(e.relation?.resource??``,e.relation!==void 0);if(!t)return null;let a=e.relation?i.data?.fields:n.fields;if(!a)return null;let o=$w(e.icon),s=e.fields.flatMap(e=>{let t=a.find(t=>t.name===e);return t?[t]:[]}),c=e.relation?.link&&typeof t._id==`string`?`/${e.relation.resource}/${encodeURIComponent(t._id)}`:void 0;return(0,b.jsx)(iE,{title:e.title,icon:o?(0,b.jsx)(o,{}):void 0,actions:c&&(0,b.jsx)(bo,{to:c,className:`text-[13px] font-medium text-primary hover:underline`,children:r(`form.viewProfile`)}),children:(0,b.jsxs)(`dl`,{className:`flex flex-col gap-2.5 text-[13px]`,children:[e.relation&&typeof t._title==`string`&&(0,b.jsx)(`dt`,{className:`text-[14px] font-semibold`,children:t._title}),s.map(e=>(0,b.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{className:`min-w-0 text-end break-words`,children:(0,b.jsx)(rE,{value:t[e.name],field:e,record:t})})]},e.name))]})})}function oE(e,t,n){let r=e.steps?.values??e.enumValues??[],i=typeof t==`string`?r.indexOf(t):-1;return r.map((t,r)=>{let a=n?.[t],o=a?rg(new Date(a)):null,s=i===-1?`future`:r<i?`done`:r===i?`current`:`future`;return{key:t,label:e.enumLabels?.[t]??t,state:s,at:s===`future`?null:o,caption:s===`current`&&o?J(`stepper.since`,{time:o}):null}})}function sE({field:e,value:t,reached:n}){let r=oE(e,t,n);return(0,b.jsx)(iE,{"aria-label":e.label,bodyClassName:`overflow-x-auto px-5 py-4`,children:(0,b.jsx)(`ol`,{className:`flex min-w-max`,children:r.map((e,t)=>(0,b.jsxs)(`li`,{"aria-current":e.state===`current`?`step`:void 0,className:`relative flex min-w-28 flex-1 flex-col items-center gap-1.5 text-center`,children:[t<r.length-1&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:W(`absolute start-1/2 top-3.5 h-0.5 w-full`,e.state===`done`?`bg-primary`:`bg-border`)}),(0,b.jsx)(`span`,{className:W(`relative z-10 flex size-7 items-center justify-center rounded-full border-2 bg-card text-xs font-semibold`,e.state===`done`&&`border-primary bg-primary text-primary-foreground`,e.state===`current`&&`border-primary text-primary`,e.state===`future`&&`border-border text-muted-foreground`),children:e.state===`done`?(0,b.jsx)(bv,{className:`size-3.5`,"aria-hidden":!0}):eg(t+1)}),(0,b.jsx)(`span`,{className:W(`text-[13px]`,e.state===`current`?`font-semibold text-primary`:e.state===`done`?`font-semibold`:`text-muted-foreground`),children:e.label}),(0,b.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:e.caption??e.at??`—`})]},e.key))})})}var cE=class{options;pending=[];problems=[];uploads=new Map;nextId=0;disposed=!1;constructor(e){this.options=e}get busy(){return this.pending.length>0}start(e,t){if(!(this.disposed||e.length===0)){this.problems=[];for(let n of e){let e=this.options.check(n);if(e){this.problems=[...this.problems,this.options.describe(n.name,e)];continue}let r=++this.nextId,i=this.options.preview?.(n),a=this.options.send(n,e=>{this.disposed||(this.pending=this.pending.map(t=>t.id===r?{...t,progress:e}:t),this.options.onChange())});this.uploads.set(r,a),this.pending=[...this.pending,{id:r,name:n.name,progress:0,preview:i}],a.promise.then(e=>{this.disposed||(this.finish(r),t(e,n,i))},e=>{this.disposed||(i&&this.options.revoke?.(i),e instanceof Tg||(this.problems=[...this.problems,this.options.describe(n.name,Ag(e))]),this.finish(r))})}this.options.onChange()}}report(e,t){this.problems=[...this.problems,this.options.describe(e,t)],this.options.onChange()}cancel(e){this.uploads.get(e)?.abort()}cancelAll(){for(let e of[...this.uploads.values()])e.abort()}dispose(){this.disposed=!0;for(let e of this.pending)e.preview&&this.options.revoke?.(e.preview);this.cancelAll(),this.uploads.clear(),this.pending=[]}finish(e){this.uploads.delete(e),this.pending=this.pending.filter(t=>t.id!==e),this.options.onChange()}};function lE({resource:e,field:t,rules:n,onBusy:r}){let i=X(),[,a]=(0,y.useReducer)(e=>e+1,0),o=(0,y.useRef)({resource:e,field:t,rules:n,t:i});o.current={resource:e,field:t,rules:n,t:i};let s=(0,y.useRef)(null),c=()=>new cE({send:(e,t)=>Q.upload(e,{resource:o.current.resource,field:o.current.field.name},t),check:e=>Mg(e,o.current.rules),describe:(e,t)=>o.current.t(`upload.failed`,{name:e,message:t}),preview:e=>e.type.startsWith(`image/`)?URL.createObjectURL(e):void 0,revoke:e=>URL.revokeObjectURL(e),onChange:a});s.current??=c();let l=s.current.busy;return(0,y.useEffect)(()=>{r?.(l)},[l]),(0,y.useEffect)(()=>(s.current||(s.current=c(),a()),()=>{s.current?.dispose(),s.current=null,r?.(!1)}),[]),s.current}function uE({resource:e,field:t,value:n,onChange:r,onBusy:i}){let a=t.file?.many===!0,o=hC(n),s=(0,y.useRef)(o);s.current=o;let c=lE({resource:e,field:t,rules:t.file??{accept:[],maxBytes:1/0},onBusy:i}),l=(0,y.useRef)(new Map);(0,y.useEffect)(()=>()=>{for(let e of l.current.values())URL.revokeObjectURL(e);l.current.clear()},[]);function u(e){let t=new Set(e.map(e=>e.token));for(let[e,n]of l.current)t.has(e)||(URL.revokeObjectURL(n),l.current.delete(e));s.current=e,r(a?e:e[0]??null)}function d(e){let t=a?e:e.slice(0,1);t.length!==0&&(a||c.cancelAll(),c.start(t,(e,t,n)=>{n&&l.current.set(e.token,n);let r={token:e.token,name:e.name,size:e.size,contentType:e.contentType,...e.url?{url:e.url}:{}};u(a?[...s.current,r]:[r])}))}return{many:a,files:o,pending:c.pending,problems:c.problems,add:d,remove:e=>u(o.filter((t,n)=>n!==e)),move:(e,t)=>u(Fg(o,e,t)),cancel:e=>c.cancel(e),previewOf:e=>e.url??(e.token?l.current.get(e.token):void 0)}}function dE(e){let[t,n]=(0,y.useState)(null),[r,i]=(0,y.useState)(null),a=()=>{n(null),i(null)};return{dragging:t,over:r,item:r=>({draggable:!0,onDragStart:e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,String(r)),n(r)},onDragOver:e=>{t!==null&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,i(r))},onDrop:n=>{t!==null&&(n.preventDefault(),e(t,r),a())},onDragEnd:a})}}function fE({id:e,field:t,label:n,compact:r,onFiles:i,aria:a}){let o=X(),s=(0,y.useRef)(null),[c,l]=(0,y.useState)(!1),u=t.file?.many===!0,d=t.file?.accept??[],f=d.length===0||d.some(e=>e===`*`||e===`*/*`),p=e=>e.dataTransfer.types.includes(`Files`);return(0,b.jsxs)(`div`,{"data-dropzone":t.name,onDragOver:e=>{p(e)&&(e.preventDefault(),l(!0))},onDragLeave:()=>l(!1),onDrop:e=>{p(e)&&(e.preventDefault(),l(!1),i([...e.dataTransfer.files]))},className:W(`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg text-sm has-[:focus-visible]:ring-3 has-[:focus-visible]:ring-ring/50`,!r&&`border border-dashed border-input px-3 py-3`,c&&`border-primary bg-muted/50`),children:[(0,b.jsx)(`input`,{ref:s,id:e,type:`file`,className:`sr-only`,multiple:u,accept:f?void 0:d.join(`,`),onChange:e=>{i([...e.target.files??[]]),e.target.value=``},...a}),(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,tabIndex:-1,"aria-hidden":!0,onClick:()=>s.current?.click(),children:[(0,b.jsx)(cx,{}),n]}),!r&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[o(u?`upload.dropMany`:`upload.drop`),t.file&&` · ${o(`upload.limit`,{max:Pg(t.file.maxBytes)})}`]})]})}function pE({upload:e,onCancel:t,className:n}){let r=X(),i=Math.round(e.progress*100);return(0,b.jsxs)(`div`,{className:W(`flex items-center gap-2`,n),children:[(0,b.jsx)(`div`,{role:`progressbar`,"aria-label":r(`upload.uploading`,{name:e.name}),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i,className:`h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,b.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width]`,style:{width:`${i}%`}})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":r(`upload.cancel`,{name:e.name}),onClick:t,children:(0,b.jsx)(Sx,{})})]})}function mE({problems:e}){return e.length===0?null:(0,b.jsx)(`ul`,{role:`alert`,className:`flex flex-col gap-0.5 text-sm text-destructive`,children:e.map((e,t)=>(0,b.jsx)(`li`,{children:e},t))})}function hE(e){let t=X(),{id:n,field:r,aria:i}=e,{many:a,files:o,pending:s,problems:c,add:l,remove:u,move:d,cancel:f}=uE(e),p=dE(d);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(o.length>0||s.length>0)&&(0,b.jsxs)(`ul`,{className:`flex flex-col gap-1`,children:[o.map((e,n)=>(0,b.jsxs)(`li`,{"data-file":e.name,...a&&o.length>1?p.item(n):{},className:W(`flex items-center gap-2 rounded-lg border px-2 py-1.5 text-sm`,p.dragging===n&&`opacity-50`,p.over===n&&p.dragging!==n&&`border-primary`),children:[a&&o.length>1?(0,b.jsx)(uy,{className:`size-4 shrink-0 cursor-grab text-muted-foreground`,"aria-hidden":!0}):(0,b.jsx)(iy,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),e.url?(0,b.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`min-w-0 truncate hover:underline`,"aria-label":t(`upload.open`,{name:e.name}),children:(0,b.jsx)(`bdi`,{children:e.name})}):(0,b.jsx)(`bdi`,{className:`min-w-0 truncate`,children:e.name}),(0,b.jsx)(`span`,{className:`ms-auto shrink-0 text-muted-foreground`,children:Pg(e.size)}),a&&o.length>1&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-xs`,disabled:n===0,"aria-label":t(`list.moveUp`,{name:e.name}),onClick:()=>d(n,n-1),children:(0,b.jsx)(X_,{})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-xs`,disabled:n===o.length-1,"aria-label":t(`list.moveDown`,{name:e.name}),onClick:()=>d(n,n+1),children:(0,b.jsx)(K_,{})})]}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":t(`upload.remove`,{name:e.name}),onClick:()=>u(n),children:(0,b.jsx)(Sx,{})})]},e.token??e.key)),s.map(e=>(0,b.jsxs)(`li`,{className:`flex flex-col gap-1 rounded-lg border border-dashed px-2 py-1.5 text-sm`,children:[(0,b.jsx)(`bdi`,{className:`truncate text-muted-foreground`,children:e.name}),(0,b.jsx)(pE,{upload:e,onCancel:()=>f(e.id)})]},`pending-${e.id}`))]}),(0,b.jsx)(fE,{id:n,field:r,label:t(a?`upload.chooseMany`:o.length>0?`upload.replace`:`upload.choose`),compact:!a&&o.length>0,onFiles:l,aria:i}),(0,b.jsx)(mE,{problems:c})]})}function gE(e){let t=X(),{id:n,field:r,aria:i}=e,{many:a,files:o,pending:s,problems:c,add:l,remove:u,move:d,cancel:f,previewOf:p}=uE(e),m=dE(d),h=a&&o.length>1;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(o.length>0||s.length>0)&&(0,b.jsxs)(`ul`,{className:`flex flex-wrap gap-2`,children:[o.map((e,n)=>{let r=p(e);return(0,b.jsxs)(`li`,{"data-file":e.name,...h?m.item(n):{},className:W(`group relative size-28 overflow-hidden rounded-lg border bg-muted`,h&&`cursor-grab`,m.dragging===n&&`opacity-50`,m.over===n&&m.dragging!==n&&`border-primary ring-2 ring-primary/40`),children:[r?(0,b.jsx)(`img`,{src:r,alt:e.name,draggable:!1,className:`size-full object-cover`}):(0,b.jsxs)(`span`,{className:`flex size-full flex-col items-center justify-center gap-1 p-1 text-center text-xs text-muted-foreground`,children:[(0,b.jsx)(gy,{className:`size-5`,"aria-hidden":!0}),(0,b.jsx)(`bdi`,{className:`w-full truncate`,children:e.name})]}),(0,b.jsx)(q,{type:`button`,variant:`secondary`,size:`icon-xs`,className:`absolute end-1 top-1 shadow`,"aria-label":t(`upload.remove`,{name:e.name}),onClick:()=>u(n),children:(0,b.jsx)(Sx,{})}),h&&(0,b.jsxs)(`div`,{className:`absolute inset-x-1 bottom-1 flex justify-between`,children:[(0,b.jsx)(q,{type:`button`,variant:`secondary`,size:`icon-xs`,className:`shadow`,disabled:n===0,"aria-label":t(`list.moveUp`,{name:e.name}),onClick:()=>d(n,n-1),children:(0,b.jsx)(wv,{className:`rtl:rotate-180`})}),(0,b.jsx)(q,{type:`button`,variant:`secondary`,size:`icon-xs`,className:`shadow`,disabled:n===o.length-1,"aria-label":t(`list.moveDown`,{name:e.name}),onClick:()=>d(n,n+1),children:(0,b.jsx)(Ev,{className:`rtl:rotate-180`})})]})]},e.token??e.key)}),s.map(e=>(0,b.jsxs)(`li`,{className:`relative size-28 overflow-hidden rounded-lg border border-dashed bg-muted`,children:[e.preview&&(0,b.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover opacity-40`}),(0,b.jsx)(pE,{upload:e,onCancel:()=>f(e.id),className:`absolute inset-x-1 bottom-1 rounded-md bg-background/80 ps-1.5`})]},`pending-${e.id}`))]}),(0,b.jsx)(fE,{id:n,field:r,label:t(a?`upload.chooseImages`:o.length>0?`upload.replace`:`upload.chooseImage`),compact:!a&&o.length>0,onFiles:l,aria:i}),(0,b.jsx)(mE,{problems:c})]})}function _E({className:e,...t}){return(0,b.jsx)(`textarea`,{"data-slot":`textarea`,className:W(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function vE({id:e,field:t,value:n,onChange:r,aria:i}){let{unit:a,position:o}=jx(`0`,{currency:t.currency}),s=a&&(0,b.jsx)(`span`,{className:`shrink-0 text-[13px] text-muted-foreground`,children:a});return(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o===`before`&&s,(0,b.jsx)(Oh,{id:e,type:`text`,inputMode:`decimal`,dir:`ltr`,className:`text-end`,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),onBlur:()=>r(Dx(n,t.scale)),...i}),o!==`before`&&s]})}function yE({id:e,checked:t,onChange:n,aria:r}){return(0,b.jsx)(`button`,{id:e,type:`button`,role:`switch`,"aria-checked":t,onClick:()=>n(!t),className:W(`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,t?`bg-primary`:`bg-input`),...r,children:(0,b.jsx)(`span`,{className:W(`block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-4 rtl:-translate-x-4`:`translate-x-0`)})})}function bE({id:e,field:t,value:n,onChange:r,aria:i,label:a,required:o}){let s=X(),c=(t.enumValues??[]).map(e=>[e,MC(t,e)]);return t.nullable&&!o&&c.unshift([``,s(`common.empty`)]),(0,b.jsxs)(`fieldset`,{id:e,className:`flex flex-col gap-1.5`,...i,children:[(0,b.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:a}),(0,b.jsx)(`div`,{role:`radiogroup`,className:`flex flex-wrap gap-x-4 gap-y-1.5`,children:c.map(([t,i])=>(0,b.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,b.jsx)(`input`,{type:`radio`,name:e,value:t,checked:n===t,onChange:()=>r(t),className:`size-4 accent-primary`}),i]},t))})]})}var xE=/^#[0-9a-f]{6}$/i;function SE({id:e,field:t,value:n,onChange:r,aria:i}){let a=X();return(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`color`,"aria-hidden":!0,tabIndex:-1,className:`h-8 w-10 shrink-0 cursor-pointer rounded-md border border-input bg-transparent p-0.5`,value:xE.test(n)?n.toLowerCase():`#000000`,onChange:e=>r(e.target.value)}),(0,b.jsx)(Oh,{id:e,dir:`ltr`,value:n,placeholder:t.placeholder??`#000000`,"aria-label":a(`form.colorCode`,{name:t.label}),onChange:e=>r(e.target.value),...i})]})}function CE({id:e,field:t,value:n,onChange:r,aria:i}){let a=X(),[o,s]=(0,y.useState)(null),c=`${e}-json`;function l(){if(n.trim()!==``)try{r(JSON.stringify(JSON.parse(n),null,2)),s(null)}catch(e){s(e instanceof Error?e.message:String(e))}}let u=[i[`aria-describedby`],o?c:void 0].filter(Boolean).join(` `)||void 0;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(_E,{id:e,dir:`ltr`,rows:6,className:`font-mono`,spellCheck:!1,value:n,placeholder:t.placeholder,onChange:e=>{s(null),r(e.target.value)},...i,"aria-invalid":i[`aria-invalid`]??(o?!0:void 0),"aria-describedby":u}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:l,children:a(`form.formatJson`)}),o&&(0,b.jsx)(`p`,{id:c,className:`text-sm text-destructive`,children:o})]})]})}function wE({id:e,field:t,value:n,onChange:r,aria:i}){return(0,b.jsx)(_E,{id:e,rows:4,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),...i})}function TE({id:e,field:t,value:n,onChange:r,aria:i,...a}){return(0,b.jsx)(Oh,{id:e,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),...a,...i})}var EE=(0,y.lazy)(()=>Xa(()=>import(`./rich-text-input-CuSUMUx9.js`),__vite__mapDeps([0,1]),import.meta.url));function DE(e){let t=X();return(0,b.jsx)(y.Suspense,{fallback:(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`editor.loading`)}),children:(0,b.jsx)(EE,{...e})})}var OE=`h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive`;function kE({resource:e,field:t,value:n,required:r,errors:i,constraints:a,formValues:o,onChange:s,onBusy:c,idPrefix:l=`field`,parent:u,hideLabel:d}){let f=`${l}-${t.name}`,p=`${f}-error`,m=`${f}-help`,h=(i?.length??0)>0,g=[t.help?m:void 0,h?p:void 0].filter(Boolean).join(` `)||void 0,_={"aria-invalid":h?!0:void 0,"aria-describedby":g},v=typeof n==`string`?n:``,y=t.type===`relation`?void 0:jC(t,a),x=(0,b.jsxs)(b.Fragment,{children:[t.label,r&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`text-destructive`,children:`*`})]}),S=(0,b.jsx)(kh,{htmlFor:f,className:d?`sr-only`:void 0,children:x}),C=t.help?(0,b.jsx)(`p`,{id:m,className:`text-sm text-muted-foreground`,children:t.help}):null,w={id:f,field:t,value:v,onChange:e=>s(e),aria:_};if(t.type===`boolean`){let e=n===!0;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y===`switch`?(0,b.jsx)(yE,{id:f,checked:e,onChange:s,aria:_}):(0,b.jsx)(`input`,{id:f,type:`checkbox`,className:`size-4 accent-primary`,checked:e,onChange:e=>s(e.target.checked),..._}),S]}),C,(0,b.jsx)(jE,{id:p,errors:i})]})}if(t.type===`enum`&&y===`radio`)return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(bE,{...w,label:x,required:r}),C,(0,b.jsx)(jE,{id:p,errors:i})]});let T;if(t.type===`relation`)T=(0,b.jsx)(GS,{id:f,resource:e,field:t,value:n??null,onChange:s,clearable:t.nullable,values:o,parent:u,invalid:h,describedBy:g});else if(t.type===`enum`)T=(0,b.jsxs)(`select`,{id:f,className:OE,value:v,onChange:e=>s(e.target.value),..._,children:[(0,b.jsx)(`option`,{value:``,children:t.placeholder??`—`}),t.enumValues?.map(e=>(0,b.jsx)(`option`,{value:e,children:MC(t,e)},e))]});else switch(y){case`file`:T=(0,b.jsx)(hE,{id:f,resource:e,field:t,value:n,onChange:s,onBusy:c,aria:_});break;case`image`:T=(0,b.jsx)(gE,{id:f,resource:e,field:t,value:n,onChange:s,onBusy:c,aria:_});break;case`richtext`:T=(0,b.jsx)(DE,{id:f,resource:e,field:t,value:v,onChange:s,onBusy:c,invalid:h,describedBy:g});break;case`money`:T=(0,b.jsx)(vE,{...w});break;case`date`:T=(0,b.jsx)(RS,{id:f,live:!0,value:v,label:t.label,onChange:e=>s(e),..._});break;case`datetime`:T=(0,b.jsx)(VS,{id:f,value:v,label:t.label,onChange:e=>s(e),..._});break;case`json`:T=(0,b.jsx)(CE,{...w});break;case`textarea`:T=(0,b.jsx)(wE,{...w});break;case`color`:T=(0,b.jsx)(SE,{...w});break;case`password`:T=(0,b.jsx)(TE,{...w,type:`password`,autoComplete:`new-password`});break;case`slug`:T=(0,b.jsx)(TE,{...w,dir:`ltr`,autoCapitalize:`none`,spellCheck:!1});break;default:T=(0,b.jsx)(TE,{...w,...AE(t,y)})}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[S,T,C,(0,b.jsx)(jE,{id:p,errors:i})]})}function AE(e,t){if(t===`email`||t===`url`)return{type:t};switch(e.type){case`number`:case`decimal`:return{type:`text`,inputMode:`decimal`};case`bigint`:return{type:`text`,inputMode:`numeric`};case`date`:return{type:`date`};case`datetime`:return{type:`datetime-local`};default:return{type:`text`}}}function jE({id:e,errors:t}){return t?.length?(0,b.jsx)(`p`,{id:e,className:`text-sm text-destructive`,children:t.join(` `)}):null}var ME={1:``,2:`md:grid-cols-2`,3:`md:grid-cols-2 lg:grid-cols-3`};function NE({layout:e,names:t,render:n,errors:r,renderInline:i,renderSummary:a,plain:o}){let s=e&&(i?e:LE(e)),c=new Set((s??[]).flatMap(e=>`tab`in e?e.sections:[e]).flatMap(e=>FE(e)||IE(e)?[]:e.fields)),l=t.filter(e=>!c.has(e)),u=(s??[]).filter(e=>`tab`in e),d=(s??[]).findIndex(e=>`tab`in e),f=d===-1?(s??[]).filter(e=>!(`tab`in e)):(s??[]).slice(0,d).filter(e=>!(`tab`in e)),p=d===-1?[]:(s??[]).slice(d).filter(e=>!(`tab`in e)),m=(e,t)=>FE(e)?(0,b.jsx)(y.Fragment,{children:i?.(e)},t):IE(e)?(0,b.jsx)(y.Fragment,{children:a?.(e)},t):(0,b.jsx)(PE,{section:e,render:n,plain:o},t);return(0,b.jsxs)(b.Fragment,{children:[f.map((e,t)=>m(e,`b${t}`)),u.length>0&&(0,b.jsx)(RE,{tabs:u,render:n,errors:r,block:m}),p.map((e,t)=>m(e,`a${t}`)),l.length>0&&(0,b.jsx)(PE,{section:{fields:l,columns:1},render:n,plain:o})]})}function PE({section:e,render:t,plain:n}){let r=(0,y.useId)(),i=e.fields.map(e=>[e,t(e)]).filter(([,e])=>e!==null);if(i.length===0)return null;let a=(0,b.jsx)(`div`,{className:W(`grid gap-5`,ME[e.columns]),children:i.map(([e,t])=>(0,b.jsx)(`div`,{className:`min-w-0`,children:t},e))});return n?e.title?(0,b.jsxs)(`section`,{"aria-labelledby":r,className:`flex flex-col gap-3`,children:[(0,b.jsx)(`h3`,{id:r,className:`text-[13px] font-semibold text-muted-foreground`,children:e.title}),a]}):a:e.title?(0,b.jsx)(iE,{"aria-labelledby":r,title:(0,b.jsx)(`span`,{id:r,children:e.title}),children:a}):(0,b.jsx)(iE,{bodyClassName:`p-5`,children:a})}var FE=e=>`inline`in e,IE=e=>`summary`in e;function LE(e){return e.filter(e=>!FE(e)&&!IE(e)).map(e=>`tab`in e?{...e,sections:e.sections.filter(e=>!FE(e)&&!IE(e))}:e)}function RE({tabs:e,render:t,errors:n,block:r}){let i=X(),{locale:a}=Y(),o=(0,y.useId)(),[s,c]=(0,y.useState)(0),l=(0,y.useRef)([]),u=e=>e.sections.some(e=>(FE(e)?[`_inlines.${e.inline}`]:IE(e)?[]:e.fields).some(e=>Object.keys(n).some(t=>t===e||t.startsWith(`${e}.`))));(0,y.useEffect)(()=>{if(u(e[s]))return;let t=e.findIndex(u);t!==-1&&c(t)},[n]);function d(t){let n=Qh(a)?`ArrowLeft`:`ArrowRight`,r=Qh(a)?`ArrowRight`:`ArrowLeft`,i;t.key===n?i=(s+1)%e.length:t.key===r?i=(s-1+e.length)%e.length:t.key===`Home`?i=0:t.key===`End`&&(i=e.length-1),i!==void 0&&(t.preventDefault(),c(i),l.current[i]?.focus())}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`div`,{role:`tablist`,className:`flex gap-0.5 overflow-x-auto border-b`,onKeyDown:d,children:e.map((e,t)=>(0,b.jsxs)(`button`,{ref:e=>{l.current[t]=e},id:`${o}-tab-${t}`,type:`button`,role:`tab`,"aria-selected":t===s,"aria-controls":`${o}-panel-${t}`,tabIndex:t===s?0:-1,onClick:()=>c(t),className:W(`-mb-px flex h-[38px] items-center gap-1.5 border-b-2 px-3 text-[13px] whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,t===s?`border-foreground font-semibold`:`border-transparent text-muted-foreground hover:text-foreground`),children:[e.tab,u(e)&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-destructive`}),(0,b.jsx)(`span`,{className:`sr-only`,children:i(`form.tabHasErrors`)})]})]},t))}),e.map((e,t)=>(0,b.jsx)(`div`,{id:`${o}-panel-${t}`,role:`tabpanel`,"aria-labelledby":`${o}-tab-${t}`,hidden:t!==s,className:W(`flex-col gap-5`,t===s?`flex`:`hidden`),children:e.sections.map((e,t)=>r(e,String(t)))},t))]})}var zE=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{};function BE({resource:e,field:t,path:n,pattern:r,value:i,constraints:a,markRequired:o,errors:s,onChange:c,idPrefix:l}){let u=X(),d=s[n];if(t.many){let f=Array.isArray(i)?i:[];return(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,b.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:t.label}),f.map((i,d)=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-md border border-dashed p-3`,children:[(0,b.jsx)(VE,{resource:e,field:t,path:`${n}.${d}`,pattern:`${r}.*`,value:i,constraints:a,markRequired:o,errors:s,idPrefix:l,onChange:e=>c(f.map((t,n)=>n===d?e:t))}),(0,b.jsx)(`div`,{children:(0,b.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>c(f.filter((e,t)=>t!==d)),children:[(0,b.jsx)(nx,{}),u(`form.remove`,{name:t.label,index:d+1})]})})]},d)),(0,b.jsx)(`div`,{children:(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>c([...f,wC(t.fields??[])]),children:[(0,b.jsx)(mb,{}),u(`form.add`,{name:t.label})]})}),d&&(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:d.join(` `)})]})}return(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,b.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:t.label}),(0,b.jsx)(VE,{resource:e,field:t,path:n,pattern:r,value:zE(i),constraints:a,markRequired:o,errors:s,idPrefix:l,onChange:c}),d&&(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:d.join(` `)})]})}function VE({resource:e,field:t,path:n,pattern:r,value:i,constraints:a,markRequired:o,errors:s,onChange:c,idPrefix:l}){return(0,b.jsx)(b.Fragment,{children:(t.fields??[]).filter(e=>!e.readonly).map(t=>{let u=`${n}.${t.name}`,d=`${r}.${t.name}`,f=e=>c({...i,[t.name]:e});return t.type===`object`?(0,b.jsx)(BE,{resource:e,field:t,path:u,pattern:d,value:i[t.name],constraints:a,markRequired:o,errors:s,idPrefix:l,onChange:f},t.name):(0,b.jsx)(kE,{resource:e,field:{...t,name:u},value:i[t.name],required:o&&a[d]?.required===!0,errors:s[u],constraints:a[d],idPrefix:l,onChange:f},t.name)})})}function HE(e,t){let n=t?._perm?.actions;return e.actions.filter(e=>e.target===`record`&&(n===void 0||typeof n[e.name]==`string`)).map(e=>n?.[e.name]?{...e,label:n[e.name]}:e)}function UE(e,t){let n=HE(e,t),r=n.find(e=>e.primary),i=n.filter(e=>e!==r);return{...r?{primary:r}:{},buttons:i.slice(0,3),overflow:i.slice(3)}}function WE(e,t){let n=e.actions.filter(e=>e.target===`record`&&e.bulk);return t.length===0?n:n.filter(n=>t.some(t=>HE(e,t).some(e=>e.name===n.name)))}function GE(e){return e.actions.filter(e=>e.target===`resource`)}function KE(e,t=0){return e.confirm!==void 0||e.variant===`destructive`||t>1}function qE(e,t=0){return!e.input&&!KE(e,t)}function JE(e,t,n,r){if(KE(e,t))return typeof e.confirm==`string`?e.confirm:t>1?r(`action.confirmSelected`,{action:e.label,count:t}):n===void 0?r(`action.confirm`,{action:e.label}):r(`action.confirmRecord`,{action:e.label,name:n})}function YE(e){let t=e.message===void 0?{}:{message:e.message};return`record`in e?{kind:`record`,record:e.record,...t}:`ok`in e&&`failed`in e?{kind:`bulk`,result:{ok:e.ok,failed:e.failed},...t}:{kind:`resource`,...t}}function XE(e,t){return e.kind===`bulk`?e.result:{ok:t,failed:[]}}function ZE(e,t){if(!(e instanceof fg))return{fields:{},form:e.message};let n=Object.entries(e.fields),r=e=>t.includes(e.split(`.`)[0]),i=Object.fromEntries(n.filter(([e])=>r(e))),a=n.filter(([e])=>!r(e)).map(([e,t])=>`${e}: ${t.join(`, `)}`);return{fields:i,form:Object.keys(i).length>0&&a.length===0?null:[e.message,...a].join(` — `)}}var QE=/\{([^{}]*)\}/g;function $E(e,t){let n=!1,r=e.replace(QE,(e,r)=>{let i=t[r],a=typeof i==`string`?i.trim():typeof i==`boolean`?String(i):``;return a===``&&(n=!0),a});return n?``:r}function eD(e,t){return new Set(e.filter(e=>e.fillFrom!==void 0&&t[e.name]!==``&&t[e.name]!==void 0).map(e=>e.name))}function tD(e,t,n){let r=e.filter(e=>e.fillFrom!==void 0&&!n.has(e.name));if(r.length===0)return t;let i=t;for(let e=0;e<=r.length;e++){let e=!1;for(let n of r){let r=$E(n.fillFrom,i);i[n.name]!==r&&(i===t&&(i={...t}),i[n.name]=r,e=!0)}if(!e)break}return i}function nD(e,t,n,r){e.some(e=>e.name===n&&e.fillFrom!==void 0)&&(r===``||r===null?t.delete(n):t.add(n))}function rD(e,t){let n=pC(e)?String(e.id):e;return t===null?n==null||n===``:typeof t==`boolean`?n===t||n===String(t):typeof n!=`string`||n.trim()===``?!1:typeof t==`number`?Number(Nh(n).trim().replace(/,/g,``))===t:n===t}function iD(e,t){return!e.showIf||Object.entries(e.showIf).every(([e,n])=>(Array.isArray(n)?n:[n]).some(n=>rD(t[e],n)))}var aD=/^.+@[^\s@]+\.[^\s@]+$/,oD=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function sD(e){if(/\s/.test(e))return!1;try{let{hostname:t}=new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(e)?e:`http://${e}`);return t.includes(`.`)||t.startsWith(`[`)}catch{return!1}}function cD(e,t){try{return new RegExp(t.source,t.flags).test(e)}catch{return!0}}function lD(e){let t=e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)??[],n=e.match(/[^\uFE0F\uFE0E][\uFE0F\uFE0E]/g)??[];return e.length-t.length-n.length}function uD(e,t){let n=[];if(typeof e==`string`){let r=lD(e);t.minLength!==void 0&&r<t.minLength&&n.push(J(`validation.minLength`,{min:t.minLength})),t.maxLength!==void 0&&r>t.maxLength&&n.push(J(`validation.maxLength`,{max:t.maxLength})),t.pattern&&!cD(e,t.pattern)&&n.push(t.pattern.message??J(`validation.pattern`)),t.format===`email`&&!aD.test(e)&&n.push(J(`validation.email`)),t.format===`url`&&!sD(e)&&n.push(J(`validation.url`)),t.format===`uuid`&&!oD.test(e)&&n.push(J(`validation.uuid`)),t.oneOf&&!t.oneOf.includes(e)&&n.push(J(`validation.oneOf`,{values:t.oneOf.join(`, `)}))}return typeof e==`number`&&(t.integer&&!Number.isInteger(e)&&n.push(J(`validation.integer`)),t.min!==void 0&&e<t.min&&n.push(J(`validation.min`,{min:t.min})),t.max!==void 0&&e>t.max&&n.push(J(`validation.max`,{max:t.max}))),n}function dD(e,t,n){let r={};for(let[i,a]of Object.entries(t))for(let{path:t,value:o,sent:s,parentSent:c}of fD(e,i.split(`.`))){if(o==null||o===``){a.required&&c&&(n===`create`||s)&&(r[t]=[J(`validation.required`)]);continue}let e=uD(o,a);e.length>0&&(r[t]=e)}return r}function fD(e,t,n=``,r=!0){let[i,...a]=t,o=typeof e==`object`&&e?e:void 0;if(i===`*`)return(Array.isArray(e)?e:[]).flatMap((e,t)=>fD(e,a,`${n}${t}.`,!0));let s=o!==void 0&&Object.hasOwn(o,i),c=o?.[i],l=`${n}${i}`;return a.length===0?[{path:l,value:c,sent:s,parentSent:r}]:fD(c,a,`${l}.`,r&&s)}function pD({resource:e,action:t,count:n,subject:r,running:i,error:a,onRun:o,onClose:s}){let c=X(),l=t.input?.fields??[],u=(0,y.useRef)(new Set),[d,f]=(0,y.useState)(()=>tD(l,wC(l),u.current)),[p,m]=(0,y.useState)({}),[h,g]=(0,y.useState)(!1),_=l.filter(e=>iD(e,d)),v=a&&!h?ZE(a,l.map(e=>e.name)):{fields:{},form:null},x={...v.fields,...p};function S(e){if(e.preventDefault(),e.stopPropagation(),!t.input)return o(void 0);let{payload:n,errors:r}=EC(_,d),i={...dD(n,Object.fromEntries(Object.entries(t.input.constraints).filter(([e])=>_.some(t=>t.name===e.split(`.`)[0]))),`create`),...r};m(i),g(Object.keys(i).length>0),Object.keys(i).length===0&&o(n)}let C=JE(t,n,r,c);function w(n){let r=_.find(e=>e.name===n);if(!r||!t.input)return null;let i=e=>{nD(l,u.current,n,e),f(t=>tD(l,{...t,[n]:e},u.current))};return r.type===`object`?(0,b.jsx)(BE,{resource:e,field:r,path:n,pattern:n,value:d[n],constraints:t.input.constraints,markRequired:!0,errors:x,idPrefix:`action`,onChange:i}):(0,b.jsx)(kE,{resource:e,field:r,value:d[n],required:t.input.required.includes(n),errors:x[n],constraints:t.input.constraints[n],idPrefix:`action`,onChange:i})}return(0,b.jsx)(jd,{open:!0,onOpenChange:e=>!e&&!i&&s(),children:(0,b.jsxs)(Ld,{children:[(0,b.jsx)(zd,{className:HS}),(0,b.jsx)(Ud,{"aria-describedby":C?`action-question`:void 0,className:`fixed inset-x-3 top-[12vh] z-50 mx-auto flex max-h-[76vh] max-w-lg flex-col overflow-hidden rounded-xl border bg-background shadow-xl outline-none`,children:(0,b.jsxs)(`form`,{onSubmit:S,noValidate:!0,className:`flex min-h-0 flex-col`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-4 overflow-y-auto p-4`,children:[(0,b.jsx)(Jd,{className:`text-lg font-semibold`,children:t.label}),C&&(0,b.jsx)(`p`,{id:`action-question`,className:`text-sm`,children:C}),n>1&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c(t.atomic?`action.atomicNote`:`action.eachNote`,{count:n})}),v.form&&(0,b.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:v.form}),t.input&&(0,b.jsx)(NE,{layout:void 0,names:l.map(e=>e.name),errors:x,render:w})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t p-4`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:i,onClick:s,children:c(`common.cancel`)}),(0,b.jsx)(q,{type:`submit`,variant:t.variant===`destructive`?`destructive`:`default`,disabled:i,children:i?c(`action.running`):t.label})]})]})})]})})}function mD({resource:e,action:t,ids:n,subject:r,size:i=`default`,className:a,primary:o=!1,menuItem:s=!1,blocked:c=!1,describedBy:l,onDone:u}){let d=X(),f=S(),[p,m]=(0,y.useState)(!1),h=qE(t,n?.length??0),g=pt({mutationFn:r=>Q.runAction(e,t.name,{...n?{ids:n}:{},...r?{input:r}:{}}),onSuccess:r=>{let i=YE(r);m(!1),i.kind===`bulk`?i.message&&VT(i.message):VT(i.message??d(i.kind===`record`&&i.record===null?`action.doneGone`:`action.done`,{action:t.label})),u(i,n??[]);for(let t of[`list`,`count`,`record`,`history`])f.invalidateQueries({queryKey:[t,e]})},onError:e=>{h&&VT(pg(e),`error`)}}),_=$w(t.icon);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(q,{type:`button`,size:i,variant:t.variant===`destructive`?`destructive`:o?`default`:s?`ghost`:`outline`,className:W(s&&`w-full justify-start font-normal`,a),disabled:c||g.isPending,"aria-describedby":l,"data-action":t.name,onClick:()=>{g.reset(),h?g.mutate(void 0):m(!0)},children:[_&&(0,b.jsx)(_,{"aria-hidden":!0}),t.label,o&&(0,b.jsx)(wv,{className:`ltr:rotate-180`,"aria-hidden":!0})]}),p&&(0,b.jsx)(pD,{resource:e,action:t,count:n?.length??0,subject:r,running:g.isPending,error:g.error,onRun:e=>g.mutate(e),onClose:()=>m(!1)})]})}function hD({schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a}){let o=X(),s=S(),[c,l]=(0,y.useState)(!1),{primary:u,buttons:d,overflow:f}=UE(e,t);if(!u&&d.length===0)return null;let p=`record-actions-note`,m=(o,c={})=>(0,b.jsx)(mD,{resource:e.name,action:o,ids:[n],subject:typeof t._title==`string`?t._title:`#${n}`,blocked:r,describedBy:r?p:void 0,...c,onDone:t=>{l(!1);let r=t.kind===`record`?t.record:void 0;if(r===null){i(),s.removeQueries({queryKey:[`record`,e.name,n]});return}r&&s.setQueryData([`record`,e.name,n],r),a()}},o.name);return(0,b.jsxs)(`div`,{role:`group`,"aria-label":o(`list.actions`),className:`ms-auto flex flex-wrap items-center gap-2`,children:[r&&(0,b.jsx)(`span`,{id:p,className:`text-xs text-muted-foreground`,children:o(`action.saveFirst`)}),d.map(e=>m(e)),f.length>0&&(0,b.jsxs)(Sh,{open:c,onOpenChange:l,children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`icon`,"aria-label":o(`action.more`),children:(0,b.jsx)(Jv,{})})}),(0,b.jsx)(wh,{forceMount:!0,children:(0,b.jsx)(Th,{forceMount:!0,align:`end`,sideOffset:6,className:`z-50 flex min-w-48 flex-col gap-0.5 rounded-[10px] border bg-popover p-1.5 shadow-lg data-[state=closed]:hidden`,onClick:()=>l(!1),children:f.map(e=>m(e,{menuItem:!0}))})})]}),u&&m(u,{primary:!0})]})}function gD({schema:e,ids:t,bulkOnly:n=!1,size:r=`default`}){let i=X(),a=(e.prints??[]).filter(e=>!n||e.bulk);return t.length===0||a.length===0?null:(0,b.jsx)(b.Fragment,{children:a.map(n=>{let a=$w(n.icon)??gb;return(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:r,"aria-label":i(`print.open`,{name:n.label}),onClick:()=>window.open(Hg(e.name,n.name,t),`_blank`,`noopener`),children:[(0,b.jsx)(a,{}),n.label]},n.name)})})}function _D({schema:e,query:t,iconOnly:n=!1}){let r=X(),[i,a]=(0,y.useState)(!1);if(!e.list.export)return null;async function o(){a(!0);try{let{blob:n,filename:i,truncated:a}=await Q.exportList(e.name,t),o=URL.createObjectURL(n),s=document.createElement(`a`);s.href=o,s.download=i,s.click(),setTimeout(()=>URL.revokeObjectURL(o),1e4),VT(a?r(`list.exportTruncated`,{count:a}):r(`list.exportDone`,{file:i}),a?`error`:`success`)}catch(e){VT(pg(e),`error`)}finally{a(!1)}}return(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:n?`icon`:`default`,disabled:i,"aria-label":n?r(`list.export`):void 0,onClick:()=>void o(),children:[(0,b.jsx)(ey,{}),!n&&r(i?`list.exporting`:`list.export`)]})}function vD(e,t,n){return e<=0?-1:t<0?n?e-1:0:(t+(n?-1:1)+e)%e}var yD=`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`,bD=[],xD=null;function SD(){let e=document.getElementById(`root`),t=document.documentElement,n={overflow:document.body.style.overflow,gutter:t.style.scrollbarGutter,inert:e?.hasAttribute(`inert`)??!1};document.body.style.overflow=`hidden`,t.style.scrollbarGutter=`stable`,e?.setAttribute(`inert`,``),xD=()=>{document.body.style.overflow=n.overflow,t.style.scrollbarGutter=n.gutter,n.inert||e?.removeAttribute(`inert`)}}function CD({labelledBy:e,describedBy:t,onDismiss:n,initialFocus:r,className:i,children:a}){let o=(0,y.useRef)(null),s=(0,y.useRef)(n);return s.current=n,(0,y.useEffect)(()=>{let e=Symbol(`alert`),t=document.activeElement instanceof HTMLElement?document.activeElement:null;bD.length===0&&SD(),bD.push(e),((r?o.current?.querySelector(r):null)??o.current?.querySelector(yD)??o.current)?.focus();let n=t=>{if(bD[bD.length-1]===e&&o.current){if(t.key===`Escape`&&s.current)t.preventDefault(),t.stopPropagation(),s.current();else if(t.key===`Tab`){t.preventDefault();let e=[...o.current.querySelectorAll(yD)];(e[vD(e.length,e.indexOf(document.activeElement),t.shiftKey)]??o.current).focus()}}};return document.addEventListener(`keydown`,n,!0),()=>{document.removeEventListener(`keydown`,n,!0),bD.splice(bD.indexOf(e),1),bD.length===0&&(xD?.(),xD=null),t?.isConnected&&bD.length===0&&t.focus()}},[r]),(0,Ec.createPortal)((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{"data-testid":`alert-backdrop`,"aria-hidden":!0,className:HS,onClick:()=>s.current?.()}),(0,b.jsx)(`div`,{ref:o,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":e,"aria-describedby":t,"data-state":`open`,tabIndex:-1,className:W(`fixed inset-x-3 top-[12vh] z-50 mx-auto max-h-[76vh] max-w-lg overflow-y-auto rounded-card border border-amber-500/50 bg-background p-4 shadow-xl outline-none motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-2 motion-safe:duration-150`,i),children:a})]}),document.body)}function wD(e){let t=(0,y.useRef)(!1),n=ha(({currentLocation:n,nextLocation:r})=>e&&!t.current&&(n.pathname!==r.pathname||n.search!==r.search));return(0,y.useEffect)(()=>{if(!e)return;let t=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,t),()=>window.removeEventListener(`beforeunload`,t)},[e]),{blocker:n,release:()=>{t.current=!0}}}function TD({blocker:e}){let t=X();return e.state===`blocked`?(0,b.jsxs)(CD,{labelledBy:`leave-title`,onDismiss:()=>e.reset(),className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`p`,{id:`leave-title`,className:`min-w-0 flex-1 basis-full text-sm font-medium sm:basis-0`,children:t(`form.leaveTitle`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>e.reset(),children:t(`form.stay`)}),(0,b.jsx)(q,{type:`button`,variant:`destructive`,onClick:()=>e.proceed(),children:t(`form.leave`)})]}):null}function ED(e,t){let n=(0,y.useRef)(t);n.current=t,(0,y.useEffect)(()=>{let t=t=>{if(!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey||t.key.toLowerCase()!==`s`)return;t.preventDefault();let r=document.querySelector(`[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]`);(!r||r.contains(e.current))&&(n.current?.(),e.current?.requestSubmit())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function DD(e){let[t,n]=(0,y.useState)([]),[r,i]=(0,y.useState)(!1),a=(0,y.useRef)(e);return a.current=e,(0,y.useEffect)(()=>{t.length>0||!r||(i(!1),a.current())},[t.length,r]),{busy:t.length>0,setBusy:(e,t)=>n(n=>t===n.includes(e)?n:t?[...n,e]:n.filter(t=>t!==e)),refuse:()=>i(!0)}}function OD({dirty:e,children:t}){let n=X();return(0,b.jsxs)(`div`,{className:`sticky bottom-3 z-10 flex flex-wrap items-center gap-2 rounded-card border bg-card px-4 py-2.5 shadow-[0_12px_32px_rgba(0,0,0,.12)]`,children:[e&&(0,b.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-[13px] font-semibold`,children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full bg-amber-500`}),n(`form.unsaved`)]}),(0,b.jsx)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:t})]})}function kD(){let e=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform);return(0,b.jsx)(`kbd`,{"aria-hidden":!0,className:`rounded border border-current/30 px-1 font-sans text-[10.5px] opacity-80`,children:e?`⌘S`:`Ctrl S`})}var AD=`—`,jD=e=>e==null||e===``;function MD(e,t){let n=t?.value;switch(e.kind){case`image`:return typeof n==`string`&&n!==``?{kind:`image`,src:n}:{kind:`image`};case`toggle`:return{kind:`toggle`,on:n===!0};case`money`:{if(jD(n))return{kind:`money`,text:AD};let e=jx(String(n),jD(t?.previous)?{}:{previous:String(t.previous)});return{kind:`money`,text:e.main,...e.unit?{unit:e.unit,unitPosition:e.position}:{},...e.previous===void 0?{}:{previous:e.previous}}}case`badge`:return{kind:`badge`,text:t?.label??(jD(n)?AD:String(n)),...t?.tone?{tone:t.tone}:{}};case`count`:return{kind:`count`,text:typeof n==`number`?eg(n):jD(n)?AD:tg(String(n))};case`title`:return{kind:`title`,text:jD(n)?AD:String(n),...jD(t?.subline)?{}:{subline:String(t.subline)}}}}function ND({schema:e,name:t,column:n,item:r,compact:i=!1}){let a=r._computed?.[t],o=MD(n,a);switch(o.kind){case`image`:return(0,b.jsx)(`span`,{className:W(`flex shrink-0 items-center justify-center overflow-hidden rounded-control border bg-muted text-muted-foreground`,i?`size-14`:`size-10`),children:o.src?(0,b.jsx)(`img`,{src:o.src,alt:``,className:`size-full object-cover`,loading:`lazy`}):(0,b.jsx)(vy,{className:`size-[18px]`,"aria-hidden":!0})});case`title`:return(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-col leading-[1.45]`,children:[(0,b.jsx)(`span`,{className:W(`truncate font-semibold`,i?`text-[14.5px]`:`text-[13.5px]`),children:o.text}),o.subline&&(0,b.jsx)(`span`,{className:`truncate text-start font-mono text-[11.5px] text-muted-foreground`,children:(0,b.jsx)(`bdi`,{dir:`ltr`,children:o.subline})})]});case`money`:return(0,b.jsxs)(`span`,{className:`flex flex-col leading-[1.4]`,children:[(0,b.jsxs)(`span`,{className:`font-semibold whitespace-nowrap`,children:[o.unit&&o.unitPosition===`before`&&(0,b.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[o.unit,` `]}),o.text,o.unit&&o.unitPosition!==`before`&&(0,b.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[` `,o.unit]})]}),o.previous&&(0,b.jsx)(`s`,{className:`text-xs text-muted-foreground`,children:o.previous})]});case`badge`:return(0,b.jsx)($T,{tone:o.tone,children:o.text});case`count`:return(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:o.text});case`toggle`:return(0,b.jsx)(PD,{schema:e,column:n,item:r,on:o.on===!0})}}function PD({schema:e,column:t,item:n,on:r}){let i=X(),a=S(),[o,s]=(0,y.useState)(r),c=t.toggle,l=c!==void 0&&n._perm?.update!==!1&&!(Array.isArray(n._readonly)&&n._readonly.includes(c.field)),u=pt({mutationFn:t=>Q.update(e.name,String(n._id),{[c.field]:t?c.on:c.off},e.version?n[e.version]:void 0),onSuccess:()=>a.invalidateQueries({queryKey:[`list`,e.name]}),onError:e=>{s(r),VT(pg(e),`error`)}}),d=typeof n._title==`string`?n._title:String(n._id);return(0,b.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":o,"aria-label":i(`list.toggleRow`,{column:t.label,name:d}),disabled:!l||u.isPending,onClick:e=>{e.preventDefault(),e.stopPropagation(),s(!o),u.mutate(!o)},className:W(`relative inline-block h-5 w-9 shrink-0 cursor-pointer rounded-full bg-input transition-colors disabled:cursor-default disabled:opacity-60`,o&&`bg-primary`,`after:absolute after:top-0.5 after:size-4 after:rounded-full after:bg-white after:shadow-sm after:transition-[inset-inline-start] after:content-[''] after:start-0.5`,o&&`after:start-[18px]`)})}function FD(e){let t=e.form.layout;return t?t.flatMap(e=>`tab`in e?e.sections:[e]).flatMap(e=>`fields`in e&&!(`inline`in e)?e.fields:[]):[...new Set([...e.form.update,...e.form.readonly])]}function ID(e){let t=(e.form.layout??[]).flatMap(e=>`tab`in e?e.sections:[e]).flatMap(e=>`summary`in e?e.summary.flatMap(e=>`field`in e.value?[e.value.field]:[]):[]),n=(e.form.aside??[]).flatMap(e=>e.relation?[e.relation.field]:e.fields),r=[...e.form.header?.badges??[],...(e.form.header?.subtitle??[]).flatMap(e=>`field`in e?[e.field]:[])],i=new Set(e.form.update);return new Set([...t,...n,...r].filter(e=>!i.has(e)))}function LD(e,t,n){let r=e.form.mode===`view`&&t!==void 0&&!n,i=new Set(FD(e)),a=r?[]:e.form.update.filter(t=>i.has(t)||!e.form.layout),o=e.form.header,s=t=>e.fields.find(e=>e.name===t),c=e=>e!==void 0&&t?.[e.name]!==void 0&&t?.[e.name]!==null,l=(o?.badges?o.badges.map(s):e.fields.filter(e=>e.widget===`badge`)).filter(c),u=o?.stepper?s(o.stepper):void 0;u&&c(u)&&u.steps?.exclude.includes(String(t[u.name]))&&!l.includes(u)&&l.push(u);let d=t?._computed??{};return{editable:a,header:{badges:l,subtitle:(o?.subtitle??[]).flatMap(n=>{if(`field`in n){let e=s(n.field);return e&&c(e)?[Nx(t[e.name],e)]:[]}let r=e.list.computed?.[n.computed];if(!r||!d[n.computed])return[];let i=MD(r,d[n.computed]);return i.text?[r.kind===`count`?`${i.text} ${r.label}`:i.text]:[]}),...u?{stepper:u}:{}},aside:e.form.aside??[]}}function RD(e,t,n){return e.relation?n?._aside?.[String(t)]:n}function zD(e,t,n){let r=n?._computed??{};return e.summary.flatMap(e=>{if(`field`in e.value){let r=t.fields.find(t=>t.name===e.value.field),i=n?.[e.value.field];return r&&i!=null?[{label:e.label,text:Nx(i,r)}]:[]}let i=t.list.computed?.[e.value.computed],a=r[e.value.computed];if(!i||!a)return[];let o=MD(i,a),s=o.unit?o.unitPosition===`before`?`${o.unit} ${o.text}`:`${o.text} ${o.unit}`:o.text;return s?[{label:e.label,text:s}]:[]})}function BD(e,t){let n={};for(let r of e){if(!r.warnIf||!(r.name in t))continue;let e=t[r.name];(e==null||typeof e==`string`&&e.trim()===``)&&(n[r.name]=r.warnIf.message)}return n}function VD(e,t){return e.fields.filter(t=>t!==e.order).flatMap(e=>t.fields.filter(t=>t.name===e))}function HD(e,t,n){let r=n?._inlines?.[e.inline],i=VD(e,t);return(r?.rows??[]).map(e=>({key:String(e._id),id:String(e._id),record:e,values:wC(i,e)}))}function UD(e,t,n){return{key:n,values:wC(VD(e,t))}}function WD(e,t){if(!e.record)return new Set;let n=e.record._perm;if(t.permissions?.update===!1||n?.update===!1)return new Set(t.fields.map(e=>e.name));let r=Array.isArray(e.record._readonly)?e.record._readonly:[];return new Set([...t.form.readonly,...r])}function GD(e,t,n,r){let i=VD(e,t),a={},o=[],s=[],c=new Map(n.map(e=>[e.key,e]));for(let e of r){let n=c.get(e.key);if(n?.id!==void 0){let r=WD(e,t),{payload:o,errors:c}=EC(i.filter(e=>!r.has(e.name)),e.values,n.values),l={...dD(o,t.form.constraints.update,`update`),...c};if(Object.keys(l).length>0&&(a[e.key]=l),Object.keys(o).length===0)continue;let u=t.version?n.record?.[t.version]:void 0;s.push({_id:n.id,...o,...typeof u==`number`?{_version:u}:{}})}else{let{payload:n,errors:r}=EC(i,e.values),s={...dD(n,t.form.constraints.create,`create`),...r};Object.keys(s).length>0&&(a[e.key]=s),o.push({_key:e.key,...n})}}let l=new Set(r.map(e=>e.key)),u=n.filter(e=>e.id!==void 0&&!l.has(e.key)).map(e=>e.id),d=e.order!==void 0&&t.form.update.includes(e.order),f=r.map(e=>e.key),p=d&&f.join(`
52
+ `}return f.substring(0,f.length-1)},c.renderTo2dContext=function(e,t){t||=2;let n=c.getModuleCount();for(let r=0;r<n;r++)for(let i=0;i<n;i++)e.fillStyle=c.isDark(r,i)?`black`:`white`,e.fillRect(i*t,r*t,t,t)},c};e_.stringToBytes=function(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);t.push(r&255)}return t},e_.createStringToBytes=function(e,t){let n=function(){let n=h_(e),r=function(){let e=n.read();if(e==-1)throw`eof`;return e},i=0,a={};for(;;){let e=n.read();if(e==-1)break;let t=r(),o=r(),s=r(),c=String.fromCharCode(e<<8|t);a[c]=o<<8|s,i+=1}if(i!=t)throw i+` != `+t;return a}();return function(e){let t=[];for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);if(i<128)t.push(i);else{let i=n[e.charAt(r)];typeof i==`number`?(i&255)==i?t.push(i):(t.push(i>>>8),t.push(i&255)):t.push(63)}}return t}};var t_={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},n_={L:1,M:0,Q:3,H:2},r_={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},i_=function(){let e=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],t=1335,n=7973,r={},i=function(e){let t=0;for(;e!=0;)t+=1,e>>>=1;return t};return r.getBCHTypeInfo=function(e){let n=e<<10;for(;i(n)-i(t)>=0;)n^=t<<i(n)-i(t);return(e<<10|n)^21522},r.getBCHTypeNumber=function(e){let t=e<<12;for(;i(t)-i(n)>=0;)t^=n<<i(t)-i(n);return e<<12|t},r.getPatternPosition=function(t){return e[t-1]},r.getMaskFunction=function(e){switch(e){case r_.PATTERN000:return function(e,t){return(e+t)%2==0};case r_.PATTERN001:return function(e,t){return e%2==0};case r_.PATTERN010:return function(e,t){return t%3==0};case r_.PATTERN011:return function(e,t){return(e+t)%3==0};case r_.PATTERN100:return function(e,t){return(Math.floor(e/2)+Math.floor(t/3))%2==0};case r_.PATTERN101:return function(e,t){return e*t%2+e*t%3==0};case r_.PATTERN110:return function(e,t){return(e*t%2+e*t%3)%2==0};case r_.PATTERN111:return function(e,t){return(e*t%3+(e+t)%2)%2==0};default:throw`bad maskPattern:`+e}},r.getErrorCorrectPolynomial=function(e){let t=o_([1],0);for(let n=0;n<e;n+=1)t=t.multiply(o_([1,a_.gexp(n)],0));return t},r.getLengthInBits=function(e,t){if(1<=t&&t<10)switch(e){case t_.MODE_NUMBER:return 10;case t_.MODE_ALPHA_NUM:return 9;case t_.MODE_8BIT_BYTE:return 8;case t_.MODE_KANJI:return 8;default:throw`mode:`+e}else if(t<27)switch(e){case t_.MODE_NUMBER:return 12;case t_.MODE_ALPHA_NUM:return 11;case t_.MODE_8BIT_BYTE:return 16;case t_.MODE_KANJI:return 10;default:throw`mode:`+e}else if(t<41)switch(e){case t_.MODE_NUMBER:return 14;case t_.MODE_ALPHA_NUM:return 13;case t_.MODE_8BIT_BYTE:return 16;case t_.MODE_KANJI:return 12;default:throw`mode:`+e}else throw`type:`+t},r.getLostPoint=function(e){let t=e.getModuleCount(),n=0;for(let r=0;r<t;r+=1)for(let i=0;i<t;i+=1){let a=0,o=e.isDark(r,i);for(let n=-1;n<=1;n+=1)if(!(r+n<0||t<=r+n))for(let s=-1;s<=1;s+=1)i+s<0||t<=i+s||(n!=0||s!=0)&&o==e.isDark(r+n,i+s)&&(a+=1);a>5&&(n+=3+a-5)}for(let r=0;r<t-1;r+=1)for(let i=0;i<t-1;i+=1){let t=0;e.isDark(r,i)&&(t+=1),e.isDark(r+1,i)&&(t+=1),e.isDark(r,i+1)&&(t+=1),e.isDark(r+1,i+1)&&(t+=1),(t==0||t==4)&&(n+=3)}for(let r=0;r<t;r+=1)for(let i=0;i<t-6;i+=1)e.isDark(r,i)&&!e.isDark(r,i+1)&&e.isDark(r,i+2)&&e.isDark(r,i+3)&&e.isDark(r,i+4)&&!e.isDark(r,i+5)&&e.isDark(r,i+6)&&(n+=40);for(let r=0;r<t;r+=1)for(let i=0;i<t-6;i+=1)e.isDark(i,r)&&!e.isDark(i+1,r)&&e.isDark(i+2,r)&&e.isDark(i+3,r)&&e.isDark(i+4,r)&&!e.isDark(i+5,r)&&e.isDark(i+6,r)&&(n+=40);let r=0;for(let n=0;n<t;n+=1)for(let i=0;i<t;i+=1)e.isDark(i,n)&&(r+=1);let i=Math.abs(100*r/t/t-50)/5;return n+=i*10,n},r}(),a_=function(){let e=Array(256),t=Array(256);for(let t=0;t<8;t+=1)e[t]=1<<t;for(let t=8;t<256;t+=1)e[t]=e[t-4]^e[t-5]^e[t-6]^e[t-8];for(let n=0;n<255;n+=1)t[e[n]]=n;let n={};return n.glog=function(e){if(e<1)throw`glog(`+e+`)`;return t[e]},n.gexp=function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return e[t]},n}(),o_=function(e,t){if(e.length===void 0)throw e.length+`/`+t;let n=function(){let n=0;for(;n<e.length&&e[n]==0;)n+=1;let r=Array(e.length-n+t);for(let t=0;t<e.length-n;t+=1)r[t]=e[t+n];return r}(),r={};return r.getAt=function(e){return n[e]},r.getLength=function(){return n.length},r.multiply=function(e){let t=Array(r.getLength()+e.getLength()-1);for(let n=0;n<r.getLength();n+=1)for(let i=0;i<e.getLength();i+=1)t[n+i]^=a_.gexp(a_.glog(r.getAt(n))+a_.glog(e.getAt(i)));return o_(t,0)},r.mod=function(e){if(r.getLength()-e.getLength()<0)return r;let t=a_.glog(r.getAt(0))-a_.glog(e.getAt(0)),n=Array(r.getLength());for(let e=0;e<r.getLength();e+=1)n[e]=r.getAt(e);for(let r=0;r<e.getLength();r+=1)n[r]^=a_.gexp(a_.glog(e.getAt(r))+t);return o_(n,0).mod(e)},r},s_=function(){let e=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],t=function(e,t){let n={};return n.totalCount=e,n.dataCount=t,n},n={},r=function(t,n){switch(n){case n_.L:return e[(t-1)*4+0];case n_.M:return e[(t-1)*4+1];case n_.Q:return e[(t-1)*4+2];case n_.H:return e[(t-1)*4+3];default:return}};return n.getRSBlocks=function(e,n){let i=r(e,n);if(i===void 0)throw`bad rs block @ typeNumber:`+e+`/errorCorrectionLevel:`+n;let a=i.length/3,o=[];for(let e=0;e<a;e+=1){let n=i[e*3+0],r=i[e*3+1],a=i[e*3+2];for(let e=0;e<n;e+=1)o.push(t(r,a))}return o},n}(),c_=function(){let e=[],t=0,n={};return n.getBuffer=function(){return e},n.getAt=function(t){let n=Math.floor(t/8);return(e[n]>>>7-t%8&1)==1},n.put=function(e,t){for(let r=0;r<t;r+=1)n.putBit((e>>>t-r-1&1)==1)},n.getLengthInBits=function(){return t},n.putBit=function(n){let r=Math.floor(t/8);e.length<=r&&e.push(0),n&&(e[r]|=128>>>t%8),t+=1},n},l_=function(e){let t=t_.MODE_NUMBER,n=e,r={};r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){let t=n,r=0;for(;r+2<t.length;)e.put(i(t.substring(r,r+3)),10),r+=3;r<t.length&&(t.length-r==1?e.put(i(t.substring(r,r+1)),4):t.length-r==2&&e.put(i(t.substring(r,r+2)),7))};let i=function(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*10+a(e.charAt(n));return t},a=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;throw`illegal char :`+e};return r},u_=function(e){let t=t_.MODE_ALPHA_NUM,n=e,r={};r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){let t=n,r=0;for(;r+1<t.length;)e.put(i(t.charAt(r))*45+i(t.charAt(r+1)),11),r+=2;r<t.length&&e.put(i(t.charAt(r)),6)};let i=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;if(`A`<=e&&e<=`Z`)return e.charCodeAt(0)-65+10;switch(e){case` `:return 36;case`$`:return 37;case`%`:return 38;case`*`:return 39;case`+`:return 40;case`-`:return 41;case`.`:return 42;case`/`:return 43;case`:`:return 44;default:throw`illegal char :`+e}};return r},d_=function(e){let t=t_.MODE_8BIT_BYTE,n=e_.stringToBytes(e),r={};return r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){for(let t=0;t<n.length;t+=1)e.put(n[t],8)},r},f_=function(e){let t=t_.MODE_KANJI,n=e_.stringToBytes;(function(e,t){let r=n(e);if(r.length!=2||(r[0]<<8|r[1])!=t)throw`sjis not supported.`})(`友`,38726);let r=n(e),i={};return i.getMode=function(){return t},i.getLength=function(e){return~~(r.length/2)},i.write=function(e){let t=r,n=0;for(;n+1<t.length;){let r=(255&t[n])<<8|255&t[n+1];if(33088<=r&&r<=40956)r-=33088;else if(57408<=r&&r<=60351)r-=49472;else throw`illegal char at `+(n+1)+`/`+r;r=(r>>>8&255)*192+(r&255),e.put(r,13),n+=2}if(n<t.length)throw`illegal char at `+(n+1)},i},p_=function(){let e=[],t={};return t.writeByte=function(t){e.push(t&255)},t.writeShort=function(e){t.writeByte(e),t.writeByte(e>>>8)},t.writeBytes=function(e,n,r){n||=0,r||=e.length;for(let i=0;i<r;i+=1)t.writeByte(e[i+n])},t.writeString=function(e){for(let n=0;n<e.length;n+=1)t.writeByte(e.charCodeAt(n))},t.toByteArray=function(){return e},t.toString=function(){let t=``;t+=`[`;for(let n=0;n<e.length;n+=1)n>0&&(t+=`,`),t+=e[n];return t+=`]`,t},t},m_=function(){let e=0,t=0,n=0,r=``,i={},a=function(e){r+=String.fromCharCode(o(e&63))},o=function(e){if(e<0)throw`n:`+e;if(e<26)return 65+e;if(e<52)return 97+(e-26);if(e<62)return 48+(e-52);if(e==62)return 43;if(e==63)return 47;throw`n:`+e};return i.writeByte=function(r){for(e=e<<8|r&255,t+=8,n+=1;t>=6;)a(e>>>t-6),t-=6},i.flush=function(){if(t>0&&(a(e<<6-t),e=0,t=0),n%3!=0){let e=3-n%3;for(let t=0;t<e;t+=1)r+=`=`}},i.toString=function(){return r},i},h_=function(e){let t=e,n=0,r=0,i=0,a={};a.read=function(){for(;i<8;){if(n>=t.length){if(i==0)return-1;throw`unexpected end of file./`+i}let e=t.charAt(n);if(n+=1,e==`=`)return i=0,-1;e.match(/^\s$/)||(r=r<<6|o(e.charCodeAt(0)),i+=6)}let e=r>>>i-8&255;return i-=8,e};let o=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(e==43)return 62;if(e==47)return 63;throw`c:`+e};return a},g_=function(e,t){let n=e,r=t,i=Array(e*t),a={};a.setPixel=function(e,t,r){i[t*n+e]=r},a.write=function(e){e.writeString(`GIF87a`),e.writeShort(n),e.writeShort(r),e.writeByte(128),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(255),e.writeByte(255),e.writeByte(255),e.writeString(`,`),e.writeShort(0),e.writeShort(0),e.writeShort(n),e.writeShort(r),e.writeByte(0);let t=s(2);e.writeByte(2);let i=0;for(;t.length-i>255;)e.writeByte(255),e.writeBytes(t,i,255),i+=255;e.writeByte(t.length-i),e.writeBytes(t,i,t.length-i),e.writeByte(0),e.writeString(`;`)};let o=function(e){let t=e,n=0,r=0,i={};return i.write=function(e,i){if(e>>>i)throw`length over`;for(;n+i>=8;)t.writeByte(255&(e<<n|r)),i-=8-n,e>>>=8-n,r=0,n=0;r=e<<n|r,n+=i},i.flush=function(){n>0&&t.writeByte(r)},i},s=function(e){let t=1<<e,n=(1<<e)+1,r=e+1,a=c();for(let e=0;e<t;e+=1)a.add(String.fromCharCode(e));a.add(String.fromCharCode(t)),a.add(String.fromCharCode(n));let s=p_(),l=o(s);l.write(t,r);let u=0,d=String.fromCharCode(i[u]);for(u+=1;u<i.length;){let e=String.fromCharCode(i[u]);u+=1,a.contains(d+e)?d+=e:(l.write(a.indexOf(d),r),a.size()<4095&&(a.size()==1<<r&&(r+=1),a.add(d+e)),d=e)}return l.write(a.indexOf(d),r),l.write(n,r),l.flush(),s.toByteArray()},c=function(){let e={},t=0,n={};return n.add=function(r){if(n.contains(r))throw`dup key:`+r;e[r]=t,t+=1},n.size=function(){return t},n.indexOf=function(t){return e[t]},n.contains=function(t){return e[t]!==void 0},n};return a},__=function(e,t,n){let r=g_(e,t);for(let i=0;i<t;i+=1)for(let t=0;t<e;t+=1)r.setPixel(t,i,n(t,i));let i=p_();r.write(i);let a=m_(),o=i.toByteArray();for(let e=0;e<o.length;e+=1)a.writeByte(o[e]);return a.flush(),`data:image/gif;base64,`+a};e_.stringToBytes;function v_({text:e,label:t}){let{size:n,path:r}=(0,y.useMemo)(()=>{let t=e_(0,`M`);t.addData(e),t.make();let n=t.getModuleCount(),r=``;for(let e=0;e<n;e++)for(let i=0;i<n;i++)t.isDark(e,i)&&(r+=`M${i} ${e}h1v1h-1z`);return{size:n,path:r}},[e]);return(0,b.jsx)(`svg`,{viewBox:`-3 -3 ${n+6} ${n+6}`,role:`img`,"aria-label":t,className:`size-44 rounded-md bg-white`,shapeRendering:`crispEdges`,children:(0,b.jsx)(`path`,{d:r,fill:`#000`})})}function y_(){let{t:e}=Y(),t=Gg();if(t.isPending)return(0,b.jsx)(G,{children:e(`common.loading`)});if(!t.data)return null;if(t.data.viewAs)return(0,b.jsx)(Da,{to:`/`,replace:!0});let{user:n,auth:r}=t.data;return(0,b.jsxs)(`div`,{className:`flex max-w-2xl flex-col gap-8`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:e(`auth.account`)}),(0,b.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[n.displayName,n.username?` · ${n.username}`:``]})]}),r.password&&(0,b.jsx)(b_,{}),r.twoFactor&&(0,b.jsx)(x_,{}),r.sessions&&(0,b.jsx)(C_,{revokeOthers:r.revokeOthers})]})}function b_(){let{t:e}=Y(),t=S(),[n,r]=(0,y.useState)(``),[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)({}),[u,d]=(0,y.useState)(!1),f=pt({mutationFn:()=>Q.changePassword(n,i),onSuccess:async()=>{r(``),a(``),s(``),l({}),d(!0),await t.invalidateQueries({queryKey:[`account-sessions`]})},onError:e=>l(e instanceof fg&&Object.keys(e.fields).length>0?e.fields:{form:[pg(e)]})});function p(t){t.preventDefault(),d(!1);let r={};n||(r.current=[e(`validation.required`)]),i?i!==o&&(r.confirm=[e(`auth.mismatch`)]):r.next=[e(`validation.required`)],l(r),Object.keys(r).length===0&&f.mutate()}let m=(e,t,n,r,i)=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`password-${e}`,children:t}),(0,b.jsx)(Oh,{id:`password-${e}`,type:`password`,autoComplete:i,value:n,onChange:e=>r(e.target.value),"aria-invalid":c[e]?!0:void 0,"aria-describedby":c[e]?`password-${e}-error`:void 0}),c[e]&&(0,b.jsx)(`p`,{id:`password-${e}-error`,className:`text-sm text-destructive`,children:c[e].join(` `)})]});return(0,b.jsxs)(`section`,{"aria-labelledby":`password-title`,className:`flex flex-col gap-4 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsx)(`h2`,{id:`password-title`,className:`font-medium`,children:e(`auth.changePassword`)}),(0,b.jsxs)(`form`,{onSubmit:p,noValidate:!0,className:`flex flex-col gap-4`,children:[c.form&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:c.form.join(` `)}),u&&(0,b.jsx)(`p`,{role:`status`,className:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:e(`auth.passwordChanged`)}),m(`current`,e(`auth.currentPassword`),n,r,`current-password`),m(`next`,e(`auth.newPassword`),i,a,`new-password`),m(`confirm`,e(`auth.confirmPassword`),o,s,`new-password`),(0,b.jsx)(`div`,{children:(0,b.jsx)(q,{type:`submit`,disabled:f.isPending,children:e(`auth.changePassword`)})})]})]})}function x_(){let{t:e}=Y(),t=S(),n=ft({queryKey:[`account-2fa`],queryFn:Q.twoFactor.status}),[r,i]=(0,y.useState)(``),[a,o]=(0,y.useState)(``),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(!1),[d,f]=(0,y.useState)(null),[p,m]=(0,y.useState)(null),h=e=>m(e instanceof fg&&Object.keys(e.fields).length>0?Object.values(e.fields).flat().join(` `):pg(e)),g=async()=>{await t.invalidateQueries({queryKey:[`account-2fa`]}),await t.invalidateQueries({queryKey:[`account-sessions`]})},_=pt({mutationFn:Q.twoFactor.setup,onMutate:()=>m(null),onError:h}),v=pt({mutationFn:()=>Q.twoFactor.confirm(r.trim()),onMutate:()=>m(null),onSuccess:async t=>{c(t.recoveryCodes),i(``),_.reset(),f(e(`twoFactor.enabledNote`)),await g()},onError:h}),x=pt({mutationFn:()=>Q.twoFactor.recoveryCodes(a),onMutate:()=>m(null),onSuccess:async e=>{c(e.recoveryCodes),o(``),await g()},onError:h}),C=pt({mutationFn:()=>Q.twoFactor.disable(a),onMutate:()=>m(null),onSuccess:async()=>{o(``),c(null),f(e(`twoFactor.disabledNote`)),await g()},onError:h}),w=n.data?.enabled===!0,T=_.data;return(0,b.jsxs)(`section`,{"aria-labelledby":`two-factor-title`,className:`flex flex-col gap-3 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`h2`,{id:`two-factor-title`,className:`font-medium`,children:e(`twoFactor.title`)}),n.data&&(0,b.jsx)(`span`,{className:w?`rounded-full bg-green-500/15 px-2 py-0.5 text-xs text-green-800 dark:text-green-300`:`rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground`,children:e(w?`twoFactor.on`:`twoFactor.off`)})]}),p&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:p}),d&&!p&&(0,b.jsx)(`p`,{role:`status`,className:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:d}),s&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border bg-muted/40 p-3`,children:[(0,b.jsx)(`h3`,{className:`text-sm font-medium`,children:e(`twoFactor.recoveryTitle`)}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`twoFactor.recoveryIntro`)}),(0,b.jsx)(`ul`,{"aria-label":e(`twoFactor.recoveryTitle`),dir:`ltr`,className:`grid grid-cols-2 gap-1 font-mono text-sm`,children:s.map(e=>(0,b.jsx)(`li`,{children:e},e))}),(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{navigator.clipboard?.writeText(s.join(`
53
+ `)).then(()=>u(!0),()=>void 0)},children:e(l?`twoFactor.copied`:`twoFactor.copy`)}),(0,b.jsx)(q,{type:`button`,size:`sm`,onClick:()=>{c(null),u(!1)},children:e(`twoFactor.done`)})]})]}),n.data&&!w&&!T&&(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`twoFactor.intro`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:_.isPending,onClick:()=>_.mutate(),children:e(`twoFactor.setUp`)})]}),!w&&T&&(0,b.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),r.trim()&&v.mutate()},children:[(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`twoFactor.scan`)}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,b.jsx)(v_,{text:T.otpauthUrl,label:e(`twoFactor.qr`)}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 text-sm`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e(`twoFactor.key`)}),(0,b.jsx)(`code`,{dir:`ltr`,"data-testid":`two-factor-key`,className:`break-all font-mono`,children:T.secret.match(/.{1,4}/g).join(` `)})]})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`two-factor-code`,children:e(`twoFactor.code`)}),(0,b.jsx)(Oh,{id:`two-factor-code`,autoComplete:`one-time-code`,inputMode:`numeric`,dir:`ltr`,maxLength:10,value:r,onChange:e=>i(e.target.value)})]}),(0,b.jsx)(q,{type:`submit`,disabled:v.isPending||!r.trim(),children:e(`twoFactor.turnOn`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>_.reset(),children:e(`common.cancel`)})]})]}),w&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`twoFactor.left`,{count:n.data.recoveryCodesLeft})}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`two-factor-password`,children:e(`twoFactor.password`)}),(0,b.jsx)(Oh,{id:`two-factor-password`,type:`password`,autoComplete:`current-password`,value:a,onChange:e=>o(e.target.value)})]}),(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:!a||x.isPending,onClick:()=>x.mutate(),children:e(`twoFactor.newCodes`)}),(0,b.jsx)(q,{type:`button`,variant:`destructive`,disabled:!a||C.isPending,onClick:()=>C.mutate(),children:e(`twoFactor.turnOff`)})]})]})]})}function S_(e,t){return e?[/Edg\//.test(e)?`Edge`:/Firefox\//.test(e)?`Firefox`:/Chrome\//.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:void 0,/Android/.test(e)?`Android`:/iPhone|iPad/.test(e)?`iOS`:/Mac OS X/.test(e)?`macOS`:/Windows/.test(e)?`Windows`:/Linux/.test(e)?`Linux`:void 0].filter(Boolean).join(` · `)||e.slice(0,40):t}function C_({revokeOthers:e}){let{t}=Y(),n=S(),r=ft({queryKey:[`account-sessions`],queryFn:Q.sessions}),i=()=>n.invalidateQueries({queryKey:[`account-sessions`]}),a=pt({mutationFn:e=>Q.revokeSession(e),onSuccess:i}),o=pt({mutationFn:()=>Q.revokeOtherSessions(),onSuccess:i}),s=r.data?.items??[],c=a.error??o.error??r.error;return(0,b.jsxs)(`section`,{"aria-labelledby":`sessions-title`,className:`flex flex-col gap-3 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`h2`,{id:`sessions-title`,className:`font-medium`,children:t(`auth.sessions`)}),e&&s.length>1&&(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(),children:t(`auth.signOutOthers`)})]}),c&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:pg(c)}),(0,b.jsx)(`ul`,{"aria-label":t(`auth.sessions`),className:`flex flex-col divide-y`,children:s.map(e=>(0,b.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 py-2 text-sm`,children:[(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,b.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,title:e.userAgent,children:[S_(e.userAgent,t(`auth.unknownDevice`)),e.current&&(0,b.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs text-primary`,children:t(`auth.thisDevice`)})]}),(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[t(`auth.lastSeen`,{when:ng(new Date(e.lastSeenAt))}),e.ip?` · ${e.ip}`:``]})]}),!e.current&&(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(e.id),"aria-label":t(`auth.revokeSession`,{name:S_(e.userAgent,t(`auth.unknownDevice`))}),children:t(`auth.revoke`)})]},e.id))})]})}function w_(e,t){return e==null?``:typeof e==`string`?e:e[t]??e[dg.locale]??Object.values(e)[0]??``}function T_(e){let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e.trim()!==``).map(([e,t])=>[e,t.trim()])),n=Object.keys(t);if(n.length!==0)return dg.locales.length===1?t[n[0]]:t}function E_(e){let t=Object.fromEntries(dg.locales.map(e=>[e,``]));return typeof e==`string`?t[dg.locale]=e:e&&Object.assign(t,e),t}function D_({children:e,actions:t}){return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:e}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t})]})}function O_({children:e,tone:t=`error`}){return(0,b.jsx)(`p`,{role:t===`error`?`alert`:`status`,className:t===`error`?`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:e})}var k_=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function A_(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:k_(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var j_=e=>{let t=``,n=!1;for(let r of e){if(r===`-`||r===`_`||r<=` `){n=t.length>0;continue}t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1}return t},M_=e=>{let t=j_(e);return t.charAt(0).toUpperCase()+t.slice(1)},N_=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),P_={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function F_(e){return e!=null}function I_(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??P_.width,a=e.size??e.height??P_.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?N_(...c):N_(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??P_[`stroke-width`])*Number(e.size??e.width??P_.width)/Number(t.size??t.width??P_.width):t.strokeWidth??P_[`stroke-width`];return[`svg`,{...Object.entries(P_).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&F_(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&F_(t.width)&&{[r(`width`)]:t.width},...`height`in t&&F_(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function L_(e,t={}){return I_(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var R_=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},z_=(0,y.createContext)({}),B_=()=>(0,y.useContext)(z_),V_=(0,y.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=B_()??{},b=!!c||R_(d),[x,S,C=[]]=L_(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:N_(v,s),hasA11yProp:b,attributes:d});return(0,y.createElement)(x,{ref:f,...S},[...C.map(([e,t])=>(0,y.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function $(e,t=[],n=[]){let r=typeof e==`string`?A_(e,t,n):e,i=(0,y.forwardRef)(({className:e,...t},n)=>(0,y.createElement)(V_,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=M_(r.name)),i}var H_={name:`archive`,size:24,node:[[`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`}]]};H_.node;var U_=$(H_),W_={name:`arrow-down-up`,size:24,node:[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`m21 8-4-4-4 4`,key:`1c9v7m`}],[`path`,{d:`M17 4v16`,key:`7dpous`}]]};W_.node;var G_=$(W_),K_={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};K_.node;var q_=$(K_),J_={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};J_.node;var Y_=$(J_),X_={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};X_.node;var Z_=$(X_),Q_={name:`ban`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]};Q_.node;var $_=$(Q_),ev={name:`bell`,size:24,node:[[`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`}]]};ev.node;var tv=$(ev),nv={name:`book-open`,size:24,node:[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]};nv.node;var rv=$(nv),iv={name:`box`,size:24,node:[[`path`,{d:`M21 8a2 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]};iv.node;var av=$(iv),ov={name:`boxes`,size:24,node:[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]};ov.node;var sv=$(ov),cv={name:`briefcase`,size:24,node:[[`path`,{d:`M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16`,key:`jecpp`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]};cv.node;var lv=$(cv),uv={name:`building-complex`,size:24,node:[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]],aliases:[`building-2`]};uv.node;var dv=$(uv),fv={name:`calendar-days`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 13h.01`,key:`1sbv64`}],[`path`,{d:`M12 13h.01`,key:`y0uutt`}],[`path`,{d:`M16 13h.01`,key:`wip0gl`}],[`path`,{d:`M8 17h.01`,key:`p3bg7i`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M16 17h.01`,key:`ql8jdd`}]]};fv.node;var pv=$(fv),mv={name:`calendar-range`,size:24,node:[[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M17 13h-6`,key:`1qbiup`}],[`path`,{d:`M13 17H7`,key:`1x38vv`}],[`path`,{d:`M7 13h.01`,key:`1vezk1`}],[`path`,{d:`M17 17h.01`,key:`1sd3ek`}]]};mv.node;var hv=$(mv),gv={name:`calendar`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};gv.node;var _v=$(gv),vv={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};vv.node;var yv=$(vv),bv={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};bv.node;var xv=$(bv),Sv={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};Sv.node;var Cv=$(Sv),wv={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};wv.node;var Tv=$(wv),Ev={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Ev.node;var Dv=$(Ev),Ov={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};Ov.node;var kv=$(Ov),Av={name:`circle-plus`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]],aliases:[`plus-circle`]};Av.node;var jv=$(Av),Mv={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};Mv.node;var Nv=$(Mv),Pv={name:`columns-3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]],aliases:[`panels-left-right`]};Pv.node;var Fv=$(Pv),Iv={name:`copy`,size:24,node:[[`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`}]]};Iv.node;var Lv=$(Iv),Rv={name:`credit-card`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}],[`path`,{d:`M6 14h2`,key:`mk7k0u`}]]};Rv.node;var zv=$(Rv),Bv={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};Bv.node;var Vv=$(Bv),Hv={name:`dollar-sign`,size:24,node:[[`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`}]]};Hv.node;var Uv=$(Hv),Wv={name:`download`,size:24,node:[[`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`}]]};Wv.node;var Gv=$(Wv),Kv={name:`ellipsis-vertical`,size:24,node:[[`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`}]],aliases:[`more-vertical`]};Kv.node;var qv=$(Kv),Jv={name:`ellipsis`,size:24,node:[[`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`}]],aliases:[`more-horizontal`]};Jv.node;var Yv=$(Jv),Xv={name:`external-link`,size:24,node:[[`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`}]]};Xv.node;var Zv=$(Xv),Qv={name:`eye`,size:24,node:[[`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`}]]};Qv.node;var $v=$(Qv),ey={name:`file-spreadsheet`,size:24,node:[[`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:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};ey.node;var ty=$(ey),ny={name:`file-text`,size:24,node:[[`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`}]]};ny.node;var ry=$(ny),iy={name:`file`,size:24,node:[[`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`}]]};iy.node;var ay=$(iy),oy={name:`folder`,size:24,node:[[`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`}]]};oy.node;var sy=$(oy),cy={name:`globe`,size:24,node:[[`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`}]]};cy.node;var ly=$(cy),uy={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};uy.node;var dy=$(uy),fy={name:`heart`,size:24,node:[[`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`}]]};fy.node;var py=$(fy),my={name:`house`,size:24,node:[[`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`}]],aliases:[`home`]};my.node;var hy=$(my),gy={name:`image-off`,size:24,node:[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]};gy.node;var _y=$(gy),vy={name:`image`,size:24,node:[[`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`}]]};vy.node;var yy=$(vy),by={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};by.node;var xy=$(by),Sy={name:`key`,size:24,node:[[`path`,{d:`m2 21 9.6-9.6`,key:`9l79m3`}],[`path`,{d:`m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19`,key:`fw8biw`}],[`circle`,{cx:`15.5`,cy:`7.5`,r:`5.5`,key:`4wxmhb`}]]};Sy.node;var Cy=$(Sy),wy={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};wy.node;var Ty=$(wy),Ey={name:`layers`,size:24,node:[[`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`}]],aliases:[`layers-3`]};Ey.node;var Dy=$(Ey),Oy={name:`layout-dashboard`,size:24,node:[[`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`}]]};Oy.node;var ky=$(Oy),Ay={name:`link`,size:24,node:[[`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`}]]};Ay.node;var jy=$(Ay),My={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};My.node;var Ny=$(My),Py={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};Py.node;var Fy=$(Py),Iy={name:`list`,size:24,node:[[`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`}]]};Iy.node;var Ly=$(Iy),Ry={name:`lock`,size:24,node:[[`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`}]]};Ry.node;var zy=$(Ry),By={name:`log-out`,size:24,node:[[`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`}]]};By.node;var Vy=$(By),Hy={name:`mail`,size:24,node:[[`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`}]]};Hy.node;var Uy=$(Hy),Wy={name:`map-pin`,size:24,node:[[`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`}]]};Wy.node;var Gy=$(Wy),Ky={name:`map`,size:24,node:[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]};Ky.node;var qy=$(Ky),Jy={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};Jy.node;var Yy=$(Jy),Xy={name:`message-square`,size:24,node:[[`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`}]]};Xy.node;var Zy=$(Xy),Qy={name:`monitor`,size:24,node:[[`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`}]]};Qy.node;var $y=$(Qy),eb={name:`moon`,size:24,node:[[`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`}]]};eb.node;var tb=$(eb),nb={name:`package`,size:24,node:[[`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`}]]};nb.node;var rb=$(nb),ib={name:`panel-right`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]};ib.node;var ab=$(ib),ob={name:`pencil`,size:24,node:[[`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`}]]};ob.node;var sb=$(ob),cb={name:`phone`,size:24,node:[[`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`}]]};cb.node;var lb=$(cb),ub={name:`pin-off`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]};ub.node;var db=$(ub),fb={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]};fb.node;var pb=$(fb),mb={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};mb.node;var hb=$(mb),gb={name:`printer`,size:24,node:[[`path`,{d:`M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`,key:`143wyd`}],[`path`,{d:`M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6`,key:`1itne7`}],[`rect`,{x:`6`,y:`14`,width:`12`,height:`8`,rx:`1`,key:`1ue0tg`}]]};gb.node;var _b=$(gb),vb={name:`receipt`,size:24,node:[[`path`,{d:`M12 17V7`,key:`pyj7ub`}],[`path`,{d:`M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8`,key:`1elt7d`}],[`path`,{d:`M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z`,key:`ycz6yz`}]]};vb.node;var yb=$(vb),bb={name:`refresh-cw`,size:24,node:[[`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`}]]};bb.node;var xb=$(bb),Sb={name:`rotate-ccw-clock`,size:24,node:[[`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`}]],aliases:[`history`]};Sb.node;var Cb=$(Sb),wb={name:`rotate-ccw`,size:24,node:[[`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`}]]};wb.node;var Tb=$(wb),Eb={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Eb.node;var Db=$(Eb),Ob={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};Ob.node;var kb=$(Ob),Ab={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};Ab.node;var jb=$(Ab),Mb={name:`settings`,size:24,node:[[`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`}]]};Mb.node;var Nb=$(Mb),Pb={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};Pb.node;var Fb=$(Pb),Ib={name:`shield`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]};Ib.node;var Lb=$(Ib),Rb={name:`shopping-bag`,size:24,node:[[`path`,{d:`M16 10a4 4 0 0 1-8 0`,key:`1ltviw`}],[`path`,{d:`M3.103 6.034h17.794`,key:`awc11p`}],[`path`,{d:`M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z`,key:`o988cm`}]]};Rb.node;var zb=$(Rb),Bb={name:`shopping-cart`,size:24,node:[[`path`,{d:`m2.05 2.05 1.099-.028a1 1 0 0 1 1.008.815l2.69 14.347A1 1 0 0 0 7.83 18H18`,key:`uebgi3`}],[`path`,{d:`M4.563 5h16.435a1 1 0 0 1 .981 1.204l-1.026 6.226A2 2 0 0 1 18.962 14H6.25`,key:`1j7c9p`}],[`circle`,{cx:`18`,cy:`20`,r:`2`,key:`t9985n`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]};Bb.node;var Vb=$(Bb),Hb={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};Hb.node;var Ub=$(Hb),Wb={name:`star`,size:24,node:[[`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`}]]};Wb.node;var Gb=$(Wb),Kb={name:`store`,size:24,node:[[`path`,{d:`M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5`,key:`slp6dd`}],[`path`,{d:`M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244`,key:`o0xfot`}],[`path`,{d:`M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05`,key:`wn3emo`}]]};Kb.node;var qb=$(Kb),Jb={name:`sun`,size:24,node:[[`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`}]]};Jb.node;var Yb=$(Jb),Xb={name:`tag`,size:24,node:[[`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`}]]};Xb.node;var Zb=$(Xb),Qb={name:`tags`,size:24,node:[[`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`}]]};Qb.node;var $b=$(Qb),ex={name:`ticket`,size:24,node:[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]};ex.node;var tx=$(ex),nx={name:`trash`,size:24,node:[[`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`}]],aliases:[`trash-2`]};nx.node;var rx=$(nx),ix={name:`triangle-alert`,size:24,node:[[`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`}]],aliases:[`alert-triangle`]};ix.node;var ax=$(ix),ox={name:`truck`,size:24,node:[[`path`,{d:`M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2`,key:`wrbu53`}],[`path`,{d:`M15 18H9`,key:`1lyqi6`}],[`path`,{d:`M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14`,key:`lysw3i`}],[`circle`,{cx:`17`,cy:`18`,r:`2`,key:`332jqn`}],[`circle`,{cx:`7`,cy:`18`,r:`2`,key:`19iecd`}]]};ox.node;var sx=$(ox),cx={name:`upload`,size:24,node:[[`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`}]]};cx.node;var lx=$(cx),ux={name:`user-round`,size:24,node:[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]],aliases:[`user-2`]};ux.node;var dx=$(ux),fx={name:`user`,size:24,node:[[`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`}]]};fx.node;var px=$(fx),mx={name:`users`,size:24,node:[[`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`}]]};mx.node;var hx=$(mx),gx={name:`video`,size:24,node:[[`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`}]]};gx.node;var _x=$(gx),vx={name:`wallet`,size:24,node:[[`path`,{d:`M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1`,key:`18etb6`}],[`path`,{d:`M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4`,key:`xoc0q4`}]]};vx.node;var yx=$(vx),bx={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};bx.node;var xx=$(bx),Sx={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};Sx.node;var Cx=$(Sx),wx={name:`zap`,size:24,node:[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]};wx.node;var Tx=$(wx),Ex=/^(-?)(\d+)(?:\.(\d*))?$/,Dx=/^-?\d{1,3}(,\d{3})+(\.\d*)?$/;function Ox(e,t){let n=Nh(e).trim(),r=Ex.exec(Dx.test(n)?n.replace(/,/g,``):n);if(!r)return e;let[,i,a,o]=r,s=a.replace(/^0+(?=\d)/,``).replace(/\B(?=(\d{3})+$)/g,`,`),c=t===void 0?o??``:(o??``).padEnd(t,`0`);return`${i}${s}${c?`.${c}`:``}`}var kx;function Ax(e){kx=e}function jx(){if(!kx)return;let{unit:e,position:t}=kx,n=Yh(),r=typeof e==`string`?e:e[n]??e[n.split(`-`)[0]]??Object.values(e)[0];return r?{unit:r,position:t}:void 0}function Mx(e,t={}){let n=t.currency??jx(),r=e=>tg(Ox(e,t.scale));return{main:r(e),...n?{unit:n.unit,position:n.position}:{},...t.previous===void 0?{}:{previous:r(t.previous)}}}function Nx(e){return e.unit?e.position===`before`?`${e.unit} ${e.main}`:`${e.main} ${e.unit}`:e.main}function Px(e,t){if(e==null)return`—`;if(t.type===`relation`){let t=Array.isArray(e)?e:[e];return t.length===0?`—`:t.map(e=>String(e.title)).join(`, `)}if(t.file)return(Array.isArray(e)?e:[e]).map(e=>String(e).split(`/`).pop()).join(`, `)||`—`;if(t.widget===`richtext`)return Ix(String(e))||`—`;if(t.type===`boolean`)return J(e?`common.yes`:`common.no`);if(t.type===`enum`)return t.enumLabels?.[String(e)]??String(e);if(t.widget===`money`)return Nx(Mx(String(e),{currency:t.currency,scale:t.scale}));if(t.type===`number`||t.type===`decimal`||t.type===`bigint`)return tg(String(e));if(t.type===`date`)return ig(String(e));if(t.type===`json`||t.type===`object`)return JSON.stringify(e);if(t.type===`datetime`){let t=new Date(String(e));return Number.isNaN(t.getTime())?String(e):ng(t)}return String(e)}var Fx={amp:`&`,lt:`<`,gt:`>`,quot:`"`,"#39":`'`,nbsp:` `};function Ix(e,t=120){let n=e.replace(/<[^>]*>/g,` `).replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(e,t)=>Fx[t]).replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t).trimEnd()}…`:n}function Lx(e,t){let n=e?.groups??[];return{resource:e=>t(e)?.label??n.flatMap(e=>e.resources).find(t=>t.name===e)?.label,page:e=>n.flatMap(e=>e.pages).find(t=>t.name===e)?.label,action:(e,n)=>t(e)?.actions?.find(e=>e.name===n)?.label,softDelete:e=>t(e)?.softDelete}}var Rx={created:`audit.event.created`,updated:`audit.event.updated`,deleted:`audit.event.deleted`,restored:`audit.event.restored`,purged:`audit.event.purged`},zx={"auth.login":`audit.event.login`,"auth.logout":`audit.event.logout`,"auth.view_as":`audit.event.viewAs`,"auth.password_changed":`audit.event.passwordChanged`,"auth.two_factor_enabled":`audit.event.twoFactorEnabled`,"auth.two_factor_disabled":`audit.event.twoFactorDisabled`,"auth.recovery_codes_regenerated":`audit.event.recoveryCodes`,"rbac.role.changed":`audit.event.roleChanged`,"rbac.group.changed":`audit.event.groupChanged`,"rbac.user_roles.changed":`audit.event.userRolesChanged`,"rbac.user.created":`audit.event.userCreated`,"rbac.user.changed":`audit.event.userChanged`,"rbac.user.password_reset":`audit.event.passwordReset`,"rbac.user.two_factor_reset":`audit.event.twoFactorReset`},Bx={WRONG_CODE:`audit.event.loginFailedCode`,RATE_LIMITED:`audit.event.loginFailedLimited`};function Vx(e){return e.event.startsWith(`*.`)||e.event.startsWith(`page.*.`)}function Hx(e){return e.resource!==void 0&&e.event.startsWith(`${e.resource}.`)?e.event.slice(e.resource.length+1):void 0}var Ux=/^page\.(.+)\.updated$/;function Wx(e,t={}){if(Vx(e))return J(`audit.event.unseen`);let n=Hx(e);if(n!==void 0){if(n.startsWith(`action.`)&&n.length>7){let r=n.slice(7);return J(`audit.event.action`,{action:t.action?.(e.resource,r)??r})}if(n===`deleted`&&t.softDelete?.(e.resource))return J(`audit.event.trashed`);let r=Rx[n];return r?J(r):e.event}let r=Ux.exec(e.event)?.[1];if(r!==void 0)return J(`audit.event.page`,{page:t.page?.(r)??r});if(e.event===`auth.login_failed`){let t=e.meta?.reason;return t===`SUPPRESSED`?J(`audit.event.loginFailedMore`,{count:e.meta?.suppressed??0}):J(t&&Bx[t]||`audit.event.loginFailed`)}if(e.event===`auth.sessions_revoked`){let t=e.meta?.sessions;return J(t===`others`?`audit.event.sessionsOthers`:t===`one`?`audit.event.sessionsOne`:`audit.event.sessions`)}let i=zx[e.event];return i?J(i):e.event}function Gx(e){if(e.event===`auth.login_failed`){if(e.meta?.reason===`SUPPRESSED`)return J(`audit.suppressedNote`);if(e.meta?.limited)return J(`audit.limitedNote`)}if(e.meta?.action!==void 0&&e.meta.deleted)return J(`audit.actionDeleted`)}function Kx(e,t={}){if(!Vx(e)){if(e.resource!==void 0){let n=t.resource?.(e.resource)??e.resource;return e.recordId===void 0?n:e.recordTitle!==void 0&&e.recordTitle!==``?`${n}: ${e.recordTitle}`:`${n} #${e.recordId}`}if(e.recordTitle!==void 0&&e.recordTitle!==``)return e.recordTitle;if(e.recordId!==void 0)return e.recordId;if(e.event===`auth.login_failed`&&e.meta?.username)return e.meta.username}}function qx(e){if(e.restricted&&!Vx(e))return J(e.resource===void 0?`audit.restrictedChanges`:`audit.restrictedRecord`)}function Jx(e,t,n){let r={field:e.field,label:t?.label??e.field};if(`hidden`in e&&e.hidden)return{...r,state:`hidden`,truncated:!1};if(`changed`in e&&e.changed)return{...r,state:`changed`,truncated:!1};let i=e,a=i.truncated===!0;return a&&!(`before`in i)&&!(`after`in i)?{...r,state:`dropped`,truncated:a}:{...r,state:`values`,before:`before`in i&&i.before!==void 0?Qx(i.before,t,n):void 0,after:`after`in i&&i.after!==void 0?Qx(i.after,t,n):void 0,truncated:a}}var Yx=`—`,Xx=1e5;function Zx(e){return e==null||e===``?Yx:typeof e==`boolean`?J(e?`common.yes`:`common.no`):typeof e==`string`?e:Array.isArray(e)?e.length===0?Yx:e.every(e=>typeof e!=`object`||!e)?e.map(String).join(`, `):JSON.stringify(e):typeof e==`object`?JSON.stringify(e):String(e)}function Qx(e,t,n){if(e==null||e===``)return Yx;if(!t)return Zx(e);if(t.type===`relation`){let t=Array.isArray(e)?e:[e],r=e=>typeof e==`object`&&e?e.id:e;if(t.some(e=>![`string`,`number`,`bigint`].includes(typeof r(e))))return Zx(e);let i=t.map(e=>String(r(e)));return i.length===0?Yx:i.map(e=>{let t=n?.(e);return t!==void 0&&t!==``&&t!==`#${e}`?`${t} (#${e})`:`#${e}`}).join(`, `)}return t.file?typeof e==`string`||Array.isArray(e)?Px(e,t):Zx(e):t.type===`json`||t.type===`object`?typeof e==`string`?e:JSON.stringify(e):typeof e==`object`?Zx(e):t.widget===`richtext`?Ix(String(e),Xx)||Yx:Px(e,t)}var $x=[`actor`,`event`,`resource`,`record`,`from`,`to`],eS=/^(\d{4})-(\d{2})-(\d{2})$/;function tS(e,t){let n=eS.exec(e);if(!n)return e;let[r,i,a]=[Number(n[1]),Number(n[2]),Number(n[3])],o=t?new Date(r,i-1,a,23,59,59,999):new Date(r,i-1,a,0,0,0,0);return o.getFullYear()===r&&o.getMonth()===i-1&&o.getDate()===a?o.toISOString():e}function nS(e){let t=new URLSearchParams;for(let n of $x){let r=e.get(n);r!==null&&r!==``&&(n!==`record`||e.get(`resource`))&&t.set(n,n===`from`?tS(r,!1):n===`to`?tS(r,!0):r)}return t.sort(),t.toString()}function rS(e){return nS(e)!==``}function iS(e,t){let n=t.trim();return e===`resource`?{resource:n||null,record:null}:{[e]:n||null}}function aS(){return Object.fromEntries($x.map(e=>[e,null]))}function oS({entries:e,now:t,names:n,schemaOf:r,pageFieldsOf:i,titleOf:a,onActor:o,showSubject:s=!1}){let{t:c}=Y();return(0,b.jsx)(`ol`,{"aria-label":c(`audit.entries`),className:`flex flex-col divide-y rounded-card border bg-card shadow-card`,children:e.map(e=>(0,b.jsx)(cS,{entry:e,now:t,names:n,schema:e.resource===void 0?void 0:r(e.resource),pageFields:e.resource===void 0&&e.meta?.page!==void 0?i?.(e.meta.page):void 0,titleOf:a,onActor:o,showSubject:s},e.id))})}var sS=/\.(deleted|purged)$/;function cS({entry:e,now:t,names:n,schema:r,pageFields:i,titleOf:a,onActor:o,showSubject:s}){let c=r?.fields??i,{t:l}=Y(),u=new Date(e.at),d=!Number.isNaN(u.getTime()),f=s?Kx(e,n):void 0,p=s&&e.resource!==void 0&&e.recordId!==void 0&&!sS.test(e.event)&&!e.meta?.deleted,m=qx(e),h=Gx(e),g=e.actor?e.actor.name??`#${e.actor.id}`:l(`audit.noActor`),_=e.meta?.input?Object.entries(e.meta.input):[],v=e.meta?.action===void 0?void 0:r?.actions?.find(t=>t.name===lS(e))?.input?.fields,y=[e.meta?.ip,e.meta?.userAgent].filter(Boolean).join(` · `);return(0,b.jsxs)(`li`,{className:`flex flex-col gap-2 px-4 py-3 text-sm`,"data-event":e.event,"data-actor":e.actor?.id??``,"data-anonymous":Vx(e)||void 0,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:Wx(e,n)}),f!==void 0&&(p?(0,b.jsx)(bo,{to:`/${e.resource}/${encodeURIComponent(e.recordId)}`,className:`text-primary hover:underline`,children:f}):(0,b.jsx)(`span`,{children:f}))]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[e.actor&&o?(0,b.jsx)(`button`,{type:`button`,className:`font-medium text-foreground hover:underline`,"aria-label":l(`audit.filterByActor`,{name:g}),onClick:()=>o(e.actor.id),children:g}):(0,b.jsx)(`span`,{className:`font-medium text-foreground`,children:g}),e.viewAsBy!==void 0&&(0,b.jsx)(`span`,{children:l(`audit.viewAsBy`,{id:e.viewAsBy})}),d?(0,b.jsxs)(`time`,{dateTime:e.at,children:[ag(u,t),` · `,ng(u)]}):(0,b.jsx)(`span`,{children:e.at})]}),h!==void 0&&(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:h}),m!==void 0&&(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:m}),e.changes!==void 0&&e.changes.length>0&&(0,b.jsx)(`dl`,{"aria-label":l(`audit.changedFields`),className:`grid grid-cols-1 gap-x-4 gap-y-1.5 sm:grid-cols-[minmax(6rem,auto)_1fr]`,children:e.changes.map(e=>{let t=c?.find(t=>t.name===e.field);return(0,b.jsx)(uS,{row:Jx(e,t,a?t=>a(e.field,t):void 0)},e.field)})}),_.length>0&&(0,b.jsx)(`dl`,{"aria-label":l(`audit.input`),className:`grid grid-cols-1 gap-x-4 gap-y-1.5 sm:grid-cols-[minmax(6rem,auto)_1fr]`,children:_.map(([e,t])=>{let n=v?.find(t=>t.name===e);return(0,b.jsxs)(`div`,{className:`contents`,"data-input":e,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:n?.label??e}),(0,b.jsx)(`dd`,{className:`min-w-0`,children:(0,b.jsx)(fS,{text:Qx(t,n)})})]},e)})}),e.meta?.inputTruncated&&(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:l(`audit.inputTruncated`)}),y!==``&&(0,b.jsx)(`p`,{className:`text-xs break-all text-muted-foreground`,dir:`ltr`,"data-client":!0,children:y})]})}function lS(e){let t=`${e.resource}.action.`;return e.event.startsWith(t)?e.event.slice(t.length):void 0}function uS({row:e}){let{t}=Y();return(0,b.jsxs)(`div`,{className:`contents`,"data-change":e.field,"data-state":e.state,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:e.state===`values`?(0,b.jsxs)(b.Fragment,{children:[e.before!==void 0&&(0,b.jsxs)(`span`,{className:`min-w-0 text-muted-foreground line-through decoration-muted-foreground/50`,"data-before":!0,children:[(0,b.jsxs)(`span`,{className:`sr-only`,children:[t(`audit.before`),`: `]}),(0,b.jsx)(fS,{text:e.before})]}),e.before!==void 0&&e.after!==void 0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(Y_,{className:`size-3.5 shrink-0 self-center text-muted-foreground rtl:-scale-x-100`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`sr-only`,children:t(`audit.becomes`)})]}),e.after!==void 0&&(0,b.jsxs)(`span`,{className:`min-w-0`,"data-after":!0,children:[e.before===void 0&&(0,b.jsxs)(`span`,{className:`sr-only`,children:[t(`audit.after`),`: `]}),(0,b.jsx)(fS,{text:e.after})]}),e.truncated&&(0,b.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t(`audit.field.truncated`),`)`]})]}):(0,b.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground`,children:t(`audit.field.${e.state}`)})})]})}var dS=160;function fS({text:e}){let{t}=Y(),[n,r]=(0,y.useState)(!1);return e.length<=dS?(0,b.jsx)(`span`,{dir:`auto`,className:`break-words whitespace-pre-wrap`,children:e}):(0,b.jsxs)(`span`,{dir:`auto`,className:`break-words whitespace-pre-wrap`,children:[n?e:`${e.slice(0,dS).trimEnd()}…`,` `,(0,b.jsx)(q,{type:`button`,variant:`link`,size:`sm`,className:`h-auto p-0 text-xs`,"aria-expanded":n,onClick:()=>r(e=>!e),children:t(n?`audit.showLess`:`audit.showMore`)})]})}var pS=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178],mS=(e,t)=>Math.trunc(e/t),hS=(e,t)=>e-Math.trunc(e/t)*t;function gS(e){let t=e+621,n=-14,r=pS[0];if(e<r||e>=pS[pS.length-1])throw RangeError(`Jalali year ${e} is out of range`);let i=0;for(let t=1;t<pS.length;t++){let a=pS[t];if(i=a-r,e<a)break;n+=mS(i,33)*8+mS(hS(i,33),4),r=a}let a=e-r;n+=mS(a,33)*8+mS(hS(a,33)+3,4),hS(i,33)===4&&i-a===4&&(n+=1);let o=mS(t,4)-mS((mS(t,100)+1)*3,4)-150,s=20+n-o;i-a<6&&(a=a-i+mS(i+4,33)*33);let c=hS(hS(a+1,33)-1,4);return c===-1&&(c=4),{leap:c,gy:t,march:s}}function _S(e,t,n){return mS((e+mS(t-8,6)+100100)*1461,4)+mS(153*hS(t+9,12)+2,5)+n-34840408-mS(mS(e+100100+mS(t-8,6),100)*3,4)+752}function vS(e){let t=4*e+139361631;t=t+mS(mS(4*e+183187720,146097)*3,4)*4-3908;let n=mS(hS(t,1461),4)*5+308,r=mS(hS(n,153),5)+1,i=hS(mS(n,153),12)+1;return{gy:mS(t,1461)-100100+mS(8-i,6),gm:i,gd:r}}function yS(e,t,n){let{gy:r,march:i}=gS(e);return _S(r,3,i)+(t-1)*31-mS(t,7)*(t-7)+n-1}function bS(e){let{gy:t}=vS(e),n=t-621,r=gS(n),i=e-_S(t,3,r.march);if(i>=0){if(i<=185)return{jy:n,jm:1+mS(i,31),jd:hS(i,31)+1};i-=186}else--n,i+=179,r.leap===1&&(i+=1);return{jy:n,jm:7+mS(i,30),jd:hS(i,30)+1}}var xS=(e,t=2)=>String(e).padStart(t,`0`),SS=/^(\d{4})-(\d{2})-(\d{2})$/;function CS(e){return gS(e).leap===0}function wS(e,t){return t<=6?31:t<=11||CS(e)?30:29}function TS(e){let t=SS.exec(e);if(!t)throw RangeError(`not an ISO date: ${e}`);return bS(_S(Number(t[1]),Number(t[2]),Number(t[3])))}function ES(e,t,n){let{gy:r,gm:i,gd:a}=vS(yS(e,t,n));return`${xS(r,4)}-${xS(i)}-${xS(a)}`}function DS(e,t,n){return Number.isInteger(e)&&e>=1&&e<3178&&t>=1&&t<=12&&n>=1&&n<=wS(e,t)}function OS(e){let{jy:t,jm:n,jd:r}=TS(e);return`${t}/${xS(n)}/${xS(r)}`}function kS(e){let t=/^(\d{4})[/\-.](\d{1,2})[/\-.](\d{1,2})$/.exec(Mh(e.trim()));if(!t)return;let[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])];return DS(n,r,i)?ES(n,r,i):void 0}function AS(e,t){let{jy:n,jm:r,jd:i}=TS(e),a=n*12+(r-1)+t,o=Math.floor(a/12),s=a%12+1;return ES(o,s,Math.min(i,wS(o,s)))}function jS(e,t){return new Date(Date.parse(`${e}T00:00:00Z`)+t*864e5).toISOString().slice(0,10)}function MS(){let e=new Date;return`${xS(e.getFullYear(),4)}-${xS(e.getMonth()+1)}-${xS(e.getDate())}`}var NS=(e,t=2)=>String(e).padStart(t,`0`),PS=(e,t)=>new Date(Date.UTC(e,t,0)).getUTCDate(),FS={intl:`persian`,parts:e=>{let{jy:t,jm:n,jd:r}=TS(e);return{year:t,month:n,day:r}},fromParts:ES,monthLength:wS,addMonths:AS,format:OS,parse:kS,weekStart:6},IS={intl:`gregory`,parts:e=>({year:Number(e.slice(0,4)),month:Number(e.slice(5,7)),day:Number(e.slice(8,10))}),fromParts:(e,t,n)=>`${NS(e,4)}-${NS(t)}-${NS(n)}`,monthLength:PS,addMonths:(e,t)=>{let{year:n,month:r,day:i}=IS.parts(e),a=n*12+(r-1)+t,o=Math.floor(a/12),s=a%12+1;return IS.fromParts(o,s,Math.min(i,PS(o,s)))},format:e=>e,parse:e=>{let t=/^(\d{4})[/\-.](\d{1,2})[/\-.](\d{1,2})$/.exec(Mh(e.trim()));if(!t)return;let[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])];return n>=1&&r>=1&&r<=12&&i>=1&&i<=PS(n,r)?IS.fromParts(n,r,i):void 0},weekStart:1},LS=e=>e===`persian`?FS:IS,RS=/^\d{4}-\d{2}-\d{2}$/;function zS(e){let{calendar:t}=Y();return(0,b.jsx)(BS,{...e,system:LS(t)})}function BS({id:e,value:t,onChange:n,label:r,live:i,className:a,system:o,...s}){let{t:c,digits:l}=Y(),u=e=>RS.test(e)?tg(o.format(e)):e,[d,f]=(0,y.useState)(()=>u(t)),[p,m]=(0,y.useState)(!1),h=(0,y.useRef)(t);(0,y.useEffect)(()=>{t!==h.current&&(h.current=t,f(u(t)))},[t,l,o]);function g(e){h.current=e,n(e)}function _(){let e=d.trim();if(e===``)return t!==``&&g(``);let n=o.parse(e);n?(f(u(n)),n!==t&&g(n)):i&&g(Mh(e))}function v(e){f(u(e)),m(!1),g(e)}return(0,b.jsxs)(`div`,{className:W(`flex items-center gap-1`,a),children:[(0,b.jsx)(Oh,{id:e,dir:`ltr`,inputMode:`numeric`,placeholder:c(`date.placeholder`),value:d,...s,onChange:e=>{if(f(e.target.value),!i)return;let t=e.target.value.trim();g((t===``?``:o.parse(t))??Mh(t))},onBlur:()=>{_(),s.onBlur?.()},onKeyDown:e=>{e.key===`Enter`&&(_(),i||e.preventDefault()),s.onKeyDown?.(e)}}),(0,b.jsxs)(Sh,{open:p,onOpenChange:m,children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c(`date.openCalendar`,{name:r}),children:(0,b.jsx)(pv,{})})}),(0,b.jsx)(wh,{children:(0,b.jsx)(Th,{align:`end`,sideOffset:4,className:`z-50 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md`,"aria-label":c(`date.calendar`,{name:r}),children:(0,b.jsx)(VS,{system:o,value:RS.test(t)?t:void 0,onPick:v,onClear:()=>v(``)})})})]})]})}function VS({system:e,value:t,onPick:n,onClear:r}){let{t:i,locale:a}=Y(),o=MS(),[s,c]=(0,y.useState)(t??o),[l,u]=(0,y.useState)(`days`),d=(0,y.useRef)(null),f=(0,y.useRef)(!1),{year:p,month:m}=e.parts(s),h=Qh(a);(0,y.useEffect)(()=>{f.current&&(f.current=!1,d.current?.querySelector(`[data-iso="${s}"]`)?.focus())},[s]);let g=t=>new Intl.DateTimeFormat(`${a}-u-ca-${e.intl}`,{month:`long`,timeZone:`UTC`}).format(Date.parse(`${e.fromParts(p,t,1)}T00:00:00Z`)),_=e=>tg(String(e)),v=jS(`2024-01-07`,e.weekStart),x=Array.from({length:7},(e,t)=>new Intl.DateTimeFormat(a,{weekday:`narrow`,timeZone:`UTC`}).format(Date.parse(`${jS(v,t)}T00:00:00Z`))),S=e.fromParts(p,m,1),C=(new Date(`${S}T00:00:00Z`).getUTCDay()-e.weekStart+7)%7,w=e.monthLength(p,m),T=[...Array.from({length:C},()=>null),...Array.from({length:w},(e,t)=>jS(S,t))];function E(t){let n={ArrowRight:h?-1:1,ArrowLeft:h?1:-1,ArrowDown:7,ArrowUp:-7},r;t.key in n?r=jS(s,n[t.key]):t.key===`PageDown`?r=e.addMonths(s,t.shiftKey?12:1):t.key===`PageUp`&&(r=e.addMonths(s,t.shiftKey?-12:-1)),r&&(t.preventDefault(),f.current=!0,c(r))}let D=(e,t,n,r)=>(0,b.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":i(`date.previous`),onClick:()=>n(-1),children:(0,b.jsx)(Tv,{className:`rtl:rotate-180`})}),t?(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":r,onClick:t,children:e}):(0,b.jsx)(`span`,{className:`text-sm font-medium`,children:e}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":i(`date.next`),onClick:()=>n(1),children:(0,b.jsx)(Dv,{className:`rtl:rotate-180`})})]}),O;if(l===`years`){let t=p-p%12;O=(0,b.jsxs)(b.Fragment,{children:[D(`${_(t)}–${_(t+11)}`,void 0,t=>c(e.addMonths(s,t*144)),``),(0,b.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:Array.from({length:12},(e,n)=>t+n).map(t=>(0,b.jsx)(q,{type:`button`,variant:t===p?`secondary`:`ghost`,size:`sm`,onClick:()=>{c(e.fromParts(t,m,Math.min(e.parts(s).day,e.monthLength(t,m)))),u(`months`)},children:_(t)},t))})]})}else O=l===`months`?(0,b.jsxs)(b.Fragment,{children:[D(_(p),()=>u(`years`),t=>c(e.addMonths(s,t*12)),i(`date.chooseYear`)),(0,b.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:Array.from({length:12},(e,t)=>t+1).map(t=>(0,b.jsx)(q,{type:`button`,variant:t===m?`secondary`:`ghost`,size:`sm`,onClick:()=>{c(e.fromParts(p,t,Math.min(e.parts(s).day,e.monthLength(p,t)))),u(`days`)},children:g(t)},t))})]}):(0,b.jsxs)(b.Fragment,{children:[D(`${g(m)} ${_(p)}`,()=>u(`months`),t=>c(e.addMonths(s,t)),i(`date.chooseMonth`)),(0,b.jsxs)(`div`,{ref:d,role:`grid`,"aria-label":`${g(m)} ${_(p)}`,onKeyDown:E,className:`grid grid-cols-7 gap-0.5 text-center`,children:[(0,b.jsx)(`div`,{role:`row`,className:`contents`,children:x.map((e,t)=>(0,b.jsx)(`div`,{role:`columnheader`,className:`py-1 text-xs text-muted-foreground`,children:e},t))}),Array.from({length:Math.ceil(T.length/7)},(r,i)=>(0,b.jsx)(`div`,{role:`row`,className:`contents`,children:T.slice(i*7,i*7+7).map((r,a)=>r?(0,b.jsx)(`div`,{role:`gridcell`,"aria-selected":r===t,children:(0,b.jsx)(`button`,{type:`button`,"data-iso":r,tabIndex:r===s?0:-1,"aria-label":ig(r),"aria-current":r===o?`date`:void 0,onClick:()=>n(r),className:W(`size-8 rounded-md text-sm hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none`,r===o&&`font-semibold text-primary`,r===t&&`bg-primary text-primary-foreground hover:bg-primary/90`),children:_(e.parts(r).day)})},r):(0,b.jsx)(`div`,{role:`gridcell`},`empty-${i}-${a}`))},i))]})]});return(0,b.jsxs)(`div`,{className:`flex w-64 flex-col`,children:[O,(0,b.jsxs)(`div`,{className:`mt-2 flex justify-between gap-2 border-t pt-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>n(o),children:i(`date.today`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:i(`date.clear`)})]})]})}function HS({id:e,value:t,onChange:n,label:r,...i}){let{t:a}=Y(),[o=``,s=``]=t.split(`T`),c=(e,t)=>n(e===``?``:`${e}T${t||`00:00`}`);return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(zS,{id:e,live:!0,value:o,label:r,onChange:e=>c(e,s),className:`min-w-44 flex-1`,...i}),(0,b.jsx)(Oh,{type:`time`,dir:`ltr`,"aria-label":a(`date.time`,{name:r}),className:`w-28`,value:s,onChange:e=>c(o,e.target.value)})]})}var US=`fixed inset-0 z-40 bg-black/40 backdrop-blur-sm dark:bg-black/60 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150`;function WS(e,t){let[n,r]=(0,y.useState)(e);return(0,y.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var GS=(e,t)=>String(e.id)===String(t.id);function KS({id:e,resource:t,field:n,value:r,onChange:i,clearable:a,values:o,parent:s,invalid:c,describedBy:l}){let u=X(),d=n.relation?.kind===`to-many`,f=d&&Array.isArray(r)?r:[],p=!d&&r&&!Array.isArray(r)?r:null,[m,h]=(0,y.useState)(``),[g,_]=(0,y.useState)(!1),[v,x]=(0,y.useState)(0),S=WS(m.trim(),250),C=Qg(t,n.optionsField??n.name,S,g,o,s),w=(C.data?.items??[]).filter(e=>!f.some(t=>GS(t,e))),T=`${e}-options`,E=t=>`${e}-option-${t}`;(0,y.useEffect)(()=>{x(0)},[S,C.data]);function D(e){h(``),_(!1),i(d?[...f,e]:e)}function O(e){e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),g?x(t=>Math.max(0,Math.min(w.length-1,t+(e.key===`ArrowDown`?1:-1)))):_(!0)):e.key===`Enter`&&g?(e.preventDefault(),w[v]&&D(w[v])):e.key===`Escape`&&g?(e.preventDefault(),_(!1),h(``)):e.key===`Backspace`&&d&&m===``&&f.length>0&&i(f.slice(0,-1))}return(0,b.jsxs)(`div`,{className:`relative flex flex-col gap-1.5`,children:[d&&f.length>0&&(0,b.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,"aria-label":u(`picker.selected`,{name:n.label}),children:f.map(e=>(0,b.jsxs)(`li`,{className:`inline-flex items-center gap-1 rounded-md bg-muted py-0.5 ps-2 pe-1 text-sm`,children:[e.title,(0,b.jsx)(`button`,{type:`button`,className:`rounded-sm p-0.5 text-muted-foreground hover:text-foreground`,"aria-label":u(`picker.remove`,{name:e.title}),onClick:()=>i(f.filter(t=>!GS(t,e))),children:(0,b.jsx)(Cx,{className:`size-3.5`})})]},String(e.id)))}),(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(Oh,{id:e,role:`combobox`,autoComplete:`off`,"aria-autocomplete":`list`,"aria-expanded":g,"aria-controls":T,"aria-activedescendant":g&&w[v]?E(v):void 0,"aria-invalid":c||void 0,"aria-describedby":l,className:W(p&&a&&`pe-8`),placeholder:p?p.title:u(d?`picker.typeToAdd`:`picker.typeToSearch`),value:g||m?m:p?.title??``,onChange:e=>{h(e.target.value),_(!0)},onFocus:()=>_(!0),onBlur:()=>{_(!1),h(``)},onKeyDown:O}),p&&a&&(0,b.jsx)(`button`,{type:`button`,className:`absolute inset-y-0 end-0 flex items-center px-2 text-muted-foreground hover:text-foreground`,"aria-label":u(`picker.clear`,{name:n.label}),onClick:()=>i(null),children:(0,b.jsx)(Cx,{className:`size-4`})})]}),g&&(0,b.jsxs)(`div`,{className:`absolute inset-x-0 top-full z-20 mt-1 max-h-60 overflow-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:[(0,b.jsx)(`ul`,{id:T,role:`listbox`,"aria-label":n.label,children:w.map((e,t)=>(0,b.jsx)(`li`,{id:E(t),role:`option`,"aria-selected":t===v,className:W(`cursor-pointer rounded-md px-2 py-1.5 text-sm`,t===v&&`bg-accent text-accent-foreground`),onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>x(t),onClick:()=>D(e),children:e.title},String(e.id)))}),w.length===0&&(0,b.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,children:C.isError?pg(C.error):u(C.isFetching||C.isPending?`picker.searching`:`picker.noMatches`)})]})]})}var qS=new Set([`page`,`pageSize`,`sort`,`search`,`trashed`,`after`,`tab`]),JS=e=>qS.has(e)||e.startsWith(`filter[`);function YS(e){let t=new URLSearchParams;for(let[n,r]of e)r!==``&&JS(n)&&t.append(n,r);return t.sort(),t.toString()}function XS(e,t){return`filter[${e}][${t}]`}function ZS(e){return[...e.keys()].some(e=>e===`search`||e.startsWith(`filter[`))}function QS(e){let t={};for(let n of e.keys())(n===`search`||n.startsWith(`filter[`))&&(t[n]=null);return t}function $S(e,t){let n=new URLSearchParams(e);Object.keys(t).some(e=>e!==`page`&&e!==`after`)&&(n.delete(`page`),n.delete(`after`));for(let[e,r]of Object.entries(t))r===null?n.delete(e):n.set(e,r);return n}function eC(e,t){if(!e)return{summary:``,label:J(`list.page`,{page:t}),hasNext:!1};if(e.total===null)return{summary:``,label:J(`list.page`,{page:t}),hasNext:e.hasMore===!0};let n=Math.max(1,Math.ceil(e.total/e.pageSize)),r=eg(e.total);return{summary:J(e.estimated?`list.about`:`list.total`,{count:r}),label:e.estimated?J(`list.page`,{page:t}):J(`list.pageOf`,{page:t,pages:n}),hasNext:t<n}}function tC(e,t,n){if(!e||e.total===null||e.total===0)return``;if(e.estimated)return J(`list.about`,{count:eg(e.total)});let r=(t-1)*e.pageSize+1;return J(`list.range`,{from:eg(r),to:eg(r+Math.max(n,1)-1),total:eg(e.total)})}function nC(e){return[...new Set([10,20,50,100,e])].filter(e=>e<=100).sort((e,t)=>e-t)}function rC(e){let t=new Set;for(let[n,r]of e){let e=/^filter\[([^\][]+)\]/.exec(n);e&&r!==``&&t.add(e[1])}return t.size}function iC(e,t){let n=e=>e===`search`||e===`sort`||e.startsWith(`filter[`),r={};for(let i of new Set([...e.keys(),...t.keys()]))n(i)&&e.get(i)!==t.get(i)&&(r[i]=t.get(i));return Object.fromEntries(Object.entries(r).sort(([e],[t])=>e.localeCompare(t)))}function aC(e){return new Map([...e].filter(([e,t])=>e.startsWith(`filter[`)&&t!==``))}function oC(e,t){let n=aC(t),r=t.get(`tab`);return e?.find(e=>{if((e.where?e.key:null)!==r)return!1;let t=Object.entries(e.filter);return t.length===n.size&&t.every(([e,t])=>n.get(e)===t)})}function sC(e,t){let n={};for(let e of aC(t).keys())n[e]=null;return t.has(`tab`)&&(n.tab=null),Object.assign(n,e.filter),e.where?n.tab=e.key:t.has(`tab`)&&(n.tab=null),n}var cC=/^filter\[([^\][]+)\]\[([^\][]+)\]$/;function lC(e,t){if(e.type===`boolean`)return J(t===`true`?`common.yes`:`common.no`);if(e.type===`enum`)return e.enumLabels?.[t]??t;if(e.type===`date`)return ig(t);if(e.type===`number`||e.type===`decimal`||e.type===`bigint`)return tg(t);if(e.type===`datetime`){let e=new Date(t);return Number.isNaN(e.getTime())?t:ng(e)}return t}function uC(e,t){let n=[],r=t.get(`search`);r&&n.push({key:`search`,label:J(`filters.search`),value:`“${r}”`,remove:[`search`]});let i=dC(e,t),a=new Map;for(let[e,n]of t){if(i[e]===n)continue;let t=cC.exec(e);if(!t||n===``)continue;let[,r,o]=t;a.set(r,[...a.get(r)??[],{operator:o,raw:n,key:e}])}for(let[t,r]of a){let i=e.fields.find(e=>e.name===t);if(!i)continue;let a=[],o,s=r.find(e=>e.operator===`gte`||e.operator===`gt`),c=r.find(e=>e.operator===`lte`||e.operator===`lt`);s&&c&&a.push(`${lC(i,s.raw)} – ${lC(i,c.raw)}`);for(let{operator:e,raw:n}of r){if((e===`gte`||e===`gt`||e===`lte`||e===`lt`)&&s&&c)continue;let r=n.split(`,`).map(e=>lC(i,e));if(i.type===`relation`&&[`eq`,`ne`,`in`,`nin`].includes(e)){let r=e===`ne`||e===`nin`?J(`filters.not`):``;o={field:t,ids:n.split(`,`),prefix:r},a.push(`${r}${n.split(`,`).map(e=>`#${e}`).join(`, `)}`);continue}switch(e){case`isNull`:a.push(J(n===`true`?`filters.empty`:`filters.notEmpty`));break;case`ne`:case`nin`:a.push(`${J(`filters.not`)}${r.join(`, `)}`);break;case`gte`:case`gt`:a.push(`≥ ${r[0]}`);break;case`lte`:case`lt`:a.push(`≤ ${r[0]}`);break;case`between`:a.push(r.join(` – `));break;case`contains`:a.push(`“${n}”`);break;case`startsWith`:a.push(`${n}…`);break;default:a.push(r.join(`, `))}}n.push({key:`filter:${t}`,label:i.label,value:a.join(`; `),...o?{ref:o}:{},remove:r.map(e=>e.key)})}return n}function dC(e,t){return oC(e.list?.tabs,t)?.filter??{}}var fC=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{},pC=e=>Array.isArray(e)?e:[];function mC(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`id`in e&&`title`in e}function hC(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`name`in e&&`size`in e&&(`key`in e||`token`in e)}function gC(e){return(Array.isArray(e)?e:[e]).filter(hC)}function _C(e,t){let n=e?._files?.[t];return n==null?[]:Array.isArray(n)?n:[n]}var vC=e=>e.token===void 0?`key:${e.key}`:`token:${e.token}`,yC=e=>e.token===void 0?{key:e.key}:{token:e.token},bC=(e,t)=>{let n=new Set(e.map(e=>String(e.id)));return e.length===t.length&&t.every(e=>n.has(String(e.id)))},xC=/<img\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;function SC(e){return e.replace(xC,``)}var CC=e=>String(e).padStart(2,`0`);function wC(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.getFullYear()}-${CC(t.getMonth()+1)}-${CC(t.getDate())}T${CC(t.getHours())}:${CC(t.getMinutes())}`}function TC(e,t){let n={};for(let r of e){let e=t?t[r.name]:r.default;if(r.file){let e=_C(t,r.name).map(({key:e,name:t,size:n,contentType:r,url:i})=>({key:e,name:t,size:n,contentType:r,url:i}));n[r.name]=r.file.many?e:e[0]??null}else if(r.type===`object`){let t=r.fields??[];n[r.name]=r.many?(Array.isArray(e)?e:[]).map(e=>TC(t,e)):TC(t,e??void 0)}else r.relation?.kind===`to-many`?n[r.name]=Array.isArray(e)?e.filter(mC):[]:r.type===`relation`?n[r.name]=mC(e)?e:null:r.type===`boolean`?n[r.name]=e===!0:e==null?n[r.name]=``:r.type===`json`?n[r.name]=JSON.stringify(e,null,2):r.type===`datetime`?n[r.name]=wC(String(e)):r.widget===`money`?n[r.name]=Ox(String(e),r.scale):n[r.name]=String(e)}return n}function EC(e,t){let n=/^-?\d{1,3}(,\d{3})+(\.\d+)?$/.test(e)?e.replace(/,/g,``):e;if((t?/^-?\d+$/:/^-?\d+(\.\d+)?$/).test(n))return n}function DC(e,t,n,r=``){let i={},a={};for(let o of e){let e=t[o.name];if(n&&e===n[o.name])continue;let s=`${r}${o.name}`;if(o.type===`object`){let t=o.fields??[];if(o.many){let r=pC(e).map((e,n)=>DC(t,e,void 0,`${s}.${n}.`));for(let e of r)Object.assign(a,e.errors);let c=r.map(e=>e.payload),l=n?pC(n[o.name]).map(e=>DC(t,e).payload):void 0;(l?JSON.stringify(l)!==JSON.stringify(c):c.length>0)&&(i[o.name]=c);continue}let r=DC(t,fC(e),n?fC(n[o.name]):void 0,`${s}.`);Object.assign(a,r.errors),(Object.keys(r.payload).length>0||!n&&!o.nullable)&&(i[o.name]=r.payload);continue}if(o.file){let t=gC(e),r=n?gC(n[o.name]):void 0;if(r&&t.map(vC).join(`
54
+ `)===r.map(vC).join(`
55
+ `))continue;o.file.many?(r||t.length>0)&&(i[o.name]=t.map(yC)):t[0]?i[o.name]=yC(t[0]):(o.nullable||n)&&(i[o.name]=null);continue}if(o.relation?.kind===`to-many`){let t=Array.isArray(e)?e.filter(mC):[],r=n?.[o.name];(n?!bC(t,Array.isArray(r)?r.filter(mC):[]):t.length>0)&&(i[o.name]=t.map(e=>e.id));continue}if(o.type===`relation`){let t=mC(e)?e:null,r=n?.[o.name];if(n&&String(t?.id)===String(mC(r)?r.id:void 0))continue;t?i[o.name]=t.id:(o.nullable||n)&&(i[o.name]=null);continue}if(o.type===`boolean`){i[o.name]=e===!0;continue}let c=typeof e==`string`?e:``,l=c.trim();if(l===``){(o.nullable||n)&&(i[o.name]=null);continue}switch(o.type){case`number`:case`decimal`:case`bigint`:{let e=EC(Nh(l),o.type===`bigint`);e===void 0?a[s]=[J(`validation.number`)]:i[o.name]=o.type===`number`?Number(e):e;break}case`json`:try{i[o.name]=JSON.parse(l)}catch{a[s]=[J(`validation.json`)]}break;case`date`:{let e=Mh(l);!/^\d{4}-\d{2}-\d{2}$/.test(e)||Number.isNaN(Date.parse(`${e}T00:00:00Z`))||new Date(`${e}T00:00:00Z`).toISOString().slice(0,10)!==e?a[s]=[J(`validation.date`)]:i[o.name]=e;break}case`datetime`:{let e=new Date(Mh(l));Number.isNaN(e.getTime())?a[s]=[J(`validation.datetime`)]:i[o.name]=e.toISOString();break}default:i[o.name]=c}}return{payload:i,errors:a}}function OC(e,t){let{payload:n}=DC(e,t),r=e=>Array.isArray(e)?e.every(e=>typeof e==`string`||typeof e==`number`):typeof e==`string`?e.length<=100:typeof e!=`object`||!e,i=Object.fromEntries(Object.entries(n).filter(([,e])=>r(e))),a=JSON.stringify(i);return a.length<=4e3?a:void 0}var kC=`(max-width: 767px)`;function AC(e){let t=window.matchMedia(kC);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function jC(){return(0,y.useSyncExternalStore)(AC,()=>window.matchMedia(kC).matches,()=>!1)}function MC(e,t){if(e.widget===`stepper`)return`select`;if(e.widget)return e.widget;switch(e.type){case`boolean`:return`checkbox`;case`enum`:return`select`;case`text`:return`textarea`;case`json`:case`object`:return`json`;case`number`:case`decimal`:case`bigint`:return`number`;case`date`:return`date`;case`datetime`:return`datetime`;default:return t?.format===`email`?`email`:t?.format===`url`?`url`:`text`}}function NC(e,t){return e.enumLabels?.[t]??t}var PC=`h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,FC=new Set([`number`,`decimal`,`bigint`,`date`,`datetime`]);function IC({schema:e,params:t,onChange:n,trailing:r}){let i=X(),a=jC(),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(),u=t.get(`search`)??``,[d,f]=(0,y.useState)(u);(0,y.useEffect)(()=>{f(u)},[u]);let p=e.list.filters.map(t=>({operators:t.operators,field:e.fields.find(e=>e.name===t.field)})).filter(e=>e.field!==void 0),m=e.list.search.length>0,h=a&&(p.length>0||e.list.sortable.length>0);if(p.length===0&&!m&&!h&&!r)return null;let g=e.list.search.map(t=>e.fields.find(e=>e.name===t)?.label??t);if(!a){let a=new Map(uC(e,t).map(e=>[e.key,e]));return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[m&&(0,b.jsx)(JC,{label:i(`filters.search`),placeholder:i(`filters.searchIn`,{fields:g.join(`, `)}),value:d,onChange:f,onSubmit:()=>n({search:d.trim()||null})}),p.length>0&&(0,b.jsx)(`ul`,{"aria-label":i(`filters.filters`),className:`contents`,children:p.map(({field:r,operators:i})=>(0,b.jsx)(`li`,{className:`contents`,children:(0,b.jsx)(YC,{resource:e.name,field:r,operators:i,params:t,onChange:n,chip:a.get(`filter:${r.name}`)})},r.name))}),ZS(t)&&(0,b.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>n(QS(t)),children:[i(`filters.clear`),(0,b.jsx)(Cx,{className:`size-3.5`})]}),r&&(0,b.jsx)(`div`,{className:`ms-auto flex items-center gap-2`,children:r})]})}let _=rC(t),v=uC(e,t).length>0,x=LC(e,t,i),S=()=>{l(new URLSearchParams(t)),s(!0)};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[m&&(0,b.jsx)(JC,{className:`flex-1`,label:i(`filters.search`),placeholder:i(`filters.searchIn`,{fields:g.join(`, `)}),value:d,onChange:f,onSubmit:()=>n({search:d.trim()||null})}),h&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,"aria-haspopup":`dialog`,onClick:S,children:[(0,b.jsx)(Ub,{}),i(`filters.filters`),_>0&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1.5 text-xs text-primary-foreground`,children:eg(_)})]})]}),(v||h&&x)&&(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[v&&(0,b.jsx)(WC,{schema:e,params:t,onChange:n}),h&&x&&(0,b.jsxs)(`button`,{type:`button`,className:`inline-flex h-9 items-center gap-1.5 rounded-full border border-input bg-card px-3 text-[13px]`,"aria-haspopup":`dialog`,onClick:S,children:[(0,b.jsx)(G_,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),x]})]}),h&&(0,b.jsx)(jd,{open:o,onOpenChange:s,children:(0,b.jsxs)(Ld,{children:[(0,b.jsx)(zd,{className:US}),(0,b.jsxs)(Ud,{"aria-describedby":void 0,className:`fixed inset-x-0 bottom-0 z-50 flex max-h-[85dvh] flex-col rounded-t-[18px] bg-card shadow-xl outline-none`,children:[(0,b.jsx)(`div`,{className:`flex justify-center pt-2`,"aria-hidden":!0,children:(0,b.jsx)(`span`,{className:`h-1.5 w-10 rounded-full bg-input`})}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 ps-4 pe-2 pt-1.5 pb-2`,children:[(0,b.jsx)(Jd,{className:`flex-1 text-[17px] font-bold`,children:i(`filters.filtersAndSort`)}),ZS(t)&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,className:`text-primary`,onClick:()=>n(QS(t)),children:i(`filters.clear`)})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-5 overflow-y-auto px-4 py-1`,children:[p.map(({field:r,operators:i})=>(0,b.jsx)(zC,{resource:e.name,field:r,operators:i,params:t,onChange:n,touch:!0},r.name)),e.list.sortable.length>0&&(0,b.jsx)(RC,{schema:e,params:t,onChange:n})]}),(0,b.jsxs)(`div`,{className:`flex gap-2.5 border-t px-4 pt-3 pb-5`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>{c&&n(iC(t,c)),s(!1)},children:i(`common.cancel`)}),(0,b.jsx)(Xd,{asChild:!0,children:(0,b.jsx)(q,{className:`flex-1`,children:i(`filters.showResults`)})})]})]})]})})]})}function LC(e,t,n){if(e.list.sortable.length===0)return``;let{field:r,direction:i}=e.list.defaultSort,a=t.get(`sort`)??(i===`desc`?`-${r}`:r),o=a.replace(/^-/,``),s=e.fields.find(e=>e.name===o)?.label??o;return n(a.startsWith(`-`)?`filters.descending`:`filters.ascending`,{name:s})}function RC({schema:e,params:t,onChange:n}){let r=X(),{field:i,direction:a}=e.list.defaultSort,o=t.get(`sort`)??(a===`desc`?`-${i}`:i),s=t=>e.fields.find(e=>e.name===t)?.label??t;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`list-sort`,children:r(`filters.sortBy`)}),(0,b.jsx)(`select`,{id:`list-sort`,className:PC,value:o,onChange:e=>n({sort:e.target.value,page:null,after:null}),children:e.list.sortable.flatMap(e=>[(0,b.jsx)(`option`,{value:e,children:r(`filters.ascending`,{name:s(e)})},e),(0,b.jsx)(`option`,{value:`-${e}`,children:r(`filters.descending`,{name:s(e)})},`-${e}`)])})]})}function zC(e){let t=(0,b.jsx)(UC,{...e}),{field:n,operators:r,params:i,onChange:a}=e;return!n.nullable||!r.includes(`isNull`)||n.type===`relation`?t:(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[t,(0,b.jsx)(BC,{field:n,params:i,onChange:a})]})}function BC({field:e,params:t,onChange:n}){let r=X(),i=XS(e.name,`isNull`);return(0,b.jsxs)(`select`,{"aria-label":r(`filters.emptyValues`,{field:e.label}),className:W(PC,`h-7 text-xs text-muted-foreground`),value:t.get(i)??``,onChange:e=>n({[i]:e.target.value||null}),children:[(0,b.jsx)(`option`,{value:``,children:r(`filters.any`)}),(0,b.jsx)(`option`,{value:`true`,children:r(`filters.onlyEmpty`)}),(0,b.jsx)(`option`,{value:`false`,children:r(`filters.hideEmpty`)})]})}function VC({id:e,inline:t,field:n,params:r,onChange:i}){let a=X(),o=XS(n.name,`in`),s=(r.get(o)??``).split(`,`).filter(Boolean),c=e=>{let t=s.includes(e)?s.filter(t=>t!==e):[...s,e];i({[o]:t.length>0?t.join(`,`):null})};return t?(0,b.jsx)(HC,{field:n,selected:s,onToggle:c}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:e,children:n.label}),(0,b.jsxs)(Sh,{children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsxs)(q,{id:e,type:`button`,variant:`outline`,className:`justify-between font-normal`,children:[(0,b.jsx)(`span`,{className:`truncate`,children:s.length===0?a(`common.all`):s.length<=2?s.map(e=>NC(n,e)).join(`, `):a(`filters.selected`,{count:s.length})}),(0,b.jsx)(Cv,{className:`size-4 opacity-60`,"aria-hidden":!0})]})}),(0,b.jsx)(wh,{children:(0,b.jsx)(Th,{align:`start`,sideOffset:4,className:`z-50 min-w-48 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:(0,b.jsx)(HC,{field:n,selected:s,onToggle:c})})})]})]})}function HC({field:e,selected:t,onToggle:n}){return(0,b.jsx)(`ul`,{"aria-label":e.label,children:(e.enumValues??[]).map(r=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-accent`,children:[(0,b.jsx)(ff,{checked:t.includes(r),onCheckedChange:()=>n(r),className:`flex size-4 items-center justify-center rounded border border-input data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,children:(0,b.jsx)(mf,{children:(0,b.jsx)(xv,{className:`size-3`})})}),NC(e,r)]})},r))})}function UC({inline:e,touch:t,resource:n,field:r,operators:i,params:a,onChange:o}){let{t:s,calendar:c}=Y(),l=`filter-${r.name}`;if(t&&r.type===`enum`&&i.includes(`in`))return(0,b.jsx)(ZC,{field:r,params:a,onChange:o});if(r.type===`enum`&&i.includes(`in`))return(0,b.jsx)(VC,{id:l,inline:e,field:r,params:a,onChange:o});if(r.type===`relation`){let e=r.relation?.kind===`to-many`?`in`:`eq`;return i.includes(e)?(0,b.jsx)(KC,{id:l,resource:n,field:r,operator:e,params:a,onChange:o}):null}if((r.type===`enum`||r.type===`boolean`)&&i.includes(`eq`)){let e=XS(r.name,`eq`),n=r.type===`boolean`?[[`true`,s(`common.yes`)],[`false`,s(`common.no`)]]:(r.enumValues??[]).map(e=>[e,NC(r,e)]);return t&&n.length<=3?(0,b.jsx)(QC,{label:r.label,options:[[``,s(`common.all`)],...n],value:a.get(e)??``,onChange:t=>o({[e]:t||null})}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:l,children:r.label}),(0,b.jsxs)(`select`,{id:l,className:PC,value:a.get(e)??``,onChange:t=>o({[e]:t.target.value||null}),children:[(0,b.jsx)(`option`,{value:``,children:s(`common.all`)}),n.map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))]})]})}if((r.type===`date`||r.type===`datetime`)&&i.includes(`gte`)&&i.includes(`lte`)){let e=(e,t)=>r.type===`date`||!t?t:new Date(`${t}T${e===`gte`?`00:00:00.000`:`23:59:59.999`}`).toISOString(),t=e=>e&&r.type===`datetime`?wC(e).slice(0,10):e??``;return(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:r.label}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`gte`,`lte`].map(n=>{let i=XS(r.name,n),c=`${l}-${n}`,u=s(n===`gte`?`filters.from`:`filters.to`);return(0,b.jsxs)(`div`,{className:`flex min-w-36 flex-1 flex-col gap-1`,children:[(0,b.jsx)(kh,{htmlFor:c,className:`text-xs text-muted-foreground`,children:u}),(0,b.jsx)(zS,{id:c,label:`${r.label} ${u}`,value:t(a.get(i)),onChange:t=>o({[i]:e(n,t)||null})})]},n)})})]})}if(FC.has(r.type)&&i.includes(`gte`)&&i.includes(`lte`)){let e=r.type===`date`?`date`:r.type===`datetime`?`datetime-local`:`text`,t=e=>r.type===`datetime`&&e?new Date(e).toISOString():Nh(e.trim()).replace(/,/g,``),n=e=>e&&r.type===`datetime`?wC(e):e??``;return(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:r.label}),(0,b.jsx)(`div`,{className:`flex gap-2`,children:[`gte`,`lte`].map(i=>{let c=XS(r.name,i),u=`${l}-${i}`;return(0,b.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1`,children:[(0,b.jsx)(kh,{htmlFor:u,className:`text-xs text-muted-foreground`,children:s(i===`gte`?`filters.from`:`filters.to`)}),(0,b.jsx)(qC,{id:u,type:e,inputMode:e===`text`?`decimal`:void 0,value:n(a.get(c)),onCommit:e=>o({[c]:t(e)||null})})]},i)})})]})}let u=i.includes(`contains`)?`contains`:i.includes(`eq`)?`eq`:void 0;if(!u)return null;let d=XS(r.name,u);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:l,children:u===`contains`?s(`filters.contains`,{field:r.label}):r.label}),(0,b.jsx)(qC,{id:l,value:a.get(d)??``,onCommit:e=>o({[d]:e.trim()||null})})]})}function WC({schema:e,params:t,onChange:n}){let r=X(),i=uC(e,t);return(0,b.jsx)(`ul`,{"aria-label":r(`filters.active`),className:`flex flex-wrap gap-2`,children:i.map(t=>(0,b.jsxs)(`li`,{className:`inline-flex h-9 items-center gap-1 rounded-full border border-primary bg-primary-soft ps-3 pe-1.5 text-[13px] font-semibold text-primary`,children:[(0,b.jsxs)(`span`,{className:`font-medium`,children:[t.label,`:`]}),t.ref?(0,b.jsx)(GC,{resource:e.name,chip:t}):(0,b.jsx)(`span`,{children:t.value}),(0,b.jsx)(`button`,{type:`button`,className:`rounded-full p-1 hover:bg-primary-soft`,"aria-label":r(`filters.removeChip`,{label:t.label}),onClick:()=>n(Object.fromEntries(t.remove.map(e=>[e,null]))),children:(0,b.jsx)(Cx,{className:`size-3.5`})})]},t.key))})}function GC({resource:e,chip:t}){let n=$g(e,t.ref.field,t.ref.ids);if(!n.data)return(0,b.jsx)(`span`,{children:t.value});let r=new Map(n.data.items.map(e=>[String(e.id),e.title]));return(0,b.jsx)(`span`,{children:t.ref.prefix+t.ref.ids.map(e=>r.get(e)??`#${e}`).join(`, `)})}function KC({id:e,resource:t,field:n,operator:r,params:i,onChange:a}){let o=XS(n.name,r),s=(i.get(o)??``).split(`,`).filter(Boolean),c=$g(t,n.name,s),l=new Map((c.data?.items??[]).map(e=>[String(e.id),e])),u=s.map(e=>l.get(e)??{id:e,title:`#${e}`});return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:e,children:n.label}),(0,b.jsx)(KS,{id:e,resource:t,field:n,clearable:!0,value:r===`in`?u:u[0]??null,onChange:e=>{let t=Array.isArray(e)?e:e?[e]:[];a({[o]:t.length>0?t.map(e=>e.id).join(`,`):null})}})]})}function qC({id:e,value:t,type:n=`text`,inputMode:r,onCommit:i}){let[a,o]=(0,y.useState)(t);(0,y.useEffect)(()=>{o(t)},[t]);let s=()=>{a!==t&&i(a)};return(0,b.jsx)(Oh,{id:e,type:n,inputMode:r,value:a,onChange:e=>o(e.target.value),onBlur:s,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),s())}})}function JC({label:e,placeholder:t,value:n,className:r,onChange:i,onSubmit:a}){return(0,b.jsxs)(`form`,{role:`search`,className:W(`relative w-[300px] max-w-full`,r),onSubmit:e=>{e.preventDefault(),a()},children:[(0,b.jsx)(Db,{className:`pointer-events-none absolute start-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(Oh,{"aria-label":e,placeholder:t,value:n,className:`ps-8`,onChange:e=>i(e.target.value)})]})}function YC({chip:e,...t}){let n=X(),{field:r,onChange:i}=t,a=e&&(()=>i(Object.fromEntries(e.remove.map(e=>[e,null]))));return(0,b.jsxs)(Sh,{children:[(0,b.jsxs)(`span`,{className:W(`inline-flex h-8 items-center rounded-lg border border-dashed border-input`,e&&`border-solid bg-card`),children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsxs)(`button`,{type:`button`,className:`inline-flex h-full items-center gap-1.5 rounded-lg px-2.5 text-[12.5px] font-medium outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50`,children:[e?(0,b.jsx)(Fy,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}):(0,b.jsx)(jv,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),r.label,e&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`sr-only`,children:`:`}),(0,b.jsx)(`span`,{className:`h-4 w-px bg-border`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`max-w-48 truncate rounded-[5px] bg-muted px-1.5 text-xs font-medium`,children:e.ref?(0,b.jsx)(GC,{resource:t.resource,chip:e}):e.value})]})]})}),a&&(0,b.jsx)(`button`,{type:`button`,className:`-ms-1 me-1 rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":n(`filters.removeChip`,{label:r.label}),onClick:a,children:(0,b.jsx)(Cx,{className:`size-3.5`})})]}),(0,b.jsx)(wh,{children:(0,b.jsx)(Th,{align:`start`,sideOffset:6,onOpenAutoFocus:r.type===`relation`?e=>e.preventDefault():void 0,className:`z-50 flex w-72 flex-col gap-3 rounded-[10px] border bg-popover p-3 text-popover-foreground shadow-lg outline-none`,children:(0,b.jsx)(zC,{...t,inline:!0})})})]})}var XC=`inline-flex h-9 items-center gap-1.5 rounded-full border border-input bg-card px-3 text-[13px] outline-none focus-visible:ring-3 focus-visible:ring-ring/50 data-[state=checked]:border-primary data-[state=checked]:bg-primary-soft data-[state=checked]:font-semibold data-[state=checked]:text-primary`;function ZC({field:e,params:t,onChange:n}){let r=XS(e.name,`in`),i=(t.get(r)??``).split(`,`).filter(Boolean),a=e=>{let t=i.includes(e)?i.filter(t=>t!==e):[...i,e];n({[r]:t.length>0?t.join(`,`):null})};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,b.jsx)(`span`,{className:`text-sm font-medium`,"aria-hidden":!0,children:e.label}),(0,b.jsx)(`ul`,{"aria-label":e.label,className:`flex flex-wrap gap-2`,children:(e.enumValues??[]).map(t=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(ff,{checked:i.includes(t),onCheckedChange:()=>a(t),className:XC,children:[(0,b.jsx)(mf,{children:(0,b.jsx)(xv,{className:`size-3.5`})}),NC(e,t)]})},t))})]})}function QC({label:e,options:t,value:n,onChange:r}){return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,b.jsx)(`span`,{className:`text-sm font-medium`,"aria-hidden":!0,children:e}),(0,b.jsx)(`div`,{role:`radiogroup`,"aria-label":e,className:`grid auto-cols-fr grid-flow-col gap-0.5 rounded-[10px] bg-muted p-[3px]`,children:t.map(([e,t])=>(0,b.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n===e,className:W(`h-9 rounded-lg text-[13px] text-muted-foreground`,n===e&&`bg-card font-semibold text-foreground shadow-sm`),onClick:()=>r(e),children:t},e))})]})}var $C=[`auth.*`,`auth.login`,`auth.login_failed`,`auth.view_as`,`rbac.*`,`rbac.role.changed`,`rbac.user_roles.changed`,`page.*`],ew=[`*`,`created`,`updated`,`deleted`,`restored`,`purged`,`action.*`];function tw(){let{t:e,locale:t}=Y(),[n,r]=wo(),i=Kg(),a=Gg(),o=a.data?.audit.view===!0,s=nS(n),c=mt({queryKey:[`audit`,s],initialPageParam:void 0,queryFn:({pageParam:e})=>Q.audit(s,e),getNextPageParam:e=>e.next,staleTime:0,enabled:o,retry:!1}),l=c.data?.pages.flatMap(e=>e.entries)??[],u=new Set((i.data?.groups??[]).flatMap(e=>e.resources.map(e=>e.name))),d=[...new Set(l.map(e=>e.resource).filter(e=>e!==void 0&&u.has(e)))].sort(),f=ut({queries:d.map(e=>({queryKey:[`schema`,e,t],queryFn:()=>Q.schema(e),retry:!1}))}),p=e=>f[d.indexOf(e)]?.data,m=new Set((i.data?.groups??[]).flatMap(e=>e.pages.map(e=>e.name))),h=[...new Set(l.map(e=>e.meta?.page).filter(e=>e!==void 0&&m.has(e)))].sort(),g=ut({queries:h.map(e=>({queryKey:[`page`,e,t],queryFn:()=>Q.page(e),retry:!1}))}),_=e=>g[h.indexOf(e)]?.data?.schema.fields,v=(e,t)=>r(n=>$S(n,iS(e,t))),y=c.error instanceof fg&&(c.error.status===403||c.error.status===404);if(a.isPending)return(0,b.jsx)(G,{children:e(`common.loading`)});if(!o||y)return(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(D_,{children:e(`audit.title`)}),(0,b.jsx)(G,{tone:`error`,children:y?pg(c.error):e(a.data?.audit.enabled?`audit.notAllowed`:`audit.off`)})]});let x=(i.data?.groups??[]).flatMap(e=>e.resources),S=n.get(`resource`)??``;return(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(D_,{children:e(`audit.title`)}),(0,b.jsxs)(`fieldset`,{className:`grid gap-3 rounded-card border bg-card shadow-card p-3 sm:grid-cols-2 lg:grid-cols-3`,children:[(0,b.jsx)(`legend`,{className:`px-1 text-xs font-medium text-muted-foreground`,children:e(`filters.filters`)}),(0,b.jsx)(nw,{label:e(`audit.filter.actor`),value:n.get(`actor`)??``,onCommit:e=>v(`actor`,e)}),(0,b.jsx)(nw,{label:e(`audit.filter.event`),placeholder:e(`audit.filter.eventHint`),value:n.get(`event`)??``,onCommit:e=>v(`event`,e),hints:[...S?ew.map(e=>`${S}.${e}`):[],...$C]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`audit-resource`,children:e(`audit.filter.resource`)}),(0,b.jsxs)(`select`,{id:`audit-resource`,className:PC,value:S,onChange:e=>v(`resource`,e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:e(`common.all`)}),S&&!x.some(e=>e.name===S)&&(0,b.jsx)(`option`,{value:S,children:S}),x.map(e=>(0,b.jsx)(`option`,{value:e.name,children:e.label},e.name))]})]}),(0,b.jsx)(nw,{label:e(`audit.filter.record`),placeholder:S?void 0:e(`audit.filter.recordHint`),value:S?n.get(`record`)??``:``,disabled:!S,onCommit:e=>v(`record`,e)}),[`from`,`to`].map(t=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`audit-${t}`,children:e(`filters.${t}`)}),(0,b.jsx)(zS,{id:`audit-${t}`,label:e(`filters.${t}`),value:n.get(t)??``,onChange:e=>v(t,e)})]},t)),rS(n)&&(0,b.jsx)(`div`,{className:`flex items-end sm:col-span-2 lg:col-span-3`,children:(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>r(e=>$S(e,aS())),children:e(`filters.clear`)})})]}),c.isError&&(0,b.jsx)(O_,{children:pg(c.error)}),c.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):l.length===0?!c.isError&&(0,b.jsx)(G,{children:e(rS(n)?`audit.noMatches`:`audit.empty`)}):(0,b.jsx)(oS,{entries:l,now:new Date(c.dataUpdatedAt),names:Lx(i.data,p),schemaOf:p,pageFieldsOf:_,onActor:e=>v(`actor`,e),showSubject:!0}),c.hasNextPage&&(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`self-center`,disabled:c.isFetchingNextPage,onClick:()=>void c.fetchNextPage(),children:e(c.isFetchingNextPage?`common.loading`:`list.loadMore`)})]})}function nw({label:e,value:t,onCommit:n,placeholder:r,disabled:i,hints:a}){let o=(0,y.useId)(),[s,c]=(0,y.useState)(t);(0,y.useEffect)(()=>c(t),[t]);let l=()=>{s.trim()!==t&&n(s)};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:o,children:e}),(0,b.jsx)(Oh,{id:o,type:`text`,dir:`auto`,value:s,placeholder:r,disabled:i,list:a?`${o}-hints`:void 0,autoComplete:`off`,spellCheck:!1,onChange:e=>c(e.target.value),onBlur:l,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),l())}}),a&&(0,b.jsx)(`datalist`,{id:`${o}-hints`,children:a.map(e=>(0,b.jsx)(`option`,{value:e},e))})]})}var rw={hidden:`rbac.rule.hidden`,view:`rbac.rule.readonly`,edit:`rbac.rule.edit`};function iw(){let{t:e}=Y(),[t,n]=wo(),r=t.get(`user`)??``,i=t.get(`resource`)??``,a=t.get(`record`)??``,o=ft({queryKey:[`rbac`,`catalog`],queryFn:Q.rbac.catalog}),s=ft({queryKey:[`rbac`,`user`,r],queryFn:()=>Q.rbac.user(r),enabled:r!==``}),[c,l]=(0,y.useState)(``),[u,d]=(0,y.useState)(i),[f,p]=(0,y.useState)(a),[m,h]=(0,y.useState)(r),g=ft({queryKey:[`rbac`,`users`,c,1],queryFn:()=>Q.rbac.users({search:c}),enabled:c.trim().length>0}),_=ft({queryKey:[`rbac`,`explain`,r,i,a],queryFn:()=>Q.rbac.explain({user:r,resource:i,record:a||void 0}),enabled:r!==``&&i!==``});function v(e){e.preventDefault();let t={};m&&(t.user=m),u&&(t.resource=u),f.trim()&&(t.record=f.trim()),n(t)}let x=m===r?s.data?.displayName:void 0;return(0,b.jsxs)(`div`,{className:`flex max-w-5xl flex-col gap-5`,children:[(0,b.jsx)(D_,{children:e(`debugger.title`)}),(0,b.jsx)(`p`,{className:`-mt-3 text-sm text-muted-foreground`,children:e(`debugger.intro`)}),(0,b.jsxs)(`form`,{onSubmit:v,className:`grid gap-4 rounded-card border bg-card shadow-card p-4 md:grid-cols-3`,"aria-label":e(`debugger.title`),children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`debug-user`,children:e(`debugger.user`)}),(0,b.jsx)(Oh,{id:`debug-user`,placeholder:e(`rbac.searchUsers`),value:c,onChange:e=>l(e.target.value),autoComplete:`off`}),c.trim()&&(0,b.jsx)(`ul`,{"aria-label":e(`rbac.searchResults`),className:`flex flex-col rounded-md border text-sm`,children:(g.data?.items??[]).slice(0,6).map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`button`,{type:`button`,className:`w-full px-2 py-1.5 text-start hover:bg-accent`,onClick:()=>{h(e.id),l(``)},children:[e.displayName,e.username&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e.username]})]})},e.id))}),m&&(0,b.jsx)(`p`,{className:`text-sm`,"data-testid":`debug-chosen-user`,children:x??m})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`debug-resource`,children:e(`debugger.resource`)}),(0,b.jsxs)(`select`,{id:`debug-resource`,className:`h-9 rounded-md border bg-background px-2 text-sm`,value:u,onChange:e=>d(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`—`}),(o.data?.resources??[]).map(e=>(0,b.jsx)(`option`,{value:e.name,children:e.label},e.name))]})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`debug-record`,children:e(`debugger.record`)}),(0,b.jsx)(Oh,{id:`debug-record`,dir:`ltr`,value:f,onChange:e=>p(e.target.value)})]}),(0,b.jsx)(`div`,{className:`md:col-span-3`,children:(0,b.jsx)(q,{type:`submit`,disabled:!m||!u,children:e(`debugger.explain`)})})]}),!r||!i?(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`debugger.pick`)}):_.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):_.isError?(0,b.jsx)(G,{tone:`error`,children:pg(_.error)}):(0,b.jsx)(ow,{data:_.data})]})}function aw({allowed:e}){let{t}=Y();return(0,b.jsx)(`span`,{className:W(`rounded-full px-2 py-0.5 text-xs font-medium`,e?`bg-green-500/15 text-green-800 dark:text-green-300`:`bg-destructive/10 text-destructive`),children:t(e?`debugger.allowed`:`debugger.denied`)})}function ow({data:e}){let{t,locale:n}=Y(),r=e=>e.kind===`group`?t(`debugger.source.group`,{group:e.group??``}):t(`debugger.source.${e.kind}`),i=e=>e===`all`?t(`debugger.allRows`):e.length===0?t(`debugger.noRows`):t(`debugger.someRows`,{scopes:e.join(`, `)});return(0,b.jsxs)(`div`,{className:`flex flex-col gap-5`,"data-testid":`explanation`,children:[(0,b.jsxs)(`section`,{"aria-labelledby":`debug-roles`,className:`flex flex-col gap-2`,children:[(0,b.jsxs)(`h2`,{id:`debug-roles`,className:`font-medium`,children:[t(`debugger.roles`),` · `,e.user.displayName]}),e.superuser?(0,b.jsx)(`p`,{className:`text-sm`,children:t(`debugger.superuser`)}):e.roles.length===0?(0,b.jsx)(`p`,{className:`text-sm`,children:t(`debugger.noRoles`)}):(0,b.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:e.roles.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsx)(`span`,{className:`font-medium`,children:w_(e.label,n)||e.name}),` `,(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.sources.map(r).join(`, `),`)`]}),!e.known&&(0,b.jsx)(`span`,{className:`ms-2 text-destructive`,children:t(`debugger.unknownRole`)})]},e.name))})]}),(0,b.jsxs)(`section`,{"aria-labelledby":`debug-operations`,className:`flex flex-col gap-2`,children:[(0,b.jsxs)(`h2`,{id:`debug-operations`,className:`font-medium`,children:[t(`debugger.operations`),` · `,e.resource.label]}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsx)(`table`,{className:`w-full text-sm`,children:(0,b.jsx)(`tbody`,{className:`divide-y`,children:e.operations.map(n=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{scope:`row`,className:`w-32 px-3 py-2 text-start font-medium`,children:t(`rbac.op.${n.operation}`)}),(0,b.jsx)(`td`,{className:`w-24 px-3 py-2`,children:(0,b.jsx)(aw,{allowed:n.allowed})}),(0,b.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.superuser?``:n.grantedBy.length===0?t(`debugger.noGrant`):n.grantedBy.map(e=>t(e.via?`debugger.viaUpdate`:`debugger.grant`,{pattern:e.pattern,role:e.role})).join(` · `)})]},n.operation))})})})]}),e.actions.length>0&&(0,b.jsxs)(`section`,{"aria-labelledby":`debug-actions`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-actions`,className:`font-medium`,children:t(`debugger.actions`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsx)(`table`,{className:`w-full text-sm`,children:(0,b.jsx)(`tbody`,{className:`divide-y`,children:e.actions.map(n=>(0,b.jsxs)(`tr`,{"data-action":n.name,children:[(0,b.jsx)(`th`,{scope:`row`,className:`w-32 px-3 py-2 text-start font-medium`,children:n.label}),(0,b.jsx)(`td`,{className:`w-24 px-3 py-2`,children:(0,b.jsx)(aw,{allowed:n.allowed})}),(0,b.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.superuser?``:[n.grantedBy.length===0?t(`debugger.noGrant`):n.grantedBy.map(e=>t(`debugger.grant`,{pattern:e.pattern,role:e.role})).join(` · `),...n.needsUpdate?[t(`debugger.needsUpdate`)]:[]].join(` — `)})]},n.name))})})})]}),(0,b.jsxs)(`section`,{"aria-labelledby":`debug-fields`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-fields`,className:`font-medium`,children:t(`debugger.fields`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{className:`bg-muted/40 text-xs text-muted-foreground`,children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`debugger.field`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`debugger.result`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`debugger.byRole`)})]})}),(0,b.jsx)(`tbody`,{className:`divide-y`,children:e.fields.map(e=>(0,b.jsxs)(`tr`,{"data-field":e.name,children:[(0,b.jsxs)(`th`,{scope:`row`,className:`px-3 py-2 text-start font-medium`,children:[e.label,e.restricted&&(0,b.jsx)(`span`,{className:`ms-2 rounded-full border px-1.5 text-xs font-normal text-muted-foreground`,children:t(`rbac.restricted`)})]}),(0,b.jsxs)(`td`,{className:`px-3 py-2`,children:[t(rw[e.level]),e.forced&&(0,b.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:t(`debugger.forced`)})]}),(0,b.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.byRole.map(e=>`${e.role}: ${t(rw[e.level])}${e.rule?` (${e.rule})`:``}${e.code?` (${e.code})`:``}`).join(` · `)})]},e.name))})]})})]}),(0,b.jsxs)(`section`,{"aria-labelledby":`debug-scopes`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-scopes`,className:`font-medium`,children:t(`debugger.scopes`)}),(0,b.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:e.scopes.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`span`,{className:`font-medium`,children:[t(`rbac.op.${e.operation}`),`:`]}),` `,i(e.result),e.byRole.length>0&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[` (`,e.byRole.map(e=>`${e.role}: ${i(e.scopes)}`).join(` · `),`)`]}),e.global.length>0&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,t(`debugger.globalScopes`,{scopes:e.global.join(`, `)})]})]},e.operation))})]}),e.record&&(0,b.jsxs)(`section`,{"aria-labelledby":`debug-record-title`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-record-title`,className:`font-medium`,children:t(`debugger.recordTitle`,{id:e.record.id})}),(0,b.jsxs)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:[[`view`,`update`,`delete`].map(n=>(0,b.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,"data-operation":n,children:[(0,b.jsx)(`span`,{className:`w-24 font-medium`,children:t(`rbac.op.${n}`)}),(0,b.jsx)(aw,{allowed:e.record[n]}),e.record.reasons[n]&&(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:t(`debugger.reason.${e.record.reasons[n]}`)})]},n)),e.record.actions&&(0,b.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,"data-operation":`actions`,children:[(0,b.jsx)(`span`,{className:`w-24 font-medium`,children:t(`debugger.actions`)}),(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e.record.actions.length===0?t(`debugger.noRecordActions`):e.record.actions.map(t=>e.actions.find(e=>e.name===t)?.label??t).join(`, `)})]})]})]}),e.pages.length>0&&(0,b.jsxs)(`section`,{"aria-labelledby":`debug-pages`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-pages`,className:`font-medium`,children:t(`debugger.pages`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{className:`bg-muted/40 text-xs text-muted-foreground`,children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`rbac.page`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`rbac.op.view`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`rbac.op.update`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`debugger.byRole`)})]})}),(0,b.jsx)(`tbody`,{className:`divide-y`,children:e.pages.map(n=>(0,b.jsxs)(`tr`,{"data-page":n.name,children:[(0,b.jsx)(`th`,{scope:`row`,className:`px-3 py-2 text-start font-medium`,children:n.label}),(0,b.jsx)(`td`,{className:`px-3 py-2`,"data-operation":`view`,children:(0,b.jsx)(aw,{allowed:n.view})}),(0,b.jsx)(`td`,{className:`px-3 py-2`,"data-operation":`update`,children:(0,b.jsx)(aw,{allowed:n.update})}),(0,b.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.superuser?``:n.grantedBy.length===0?t(`debugger.noGrant`):n.grantedBy.map(e=>`${t(`debugger.grant`,{pattern:e.pattern,role:e.role})} (${e.code})`).join(` · `)})]},n.name))})]})})]})]})}function sw(){let{t:e,locale:t}=Y(),n=Gg(),r=ft({queryKey:[`rbac`,`groups`],queryFn:Q.rbac.groups});return r.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(G,{tone:`error`,children:pg(r.error)}):(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(D_,{actions:n.data?.rbac.manage&&(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/-/groups/new`,children:[(0,b.jsx)(hb,{}),e(`rbac.newGroup`)]})}),children:e(`rbac.groups`)}),r.data.items.length===0&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`rbac.noGroups`)}),(0,b.jsx)(`ul`,{"aria-label":e(`rbac.groups`),className:`flex flex-col divide-y rounded-card border bg-card shadow-card empty:hidden`,children:r.data.items.map(n=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{to:`/-/groups/${n.id}`,className:`flex flex-wrap items-center justify-between gap-2 px-4 py-3 hover:bg-muted/50`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:w_(n.label,t)||n.name}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`rbac.groupSummary`,{roles:n.roles.length,members:n.members.length})})]})},n.id))})]})}function cw(){let{t:e}=Y(),{id:t}=$i(),n=t===void 0,r=ft({queryKey:[`rbac`,`roles`],queryFn:Q.rbac.roles}),i=ft({queryKey:[`rbac`,`group`,t],queryFn:()=>Q.rbac.group(Number(t)),enabled:!n});return r.isPending||!n&&i.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(G,{tone:`error`,children:pg(r.error)}):!n&&i.isError?(0,b.jsx)(G,{tone:`error`,children:pg(i.error)}):(0,b.jsx)(lw,{roles:r.data.items,group:n?void 0:i.data},t??`new`)}function lw({roles:e,group:t}){let{t:n,locale:r}=Y(),i=Yi(),a=S(),o=Gg().data?.rbac.manage!==!0,[s,c]=(0,y.useState)(t?.name??``),[l,u]=(0,y.useState)(E_(t?.label)),[d,f]=(0,y.useState)(t?.roles??[]),[p,m]=(0,y.useState)(t?.members??[]),[h,g]=(0,y.useState)(``),_=ft({queryKey:[`rbac`,`users`,h],queryFn:()=>Q.rbac.users({search:h}),enabled:h.trim().length>0}),v=ft({queryKey:[`rbac`,`users`,``,1],queryFn:()=>Q.rbac.users({})}),[x,C]=(0,y.useState)({}),w=e=>x[e]??v.data?.items.find(t=>t.id===e)?.displayName??e,[T,E]=(0,y.useState)(null),D=pt({mutationFn:()=>Q.rbac.saveGroup({name:s.trim(),label:T_(l)??null,roles:d,members:p},t?.id),onSuccess:async e=>{await a.invalidateQueries({queryKey:[`rbac`]}),await a.invalidateQueries({queryKey:[`session`]}),i(`/-/groups/${e.id}`,{replace:!0}),E(null)},onError:e=>E(pg(e))}),O=pt({mutationFn:()=>Q.rbac.deleteGroup(t.id),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`rbac`]}),i(`/-/groups`)},onError:e=>E(pg(e))});function k(e){e.preventDefault(),o||D.mutate()}return(0,b.jsxs)(`form`,{onSubmit:k,className:`flex max-w-3xl flex-col gap-5`,"aria-label":n(`rbac.group`),children:[(0,b.jsx)(D_,{children:t?w_(t.label,r)||t.name:n(`rbac.newGroup`)}),T&&(0,b.jsx)(O_,{children:T}),(0,b.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`group-name`,children:n(`rbac.name`)}),(0,b.jsx)(Oh,{id:`group-name`,dir:`ltr`,value:s,disabled:o,onChange:e=>c(e.target.value)})]}),dg.locales.map(e=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`group-label-${e}`,children:n(`rbac.labelIn`,{language:e})}),(0,b.jsx)(Oh,{id:`group-label-${e}`,value:l[e]??``,disabled:o,onChange:t=>u({...l,[e]:t.target.value})})]},e))]}),(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`legend`,{className:`mb-1 font-medium`,children:n(`rbac.roles`)}),e.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:d.includes(e.name),disabled:o,onChange:t=>f(t.target.checked?[...d,e.name]:d.filter(t=>t!==e.name))}),w_(e.label,r)||e.name]},e.name))]}),(0,b.jsxs)(`section`,{"aria-labelledby":`members-title`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`members-title`,className:`font-medium`,children:n(`rbac.members`)}),(0,b.jsxs)(`ul`,{"aria-label":n(`rbac.members`),className:`flex flex-wrap gap-2`,children:[p.map(e=>(0,b.jsxs)(`li`,{className:`flex items-center gap-1 rounded-full border px-2 py-0.5 text-sm`,children:[w(e),!o&&(0,b.jsx)(`button`,{type:`button`,"aria-label":n(`picker.remove`,{name:w(e)}),onClick:()=>m(p.filter(t=>t!==e)),children:(0,b.jsx)(Cx,{className:`size-3.5`})})]},e)),p.length===0&&(0,b.jsx)(`li`,{className:`text-sm text-muted-foreground`,children:n(`rbac.noMembers`)})]}),!o&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`member-search`,children:n(`rbac.addMember`)}),(0,b.jsx)(Oh,{id:`member-search`,value:h,placeholder:n(`rbac.searchUsers`),onChange:e=>g(e.target.value)}),(0,b.jsx)(`ul`,{"aria-label":n(`rbac.searchResults`),className:`flex flex-wrap gap-2`,children:(_.data?.items??[]).filter(e=>!p.includes(e.id)).map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{C({...x,[e.id]:e.displayName}),m([...p,e.id])},children:[(0,b.jsx)(hb,{}),e.displayName,e.username?` (${e.username})`:``]})},e.id))})]})]}),!o&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`submit`,disabled:D.isPending||!s.trim(),children:n(D.isPending?`form.saving`:`form.save`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>i(`/-/groups`),children:n(`common.cancel`)}),t&&(0,b.jsx)(q,{type:`button`,variant:`outline`,className:`ms-auto`,disabled:O.isPending,onClick:()=>O.mutate(),children:n(`form.delete`)})]})]})}var uw=[`view`,`create`,`update`,`delete`,`purge`,`field`,`action`];function dw(e,t){let n=e.split(`.`),r=t.split(`.`),i=r[0]===`page`&&!uw.includes(r[1]??``)&&(r.length===2||r.length===3&&r[2]===`update`);if(n[0]===`*`&&n.length>1&&i)return!1;for(let e=0;e<n.length;e++){let t=n[e];if(t===`*`&&e===n.length-1)return r.length>e;if(e>=r.length||t!==`*`&&t!==r[e])return!1}return n.length===r.length}function fw(e){let t=[...e.global];for(let n of e.resources){for(let r of e.operations)t.push(`${n.name}.${r}`);for(let e of n.custom)t.push(`${n.name}.${e}`);for(let e of n.actions)t.push(`${n.name}.action.${e.name}`)}for(let n of e.pages)t.push(`page.${n.name}`,`page.${n.name}.update`);return t}function pw(e,t){return e.some(e=>dw(e,t))}function mw(e,t,n,r){if(n)return pw(e,t)?e:[...e,t];let i=[];for(let n of e)if(n!==t){if(n.includes(`*`)&&dw(n,t)){for(let e of r)e!==t&&dw(n,e)&&!i.includes(e)&&i.push(e);continue}i.push(n)}return i.filter(e=>e===t||!dw(e,t))}var hw=[`view`,`update`,`delete`];function gw(){let{t:e}=Y(),{name:t}=$i(),n=t===void 0,r=ft({queryKey:[`rbac`,`catalog`],queryFn:Q.rbac.catalog}),i=ft({queryKey:[`rbac`,`role`,t],queryFn:()=>Q.rbac.role(t),enabled:!n});return r.isPending||!n&&i.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(G,{tone:`error`,children:pg(r.error)}):!n&&i.isError?(0,b.jsx)(G,{tone:`error`,children:pg(i.error)}):(0,b.jsx)(_w,{catalog:r.data,role:n?void 0:i.data},t??`new`)}function _w({catalog:e,role:t}){let{t:n,locale:r}=Y(),i=Yi(),a=S(),o=Gg(),s=t?.system===!0||o.data?.rbac.manage!==!0,c=fw(e),[l,u]=(0,y.useState)(t?.name??``),[d,f]=(0,y.useState)(E_(t?.label)),[p,m]=(0,y.useState)(t?.permissions??[]),[h,g]=(0,y.useState)(t?.fields??{}),[_,v]=(0,y.useState)(t?.scopes??{}),[x,C]=(0,y.useState)(null),[w,T]=(0,y.useState)(null),E=pt({mutationFn:()=>{let e={label:T_(d),permissions:p,fields:vw(h),scopes:vw(_)};return t?Q.rbac.updateRole(t.name,e):Q.rbac.createRole({name:l.trim(),...e})},onSuccess:async e=>{await a.invalidateQueries({queryKey:[`rbac`]}),await a.invalidateQueries({queryKey:[`session`]}),i(`/-/roles/${encodeURIComponent(e.name)}`,{replace:!0}),T(null)},onError:e=>T(e instanceof fg?[e.message,...Object.values(e.fields).flat()].join(` — `):pg(e))}),D=pt({mutationFn:()=>Q.rbac.deleteRole(t.name),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`rbac`]}),i(`/-/roles`)},onError:e=>T(pg(e))}),O=(e,t)=>m(n=>mw(n,e,t,c)),k=(e,t,n)=>g(r=>{let i={...r,[e]:{...r[e]}};return n===``?delete i[e][t]:i[e][t]=n,i}),A=(e,t,n,r)=>v(i=>{let a=i[e]?.[t],o=new Set(Array.isArray(a)?a:a?[a]:[]);return r?o.add(n):o.delete(n),{...i,[e]:{...i[e],[t]:[...o]}}});function j(e){e.preventDefault(),s||E.mutate()}let M=[...new Set(e.resources.map(e=>e.group))];return(0,b.jsxs)(`form`,{onSubmit:j,className:`flex max-w-5xl flex-col gap-5`,"aria-label":n(`rbac.role`),children:[(0,b.jsx)(D_,{children:t?w_(t.label,r)||t.name:n(`rbac.newRole`)}),t?.system&&(0,b.jsx)(O_,{tone:`success`,children:n(`rbac.systemNote`)}),w&&(0,b.jsx)(O_,{children:w}),(0,b.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`role-name`,children:n(`rbac.name`)}),(0,b.jsx)(Oh,{id:`role-name`,dir:`ltr`,value:l,disabled:!!t,onChange:e=>u(e.target.value)})]}),dg.locales.map(e=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`role-label-${e}`,children:n(`rbac.labelIn`,{language:e})}),(0,b.jsx)(Oh,{id:`role-label-${e}`,value:d[e]??``,disabled:s,onChange:t=>f({...d,[e]:t.target.value})})]},e))]}),(0,b.jsxs)(`section`,{"aria-labelledby":`matrix-title`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`matrix-title`,className:`font-medium`,children:n(`rbac.matrix`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`border-b bg-muted/40`,children:[(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:n(`rbac.resource`)}),e.operations.map(e=>(0,b.jsx)(`th`,{className:`px-2 py-2 text-center font-medium`,children:n(`rbac.op.${e}`)},e)),(0,b.jsx)(`th`,{className:`w-0`})]})}),(0,b.jsx)(`tbody`,{children:M.map(t=>(0,b.jsx)(y.Fragment,{children:e.resources.filter(e=>e.group===t).map(t=>{let r=x===t.name,i=`role-details-${t.name}`;return(0,b.jsxs)(y.Fragment,{children:[(0,b.jsxs)(`tr`,{className:`border-b last:border-0`,children:[(0,b.jsx)(`th`,{scope:`row`,className:`px-3 py-2 text-start font-normal`,children:t.label}),e.operations.map(e=>{let r=`${t.name}.${e}`;return(0,b.jsx)(`td`,{className:`px-2 py-2 text-center`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":n(`rbac.grant`,{operation:n(`rbac.op.${e}`),resource:t.label}),checked:pw(p,r),disabled:s,onChange:e=>O(r,e.target.checked)})},e)}),(0,b.jsx)(`td`,{className:`px-2`,children:(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-expanded":r,"aria-controls":i,"aria-label":n(`rbac.details`,{resource:t.label}),onClick:()=>C(r?null:t.name),children:(0,b.jsx)(Cv,{className:W(`transition-transform`,r&&`rotate-180`)})})})]}),r&&(0,b.jsx)(`tr`,{id:i,className:`border-b bg-muted/20`,children:(0,b.jsx)(`td`,{colSpan:e.operations.length+2,className:`px-3 py-3`,children:(0,b.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n(`rbac.fields`)}),t.fields.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[(0,b.jsxs)(`span`,{children:[e.label,e.restricted&&(0,b.jsx)(`span`,{className:`ms-2 rounded-full bg-amber-500/15 px-2 py-0.5 text-xs text-amber-800 dark:text-amber-300`,children:n(`rbac.restricted`)})]}),(0,b.jsxs)(`select`,{className:`h-8 rounded-lg border border-input bg-transparent px-2 text-sm`,value:h[t.name]?.[e.name]??``,disabled:s,"aria-label":n(`rbac.fieldRule`,{field:e.label}),onChange:n=>k(t.name,e.name,n.target.value),children:[(0,b.jsx)(`option`,{value:``,children:n(e.restricted?`rbac.rule.defaultHidden`:`rbac.rule.default`)}),(0,b.jsx)(`option`,{value:`hidden`,children:n(`rbac.rule.hidden`)}),(0,b.jsx)(`option`,{value:`readonly`,children:n(`rbac.rule.readonly`)}),(0,b.jsx)(`option`,{value:`edit`,children:n(`rbac.rule.edit`)})]})]},e.name))]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t.scopes.length>0&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n(`rbac.scopes`)}),hw.map(e=>{let r=_[t.name]?.[e],i=Array.isArray(r)?r:r?[r]:[];return(0,b.jsxs)(`fieldset`,{className:`flex flex-wrap items-center gap-3`,children:[(0,b.jsxs)(`legend`,{className:`me-2 text-sm`,children:[n(`rbac.op.${e}`),`:`]}),t.scopes.map(n=>(0,b.jsxs)(`label`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:i.includes(n),disabled:s,onChange:r=>A(t.name,e,n,r.target.checked)}),n]},n)),i.length===0&&(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`rbac.allRows`)})]},e)})]}),t.actions.length>0&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,"data-actions":t.name,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n(`rbac.actions`)}),t.actions.map(e=>{let n=`${t.name}.action.${e.name}`;return(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:pw(p,n),disabled:s,onChange:e=>O(n,e.target.checked)}),e.label,(0,b.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:n})]},e.name)}),t.actions.some(e=>e.target===`record`)&&(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`rbac.actionNote`)})]}),t.custom.length>0&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n(`rbac.custom`)}),t.custom.map(e=>{let n=`${t.name}.${e}`;return(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:pw(p,n),disabled:s,onChange:e=>O(n,e.target.checked)}),(0,b.jsx)(`code`,{className:`text-xs`,children:n})]},e)})]})]})]})})})]},t.name)})},t))})]})})]}),e.pages.length>0&&(0,b.jsxs)(`section`,{"aria-labelledby":`pages-title`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`pages-title`,className:`font-medium`,children:n(`rbac.pages`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`border-b bg-muted/40`,children:[(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:n(`rbac.page`)}),(0,b.jsx)(`th`,{className:`px-2 py-2 text-center font-medium`,children:n(`rbac.op.view`)}),(0,b.jsx)(`th`,{className:`px-2 py-2 text-center font-medium`,children:n(`rbac.op.update`)})]})}),(0,b.jsx)(`tbody`,{children:e.pages.map(e=>{let t=`page.${e.name}`,r=`${t}.update`,i=pw(p,r)&&!pw(p,t);return(0,b.jsxs)(`tr`,{className:`border-b last:border-0`,children:[(0,b.jsx)(`th`,{scope:`row`,className:`px-3 py-2 text-start font-normal`,children:e.label}),(0,b.jsx)(`td`,{className:`px-2 py-2 text-center`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":n(`rbac.grant`,{operation:n(`rbac.op.view`),resource:e.label}),title:i?n(`rbac.viewImplied`):void 0,checked:i||pw(p,t),disabled:s||i,onChange:e=>O(t,e.target.checked)})}),(0,b.jsx)(`td`,{className:`px-2 py-2 text-center`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":n(`rbac.grant`,{operation:n(`rbac.op.update`),resource:e.label}),checked:pw(p,r),disabled:s,onChange:e=>O(r,e.target.checked)})})]},e.name)})})]})})]}),e.global.length>0&&(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`legend`,{className:`mb-1 font-medium`,children:n(`rbac.global`)}),e.global.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:pw(p,e),disabled:s,onChange:t=>O(e,t.target.checked)}),(0,b.jsx)(`code`,{className:`text-xs`,children:e})]},e))]}),!s&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`submit`,disabled:E.isPending||!t&&!l.trim(),children:n(E.isPending?`form.saving`:`form.save`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>i(`/-/roles`),children:n(`common.cancel`)}),t&&(0,b.jsx)(q,{type:`button`,variant:`outline`,className:`ms-auto`,disabled:D.isPending,onClick:()=>D.mutate(),children:n(`form.delete`)})]})]})}function vw(e){let t=Object.entries(e).map(([e,t])=>[e,Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0&&!(Array.isArray(e)&&e.length===0)))]).filter(([,e])=>Object.keys(e).length>0);return t.length>0?Object.fromEntries(t):void 0}function yw(){let{t:e,locale:t}=Y(),n=Gg(),r=S(),i=ft({queryKey:[`rbac`,`roles`],queryFn:Q.rbac.roles}),a=(0,y.useRef)(null),[o,s]=(0,y.useState)(null),c=n.data?.rbac.manage===!0,l=pt({mutationFn:async e=>Q.rbac.importRoles(JSON.parse(await e.text())),onSuccess:async t=>{s(e(`rbac.imported`,{count:t.imported.length})),await r.invalidateQueries({queryKey:[`rbac`]})}});async function u(){let e=await Q.rbac.exportRoles(),t=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:`application/json`})),n=document.createElement(`a`);n.href=t,n.download=`roles.json`,n.click(),URL.revokeObjectURL(t)}return i.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):i.isError?(0,b.jsx)(G,{tone:`error`,children:pg(i.error)}):(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(D_,{actions:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(q,{variant:`outline`,onClick:()=>void u(),children:[(0,b.jsx)(Gv,{}),e(`rbac.export`)]}),c&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`input`,{ref:a,type:`file`,accept:`application/json,.json`,className:`hidden`,"aria-label":e(`rbac.importFile`),onChange:e=>{let t=e.target.files?.[0];t&&l.mutate(t),e.target.value=``}}),(0,b.jsxs)(q,{variant:`outline`,onClick:()=>a.current?.click(),children:[(0,b.jsx)(lx,{}),e(`rbac.import`)]}),(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/-/roles/new`,children:[(0,b.jsx)(hb,{}),e(`rbac.newRole`)]})})]})]}),children:e(`rbac.roles`)}),o&&(0,b.jsx)(O_,{tone:`success`,children:o}),l.isError&&(0,b.jsx)(O_,{children:l.error instanceof SyntaxError?e(`rbac.notJson`):pg(l.error)}),(0,b.jsx)(`ul`,{"aria-label":e(`rbac.roles`),className:`flex flex-col divide-y rounded-card border bg-card shadow-card`,children:i.data.items.map(n=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{to:`/-/roles/${encodeURIComponent(n.name)}`,className:`flex flex-wrap items-center justify-between gap-2 px-4 py-3 hover:bg-muted/50`,children:[(0,b.jsxs)(`span`,{className:`flex flex-col`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:w_(n.label,t)||n.name}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.name})]}),(0,b.jsxs)(`span`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e(`rbac.permissionCount`,{count:n.permissions.length}),n.system&&(0,b.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5`,children:e(`rbac.system`)})]})]})},n.name))})]})}function bw(){let{t:e}=Y(),t=Gg(),[n,r]=wo(),i=n.get(`search`)??``,a=Math.max(1,Number(n.get(`page`))||1),[o,s]=(0,y.useState)(i),c=ft({queryKey:[`rbac`,`users`,i,a],queryFn:()=>Q.rbac.users({search:i,page:a})});if(c.isPending)return(0,b.jsx)(G,{children:e(`common.loading`)});if(c.isError)return(0,b.jsx)(G,{tone:`error`,children:pg(c.error)});let{items:l,total:u,pageSize:d,capabilities:f}=c.data;return(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(D_,{actions:t.data?.rbac.manage&&f.create&&(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/-/users/new`,children:[(0,b.jsx)(hb,{}),e(`rbac.newUser`)]})}),children:e(`rbac.users`)}),!f.list&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`rbac.usersFromMemberships`)}),(0,b.jsxs)(`form`,{role:`search`,className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),r(o.trim()?{search:o.trim()}:{})},children:[(0,b.jsx)(Oh,{"aria-label":e(`rbac.searchUsers`),placeholder:e(`rbac.searchUsers`),value:o,onChange:e=>s(e.target.value)}),(0,b.jsx)(q,{type:`submit`,variant:`outline`,children:e(`filters.search`)})]}),(0,b.jsxs)(`ul`,{"aria-label":e(`rbac.users`),className:`flex flex-col divide-y rounded-card border bg-card shadow-card`,children:[l.map(t=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{to:`/-/users/${encodeURIComponent(t.id)}`,className:`flex flex-wrap items-center justify-between gap-2 px-4 py-3 hover:bg-muted/50`,children:[(0,b.jsxs)(`span`,{className:`flex flex-col`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:t.displayName}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:[t.username,t.email].filter(Boolean).join(` · `)})]}),(0,b.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-xs`,children:[t.isSuperuser&&(0,b.jsx)(`span`,{className:`rounded-full bg-purple-500/15 px-2 py-0.5 text-purple-800 dark:text-purple-300`,children:e(`rbac.superuser`)}),t.isActive===!1&&(0,b.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-muted-foreground`,children:e(`rbac.inactive`)}),t.twoFactor&&(0,b.jsx)(`span`,{className:`rounded-full bg-green-500/15 px-2 py-0.5 text-green-800 dark:text-green-300`,children:e(`rbac.twoFactor`)}),t.roles.map(e=>(0,b.jsx)(`span`,{className:`rounded-full border px-2 py-0.5`,children:e},e))]})]})},t.id)),l.length===0&&(0,b.jsx)(`li`,{className:`px-4 py-3 text-sm text-muted-foreground`,children:e(`list.noMatches`)})]}),u>d&&(0,b.jsxs)(`div`,{className:`flex items-center justify-end gap-2 text-sm`,children:[(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:a<=1,onClick:()=>r({...i?{search:i}:{},page:String(a-1)}),children:e(`list.previousPage`)}),(0,b.jsx)(`span`,{children:e(`list.pageOf`,{page:a,pages:Math.ceil(u/d)})}),(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:a*d>=u,onClick:()=>r({...i?{search:i}:{},page:String(a+1)}),children:e(`list.nextPage`)})]})]})}function xw(){let{t:e}=Y(),{id:t}=$i(),n=t===void 0,r=ft({queryKey:[`rbac`,`roles`],queryFn:Q.rbac.roles}),i=ft({queryKey:[`rbac`,`groups`],queryFn:Q.rbac.groups}),a=ft({queryKey:[`rbac`,`user`,t],queryFn:()=>Q.rbac.user(t),enabled:!n}),o=ft({queryKey:[`rbac`,`users`,``,1],queryFn:()=>Q.rbac.users({})});if(r.isPending||i.isPending||o.isPending||!n&&a.isPending)return(0,b.jsx)(G,{children:e(`common.loading`)});let s=r.error??i.error??o.error??(n?null:a.error);return s?(0,b.jsx)(G,{tone:`error`,children:pg(s)}):(0,b.jsx)(Sw,{user:n?void 0:a.data,roles:r.data.items,groups:i.data.items,capabilities:o.data.capabilities},t??`new`)}function Sw({user:e,roles:t,groups:n,capabilities:r}){let{t:i,locale:a}=Y(),o=Yi(),s=S(),c=Gg(),l=c.data?.rbac.manage===!0,u=c.data?.user.isSuperuser===!0,[d,f]=(0,y.useState)(``),[p,m]=(0,y.useState)(e?.displayName??``),[h,g]=(0,y.useState)(e?.email??``),[_,v]=(0,y.useState)(e?.isActive!==!1),[x,C]=(0,y.useState)(e?.isSuperuser===!0),[w,T]=(0,y.useState)(e?.roles??[]),[E,D]=(0,y.useState)(e?.groups??[]),[O,k]=(0,y.useState)(``),[A,j]=(0,y.useState)({}),[M,N]=(0,y.useState)(null),[ee,P]=(0,y.useState)(null),F=l&&(!e?.isSuperuser||u),te=e=>{e instanceof fg&&Object.keys(e.fields).length>0?(j(e.fields),N(e.message)):(j({}),N(pg(e)))},ne=pt({mutationFn:()=>{let t=r.update||!e?{displayName:p,email:h||null,isActive:_,...u?{isSuperuser:x}:{}}:{};return e?Q.rbac.updateUser(e.id,{...t,roles:w,groups:E}):Q.rbac.createUser({username:d,displayName:p,email:h||null,password:O,...u?{isSuperuser:x}:{},roles:w,groups:E})},onSuccess:async e=>{await s.invalidateQueries({queryKey:[`rbac`]}),j({}),N(null),P(i(`rbac.saved`)),o(`/-/users/${encodeURIComponent(e.id)}`,{replace:!0})},onError:te}),re=pt({mutationFn:()=>Q.rbac.resetTwoFactor(e.id),onSuccess:async()=>{await s.invalidateQueries({queryKey:[`rbac`]}),N(null),P(i(`rbac.twoFactorReset`))},onError:te}),ie=!!e&&u&&!c.data?.viewAs&&e.id!==c.data?.user.id&&e.isActive!==!1,ae=pt({mutationFn:()=>Q.rbac.setPassword(e.id,O),onSuccess:()=>{k(``),j({}),N(null),P(i(`rbac.passwordSet`))},onError:te});function oe(e){e.preventDefault(),P(null),F&&ne.mutate()}let se=(t,n,i,a,o={})=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:t,children:n}),(0,b.jsx)(Oh,{id:t,value:i,disabled:!F||!!e&&!r.update,onChange:e=>a(e.target.value),"aria-invalid":A[t.replace(`user-`,``)]?!0:void 0,...o}),A[t.replace(`user-`,``)]&&(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:A[t.replace(`user-`,``)].join(` `)})]});return(0,b.jsxs)(`form`,{onSubmit:oe,className:`flex max-w-3xl flex-col gap-5`,"aria-label":i(`rbac.user`),children:[(0,b.jsx)(D_,{actions:ie&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,onClick:()=>{wg(e.id),s.clear(),o(`/`)},children:[(0,b.jsx)($v,{}),i(`viewAs.start`)]}),children:e?e.displayName:i(`rbac.newUser`)}),M&&(0,b.jsx)(O_,{children:M}),ee&&(0,b.jsx)(O_,{tone:`success`,children:ee}),e?.isSuperuser&&!u&&(0,b.jsx)(O_,{tone:`success`,children:i(`rbac.superuserNote`)}),(0,b.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[!e&&se(`user-username`,i(`auth.username`),d,f,{dir:`ltr`,autoComplete:`off`}),se(`user-displayName`,i(`rbac.displayName`),p,m),se(`user-email`,i(`rbac.email`),h,g,{type:`email`,dir:`ltr`}),!e&&se(`user-password`,i(`auth.password`),O,k,{type:`password`,autoComplete:`new-password`})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-6 text-sm`,children:[(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:_,disabled:!F||!!e&&!r.update,onChange:e=>v(e.target.checked)}),i(`rbac.active`)]}),u&&(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:x,disabled:!F,onChange:e=>C(e.target.checked)}),i(`rbac.superuser`)]})]}),(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`legend`,{className:`mb-1 font-medium`,children:i(`rbac.roles`)}),t.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:w.includes(e.name),disabled:!F,onChange:t=>T(t.target.checked?[...w,e.name]:w.filter(t=>t!==e.name))}),w_(e.label,a)||e.name]},e.name))]}),n.length>0&&(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`legend`,{className:`mb-1 font-medium`,children:i(`rbac.groups`)}),n.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:E.includes(e.id),disabled:!F,onChange:t=>D(t.target.checked?[...E,e.id]:E.filter(t=>t!==e.id))}),w_(e.label,a)||e.name]},e.id))]}),F&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`submit`,disabled:ne.isPending,children:i(ne.isPending?`form.saving`:e?`form.save`:`rbac.createUser`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>o(`/-/users`),children:i(`common.cancel`)})]}),e&&F&&r.password&&(0,b.jsxs)(`section`,{"aria-labelledby":`set-password`,className:`flex flex-col gap-2 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsx)(`h2`,{id:`set-password`,className:`font-medium`,children:i(`rbac.setPassword`)}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`user-new-password`,children:i(`auth.newPassword`)}),(0,b.jsx)(Oh,{id:`user-new-password`,type:`password`,autoComplete:`new-password`,value:O,onChange:e=>k(e.target.value)})]}),(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:!O||ae.isPending,onClick:()=>ae.mutate(),children:i(`rbac.setPassword`)})]}),A.password&&e&&(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:A.password.join(` `)}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`rbac.setPasswordNote`)})]}),e?.twoFactor&&F&&r.resetTwoFactor&&(0,b.jsxs)(`section`,{"aria-labelledby":`reset-two-factor`,className:`flex flex-col gap-2 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsx)(`h2`,{id:`reset-two-factor`,className:`font-medium`,children:i(`rbac.resetTwoFactor`)}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`rbac.resetTwoFactorNote`)}),(0,b.jsx)(`div`,{children:(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:re.isPending,onClick:()=>re.mutate(),children:i(`rbac.resetTwoFactor`)})})]})]})}function Cw(e){if(!e.menu)return e.groups.map(e=>({...e,items:[...e.resources.map(e=>({kind:`resource`,name:e.name,label:e.label,...e.icon?{icon:e.icon}:{}})),...e.pages.map(e=>({kind:`page`,name:e.name,label:e.label,...e.icon?{icon:e.icon}:{}}))]}));let{sections:t,advanced:n}=e.menu;return[...t,...n.items.length>0?[n]:[]].map(e=>{let t=[],r=[],i=e.items.map(n=>n.kind===`resource`?(t.push({name:n.resource,label:n.label,...n.icon?{icon:n.icon}:{},creatable:n.creatable,searchable:n.searchable}),{kind:`resource`,name:n.resource,label:n.label,...n.icon?{icon:n.icon}:{},...n.badge?{badge:`${e.key}.${n.resource}`}:{}}):n.kind===`page`?(r.push({name:n.page,label:n.label,...n.icon?{icon:n.icon}:{}}),{kind:`page`,name:n.page,label:n.label,...n.icon?{icon:n.icon}:{}}):n);return{key:e.key,label:e.label,...e.icon?{icon:e.icon}:{},resources:t,pages:r,items:i,...e===n?{advanced:!0}:{}}})}function ww(e,t){let n=e.flatMap(e=>e.kind===`resource`&&e.badge&&t?.[e.badge]?[t[e.badge]]:[]);if(n.length!==0)return{count:n.reduce((e,t)=>e+t.count,0),estimate:n.some(e=>e.estimate)}}function Tw({menu:e,current:t}){return e&&!t}function Ew(e){return Mh(e).toLocaleLowerCase().replace(/[يى]/g,`ی`).replace(/ك/g,`ک`).replace(/‌/g,` `)}function Dw(e,t){let n=Ew(e);return Ew(t).split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function Ow(e,t,n,r=[]){let i=[],a=[],o=Cw(e),s=t.trim()!==``;for(let r of o){o.length>1&&Dw(r.label,t)&&i.push({id:`group:${r.key}`,section:`go`,label:r.label,to:`/g/${r.key}`,...r.icon?{icon:r.icon}:{}});for(let o of r.resources){let c=o.icon??r.icon;Dw(`${o.label} ${r.label}`,t)&&i.push({id:`go:${o.name}`,section:`go`,label:o.label,detail:r.label,to:`/${o.name}`,...c?{icon:c}:{}});let l=n(o.label),u=s||e.menu!==void 0&&!r.advanced&&a.length<3;o.creatable&&u&&Dw(l,t)&&a.push({id:`new:${o.name}`,section:`actions`,label:l,to:`/${o.name}/new`})}for(let e of r.pages){let n=e.icon??r.icon;Dw(`${e.label} ${r.label}`,t)&&i.push({id:`page:${e.name}`,section:`go`,label:e.label,detail:r.label,to:`/p/${e.name}`,...n?{icon:n}:{}})}}let c=r.filter(e=>Dw(e.label,t)).map(e=>({id:e.id,section:`actions`,label:e.label}));return[...i,...a,...c]}var kw=`nma.theme`,Aw=`oklch(0.145 0 0)`,jw=`oklch(0.985 0 0)`;function Mw(){try{let e=localStorage.getItem(kw);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}function Nw(e,t){return e===`system`?t?`dark`:`light`:e}var Pw=()=>typeof matchMedia==`function`&&matchMedia(`(prefers-color-scheme: dark)`).matches;function Fw(e){let t=Nw(e,Pw());document.documentElement.classList.toggle(`dark`,t===`dark`),document.documentElement.style.colorScheme=t}var Iw=`nma-theme`;function Lw(e){try{localStorage.setItem(kw,e)}catch{}Fw(e),typeof window<`u`&&window.dispatchEvent(new Event(Iw))}function Rw(){Lw(Nw(Mw(),Pw())===`dark`?`light`:`dark`)}function zw(e){if(typeof matchMedia!=`function`)return()=>void 0;let t=matchMedia(`(prefers-color-scheme: dark)`),n=()=>{e()===`system`&&Fw(`system`)};return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)}function Bw(e){let t,n=/^#([0-9a-f]{3,8})$/i.exec(e.trim())?.[1];if(n){let e=n.length<=4?[...n.slice(0,3)].map(e=>e+e).join(``):n.slice(0,6);t=[0,2,4].map(t=>parseInt(e.slice(t,t+2),16))}else{let n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(e.trim());n&&(t=n.slice(1,4).map(Number))}if(!t)return;let[r,i,a]=t.map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*r+.7152*i+.0722*a}function Vw(e){let t={};if(e.primaryColor){let n=Bw(e.primaryColor),r=e.primaryForeground??(n!==void 0&&n>.45?Aw:jw);Object.assign(t,{"--primary":e.primaryColor,"--primary-foreground":r,"--ring":e.primaryColor,"--sidebar-primary":e.primaryColor,"--sidebar-primary-foreground":r})}return e.radius&&Object.assign(t,{"--nma-radius-control":e.radius,"--nma-radius-card":`calc(${e.radius} * 1.5)`}),t}function Hw(e){for(let[t,n]of Object.entries(Vw(e)))document.documentElement.style.setProperty(t,n)}var Uw=`nma.accent`,Ww=`nma-accent`,Gw=/^(#[0-9a-f]{3,8}|(rgb|rgba|hsl|hsla|oklch|oklab|lch|lab)\([0-9.,%\s/+-]+(deg|turn|rad)?[0-9.,%\s/+-]*\))$/i;function Kw(e){return(e.personal&&Gw.test(e.personal.trim())?e.personal:null)??e.admin??e.branding??void 0}function qw(){try{return localStorage.getItem(Uw)}catch{return null}}function Jw(e){try{e===null?localStorage.removeItem(Uw):localStorage.setItem(Uw,e)}catch{}}var Yw=null,Xw;function Zw(e={}){`admin`in e&&(Yw=e.admin??null),`branding`in e&&(Xw=e.branding);let t=Kw({personal:qw(),admin:Yw,branding:Xw}),n=[`--primary`,`--primary-foreground`,`--ring`,`--sidebar-primary`,`--sidebar-primary-foreground`];if(t)for(let[e,n]of Object.entries(Vw({primaryColor:t})))document.documentElement.style.setProperty(e,n);else for(let e of n)document.documentElement.style.removeProperty(e);typeof window<`u`&&window.dispatchEvent(new Event(Ww))}var Qw={archive:U_,ban:$_,bell:tv,book:rv,box:av,boxes:sv,briefcase:lv,building:dv,calendar:_v,chart:yv,check:xv,clock:Nv,"credit-card":zv,database:Vv,dollar:Uv,file:ay,"file-text":ry,folder:sy,globe:ly,heart:py,history:Cb,home:hy,image:yy,inbox:xy,key:Cy,layers:Dy,link:jy,list:Ly,lock:zy,mail:Uy,map:qy,"map-pin":Gy,message:Zy,package:rb,phone:lb,printer:_b,receipt:yb,refresh:xb,send:kb,server:jb,settings:Nb,shield:Lb,"shopping-bag":zb,cart:Vb,"shopping-cart":Vb,star:Gb,store:qb,tag:Zb,tags:$b,ticket:tx,truck:sx,user:px,users:hx,video:_x,wallet:yx,wrench:xx,x:Cx,zap:Tx};Object.keys(Qw);function $w(e,t){return eT(e)??(t===`group`?sy:t===`page`?Nb:ry)}function eT(e){return e&&Object.hasOwn(Qw,e)?Qw[e]:void 0}function tT(e,t){let[n,r]=(0,y.useState)(e);return(0,y.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function nT(){let{t:e}=Y(),t=Yi(),n=Kg(),r=Gg(),[i,a]=(0,y.useState)(!1),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)(0),u=(0,y.useId)(),d=(0,y.useRef)(null);(0,y.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`k`&&(e.preventDefault(),a(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let f=tT(o.trim(),250),p=f.length>=2&&(n.data?.groups.some(e=>e.resources.some(e=>e.searchable))??!1),m=ft({queryKey:[`search`,f],queryFn:()=>Q.search(f),enabled:i&&p,staleTime:1e4}),h=e=>{let t=n.data?Cw(n.data).find(t=>t.resources.some(t=>t.name===e)):void 0;return t?.resources.find(t=>t.name===e)?.icon??t?.icon},g=n.data?Ow(n.data,o,t=>e(`palette.new`,{name:t}),[{id:`theme`,label:e(`palette.toggleTheme`)}]):[],_=[...p&&o.trim()===f?(m.data?.groups??[]).flatMap(e=>e.items.map(t=>({id:`record:${e.resource}:${t._id}`,section:`records`,...h(e.resource)?{icon:h(e.resource)}:{},label:t._title,detail:e.label,to:`/${e.resource}/${encodeURIComponent(t._id)}`}))):[],...g.filter(e=>e.section===`actions`),...g.filter(e=>e.section===`go`),...r.data?.audit.view&&Dw(e(`audit.title`),o)?[{id:`audit`,section:`go`,label:e(`audit.title`),to:`/-/audit`}]:[]],v=Math.min(c,Math.max(0,_.length-1));(0,y.useEffect)(()=>l(0),[o,m.data]),(0,y.useEffect)(()=>{d.current?.querySelector(`[data-index="${v}"]`)?.scrollIntoView({block:`nearest`})},[v]);function x(e){e&&(a(!1),e.to?t(e.to):e.id===`theme`&&Rw())}function S(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),_.length===0)return;l((v+(e.key===`ArrowDown`?1:-1)+_.length)%_.length)}else e.key===`Enter`&&(e.preventDefault(),x(_[v]))}let C=[[`records`,e(`palette.records`)],[`actions`,e(`palette.actions`)],[`go`,e(`palette.goTo`)]],w=e=>`${u}-${e}`,T=p&&(m.isFetching||o.trim()!==f)?e(`palette.searching`):_.length===0?e(`palette.noResults`):``;return(0,b.jsxs)(jd,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,b.jsx)(Nd,{asChild:!0,children:(0,b.jsxs)(q,{variant:`outline`,className:`w-9 justify-start px-0 font-normal text-muted-foreground max-sm:justify-center sm:w-[260px] sm:px-3.5`,"aria-keyshortcuts":`Control+K Meta+K`,"aria-label":e(`palette.open`),children:[(0,b.jsx)(Db,{}),(0,b.jsx)(`span`,{className:`hidden min-w-0 flex-1 truncate text-start sm:inline`,children:e(`palette.placeholder`)}),(0,b.jsx)(`kbd`,{className:`hidden shrink-0 rounded-[5px] border border-border bg-muted px-[5px] py-px font-mono text-[11px] text-muted-foreground sm:inline`,dir:`ltr`,children:`⌘K`})]})}),(0,b.jsxs)(Ld,{children:[(0,b.jsx)(zd,{className:US}),(0,b.jsxs)(Ud,{"aria-describedby":void 0,className:`fixed inset-x-3 top-[12vh] z-50 mx-auto flex max-h-[70vh] max-w-[540px] flex-col overflow-hidden rounded-card border border-border bg-card text-card-foreground shadow-[0_24px_48px_rgba(0,0,0,.18)] outline-none`,children:[(0,b.jsx)(Jd,{className:`sr-only`,children:e(`palette.open`)}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b border-border px-4`,children:[(0,b.jsx)(Db,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(`input`,{role:`combobox`,"aria-expanded":!0,"aria-controls":u,"aria-autocomplete":`list`,"aria-activedescendant":_.length>0?w(v):void 0,"aria-label":e(`palette.open`),placeholder:e(`palette.placeholder`),className:`h-[52px] flex-1 bg-transparent text-sm outline-none`,value:o,onChange:e=>s(e.target.value),onKeyDown:S}),(0,b.jsx)(`kbd`,{className:`rounded-[5px] border border-border bg-muted px-[5px] py-px font-mono text-[11px] text-muted-foreground`,dir:`ltr`,children:`Esc`})]}),(0,b.jsx)(`ul`,{ref:d,id:u,role:`listbox`,"aria-label":e(`palette.results`),className:`flex-1 overflow-y-auto p-1.5`,children:C.map(([e,t])=>{let n=_.map((e,t)=>({item:e,index:t})).filter(({item:t})=>t.section===e);return n.length===0?null:(0,b.jsxs)(`li`,{role:`presentation`,children:[(0,b.jsx)(`div`,{className:`px-2.5 pt-2.5 pb-1 text-xs font-medium text-muted-foreground`,"aria-hidden":!0,children:t}),(0,b.jsx)(`ul`,{role:`group`,"aria-label":t,children:n.map(({item:e,index:t})=>(0,b.jsxs)(`li`,{id:w(t),role:`option`,"aria-selected":t===v,"data-index":t,className:W(`flex h-10 cursor-pointer items-center gap-3 rounded-control px-2.5 text-[13.5px]`,t===v&&`bg-muted`),onMouseMove:()=>l(t),onClick:()=>x(e),children:[(0,b.jsx)(rT,{item:e}),(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:e.section===`go`&&e.detail?`${e.detail} › ${e.label}`:e.label}),e.section===`records`&&e.detail&&(0,b.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.detail})]},e.id))})]},e)})}),(0,b.jsx)(`p`,{role:`status`,className:W(`px-4 text-sm text-muted-foreground`,T&&`border-t border-border py-2`),children:T}),(0,b.jsxs)(`div`,{className:`flex items-center gap-4 border-t border-border px-4 py-2.5 text-xs text-muted-foreground`,"aria-hidden":!0,children:[(0,b.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`kbd`,{className:`rounded-[5px] border border-border bg-muted px-[5px] font-mono text-[11px]`,children:`↑↓`}),e(`palette.move`)]}),(0,b.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`kbd`,{className:`rounded-[5px] border border-border bg-muted px-[5px] font-mono text-[11px]`,children:`↵`}),e(`palette.openItem`)]}),(0,b.jsxs)(`span`,{className:`ms-auto flex items-center gap-1.5`,children:[(0,b.jsx)(`kbd`,{className:`rounded-[5px] border border-border bg-muted px-[5px] font-mono text-[11px]`,dir:`ltr`,children:`⌘K`}),e(`palette.close`)]})]})]})]})]})}function rT({item:e}){let t=e.id.startsWith(`new:`)?hb:e.id===`theme`?tb:$w(e.icon,e.section===`records`?`resource`:`group`);return(0,b.jsx)(t,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})}var iT={success:5e3,error:1e4},aT=4;function oT(e=globalThis){let t=[],n=1,r=new Map,i=new Set,a=e=>{t=e;for(let e of i)e()},o=n=>{let i=r.get(n);i!==void 0&&e.clearTimeout(i),r.delete(n),t.some(e=>e.id===n)&&a(t.filter(e=>e.id!==n))};return{get:()=>t,subscribe(e){return i.add(e),()=>i.delete(e)},show(i,s=`success`){let c=n++,l=[...t,{id:c,message:i,tone:s}];for(let e of l.slice(0,Math.max(0,l.length-aT)))o(e.id);return a([...t,{id:c,message:i,tone:s}]),r.set(c,e.setTimeout(()=>o(c),iT[s])),c},dismiss:o}}var sT=oT(),cT=(e,t=`success`)=>sT.show(e,t);function lT(){return(0,y.useSyncExternalStore)(sT.subscribe,sT.get)}var uT={en:`English`,fa:`فارسی`};function dT(){let{t:e}=Y(),[t,n]=(0,y.useState)(Mw),r=[[`light`,e(`shell.themeLight`),Yb],[`dark`,e(`shell.themeDark`),tb],[`system`,e(`shell.themeSystem`),$y]];return(0,b.jsx)(`div`,{role:`radiogroup`,"aria-label":e(`shell.theme`),className:`flex items-center rounded-control border border-border p-0.5`,children:r.map(([e,r,i])=>(0,b.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":t===e,"aria-label":r,title:r,className:W(`rounded-md p-1.5 text-muted-foreground hover:text-foreground`,t===e&&`bg-muted text-foreground`),onClick:()=>{Lw(e),n(e)},children:(0,b.jsx)(i,{className:`size-4`})},e))})}function fT(){let{t:e,locale:t,locales:n,setLocale:r}=Y();return n.length<2?null:(0,b.jsxs)(`label`,{className:`flex items-center gap-1.5 text-[13px]`,children:[(0,b.jsx)(Ty,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`sr-only`,children:e(`shell.language`)}),(0,b.jsx)(`select`,{className:`h-8 flex-1 rounded-control border border-input bg-card px-2 text-[13px]`,value:t,onChange:e=>r(e.target.value),children:n.map(e=>(0,b.jsx)(`option`,{value:e,lang:e,children:uT[e]??e},e))})]})}function pT(){let{t:e,calendar:t,digits:n,setDisplay:r}=Y(),i=(e,t,n,r)=>(0,b.jsxs)(`div`,{role:`radiogroup`,"aria-label":e,className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,b.jsx)(`div`,{className:`flex rounded-control border border-border p-0.5`,children:n.map(([e,n])=>(0,b.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":t===e,className:W(`flex-1 cursor-pointer rounded-md px-2 py-1 text-[13px] text-muted-foreground hover:text-foreground`,t===e&&`bg-muted text-foreground`),onClick:()=>r(e),children:n},e))})]});return(0,b.jsxs)(b.Fragment,{children:[i(e(`display.calendar`),t,[[`gregorian`,e(`display.gregorian`)],[`persian`,e(`display.jalali`)]],e=>r({calendar:e})),i(e(`display.digits`),n,[[`latn`,e(`display.latinDigits`)],[`arabext`,e(`display.persianDigits`)]],e=>r({digits:e}))]})}function mT(){let{t:e}=Y(),[t,n]=(0,y.useState)(Mw);(0,y.useEffect)(()=>{let e=()=>n(Mw());return window.addEventListener(Iw,e),()=>window.removeEventListener(Iw,e)},[]);let r=t===`dark`||t===`system`&&typeof matchMedia==`function`&&matchMedia(`(prefers-color-scheme: dark)`).matches;return(0,b.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":e(`shell.theme`),title:e(`shell.theme`),onClick:Rw,children:r?(0,b.jsx)(Yb,{}):(0,b.jsx)(tb,{})})}var hT=[`#5B5BD6`,`#2563EB`,`#0E7490`,`#0F766E`,`#9333EA`,`#DB2777`,`#EA580C`];function gT(){let{t:e}=Y(),t=Gg(),n=S(),[r,i]=(0,y.useState)(qw);(0,y.useEffect)(()=>{let e=()=>i(qw());return window.addEventListener(Ww,e),()=>window.removeEventListener(Ww,e)},[]);let a=t.data?.appearance,o=pt({mutationFn:e=>Q.setAppearance(e),onSuccess:async({accent:e})=>{Jw(null),Zw({admin:e}),await n.invalidateQueries({queryKey:[`session`]})}}),s=e=>{Jw(e),Zw()},c=r??a?.accent??null;return(0,b.jsxs)(`div`,{role:`group`,"aria-label":e(`display.accent`),className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:e(`display.accent`)}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[hT.map(e=>(0,b.jsx)(`button`,{type:`button`,"aria-label":e,"aria-pressed":c?.toLowerCase()===e.toLowerCase(),className:W(`size-6 cursor-pointer rounded-full border-2 border-transparent outline-none focus-visible:ring-2 focus-visible:ring-ring`,c?.toLowerCase()===e.toLowerCase()&&`border-foreground`),style:{background:e},onClick:()=>s(e)},e)),(0,b.jsx)(`button`,{type:`button`,className:`size-6 cursor-pointer overflow-hidden rounded-full border border-border bg-[conic-gradient(red,yellow,lime,aqua,blue,magenta,red)]`,"aria-label":e(`display.customAccent`),title:e(`display.customAccent`),onClick:()=>CT(c)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-6 px-1.5 text-xs`,"aria-pressed":r===null,onClick:()=>s(null),children:e(`display.defaultAccent`)})]}),a?.manage&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 text-xs`,disabled:o.isPending||!r||r===a.accent,onClick:()=>o.mutate(r),children:e(`display.accentForEveryone`)}),a.accent&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-xs`,disabled:o.isPending,onClick:()=>o.mutate(null),children:e(`display.resetForEveryone`)})]}),o.isError&&(0,b.jsx)(`p`,{className:`text-xs text-destructive`,children:pg(o.error)}),a?.manage&&(0,b.jsx)(_T,{logo:a.logo,favicon:a.favicon})]})}function _T({logo:e,favicon:t}){let{t:n}=Y(),r=pt({mutationFn:e=>Q.removePicture(e),onSuccess:()=>window.location.reload(),onError:e=>cT(pg(e),`error`)}),i=(e,t)=>(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`span`,{className:`w-14 text-xs text-muted-foreground`,children:n(e===`logo`?`display.logo`:`display.favicon`)}),t&&(0,b.jsx)(`img`,{src:t,alt:``,className:`size-6 rounded object-contain`}),(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:()=>bT(e),children:n(`display.uploadPicture`)}),t&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-xs`,disabled:r.isPending,onClick:()=>r.mutate(e),children:n(`display.removePicture`)})]});return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5 pt-1`,children:[i(`logo`,e),i(`favicon`,t)]})}var vT=null,yT=`logo`;function bT(e){vT&&(yT=e,vT.value=``,vT.click())}function xT(){return Gg().data?.appearance?.manage===!0?(0,b.jsx)(`input`,{ref:e=>{vT=e},type:`file`,accept:`image/png,image/jpeg,image/gif,image/webp,image/svg+xml,image/x-icon,.ico`,tabIndex:-1,"aria-hidden":!0,"data-testid":`picture-input`,className:`pointer-events-none fixed bottom-0 start-0 size-px opacity-0`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&Q.setPicture(yT,t).then(()=>window.location.reload(),e=>cT(pg(e),`error`))}}):null}var ST=null;function CT(e){ST&&(e&&/^#[0-9a-f]{6}$/i.test(e)&&(ST.value=e),ST.click())}function wT(){return(0,b.jsx)(`input`,{ref:e=>{ST=e},type:`color`,tabIndex:-1,"aria-hidden":!0,className:`pointer-events-none fixed bottom-0 start-0 size-px opacity-0`,onInput:e=>{Jw(e.currentTarget.value),Zw()}})}var TT=`nma.nav`,ET={pinned:[],recent:[],collapsedGroups:[],expandedGroups:[],railCollapsed:!1};function DT(e){let t=ET;try{let n=e?.getItem(TT);n&&(t={...ET,...JSON.parse(n)})}catch{t=ET}let n=new Set,r=r=>{t=r;try{e?.setItem(TT,JSON.stringify(r))}catch{}for(let e of n)e()},i=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t];return{get:()=>t,subscribe(e){return n.add(e),()=>n.delete(e)},togglePin:e=>r({...t,pinned:i(t.pinned,e)}),visit:e=>{t.recent[0]!==e&&r({...t,recent:[e,...t.recent.filter(t=>t!==e)].slice(0,5)})},toggleGroup:(e,n=!1)=>{let i=MT(t,e,n),a=t=>t.filter(t=>t!==e);r({...t,collapsedGroups:i?a(t.collapsedGroups):[...a(t.collapsedGroups),e],expandedGroups:i?[...a(t.expandedGroups),e]:a(t.expandedGroups)})},toggleRail:()=>r({...t,railCollapsed:!t.railCollapsed})}}function OT(){try{return typeof localStorage>`u`?void 0:localStorage}catch{return}}var kT=DT(OT());function AT(){return(0,y.useSyncExternalStore)(kT.subscribe,kT.get)}function jT(e,t){return e.filter(e=>t.has(e))}function MT(e,t,n){return e.collapsedGroups.includes(t)?!0:!e.expandedGroups.includes(t)&&n}function NT(e){let{t}=Y(),[n,r,i]=qi().pathname.split(`/`).filter(Boolean).map(e=>decodeURIComponent(e)),a=n&&n!==`g`&&n!==`p`&&n!==`-`&&r&&r!==`new`?r:void 0,o=Zg(n??``,a),s=!!n&&![`g`,`p`,`-`,`account`].includes(n),c=qg(n??``,s&&e!==void 0&&!Cw(e).some(e=>e.resources.some(e=>e.name===n))),l=[{label:t(e?.dashboard?`shell.dashboard`:`shell.home`),to:`/`}];if(n===`account`&&!r)return[...l,{label:t(`auth.account`)}];if(n===`-`&&(r===`users`||r===`groups`||r===`roles`||r===`debugger`||r===`audit`)){let e={users:t(`rbac.users`),groups:t(`rbac.groups`),roles:t(`rbac.roles`),debugger:t(`debugger.title`),audit:t(`audit.title`)}[r];return l.push({label:t(`rbac.administration`)},{label:e,to:`/-/${r}`}),i&&l.push({label:i===`new`?t(`list.new`):i}),l}if(!n||!e)return l;let u=Cw(e);if(n===`g`){let e=u.find(e=>e.key===r);return e&&l.push({label:e.label}),l}if(n===`p`){let e=u.find(e=>e.pages.some(e=>e.name===r)),t=e?.pages.find(e=>e.name===r);return e&&t&&l.push({label:e.label,to:`/g/${e.key}`},{label:t.label}),l}let d=u.find(e=>e.resources.some(e=>e.name===n)),f=d?.resources.find(e=>e.name===n);return!d||!f?c.data?(l.push({label:c.data.label,to:`/${n}`}),a&&l.push({label:typeof o.data?._title==`string`?o.data._title:`#${a}`}),l):l:(l.push({label:d.label,to:`/g/${d.key}`},{label:f.label,to:`/${f.name}`}),r===`new`?l.push({label:t(`form.new`,{name:f.label})}):a&&l.push({label:typeof o.data?._title==`string`?o.data._title:`#${a}`}),l)}function PT({meta:e,onOpenMenu:t}){let{t:n}=Y(),r=AT(),i=NT(e),a=i.length-1;return(0,b.jsxs)(`header`,{className:`flex h-14 items-center gap-2 border-b border-border bg-card px-5`,children:[(0,b.jsx)(q,{variant:`ghost`,size:`icon`,className:`md:hidden`,"aria-label":n(`shell.menu`),onClick:t,"data-sidebar-toggle":``,children:(0,b.jsx)(Yy,{})}),(0,b.jsx)(q,{variant:`ghost`,size:`icon`,className:`hidden md:inline-flex`,"aria-label":n(r.railCollapsed?`shell.expandSidebar`:`shell.collapseSidebar`),"aria-pressed":r.railCollapsed,onClick:()=>kT.toggleRail(),"data-sidebar-toggle":``,children:(0,b.jsx)(ab,{className:`ltr:-scale-x-100`})}),(0,b.jsx)(`div`,{className:`hidden h-5 w-px bg-border md:block`,"aria-hidden":!0}),(0,b.jsx)(`nav`,{"aria-label":n(`shell.breadcrumbs`),className:`min-w-0 flex-1 ps-1`,children:(0,b.jsx)(`ol`,{className:`flex min-w-0 items-center gap-1.5 text-sm text-muted-foreground`,children:i.map((e,t)=>(0,b.jsxs)(y.Fragment,{children:[t>0&&(0,b.jsx)(Tv,{className:`size-3.5 shrink-0 ltr:rotate-180`,"aria-hidden":!0}),(0,b.jsx)(`li`,{className:t===a?`truncate font-medium text-foreground`:`hidden truncate sm:block`,children:e.to&&t!==a?(0,b.jsx)(bo,{to:e.to,className:`hover:text-foreground`,children:e.label}):(0,b.jsx)(`span`,{"aria-current":t===a?`page`:void 0,children:e.label})})]},`${t}:${e.label}`))})}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(nT,{}),(0,b.jsx)(mT,{})]})]})}function FT({rail:e=!1}){let{t}=Y(),n=Gg(),r=Yi(),i=S(),a=n.data;if(!a)return null;let{user:o,auth:s}=a,c=o.displayName.split(/\s+/).filter(Boolean).slice(0,2).map(e=>[...e][0].toUpperCase()).join(``);async function l(){try{await Q.logout()}finally{gg(void 0),wg(void 0),i.clear(),r(`/login`,{replace:!0})}}return(0,b.jsxs)(Sh,{children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsxs)(`button`,{type:`button`,"aria-label":t(`auth.userMenu`,{name:o.displayName}),"data-user-block":``,className:W(`flex cursor-pointer items-center gap-2.5 rounded-control text-start hover:bg-muted`,e?`size-10 justify-center`:`px-2.5 py-2`),children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-[13px] font-semibold`,children:c||(0,b.jsx)(dx,{className:`size-4`})}),!e&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`span`,{className:`min-w-0 flex-1 leading-[1.35]`,children:[(0,b.jsx)(`span`,{className:`block truncate text-[13px] font-medium`,children:o.displayName}),(o.username||o.email)&&(0,b.jsx)(`span`,{className:`block truncate text-[11.5px] text-muted-foreground`,children:o.email??o.username})]}),(0,b.jsx)(qv,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})]})]})}),(0,b.jsx)(wh,{children:(0,b.jsxs)(Th,{side:`top`,align:`start`,sideOffset:6,className:`z-50 flex w-64 flex-col gap-1 rounded-[10px] border border-border bg-popover p-1.5 text-popover-foreground shadow-[0_12px_32px_rgba(0,0,0,.12)]`,children:[(s.password||s.sessions||s.twoFactor)&&!a.viewAs&&(0,b.jsx)(Eh,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/account`,className:`flex h-[34px] items-center gap-2.5 rounded-md px-2 text-[13px] hover:bg-muted`,children:[(0,b.jsx)(dx,{className:`size-4`}),t(`auth.account`)]})}),a.audit.view&&(0,b.jsx)(Eh,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/-/audit`,className:`flex h-[34px] items-center gap-2.5 rounded-md px-2 text-[13px] hover:bg-muted`,children:[(0,b.jsx)(Cb,{className:`size-4`}),t(`audit.title`)]})}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 border-y border-border px-2 py-2`,children:[(0,b.jsx)(fT,{}),(0,b.jsx)(pT,{}),(0,b.jsx)(dT,{}),(0,b.jsx)(gT,{})]}),s.logout&&!a.open&&(0,b.jsxs)(`button`,{type:`button`,className:`flex h-[34px] items-center gap-2.5 rounded-md px-2 text-start text-[13px] hover:bg-muted`,onClick:()=>void l(),children:[(0,b.jsx)(Vy,{className:`size-4 rtl:-scale-x-100`}),t(`auth.signOut`)]})]})})]})}var IT=`flex h-9 w-full cursor-pointer items-center gap-2.5 rounded-control px-2.5 text-start text-[13.5px] text-sidebar-foreground hover:bg-muted`,LT=({isActive:e})=>W(`flex h-8 items-center rounded-[7px] px-2.5 text-[13px] text-muted-foreground hover:bg-muted hover:text-foreground`,e&&`bg-primary-soft font-semibold text-primary-text hover:bg-primary-soft hover:text-primary-text`);function RT(e){return e.kind===`resource`?{key:e.name,to:`/${e.name}`,label:e.label,pin:e.name,...e.badge?{badge:e.badge}:{}}:e.kind===`page`?{key:`page:${e.name}`,to:`/p/${e.name}`,label:e.label}:{key:`link:${e.href}`,to:e.href,label:e.label,external:/^https?:\/\//i.test(e.href)}}var zT=(e,t)=>!t.external&&(e===t.to||e.startsWith(`${t.to}/`));function BT(e,t,n,r,i){let a=e.map(e=>{let r=e.items.map(RT);return{key:e.key,label:e.label,icon:$w(e.icon,`group`),entries:r,collapsedByDefault:Tw({menu:t,current:r.some(e=>zT(n,e))}),asLink:t&&!e.advanced&&r.length===1}});return r.length>0?[{key:`~pinned`,label:i,icon:pb,entries:r},...a]:a}function VT({title:e,logo:t,groups:n,menu:r,rail:i=!1,onClose:a}){let{t:o}=Y(),s=AT(),{pathname:c}=qi(),l=Jg(r).data,u=new Map(n.flatMap(e=>e.items.flatMap(e=>e.kind===`resource`?[[e.name,RT(e)]]:[]))),d=BT(n,r,c,jT(s.pinned,new Set(u.keys())).map(e=>u.get(e)),o(`shell.pinned`)),f=d.find(e=>n.some(t=>t.advanced&&t.key===e.key)),p=d.filter(e=>e!==f),m=JT(),h=(e,t=!1)=>i?(0,b.jsx)(KT,{section:e,muted:t},e.key):(0,b.jsx)(GT,{section:e,collapsed:MT(s,e.key,e.collapsedByDefault??!1),badges:l,muted:t,large:!!a},e.key);return(0,b.jsxs)(`nav`,{"aria-label":o(`shell.resources`),className:`flex h-full flex-col`,children:[(0,b.jsx)(WT,{title:e,logo:t,rail:i,onClose:a}),(0,b.jsxs)(`div`,{className:W(`flex flex-1 flex-col gap-0.5 overflow-y-auto`,i?`items-center px-0 py-2.5`:`p-2.5`),children:[r&&(0,b.jsx)(HT,{to:`/`,label:o(`shell.dashboard`),icon:ky,rail:i,large:!!a,end:!0}),p.map(e=>h(e))]}),(0,b.jsxs)(`div`,{className:W(`flex flex-col gap-1 border-t border-sidebar-border`,i?`items-center px-0 py-2.5`:`p-2.5`),children:[f&&h(f,!0),m&&h(m,!0),(0,b.jsx)(FT,{rail:i})]})]})}function HT({to:e,label:t,icon:n,rail:r,large:i,end:a,external:o,count:s}){let c=({isActive:e})=>r?W(`flex size-10 items-center justify-center rounded-control hover:bg-muted`,e&&`bg-primary-soft text-primary-text hover:bg-primary-soft`):W(IT,i&&`h-11 text-[15px]`,e&&`bg-primary-soft font-semibold text-primary-text hover:bg-primary-soft`),l=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":!0}),!r&&(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:t}),!r&&s&&(0,b.jsx)(UT,{count:s})]});return o?(0,b.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,"aria-label":r?t:void 0,title:r?t:void 0,className:c({isActive:!1}),children:l}):(0,b.jsx)(xo,{to:e,end:a,"aria-label":r?t:void 0,title:r?t:void 0,className:c,children:l})}function UT({count:e,strong:t}){return(0,b.jsxs)(`span`,{className:W(`inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full px-1.5 text-[11px]`,t?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:[e.estimate?`~`:``,eg(e.count)]})}function WT({title:e,logo:t,rail:n,onClose:r}){let{t:i}=Y(),a=t?(0,b.jsx)(`img`,{src:t,alt:``,className:`size-[30px] shrink-0 rounded-control object-contain`}):(0,b.jsx)(`img`,{src:`favicon.svg`,alt:``,className:`size-[30px] shrink-0 object-contain`});return(0,b.jsxs)(`div`,{className:W(`flex h-14 shrink-0 items-center gap-2.5 border-b border-sidebar-border`,n?`justify-center`:`px-4`),children:[a,!n&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1 leading-[1.3]`,children:[(0,b.jsx)(`div`,{className:W(`truncate font-semibold`,r?`text-[15px]`:`text-sm`),children:e}),!r&&(0,b.jsx)(`div`,{className:`text-[11.5px] text-muted-foreground`,children:i(`shell.adminPanel`)})]}),r?(0,b.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":i(`shell.closeMenu`),onClick:r,children:(0,b.jsx)(Cx,{})}):(0,b.jsx)(kv,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})]})]})}function GT({section:e,collapsed:t,badges:n,muted:r,large:i}){let{t:a}=Y(),o=e.icon,s=`nav-group-${e.key}`,c=ww(e.entries.flatMap(e=>e.badge?[{kind:`resource`,name:e.key,label:e.label,badge:e.badge}]:[]),n);if(e.asLink){let[t]=e.entries;return(0,b.jsx)(HT,{to:t.to,label:e.label,icon:o,rail:!1,large:i,external:t.external,count:t.badge?n?.[t.badge]:void 0})}return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`button`,{type:`button`,className:W(IT,i&&`h-11 text-[15px]`,r&&`text-muted-foreground`),"aria-expanded":!t,"aria-controls":s,"aria-label":a(t?`shell.expandGroup`:`shell.collapseGroup`,{name:e.label}),onClick:()=>kT.toggleGroup(e.key,e.collapsedByDefault??!1),children:[(0,b.jsx)(o,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),t&&c&&(0,b.jsx)(UT,{count:c}),(0,b.jsx)(Cv,{className:W(`size-4 shrink-0 text-muted-foreground transition-transform`,t&&`rotate-90 rtl:rotate-90 ltr:-rotate-90`),"aria-hidden":!0})]}),!t&&(0,b.jsx)(`ul`,{id:s,"aria-label":e.label,className:`ms-[18px] mt-0.5 mb-1 flex flex-col gap-px border-s border-sidebar-border ps-2.5`,children:e.entries.map(e=>(0,b.jsxs)(`li`,{className:`group/item flex items-center`,children:[e.external?(0,b.jsx)(`a`,{href:e.to,target:`_blank`,rel:`noopener noreferrer`,className:W(LT({isActive:!1}),`min-w-0 flex-1`),children:(0,b.jsx)(`span`,{className:`truncate`,children:e.label})}):(0,b.jsxs)(xo,{to:e.to,className:e=>W(LT(e),`min-w-0 flex-1 gap-2`),children:[(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.badge&&n?.[e.badge]&&(0,b.jsx)(UT,{count:n[e.badge]})]}),e.pin&&(0,b.jsx)(qT,{name:e.pin,label:e.label})]},e.key))})]})}function KT({section:e,muted:t}){let[n,r]=(0,y.useState)(!1),{pathname:i}=qi(),a=e.icon,o=e.entries.some(e=>zT(i,e));return(0,b.jsxs)(Sh,{open:n,onOpenChange:r,children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsx)(`button`,{type:`button`,"aria-label":e.label,title:e.label,onMouseEnter:()=>r(!0),"data-nav-section":``,className:W(`flex size-10 cursor-pointer items-center justify-center rounded-control hover:bg-muted`,t&&`text-muted-foreground`,o&&`bg-primary-soft text-primary-text hover:bg-primary-soft`),children:(0,b.jsx)(a,{className:`size-4`,"aria-hidden":!0})})}),(0,b.jsx)(wh,{children:(0,b.jsxs)(Th,{side:`right`,align:`start`,sideOffset:8,onMouseLeave:()=>r(!1),className:`z-50 flex flex-col items-start gap-1.5`,children:[(0,b.jsx)(`span`,{className:`rounded-control bg-foreground px-3 py-1.5 text-[13px] font-medium text-background`,children:e.label}),(0,b.jsx)(`div`,{className:`flex min-w-40 flex-col gap-px rounded-[10px] border border-border bg-card p-1.5 shadow-[0_12px_32px_rgba(0,0,0,.12)]`,children:e.entries.map(e=>e.external?(0,b.jsx)(`a`,{href:e.to,target:`_blank`,rel:`noopener noreferrer`,className:LT({isActive:!1}),onClick:()=>r(!1),children:e.label},e.key):(0,b.jsx)(xo,{to:e.to,className:LT,onClick:()=>r(!1),children:e.label},e.key))})]})})]})}function qT({name:e,label:t}){let{t:n}=Y(),r=AT().pinned.includes(e);return(0,b.jsx)(`button`,{type:`button`,className:W(`cursor-pointer rounded-md p-1 text-muted-foreground opacity-0 hover:text-foreground focus-visible:opacity-100 group-hover/item:opacity-100`,r&&`opacity-100`),"aria-label":n(r?`shell.unpin`:`shell.pin`,{name:t}),"aria-pressed":r,onClick:()=>kT.togglePin(e),children:r?(0,b.jsx)(db,{className:`size-3.5`}):(0,b.jsx)(pb,{className:`size-3.5`})})}function JT(){let{t:e}=Y();if(Gg().data?.rbac.view)return{key:`~administration`,label:e(`rbac.administration`),icon:Fb,entries:[{key:`users`,to:`/-/users`,label:e(`rbac.users`)},{key:`groups`,to:`/-/groups`,label:e(`rbac.groups`)},{key:`roles`,to:`/-/roles`,label:e(`rbac.roles`)},{key:`debugger`,to:`/-/debugger`,label:e(`debugger.title`)}]}}function YT(){let e=X(),t=lT();return(0,b.jsx)(`div`,{role:`region`,"aria-label":e(`toast.region`),className:`pointer-events-none fixed inset-x-4 bottom-4 z-[60] flex flex-col items-end gap-2 sm:start-auto sm:w-96`,children:t.map(t=>(0,b.jsxs)(`div`,{role:t.tone===`error`?`alert`:`status`,className:W(`pointer-events-auto flex w-full items-start gap-2 rounded-lg border bg-popover px-3 py-2 text-sm text-popover-foreground shadow-lg`,t.tone===`error`?`border-destructive/50`:`border-green-600/40`),children:[(0,b.jsx)(`span`,{className:W(`min-w-0 flex-1 break-words`,t.tone===`error`&&`text-destructive`),children:t.message}),(0,b.jsx)(`button`,{type:`button`,className:`rounded-md p-0.5 text-muted-foreground hover:text-foreground`,"aria-label":e(`toast.dismiss`),onClick:()=>sT.dismiss(t.id),children:(0,b.jsx)(Cx,{className:`size-4`,"aria-hidden":!0})})]},t.id))})}function XT(e,t){return e===void 0||typeof e==`string`?e:e[t]??e[dg.locale]??Object.values(e)[0]}function ZT(){let{t:e}=Y(),t=Gg(),n=qi(),r=S(),i=t.isError&&Cg()!==void 0&&t.error instanceof fg&&(t.error.status===403||t.error.status===404);return(0,y.useEffect)(()=>{i&&(wg(void 0),r.clear())},[i,r]),t.isPending||i?(0,b.jsx)(G,{children:e(`common.loading`)}):t.isError?t.error instanceof fg&&t.error.status===401?(0,b.jsx)(Da,{to:`/login?${new URLSearchParams({next:n.pathname+n.search})}`,replace:!0}):(0,b.jsxs)(G,{tone:`error`,children:[pg(t.error),` `,(0,b.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:e(`list.retry`)})]}):(0,b.jsx)($T,{})}function QT(){let{t:e}=Y(),t=Gg(),n=S(),r=Yi(),i=t.data;return i?.viewAs?(0,b.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center justify-center gap-3 bg-amber-400 px-4 py-2 text-sm font-medium text-amber-950`,children:[(0,b.jsx)($v,{className:`size-4`,"aria-hidden":!0}),(0,b.jsx)(`span`,{children:e(`viewAs.banner`,{name:i.user.displayName})}),(0,b.jsx)(q,{size:`sm`,variant:`outline`,className:`h-7 border-amber-950/30 bg-amber-50 text-amber-950 hover:bg-amber-100`,onClick:()=>{let e=i.user.id;wg(void 0),n.clear(),r(`/-/users/${encodeURIComponent(e)}`)},children:e(`viewAs.stop`)})]}):null}function $T(){let e=Kg(),{t,locale:n}=Y(),r=AT(),i=qi(),[a,o]=(0,y.useState)(!1),s=(0,y.useRef)(null),c=Gg().data?.appearance?.accent;(0,y.useEffect)(()=>{c!==void 0&&Zw({admin:c})},[c]);let l=(0,y.useMemo)(()=>e.data?Cw(e.data):[],[e.data]),u=e.data?.menu!==void 0,d=XT(dg.branding.name,n)??e.data?.title??dg.title,f=dg.branding.logo;return(0,y.useEffect)(()=>{o(!1);let e=decodeURIComponent(i.pathname.split(`/`).filter(Boolean)[0]??``);l.some(t=>t.resources.some(t=>t.name===e))&&kT.visit(e)},[i.pathname,l]),(0,y.useEffect)(()=>{e.data&&(document.title=e.data.title)},[e.data]),(0,y.useEffect)(()=>{if(!a)return;s.current?.querySelector(`a, button, input`)?.focus();let e=e=>{e.key===`Escape`&&o(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),(0,b.jsxs)(`div`,{className:`flex min-h-svh bg-background text-foreground`,children:[(0,b.jsx)(wT,{}),(0,b.jsx)(xT,{}),(0,b.jsx)(`aside`,{className:W(`sticky top-0 hidden h-svh shrink-0 border-e border-sidebar-border bg-sidebar text-sidebar-foreground md:block`,r.railCollapsed?`w-16`:`w-64`),children:(0,b.jsx)(VT,{title:d,logo:f,groups:l,menu:u,rail:r.railCollapsed})}),a&&(0,b.jsxs)(`div`,{className:`fixed inset-0 z-40 md:hidden`,role:`dialog`,"aria-modal":`true`,"aria-label":t(`shell.menu`),ref:s,children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-black/40 backdrop-blur-sm dark:bg-black/60 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150`,"aria-hidden":!0,onClick:()=>o(!1)}),(0,b.jsx)(`aside`,{className:`absolute inset-y-0 start-0 flex w-[300px] max-w-[85vw] flex-col border-e border-sidebar-border bg-sidebar text-sidebar-foreground shadow-xl`,onClick:e=>{e.target.closest(`a`)&&o(!1)},children:(0,b.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,b.jsx)(VT,{title:d,logo:f,groups:l,menu:u,onClose:()=>o(!1)})})})]}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,inert:a||void 0,children:[(0,b.jsxs)(`div`,{className:`sticky top-0 z-30 bg-background`,children:[(0,b.jsx)(QT,{}),(0,b.jsx)(PT,{meta:e.data,onOpenMenu:()=>o(!0)})]}),(0,b.jsx)(`main`,{className:`flex-1 p-4 md:p-7`,children:(0,b.jsx)(`div`,{className:`mx-auto w-full max-w-[1400px]`,children:(0,b.jsx)(Oa,{})})})]}),(0,b.jsx)(YT,{})]})}function eE(e){let t=dg.branding.name;return t===void 0?dg.title:typeof t==`string`?t:t[e]??t[dg.locale]??Object.values(t)[0]??dg.title}function tE(){let{t:e,locale:t}=Y(),n=Yi(),r=S(),[i]=wo(),a=xg(i.get(`next`),dg.basePath),o=Gg(),[s,c]=(0,y.useState)(``),[l,u]=(0,y.useState)(``),[d,f]=(0,y.useState)(`password`),[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(null),[_,v]=(0,y.useState)(!1);if(o.isSuccess)return(0,b.jsx)(Da,{to:a,replace:!0});async function x(t){if(t.preventDefault(),!s.trim()||!l){g(e(`auth.required`));return}if(d===`otp`&&!p.trim()){g(e(`auth.otpRequired`));return}v(!0),g(null);try{let e=await Q.login(s.trim(),l,d===`otp`?p.trim():void 0);gg(e.csrfToken),wg(void 0),r.clear(),r.setQueryData([`session`],e),n(a,{replace:!0})}catch(t){if(t instanceof fg&&t.body.code===`TWO_FACTOR_REQUIRED`){g(d===`otp`?t.message:null),f(`otp`),m(``);return}f(`password`),m(``),u(``),g(t instanceof fg&&(t.status===401||t.status===429||t.status===404)?t.message:e(`auth.failed`))}finally{v(!1)}}let C=dg.branding.logo;return(0,b.jsxs)(`main`,{className:`flex min-h-dvh flex-col bg-muted/30`,children:[(0,b.jsxs)(`div`,{className:`flex justify-end gap-2 p-4`,children:[(0,b.jsx)(fT,{}),(0,b.jsx)(dT,{})]}),(0,b.jsx)(`div`,{className:`flex flex-1 items-start justify-center px-4 pt-[10vh]`,children:(0,b.jsxs)(`form`,{onSubmit:x,noValidate:!0,className:`flex w-full max-w-sm flex-col gap-4 rounded-xl border bg-background p-6 shadow-sm`,"aria-labelledby":`login-title`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,b.jsx)(`img`,{src:C??`favicon.svg`,alt:``,className:`size-10 rounded-md object-contain`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:eE(t)}),(0,b.jsx)(`h1`,{id:`login-title`,className:`text-[22px] font-bold`,children:e(d===`otp`?`auth.otpTitle`:`auth.title`)})]}),h&&(0,b.jsx)(`p`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:h}),d===`otp`?(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`login-otp`,children:e(`auth.otp`)}),(0,b.jsx)(Oh,{id:`login-otp`,autoComplete:`one-time-code`,inputMode:`text`,autoCapitalize:`none`,spellCheck:!1,autoFocus:!0,dir:`ltr`,maxLength:40,value:p,onChange:e=>m(e.target.value),"aria-describedby":`login-otp-help`}),(0,b.jsx)(`p`,{id:`login-otp-help`,className:`text-sm text-muted-foreground`,children:e(`auth.otpHelp`)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`login-username`,children:e(`auth.username`)}),(0,b.jsx)(Oh,{id:`login-username`,autoComplete:`username`,autoCapitalize:`none`,spellCheck:!1,autoFocus:!0,value:s,onChange:e=>c(e.target.value)})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`login-password`,children:e(`auth.password`)}),(0,b.jsx)(Oh,{id:`login-password`,type:`password`,autoComplete:`current-password`,value:l,onChange:e=>u(e.target.value)})]})]}),(0,b.jsx)(q,{type:`submit`,disabled:_,children:e(_?`auth.signingIn`:d===`otp`?`auth.verify`:`auth.signIn`)}),d===`otp`&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>{f(`password`),m(``),u(``),g(null)},children:e(`auth.startOver`)})]})})]})}var nE=3;function rE({field:e,files:t,detailed:n=!1,plain:r=!1}){let i=X();if(t.length===0)return(0,b.jsx)(b.Fragment,{children:`—`});let a=t=>e.widget===`image`&&t.contentType.startsWith(`image/`),o=n?t:t.slice(0,nE);return(0,b.jsxs)(`span`,{className:W(`inline-flex flex-wrap items-center`,n?`gap-2`:`gap-1 align-middle`),children:[o.map(e=>{let t=a(e)?(0,b.jsx)(`img`,{src:e.url,alt:e.name,loading:`lazy`,className:W(`rounded-md border bg-muted object-cover`,n?`size-24`:`size-8`)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ay,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(`bdi`,{className:`max-w-48 truncate`,children:e.name}),n&&(0,b.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:Pg(e.size)})]});return r?(0,b.jsx)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:t},e.key):(0,b.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":i(`upload.open`,{name:e.name}),title:e.name,className:`inline-flex min-w-0 items-center gap-1 hover:underline`,onClick:e=>e.stopPropagation(),children:t},e.key)}),t.length>o.length&&(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i(`upload.more`,{count:t.length-o.length})})]})}var iE={ok:`bg-ok-bg text-ok`,warn:`bg-warn-bg text-warn`,bad:`bg-bad-bg text-bad`,info:`bg-info-bg text-info`,neutral:`bg-muted text-muted-foreground`,primary:`bg-primary-soft text-primary-text`};function aE({tone:e=`neutral`,className:t,...n}){return(0,b.jsx)(`span`,{"data-slot":`badge`,"data-tone":e,className:W(`inline-flex h-[22px] items-center gap-1 rounded-full px-2 text-xs leading-none font-medium whitespace-nowrap`,iE[e],t),...n})}var oE={gray:`neutral`,red:`bad`,amber:`warn`,green:`ok`,blue:`info`,purple:`primary`,pink:`bad`};function sE(e){return oE[e]??`neutral`}function cE({value:e,field:t,className:n}){if(e==null)return(0,b.jsx)(b.Fragment,{children:Px(e,t)});let r=t.colors?.[String(e)]??`gray`;return(0,b.jsx)(aE,{"data-color":r,tone:sE(r),className:n,children:Px(e,t)})}function lE({value:e,field:t,record:n,detailed:r,plain:i}){return t.file&&n?(0,b.jsx)(rE,{field:t,files:_C(n,t.name),detailed:r,plain:i}):t.widget===`badge`?(0,b.jsx)(cE,{value:e,field:t}):(0,b.jsx)(b.Fragment,{children:Px(e,t)})}function uE({title:e,subtitle:t,icon:n,actions:r,footer:i,className:a,bodyClassName:o,children:s,...c}){let l=(0,y.useId)(),u=e!==void 0&&c[`aria-labelledby`]===void 0?{"aria-labelledby":l}:{};return(0,b.jsxs)(`section`,{"data-slot":`card`,className:W(`rounded-card border border-border bg-card text-card-foreground shadow-card`,a),...u,...c,children:[e!==void 0&&(0,b.jsxs)(`header`,{className:`flex min-h-14 items-center gap-2 border-b border-border px-5 py-3`,children:[n&&(0,b.jsx)(`span`,{className:`text-muted-foreground [&_svg]:size-4`,children:n}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`h2`,{id:l,className:`text-[15px] font-semibold`,children:e}),t&&(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t})]}),r&&(0,b.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:r})]}),(0,b.jsx)(`div`,{className:W(e!==void 0&&`p-5`,o),children:s}),i&&(0,b.jsx)(`footer`,{className:`border-t border-border px-5 py-3`,children:i})]})}function dE({card:e,values:t,schema:n}){let r=X(),i=qg(e.relation?.resource??``,e.relation!==void 0);if(!t)return null;let a=e.relation?i.data?.fields:n.fields;if(!a)return null;let o=eT(e.icon),s=e.fields.flatMap(e=>{let t=a.find(t=>t.name===e);return t?[t]:[]}),c=e.relation?.link&&typeof t._id==`string`?`/${e.relation.resource}/${encodeURIComponent(t._id)}`:void 0;return(0,b.jsx)(uE,{title:e.title,icon:o?(0,b.jsx)(o,{}):void 0,actions:c&&(0,b.jsx)(bo,{to:c,className:`text-[13px] font-medium text-primary hover:underline`,children:r(`form.viewProfile`)}),children:(0,b.jsxs)(`dl`,{className:`flex flex-col gap-2.5 text-[13px]`,children:[e.relation&&typeof t._title==`string`&&(0,b.jsx)(`dt`,{className:`text-[14px] font-semibold`,children:t._title}),s.map(e=>(0,b.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{className:`min-w-0 text-end break-words`,children:(0,b.jsx)(lE,{value:t[e.name],field:e,record:t})})]},e.name))]})})}function fE(e,t,n){let r=e.steps?.values??e.enumValues??[],i=typeof t==`string`?r.indexOf(t):-1;return r.map((t,r)=>{let a=n?.[t],o=a?rg(new Date(a)):null,s=i===-1?`future`:r<i?`done`:r===i?`current`:`future`;return{key:t,label:e.enumLabels?.[t]??t,state:s,at:s===`future`?null:o,caption:s===`current`&&o?J(`stepper.since`,{time:o}):null}})}function pE({field:e,value:t,reached:n}){let r=fE(e,t,n);return(0,b.jsx)(uE,{"aria-label":e.label,bodyClassName:`overflow-x-auto px-5 py-4`,children:(0,b.jsx)(`ol`,{className:`flex min-w-max`,children:r.map((e,t)=>(0,b.jsxs)(`li`,{"aria-current":e.state===`current`?`step`:void 0,className:`relative flex min-w-28 flex-1 flex-col items-center gap-1.5 text-center`,children:[t<r.length-1&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:W(`absolute start-1/2 top-3.5 h-0.5 w-full`,e.state===`done`?`bg-primary`:`bg-border`)}),(0,b.jsx)(`span`,{className:W(`relative z-10 flex size-7 items-center justify-center rounded-full border-2 bg-card text-xs font-semibold`,e.state===`done`&&`border-primary bg-primary text-primary-foreground`,e.state===`current`&&`border-primary text-primary`,e.state===`future`&&`border-border text-muted-foreground`),children:e.state===`done`?(0,b.jsx)(xv,{className:`size-3.5`,"aria-hidden":!0}):eg(t+1)}),(0,b.jsx)(`span`,{className:W(`text-[13px]`,e.state===`current`?`font-semibold text-primary`:e.state===`done`?`font-semibold`:`text-muted-foreground`),children:e.label}),(0,b.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:e.caption??e.at??`—`})]},e.key))})})}var mE=class{options;pending=[];problems=[];uploads=new Map;nextId=0;disposed=!1;constructor(e){this.options=e}get busy(){return this.pending.length>0}start(e,t){if(!(this.disposed||e.length===0)){this.problems=[];for(let n of e){let e=this.options.check(n);if(e){this.problems=[...this.problems,this.options.describe(n.name,e)];continue}let r=++this.nextId,i=this.options.preview?.(n),a=this.options.send(n,e=>{this.disposed||(this.pending=this.pending.map(t=>t.id===r?{...t,progress:e}:t),this.options.onChange())});this.uploads.set(r,a),this.pending=[...this.pending,{id:r,name:n.name,progress:0,preview:i}],a.promise.then(e=>{this.disposed||(this.finish(r),t(e,n,i))},e=>{this.disposed||(i&&this.options.revoke?.(i),e instanceof Tg||(this.problems=[...this.problems,this.options.describe(n.name,Ag(e))]),this.finish(r))})}this.options.onChange()}}report(e,t){this.problems=[...this.problems,this.options.describe(e,t)],this.options.onChange()}cancel(e){this.uploads.get(e)?.abort()}cancelAll(){for(let e of[...this.uploads.values()])e.abort()}dispose(){this.disposed=!0;for(let e of this.pending)e.preview&&this.options.revoke?.(e.preview);this.cancelAll(),this.uploads.clear(),this.pending=[]}finish(e){this.uploads.delete(e),this.pending=this.pending.filter(t=>t.id!==e),this.options.onChange()}};function hE({resource:e,field:t,rules:n,onBusy:r}){let i=X(),[,a]=(0,y.useReducer)(e=>e+1,0),o=(0,y.useRef)({resource:e,field:t,rules:n,t:i});o.current={resource:e,field:t,rules:n,t:i};let s=(0,y.useRef)(null),c=()=>new mE({send:(e,t)=>Q.upload(e,{resource:o.current.resource,field:o.current.field.name},t),check:e=>Mg(e,o.current.rules),describe:(e,t)=>o.current.t(`upload.failed`,{name:e,message:t}),preview:e=>e.type.startsWith(`image/`)?URL.createObjectURL(e):void 0,revoke:e=>URL.revokeObjectURL(e),onChange:a});s.current??=c();let l=s.current.busy;return(0,y.useEffect)(()=>{r?.(l)},[l]),(0,y.useEffect)(()=>(s.current||(s.current=c(),a()),()=>{s.current?.dispose(),s.current=null,r?.(!1)}),[]),s.current}function gE({resource:e,field:t,value:n,onChange:r,onBusy:i}){let a=t.file?.many===!0,o=gC(n),s=(0,y.useRef)(o);s.current=o;let c=hE({resource:e,field:t,rules:t.file??{accept:[],maxBytes:1/0},onBusy:i}),l=(0,y.useRef)(new Map);(0,y.useEffect)(()=>()=>{for(let e of l.current.values())URL.revokeObjectURL(e);l.current.clear()},[]);function u(e){let t=new Set(e.map(e=>e.token));for(let[e,n]of l.current)t.has(e)||(URL.revokeObjectURL(n),l.current.delete(e));s.current=e,r(a?e:e[0]??null)}function d(e){let t=a?e:e.slice(0,1);t.length!==0&&(a||c.cancelAll(),c.start(t,(e,t,n)=>{n&&l.current.set(e.token,n);let r={token:e.token,name:e.name,size:e.size,contentType:e.contentType,...e.url?{url:e.url}:{}};u(a?[...s.current,r]:[r])}))}return{many:a,files:o,pending:c.pending,problems:c.problems,add:d,remove:e=>u(o.filter((t,n)=>n!==e)),move:(e,t)=>u(Fg(o,e,t)),cancel:e=>c.cancel(e),previewOf:e=>e.url??(e.token?l.current.get(e.token):void 0)}}function _E(e){let[t,n]=(0,y.useState)(null),[r,i]=(0,y.useState)(null),a=()=>{n(null),i(null)};return{dragging:t,over:r,item:r=>({draggable:!0,onDragStart:e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,String(r)),n(r)},onDragOver:e=>{t!==null&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,i(r))},onDrop:n=>{t!==null&&(n.preventDefault(),e(t,r),a())},onDragEnd:a})}}function vE({id:e,field:t,label:n,compact:r,onFiles:i,aria:a}){let o=X(),s=(0,y.useRef)(null),[c,l]=(0,y.useState)(!1),u=t.file?.many===!0,d=t.file?.accept??[],f=d.length===0||d.some(e=>e===`*`||e===`*/*`),p=e=>e.dataTransfer.types.includes(`Files`);return(0,b.jsxs)(`div`,{"data-dropzone":t.name,onDragOver:e=>{p(e)&&(e.preventDefault(),l(!0))},onDragLeave:()=>l(!1),onDrop:e=>{p(e)&&(e.preventDefault(),l(!1),i([...e.dataTransfer.files]))},className:W(`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg text-sm has-[:focus-visible]:ring-3 has-[:focus-visible]:ring-ring/50`,!r&&`border border-dashed border-input px-3 py-3`,c&&`border-primary bg-muted/50`),children:[(0,b.jsx)(`input`,{ref:s,id:e,type:`file`,className:`sr-only`,multiple:u,accept:f?void 0:d.join(`,`),onChange:e=>{i([...e.target.files??[]]),e.target.value=``},...a}),(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,tabIndex:-1,"aria-hidden":!0,onClick:()=>s.current?.click(),children:[(0,b.jsx)(lx,{}),n]}),!r&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[o(u?`upload.dropMany`:`upload.drop`),t.file&&` · ${o(`upload.limit`,{max:Pg(t.file.maxBytes)})}`]})]})}function yE({upload:e,onCancel:t,className:n}){let r=X(),i=Math.round(e.progress*100);return(0,b.jsxs)(`div`,{className:W(`flex items-center gap-2`,n),children:[(0,b.jsx)(`div`,{role:`progressbar`,"aria-label":r(`upload.uploading`,{name:e.name}),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i,className:`h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,b.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width]`,style:{width:`${i}%`}})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":r(`upload.cancel`,{name:e.name}),onClick:t,children:(0,b.jsx)(Cx,{})})]})}function bE({problems:e}){return e.length===0?null:(0,b.jsx)(`ul`,{role:`alert`,className:`flex flex-col gap-0.5 text-sm text-destructive`,children:e.map((e,t)=>(0,b.jsx)(`li`,{children:e},t))})}function xE(e){let t=X(),{id:n,field:r,aria:i}=e,{many:a,files:o,pending:s,problems:c,add:l,remove:u,move:d,cancel:f}=gE(e),p=_E(d);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(o.length>0||s.length>0)&&(0,b.jsxs)(`ul`,{className:`flex flex-col gap-1`,children:[o.map((e,n)=>(0,b.jsxs)(`li`,{"data-file":e.name,...a&&o.length>1?p.item(n):{},className:W(`flex items-center gap-2 rounded-lg border px-2 py-1.5 text-sm`,p.dragging===n&&`opacity-50`,p.over===n&&p.dragging!==n&&`border-primary`),children:[a&&o.length>1?(0,b.jsx)(dy,{className:`size-4 shrink-0 cursor-grab text-muted-foreground`,"aria-hidden":!0}):(0,b.jsx)(ay,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),e.url?(0,b.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`min-w-0 truncate hover:underline`,"aria-label":t(`upload.open`,{name:e.name}),children:(0,b.jsx)(`bdi`,{children:e.name})}):(0,b.jsx)(`bdi`,{className:`min-w-0 truncate`,children:e.name}),(0,b.jsx)(`span`,{className:`ms-auto shrink-0 text-muted-foreground`,children:Pg(e.size)}),a&&o.length>1&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-xs`,disabled:n===0,"aria-label":t(`list.moveUp`,{name:e.name}),onClick:()=>d(n,n-1),children:(0,b.jsx)(Z_,{})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-xs`,disabled:n===o.length-1,"aria-label":t(`list.moveDown`,{name:e.name}),onClick:()=>d(n,n+1),children:(0,b.jsx)(q_,{})})]}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":t(`upload.remove`,{name:e.name}),onClick:()=>u(n),children:(0,b.jsx)(Cx,{})})]},e.token??e.key)),s.map(e=>(0,b.jsxs)(`li`,{className:`flex flex-col gap-1 rounded-lg border border-dashed px-2 py-1.5 text-sm`,children:[(0,b.jsx)(`bdi`,{className:`truncate text-muted-foreground`,children:e.name}),(0,b.jsx)(yE,{upload:e,onCancel:()=>f(e.id)})]},`pending-${e.id}`))]}),(0,b.jsx)(vE,{id:n,field:r,label:t(a?`upload.chooseMany`:o.length>0?`upload.replace`:`upload.choose`),compact:!a&&o.length>0,onFiles:l,aria:i}),(0,b.jsx)(bE,{problems:c})]})}function SE(e){let t=X(),{id:n,field:r,aria:i}=e,{many:a,files:o,pending:s,problems:c,add:l,remove:u,move:d,cancel:f,previewOf:p}=gE(e),m=_E(d),h=a&&o.length>1;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(o.length>0||s.length>0)&&(0,b.jsxs)(`ul`,{className:`flex flex-wrap gap-2`,children:[o.map((e,n)=>{let r=p(e);return(0,b.jsxs)(`li`,{"data-file":e.name,...h?m.item(n):{},className:W(`group relative size-28 overflow-hidden rounded-lg border bg-muted`,h&&`cursor-grab`,m.dragging===n&&`opacity-50`,m.over===n&&m.dragging!==n&&`border-primary ring-2 ring-primary/40`),children:[r?(0,b.jsx)(`img`,{src:r,alt:e.name,draggable:!1,className:`size-full object-cover`}):(0,b.jsxs)(`span`,{className:`flex size-full flex-col items-center justify-center gap-1 p-1 text-center text-xs text-muted-foreground`,children:[(0,b.jsx)(_y,{className:`size-5`,"aria-hidden":!0}),(0,b.jsx)(`bdi`,{className:`w-full truncate`,children:e.name})]}),(0,b.jsx)(q,{type:`button`,variant:`secondary`,size:`icon-xs`,className:`absolute end-1 top-1 shadow`,"aria-label":t(`upload.remove`,{name:e.name}),onClick:()=>u(n),children:(0,b.jsx)(Cx,{})}),h&&(0,b.jsxs)(`div`,{className:`absolute inset-x-1 bottom-1 flex justify-between`,children:[(0,b.jsx)(q,{type:`button`,variant:`secondary`,size:`icon-xs`,className:`shadow`,disabled:n===0,"aria-label":t(`list.moveUp`,{name:e.name}),onClick:()=>d(n,n-1),children:(0,b.jsx)(Tv,{className:`rtl:rotate-180`})}),(0,b.jsx)(q,{type:`button`,variant:`secondary`,size:`icon-xs`,className:`shadow`,disabled:n===o.length-1,"aria-label":t(`list.moveDown`,{name:e.name}),onClick:()=>d(n,n+1),children:(0,b.jsx)(Dv,{className:`rtl:rotate-180`})})]})]},e.token??e.key)}),s.map(e=>(0,b.jsxs)(`li`,{className:`relative size-28 overflow-hidden rounded-lg border border-dashed bg-muted`,children:[e.preview&&(0,b.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover opacity-40`}),(0,b.jsx)(yE,{upload:e,onCancel:()=>f(e.id),className:`absolute inset-x-1 bottom-1 rounded-md bg-background/80 ps-1.5`})]},`pending-${e.id}`))]}),(0,b.jsx)(vE,{id:n,field:r,label:t(a?`upload.chooseImages`:o.length>0?`upload.replace`:`upload.chooseImage`),compact:!a&&o.length>0,onFiles:l,aria:i}),(0,b.jsx)(bE,{problems:c})]})}function CE({className:e,...t}){return(0,b.jsx)(`textarea`,{"data-slot":`textarea`,className:W(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function wE({id:e,field:t,value:n,onChange:r,aria:i}){let{unit:a,position:o}=Mx(`0`,{currency:t.currency}),s=a&&(0,b.jsx)(`span`,{className:`shrink-0 text-[13px] text-muted-foreground`,children:a});return(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o===`before`&&s,(0,b.jsx)(Oh,{id:e,type:`text`,inputMode:`decimal`,dir:`ltr`,className:`text-end`,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),onBlur:()=>r(Ox(n,t.scale)),...i}),o!==`before`&&s]})}function TE({id:e,checked:t,onChange:n,aria:r}){return(0,b.jsx)(`button`,{id:e,type:`button`,role:`switch`,"aria-checked":t,onClick:()=>n(!t),className:W(`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,t?`bg-primary`:`bg-input`),...r,children:(0,b.jsx)(`span`,{className:W(`block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-4 rtl:-translate-x-4`:`translate-x-0`)})})}function EE({id:e,field:t,value:n,onChange:r,aria:i,label:a,required:o}){let s=X(),c=(t.enumValues??[]).map(e=>[e,NC(t,e)]);return t.nullable&&!o&&c.unshift([``,s(`common.empty`)]),(0,b.jsxs)(`fieldset`,{id:e,className:`flex flex-col gap-1.5`,...i,children:[(0,b.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:a}),(0,b.jsx)(`div`,{role:`radiogroup`,className:`flex flex-wrap gap-x-4 gap-y-1.5`,children:c.map(([t,i])=>(0,b.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,b.jsx)(`input`,{type:`radio`,name:e,value:t,checked:n===t,onChange:()=>r(t),className:`size-4 accent-primary`}),i]},t))})]})}var DE=/^#[0-9a-f]{6}$/i;function OE({id:e,field:t,value:n,onChange:r,aria:i}){let a=X();return(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`color`,"aria-hidden":!0,tabIndex:-1,className:`h-8 w-10 shrink-0 cursor-pointer rounded-md border border-input bg-transparent p-0.5`,value:DE.test(n)?n.toLowerCase():`#000000`,onChange:e=>r(e.target.value)}),(0,b.jsx)(Oh,{id:e,dir:`ltr`,value:n,placeholder:t.placeholder??`#000000`,"aria-label":a(`form.colorCode`,{name:t.label}),onChange:e=>r(e.target.value),...i})]})}function kE({id:e,field:t,value:n,onChange:r,aria:i}){let a=X(),[o,s]=(0,y.useState)(null),c=`${e}-json`;function l(){if(n.trim()!==``)try{r(JSON.stringify(JSON.parse(n),null,2)),s(null)}catch(e){s(e instanceof Error?e.message:String(e))}}let u=[i[`aria-describedby`],o?c:void 0].filter(Boolean).join(` `)||void 0;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(CE,{id:e,dir:`ltr`,rows:6,className:`font-mono`,spellCheck:!1,value:n,placeholder:t.placeholder,onChange:e=>{s(null),r(e.target.value)},...i,"aria-invalid":i[`aria-invalid`]??(o?!0:void 0),"aria-describedby":u}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:l,children:a(`form.formatJson`)}),o&&(0,b.jsx)(`p`,{id:c,className:`text-sm text-destructive`,children:o})]})]})}function AE({id:e,field:t,value:n,onChange:r,aria:i}){return(0,b.jsx)(CE,{id:e,rows:4,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),...i})}function jE({id:e,field:t,value:n,onChange:r,aria:i,...a}){return(0,b.jsx)(Oh,{id:e,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),...a,...i})}var ME=(0,y.lazy)(()=>Xa(()=>import(`./rich-text-input-yOiXiDm7.js`),__vite__mapDeps([0,1]),import.meta.url));function NE(e){let t=X();return(0,b.jsx)(y.Suspense,{fallback:(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`editor.loading`)}),children:(0,b.jsx)(ME,{...e})})}var PE=`h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive`;function FE({resource:e,field:t,value:n,required:r,errors:i,constraints:a,formValues:o,onChange:s,onBusy:c,idPrefix:l=`field`,parent:u,hideLabel:d}){let f=`${l}-${t.name}`,p=`${f}-error`,m=`${f}-help`,h=(i?.length??0)>0,g=[t.help?m:void 0,h?p:void 0].filter(Boolean).join(` `)||void 0,_={"aria-invalid":h?!0:void 0,"aria-describedby":g},v=typeof n==`string`?n:``,y=t.type===`relation`?void 0:MC(t,a),x=(0,b.jsxs)(b.Fragment,{children:[t.label,r&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`text-destructive`,children:`*`})]}),S=(0,b.jsx)(kh,{htmlFor:f,className:d?`sr-only`:void 0,children:x}),C=t.help?(0,b.jsx)(`p`,{id:m,className:`text-sm text-muted-foreground`,children:t.help}):null,w={id:f,field:t,value:v,onChange:e=>s(e),aria:_};if(t.type===`boolean`){let e=n===!0;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y===`switch`?(0,b.jsx)(TE,{id:f,checked:e,onChange:s,aria:_}):(0,b.jsx)(`input`,{id:f,type:`checkbox`,className:`size-4 accent-primary`,checked:e,onChange:e=>s(e.target.checked),..._}),S]}),C,(0,b.jsx)(LE,{id:p,errors:i})]})}if(t.type===`enum`&&y===`radio`)return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(EE,{...w,label:x,required:r}),C,(0,b.jsx)(LE,{id:p,errors:i})]});let T;if(t.type===`relation`)T=(0,b.jsx)(KS,{id:f,resource:e,field:t,value:n??null,onChange:s,clearable:t.nullable,values:o,parent:u,invalid:h,describedBy:g});else if(t.type===`enum`)T=(0,b.jsxs)(`select`,{id:f,className:PE,value:v,onChange:e=>s(e.target.value),..._,children:[(0,b.jsx)(`option`,{value:``,children:t.placeholder??`—`}),t.enumValues?.map(e=>(0,b.jsx)(`option`,{value:e,children:NC(t,e)},e))]});else switch(y){case`file`:T=(0,b.jsx)(xE,{id:f,resource:e,field:t,value:n,onChange:s,onBusy:c,aria:_});break;case`image`:T=(0,b.jsx)(SE,{id:f,resource:e,field:t,value:n,onChange:s,onBusy:c,aria:_});break;case`richtext`:T=(0,b.jsx)(NE,{id:f,resource:e,field:t,value:v,onChange:s,onBusy:c,invalid:h,describedBy:g});break;case`money`:T=(0,b.jsx)(wE,{...w});break;case`date`:T=(0,b.jsx)(zS,{id:f,live:!0,value:v,label:t.label,onChange:e=>s(e),..._});break;case`datetime`:T=(0,b.jsx)(HS,{id:f,value:v,label:t.label,onChange:e=>s(e),..._});break;case`json`:T=(0,b.jsx)(kE,{...w});break;case`textarea`:T=(0,b.jsx)(AE,{...w});break;case`color`:T=(0,b.jsx)(OE,{...w});break;case`password`:T=(0,b.jsx)(jE,{...w,type:`password`,autoComplete:`new-password`});break;case`slug`:T=(0,b.jsx)(jE,{...w,dir:`ltr`,autoCapitalize:`none`,spellCheck:!1});break;default:T=(0,b.jsx)(jE,{...w,...IE(t,y)})}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[S,T,C,(0,b.jsx)(LE,{id:p,errors:i})]})}function IE(e,t){if(t===`email`||t===`url`)return{type:t};switch(e.type){case`number`:case`decimal`:return{type:`text`,inputMode:`decimal`};case`bigint`:return{type:`text`,inputMode:`numeric`};case`date`:return{type:`date`};case`datetime`:return{type:`datetime-local`};default:return{type:`text`}}}function LE({id:e,errors:t}){return t?.length?(0,b.jsx)(`p`,{id:e,className:`text-sm text-destructive`,children:t.join(` `)}):null}var RE={1:``,2:`md:grid-cols-2`,3:`md:grid-cols-2 lg:grid-cols-3`};function zE({layout:e,names:t,render:n,errors:r,renderInline:i,renderSummary:a,plain:o}){let s=e&&(i?e:UE(e)),c=new Set((s??[]).flatMap(e=>`tab`in e?e.sections:[e]).flatMap(e=>VE(e)||HE(e)?[]:e.fields)),l=t.filter(e=>!c.has(e)),u=(s??[]).filter(e=>`tab`in e),d=(s??[]).findIndex(e=>`tab`in e),f=d===-1?(s??[]).filter(e=>!(`tab`in e)):(s??[]).slice(0,d).filter(e=>!(`tab`in e)),p=d===-1?[]:(s??[]).slice(d).filter(e=>!(`tab`in e)),m=(e,t)=>VE(e)?(0,b.jsx)(y.Fragment,{children:i?.(e)},t):HE(e)?(0,b.jsx)(y.Fragment,{children:a?.(e)},t):(0,b.jsx)(BE,{section:e,render:n,plain:o},t);return(0,b.jsxs)(b.Fragment,{children:[f.map((e,t)=>m(e,`b${t}`)),u.length>0&&(0,b.jsx)(WE,{tabs:u,render:n,errors:r,block:m}),p.map((e,t)=>m(e,`a${t}`)),l.length>0&&(0,b.jsx)(BE,{section:{fields:l,columns:1},render:n,plain:o})]})}function BE({section:e,render:t,plain:n}){let r=(0,y.useId)(),i=e.fields.map(e=>[e,t(e)]).filter(([,e])=>e!==null);if(i.length===0)return null;let a=(0,b.jsx)(`div`,{className:W(`grid gap-5`,RE[e.columns]),children:i.map(([e,t])=>(0,b.jsx)(`div`,{className:`min-w-0`,children:t},e))});return n?e.title?(0,b.jsxs)(`section`,{"aria-labelledby":r,className:`flex flex-col gap-3`,children:[(0,b.jsx)(`h3`,{id:r,className:`text-[13px] font-semibold text-muted-foreground`,children:e.title}),a]}):a:e.title?(0,b.jsx)(uE,{"aria-labelledby":r,title:(0,b.jsx)(`span`,{id:r,children:e.title}),children:a}):(0,b.jsx)(uE,{bodyClassName:`p-5`,children:a})}var VE=e=>`inline`in e,HE=e=>`summary`in e;function UE(e){return e.filter(e=>!VE(e)&&!HE(e)).map(e=>`tab`in e?{...e,sections:e.sections.filter(e=>!VE(e)&&!HE(e))}:e)}function WE({tabs:e,render:t,errors:n,block:r}){let i=X(),{locale:a}=Y(),o=(0,y.useId)(),[s,c]=(0,y.useState)(0),l=(0,y.useRef)([]),u=e=>e.sections.some(e=>(VE(e)?[`_inlines.${e.inline}`]:HE(e)?[]:e.fields).some(e=>Object.keys(n).some(t=>t===e||t.startsWith(`${e}.`))));(0,y.useEffect)(()=>{if(u(e[s]))return;let t=e.findIndex(u);t!==-1&&c(t)},[n]);function d(t){let n=Qh(a)?`ArrowLeft`:`ArrowRight`,r=Qh(a)?`ArrowRight`:`ArrowLeft`,i;t.key===n?i=(s+1)%e.length:t.key===r?i=(s-1+e.length)%e.length:t.key===`Home`?i=0:t.key===`End`&&(i=e.length-1),i!==void 0&&(t.preventDefault(),c(i),l.current[i]?.focus())}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`div`,{role:`tablist`,className:`flex gap-0.5 overflow-x-auto border-b`,onKeyDown:d,children:e.map((e,t)=>(0,b.jsxs)(`button`,{ref:e=>{l.current[t]=e},id:`${o}-tab-${t}`,type:`button`,role:`tab`,"aria-selected":t===s,"aria-controls":`${o}-panel-${t}`,tabIndex:t===s?0:-1,onClick:()=>c(t),className:W(`-mb-px flex h-[38px] items-center gap-1.5 border-b-2 px-3 text-[13px] whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,t===s?`border-foreground font-semibold`:`border-transparent text-muted-foreground hover:text-foreground`),children:[e.tab,u(e)&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-destructive`}),(0,b.jsx)(`span`,{className:`sr-only`,children:i(`form.tabHasErrors`)})]})]},t))}),e.map((e,t)=>(0,b.jsx)(`div`,{id:`${o}-panel-${t}`,role:`tabpanel`,"aria-labelledby":`${o}-tab-${t}`,hidden:t!==s,className:W(`flex-col gap-5`,t===s?`flex`:`hidden`),children:e.sections.map((e,t)=>r(e,String(t)))},t))]})}var GE=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{};function KE({resource:e,field:t,path:n,pattern:r,value:i,constraints:a,markRequired:o,errors:s,onChange:c,idPrefix:l}){let u=X(),d=s[n];if(t.many){let f=Array.isArray(i)?i:[];return(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,b.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:t.label}),f.map((i,d)=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-md border border-dashed p-3`,children:[(0,b.jsx)(qE,{resource:e,field:t,path:`${n}.${d}`,pattern:`${r}.*`,value:i,constraints:a,markRequired:o,errors:s,idPrefix:l,onChange:e=>c(f.map((t,n)=>n===d?e:t))}),(0,b.jsx)(`div`,{children:(0,b.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>c(f.filter((e,t)=>t!==d)),children:[(0,b.jsx)(rx,{}),u(`form.remove`,{name:t.label,index:d+1})]})})]},d)),(0,b.jsx)(`div`,{children:(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>c([...f,TC(t.fields??[])]),children:[(0,b.jsx)(hb,{}),u(`form.add`,{name:t.label})]})}),d&&(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:d.join(` `)})]})}return(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,b.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:t.label}),(0,b.jsx)(qE,{resource:e,field:t,path:n,pattern:r,value:GE(i),constraints:a,markRequired:o,errors:s,idPrefix:l,onChange:c}),d&&(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:d.join(` `)})]})}function qE({resource:e,field:t,path:n,pattern:r,value:i,constraints:a,markRequired:o,errors:s,onChange:c,idPrefix:l}){return(0,b.jsx)(b.Fragment,{children:(t.fields??[]).filter(e=>!e.readonly).map(t=>{let u=`${n}.${t.name}`,d=`${r}.${t.name}`,f=e=>c({...i,[t.name]:e});return t.type===`object`?(0,b.jsx)(KE,{resource:e,field:t,path:u,pattern:d,value:i[t.name],constraints:a,markRequired:o,errors:s,idPrefix:l,onChange:f},t.name):(0,b.jsx)(FE,{resource:e,field:{...t,name:u},value:i[t.name],required:o&&a[d]?.required===!0,errors:s[u],constraints:a[d],idPrefix:l,onChange:f},t.name)})})}function JE(e,t){let n=t?._perm?.actions;return e.actions.filter(e=>e.target===`record`&&(n===void 0||typeof n[e.name]==`string`)).map(e=>n?.[e.name]?{...e,label:n[e.name]}:e)}function YE(e,t){let n=JE(e,t),r=n.find(e=>e.primary),i=n.filter(e=>e!==r);return{...r?{primary:r}:{},buttons:i.slice(0,3),overflow:i.slice(3)}}function XE(e,t){let n=e.actions.filter(e=>e.target===`record`&&e.bulk);return t.length===0?n:n.filter(n=>t.some(t=>JE(e,t).some(e=>e.name===n.name)))}function ZE(e){return e.actions.filter(e=>e.target===`resource`)}function QE(e,t=0){return e.confirm!==void 0||e.variant===`destructive`||t>1}function $E(e,t=0){return!e.input&&!QE(e,t)}function eD(e,t,n,r){if(QE(e,t))return typeof e.confirm==`string`?e.confirm:t>1?r(`action.confirmSelected`,{action:e.label,count:t}):n===void 0?r(`action.confirm`,{action:e.label}):r(`action.confirmRecord`,{action:e.label,name:n})}function tD(e){let t=e.message===void 0?{}:{message:e.message};return`record`in e?{kind:`record`,record:e.record,...t}:`ok`in e&&`failed`in e?{kind:`bulk`,result:{ok:e.ok,failed:e.failed},...t}:{kind:`resource`,...t}}function nD(e,t){return e.kind===`bulk`?e.result:{ok:t,failed:[]}}function rD(e,t){if(!(e instanceof fg))return{fields:{},form:e.message};let n=Object.entries(e.fields),r=e=>t.includes(e.split(`.`)[0]),i=Object.fromEntries(n.filter(([e])=>r(e))),a=n.filter(([e])=>!r(e)).map(([e,t])=>`${e}: ${t.join(`, `)}`);return{fields:i,form:Object.keys(i).length>0&&a.length===0?null:[e.message,...a].join(` — `)}}var iD=/\{([^{}]*)\}/g;function aD(e,t){let n=!1,r=e.replace(iD,(e,r)=>{let i=t[r],a=typeof i==`string`?i.trim():typeof i==`boolean`?String(i):``;return a===``&&(n=!0),a});return n?``:r}function oD(e,t){return new Set(e.filter(e=>e.fillFrom!==void 0&&t[e.name]!==``&&t[e.name]!==void 0).map(e=>e.name))}function sD(e,t,n){let r=e.filter(e=>e.fillFrom!==void 0&&!n.has(e.name));if(r.length===0)return t;let i=t;for(let e=0;e<=r.length;e++){let e=!1;for(let n of r){let r=aD(n.fillFrom,i);i[n.name]!==r&&(i===t&&(i={...t}),i[n.name]=r,e=!0)}if(!e)break}return i}function cD(e,t,n,r){e.some(e=>e.name===n&&e.fillFrom!==void 0)&&(r===``||r===null?t.delete(n):t.add(n))}function lD(e,t){let n=mC(e)?String(e.id):e;return t===null?n==null||n===``:typeof t==`boolean`?n===t||n===String(t):typeof n!=`string`||n.trim()===``?!1:typeof t==`number`?Number(Nh(n).trim().replace(/,/g,``))===t:n===t}function uD(e,t){return!e.showIf||Object.entries(e.showIf).every(([e,n])=>(Array.isArray(n)?n:[n]).some(n=>lD(t[e],n)))}var dD=/^.+@[^\s@]+\.[^\s@]+$/,fD=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function pD(e){if(/\s/.test(e))return!1;try{let{hostname:t}=new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(e)?e:`http://${e}`);return t.includes(`.`)||t.startsWith(`[`)}catch{return!1}}function mD(e,t){try{return new RegExp(t.source,t.flags).test(e)}catch{return!0}}function hD(e){let t=e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)??[],n=e.match(/[^\uFE0F\uFE0E][\uFE0F\uFE0E]/g)??[];return e.length-t.length-n.length}function gD(e,t){let n=[];if(typeof e==`string`){let r=hD(e);t.minLength!==void 0&&r<t.minLength&&n.push(J(`validation.minLength`,{min:t.minLength})),t.maxLength!==void 0&&r>t.maxLength&&n.push(J(`validation.maxLength`,{max:t.maxLength})),t.pattern&&!mD(e,t.pattern)&&n.push(t.pattern.message??J(`validation.pattern`)),t.format===`email`&&!dD.test(e)&&n.push(J(`validation.email`)),t.format===`url`&&!pD(e)&&n.push(J(`validation.url`)),t.format===`uuid`&&!fD.test(e)&&n.push(J(`validation.uuid`)),t.oneOf&&!t.oneOf.includes(e)&&n.push(J(`validation.oneOf`,{values:t.oneOf.join(`, `)}))}return typeof e==`number`&&(t.integer&&!Number.isInteger(e)&&n.push(J(`validation.integer`)),t.min!==void 0&&e<t.min&&n.push(J(`validation.min`,{min:t.min})),t.max!==void 0&&e>t.max&&n.push(J(`validation.max`,{max:t.max}))),n}function _D(e,t,n){let r={};for(let[i,a]of Object.entries(t))for(let{path:t,value:o,sent:s,parentSent:c}of vD(e,i.split(`.`))){if(o==null||o===``){a.required&&c&&(n===`create`||s)&&(r[t]=[J(`validation.required`)]);continue}let e=gD(o,a);e.length>0&&(r[t]=e)}return r}function vD(e,t,n=``,r=!0){let[i,...a]=t,o=typeof e==`object`&&e?e:void 0;if(i===`*`)return(Array.isArray(e)?e:[]).flatMap((e,t)=>vD(e,a,`${n}${t}.`,!0));let s=o!==void 0&&Object.hasOwn(o,i),c=o?.[i],l=`${n}${i}`;return a.length===0?[{path:l,value:c,sent:s,parentSent:r}]:vD(c,a,`${l}.`,r&&s)}function yD({resource:e,action:t,count:n,subject:r,running:i,error:a,onRun:o,onClose:s}){let c=X(),l=t.input?.fields??[],u=(0,y.useRef)(new Set),[d,f]=(0,y.useState)(()=>sD(l,TC(l),u.current)),[p,m]=(0,y.useState)({}),[h,g]=(0,y.useState)(!1),_=l.filter(e=>uD(e,d)),v=a&&!h?rD(a,l.map(e=>e.name)):{fields:{},form:null},x={...v.fields,...p};function S(e){if(e.preventDefault(),e.stopPropagation(),!t.input)return o(void 0);let{payload:n,errors:r}=DC(_,d),i={..._D(n,Object.fromEntries(Object.entries(t.input.constraints).filter(([e])=>_.some(t=>t.name===e.split(`.`)[0]))),`create`),...r};m(i),g(Object.keys(i).length>0),Object.keys(i).length===0&&o(n)}let C=eD(t,n,r,c);function w(n){let r=_.find(e=>e.name===n);if(!r||!t.input)return null;let i=e=>{cD(l,u.current,n,e),f(t=>sD(l,{...t,[n]:e},u.current))};return r.type===`object`?(0,b.jsx)(KE,{resource:e,field:r,path:n,pattern:n,value:d[n],constraints:t.input.constraints,markRequired:!0,errors:x,idPrefix:`action`,onChange:i}):(0,b.jsx)(FE,{resource:e,field:r,value:d[n],required:t.input.required.includes(n),errors:x[n],constraints:t.input.constraints[n],idPrefix:`action`,onChange:i})}return(0,b.jsx)(jd,{open:!0,onOpenChange:e=>!e&&!i&&s(),children:(0,b.jsxs)(Ld,{children:[(0,b.jsx)(zd,{className:US}),(0,b.jsx)(Ud,{"aria-describedby":C?`action-question`:void 0,className:`fixed inset-x-3 top-[12vh] z-50 mx-auto flex max-h-[76vh] max-w-lg flex-col overflow-hidden rounded-xl border bg-background shadow-xl outline-none`,children:(0,b.jsxs)(`form`,{onSubmit:S,noValidate:!0,className:`flex min-h-0 flex-col`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-4 overflow-y-auto p-4`,children:[(0,b.jsx)(Jd,{className:`text-lg font-semibold`,children:t.label}),C&&(0,b.jsx)(`p`,{id:`action-question`,className:`text-sm`,children:C}),n>1&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c(t.atomic?`action.atomicNote`:`action.eachNote`,{count:n})}),v.form&&(0,b.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:v.form}),t.input&&(0,b.jsx)(zE,{layout:void 0,names:l.map(e=>e.name),errors:x,render:w})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t p-4`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:i,onClick:s,children:c(`common.cancel`)}),(0,b.jsx)(q,{type:`submit`,variant:t.variant===`destructive`?`destructive`:`default`,disabled:i,children:i?c(`action.running`):t.label})]})]})})]})})}function bD({resource:e,action:t,ids:n,subject:r,size:i=`default`,className:a,primary:o=!1,menuItem:s=!1,blocked:c=!1,describedBy:l,onDone:u}){let d=X(),f=S(),[p,m]=(0,y.useState)(!1),h=$E(t,n?.length??0),g=pt({mutationFn:r=>Q.runAction(e,t.name,{...n?{ids:n}:{},...r?{input:r}:{}}),onSuccess:r=>{let i=tD(r);m(!1),i.kind===`bulk`?i.message&&cT(i.message):cT(i.message??d(i.kind===`record`&&i.record===null?`action.doneGone`:`action.done`,{action:t.label})),u(i,n??[]);for(let t of[`list`,`count`,`record`,`history`])f.invalidateQueries({queryKey:[t,e]})},onError:e=>{h&&cT(pg(e),`error`)}}),_=eT(t.icon);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(q,{type:`button`,size:i,variant:t.variant===`destructive`?`destructive`:o?`default`:s?`ghost`:`outline`,className:W(s&&`w-full justify-start font-normal`,a),disabled:c||g.isPending,"aria-describedby":l,"data-action":t.name,onClick:()=>{g.reset(),h?g.mutate(void 0):m(!0)},children:[_&&(0,b.jsx)(_,{"aria-hidden":!0}),t.label,o&&(0,b.jsx)(Tv,{className:`ltr:rotate-180`,"aria-hidden":!0})]}),p&&(0,b.jsx)(yD,{resource:e,action:t,count:n?.length??0,subject:r,running:g.isPending,error:g.error,onRun:e=>g.mutate(e),onClose:()=>m(!1)})]})}function xD({schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a}){let o=X(),s=S(),[c,l]=(0,y.useState)(!1),{primary:u,buttons:d,overflow:f}=YE(e,t);if(!u&&d.length===0)return null;let p=`record-actions-note`,m=(o,c={})=>(0,b.jsx)(bD,{resource:e.name,action:o,ids:[n],subject:typeof t._title==`string`?t._title:`#${n}`,blocked:r,describedBy:r?p:void 0,...c,onDone:t=>{l(!1);let r=t.kind===`record`?t.record:void 0;if(r===null){i(),s.removeQueries({queryKey:[`record`,e.name,n]});return}r&&s.setQueryData([`record`,e.name,n],r),a()}},o.name);return(0,b.jsxs)(`div`,{role:`group`,"aria-label":o(`list.actions`),className:`ms-auto flex flex-wrap items-center gap-2`,children:[r&&(0,b.jsx)(`span`,{id:p,className:`text-xs text-muted-foreground`,children:o(`action.saveFirst`)}),d.map(e=>m(e)),f.length>0&&(0,b.jsxs)(Sh,{open:c,onOpenChange:l,children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`icon`,"aria-label":o(`action.more`),children:(0,b.jsx)(Yv,{})})}),(0,b.jsx)(wh,{forceMount:!0,children:(0,b.jsx)(Th,{forceMount:!0,align:`end`,sideOffset:6,className:`z-50 flex min-w-48 flex-col gap-0.5 rounded-[10px] border bg-popover p-1.5 shadow-lg data-[state=closed]:hidden`,onClick:()=>l(!1),children:f.map(e=>m(e,{menuItem:!0}))})})]}),u&&m(u,{primary:!0})]})}function SD({schema:e,ids:t,bulkOnly:n=!1,size:r=`default`}){let i=X(),a=(e.prints??[]).filter(e=>!n||e.bulk);return t.length===0||a.length===0?null:(0,b.jsx)(b.Fragment,{children:a.map(n=>{let a=eT(n.icon)??_b;return(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:r,"aria-label":i(`print.open`,{name:n.label}),onClick:()=>window.open(Hg(e.name,n.name,t),`_blank`,`noopener`),children:[(0,b.jsx)(a,{}),n.label]},n.name)})})}function CD({schema:e,query:t,iconOnly:n=!1}){let r=X(),[i,a]=(0,y.useState)(!1);if(!e.list.export)return null;async function o(){a(!0);try{let{blob:n,filename:i,truncated:a}=await Q.exportList(e.name,t),o=URL.createObjectURL(n),s=document.createElement(`a`);s.href=o,s.download=i,s.click(),setTimeout(()=>URL.revokeObjectURL(o),1e4),cT(a?r(`list.exportTruncated`,{count:a}):r(`list.exportDone`,{file:i}),a?`error`:`success`)}catch(e){cT(pg(e),`error`)}finally{a(!1)}}return(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:n?`icon`:`default`,disabled:i,"aria-label":n?r(`list.export`):void 0,onClick:()=>void o(),children:[(0,b.jsx)(ty,{}),!n&&r(i?`list.exporting`:`list.export`)]})}function wD(e,t,n){return e<=0?-1:t<0?n?e-1:0:(t+(n?-1:1)+e)%e}var TD=`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`,ED=[],DD=null;function OD(){let e=document.getElementById(`root`),t=document.documentElement,n={overflow:document.body.style.overflow,gutter:t.style.scrollbarGutter,inert:e?.hasAttribute(`inert`)??!1};document.body.style.overflow=`hidden`,t.style.scrollbarGutter=`stable`,e?.setAttribute(`inert`,``),DD=()=>{document.body.style.overflow=n.overflow,t.style.scrollbarGutter=n.gutter,n.inert||e?.removeAttribute(`inert`)}}function kD({labelledBy:e,describedBy:t,onDismiss:n,initialFocus:r,className:i,children:a}){let o=(0,y.useRef)(null),s=(0,y.useRef)(n);return s.current=n,(0,y.useEffect)(()=>{let e=Symbol(`alert`),t=document.activeElement instanceof HTMLElement?document.activeElement:null;ED.length===0&&OD(),ED.push(e),((r?o.current?.querySelector(r):null)??o.current?.querySelector(TD)??o.current)?.focus();let n=t=>{if(ED[ED.length-1]===e&&o.current){if(t.key===`Escape`&&s.current)t.preventDefault(),t.stopPropagation(),s.current();else if(t.key===`Tab`){t.preventDefault();let e=[...o.current.querySelectorAll(TD)];(e[wD(e.length,e.indexOf(document.activeElement),t.shiftKey)]??o.current).focus()}}};return document.addEventListener(`keydown`,n,!0),()=>{document.removeEventListener(`keydown`,n,!0),ED.splice(ED.indexOf(e),1),ED.length===0&&(DD?.(),DD=null),t?.isConnected&&ED.length===0&&t.focus()}},[r]),(0,Ec.createPortal)((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{"data-testid":`alert-backdrop`,"aria-hidden":!0,className:US,onClick:()=>s.current?.()}),(0,b.jsx)(`div`,{ref:o,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":e,"aria-describedby":t,"data-state":`open`,tabIndex:-1,className:W(`fixed inset-x-3 top-[12vh] z-50 mx-auto max-h-[76vh] max-w-lg overflow-y-auto rounded-card border border-amber-500/50 bg-background p-4 shadow-xl outline-none motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-2 motion-safe:duration-150`,i),children:a})]}),document.body)}function AD(e){let t=(0,y.useRef)(!1),n=ha(({currentLocation:n,nextLocation:r})=>e&&!t.current&&(n.pathname!==r.pathname||n.search!==r.search));return(0,y.useEffect)(()=>{if(!e)return;let t=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,t),()=>window.removeEventListener(`beforeunload`,t)},[e]),{blocker:n,release:()=>{t.current=!0}}}function jD({blocker:e}){let t=X();return e.state===`blocked`?(0,b.jsxs)(kD,{labelledBy:`leave-title`,onDismiss:()=>e.reset(),className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`p`,{id:`leave-title`,className:`min-w-0 flex-1 basis-full text-sm font-medium sm:basis-0`,children:t(`form.leaveTitle`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>e.reset(),children:t(`form.stay`)}),(0,b.jsx)(q,{type:`button`,variant:`destructive`,onClick:()=>e.proceed(),children:t(`form.leave`)})]}):null}function MD(e,t){let n=(0,y.useRef)(t);n.current=t,(0,y.useEffect)(()=>{let t=t=>{if(!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey||t.key.toLowerCase()!==`s`)return;t.preventDefault();let r=document.querySelector(`[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]`);(!r||r.contains(e.current))&&(n.current?.(),e.current?.requestSubmit())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function ND(e){let[t,n]=(0,y.useState)([]),[r,i]=(0,y.useState)(!1),a=(0,y.useRef)(e);return a.current=e,(0,y.useEffect)(()=>{t.length>0||!r||(i(!1),a.current())},[t.length,r]),{busy:t.length>0,setBusy:(e,t)=>n(n=>t===n.includes(e)?n:t?[...n,e]:n.filter(t=>t!==e)),refuse:()=>i(!0)}}function PD({dirty:e,children:t}){let n=X();return(0,b.jsxs)(`div`,{className:`sticky bottom-3 z-10 flex flex-wrap items-center gap-2 rounded-card border bg-card px-4 py-2.5 shadow-[0_12px_32px_rgba(0,0,0,.12)]`,children:[e&&(0,b.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-[13px] font-semibold`,children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full bg-amber-500`}),n(`form.unsaved`)]}),(0,b.jsx)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:t})]})}function FD(){let e=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform);return(0,b.jsx)(`kbd`,{"aria-hidden":!0,className:`rounded border border-current/30 px-1 font-sans text-[10.5px] opacity-80`,children:e?`⌘S`:`Ctrl S`})}var ID=`—`,LD=e=>e==null||e===``;function RD(e,t){let n=t?.value;switch(e.kind){case`image`:return typeof n==`string`&&n!==``?{kind:`image`,src:n}:{kind:`image`};case`toggle`:return{kind:`toggle`,on:n===!0};case`money`:{if(LD(n))return{kind:`money`,text:ID};let e=Mx(String(n),LD(t?.previous)?{}:{previous:String(t.previous)});return{kind:`money`,text:e.main,...e.unit?{unit:e.unit,unitPosition:e.position}:{},...e.previous===void 0?{}:{previous:e.previous}}}case`badge`:return{kind:`badge`,text:t?.label??(LD(n)?ID:String(n)),...t?.tone?{tone:t.tone}:{}};case`count`:return{kind:`count`,text:typeof n==`number`?eg(n):LD(n)?ID:tg(String(n))};case`title`:return{kind:`title`,text:LD(n)?ID:String(n),...LD(t?.subline)?{}:{subline:String(t.subline)}}}}function zD({schema:e,name:t,column:n,item:r,compact:i=!1}){let a=r._computed?.[t],o=RD(n,a);switch(o.kind){case`image`:return(0,b.jsx)(`span`,{className:W(`flex shrink-0 items-center justify-center overflow-hidden rounded-control border bg-muted text-muted-foreground`,i?`size-14`:`size-10`),children:o.src?(0,b.jsx)(`img`,{src:o.src,alt:``,className:`size-full object-cover`,loading:`lazy`}):(0,b.jsx)(yy,{className:`size-[18px]`,"aria-hidden":!0})});case`title`:return(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-col leading-[1.45]`,children:[(0,b.jsx)(`span`,{className:W(`truncate font-semibold`,i?`text-[14.5px]`:`text-[13.5px]`),children:o.text}),o.subline&&(0,b.jsx)(`span`,{className:`truncate text-start font-mono text-[11.5px] text-muted-foreground`,children:(0,b.jsx)(`bdi`,{dir:`ltr`,children:o.subline})})]});case`money`:return(0,b.jsxs)(`span`,{className:`flex flex-col leading-[1.4]`,children:[(0,b.jsxs)(`span`,{className:`font-semibold whitespace-nowrap`,children:[o.unit&&o.unitPosition===`before`&&(0,b.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[o.unit,` `]}),o.text,o.unit&&o.unitPosition!==`before`&&(0,b.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[` `,o.unit]})]}),o.previous&&(0,b.jsx)(`s`,{className:`text-xs text-muted-foreground`,children:o.previous})]});case`badge`:return(0,b.jsx)(aE,{tone:o.tone,children:o.text});case`count`:return(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:o.text});case`toggle`:return(0,b.jsx)(BD,{schema:e,column:n,item:r,on:o.on===!0})}}function BD({schema:e,column:t,item:n,on:r}){let i=X(),a=S(),[o,s]=(0,y.useState)(r),c=t.toggle,l=c!==void 0&&n._perm?.update!==!1&&!(Array.isArray(n._readonly)&&n._readonly.includes(c.field)),u=pt({mutationFn:t=>Q.update(e.name,String(n._id),{[c.field]:t?c.on:c.off},e.version?n[e.version]:void 0),onSuccess:()=>a.invalidateQueries({queryKey:[`list`,e.name]}),onError:e=>{s(r),cT(pg(e),`error`)}}),d=typeof n._title==`string`?n._title:String(n._id);return(0,b.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":o,"aria-label":i(`list.toggleRow`,{column:t.label,name:d}),disabled:!l||u.isPending,onClick:e=>{e.preventDefault(),e.stopPropagation(),s(!o),u.mutate(!o)},className:W(`relative inline-block h-5 w-9 shrink-0 cursor-pointer rounded-full bg-input transition-colors disabled:cursor-default disabled:opacity-60`,o&&`bg-primary`,`after:absolute after:top-0.5 after:size-4 after:rounded-full after:bg-white after:shadow-sm after:transition-[inset-inline-start] after:content-[''] after:start-0.5`,o&&`after:start-[18px]`)})}function VD(e){let t=e.form.layout;return t?t.flatMap(e=>`tab`in e?e.sections:[e]).flatMap(e=>`fields`in e&&!(`inline`in e)?e.fields:[]):[...new Set([...e.form.update,...e.form.readonly])]}function HD(e){let t=(e.form.layout??[]).flatMap(e=>`tab`in e?e.sections:[e]).flatMap(e=>`summary`in e?e.summary.flatMap(e=>`field`in e.value?[e.value.field]:[]):[]),n=(e.form.aside??[]).flatMap(e=>e.relation?[e.relation.field]:e.fields),r=[...e.form.header?.badges??[],...(e.form.header?.subtitle??[]).flatMap(e=>`field`in e?[e.field]:[])],i=new Set(e.form.update);return new Set([...t,...n,...r].filter(e=>!i.has(e)))}function UD(e,t,n){let r=e.form.mode===`view`&&t!==void 0&&!n,i=new Set(VD(e)),a=r?[]:e.form.update.filter(t=>i.has(t)||!e.form.layout),o=e.form.header,s=t=>e.fields.find(e=>e.name===t),c=e=>e!==void 0&&t?.[e.name]!==void 0&&t?.[e.name]!==null,l=(o?.badges?o.badges.map(s):e.fields.filter(e=>e.widget===`badge`)).filter(c),u=o?.stepper?s(o.stepper):void 0;u&&c(u)&&u.steps?.exclude.includes(String(t[u.name]))&&!l.includes(u)&&l.push(u);let d=t?._computed??{};return{editable:a,header:{badges:l,subtitle:(o?.subtitle??[]).flatMap(n=>{if(`field`in n){let e=s(n.field);return e&&c(e)?[Px(t[e.name],e)]:[]}let r=e.list.computed?.[n.computed];if(!r||!d[n.computed])return[];let i=RD(r,d[n.computed]);return i.text?[r.kind===`count`?`${i.text} ${r.label}`:i.text]:[]}),...u?{stepper:u}:{}},aside:e.form.aside??[]}}function WD(e,t,n){return e.relation?n?._aside?.[String(t)]:n}function GD(e,t,n){let r=n?._computed??{};return e.summary.flatMap(e=>{if(`field`in e.value){let r=t.fields.find(t=>t.name===e.value.field),i=n?.[e.value.field];return r&&i!=null?[{label:e.label,text:Px(i,r)}]:[]}let i=t.list.computed?.[e.value.computed],a=r[e.value.computed];if(!i||!a)return[];let o=RD(i,a),s=o.unit?o.unitPosition===`before`?`${o.unit} ${o.text}`:`${o.text} ${o.unit}`:o.text;return s?[{label:e.label,text:s}]:[]})}function KD(e,t){let n={};for(let r of e){if(!r.warnIf||!(r.name in t))continue;let e=t[r.name];(e==null||typeof e==`string`&&e.trim()===``)&&(n[r.name]=r.warnIf.message)}return n}function qD(e,t){return e.fields.filter(t=>t!==e.order).flatMap(e=>t.fields.filter(t=>t.name===e))}function JD(e,t,n){let r=n?._inlines?.[e.inline],i=qD(e,t);return(r?.rows??[]).map(e=>({key:String(e._id),id:String(e._id),record:e,values:TC(i,e)}))}function YD(e,t,n){return{key:n,values:TC(qD(e,t))}}function XD(e,t){if(!e.record)return new Set;let n=e.record._perm;if(t.permissions?.update===!1||n?.update===!1)return new Set(t.fields.map(e=>e.name));let r=Array.isArray(e.record._readonly)?e.record._readonly:[];return new Set([...t.form.readonly,...r])}function ZD(e,t,n,r){let i=qD(e,t),a={},o=[],s=[],c=new Map(n.map(e=>[e.key,e]));for(let e of r){let n=c.get(e.key);if(n?.id!==void 0){let r=XD(e,t),{payload:o,errors:c}=DC(i.filter(e=>!r.has(e.name)),e.values,n.values),l={..._D(o,t.form.constraints.update,`update`),...c};if(Object.keys(l).length>0&&(a[e.key]=l),Object.keys(o).length===0)continue;let u=t.version?n.record?.[t.version]:void 0;s.push({_id:n.id,...o,...typeof u==`number`?{_version:u}:{}})}else{let{payload:n,errors:r}=DC(i,e.values),s={..._D(n,t.form.constraints.create,`create`),...r};Object.keys(s).length>0&&(a[e.key]=s),o.push({_key:e.key,...n})}}let l=new Set(r.map(e=>e.key)),u=n.filter(e=>e.id!==void 0&&!l.has(e.key)).map(e=>e.id),d=e.order!==void 0&&t.form.update.includes(e.order),f=r.map(e=>e.key),p=d&&f.join(`
56
56
  `)!==n.map(e=>e.key).join(`
57
- `)?f:void 0,m={...o.length?{create:o}:{},...s.length?{update:s}:{},...u.length?{delete:u}:{},...p?{order:p}:{}};return{changes:Object.keys(m).length?m:void 0,errors:a}}function KD(e,t,n,r,i){let a={},o={};for(let s of e){let e=t[s.inline];if(!e||s.readonly)continue;let c=r[s.inline]??[],l=GD(s,e,n[s.inline]??[],c),u=l.changes?i(s,c.length):null;(Object.keys(l.errors).length>0||u)&&(o[s.inline]={rows:l.errors,inline:u?[u]:[]}),l.changes&&(a[s.inline]=l.changes)}return{changes:Object.keys(a).length?a:void 0,errors:o}}function qD(e,t){let n={},r={};for(let[i,a]of Object.entries(e)){if(i!==`_inlines`&&!i.startsWith(`_inlines.`)){r[i]=a;continue}let[,e=``,o,s,...c]=i.split(`.`),l=n[e]??={rows:{},inline:[]},u=o===`create`?t?.[e]?.create?.[Number(s)]?._key:o===`update`||o===`delete`?s:void 0,d=c.join(`.`);u===void 0||o===`create`&&!/^\d+$/.test(s??``)||d===``?l.inline.push(...a):((l.rows[u]??={})[d]??=[]).push(...a)}return{inlines:n,parent:r}}var JD=e=>Object.values(e).some(e=>e.inline.length>0||Object.keys(e.rows).length>0);function YD({inline:e,child:t,rows:n,onChange:r,readOnly:i,errors:a,parent:o,parentValues:s,onBusy:c,truncated:l,canAdd:u=!0}){let d=X(),f=(0,y.useId)(),p=VD(e,t),m=(0,y.useRef)(0),[h,g]=(0,y.useState)(null),_=!i&&u&&t.permissions?.create!==!1&&t.form.create.length>0&&n.length<e.max,v=!i&&e.order!==void 0&&t.form.update.includes(e.order)&&n.length>1,x=e=>!i&&(e.id===void 0||t.permissions?.delete!==!1&&e.record?._perm?.delete!==!1),S=e=>s===void 0?void 0:JSON.stringify({...JSON.parse(DC(p,e.values)??`{}`),_parent:JSON.parse(s)});function C(){let i;do i=`n${++m.current}`;while(n.some(e=>e.key===i));r([...n,UD(e,t,i)])}let w=(e,t,i)=>r(n.map(n=>n.key===e?{...n,values:{...n.values,[t]:i}}:n)),T=e=>r(n.filter(t=>t.key!==e));function E(e,t){if(t<0||t>=n.length||e===t)return;let i=[...n];i.splice(t,0,i.splice(e,1)[0]),r(i)}function D(n,r,s){let l=`inline-${t.name}-${n.key}`,u=a?.rows[n.key]??{},d=n.id===void 0;if(i||!(d?t.form.create:t.form.update).includes(r.name)||WD(n,t).has(r.name))return d?null:e.readonly&&s?(0,b.jsx)(rE,{value:n.record?.[r.name],field:r,record:n.record}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-readonly":r.name,children:[!s&&(0,b.jsx)(`span`,{className:`text-sm font-medium`,children:r.label}),(0,b.jsx)(`div`,{className:`min-h-8 rounded-lg bg-muted/50 px-2.5 py-1.5 text-sm break-words`,children:(0,b.jsx)(rE,{value:n.record?.[r.name],field:r,record:n.record})})]});let f=d?`create`:`update`;if(r.type===`object`)return(0,b.jsx)(BE,{resource:t.name,field:r,path:r.name,pattern:r.name,value:n.values[r.name],constraints:t.form.constraints[f],markRequired:d,errors:u,idPrefix:l,onChange:e=>w(n.key,r.name,e)});let p=BD([r],n.values)[r.name],m=(0,b.jsx)(kE,{resource:t.name,field:r,value:n.values[r.name],required:d&&t.form.requiredOnCreate.includes(r.name),errors:u[r.name],constraints:t.form.constraints[f][r.name],formValues:r.type===`relation`?S(n):void 0,parent:o,idPrefix:l,hideLabel:s,onChange:e=>w(n.key,r.name,e),onBusy:e=>c(`${t.name}:${n.key}:${r.name}`,e)});return p?(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[m,(0,b.jsxs)(`p`,{className:`flex items-center gap-1 text-xs text-warn`,children:[(0,b.jsx)(ix,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),p]})]}):m}function O(t,r){let i=d(`inline.row`,{name:e.label,index:r+1});return(0,b.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`cursor-grab text-muted-foreground`,draggable:!0,"aria-hidden":!0,onDragStart:e=>{e.dataTransfer.effectAllowed=`move`,g(r)},onDragEnd:()=>g(null),children:(0,b.jsx)(uy,{className:`size-4`})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:r===0,"aria-label":d(`inline.moveUp`,{name:i}),onClick:()=>E(r,r-1),children:(0,b.jsx)(X_,{})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:r===n.length-1,"aria-label":d(`inline.moveDown`,{name:i}),onClick:()=>E(r,r+1),children:(0,b.jsx)(K_,{})})]}),x(t)&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":d(`inline.remove`,{name:i}),onClick:()=>T(t.key),children:(0,b.jsx)(nx,{})})]})}let k=e=>v?{onDragOver:e=>{h!==null&&e.preventDefault()},onDrop:t=>{t.preventDefault(),h!==null&&E(h,e),g(null)}}:{},A=e=>{let t=Object.entries(a?.rows[e.key]??{}).filter(([e])=>!p.some(t=>t.name===e.split(`.`)[0]));return t.length>0?(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:t.map(([e,t])=>`${e}: ${t.join(`, `)}`).join(` — `)}):null},j=v||n.some(x);return(0,b.jsxs)(`section`,{"aria-labelledby":f,className:`flex min-w-0 flex-col rounded-card border bg-card shadow-card`,"data-inline":t.name,children:[(0,b.jsxs)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 border-b px-5 py-3`,children:[(0,b.jsx)(`h2`,{id:f,className:`text-[15px] font-semibold`,children:e.label}),(0,b.jsx)(`span`,{className:`inline-flex h-5 items-center rounded-full bg-muted px-2 text-[11px] text-muted-foreground`,children:ZD(d,e,n.length)}),_&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,className:`ms-auto`,onClick:C,children:[(0,b.jsx)(mb,{}),d(`form.add`,{name:e.label})]})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 p-5 empty:hidden`,children:[l&&(0,b.jsxs)(`p`,{role:`note`,className:`text-sm text-muted-foreground`,children:[d(`inline.truncated`,{count:l.total-n.length}),` `,(0,b.jsx)(bo,{to:l.href,className:`text-primary hover:underline`,children:d(`inline.openList`)})]}),n.length===0&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d(`inline.empty`)}),n.length>0&&e.display===`table`&&(0,b.jsx)(`div`,{className:`relative -mx-5 overflow-x-auto border-y first:-mt-5 first:border-t-0 last:-mb-5 last:border-b-0`,children:(0,b.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,b.jsx)(`thead`,{className:`bg-[color-mix(in_oklab,var(--muted)_50%,transparent)] text-[12.5px] text-muted-foreground`,children:(0,b.jsxs)(`tr`,{children:[(e.computed??[]).map(e=>(0,b.jsx)(`th`,{scope:`col`,className:`px-3.5 py-2.5 text-start font-medium whitespace-nowrap`,children:t.list.computed?.[e]?.label},`~${e}`)),p.map(e=>(0,b.jsxs)(`th`,{scope:`col`,className:`px-3.5 py-2.5 text-start font-medium whitespace-nowrap`,children:[e.label,t.form.requiredOnCreate.includes(e.name)&&n.some(e=>e.id===void 0)&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`text-destructive`,children:`*`})]},e.name)),j&&(0,b.jsx)(`th`,{scope:`col`,className:`px-3.5 py-2.5`,children:(0,b.jsx)(`span`,{className:`sr-only`,children:d(`inline.rowActions`)})})]})}),(0,b.jsx)(`tbody`,{children:n.map((n,r)=>(0,b.jsxs)(`tr`,{"data-row":n.key,className:W(`border-t align-top`,h===r&&`opacity-50`),...k(r),children:[(e.computed??[]).map(e=>(0,b.jsx)(`td`,{className:`px-3.5 py-2`,children:n.record&&t.list.computed?.[e]&&(0,b.jsx)(ND,{schema:t,name:e,column:t.list.computed[e],item:n.record})},`~${e}`)),p.map(e=>(0,b.jsx)(`td`,{className:`min-w-32 px-3.5 py-2`,children:D(n,e,!0)},e.name)),j&&(0,b.jsx)(`td`,{className:`px-3.5 py-2`,children:O(n,r)})]},n.key))})]})}),e.display===`table`&&n.map(e=>(0,b.jsx)(y.Fragment,{children:A(e)},e.key)),e.display===`cards`&&n.map((n,r)=>(0,b.jsxs)(`div`,{"data-row":n.key,className:W(`flex flex-col gap-4 rounded-card border bg-background/40 p-4`,h===r&&`opacity-50`),...k(r),children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,b.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium`,children:[XD(n)??d(`inline.newRow`,{name:e.label,index:r+1}),r===0&&e.markFirst&&(0,b.jsx)($T,{tone:`primary`,children:e.markFirst})]}),O(n,r)]}),(0,b.jsx)(NE,{plain:!0,layout:t.form.layout,names:p.map(e=>e.name),errors:a?.rows[n.key]??{},render:e=>{let t=p.find(t=>t.name===e);return t?D(n,t,!1):null}}),A(n)]},n.key)),a&&a.inline.length>0&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a.inline.join(` — `)})]})]})}var XD=e=>typeof e.record?._title==`string`?e.record._title:void 0;function ZD(e,t,n){return t.min?e(`inline.limitsBetween`,{min:t.min,max:t.max,count:n}):e(`inline.limitsMax`,{max:t.max,count:n})}var QD=(e,t)=>t===void 0?[`history`,e]:[`history`,e,t];function $D({schema:e,id:t,record:n}){let r=X(),i=Gg(),a=mt({queryKey:QD(e.name,t),initialPageParam:void 0,queryFn:({pageParam:n})=>Q.history(e.name,t,n),getNextPageParam:e=>e.next,staleTime:0});if(a.isPending)return(0,b.jsx)(G,{children:r(`common.loading`)});if(a.isError&&!a.data)return(0,b.jsx)(G,{tone:`error`,children:pg(a.error)});let o=a.data.pages.flatMap(e=>e.entries);if(o.length===0)return(0,b.jsx)(G,{children:r(`audit.empty`)});let s=t=>t===e.name?e:void 0;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,b.jsx)(aS,{entries:o,now:new Date(a.dataUpdatedAt),names:Ix(i.data,s),schemaOf:s,titleOf:(e,t)=>eO(n,e,t)}),a.isError&&(0,b.jsx)(G,{tone:`error`,children:pg(a.error)}),a.hasNextPage&&(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`self-center`,disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:r(a.isFetchingNextPage?`common.loading`:`list.loadMore`)})]})}function eO(e,t,n){let r=e?.[t],i=(Array.isArray(r)?r:[r]).find(e=>typeof e==`object`&&!!e&&String(e.id)===n);return typeof i?.title==`string`?i.title:void 0}function tO(e){return e.normalize(`NFKD`).replace(/\p{M}/gu,``).normalize(`NFC`).toLowerCase().replace(/[^\p{L}\p{N}]+/gu,`-`).replace(/^-+|-+$/g,``)}function nO(e,t,n){let r=typeof t?._title==`string`?t._title:`#${n}`;return r.startsWith(`#`)?`${e} ${r}`:`${e}: ${r}`}function rO({mode:e}){let t=X(),{resource:n=``,id:r}=$i(),i=qi(),[a]=wo(),o=e===`create`?a.get(`from`)??void 0:void 0,s=e===`edit`?r:o,c=Kg(n),l=Xg(n,s),[u,d]=(0,y.useState)(0),f=`${n}:${r}`,[p,m]=(0,y.useState)({of:f,tab:`details`}),h=p.of===f?p.tab:`details`;if(c.isPending||s!==void 0&&l.isPending)return(0,b.jsx)(G,{children:t(`common.loading`)});if(c.isError)return(0,b.jsx)(G,{tone:`error`,children:c.error.message});if(s!==void 0&&l.isError)return(0,b.jsx)(G,{tone:`error`,children:l.error.message});let g=i.state?.saved;return(0,b.jsx)(aO,{schema:c.data,mode:e,id:r,record:e===`edit`?l.data:void 0,source:o?l.data:void 0,saved:u===0?g:void 0,onChanged:()=>d(e=>e+1),tab:h,onTab:e=>m({of:f,tab:e})},e===`edit`?`${n}:${r}:${u}`:`${n}:new:${i.key}`)}function iO(e,t){let n=new Set(e.fields.filter(e=>e.primary||e.unique||e.readonly||e.file).map(e=>e.name)),r=new Set(e.fields.filter(e=>e.widget===`richtext`).map(e=>e.name));return Object.fromEntries(Object.entries(t).filter(([e])=>!n.has(e)&&!e.startsWith(`_`)).map(([e,t])=>[e,r.has(e)&&typeof t==`string`?xC(t):t]))}function aO({schema:e,mode:t,id:n,record:r,source:i,saved:a,onChanged:o,tab:s,onTab:c}){let l=X(),{locale:u}=Y(),d=Yi(),f=S(),p=r?._perm,m=t===`create`||e.permissions?.update!==!1&&p?.update!==!1,h=e.permissions?.delete!==!1&&p?.delete!==!1,[g,_]=(0,y.useState)(!1),v=LD(e,t===`edit`?r:void 0,g),x=t===`edit`&&e.form.mode===`view`&&!g,C=new Set(t===`edit`?m&&!x?[...e.form.readonly,...lO(r)]:[...e.form.update,...e.form.readonly]:[]),w=t===`create`?e.form.create:[...e.form.update,...e.form.readonly],T=e.fields.filter(e=>w.includes(e.name)),E=ID(e),D=T.filter(e=>!C.has(e.name)),O=D.map(e=>e.name),[k,A]=(0,y.useState)(r),[j,M]=(0,y.useState)(()=>{let t=wC(D,r??(i?iO(e,i):void 0));return tD(D,t,eD(D,t))}),[N,ee]=(0,y.useState)(j),P=(0,y.useRef)(eD(D,j));(0,y.useEffect)(()=>{if(!g||!r)return;let e=wC(D,r);P.current=eD(D,e),M(e),ee(e)},[g]);let F=oO(e),te=t=>Object.fromEntries(F.map(n=>[n.inline,HD(n,e.inlines[n.inline],t)])),[ne,re]=(0,y.useState)(()=>te(r)),[ie,ae]=(0,y.useState)(ne),[oe,se]=(0,y.useState)({}),ce=(0,y.useRef)(void 0),le=e.version?k?.[e.version]:void 0,[ue,de]=(0,y.useState)(null),fe=DC(D,N),[pe,me]=(0,y.useState)({}),[I,L]=(0,y.useState)(null),he=Wg(),ge=t===`edit`&&n!==void 0&&he.data?.audit.enabled===!0&&!e.source,_e=ge?s:`details`,ve=(0,y.useRef)(new Set(D.filter(e=>e.widget===`slug`&&j[e.name]!==``).map(e=>e.name)));function ye(e,t){nD(D,P.current,e,t),ee(n=>{let r={...n,[e]:t};if(typeof t==`string`)for(let n of D)n.slugFrom===e&&!ve.current.has(n.name)&&(r[n.name]=tO(t));return tD(D,r,P.current)}),D.some(t=>t.name===e&&t.widget===`slug`)&&ve.current.add(e)}let[be,xe]=(0,y.useState)(a?l(`form.savedName`,{name:a}):null),Se=DD(()=>L(null)),Ce=JSON.stringify(N)!==JSON.stringify(j)||JSON.stringify(ie)!==JSON.stringify(ne),{blocker:we,release:Te}=wD(Ce),Ee=(0,y.useRef)(null),De=(0,y.useRef)(`list`);ED(Ee,()=>{De.current=`stay`});let Oe=pt({mutationFn:({payload:r,version:i})=>t===`create`?Q.create(e.name,r):Q.update(e.name,n,r,i),onSuccess:async(r,{then:i})=>{f.invalidateQueries({queryKey:QD(e.name)}),await f.invalidateQueries({queryKey:[`list`,e.name]});let a=typeof r._title==`string`?r._title:`#${String(r._id)}`;if(i===`stay`&&t===`edit`){let t=wC(D,r);P.current=eD(D,t);let i=te(r);A(r),M(t),ee(t),re(i),ae(i),se({}),xe(l(`form.savedName`,{name:a})),await f.invalidateQueries({queryKey:[`record`,e.name,n]});return}Te(),f.removeQueries({queryKey:[`record`,e.name]}),i===`new`?d(`/${e.name}/new`,{state:{saved:a}}):i===`stay`?d(`/${e.name}/${encodeURIComponent(String(r._id))}`,{replace:!0,state:{saved:a}}):d(`/${e.name}`)},onError:e=>{if(c(`details`),!(e instanceof fg)){L(e.message);return}if(e.status===409&&e.body.current){de(e.body.current);return}let t=ZE(e,[...O,`_inlines`]),n=qD(t.fields,ce.current);me(n.parent),se(n.inlines),L(t.form)}}),[ke,Ae]=(0,y.useState)(!1),je=pt({mutationFn:()=>Q.remove(e.name,n,le),onSuccess:async()=>{Te(),await f.invalidateQueries({queryKey:[`list`,e.name]}),d(`/${e.name}`),f.removeQueries({queryKey:[`record`,e.name,n]})},onError:e=>{Ae(!1),L(pg(e))}}),Me=D.filter(e=>iD(e,N));function Ne(){let n=EC(Me,N,t===`edit`?j:void 0),r=KD(F,e.inlines??{},ne,ie,(e,t)=>e.min!==void 0&&t<e.min?l(`inline.countMin`,{min:e.min,count:t}):t>e.max?l(`inline.countMax`,{max:e.max,count:t}):null);return ce.current=r.changes,{payload:r.changes?{...n.payload,_inlines:r.changes}:n.payload,errors:n.errors,inlineErrors:r.errors}}function Pe(n){if(n.preventDefault(),!m)return;let r=n.nativeEvent.submitter,i=r?.value===`new`?`new`:r?`list`:De.current;if(De.current=`list`,xe(null),Se.busy){L(l(`upload.busy`)),Se.refuse();return}let{payload:a,errors:o,inlineErrors:s}=Ne(),u=t===`create`?`create`:`update`,d={...dD(a,Object.fromEntries(Object.entries(e.form.constraints[u]).filter(([e])=>Me.some(t=>t.name===e.split(`.`)[0]))),u),...o};me(d),se(s),L(null),Object.keys(d).length===0&&!JD(s)?Oe.mutate({payload:a,version:le,then:i}):c(`details`)}function Fe(t){de(null),Oe.mutate({payload:Ne().payload,version:e.version?t[e.version]:void 0,then:Oe.variables?.then??`list`})}function Ie(e){let t=wC(D,e);P.current=eD(D,t),de(null),A(e),M(t),ee(t),me({})}function Le(t){let i=e.inlines?.[t.inline];if(!i)return null;let a=r?._inlines?.[t.inline],o=a?.truncated&&n!==void 0?{total:a.total,href:`/${i.name}?${new URLSearchParams({[`filter[${t.link}]`]:String(r?.[e.primaryKeys[0]]??n)})}`}:void 0;return(0,b.jsx)(YD,{inline:t,child:i,rows:ie[t.inline]??[],onChange:e=>ae(n=>({...n,[t.inline]:e})),readOnly:!m||x||t.readonly===!0||o!==void 0,errors:oe[t.inline],parent:e.name,parentValues:fe,onBusy:Se.setBusy,truncated:o,canAdd:(r?._perm)?.inlines?.[t.inline]?.create!==!1})}function Re(t){let n=zD(t,e,r);return n.length===0?null:(0,b.jsx)(iE,{title:t.title,bodyClassName:t.title?void 0:`p-5`,children:(0,b.jsx)(`dl`,{className:`flex flex-col gap-2 text-[13px]`,children:n.map((e,t)=>(0,b.jsxs)(`div`,{className:W(`flex items-baseline justify-between gap-3`,t===n.length-1&&n.length>1&&`border-t pt-2.5 text-sm font-bold`),children:[(0,b.jsx)(`dt`,{className:W(t===n.length-1&&n.length>1?``:`text-muted-foreground`),children:e.label}),(0,b.jsx)(`dd`,{children:e.text})]},e.label))})})}let ze=BD(D,N);function Be(e){let t=Ve(e);return t&&ze[e]?(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[t,(0,b.jsxs)(`p`,{className:`flex items-center gap-1 text-xs text-warn`,children:[(0,b.jsx)(ix,{className:`size-3.5`,"aria-hidden":!0}),ze[e]]})]}):t}function Ve(n){let i=T.find(e=>e.name===n);if(!i||!iD(i,N))return null;if(C.has(n))return(0,b.jsx)(uO,{resource:e.name,field:i,record:r,plain:x});let a=t===`create`?`create`:`update`;return i.type===`object`?(0,b.jsx)(BE,{resource:e.name,field:i,path:i.name,pattern:i.name,value:N[i.name],constraints:e.form.constraints[a],markRequired:t===`create`,errors:pe,onChange:e=>ye(i.name,e)}):(0,b.jsx)(kE,{resource:e.name,field:i,value:N[i.name],required:t===`create`&&e.form.requiredOnCreate.includes(i.name),errors:pe[i.name],formValues:i.type===`relation`?fe:void 0,constraints:e.form.constraints[a][i.name],onChange:e=>ye(i.name,e),onBusy:e=>Se.setBusy(i.name,e)})}return(0,b.jsxs)(`form`,{ref:Ee,onSubmit:Pe,noValidate:!0,className:W(`flex flex-col gap-5`,v.aside.length>0?`max-w-[1400px]`:e.form.layout?.length?`max-w-4xl`:`max-w-2xl`),children:[t===`create`?(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsx)(dO,{to:`/${e.name}`}),(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:l(`form.new`,{name:e.label})})]}):(0,b.jsx)(fO,{schema:e,record:r,id:n,dirty:Ce,onGone:()=>{Te(),d(`/${e.name}`)},onChanged:o,badges:v.header.badges,subtitle:v.header.subtitle,extra:(0,b.jsxs)(b.Fragment,{children:[x&&m&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,onClick:()=>_(!0),children:[(0,b.jsx)(ob,{}),l(`form.edit`)]}),e.creatable&&(0,b.jsx)(q,{asChild:!0,variant:`outline`,children:(0,b.jsxs)(bo,{to:`/${e.name}/new?${new URLSearchParams({from:n})}`,children:[(0,b.jsx)(Iv,{}),l(`form.duplicate`)]})}),h&&(ke?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(q,{type:`button`,variant:`destructive`,disabled:je.isPending,onClick:()=>je.mutate(),children:l(je.isPending?`form.deleting`:e.softDelete?`form.confirmMoveToTrash`:`form.confirmDelete`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>Ae(!1),children:l(`form.keep`)})]}):(0,b.jsxs)(q,{type:`button`,variant:`outline`,className:`text-destructive`,onClick:()=>Ae(!0),children:[(0,b.jsx)(nx,{}),l(e.softDelete?`form.moveToTrash`:`form.delete`)]}))]})}),i&&F.length>0&&(0,b.jsx)(`p`,{role:`note`,className:`rounded-md border bg-muted/40 px-3 py-2 text-sm text-muted-foreground`,children:l(`inline.duplicateNote`,{names:new Intl.ListFormat(u).format(F.map(e=>e.label))})}),!m&&e.form.mode!==`view`&&(0,b.jsx)(`p`,{role:`note`,className:`rounded-md border bg-muted/40 px-3 py-2 text-sm text-muted-foreground`,children:l(`form.viewOnly`)}),be&&(0,b.jsx)(`p`,{role:`status`,className:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:be}),(0,b.jsx)(TD,{blocker:we}),ge&&(0,b.jsx)(cO,{active:_e,onChange:c}),ue&&(0,b.jsx)(pO,{fields:D,before:k,current:ue,busy:Oe.isPending,onKeepMine:()=>Fe(ue),onLoadTheirs:()=>Ie(ue)}),I&&(0,b.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:I}),ge&&_e===`history`&&(0,b.jsx)(`div`,{role:`tabpanel`,id:`record-panel-history`,"aria-labelledby":`record-tab-history`,children:(0,b.jsx)($D,{schema:e,id:n,record:r})}),(0,b.jsxs)(`div`,{className:_e===`details`?`contents`:`hidden`,...ge?{role:`tabpanel`,id:`record-panel-details`,"aria-labelledby":`record-tab-details`}:{},children:[t===`edit`&&r&&v.header.stepper&&(0,b.jsx)(sE,{field:v.header.stepper,value:r[v.header.stepper.name],reached:r._steps}),(0,b.jsxs)(`div`,{className:W(v.aside.length>0?`grid items-start gap-5 lg:grid-cols-[minmax(0,1fr)_340px]`:`contents`),children:[(0,b.jsxs)(`div`,{className:W(v.aside.length>0?`flex min-w-0 flex-col gap-5`:`contents`),children:[(0,b.jsx)(NE,{layout:e.form.layout,names:T.map(e=>e.name).filter(e=>!E.has(e)),errors:{...pe,...Object.fromEntries(Object.entries(oe).filter(([,e])=>JD({found:e})).map(([e])=>[`_inlines.${e}`,[``]]))},render:Be,renderInline:Le,renderSummary:Re}),!x&&(0,b.jsxs)(OD,{dirty:Ce,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>d(`/${e.name}`),children:l(m?`common.cancel`:`form.back`)}),m&&e.creatable&&(0,b.jsx)(q,{type:`submit`,value:`new`,variant:`outline`,disabled:Oe.isPending||Se.busy,children:l(`form.saveAndNew`)}),m&&(0,b.jsxs)(q,{type:`submit`,value:`list`,disabled:Oe.isPending||Se.busy,"aria-keyshortcuts":`Control+S Meta+S`,children:[l(Oe.isPending?`form.saving`:`form.save`),(0,b.jsx)(kD,{})]})]}),t===`edit`&&r&&e.related.length>0&&(0,b.jsxs)(`nav`,{"aria-label":l(`form.related`),className:`flex flex-col gap-2 border-t pt-4`,children:[(0,b.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground`,children:l(`form.related`)}),(0,b.jsx)(`ul`,{className:`flex flex-wrap gap-2`,children:e.related.map(t=>(0,b.jsx)(`li`,{children:(0,b.jsx)(q,{asChild:!0,variant:`outline`,size:`sm`,children:(0,b.jsx)(bo,{to:`/${t.resource}?${new URLSearchParams({[`filter[${t.field}][${t.operator}]`]:String(r[e.primaryKeys[0]])})}`,children:t.label})})},`${t.resource}:${t.field}`))})]})]}),v.aside.length>0&&(0,b.jsx)(`aside`,{className:`flex flex-col gap-5`,children:v.aside.map((t,n)=>(0,b.jsx)(aE,{card:t,values:RD(t,n,r),schema:e},n))})]})]})]})}function oO(e){return(e.form.layout??[]).flatMap(e=>`tab`in e?e.sections:[e]).filter(t=>`inline`in t&&e.inlines?.[t.inline]!==void 0)}var sO=[`details`,`history`];function cO({active:e,onChange:t}){let n=X(),r=(0,y.useRef)({});return(0,b.jsx)(`div`,{role:`tablist`,"aria-label":n(`audit.recordTabs`),className:`flex gap-0.5 overflow-x-auto border-b`,onKeyDown:n=>{if(n.key!==`ArrowLeft`&&n.key!==`ArrowRight`&&n.key!==`Home`&&n.key!==`End`)return;n.preventDefault();let i=n.key===`Home`?`details`:n.key===`End`||e===`details`?`history`:`details`;t(i),r.current[i]?.focus()},children:sO.map(i=>(0,b.jsx)(`button`,{ref:e=>{r.current[i]=e},id:`record-tab-${i}`,type:`button`,role:`tab`,"aria-selected":i===e,"aria-controls":i===`details`||e===`history`?`record-panel-${i}`:void 0,tabIndex:i===e?0:-1,onClick:()=>t(i),className:W(`-mb-px flex h-[38px] items-center border-b-2 px-3 text-[13px] whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,i===e?`border-foreground font-semibold`:`border-transparent text-muted-foreground hover:text-foreground`),children:n(i===`details`?`audit.details`:`audit.history`)},i))})}var lO=e=>Array.isArray(e?._readonly)?e._readonly:[];function uO({resource:e,field:t,record:n,plain:r=!1}){let i=X(),a=n?.[t.name];return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-readonly":t.name,children:[(0,b.jsxs)(`span`,{className:W(`flex items-center gap-1.5 font-medium`,r?`text-[12.5px] text-muted-foreground`:`text-sm`),children:[t.label,!r&&(0,b.jsx)(Ry,{className:`size-3.5 text-muted-foreground`,"aria-label":i(`form.readOnly`),role:`img`})]}),(0,b.jsx)(`div`,{className:W(`text-sm break-words`,!r&&`min-h-8 rounded-lg bg-muted/50 px-2.5 py-1.5`),children:t.widget===`richtext`&&typeof a==`string`&&a!==``?(0,b.jsx)(DE,{id:`field-${t.name}`,resource:e,field:t,value:a,readOnly:!0}):(0,b.jsx)(rE,{value:a,field:t,record:n,detailed:!0})}),t.help&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.help})]})}function dO({to:e}){let t=X();return(0,b.jsx)(q,{asChild:!0,variant:`outline`,size:`icon`,className:`shrink-0`,children:(0,b.jsx)(bo,{to:e,"aria-label":t(`form.back`),children:(0,b.jsx)(Ev,{className:`ltr:rotate-180`})})})}function fO({schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a,extra:o,badges:s,subtitle:c}){let l=X(),u=Array.isArray(t?._links)?t._links:[];return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,b.jsx)(dO,{to:`/${e.name}`}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:nO(e.label,t,n)}),s.map(e=>(0,b.jsx)(nE,{value:t[e.name],field:e},e.name))]}),c.length>0&&(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:c.join(` · `)}),u.length>0&&(0,b.jsx)(`ul`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-[13px]`,children:u.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-primary hover:underline`,"aria-label":l(`form.externalLink`,{name:e.label}),children:[e.label,(0,b.jsx)(Xv,{className:`size-3.5 rtl:-scale-x-100`,"aria-hidden":!0})]})},`${e.label}:${e.href}`))})]}),(0,b.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[t&&n!==void 0&&(0,b.jsx)(gD,{schema:e,ids:[n]}),t&&n!==void 0&&(0,b.jsx)(hD,{schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a}),o]})]})}function pO({fields:e,before:t,current:n,busy:r,onKeepMine:i,onLoadTheirs:a}){let o=X(),s=e.filter(e=>JSON.stringify(t?.[e.name]??null)!==JSON.stringify(n[e.name]??null));return(0,b.jsxs)(CD,{labelledBy:`conflict-title`,describedBy:`conflict-body`,initialFocus:`[data-autofocus]`,className:`flex flex-col gap-3 text-sm`,children:[(0,b.jsx)(`p`,{id:`conflict-title`,className:`font-medium`,children:o(`form.conflictTitle`)}),(0,b.jsx)(`div`,{id:`conflict-body`,children:s.length>0?(0,b.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1`,children:s.map(e=>(0,b.jsxs)(y.Fragment,{children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsxs)(`dd`,{children:[(0,b.jsx)(`span`,{className:`line-through opacity-60`,children:Nx(t?.[e.name],e)}),` → `,Nx(n[e.name],e)]})]},e.name))}):(0,b.jsx)(`p`,{children:o(`form.conflictNone`)})}),(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`button`,disabled:r,onClick:i,children:o(`form.keepMine`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,"data-autofocus":!0,onClick:a,children:o(`form.loadTheirs`)})]})]})}function mO(){let{t:e}=Y(),{group:t}=$i(),n=Gg();if(n.isPending)return(0,b.jsx)(G,{children:e(`common.loading`)});if(n.isError)return(0,b.jsx)(G,{tone:`error`,children:n.error.message});let r=Sw(n.data).find(e=>e.key===t);return r?(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:r.label}),(0,b.jsx)(gO,{group:r})]}):(0,b.jsx)(G,{children:e(`common.pageNotFound`)})}function hO({groups:e}){return(0,b.jsx)(`div`,{className:`flex flex-col gap-8`,children:e.map(e=>(0,b.jsxs)(`section`,{"aria-labelledby":`group-${e.key}`,className:`flex flex-col gap-3`,children:[(0,b.jsx)(`h2`,{id:`group-${e.key}`,className:`text-lg font-semibold`,children:(0,b.jsx)(bo,{to:`/g/${e.key}`,className:`hover:underline`,children:e.label})}),(0,b.jsx)(gO,{group:e})]},e.key))})}function gO({group:e}){return(0,b.jsxs)(b.Fragment,{children:[e.resources.length>0&&(0,b.jsx)(yO,{resources:e.resources}),e.pages.length>0&&(0,b.jsx)(vO,{pages:e.pages})]})}var _O=`flex items-center gap-3 rounded-card border bg-card shadow-card p-4 hover:bg-muted/50`;function vO({pages:e}){return(0,b.jsx)(`ul`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>{let t=Qw(e.icon,`page`);return(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{to:`/p/${e.name}`,className:_O,children:[(0,b.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-md bg-muted`,children:(0,b.jsx)(t,{className:`size-5 text-muted-foreground`,"aria-hidden":!0})}),(0,b.jsx)(`span`,{className:`truncate font-medium`,children:e.label})]})},e.name)})})}function yO({resources:e}){let{t,locale:n}=Y(),r=ut({queries:e.map(e=>({queryKey:[`count`,e.name],queryFn:()=>Q.list(e.name,new URLSearchParams({pageSize:`1`})),staleTime:6e4}))});return(0,b.jsx)(`ul`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.map((e,i)=>{let a=Qw(e.icon,`resource`),o=r[i]?.data,s=o&&o.total!==null?t(o.estimated?`shell.aboutRecords`:`shell.records`,{count:eg(o.total,n)}):void 0;return(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{to:`/${e.name}`,className:_O,children:[(0,b.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-md bg-muted`,children:(0,b.jsx)(a,{className:`size-5 text-muted-foreground`,"aria-hidden":!0})}),(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,b.jsx)(`span`,{className:`truncate font-medium`,children:e.label}),s&&(0,b.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:s})]})]})},e.name)})})}var bO=(e,t=2)=>String(e).padStart(t,`0`),xO=e=>`${bO(e.getFullYear(),4)}-${bO(e.getMonth()+1)}-${bO(e.getDate())}`,SO=e=>new Date(`${e}T00:00:00`).toISOString(),CO=(e,t)=>{let[n,r]=e.split(`-`).map(Number),i=n*12+(r-1)+t;return`${bO(Math.floor(i/12),4)}-${bO(i%12+1)}-01`};function wO(e,t,n,r,i){let a=xO(t),o=(t,n,r,i)=>({period:e,from:SO(t),to:SO(n),previousFrom:SO(r),previousTo:SO(i)}),s=(e,t)=>Math.round((Date.parse(`${t}T00:00:00Z`)-Date.parse(`${e}T00:00:00Z`))/864e5);switch(e){case`day`:return o(a,AS(a,1),AS(a,-1),a);case`week`:return o(AS(a,-6),AS(a,1),AS(a,-13),AS(a,-6));case`month`:{if(n===`persian`){let{jy:e,jm:t}=wS(a),n=TS(e,t,1);return o(n,kS(n,1),kS(n,-1),n)}let e=`${a.slice(0,7)}-01`;return o(e,CO(e,1),CO(e,-1),e)}case`year`:{if(n===`persian`){let{jy:e}=wS(a);return o(TS(e,1,1),TS(e+1,1,1),TS(e-1,1,1),TS(e,1,1))}let e=Number(a.slice(0,4));return o(`${bO(e,4)}-01-01`,`${bO(e+1,4)}-01-01`,`${bO(e-1,4)}-01-01`,`${bO(e,4)}-01-01`)}case`range`:{let e=r??a,t=AS(i??a,1);return o(e,t,AS(e,-s(e,t)),e)}}}function TO(e){if(e===void 0)return;let t=`${Math.abs(e)}%`;return e>0?{tone:`ok`,arrow:`up`,text:t}:e<0?{tone:`bad`,arrow:`down`,text:t}:{tone:`neutral`,arrow:null,text:t}}function EO(e,t,n){let r=Math.max(1,...e.series.flatMap(e=>e.values)),i=Math.max(1,e.labels.length),a=t/i,o=e=>n-e/r*n;return{max:r,gridlines:[.25,.5,.75,1].map(e=>({y:n-e*n,value:r*e})),series:e.series.map(e=>{let r=e.values.map((e,n)=>[i===1?t/2:n*t/(i-1),o(e)]);return{label:e.label,dashed:e.dashed===!0,path:r.map(([e,t],n)=>`${n===0?`M`:`L`}${DO(e)} ${DO(t)}`).join(` `),bars:e.values.map((e,t)=>{let r=a*.6;return{x:t*a+a/2-r/2,y:o(e),width:r,height:n-o(e)}})}})}}var DO=e=>Math.round(e*10)/10,OO=600,kO=200;function AO({title:e,data:t}){let n=X(),r=EO(t,OO,kO),i=Math.max(1,Math.ceil(t.labels.length/6));return(0,b.jsxs)(`div`,{className:`flex flex-col gap-3.5 p-5`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,b.jsx)(`h2`,{className:`text-[15px] font-semibold`,children:e}),t.subtitle&&(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t.subtitle})]}),(0,b.jsx)(`div`,{className:`ms-auto flex gap-4 text-xs text-muted-foreground`,children:t.series.map(e=>(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:e.dashed?`h-0 w-3.5 border-t-2 border-dashed border-muted-foreground`:`h-[3px] w-3.5 rounded-sm bg-primary`}),e.label]},e.label))})]}),(0,b.jsxs)(`svg`,{viewBox:`0 0 ${OO} ${kO}`,preserveAspectRatio:`none`,role:`img`,"aria-label":e,className:`h-[230px] w-full overflow-visible rtl:-scale-x-100`,children:[(0,b.jsx)(`g`,{className:`stroke-border`,children:r.gridlines.map(e=>(0,b.jsx)(`path`,{d:`M0 ${e.y}H${OO}`,vectorEffect:`non-scaling-stroke`},e.y))}),r.series.map((e,n)=>t.kind===`bar`&&!e.dashed?(0,b.jsx)(`g`,{className:`fill-primary`,children:e.bars.map((e,t)=>(0,b.jsx)(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:3},t))},e.label):(0,b.jsxs)(`g`,{children:[!e.dashed&&n===0&&(0,b.jsx)(`path`,{d:`${e.path} L${OO} ${kO} L0 ${kO} Z`,className:`fill-primary/10`}),(0,b.jsx)(`path`,{d:e.path,fill:`none`,vectorEffect:`non-scaling-stroke`,strokeWidth:e.dashed?2:2.5,strokeDasharray:e.dashed?`5 5`:void 0,className:e.dashed||n>0?`stroke-muted-foreground`:`stroke-primary`})]},e.label))]}),(0,b.jsx)(`div`,{"aria-hidden":!0,className:`flex justify-between text-[11.5px] text-muted-foreground`,children:t.labels.filter((e,t)=>t%i===0).map(e=>(0,b.jsx)(`span`,{children:e},e))}),(0,b.jsxs)(`span`,{className:`sr-only`,children:[t.series.map(e=>`${e.label}: ${e.values.map(e=>eg(e)).join(`, `)}`).join(`; `),` `,n(`dashboard.period`)]})]})}var jO={ok:`bg-ok`,warn:`bg-warn`,bad:`bg-bad`,info:`bg-info`,neutral:`bg-muted-foreground`,primary:`bg-primary`};function MO({title:e,data:t}){return(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 p-5`,children:[(0,b.jsx)(`h2`,{className:`text-[15px] font-semibold`,children:e}),(0,b.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:t.items.map((e,t)=>{let n=Qw(e.icon,`resource`),r=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-control bg-muted text-muted-foreground`,children:(0,b.jsx)(n,{className:`size-4`,"aria-hidden":!0})}),(0,b.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px]`,children:e.text}),e.status&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:W(`size-2 shrink-0 rounded-full`,jO[e.status])})]});return(0,b.jsx)(`li`,{children:e.link?(0,b.jsx)(bo,{to:e.link,className:`flex items-center gap-3 rounded-control hover:bg-muted`,children:r}):(0,b.jsx)(`div`,{className:`flex items-center gap-3`,children:r})},t)})})]})}function NO({items:e,value:t,onChange:n,className:r}){return(0,b.jsx)(`div`,{role:`tablist`,className:W(`flex w-full gap-0.5 border-b border-border`,r),children:e.map(e=>{let r=e.key===t;return(0,b.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n(e.key),className:W(`-mb-px inline-flex h-[38px] cursor-pointer items-center gap-1.5 border-b-2 border-transparent px-3 text-[13px] text-muted-foreground`,r&&`border-foreground font-semibold text-foreground`),children:[e.label,e.count!==void 0&&(0,b.jsxs)(`span`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-muted px-1.5 text-[11px] text-muted-foreground`,children:[e.estimate?`~`:``,e.count]})]},e.key)})})}function PO({period:e,from:t,to:n,onChange:r}){let i=X(),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(t??``),[l,u]=(0,y.useState)(n??``);return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(NO,{className:`w-auto`,items:[`day`,`week`,`month`,`year`].map(e=>({key:e,label:i(`dashboard.${e}`)})),value:e===`range`?``:e,onChange:e=>r(e)}),(0,b.jsxs)(Sh,{open:a,onOpenChange:o,children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsx)(q,{variant:e===`range`?`secondary`:`outline`,size:`icon`,"aria-label":i(`dashboard.range`),"aria-pressed":e===`range`,children:(0,b.jsx)(mv,{})})}),(0,b.jsx)(wh,{children:(0,b.jsxs)(Th,{align:`end`,sideOffset:6,className:`z-50 flex w-72 flex-col gap-3 rounded-[10px] border bg-popover p-3 shadow-lg`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,b.jsx)(kh,{htmlFor:`dashboard-from`,children:i(`filters.from`)}),(0,b.jsx)(RS,{id:`dashboard-from`,label:i(`filters.from`),value:s,onChange:c,live:!0})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,b.jsx)(kh,{htmlFor:`dashboard-to`,children:i(`filters.to`)}),(0,b.jsx)(RS,{id:`dashboard-to`,label:i(`filters.to`),value:l,onChange:u,live:!0})]}),(0,b.jsx)(q,{disabled:!/^\d{4}-\d{2}-\d{2}$/.test(s)||!/^\d{4}-\d{2}-\d{2}$/.test(l)||s>l,onClick:()=>{o(!1),r(`range`,s,l)},children:i(`dashboard.apply`)})]})})]})]})}var FO=42,IO=2*Math.PI*FO;function LO({title:e,data:t}){let n=Math.max(0,Math.min(100,t.percent));return(0,b.jsxs)(`div`,{className:`flex items-center gap-5 p-5`,children:[(0,b.jsxs)(`svg`,{viewBox:`0 0 100 100`,role:`img`,"aria-label":tg(t.value),className:`size-[104px] shrink-0 -rotate-90`,children:[(0,b.jsx)(`circle`,{cx:`50`,cy:`50`,r:FO,fill:`none`,strokeWidth:10,className:`stroke-muted`}),(0,b.jsx)(`circle`,{cx:`50`,cy:`50`,r:FO,fill:`none`,strokeWidth:10,strokeLinecap:`round`,strokeDasharray:`${n/100*IO} ${IO}`,className:`stroke-primary`})]}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,b.jsx)(`div`,{className:`text-2xl leading-tight font-bold`,children:tg(t.value)}),(0,b.jsx)(`h2`,{className:`text-sm font-semibold`,children:e}),(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t.caption})]})]})}function RO({title:e,data:t}){let n=TO(t.change);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 px-5 py-[18px]`,children:[(0,b.jsx)(`div`,{className:`text-[13px] font-medium text-muted-foreground`,children:e}),(0,b.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,b.jsx)(`span`,{className:`text-[26px] leading-[1.3] font-bold`,children:tg(t.value)}),t.unit&&(0,b.jsx)(`span`,{className:`text-[13px] text-muted-foreground`,children:t.unit})]}),(n||t.previousLabel)&&(0,b.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[n&&(0,b.jsxs)(`span`,{className:W(`inline-flex items-center gap-0.5 rounded-full px-1.5 py-0.5 font-medium`,n.tone===`ok`?`bg-ok-bg text-ok`:n.tone===`bad`?`bg-bad-bg text-bad`:`bg-muted text-muted-foreground`),children:[n.arrow===`up`&&(0,b.jsx)(X_,{className:`size-3`,"aria-hidden":!0}),n.arrow===`down`&&(0,b.jsx)(K_,{className:`size-3`,"aria-hidden":!0}),tg(n.text)]}),t.previousLabel&&(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:t.previousLabel})]})]})}function zO({title:e,data:t}){let n=X(),r=t.link?`/${t.link.resource}${t.link.filter?`?${new URLSearchParams(t.link.filter)}`:``}`:void 0;return(0,b.jsxs)(`div`,{className:`flex flex-col`,children:[(0,b.jsxs)(`div`,{className:`flex min-h-14 items-center gap-2 border-b px-5 py-3`,children:[(0,b.jsx)(`h2`,{className:`flex-1 text-[15px] font-semibold`,children:e}),r&&(0,b.jsxs)(bo,{to:r,className:`inline-flex items-center gap-1 text-[13px] font-medium text-primary hover:underline`,children:[n(`dashboard.viewAll`),(0,b.jsx)(wv,{className:`size-3.5 ltr:rotate-180`,"aria-hidden":!0})]})]}),(0,b.jsx)(`div`,{className:`overflow-x-auto`,children:(0,b.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,b.jsx)(`thead`,{className:`bg-[color-mix(in_oklab,var(--muted)_50%,transparent)] text-[12.5px] text-muted-foreground`,children:(0,b.jsx)(`tr`,{children:t.columns.map(e=>(0,b.jsx)(`th`,{className:`px-3.5 py-2.5 text-start font-medium whitespace-nowrap`,children:e.label},e.key))})}),(0,b.jsx)(`tbody`,{children:t.rows.map((e,n)=>(0,b.jsx)(`tr`,{className:`border-t`,children:t.columns.map(t=>{let n=e[t.key];return(0,b.jsx)(`td`,{className:`px-3.5 py-2.5 whitespace-nowrap`,children:typeof n==`object`&&n?(0,b.jsx)($T,{tone:n.tone,children:n.label}):typeof n==`number`?eg(n):tg(String(n??``))},t.key)})},n))})]})})]})}var BO=[`day`,`week`,`month`,`year`,`range`],VO={1:`lg:col-span-4`,2:`lg:col-span-6`,3:`lg:col-span-8`,4:`lg:col-span-12`};function HO(){let{t:e,calendar:t}=Y(),[n,r]=wo(),i=n.get(`period`),a=i&&BO.includes(i)?i:`week`,o=n.get(`from`)??void 0,s=n.get(`to`)??void 0,c=wO(a,new Date,t===`persian`?`persian`:`gregory`,o,s),l=ft({queryKey:[`dashboard`],queryFn:Q.dashboard});return(0,b.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:e(`dashboard.title`)}),(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:e(`dashboard.subtitle`)})]}),(0,b.jsx)(`div`,{className:`ms-auto`,children:(0,b.jsx)(PO,{period:a,from:o,to:s,onChange:(e,t,n)=>r(e===`range`?{period:e,from:t,to:n}:e===`week`?{}:{period:e})})})]}),l.isPending&&(0,b.jsx)(G,{children:e(`common.loading`)}),l.isError&&(0,b.jsx)(G,{tone:`error`,children:pg(l.error)}),l.data&&(0,b.jsx)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-12`,children:l.data.widgets.map(e=>(0,b.jsx)(UO,{widget:e,params:c},e.name))})]})}function UO({widget:e,params:t}){let{t:n}=Y(),r=ft({queryKey:[`dashboard`,e.name,t],queryFn:()=>Q.widget(e.name,t),retry:!1}),i=e.type===`stat`?`lg:col-span-3`:VO[e.size];return(0,b.jsxs)(`section`,{"aria-label":e.title,"data-widget":e.name,className:W(`min-w-0 overflow-hidden rounded-card border bg-card shadow-card`,i),children:[r.isPending&&(0,b.jsxs)(`div`,{"aria-hidden":!0,className:`flex flex-col gap-3 p-5`,children:[(0,b.jsx)(`div`,{className:`h-4 w-1/3 animate-pulse rounded bg-muted`}),(0,b.jsx)(`div`,{className:`h-8 w-2/3 animate-pulse rounded bg-muted`})]}),r.isError&&(0,b.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 p-5 text-[13px]`,children:[(0,b.jsx)(`span`,{className:`font-semibold`,children:e.title}),(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:n(`dashboard.failed`)}),(0,b.jsx)(q,{size:`sm`,variant:`outline`,onClick:()=>void r.refetch(),children:n(`dashboard.retry`)})]}),r.data&&(0,b.jsx)(WO,{type:e.type,title:e.title,data:r.data})]})}function WO({type:e,title:t,data:n}){switch(e){case`stat`:return(0,b.jsx)(RO,{title:t,data:n});case`chart`:return(0,b.jsx)(AO,{title:t,data:n});case`table`:return(0,b.jsx)(zO,{title:t,data:n});case`progress`:return(0,b.jsx)(LO,{title:t,data:n});case`list`:return(0,b.jsx)(MO,{title:t,data:n})}}function GO(){let e=X(),t=Gg();if(t.isPending)return(0,b.jsx)(G,{children:e(`common.loading`)});if(t.isError)return(0,b.jsx)(G,{tone:`error`,children:t.error.message});if(t.data.dashboard)return(0,b.jsx)(HO,{});let n=Sw(t.data);return n.length===0?(0,b.jsx)(G,{children:e(`shell.noResources`)}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:t.data.title}),(0,b.jsx)(hO,{groups:n})]})}var KO={order:[],hidden:[],widths:{},density:`comfortable`},qO=e=>`nma.columns.${e}`;function JO(e,t){return YO(e,t).filter(e=>!t.hidden.includes(e))}function YO(e,t){let n=t.order.filter(t=>e.includes(t));return[...n,...e.filter(e=>!n.includes(e))]}function XO(e){let t=new Map,n=new Set,r=n=>{let r=t.get(n);if(!r){r=KO;try{let t=e?.getItem(qO(n));t&&(r={...KO,...JSON.parse(t)})}catch{r=KO}t.set(n,r)}return r},i=(r,i)=>{t.set(r,i);try{e?.setItem(qO(r),JSON.stringify(i))}catch{}for(let e of n)e()};return{get:r,subscribe(e){return n.add(e),()=>n.delete(e)},toggle(e,t){let n=r(e),a=n.hidden.includes(t)?n.hidden.filter(e=>e!==t):[...n.hidden,t];i(e,{...n,hidden:a})},move(e,t,n,a){let o=r(e),s=YO(t,o),c=s.indexOf(n),l=c+a;c<0||l<0||l>=s.length||([s[c],s[l]]=[s[l],s[c]],i(e,{...o,order:s}))},setWidth(e,t,n){let a=r(e),o=Math.round(Math.min(600,Math.max(60,n)));i(e,{...a,widths:{...a.widths,[t]:o}})},setDensity(e,t){i(e,{...r(e),density:t})},reset(r){try{e?.removeItem(qO(r))}catch{}t.set(r,KO);for(let e of n)e()}}}function ZO(){try{return typeof localStorage>`u`?void 0:localStorage}catch{return}}var QO=XO(ZO());function $O(e){return(0,y.useSyncExternalStore)(QO.subscribe,()=>QO.get(e))}function ek({schema:e,prefs:t}){let n=X(),r=YO(e.list.columns,t),i=t=>e.list.computed?.[t]?.label??e.fields.find(e=>e.name===t)?.label??t,a=r.filter(e=>!t.hidden.includes(e));return(0,b.jsxs)(Sh,{children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsxs)(q,{variant:`outline`,size:`sm`,className:`hidden md:inline-flex`,children:[(0,b.jsx)(Pv,{}),n(`list.columns`),(0,b.jsx)(Sv,{className:`text-muted-foreground`})]})}),(0,b.jsx)(wh,{children:(0,b.jsxs)(Th,{align:`end`,sideOffset:4,className:`z-50 flex w-72 flex-col gap-3 rounded-[10px] border bg-popover p-3 text-popover-foreground shadow-lg`,children:[(0,b.jsx)(`ul`,{"aria-label":n(`list.columns`),className:`flex flex-col gap-0.5`,children:r.map((o,s)=>{let c=!t.hidden.includes(o);return(0,b.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md px-1 py-0.5 hover:bg-accent`,children:[(0,b.jsxs)(`label`,{className:`flex flex-1 cursor-pointer items-center gap-2 text-sm`,children:[(0,b.jsx)(ff,{checked:c,disabled:c&&a.length===1,onCheckedChange:()=>QO.toggle(e.name,o),className:`flex size-4 items-center justify-center rounded border border-input disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,children:(0,b.jsx)(mf,{children:(0,b.jsx)(bv,{className:`size-3`})})}),i(o)]}),(0,b.jsx)(q,{variant:`ghost`,size:`icon-sm`,"aria-label":n(`list.moveUp`,{name:i(o)}),disabled:s===0,onClick:()=>QO.move(e.name,e.list.columns,o,-1),children:(0,b.jsx)(X_,{})}),(0,b.jsx)(q,{variant:`ghost`,size:`icon-sm`,"aria-label":n(`list.moveDown`,{name:i(o)}),disabled:s===r.length-1,onClick:()=>QO.move(e.name,e.list.columns,o,1),children:(0,b.jsx)(K_,{})})]},o)})}),(0,b.jsx)(`div`,{role:`radiogroup`,"aria-label":n(`list.density`),className:`flex gap-1`,children:[`comfortable`,`compact`].map(r=>(0,b.jsx)(q,{role:`radio`,"aria-checked":t.density===r,variant:t.density===r?`secondary`:`ghost`,size:`sm`,onClick:()=>QO.setDensity(e.name,r),children:n(r===`compact`?`list.compact`:`list.comfortable`)},r))}),(0,b.jsx)(q,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>QO.reset(e.name),children:n(`list.resetColumns`)})]})})]})}function tk({resource:e,column:t,label:n,width:r}){let i=X(),a=(0,y.useRef)(null);return(0,b.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":i(`list.resize`,{name:n}),"aria-valuenow":r,tabIndex:0,className:W(`absolute inset-y-1 end-0 w-1.5 cursor-col-resize touch-none rounded bg-transparent hover:bg-border focus-visible:bg-ring`),onPointerDown:e=>{let t=e.currentTarget.parentElement;a.current={x:e.clientX,width:t.getBoundingClientRect().width,rtl:getComputedStyle(t).direction===`rtl`},e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:n=>{if(!a.current)return;let r=(n.clientX-a.current.x)*(a.current.rtl?-1:1);QO.setWidth(e,t,a.current.width+r)},onPointerUp:()=>a.current=null,onKeyDown:n=>{if(n.key!==`ArrowLeft`&&n.key!==`ArrowRight`)return;n.preventDefault();let i=r??n.currentTarget.parentElement.getBoundingClientRect().width,a=getComputedStyle(n.currentTarget).direction===`rtl`,o=n.key===`ArrowRight`!==a;QO.setWidth(e,t,i+(o?10:-10))},onClick:e=>e.stopPropagation()})}var nk=`h-7 w-full min-w-20 rounded-md border border-input bg-background px-2 text-sm outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 aria-invalid:border-destructive`;function rk({schema:e,item:t,field:n}){let r=X(),i=S(),[a,o]=(0,y.useState)(!1),s=wC([n],t)[n.name],[c,l]=(0,y.useState)(s),[u,d]=(0,y.useState)(null),f=pt({mutationFn:n=>Q.update(e.name,String(t._id),n,e.version?t[e.version]:void 0),onSuccess:n=>{i.setQueriesData({queryKey:[`list`,e.name]},e=>e&&{...e,items:e.items.map(e=>e._id===n._id?{...e,...n}:e)}),i.removeQueries({queryKey:[`record`,e.name,String(t._id)]}),o(!1),d(null)},onError:e=>{d(e instanceof fg?e.fields[n.name]?.join(` `)??e.message:e.message),l(s),o(!1)}});function p(t=c){if(t===s){o(!1);return}let{payload:r,errors:i}=EC([n],{[n.name]:t},{[n.name]:s}),a=dD(r,{[n.name]:e.form.constraints.update[n.name]??{}},`update`),l=i[n.name]??a[n.name];if(l){d(l.join(` `));return}f.mutate(r)}let m=e=>{e.key===`Enter`?(e.preventDefault(),p()):e.key===`Escape`&&(e.preventDefault(),l(s),d(null),o(!1))},h=`cell-${e.name}-${String(t._id)}-${n.name}-error`,g={"aria-label":n.label,"aria-invalid":u?!0:void 0,"aria-describedby":u?h:void 0,autoFocus:!0,disabled:f.isPending,className:nk,onKeyDown:m},_;if(!a)_=(0,b.jsx)(`button`,{type:`button`,className:W(`-mx-1 rounded px-1 text-start hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none`,u&&`text-destructive`),"aria-label":r(`list.editCell`,{name:n.label,value:Nx(t[n.name],n)}),onClick:()=>{l(s),o(!0)},children:(0,b.jsx)(rE,{value:t[n.name],field:n})});else if(n.type===`enum`||n.type===`boolean`){let e=n.type===`boolean`?[[`true`,r(`common.yes`)],[`false`,r(`common.no`)]]:(n.enumValues??[]).map(e=>[e,MC(n,e)]);_=(0,b.jsxs)(`select`,{...g,value:String(c),onChange:e=>{let t=n.type===`boolean`?e.target.value===`true`:e.target.value;l(t),p(t)},onBlur:()=>o(!1),children:[n.nullable&&n.type===`enum`&&(0,b.jsx)(`option`,{value:``,children:r(`common.empty`)}),e.map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))]})}else if(n.type===`date`)_=(0,b.jsx)(RS,{id:`cell-${e.name}-${String(t._id)}-${n.name}`,label:n.label,value:String(c),onChange:e=>{l(e),p(e)},autoFocus:!0,"aria-invalid":u?!0:void 0,"aria-describedby":u?h:void 0,className:`min-w-44`,onKeyDown:m});else{let e=n.type===`number`||n.type===`decimal`||n.type===`bigint`;_=(0,b.jsx)(`input`,{...g,type:`text`,inputMode:e?n.type===`bigint`?`numeric`:`decimal`:void 0,value:String(c),onChange:e=>l(e.target.value),onBlur:()=>p()})}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-0.5`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[_,u&&(0,b.jsx)(`p`,{id:h,role:`alert`,className:`text-xs text-destructive`,children:u})]})}var ik=e=>e.total===null?e.hasMore===!0:e.page*e.pageSize<e.total;function ak({schema:e,query:t,columns:n,trash:r,selectMode:i,selected:a,onSelect:o,restore:s,empty:c}){let l=X(),u=e.list.pagination===`keyset`,d=mt({queryKey:[`list`,e.name,`cards`,t],initialPageParam:void 0,queryFn:({pageParam:n})=>{let r=new URLSearchParams(t);return n&&r.set(u?`after`:`page`,n),Q.list(e.name,r)},getNextPageParam:e=>u?e.nextCursor??void 0:ik(e)?String(e.page+1):void 0}),f=new Set,p=(d.data?.pages??[]).flatMap(e=>e.items).filter(e=>{let t=String(e._id);return!f.has(t)&&(f.add(t),!0)}),m=d.data?.pages[0]?.total??null,h=(0,y.useRef)(null),{hasNextPage:g,isFetchingNextPage:_,fetchNextPage:v}=d;(0,y.useEffect)(()=>{let e=h.current;if(!e||!g||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&!_&&v()},{rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},[g,_,v]);let x=e=>{let t=new Set(a);t.has(e)?t.delete(e):t.add(e),o(t)};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsxs)(`ul`,{"aria-label":e.label,"aria-busy":d.isFetching,className:`flex flex-col gap-2.5`,children:[d.isPending&&Array.from({length:4},(e,t)=>(0,b.jsx)(`li`,{"aria-hidden":!0,className:`h-20 animate-pulse rounded-card border bg-muted/40`},`skeleton-${t}`)),p.map(t=>{let o=String(t._id),c=(0,b.jsx)(ok,{schema:e,item:t,columns:n});return(0,b.jsx)(`li`,{children:r?(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-2 rounded-card border bg-card p-3 shadow-card`,children:[c,s(t)]}):i?(0,b.jsxs)(`label`,{className:W(`flex cursor-pointer items-start gap-3 rounded-card border bg-card p-3 shadow-card`,a.has(o)&&`border-primary bg-primary-soft`),children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 accent-primary`,checked:a.has(o),onChange:()=>x(o),"aria-label":l(`list.selectRow`,{name:String(t._title??o)})}),c]}):(0,b.jsx)(bo,{to:`/${e.name}/${encodeURIComponent(o)}`,className:`block rounded-card border bg-card p-3 shadow-card active:bg-muted`,children:c})},o)}),d.isSuccess&&p.length===0&&(0,b.jsx)(`li`,{className:`flex flex-col items-center gap-2 py-6 text-center text-sm text-muted-foreground`,children:c})]}),d.isError&&(0,b.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[(0,b.jsx)(`span`,{children:l(`list.loadFailed`)}),(0,b.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void d.refetch(),children:l(`list.retry`)})]}),(0,b.jsxs)(`div`,{ref:h,className:`flex flex-col items-center gap-2 py-2 text-sm text-muted-foreground`,children:[p.length>0&&(0,b.jsx)(`span`,{children:m===null?l(`list.showing`,{shown:eg(p.length)}):l(`list.showingOf`,{shown:eg(p.length),total:eg(m)})}),g&&(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:_,onClick:()=>void v(),children:l(_?`common.loading`:`list.loadMore`)})]})]})}function ok({schema:e,item:t,columns:n}){let r=Object.entries(e.list.computed??{}).filter(([t])=>e.list.columns.includes(t));if(r.length>0)return(0,b.jsx)(sk,{schema:e,item:t,computed:r});let i=e.list.mobile,a=typeof t._title==`string`?t._title:String(t._id);if(!i)return(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`div`,{className:`text-[14.5px] font-semibold`,children:a}),(0,b.jsx)(`dl`,{className:`mt-1 grid grid-cols-2 gap-x-3 gap-y-0.5 text-sm`,children:n.filter(e=>Nx(t[e.name],e)!==t._title).map(e=>(0,b.jsxs)(y.Fragment,{children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{className:`truncate`,children:(0,b.jsx)(rE,{value:t[e.name],field:e,record:t,plain:!0})})]},e.name))})]});let o=t=>t?e.fields.find(e=>e.name===t):void 0,s=o(i.title),c=o(i.subtitle),l=o(i.badge),u=i.meta.map(o).filter(e=>e!==void 0);return(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,b.jsx)(`span`,{className:`min-w-0 truncate text-[14.5px] font-semibold`,children:s?Nx(t[s.name],s):a}),l&&t[l.name]!==null&&t[l.name]!==void 0&&(0,b.jsx)(nE,{value:t[l.name],field:l,className:`shrink-0`})]}),c&&(0,b.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:Nx(t[c.name],c)}),u.length>0&&(0,b.jsx)(`dl`,{className:`mt-1 flex flex-wrap gap-x-4 gap-y-0.5 text-sm`,children:u.map(e=>(0,b.jsxs)(`div`,{className:`flex gap-1`,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(rE,{value:t[e.name],field:e,record:t,plain:!0})})]},e.name))})]})}function sk({schema:e,item:t,computed:n}){let r=e=>n.filter(([,t])=>t.kind===e),i=([n,r],i=!0)=>(0,b.jsx)(ND,{schema:e,name:n,column:r,item:t,compact:i},n),[a]=r(`image`),[o]=r(`title`);return(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-3`,children:[a&&i(a),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,b.jsx)(`div`,{className:`min-w-0 flex-1`,children:o?i(o):(0,b.jsx)(`span`,{className:`text-[14.5px] font-semibold`,children:typeof t._title==`string`?t._title:String(t._id)})}),r(`toggle`).map(e=>i(e))]}),r(`money`).map(e=>i(e)),(r(`badge`).length>0||r(`count`).length>0)&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[r(`badge`).map(e=>i(e)),r(`count`).map(([e,n])=>(0,b.jsxs)($T,{tone:`neutral`,children:[MD(n,t._computed?.[e]).text,` `,n.label]},e))]})]})]})}function ck({schema:e,item:t,onClose:n}){let r=X(),i=(0,y.useRef)(null);t&&!i.current&&(i.current=document.activeElement);let a=t?String(t._id):void 0,o=Xg(e.name,a).data??t,s=typeof o?._title==`string`?o._title:`#${a}`,c=e.fields.filter(e=>e.persisted&&!e.name.includes(`.`)&&o!==void 0&&Object.hasOwn(o,e.name));return(0,b.jsx)(jd,{open:t!==void 0,onOpenChange:e=>!e&&n(),children:(0,b.jsxs)(Ld,{children:[(0,b.jsx)(zd,{className:HS}),(0,b.jsxs)(Ud,{className:`fixed inset-y-0 end-0 z-50 flex w-full max-w-md flex-col border-s bg-background shadow-xl outline-none`,"aria-describedby":void 0,onCloseAutoFocus:e=>{e.preventDefault(),i.current?.focus(),i.current=null},children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 border-b p-4`,children:[(0,b.jsx)(Jd,{className:`min-w-0 flex-1 truncate text-lg font-semibold`,children:r(`list.quickView`,{name:s})}),(0,b.jsx)(Xd,{asChild:!0,children:(0,b.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":r(`list.close`),children:(0,b.jsx)(Sx,{})})})]}),(0,b.jsx)(`dl`,{className:`grid flex-1 grid-cols-[minmax(6rem,auto)_1fr] content-start gap-x-4 gap-y-2 overflow-y-auto p-4 text-sm`,children:c.map(e=>(0,b.jsxs)(`div`,{className:`contents`,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{className:`break-words`,children:(0,b.jsx)(rE,{value:o[e.name],field:e,record:o,detailed:!0})})]},e.name))}),(0,b.jsxs)(`div`,{className:`flex gap-2 border-t p-4`,children:[(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/${e.name}/${encodeURIComponent(a??``)}`,children:[(0,b.jsx)(ob,{}),r(`list.edit`)]})}),(0,b.jsx)(Xd,{asChild:!0,children:(0,b.jsx)(q,{variant:`outline`,children:r(`list.close`)})})]})]})]})})}function lk({className:e,...t}){return(0,b.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full`,children:(0,b.jsx)(`table`,{"data-slot":`table`,className:W(`w-full caption-bottom text-[13px]`,e),...t})})}function uk({className:e,...t}){return(0,b.jsx)(`thead`,{"data-slot":`table-header`,className:W(`[&_tr]:border-b`,e),...t})}function dk({className:e,...t}){return(0,b.jsx)(`tbody`,{"data-slot":`table-body`,className:W(`[&_tr:last-child]:border-0`,e),...t})}function fk({className:e,...t}){return(0,b.jsx)(`tr`,{"data-slot":`table-row`,className:W(`border-b border-border transition-colors hover:bg-[color-mix(in_oklab,var(--muted)_60%,transparent)] has-aria-expanded:bg-muted/50 data-[state=selected]:bg-primary-soft`,e),...t})}function pk({className:e,...t}){return(0,b.jsx)(`th`,{"data-slot":`table-head`,className:W(`px-3.5 py-2.5 text-start align-middle text-[12.5px] font-medium whitespace-nowrap text-muted-foreground bg-[color-mix(in_oklab,var(--muted)_50%,transparent)] [&:has([role=checkbox])]:pe-0`,e),...t})}function mk({className:e,...t}){return(0,b.jsx)(`td`,{"data-slot":`table-cell`,className:W(`px-3.5 py-2.5 align-middle whitespace-nowrap [&:has([role=checkbox])]:pe-0`,e),...t})}function hk(e){let t=e.map(e=>String(e).replace(/~/g,`~0`).replace(/,/g,`~1`)).join(`,`);return t===`new`?`~new`:t}function gk(){let{resource:e=``}=$i(),[t,n]=wo(),r=Math.max(1,Number(t.get(`page`))||1),i=t.get(`sort`)??void 0,a=Kg(e),o=AC(),s=Yg(e,JS(t),!o),[c,l]=(0,y.useState)(!1),u=S(),d=X(),f=pt({mutationFn:t=>Q.restore(e,t),onSuccess:()=>u.invalidateQueries({queryKey:[`list`,e]})}),p=t.get(`trashed`)===`only`,m=$O(e),h=JS(t),g=(()=>{let e=new URLSearchParams(h);return e.delete(`page`),e.delete(`after`),e.toString()})(),[_,v]=(0,y.useState)(new Set);(0,y.useEffect)(()=>v(new Set),[h,e]);let[x,C]=(0,y.useState)(),[w,T]=(0,y.useState)(!1),[E,D]=(0,y.useState)();(0,y.useEffect)(()=>D(void 0),[e]);let O=pt({mutationFn:t=>Q.bulkDelete(e,t),onSuccess:async t=>{v(new Set),T(!1),D({title:d(`list.bulkDeleted`,{count:t.ok.length}),result:t}),await u.invalidateQueries({queryKey:[`list`,e]})},onError:()=>T(!1)}),[k,A]=(0,y.useState)([]),j=t.has(`after`);if((0,y.useEffect)(()=>{j||A([])},[j]),a.isPending)return(0,b.jsx)(G,{children:d(`common.loading`)});if(a.isError)return(0,b.jsx)(G,{tone:`error`,children:a.error.message});let M=a.data,N=JO(M.list.columns,m).flatMap(e=>{let t=M.list.computed?.[e];if(t)return[{name:e,label:t.label,computed:t}];let n=M.fields.find(t=>t.name===e);return n?[{name:e,label:n.label,field:n}]:[]}),ee=N.flatMap(e=>e.field&&!M.primaryKeys.includes(e.name)?[e.field]:[]);for(let e=N.length-2;e>=0;e--)N[e].computed?.kind===`image`&&N[e+1].computed?.kind===`title`&&(N[e+1]={...N[e+1],image:N[e]},N.splice(e,1));let P=N.findIndex(e=>e.computed?.kind!==`image`&&e.computed?.kind!==`toggle`),F=i?{field:i.replace(/^-/,``),direction:i.startsWith(`-`)?`desc`:`asc`}:M.list.defaultSort,te=s.data?.items??[],ne=M.list.pagination===`keyset`,re=t.get(`after`),ie=ne?{summary:$S(s.data,1).summary,label:d(`list.page`,{page:k.length+1}),hasNext:!!s.data?.nextCursor}:$S(s.data,r),ae=ne?k.length>0:r>1;function oe(){if(!ne)return fe({page:String(r+1)});A([...k,re??``]),fe({after:s.data?.nextCursor??null})}function se(){if(!ne)return fe({page:String(r-1)});let e=k[k.length-1];A(k.slice(0,-1)),fe({after:e||null})}let ce=M.permissions??{create:!0,update:!0,delete:!0,purge:!0},le=!p&&(ce.delete||WE(M,[]).length>0||(M.prints??[]).some(e=>e.bulk)),ue=WE(M,te.filter(e=>_.has(String(e._id)))),de=e=>`/${M.name}/${encodeURIComponent(String(e._id))}`;function fe(e){n(t=>QS(t,e))}function pe(e){fe({sort:F.field===e&&F.direction===`asc`?`-${e}`:e})}let me=`border-transparent bg-transparent text-inherit hover:bg-background/15`,I=le&&_.size>0&&(0,b.jsxs)(`div`,{role:`region`,"aria-label":d(`list.selected`,{count:_.size}),className:W(`flex flex-wrap items-center gap-2 text-sm`,o?`fixed inset-x-3 bottom-4 z-30 rounded-[14px] bg-foreground py-1.5 ps-2 pe-1.5 text-background shadow-[0_12px_32px_rgba(0,0,0,.25)]`:`border-b bg-primary-soft px-3.5 py-2`),children:[(0,b.jsx)(`span`,{className:W(`font-semibold`,o?`flex-1 text-sm`:`pe-1.5 text-primary`),children:d(`list.selected`,{count:_.size})}),(0,b.jsx)(gD,{schema:M,ids:[..._],bulkOnly:!0,size:`sm`}),ue.map(e=>(0,b.jsx)(mD,{resource:M.name,action:e,ids:[..._],size:`sm`,className:o?me:void 0,onDone:(t,n)=>{let r=XE(t,n);v(new Set),O.reset(),D({title:d(`action.bulkDone`,{action:e.label,count:r.ok.length}),result:r})}},e.name)),ce.delete?w?(0,b.jsx)(q,{variant:`destructive`,size:`sm`,disabled:O.isPending,onClick:()=>O.mutate([..._]),children:d(`list.confirmDeleteSelected`,{count:_.size})}):(0,b.jsxs)(q,{variant:`outline`,size:o?`icon-sm`:`sm`,className:o?me:`text-destructive`,"aria-label":o?d(`list.deleteSelected`):void 0,onClick:()=>T(!0),children:[(0,b.jsx)(nx,{}),!o&&d(`list.deleteSelected`)]}):null,(0,b.jsx)(q,{variant:`ghost`,size:o?`icon-sm`:`sm`,className:o?W(me,`-order-1`):`ms-auto`,"aria-label":o?d(`list.clearSelection`):void 0,onClick:()=>v(new Set),children:o?(0,b.jsx)(Sx,{}):d(`list.clearSelection`)})]});return(0,b.jsxs)(`div`,{className:W(`flex flex-col gap-4`,o&&_.size>0&&`pb-16`),children:[(0,b.jsxs)(`div`,{className:W(`flex flex-wrap gap-3`,o?`items-center gap-2`:`items-end`),children:[(0,b.jsxs)(`div`,{className:W(`flex gap-0.5`,o?`items-baseline gap-1.5`:`flex-col`),children:[(0,b.jsx)(`h1`,{className:o?`text-base font-semibold`:`text-[22px] font-bold`,children:M.label}),s.data&&s.data.total!==null&&(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:$S(s.data,r).summary})]}),(0,b.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[M.softDelete&&ce.delete&&(0,b.jsxs)(q,{variant:p?`secondary`:`outline`,size:o?`icon`:`default`,"aria-pressed":p,"aria-label":o?d(`list.trash`):void 0,onClick:()=>fe({trashed:p?null:`only`}),children:[(0,b.jsx)(nx,{}),!o&&d(`list.trash`)]}),o&&le&&(0,b.jsx)(q,{variant:c?`secondary`:`outline`,size:`icon`,"aria-pressed":c,"aria-label":d(c?`list.done`:`list.select`),onClick:()=>{l(!c),v(new Set)},children:(0,b.jsx)(My,{})}),!p&&GE(M).map(e=>(0,b.jsx)(mD,{resource:M.name,action:e,onDone:()=>void 0},e.name)),!p&&(0,b.jsx)(_D,{schema:M,query:xk(t),iconOnly:o}),M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,size:o?`icon`:`default`,className:W(o&&`size-10`),children:(0,b.jsxs)(bo,{to:`/${M.name}/new`,"aria-label":o?d(`list.new`):void 0,children:[(0,b.jsx)(mb,{}),!o&&d(`list.new`)]})})]})]}),M.list.tabs&&M.list.tabs.length>0&&!p&&(0,b.jsx)(_k,{schema:M,params:t,onChange:fe}),(0,b.jsx)(FC,{schema:M,params:t,onChange:fe,trailing:(0,b.jsx)(ek,{schema:M,prefs:m})}),s.isError&&(0,b.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[(0,b.jsxs)(`span`,{children:[d(`list.loadFailed`),` `,pg(s.error)]}),(0,b.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void s.refetch(),children:d(`list.retry`)})]}),f.isError&&(0,b.jsx)(G,{tone:`error`,children:pg(f.error)}),p&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d(`list.trashNote`)}),o&&I,E&&(0,b.jsx)(bk,{title:E.title,result:E.result,items:te}),O.isError&&(0,b.jsx)(G,{tone:`error`,children:pg(O.error)}),o?(0,b.jsx)(ak,{schema:M,query:g,columns:ee,trash:p,selectMode:c,selected:_,onSelect:v,restore:e=>(0,b.jsx)(yk,{item:e,pending:f.isPending,onRestore:e=>f.mutate(e)}),empty:(0,b.jsxs)(b.Fragment,{children:[d(XS(t)?`list.noMatches`:`list.noRecords`),!XS(t)&&M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,size:`sm`,variant:`outline`,children:(0,b.jsxs)(bo,{to:`/${M.name}/new`,children:[(0,b.jsx)(mb,{}),d(`list.new`)]})})]})}):(0,b.jsx)(b.Fragment,{children:(0,b.jsxs)(`section`,{className:`overflow-hidden rounded-card border bg-card shadow-card`,children:[I,(0,b.jsx)(`div`,{className:`overflow-x-auto`,children:(0,b.jsxs)(lk,{className:W(m.density===`compact`&&`[&_td]:py-1 [&_th]:h-8`),children:[(0,b.jsx)(uk,{children:(0,b.jsxs)(fk,{children:[le&&(0,b.jsx)(pk,{className:`w-0`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":d(`list.selectPage`),checked:te.length>0&&te.every(e=>_.has(String(e._id))),onChange:e=>v(e.target.checked?new Set(te.map(e=>String(e._id))):new Set)})}),N.map(e=>(0,b.jsxs)(pk,{className:`relative`,style:m.widths[e.name]?{width:m.widths[e.name],minWidth:m.widths[e.name]}:void 0,"aria-sort":F.field===e.name?F.direction===`asc`?`ascending`:`descending`:void 0,children:[M.list.sortable.includes(e.name)?(0,b.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1`,onClick:()=>pe(e.name),children:[e.label,F.field===e.name&&(F.direction===`asc`?(0,b.jsx)(X_,{className:`size-3.5`}):(0,b.jsx)(K_,{className:`size-3.5`}))]}):e.label,(0,b.jsx)(tk,{resource:M.name,column:e.name,label:e.label,width:m.widths[e.name]})]},e.name)),p&&(0,b.jsx)(pk,{className:`w-0`,children:(0,b.jsx)(`span`,{className:`sr-only`,children:d(`list.actions`)})})]})}),(0,b.jsxs)(dk,{children:[s.isPending&&Array.from({length:5},(e,t)=>(0,b.jsxs)(fk,{"aria-hidden":!0,children:[le&&(0,b.jsx)(mk,{}),N.map(e=>(0,b.jsx)(mk,{children:(0,b.jsx)(`div`,{className:`h-4 w-3/4 animate-pulse rounded bg-muted`})},e.name))]},`skeleton-${t}`)),te.map(e=>(0,b.jsxs)(fk,{"data-state":_.has(String(e._id))?`selected`:void 0,className:p?void 0:`cursor-pointer focus-visible:bg-muted/50 focus-visible:outline-none`,tabIndex:p?void 0:0,onClick:p?void 0:()=>C(e),onKeyDown:p?void 0:t=>{t.key===`Enter`&&t.target===t.currentTarget&&(t.preventDefault(),C(e))},children:[le&&(0,b.jsx)(mk,{onClick:e=>e.stopPropagation(),children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":d(`list.selectRow`,{name:String(e._title??e._id)}),checked:_.has(String(e._id)),onChange:t=>{let n=new Set(_);t.target.checked?n.add(String(e._id)):n.delete(String(e._id)),v(n)}})}),N.map((t,n)=>(0,b.jsx)(mk,{children:t.computed?(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[t.image&&(0,b.jsx)(ND,{schema:M,name:t.image.name,column:t.image.computed,item:e}),n===P&&!p?(0,b.jsx)(bo,{to:de(e),className:`min-w-0 hover:underline`,onClick:e=>e.stopPropagation(),children:(0,b.jsx)(ND,{schema:M,name:t.name,column:t.computed,item:e})}):(0,b.jsx)(ND,{schema:M,name:t.name,column:t.computed,item:e})]}):n===P&&!p?(0,b.jsx)(bo,{to:de(e),className:`font-semibold hover:underline`,onClick:e=>e.stopPropagation(),children:Nx(e[t.name],t.field)}):!p&&M.list.editable.includes(t.name)&&!(Array.isArray(e._readonly)&&e._readonly.includes(t.name))&&e._perm?.update!==!1?(0,b.jsx)(rk,{schema:M,item:e,field:t.field}):(0,b.jsx)(vk,{value:e[t.name],field:t.field,record:e})},t.name)),p&&(0,b.jsx)(mk,{children:(0,b.jsx)(yk,{item:e,pending:f.isPending,onRestore:e=>f.mutate(e)})})]},String(e._id))),s.isSuccess&&te.length===0&&(0,b.jsx)(fk,{children:(0,b.jsx)(mk,{colSpan:N.length+(p||le?1:0),className:`text-center text-muted-foreground`,children:(0,b.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-6`,children:[d(XS(t)?`list.noMatches`:`list.noRecords`),!XS(t)&&M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,size:`sm`,variant:`outline`,children:(0,b.jsxs)(bo,{to:`/${M.name}/new`,children:[(0,b.jsx)(mb,{}),d(`list.new`)]})})]})})})]})]})}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-t px-3.5 py-2.5 text-[13px] text-muted-foreground`,children:[(0,b.jsx)(`span`,{children:eC(s.data,ne?1:r,te.length)||ie.summary}),(0,b.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[!ne&&(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[d(`list.rowsPerPage`),(0,b.jsx)(`select`,{className:`h-8 rounded-lg border border-input bg-card px-2 text-[12.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,value:s.data?.pageSize??M.list.pageSize,onChange:e=>fe({pageSize:Number(e.target.value)===M.list.pageSize?null:e.target.value}),children:tC(M.list.pageSize).map(e=>(0,b.jsx)(`option`,{value:e,children:eg(e)},e))})]}),(0,b.jsx)(`span`,{children:ie.label}),(0,b.jsx)(q,{variant:`outline`,size:`icon-sm`,"aria-label":d(`list.previousPage`),disabled:!ae,onClick:se,children:(0,b.jsx)(wv,{className:`rtl:rotate-180`})}),(0,b.jsx)(q,{variant:`outline`,size:`icon-sm`,"aria-label":d(`list.nextPage`),disabled:!ie.hasNext,onClick:oe,children:(0,b.jsx)(Ev,{className:`rtl:rotate-180`})})]})]})]})}),(0,b.jsx)(ck,{schema:M,item:x,onClose:()=>C(void 0)})]})}function _k({schema:e,params:t,onChange:n}){let r=ft({queryKey:[`list`,e.name,`tab-counts`],queryFn:()=>Q.tabCounts(e.name)}),i=e.list.tabs,a=aC(i,t);return(0,b.jsx)(`div`,{className:`overflow-x-auto`,children:(0,b.jsx)(NO,{items:i.map(e=>{let t=r.data?.[e.key];return{key:e.key,label:e.label,...t?{count:eg(t.count),estimate:t.estimate}:{}}}),value:a?.key??``,onChange:e=>n(oC(i.find(t=>t.key===e),t))})})}function vk({value:e,field:t,record:n}){let r=t.relation?.resource;if(!r||e==null)return(0,b.jsx)(rE,{value:e,field:t,record:n});let i=(Array.isArray(e)?e:[e]).filter(pC);return i.length===0?(0,b.jsx)(b.Fragment,{children:Nx(e,t)}):(0,b.jsx)(b.Fragment,{children:i.map((e,t)=>(0,b.jsxs)(y.Fragment,{children:[t>0&&`, `,(0,b.jsx)(bo,{to:`/${r}/${encodeURIComponent(hk([e.id]))}`,className:`hover:underline`,onClick:e=>e.stopPropagation(),children:e.title})]},String(e.id)))})}function yk({item:e,pending:t,onRestore:n}){let r=X();return(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,disabled:t,"aria-label":r(`list.restoreRecord`,{name:String(e._title??e._id)}),onClick:()=>n(String(e._id)),children:[(0,b.jsx)(wb,{}),r(`list.restore`)]})}function bk({title:e,result:t,items:n}){let r=X(),i=e=>{let t=n.find(t=>String(t._id)===e);return typeof t?._title==`string`?t._title:`#${e}`};return(0,b.jsxs)(`div`,{role:`status`,className:`rounded-lg border px-3 py-2 text-sm`,children:[(0,b.jsxs)(`p`,{children:[e,t.failed.length>0&&` · ${r(`list.bulkFailed`,{count:t.failed.length})}`]}),t.failed.length>0&&(0,b.jsx)(`ul`,{className:`mt-1 list-disc ps-5 text-destructive`,children:t.failed.map(e=>(0,b.jsxs)(`li`,{children:[i(e.id),`: `,e.message]},e.id))})]})}function xk(e){let t=new URLSearchParams(e);for(let e of[`page`,`pageSize`,`after`])t.delete(e);return t}function Sk(){let e=X();return(0,b.jsx)(G,{children:e(`common.pageNotFound`)})}function Ck(e){let t=wC(e.schema.fields.filter(e=>!e.secret),{...e.values,_files:e.files});for(let n of e.schema.fields)n.secret&&(t[n.name]=``);return t}function wk(e,t,n){let r=e.filter(e=>iD(e,t)),i=r.filter(e=>!e.secret),{payload:a,errors:o}=EC(i,t,n),s=EC(i.filter(e=>e.type===`object`&&!e.many&&Object.hasOwn(a,e.name)),t);Object.assign(a,s.payload),Object.assign(o,s.errors);for(let e of r){if(!e.secret)continue;let n=t[e.name];n===null?a[e.name]=null:typeof n==`string`&&n.trim()!==``&&(a[e.name]=n)}return{payload:a,errors:o}}function Tk(e,t){let n=new Set(t.fields.filter(e=>e.secret).map(e=>e.name)),r=Object.entries(t.constraints).filter(([t])=>Object.hasOwn(e,t.split(`.`)[0])),i=r.filter(([e])=>!e.includes(`.`)).map(([e,t])=>[e,n.has(e)?{...t,required:!1}:t]),a=r.filter(([e])=>e.includes(`.`));return{...dD(e,Object.fromEntries(a),`create`),...dD(e,Object.fromEntries(i),`update`)}}function Ek(){let e=X(),{page:t=``}=$i(),n=Jg(t);return n.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):n.isError?(0,b.jsx)(G,{tone:`error`,children:pg(n.error)}):(0,b.jsx)(Dk,{page:n.data},t)}function Dk({page:e}){let t=X(),{locale:n}=Y(),r=S(),{schema:i}=e,a=i.fields.map(e=>e.name),[o,s]=(0,y.useState)(()=>Ck(e)),[c,l]=(0,y.useState)(o),[u,d]=(0,y.useState)([]),[f,p]=(0,y.useState)({}),[m,h]=(0,y.useState)(null),[g,_]=(0,y.useState)(null),v=DD(()=>h(null)),x=JSON.stringify(c)!==JSON.stringify(o),{blocker:C}=wD(x),w=(0,y.useRef)(null);ED(w);let T=(e,t)=>l(n=>({...n,[e]:t})),E=pt({mutationFn:e=>Q.savePage(i.name,e),gcTime:0,onSuccess:e=>{E.reset();let a=Ck(e);r.setQueryData([`page`,i.name,n],e),s(a),l(a),d([]),p({}),_(t(`form.savedName`,{name:e.schema.label}))},onError:e=>{let t=ZE(e,a);p(t.fields),h(t.form)}});function D(e){if(e.preventDefault(),i.readonly)return;if(_(null),v.busy){h(t(`upload.busy`)),v.refuse();return}let{payload:n,errors:r}=wk(i.fields,c,o),a={...Tk(n,i),...r};if(p(a),h(null),!(Object.keys(a).length>0)){if(Object.keys(n).length===0){l(o),d([]);return}E.mutate(n)}}let O={...e.values,_files:e.files};function k(t){let n=i.fields.find(e=>e.name===t);if(!n||!iD(n,c))return null;let r=i.required.includes(t);return n.secret?(0,b.jsx)(Ok,{field:n,stored:e.secrets[t]===!0,value:c[t],replacing:u.includes(t),readOnly:i.readonly,required:r,errors:f[t],onChange:e=>T(t,e),onReplacing:e=>d(n=>e?[...n,t]:n.filter(e=>e!==t))}):i.readonly?(0,b.jsx)(uO,{resource:`page:${i.name}`,field:n,record:O}):n.type===`object`?(0,b.jsx)(BE,{resource:`page:${i.name}`,field:n,path:t,pattern:t,value:c[t],constraints:i.constraints,markRequired:!0,errors:f,onChange:e=>T(t,e)}):(0,b.jsx)(kE,{resource:`page:${i.name}`,field:n,value:c[t],required:r,errors:f[t],constraints:i.constraints[t],onChange:e=>T(t,e),onBusy:e=>v.setBusy(t,e)})}return(0,b.jsxs)(`form`,{ref:w,onSubmit:D,noValidate:!0,className:W(`flex flex-col gap-5`,i.layout?.length?`max-w-4xl`:`max-w-2xl`),children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:i.label}),i.readonly&&(0,b.jsx)(`p`,{role:`note`,className:`rounded-md border bg-muted/40 px-3 py-2 text-sm text-muted-foreground`,children:t(`settings.viewOnly`)}),g&&(0,b.jsx)(`p`,{role:`status`,className:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:g}),(0,b.jsx)(TD,{blocker:C}),m&&(0,b.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:m}),(0,b.jsx)(NE,{layout:i.layout,names:a,errors:f,render:k}),!i.readonly&&(0,b.jsxs)(OD,{dirty:x,children:[x&&(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:E.isPending,onClick:()=>{l(o),d([]),p({}),h(null)},children:t(`settings.discard`)}),(0,b.jsxs)(q,{type:`submit`,disabled:E.isPending||v.busy,"aria-keyshortcuts":`Control+S Meta+S`,children:[t(E.isPending?`form.saving`:`form.save`),(0,b.jsx)(kD,{})]})]})]})}function Ok({field:e,stored:t,value:n,replacing:r,readOnly:i,required:a,errors:o,onChange:s,onReplacing:c}){let l=X(),u=`field-${e.name}`,d=`${u}-label`,f=`${u}-help`,p=`${u}-error`,m=(o?.length??0)>0,h=[e.help?f:void 0,m?p:void 0].filter(Boolean).join(` `)||void 0,g=n===null,_=!i&&!g&&(!t||r);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-secret":e.name,children:[(0,b.jsxs)(`label`,{id:d,htmlFor:_?u:void 0,className:`text-sm font-medium`,children:[e.label,a&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`text-destructive`,children:`*`})]}),_?(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(Oh,{id:u,type:`password`,autoComplete:`new-password`,dir:`ltr`,className:`min-w-0 flex-1`,value:typeof n==`string`?n:``,autoFocus:r,"aria-invalid":m?!0:void 0,"aria-describedby":h,onChange:e=>s(e.target.value)}),t&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{s(``),c(!1)},children:l(`secret.keep`)})]}):(0,b.jsx)(`div`,{role:`group`,"aria-labelledby":d,"aria-describedby":h,className:`flex min-h-8 flex-wrap items-center gap-2 text-sm`,children:g?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`text-amber-800 dark:text-amber-300`,children:l(`secret.willClear`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>s(``),children:l(`secret.undo`)})]}):t?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-medium text-green-800 dark:text-green-300`,children:[l(`secret.set`),(0,b.jsx)(bv,{className:`size-4`,"aria-hidden":!0})]}),!i&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"aria-label":l(`secret.replaceName`,{name:e.label}),onClick:()=>c(!0),children:l(`secret.replace`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":l(`secret.clearName`,{name:e.label}),onClick:()=>s(null),children:l(`secret.clear`)})]})]}):(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:l(`secret.notSet`)})}),e.help&&(0,b.jsx)(`p`,{id:f,className:`text-sm text-muted-foreground`,children:e.help}),m&&(0,b.jsx)(`p`,{id:p,className:`text-sm text-destructive`,children:o.join(` `)})]})}document.title=dg.title,Pw(jw()),Vw(dg.branding),Xw({branding:dg.branding.primaryColor}),kx(dg.currency),Zh(dg.messages),Rw(jw);var kk=new Qe({defaultOptions:{queries:{retry:1,staleTime:3e4}}}),Ak=_o([{path:`login`,element:(0,b.jsx)(YT,{})},{element:(0,b.jsx)(GT,{}),children:[{index:!0,element:(0,b.jsx)(GO,{})},{path:`account`,element:(0,b.jsx)(v_,{})},{path:`-/users`,element:(0,b.jsx)(yw,{})},{path:`-/users/new`,element:(0,b.jsx)(bw,{})},{path:`-/users/:id`,element:(0,b.jsx)(bw,{})},{path:`-/groups`,element:(0,b.jsx)(ow,{})},{path:`-/groups/new`,element:(0,b.jsx)(sw,{})},{path:`-/groups/:id`,element:(0,b.jsx)(sw,{})},{path:`-/roles`,element:(0,b.jsx)(vw,{})},{path:`-/roles/new`,element:(0,b.jsx)(hw,{})},{path:`-/roles/:name`,element:(0,b.jsx)(hw,{})},{path:`-/debugger`,element:(0,b.jsx)(rw,{})},{path:`-/audit`,element:(0,b.jsx)(ew,{})},{path:`g/:group`,element:(0,b.jsx)(mO,{})},{path:`p/:page`,element:(0,b.jsx)(Ek,{})},{path:`:resource`,element:(0,b.jsx)(gk,{})},{path:`:resource/new`,element:(0,b.jsx)(rO,{mode:`create`})},{path:`:resource/:id`,element:(0,b.jsx)(rO,{mode:`edit`})},{path:`*`,element:(0,b.jsx)(Sk,{})}]}],{basename:dg.basePath});vg(()=>{let e=bg(Ak.state.location.pathname,dg.basePath),{search:t}=Ak.state.location;e!==`/login`&&(kk.clear(),Ak.navigate(`/login?${new URLSearchParams({next:e+t})}`,{replace:!0}))}),(0,Ka.createRoot)(document.getElementById(`root`)).render((0,b.jsx)(y.StrictMode,{children:(0,b.jsx)(lg,{locales:dg.locales,fallback:dg.locale,children:(0,b.jsx)(C,{client:kk,children:(0,b.jsx)(Ca,{router:Ak})})})}));export{c as _,Iy as a,$ as c,q as d,W as f,o as g,u as h,nx as i,X as l,m,pE as n,Ay as o,v as p,lE as r,Pv as s,mE as t,Oh as u};
57
+ `)?f:void 0,m={...o.length?{create:o}:{},...s.length?{update:s}:{},...u.length?{delete:u}:{},...p?{order:p}:{}};return{changes:Object.keys(m).length?m:void 0,errors:a}}function QD(e,t,n,r,i){let a={},o={};for(let s of e){let e=t[s.inline];if(!e||s.readonly)continue;let c=r[s.inline]??[],l=ZD(s,e,n[s.inline]??[],c),u=l.changes?i(s,c.length):null;(Object.keys(l.errors).length>0||u)&&(o[s.inline]={rows:l.errors,inline:u?[u]:[]}),l.changes&&(a[s.inline]=l.changes)}return{changes:Object.keys(a).length?a:void 0,errors:o}}function $D(e,t){let n={},r={};for(let[i,a]of Object.entries(e)){if(i!==`_inlines`&&!i.startsWith(`_inlines.`)){r[i]=a;continue}let[,e=``,o,s,...c]=i.split(`.`),l=n[e]??={rows:{},inline:[]},u=o===`create`?t?.[e]?.create?.[Number(s)]?._key:o===`update`||o===`delete`?s:void 0,d=c.join(`.`);u===void 0||o===`create`&&!/^\d+$/.test(s??``)||d===``?l.inline.push(...a):((l.rows[u]??={})[d]??=[]).push(...a)}return{inlines:n,parent:r}}var eO=e=>Object.values(e).some(e=>e.inline.length>0||Object.keys(e.rows).length>0);function tO({inline:e,child:t,rows:n,onChange:r,readOnly:i,errors:a,parent:o,parentValues:s,onBusy:c,truncated:l,canAdd:u=!0}){let d=X(),f=(0,y.useId)(),p=qD(e,t),m=(0,y.useRef)(0),[h,g]=(0,y.useState)(null),_=!i&&u&&t.permissions?.create!==!1&&t.form.create.length>0&&n.length<e.max,v=!i&&e.order!==void 0&&t.form.update.includes(e.order)&&n.length>1,x=e=>!i&&(e.id===void 0||t.permissions?.delete!==!1&&e.record?._perm?.delete!==!1),S=e=>s===void 0?void 0:JSON.stringify({...JSON.parse(OC(p,e.values)??`{}`),_parent:JSON.parse(s)});function C(){let i;do i=`n${++m.current}`;while(n.some(e=>e.key===i));r([...n,YD(e,t,i)])}let w=(e,t,i)=>r(n.map(n=>n.key===e?{...n,values:{...n.values,[t]:i}}:n)),T=e=>r(n.filter(t=>t.key!==e));function E(e,t){if(t<0||t>=n.length||e===t)return;let i=[...n];i.splice(t,0,i.splice(e,1)[0]),r(i)}function D(n,r,s){let l=`inline-${t.name}-${n.key}`,u=a?.rows[n.key]??{},d=n.id===void 0;if(i||!(d?t.form.create:t.form.update).includes(r.name)||XD(n,t).has(r.name))return d?null:e.readonly&&s?(0,b.jsx)(lE,{value:n.record?.[r.name],field:r,record:n.record}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-readonly":r.name,children:[!s&&(0,b.jsx)(`span`,{className:`text-sm font-medium`,children:r.label}),(0,b.jsx)(`div`,{className:`min-h-8 rounded-lg bg-muted/50 px-2.5 py-1.5 text-sm break-words`,children:(0,b.jsx)(lE,{value:n.record?.[r.name],field:r,record:n.record})})]});let f=d?`create`:`update`;if(r.type===`object`)return(0,b.jsx)(KE,{resource:t.name,field:r,path:r.name,pattern:r.name,value:n.values[r.name],constraints:t.form.constraints[f],markRequired:d,errors:u,idPrefix:l,onChange:e=>w(n.key,r.name,e)});let p=KD([r],n.values)[r.name],m=(0,b.jsx)(FE,{resource:t.name,field:r,value:n.values[r.name],required:d&&t.form.requiredOnCreate.includes(r.name),errors:u[r.name],constraints:t.form.constraints[f][r.name],formValues:r.type===`relation`?S(n):void 0,parent:o,idPrefix:l,hideLabel:s,onChange:e=>w(n.key,r.name,e),onBusy:e=>c(`${t.name}:${n.key}:${r.name}`,e)});return p?(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[m,(0,b.jsxs)(`p`,{className:`flex items-center gap-1 text-xs text-warn`,children:[(0,b.jsx)(ax,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),p]})]}):m}function O(t,r){let i=d(`inline.row`,{name:e.label,index:r+1});return(0,b.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`cursor-grab text-muted-foreground`,draggable:!0,"aria-hidden":!0,onDragStart:e=>{e.dataTransfer.effectAllowed=`move`,g(r)},onDragEnd:()=>g(null),children:(0,b.jsx)(dy,{className:`size-4`})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:r===0,"aria-label":d(`inline.moveUp`,{name:i}),onClick:()=>E(r,r-1),children:(0,b.jsx)(Z_,{})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:r===n.length-1,"aria-label":d(`inline.moveDown`,{name:i}),onClick:()=>E(r,r+1),children:(0,b.jsx)(q_,{})})]}),x(t)&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":d(`inline.remove`,{name:i}),onClick:()=>T(t.key),children:(0,b.jsx)(rx,{})})]})}let k=e=>v?{onDragOver:e=>{h!==null&&e.preventDefault()},onDrop:t=>{t.preventDefault(),h!==null&&E(h,e),g(null)}}:{},A=e=>{let t=Object.entries(a?.rows[e.key]??{}).filter(([e])=>!p.some(t=>t.name===e.split(`.`)[0]));return t.length>0?(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:t.map(([e,t])=>`${e}: ${t.join(`, `)}`).join(` — `)}):null},j=v||n.some(x);return(0,b.jsxs)(`section`,{"aria-labelledby":f,className:`flex min-w-0 flex-col rounded-card border bg-card shadow-card`,"data-inline":t.name,children:[(0,b.jsxs)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 border-b px-5 py-3`,children:[(0,b.jsx)(`h2`,{id:f,className:`text-[15px] font-semibold`,children:e.label}),(0,b.jsx)(`span`,{className:`inline-flex h-5 items-center rounded-full bg-muted px-2 text-[11px] text-muted-foreground`,children:rO(d,e,n.length)}),_&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,className:`ms-auto`,onClick:C,children:[(0,b.jsx)(hb,{}),d(`form.add`,{name:e.label})]})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 p-5 empty:hidden`,children:[l&&(0,b.jsxs)(`p`,{role:`note`,className:`text-sm text-muted-foreground`,children:[d(`inline.truncated`,{count:l.total-n.length}),` `,(0,b.jsx)(bo,{to:l.href,className:`text-primary hover:underline`,children:d(`inline.openList`)})]}),n.length===0&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d(`inline.empty`)}),n.length>0&&e.display===`table`&&(0,b.jsx)(`div`,{className:`relative -mx-5 overflow-x-auto border-y first:-mt-5 first:border-t-0 last:-mb-5 last:border-b-0`,children:(0,b.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,b.jsx)(`thead`,{className:`bg-[color-mix(in_oklab,var(--muted)_50%,transparent)] text-[12.5px] text-muted-foreground`,children:(0,b.jsxs)(`tr`,{children:[(e.computed??[]).map(e=>(0,b.jsx)(`th`,{scope:`col`,className:`px-3.5 py-2.5 text-start font-medium whitespace-nowrap`,children:t.list.computed?.[e]?.label},`~${e}`)),p.map(e=>(0,b.jsxs)(`th`,{scope:`col`,className:`px-3.5 py-2.5 text-start font-medium whitespace-nowrap`,children:[e.label,t.form.requiredOnCreate.includes(e.name)&&n.some(e=>e.id===void 0)&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`text-destructive`,children:`*`})]},e.name)),j&&(0,b.jsx)(`th`,{scope:`col`,className:`px-3.5 py-2.5`,children:(0,b.jsx)(`span`,{className:`sr-only`,children:d(`inline.rowActions`)})})]})}),(0,b.jsx)(`tbody`,{children:n.map((n,r)=>(0,b.jsxs)(`tr`,{"data-row":n.key,className:W(`border-t align-top`,h===r&&`opacity-50`),...k(r),children:[(e.computed??[]).map(e=>(0,b.jsx)(`td`,{className:`px-3.5 py-2`,children:n.record&&t.list.computed?.[e]&&(0,b.jsx)(zD,{schema:t,name:e,column:t.list.computed[e],item:n.record})},`~${e}`)),p.map(e=>(0,b.jsx)(`td`,{className:`min-w-32 px-3.5 py-2`,children:D(n,e,!0)},e.name)),j&&(0,b.jsx)(`td`,{className:`px-3.5 py-2`,children:O(n,r)})]},n.key))})]})}),e.display===`table`&&n.map(e=>(0,b.jsx)(y.Fragment,{children:A(e)},e.key)),e.display===`cards`&&n.map((n,r)=>(0,b.jsxs)(`div`,{"data-row":n.key,className:W(`flex flex-col gap-4 rounded-card border bg-background/40 p-4`,h===r&&`opacity-50`),...k(r),children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,b.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium`,children:[nO(n)??d(`inline.newRow`,{name:e.label,index:r+1}),r===0&&e.markFirst&&(0,b.jsx)(aE,{tone:`primary`,children:e.markFirst})]}),O(n,r)]}),(0,b.jsx)(zE,{plain:!0,layout:t.form.layout,names:p.map(e=>e.name),errors:a?.rows[n.key]??{},render:e=>{let t=p.find(t=>t.name===e);return t?D(n,t,!1):null}}),A(n)]},n.key)),a&&a.inline.length>0&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a.inline.join(` — `)})]})]})}var nO=e=>typeof e.record?._title==`string`?e.record._title:void 0;function rO(e,t,n){return t.min?e(`inline.limitsBetween`,{min:t.min,max:t.max,count:n}):e(`inline.limitsMax`,{max:t.max,count:n})}var iO=(e,t)=>t===void 0?[`history`,e]:[`history`,e,t];function aO({schema:e,id:t,record:n}){let r=X(),i=Kg(),a=mt({queryKey:iO(e.name,t),initialPageParam:void 0,queryFn:({pageParam:n})=>Q.history(e.name,t,n),getNextPageParam:e=>e.next,staleTime:0});if(a.isPending)return(0,b.jsx)(G,{children:r(`common.loading`)});if(a.isError&&!a.data)return(0,b.jsx)(G,{tone:`error`,children:pg(a.error)});let o=a.data.pages.flatMap(e=>e.entries);if(o.length===0)return(0,b.jsx)(G,{children:r(`audit.empty`)});let s=t=>t===e.name?e:void 0;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,b.jsx)(oS,{entries:o,now:new Date(a.dataUpdatedAt),names:Lx(i.data,s),schemaOf:s,titleOf:(e,t)=>oO(n,e,t)}),a.isError&&(0,b.jsx)(G,{tone:`error`,children:pg(a.error)}),a.hasNextPage&&(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`self-center`,disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:r(a.isFetchingNextPage?`common.loading`:`list.loadMore`)})]})}function oO(e,t,n){let r=e?.[t],i=(Array.isArray(r)?r:[r]).find(e=>typeof e==`object`&&!!e&&String(e.id)===n);return typeof i?.title==`string`?i.title:void 0}function sO(e){return e.normalize(`NFKD`).replace(/\p{M}/gu,``).normalize(`NFC`).toLowerCase().replace(/[^\p{L}\p{N}]+/gu,`-`).replace(/^-+|-+$/g,``)}function cO(e,t,n){let r=typeof t?._title==`string`?t._title:`#${n}`;return r.startsWith(`#`)?`${e} ${r}`:`${e}: ${r}`}function lO({mode:e}){let t=X(),{resource:n=``,id:r}=$i(),i=qi(),[a]=wo(),o=e===`create`?a.get(`from`)??void 0:void 0,s=e===`edit`?r:o,c=qg(n),l=Zg(n,s),[u,d]=(0,y.useState)(0),f=`${n}:${r}`,[p,m]=(0,y.useState)({of:f,tab:`details`}),h=p.of===f?p.tab:`details`;if(c.isPending||s!==void 0&&l.isPending)return(0,b.jsx)(G,{children:t(`common.loading`)});if(c.isError)return(0,b.jsx)(G,{tone:`error`,children:c.error.message});if(s!==void 0&&l.isError)return(0,b.jsx)(G,{tone:`error`,children:l.error.message});let g=i.state?.saved;return(0,b.jsx)(dO,{schema:c.data,mode:e,id:r,record:e===`edit`?l.data:void 0,source:o?l.data:void 0,saved:u===0?g:void 0,onChanged:()=>d(e=>e+1),tab:h,onTab:e=>m({of:f,tab:e})},e===`edit`?`${n}:${r}:${u}`:`${n}:new:${i.key}`)}function uO(e,t){let n=new Set(e.fields.filter(e=>e.primary||e.unique||e.readonly||e.file).map(e=>e.name)),r=new Set(e.fields.filter(e=>e.widget===`richtext`).map(e=>e.name));return Object.fromEntries(Object.entries(t).filter(([e])=>!n.has(e)&&!e.startsWith(`_`)).map(([e,t])=>[e,r.has(e)&&typeof t==`string`?SC(t):t]))}function dO({schema:e,mode:t,id:n,record:r,source:i,saved:a,onChanged:o,tab:s,onTab:c}){let l=X(),{locale:u}=Y(),d=Yi(),f=S(),p=r?._perm,m=t===`create`||e.permissions?.update!==!1&&p?.update!==!1,h=e.permissions?.delete!==!1&&p?.delete!==!1,[g,_]=(0,y.useState)(!1),v=UD(e,t===`edit`?r:void 0,g),x=t===`edit`&&e.form.mode===`view`&&!g,C=new Set(t===`edit`?m&&!x?[...e.form.readonly,...hO(r)]:[...e.form.update,...e.form.readonly]:[]),w=t===`create`?e.form.create:[...e.form.update,...e.form.readonly],T=e.fields.filter(e=>w.includes(e.name)),E=HD(e),D=T.filter(e=>!C.has(e.name)),O=D.map(e=>e.name),[k,A]=(0,y.useState)(r),[j,M]=(0,y.useState)(()=>{let t=TC(D,r??(i?uO(e,i):void 0));return sD(D,t,oD(D,t))}),[N,ee]=(0,y.useState)(j),P=(0,y.useRef)(oD(D,j));(0,y.useEffect)(()=>{if(!g||!r)return;let e=TC(D,r);P.current=oD(D,e),M(e),ee(e)},[g]);let F=fO(e),te=t=>Object.fromEntries(F.map(n=>[n.inline,JD(n,e.inlines[n.inline],t)])),[ne,re]=(0,y.useState)(()=>te(r)),[ie,ae]=(0,y.useState)(ne),[oe,se]=(0,y.useState)({}),ce=(0,y.useRef)(void 0),le=e.version?k?.[e.version]:void 0,[ue,de]=(0,y.useState)(null),fe=OC(D,N),[pe,me]=(0,y.useState)({}),[I,L]=(0,y.useState)(null),he=Gg(),ge=t===`edit`&&n!==void 0&&he.data?.audit.enabled===!0&&!e.source,_e=ge?s:`details`,ve=(0,y.useRef)(new Set(D.filter(e=>e.widget===`slug`&&j[e.name]!==``).map(e=>e.name)));function ye(e,t){cD(D,P.current,e,t),ee(n=>{let r={...n,[e]:t};if(typeof t==`string`)for(let n of D)n.slugFrom===e&&!ve.current.has(n.name)&&(r[n.name]=sO(t));return sD(D,r,P.current)}),D.some(t=>t.name===e&&t.widget===`slug`)&&ve.current.add(e)}let[be,xe]=(0,y.useState)(a?l(`form.savedName`,{name:a}):null),Se=ND(()=>L(null)),Ce=JSON.stringify(N)!==JSON.stringify(j)||JSON.stringify(ie)!==JSON.stringify(ne),{blocker:we,release:Te}=AD(Ce),Ee=(0,y.useRef)(null),De=(0,y.useRef)(`list`);MD(Ee,()=>{De.current=`stay`});let Oe=pt({mutationFn:({payload:r,version:i})=>t===`create`?Q.create(e.name,r):Q.update(e.name,n,r,i),onSuccess:async(r,{then:i})=>{f.invalidateQueries({queryKey:iO(e.name)}),await f.invalidateQueries({queryKey:[`list`,e.name]});let a=typeof r._title==`string`?r._title:`#${String(r._id)}`;if(i===`stay`&&t===`edit`){let t=TC(D,r);P.current=oD(D,t);let i=te(r);A(r),M(t),ee(t),re(i),ae(i),se({}),xe(l(`form.savedName`,{name:a})),await f.invalidateQueries({queryKey:[`record`,e.name,n]});return}Te(),f.removeQueries({queryKey:[`record`,e.name]}),i===`new`?d(`/${e.name}/new`,{state:{saved:a}}):i===`stay`?d(`/${e.name}/${encodeURIComponent(String(r._id))}`,{replace:!0,state:{saved:a}}):d(`/${e.name}`)},onError:e=>{if(c(`details`),!(e instanceof fg)){L(e.message);return}if(e.status===409&&e.body.current){de(e.body.current);return}let t=rD(e,[...O,`_inlines`]),n=$D(t.fields,ce.current);me(n.parent),se(n.inlines),L(t.form)}}),[ke,Ae]=(0,y.useState)(!1),je=pt({mutationFn:()=>Q.remove(e.name,n,le),onSuccess:async()=>{Te(),await f.invalidateQueries({queryKey:[`list`,e.name]}),d(`/${e.name}`),f.removeQueries({queryKey:[`record`,e.name,n]})},onError:e=>{Ae(!1),L(pg(e))}}),Me=D.filter(e=>uD(e,N));function Ne(){let n=DC(Me,N,t===`edit`?j:void 0),r=QD(F,e.inlines??{},ne,ie,(e,t)=>e.min!==void 0&&t<e.min?l(`inline.countMin`,{min:e.min,count:t}):t>e.max?l(`inline.countMax`,{max:e.max,count:t}):null);return ce.current=r.changes,{payload:r.changes?{...n.payload,_inlines:r.changes}:n.payload,errors:n.errors,inlineErrors:r.errors}}function Pe(n){if(n.preventDefault(),!m)return;let r=n.nativeEvent.submitter,i=r?.value===`new`?`new`:r?`list`:De.current;if(De.current=`list`,xe(null),Se.busy){L(l(`upload.busy`)),Se.refuse();return}let{payload:a,errors:o,inlineErrors:s}=Ne(),u=t===`create`?`create`:`update`,d={..._D(a,Object.fromEntries(Object.entries(e.form.constraints[u]).filter(([e])=>Me.some(t=>t.name===e.split(`.`)[0]))),u),...o};me(d),se(s),L(null),Object.keys(d).length===0&&!eO(s)?Oe.mutate({payload:a,version:le,then:i}):c(`details`)}function Fe(t){de(null),Oe.mutate({payload:Ne().payload,version:e.version?t[e.version]:void 0,then:Oe.variables?.then??`list`})}function Ie(e){let t=TC(D,e);P.current=oD(D,t),de(null),A(e),M(t),ee(t),me({})}function Le(t){let i=e.inlines?.[t.inline];if(!i)return null;let a=r?._inlines?.[t.inline],o=a?.truncated&&n!==void 0?{total:a.total,href:`/${i.name}?${new URLSearchParams({[`filter[${t.link}]`]:String(r?.[e.primaryKeys[0]]??n)})}`}:void 0;return(0,b.jsx)(tO,{inline:t,child:i,rows:ie[t.inline]??[],onChange:e=>ae(n=>({...n,[t.inline]:e})),readOnly:!m||x||t.readonly===!0||o!==void 0,errors:oe[t.inline],parent:e.name,parentValues:fe,onBusy:Se.setBusy,truncated:o,canAdd:(r?._perm)?.inlines?.[t.inline]?.create!==!1})}function Re(t){let n=GD(t,e,r);return n.length===0?null:(0,b.jsx)(uE,{title:t.title,bodyClassName:t.title?void 0:`p-5`,children:(0,b.jsx)(`dl`,{className:`flex flex-col gap-2 text-[13px]`,children:n.map((e,t)=>(0,b.jsxs)(`div`,{className:W(`flex items-baseline justify-between gap-3`,t===n.length-1&&n.length>1&&`border-t pt-2.5 text-sm font-bold`),children:[(0,b.jsx)(`dt`,{className:W(t===n.length-1&&n.length>1?``:`text-muted-foreground`),children:e.label}),(0,b.jsx)(`dd`,{children:e.text})]},e.label))})})}let ze=KD(D,N);function Be(e){let t=Ve(e);return t&&ze[e]?(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[t,(0,b.jsxs)(`p`,{className:`flex items-center gap-1 text-xs text-warn`,children:[(0,b.jsx)(ax,{className:`size-3.5`,"aria-hidden":!0}),ze[e]]})]}):t}function Ve(n){let i=T.find(e=>e.name===n);if(!i||!uD(i,N))return null;if(C.has(n))return(0,b.jsx)(gO,{resource:e.name,field:i,record:r,plain:x});let a=t===`create`?`create`:`update`;return i.type===`object`?(0,b.jsx)(KE,{resource:e.name,field:i,path:i.name,pattern:i.name,value:N[i.name],constraints:e.form.constraints[a],markRequired:t===`create`,errors:pe,onChange:e=>ye(i.name,e)}):(0,b.jsx)(FE,{resource:e.name,field:i,value:N[i.name],required:t===`create`&&e.form.requiredOnCreate.includes(i.name),errors:pe[i.name],formValues:i.type===`relation`?fe:void 0,constraints:e.form.constraints[a][i.name],onChange:e=>ye(i.name,e),onBusy:e=>Se.setBusy(i.name,e)})}return(0,b.jsxs)(`form`,{ref:Ee,onSubmit:Pe,noValidate:!0,className:W(`flex flex-col gap-5`,v.aside.length>0?`max-w-[1400px]`:e.form.layout?.length?`max-w-4xl`:`max-w-2xl`),children:[t===`create`?(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsx)(_O,{to:`/${e.name}`}),(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:l(`form.new`,{name:e.label})})]}):(0,b.jsx)(vO,{schema:e,record:r,id:n,dirty:Ce,onGone:()=>{Te(),d(`/${e.name}`)},onChanged:o,badges:v.header.badges,subtitle:v.header.subtitle,extra:(0,b.jsxs)(b.Fragment,{children:[x&&m&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,onClick:()=>_(!0),children:[(0,b.jsx)(sb,{}),l(`form.edit`)]}),e.creatable&&(0,b.jsx)(q,{asChild:!0,variant:`outline`,children:(0,b.jsxs)(bo,{to:`/${e.name}/new?${new URLSearchParams({from:n})}`,children:[(0,b.jsx)(Lv,{}),l(`form.duplicate`)]})}),h&&(ke?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(q,{type:`button`,variant:`destructive`,disabled:je.isPending,onClick:()=>je.mutate(),children:l(je.isPending?`form.deleting`:e.softDelete?`form.confirmMoveToTrash`:`form.confirmDelete`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>Ae(!1),children:l(`form.keep`)})]}):(0,b.jsxs)(q,{type:`button`,variant:`outline`,className:`text-destructive`,onClick:()=>Ae(!0),children:[(0,b.jsx)(rx,{}),l(e.softDelete?`form.moveToTrash`:`form.delete`)]}))]})}),i&&F.length>0&&(0,b.jsx)(`p`,{role:`note`,className:`rounded-md border bg-muted/40 px-3 py-2 text-sm text-muted-foreground`,children:l(`inline.duplicateNote`,{names:new Intl.ListFormat(u).format(F.map(e=>e.label))})}),!m&&e.form.mode!==`view`&&(0,b.jsx)(`p`,{role:`note`,className:`rounded-md border bg-muted/40 px-3 py-2 text-sm text-muted-foreground`,children:l(`form.viewOnly`)}),be&&(0,b.jsx)(`p`,{role:`status`,className:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:be}),(0,b.jsx)(jD,{blocker:we}),ge&&(0,b.jsx)(mO,{active:_e,onChange:c}),ue&&(0,b.jsx)(yO,{fields:D,before:k,current:ue,busy:Oe.isPending,onKeepMine:()=>Fe(ue),onLoadTheirs:()=>Ie(ue)}),I&&(0,b.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:I}),ge&&_e===`history`&&(0,b.jsx)(`div`,{role:`tabpanel`,id:`record-panel-history`,"aria-labelledby":`record-tab-history`,children:(0,b.jsx)(aO,{schema:e,id:n,record:r})}),(0,b.jsxs)(`div`,{className:_e===`details`?`contents`:`hidden`,...ge?{role:`tabpanel`,id:`record-panel-details`,"aria-labelledby":`record-tab-details`}:{},children:[t===`edit`&&r&&v.header.stepper&&(0,b.jsx)(pE,{field:v.header.stepper,value:r[v.header.stepper.name],reached:r._steps}),(0,b.jsxs)(`div`,{className:W(v.aside.length>0?`grid items-start gap-5 lg:grid-cols-[minmax(0,1fr)_340px]`:`contents`),children:[(0,b.jsxs)(`div`,{className:W(v.aside.length>0?`flex min-w-0 flex-col gap-5`:`contents`),children:[(0,b.jsx)(zE,{layout:e.form.layout,names:T.map(e=>e.name).filter(e=>!E.has(e)),errors:{...pe,...Object.fromEntries(Object.entries(oe).filter(([,e])=>eO({found:e})).map(([e])=>[`_inlines.${e}`,[``]]))},render:Be,renderInline:Le,renderSummary:Re}),!x&&(0,b.jsxs)(PD,{dirty:Ce,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>d(`/${e.name}`),children:l(m?`common.cancel`:`form.back`)}),m&&e.creatable&&(0,b.jsx)(q,{type:`submit`,value:`new`,variant:`outline`,disabled:Oe.isPending||Se.busy,children:l(`form.saveAndNew`)}),m&&(0,b.jsxs)(q,{type:`submit`,value:`list`,disabled:Oe.isPending||Se.busy,"aria-keyshortcuts":`Control+S Meta+S`,children:[l(Oe.isPending?`form.saving`:`form.save`),(0,b.jsx)(FD,{})]})]}),t===`edit`&&r&&e.related.length>0&&(0,b.jsxs)(`nav`,{"aria-label":l(`form.related`),className:`flex flex-col gap-2 border-t pt-4`,children:[(0,b.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground`,children:l(`form.related`)}),(0,b.jsx)(`ul`,{className:`flex flex-wrap gap-2`,children:e.related.map(t=>(0,b.jsx)(`li`,{children:(0,b.jsx)(q,{asChild:!0,variant:`outline`,size:`sm`,children:(0,b.jsx)(bo,{to:`/${t.resource}?${new URLSearchParams({[`filter[${t.field}][${t.operator}]`]:String(r[e.primaryKeys[0]])})}`,children:t.label})})},`${t.resource}:${t.field}`))})]})]}),v.aside.length>0&&(0,b.jsx)(`aside`,{className:`flex flex-col gap-5`,children:v.aside.map((t,n)=>(0,b.jsx)(dE,{card:t,values:WD(t,n,r),schema:e},n))})]})]})]})}function fO(e){return(e.form.layout??[]).flatMap(e=>`tab`in e?e.sections:[e]).filter(t=>`inline`in t&&e.inlines?.[t.inline]!==void 0)}var pO=[`details`,`history`];function mO({active:e,onChange:t}){let n=X(),r=(0,y.useRef)({});return(0,b.jsx)(`div`,{role:`tablist`,"aria-label":n(`audit.recordTabs`),className:`flex gap-0.5 overflow-x-auto border-b`,onKeyDown:n=>{if(n.key!==`ArrowLeft`&&n.key!==`ArrowRight`&&n.key!==`Home`&&n.key!==`End`)return;n.preventDefault();let i=n.key===`Home`?`details`:n.key===`End`||e===`details`?`history`:`details`;t(i),r.current[i]?.focus()},children:pO.map(i=>(0,b.jsx)(`button`,{ref:e=>{r.current[i]=e},id:`record-tab-${i}`,type:`button`,role:`tab`,"aria-selected":i===e,"aria-controls":i===`details`||e===`history`?`record-panel-${i}`:void 0,tabIndex:i===e?0:-1,onClick:()=>t(i),className:W(`-mb-px flex h-[38px] items-center border-b-2 px-3 text-[13px] whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,i===e?`border-foreground font-semibold`:`border-transparent text-muted-foreground hover:text-foreground`),children:n(i===`details`?`audit.details`:`audit.history`)},i))})}var hO=e=>Array.isArray(e?._readonly)?e._readonly:[];function gO({resource:e,field:t,record:n,plain:r=!1}){let i=X(),a=n?.[t.name];return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-readonly":t.name,children:[(0,b.jsxs)(`span`,{className:W(`flex items-center gap-1.5 font-medium`,r?`text-[12.5px] text-muted-foreground`:`text-sm`),children:[t.label,!r&&(0,b.jsx)(zy,{className:`size-3.5 text-muted-foreground`,"aria-label":i(`form.readOnly`),role:`img`})]}),(0,b.jsx)(`div`,{className:W(`text-sm break-words`,!r&&`min-h-8 rounded-lg bg-muted/50 px-2.5 py-1.5`),children:t.widget===`richtext`&&typeof a==`string`&&a!==``?(0,b.jsx)(NE,{id:`field-${t.name}`,resource:e,field:t,value:a,readOnly:!0}):(0,b.jsx)(lE,{value:a,field:t,record:n,detailed:!0})}),t.help&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.help})]})}function _O({to:e}){let t=X();return(0,b.jsx)(q,{asChild:!0,variant:`outline`,size:`icon`,className:`shrink-0`,children:(0,b.jsx)(bo,{to:e,"aria-label":t(`form.back`),children:(0,b.jsx)(Dv,{className:`ltr:rotate-180`})})})}function vO({schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a,extra:o,badges:s,subtitle:c}){let l=X(),u=Array.isArray(t?._links)?t._links:[];return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,b.jsx)(_O,{to:`/${e.name}`}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:cO(e.label,t,n)}),s.map(e=>(0,b.jsx)(cE,{value:t[e.name],field:e},e.name))]}),c.length>0&&(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:c.join(` · `)}),u.length>0&&(0,b.jsx)(`ul`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-[13px]`,children:u.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-primary hover:underline`,"aria-label":l(`form.externalLink`,{name:e.label}),children:[e.label,(0,b.jsx)(Zv,{className:`size-3.5 rtl:-scale-x-100`,"aria-hidden":!0})]})},`${e.label}:${e.href}`))})]}),(0,b.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[t&&n!==void 0&&(0,b.jsx)(SD,{schema:e,ids:[n]}),t&&n!==void 0&&(0,b.jsx)(xD,{schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a}),o]})]})}function yO({fields:e,before:t,current:n,busy:r,onKeepMine:i,onLoadTheirs:a}){let o=X(),s=e.filter(e=>JSON.stringify(t?.[e.name]??null)!==JSON.stringify(n[e.name]??null));return(0,b.jsxs)(kD,{labelledBy:`conflict-title`,describedBy:`conflict-body`,initialFocus:`[data-autofocus]`,className:`flex flex-col gap-3 text-sm`,children:[(0,b.jsx)(`p`,{id:`conflict-title`,className:`font-medium`,children:o(`form.conflictTitle`)}),(0,b.jsx)(`div`,{id:`conflict-body`,children:s.length>0?(0,b.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1`,children:s.map(e=>(0,b.jsxs)(y.Fragment,{children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsxs)(`dd`,{children:[(0,b.jsx)(`span`,{className:`line-through opacity-60`,children:Px(t?.[e.name],e)}),` → `,Px(n[e.name],e)]})]},e.name))}):(0,b.jsx)(`p`,{children:o(`form.conflictNone`)})}),(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`button`,disabled:r,onClick:i,children:o(`form.keepMine`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,"data-autofocus":!0,onClick:a,children:o(`form.loadTheirs`)})]})]})}function bO(){let{t:e}=Y(),{group:t}=$i(),n=Kg();if(n.isPending)return(0,b.jsx)(G,{children:e(`common.loading`)});if(n.isError)return(0,b.jsx)(G,{tone:`error`,children:n.error.message});let r=Cw(n.data).find(e=>e.key===t);return r?(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:r.label}),(0,b.jsx)(SO,{group:r})]}):(0,b.jsx)(G,{children:e(`common.pageNotFound`)})}function xO({groups:e}){return(0,b.jsx)(`div`,{className:`flex flex-col gap-8`,children:e.map(e=>(0,b.jsxs)(`section`,{"aria-labelledby":`group-${e.key}`,className:`flex flex-col gap-3`,children:[(0,b.jsx)(`h2`,{id:`group-${e.key}`,className:`text-lg font-semibold`,children:(0,b.jsx)(bo,{to:`/g/${e.key}`,className:`hover:underline`,children:e.label})}),(0,b.jsx)(SO,{group:e})]},e.key))})}function SO({group:e}){return(0,b.jsxs)(b.Fragment,{children:[e.resources.length>0&&(0,b.jsx)(TO,{resources:e.resources}),e.pages.length>0&&(0,b.jsx)(wO,{pages:e.pages})]})}var CO=`flex items-center gap-3 rounded-card border bg-card shadow-card p-4 hover:bg-muted/50`;function wO({pages:e}){return(0,b.jsx)(`ul`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>{let t=$w(e.icon,`page`);return(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{to:`/p/${e.name}`,className:CO,children:[(0,b.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-md bg-muted`,children:(0,b.jsx)(t,{className:`size-5 text-muted-foreground`,"aria-hidden":!0})}),(0,b.jsx)(`span`,{className:`truncate font-medium`,children:e.label})]})},e.name)})})}function TO({resources:e}){let{t,locale:n}=Y(),r=ut({queries:e.map(e=>({queryKey:[`count`,e.name],queryFn:()=>Q.list(e.name,new URLSearchParams({pageSize:`1`})),staleTime:6e4}))});return(0,b.jsx)(`ul`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.map((e,i)=>{let a=$w(e.icon,`resource`),o=r[i]?.data,s=o&&o.total!==null?t(o.estimated?`shell.aboutRecords`:`shell.records`,{count:eg(o.total,n)}):void 0;return(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{to:`/${e.name}`,className:CO,children:[(0,b.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-md bg-muted`,children:(0,b.jsx)(a,{className:`size-5 text-muted-foreground`,"aria-hidden":!0})}),(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,b.jsx)(`span`,{className:`truncate font-medium`,children:e.label}),s&&(0,b.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:s})]})]})},e.name)})})}var EO=(e,t=2)=>String(e).padStart(t,`0`),DO=e=>`${EO(e.getFullYear(),4)}-${EO(e.getMonth()+1)}-${EO(e.getDate())}`,OO=e=>new Date(`${e}T00:00:00`).toISOString(),kO=(e,t)=>{let[n,r]=e.split(`-`).map(Number),i=n*12+(r-1)+t;return`${EO(Math.floor(i/12),4)}-${EO(i%12+1)}-01`};function AO(e,t,n,r,i){let a=DO(t),o=(t,n,r,i)=>({period:e,from:OO(t),to:OO(n),previousFrom:OO(r),previousTo:OO(i)}),s=(e,t)=>Math.round((Date.parse(`${t}T00:00:00Z`)-Date.parse(`${e}T00:00:00Z`))/864e5);switch(e){case`day`:return o(a,jS(a,1),jS(a,-1),a);case`week`:return o(jS(a,-6),jS(a,1),jS(a,-13),jS(a,-6));case`month`:{if(n===`persian`){let{jy:e,jm:t}=TS(a),n=ES(e,t,1);return o(n,AS(n,1),AS(n,-1),n)}let e=`${a.slice(0,7)}-01`;return o(e,kO(e,1),kO(e,-1),e)}case`year`:{if(n===`persian`){let{jy:e}=TS(a);return o(ES(e,1,1),ES(e+1,1,1),ES(e-1,1,1),ES(e,1,1))}let e=Number(a.slice(0,4));return o(`${EO(e,4)}-01-01`,`${EO(e+1,4)}-01-01`,`${EO(e-1,4)}-01-01`,`${EO(e,4)}-01-01`)}case`range`:{let e=r??a,t=jS(i??a,1);return o(e,t,jS(e,-s(e,t)),e)}}}function jO(e){if(e===void 0)return;let t=`${Math.abs(e)}%`;return e>0?{tone:`ok`,arrow:`up`,text:t}:e<0?{tone:`bad`,arrow:`down`,text:t}:{tone:`neutral`,arrow:null,text:t}}function MO(e,t,n){let r=Math.max(1,...e.series.flatMap(e=>e.values)),i=Math.max(1,e.labels.length),a=t/i,o=e=>n-e/r*n;return{max:r,gridlines:[.25,.5,.75,1].map(e=>({y:n-e*n,value:r*e})),series:e.series.map(e=>{let r=e.values.map((e,n)=>[i===1?t/2:n*t/(i-1),o(e)]);return{label:e.label,dashed:e.dashed===!0,path:r.map(([e,t],n)=>`${n===0?`M`:`L`}${NO(e)} ${NO(t)}`).join(` `),bars:e.values.map((e,t)=>{let r=a*.6;return{x:t*a+a/2-r/2,y:o(e),width:r,height:n-o(e)}})}})}}var NO=e=>Math.round(e*10)/10,PO=600,FO=200;function IO({title:e,data:t}){let n=X(),r=MO(t,PO,FO),i=Math.max(1,Math.ceil(t.labels.length/6));return(0,b.jsxs)(`div`,{className:`flex flex-col gap-3.5 p-5`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,b.jsx)(`h2`,{className:`text-[15px] font-semibold`,children:e}),t.subtitle&&(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t.subtitle})]}),(0,b.jsx)(`div`,{className:`ms-auto flex gap-4 text-xs text-muted-foreground`,children:t.series.map(e=>(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:e.dashed?`h-0 w-3.5 border-t-2 border-dashed border-muted-foreground`:`h-[3px] w-3.5 rounded-sm bg-primary`}),e.label]},e.label))})]}),(0,b.jsxs)(`svg`,{viewBox:`0 0 ${PO} ${FO}`,preserveAspectRatio:`none`,role:`img`,"aria-label":e,className:`h-[230px] w-full overflow-visible rtl:-scale-x-100`,children:[(0,b.jsx)(`g`,{className:`stroke-border`,children:r.gridlines.map(e=>(0,b.jsx)(`path`,{d:`M0 ${e.y}H${PO}`,vectorEffect:`non-scaling-stroke`},e.y))}),r.series.map((e,n)=>t.kind===`bar`&&!e.dashed?(0,b.jsx)(`g`,{className:`fill-primary`,children:e.bars.map((e,t)=>(0,b.jsx)(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:3},t))},e.label):(0,b.jsxs)(`g`,{children:[!e.dashed&&n===0&&(0,b.jsx)(`path`,{d:`${e.path} L${PO} ${FO} L0 ${FO} Z`,className:`fill-primary/10`}),(0,b.jsx)(`path`,{d:e.path,fill:`none`,vectorEffect:`non-scaling-stroke`,strokeWidth:e.dashed?2:2.5,strokeDasharray:e.dashed?`5 5`:void 0,className:e.dashed||n>0?`stroke-muted-foreground`:`stroke-primary`})]},e.label))]}),(0,b.jsx)(`div`,{"aria-hidden":!0,className:`flex justify-between text-[11.5px] text-muted-foreground`,children:t.labels.filter((e,t)=>t%i===0).map(e=>(0,b.jsx)(`span`,{children:e},e))}),(0,b.jsxs)(`span`,{className:`sr-only`,children:[t.series.map(e=>`${e.label}: ${e.values.map(e=>eg(e)).join(`, `)}`).join(`; `),` `,n(`dashboard.period`)]})]})}var LO={ok:`bg-ok`,warn:`bg-warn`,bad:`bg-bad`,info:`bg-info`,neutral:`bg-muted-foreground`,primary:`bg-primary`};function RO({title:e,data:t}){return(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 p-5`,children:[(0,b.jsx)(`h2`,{className:`text-[15px] font-semibold`,children:e}),(0,b.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:t.items.map((e,t)=>{let n=$w(e.icon,`resource`),r=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-control bg-muted text-muted-foreground`,children:(0,b.jsx)(n,{className:`size-4`,"aria-hidden":!0})}),(0,b.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px]`,children:e.text}),e.status&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:W(`size-2 shrink-0 rounded-full`,LO[e.status])})]});return(0,b.jsx)(`li`,{children:e.link?(0,b.jsx)(bo,{to:e.link,className:`flex items-center gap-3 rounded-control hover:bg-muted`,children:r}):(0,b.jsx)(`div`,{className:`flex items-center gap-3`,children:r})},t)})})]})}function zO({items:e,value:t,onChange:n,className:r}){return(0,b.jsx)(`div`,{role:`tablist`,className:W(`flex w-full gap-0.5 border-b border-border`,r),children:e.map(e=>{let r=e.key===t;return(0,b.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n(e.key),className:W(`-mb-px inline-flex h-[38px] cursor-pointer items-center gap-1.5 border-b-2 border-transparent px-3 text-[13px] text-muted-foreground`,r&&`border-foreground font-semibold text-foreground`),children:[e.label,e.count!==void 0&&(0,b.jsxs)(`span`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-muted px-1.5 text-[11px] text-muted-foreground`,children:[e.estimate?`~`:``,e.count]})]},e.key)})})}function BO({period:e,from:t,to:n,onChange:r}){let i=X(),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(t??``),[l,u]=(0,y.useState)(n??``);return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(zO,{className:`w-auto`,items:[`day`,`week`,`month`,`year`].map(e=>({key:e,label:i(`dashboard.${e}`)})),value:e===`range`?``:e,onChange:e=>r(e)}),(0,b.jsxs)(Sh,{open:a,onOpenChange:o,children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsx)(q,{variant:e===`range`?`secondary`:`outline`,size:`icon`,"aria-label":i(`dashboard.range`),"aria-pressed":e===`range`,children:(0,b.jsx)(hv,{})})}),(0,b.jsx)(wh,{children:(0,b.jsxs)(Th,{align:`end`,sideOffset:6,className:`z-50 flex w-72 flex-col gap-3 rounded-[10px] border bg-popover p-3 shadow-lg`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,b.jsx)(kh,{htmlFor:`dashboard-from`,children:i(`filters.from`)}),(0,b.jsx)(zS,{id:`dashboard-from`,label:i(`filters.from`),value:s,onChange:c,live:!0})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,b.jsx)(kh,{htmlFor:`dashboard-to`,children:i(`filters.to`)}),(0,b.jsx)(zS,{id:`dashboard-to`,label:i(`filters.to`),value:l,onChange:u,live:!0})]}),(0,b.jsx)(q,{disabled:!/^\d{4}-\d{2}-\d{2}$/.test(s)||!/^\d{4}-\d{2}-\d{2}$/.test(l)||s>l,onClick:()=>{o(!1),r(`range`,s,l)},children:i(`dashboard.apply`)})]})})]})]})}var VO=42,HO=2*Math.PI*VO;function UO({title:e,data:t}){let n=Math.max(0,Math.min(100,t.percent));return(0,b.jsxs)(`div`,{className:`flex items-center gap-5 p-5`,children:[(0,b.jsxs)(`svg`,{viewBox:`0 0 100 100`,role:`img`,"aria-label":tg(t.value),className:`size-[104px] shrink-0 -rotate-90`,children:[(0,b.jsx)(`circle`,{cx:`50`,cy:`50`,r:VO,fill:`none`,strokeWidth:10,className:`stroke-muted`}),(0,b.jsx)(`circle`,{cx:`50`,cy:`50`,r:VO,fill:`none`,strokeWidth:10,strokeLinecap:`round`,strokeDasharray:`${n/100*HO} ${HO}`,className:`stroke-primary`})]}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,b.jsx)(`div`,{className:`text-2xl leading-tight font-bold`,children:tg(t.value)}),(0,b.jsx)(`h2`,{className:`text-sm font-semibold`,children:e}),(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t.caption})]})]})}function WO({title:e,data:t}){let n=jO(t.change);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 px-5 py-[18px]`,children:[(0,b.jsx)(`div`,{className:`text-[13px] font-medium text-muted-foreground`,children:e}),(0,b.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,b.jsx)(`span`,{className:`text-[26px] leading-[1.3] font-bold`,children:tg(t.value)}),t.unit&&(0,b.jsx)(`span`,{className:`text-[13px] text-muted-foreground`,children:t.unit})]}),(n||t.previousLabel)&&(0,b.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[n&&(0,b.jsxs)(`span`,{className:W(`inline-flex items-center gap-0.5 rounded-full px-1.5 py-0.5 font-medium`,n.tone===`ok`?`bg-ok-bg text-ok`:n.tone===`bad`?`bg-bad-bg text-bad`:`bg-muted text-muted-foreground`),children:[n.arrow===`up`&&(0,b.jsx)(Z_,{className:`size-3`,"aria-hidden":!0}),n.arrow===`down`&&(0,b.jsx)(q_,{className:`size-3`,"aria-hidden":!0}),tg(n.text)]}),t.previousLabel&&(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:t.previousLabel})]})]})}function GO({title:e,data:t}){let n=X(),r=t.link?`/${t.link.resource}${t.link.filter?`?${new URLSearchParams(t.link.filter)}`:``}`:void 0;return(0,b.jsxs)(`div`,{className:`flex flex-col`,children:[(0,b.jsxs)(`div`,{className:`flex min-h-14 items-center gap-2 border-b px-5 py-3`,children:[(0,b.jsx)(`h2`,{className:`flex-1 text-[15px] font-semibold`,children:e}),r&&(0,b.jsxs)(bo,{to:r,className:`inline-flex items-center gap-1 text-[13px] font-medium text-primary hover:underline`,children:[n(`dashboard.viewAll`),(0,b.jsx)(Tv,{className:`size-3.5 ltr:rotate-180`,"aria-hidden":!0})]})]}),(0,b.jsx)(`div`,{className:`overflow-x-auto`,children:(0,b.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,b.jsx)(`thead`,{className:`bg-[color-mix(in_oklab,var(--muted)_50%,transparent)] text-[12.5px] text-muted-foreground`,children:(0,b.jsx)(`tr`,{children:t.columns.map(e=>(0,b.jsx)(`th`,{className:`px-3.5 py-2.5 text-start font-medium whitespace-nowrap`,children:e.label},e.key))})}),(0,b.jsx)(`tbody`,{children:t.rows.map((e,n)=>(0,b.jsx)(`tr`,{className:`border-t`,children:t.columns.map(t=>{let n=e[t.key];return(0,b.jsx)(`td`,{className:`px-3.5 py-2.5 whitespace-nowrap`,children:typeof n==`object`&&n?(0,b.jsx)(aE,{tone:n.tone,children:n.label}):typeof n==`number`?eg(n):tg(String(n??``))},t.key)})},n))})]})})]})}var KO=[`day`,`week`,`month`,`year`,`range`],qO={1:`lg:col-span-4`,2:`lg:col-span-6`,3:`lg:col-span-8`,4:`lg:col-span-12`};function JO(){let{t:e,calendar:t}=Y(),[n,r]=wo(),i=n.get(`period`),a=i&&KO.includes(i)?i:`week`,o=n.get(`from`)??void 0,s=n.get(`to`)??void 0,c=AO(a,new Date,t===`persian`?`persian`:`gregory`,o,s),l=ft({queryKey:[`dashboard`],queryFn:Q.dashboard});return(0,b.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:e(`dashboard.title`)}),(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:e(`dashboard.subtitle`)})]}),(0,b.jsx)(`div`,{className:`ms-auto`,children:(0,b.jsx)(BO,{period:a,from:o,to:s,onChange:(e,t,n)=>r(e===`range`?{period:e,from:t,to:n}:e===`week`?{}:{period:e})})})]}),l.isPending&&(0,b.jsx)(G,{children:e(`common.loading`)}),l.isError&&(0,b.jsx)(G,{tone:`error`,children:pg(l.error)}),l.data&&(0,b.jsx)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-12`,children:l.data.widgets.map(e=>(0,b.jsx)(YO,{widget:e,params:c},e.name))})]})}function YO({widget:e,params:t}){let{t:n}=Y(),r=ft({queryKey:[`dashboard`,e.name,t],queryFn:()=>Q.widget(e.name,t),retry:!1}),i=e.type===`stat`?`lg:col-span-3`:qO[e.size];return(0,b.jsxs)(`section`,{"aria-label":e.title,"data-widget":e.name,className:W(`min-w-0 overflow-hidden rounded-card border bg-card shadow-card`,i),children:[r.isPending&&(0,b.jsxs)(`div`,{"aria-hidden":!0,className:`flex flex-col gap-3 p-5`,children:[(0,b.jsx)(`div`,{className:`h-4 w-1/3 animate-pulse rounded bg-muted`}),(0,b.jsx)(`div`,{className:`h-8 w-2/3 animate-pulse rounded bg-muted`})]}),r.isError&&(0,b.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 p-5 text-[13px]`,children:[(0,b.jsx)(`span`,{className:`font-semibold`,children:e.title}),(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:n(`dashboard.failed`)}),(0,b.jsx)(q,{size:`sm`,variant:`outline`,onClick:()=>void r.refetch(),children:n(`dashboard.retry`)})]}),r.data&&(0,b.jsx)(XO,{type:e.type,title:e.title,data:r.data})]})}function XO({type:e,title:t,data:n}){switch(e){case`stat`:return(0,b.jsx)(WO,{title:t,data:n});case`chart`:return(0,b.jsx)(IO,{title:t,data:n});case`table`:return(0,b.jsx)(GO,{title:t,data:n});case`progress`:return(0,b.jsx)(UO,{title:t,data:n});case`list`:return(0,b.jsx)(RO,{title:t,data:n})}}function ZO(){let e=X(),t=Kg();if(t.isPending)return(0,b.jsx)(G,{children:e(`common.loading`)});if(t.isError)return(0,b.jsx)(G,{tone:`error`,children:t.error.message});if(t.data.dashboard)return(0,b.jsx)(JO,{});let n=Cw(t.data);return n.length===0?(0,b.jsx)(G,{children:e(`shell.noResources`)}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:t.data.title}),(0,b.jsx)(xO,{groups:n})]})}var QO={order:[],hidden:[],widths:{},density:`comfortable`},$O=e=>`nma.columns.${e}`;function ek(e,t){return tk(e,t).filter(e=>!t.hidden.includes(e))}function tk(e,t){let n=t.order.filter(t=>e.includes(t));return[...n,...e.filter(e=>!n.includes(e))]}function nk(e){let t=new Map,n=new Set,r=n=>{let r=t.get(n);if(!r){r=QO;try{let t=e?.getItem($O(n));t&&(r={...QO,...JSON.parse(t)})}catch{r=QO}t.set(n,r)}return r},i=(r,i)=>{t.set(r,i);try{e?.setItem($O(r),JSON.stringify(i))}catch{}for(let e of n)e()};return{get:r,subscribe(e){return n.add(e),()=>n.delete(e)},toggle(e,t){let n=r(e),a=n.hidden.includes(t)?n.hidden.filter(e=>e!==t):[...n.hidden,t];i(e,{...n,hidden:a})},move(e,t,n,a){let o=r(e),s=tk(t,o),c=s.indexOf(n),l=c+a;c<0||l<0||l>=s.length||([s[c],s[l]]=[s[l],s[c]],i(e,{...o,order:s}))},setWidth(e,t,n){let a=r(e),o=Math.round(Math.min(600,Math.max(60,n)));i(e,{...a,widths:{...a.widths,[t]:o}})},setDensity(e,t){i(e,{...r(e),density:t})},reset(r){try{e?.removeItem($O(r))}catch{}t.set(r,QO);for(let e of n)e()}}}function rk(){try{return typeof localStorage>`u`?void 0:localStorage}catch{return}}var ik=nk(rk());function ak(e){return(0,y.useSyncExternalStore)(ik.subscribe,()=>ik.get(e))}function ok({schema:e,prefs:t}){let n=X(),r=tk(e.list.columns,t),i=t=>e.list.computed?.[t]?.label??e.fields.find(e=>e.name===t)?.label??t,a=r.filter(e=>!t.hidden.includes(e));return(0,b.jsxs)(Sh,{children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsxs)(q,{variant:`outline`,size:`sm`,className:`hidden md:inline-flex`,children:[(0,b.jsx)(Fv,{}),n(`list.columns`),(0,b.jsx)(Cv,{className:`text-muted-foreground`})]})}),(0,b.jsx)(wh,{children:(0,b.jsxs)(Th,{align:`end`,sideOffset:4,className:`z-50 flex w-72 flex-col gap-3 rounded-[10px] border bg-popover p-3 text-popover-foreground shadow-lg`,children:[(0,b.jsx)(`ul`,{"aria-label":n(`list.columns`),className:`flex flex-col gap-0.5`,children:r.map((o,s)=>{let c=!t.hidden.includes(o);return(0,b.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md px-1 py-0.5 hover:bg-accent`,children:[(0,b.jsxs)(`label`,{className:`flex flex-1 cursor-pointer items-center gap-2 text-sm`,children:[(0,b.jsx)(ff,{checked:c,disabled:c&&a.length===1,onCheckedChange:()=>ik.toggle(e.name,o),className:`flex size-4 items-center justify-center rounded border border-input disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,children:(0,b.jsx)(mf,{children:(0,b.jsx)(xv,{className:`size-3`})})}),i(o)]}),(0,b.jsx)(q,{variant:`ghost`,size:`icon-sm`,"aria-label":n(`list.moveUp`,{name:i(o)}),disabled:s===0,onClick:()=>ik.move(e.name,e.list.columns,o,-1),children:(0,b.jsx)(Z_,{})}),(0,b.jsx)(q,{variant:`ghost`,size:`icon-sm`,"aria-label":n(`list.moveDown`,{name:i(o)}),disabled:s===r.length-1,onClick:()=>ik.move(e.name,e.list.columns,o,1),children:(0,b.jsx)(q_,{})})]},o)})}),(0,b.jsx)(`div`,{role:`radiogroup`,"aria-label":n(`list.density`),className:`flex gap-1`,children:[`comfortable`,`compact`].map(r=>(0,b.jsx)(q,{role:`radio`,"aria-checked":t.density===r,variant:t.density===r?`secondary`:`ghost`,size:`sm`,onClick:()=>ik.setDensity(e.name,r),children:n(r===`compact`?`list.compact`:`list.comfortable`)},r))}),(0,b.jsx)(q,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>ik.reset(e.name),children:n(`list.resetColumns`)})]})})]})}function sk({resource:e,column:t,label:n,width:r}){let i=X(),a=(0,y.useRef)(null);return(0,b.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":i(`list.resize`,{name:n}),"aria-valuenow":r,tabIndex:0,className:W(`absolute inset-y-1 end-0 w-1.5 cursor-col-resize touch-none rounded bg-transparent hover:bg-border focus-visible:bg-ring`),onPointerDown:e=>{let t=e.currentTarget.parentElement;a.current={x:e.clientX,width:t.getBoundingClientRect().width,rtl:getComputedStyle(t).direction===`rtl`},e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:n=>{if(!a.current)return;let r=(n.clientX-a.current.x)*(a.current.rtl?-1:1);ik.setWidth(e,t,a.current.width+r)},onPointerUp:()=>a.current=null,onKeyDown:n=>{if(n.key!==`ArrowLeft`&&n.key!==`ArrowRight`)return;n.preventDefault();let i=r??n.currentTarget.parentElement.getBoundingClientRect().width,a=getComputedStyle(n.currentTarget).direction===`rtl`,o=n.key===`ArrowRight`!==a;ik.setWidth(e,t,i+(o?10:-10))},onClick:e=>e.stopPropagation()})}var ck=`h-7 w-full min-w-20 rounded-md border border-input bg-background px-2 text-sm outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 aria-invalid:border-destructive`;function lk({schema:e,item:t,field:n}){let r=X(),i=S(),[a,o]=(0,y.useState)(!1),s=TC([n],t)[n.name],[c,l]=(0,y.useState)(s),[u,d]=(0,y.useState)(null),f=pt({mutationFn:n=>Q.update(e.name,String(t._id),n,e.version?t[e.version]:void 0),onSuccess:n=>{i.setQueriesData({queryKey:[`list`,e.name]},e=>e&&{...e,items:e.items.map(e=>e._id===n._id?{...e,...n}:e)}),i.removeQueries({queryKey:[`record`,e.name,String(t._id)]}),o(!1),d(null)},onError:e=>{d(e instanceof fg?e.fields[n.name]?.join(` `)??e.message:e.message),l(s),o(!1)}});function p(t=c){if(t===s){o(!1);return}let{payload:r,errors:i}=DC([n],{[n.name]:t},{[n.name]:s}),a=_D(r,{[n.name]:e.form.constraints.update[n.name]??{}},`update`),l=i[n.name]??a[n.name];if(l){d(l.join(` `));return}f.mutate(r)}let m=e=>{e.key===`Enter`?(e.preventDefault(),p()):e.key===`Escape`&&(e.preventDefault(),l(s),d(null),o(!1))},h=`cell-${e.name}-${String(t._id)}-${n.name}-error`,g={"aria-label":n.label,"aria-invalid":u?!0:void 0,"aria-describedby":u?h:void 0,autoFocus:!0,disabled:f.isPending,className:ck,onKeyDown:m},_;if(!a)_=(0,b.jsx)(`button`,{type:`button`,className:W(`-mx-1 rounded px-1 text-start hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none`,u&&`text-destructive`),"aria-label":r(`list.editCell`,{name:n.label,value:Px(t[n.name],n)}),onClick:()=>{l(s),o(!0)},children:(0,b.jsx)(lE,{value:t[n.name],field:n})});else if(n.type===`enum`||n.type===`boolean`){let e=n.type===`boolean`?[[`true`,r(`common.yes`)],[`false`,r(`common.no`)]]:(n.enumValues??[]).map(e=>[e,NC(n,e)]);_=(0,b.jsxs)(`select`,{...g,value:String(c),onChange:e=>{let t=n.type===`boolean`?e.target.value===`true`:e.target.value;l(t),p(t)},onBlur:()=>o(!1),children:[n.nullable&&n.type===`enum`&&(0,b.jsx)(`option`,{value:``,children:r(`common.empty`)}),e.map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))]})}else if(n.type===`date`)_=(0,b.jsx)(zS,{id:`cell-${e.name}-${String(t._id)}-${n.name}`,label:n.label,value:String(c),onChange:e=>{l(e),p(e)},autoFocus:!0,"aria-invalid":u?!0:void 0,"aria-describedby":u?h:void 0,className:`min-w-44`,onKeyDown:m});else{let e=n.type===`number`||n.type===`decimal`||n.type===`bigint`;_=(0,b.jsx)(`input`,{...g,type:`text`,inputMode:e?n.type===`bigint`?`numeric`:`decimal`:void 0,value:String(c),onChange:e=>l(e.target.value),onBlur:()=>p()})}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-0.5`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[_,u&&(0,b.jsx)(`p`,{id:h,role:`alert`,className:`text-xs text-destructive`,children:u})]})}var uk=e=>e.total===null?e.hasMore===!0:e.page*e.pageSize<e.total;function dk({schema:e,query:t,columns:n,trash:r,selectMode:i,selected:a,onSelect:o,restore:s,empty:c}){let l=X(),u=e.list.pagination===`keyset`,d=mt({queryKey:[`list`,e.name,`cards`,t],initialPageParam:void 0,queryFn:({pageParam:n})=>{let r=new URLSearchParams(t);return n&&r.set(u?`after`:`page`,n),Q.list(e.name,r)},getNextPageParam:e=>u?e.nextCursor??void 0:uk(e)?String(e.page+1):void 0}),f=new Set,p=(d.data?.pages??[]).flatMap(e=>e.items).filter(e=>{let t=String(e._id);return!f.has(t)&&(f.add(t),!0)}),m=d.data?.pages[0]?.total??null,h=(0,y.useRef)(null),{hasNextPage:g,isFetchingNextPage:_,fetchNextPage:v}=d;(0,y.useEffect)(()=>{let e=h.current;if(!e||!g||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&!_&&v()},{rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},[g,_,v]);let x=e=>{let t=new Set(a);t.has(e)?t.delete(e):t.add(e),o(t)};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsxs)(`ul`,{"aria-label":e.label,"aria-busy":d.isFetching,className:`flex flex-col gap-2.5`,children:[d.isPending&&Array.from({length:4},(e,t)=>(0,b.jsx)(`li`,{"aria-hidden":!0,className:`h-20 animate-pulse rounded-card border bg-muted/40`},`skeleton-${t}`)),p.map(t=>{let o=String(t._id),c=(0,b.jsx)(fk,{schema:e,item:t,columns:n});return(0,b.jsx)(`li`,{children:r?(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-2 rounded-card border bg-card p-3 shadow-card`,children:[c,s(t)]}):i?(0,b.jsxs)(`label`,{className:W(`flex cursor-pointer items-start gap-3 rounded-card border bg-card p-3 shadow-card`,a.has(o)&&`border-primary bg-primary-soft`),children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 accent-primary`,checked:a.has(o),onChange:()=>x(o),"aria-label":l(`list.selectRow`,{name:String(t._title??o)})}),c]}):(0,b.jsx)(bo,{to:`/${e.name}/${encodeURIComponent(o)}`,className:`block rounded-card border bg-card p-3 shadow-card active:bg-muted`,children:c})},o)}),d.isSuccess&&p.length===0&&(0,b.jsx)(`li`,{className:`flex flex-col items-center gap-2 py-6 text-center text-sm text-muted-foreground`,children:c})]}),d.isError&&(0,b.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[(0,b.jsx)(`span`,{children:l(`list.loadFailed`)}),(0,b.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void d.refetch(),children:l(`list.retry`)})]}),(0,b.jsxs)(`div`,{ref:h,className:`flex flex-col items-center gap-2 py-2 text-sm text-muted-foreground`,children:[p.length>0&&(0,b.jsx)(`span`,{children:m===null?l(`list.showing`,{shown:eg(p.length)}):l(`list.showingOf`,{shown:eg(p.length),total:eg(m)})}),g&&(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:_,onClick:()=>void v(),children:l(_?`common.loading`:`list.loadMore`)})]})]})}function fk({schema:e,item:t,columns:n}){let r=Object.entries(e.list.computed??{}).filter(([t])=>e.list.columns.includes(t));if(r.length>0)return(0,b.jsx)(pk,{schema:e,item:t,computed:r});let i=e.list.mobile,a=typeof t._title==`string`?t._title:String(t._id);if(!i)return(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`div`,{className:`text-[14.5px] font-semibold`,children:a}),(0,b.jsx)(`dl`,{className:`mt-1 grid grid-cols-2 gap-x-3 gap-y-0.5 text-sm`,children:n.filter(e=>Px(t[e.name],e)!==t._title).map(e=>(0,b.jsxs)(y.Fragment,{children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{className:`truncate`,children:(0,b.jsx)(lE,{value:t[e.name],field:e,record:t,plain:!0})})]},e.name))})]});let o=t=>t?e.fields.find(e=>e.name===t):void 0,s=o(i.title),c=o(i.subtitle),l=o(i.badge),u=i.meta.map(o).filter(e=>e!==void 0);return(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,b.jsx)(`span`,{className:`min-w-0 truncate text-[14.5px] font-semibold`,children:s?Px(t[s.name],s):a}),l&&t[l.name]!==null&&t[l.name]!==void 0&&(0,b.jsx)(cE,{value:t[l.name],field:l,className:`shrink-0`})]}),c&&(0,b.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:Px(t[c.name],c)}),u.length>0&&(0,b.jsx)(`dl`,{className:`mt-1 flex flex-wrap gap-x-4 gap-y-0.5 text-sm`,children:u.map(e=>(0,b.jsxs)(`div`,{className:`flex gap-1`,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(lE,{value:t[e.name],field:e,record:t,plain:!0})})]},e.name))})]})}function pk({schema:e,item:t,computed:n}){let r=e=>n.filter(([,t])=>t.kind===e),i=([n,r],i=!0)=>(0,b.jsx)(zD,{schema:e,name:n,column:r,item:t,compact:i},n),[a]=r(`image`),[o]=r(`title`);return(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-3`,children:[a&&i(a),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,b.jsx)(`div`,{className:`min-w-0 flex-1`,children:o?i(o):(0,b.jsx)(`span`,{className:`text-[14.5px] font-semibold`,children:typeof t._title==`string`?t._title:String(t._id)})}),r(`toggle`).map(e=>i(e))]}),r(`money`).map(e=>i(e)),(r(`badge`).length>0||r(`count`).length>0)&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[r(`badge`).map(e=>i(e)),r(`count`).map(([e,n])=>(0,b.jsxs)(aE,{tone:`neutral`,children:[RD(n,t._computed?.[e]).text,` `,n.label]},e))]})]})]})}function mk({schema:e,item:t,onClose:n}){let r=X(),i=(0,y.useRef)(null);t&&!i.current&&(i.current=document.activeElement);let a=t?String(t._id):void 0,o=Zg(e.name,a).data??t,s=typeof o?._title==`string`?o._title:`#${a}`,c=e.fields.filter(e=>e.persisted&&!e.name.includes(`.`)&&o!==void 0&&Object.hasOwn(o,e.name));return(0,b.jsx)(jd,{open:t!==void 0,onOpenChange:e=>!e&&n(),children:(0,b.jsxs)(Ld,{children:[(0,b.jsx)(zd,{className:US}),(0,b.jsxs)(Ud,{className:`fixed inset-y-0 end-0 z-50 flex w-full max-w-md flex-col border-s bg-background shadow-xl outline-none`,"aria-describedby":void 0,onCloseAutoFocus:e=>{e.preventDefault(),i.current?.focus(),i.current=null},children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 border-b p-4`,children:[(0,b.jsx)(Jd,{className:`min-w-0 flex-1 truncate text-lg font-semibold`,children:r(`list.quickView`,{name:s})}),(0,b.jsx)(Xd,{asChild:!0,children:(0,b.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":r(`list.close`),children:(0,b.jsx)(Cx,{})})})]}),(0,b.jsx)(`dl`,{className:`grid flex-1 grid-cols-[minmax(6rem,auto)_1fr] content-start gap-x-4 gap-y-2 overflow-y-auto p-4 text-sm`,children:c.map(e=>(0,b.jsxs)(`div`,{className:`contents`,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{className:`break-words`,children:(0,b.jsx)(lE,{value:o[e.name],field:e,record:o,detailed:!0})})]},e.name))}),(0,b.jsxs)(`div`,{className:`flex gap-2 border-t p-4`,children:[(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/${e.name}/${encodeURIComponent(a??``)}`,children:[(0,b.jsx)(sb,{}),r(`list.edit`)]})}),(0,b.jsx)(Xd,{asChild:!0,children:(0,b.jsx)(q,{variant:`outline`,children:r(`list.close`)})})]})]})]})})}function hk({className:e,...t}){return(0,b.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full`,children:(0,b.jsx)(`table`,{"data-slot":`table`,className:W(`w-full caption-bottom text-[13px]`,e),...t})})}function gk({className:e,...t}){return(0,b.jsx)(`thead`,{"data-slot":`table-header`,className:W(`[&_tr]:border-b`,e),...t})}function _k({className:e,...t}){return(0,b.jsx)(`tbody`,{"data-slot":`table-body`,className:W(`[&_tr:last-child]:border-0`,e),...t})}function vk({className:e,...t}){return(0,b.jsx)(`tr`,{"data-slot":`table-row`,className:W(`border-b border-border transition-colors hover:bg-[color-mix(in_oklab,var(--muted)_60%,transparent)] has-aria-expanded:bg-muted/50 data-[state=selected]:bg-primary-soft`,e),...t})}function yk({className:e,...t}){return(0,b.jsx)(`th`,{"data-slot":`table-head`,className:W(`px-3.5 py-2.5 text-start align-middle text-[12.5px] font-medium whitespace-nowrap text-muted-foreground bg-[color-mix(in_oklab,var(--muted)_50%,transparent)] [&:has([role=checkbox])]:pe-0`,e),...t})}function bk({className:e,...t}){return(0,b.jsx)(`td`,{"data-slot":`table-cell`,className:W(`px-3.5 py-2.5 align-middle whitespace-nowrap [&:has([role=checkbox])]:pe-0`,e),...t})}function xk(e){let t=e.map(e=>String(e).replace(/~/g,`~0`).replace(/,/g,`~1`)).join(`,`);return t===`new`?`~new`:t}function Sk(){let{resource:e=``}=$i(),[t,n]=wo(),r=Math.max(1,Number(t.get(`page`))||1),i=t.get(`sort`)??void 0,a=qg(e),o=jC(),s=Xg(e,YS(t),!o),[c,l]=(0,y.useState)(!1),u=S(),d=X(),f=pt({mutationFn:t=>Q.restore(e,t),onSuccess:()=>u.invalidateQueries({queryKey:[`list`,e]})}),p=t.get(`trashed`)===`only`,m=ak(e),h=YS(t),g=(()=>{let e=new URLSearchParams(h);return e.delete(`page`),e.delete(`after`),e.toString()})(),[_,v]=(0,y.useState)(new Set);(0,y.useEffect)(()=>v(new Set),[h,e]);let[x,C]=(0,y.useState)(),[w,T]=(0,y.useState)(!1),[E,D]=(0,y.useState)();(0,y.useEffect)(()=>D(void 0),[e]);let O=pt({mutationFn:t=>Q.bulkDelete(e,t),onSuccess:async t=>{v(new Set),T(!1),D({title:d(`list.bulkDeleted`,{count:t.ok.length}),result:t}),await u.invalidateQueries({queryKey:[`list`,e]})},onError:()=>T(!1)}),[k,A]=(0,y.useState)([]),j=t.has(`after`);if((0,y.useEffect)(()=>{j||A([])},[j]),a.isPending)return(0,b.jsx)(G,{children:d(`common.loading`)});if(a.isError)return(0,b.jsx)(G,{tone:`error`,children:a.error.message});let M=a.data,N=ek(M.list.columns,m).flatMap(e=>{let t=M.list.computed?.[e];if(t)return[{name:e,label:t.label,computed:t}];let n=M.fields.find(t=>t.name===e);return n?[{name:e,label:n.label,field:n}]:[]}),ee=N.flatMap(e=>e.field&&!M.primaryKeys.includes(e.name)?[e.field]:[]);for(let e=N.length-2;e>=0;e--)N[e].computed?.kind===`image`&&N[e+1].computed?.kind===`title`&&(N[e+1]={...N[e+1],image:N[e]},N.splice(e,1));let P=N.findIndex(e=>e.computed?.kind!==`image`&&e.computed?.kind!==`toggle`),F=i?{field:i.replace(/^-/,``),direction:i.startsWith(`-`)?`desc`:`asc`}:M.list.defaultSort,te=s.data?.items??[],ne=M.list.pagination===`keyset`,re=t.get(`after`),ie=ne?{summary:eC(s.data,1).summary,label:d(`list.page`,{page:k.length+1}),hasNext:!!s.data?.nextCursor}:eC(s.data,r),ae=ne?k.length>0:r>1;function oe(){if(!ne)return fe({page:String(r+1)});A([...k,re??``]),fe({after:s.data?.nextCursor??null})}function se(){if(!ne)return fe({page:String(r-1)});let e=k[k.length-1];A(k.slice(0,-1)),fe({after:e||null})}let ce=M.permissions??{create:!0,update:!0,delete:!0,purge:!0},le=!p&&(ce.delete||XE(M,[]).length>0||(M.prints??[]).some(e=>e.bulk)),ue=XE(M,te.filter(e=>_.has(String(e._id)))),de=e=>`/${M.name}/${encodeURIComponent(String(e._id))}`;function fe(e){n(t=>$S(t,e))}function pe(e){fe({sort:F.field===e&&F.direction===`asc`?`-${e}`:e})}let me=`border-transparent bg-transparent text-inherit hover:bg-background/15`,I=le&&_.size>0&&(0,b.jsxs)(`div`,{role:`region`,"aria-label":d(`list.selected`,{count:_.size}),className:W(`flex flex-wrap items-center gap-2 text-sm`,o?`fixed inset-x-3 bottom-4 z-30 rounded-[14px] bg-foreground py-1.5 ps-2 pe-1.5 text-background shadow-[0_12px_32px_rgba(0,0,0,.25)]`:`border-b bg-primary-soft px-3.5 py-2`),children:[(0,b.jsx)(`span`,{className:W(`font-semibold`,o?`flex-1 text-sm`:`pe-1.5 text-primary`),children:d(`list.selected`,{count:_.size})}),(0,b.jsx)(SD,{schema:M,ids:[..._],bulkOnly:!0,size:`sm`}),ue.map(e=>(0,b.jsx)(bD,{resource:M.name,action:e,ids:[..._],size:`sm`,className:o?me:void 0,onDone:(t,n)=>{let r=nD(t,n);v(new Set),O.reset(),D({title:d(`action.bulkDone`,{action:e.label,count:r.ok.length}),result:r})}},e.name)),ce.delete?w?(0,b.jsx)(q,{variant:`destructive`,size:`sm`,disabled:O.isPending,onClick:()=>O.mutate([..._]),children:d(`list.confirmDeleteSelected`,{count:_.size})}):(0,b.jsxs)(q,{variant:`outline`,size:o?`icon-sm`:`sm`,className:o?me:`text-destructive`,"aria-label":o?d(`list.deleteSelected`):void 0,onClick:()=>T(!0),children:[(0,b.jsx)(rx,{}),!o&&d(`list.deleteSelected`)]}):null,(0,b.jsx)(q,{variant:`ghost`,size:o?`icon-sm`:`sm`,className:o?W(me,`-order-1`):`ms-auto`,"aria-label":o?d(`list.clearSelection`):void 0,onClick:()=>v(new Set),children:o?(0,b.jsx)(Cx,{}):d(`list.clearSelection`)})]});return(0,b.jsxs)(`div`,{className:W(`flex flex-col gap-4`,o&&_.size>0&&`pb-16`),children:[(0,b.jsxs)(`div`,{className:W(`flex flex-wrap gap-3`,o?`items-center gap-2`:`items-end`),children:[(0,b.jsxs)(`div`,{className:W(`flex gap-0.5`,o?`items-baseline gap-1.5`:`flex-col`),children:[(0,b.jsx)(`h1`,{className:o?`text-base font-semibold`:`text-[22px] font-bold`,children:M.label}),s.data&&s.data.total!==null&&(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:eC(s.data,r).summary})]}),(0,b.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[M.softDelete&&ce.delete&&(0,b.jsxs)(q,{variant:p?`secondary`:`outline`,size:o?`icon`:`default`,"aria-pressed":p,"aria-label":o?d(`list.trash`):void 0,onClick:()=>fe({trashed:p?null:`only`}),children:[(0,b.jsx)(rx,{}),!o&&d(`list.trash`)]}),o&&le&&(0,b.jsx)(q,{variant:c?`secondary`:`outline`,size:`icon`,"aria-pressed":c,"aria-label":d(c?`list.done`:`list.select`),onClick:()=>{l(!c),v(new Set)},children:(0,b.jsx)(Ny,{})}),!p&&ZE(M).map(e=>(0,b.jsx)(bD,{resource:M.name,action:e,onDone:()=>void 0},e.name)),!p&&(0,b.jsx)(CD,{schema:M,query:Dk(t),iconOnly:o}),M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,size:o?`icon`:`default`,className:W(o&&`size-10`),children:(0,b.jsxs)(bo,{to:`/${M.name}/new`,"aria-label":o?d(`list.new`):void 0,children:[(0,b.jsx)(hb,{}),!o&&d(`list.new`)]})})]})]}),M.list.tabs&&M.list.tabs.length>0&&!p&&(0,b.jsx)(Ck,{schema:M,params:t,onChange:fe}),(0,b.jsx)(IC,{schema:M,params:t,onChange:fe,trailing:(0,b.jsx)(ok,{schema:M,prefs:m})}),s.isError&&(0,b.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[(0,b.jsxs)(`span`,{children:[d(`list.loadFailed`),` `,pg(s.error)]}),(0,b.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void s.refetch(),children:d(`list.retry`)})]}),f.isError&&(0,b.jsx)(G,{tone:`error`,children:pg(f.error)}),p&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d(`list.trashNote`)}),o&&I,E&&(0,b.jsx)(Ek,{title:E.title,result:E.result,items:te}),O.isError&&(0,b.jsx)(G,{tone:`error`,children:pg(O.error)}),o?(0,b.jsx)(dk,{schema:M,query:g,columns:ee,trash:p,selectMode:c,selected:_,onSelect:v,restore:e=>(0,b.jsx)(Tk,{item:e,pending:f.isPending,onRestore:e=>f.mutate(e)}),empty:(0,b.jsxs)(b.Fragment,{children:[d(ZS(t)?`list.noMatches`:`list.noRecords`),!ZS(t)&&M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,size:`sm`,variant:`outline`,children:(0,b.jsxs)(bo,{to:`/${M.name}/new`,children:[(0,b.jsx)(hb,{}),d(`list.new`)]})})]})}):(0,b.jsx)(b.Fragment,{children:(0,b.jsxs)(`section`,{className:`overflow-hidden rounded-card border bg-card shadow-card`,children:[I,(0,b.jsx)(`div`,{className:`overflow-x-auto`,children:(0,b.jsxs)(hk,{className:W(m.density===`compact`&&`[&_td]:py-1 [&_th]:h-8`),children:[(0,b.jsx)(gk,{children:(0,b.jsxs)(vk,{children:[le&&(0,b.jsx)(yk,{className:`w-0`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":d(`list.selectPage`),checked:te.length>0&&te.every(e=>_.has(String(e._id))),onChange:e=>v(e.target.checked?new Set(te.map(e=>String(e._id))):new Set)})}),N.map(e=>(0,b.jsxs)(yk,{className:`relative`,style:m.widths[e.name]?{width:m.widths[e.name],minWidth:m.widths[e.name]}:void 0,"aria-sort":F.field===e.name?F.direction===`asc`?`ascending`:`descending`:void 0,children:[M.list.sortable.includes(e.name)?(0,b.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1`,onClick:()=>pe(e.name),children:[e.label,F.field===e.name&&(F.direction===`asc`?(0,b.jsx)(Z_,{className:`size-3.5`}):(0,b.jsx)(q_,{className:`size-3.5`}))]}):e.label,(0,b.jsx)(sk,{resource:M.name,column:e.name,label:e.label,width:m.widths[e.name]})]},e.name)),p&&(0,b.jsx)(yk,{className:`w-0`,children:(0,b.jsx)(`span`,{className:`sr-only`,children:d(`list.actions`)})})]})}),(0,b.jsxs)(_k,{children:[s.isPending&&Array.from({length:5},(e,t)=>(0,b.jsxs)(vk,{"aria-hidden":!0,children:[le&&(0,b.jsx)(bk,{}),N.map(e=>(0,b.jsx)(bk,{children:(0,b.jsx)(`div`,{className:`h-4 w-3/4 animate-pulse rounded bg-muted`})},e.name))]},`skeleton-${t}`)),te.map(e=>(0,b.jsxs)(vk,{"data-state":_.has(String(e._id))?`selected`:void 0,className:p?void 0:`cursor-pointer focus-visible:bg-muted/50 focus-visible:outline-none`,tabIndex:p?void 0:0,onClick:p?void 0:()=>C(e),onKeyDown:p?void 0:t=>{t.key===`Enter`&&t.target===t.currentTarget&&(t.preventDefault(),C(e))},children:[le&&(0,b.jsx)(bk,{onClick:e=>e.stopPropagation(),children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":d(`list.selectRow`,{name:String(e._title??e._id)}),checked:_.has(String(e._id)),onChange:t=>{let n=new Set(_);t.target.checked?n.add(String(e._id)):n.delete(String(e._id)),v(n)}})}),N.map((t,n)=>(0,b.jsx)(bk,{children:t.computed?(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[t.image&&(0,b.jsx)(zD,{schema:M,name:t.image.name,column:t.image.computed,item:e}),n===P&&!p?(0,b.jsx)(bo,{to:de(e),className:`min-w-0 hover:underline`,onClick:e=>e.stopPropagation(),children:(0,b.jsx)(zD,{schema:M,name:t.name,column:t.computed,item:e})}):(0,b.jsx)(zD,{schema:M,name:t.name,column:t.computed,item:e})]}):n===P&&!p?(0,b.jsx)(bo,{to:de(e),className:`font-semibold hover:underline`,onClick:e=>e.stopPropagation(),children:Px(e[t.name],t.field)}):!p&&M.list.editable.includes(t.name)&&!(Array.isArray(e._readonly)&&e._readonly.includes(t.name))&&e._perm?.update!==!1?(0,b.jsx)(lk,{schema:M,item:e,field:t.field}):(0,b.jsx)(wk,{value:e[t.name],field:t.field,record:e})},t.name)),p&&(0,b.jsx)(bk,{children:(0,b.jsx)(Tk,{item:e,pending:f.isPending,onRestore:e=>f.mutate(e)})})]},String(e._id))),s.isSuccess&&te.length===0&&(0,b.jsx)(vk,{children:(0,b.jsx)(bk,{colSpan:N.length+(p||le?1:0),className:`text-center text-muted-foreground`,children:(0,b.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-6`,children:[d(ZS(t)?`list.noMatches`:`list.noRecords`),!ZS(t)&&M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,size:`sm`,variant:`outline`,children:(0,b.jsxs)(bo,{to:`/${M.name}/new`,children:[(0,b.jsx)(hb,{}),d(`list.new`)]})})]})})})]})]})}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-t px-3.5 py-2.5 text-[13px] text-muted-foreground`,children:[(0,b.jsx)(`span`,{children:tC(s.data,ne?1:r,te.length)||ie.summary}),(0,b.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[!ne&&(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[d(`list.rowsPerPage`),(0,b.jsx)(`select`,{className:`h-8 rounded-lg border border-input bg-card px-2 text-[12.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,value:s.data?.pageSize??M.list.pageSize,onChange:e=>fe({pageSize:Number(e.target.value)===M.list.pageSize?null:e.target.value}),children:nC(M.list.pageSize).map(e=>(0,b.jsx)(`option`,{value:e,children:eg(e)},e))})]}),(0,b.jsx)(`span`,{children:ie.label}),(0,b.jsx)(q,{variant:`outline`,size:`icon-sm`,"aria-label":d(`list.previousPage`),disabled:!ae,onClick:se,children:(0,b.jsx)(Tv,{className:`rtl:rotate-180`})}),(0,b.jsx)(q,{variant:`outline`,size:`icon-sm`,"aria-label":d(`list.nextPage`),disabled:!ie.hasNext,onClick:oe,children:(0,b.jsx)(Dv,{className:`rtl:rotate-180`})})]})]})]})}),(0,b.jsx)(mk,{schema:M,item:x,onClose:()=>C(void 0)})]})}function Ck({schema:e,params:t,onChange:n}){let r=ft({queryKey:[`list`,e.name,`tab-counts`],queryFn:()=>Q.tabCounts(e.name)}),i=e.list.tabs,a=oC(i,t);return(0,b.jsx)(`div`,{className:`overflow-x-auto`,children:(0,b.jsx)(zO,{items:i.map(e=>{let t=r.data?.[e.key];return{key:e.key,label:e.label,...t?{count:eg(t.count),estimate:t.estimate}:{}}}),value:a?.key??``,onChange:e=>n(sC(i.find(t=>t.key===e),t))})})}function wk({value:e,field:t,record:n}){let r=t.relation?.resource;if(!r||e==null)return(0,b.jsx)(lE,{value:e,field:t,record:n});let i=(Array.isArray(e)?e:[e]).filter(mC);return i.length===0?(0,b.jsx)(b.Fragment,{children:Px(e,t)}):(0,b.jsx)(b.Fragment,{children:i.map((e,t)=>(0,b.jsxs)(y.Fragment,{children:[t>0&&`, `,(0,b.jsx)(bo,{to:`/${r}/${encodeURIComponent(xk([e.id]))}`,className:`hover:underline`,onClick:e=>e.stopPropagation(),children:e.title})]},String(e.id)))})}function Tk({item:e,pending:t,onRestore:n}){let r=X();return(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,disabled:t,"aria-label":r(`list.restoreRecord`,{name:String(e._title??e._id)}),onClick:()=>n(String(e._id)),children:[(0,b.jsx)(Tb,{}),r(`list.restore`)]})}function Ek({title:e,result:t,items:n}){let r=X(),i=e=>{let t=n.find(t=>String(t._id)===e);return typeof t?._title==`string`?t._title:`#${e}`};return(0,b.jsxs)(`div`,{role:`status`,className:`rounded-lg border px-3 py-2 text-sm`,children:[(0,b.jsxs)(`p`,{children:[e,t.failed.length>0&&` · ${r(`list.bulkFailed`,{count:t.failed.length})}`]}),t.failed.length>0&&(0,b.jsx)(`ul`,{className:`mt-1 list-disc ps-5 text-destructive`,children:t.failed.map(e=>(0,b.jsxs)(`li`,{children:[i(e.id),`: `,e.message]},e.id))})]})}function Dk(e){let t=new URLSearchParams(e);for(let e of[`page`,`pageSize`,`after`])t.delete(e);return t}function Ok(){let e=X();return(0,b.jsx)(G,{children:e(`common.pageNotFound`)})}function kk(e){let t=TC(e.schema.fields.filter(e=>!e.secret),{...e.values,_files:e.files});for(let n of e.schema.fields)n.secret&&(t[n.name]=``);return t}function Ak(e,t,n){let r=e.filter(e=>uD(e,t)),i=r.filter(e=>!e.secret),{payload:a,errors:o}=DC(i,t,n),s=DC(i.filter(e=>e.type===`object`&&!e.many&&Object.hasOwn(a,e.name)),t);Object.assign(a,s.payload),Object.assign(o,s.errors);for(let e of r){if(!e.secret)continue;let n=t[e.name];n===null?a[e.name]=null:typeof n==`string`&&n.trim()!==``&&(a[e.name]=n)}return{payload:a,errors:o}}function jk(e,t){let n=new Set(t.fields.filter(e=>e.secret).map(e=>e.name)),r=Object.entries(t.constraints).filter(([t])=>Object.hasOwn(e,t.split(`.`)[0])),i=r.filter(([e])=>!e.includes(`.`)).map(([e,t])=>[e,n.has(e)?{...t,required:!1}:t]),a=r.filter(([e])=>e.includes(`.`));return{..._D(e,Object.fromEntries(a),`create`),..._D(e,Object.fromEntries(i),`update`)}}function Mk(){let e=X(),{page:t=``}=$i(),n=Yg(t);return n.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):n.isError?(0,b.jsx)(G,{tone:`error`,children:pg(n.error)}):(0,b.jsx)(Nk,{page:n.data},t)}function Nk({page:e}){let t=X(),{locale:n}=Y(),r=S(),{schema:i}=e,a=i.fields.map(e=>e.name),[o,s]=(0,y.useState)(()=>kk(e)),[c,l]=(0,y.useState)(o),[u,d]=(0,y.useState)([]),[f,p]=(0,y.useState)({}),[m,h]=(0,y.useState)(null),[g,_]=(0,y.useState)(null),v=ND(()=>h(null)),x=JSON.stringify(c)!==JSON.stringify(o),{blocker:C}=AD(x),w=(0,y.useRef)(null);MD(w);let T=(e,t)=>l(n=>({...n,[e]:t})),E=pt({mutationFn:e=>Q.savePage(i.name,e),gcTime:0,onSuccess:e=>{E.reset();let a=kk(e);r.setQueryData([`page`,i.name,n],e),s(a),l(a),d([]),p({}),_(t(`form.savedName`,{name:e.schema.label}))},onError:e=>{let t=rD(e,a);p(t.fields),h(t.form)}});function D(e){if(e.preventDefault(),i.readonly)return;if(_(null),v.busy){h(t(`upload.busy`)),v.refuse();return}let{payload:n,errors:r}=Ak(i.fields,c,o),a={...jk(n,i),...r};if(p(a),h(null),!(Object.keys(a).length>0)){if(Object.keys(n).length===0){l(o),d([]);return}E.mutate(n)}}let O={...e.values,_files:e.files};function k(t){let n=i.fields.find(e=>e.name===t);if(!n||!uD(n,c))return null;let r=i.required.includes(t);return n.secret?(0,b.jsx)(Pk,{field:n,stored:e.secrets[t]===!0,value:c[t],replacing:u.includes(t),readOnly:i.readonly,required:r,errors:f[t],onChange:e=>T(t,e),onReplacing:e=>d(n=>e?[...n,t]:n.filter(e=>e!==t))}):i.readonly?(0,b.jsx)(gO,{resource:`page:${i.name}`,field:n,record:O}):n.type===`object`?(0,b.jsx)(KE,{resource:`page:${i.name}`,field:n,path:t,pattern:t,value:c[t],constraints:i.constraints,markRequired:!0,errors:f,onChange:e=>T(t,e)}):(0,b.jsx)(FE,{resource:`page:${i.name}`,field:n,value:c[t],required:r,errors:f[t],constraints:i.constraints[t],onChange:e=>T(t,e),onBusy:e=>v.setBusy(t,e)})}return(0,b.jsxs)(`form`,{ref:w,onSubmit:D,noValidate:!0,className:W(`flex flex-col gap-5`,i.layout?.length?`max-w-4xl`:`max-w-2xl`),children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:i.label}),i.readonly&&(0,b.jsx)(`p`,{role:`note`,className:`rounded-md border bg-muted/40 px-3 py-2 text-sm text-muted-foreground`,children:t(`settings.viewOnly`)}),g&&(0,b.jsx)(`p`,{role:`status`,className:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:g}),(0,b.jsx)(jD,{blocker:C}),m&&(0,b.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:m}),(0,b.jsx)(zE,{layout:i.layout,names:a,errors:f,render:k}),!i.readonly&&(0,b.jsxs)(PD,{dirty:x,children:[x&&(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:E.isPending,onClick:()=>{l(o),d([]),p({}),h(null)},children:t(`settings.discard`)}),(0,b.jsxs)(q,{type:`submit`,disabled:E.isPending||v.busy,"aria-keyshortcuts":`Control+S Meta+S`,children:[t(E.isPending?`form.saving`:`form.save`),(0,b.jsx)(FD,{})]})]})]})}function Pk({field:e,stored:t,value:n,replacing:r,readOnly:i,required:a,errors:o,onChange:s,onReplacing:c}){let l=X(),u=`field-${e.name}`,d=`${u}-label`,f=`${u}-help`,p=`${u}-error`,m=(o?.length??0)>0,h=[e.help?f:void 0,m?p:void 0].filter(Boolean).join(` `)||void 0,g=n===null,_=!i&&!g&&(!t||r);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-secret":e.name,children:[(0,b.jsxs)(`label`,{id:d,htmlFor:_?u:void 0,className:`text-sm font-medium`,children:[e.label,a&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`text-destructive`,children:`*`})]}),_?(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(Oh,{id:u,type:`password`,autoComplete:`new-password`,dir:`ltr`,className:`min-w-0 flex-1`,value:typeof n==`string`?n:``,autoFocus:r,"aria-invalid":m?!0:void 0,"aria-describedby":h,onChange:e=>s(e.target.value)}),t&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{s(``),c(!1)},children:l(`secret.keep`)})]}):(0,b.jsx)(`div`,{role:`group`,"aria-labelledby":d,"aria-describedby":h,className:`flex min-h-8 flex-wrap items-center gap-2 text-sm`,children:g?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`text-amber-800 dark:text-amber-300`,children:l(`secret.willClear`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>s(``),children:l(`secret.undo`)})]}):t?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-medium text-green-800 dark:text-green-300`,children:[l(`secret.set`),(0,b.jsx)(xv,{className:`size-4`,"aria-hidden":!0})]}),!i&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"aria-label":l(`secret.replaceName`,{name:e.label}),onClick:()=>c(!0),children:l(`secret.replace`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":l(`secret.clearName`,{name:e.label}),onClick:()=>s(null),children:l(`secret.clear`)})]})]}):(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:l(`secret.notSet`)})}),e.help&&(0,b.jsx)(`p`,{id:f,className:`text-sm text-muted-foreground`,children:e.help}),m&&(0,b.jsx)(`p`,{id:p,className:`text-sm text-destructive`,children:o.join(` `)})]})}document.title=dg.title,Fw(Mw()),Hw(dg.branding),Zw({branding:dg.branding.primaryColor}),Ax(dg.currency),Zh(dg.messages),zw(Mw);var Fk=new Qe({defaultOptions:{queries:{retry:1,staleTime:3e4}}}),Ik=_o([{path:`login`,element:(0,b.jsx)(tE,{})},{element:(0,b.jsx)(ZT,{}),children:[{index:!0,element:(0,b.jsx)(ZO,{})},{path:`account`,element:(0,b.jsx)(y_,{})},{path:`-/users`,element:(0,b.jsx)(bw,{})},{path:`-/users/new`,element:(0,b.jsx)(xw,{})},{path:`-/users/:id`,element:(0,b.jsx)(xw,{})},{path:`-/groups`,element:(0,b.jsx)(sw,{})},{path:`-/groups/new`,element:(0,b.jsx)(cw,{})},{path:`-/groups/:id`,element:(0,b.jsx)(cw,{})},{path:`-/roles`,element:(0,b.jsx)(yw,{})},{path:`-/roles/new`,element:(0,b.jsx)(gw,{})},{path:`-/roles/:name`,element:(0,b.jsx)(gw,{})},{path:`-/debugger`,element:(0,b.jsx)(iw,{})},{path:`-/audit`,element:(0,b.jsx)(tw,{})},{path:`g/:group`,element:(0,b.jsx)(bO,{})},{path:`p/:page`,element:(0,b.jsx)(Mk,{})},{path:`:resource`,element:(0,b.jsx)(Sk,{})},{path:`:resource/new`,element:(0,b.jsx)(lO,{mode:`create`})},{path:`:resource/:id`,element:(0,b.jsx)(lO,{mode:`edit`})},{path:`*`,element:(0,b.jsx)(Ok,{})}]}],{basename:dg.basePath});vg(()=>{let e=bg(Ik.state.location.pathname,dg.basePath),{search:t}=Ik.state.location;e!==`/login`&&(Fk.clear(),Ik.navigate(`/login?${new URLSearchParams({next:e+t})}`,{replace:!0}))}),(0,Ka.createRoot)(document.getElementById(`root`)).render((0,b.jsx)(y.StrictMode,{children:(0,b.jsx)(lg,{locales:dg.locales,fallback:dg.locale,children:(0,b.jsx)(C,{client:Fk,children:(0,b.jsx)(Ca,{router:Ik})})})}));export{c as _,Ly as a,$ as c,q as d,W as f,o as g,u as h,rx as i,X as l,m,yE as n,jy as o,v as p,hE as r,Fv as s,bE as t,Oh as u};