@nymbalhq/admin 1.5.0 → 1.6.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.
- package/LICENSE +21 -0
- package/README.md +6 -0
- package/dist/assets/index-bIbOAd1S.css +1 -0
- package/dist/assets/index-fowvSqZE.js +323 -0
- package/dist/assets/vendor-0v2ry8Wl.js +60 -0
- package/dist/index.html +3 -3
- package/package.json +3 -3
- package/dist/assets/index-BmTgcJqc.css +0 -1
- package/dist/assets/index-DzFoEmIR.js +0 -313
- package/dist/assets/vendor-dpy99fWE.js +0 -60
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
var Qa=e=>{throw TypeError(e)};var Hs=(e,t,n)=>t.has(e)||Qa("Cannot "+n);var b=(e,t,n)=>(Hs(e,t,"read from private field"),n?n.call(e):t.get(e)),F=(e,t,n)=>t.has(e)?Qa("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),M=(e,t,n,s)=>(Hs(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),J=(e,t,n)=>(Hs(e,t,"access private method"),n);var Fr=(e,t,n,s)=>({set _(o){M(e,t,o,n)},get _(){return b(e,t,s)}});import{r as l,a as Er,u as jt,N as Vf,b as Bf,L as Ft,R as Xo,c as Kf,d as We,O as qf,e as Zo,f as Hf,g as Wf,h as Gf}from"./vendor-dpy99fWE.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();var ac={exports:{}},gs={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Qf=l,Yf=Symbol.for("react.element"),Xf=Symbol.for("react.fragment"),Zf=Object.prototype.hasOwnProperty,Jf=Qf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,eh={key:!0,ref:!0,__self:!0,__source:!0};function ic(e,t,n){var s,o={},a=null,i=null;n!==void 0&&(a=""+n),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(i=t.ref);for(s in t)Zf.call(t,s)&&!eh.hasOwnProperty(s)&&(o[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)o[s]===void 0&&(o[s]=t[s]);return{$$typeof:Yf,type:e,key:a,ref:i,props:o,_owner:Jf.current}}gs.Fragment=Xf;gs.jsx=ic;gs.jsxs=ic;ac.exports=gs;var r=ac.exports,cc,Ya=Er;cc=Ya.createRoot,Ya.hydrateRoot;var Yn=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Jt,Tt,An,Qi,th=(Qi=class extends Yn{constructor(){super();F(this,Jt);F(this,Tt);F(this,An);M(this,An,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){b(this,Tt)||this.setEventListener(b(this,An))}onUnsubscribe(){var t;this.hasListeners()||((t=b(this,Tt))==null||t.call(this),M(this,Tt,void 0))}setEventListener(t){var n;M(this,An,t),(n=b(this,Tt))==null||n.call(this),M(this,Tt,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){b(this,Jt)!==t&&(M(this,Jt,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof b(this,Jt)=="boolean"?b(this,Jt):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Jt=new WeakMap,Tt=new WeakMap,An=new WeakMap,Qi),Jo=new th,nh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},At,Yo,Yi,rh=(Yi=class{constructor(){F(this,At,nh);F(this,Yo,!1)}setTimeoutProvider(e){M(this,At,e)}setTimeout(e,t){return b(this,At).setTimeout(e,t)}clearTimeout(e){b(this,At).clearTimeout(e)}setInterval(e,t){return b(this,At).setInterval(e,t)}clearInterval(e){b(this,At).clearInterval(e)}},At=new WeakMap,Yo=new WeakMap,Yi),Zt=new rh;function sh(e){setTimeout(e,0)}var oh=typeof window>"u"||"Deno"in globalThis;function Re(){}function ah(e,t){return typeof e=="function"?e(t):e}function mo(e){return typeof e=="number"&&e>=0&&e!==1/0}function lc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function $t(e,t){return typeof e=="function"?e(t):e}function Ie(e,t){return typeof e=="function"?e(t):e}function Xa(e,t){const{type:n="all",exact:s,fetchStatus:o,predicate:a,queryKey:i,stale:c}=e;if(i){if(s){if(t.queryHash!==ea(i,t.options))return!1}else if(!hr(t.queryKey,i))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||o&&o!==t.state.fetchStatus||a&&!a(t))}function Za(e,t){const{exact:n,status:s,predicate:o,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(dn(t.options.mutationKey)!==dn(a))return!1}else if(!hr(t.options.mutationKey,a))return!1}return!(s&&t.state.status!==s||o&&!o(t))}function ea(e,t){return((t==null?void 0:t.queryKeyHashFn)||dn)(e)}function dn(e){return JSON.stringify(e,(t,n)=>po(n)?Object.keys(n).sort().reduce((s,o)=>(s[o]=n[o],s),{}):n)}function hr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>hr(e[n],t[n])):!1}var ih=Object.prototype.hasOwnProperty;function dc(e,t,n=0){if(e===t)return e;if(n>500)return t;const s=Ja(e)&&Ja(t);if(!s&&!(po(e)&&po(t)))return t;const a=(s?e:Object.keys(e)).length,i=s?t:Object.keys(t),c=i.length,u=s?new Array(c):{};let d=0;for(let h=0;h<c;h++){const f=s?h:i[h],m=e[f],g=t[f];if(m===g){u[f]=m,(s?h<a:ih.call(e,f))&&d++;continue}if(m===null||g===null||typeof m!="object"||typeof g!="object"){u[f]=g;continue}const v=dc(m,g,n+1);u[f]=v,v===m&&d++}return a===c&&d===a?e:u}function ns(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Ja(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function po(e){if(!ei(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!ei(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ei(e){return Object.prototype.toString.call(e)==="[object Object]"}function ch(e){return new Promise(t=>{Zt.setTimeout(t,e)})}function xo(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?dc(e,t):t}function lh(e,t,n=0){const s=[...e,t];return n&&s.length>n?s.slice(1):s}function dh(e,t,n=0){const s=[t,...e];return n&&s.length>n?s.slice(0,-1):s}var ta=Symbol();function uc(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===ta?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function na(e,t){return typeof e=="function"?e(...t):!!e}function uh(e,t,n){let s=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??(o=t()),s||(s=!0,o.aborted?n():o.addEventListener("abort",n,{once:!0})),o)}),e}var mr=(()=>{let e=()=>oh;return{isServer(){return e()},setIsServer(t){e=t}}})();function go(){let e,t;const n=new Promise((o,a)=>{e=o,t=a});n.status="pending",n.catch(()=>{});function s(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{s({status:"fulfilled",value:o}),e(o)},n.reject=o=>{s({status:"rejected",reason:o}),t(o)},n}var fh=sh;function hh(){let e=[],t=0,n=c=>{c()},s=c=>{c()},o=fh;const a=c=>{t?e.push(c):o(()=>{n(c)})},i=()=>{const c=e;e=[],c.length&&o(()=>{s(()=>{c.forEach(u=>{n(u)})})})};return{batch:c=>{let u;t++;try{u=c()}finally{t--,t||i()}return u},batchCalls:c=>(...u)=>{a(()=>{c(...u)})},schedule:a,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{s=c},setScheduler:c=>{o=c}}}var ye=hh(),Mn,Mt,_n,Xi,mh=(Xi=class extends Yn{constructor(){super();F(this,Mn,!0);F(this,Mt);F(this,_n);M(this,_n,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}}})}onSubscribe(){b(this,Mt)||this.setEventListener(b(this,_n))}onUnsubscribe(){var t;this.hasListeners()||((t=b(this,Mt))==null||t.call(this),M(this,Mt,void 0))}setEventListener(t){var n;M(this,_n,t),(n=b(this,Mt))==null||n.call(this),M(this,Mt,t(this.setOnline.bind(this)))}setOnline(t){b(this,Mn)!==t&&(M(this,Mn,t),this.listeners.forEach(s=>{s(t)}))}isOnline(){return b(this,Mn)}},Mn=new WeakMap,Mt=new WeakMap,_n=new WeakMap,Xi),rs=new mh;function ph(e){return Math.min(1e3*2**e,3e4)}function fc(e){return(e??"online")==="online"?rs.isOnline():!0}var vo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function hc(e){let t=!1,n=0,s;const o=go(),a=()=>o.status!=="pending",i=p=>{var x;if(!a()){const y=new vo(p);m(y),(x=e.onCancel)==null||x.call(e,y)}},c=()=>{t=!0},u=()=>{t=!1},d=()=>Jo.isFocused()&&(e.networkMode==="always"||rs.isOnline())&&e.canRun(),h=()=>fc(e.networkMode)&&e.canRun(),f=p=>{a()||(s==null||s(),o.resolve(p))},m=p=>{a()||(s==null||s(),o.reject(p))},g=()=>new Promise(p=>{var x;s=y=>{(a()||d())&&p(y)},(x=e.onPause)==null||x.call(e)}).then(()=>{var p;s=void 0,a()||(p=e.onContinue)==null||p.call(e)}),v=()=>{if(a())return;let p;const x=n===0?e.initialPromise:void 0;try{p=x??e.fn()}catch(y){p=Promise.reject(y)}Promise.resolve(p).then(f).catch(y=>{var E;if(a())return;const w=e.retry??(mr.isServer()?0:3),N=e.retryDelay??ph,j=typeof N=="function"?N(n,y):N,C=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,y);if(t||!C){m(y);return}n++,(E=e.onFail)==null||E.call(e,n,y),ch(j).then(()=>d()?void 0:g()).then(()=>{t?m(y):v()})})};return{promise:o,status:()=>o.status,cancel:i,continue:()=>(s==null||s(),o),cancelRetry:c,continueRetry:u,canStart:h,start:()=>(h()?v():g().then(v),o)}}var en,Zi,mc=(Zi=class{constructor(){F(this,en)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),mo(this.gcTime)&&M(this,en,Zt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(mr.isServer()?1/0:5*60*1e3))}clearGcTimeout(){b(this,en)!==void 0&&(Zt.clearTimeout(b(this,en)),M(this,en,void 0))}},en=new WeakMap,Zi),tn,On,$e,nn,we,wr,rn,Oe,pc,ht,Ji,xh=(Ji=class extends mc{constructor(t){super();F(this,Oe);F(this,tn);F(this,On);F(this,$e);F(this,nn);F(this,we);F(this,wr);F(this,rn);M(this,rn,!1),M(this,wr,t.defaultOptions),this.setOptions(t.options),this.observers=[],M(this,nn,t.client),M(this,$e,b(this,nn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,M(this,tn,ni(this.options)),this.state=t.state??b(this,tn),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=b(this,we))==null?void 0:t.promise}setOptions(t){if(this.options={...b(this,wr),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=ni(this.options);n.data!==void 0&&(this.setState(ti(n.data,n.dataUpdatedAt)),M(this,tn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&b(this,$e).remove(this)}setData(t,n){const s=xo(this.state.data,t,this.options);return J(this,Oe,ht).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(t,n){J(this,Oe,ht).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var s,o;const n=(s=b(this,we))==null?void 0:s.promise;return(o=b(this,we))==null||o.cancel(t),n?n.then(Re).catch(Re):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return b(this,tn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Ie(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ta||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>$t(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!lc(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(s=>s.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=b(this,we))==null||n.continue()}onOnline(){var n;const t=this.observers.find(s=>s.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=b(this,we))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),b(this,$e).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(b(this,we)&&(b(this,rn)||J(this,Oe,pc).call(this)?b(this,we).cancel({revert:!0}):b(this,we).cancelRetry()),this.scheduleGc()),b(this,$e).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||J(this,Oe,ht).call(this,{type:"invalidate"})}async fetch(t,n){var u,d,h,f,m,g,v,p,x,y,w,N;if(this.state.fetchStatus!=="idle"&&((u=b(this,we))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(b(this,we))return b(this,we).continueRetry(),b(this,we).promise}if(t&&this.setOptions(t),!this.options.queryFn){const j=this.observers.find(C=>C.options.queryFn);j&&this.setOptions(j.options)}const s=new AbortController,o=j=>{Object.defineProperty(j,"signal",{enumerable:!0,get:()=>(M(this,rn,!0),s.signal)})},a=()=>{const j=uc(this.options,n),E=(()=>{const S={client:b(this,nn),queryKey:this.queryKey,meta:this.meta};return o(S),S})();return M(this,rn,!1),this.options.persister?this.options.persister(j,E,this):j(E)},c=(()=>{const j={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:b(this,nn),state:this.state,fetchFn:a};return o(j),j})();(d=this.options.behavior)==null||d.onFetch(c,this),M(this,On,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=c.fetchOptions)==null?void 0:h.meta))&&J(this,Oe,ht).call(this,{type:"fetch",meta:(f=c.fetchOptions)==null?void 0:f.meta}),M(this,we,hc({initialPromise:n==null?void 0:n.initialPromise,fn:c.fetchFn,onCancel:j=>{j instanceof vo&&j.revert&&this.setState({...b(this,On),fetchStatus:"idle"}),s.abort()},onFail:(j,C)=>{J(this,Oe,ht).call(this,{type:"failed",failureCount:j,error:C})},onPause:()=>{J(this,Oe,ht).call(this,{type:"pause"})},onContinue:()=>{J(this,Oe,ht).call(this,{type:"continue"})},retry:c.options.retry,retryDelay:c.options.retryDelay,networkMode:c.options.networkMode,canRun:()=>!0}));try{const j=await b(this,we).start();if(j===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(j),(g=(m=b(this,$e).config).onSuccess)==null||g.call(m,j,this),(p=(v=b(this,$e).config).onSettled)==null||p.call(v,j,this.state.error,this),j}catch(j){if(j instanceof vo){if(j.silent)return b(this,we).promise;if(j.revert){if(this.state.data===void 0)throw j;return this.state.data}}throw J(this,Oe,ht).call(this,{type:"error",error:j}),(y=(x=b(this,$e).config).onError)==null||y.call(x,j,this),(N=(w=b(this,$e).config).onSettled)==null||N.call(w,this.state.data,j,this),j}finally{this.scheduleGc()}}},tn=new WeakMap,On=new WeakMap,$e=new WeakMap,nn=new WeakMap,we=new WeakMap,wr=new WeakMap,rn=new WeakMap,Oe=new WeakSet,pc=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ht=function(t){const n=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...xc(s.data,this.options),fetchMeta:t.meta??null};case"success":const o={...s,...ti(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return M(this,On,t.manual?o:void 0),o;case"error":const a=t.error;return{...s,error:a,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=n(this.state),ye.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),b(this,$e).notify({query:this,type:"updated",action:t})})},Ji);function xc(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:fc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ti(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ni(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,s=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Te,oe,jr,Ee,sn,In,mt,_t,Nr,Dn,zn,on,an,Ot,Ln,ue,dr,yo,bo,wo,jo,No,Co,So,vc,ec,gc=(ec=class extends Yn{constructor(t,n){super();F(this,ue);F(this,Te);F(this,oe);F(this,jr);F(this,Ee);F(this,sn);F(this,In);F(this,mt);F(this,_t);F(this,Nr);F(this,Dn);F(this,zn);F(this,on);F(this,an);F(this,Ot);F(this,Ln,new Set);this.options=n,M(this,Te,t),M(this,_t,null),M(this,mt,go()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(b(this,oe).addObserver(this),ri(b(this,oe),this.options)?J(this,ue,dr).call(this):this.updateResult(),J(this,ue,jo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Eo(b(this,oe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Eo(b(this,oe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,J(this,ue,No).call(this),J(this,ue,Co).call(this),b(this,oe).removeObserver(this)}setOptions(t){const n=this.options,s=b(this,oe);if(this.options=b(this,Te).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ie(this.options.enabled,b(this,oe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");J(this,ue,So).call(this),b(this,oe).setOptions(this.options),n._defaulted&&!ns(this.options,n)&&b(this,Te).getQueryCache().notify({type:"observerOptionsUpdated",query:b(this,oe),observer:this});const o=this.hasListeners();o&&si(b(this,oe),s,this.options,n)&&J(this,ue,dr).call(this),this.updateResult(),o&&(b(this,oe)!==s||Ie(this.options.enabled,b(this,oe))!==Ie(n.enabled,b(this,oe))||$t(this.options.staleTime,b(this,oe))!==$t(n.staleTime,b(this,oe)))&&J(this,ue,yo).call(this);const a=J(this,ue,bo).call(this);o&&(b(this,oe)!==s||Ie(this.options.enabled,b(this,oe))!==Ie(n.enabled,b(this,oe))||a!==b(this,Ot))&&J(this,ue,wo).call(this,a)}getOptimisticResult(t){const n=b(this,Te).getQueryCache().build(b(this,Te),t),s=this.createResult(n,t);return vh(this,s)&&(M(this,Ee,s),M(this,In,this.options),M(this,sn,b(this,oe).state)),s}getCurrentResult(){return b(this,Ee)}trackResult(t,n){return new Proxy(t,{get:(s,o)=>(this.trackProp(o),n==null||n(o),o==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&b(this,mt).status==="pending"&&b(this,mt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,o))})}trackProp(t){b(this,Ln).add(t)}getCurrentQuery(){return b(this,oe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=b(this,Te).defaultQueryOptions(t),s=b(this,Te).getQueryCache().build(b(this,Te),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return J(this,ue,dr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),b(this,Ee)))}createResult(t,n){var D;const s=b(this,oe),o=this.options,a=b(this,Ee),i=b(this,sn),c=b(this,In),d=t!==s?t.state:b(this,jr),{state:h}=t;let f={...h},m=!1,g;if(n._optimisticResults){const I=this.hasListeners(),$=!I&&ri(t,n),_=I&&si(t,s,n,o);($||_)&&(f={...f,...xc(h.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:v,errorUpdatedAt:p,status:x}=f;g=f.data;let y=!1;if(n.placeholderData!==void 0&&g===void 0&&x==="pending"){let I;a!=null&&a.isPlaceholderData&&n.placeholderData===(c==null?void 0:c.placeholderData)?(I=a.data,y=!0):I=typeof n.placeholderData=="function"?n.placeholderData((D=b(this,zn))==null?void 0:D.state.data,b(this,zn)):n.placeholderData,I!==void 0&&(x="success",g=xo(a==null?void 0:a.data,I,n),m=!0)}if(n.select&&g!==void 0&&!y)if(a&&g===(i==null?void 0:i.data)&&n.select===b(this,Nr))g=b(this,Dn);else try{M(this,Nr,n.select),g=n.select(g),g=xo(a==null?void 0:a.data,g,n),M(this,Dn,g),M(this,_t,null)}catch(I){M(this,_t,I)}b(this,_t)&&(v=b(this,_t),g=b(this,Dn),p=Date.now(),x="error");const w=f.fetchStatus==="fetching",N=x==="pending",j=x==="error",C=N&&w,E=g!==void 0,P={status:x,fetchStatus:f.fetchStatus,isPending:N,isSuccess:x==="success",isError:j,isInitialLoading:C,isLoading:C,data:g,dataUpdatedAt:f.dataUpdatedAt,error:v,errorUpdatedAt:p,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:w,isRefetching:w&&!N,isLoadingError:j&&!E,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:j&&E,isStale:ra(t,n),refetch:this.refetch,promise:b(this,mt),isEnabled:Ie(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const I=P.data!==void 0,$=P.status==="error"&&!I,_=X=>{$?X.reject(P.error):I&&X.resolve(P.data)},G=()=>{const X=M(this,mt,P.promise=go());_(X)},U=b(this,mt);switch(U.status){case"pending":t.queryHash===s.queryHash&&_(U);break;case"fulfilled":($||P.data!==U.value)&&G();break;case"rejected":(!$||P.error!==U.reason)&&G();break}}return P}updateResult(){const t=b(this,Ee),n=this.createResult(b(this,oe),this.options);if(M(this,sn,b(this,oe).state),M(this,In,this.options),b(this,sn).data!==void 0&&M(this,zn,b(this,oe)),ns(n,t))return;M(this,Ee,n);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,a=typeof o=="function"?o():o;if(a==="all"||!a&&!b(this,Ln).size)return!0;const i=new Set(a??b(this,Ln));return this.options.throwOnError&&i.add("error"),Object.keys(b(this,Ee)).some(c=>{const u=c;return b(this,Ee)[u]!==t[u]&&i.has(u)})};J(this,ue,vc).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&J(this,ue,jo).call(this)}},Te=new WeakMap,oe=new WeakMap,jr=new WeakMap,Ee=new WeakMap,sn=new WeakMap,In=new WeakMap,mt=new WeakMap,_t=new WeakMap,Nr=new WeakMap,Dn=new WeakMap,zn=new WeakMap,on=new WeakMap,an=new WeakMap,Ot=new WeakMap,Ln=new WeakMap,ue=new WeakSet,dr=function(t){J(this,ue,So).call(this);let n=b(this,oe).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Re)),n},yo=function(){J(this,ue,No).call(this);const t=$t(this.options.staleTime,b(this,oe));if(mr.isServer()||b(this,Ee).isStale||!mo(t))return;const s=lc(b(this,Ee).dataUpdatedAt,t)+1;M(this,on,Zt.setTimeout(()=>{b(this,Ee).isStale||this.updateResult()},s))},bo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(b(this,oe)):this.options.refetchInterval)??!1},wo=function(t){J(this,ue,Co).call(this),M(this,Ot,t),!(mr.isServer()||Ie(this.options.enabled,b(this,oe))===!1||!mo(b(this,Ot))||b(this,Ot)===0)&&M(this,an,Zt.setInterval(()=>{(this.options.refetchIntervalInBackground||Jo.isFocused())&&J(this,ue,dr).call(this)},b(this,Ot)))},jo=function(){J(this,ue,yo).call(this),J(this,ue,wo).call(this,J(this,ue,bo).call(this))},No=function(){b(this,on)!==void 0&&(Zt.clearTimeout(b(this,on)),M(this,on,void 0))},Co=function(){b(this,an)!==void 0&&(Zt.clearInterval(b(this,an)),M(this,an,void 0))},So=function(){const t=b(this,Te).getQueryCache().build(b(this,Te),this.options);if(t===b(this,oe))return;const n=b(this,oe);M(this,oe,t),M(this,jr,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},vc=function(t){ye.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(b(this,Ee))}),b(this,Te).getQueryCache().notify({query:b(this,oe),type:"observerResultsUpdated"})})},ec);function gh(e,t){return Ie(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Ie(t.retryOnMount,e)===!1)}function ri(e,t){return gh(e,t)||e.state.data!==void 0&&Eo(e,t,t.refetchOnMount)}function Eo(e,t,n){if(Ie(t.enabled,e)!==!1&&$t(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&ra(e,t)}return!1}function si(e,t,n,s){return(e!==t||Ie(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ra(e,n)}function ra(e,t){return Ie(t.enabled,e)!==!1&&e.isStaleByTime($t(t.staleTime,e))}function vh(e,t){return!ns(e.getCurrentResult(),t)}function ss(e){return{onFetch:(t,n)=>{var h,f,m,g,v;const s=t.options,o=(m=(f=(h=t.fetchOptions)==null?void 0:h.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,a=((g=t.state.data)==null?void 0:g.pages)||[],i=((v=t.state.data)==null?void 0:v.pageParams)||[];let c={pages:[],pageParams:[]},u=0;const d=async()=>{let p=!1;const x=N=>{uh(N,()=>t.signal,()=>p=!0)},y=uc(t.options,t.fetchOptions),w=async(N,j,C)=>{if(p)return Promise.reject();if(j==null&&N.pages.length)return Promise.resolve(N);const S=(()=>{const $={client:t.client,queryKey:t.queryKey,pageParam:j,direction:C?"backward":"forward",meta:t.options.meta};return x($),$})(),P=await y(S),{maxPages:D}=t.options,I=C?dh:lh;return{pages:I(N.pages,P,D),pageParams:I(N.pageParams,j,D)}};if(o&&a.length){const N=o==="backward",j=N?yc:Ro,C={pages:a,pageParams:i},E=j(s,C);c=await w(C,E,N)}else{const N=e??a.length;do{const j=u===0?i[0]??s.initialPageParam:Ro(s,c);if(u>0&&j==null)break;c=await w(c,j),u++}while(u<N)}return c};t.options.persister?t.fetchFn=()=>{var p,x;return(x=(p=t.options).persister)==null?void 0:x.call(p,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function Ro(e,{pages:t,pageParams:n}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,n[s],n):void 0}function yc(e,{pages:t,pageParams:n}){var s;return t.length>0?(s=e.getPreviousPageParam)==null?void 0:s.call(e,t[0],t,n[0],n):void 0}function yh(e,t){return t?Ro(e,t)!=null:!1}function bh(e,t){return!t||!e.getPreviousPageParam?!1:yc(e,t)!=null}var wh=class extends gc{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:ss()})}getOptimisticResult(e){return e.behavior=ss(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var v,p;const{state:n}=e,s=super.createResult(e,t),{isFetching:o,isRefetching:a,isError:i,isRefetchError:c}=s,u=(p=(v=n.fetchMeta)==null?void 0:v.fetchMore)==null?void 0:p.direction,d=i&&u==="forward",h=o&&u==="forward",f=i&&u==="backward",m=o&&u==="backward";return{...s,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:yh(t,n.data),hasPreviousPage:bh(t,n.data),isFetchNextPageError:d,isFetchingNextPage:h,isFetchPreviousPageError:f,isFetchingPreviousPage:m,isRefetchError:c&&!d&&!f,isRefetching:a&&!h&&!m}}},Cr,et,Ce,cn,tt,Rt,tc,jh=(tc=class extends mc{constructor(t){super();F(this,tt);F(this,Cr);F(this,et);F(this,Ce);F(this,cn);M(this,Cr,t.client),this.mutationId=t.mutationId,M(this,Ce,t.mutationCache),M(this,et,[]),this.state=t.state||bc(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){b(this,et).includes(t)||(b(this,et).push(t),this.clearGcTimeout(),b(this,Ce).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){M(this,et,b(this,et).filter(n=>n!==t)),this.scheduleGc(),b(this,Ce).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){b(this,et).length||(this.state.status==="pending"?this.scheduleGc():b(this,Ce).remove(this))}continue(){var t;return((t=b(this,cn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,c,u,d,h,f,m,g,v,p,x,y,w,N,j,C,E,S;const n=()=>{J(this,tt,Rt).call(this,{type:"continue"})},s={client:b(this,Cr),meta:this.options.meta,mutationKey:this.options.mutationKey};M(this,cn,hc({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(P,D)=>{J(this,tt,Rt).call(this,{type:"failed",failureCount:P,error:D})},onPause:()=>{J(this,tt,Rt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>b(this,Ce).canRun(this)}));const o=this.state.status==="pending",a=!b(this,cn).canStart();try{if(o)n();else{J(this,tt,Rt).call(this,{type:"pending",variables:t,isPaused:a}),b(this,Ce).config.onMutate&&await b(this,Ce).config.onMutate(t,this,s);const D=await((c=(i=this.options).onMutate)==null?void 0:c.call(i,t,s));D!==this.state.context&&J(this,tt,Rt).call(this,{type:"pending",context:D,variables:t,isPaused:a})}const P=await b(this,cn).start();return await((d=(u=b(this,Ce).config).onSuccess)==null?void 0:d.call(u,P,t,this.state.context,this,s)),await((f=(h=this.options).onSuccess)==null?void 0:f.call(h,P,t,this.state.context,s)),await((g=(m=b(this,Ce).config).onSettled)==null?void 0:g.call(m,P,null,this.state.variables,this.state.context,this,s)),await((p=(v=this.options).onSettled)==null?void 0:p.call(v,P,null,t,this.state.context,s)),J(this,tt,Rt).call(this,{type:"success",data:P}),P}catch(P){try{await((y=(x=b(this,Ce).config).onError)==null?void 0:y.call(x,P,t,this.state.context,this,s))}catch(D){Promise.reject(D)}try{await((N=(w=this.options).onError)==null?void 0:N.call(w,P,t,this.state.context,s))}catch(D){Promise.reject(D)}try{await((C=(j=b(this,Ce).config).onSettled)==null?void 0:C.call(j,void 0,P,this.state.variables,this.state.context,this,s))}catch(D){Promise.reject(D)}try{await((S=(E=this.options).onSettled)==null?void 0:S.call(E,void 0,P,t,this.state.context,s))}catch(D){Promise.reject(D)}throw J(this,tt,Rt).call(this,{type:"error",error:P}),P}finally{b(this,Ce).runNext(this)}}},Cr=new WeakMap,et=new WeakMap,Ce=new WeakMap,cn=new WeakMap,tt=new WeakSet,Rt=function(t){const n=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ye.batch(()=>{b(this,et).forEach(s=>{s.onMutationUpdate(t)}),b(this,Ce).notify({mutation:this,type:"updated",action:t})})},tc);function bc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var pt,He,Sr,nc,Nh=(nc=class extends Yn{constructor(t={}){super();F(this,pt);F(this,He);F(this,Sr);this.config=t,M(this,pt,new Set),M(this,He,new Map),M(this,Sr,0)}build(t,n,s){const o=new jh({client:t,mutationCache:this,mutationId:++Fr(this,Sr)._,options:t.defaultMutationOptions(n),state:s});return this.add(o),o}add(t){b(this,pt).add(t);const n=$r(t);if(typeof n=="string"){const s=b(this,He).get(n);s?s.push(t):b(this,He).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(b(this,pt).delete(t)){const n=$r(t);if(typeof n=="string"){const s=b(this,He).get(n);if(s)if(s.length>1){const o=s.indexOf(t);o!==-1&&s.splice(o,1)}else s[0]===t&&b(this,He).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=$r(t);if(typeof n=="string"){const s=b(this,He).get(n),o=s==null?void 0:s.find(a=>a.state.status==="pending");return!o||o===t}else return!0}runNext(t){var s;const n=$r(t);if(typeof n=="string"){const o=(s=b(this,He).get(n))==null?void 0:s.find(a=>a!==t&&a.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ye.batch(()=>{b(this,pt).forEach(t=>{this.notify({type:"removed",mutation:t})}),b(this,pt).clear(),b(this,He).clear()})}getAll(){return Array.from(b(this,pt))}find(t){const n={exact:!0,...t};return this.getAll().find(s=>Za(n,s))}findAll(t={}){return this.getAll().filter(n=>Za(t,n))}notify(t){ye.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ye.batch(()=>Promise.all(t.map(n=>n.continue().catch(Re))))}},pt=new WeakMap,He=new WeakMap,Sr=new WeakMap,nc);function $r(e){var t;return(t=e.options.scope)==null?void 0:t.id}var xt,It,Ae,gt,yt,Qr,Po,rc,Ch=(rc=class extends Yn{constructor(n,s){super();F(this,yt);F(this,xt);F(this,It);F(this,Ae);F(this,gt);M(this,xt,n),this.setOptions(s),this.bindMethods(),J(this,yt,Qr).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const s=this.options;this.options=b(this,xt).defaultMutationOptions(n),ns(this.options,s)||b(this,xt).getMutationCache().notify({type:"observerOptionsUpdated",mutation:b(this,Ae),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&dn(s.mutationKey)!==dn(this.options.mutationKey)?this.reset():((o=b(this,Ae))==null?void 0:o.state.status)==="pending"&&b(this,Ae).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=b(this,Ae))==null||n.removeObserver(this)}onMutationUpdate(n){J(this,yt,Qr).call(this),J(this,yt,Po).call(this,n)}getCurrentResult(){return b(this,It)}reset(){var n;(n=b(this,Ae))==null||n.removeObserver(this),M(this,Ae,void 0),J(this,yt,Qr).call(this),J(this,yt,Po).call(this)}mutate(n,s){var o;return M(this,gt,s),(o=b(this,Ae))==null||o.removeObserver(this),M(this,Ae,b(this,xt).getMutationCache().build(b(this,xt),this.options)),b(this,Ae).addObserver(this),b(this,Ae).execute(n)}},xt=new WeakMap,It=new WeakMap,Ae=new WeakMap,gt=new WeakMap,yt=new WeakSet,Qr=function(){var s;const n=((s=b(this,Ae))==null?void 0:s.state)??bc();M(this,It,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Po=function(n){ye.batch(()=>{var s,o,a,i,c,u,d,h;if(b(this,gt)&&this.hasListeners()){const f=b(this,It).variables,m=b(this,It).context,g={client:b(this,xt),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(o=(s=b(this,gt)).onSuccess)==null||o.call(s,n.data,f,m,g)}catch(v){Promise.reject(v)}try{(i=(a=b(this,gt)).onSettled)==null||i.call(a,n.data,null,f,m,g)}catch(v){Promise.reject(v)}}else if((n==null?void 0:n.type)==="error"){try{(u=(c=b(this,gt)).onError)==null||u.call(c,n.error,f,m,g)}catch(v){Promise.reject(v)}try{(h=(d=b(this,gt)).onSettled)==null||h.call(d,void 0,n.error,f,m,g)}catch(v){Promise.reject(v)}}}this.listeners.forEach(f=>{f(b(this,It))})})},rc),nt,sc,Sh=(sc=class extends Yn{constructor(t={}){super();F(this,nt);this.config=t,M(this,nt,new Map)}build(t,n,s){const o=n.queryKey,a=n.queryHash??ea(o,n);let i=this.get(a);return i||(i=new xh({client:t,queryKey:o,queryHash:a,options:t.defaultQueryOptions(n),state:s,defaultOptions:t.getQueryDefaults(o)}),this.add(i)),i}add(t){b(this,nt).has(t.queryHash)||(b(this,nt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=b(this,nt).get(t.queryHash);n&&(t.destroy(),n===t&&b(this,nt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ye.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return b(this,nt).get(t)}getAll(){return[...b(this,nt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(s=>Xa(n,s))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(s=>Xa(t,s)):n}notify(t){ye.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ye.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ye.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},nt=new WeakMap,sc),ve,Dt,zt,Fn,$n,Lt,Un,Vn,oc,Eh=(oc=class{constructor(e={}){F(this,ve);F(this,Dt);F(this,zt);F(this,Fn);F(this,$n);F(this,Lt);F(this,Un);F(this,Vn);M(this,ve,e.queryCache||new Sh),M(this,Dt,e.mutationCache||new Nh),M(this,zt,e.defaultOptions||{}),M(this,Fn,new Map),M(this,$n,new Map),M(this,Lt,0)}mount(){Fr(this,Lt)._++,b(this,Lt)===1&&(M(this,Un,Jo.subscribe(async e=>{e&&(await this.resumePausedMutations(),b(this,ve).onFocus())})),M(this,Vn,rs.subscribe(async e=>{e&&(await this.resumePausedMutations(),b(this,ve).onOnline())})))}unmount(){var e,t;Fr(this,Lt)._--,b(this,Lt)===0&&((e=b(this,Un))==null||e.call(this),M(this,Un,void 0),(t=b(this,Vn))==null||t.call(this),M(this,Vn,void 0))}isFetching(e){return b(this,ve).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return b(this,Dt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=b(this,ve).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=b(this,ve).build(this,t),s=n.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime($t(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return b(this,ve).findAll(e).map(({queryKey:t,state:n})=>{const s=n.data;return[t,s]})}setQueryData(e,t,n){const s=this.defaultQueryOptions({queryKey:e}),o=b(this,ve).get(s.queryHash),a=o==null?void 0:o.state.data,i=ah(t,a);if(i!==void 0)return b(this,ve).build(this,s).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return ye.batch(()=>b(this,ve).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=b(this,ve).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=b(this,ve);ye.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=b(this,ve);return ye.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},s=ye.batch(()=>b(this,ve).findAll(e).map(o=>o.cancel(n)));return Promise.all(s).then(Re).catch(Re)}invalidateQueries(e,t={}){return ye.batch(()=>(b(this,ve).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},s=ye.batch(()=>b(this,ve).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let a=o.fetch(void 0,n);return n.throwOnError||(a=a.catch(Re)),o.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(s).then(Re)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=b(this,ve).build(this,t);return n.isStaleByTime($t(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Re).catch(Re)}fetchInfiniteQuery(e){return e.behavior=ss(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Re).catch(Re)}ensureInfiniteQueryData(e){return e.behavior=ss(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return rs.isOnline()?b(this,Dt).resumePausedMutations():Promise.resolve()}getQueryCache(){return b(this,ve)}getMutationCache(){return b(this,Dt)}getDefaultOptions(){return b(this,zt)}setDefaultOptions(e){M(this,zt,e)}setQueryDefaults(e,t){b(this,Fn).set(dn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...b(this,Fn).values()],n={};return t.forEach(s=>{hr(e,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(e,t){b(this,$n).set(dn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...b(this,$n).values()],n={};return t.forEach(s=>{hr(e,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...b(this,zt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ea(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ta&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...b(this,zt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){b(this,ve).clear(),b(this,Dt).clear()}},ve=new WeakMap,Dt=new WeakMap,zt=new WeakMap,Fn=new WeakMap,$n=new WeakMap,Lt=new WeakMap,Un=new WeakMap,Vn=new WeakMap,oc),wc=l.createContext(void 0),be=e=>{const t=l.useContext(wc);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Rh=({client:e,children:t})=>(l.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),r.jsx(wc.Provider,{value:e,children:t})),jc=l.createContext(!1),Ph=()=>l.useContext(jc);jc.Provider;function kh(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Th=l.createContext(kh()),Ah=()=>l.useContext(Th),Mh=(e,t,n)=>{const s=n!=null&&n.state.error&&typeof e.throwOnError=="function"?na(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||s)&&(t.isReset()||(e.retryOnMount=!1))},_h=e=>{l.useEffect(()=>{e.clearReset()},[e])},Oh=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(o&&e.data===void 0||na(n,[e.error,s])),Ih=e=>{if(e.suspense){const n=o=>o==="static"?o:Math.max(o??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...o)=>n(s(...o)):n(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Dh=(e,t)=>e.isLoading&&e.isFetching&&!t,zh=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,oi=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Nc(e,t,n){var m,g,v,p;const s=Ph(),o=Ah(),a=be(),i=a.defaultQueryOptions(e);(g=(m=a.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||g.call(m,i);const c=a.getQueryCache().get(i.queryHash);i._optimisticResults=s?"isRestoring":"optimistic",Ih(i),Mh(i,o,c),_h(o);const u=!a.getQueryCache().get(i.queryHash),[d]=l.useState(()=>new t(a,i)),h=d.getOptimisticResult(i),f=!s&&e.subscribed!==!1;if(l.useSyncExternalStore(l.useCallback(x=>{const y=f?d.subscribe(ye.batchCalls(x)):Re;return d.updateResult(),y},[d,f]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),l.useEffect(()=>{d.setOptions(i)},[i,d]),zh(i,h))throw oi(i,d,o);if(Oh({result:h,errorResetBoundary:o,throwOnError:i.throwOnError,query:c,suspense:i.suspense}))throw h.error;if((p=(v=a.getDefaultOptions().queries)==null?void 0:v._experimental_afterQuery)==null||p.call(v,i,h),i.experimental_prefetchInRender&&!mr.isServer()&&Dh(h,s)){const x=u?oi(i,d,o):c==null?void 0:c.promise;x==null||x.catch(Re).finally(()=>{d.updateResult()})}return i.notifyOnChangeProps?h:d.trackResult(h)}function Pe(e,t){return Nc(e,gc)}function Ne(e,t){const n=be(),[s]=l.useState(()=>new Ch(n,e));l.useEffect(()=>{s.setOptions(e)},[s,e]);const o=l.useSyncExternalStore(l.useCallback(i=>s.subscribe(ye.batchCalls(i)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),a=l.useCallback((i,c)=>{s.mutate(i,c).catch(Re)},[s]);if(o.error&&na(s.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:a,mutateAsync:o.mutate}}function Cc(e,t){return Nc(e,wh)}const os=new Eh({defaultOptions:{queries:{staleTime:3e4,gcTime:5*6e4,retry:1,refetchOnWindowFocus:!1}}});var Lh={pending:["confirmed","cancelled"],confirmed:["processing","cancelled","refunded","partially_refunded"],processing:["shipped","cancelled","refunded","partially_refunded"],shipped:["delivered","refunded","partially_refunded"],delivered:["refunded","partially_refunded"],cancelled:[],refunded:[],partially_refunded:["refunded"]};function Fh(e){return e.capturedMinor<=0?"unpaid":e.refundedMinor<=0?"paid":e.refundedMinor<e.capturedMinor?"partially_refunded":"refunded"}var $h="product.created.v1",Uh="product.updated.v1",Vh="product.deleted.v1",Bh="product.published.v1",Kh="product.unpublished.v1",qh="product.viewed.v1",Hh="product.restocked.v1",Wh="product.variant_price_changed.v1",Gh="category.created.v1",Qh="category.updated.v1",Yh="category.deleted.v1",Xh="order.placed.v1",Zh="order.paid.v1",Jh="order.fulfilled.v1",em="order.shipped.v1",tm="order.delivered.v1",nm="order.cancelled.v1",rm="order.refunded.v1",sm="order.partially_refunded.v1",om="order.status_changed.v1",am="order.confirmation_resend_requested.v1",im="inventory.changed.v1",cm="inventory.reserved.v1",lm="inventory.released.v1",dm="inventory.low_stock.v1",um="inventory.out_of_stock.v1",fm="customer.created.v1",hm="customer.updated.v1",mm="customer.deleted.v1",pm="visitor.merged.v1",xm="cart.created.v1",gm="cart.item_added.v1",vm="cart.item_removed.v1",ym="cart.updated.v1",bm="cart.abandoned.v1",wm="cart.converted.v1",jm="payment.intent_created.v1",Nm="payment.captured.v1",Cm="payment.failed.v1",Sm="payment.refunded.v1",Em="alert.requested.v1",Rm="alert.repeated.v1",Pm="alert.confirmed.v1",km="alert.unsubscribed.v1",Tm="alert.sent.v1",Am="adapter.error.v1",Mm="settings.changed.v1",_m=[$h,Uh,Vh,Bh,Kh,qh,Hh,Wh,Gh,Qh,Yh,Xh,Zh,Jh,em,tm,nm,rm,sm,om,am,im,cm,lm,dm,um,fm,hm,mm,pm,xm,gm,vm,ym,bm,wm,jm,Nm,Cm,Sm,Em,Rm,Pm,km,Tm,Am,Mm],Om="idempotency-key";class un extends Error{constructor(t,n,s,o){super(n),this.code=t,this.status=s,this.context=o,this.name="ApiError"}}const Im="x-csrf-token",Dm=new Set(["POST","PUT","PATCH","DELETE"]);let Yr=null;function zm(){return Yr??(Yr=fetch("/api/csrf").then(async e=>{var n;const t=await e.json();if(!e.ok||!((n=t.data)!=null&&n.token))throw new un("csrf.unavailable",`GET /api/csrf answered ${e.status}`,e.status);return t.data.token}).catch(e=>{throw Yr=null,e})),Yr}async function Lm(e){var n;return e.status!==403?!1:((n=(await e.clone().json().catch(()=>({}))).error)==null?void 0:n.code)==="csrf.invalid"}async function sa(e,t={}){const n=(t.method??"GET").toUpperCase();if(!Dm.has(n))return fetch(e,t);const s=async()=>{const a=new Headers(t.headers);return a.set(Im,await zm()),fetch(e,{...t,headers:a})},o=await s();return await Lm(o)?(Yr=null,s()):o}function Fm(e,t){if(!t)return e;const n=new URLSearchParams;for(const[o,a]of Object.entries(t))a!=null&&a!==""&&n.set(o,String(a));const s=n.toString();return s?`${e}?${s}`:e}async function $m(e){const t=Ec();return t!==e?t!==null:Km()}function ko(){return crypto.randomUUID()}async function Pt(e,t,n,s={}){const{query:o,retried:a=!1}=s,i=Ec(),c={};i&&(c.Authorization=`Bearer ${i}`),s.idempotencyKey!==void 0&&(c[Om]=s.idempotencyKey);const u=Fm(t,o),d={method:e,headers:c};n!==void 0&&(c["Content-Type"]="application/json",d.body=JSON.stringify(n));const h=await sa(u,d);if(h.status===401){if(!a&&i!==null&&!t.startsWith("/api/auth/")&&await $m(i))return Pt(e,t,n,{...s,retried:!0});const g=(await h.json().catch(()=>({}))).error;throw new un((g==null?void 0:g.code)??"UNAUTHORIZED",(g==null?void 0:g.message)??"Unauthorized",401)}if(s.text&&h.ok)return await h.text();const f=await h.json();if(!h.ok){const m=f.error;throw new un((m==null?void 0:m.code)??"UNKNOWN_ERROR",(m==null?void 0:m.message)??`HTTP ${h.status}`,h.status,m==null?void 0:m.context)}return s.envelope?f:"data"in f?f.data:f}function Ur(e,t){const n=(e==null?void 0:e.idempotencyKey)??(t.startsWith("/api/admin/")?ko():void 0);return n===void 0?{}:{idempotencyKey:n}}const se={get(e,t){return Pt("GET",e,void 0,t===void 0?{}:{query:t})},getPage(e,t){return Pt("GET",e,void 0,{envelope:!0,...t&&{query:t}})},getText(e,t){return Pt("GET",e,void 0,{text:!0,...t&&{query:t}})},post(e,t,n){return Pt("POST",e,t,Ur(n,e))},patch(e,t,n){return Pt("PATCH",e,t,Ur(n,e))},put(e,t,n){return Pt("PUT",e,t,Ur(n,e))},delete(e,t){return Pt("DELETE",e,void 0,Ur(t,e))}};let vs=null,Ws=null;const To=new Set;function Sc(e){vs=e}function Ec(){return vs}function Rc(){vs=null}function as(){return vs!==null}function Um(e){return To.add(e),()=>{To.delete(e)}}async function Vm(e){var t,n;try{const s=await fetch("/api/admin/me",{headers:{Authorization:`Bearer ${e}`}});return s.ok?((n=(t=(await s.json()).data)==null?void 0:t.roles)==null?void 0:n.includes("admin"))??!1:!1}catch{return!1}}async function Bm(){var t;let e;try{const n=await sa("/api/auth/refresh",{method:"POST"});if(!n.ok)return!1;e=(t=(await n.json()).data)==null?void 0:t.accessToken}catch{return!1}return!e||!await Vm(e)?!1:(Sc(e),!0)}function Pc(e){return Ws??(Ws=Bm().then(t=>{if(Ws=null,!t&&(Rc(),e))for(const n of[...To])n();return t})),Ws}function Km(){return Pc(!0)}function qm(){return Pc(!1)}/**
|
|
10
|
-
* @license lucide-react v0.462.0 - ISC
|
|
11
|
-
*
|
|
12
|
-
* This source code is licensed under the ISC license.
|
|
13
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
14
|
-
*/const Hm=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),kc=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();/**
|
|
15
|
-
* @license lucide-react v0.462.0 - ISC
|
|
16
|
-
*
|
|
17
|
-
* This source code is licensed under the ISC license.
|
|
18
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
19
|
-
*/var Wm={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
20
|
-
* @license lucide-react v0.462.0 - ISC
|
|
21
|
-
*
|
|
22
|
-
* This source code is licensed under the ISC license.
|
|
23
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
24
|
-
*/const Gm=l.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:o="",children:a,iconNode:i,...c},u)=>l.createElement("svg",{ref:u,...Wm,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:kc("lucide",o),...c},[...i.map(([d,h])=>l.createElement(d,h)),...Array.isArray(a)?a:[a]]));/**
|
|
25
|
-
* @license lucide-react v0.462.0 - ISC
|
|
26
|
-
*
|
|
27
|
-
* This source code is licensed under the ISC license.
|
|
28
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
29
|
-
*/const q=(e,t)=>{const n=l.forwardRef(({className:s,...o},a)=>l.createElement(Gm,{ref:a,iconNode:t,className:kc(`lucide-${Hm(e)}`,s),...o}));return n.displayName=`${e}`,n};/**
|
|
30
|
-
* @license lucide-react v0.462.0 - ISC
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the ISC license.
|
|
33
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/const Qm=q("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
|
|
35
|
-
* @license lucide-react v0.462.0 - ISC
|
|
36
|
-
*
|
|
37
|
-
* This source code is licensed under the ISC license.
|
|
38
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
39
|
-
*/const oa=q("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
|
|
40
|
-
* @license lucide-react v0.462.0 - ISC
|
|
41
|
-
*
|
|
42
|
-
* This source code is licensed under the ISC license.
|
|
43
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
44
|
-
*/const Ym=q("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
|
|
45
|
-
* @license lucide-react v0.462.0 - ISC
|
|
46
|
-
*
|
|
47
|
-
* This source code is licensed under the ISC license.
|
|
48
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
49
|
-
*/const Tc=q("Boxes",[["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"}]]);/**
|
|
50
|
-
* @license lucide-react v0.462.0 - ISC
|
|
51
|
-
*
|
|
52
|
-
* This source code is licensed under the ISC license.
|
|
53
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
54
|
-
*/const Xm=q("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
|
|
55
|
-
* @license lucide-react v0.462.0 - ISC
|
|
56
|
-
*
|
|
57
|
-
* This source code is licensed under the ISC license.
|
|
58
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
59
|
-
*/const Zm=q("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/**
|
|
60
|
-
* @license lucide-react v0.462.0 - ISC
|
|
61
|
-
*
|
|
62
|
-
* This source code is licensed under the ISC license.
|
|
63
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
64
|
-
*/const Xn=q("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
65
|
-
* @license lucide-react v0.462.0 - ISC
|
|
66
|
-
*
|
|
67
|
-
* This source code is licensed under the ISC license.
|
|
68
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
69
|
-
*/const Ac=q("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
70
|
-
* @license lucide-react v0.462.0 - ISC
|
|
71
|
-
*
|
|
72
|
-
* This source code is licensed under the ISC license.
|
|
73
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
74
|
-
*/const Mc=q("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
75
|
-
* @license lucide-react v0.462.0 - ISC
|
|
76
|
-
*
|
|
77
|
-
* This source code is licensed under the ISC license.
|
|
78
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
79
|
-
*/const Jm=q("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
80
|
-
* @license lucide-react v0.462.0 - ISC
|
|
81
|
-
*
|
|
82
|
-
* This source code is licensed under the ISC license.
|
|
83
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
84
|
-
*/const ep=q("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
85
|
-
* @license lucide-react v0.462.0 - ISC
|
|
86
|
-
*
|
|
87
|
-
* This source code is licensed under the ISC license.
|
|
88
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
89
|
-
*/const ai=q("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
90
|
-
* @license lucide-react v0.462.0 - ISC
|
|
91
|
-
*
|
|
92
|
-
* This source code is licensed under the ISC license.
|
|
93
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
94
|
-
*/const tp=q("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
|
95
|
-
* @license lucide-react v0.462.0 - ISC
|
|
96
|
-
*
|
|
97
|
-
* This source code is licensed under the ISC license.
|
|
98
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
99
|
-
*/const np=q("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
100
|
-
* @license lucide-react v0.462.0 - ISC
|
|
101
|
-
*
|
|
102
|
-
* This source code is licensed under the ISC license.
|
|
103
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
104
|
-
*/const ii=q("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
105
|
-
* @license lucide-react v0.462.0 - ISC
|
|
106
|
-
*
|
|
107
|
-
* This source code is licensed under the ISC license.
|
|
108
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
109
|
-
*/const rp=q("Copy",[["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"}]]);/**
|
|
110
|
-
* @license lucide-react v0.462.0 - ISC
|
|
111
|
-
*
|
|
112
|
-
* This source code is licensed under the ISC license.
|
|
113
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
114
|
-
*/const sp=q("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
|
|
115
|
-
* @license lucide-react v0.462.0 - ISC
|
|
116
|
-
*
|
|
117
|
-
* This source code is licensed under the ISC license.
|
|
118
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
119
|
-
*/const op=q("DollarSign",[["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"}]]);/**
|
|
120
|
-
* @license lucide-react v0.462.0 - ISC
|
|
121
|
-
*
|
|
122
|
-
* This source code is licensed under the ISC license.
|
|
123
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
124
|
-
*/const ap=q("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
125
|
-
* @license lucide-react v0.462.0 - ISC
|
|
126
|
-
*
|
|
127
|
-
* This source code is licensed under the ISC license.
|
|
128
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
129
|
-
*/const _c=q("Ellipsis",[["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"}]]);/**
|
|
130
|
-
* @license lucide-react v0.462.0 - ISC
|
|
131
|
-
*
|
|
132
|
-
* This source code is licensed under the ISC license.
|
|
133
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
134
|
-
*/const ip=q("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
|
|
135
|
-
* @license lucide-react v0.462.0 - ISC
|
|
136
|
-
*
|
|
137
|
-
* This source code is licensed under the ISC license.
|
|
138
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
139
|
-
*/const Bn=q("History",[["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"}]]);/**
|
|
140
|
-
* @license lucide-react v0.462.0 - ISC
|
|
141
|
-
*
|
|
142
|
-
* This source code is licensed under the ISC license.
|
|
143
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
144
|
-
*/const cp=q("Image",[["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"}]]);/**
|
|
145
|
-
* @license lucide-react v0.462.0 - ISC
|
|
146
|
-
*
|
|
147
|
-
* This source code is licensed under the ISC license.
|
|
148
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
149
|
-
*/const lp=q("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
150
|
-
* @license lucide-react v0.462.0 - ISC
|
|
151
|
-
*
|
|
152
|
-
* This source code is licensed under the ISC license.
|
|
153
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
154
|
-
*/const dp=q("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
|
|
155
|
-
* @license lucide-react v0.462.0 - ISC
|
|
156
|
-
*
|
|
157
|
-
* This source code is licensed under the ISC license.
|
|
158
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
159
|
-
*/const up=q("LayoutDashboard",[["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"}]]);/**
|
|
160
|
-
* @license lucide-react v0.462.0 - ISC
|
|
161
|
-
*
|
|
162
|
-
* This source code is licensed under the ISC license.
|
|
163
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
164
|
-
*/const aa=q("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
165
|
-
* @license lucide-react v0.462.0 - ISC
|
|
166
|
-
*
|
|
167
|
-
* This source code is licensed under the ISC license.
|
|
168
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
169
|
-
*/const fp=q("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
|
|
170
|
-
* @license lucide-react v0.462.0 - ISC
|
|
171
|
-
*
|
|
172
|
-
* This source code is licensed under the ISC license.
|
|
173
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
174
|
-
*/const Oc=q("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
|
|
175
|
-
* @license lucide-react v0.462.0 - ISC
|
|
176
|
-
*
|
|
177
|
-
* This source code is licensed under the ISC license.
|
|
178
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
179
|
-
*/const hp=q("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
|
|
180
|
-
* @license lucide-react v0.462.0 - ISC
|
|
181
|
-
*
|
|
182
|
-
* This source code is licensed under the ISC license.
|
|
183
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
184
|
-
*/const mp=q("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
|
185
|
-
* @license lucide-react v0.462.0 - ISC
|
|
186
|
-
*
|
|
187
|
-
* This source code is licensed under the ISC license.
|
|
188
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
189
|
-
*/const pp=q("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
|
|
190
|
-
* @license lucide-react v0.462.0 - ISC
|
|
191
|
-
*
|
|
192
|
-
* This source code is licensed under the ISC license.
|
|
193
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
194
|
-
*/const Vt=q("Package",[["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"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
|
|
195
|
-
* @license lucide-react v0.462.0 - ISC
|
|
196
|
-
*
|
|
197
|
-
* This source code is licensed under the ISC license.
|
|
198
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
199
|
-
*/const xp=q("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
|
|
200
|
-
* @license lucide-react v0.462.0 - ISC
|
|
201
|
-
*
|
|
202
|
-
* This source code is licensed under the ISC license.
|
|
203
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
204
|
-
*/const pr=q("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
205
|
-
* @license lucide-react v0.462.0 - ISC
|
|
206
|
-
*
|
|
207
|
-
* This source code is licensed under the ISC license.
|
|
208
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
209
|
-
*/const gp=q("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
|
|
210
|
-
* @license lucide-react v0.462.0 - ISC
|
|
211
|
-
*
|
|
212
|
-
* This source code is licensed under the ISC license.
|
|
213
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
214
|
-
*/const Zn=q("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
215
|
-
* @license lucide-react v0.462.0 - ISC
|
|
216
|
-
*
|
|
217
|
-
* This source code is licensed under the ISC license.
|
|
218
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
219
|
-
*/const Ic=q("Send",[["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"}]]);/**
|
|
220
|
-
* @license lucide-react v0.462.0 - ISC
|
|
221
|
-
*
|
|
222
|
-
* This source code is licensed under the ISC license.
|
|
223
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
224
|
-
*/const vp=q("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
225
|
-
* @license lucide-react v0.462.0 - ISC
|
|
226
|
-
*
|
|
227
|
-
* This source code is licensed under the ISC license.
|
|
228
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
229
|
-
*/const Kn=q("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/**
|
|
230
|
-
* @license lucide-react v0.462.0 - ISC
|
|
231
|
-
*
|
|
232
|
-
* This source code is licensed under the ISC license.
|
|
233
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
234
|
-
*/const yp=q("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
|
|
235
|
-
* @license lucide-react v0.462.0 - ISC
|
|
236
|
-
*
|
|
237
|
-
* This source code is licensed under the ISC license.
|
|
238
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
239
|
-
*/const bp=q("Star",[["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"}]]);/**
|
|
240
|
-
* @license lucide-react v0.462.0 - ISC
|
|
241
|
-
*
|
|
242
|
-
* This source code is licensed under the ISC license.
|
|
243
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
244
|
-
*/const Dc=q("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
245
|
-
* @license lucide-react v0.462.0 - ISC
|
|
246
|
-
*
|
|
247
|
-
* This source code is licensed under the ISC license.
|
|
248
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
249
|
-
*/const Ao=q("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
|
|
250
|
-
* @license lucide-react v0.462.0 - ISC
|
|
251
|
-
*
|
|
252
|
-
* This source code is licensed under the ISC license.
|
|
253
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
254
|
-
*/const is=q("TriangleAlert",[["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"}]]);/**
|
|
255
|
-
* @license lucide-react v0.462.0 - ISC
|
|
256
|
-
*
|
|
257
|
-
* This source code is licensed under the ISC license.
|
|
258
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
259
|
-
*/const zc=q("Truck",[["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"}]]);/**
|
|
260
|
-
* @license lucide-react v0.462.0 - ISC
|
|
261
|
-
*
|
|
262
|
-
* This source code is licensed under the ISC license.
|
|
263
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
264
|
-
*/const ia=q("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
|
|
265
|
-
* @license lucide-react v0.462.0 - ISC
|
|
266
|
-
*
|
|
267
|
-
* This source code is licensed under the ISC license.
|
|
268
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
269
|
-
*/const Rr=q("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Lc(){return Pe({queryKey:["me"],queryFn:()=>se.get("/api/admin/me"),staleTime:5*6e4})}function Fc(){const e=jt(),t=l.useCallback(async(s,o)=>{var d;const a=await sa("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:s,password:o})}),i=await a.json();if(!a.ok||!i.data)throw new Error(((d=i.error)==null?void 0:d.message)??"Login failed");const{accessToken:c,customer:u}=i.data;if(!u.roles.includes("admin"))throw new Error("Not authorized: admin role required");Sc(c),await os.invalidateQueries({queryKey:["me"]}),e("/")},[e]),n=l.useCallback(async()=>{await se.post("/api/auth/logout").catch(()=>{}),Rc(),os.clear(),e("/login")},[e]);return{isAuthenticated:as(),login:t,logout:n}}function ca(){const[e,t]=l.useState(ko),n=l.useCallback(()=>t(ko()),[]);return[e,n]}function $c(e={}){return Pe({queryKey:["orders","list",e],queryFn:()=>se.get("/api/admin/orders",e)})}function wp(e){return Pe({queryKey:["orders","detail",e],queryFn:()=>se.get(`/api/admin/orders/${e}`),enabled:!!e})}function jp(e){return Pe({queryKey:["orders","notes",e],queryFn:()=>se.get(`/api/admin/orders/${e}/notes`),enabled:!!e})}function Np(){const e=be();return Ne({mutationFn:async({orderId:t,action:n,body:s})=>se.post(`/api/admin/orders/${t}/${n}`,s),onSuccess:t=>{e.setQueryData(["orders","detail",t.orderNumber],n=>n?{...n,...t}:t),e.invalidateQueries({queryKey:["orders","detail",t.orderNumber]}),e.invalidateQueries({queryKey:["orders","list"]}),e.invalidateQueries({queryKey:["dashboard"]})}})}function Cp(){const e=be();return Ne({mutationFn:({orderId:t,reason:n})=>se.post(`/api/admin/orders/${t}/cancel`,{reason:n}),onSuccess:t=>{e.setQueryData(["orders","detail",t.orderNumber],n=>n?{...n,...t}:t),e.invalidateQueries({queryKey:["orders","list"]})}})}function Uc(){const e=be();return Ne({mutationFn:({orderId:t,note:n})=>se.post(`/api/admin/orders/${t}/mark-paid`,n?{note:n}:{}),onSuccess:t=>{e.setQueryData(["orders","detail",t.orderNumber],n=>n?{...n,...t}:t),e.invalidateQueries({queryKey:["orders","detail",t.orderNumber]}),e.invalidateQueries({queryKey:["orders","list"]}),e.invalidateQueries({queryKey:["dashboard"]})}})}function Sp(){const e=be();return Ne({mutationFn:t=>se.post(`/api/admin/orders/${t}/mark-delivered`),onSuccess:t=>{e.setQueryData(["orders","detail",t.orderNumber],n=>n?{...n,...t}:t),e.invalidateQueries({queryKey:["orders","list"]})}})}function Ep(){const e=be();return Ne({mutationFn:({orderId:t,trackingNumber:n,carrier:s})=>se.post(`/api/admin/orders/${t}/ship`,{trackingNumber:n,carrier:s}),onSuccess:t=>{e.setQueryData(["orders","detail",t.orderNumber],n=>n?{...n,...t}:t),e.invalidateQueries({queryKey:["orders","list"]})}})}function Rp(){const e=be();return Ne({mutationFn:({orderId:t,amountMinor:n,reason:s,requestId:o})=>se.post(`/api/admin/orders/${t}/refund`,s?{amountMinor:n,reason:s,requestId:o}:{amountMinor:n,requestId:o}),onSuccess:async t=>{await Promise.all([e.invalidateQueries({queryKey:["orders","detail",t.order.orderNumber]}),e.invalidateQueries({queryKey:["orders","list"]}),e.invalidateQueries({queryKey:["dashboard"]})])}})}function Pp(){const[e,t]=ca();return Ne({mutationFn:({orderId:n})=>se.post(`/api/admin/orders/${n}/resend-confirmation`,void 0,{idempotencyKey:e}),onSettled:t})}function kp(){const e=be();return Ne({mutationFn:({orderId:t,body:n})=>se.post(`/api/admin/orders/${t}/notes`,{body:n}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["orders","notes",n.orderId]})}})}function B(...e){return["admin",...e].join("-")}function Vc(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Vc(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function Bc(){for(var e,t,n=0,s="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Vc(e))&&(s&&(s+=" "),s+=t);return s}const la="-",Tp=e=>{const t=Mp(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:i=>{const c=i.split(la);return c[0]===""&&c.length!==1&&c.shift(),Kc(c,t)||Ap(i)},getConflictingClassGroupIds:(i,c)=>{const u=n[i]||[];return c&&s[i]?[...u,...s[i]]:u}}},Kc=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),o=s?Kc(e.slice(1),s):void 0;if(o)return o;if(t.validators.length===0)return;const a=e.join(la);return(i=t.validators.find(({validator:c})=>c(a)))==null?void 0:i.classGroupId},ci=/^\[(.+)\]$/,Ap=e=>{if(ci.test(e)){const t=ci.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Mp=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return Op(Object.entries(e.classGroups),n).forEach(([a,i])=>{Mo(i,s,a,t)}),s},Mo=(e,t,n,s)=>{e.forEach(o=>{if(typeof o=="string"){const a=o===""?t:li(t,o);a.classGroupId=n;return}if(typeof o=="function"){if(_p(o)){Mo(o(s),t,n,s);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([a,i])=>{Mo(i,li(t,a),n,s)})})},li=(e,t)=>{let n=e;return t.split(la).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},_p=e=>e.isThemeGetter,Op=(e,t)=>t?e.map(([n,s])=>{const o=s.map(a=>typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([i,c])=>[t+i,c])):a);return[n,o]}):e,Ip=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const o=(a,i)=>{n.set(a,i),t++,t>e&&(t=0,s=n,n=new Map)};return{get(a){let i=n.get(a);if(i!==void 0)return i;if((i=s.get(a))!==void 0)return o(a,i),i},set(a,i){n.has(a)?n.set(a,i):o(a,i)}}},qc="!",Dp=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,o=t[0],a=t.length,i=c=>{const u=[];let d=0,h=0,f;for(let x=0;x<c.length;x++){let y=c[x];if(d===0){if(y===o&&(s||c.slice(x,x+a)===t)){u.push(c.slice(h,x)),h=x+a;continue}if(y==="/"){f=x;continue}}y==="["?d++:y==="]"&&d--}const m=u.length===0?c:c.substring(h),g=m.startsWith(qc),v=g?m.substring(1):m,p=f&&f>h?f-h:void 0;return{modifiers:u,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:p}};return n?c=>n({className:c,parseClassName:i}):i},zp=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(s=>{s[0]==="["?(t.push(...n.sort(),s),n=[]):n.push(s)}),t.push(...n.sort()),t},Lp=e=>({cache:Ip(e.cacheSize),parseClassName:Dp(e),...Tp(e)}),Fp=/\s+/,$p=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o}=t,a=[],i=e.trim().split(Fp);let c="";for(let u=i.length-1;u>=0;u-=1){const d=i[u],{modifiers:h,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:g}=n(d);let v=!!g,p=s(v?m.substring(0,g):m);if(!p){if(!v){c=d+(c.length>0?" "+c:c);continue}if(p=s(m),!p){c=d+(c.length>0?" "+c:c);continue}v=!1}const x=zp(h).join(":"),y=f?x+qc:x,w=y+p;if(a.includes(w))continue;a.push(w);const N=o(p,v);for(let j=0;j<N.length;++j){const C=N[j];a.push(y+C)}c=d+(c.length>0?" "+c:c)}return c};function Up(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Hc(t))&&(s&&(s+=" "),s+=n);return s}const Hc=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Hc(e[s]))&&(n&&(n+=" "),n+=t);return n};function Vp(e,...t){let n,s,o,a=i;function i(u){const d=t.reduce((h,f)=>f(h),e());return n=Lp(d),s=n.cache.get,o=n.cache.set,a=c,c(u)}function c(u){const d=s(u);if(d)return d;const h=$p(u,n);return o(u,h),h}return function(){return a(Up.apply(null,arguments))}}const me=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Wc=/^\[(?:([a-z-]+):)?(.+)\]$/i,Bp=/^\d+\/\d+$/,Kp=new Set(["px","full","screen"]),qp=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Hp=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Wp=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Gp=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Qp=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ft=e=>Pn(e)||Kp.has(e)||Bp.test(e),St=e=>Jn(e,"length",rx),Pn=e=>!!e&&!Number.isNaN(Number(e)),Gs=e=>Jn(e,"number",Pn),ir=e=>!!e&&Number.isInteger(Number(e)),Yp=e=>e.endsWith("%")&&Pn(e.slice(0,-1)),ee=e=>Wc.test(e),Et=e=>qp.test(e),Xp=new Set(["length","size","percentage"]),Zp=e=>Jn(e,Xp,Gc),Jp=e=>Jn(e,"position",Gc),ex=new Set(["image","url"]),tx=e=>Jn(e,ex,ox),nx=e=>Jn(e,"",sx),cr=()=>!0,Jn=(e,t,n)=>{const s=Wc.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},rx=e=>Hp.test(e)&&!Wp.test(e),Gc=()=>!1,sx=e=>Gp.test(e),ox=e=>Qp.test(e),ax=()=>{const e=me("colors"),t=me("spacing"),n=me("blur"),s=me("brightness"),o=me("borderColor"),a=me("borderRadius"),i=me("borderSpacing"),c=me("borderWidth"),u=me("contrast"),d=me("grayscale"),h=me("hueRotate"),f=me("invert"),m=me("gap"),g=me("gradientColorStops"),v=me("gradientColorStopPositions"),p=me("inset"),x=me("margin"),y=me("opacity"),w=me("padding"),N=me("saturate"),j=me("scale"),C=me("sepia"),E=me("skew"),S=me("space"),P=me("translate"),D=()=>["auto","contain","none"],I=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",ee,t],_=()=>[ee,t],G=()=>["",ft,St],U=()=>["auto",Pn,ee],X=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],L=()=>["start","end","center","between","around","evenly","stretch"],T=()=>["","0",ee],ie=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ce=()=>[Pn,ee];return{cacheSize:500,separator:":",theme:{colors:[cr],spacing:[ft,St],blur:["none","",Et,ee],brightness:ce(),borderColor:[e],borderRadius:["none","","full",Et,ee],borderSpacing:_(),borderWidth:G(),contrast:ce(),grayscale:T(),hueRotate:ce(),invert:T(),gap:_(),gradientColorStops:[e],gradientColorStopPositions:[Yp,St],inset:$(),margin:$(),opacity:ce(),padding:_(),saturate:ce(),scale:ce(),sepia:T(),skew:ce(),space:_(),translate:_()},classGroups:{aspect:[{aspect:["auto","square","video",ee]}],container:["container"],columns:[{columns:[Et]}],"break-after":[{"break-after":ie()}],"break-before":[{"break-before":ie()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...X(),ee]}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ir,ee]}],basis:[{basis:$()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ee]}],grow:[{grow:T()}],shrink:[{shrink:T()}],order:[{order:["first","last","none",ir,ee]}],"grid-cols":[{"grid-cols":[cr]}],"col-start-end":[{col:["auto",{span:["full",ir,ee]},ee]}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":[cr]}],"row-start-end":[{row:["auto",{span:[ir,ee]},ee]}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ee]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ee]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...L()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...L(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...L(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[S]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[S]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ee,t]}],"min-w":[{"min-w":[ee,t,"min","max","fit"]}],"max-w":[{"max-w":[ee,t,"none","full","min","max","fit","prose",{screen:[Et]},Et]}],h:[{h:[ee,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ee,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ee,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ee,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Et,St]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Gs]}],"font-family":[{font:[cr]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ee]}],"line-clamp":[{"line-clamp":["none",Pn,Gs]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ft,ee]}],"list-image":[{"list-image":["none",ee]}],"list-style-type":[{list:["none","disc","decimal",ee]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ft,St]}],"underline-offset":[{"underline-offset":["auto",ft,ee]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ee]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ee]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...X(),Jp]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Zp]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},tx]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:V()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[ft,ee]}],"outline-w":[{outline:[ft,St]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[ft,St]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Et,nx]}],"shadow-color":[{shadow:[cr]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...re(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":re()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Et,ee]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[f]}],saturate:[{saturate:[N]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ee]}],duration:[{duration:ce()}],ease:[{ease:["linear","in","out","in-out",ee]}],delay:[{delay:ce()}],animate:[{animate:["none","spin","ping","pulse","bounce",ee]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[ir,ee]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ee]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ee]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ee]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ft,St,Gs]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},ix=Vp(ax);function k(...e){return ix(Bc(e))}const cx=[{to:"/",label:"Dashboard",icon:up,end:!0},{to:"/orders",label:"Orders",icon:Kn,end:!1},{to:"/products",label:"Products",icon:Vt,end:!1},{to:"/inventory",label:"Inventory",icon:Tc,end:!1},{to:"/customers",label:"Customers",icon:ia,end:!1},{to:"/activity",label:"Activity",icon:Bn,end:!1},{to:"/settings",label:"Settings",icon:vp,end:!1}];function lx(){const{data:e}=$c({status:"pending",limit:1});return!e||e.length===0?null:r.jsx("span",{className:"ml-auto flex h-4 min-w-4 items-center justify-center rounded-full bg-blue-500/20 px-1 text-[10px] font-semibold text-blue-400",children:e.length})}function dx({open:e,onClose:t}){const{data:n}=Lc(),{logout:s}=Fc(),o=()=>{s()};return r.jsxs("aside",{id:"admin-sidebar","data-testid":B("sidebar"),"data-state":e?"open":"closed",className:k("fixed inset-y-0 left-0 z-50 flex w-60 flex-col bg-zinc-950 transition-transform duration-150 md:visible md:translate-x-0",e?"visible translate-x-0":"invisible -translate-x-full"),children:[r.jsxs("div",{className:"flex h-14 items-center border-b border-zinc-800/60 px-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-blue-600",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"N"})}),r.jsx("span",{className:"text-sm font-bold tracking-widest text-zinc-100 uppercase",children:"Nymbal"})]}),(n==null?void 0:n.storeName)&&r.jsx("span",{className:"ml-2 truncate text-[10px] font-medium text-zinc-500 border-l border-zinc-700 pl-2",children:n.storeName})]}),r.jsx("nav",{className:"flex-1 overflow-y-auto py-3 px-2",children:r.jsx("ul",{className:"space-y-0.5",children:cx.map(a=>r.jsx("li",{children:r.jsx(Vf,{to:a.to,end:a.end,"data-testid":B("nav",a.label.toLowerCase()),onClick:t,className:({isActive:i})=>k("flex items-center gap-3 rounded-md px-3 py-2.5 text-sm font-medium transition-all duration-100",i?"border-l-2 border-blue-500 bg-blue-600/10 pl-[10px] text-blue-400":"text-zinc-400 hover:bg-zinc-800/50 hover:text-zinc-200"),children:({isActive:i})=>r.jsxs(r.Fragment,{children:[r.jsx(a.icon,{className:k("h-4 w-4 shrink-0",i?"text-blue-400":"text-zinc-500")}),r.jsx("span",{children:a.label}),a.label==="Orders"&&r.jsx(lx,{})]})})},a.to))})}),r.jsx("div",{className:"border-t border-zinc-800/60"}),r.jsx("div",{className:"p-3",children:r.jsxs("div",{className:"flex items-center gap-3 rounded-md px-3 py-2.5",children:[r.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-zinc-700 text-xs font-semibold text-zinc-300",children:n?n.userId.slice(0,2).toUpperCase():r.jsx(aa,{className:"h-3.5 w-3.5 animate-spin"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-xs font-medium text-zinc-300",children:(n==null?void 0:n.storeName)??"Loading..."}),r.jsx("p",{className:"truncate text-[10px] text-zinc-500 capitalize",children:(n==null?void 0:n.environment)??""})]}),r.jsx("button",{onClick:o,className:"rounded p-1 text-zinc-500 hover:bg-zinc-800 hover:text-zinc-300 transition-colors",title:"Sign out",children:r.jsx(fp,{className:"h-3.5 w-3.5"})})]})})]})}function ux(){const t=Bf().filter(n=>{const s=n.handle;return(s==null?void 0:s.breadcrumb)!=null}).map(n=>{var a;const s=n.handle;return{label:(a=s.breadcrumb)==null?void 0:a.call(s,n.params),pathname:n.pathname}}).filter(n=>n.label!=null);return t.length===0?null:r.jsx("nav",{className:"flex items-center gap-1 text-sm","aria-label":"Breadcrumb",children:t.map((n,s)=>{const o=s===t.length-1;return r.jsxs("span",{className:"flex items-center gap-1",children:[s>0&&r.jsx(Mc,{className:"h-3.5 w-3.5 text-zinc-400"}),o?r.jsx("span",{className:"font-medium text-zinc-900",children:n.label}):r.jsx(Ft,{to:n.pathname,className:k("text-zinc-500 hover:text-zinc-700 transition-colors","font-normal"),children:n.label})]},n.pathname)})})}const di=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ui=Bc,ys=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return ui(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:a}=t,i=Object.keys(o).map(d=>{const h=n==null?void 0:n[d],f=a==null?void 0:a[d];if(h===null)return null;const m=di(h)||di(f);return o[d][m]}),c=n&&Object.entries(n).reduce((d,h)=>{let[f,m]=h;return m===void 0||(d[f]=m),d},{}),u=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((d,h)=>{let{class:f,className:m,...g}=h;return Object.entries(g).every(v=>{let[p,x]=v;return Array.isArray(x)?x.includes({...a,...c}[p]):{...a,...c}[p]===x})?[...d,f,m]:d},[]);return ui(e,i,u,n==null?void 0:n.class,n==null?void 0:n.className)},fx=ys("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800",secondary:"bg-zinc-100 text-zinc-900 hover:bg-zinc-200 active:bg-zinc-300 border border-zinc-200",destructive:"bg-red-600 text-white hover:bg-red-700 active:bg-red-800",outline:"border border-zinc-200 bg-white text-zinc-900 hover:bg-zinc-50 active:bg-zinc-100",ghost:"text-zinc-700 hover:bg-zinc-100 hover:text-zinc-900 active:bg-zinc-200",link:"text-blue-600 underline-offset-4 hover:underline p-0 h-auto"},size:{default:"h-9 px-4 py-2",sm:"h-7 rounded px-3 text-xs",lg:"h-11 rounded-md px-8 text-base",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),le=l.forwardRef(({className:e,variant:t,size:n,...s},o)=>r.jsx("button",{className:k(fx({variant:t,size:n,className:e})),ref:o,...s}));le.displayName="Button";function O(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function fi(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function at(...e){return t=>{let n=!1;const s=e.map(o=>{const a=fi(o,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let o=0;o<s.length;o++){const a=s[o];typeof a=="function"?a():fi(e[o],null)}}}}function de(...e){return l.useCallback(at(...e),e)}function hx(e,t){const n=l.createContext(t),s=a=>{const{children:i,...c}=a,u=l.useMemo(()=>c,Object.values(c));return r.jsx(n.Provider,{value:u,children:i})};s.displayName=e+"Provider";function o(a){const i=l.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[s,o]}function lt(e,t=[]){let n=[];function s(a,i){const c=l.createContext(i),u=n.length;n=[...n,i];const d=f=>{var y;const{scope:m,children:g,...v}=f,p=((y=m==null?void 0:m[e])==null?void 0:y[u])||c,x=l.useMemo(()=>v,Object.values(v));return r.jsx(p.Provider,{value:x,children:g})};d.displayName=a+"Provider";function h(f,m){var p;const g=((p=m==null?void 0:m[e])==null?void 0:p[u])||c,v=l.useContext(g);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[d,h]}const o=()=>{const a=n.map(i=>l.createContext(i));return function(c){const u=(c==null?void 0:c[e])||a;return l.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return o.scopeName=e,[s,mx(o,...t)]}function mx(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const i=s.reduce((c,{useScope:u,scopeName:d})=>{const f=u(a)[`__scope${d}`];return{...c,...f}},{});return l.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function fn(e){const t=px(e),n=l.forwardRef((s,o)=>{const{children:a,...i}=s,c=l.Children.toArray(a),u=c.find(gx);if(u){const d=u.props.children,h=c.map(f=>f===u?l.Children.count(d)>1?l.Children.only(null):l.isValidElement(d)?d.props.children:null:f);return r.jsx(t,{...i,ref:o,children:l.isValidElement(d)?l.cloneElement(d,void 0,h):null})}return r.jsx(t,{...i,ref:o,children:a})});return n.displayName=`${e}.Slot`,n}function px(e){const t=l.forwardRef((n,s)=>{const{children:o,...a}=n;if(l.isValidElement(o)){const i=yx(o),c=vx(a,o.props);return o.type!==l.Fragment&&(c.ref=s?at(s,i):i),l.cloneElement(o,c)}return l.Children.count(o)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var xx=Symbol("radix.slottable");function gx(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===xx}function vx(e,t){const n={...t};for(const s in t){const o=e[s],a=t[s];/^on[A-Z]/.test(s)?o&&a?n[s]=(...c)=>{const u=a(...c);return o(...c),u}:o&&(n[s]=o):s==="style"?n[s]={...o,...a}:s==="className"&&(n[s]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function yx(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var bx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],W=bx.reduce((e,t)=>{const n=fn(`Primitive.${t}`),s=l.forwardRef((o,a)=>{const{asChild:i,...c}=o,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(u,{...c,ref:a})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function Qc(e,t){e&&Er.flushSync(()=>e.dispatchEvent(t))}function it(e){const t=l.useRef(e);return l.useEffect(()=>{t.current=e}),l.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function wx(e,t=globalThis==null?void 0:globalThis.document){const n=it(e);l.useEffect(()=>{const s=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var jx="DismissableLayer",_o="dismissableLayer.update",Nx="dismissableLayer.pointerDownOutside",Cx="dismissableLayer.focusOutside",hi,Yc=l.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Pr=l.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:i,onDismiss:c,...u}=e,d=l.useContext(Yc),[h,f]=l.useState(null),m=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=l.useState({}),v=de(t,S=>f(S)),p=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=p.indexOf(x),w=h?p.indexOf(h):-1,N=d.layersWithOutsidePointerEventsDisabled.size>0,j=w>=y,C=Rx(S=>{const P=S.target,D=[...d.branches].some(I=>I.contains(P));!j||D||(o==null||o(S),i==null||i(S),S.defaultPrevented||c==null||c())},m),E=Px(S=>{const P=S.target;[...d.branches].some(I=>I.contains(P))||(a==null||a(S),i==null||i(S),S.defaultPrevented||c==null||c())},m);return wx(S=>{w===d.layers.size-1&&(s==null||s(S),!S.defaultPrevented&&c&&(S.preventDefault(),c()))},m),l.useEffect(()=>{if(h)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(hi=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),mi(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=hi)}},[h,m,n,d]),l.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),mi())},[h,d]),l.useEffect(()=>{const S=()=>g({});return document.addEventListener(_o,S),()=>document.removeEventListener(_o,S)},[]),r.jsx(W.div,{...u,ref:v,style:{pointerEvents:N?j?"auto":"none":void 0,...e.style},onFocusCapture:O(e.onFocusCapture,E.onFocusCapture),onBlurCapture:O(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:O(e.onPointerDownCapture,C.onPointerDownCapture)})});Pr.displayName=jx;var Sx="DismissableLayerBranch",Ex=l.forwardRef((e,t)=>{const n=l.useContext(Yc),s=l.useRef(null),o=de(t,s);return l.useEffect(()=>{const a=s.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),r.jsx(W.div,{...e,ref:o})});Ex.displayName=Sx;function Rx(e,t=globalThis==null?void 0:globalThis.document){const n=it(e),s=l.useRef(!1),o=l.useRef(()=>{});return l.useEffect(()=>{const a=c=>{if(c.target&&!s.current){let u=function(){Xc(Nx,n,d,{discrete:!0})};const d={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=u,t.addEventListener("click",o.current,{once:!0})):u()}else t.removeEventListener("click",o.current);s.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function Px(e,t=globalThis==null?void 0:globalThis.document){const n=it(e),s=l.useRef(!1);return l.useEffect(()=>{const o=a=>{a.target&&!s.current&&Xc(Cx,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function mi(){const e=new CustomEvent(_o);document.dispatchEvent(e)}function Xc(e,t,n,{discrete:s}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),s?Qc(o,a):o.dispatchEvent(a)}var Qs=0;function bs(){l.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??pi()),document.body.insertAdjacentElement("beforeend",e[1]??pi()),Qs++,()=>{Qs===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Qs--}},[])}function pi(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ys="focusScope.autoFocusOnMount",Xs="focusScope.autoFocusOnUnmount",xi={bubbles:!1,cancelable:!0},kx="FocusScope",kr=l.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...i}=e,[c,u]=l.useState(null),d=it(o),h=it(a),f=l.useRef(null),m=de(t,p=>u(p)),g=l.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;l.useEffect(()=>{if(s){let p=function(N){if(g.paused||!c)return;const j=N.target;c.contains(j)?f.current=j:kt(f.current,{select:!0})},x=function(N){if(g.paused||!c)return;const j=N.relatedTarget;j!==null&&(c.contains(j)||kt(f.current,{select:!0}))},y=function(N){if(document.activeElement===document.body)for(const C of N)C.removedNodes.length>0&&kt(c)};document.addEventListener("focusin",p),document.addEventListener("focusout",x);const w=new MutationObserver(y);return c&&w.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",x),w.disconnect()}}},[s,c,g.paused]),l.useEffect(()=>{if(c){vi.add(g);const p=document.activeElement;if(!c.contains(p)){const y=new CustomEvent(Ys,xi);c.addEventListener(Ys,d),c.dispatchEvent(y),y.defaultPrevented||(Tx(Ix(Zc(c)),{select:!0}),document.activeElement===p&&kt(c))}return()=>{c.removeEventListener(Ys,d),setTimeout(()=>{const y=new CustomEvent(Xs,xi);c.addEventListener(Xs,h),c.dispatchEvent(y),y.defaultPrevented||kt(p??document.body,{select:!0}),c.removeEventListener(Xs,h),vi.remove(g)},0)}}},[c,d,h,g]);const v=l.useCallback(p=>{if(!n&&!s||g.paused)return;const x=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,y=document.activeElement;if(x&&y){const w=p.currentTarget,[N,j]=Ax(w);N&&j?!p.shiftKey&&y===j?(p.preventDefault(),n&&kt(N,{select:!0})):p.shiftKey&&y===N&&(p.preventDefault(),n&&kt(j,{select:!0})):y===w&&p.preventDefault()}},[n,s,g.paused]);return r.jsx(W.div,{tabIndex:-1,...i,ref:m,onKeyDown:v})});kr.displayName=kx;function Tx(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(kt(s,{select:t}),document.activeElement!==n)return}function Ax(e){const t=Zc(e),n=gi(t,e),s=gi(t.reverse(),e);return[n,s]}function Zc(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const o=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||o?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function gi(e,t){for(const n of e)if(!Mx(n,{upTo:t}))return n}function Mx(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function _x(e){return e instanceof HTMLInputElement&&"select"in e}function kt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&_x(e)&&t&&e.select()}}var vi=Ox();function Ox(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=yi(e,t),e.unshift(t)},remove(t){var n;e=yi(e,t),(n=e[0])==null||n.resume()}}}function yi(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function Ix(e){return e.filter(t=>t.tagName!=="A")}var Se=globalThis!=null&&globalThis.document?l.useLayoutEffect:()=>{},Dx=Xo[" useId ".trim().toString()]||(()=>{}),zx=0;function je(e){const[t,n]=l.useState(Dx());return Se(()=>{n(s=>s??String(zx++))},[e]),t?`radix-${t}`:""}const Lx=["top","right","bottom","left"],Bt=Math.min,De=Math.max,cs=Math.round,Vr=Math.floor,ot=e=>({x:e,y:e}),Fx={left:"right",right:"left",bottom:"top",top:"bottom"};function Oo(e,t,n){return De(e,Bt(t,n))}function bt(e,t){return typeof e=="function"?e(t):e}function wt(e){return e.split("-")[0]}function er(e){return e.split("-")[1]}function da(e){return e==="x"?"y":"x"}function ua(e){return e==="y"?"height":"width"}function st(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function fa(e){return da(st(e))}function $x(e,t,n){n===void 0&&(n=!1);const s=er(e),o=fa(e),a=ua(o);let i=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=ls(i)),[i,ls(i)]}function Ux(e){const t=ls(e);return[Io(e),t,Io(t)]}function Io(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const bi=["left","right"],wi=["right","left"],Vx=["top","bottom"],Bx=["bottom","top"];function Kx(e,t,n){switch(e){case"top":case"bottom":return n?t?wi:bi:t?bi:wi;case"left":case"right":return t?Vx:Bx;default:return[]}}function qx(e,t,n,s){const o=er(e);let a=Kx(wt(e),n==="start",s);return o&&(a=a.map(i=>i+"-"+o),t&&(a=a.concat(a.map(Io)))),a}function ls(e){const t=wt(e);return Fx[t]+e.slice(t.length)}function Hx(e){return{top:0,right:0,bottom:0,left:0,...e}}function Jc(e){return typeof e!="number"?Hx(e):{top:e,right:e,bottom:e,left:e}}function ds(e){const{x:t,y:n,width:s,height:o}=e;return{width:s,height:o,top:n,left:t,right:t+s,bottom:n+o,x:t,y:n}}function ji(e,t,n){let{reference:s,floating:o}=e;const a=st(t),i=fa(t),c=ua(i),u=wt(t),d=a==="y",h=s.x+s.width/2-o.width/2,f=s.y+s.height/2-o.height/2,m=s[c]/2-o[c]/2;let g;switch(u){case"top":g={x:h,y:s.y-o.height};break;case"bottom":g={x:h,y:s.y+s.height};break;case"right":g={x:s.x+s.width,y:f};break;case"left":g={x:s.x-o.width,y:f};break;default:g={x:s.x,y:s.y}}switch(er(t)){case"start":g[i]-=m*(n&&d?-1:1);break;case"end":g[i]+=m*(n&&d?-1:1);break}return g}async function Wx(e,t){var n;t===void 0&&(t={});const{x:s,y:o,platform:a,rects:i,elements:c,strategy:u}=e,{boundary:d="clippingAncestors",rootBoundary:h="viewport",elementContext:f="floating",altBoundary:m=!1,padding:g=0}=bt(t,e),v=Jc(g),x=c[m?f==="floating"?"reference":"floating":f],y=ds(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(x)))==null||n?x:x.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:d,rootBoundary:h,strategy:u})),w=f==="floating"?{x:s,y:o,width:i.floating.width,height:i.floating.height}:i.reference,N=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),j=await(a.isElement==null?void 0:a.isElement(N))?await(a.getScale==null?void 0:a.getScale(N))||{x:1,y:1}:{x:1,y:1},C=ds(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:w,offsetParent:N,strategy:u}):w);return{top:(y.top-C.top+v.top)/j.y,bottom:(C.bottom-y.bottom+v.bottom)/j.y,left:(y.left-C.left+v.left)/j.x,right:(C.right-y.right+v.right)/j.x}}const Gx=50,Qx=async(e,t,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:a=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Wx},u=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:f}=ji(d,s,u),m=s,g=0;const v={};for(let p=0;p<a.length;p++){const x=a[p];if(!x)continue;const{name:y,fn:w}=x,{x:N,y:j,data:C,reset:E}=await w({x:h,y:f,initialPlacement:s,placement:m,strategy:o,middlewareData:v,rects:d,platform:c,elements:{reference:e,floating:t}});h=N??h,f=j??f,v[y]={...v[y],...C},E&&g<Gx&&(g++,typeof E=="object"&&(E.placement&&(m=E.placement),E.rects&&(d=E.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):E.rects),{x:h,y:f}=ji(d,m,u)),p=-1)}return{x:h,y:f,placement:m,strategy:o,middlewareData:v}},Yx=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:o,rects:a,platform:i,elements:c,middlewareData:u}=t,{element:d,padding:h=0}=bt(e,t)||{};if(d==null)return{};const f=Jc(h),m={x:n,y:s},g=fa(o),v=ua(g),p=await i.getDimensions(d),x=g==="y",y=x?"top":"left",w=x?"bottom":"right",N=x?"clientHeight":"clientWidth",j=a.reference[v]+a.reference[g]-m[g]-a.floating[v],C=m[g]-a.reference[g],E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let S=E?E[N]:0;(!S||!await(i.isElement==null?void 0:i.isElement(E)))&&(S=c.floating[N]||a.floating[v]);const P=j/2-C/2,D=S/2-p[v]/2-1,I=Bt(f[y],D),$=Bt(f[w],D),_=I,G=S-p[v]-$,U=S/2-p[v]/2+P,X=Oo(_,U,G),V=!u.arrow&&er(o)!=null&&U!==X&&a.reference[v]/2-(U<_?I:$)-p[v]/2<0,re=V?U<_?U-_:U-G:0;return{[g]:m[g]+re,data:{[g]:X,centerOffset:U-X-re,...V&&{alignmentOffset:re}},reset:V}}}),Xx=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:o,middlewareData:a,rects:i,initialPlacement:c,platform:u,elements:d}=t,{mainAxis:h=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:p=!0,...x}=bt(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const y=wt(o),w=st(c),N=wt(c)===c,j=await(u.isRTL==null?void 0:u.isRTL(d.floating)),C=m||(N||!p?[ls(c)]:Ux(c)),E=v!=="none";!m&&E&&C.push(...qx(c,p,v,j));const S=[c,...C],P=await u.detectOverflow(t,x),D=[];let I=((s=a.flip)==null?void 0:s.overflows)||[];if(h&&D.push(P[y]),f){const U=$x(o,i,j);D.push(P[U[0]],P[U[1]])}if(I=[...I,{placement:o,overflows:D}],!D.every(U=>U<=0)){var $,_;const U=((($=a.flip)==null?void 0:$.index)||0)+1,X=S[U];if(X&&(!(f==="alignment"?w!==st(X):!1)||I.every(L=>st(L.placement)===w?L.overflows[0]>0:!0)))return{data:{index:U,overflows:I},reset:{placement:X}};let V=(_=I.filter(re=>re.overflows[0]<=0).sort((re,L)=>re.overflows[1]-L.overflows[1])[0])==null?void 0:_.placement;if(!V)switch(g){case"bestFit":{var G;const re=(G=I.filter(L=>{if(E){const T=st(L.placement);return T===w||T==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(T=>T>0).reduce((T,ie)=>T+ie,0)]).sort((L,T)=>L[1]-T[1])[0])==null?void 0:G[0];re&&(V=re);break}case"initialPlacement":V=c;break}if(o!==V)return{reset:{placement:V}}}return{}}}};function Ni(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ci(e){return Lx.some(t=>e[t]>=0)}const Zx=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:o="referenceHidden",...a}=bt(e,t);switch(o){case"referenceHidden":{const i=await s.detectOverflow(t,{...a,elementContext:"reference"}),c=Ni(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Ci(c)}}}case"escaped":{const i=await s.detectOverflow(t,{...a,altBoundary:!0}),c=Ni(i,n.floating);return{data:{escapedOffsets:c,escaped:Ci(c)}}}default:return{}}}}},el=new Set(["left","top"]);async function Jx(e,t){const{placement:n,platform:s,elements:o}=e,a=await(s.isRTL==null?void 0:s.isRTL(o.floating)),i=wt(n),c=er(n),u=st(n)==="y",d=el.has(i)?-1:1,h=a&&u?-1:1,f=bt(t,e);let{mainAxis:m,crossAxis:g,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof v=="number"&&(g=c==="end"?v*-1:v),u?{x:g*h,y:m*d}:{x:m*d,y:g*h}}const eg=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:o,y:a,placement:i,middlewareData:c}=t,u=await Jx(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(s=c.arrow)!=null&&s.alignmentOffset?{}:{x:o+u.x,y:a+u.y,data:{...u,placement:i}}}}},tg=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:o,platform:a}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:u={fn:y=>{let{x:w,y:N}=y;return{x:w,y:N}}},...d}=bt(e,t),h={x:n,y:s},f=await a.detectOverflow(t,d),m=st(wt(o)),g=da(m);let v=h[g],p=h[m];if(i){const y=g==="y"?"top":"left",w=g==="y"?"bottom":"right",N=v+f[y],j=v-f[w];v=Oo(N,v,j)}if(c){const y=m==="y"?"top":"left",w=m==="y"?"bottom":"right",N=p+f[y],j=p-f[w];p=Oo(N,p,j)}const x=u.fn({...t,[g]:v,[m]:p});return{...x,data:{x:x.x-n,y:x.y-s,enabled:{[g]:i,[m]:c}}}}}},ng=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:o,rects:a,middlewareData:i}=t,{offset:c=0,mainAxis:u=!0,crossAxis:d=!0}=bt(e,t),h={x:n,y:s},f=st(o),m=da(f);let g=h[m],v=h[f];const p=bt(c,t),x=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(u){const N=m==="y"?"height":"width",j=a.reference[m]-a.floating[N]+x.mainAxis,C=a.reference[m]+a.reference[N]-x.mainAxis;g<j?g=j:g>C&&(g=C)}if(d){var y,w;const N=m==="y"?"width":"height",j=el.has(wt(o)),C=a.reference[f]-a.floating[N]+(j&&((y=i.offset)==null?void 0:y[f])||0)+(j?0:x.crossAxis),E=a.reference[f]+a.reference[N]+(j?0:((w=i.offset)==null?void 0:w[f])||0)-(j?x.crossAxis:0);v<C?v=C:v>E&&(v=E)}return{[m]:g,[f]:v}}}},rg=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:o,rects:a,platform:i,elements:c}=t,{apply:u=()=>{},...d}=bt(e,t),h=await i.detectOverflow(t,d),f=wt(o),m=er(o),g=st(o)==="y",{width:v,height:p}=a.floating;let x,y;f==="top"||f==="bottom"?(x=f,y=m===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(y=f,x=m==="end"?"top":"bottom");const w=p-h.top-h.bottom,N=v-h.left-h.right,j=Bt(p-h[x],w),C=Bt(v-h[y],N),E=!t.middlewareData.shift;let S=j,P=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=N),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(S=w),E&&!m){const I=De(h.left,0),$=De(h.right,0),_=De(h.top,0),G=De(h.bottom,0);g?P=v-2*(I!==0||$!==0?I+$:De(h.left,h.right)):S=p-2*(_!==0||G!==0?_+G:De(h.top,h.bottom))}await u({...t,availableWidth:P,availableHeight:S});const D=await i.getDimensions(c.floating);return v!==D.width||p!==D.height?{reset:{rects:!0}}:{}}}};function ws(){return typeof window<"u"}function tr(e){return tl(e)?(e.nodeName||"").toLowerCase():"#document"}function Le(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dt(e){var t;return(t=(tl(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function tl(e){return ws()?e instanceof Node||e instanceof Le(e).Node:!1}function Ye(e){return ws()?e instanceof Element||e instanceof Le(e).Element:!1}function Nt(e){return ws()?e instanceof HTMLElement||e instanceof Le(e).HTMLElement:!1}function Si(e){return!ws()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Le(e).ShadowRoot}function Tr(e){const{overflow:t,overflowX:n,overflowY:s,display:o}=Xe(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&o!=="inline"&&o!=="contents"}function sg(e){return/^(table|td|th)$/.test(tr(e))}function js(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const og=/transform|translate|scale|rotate|perspective|filter/,ag=/paint|layout|strict|content/,Yt=e=>!!e&&e!=="none";let Zs;function ha(e){const t=Ye(e)?Xe(e):e;return Yt(t.transform)||Yt(t.translate)||Yt(t.scale)||Yt(t.rotate)||Yt(t.perspective)||!ma()&&(Yt(t.backdropFilter)||Yt(t.filter))||og.test(t.willChange||"")||ag.test(t.contain||"")}function ig(e){let t=Kt(e);for(;Nt(t)&&!qn(t);){if(ha(t))return t;if(js(t))return null;t=Kt(t)}return null}function ma(){return Zs==null&&(Zs=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Zs}function qn(e){return/^(html|body|#document)$/.test(tr(e))}function Xe(e){return Le(e).getComputedStyle(e)}function Ns(e){return Ye(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Kt(e){if(tr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Si(e)&&e.host||dt(e);return Si(t)?t.host:t}function nl(e){const t=Kt(e);return qn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Nt(t)&&Tr(t)?t:nl(t)}function xr(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=nl(e),a=o===((s=e.ownerDocument)==null?void 0:s.body),i=Le(o);if(a){const c=Do(i);return t.concat(i,i.visualViewport||[],Tr(o)?o:[],c&&n?xr(c):[])}else return t.concat(o,xr(o,[],n))}function Do(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function rl(e){const t=Xe(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=Nt(e),a=o?e.offsetWidth:n,i=o?e.offsetHeight:s,c=cs(n)!==a||cs(s)!==i;return c&&(n=a,s=i),{width:n,height:s,$:c}}function pa(e){return Ye(e)?e:e.contextElement}function kn(e){const t=pa(e);if(!Nt(t))return ot(1);const n=t.getBoundingClientRect(),{width:s,height:o,$:a}=rl(t);let i=(a?cs(n.width):n.width)/s,c=(a?cs(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const cg=ot(0);function sl(e){const t=Le(e);return!ma()||!t.visualViewport?cg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function lg(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Le(e)?!1:t}function hn(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),a=pa(e);let i=ot(1);t&&(s?Ye(s)&&(i=kn(s)):i=kn(e));const c=lg(a,n,s)?sl(a):ot(0);let u=(o.left+c.x)/i.x,d=(o.top+c.y)/i.y,h=o.width/i.x,f=o.height/i.y;if(a){const m=Le(a),g=s&&Ye(s)?Le(s):s;let v=m,p=Do(v);for(;p&&s&&g!==v;){const x=kn(p),y=p.getBoundingClientRect(),w=Xe(p),N=y.left+(p.clientLeft+parseFloat(w.paddingLeft))*x.x,j=y.top+(p.clientTop+parseFloat(w.paddingTop))*x.y;u*=x.x,d*=x.y,h*=x.x,f*=x.y,u+=N,d+=j,v=Le(p),p=Do(v)}}return ds({width:h,height:f,x:u,y:d})}function Cs(e,t){const n=Ns(e).scrollLeft;return t?t.left+n:hn(dt(e)).left+n}function ol(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Cs(e,n),o=n.top+t.scrollTop;return{x:s,y:o}}function dg(e){let{elements:t,rect:n,offsetParent:s,strategy:o}=e;const a=o==="fixed",i=dt(s),c=t?js(t.floating):!1;if(s===i||c&&a)return n;let u={scrollLeft:0,scrollTop:0},d=ot(1);const h=ot(0),f=Nt(s);if((f||!f&&!a)&&((tr(s)!=="body"||Tr(i))&&(u=Ns(s)),f)){const g=hn(s);d=kn(s),h.x=g.x+s.clientLeft,h.y=g.y+s.clientTop}const m=i&&!f&&!a?ol(i,u):ot(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-u.scrollLeft*d.x+h.x+m.x,y:n.y*d.y-u.scrollTop*d.y+h.y+m.y}}function ug(e){return Array.from(e.getClientRects())}function fg(e){const t=dt(e),n=Ns(e),s=e.ownerDocument.body,o=De(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),a=De(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let i=-n.scrollLeft+Cs(e);const c=-n.scrollTop;return Xe(s).direction==="rtl"&&(i+=De(t.clientWidth,s.clientWidth)-o),{width:o,height:a,x:i,y:c}}const Ei=25;function hg(e,t){const n=Le(e),s=dt(e),o=n.visualViewport;let a=s.clientWidth,i=s.clientHeight,c=0,u=0;if(o){a=o.width,i=o.height;const h=ma();(!h||h&&t==="fixed")&&(c=o.offsetLeft,u=o.offsetTop)}const d=Cs(s);if(d<=0){const h=s.ownerDocument,f=h.body,m=getComputedStyle(f),g=h.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,v=Math.abs(s.clientWidth-f.clientWidth-g);v<=Ei&&(a-=v)}else d<=Ei&&(a+=d);return{width:a,height:i,x:c,y:u}}function mg(e,t){const n=hn(e,!0,t==="fixed"),s=n.top+e.clientTop,o=n.left+e.clientLeft,a=Nt(e)?kn(e):ot(1),i=e.clientWidth*a.x,c=e.clientHeight*a.y,u=o*a.x,d=s*a.y;return{width:i,height:c,x:u,y:d}}function Ri(e,t,n){let s;if(t==="viewport")s=hg(e,n);else if(t==="document")s=fg(dt(e));else if(Ye(t))s=mg(t,n);else{const o=sl(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return ds(s)}function al(e,t){const n=Kt(e);return n===t||!Ye(n)||qn(n)?!1:Xe(n).position==="fixed"||al(n,t)}function pg(e,t){const n=t.get(e);if(n)return n;let s=xr(e,[],!1).filter(c=>Ye(c)&&tr(c)!=="body"),o=null;const a=Xe(e).position==="fixed";let i=a?Kt(e):e;for(;Ye(i)&&!qn(i);){const c=Xe(i),u=ha(i);!u&&c.position==="fixed"&&(o=null),(a?!u&&!o:!u&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Tr(i)&&!u&&al(e,i))?s=s.filter(h=>h!==i):o=c,i=Kt(i)}return t.set(e,s),s}function xg(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const i=[...n==="clippingAncestors"?js(t)?[]:pg(t,this._c):[].concat(n),s],c=Ri(t,i[0],o);let u=c.top,d=c.right,h=c.bottom,f=c.left;for(let m=1;m<i.length;m++){const g=Ri(t,i[m],o);u=De(g.top,u),d=Bt(g.right,d),h=Bt(g.bottom,h),f=De(g.left,f)}return{width:d-f,height:h-u,x:f,y:u}}function gg(e){const{width:t,height:n}=rl(e);return{width:t,height:n}}function vg(e,t,n){const s=Nt(t),o=dt(t),a=n==="fixed",i=hn(e,!0,a,t);let c={scrollLeft:0,scrollTop:0};const u=ot(0);function d(){u.x=Cs(o)}if(s||!s&&!a)if((tr(t)!=="body"||Tr(o))&&(c=Ns(t)),s){const g=hn(t,!0,a,t);u.x=g.x+t.clientLeft,u.y=g.y+t.clientTop}else o&&d();a&&!s&&o&&d();const h=o&&!s&&!a?ol(o,c):ot(0),f=i.left+c.scrollLeft-u.x-h.x,m=i.top+c.scrollTop-u.y-h.y;return{x:f,y:m,width:i.width,height:i.height}}function Js(e){return Xe(e).position==="static"}function Pi(e,t){if(!Nt(e)||Xe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return dt(e)===n&&(n=n.ownerDocument.body),n}function il(e,t){const n=Le(e);if(js(e))return n;if(!Nt(e)){let o=Kt(e);for(;o&&!qn(o);){if(Ye(o)&&!Js(o))return o;o=Kt(o)}return n}let s=Pi(e,t);for(;s&&sg(s)&&Js(s);)s=Pi(s,t);return s&&qn(s)&&Js(s)&&!ha(s)?n:s||ig(e)||n}const yg=async function(e){const t=this.getOffsetParent||il,n=this.getDimensions,s=await n(e.floating);return{reference:vg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function bg(e){return Xe(e).direction==="rtl"}const wg={convertOffsetParentRelativeRectToViewportRelativeRect:dg,getDocumentElement:dt,getClippingRect:xg,getOffsetParent:il,getElementRects:yg,getClientRects:ug,getDimensions:gg,getScale:kn,isElement:Ye,isRTL:bg};function cl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function jg(e,t){let n=null,s;const o=dt(e);function a(){var c;clearTimeout(s),(c=n)==null||c.disconnect(),n=null}function i(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),a();const d=e.getBoundingClientRect(),{left:h,top:f,width:m,height:g}=d;if(c||t(),!m||!g)return;const v=Vr(f),p=Vr(o.clientWidth-(h+m)),x=Vr(o.clientHeight-(f+g)),y=Vr(h),N={rootMargin:-v+"px "+-p+"px "+-x+"px "+-y+"px",threshold:De(0,Bt(1,u))||1};let j=!0;function C(E){const S=E[0].intersectionRatio;if(S!==u){if(!j)return i();S?i(!1,S):s=setTimeout(()=>{i(!1,1e-7)},1e3)}S===1&&!cl(d,e.getBoundingClientRect())&&i(),j=!1}try{n=new IntersectionObserver(C,{...N,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,N)}n.observe(e)}return i(!0),a}function Ng(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=s,d=pa(e),h=o||a?[...d?xr(d):[],...t?xr(t):[]]:[];h.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),a&&y.addEventListener("resize",n)});const f=d&&c?jg(d,n):null;let m=-1,g=null;i&&(g=new ResizeObserver(y=>{let[w]=y;w&&w.target===d&&g&&t&&(g.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var N;(N=g)==null||N.observe(t)})),n()}),d&&!u&&g.observe(d),t&&g.observe(t));let v,p=u?hn(e):null;u&&x();function x(){const y=hn(e);p&&!cl(p,y)&&n(),p=y,v=requestAnimationFrame(x)}return n(),()=>{var y;h.forEach(w=>{o&&w.removeEventListener("scroll",n),a&&w.removeEventListener("resize",n)}),f==null||f(),(y=g)==null||y.disconnect(),g=null,u&&cancelAnimationFrame(v)}}const Cg=eg,Sg=tg,Eg=Xx,Rg=rg,Pg=Zx,ki=Yx,kg=ng,Tg=(e,t,n)=>{const s=new Map,o={platform:wg,...n},a={...o.platform,_c:s};return Qx(e,t,{...o,platform:a})};var Ag=typeof document<"u",Mg=function(){},Xr=Ag?l.useLayoutEffect:Mg;function us(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!us(e[s],t[s]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,o[s]))return!1;for(s=n;s--!==0;){const a=o[s];if(!(a==="_owner"&&e.$$typeof)&&!us(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function ll(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ti(e,t){const n=ll(e);return Math.round(t*n)/n}function eo(e){const t=l.useRef(e);return Xr(()=>{t.current=e}),t}function _g(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:o,elements:{reference:a,floating:i}={},transform:c=!0,whileElementsMounted:u,open:d}=e,[h,f]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,g]=l.useState(s);us(m,s)||g(s);const[v,p]=l.useState(null),[x,y]=l.useState(null),w=l.useCallback(L=>{L!==E.current&&(E.current=L,p(L))},[]),N=l.useCallback(L=>{L!==S.current&&(S.current=L,y(L))},[]),j=a||v,C=i||x,E=l.useRef(null),S=l.useRef(null),P=l.useRef(h),D=u!=null,I=eo(u),$=eo(o),_=eo(d),G=l.useCallback(()=>{if(!E.current||!S.current)return;const L={placement:t,strategy:n,middleware:m};$.current&&(L.platform=$.current),Tg(E.current,S.current,L).then(T=>{const ie={...T,isPositioned:_.current!==!1};U.current&&!us(P.current,ie)&&(P.current=ie,Er.flushSync(()=>{f(ie)}))})},[m,t,n,$,_]);Xr(()=>{d===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,f(L=>({...L,isPositioned:!1})))},[d]);const U=l.useRef(!1);Xr(()=>(U.current=!0,()=>{U.current=!1}),[]),Xr(()=>{if(j&&(E.current=j),C&&(S.current=C),j&&C){if(I.current)return I.current(j,C,G);G()}},[j,C,G,I,D]);const X=l.useMemo(()=>({reference:E,floating:S,setReference:w,setFloating:N}),[w,N]),V=l.useMemo(()=>({reference:j,floating:C}),[j,C]),re=l.useMemo(()=>{const L={position:n,left:0,top:0};if(!V.floating)return L;const T=Ti(V.floating,h.x),ie=Ti(V.floating,h.y);return c?{...L,transform:"translate("+T+"px, "+ie+"px)",...ll(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:T,top:ie}},[n,c,V.floating,h.x,h.y]);return l.useMemo(()=>({...h,update:G,refs:X,elements:V,floatingStyles:re}),[h,G,X,V,re])}const Og=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:o}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?ki({element:s.current,padding:o}).fn(n):{}:s?ki({element:s,padding:o}).fn(n):{}}}},Ig=(e,t)=>{const n=Cg(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dg=(e,t)=>{const n=Sg(e);return{name:n.name,fn:n.fn,options:[e,t]}},zg=(e,t)=>({fn:kg(e).fn,options:[e,t]}),Lg=(e,t)=>{const n=Eg(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fg=(e,t)=>{const n=Rg(e);return{name:n.name,fn:n.fn,options:[e,t]}},$g=(e,t)=>{const n=Pg(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ug=(e,t)=>{const n=Og(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Vg="Arrow",dl=l.forwardRef((e,t)=>{const{children:n,width:s=10,height:o=5,...a}=e;return r.jsx(W.svg,{...a,ref:t,width:s,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});dl.displayName=Vg;var Bg=dl;function ul(e){const[t,n]=l.useState(void 0);return Se(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const a=o[0];let i,c;if("borderBoxSize"in a){const u=a.borderBoxSize,d=Array.isArray(u)?u[0]:u;i=d.inlineSize,c=d.blockSize}else i=e.offsetWidth,c=e.offsetHeight;n({width:i,height:c})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var xa="Popper",[fl,nr]=lt(xa),[Kg,hl]=fl(xa),ml=e=>{const{__scopePopper:t,children:n}=e,[s,o]=l.useState(null);return r.jsx(Kg,{scope:t,anchor:s,onAnchorChange:o,children:n})};ml.displayName=xa;var pl="PopperAnchor",xl=l.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...o}=e,a=hl(pl,n),i=l.useRef(null),c=de(t,i),u=l.useRef(null);return l.useEffect(()=>{const d=u.current;u.current=(s==null?void 0:s.current)||i.current,d!==u.current&&a.onAnchorChange(u.current)}),s?null:r.jsx(W.div,{...o,ref:c})});xl.displayName=pl;var ga="PopperContent",[qg,Hg]=fl(ga),gl=l.forwardRef((e,t)=>{var A,Q,Y,ae,fe,he;const{__scopePopper:n,side:s="bottom",sideOffset:o=0,align:a="center",alignOffset:i=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:h=0,sticky:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:v,...p}=e,x=hl(ga,n),[y,w]=l.useState(null),N=de(t,_e=>w(_e)),[j,C]=l.useState(null),E=ul(j),S=(E==null?void 0:E.width)??0,P=(E==null?void 0:E.height)??0,D=s+(a!=="center"?"-"+a:""),I=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},$=Array.isArray(d)?d:[d],_=$.length>0,G={padding:I,boundary:$.filter(Gg),altBoundary:_},{refs:U,floatingStyles:X,placement:V,isPositioned:re,middlewareData:L}=_g({strategy:"fixed",placement:D,whileElementsMounted:(..._e)=>Ng(..._e,{animationFrame:g==="always"}),elements:{reference:x.anchor},middleware:[Ig({mainAxis:o+P,alignmentAxis:i}),u&&Dg({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?zg():void 0,...G}),u&&Lg({...G}),Fg({...G,apply:({elements:_e,rects:Je,availableWidth:sr,availableHeight:or})=>{const{width:ar,height:Uf}=Je.reference,Lr=_e.floating.style;Lr.setProperty("--radix-popper-available-width",`${sr}px`),Lr.setProperty("--radix-popper-available-height",`${or}px`),Lr.setProperty("--radix-popper-anchor-width",`${ar}px`),Lr.setProperty("--radix-popper-anchor-height",`${Uf}px`)}}),j&&Ug({element:j,padding:c}),Qg({arrowWidth:S,arrowHeight:P}),m&&$g({strategy:"referenceHidden",...G})]}),[T,ie]=bl(V),ce=it(v);Se(()=>{re&&(ce==null||ce())},[re,ce]);const R=(A=L.arrow)==null?void 0:A.x,K=(Q=L.arrow)==null?void 0:Q.y,H=((Y=L.arrow)==null?void 0:Y.centerOffset)!==0,[z,Z]=l.useState();return Se(()=>{y&&Z(window.getComputedStyle(y).zIndex)},[y]),r.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...X,transform:re?X.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:z,"--radix-popper-transform-origin":[(ae=L.transformOrigin)==null?void 0:ae.x,(fe=L.transformOrigin)==null?void 0:fe.y].join(" "),...((he=L.hide)==null?void 0:he.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(qg,{scope:n,placedSide:T,onArrowChange:C,arrowX:R,arrowY:K,shouldHideArrow:H,children:r.jsx(W.div,{"data-side":T,"data-align":ie,...p,ref:N,style:{...p.style,animation:re?void 0:"none"}})})})});gl.displayName=ga;var vl="PopperArrow",Wg={top:"bottom",right:"left",bottom:"top",left:"right"},yl=l.forwardRef(function(t,n){const{__scopePopper:s,...o}=t,a=Hg(vl,s),i=Wg[a.placedSide];return r.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:r.jsx(Bg,{...o,ref:n,style:{...o.style,display:"block"}})})});yl.displayName=vl;function Gg(e){return e!==null}var Qg=e=>({name:"transformOrigin",options:e,fn(t){var x,y,w;const{placement:n,rects:s,middlewareData:o}=t,i=((x=o.arrow)==null?void 0:x.centerOffset)!==0,c=i?0:e.arrowWidth,u=i?0:e.arrowHeight,[d,h]=bl(n),f={start:"0%",center:"50%",end:"100%"}[h],m=(((y=o.arrow)==null?void 0:y.x)??0)+c/2,g=(((w=o.arrow)==null?void 0:w.y)??0)+u/2;let v="",p="";return d==="bottom"?(v=i?f:`${m}px`,p=`${-u}px`):d==="top"?(v=i?f:`${m}px`,p=`${s.floating.height+u}px`):d==="right"?(v=`${-u}px`,p=i?f:`${g}px`):d==="left"&&(v=`${s.floating.width+u}px`,p=i?f:`${g}px`),{data:{x:v,y:p}}}});function bl(e){const[t,n="center"]=e.split("-");return[t,n]}var va=ml,Ss=xl,ya=gl,ba=yl,Yg="Portal",Ar=l.forwardRef((e,t)=>{var c;const{container:n,...s}=e,[o,a]=l.useState(!1);Se(()=>a(!0),[]);const i=n||o&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return i?Kf.createPortal(r.jsx(W.div,{...s,ref:t}),i):null});Ar.displayName=Yg;function Xg(e,t){return l.useReducer((n,s)=>t[n][s]??n,e)}var Be=e=>{const{present:t,children:n}=e,s=Zg(t),o=typeof n=="function"?n({present:s.isPresent}):l.Children.only(n),a=de(s.ref,Jg(o));return typeof n=="function"||s.isPresent?l.cloneElement(o,{ref:a}):null};Be.displayName="Presence";function Zg(e){const[t,n]=l.useState(),s=l.useRef(null),o=l.useRef(e),a=l.useRef("none"),i=e?"mounted":"unmounted",[c,u]=Xg(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return l.useEffect(()=>{const d=Br(s.current);a.current=c==="mounted"?d:"none"},[c]),Se(()=>{const d=s.current,h=o.current;if(h!==e){const m=a.current,g=Br(d);e?u("MOUNT"):g==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(h&&m!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),Se(()=>{if(t){let d;const h=t.ownerDocument.defaultView??window,f=g=>{const p=Br(s.current).includes(CSS.escape(g.animationName));if(g.target===t&&p&&(u("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",d=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},m=g=>{g.target===t&&(a.current=Br(s.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{h.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:l.useCallback(d=>{s.current=d?getComputedStyle(d):null,n(d)},[])}}function Br(e){return(e==null?void 0:e.animationName)||"none"}function Jg(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ev=Xo[" useInsertionEffect ".trim().toString()]||Se;function qt({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[o,a,i]=tv({defaultProp:t,onChange:n}),c=e!==void 0,u=c?e:o;{const h=l.useRef(e!==void 0);l.useEffect(()=>{const f=h.current;f!==c&&console.warn(`${s} is changing from ${f?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),h.current=c},[c,s])}const d=l.useCallback(h=>{var f;if(c){const m=nv(h)?h(e):h;m!==e&&((f=i.current)==null||f.call(i,m))}else a(h)},[c,e,a,i]);return[u,d]}function tv({defaultProp:e,onChange:t}){const[n,s]=l.useState(e),o=l.useRef(n),a=l.useRef(t);return ev(()=>{a.current=t},[t]),l.useEffect(()=>{var i;o.current!==n&&((i=a.current)==null||i.call(a,n),o.current=n)},[n,o]),[n,s,a]}function nv(e){return typeof e=="function"}var rv=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Nn=new WeakMap,Kr=new WeakMap,qr={},to=0,wl=function(e){return e&&(e.host||wl(e.parentNode))},sv=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=wl(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},ov=function(e,t,n,s){var o=sv(t,Array.isArray(e)?e:[e]);qr[n]||(qr[n]=new WeakMap);var a=qr[n],i=[],c=new Set,u=new Set(o),d=function(f){!f||c.has(f)||(c.add(f),d(f.parentNode))};o.forEach(d);var h=function(f){!f||u.has(f)||Array.prototype.forEach.call(f.children,function(m){if(c.has(m))h(m);else try{var g=m.getAttribute(s),v=g!==null&&g!=="false",p=(Nn.get(m)||0)+1,x=(a.get(m)||0)+1;Nn.set(m,p),a.set(m,x),i.push(m),p===1&&v&&Kr.set(m,!0),x===1&&m.setAttribute(n,"true"),v||m.setAttribute(s,"true")}catch(y){console.error("aria-hidden: cannot operate on ",m,y)}})};return h(t),c.clear(),to++,function(){i.forEach(function(f){var m=Nn.get(f)-1,g=a.get(f)-1;Nn.set(f,m),a.set(f,g),m||(Kr.has(f)||f.removeAttribute(s),Kr.delete(f)),g||f.removeAttribute(n)}),to--,to||(Nn=new WeakMap,Nn=new WeakMap,Kr=new WeakMap,qr={})}},Es=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),o=rv(e);return o?(s.push.apply(s,Array.from(o.querySelectorAll("[aria-live], script"))),ov(s,o,n,"aria-hidden")):function(){return null}},rt=function(){return rt=Object.assign||function(t){for(var n,s=1,o=arguments.length;s<o;s++){n=arguments[s];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},rt.apply(this,arguments)};function jl(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(e);o<s.length;o++)t.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(e,s[o])&&(n[s[o]]=e[s[o]]);return n}function av(e,t,n){if(n||arguments.length===2)for(var s=0,o=t.length,a;s<o;s++)(a||!(s in t))&&(a||(a=Array.prototype.slice.call(t,0,s)),a[s]=t[s]);return e.concat(a||Array.prototype.slice.call(t))}var Zr="right-scroll-bar-position",Jr="width-before-scroll-bar",iv="with-scroll-bars-hidden",cv="--removed-body-scroll-bar-size";function no(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function lv(e,t){var n=l.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var o=n.value;o!==s&&(n.value=s,n.callback(s,o))}}}})[0];return n.callback=t,n.facade}var dv=typeof window<"u"?l.useLayoutEffect:l.useEffect,Ai=new WeakMap;function uv(e,t){var n=lv(null,function(s){return e.forEach(function(o){return no(o,s)})});return dv(function(){var s=Ai.get(n);if(s){var o=new Set(s),a=new Set(e),i=n.current;o.forEach(function(c){a.has(c)||no(c,null)}),a.forEach(function(c){o.has(c)||no(c,i)})}Ai.set(n,e)},[e]),n}function fv(e){return e}function hv(e,t){t===void 0&&(t=fv);var n=[],s=!1,o={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var i=t(a,s);return n.push(i),function(){n=n.filter(function(c){return c!==i})}},assignSyncMedium:function(a){for(s=!0;n.length;){var i=n;n=[],i.forEach(a)}n={push:function(c){return a(c)},filter:function(){return n}}},assignMedium:function(a){s=!0;var i=[];if(n.length){var c=n;n=[],c.forEach(a),i=n}var u=function(){var h=i;i=[],h.forEach(a)},d=function(){return Promise.resolve().then(u)};d(),n={push:function(h){i.push(h),d()},filter:function(h){return i=i.filter(h),n}}}};return o}function mv(e){e===void 0&&(e={});var t=hv(null);return t.options=rt({async:!0,ssr:!1},e),t}var Nl=function(e){var t=e.sideCar,n=jl(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return l.createElement(s,rt({},n))};Nl.isSideCarExport=!0;function pv(e,t){return e.useMedium(t),Nl}var Cl=mv(),ro=function(){},Rs=l.forwardRef(function(e,t){var n=l.useRef(null),s=l.useState({onScrollCapture:ro,onWheelCapture:ro,onTouchMoveCapture:ro}),o=s[0],a=s[1],i=e.forwardProps,c=e.children,u=e.className,d=e.removeScrollBar,h=e.enabled,f=e.shards,m=e.sideCar,g=e.noRelative,v=e.noIsolation,p=e.inert,x=e.allowPinchZoom,y=e.as,w=y===void 0?"div":y,N=e.gapMode,j=jl(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=m,E=uv([n,t]),S=rt(rt({},j),o);return l.createElement(l.Fragment,null,h&&l.createElement(C,{sideCar:Cl,removeScrollBar:d,shards:f,noRelative:g,noIsolation:v,inert:p,setCallbacks:a,allowPinchZoom:!!x,lockRef:n,gapMode:N}),i?l.cloneElement(l.Children.only(c),rt(rt({},S),{ref:E})):l.createElement(w,rt({},S,{className:u,ref:E}),c))});Rs.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Rs.classNames={fullWidth:Jr,zeroRight:Zr};var xv=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function gv(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=xv();return t&&e.setAttribute("nonce",t),e}function vv(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function yv(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var bv=function(){var e=0,t=null;return{add:function(n){e==0&&(t=gv())&&(vv(t,n),yv(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},wv=function(){var e=bv();return function(t,n){l.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Sl=function(){var e=wv(),t=function(n){var s=n.styles,o=n.dynamic;return e(s,o),null};return t},jv={left:0,top:0,right:0,gap:0},so=function(e){return parseInt(e||"",10)||0},Nv=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[so(n),so(s),so(o)]},Cv=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return jv;var t=Nv(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},Sv=Sl(),Tn="data-scroll-locked",Ev=function(e,t,n,s){var o=e.left,a=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),`
|
|
270
|
-
.`.concat(iv,` {
|
|
271
|
-
overflow: hidden `).concat(s,`;
|
|
272
|
-
padding-right: `).concat(c,"px ").concat(s,`;
|
|
273
|
-
}
|
|
274
|
-
body[`).concat(Tn,`] {
|
|
275
|
-
overflow: hidden `).concat(s,`;
|
|
276
|
-
overscroll-behavior: contain;
|
|
277
|
-
`).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
|
|
278
|
-
padding-left: `.concat(o,`px;
|
|
279
|
-
padding-top: `).concat(a,`px;
|
|
280
|
-
padding-right: `).concat(i,`px;
|
|
281
|
-
margin-left:0;
|
|
282
|
-
margin-top:0;
|
|
283
|
-
margin-right: `).concat(c,"px ").concat(s,`;
|
|
284
|
-
`),n==="padding"&&"padding-right: ".concat(c,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
.`).concat(Zr,` {
|
|
288
|
-
right: `).concat(c,"px ").concat(s,`;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
.`).concat(Jr,` {
|
|
292
|
-
margin-right: `).concat(c,"px ").concat(s,`;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
.`).concat(Zr," .").concat(Zr,` {
|
|
296
|
-
right: 0 `).concat(s,`;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
.`).concat(Jr," .").concat(Jr,` {
|
|
300
|
-
margin-right: 0 `).concat(s,`;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
body[`).concat(Tn,`] {
|
|
304
|
-
`).concat(cv,": ").concat(c,`px;
|
|
305
|
-
}
|
|
306
|
-
`)},Mi=function(){var e=parseInt(document.body.getAttribute(Tn)||"0",10);return isFinite(e)?e:0},Rv=function(){l.useEffect(function(){return document.body.setAttribute(Tn,(Mi()+1).toString()),function(){var e=Mi()-1;e<=0?document.body.removeAttribute(Tn):document.body.setAttribute(Tn,e.toString())}},[])},Pv=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,o=s===void 0?"margin":s;Rv();var a=l.useMemo(function(){return Cv(o)},[o]);return l.createElement(Sv,{styles:Ev(a,!t,o,n?"":"!important")})},zo=!1;if(typeof window<"u")try{var Hr=Object.defineProperty({},"passive",{get:function(){return zo=!0,!0}});window.addEventListener("test",Hr,Hr),window.removeEventListener("test",Hr,Hr)}catch{zo=!1}var Cn=zo?{passive:!1}:!1,kv=function(e){return e.tagName==="TEXTAREA"},El=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!kv(e)&&n[t]==="visible")},Tv=function(e){return El(e,"overflowY")},Av=function(e){return El(e,"overflowX")},_i=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var o=Rl(e,s);if(o){var a=Pl(e,s),i=a[1],c=a[2];if(i>c)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},Mv=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},_v=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},Rl=function(e,t){return e==="v"?Tv(t):Av(t)},Pl=function(e,t){return e==="v"?Mv(t):_v(t)},Ov=function(e,t){return e==="h"&&t==="rtl"?-1:1},Iv=function(e,t,n,s,o){var a=Ov(e,window.getComputedStyle(t).direction),i=a*s,c=n.target,u=t.contains(c),d=!1,h=i>0,f=0,m=0;do{if(!c)break;var g=Pl(e,c),v=g[0],p=g[1],x=g[2],y=p-x-a*v;(v||y)&&Rl(e,c)&&(f+=y,m+=v);var w=c.parentNode;c=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(h&&Math.abs(f)<1||!h&&Math.abs(m)<1)&&(d=!0),d},Wr=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Oi=function(e){return[e.deltaX,e.deltaY]},Ii=function(e){return e&&"current"in e?e.current:e},Dv=function(e,t){return e[0]===t[0]&&e[1]===t[1]},zv=function(e){return`
|
|
307
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
308
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
309
|
-
`)},Lv=0,Sn=[];function Fv(e){var t=l.useRef([]),n=l.useRef([0,0]),s=l.useRef(),o=l.useState(Lv++)[0],a=l.useState(Sl)[0],i=l.useRef(e);l.useEffect(function(){i.current=e},[e]),l.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var p=av([e.lockRef.current],(e.shards||[]).map(Ii),!0).filter(Boolean);return p.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=l.useCallback(function(p,x){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var y=Wr(p),w=n.current,N="deltaX"in p?p.deltaX:w[0]-y[0],j="deltaY"in p?p.deltaY:w[1]-y[1],C,E=p.target,S=Math.abs(N)>Math.abs(j)?"h":"v";if("touches"in p&&S==="h"&&E.type==="range")return!1;var P=window.getSelection(),D=P&&P.anchorNode,I=D?D===E||D.contains(E):!1;if(I)return!1;var $=_i(S,E);if(!$)return!0;if($?C=S:(C=S==="v"?"h":"v",$=_i(S,E)),!$)return!1;if(!s.current&&"changedTouches"in p&&(N||j)&&(s.current=C),!C)return!0;var _=s.current||C;return Iv(_,x,p,_==="h"?N:j)},[]),u=l.useCallback(function(p){var x=p;if(!(!Sn.length||Sn[Sn.length-1]!==a)){var y="deltaY"in x?Oi(x):Wr(x),w=t.current.filter(function(C){return C.name===x.type&&(C.target===x.target||x.target===C.shadowParent)&&Dv(C.delta,y)})[0];if(w&&w.should){x.cancelable&&x.preventDefault();return}if(!w){var N=(i.current.shards||[]).map(Ii).filter(Boolean).filter(function(C){return C.contains(x.target)}),j=N.length>0?c(x,N[0]):!i.current.noIsolation;j&&x.cancelable&&x.preventDefault()}}},[]),d=l.useCallback(function(p,x,y,w){var N={name:p,delta:x,target:y,should:w,shadowParent:$v(y)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(j){return j!==N})},1)},[]),h=l.useCallback(function(p){n.current=Wr(p),s.current=void 0},[]),f=l.useCallback(function(p){d(p.type,Oi(p),p.target,c(p,e.lockRef.current))},[]),m=l.useCallback(function(p){d(p.type,Wr(p),p.target,c(p,e.lockRef.current))},[]);l.useEffect(function(){return Sn.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",u,Cn),document.addEventListener("touchmove",u,Cn),document.addEventListener("touchstart",h,Cn),function(){Sn=Sn.filter(function(p){return p!==a}),document.removeEventListener("wheel",u,Cn),document.removeEventListener("touchmove",u,Cn),document.removeEventListener("touchstart",h,Cn)}},[]);var g=e.removeScrollBar,v=e.inert;return l.createElement(l.Fragment,null,v?l.createElement(a,{styles:zv(o)}):null,g?l.createElement(Pv,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function $v(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Uv=pv(Cl,Fv);var Mr=l.forwardRef(function(e,t){return l.createElement(Rs,rt({},e,{ref:t,sideCar:Uv}))});Mr.classNames=Rs.classNames;var Ps="Popover",[kl]=lt(Ps,[nr]),_r=nr(),[Vv,Wt]=kl(Ps),Tl=e=>{const{__scopePopover:t,children:n,open:s,defaultOpen:o,onOpenChange:a,modal:i=!1}=e,c=_r(t),u=l.useRef(null),[d,h]=l.useState(!1),[f,m]=qt({prop:s,defaultProp:o??!1,onChange:a,caller:Ps});return r.jsx(va,{...c,children:r.jsx(Vv,{scope:t,contentId:je(),triggerRef:u,open:f,onOpenChange:m,onOpenToggle:l.useCallback(()=>m(g=>!g),[m]),hasCustomAnchor:d,onCustomAnchorAdd:l.useCallback(()=>h(!0),[]),onCustomAnchorRemove:l.useCallback(()=>h(!1),[]),modal:i,children:n})})};Tl.displayName=Ps;var Al="PopoverAnchor",Bv=l.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,o=Wt(Al,n),a=_r(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:c}=o;return l.useEffect(()=>(i(),()=>c()),[i,c]),r.jsx(Ss,{...a,...s,ref:t})});Bv.displayName=Al;var Ml="PopoverTrigger",_l=l.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,o=Wt(Ml,n),a=_r(n),i=de(t,o.triggerRef),c=r.jsx(W.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Ll(o.open),...s,ref:i,onClick:O(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?c:r.jsx(Ss,{asChild:!0,...a,children:c})});_l.displayName=Ml;var wa="PopoverPortal",[Kv,qv]=kl(wa,{forceMount:void 0}),Ol=e=>{const{__scopePopover:t,forceMount:n,children:s,container:o}=e,a=Wt(wa,t);return r.jsx(Kv,{scope:t,forceMount:n,children:r.jsx(Be,{present:n||a.open,children:r.jsx(Ar,{asChild:!0,container:o,children:s})})})};Ol.displayName=wa;var Hn="PopoverContent",Il=l.forwardRef((e,t)=>{const n=qv(Hn,e.__scopePopover),{forceMount:s=n.forceMount,...o}=e,a=Wt(Hn,e.__scopePopover);return r.jsx(Be,{present:s||a.open,children:a.modal?r.jsx(Wv,{...o,ref:t}):r.jsx(Gv,{...o,ref:t})})});Il.displayName=Hn;var Hv=fn("PopoverContent.RemoveScroll"),Wv=l.forwardRef((e,t)=>{const n=Wt(Hn,e.__scopePopover),s=l.useRef(null),o=de(t,s),a=l.useRef(!1);return l.useEffect(()=>{const i=s.current;if(i)return Es(i)},[]),r.jsx(Mr,{as:Hv,allowPinchZoom:!0,children:r.jsx(Dl,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:O(e.onCloseAutoFocus,i=>{var c;i.preventDefault(),a.current||(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:O(e.onPointerDownOutside,i=>{const c=i.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;a.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:O(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),Gv=l.forwardRef((e,t)=>{const n=Wt(Hn,e.__scopePopover),s=l.useRef(!1),o=l.useRef(!1);return r.jsx(Dl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var i,c;(i=e.onCloseAutoFocus)==null||i.call(e,a),a.defaultPrevented||(s.current||(c=n.triggerRef.current)==null||c.focus(),a.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:a=>{var u,d;(u=e.onInteractOutside)==null||u.call(e,a),a.defaultPrevented||(s.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=a.target;((d=n.triggerRef.current)==null?void 0:d.contains(i))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),Dl=l.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,...f}=e,m=Wt(Hn,n),g=_r(n);return bs(),r.jsx(kr,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:a,children:r.jsx(Pr,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:h,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),children:r.jsx(ya,{"data-state":Ll(m.open),role:"dialog",id:m.contentId,...g,...f,ref:t,style:{...f.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)"}})})})}),zl="PopoverClose",Qv=l.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,o=Wt(zl,n);return r.jsx(W.button,{type:"button",...s,ref:t,onClick:O(e.onClick,()=>o.onOpenChange(!1))})});Qv.displayName=zl;var Yv="PopoverArrow",Xv=l.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,o=_r(n);return r.jsx(ba,{...o,...s,ref:t})});Xv.displayName=Yv;function Ll(e){return e?"open":"closed"}var Zv=Tl,Jv=_l,e0=Ol,Fl=Il;const t0=Zv,n0=Jv,$l=l.forwardRef(({className:e,align:t="center",sideOffset:n=4,...s},o)=>r.jsx(e0,{children:r.jsx(Fl,{ref:o,align:t,sideOffset:n,className:k("z-50 w-72 rounded-md border border-zinc-200 bg-white p-4 text-zinc-900 shadow-md outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));$l.displayName=Fl.displayName;const Di=e=>{let t;const n=new Set,s=(d,h)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const m=t;t=h??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,m))}},o=()=>t,c={setState:s,getState:o,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d))},u=t=e(s,o,c);return c},r0=e=>e?Di(e):Di,s0=e=>e;function o0(e,t=s0){const n=We.useSyncExternalStore(e.subscribe,We.useCallback(()=>t(e.getState()),[e,t]),We.useCallback(()=>t(e.getInitialState()),[e,t]));return We.useDebugValue(n),n}const zi=e=>{const t=r0(e),n=s=>o0(t,s);return Object.assign(n,t),n},ja=e=>e?zi(e):zi,Ul=ja(e=>({notifications:[],unreadCount:0,pushNotification:t=>{const n={...t,id:crypto.randomUUID(),at:new Date().toISOString(),read:!1};e(s=>({notifications:[n,...s.notifications].slice(0,50),unreadCount:s.unreadCount+1}))},markAllRead:()=>{e(t=>({notifications:t.notifications.map(n=>({...n,read:!0})),unreadCount:0}))},clearAll:()=>{e({notifications:[],unreadCount:0})}}));function Ke(e){const t=new Date(e);return new Intl.DateTimeFormat("en-GB",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(t)}function a0(e){const t=new Date(e);return new Intl.DateTimeFormat("en-GB",{day:"2-digit",month:"short"}).format(t)}function ut(e){const t=new Date(e),s=new Date().getTime()-t.getTime(),o=Math.floor(s/1e3),a=Math.floor(o/60),i=Math.floor(a/60),c=Math.floor(i/24);return o<30?"just now":o<60?`${o}s ago`:a<60?`${a}m ago`:i<24?`${i}h ago`:c===1?"yesterday":c<7?`${c} days ago`:c<30?`${Math.floor(c/7)}w ago`:a0(e)}function i0({type:e}){return e==="error"?r.jsx(ep,{className:"h-4 w-4 text-red-500"}):e==="warning"?r.jsx(is,{className:"h-4 w-4 text-amber-500"}):r.jsx(lp,{className:"h-4 w-4 text-blue-500"})}function c0(){const{notifications:e,unreadCount:t,markAllRead:n}=Ul(),s=e.slice(0,10);return r.jsxs(t0,{children:[r.jsx(n0,{asChild:!0,children:r.jsxs(le,{variant:"ghost",size:"icon","aria-label":"Notifications",className:"relative text-zinc-500 hover:text-zinc-700",children:[r.jsx(Ym,{className:"h-4 w-4"}),t>0&&r.jsx("span",{className:"absolute -right-0.5 -top-0.5 flex h-4 w-4 items-center justify-center rounded-full bg-red-500 text-[10px] font-bold text-white",children:t>9?"9+":t})]})}),r.jsxs($l,{align:"end",className:"w-80 p-0",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-100 px-4 py-3",children:[r.jsx("span",{className:"text-sm font-semibold text-zinc-900",children:"Notifications"}),t>0&&r.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-700 font-medium",children:[r.jsx(Xn,{className:"h-3 w-3"}),"Mark all read"]})]}),r.jsx("div",{className:"max-h-80 overflow-y-auto",children:s.length===0?r.jsx("div",{className:"py-8 text-center text-sm text-zinc-400",children:"No notifications"}):s.map(o=>r.jsxs("div",{className:k("flex gap-3 border-b border-zinc-50 px-4 py-3 last:border-0",!o.read&&"bg-blue-50/30"),children:[r.jsx("div",{className:"mt-0.5 shrink-0",children:r.jsx(i0,{type:o.type})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"text-xs font-medium text-zinc-900",children:o.title}),r.jsx("p",{className:"mt-0.5 text-xs text-zinc-500 line-clamp-2",children:o.message}),r.jsx("p",{className:"mt-1 text-[10px] text-zinc-400",children:ut(o.at)})]}),!o.read&&r.jsx("div",{className:"mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-blue-500"})]},o.id))})]})]})}var Li=1,l0=.9,d0=.8,u0=.17,oo=.1,ao=.999,f0=.9999,h0=.99,m0=/[\\\/_+.#"@\[\(\{&]/,p0=/[\\\/_+.#"@\[\(\{&]/g,x0=/[\s-]/,Vl=/[\s-]/g;function Lo(e,t,n,s,o,a,i){if(a===t.length)return o===e.length?Li:h0;var c=`${o},${a}`;if(i[c]!==void 0)return i[c];for(var u=s.charAt(a),d=n.indexOf(u,o),h=0,f,m,g,v;d>=0;)f=Lo(e,t,n,s,d+1,a+1,i),f>h&&(d===o?f*=Li:m0.test(e.charAt(d-1))?(f*=d0,g=e.slice(o,d-1).match(p0),g&&o>0&&(f*=Math.pow(ao,g.length))):x0.test(e.charAt(d-1))?(f*=l0,v=e.slice(o,d-1).match(Vl),v&&o>0&&(f*=Math.pow(ao,v.length))):(f*=u0,o>0&&(f*=Math.pow(ao,d-o))),e.charAt(d)!==t.charAt(a)&&(f*=f0)),(f<oo&&n.charAt(d-1)===s.charAt(a+1)||s.charAt(a+1)===s.charAt(a)&&n.charAt(d-1)!==s.charAt(a))&&(m=Lo(e,t,n,s,d+1,a+2,i),m*oo>f&&(f=m*oo)),f>h&&(h=f),d=n.indexOf(u,d+1);return i[c]=h,h}function Fi(e){return e.toLowerCase().replace(Vl," ")}function g0(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Lo(e,t,Fi(e),Fi(t),0,0,{})}var ks="Dialog",[Bl]=lt(ks),[v0,Ze]=Bl(ks),Kl=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,c=l.useRef(null),u=l.useRef(null),[d,h]=qt({prop:s,defaultProp:o??!1,onChange:a,caller:ks});return r.jsx(v0,{scope:t,triggerRef:c,contentRef:u,contentId:je(),titleId:je(),descriptionId:je(),open:d,onOpenChange:h,onOpenToggle:l.useCallback(()=>h(f=>!f),[h]),modal:i,children:n})};Kl.displayName=ks;var ql="DialogTrigger",y0=l.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ze(ql,n),a=de(t,o.triggerRef);return r.jsx(W.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Sa(o.open),...s,ref:a,onClick:O(e.onClick,o.onOpenToggle)})});y0.displayName=ql;var Na="DialogPortal",[b0,Hl]=Bl(Na,{forceMount:void 0}),Wl=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:o}=e,a=Ze(Na,t);return r.jsx(b0,{scope:t,forceMount:n,children:l.Children.map(s,i=>r.jsx(Be,{present:n||a.open,children:r.jsx(Ar,{asChild:!0,container:o,children:i})}))})};Wl.displayName=Na;var fs="DialogOverlay",Gl=l.forwardRef((e,t)=>{const n=Hl(fs,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,a=Ze(fs,e.__scopeDialog);return a.modal?r.jsx(Be,{present:s||a.open,children:r.jsx(j0,{...o,ref:t})}):null});Gl.displayName=fs;var w0=fn("DialogOverlay.RemoveScroll"),j0=l.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ze(fs,n);return r.jsx(Mr,{as:w0,allowPinchZoom:!0,shards:[o.contentRef],children:r.jsx(W.div,{"data-state":Sa(o.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),mn="DialogContent",Ql=l.forwardRef((e,t)=>{const n=Hl(mn,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,a=Ze(mn,e.__scopeDialog);return r.jsx(Be,{present:s||a.open,children:a.modal?r.jsx(N0,{...o,ref:t}):r.jsx(C0,{...o,ref:t})})});Ql.displayName=mn;var N0=l.forwardRef((e,t)=>{const n=Ze(mn,e.__scopeDialog),s=l.useRef(null),o=de(t,n.contentRef,s);return l.useEffect(()=>{const a=s.current;if(a)return Es(a)},[]),r.jsx(Yl,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:O(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:O(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&a.preventDefault()}),onFocusOutside:O(e.onFocusOutside,a=>a.preventDefault())})}),C0=l.forwardRef((e,t)=>{const n=Ze(mn,e.__scopeDialog),s=l.useRef(!1),o=l.useRef(!1);return r.jsx(Yl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var i,c;(i=e.onCloseAutoFocus)==null||i.call(e,a),a.defaultPrevented||(s.current||(c=n.triggerRef.current)==null||c.focus(),a.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:a=>{var u,d;(u=e.onInteractOutside)==null||u.call(e,a),a.defaultPrevented||(s.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=a.target;((d=n.triggerRef.current)==null?void 0:d.contains(i))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),Yl=l.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:a,...i}=e,c=Ze(mn,n),u=l.useRef(null),d=de(t,u);return bs(),r.jsxs(r.Fragment,{children:[r.jsx(kr,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:a,children:r.jsx(Pr,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Sa(c.open),...i,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(S0,{titleId:c.titleId}),r.jsx(R0,{contentRef:u,descriptionId:c.descriptionId})]})]})}),Ca="DialogTitle",Xl=l.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ze(Ca,n);return r.jsx(W.h2,{id:o.titleId,...s,ref:t})});Xl.displayName=Ca;var Zl="DialogDescription",Jl=l.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ze(Zl,n);return r.jsx(W.p,{id:o.descriptionId,...s,ref:t})});Jl.displayName=Zl;var ed="DialogClose",td=l.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ze(ed,n);return r.jsx(W.button,{type:"button",...s,ref:t,onClick:O(e.onClick,()=>o.onOpenChange(!1))})});td.displayName=ed;function Sa(e){return e?"open":"closed"}var nd="DialogTitleWarning",[PN,rd]=hx(nd,{contentName:mn,titleName:Ca,docsSlug:"dialog"}),S0=({titleId:e})=>{const t=rd(nd),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
310
|
-
|
|
311
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
312
|
-
|
|
313
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return l.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},E0="DialogDescriptionWarning",R0=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${rd(E0).contentName}}.`;return l.useEffect(()=>{var a;const o=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},Ea=Kl,Ra=Wl,Ts=Gl,As=Ql,Pa=Xl,ka=Jl,sd=td,P0=Symbol.for("react.lazy"),hs=Xo[" use ".trim().toString()];function k0(e){return typeof e=="object"&&e!==null&&"then"in e}function od(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===P0&&"_payload"in e&&k0(e._payload)}function T0(e){const t=A0(e),n=l.forwardRef((s,o)=>{let{children:a,...i}=s;od(a)&&typeof hs=="function"&&(a=hs(a._payload));const c=l.Children.toArray(a),u=c.find(_0);if(u){const d=u.props.children,h=c.map(f=>f===u?l.Children.count(d)>1?l.Children.only(null):l.isValidElement(d)?d.props.children:null:f);return r.jsx(t,{...i,ref:o,children:l.isValidElement(d)?l.cloneElement(d,void 0,h):null})}return r.jsx(t,{...i,ref:o,children:a})});return n.displayName=`${e}.Slot`,n}function A0(e){const t=l.forwardRef((n,s)=>{let{children:o,...a}=n;if(od(o)&&typeof hs=="function"&&(o=hs(o._payload)),l.isValidElement(o)){const i=I0(o),c=O0(a,o.props);return o.type!==l.Fragment&&(c.ref=s?at(s,i):i),l.cloneElement(o,c)}return l.Children.count(o)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var M0=Symbol("radix.slottable");function _0(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===M0}function O0(e,t){const n={...t};for(const s in t){const o=e[s],a=t[s];/^on[A-Z]/.test(s)?o&&a?n[s]=(...c)=>{const u=a(...c);return o(...c),u}:o&&(n[s]=o):s==="style"?n[s]={...o,...a}:s==="className"&&(n[s]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function I0(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var D0=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ct=D0.reduce((e,t)=>{const n=T0(`Primitive.${t}`),s=l.forwardRef((o,a)=>{const{asChild:i,...c}=o,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(u,{...c,ref:a})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),lr='[cmdk-group=""]',io='[cmdk-group-items=""]',z0='[cmdk-group-heading=""]',ad='[cmdk-item=""]',$i=`${ad}:not([aria-disabled="true"])`,Fo="cmdk-item-select",En="data-value",L0=(e,t,n)=>g0(e,t,n),id=l.createContext(void 0),Or=()=>l.useContext(id),cd=l.createContext(void 0),Ta=()=>l.useContext(cd),ld=l.createContext(void 0),dd=l.forwardRef((e,t)=>{let n=Rn(()=>{var R,K;return{search:"",value:(K=(R=e.value)!=null?R:e.defaultValue)!=null?K:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=Rn(()=>new Set),o=Rn(()=>new Map),a=Rn(()=>new Map),i=Rn(()=>new Set),c=ud(e),{label:u,children:d,value:h,onValueChange:f,filter:m,shouldFilter:g,loop:v,disablePointerSelection:p=!1,vimBindings:x=!0,...y}=e,w=je(),N=je(),j=je(),C=l.useRef(null),E=Q0();pn(()=>{if(h!==void 0){let R=h.trim();n.current.value=R,S.emit()}},[h]),pn(()=>{E(6,G)},[]);let S=l.useMemo(()=>({subscribe:R=>(i.current.add(R),()=>i.current.delete(R)),snapshot:()=>n.current,setState:(R,K,H)=>{var z,Z,A,Q;if(!Object.is(n.current[R],K)){if(n.current[R]=K,R==="search")_(),I(),E(1,$);else if(R==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Y=document.getElementById(j);Y?Y.focus():(z=document.getElementById(w))==null||z.focus()}if(E(7,()=>{var Y;n.current.selectedItemId=(Y=U())==null?void 0:Y.id,S.emit()}),H||E(5,G),((Z=c.current)==null?void 0:Z.value)!==void 0){let Y=K??"";(Q=(A=c.current).onValueChange)==null||Q.call(A,Y);return}}S.emit()}},emit:()=>{i.current.forEach(R=>R())}}),[]),P=l.useMemo(()=>({value:(R,K,H)=>{var z;K!==((z=a.current.get(R))==null?void 0:z.value)&&(a.current.set(R,{value:K,keywords:H}),n.current.filtered.items.set(R,D(K,H)),E(2,()=>{I(),S.emit()}))},item:(R,K)=>(s.current.add(R),K&&(o.current.has(K)?o.current.get(K).add(R):o.current.set(K,new Set([R]))),E(3,()=>{_(),I(),n.current.value||$(),S.emit()}),()=>{a.current.delete(R),s.current.delete(R),n.current.filtered.items.delete(R);let H=U();E(4,()=>{_(),(H==null?void 0:H.getAttribute("id"))===R&&$(),S.emit()})}),group:R=>(o.current.has(R)||o.current.set(R,new Set),()=>{a.current.delete(R),o.current.delete(R)}),filter:()=>c.current.shouldFilter,label:u||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:w,inputId:j,labelId:N,listInnerRef:C}),[]);function D(R,K){var H,z;let Z=(z=(H=c.current)==null?void 0:H.filter)!=null?z:L0;return R?Z(R,n.current.search,K):0}function I(){if(!n.current.search||c.current.shouldFilter===!1)return;let R=n.current.filtered.items,K=[];n.current.filtered.groups.forEach(z=>{let Z=o.current.get(z),A=0;Z.forEach(Q=>{let Y=R.get(Q);A=Math.max(Y,A)}),K.push([z,A])});let H=C.current;X().sort((z,Z)=>{var A,Q;let Y=z.getAttribute("id"),ae=Z.getAttribute("id");return((A=R.get(ae))!=null?A:0)-((Q=R.get(Y))!=null?Q:0)}).forEach(z=>{let Z=z.closest(io);Z?Z.appendChild(z.parentElement===Z?z:z.closest(`${io} > *`)):H.appendChild(z.parentElement===H?z:z.closest(`${io} > *`))}),K.sort((z,Z)=>Z[1]-z[1]).forEach(z=>{var Z;let A=(Z=C.current)==null?void 0:Z.querySelector(`${lr}[${En}="${encodeURIComponent(z[0])}"]`);A==null||A.parentElement.appendChild(A)})}function $(){let R=X().find(H=>H.getAttribute("aria-disabled")!=="true"),K=R==null?void 0:R.getAttribute(En);S.setState("value",K||void 0)}function _(){var R,K,H,z;if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=s.current.size;return}n.current.filtered.groups=new Set;let Z=0;for(let A of s.current){let Q=(K=(R=a.current.get(A))==null?void 0:R.value)!=null?K:"",Y=(z=(H=a.current.get(A))==null?void 0:H.keywords)!=null?z:[],ae=D(Q,Y);n.current.filtered.items.set(A,ae),ae>0&&Z++}for(let[A,Q]of o.current)for(let Y of Q)if(n.current.filtered.items.get(Y)>0){n.current.filtered.groups.add(A);break}n.current.filtered.count=Z}function G(){var R,K,H;let z=U();z&&(((R=z.parentElement)==null?void 0:R.firstChild)===z&&((H=(K=z.closest(lr))==null?void 0:K.querySelector(z0))==null||H.scrollIntoView({block:"nearest"})),z.scrollIntoView({block:"nearest"}))}function U(){var R;return(R=C.current)==null?void 0:R.querySelector(`${ad}[aria-selected="true"]`)}function X(){var R;return Array.from(((R=C.current)==null?void 0:R.querySelectorAll($i))||[])}function V(R){let K=X()[R];K&&S.setState("value",K.getAttribute(En))}function re(R){var K;let H=U(),z=X(),Z=z.findIndex(Q=>Q===H),A=z[Z+R];(K=c.current)!=null&&K.loop&&(A=Z+R<0?z[z.length-1]:Z+R===z.length?z[0]:z[Z+R]),A&&S.setState("value",A.getAttribute(En))}function L(R){let K=U(),H=K==null?void 0:K.closest(lr),z;for(;H&&!z;)H=R>0?W0(H,lr):G0(H,lr),z=H==null?void 0:H.querySelector($i);z?S.setState("value",z.getAttribute(En)):re(R)}let T=()=>V(X().length-1),ie=R=>{R.preventDefault(),R.metaKey?T():R.altKey?L(1):re(1)},ce=R=>{R.preventDefault(),R.metaKey?V(0):R.altKey?L(-1):re(-1)};return l.createElement(Ct.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:R=>{var K;(K=y.onKeyDown)==null||K.call(y,R);let H=R.nativeEvent.isComposing||R.keyCode===229;if(!(R.defaultPrevented||H))switch(R.key){case"n":case"j":{x&&R.ctrlKey&&ie(R);break}case"ArrowDown":{ie(R);break}case"p":case"k":{x&&R.ctrlKey&&ce(R);break}case"ArrowUp":{ce(R);break}case"Home":{R.preventDefault(),V(0);break}case"End":{R.preventDefault(),T();break}case"Enter":{R.preventDefault();let z=U();if(z){let Z=new Event(Fo);z.dispatchEvent(Z)}}}}},l.createElement("label",{"cmdk-label":"",htmlFor:P.inputId,id:P.labelId,style:X0},u),Ms(e,R=>l.createElement(cd.Provider,{value:S},l.createElement(id.Provider,{value:P},R))))}),F0=l.forwardRef((e,t)=>{var n,s;let o=je(),a=l.useRef(null),i=l.useContext(ld),c=Or(),u=ud(e),d=(s=(n=u.current)==null?void 0:n.forceMount)!=null?s:i==null?void 0:i.forceMount;pn(()=>{if(!d)return c.item(o,i==null?void 0:i.id)},[d]);let h=fd(o,a,[e.value,e.children,a],e.keywords),f=Ta(),m=Ht(E=>E.value&&E.value===h.current),g=Ht(E=>d||c.filter()===!1?!0:E.search?E.filtered.items.get(o)>0:!0);l.useEffect(()=>{let E=a.current;if(!(!E||e.disabled))return E.addEventListener(Fo,v),()=>E.removeEventListener(Fo,v)},[g,e.onSelect,e.disabled]);function v(){var E,S;p(),(S=(E=u.current).onSelect)==null||S.call(E,h.current)}function p(){f.setState("value",h.current,!0)}if(!g)return null;let{disabled:x,value:y,onSelect:w,forceMount:N,keywords:j,...C}=e;return l.createElement(Ct.div,{ref:at(a,t),...C,id:o,"cmdk-item":"",role:"option","aria-disabled":!!x,"aria-selected":!!m,"data-disabled":!!x,"data-selected":!!m,onPointerMove:x||c.getDisablePointerSelection()?void 0:p,onClick:x?void 0:v},e.children)}),$0=l.forwardRef((e,t)=>{let{heading:n,children:s,forceMount:o,...a}=e,i=je(),c=l.useRef(null),u=l.useRef(null),d=je(),h=Or(),f=Ht(g=>o||h.filter()===!1?!0:g.search?g.filtered.groups.has(i):!0);pn(()=>h.group(i),[]),fd(i,c,[e.value,e.heading,u]);let m=l.useMemo(()=>({id:i,forceMount:o}),[o]);return l.createElement(Ct.div,{ref:at(c,t),...a,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&l.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:d},n),Ms(e,g=>l.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?d:void 0},l.createElement(ld.Provider,{value:m},g))))}),U0=l.forwardRef((e,t)=>{let{alwaysRender:n,...s}=e,o=l.useRef(null),a=Ht(i=>!i.search);return!n&&!a?null:l.createElement(Ct.div,{ref:at(o,t),...s,"cmdk-separator":"",role:"separator"})}),V0=l.forwardRef((e,t)=>{let{onValueChange:n,...s}=e,o=e.value!=null,a=Ta(),i=Ht(d=>d.search),c=Ht(d=>d.selectedItemId),u=Or();return l.useEffect(()=>{e.value!=null&&a.setState("search",e.value)},[e.value]),l.createElement(Ct.input,{ref:t,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":c,id:u.inputId,type:"text",value:o?e.value:i,onChange:d=>{o||a.setState("search",d.target.value),n==null||n(d.target.value)}})}),B0=l.forwardRef((e,t)=>{let{children:n,label:s="Suggestions",...o}=e,a=l.useRef(null),i=l.useRef(null),c=Ht(d=>d.selectedItemId),u=Or();return l.useEffect(()=>{if(i.current&&a.current){let d=i.current,h=a.current,f,m=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let g=d.offsetHeight;h.style.setProperty("--cmdk-list-height",g.toFixed(1)+"px")})});return m.observe(d),()=>{cancelAnimationFrame(f),m.unobserve(d)}}},[]),l.createElement(Ct.div,{ref:at(a,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":s,id:u.listId},Ms(e,d=>l.createElement("div",{ref:at(i,u.listInnerRef),"cmdk-list-sizer":""},d)))}),K0=l.forwardRef((e,t)=>{let{open:n,onOpenChange:s,overlayClassName:o,contentClassName:a,container:i,...c}=e;return l.createElement(Ea,{open:n,onOpenChange:s},l.createElement(Ra,{container:i},l.createElement(Ts,{"cmdk-overlay":"",className:o}),l.createElement(As,{"aria-label":e.label,"cmdk-dialog":"",className:a},l.createElement(dd,{ref:t,...c}))))}),q0=l.forwardRef((e,t)=>Ht(n=>n.filtered.count===0)?l.createElement(Ct.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),H0=l.forwardRef((e,t)=>{let{progress:n,children:s,label:o="Loading...",...a}=e;return l.createElement(Ct.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},Ms(e,i=>l.createElement("div",{"aria-hidden":!0},i)))}),Me=Object.assign(dd,{List:B0,Item:F0,Input:V0,Group:$0,Separator:U0,Dialog:K0,Empty:q0,Loading:H0});function W0(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function G0(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ud(e){let t=l.useRef(e);return pn(()=>{t.current=e}),t}var pn=typeof window>"u"?l.useEffect:l.useLayoutEffect;function Rn(e){let t=l.useRef();return t.current===void 0&&(t.current=e()),t}function Ht(e){let t=Ta(),n=()=>e(t.snapshot());return l.useSyncExternalStore(t.subscribe,n,n)}function fd(e,t,n,s=[]){let o=l.useRef(),a=Or();return pn(()=>{var i;let c=(()=>{var d;for(let h of n){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(d=h.current.textContent)==null?void 0:d.trim():o.current}})(),u=s.map(d=>d.trim());a.value(e,c,u),(i=t.current)==null||i.setAttribute(En,c),o.current=c}),o}var Q0=()=>{let[e,t]=l.useState(),n=Rn(()=>new Map);return pn(()=>{n.current.forEach(s=>s()),n.current=new Map},[e]),(s,o)=>{n.current.set(s,o),t({})}};function Y0(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Ms({asChild:e,children:t},n){return e&&l.isValidElement(t)?l.cloneElement(Y0(t),{ref:t.ref},n(t.props.children)):n(t)}var X0={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const hd=Ea,Z0=Ra,md=l.forwardRef(({className:e,...t},n)=>r.jsx(Ts,{ref:n,className:k("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));md.displayName=Ts.displayName;const Aa=l.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(Z0,{children:[r.jsx(md,{}),r.jsxs(As,{ref:s,className:k("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-zinc-200 bg-white p-6 shadow-lg duration-200","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","rounded-lg",e),...n,children:[t,r.jsxs(sd,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-zinc-950 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-zinc-100 data-[state=open]:text-zinc-500",children:[r.jsx(Rr,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Aa.displayName=As.displayName;const pd=({className:e,...t})=>r.jsx("div",{className:k("flex flex-col space-y-1.5 text-left",e),...t});pd.displayName="DialogHeader";const xd=({className:e,...t})=>r.jsx("div",{className:k("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});xd.displayName="DialogFooter";const gd=l.forwardRef(({className:e,...t},n)=>r.jsx(Pa,{ref:n,className:k("text-lg font-semibold leading-none tracking-tight",e),...t}));gd.displayName=Pa.displayName;const J0=l.forwardRef(({className:e,...t},n)=>r.jsx(ka,{ref:n,className:k("text-sm text-zinc-500",e),...t}));J0.displayName=ka.displayName;const vd=l.forwardRef(({className:e,...t},n)=>r.jsx(Me,{ref:n,className:k("flex h-full w-full flex-col overflow-hidden rounded-md bg-white text-zinc-900",e),...t}));vd.displayName=Me.displayName;const ey=({children:e,...t})=>r.jsx(hd,{...t,children:r.jsx(Aa,{className:"overflow-hidden p-0 shadow-2xl max-w-2xl",children:r.jsx(vd,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-zinc-500 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),yd=l.forwardRef(({className:e,...t},n)=>r.jsxs("div",{className:"flex items-center border-b border-zinc-200 px-3","cmdk-input-wrapper":"",children:[r.jsx(Zn,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsx(Me.Input,{ref:n,className:k("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-zinc-400 disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));yd.displayName=Me.Input.displayName;const bd=l.forwardRef(({className:e,...t},n)=>r.jsx(Me.List,{ref:n,className:k("max-h-[400px] overflow-y-auto overflow-x-hidden",e),...t}));bd.displayName=Me.List.displayName;const wd=l.forwardRef((e,t)=>r.jsx(Me.Empty,{ref:t,className:"py-6 text-center text-sm text-zinc-500",...e}));wd.displayName=Me.Empty.displayName;const es=l.forwardRef(({className:e,...t},n)=>r.jsx(Me.Group,{ref:n,className:k("overflow-hidden p-1 text-zinc-900 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-wider [&_[cmdk-group-heading]]:text-zinc-500",e),...t}));es.displayName=Me.Group.displayName;const $o=l.forwardRef(({className:e,...t},n)=>r.jsx(Me.Separator,{ref:n,className:k("-mx-1 h-px bg-zinc-100",e),...t}));$o.displayName=Me.Separator.displayName;const ts=l.forwardRef(({className:e,...t},n)=>r.jsx(Me.Item,{ref:n,className:k("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none","data-[disabled=true]:pointer-events-none data-[selected=true]:bg-zinc-100 data-[selected=true]:text-zinc-900 data-[disabled=true]:opacity-50","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));ts.displayName=Me.Item.displayName;const jd=ja(e=>({isOpen:!1,open:()=>e({isOpen:!0}),close:()=>e({isOpen:!1}),toggle:()=>e(t=>({isOpen:!t.isOpen}))}));function ty(e){return Pe({queryKey:["search",e],queryFn:()=>se.get("/api/admin/search",{q:e}),enabled:e.length>=2,staleTime:1e4})}function ny(e,t){const[n,s]=l.useState(e);return l.useEffect(()=>{const o=setTimeout(()=>s(e),t);return()=>clearTimeout(o)},[e,t]),n}function ry(){const{isOpen:e,close:t}=jd(),n=jt(),[s,o]=l.useState(""),a=ny(s,300),{data:i}=ty(a),c=l.useCallback(u=>{t(),u()},[t]);return r.jsxs(ey,{open:e,onOpenChange:u=>!u&&t(),children:[r.jsx(yd,{placeholder:"Search orders, products, customers...",value:s,onValueChange:o,"data-testid":B("search","input")}),r.jsxs(bd,{"data-testid":B("search"),children:[r.jsx(wd,{children:a.length<2?r.jsx("span",{className:"text-zinc-400",children:"Type at least 2 characters to search"}):r.jsxs("span",{children:['No results for "',a,'"']})}),(i==null?void 0:i.orders)&&i.orders.length>0&&r.jsx(es,{heading:"Orders",children:i.orders.slice(0,5).map(u=>r.jsxs(ts,{value:`order-${u.orderNumber}`,onSelect:()=>c(()=>n(`/orders/${u.orderNumber}`)),children:[r.jsx(Kn,{className:"h-4 w-4 text-zinc-400 shrink-0"}),r.jsxs("div",{className:"flex flex-col min-w-0",children:[r.jsxs("span",{className:"font-mono text-sm font-medium",children:["#",u.orderNumber]}),r.jsx("span",{className:"text-xs text-zinc-500 truncate",children:u.email})]})]},u.id))}),(i==null?void 0:i.products)&&i.products.length>0&&r.jsxs(r.Fragment,{children:[i.orders&&i.orders.length>0&&r.jsx($o,{}),r.jsx(es,{heading:"Products",children:i.products.slice(0,5).map(u=>r.jsxs(ts,{value:`product-${u.id}`,onSelect:()=>c(()=>n(`/products/${u.slug}`)),children:[r.jsx(Vt,{className:"h-4 w-4 text-zinc-400 shrink-0"}),r.jsxs("div",{className:"flex flex-col min-w-0",children:[r.jsx("span",{className:"text-sm font-medium truncate",children:u.name}),r.jsx("span",{className:"text-xs text-zinc-500 capitalize",children:u.status})]})]},u.id))})]}),(i==null?void 0:i.customers)&&i.customers.length>0&&r.jsxs(r.Fragment,{children:[r.jsx($o,{}),r.jsx(es,{heading:"Customers",children:i.customers.slice(0,5).map(u=>r.jsxs(ts,{value:`customer-${u.id}`,onSelect:()=>c(()=>n(`/customers/${u.id}`)),children:[r.jsx(ia,{className:"h-4 w-4 text-zinc-400 shrink-0"}),r.jsxs("div",{className:"flex flex-col min-w-0",children:[r.jsxs("span",{className:"text-sm font-medium",children:[u.firstName," ",u.lastName]}),r.jsx("span",{className:"text-xs text-zinc-500 truncate",children:u.email})]})]},u.id))})]})]})]})}function sy(){const{open:e}=jd();return l.useEffect(()=>{const t=n=>{(n.metaKey||n.ctrlKey)&&n.key==="k"&&(n.preventDefault(),e())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e]),r.jsxs("button",{onClick:e,className:"flex items-center gap-2 rounded-md border border-zinc-200 bg-white px-3 py-1.5 text-sm text-zinc-500 hover:border-zinc-300 hover:text-zinc-700 transition-colors","data-testid":B("search","trigger"),children:[r.jsx(Zn,{className:"h-3.5 w-3.5"}),r.jsx("span",{className:"hidden sm:inline",children:"Search"}),r.jsxs("kbd",{className:"hidden sm:inline-flex items-center gap-1 rounded border border-zinc-200 bg-zinc-50 px-1.5 text-[10px] font-medium text-zinc-400",children:[r.jsx("span",{children:"⌘"}),"K"]})]})}const Ma=["orders","list"],Xt=e=>e===void 0;function Nd(e,t){return Xt(e.status)||e.status===t.status}function oy(e,t){return Nd(e,t)&&Xt(e.q)&&Xt(e.dateFrom)&&Xt(e.dateTo)&&Xt(e.customer)&&(Xt(e.offset)||e.offset===0)&&(Xt(e.sort)||e.sort==="createdAt:desc")}function ay(e,t){for(const n of e.getQueryCache().findAll({queryKey:Ma})){const s=n.queryKey[2]??{};if(!Nd(s,t))continue;const o={queryKey:n.queryKey,exact:!0},a=n.state.fetchStatus==="fetching"?e.cancelQueries(o):void 0,i=e.getQueryData(n.queryKey),c=i!==void 0&&oy(s,t);if(c){const u=[t,...i.filter(d=>d.id!==t.id)];e.setQueryData(n.queryKey,u.slice(0,s.limit??u.length))}a?a.then(()=>e.invalidateQueries(o)):c||e.invalidateQueries(o)}}const iy=[Ma,["orders","detail"],["dashboard"],["inventory","list"]];async function cy(e){await Promise.all(iy.map(async t=>{await e.cancelQueries({queryKey:t}),e.invalidateQueries({queryKey:t})}))}function ly(e){const t=Ul.getState().pushNotification;function n(s){switch(s.type){case"order.placed.v1":{const{order:o}=s.payload;ay(e,o),e.invalidateQueries({queryKey:["dashboard"]}),t({type:"info",title:"New Order",message:`Order #${o.orderNumber} placed by ${o.email}`});break}case"order.paid.v1":case"order.fulfilled.v1":case"order.shipped.v1":case"order.delivered.v1":case"order.cancelled.v1":case"order.refunded.v1":case"order.partially_refunded.v1":{e.invalidateQueries({queryKey:Ma}),e.invalidateQueries({queryKey:["orders","detail"]}),e.invalidateQueries({queryKey:["dashboard"]});break}case"inventory.changed.v1":{e.invalidateQueries({queryKey:["inventory","list"]});break}case"inventory.low_stock.v1":{const{variantId:o,currentQty:a,threshold:i}=s.payload;t({type:"warning",title:"Low Stock Alert",message:`Variant ${o} is running low: ${a} left (threshold ${i})`}),e.invalidateQueries({queryKey:["inventory","list"]});break}case"inventory.out_of_stock.v1":{t({type:"error",title:"Out of Stock",message:`Variant ${s.payload.variantId} is out of stock`}),e.invalidateQueries({queryKey:["inventory","list"]});break}case"payment.failed.v1":{const{orderId:o,reason:a}=s.payload;t({type:"error",title:"Payment Failed",message:`Payment failed for order ${o}: ${a}`});break}case"adapter.error.v1":{const{adapterType:o,adapterName:a,error:i}=s.payload;t({type:"error",title:"Adapter Error",message:`${o} adapter ${a}: ${i.message}`});break}}}return function(o,a){n({type:o,payload:a})}}const Cd=ja(e=>({events:[],pushEvent:(t,n)=>{const s={id:crypto.randomUUID(),type:t,label:n,at:new Date().toISOString()};e(o=>({events:[s,...o.events].slice(0,20)}))}}));function dy(e){return e.includes("error")||e.includes("failed")||e.includes("out_of_stock")?"bg-red-500/10 text-red-500 border-red-500/20":e.includes("low_stock")||e.includes("warning")?"bg-amber-500/10 text-amber-600 border-amber-500/20":e.includes("placed")||e.includes("paid")?"bg-green-500/10 text-green-600 border-green-500/20":"bg-zinc-100 text-zinc-600 border-zinc-200"}function uy(){const e=Cd(s=>s.events),t=l.useRef(null),n=e.slice(0,3);return l.useEffect(()=>{t.current&&e.length>0&&(t.current.scrollLeft=0)},[e.length]),n.length===0?r.jsxs("div",{className:"flex items-center gap-2 text-xs text-zinc-400",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsxs("span",{className:"relative flex h-2 w-2",children:[r.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-75"}),r.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-green-500"})]}),r.jsx("span",{className:"font-medium text-[10px] uppercase tracking-wider text-zinc-400",children:"Live"})]}),r.jsx("span",{className:"text-zinc-300",children:"—"}),r.jsx("span",{className:"text-zinc-400",children:"No recent events"})]}):r.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",ref:t,children:[r.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[r.jsxs("span",{className:"relative flex h-2 w-2",children:[r.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-75"}),r.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-green-500"})]}),r.jsx("span",{className:"font-medium text-[10px] uppercase tracking-wider text-zinc-400 shrink-0",children:"Live"})]}),r.jsx("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:n.map(s=>r.jsx("span",{className:k("flex shrink-0 items-center rounded-full border px-2.5 py-0.5 text-[11px] font-medium whitespace-nowrap",dy(s.type)),children:s.label},s.id))})]})}function fy({navOpen:e,onToggleNav:t}){return r.jsxs(r.Fragment,{children:[r.jsxs("header",{className:"fixed left-0 right-0 top-0 z-30 flex h-14 items-center border-b border-zinc-200 bg-white px-3 sm:px-5 md:left-60",children:[r.jsx("button",{type:"button","data-testid":B("nav","toggle"),"aria-label":"Navigation","aria-controls":"admin-sidebar","aria-expanded":e,onClick:t,className:"mr-2 rounded p-1.5 text-zinc-600 hover:bg-zinc-100 md:hidden",children:r.jsx(hp,{className:"h-5 w-5"})}),r.jsx("div",{className:"flex min-w-0 flex-1 items-center",children:r.jsx(ux,{})}),r.jsx("div",{className:"mx-8 hidden flex-1 items-center justify-center overflow-hidden md:flex",children:r.jsx(uy,{})}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx(sy,{}),r.jsx(c0,{})]})]}),r.jsx(ry,{})]})}const Ui=[1e3,2e3,5e3,1e4,3e4];function hy(e){try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&"payload"in t)return t.payload}catch{}}function my(e,t={}){let n=null,s=0,o=null,a=!1;async function i(){return(await se.post("/api/admin/events/ticket")).ticket}function c(){if(a)return;const d=Ui[Math.min(s,Ui.length-1)]??3e4;s++,o=setTimeout(()=>{u()},d)}async function u(){if(!a)try{const d=await i();if(a)return;n=new EventSource(`/api/admin/events?ticket=${encodeURIComponent(d)}`),n.onopen=()=>{s=0},n.addEventListener("connected",()=>{var h;(h=t.onConnected)==null||h.call(t)});for(const h of _m)n.addEventListener(h,f=>{const m=hy(f.data);m!==void 0&&e(h,m)});n.onerror=()=>{n==null||n.close(),n=null,c()}}catch{c()}}return{connect(){a=!1,u()},disconnect(){a=!0,o!==null&&(clearTimeout(o),o=null),n==null||n.close(),n=null}}}function py(e){switch(e.type){case"order.placed.v1":return`New order #${e.payload.order.orderNumber}`;case"order.paid.v1":return"Payment received";case"order.shipped.v1":return`Order shipped (${e.payload.carrier})`;case"order.delivered.v1":return"Order delivered";case"order.confirmation_resend_requested.v1":return"Confirmation resend queued";case"inventory.low_stock.v1":return`Low stock: ${e.payload.currentQty} left`;case"inventory.out_of_stock.v1":return"Out of stock";case"payment.failed.v1":return"Payment failed";default:return e.type.replace(/\./g," ").replace(/v\d+$/,"").trim()}}function xy({children:e}){const t=be(),n=l.useRef(null),s=Cd(o=>o.pushEvent);return l.useEffect(()=>{if(!as())return;const o=ly(t),a=my((i,c)=>{o(i,c),s(i,py({type:i,payload:c}))},{onConnected:()=>void cy(t)});return n.current=a,a.connect(),()=>{a.disconnect(),n.current=null}},[t,s]),r.jsx(r.Fragment,{children:e})}function gy(){const[e,t]=l.useState(!1);return r.jsx(xy,{children:r.jsxs("div",{className:"min-h-screen bg-zinc-100",children:[e&&r.jsx("div",{"aria-hidden":"true",className:"fixed inset-0 z-40 bg-zinc-950/50 md:hidden",onClick:()=>t(!1)}),r.jsx(dx,{open:e,onClose:()=>t(!1)}),r.jsx(fy,{navOpen:e,onToggleNav:()=>t(n=>!n)}),r.jsx("main",{className:"md:ml-60 pt-14 min-h-screen",children:r.jsx("div",{className:"p-6",children:r.jsx(qf,{})})})]})})}const xe=l.forwardRef(({className:e,type:t,...n},s)=>r.jsx("input",{type:t,className:k("flex h-9 w-full rounded-md border border-zinc-200 bg-white px-3 py-1 text-sm shadow-none transition-colors","placeholder:text-zinc-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-0 focus:border-blue-500","disabled:cursor-not-allowed disabled:opacity-50",e),ref:s,...n}));xe.displayName="Input";var vy="Label",Sd=l.forwardRef((e,t)=>r.jsx(Ct.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Sd.displayName=vy;var Ed=Sd;const yy=ys("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ze=l.forwardRef(({className:e,...t},n)=>r.jsx(Ed,{ref:n,className:k(yy(),e),...t}));ze.displayName=Ed.displayName;function by({size:e="md",className:t}){return r.jsx("div",{className:k("inline-block animate-spin rounded-full border-2 border-zinc-200 border-t-blue-600",e==="sm"&&"h-4 w-4",e==="md"&&"h-6 w-6",e==="lg"&&"h-8 w-8",t),role:"status","aria-label":"Loading"})}function wy(){const{login:e}=Fc(),[t,n]=l.useState(""),[s,o]=l.useState(""),[a,i]=l.useState(null),[c,u]=l.useState(!1),d=async h=>{h.preventDefault(),i(null),u(!0);try{await e(t,s)}catch(f){i(f instanceof Error?f.message:"Login failed")}finally{u(!1)}};return r.jsxs("main",{className:"flex min-h-screen items-center justify-center bg-zinc-950 px-4",children:[r.jsx("div",{className:"pointer-events-none fixed inset-0 opacity-[0.03]",style:{backgroundImage:"radial-gradient(circle, #fff 1px, transparent 1px)",backgroundSize:"24px 24px"}}),r.jsxs("div",{className:"relative w-full max-w-sm",children:[r.jsxs("div",{className:"mb-8 flex flex-col items-center gap-3",children:[r.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl bg-blue-600 shadow-lg shadow-blue-500/20",children:r.jsx("span",{className:"text-xl font-bold text-white",children:"N"})}),r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-xl font-bold tracking-widest text-zinc-100 uppercase",children:"Nymbal"}),r.jsx("p",{className:"text-sm text-zinc-500",children:"Admin Dashboard"})]})]}),r.jsxs("div",{className:"rounded-xl border border-zinc-800 bg-zinc-900 p-6 shadow-2xl",children:[r.jsx("h2",{className:"mb-1 text-base font-semibold text-zinc-100",children:"Sign in"}),r.jsx("p",{className:"mb-6 text-sm text-zinc-500",children:"Enter your admin credentials"}),r.jsxs("form",{onSubmit:h=>void d(h),"data-testid":B("login","form"),className:"space-y-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{className:"text-zinc-300 text-xs",children:"Email"}),r.jsx(xe,{type:"email",value:t,onChange:h=>n(h.target.value),placeholder:"admin@yourstore.com",autoComplete:"email",required:!0,disabled:c,"data-testid":B("login","email"),className:"bg-zinc-800 border-zinc-700 text-zinc-100 placeholder:text-zinc-600 focus:ring-blue-500 focus:border-blue-500"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{className:"text-zinc-300 text-xs",children:"Password"}),r.jsx(xe,{type:"password",value:s,onChange:h=>o(h.target.value),placeholder:"••••••••",autoComplete:"current-password",required:!0,disabled:c,"data-testid":B("login","password"),className:"bg-zinc-800 border-zinc-700 text-zinc-100 placeholder:text-zinc-600 focus:ring-blue-500 focus:border-blue-500"})]}),a&&r.jsx("div",{role:"alert","data-testid":B("login","error"),className:"rounded-md border border-red-800/50 bg-red-900/20 px-3 py-2 text-sm text-red-400",children:a}),r.jsx(le,{type:"submit",className:"w-full",disabled:c||!t||!s,"data-testid":B("login","submit"),children:c?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(by,{size:"sm",className:"border-blue-200 border-t-white"}),"Signing in..."]}):"Sign in"})]})]}),r.jsx("p",{className:"mt-4 text-center text-xs text-zinc-600",children:"Nymbal Admin · Precision Workspace"})]})]})}function ge({className:e,...t}){return r.jsx("div",{className:k("animate-pulse rounded-md bg-zinc-200",e),...t})}const jy={pending:"bg-zinc-100 text-zinc-700",confirmed:"bg-blue-100 text-blue-700",processing:"bg-indigo-100 text-indigo-700",shipped:"bg-violet-100 text-violet-700",delivered:"bg-green-100 text-green-700",cancelled:"bg-red-100 text-red-700",refunded:"bg-orange-100 text-orange-700",partially_refunded:"bg-amber-100 text-amber-700"},Ny={pending:"Pending",confirmed:"Confirmed",processing:"Processing",shipped:"Shipped",delivered:"Delivered",cancelled:"Cancelled",refunded:"Refunded",partially_refunded:"Part. Refunded"};function Wn({status:e,size:t="md",className:n,"data-testid":s}){return r.jsx("span",{"data-testid":s,className:k("inline-flex items-center rounded-full font-medium",t==="sm"?"px-2 py-0.5 text-[10px]":"px-2.5 py-0.5 text-xs",jy[e],n),children:Ny[e]})}function ct({icon:e,title:t,description:n,action:s,className:o}){return r.jsxs("div",{className:k("flex flex-col items-center justify-center py-16 px-4 text-center",o),children:[e&&r.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-zinc-100 text-zinc-400",children:e}),r.jsx("h3",{className:"text-sm font-medium text-zinc-900",children:t}),n&&r.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:n}),s&&r.jsx("div",{className:"mt-4",children:s})]})}function Cy(){return Pe({queryKey:["dashboard"],queryFn:()=>se.get("/api/admin/dashboard"),refetchInterval:6e4})}function pe(e,t){return new Intl.NumberFormat("en-GB",{style:"currency",currency:t,minimumFractionDigits:2}).format(e/100)}function Sy(e){const t=e.trim();if(!/^\d+(\.\d{1,2})?$/.test(t))return null;const[n="0",s=""]=t.split(".");return Number(n)*100+Number(s.padEnd(2,"0"))}function Ey(e,t){const n=e/100,s=Ry(t);return n>=1e6?`${s}${(n/1e6).toFixed(1)}M`:n>=1e3?`${s}${(n/1e3).toFixed(1)}k`:pe(e,t)}function Ry(e){try{return new Intl.NumberFormat("en-GB",{style:"currency",currency:e,minimumFractionDigits:0,maximumFractionDigits:0}).format(0).replace(/[\d\s,]/g,"").trim()}catch{return e}}function Py(){return r.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-green-50 border border-green-200 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-green-600",children:[r.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[r.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-75"}),r.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-green-500"})]}),"Live"]})}function co({icon:e,label:t,value:n,subtext:s,loading:o,color:a="blue"}){const i={blue:"bg-blue-50 text-blue-600",green:"bg-green-50 text-green-600",violet:"bg-violet-50 text-violet-600"};return r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-white p-5",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsx("div",{className:k("flex h-9 w-9 items-center justify-center rounded-lg",i[a]),children:e}),r.jsx(Ao,{className:"h-4 w-4 text-zinc-300"})]}),o?r.jsxs(r.Fragment,{children:[r.jsx(ge,{className:"h-7 w-24 mb-1"}),r.jsx(ge,{className:"h-3.5 w-16"})]}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-2xl font-semibold font-mono text-zinc-900",children:n}),r.jsx("p",{className:"mt-0.5 text-xs text-zinc-500",children:t}),s&&r.jsx("p",{className:"mt-1 text-[11px] text-zinc-400",children:s})]})]})}function ky(){var a,i;const{data:e}=Lc(),{data:t,isLoading:n}=Cy(),s=jt(),o="GBP";return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-lg font-semibold text-zinc-900",children:(e==null?void 0:e.storeName)??"Dashboard"}),r.jsx("p",{className:"text-sm text-zinc-500",children:"Today's performance at a glance"})]}),r.jsx(Py,{})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[r.jsx(co,{icon:r.jsx(Kn,{className:"h-4.5 w-4.5"}),label:"Orders today",value:String((t==null?void 0:t.today.orderCount)??0),loading:n,color:"blue"}),r.jsx(co,{icon:r.jsx(op,{className:"h-4.5 w-4.5"}),label:"Revenue today",value:t?Ey(t.today.revenueMinor,o):"—",subtext:t?pe(t.today.revenueMinor,o):void 0,loading:n,color:"green"}),r.jsx(co,{icon:r.jsx(zc,{className:"h-4.5 w-4.5"}),label:"Items shipped",value:String((t==null?void 0:t.today.itemsShipped)??0),loading:n,color:"violet"})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-3",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-white overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-100 px-4 py-3",children:[r.jsx("h2",{className:"text-sm font-semibold text-zinc-900",children:"Recent Orders"}),r.jsx("button",{onClick:()=>s("/orders"),className:"text-xs text-blue-600 hover:text-blue-700 font-medium",children:"View all →"})]}),n?r.jsx("div",{className:"p-4 space-y-2",children:Array.from({length:5}).map((c,u)=>r.jsx(ge,{className:"h-11 w-full"},u))}):(a=t==null?void 0:t.recentOrders)!=null&&a.length?r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{className:"border-b border-zinc-100",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-4 py-2.5 text-left text-[10px] font-medium uppercase tracking-wider text-zinc-400",children:"Order"}),r.jsx("th",{className:"px-4 py-2.5 text-left text-[10px] font-medium uppercase tracking-wider text-zinc-400",children:"Customer"}),r.jsx("th",{className:"px-4 py-2.5 text-left text-[10px] font-medium uppercase tracking-wider text-zinc-400",children:"Status"}),r.jsx("th",{className:"px-4 py-2.5 text-right text-[10px] font-medium uppercase tracking-wider text-zinc-400",children:"Total"}),r.jsx("th",{className:"px-4 py-2.5 text-right text-[10px] font-medium uppercase tracking-wider text-zinc-400",children:"Time"})]})}),r.jsx("tbody",{children:t.recentOrders.map(c=>r.jsxs("tr",{className:"cursor-pointer border-b border-zinc-50 last:border-0 hover:bg-zinc-50 transition-colors",onClick:()=>s(`/orders/${c.orderNumber}`),children:[r.jsx("td",{className:"px-4 py-2.5",children:r.jsxs("span",{className:"font-mono text-sm font-medium text-blue-600",children:["#",c.orderNumber]})}),r.jsx("td",{className:"px-4 py-2.5 text-zinc-600 truncate max-w-[160px]",children:c.email}),r.jsx("td",{className:"px-4 py-2.5",children:r.jsx(Wn,{status:c.status,size:"sm"})}),r.jsx("td",{className:"px-4 py-2.5 text-right font-mono text-sm text-zinc-700",children:pe(c.totalMinor,c.currency)}),r.jsx("td",{className:"px-4 py-2.5 text-right text-xs text-zinc-400",children:ut(c.createdAt)})]},c.id))})]}):r.jsx(ct,{icon:r.jsx(Kn,{className:"h-5 w-5"}),title:"No orders yet",description:"Orders will appear here as they come in."})]})}),r.jsx("div",{children:r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-white overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-100 px-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h2",{className:"text-sm font-semibold text-zinc-900",children:"Low Stock"}),(t==null?void 0:t.lowStock)&&t.lowStock.length>0&&r.jsx("span",{className:"rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-semibold text-amber-700",children:t.lowStock.length})]}),r.jsx("button",{onClick:()=>s("/inventory"),className:"text-xs text-blue-600 hover:text-blue-700 font-medium",children:"Manage →"})]}),n?r.jsx("div",{className:"p-4 space-y-2",children:Array.from({length:4}).map((c,u)=>r.jsx(ge,{className:"h-10 w-full"},u))}):(i=t==null?void 0:t.lowStock)!=null&&i.length?r.jsx("div",{className:"divide-y divide-zinc-50",children:t.lowStock.map(c=>r.jsxs("div",{className:"flex items-center justify-between px-4 py-3 cursor-pointer hover:bg-zinc-50 transition-colors",onClick:()=>s("/inventory"),children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-xs font-medium text-zinc-700",children:c.productName}),r.jsx("p",{className:"font-mono text-[10px] text-zinc-400",children:c.sku})]}),r.jsxs("div",{className:"ml-3 text-right",children:[r.jsx("span",{className:k("font-mono text-sm font-semibold",c.status==="out_of_stock"?"text-red-600":"text-amber-600"),children:c.stock}),r.jsxs("p",{className:"text-[10px] text-zinc-400",children:["/",c.threshold]})]})]},c.variantId))}):r.jsxs("div",{className:"p-6 text-center",children:[r.jsx("div",{className:"mx-auto mb-2 flex h-8 w-8 items-center justify-center rounded-full bg-green-50",children:r.jsx(is,{className:"h-4 w-4 text-green-500"})}),r.jsx("p",{className:"text-xs text-zinc-500",children:"All stock levels are healthy"})]})]})})]})]})}const vn=l.forwardRef(({className:e,...t},n)=>r.jsx("div",{className:"relative w-full overflow-auto",children:r.jsx("table",{ref:n,className:k("w-full caption-bottom text-sm",e),...t})}));vn.displayName="Table";const yn=l.forwardRef(({className:e,...t},n)=>r.jsx("thead",{ref:n,className:k("[&_tr]:border-b [&_tr]:border-zinc-200",e),...t}));yn.displayName="TableHeader";const bn=l.forwardRef(({className:e,...t},n)=>r.jsx("tbody",{ref:n,className:k("[&_tr:last-child]:border-0",e),...t}));bn.displayName="TableBody";const Ty=l.forwardRef(({className:e,...t},n)=>r.jsx("tfoot",{ref:n,className:k("border-t border-zinc-200 bg-zinc-50/50 font-medium [&>tr]:last:border-b-0",e),...t}));Ty.displayName="TableFooter";const Fe=l.forwardRef(({className:e,...t},n)=>r.jsx("tr",{ref:n,className:k("border-b border-zinc-100 transition-colors hover:bg-zinc-50/60 data-[state=selected]:bg-blue-50",e),...t}));Fe.displayName="TableRow";const te=l.forwardRef(({className:e,...t},n)=>r.jsx("th",{ref:n,className:k("h-10 px-4 text-left align-middle text-xs font-medium uppercase tracking-wider text-zinc-500 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));te.displayName="TableHead";const ne=l.forwardRef(({className:e,...t},n)=>r.jsx("td",{ref:n,className:k("h-11 px-4 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));ne.displayName="TableCell";const Ay=l.forwardRef(({className:e,...t},n)=>r.jsx("caption",{ref:n,className:k("mt-4 text-sm text-zinc-500",e),...t}));Ay.displayName="TableCaption";function Rd(e){const t=l.useRef({value:e,previous:e});return l.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var _s="Checkbox",[My]=lt(_s),[_y,_a]=My(_s);function Oy(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:o,disabled:a,form:i,name:c,onCheckedChange:u,required:d,value:h="on",internal_do_not_use_render:f}=e,[m,g]=qt({prop:n,defaultProp:o??!1,onChange:u,caller:_s}),[v,p]=l.useState(null),[x,y]=l.useState(null),w=l.useRef(!1),N=v?!!i||!!v.closest("form"):!0,j={checked:m,disabled:a,setChecked:g,control:v,setControl:p,name:c,form:i,value:h,hasConsumerStoppedPropagationRef:w,required:d,defaultChecked:Ut(o)?!1:o,isFormControl:N,bubbleInput:x,setBubbleInput:y};return r.jsx(_y,{scope:t,...j,children:Iy(f)?f(j):s})}var Pd="CheckboxTrigger",kd=l.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},o)=>{const{control:a,value:i,disabled:c,checked:u,required:d,setControl:h,setChecked:f,hasConsumerStoppedPropagationRef:m,isFormControl:g,bubbleInput:v}=_a(Pd,e),p=de(o,h),x=l.useRef(u);return l.useEffect(()=>{const y=a==null?void 0:a.form;if(y){const w=()=>f(x.current);return y.addEventListener("reset",w),()=>y.removeEventListener("reset",w)}},[a,f]),r.jsx(W.button,{type:"button",role:"checkbox","aria-checked":Ut(u)?"mixed":u,"aria-required":d,"data-state":Od(u),"data-disabled":c?"":void 0,disabled:c,value:i,...s,ref:p,onKeyDown:O(t,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:O(n,y=>{f(w=>Ut(w)?!0:!w),v&&g&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})})});kd.displayName=Pd;var Oa=l.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:o,defaultChecked:a,required:i,disabled:c,value:u,onCheckedChange:d,form:h,...f}=e;return r.jsx(Oy,{__scopeCheckbox:n,checked:o,defaultChecked:a,disabled:c,required:i,onCheckedChange:d,name:s,form:h,value:u,internal_do_not_use_render:({isFormControl:m})=>r.jsxs(r.Fragment,{children:[r.jsx(kd,{...f,ref:t,__scopeCheckbox:n}),m&&r.jsx(_d,{__scopeCheckbox:n})]})})});Oa.displayName=_s;var Td="CheckboxIndicator",Ad=l.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...o}=e,a=_a(Td,n);return r.jsx(Be,{present:s||Ut(a.checked)||a.checked===!0,children:r.jsx(W.span,{"data-state":Od(a.checked),"data-disabled":a.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});Ad.displayName=Td;var Md="CheckboxBubbleInput",_d=l.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:o,checked:a,defaultChecked:i,required:c,disabled:u,name:d,value:h,form:f,bubbleInput:m,setBubbleInput:g}=_a(Md,e),v=de(n,g),p=Rd(a),x=ul(s);l.useEffect(()=>{const w=m;if(!w)return;const N=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(N,"checked").set,E=!o.current;if(p!==a&&C){const S=new Event("click",{bubbles:E});w.indeterminate=Ut(a),C.call(w,Ut(a)?!1:a),w.dispatchEvent(S)}},[m,p,a,o]);const y=l.useRef(Ut(a)?!1:a);return r.jsx(W.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??y.current,required:c,disabled:u,name:d,value:h,form:f,...t,tabIndex:-1,ref:v,style:{...t.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});_d.displayName=Md;function Iy(e){return typeof e=="function"}function Ut(e){return e==="indeterminate"}function Od(e){return Ut(e)?"indeterminate":e?"checked":"unchecked"}const Uo=l.forwardRef(({className:e,...t},n)=>r.jsx(Oa,{ref:n,className:k("peer h-4 w-4 shrink-0 rounded-sm border border-zinc-300 ring-offset-white","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-blue-600 data-[state=checked]:border-blue-600 data-[state=checked]:text-white",e),...t,children:r.jsx(Ad,{className:k("flex items-center justify-center text-current"),children:r.jsx(Xn,{className:"h-3 w-3",strokeWidth:3})})}));Uo.displayName=Oa.displayName;function Ia(e){const t=e+"CollectionProvider",[n,s]=lt(t),[o,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=p=>{const{scope:x,children:y}=p,w=We.useRef(null),N=We.useRef(new Map).current;return r.jsx(o,{scope:x,itemMap:N,collectionRef:w,children:y})};i.displayName=t;const c=e+"CollectionSlot",u=fn(c),d=We.forwardRef((p,x)=>{const{scope:y,children:w}=p,N=a(c,y),j=de(x,N.collectionRef);return r.jsx(u,{ref:j,children:w})});d.displayName=c;const h=e+"CollectionItemSlot",f="data-radix-collection-item",m=fn(h),g=We.forwardRef((p,x)=>{const{scope:y,children:w,...N}=p,j=We.useRef(null),C=de(x,j),E=a(h,y);return We.useEffect(()=>(E.itemMap.set(j,{ref:j,...N}),()=>void E.itemMap.delete(j))),r.jsx(m,{[f]:"",ref:C,children:w})});g.displayName=h;function v(p){const x=a(e+"CollectionConsumer",p);return We.useCallback(()=>{const w=x.collectionRef.current;if(!w)return[];const N=Array.from(w.querySelectorAll(`[${f}]`));return Array.from(x.itemMap.values()).sort((E,S)=>N.indexOf(E.ref.current)-N.indexOf(S.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:d,ItemSlot:g},v,s]}var Dy=l.createContext(void 0);function Os(e){const t=l.useContext(Dy);return e||t||"ltr"}var lo="rovingFocusGroup.onEntryFocus",zy={bubbles:!1,cancelable:!0},Ir="RovingFocusGroup",[Vo,Id,Ly]=Ia(Ir),[Fy,Is]=lt(Ir,[Ly]),[$y,Uy]=Fy(Ir),Dd=l.forwardRef((e,t)=>r.jsx(Vo.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Vo.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Vy,{...e,ref:t})})}));Dd.displayName=Ir;var Vy=l.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:h=!1,...f}=e,m=l.useRef(null),g=de(t,m),v=Os(a),[p,x]=qt({prop:i,defaultProp:c??null,onChange:u,caller:Ir}),[y,w]=l.useState(!1),N=it(d),j=Id(n),C=l.useRef(!1),[E,S]=l.useState(0);return l.useEffect(()=>{const P=m.current;if(P)return P.addEventListener(lo,N),()=>P.removeEventListener(lo,N)},[N]),r.jsx($y,{scope:n,orientation:s,dir:v,loop:o,currentTabStopId:p,onItemFocus:l.useCallback(P=>x(P),[x]),onItemShiftTab:l.useCallback(()=>w(!0),[]),onFocusableItemAdd:l.useCallback(()=>S(P=>P+1),[]),onFocusableItemRemove:l.useCallback(()=>S(P=>P-1),[]),children:r.jsx(W.div,{tabIndex:y||E===0?-1:0,"data-orientation":s,...f,ref:g,style:{outline:"none",...e.style},onMouseDown:O(e.onMouseDown,()=>{C.current=!0}),onFocus:O(e.onFocus,P=>{const D=!C.current;if(P.target===P.currentTarget&&D&&!y){const I=new CustomEvent(lo,zy);if(P.currentTarget.dispatchEvent(I),!I.defaultPrevented){const $=j().filter(V=>V.focusable),_=$.find(V=>V.active),G=$.find(V=>V.id===p),X=[_,G,...$].filter(Boolean).map(V=>V.ref.current);Fd(X,h)}}C.current=!1}),onBlur:O(e.onBlur,()=>w(!1))})})}),zd="RovingFocusGroupItem",Ld=l.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:a,children:i,...c}=e,u=je(),d=a||u,h=Uy(zd,n),f=h.currentTabStopId===d,m=Id(n),{onFocusableItemAdd:g,onFocusableItemRemove:v,currentTabStopId:p}=h;return l.useEffect(()=>{if(s)return g(),()=>v()},[s,g,v]),r.jsx(Vo.ItemSlot,{scope:n,id:d,focusable:s,active:o,children:r.jsx(W.span,{tabIndex:f?0:-1,"data-orientation":h.orientation,...c,ref:t,onMouseDown:O(e.onMouseDown,x=>{s?h.onItemFocus(d):x.preventDefault()}),onFocus:O(e.onFocus,()=>h.onItemFocus(d)),onKeyDown:O(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){h.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const y=qy(x,h.orientation,h.dir);if(y!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let N=m().filter(j=>j.focusable).map(j=>j.ref.current);if(y==="last")N.reverse();else if(y==="prev"||y==="next"){y==="prev"&&N.reverse();const j=N.indexOf(x.currentTarget);N=h.loop?Hy(N,j+1):N.slice(j+1)}setTimeout(()=>Fd(N))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:p!=null}):i})})});Ld.displayName=zd;var By={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ky(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function qy(e,t,n){const s=Ky(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return By[s]}function Fd(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function Hy(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var $d=Dd,Ud=Ld,Bo=["Enter"," "],Wy=["ArrowDown","PageUp","Home"],Vd=["ArrowUp","PageDown","End"],Gy=[...Wy,...Vd],Qy={ltr:[...Bo,"ArrowRight"],rtl:[...Bo,"ArrowLeft"]},Yy={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Dr="Menu",[gr,Xy,Zy]=Ia(Dr),[wn,Bd]=lt(Dr,[Zy,nr,Is]),Ds=nr(),Kd=Is(),[Jy,jn]=wn(Dr),[eb,zr]=wn(Dr),qd=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:o,onOpenChange:a,modal:i=!0}=e,c=Ds(t),[u,d]=l.useState(null),h=l.useRef(!1),f=it(a),m=Os(o);return l.useEffect(()=>{const g=()=>{h.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>h.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),r.jsx(va,{...c,children:r.jsx(Jy,{scope:t,open:n,onOpenChange:f,content:u,onContentChange:d,children:r.jsx(eb,{scope:t,onClose:l.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:h,dir:m,modal:i,children:s})})})};qd.displayName=Dr;var tb="MenuAnchor",Da=l.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,o=Ds(n);return r.jsx(Ss,{...o,...s,ref:t})});Da.displayName=tb;var za="MenuPortal",[nb,Hd]=wn(za,{forceMount:void 0}),Wd=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:o}=e,a=jn(za,t);return r.jsx(nb,{scope:t,forceMount:n,children:r.jsx(Be,{present:n||a.open,children:r.jsx(Ar,{asChild:!0,container:o,children:s})})})};Wd.displayName=za;var Ve="MenuContent",[rb,La]=wn(Ve),Gd=l.forwardRef((e,t)=>{const n=Hd(Ve,e.__scopeMenu),{forceMount:s=n.forceMount,...o}=e,a=jn(Ve,e.__scopeMenu),i=zr(Ve,e.__scopeMenu);return r.jsx(gr.Provider,{scope:e.__scopeMenu,children:r.jsx(Be,{present:s||a.open,children:r.jsx(gr.Slot,{scope:e.__scopeMenu,children:i.modal?r.jsx(sb,{...o,ref:t}):r.jsx(ob,{...o,ref:t})})})})}),sb=l.forwardRef((e,t)=>{const n=jn(Ve,e.__scopeMenu),s=l.useRef(null),o=de(t,s);return l.useEffect(()=>{const a=s.current;if(a)return Es(a)},[]),r.jsx(Fa,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:O(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ob=l.forwardRef((e,t)=>{const n=jn(Ve,e.__scopeMenu);return r.jsx(Fa,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ab=fn("MenuContent.ScrollLock"),Fa=l.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:o,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:f,onInteractOutside:m,onDismiss:g,disableOutsideScroll:v,...p}=e,x=jn(Ve,n),y=zr(Ve,n),w=Ds(n),N=Kd(n),j=Xy(n),[C,E]=l.useState(null),S=l.useRef(null),P=de(t,S,x.onContentChange),D=l.useRef(0),I=l.useRef(""),$=l.useRef(0),_=l.useRef(null),G=l.useRef("right"),U=l.useRef(0),X=v?Mr:l.Fragment,V=v?{as:ab,allowPinchZoom:!0}:void 0,re=T=>{var A,Q;const ie=I.current+T,ce=j().filter(Y=>!Y.disabled),R=document.activeElement,K=(A=ce.find(Y=>Y.ref.current===R))==null?void 0:A.textValue,H=ce.map(Y=>Y.textValue),z=vb(H,ie,K),Z=(Q=ce.find(Y=>Y.textValue===z))==null?void 0:Q.ref.current;(function Y(ae){I.current=ae,window.clearTimeout(D.current),ae!==""&&(D.current=window.setTimeout(()=>Y(""),1e3))})(ie),Z&&setTimeout(()=>Z.focus())};l.useEffect(()=>()=>window.clearTimeout(D.current),[]),bs();const L=l.useCallback(T=>{var ce,R;return G.current===((ce=_.current)==null?void 0:ce.side)&&bb(T,(R=_.current)==null?void 0:R.area)},[]);return r.jsx(rb,{scope:n,searchRef:I,onItemEnter:l.useCallback(T=>{L(T)&&T.preventDefault()},[L]),onItemLeave:l.useCallback(T=>{var ie;L(T)||((ie=S.current)==null||ie.focus(),E(null))},[L]),onTriggerLeave:l.useCallback(T=>{L(T)&&T.preventDefault()},[L]),pointerGraceTimerRef:$,onPointerGraceIntentChange:l.useCallback(T=>{_.current=T},[]),children:r.jsx(X,{...V,children:r.jsx(kr,{asChild:!0,trapped:o,onMountAutoFocus:O(a,T=>{var ie;T.preventDefault(),(ie=S.current)==null||ie.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:r.jsx(Pr,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:f,onInteractOutside:m,onDismiss:g,children:r.jsx($d,{asChild:!0,...N,dir:y.dir,orientation:"vertical",loop:s,currentTabStopId:C,onCurrentTabStopIdChange:E,onEntryFocus:O(u,T=>{y.isUsingKeyboardRef.current||T.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(ya,{role:"menu","aria-orientation":"vertical","data-state":du(x.open),"data-radix-menu-content":"",dir:y.dir,...w,...p,ref:P,style:{outline:"none",...p.style},onKeyDown:O(p.onKeyDown,T=>{const ce=T.target.closest("[data-radix-menu-content]")===T.currentTarget,R=T.ctrlKey||T.altKey||T.metaKey,K=T.key.length===1;ce&&(T.key==="Tab"&&T.preventDefault(),!R&&K&&re(T.key));const H=S.current;if(T.target!==H||!Gy.includes(T.key))return;T.preventDefault();const Z=j().filter(A=>!A.disabled).map(A=>A.ref.current);Vd.includes(T.key)&&Z.reverse(),xb(Z)}),onBlur:O(e.onBlur,T=>{T.currentTarget.contains(T.target)||(window.clearTimeout(D.current),I.current="")}),onPointerMove:O(e.onPointerMove,vr(T=>{const ie=T.target,ce=U.current!==T.clientX;if(T.currentTarget.contains(ie)&&ce){const R=T.clientX>U.current?"right":"left";G.current=R,U.current=T.clientX}}))})})})})})})});Gd.displayName=Ve;var ib="MenuGroup",$a=l.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(W.div,{role:"group",...s,ref:t})});$a.displayName=ib;var cb="MenuLabel",Qd=l.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(W.div,{...s,ref:t})});Qd.displayName=cb;var ms="MenuItem",Vi="menu.itemSelect",zs=l.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...o}=e,a=l.useRef(null),i=zr(ms,e.__scopeMenu),c=La(ms,e.__scopeMenu),u=de(t,a),d=l.useRef(!1),h=()=>{const f=a.current;if(!n&&f){const m=new CustomEvent(Vi,{bubbles:!0,cancelable:!0});f.addEventListener(Vi,g=>s==null?void 0:s(g),{once:!0}),Qc(f,m),m.defaultPrevented?d.current=!1:i.onClose()}};return r.jsx(Yd,{...o,ref:u,disabled:n,onClick:O(e.onClick,h),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),d.current=!0},onPointerUp:O(e.onPointerUp,f=>{var m;d.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:O(e.onKeyDown,f=>{const m=c.searchRef.current!=="";n||m&&f.key===" "||Bo.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});zs.displayName=ms;var Yd=l.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:o,...a}=e,i=La(ms,n),c=Kd(n),u=l.useRef(null),d=de(t,u),[h,f]=l.useState(!1),[m,g]=l.useState("");return l.useEffect(()=>{const v=u.current;v&&g((v.textContent??"").trim())},[a.children]),r.jsx(gr.ItemSlot,{scope:n,disabled:s,textValue:o??m,children:r.jsx(Ud,{asChild:!0,...c,focusable:!s,children:r.jsx(W.div,{role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...a,ref:d,onPointerMove:O(e.onPointerMove,vr(v=>{s?i.onItemLeave(v):(i.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:O(e.onPointerLeave,vr(v=>i.onItemLeave(v))),onFocus:O(e.onFocus,()=>f(!0)),onBlur:O(e.onBlur,()=>f(!1))})})})}),lb="MenuCheckboxItem",Xd=l.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...o}=e;return r.jsx(nu,{scope:e.__scopeMenu,checked:n,children:r.jsx(zs,{role:"menuitemcheckbox","aria-checked":ps(n)?"mixed":n,...o,ref:t,"data-state":Va(n),onSelect:O(o.onSelect,()=>s==null?void 0:s(ps(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Xd.displayName=lb;var Zd="MenuRadioGroup",[db,ub]=wn(Zd,{value:void 0,onValueChange:()=>{}}),Jd=l.forwardRef((e,t)=>{const{value:n,onValueChange:s,...o}=e,a=it(s);return r.jsx(db,{scope:e.__scopeMenu,value:n,onValueChange:a,children:r.jsx($a,{...o,ref:t})})});Jd.displayName=Zd;var eu="MenuRadioItem",tu=l.forwardRef((e,t)=>{const{value:n,...s}=e,o=ub(eu,e.__scopeMenu),a=n===o.value;return r.jsx(nu,{scope:e.__scopeMenu,checked:a,children:r.jsx(zs,{role:"menuitemradio","aria-checked":a,...s,ref:t,"data-state":Va(a),onSelect:O(s.onSelect,()=>{var i;return(i=o.onValueChange)==null?void 0:i.call(o,n)},{checkForDefaultPrevented:!1})})})});tu.displayName=eu;var Ua="MenuItemIndicator",[nu,fb]=wn(Ua,{checked:!1}),ru=l.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...o}=e,a=fb(Ua,n);return r.jsx(Be,{present:s||ps(a.checked)||a.checked===!0,children:r.jsx(W.span,{...o,ref:t,"data-state":Va(a.checked)})})});ru.displayName=Ua;var hb="MenuSeparator",su=l.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(W.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});su.displayName=hb;var mb="MenuArrow",ou=l.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,o=Ds(n);return r.jsx(ba,{...o,...s,ref:t})});ou.displayName=mb;var pb="MenuSub",[kN,au]=wn(pb),ur="MenuSubTrigger",iu=l.forwardRef((e,t)=>{const n=jn(ur,e.__scopeMenu),s=zr(ur,e.__scopeMenu),o=au(ur,e.__scopeMenu),a=La(ur,e.__scopeMenu),i=l.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=a,d={__scopeMenu:e.__scopeMenu},h=l.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return l.useEffect(()=>h,[h]),l.useEffect(()=>{const f=c.current;return()=>{window.clearTimeout(f),u(null)}},[c,u]),r.jsx(Da,{asChild:!0,...d,children:r.jsx(Yd,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":du(n.open),...e,ref:at(t,o.onTriggerChange),onClick:f=>{var m;(m=e.onClick)==null||m.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:O(e.onPointerMove,vr(f=>{a.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(a.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),h()},100))})),onPointerLeave:O(e.onPointerLeave,vr(f=>{var g,v;h();const m=(g=n.content)==null?void 0:g.getBoundingClientRect();if(m){const p=(v=n.content)==null?void 0:v.dataset.side,x=p==="right",y=x?-5:5,w=m[x?"left":"right"],N=m[x?"right":"left"];a.onPointerGraceIntentChange({area:[{x:f.clientX+y,y:f.clientY},{x:w,y:m.top},{x:N,y:m.top},{x:N,y:m.bottom},{x:w,y:m.bottom}],side:p}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(f),f.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:O(e.onKeyDown,f=>{var g;const m=a.searchRef.current!=="";e.disabled||m&&f.key===" "||Qy[s.dir].includes(f.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),f.preventDefault())})})})});iu.displayName=ur;var cu="MenuSubContent",lu=l.forwardRef((e,t)=>{const n=Hd(Ve,e.__scopeMenu),{forceMount:s=n.forceMount,...o}=e,a=jn(Ve,e.__scopeMenu),i=zr(Ve,e.__scopeMenu),c=au(cu,e.__scopeMenu),u=l.useRef(null),d=de(t,u);return r.jsx(gr.Provider,{scope:e.__scopeMenu,children:r.jsx(Be,{present:s||a.open,children:r.jsx(gr.Slot,{scope:e.__scopeMenu,children:r.jsx(Fa,{id:c.contentId,"aria-labelledby":c.triggerId,...o,ref:d,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{var f;i.isUsingKeyboardRef.current&&((f=u.current)==null||f.focus()),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:O(e.onFocusOutside,h=>{h.target!==c.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:O(e.onEscapeKeyDown,h=>{i.onClose(),h.preventDefault()}),onKeyDown:O(e.onKeyDown,h=>{var g;const f=h.currentTarget.contains(h.target),m=Yy[i.dir].includes(h.key);f&&m&&(a.onOpenChange(!1),(g=c.trigger)==null||g.focus(),h.preventDefault())})})})})})});lu.displayName=cu;function du(e){return e?"open":"closed"}function ps(e){return e==="indeterminate"}function Va(e){return ps(e)?"indeterminate":e?"checked":"unchecked"}function xb(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function gb(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function vb(e,t,n){const o=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let i=gb(e,Math.max(a,0));o.length===1&&(i=i.filter(d=>d!==n));const u=i.find(d=>d.toLowerCase().startsWith(o.toLowerCase()));return u!==n?u:void 0}function yb(e,t){const{x:n,y:s}=e;let o=!1;for(let a=0,i=t.length-1;a<t.length;i=a++){const c=t[a],u=t[i],d=c.x,h=c.y,f=u.x,m=u.y;h>s!=m>s&&n<(f-d)*(s-h)/(m-h)+d&&(o=!o)}return o}function bb(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return yb(n,t)}function vr(e){return t=>t.pointerType==="mouse"?e(t):void 0}var wb=qd,jb=Da,Nb=Wd,Cb=Gd,Sb=$a,Eb=Qd,Rb=zs,Pb=Xd,kb=Jd,Tb=tu,Ab=ru,Mb=su,_b=ou,Ob=iu,Ib=lu,Ls="DropdownMenu",[Db]=lt(Ls,[Bd]),ke=Bd(),[zb,uu]=Db(Ls),fu=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:o,defaultOpen:a,onOpenChange:i,modal:c=!0}=e,u=ke(t),d=l.useRef(null),[h,f]=qt({prop:o,defaultProp:a??!1,onChange:i,caller:Ls});return r.jsx(zb,{scope:t,triggerId:je(),triggerRef:d,contentId:je(),open:h,onOpenChange:f,onOpenToggle:l.useCallback(()=>f(m=>!m),[f]),modal:c,children:r.jsx(wb,{...u,open:h,onOpenChange:f,dir:s,modal:c,children:n})})};fu.displayName=Ls;var hu="DropdownMenuTrigger",mu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...o}=e,a=uu(hu,n),i=ke(n);return r.jsx(jb,{asChild:!0,...i,children:r.jsx(W.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...o,ref:at(t,a.triggerRef),onPointerDown:O(e.onPointerDown,c=>{!s&&c.button===0&&c.ctrlKey===!1&&(a.onOpenToggle(),a.open||c.preventDefault())}),onKeyDown:O(e.onKeyDown,c=>{s||(["Enter"," "].includes(c.key)&&a.onOpenToggle(),c.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});mu.displayName=hu;var Lb="DropdownMenuPortal",pu=e=>{const{__scopeDropdownMenu:t,...n}=e,s=ke(t);return r.jsx(Nb,{...s,...n})};pu.displayName=Lb;var xu="DropdownMenuContent",gu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=uu(xu,n),a=ke(n),i=l.useRef(!1);return r.jsx(Cb,{id:o.contentId,"aria-labelledby":o.triggerId,...a,...s,ref:t,onCloseAutoFocus:O(e.onCloseAutoFocus,c=>{var u;i.current||(u=o.triggerRef.current)==null||u.focus(),i.current=!1,c.preventDefault()}),onInteractOutside:O(e.onInteractOutside,c=>{const u=c.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,h=u.button===2||d;(!o.modal||h)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});gu.displayName=xu;var Fb="DropdownMenuGroup",$b=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=ke(n);return r.jsx(Sb,{...o,...s,ref:t})});$b.displayName=Fb;var Ub="DropdownMenuLabel",vu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=ke(n);return r.jsx(Eb,{...o,...s,ref:t})});vu.displayName=Ub;var Vb="DropdownMenuItem",yu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=ke(n);return r.jsx(Rb,{...o,...s,ref:t})});yu.displayName=Vb;var Bb="DropdownMenuCheckboxItem",bu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=ke(n);return r.jsx(Pb,{...o,...s,ref:t})});bu.displayName=Bb;var Kb="DropdownMenuRadioGroup",qb=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=ke(n);return r.jsx(kb,{...o,...s,ref:t})});qb.displayName=Kb;var Hb="DropdownMenuRadioItem",wu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=ke(n);return r.jsx(Tb,{...o,...s,ref:t})});wu.displayName=Hb;var Wb="DropdownMenuItemIndicator",ju=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=ke(n);return r.jsx(Ab,{...o,...s,ref:t})});ju.displayName=Wb;var Gb="DropdownMenuSeparator",Nu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=ke(n);return r.jsx(Mb,{...o,...s,ref:t})});Nu.displayName=Gb;var Qb="DropdownMenuArrow",Yb=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=ke(n);return r.jsx(_b,{...o,...s,ref:t})});Yb.displayName=Qb;var Xb="DropdownMenuSubTrigger",Cu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=ke(n);return r.jsx(Ob,{...o,...s,ref:t})});Cu.displayName=Xb;var Zb="DropdownMenuSubContent",Su=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=ke(n);return r.jsx(Ib,{...o,...s,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Su.displayName=Zb;var Jb=fu,ew=mu,tw=pu,Eu=gu,Ru=vu,Pu=yu,ku=bu,Tu=wu,Au=ju,Mu=Nu,_u=Cu,Ou=Su;const Ba=Jb,Ka=ew,nw=l.forwardRef(({className:e,inset:t,children:n,...s},o)=>r.jsxs(_u,{ref:o,className:k("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-zinc-100 data-[state=open]:bg-zinc-100 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...s,children:[n,r.jsx(Mc,{className:"ml-auto"})]}));nw.displayName=_u.displayName;const rw=l.forwardRef(({className:e,...t},n)=>r.jsx(Ou,{ref:n,className:k("z-50 min-w-[8rem] overflow-hidden rounded-md border border-zinc-200 bg-white p-1 text-zinc-900 shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));rw.displayName=Ou.displayName;const Fs=l.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(tw,{children:r.jsx(Eu,{ref:s,sideOffset:t,className:k("z-50 min-w-[8rem] overflow-hidden rounded-md border border-zinc-200 bg-white p-1 text-zinc-900 shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Fs.displayName=Eu.displayName;const vt=l.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(Pu,{ref:s,className:k("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","focus:bg-zinc-100 focus:text-zinc-900","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...n}));vt.displayName=Pu.displayName;const sw=l.forwardRef(({className:e,children:t,checked:n=!1,...s},o)=>r.jsxs(ku,{ref:o,className:k("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-zinc-100 focus:text-zinc-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...s,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(Au,{children:r.jsx(Xn,{className:"h-4 w-4"})})}),t]}));sw.displayName=ku.displayName;const ow=l.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(Tu,{ref:s,className:k("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-zinc-100 focus:text-zinc-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(Au,{children:r.jsx(np,{className:"h-2 w-2 fill-current"})})}),t]}));ow.displayName=Tu.displayName;const aw=l.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(Ru,{ref:s,className:k("px-2 py-1.5 text-xs font-semibold text-zinc-500 uppercase tracking-wider",t&&"pl-8",e),...n}));aw.displayName=Ru.displayName;const $s=l.forwardRef(({className:e,...t},n)=>r.jsx(Mu,{ref:n,className:k("-mx-1 my-1 h-px bg-zinc-100",e),...t}));$s.displayName=Mu.displayName;const iw=[{label:"All",value:"all"},{label:"Pending",value:"pending"},{label:"Confirmed",value:"confirmed"},{label:"Processing",value:"processing"},{label:"Shipped",value:"shipped"},{label:"Delivered",value:"delivered"},{label:"Cancelled",value:"cancelled"},{label:"Refunded",value:"refunded"},{label:"Partially refunded",value:"partially_refunded"}],cw={unpaid:"Unpaid",paid:"Paid",partially_refunded:"Partially refunded",refunded:"Refunded"};function lw(){const e=jt(),[t,n]=l.useState("all"),[s,o]=l.useState(""),[a,i]=l.useState(new Set),{data:c,isLoading:u}=$c({status:t==="all"?void 0:t,q:s||void 0,sort:"createdAt:desc",limit:100}),d=m=>{i(g=>{const v=new Set(g);return v.has(m)?v.delete(m):v.add(m),v})},h=()=>{c&&(a.size===c.length?i(new Set):i(new Set(c.map(m=>m.id))))},f=c?a.size===c.length&&c.length>0:!1;return r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-lg font-semibold text-zinc-900",children:"Orders"}),r.jsx("p",{className:"text-sm text-zinc-500",children:c?`${c.length} orders`:"Loading..."})]})}),r.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[r.jsx("div",{className:"flex flex-wrap gap-1.5",children:iw.map(m=>r.jsx("button",{onClick:()=>n(m.value),className:k("rounded-full px-3 py-1 text-xs font-medium transition-colors",t===m.value?"bg-zinc-900 text-white":"bg-zinc-100 text-zinc-600 hover:bg-zinc-200"),children:m.label},m.value))}),r.jsxs("div",{className:"flex flex-1 items-center gap-2 sm:justify-end",children:[r.jsxs("div",{className:"relative flex-1 sm:max-w-xs",children:[r.jsx(Zn,{className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-zinc-400"}),r.jsx(xe,{placeholder:"Search orders...",value:s,onChange:m=>o(m.target.value),className:"pl-9 h-8 text-sm"})]}),r.jsxs(le,{variant:"outline",size:"sm",className:"gap-1.5",children:[r.jsx(ip,{className:"h-3.5 w-3.5"}),"Filter"]})]})]}),a.size>0&&r.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-blue-200 bg-blue-50 px-4 py-2.5",children:[r.jsxs("span",{className:"text-sm font-medium text-blue-700",children:[a.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[r.jsxs(le,{size:"sm",variant:"outline",className:"h-7 gap-1.5 text-xs border-blue-200 text-blue-700 hover:bg-blue-100",children:[r.jsx(Zm,{className:"h-3.5 w-3.5"}),"Confirm All"]}),r.jsxs(le,{size:"sm",variant:"outline",className:"h-7 gap-1.5 text-xs border-red-200 text-red-600 hover:bg-red-50",children:[r.jsx(Dc,{className:"h-3.5 w-3.5"}),"Cancel All"]})]})]}),r.jsx("div",{className:"rounded-lg border border-zinc-200 bg-white overflow-hidden",children:u?r.jsx("div",{className:"p-4 space-y-2",children:Array.from({length:8}).map((m,g)=>r.jsx(ge,{className:"h-11 w-full"},g))}):c!=null&&c.length?r.jsxs(vn,{children:[r.jsx(yn,{children:r.jsxs(Fe,{children:[r.jsx(te,{className:"w-10 pl-4",children:r.jsx(Uo,{checked:f,onCheckedChange:h,"aria-label":"Select all"})}),r.jsx(te,{children:"Order #"}),r.jsx(te,{children:"Customer"}),r.jsx(te,{children:"Status"}),r.jsx(te,{children:"Payment"}),r.jsx(te,{className:"text-center",children:"Items"}),r.jsx(te,{className:"text-right",children:"Total"}),r.jsx(te,{className:"text-right",children:"Date"}),r.jsx(te,{className:"w-10",children:r.jsx("span",{className:"sr-only",children:"Actions"})})]})}),r.jsx(bn,{children:c.map(m=>r.jsxs(Fe,{"data-testid":B("orders","row",m.orderNumber),"data-state":a.has(m.id)?"selected":void 0,className:k("cursor-pointer",a.has(m.id)&&"bg-blue-50/50"),children:[r.jsx(ne,{className:"pl-4",onClick:g=>g.stopPropagation(),children:r.jsx(Uo,{checked:a.has(m.id),onCheckedChange:()=>d(m.id),"aria-label":`Select order ${m.orderNumber}`})}),r.jsxs(ne,{className:"font-mono text-sm font-medium text-blue-600 cursor-pointer",onClick:()=>e(`/orders/${m.orderNumber}`),children:["#",m.orderNumber]}),r.jsx(ne,{className:"text-zinc-600 cursor-pointer",onClick:()=>e(`/orders/${m.orderNumber}`),children:r.jsx("div",{className:"truncate max-w-[180px]",children:m.email})}),r.jsx(ne,{onClick:()=>e(`/orders/${m.orderNumber}`),children:r.jsx(Wn,{status:m.status})}),r.jsx(ne,{className:"text-sm text-zinc-600",onClick:()=>e(`/orders/${m.orderNumber}`),"data-testid":B("orders","payment",m.orderNumber),children:cw[Fh(m)]}),r.jsx(ne,{className:"text-center text-zinc-500",onClick:()=>e(`/orders/${m.orderNumber}`),children:m.lineItems.length}),r.jsx(ne,{className:"text-right font-mono text-sm",onClick:()=>e(`/orders/${m.orderNumber}`),children:pe(m.totalMinor,m.currency)}),r.jsx(ne,{className:"text-right text-sm text-zinc-400",onClick:()=>e(`/orders/${m.orderNumber}`),children:ut(m.createdAt)}),r.jsx(ne,{onClick:g=>g.stopPropagation(),children:r.jsxs(Ba,{children:[r.jsx(Ka,{asChild:!0,children:r.jsx(le,{variant:"ghost",size:"icon","aria-label":`Actions for order ${m.orderNumber}`,className:"h-8 w-8 text-zinc-400",children:r.jsx(_c,{className:"h-4 w-4"})})}),r.jsxs(Fs,{align:"end",children:[r.jsx(vt,{onClick:()=>e(`/orders/${m.orderNumber}`),children:"View details"}),r.jsx($s,{}),r.jsx(vt,{className:"text-red-600",children:"Cancel order"})]})]})})]},m.id))})]}):r.jsx(ct,{icon:r.jsx(Vt,{className:"h-5 w-5"}),title:"No orders found",description:s||t!=="all"?"Try adjusting your filters.":"Orders will appear here as they come in."})})]})}const dw={breadcrumb:()=>"Orders"};var Us="Tabs",[uw]=lt(Us,[Is]),Iu=Is(),[fw,qa]=uw(Us),Du=l.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:o,defaultValue:a,orientation:i="horizontal",dir:c,activationMode:u="automatic",...d}=e,h=Os(c),[f,m]=qt({prop:s,onChange:o,defaultProp:a??"",caller:Us});return r.jsx(fw,{scope:n,baseId:je(),value:f,onValueChange:m,orientation:i,dir:h,activationMode:u,children:r.jsx(W.div,{dir:h,"data-orientation":i,...d,ref:t})})});Du.displayName=Us;var zu="TabsList",Lu=l.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...o}=e,a=qa(zu,n),i=Iu(n);return r.jsx($d,{asChild:!0,...i,orientation:a.orientation,dir:a.dir,loop:s,children:r.jsx(W.div,{role:"tablist","aria-orientation":a.orientation,...o,ref:t})})});Lu.displayName=zu;var Fu="TabsTrigger",$u=l.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:o=!1,...a}=e,i=qa(Fu,n),c=Iu(n),u=Bu(i.baseId,s),d=Ku(i.baseId,s),h=s===i.value;return r.jsx(Ud,{asChild:!0,...c,focusable:!o,active:h,children:r.jsx(W.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":d,"data-state":h?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...a,ref:t,onMouseDown:O(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?i.onValueChange(s):f.preventDefault()}),onKeyDown:O(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(s)}),onFocus:O(e.onFocus,()=>{const f=i.activationMode!=="manual";!h&&!o&&f&&i.onValueChange(s)})})})});$u.displayName=Fu;var Uu="TabsContent",Vu=l.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:o,children:a,...i}=e,c=qa(Uu,n),u=Bu(c.baseId,s),d=Ku(c.baseId,s),h=s===c.value,f=l.useRef(h);return l.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),r.jsx(Be,{present:o||h,children:({present:m})=>r.jsx(W.div,{"data-state":h?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!m,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&a})})});Vu.displayName=Uu;function Bu(e,t){return`${e}-trigger-${t}`}function Ku(e,t){return`${e}-content-${t}`}var hw=Du,qu=Lu,Hu=$u,Wu=Vu;const Ha=hw,Vs=l.forwardRef(({className:e,...t},n)=>r.jsx(qu,{ref:n,className:k("inline-flex h-9 items-center justify-center rounded-lg bg-zinc-100 p-1 text-zinc-500",e),...t}));Vs.displayName=qu.displayName;const Ge=l.forwardRef(({className:e,...t},n)=>r.jsx(Hu,{ref:n,className:k("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-white transition-all","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50","data-[state=active]:bg-white data-[state=active]:text-zinc-900 data-[state=active]:shadow-sm",e),...t}));Ge.displayName=Hu.displayName;const Qe=l.forwardRef(({className:e,...t},n)=>r.jsx(Wu,{ref:n,className:k("mt-2 ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",e),...t}));Qe.displayName=Wu.displayName;function Bi(e,[t,n]){return Math.min(n,Math.max(t,e))}var Gu=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),mw="VisuallyHidden",pw=l.forwardRef((e,t)=>r.jsx(W.span,{...e,ref:t,style:{...Gu,...e.style}}));pw.displayName=mw;var xw=[" ","Enter","ArrowUp","ArrowDown"],gw=[" ","Enter"],xn="Select",[Bs,Ks,vw]=Ia(xn),[rr]=lt(xn,[vw,nr]),qs=nr(),[yw,Gt]=rr(xn),[bw,ww]=rr(xn),Qu=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:o,onOpenChange:a,value:i,defaultValue:c,onValueChange:u,dir:d,name:h,autoComplete:f,disabled:m,required:g,form:v}=e,p=qs(t),[x,y]=l.useState(null),[w,N]=l.useState(null),[j,C]=l.useState(!1),E=Os(d),[S,P]=qt({prop:s,defaultProp:o??!1,onChange:a,caller:xn}),[D,I]=qt({prop:i,defaultProp:c,onChange:u,caller:xn}),$=l.useRef(null),_=x?v||!!x.closest("form"):!0,[G,U]=l.useState(new Set),X=Array.from(G).map(V=>V.props.value).join(";");return r.jsx(va,{...p,children:r.jsxs(yw,{required:g,scope:t,trigger:x,onTriggerChange:y,valueNode:w,onValueNodeChange:N,valueNodeHasChildren:j,onValueNodeHasChildrenChange:C,contentId:je(),value:D,onValueChange:I,open:S,onOpenChange:P,dir:E,triggerPointerDownPosRef:$,disabled:m,children:[r.jsx(Bs.Provider,{scope:t,children:r.jsx(bw,{scope:e.__scopeSelect,onNativeOptionAdd:l.useCallback(V=>{U(re=>new Set(re).add(V))},[]),onNativeOptionRemove:l.useCallback(V=>{U(re=>{const L=new Set(re);return L.delete(V),L})},[]),children:n})}),_?r.jsxs(bf,{"aria-hidden":!0,required:g,tabIndex:-1,name:h,autoComplete:f,value:D,onChange:V=>I(V.target.value),disabled:m,form:v,children:[D===void 0?r.jsx("option",{value:""}):null,Array.from(G)]},X):null]})})};Qu.displayName=xn;var Yu="SelectTrigger",Xu=l.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...o}=e,a=qs(n),i=Gt(Yu,n),c=i.disabled||s,u=de(t,i.onTriggerChange),d=Ks(n),h=l.useRef("touch"),[f,m,g]=jf(p=>{const x=d().filter(N=>!N.disabled),y=x.find(N=>N.value===i.value),w=Nf(x,p,y);w!==void 0&&i.onValueChange(w.value)}),v=p=>{c||(i.onOpenChange(!0),g()),p&&(i.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return r.jsx(Ss,{asChild:!0,...a,children:r.jsx(W.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":wf(i.value)?"":void 0,...o,ref:u,onClick:O(o.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&v(p)}),onPointerDown:O(o.onPointerDown,p=>{h.current=p.pointerType;const x=p.target;x.hasPointerCapture(p.pointerId)&&x.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(v(p),p.preventDefault())}),onKeyDown:O(o.onKeyDown,p=>{const x=f.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&m(p.key),!(x&&p.key===" ")&&xw.includes(p.key)&&(v(),p.preventDefault())})})})});Xu.displayName=Yu;var Zu="SelectValue",Ju=l.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:o,children:a,placeholder:i="",...c}=e,u=Gt(Zu,n),{onValueNodeHasChildrenChange:d}=u,h=a!==void 0,f=de(t,u.onValueNodeChange);return Se(()=>{d(h)},[d,h]),r.jsx(W.span,{...c,ref:f,style:{pointerEvents:"none"},children:wf(u.value)?r.jsx(r.Fragment,{children:i}):a})});Ju.displayName=Zu;var jw="SelectIcon",ef=l.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...o}=e;return r.jsx(W.span,{"aria-hidden":!0,...o,ref:t,children:s||"▼"})});ef.displayName=jw;var Nw="SelectPortal",tf=e=>r.jsx(Ar,{asChild:!0,...e});tf.displayName=Nw;var gn="SelectContent",nf=l.forwardRef((e,t)=>{const n=Gt(gn,e.__scopeSelect),[s,o]=l.useState();if(Se(()=>{o(new DocumentFragment)},[]),!n.open){const a=s;return a?Er.createPortal(r.jsx(rf,{scope:e.__scopeSelect,children:r.jsx(Bs.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),a):null}return r.jsx(sf,{...e,ref:t})});nf.displayName=gn;var qe=10,[rf,Qt]=rr(gn),Cw="SelectContentImpl",Sw=fn("SelectContent.RemoveScroll"),sf=l.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:a,onPointerDownOutside:i,side:c,sideOffset:u,align:d,alignOffset:h,arrowPadding:f,collisionBoundary:m,collisionPadding:g,sticky:v,hideWhenDetached:p,avoidCollisions:x,...y}=e,w=Gt(gn,n),[N,j]=l.useState(null),[C,E]=l.useState(null),S=de(t,A=>j(A)),[P,D]=l.useState(null),[I,$]=l.useState(null),_=Ks(n),[G,U]=l.useState(!1),X=l.useRef(!1);l.useEffect(()=>{if(N)return Es(N)},[N]),bs();const V=l.useCallback(A=>{const[Q,...Y]=_().map(he=>he.ref.current),[ae]=Y.slice(-1),fe=document.activeElement;for(const he of A)if(he===fe||(he==null||he.scrollIntoView({block:"nearest"}),he===Q&&C&&(C.scrollTop=0),he===ae&&C&&(C.scrollTop=C.scrollHeight),he==null||he.focus(),document.activeElement!==fe))return},[_,C]),re=l.useCallback(()=>V([P,N]),[V,P,N]);l.useEffect(()=>{G&&re()},[G,re]);const{onOpenChange:L,triggerPointerDownPosRef:T}=w;l.useEffect(()=>{if(N){let A={x:0,y:0};const Q=ae=>{var fe,he;A={x:Math.abs(Math.round(ae.pageX)-(((fe=T.current)==null?void 0:fe.x)??0)),y:Math.abs(Math.round(ae.pageY)-(((he=T.current)==null?void 0:he.y)??0))}},Y=ae=>{A.x<=10&&A.y<=10?ae.preventDefault():N.contains(ae.target)||L(!1),document.removeEventListener("pointermove",Q),T.current=null};return T.current!==null&&(document.addEventListener("pointermove",Q),document.addEventListener("pointerup",Y,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Q),document.removeEventListener("pointerup",Y,{capture:!0})}}},[N,L,T]),l.useEffect(()=>{const A=()=>L(!1);return window.addEventListener("blur",A),window.addEventListener("resize",A),()=>{window.removeEventListener("blur",A),window.removeEventListener("resize",A)}},[L]);const[ie,ce]=jf(A=>{const Q=_().filter(fe=>!fe.disabled),Y=Q.find(fe=>fe.ref.current===document.activeElement),ae=Nf(Q,A,Y);ae&&setTimeout(()=>ae.ref.current.focus())}),R=l.useCallback((A,Q,Y)=>{const ae=!X.current&&!Y;(w.value!==void 0&&w.value===Q||ae)&&(D(A),ae&&(X.current=!0))},[w.value]),K=l.useCallback(()=>N==null?void 0:N.focus(),[N]),H=l.useCallback((A,Q,Y)=>{const ae=!X.current&&!Y;(w.value!==void 0&&w.value===Q||ae)&&$(A)},[w.value]),z=s==="popper"?Ko:of,Z=z===Ko?{side:c,sideOffset:u,align:d,alignOffset:h,arrowPadding:f,collisionBoundary:m,collisionPadding:g,sticky:v,hideWhenDetached:p,avoidCollisions:x}:{};return r.jsx(rf,{scope:n,content:N,viewport:C,onViewportChange:E,itemRefCallback:R,selectedItem:P,onItemLeave:K,itemTextRefCallback:H,focusSelectedItem:re,selectedItemText:I,position:s,isPositioned:G,searchRef:ie,children:r.jsx(Mr,{as:Sw,allowPinchZoom:!0,children:r.jsx(kr,{asChild:!0,trapped:w.open,onMountAutoFocus:A=>{A.preventDefault()},onUnmountAutoFocus:O(o,A=>{var Q;(Q=w.trigger)==null||Q.focus({preventScroll:!0}),A.preventDefault()}),children:r.jsx(Pr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:A=>A.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:r.jsx(z,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:A=>A.preventDefault(),...y,...Z,onPlaced:()=>U(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:O(y.onKeyDown,A=>{const Q=A.ctrlKey||A.altKey||A.metaKey;if(A.key==="Tab"&&A.preventDefault(),!Q&&A.key.length===1&&ce(A.key),["ArrowUp","ArrowDown","Home","End"].includes(A.key)){let ae=_().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);if(["ArrowUp","End"].includes(A.key)&&(ae=ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(A.key)){const fe=A.target,he=ae.indexOf(fe);ae=ae.slice(he+1)}setTimeout(()=>V(ae)),A.preventDefault()}})})})})})})});sf.displayName=Cw;var Ew="SelectItemAlignedPosition",of=l.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...o}=e,a=Gt(gn,n),i=Qt(gn,n),[c,u]=l.useState(null),[d,h]=l.useState(null),f=de(t,S=>h(S)),m=Ks(n),g=l.useRef(!1),v=l.useRef(!0),{viewport:p,selectedItem:x,selectedItemText:y,focusSelectedItem:w}=i,N=l.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&d&&p&&x&&y){const S=a.trigger.getBoundingClientRect(),P=d.getBoundingClientRect(),D=a.valueNode.getBoundingClientRect(),I=y.getBoundingClientRect();if(a.dir!=="rtl"){const fe=I.left-P.left,he=D.left-fe,_e=S.left-he,Je=S.width+_e,sr=Math.max(Je,P.width),or=window.innerWidth-qe,ar=Bi(he,[qe,Math.max(qe,or-sr)]);c.style.minWidth=Je+"px",c.style.left=ar+"px"}else{const fe=P.right-I.right,he=window.innerWidth-D.right-fe,_e=window.innerWidth-S.right-he,Je=S.width+_e,sr=Math.max(Je,P.width),or=window.innerWidth-qe,ar=Bi(he,[qe,Math.max(qe,or-sr)]);c.style.minWidth=Je+"px",c.style.right=ar+"px"}const $=m(),_=window.innerHeight-qe*2,G=p.scrollHeight,U=window.getComputedStyle(d),X=parseInt(U.borderTopWidth,10),V=parseInt(U.paddingTop,10),re=parseInt(U.borderBottomWidth,10),L=parseInt(U.paddingBottom,10),T=X+V+G+L+re,ie=Math.min(x.offsetHeight*5,T),ce=window.getComputedStyle(p),R=parseInt(ce.paddingTop,10),K=parseInt(ce.paddingBottom,10),H=S.top+S.height/2-qe,z=_-H,Z=x.offsetHeight/2,A=x.offsetTop+Z,Q=X+V+A,Y=T-Q;if(Q<=H){const fe=$.length>0&&x===$[$.length-1].ref.current;c.style.bottom="0px";const he=d.clientHeight-p.offsetTop-p.offsetHeight,_e=Math.max(z,Z+(fe?K:0)+he+re),Je=Q+_e;c.style.height=Je+"px"}else{const fe=$.length>0&&x===$[0].ref.current;c.style.top="0px";const _e=Math.max(H,X+p.offsetTop+(fe?R:0)+Z)+Y;c.style.height=_e+"px",p.scrollTop=Q-H+p.offsetTop}c.style.margin=`${qe}px 0`,c.style.minHeight=ie+"px",c.style.maxHeight=_+"px",s==null||s(),requestAnimationFrame(()=>g.current=!0)}},[m,a.trigger,a.valueNode,c,d,p,x,y,a.dir,s]);Se(()=>N(),[N]);const[j,C]=l.useState();Se(()=>{d&&C(window.getComputedStyle(d).zIndex)},[d]);const E=l.useCallback(S=>{S&&v.current===!0&&(N(),w==null||w(),v.current=!1)},[N,w]);return r.jsx(Pw,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:g,onScrollButtonChange:E,children:r.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:r.jsx(W.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});of.displayName=Ew;var Rw="SelectPopperPosition",Ko=l.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:o=qe,...a}=e,i=qs(n);return r.jsx(ya,{...i,...a,ref:t,align:s,collisionPadding:o,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Ko.displayName=Rw;var[Pw,Wa]=rr(gn,{}),qo="SelectViewport",af=l.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...o}=e,a=Qt(qo,n),i=Wa(qo,n),c=de(t,a.onViewportChange),u=l.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),r.jsx(Bs.Slot,{scope:n,children:r.jsx(W.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:O(o.onScroll,d=>{const h=d.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&f){const g=Math.abs(u.current-h.scrollTop);if(g>0){const v=window.innerHeight-qe*2,p=parseFloat(f.style.minHeight),x=parseFloat(f.style.height),y=Math.max(p,x);if(y<v){const w=y+g,N=Math.min(v,w),j=w-N;f.style.height=N+"px",f.style.bottom==="0px"&&(h.scrollTop=j>0?j:0,f.style.justifyContent="flex-end")}}}u.current=h.scrollTop})})})]})});af.displayName=qo;var cf="SelectGroup",[kw,Tw]=rr(cf),Aw=l.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=je();return r.jsx(kw,{scope:n,id:o,children:r.jsx(W.div,{role:"group","aria-labelledby":o,...s,ref:t})})});Aw.displayName=cf;var lf="SelectLabel",df=l.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=Tw(lf,n);return r.jsx(W.div,{id:o.id,...s,ref:t})});df.displayName=lf;var xs="SelectItem",[Mw,uf]=rr(xs),ff=l.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:o=!1,textValue:a,...i}=e,c=Gt(xs,n),u=Qt(xs,n),d=c.value===s,[h,f]=l.useState(a??""),[m,g]=l.useState(!1),v=de(t,w=>{var N;return(N=u.itemRefCallback)==null?void 0:N.call(u,w,s,o)}),p=je(),x=l.useRef("touch"),y=()=>{o||(c.onValueChange(s),c.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(Mw,{scope:n,value:s,disabled:o,textId:p,isSelected:d,onItemTextChange:l.useCallback(w=>{f(N=>N||((w==null?void 0:w.textContent)??"").trim())},[]),children:r.jsx(Bs.ItemSlot,{scope:n,value:s,disabled:o,textValue:h,children:r.jsx(W.div,{role:"option","aria-labelledby":p,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:v,onFocus:O(i.onFocus,()=>g(!0)),onBlur:O(i.onBlur,()=>g(!1)),onClick:O(i.onClick,()=>{x.current!=="mouse"&&y()}),onPointerUp:O(i.onPointerUp,()=>{x.current==="mouse"&&y()}),onPointerDown:O(i.onPointerDown,w=>{x.current=w.pointerType}),onPointerMove:O(i.onPointerMove,w=>{var N;x.current=w.pointerType,o?(N=u.onItemLeave)==null||N.call(u):x.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:O(i.onPointerLeave,w=>{var N;w.currentTarget===document.activeElement&&((N=u.onItemLeave)==null||N.call(u))}),onKeyDown:O(i.onKeyDown,w=>{var j;((j=u.searchRef)==null?void 0:j.current)!==""&&w.key===" "||(gw.includes(w.key)&&y(),w.key===" "&&w.preventDefault())})})})})});ff.displayName=xs;var fr="SelectItemText",hf=l.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:o,...a}=e,i=Gt(fr,n),c=Qt(fr,n),u=uf(fr,n),d=ww(fr,n),[h,f]=l.useState(null),m=de(t,y=>f(y),u.onItemTextChange,y=>{var w;return(w=c.itemTextRefCallback)==null?void 0:w.call(c,y,u.value,u.disabled)}),g=h==null?void 0:h.textContent,v=l.useMemo(()=>r.jsx("option",{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:p,onNativeOptionRemove:x}=d;return Se(()=>(p(v),()=>x(v)),[p,x,v]),r.jsxs(r.Fragment,{children:[r.jsx(W.span,{id:u.textId,...a,ref:m}),u.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Er.createPortal(a.children,i.valueNode):null]})});hf.displayName=fr;var mf="SelectItemIndicator",pf=l.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return uf(mf,n).isSelected?r.jsx(W.span,{"aria-hidden":!0,...s,ref:t}):null});pf.displayName=mf;var Ho="SelectScrollUpButton",xf=l.forwardRef((e,t)=>{const n=Qt(Ho,e.__scopeSelect),s=Wa(Ho,e.__scopeSelect),[o,a]=l.useState(!1),i=de(t,s.onScrollButtonChange);return Se(()=>{if(n.viewport&&n.isPositioned){let c=function(){const d=u.scrollTop>0;a(d)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),o?r.jsx(vf,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});xf.displayName=Ho;var Wo="SelectScrollDownButton",gf=l.forwardRef((e,t)=>{const n=Qt(Wo,e.__scopeSelect),s=Wa(Wo,e.__scopeSelect),[o,a]=l.useState(!1),i=de(t,s.onScrollButtonChange);return Se(()=>{if(n.viewport&&n.isPositioned){let c=function(){const d=u.scrollHeight-u.clientHeight,h=Math.ceil(u.scrollTop)<d;a(h)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),o?r.jsx(vf,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});gf.displayName=Wo;var vf=l.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...o}=e,a=Qt("SelectScrollButton",n),i=l.useRef(null),c=Ks(n),u=l.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return l.useEffect(()=>()=>u(),[u]),Se(()=>{var h;const d=c().find(f=>f.ref.current===document.activeElement);(h=d==null?void 0:d.ref.current)==null||h.scrollIntoView({block:"nearest"})},[c]),r.jsx(W.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:O(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(s,50))}),onPointerMove:O(o.onPointerMove,()=>{var d;(d=a.onItemLeave)==null||d.call(a),i.current===null&&(i.current=window.setInterval(s,50))}),onPointerLeave:O(o.onPointerLeave,()=>{u()})})}),_w="SelectSeparator",yf=l.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return r.jsx(W.div,{"aria-hidden":!0,...s,ref:t})});yf.displayName=_w;var Go="SelectArrow",Ow=l.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=qs(n),a=Gt(Go,n),i=Qt(Go,n);return a.open&&i.position==="popper"?r.jsx(ba,{...o,...s,ref:t}):null});Ow.displayName=Go;var Iw="SelectBubbleInput",bf=l.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const o=l.useRef(null),a=de(s,o),i=Rd(t);return l.useEffect(()=>{const c=o.current;if(!c)return;const u=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(u,"value").set;if(i!==t&&h){const f=new Event("change",{bubbles:!0});h.call(c,t),c.dispatchEvent(f)}},[i,t]),r.jsx(W.select,{...n,style:{...Gu,...n.style},ref:a,defaultValue:t})});bf.displayName=Iw;function wf(e){return e===""||e===void 0}function jf(e){const t=it(e),n=l.useRef(""),s=l.useRef(0),o=l.useCallback(i=>{const c=n.current+i;t(c),function u(d){n.current=d,window.clearTimeout(s.current),d!==""&&(s.current=window.setTimeout(()=>u(""),1e3))}(c)},[t]),a=l.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return l.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,o,a]}function Nf(e,t,n){const o=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let i=Dw(e,Math.max(a,0));o.length===1&&(i=i.filter(d=>d!==n));const u=i.find(d=>d.textValue.toLowerCase().startsWith(o.toLowerCase()));return u!==n?u:void 0}function Dw(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var zw=Qu,Cf=Xu,Lw=Ju,Fw=ef,$w=tf,Sf=nf,Uw=af,Ef=df,Rf=ff,Vw=hf,Bw=pf,Pf=xf,kf=gf,Tf=yf;const yr=zw,br=Lw,Gn=l.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(Cf,{ref:s,className:k("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-zinc-200 bg-white px-3 py-2 text-sm shadow-none ring-offset-white","placeholder:text-zinc-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-0","disabled:cursor-not-allowed disabled:opacity-50","[&>span]:line-clamp-1",e),...n,children:[t,r.jsx(Fw,{asChild:!0,children:r.jsx(Ac,{className:"h-4 w-4 opacity-50 shrink-0"})})]}));Gn.displayName=Cf.displayName;const Af=l.forwardRef(({className:e,...t},n)=>r.jsx(Pf,{ref:n,className:k("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Jm,{className:"h-4 w-4"})}));Af.displayName=Pf.displayName;const Mf=l.forwardRef(({className:e,...t},n)=>r.jsx(kf,{ref:n,className:k("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Ac,{className:"h-4 w-4"})}));Mf.displayName=kf.displayName;const Qn=l.forwardRef(({className:e,children:t,position:n="popper",...s},o)=>r.jsx($w,{children:r.jsxs(Sf,{ref:o,className:k("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-zinc-200 bg-white text-zinc-900 shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...s,children:[r.jsx(Af,{}),r.jsx(Uw,{className:k("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(Mf,{})]})}));Qn.displayName=Sf.displayName;const Kw=l.forwardRef(({className:e,...t},n)=>r.jsx(Ef,{ref:n,className:k("px-2 py-1.5 text-xs font-semibold text-zinc-500 uppercase tracking-wider",e),...t}));Kw.displayName=Ef.displayName;const Ue=l.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(Rf,{ref:s,className:k("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none","focus:bg-zinc-100 focus:text-zinc-900","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(Bw,{children:r.jsx(Xn,{className:"h-4 w-4"})})}),r.jsx(Vw,{children:t})]}));Ue.displayName=Rf.displayName;const qw=l.forwardRef(({className:e,...t},n)=>r.jsx(Tf,{ref:n,className:k("-mx-1 my-1 h-px bg-zinc-100",e),...t}));qw.displayName=Tf.displayName;const Gr="record-payment",uo={pending:"Pending",confirmed:"Confirmed",processing:"Processing",shipped:"Shipped",delivered:"Delivered",cancelled:"Cancelled",refunded:"Refunded",partially_refunded:"Partially Refunded"},Hw={confirmed:"confirm",processing:"process",shipped:"ship",delivered:"mark-delivered",cancelled:"cancel"};function Ww(e,t){return Lh[e].filter(n=>n!=="refunded"&&n!=="partially_refunded"&&n!=="confirmed"&&!(n==="cancelled"&&t>0))}function Gw({orderId:e,currentStatus:t,orderNumber:n,capturedMinor:s}){const o=be(),{mutateAsync:a,isPending:i}=Np(),{mutateAsync:c,isPending:u}=Uc(),[d,h]=l.useState(null),f=Ww(t,s),m=t==="pending"&&s===0,g=d??t,v=i||u;if(f.length===0&&!m)return r.jsx("span",{className:"text-sm text-zinc-500 font-medium capitalize",children:uo[t]});const p=async x=>{const y=x===Gr?"confirmed":x;h(y);try{x===Gr?await c({orderId:e}):await a({orderId:e,action:Hw[y]??y})}catch(w){console.error("[OrderStatusSelect] status update failed",w),h(null),o.invalidateQueries({queryKey:["orders","detail",n]})}};return r.jsxs(yr,{value:g,onValueChange:x=>void p(x),disabled:v,children:[r.jsx(Gn,{className:k("w-44 h-8 text-xs",v&&"opacity-50"),"aria-label":"Order status","data-testid":B("order","status-select"),children:r.jsx(br,{})}),r.jsxs(Qn,{children:[r.jsxs(Ue,{value:t,disabled:!0,"data-testid":B("order","status-option",t),children:[uo[t]," (current)"]}),m&&r.jsx(Ue,{value:Gr,"data-testid":B("order","status-option",Gr),children:"Record payment"}),f.map(x=>r.jsx(Ue,{value:x,"data-testid":B("order","status-option",x),children:uo[x]},x))]})]})}function Qw({entries:e}){const t=[...e].sort((n,s)=>new Date(s.timestamp).getTime()-new Date(n.timestamp).getTime());return r.jsx("div",{className:"flow-root",children:r.jsx("ul",{className:"-mb-8",children:t.map((n,s)=>r.jsx("li",{"data-testid":B("order","timeline-entry",n.toStatus),children:r.jsxs("div",{className:"relative pb-8",children:[s<t.length-1&&r.jsx("span",{className:"absolute left-4 top-5 -ml-px h-full w-0.5 bg-zinc-200","aria-hidden":"true"}),r.jsxs("div",{className:"relative flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 border-zinc-200 bg-white",children:r.jsx("div",{className:"h-2 w-2 rounded-full bg-blue-500"})}),r.jsxs("div",{className:"min-w-0 flex-1 pt-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.fromStatus&&r.jsxs(r.Fragment,{children:[r.jsx(Wn,{status:n.fromStatus,size:"sm"}),r.jsx("span",{className:"text-zinc-400 text-xs",children:"→"})]}),r.jsx(Wn,{status:n.toStatus,size:"sm"})]}),n.note&&r.jsx("p",{className:"mt-1 text-sm text-zinc-600",children:n.note}),r.jsxs("div",{className:"mt-1 flex items-center gap-2 text-xs text-zinc-400",children:[r.jsx("span",{children:n.actor}),r.jsx("span",{children:"·"}),r.jsx("time",{dateTime:n.timestamp,title:Ke(n.timestamp),children:ut(n.timestamp)})]})]})]})]})},n.id))})})}const ln=l.forwardRef(({className:e,...t},n)=>r.jsx("textarea",{className:k("flex min-h-[80px] w-full rounded-md border border-zinc-200 bg-white px-3 py-2 text-sm","placeholder:text-zinc-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500","disabled:cursor-not-allowed disabled:opacity-50","resize-none",e),ref:n,...t}));ln.displayName="Textarea";function Yw({orderId:e,notes:t}){const[n,s]=l.useState(""),o=kp(),a=async i=>{i.preventDefault(),n.trim()&&(await o.mutateAsync({orderId:e,body:n.trim()}),s(""))};return r.jsxs("div",{"data-testid":B("order","notes"),children:[r.jsx("div",{className:"space-y-3",children:t.length===0?r.jsx("p",{className:"text-sm text-zinc-400 italic",children:"No notes yet."}):[...t].sort((i,c)=>new Date(c.at).getTime()-new Date(i.at).getTime()).map((i,c)=>r.jsx(Xw,{note:i},c))}),r.jsxs("form",{onSubmit:i=>void a(i),className:"mt-4 flex gap-2",children:[r.jsx(ln,{placeholder:"Add an internal note...",value:n,onChange:i=>s(i.target.value),rows:2,className:"flex-1 text-sm",onKeyDown:i=>{i.key==="Enter"&&(i.metaKey||i.ctrlKey)&&(i.preventDefault(),a(i))}}),r.jsx(le,{type:"submit",size:"icon","aria-label":"Add note",disabled:!n.trim()||o.isPending,className:"self-end h-9 w-9",children:r.jsx(Ic,{className:"h-4 w-4"})})]})]})}function Xw({note:e}){return r.jsxs("div",{className:"rounded-md border border-zinc-200 bg-zinc-50 p-3",children:[r.jsx("p",{className:"text-sm text-zinc-700 whitespace-pre-wrap",children:e.body}),r.jsxs("div",{className:"mt-2 flex items-center gap-2 text-xs text-zinc-400",children:[r.jsx("span",{className:"font-medium text-zinc-500",children:e.actor}),r.jsx("span",{children:"·"}),r.jsx("time",{dateTime:e.at,title:Ke(e.at),children:ut(e.at)})]})]})}function Zw(e,t){if(!(e instanceof un))return"The refund could not be made.";const{amountMinor:n,refundableMinor:s}=e.context??{};return e.code==="refund.exceeds_captured"&&typeof n=="number"&&typeof s=="number"?`A refund of ${pe(n,t)} is more than the ${pe(s,t)} left to refund.`:e.message}function Jw({order:e,onClose:t}){const{refundableMinor:n,currency:s}=e.payment,[o,a]=l.useState((n/100).toFixed(2)),[i,c]=l.useState(""),[u,d]=l.useState(null),[h,f]=l.useState(()=>crypto.randomUUID()),m=l.useRef(!1),[g,v]=l.useState(!1),p=Rp(),x=Sy(o),y=x!==null&&x>0&&x<=n,w=async()=>{if(!(!y||x===null||m.current)){m.current=!0,v(!0),d(null);try{if((await p.mutateAsync({orderId:e.id,amountMinor:x,requestId:h,...i.trim()&&{reason:i.trim()}})).refund.status==="failed"){f(crypto.randomUUID()),d("The payment provider refused the refund.");return}t()}catch(N){d(Zw(N,s))}finally{m.current=!1,v(!1)}}};return r.jsx(hd,{open:!0,onOpenChange:N=>!N&&t(),children:r.jsxs(Aa,{className:"max-w-md","data-testid":B("order","refund-dialog"),children:[r.jsx(pd,{children:r.jsxs(gd,{children:["Refund Order #",e.orderNumber]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"rounded-md border border-zinc-200 p-3 bg-zinc-50",children:r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-zinc-600",children:"Refundable"}),r.jsx("span",{className:"font-mono font-semibold text-zinc-900",children:pe(n,s)})]})}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(ze,{htmlFor:"refund-amount",children:["Amount (",s,")"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xe,{id:"refund-amount",inputMode:"decimal",value:o,onChange:N=>a(N.target.value),"aria-invalid":!y,"data-testid":B("order","refund-amount")}),r.jsx(le,{variant:"outline",type:"button",onClick:()=>a((n/100).toFixed(2)),children:"Full refund"})]}),!y&&r.jsxs("p",{className:"text-xs text-red-600",children:["Enter an amount above 0 and up to ",pe(n,s),"."]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{htmlFor:"refund-reason",children:"Reason (optional)"}),r.jsx(ln,{id:"refund-reason",placeholder:"Enter refund reason...",value:i,onChange:N=>c(N.target.value),rows:3,"data-testid":B("order","refund-reason")})]}),u&&r.jsx("p",{role:"alert",className:"text-sm text-red-600",children:u})]}),r.jsxs(xd,{children:[r.jsx(le,{variant:"outline",type:"button",onClick:t,children:"Cancel"}),r.jsx(le,{variant:"destructive",type:"button",onClick:()=>void w(),disabled:!y||g,"data-testid":B("order","refund-confirm"),children:g?"Processing...":`Refund ${x!==null?pe(x,s):""}`})]})]})})}const ej=50;function tj(e,t){return Cc({queryKey:["history",e,t],initialPageParam:void 0,queryFn:({pageParam:n})=>se.get(`/api/admin/${e}/${encodeURIComponent(t)}/history`,{limit:ej,cursor:n}),getNextPageParam:n=>n.nextCursor??void 0,enabled:t!==""})}function nj(e,t){return Pe({queryKey:["history","as-of",e,t],queryFn:()=>se.get(e,{at:t}),enabled:t!==null,retry:!1})}function Qo(e){return e==null?"—":typeof e=="object"?JSON.stringify(e):String(e)}function rj({seq:e,change:t}){return r.jsxs("li",{className:"font-mono text-xs text-zinc-600 break-all","data-testid":`history-change-${e}-${t.path}`,children:[r.jsxs("span",{className:"text-zinc-400",children:[t.path,": "]}),r.jsx("span",{className:"text-red-700",children:Qo(t.from)}),r.jsx("span",{className:"text-zinc-400",children:" → "}),r.jsx("span",{className:"text-green-700",children:Qo(t.to)})]})}function sj({entry:e,onAsOf:t}){return r.jsxs("li",{className:"py-3 space-y-1.5","data-testid":`history-row-${e.seq}`,children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs",children:[r.jsx("time",{dateTime:e.at,className:"text-zinc-500",children:Ke(e.at)}),r.jsx("span",{className:"font-mono text-zinc-800",children:e.type}),r.jsx("span",{className:"font-mono text-zinc-500","data-testid":`history-row-${e.seq}-actor`,children:e.actor===null?"system":`${e.actor.kind}:${e.actor.id}`}),r.jsx("span",{className:"font-mono text-zinc-500","data-testid":`history-row-${e.seq}-command`,children:e.command??""}),r.jsx(le,{type:"button",variant:"outline",size:"sm",className:"ml-auto h-6 px-2 text-xs",onClick:()=>t(e.at),"data-testid":`history-as-of-${e.seq}`,children:"View as of"})]}),e.base?r.jsx("p",{className:"text-xs text-zinc-400",children:"The earliest state the event log holds."}):r.jsx("ul",{className:"space-y-0.5",children:e.changes.map(n=>r.jsx(rj,{seq:e.seq,change:n},n.path))})]})}function oj({detailPath:e,at:t,onClose:n}){const{data:s,error:o,isLoading:a}=nj(e,t);return r.jsxs("div",{className:"rounded-md border border-zinc-200 bg-zinc-50 p-3 space-y-2","data-testid":"history-as-of-panel",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("h4",{className:"text-xs font-semibold text-zinc-700",children:["As of ",Ke(t)]}),r.jsx(le,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:n,children:r.jsx(Rr,{className:"h-3.5 w-3.5"})})]}),a?r.jsx(ge,{className:"h-24 w-full"}):o?r.jsx("p",{className:"text-xs text-red-600",children:o instanceof un?o.message:"The record could not be read as of then."}):s?r.jsx("dl",{className:"grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1 text-xs",children:Object.entries(s.record).map(([i,c])=>r.jsxs("div",{className:"contents",children:[r.jsx("dt",{className:"text-zinc-400",children:i}),r.jsx("dd",{className:"font-mono text-zinc-700 break-all","data-testid":`history-as-of-field-${i}`,children:Qo(c)})]},i))}):null]})}function Ga({collection:e,id:t,detailPath:n}){const{data:s,isLoading:o,isError:a,hasNextPage:i,fetchNextPage:c,isFetchingNextPage:u}=tj(e,t),[d,h]=l.useState(null);if(o)return r.jsx("div",{className:"space-y-2",children:Array.from({length:4}).map((g,v)=>r.jsx(ge,{className:"h-10 w-full"},v))});if(a||!s)return r.jsx(ct,{icon:r.jsx(Bn,{className:"h-5 w-5"}),title:"History could not be loaded"});const f=s.pages[0];if(f.historyStartsAt===null)return r.jsxs("p",{className:"py-4 text-center text-sm text-zinc-500","data-testid":"history-empty",children:["This record predates the event log’s window: the log keeps ",f.retentionDays," days of changes (events.retentionDays), so its earlier history is no longer held."]});const m=s.pages.flatMap(g=>g.entries);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("p",{className:"text-xs text-zinc-400",children:["From ",Ke(f.historyStartsAt),": the event log keeps ",f.retentionDays," days of changes."]}),d!==null&&r.jsx(oj,{detailPath:n,at:d,onClose:()=>h(null)}),r.jsx("ul",{className:"divide-y divide-zinc-100",children:m.map(g=>r.jsx(sj,{entry:g,onAsOf:h},g.seq))}),i&&r.jsx(le,{type:"button",variant:"outline",size:"sm",onClick:()=>void c(),disabled:u,children:u?"Loading…":"Load more"})]})}const aj=["pending","cancelled"],ij={unpaid:"Unpaid",paid:"Paid",partially_refunded:"Partially refunded",refunded:"Refunded"},cj={unpaid:"bg-zinc-100 text-zinc-700",paid:"bg-green-100 text-green-700",partially_refunded:"bg-amber-100 text-amber-700",refunded:"bg-orange-100 text-orange-700"},lj={provider:"Payment provider",manual:"Recorded manually",import:"Imported"},dj={pending:"Refund pending",succeeded:"Refunded",failed:"Failed"};function uj({order:e}){const{payment:t}=e;return r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-white p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-400",children:"Payment"}),r.jsx("span",{className:k("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",cj[t.state]),"data-testid":B("order","payment-state"),children:ij[t.state]})]}),r.jsxs("dl",{className:"space-y-1.5 text-sm",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("dt",{className:"text-zinc-500",children:"Captured"}),r.jsx("dd",{className:"font-mono text-zinc-700","data-testid":B("order","captured"),children:pe(t.capturedMinor,t.currency)})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("dt",{className:"text-zinc-500",children:"Refunded"}),r.jsx("dd",{className:"font-mono text-zinc-700","data-testid":B("order","refunded"),children:pe(t.refundedMinor,t.currency)})]}),r.jsxs("div",{className:"flex justify-between font-semibold",children:[r.jsx("dt",{className:"text-zinc-700",children:"Net"}),r.jsx("dd",{className:"font-mono text-zinc-900","data-testid":B("order","net"),children:pe(t.capturedMinor-t.refundedMinor,t.currency)})]}),e.captureMethod&&r.jsxs("div",{className:"flex justify-between",children:[r.jsx("dt",{className:"text-zinc-500",children:"Method"}),r.jsx("dd",{className:"text-zinc-700",children:lj[e.captureMethod]})]}),e.paymentIntentId&&r.jsxs("div",{className:"flex justify-between",children:[r.jsx("dt",{className:"text-zinc-500",children:"Intent ID"}),r.jsx("dd",{className:"font-mono text-xs text-zinc-600 truncate max-w-[120px]",children:e.paymentIntentId})]})]}),t.refunds.length>0&&r.jsx("ul",{className:"space-y-1 border-t border-zinc-100 pt-2 text-sm",children:t.refunds.map(n=>r.jsxs("li",{className:"flex justify-between gap-2","data-testid":B("order","refund-row",n.id),children:[r.jsxs("span",{className:"text-zinc-500",children:[dj[n.status]," · ",Ke(n.createdAt)]}),r.jsx("span",{className:"font-mono text-zinc-700",children:pe(n.amountMinor,n.currency)})]},n.id))})]})}function Ki({address:e,label:t}){return r.jsxs("div",{children:[r.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-zinc-400 mb-1.5",children:t}),r.jsxs("div",{className:"text-sm text-zinc-600 space-y-0.5",children:[r.jsxs("p",{children:[e.firstName," ",e.lastName]}),e.company&&r.jsx("p",{children:e.company}),r.jsx("p",{children:e.addressLine1}),e.addressLine2&&r.jsx("p",{children:e.addressLine2}),r.jsxs("p",{children:[e.city,", ",e.region," ",e.postalCode]}),r.jsx("p",{children:e.country})]})]})}function fj(){const{orderNumber:e}=Zo(),[t,n]=l.useState(!1),{data:s,isLoading:o}=wp(e??""),{data:a=[]}=jp((s==null?void 0:s.id)??""),i=Uc(),c=Cp(),u=Sp(),d=Ep(),h=Pp();if(o)return r.jsxs("div",{className:"space-y-4",children:[r.jsx(ge,{className:"h-8 w-40"}),r.jsxs("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-5",children:[r.jsxs("div",{className:"md:col-span-3 space-y-4",children:[r.jsx(ge,{className:"h-48 w-full"}),r.jsx(ge,{className:"h-32 w-full"})]}),r.jsxs("div",{className:"md:col-span-2 space-y-4",children:[r.jsx(ge,{className:"h-40 w-full"}),r.jsx(ge,{className:"h-48 w-full"})]})]})]});if(!s)return r.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[r.jsx(Vt,{className:"mb-3 h-8 w-8 text-zinc-300"}),r.jsx("p",{className:"text-sm text-zinc-500",children:"Order not found"}),r.jsx(Ft,{to:"/orders",className:"mt-3 text-sm text-blue-600 hover:underline",children:"← Back to orders"})]});const m=s.status==="pending"&&s.payment.capturedMinor===0?{label:"Record payment",icon:ai,action:()=>void i.mutateAsync({orderId:s.id})}:s.status==="processing"?{label:"Mark Shipped",icon:zc,action:()=>void d.mutateAsync({orderId:s.id,trackingNumber:"",carrier:""})}:s.status==="shipped"?{label:"Mark Delivered",icon:ai,action:()=>void u.mutateAsync(s.id)}:null,g=aj.includes(s.status)||h.isPending,v=h.isError?h.error.message:h.data?`Confirmation queued to ${h.data.email}`:null;return r.jsxs("div",{className:"space-y-4","data-testid":B("order","detail"),children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs(Ft,{to:"/orders",className:"flex items-center gap-1.5 text-sm text-zinc-500 hover:text-zinc-700 transition-colors",children:[r.jsx(oa,{className:"h-4 w-4"}),"Orders"]}),r.jsx("span",{className:"text-zinc-300",children:"/"}),r.jsxs("h1",{className:"font-mono text-base font-semibold text-zinc-900",children:["#",s.orderNumber]}),r.jsx(Wn,{status:s.status,"data-testid":B("order","status-badge")})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v!==null&&r.jsx("span",{role:"status",className:"text-xs text-zinc-500","data-testid":B("order","resend-result"),children:v}),m&&r.jsxs(le,{size:"sm",onClick:m.action,className:"gap-1.5",children:[r.jsx(m.icon,{className:"h-4 w-4"}),m.label]}),r.jsxs(Ba,{children:[r.jsx(Ka,{asChild:!0,children:r.jsx(le,{variant:"outline",size:"sm","data-testid":B("order","actions"),children:"Actions"})}),r.jsxs(Fs,{align:"end",className:"w-44",children:[r.jsxs(vt,{onSelect:()=>{g||h.mutate({orderId:s.id})},className:"gap-2",disabled:g,"data-testid":B("order","action","resend-confirmation"),children:[r.jsx(Oc,{className:"h-4 w-4"}),"Resend confirmation"]}),r.jsx($s,{}),s.payment.refundableMinor>0&&r.jsxs(vt,{onClick:()=>n(!0),className:"gap-2","data-testid":B("order","action","refund"),children:[r.jsx(sp,{className:"h-4 w-4"}),"Issue refund"]}),r.jsxs(vt,{onClick:()=>void c.mutateAsync({orderId:s.id}),className:"gap-2 text-red-600",disabled:s.payment.capturedMinor>0||["cancelled","refunded","delivered"].includes(s.status),children:[r.jsx(tp,{className:"h-4 w-4"}),"Cancel order"]})]})]})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 text-sm text-zinc-500",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(ii,{className:"h-3.5 w-3.5"}),"Placed ",Ke(s.createdAt)]}),r.jsx("span",{className:"text-zinc-300",children:"·"}),r.jsx(Gw,{orderId:s.id,currentStatus:s.status,orderNumber:s.orderNumber,capturedMinor:s.payment.capturedMinor})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-5",children:[r.jsxs("div",{className:"md:col-span-3 space-y-5",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-white overflow-hidden",children:[r.jsx("div",{className:"border-b border-zinc-100 px-4 py-3",children:r.jsxs("h2",{className:"text-sm font-semibold text-zinc-900",children:["Items (",s.lineItems.length,")"]})}),r.jsx("div",{className:"divide-y divide-zinc-50",children:s.lineItems.map(p=>r.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[p.imageUrl?r.jsx("img",{src:p.imageUrl,alt:p.productName,className:"h-12 w-12 rounded border border-zinc-100 object-cover"}):r.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded border border-zinc-100 bg-zinc-50",children:r.jsx(Vt,{className:"h-5 w-5 text-zinc-300"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"text-sm font-medium text-zinc-800",children:p.productName}),r.jsxs("p",{className:"text-xs text-zinc-400",children:[p.variantName," · ",p.sku]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("p",{className:"font-mono text-sm text-zinc-700",children:pe(p.lineTotalMinor,s.currency)}),r.jsxs("p",{className:"text-xs text-zinc-400",children:[p.qty," × ",pe(p.unitPriceMinor,s.currency)]})]})]},p.variantId))}),r.jsxs("div",{className:"border-t border-zinc-100 bg-zinc-50 px-4 py-3 space-y-1",children:[r.jsxs("div",{className:"flex justify-between text-sm text-zinc-500",children:[r.jsx("span",{children:"Subtotal"}),r.jsx("span",{className:"font-mono",children:pe(s.subtotalMinor,s.currency)})]}),s.taxTotalMinor>0&&r.jsxs("div",{className:"flex justify-between text-sm text-zinc-500",children:[r.jsx("span",{children:"Tax"}),r.jsx("span",{className:"font-mono",children:pe(s.taxTotalMinor,s.currency)})]}),s.shippingTotalMinor>0&&r.jsxs("div",{className:"flex justify-between text-sm text-zinc-500",children:[r.jsx("span",{children:"Shipping"}),r.jsx("span",{className:"font-mono",children:pe(s.shippingTotalMinor,s.currency)})]}),s.discountTotalMinor>0&&r.jsxs("div",{className:"flex justify-between text-sm text-green-600",children:[r.jsx("span",{children:"Discount"}),r.jsxs("span",{className:"font-mono",children:["-",pe(s.discountTotalMinor,s.currency)]})]}),r.jsxs("div",{className:"flex justify-between border-t border-zinc-200 pt-2 text-sm font-semibold text-zinc-800",children:[r.jsx("span",{children:"Total"}),r.jsx("span",{className:"font-mono text-base",children:pe(s.totalMinor,s.currency)})]})]})]}),r.jsx("div",{className:"rounded-lg border border-zinc-200 bg-white overflow-hidden",children:r.jsxs(Ha,{defaultValue:"notes",children:[r.jsx("div",{className:"border-b border-zinc-100 px-4 py-2",children:r.jsxs(Vs,{className:"h-8",children:[r.jsxs(Ge,{value:"notes",className:"gap-1.5 text-xs",children:[r.jsx(mp,{className:"h-3.5 w-3.5"}),"Notes",a.length>0&&r.jsx("span",{className:"rounded-full bg-zinc-100 px-1.5 text-[10px]",children:a.length})]}),r.jsxs(Ge,{value:"timeline",className:"gap-1.5 text-xs","data-testid":B("order","tab","timeline"),children:[r.jsx(ii,{className:"h-3.5 w-3.5"}),"Timeline"]}),r.jsxs(Ge,{value:"history",className:"gap-1.5 text-xs","data-testid":B("order","tab","history"),children:[r.jsx(Bn,{className:"h-3.5 w-3.5"}),"History"]})]})}),r.jsx(Qe,{value:"notes",className:"p-4",children:r.jsx(Yw,{orderId:s.id,notes:a})}),r.jsx(Qe,{value:"timeline",className:"p-4",children:s.history&&s.history.length>0?r.jsx(Qw,{entries:s.history}):r.jsx("p",{className:"text-sm text-zinc-400 text-center py-4",children:"No history yet."})}),r.jsx(Qe,{value:"history",className:"p-4",children:r.jsx(Ga,{collection:"orders",id:s.id,detailPath:`/api/admin/orders/${encodeURIComponent(s.orderNumber)}`})})]})})]}),r.jsxs("div",{className:"md:col-span-2 space-y-4",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-white p-4 space-y-3",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-400",children:"Customer"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-zinc-100 text-sm font-semibold text-zinc-600",children:(s.email[0]??"?").toUpperCase()}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"text-sm font-medium text-zinc-800 [overflow-wrap:anywhere]",children:s.email}),s.customerId&&r.jsx(Ft,{to:`/customers/${s.customerId}`,className:"text-xs text-blue-600 hover:underline",children:"View customer →"})]})]})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-white p-4",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-400 mb-3",children:"Addresses"}),r.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[r.jsx(Ki,{address:s.shippingAddress,label:"Shipping"}),r.jsx(Ki,{address:s.billingAddress,label:"Billing"})]})]}),r.jsx(uj,{order:s}),s.notes&&r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-amber-50 p-4",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-amber-600 mb-1.5",children:"Order Note"}),r.jsx("p",{className:"text-sm text-amber-800",children:s.notes})]})]})]}),t&&r.jsx(Jw,{order:s,onClose:()=>n(!1)})]})}const hj={breadcrumb:e=>`#${e.orderNumber??""}`},mj=ys("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors",{variants:{variant:{default:"bg-zinc-100 text-zinc-700",secondary:"bg-zinc-200 text-zinc-800",destructive:"bg-red-100 text-red-700",outline:"border border-zinc-200 text-zinc-700",success:"bg-green-100 text-green-700",warning:"bg-amber-100 text-amber-700",info:"bg-blue-100 text-blue-700"}},defaultVariants:{variant:"default"}});function _f({className:e,variant:t,...n}){return r.jsx("div",{className:k(mj({variant:t}),e),...n})}function pj(e={}){return Pe({queryKey:["products","list",e],queryFn:()=>se.get("/api/admin/products",e)})}function xj(e){return Pe({queryKey:["products","detail",e],queryFn:()=>se.get(`/api/admin/products/${e}`),enabled:!!e&&e!=="new"})}function gj(){const e=be();return Ne({mutationFn:({product:t,idempotencyKey:n})=>se.post("/api/admin/products",t,n===void 0?void 0:{idempotencyKey:n}),onSuccess:()=>{e.invalidateQueries({queryKey:["products","list"]})}})}function vj(){const e=be();return Ne({mutationFn:({id:t,data:n,idempotencyKey:s})=>se.patch(`/api/admin/products/${t}`,n,s===void 0?void 0:{idempotencyKey:s}),onSuccess:t=>{e.setQueryData(["products","detail",t.id],t),e.setQueryData(["products","detail",t.slug],t),e.invalidateQueries({queryKey:["products","list"]})}})}function yj(){const e=be();return Ne({mutationFn:t=>se.post(`/api/admin/products/${t}/duplicate`),onSuccess:()=>{e.invalidateQueries({queryKey:["products","list"]})}})}function bj(){const e=be();return Ne({mutationFn:t=>se.post(`/api/admin/products/${t}/archive`),onSuccess:()=>{e.invalidateQueries({queryKey:["products"]})}})}function wj(){return Ne({mutationFn:({id:e,field:t,context:n})=>se.post(`/api/admin/products/${e}/enhance`,{field:t,context:n})})}const jj=[{label:"All",value:"all"},{label:"Active",value:"active"},{label:"Draft",value:"draft"},{label:"Archived",value:"archived"}],Nj={active:"success",draft:"default",archived:"secondary"};function Cj(){const e=jt(),[t,n]=l.useState("all"),[s,o]=l.useState(""),{data:a,isLoading:i}=pj({status:t==="all"?void 0:t,q:s||void 0,limit:100}),c=yj(),u=bj();return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-lg font-semibold text-zinc-900",children:"Products"}),r.jsx("p",{className:"text-sm text-zinc-500",children:a?`${a.length} products`:"Loading..."})]}),r.jsxs(le,{onClick:()=>e("/products/new"),className:"gap-1.5",children:[r.jsx(pr,{className:"h-4 w-4"}),"Add Product"]})]}),r.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[r.jsx("div",{className:"flex flex-wrap gap-1.5",children:jj.map(d=>r.jsx("button",{onClick:()=>n(d.value),className:k("rounded-full px-3 py-1 text-xs font-medium transition-colors",t===d.value?"bg-zinc-900 text-white":"bg-zinc-100 text-zinc-600 hover:bg-zinc-200"),children:d.label},d.value))}),r.jsxs("div",{className:"relative flex-1 sm:max-w-xs sm:ml-auto",children:[r.jsx(Zn,{className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-zinc-400"}),r.jsx(xe,{placeholder:"Search products...",value:s,onChange:d=>o(d.target.value),className:"pl-9 h-8 text-sm"})]})]}),r.jsx("div",{className:"rounded-lg border border-zinc-200 bg-white overflow-hidden",children:i?r.jsx("div",{className:"p-4 space-y-2",children:Array.from({length:6}).map((d,h)=>r.jsx(ge,{className:"h-11 w-full"},h))}):a!=null&&a.length?r.jsxs(vn,{children:[r.jsx(yn,{children:r.jsxs(Fe,{children:[r.jsx(te,{className:"w-12",children:"Image"}),r.jsx(te,{children:"Name"}),r.jsx(te,{children:"Status"}),r.jsx(te,{children:"Type"}),r.jsx(te,{className:"text-right",children:"Price"}),r.jsx(te,{children:"Stock"}),r.jsx(te,{className:"text-right",children:"Updated"}),r.jsx(te,{className:"w-10"})]})}),r.jsx(bn,{children:a.map(d=>{const h=d.media[0],f=d.variants[0],m=d.variants.reduce((p,x)=>p+x.stock,0),g=d.variants.some(p=>p.stock<=p.lowStockThreshold),v=d.variants.some(p=>p.stock===0);return r.jsxs(Fe,{"data-testid":B("products","row",d.id),className:"cursor-pointer",onClick:()=>e(`/products/${d.slug}`),children:[r.jsx(ne,{children:h?r.jsx("img",{src:h.url,alt:h.altText,className:"h-8 w-8 rounded border border-zinc-100 object-cover"}):r.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded border border-zinc-100 bg-zinc-50",children:r.jsx(Vt,{className:"h-3.5 w-3.5 text-zinc-300"})})}),r.jsx(ne,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-zinc-800",children:d.name}),r.jsx("p",{className:"font-mono text-[10px] text-zinc-400",children:d.slug})]})}),r.jsx(ne,{children:r.jsx(_f,{variant:Nj[d.status],className:"capitalize",children:d.status})}),r.jsx(ne,{className:"text-xs text-zinc-500 capitalize",children:d.type}),r.jsx(ne,{className:"text-right font-mono text-sm",children:f?pe(f.priceMinor,"GBP"):"—"}),r.jsx(ne,{children:r.jsx("span",{className:k("text-sm font-mono font-medium",v?"text-red-600":g?"text-amber-600":"text-zinc-700"),children:m})}),r.jsx(ne,{className:"text-right text-xs text-zinc-400",children:ut(d.updatedAt)}),r.jsx(ne,{onClick:p=>p.stopPropagation(),children:r.jsxs(Ba,{children:[r.jsx(Ka,{asChild:!0,children:r.jsx(le,{variant:"ghost",size:"icon",className:"h-7 w-7 text-zinc-400 opacity-0 group-hover:opacity-100",children:r.jsx(_c,{className:"h-4 w-4"})})}),r.jsxs(Fs,{align:"end",children:[r.jsx(vt,{onClick:()=>e(`/products/${d.slug}`),children:"Edit"}),r.jsxs(vt,{onClick:()=>void c.mutateAsync(d.id),className:"gap-2",children:[r.jsx(rp,{className:"h-3.5 w-3.5"}),"Duplicate"]}),r.jsx($s,{}),r.jsxs(vt,{onClick:()=>void u.mutateAsync(d.id),className:"gap-2 text-zinc-500",children:[r.jsx(Qm,{className:"h-3.5 w-3.5"}),"Archive"]})]})]})})]},d.id)})})]}):r.jsx(ct,{icon:r.jsx(Vt,{className:"h-5 w-5"}),title:"No products found",description:s?"Try a different search.":"Create your first product.",action:r.jsxs(le,{onClick:()=>e("/products/new"),className:"gap-1.5",children:[r.jsx(pr,{className:"h-4 w-4"}),"Add Product"]})})})]})}const Sj={breadcrumb:()=>"Products"};function Ej(e){return{id:`new-${crypto.randomUUID()}`,productId:e,sku:"",name:"New Variant",priceMinor:0,compareAtPriceMinor:null,weightGrams:null,dimensions:null,stock:0,lowStockThreshold:5,options:[],status:"active",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}}function Rj({productId:e,variants:t,onChange:n,currency:s}){const[o,a]=l.useState(t.map(d=>({...d,_priceDisplay:(d.priceMinor/100).toFixed(2)}))),i=(d,h,f)=>{a(m=>{const g=m.map(v=>{if(v.id!==d)return v;if(h==="_priceDisplay"){const p=parseFloat(f);return{...v,_priceDisplay:f,priceMinor:isNaN(p)?v.priceMinor:Math.round(p*100)}}return{...v,[h]:f}});return n(g.map(({_priceDisplay:v,...p})=>p)),g})},c=()=>{const d=Ej(e),h=[...o,{...d,_priceDisplay:"0.00"}];a(h),n(h.map(({_priceDisplay:f,...m})=>m))},u=d=>{const h=o.filter(f=>f.id!==d);a(h),n(h.map(({_priceDisplay:f,...m})=>m))};return r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"rounded-md border border-zinc-200 overflow-hidden",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{className:"bg-zinc-50 border-b border-zinc-200",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium uppercase tracking-wider text-zinc-500",children:"SKU"}),r.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium uppercase tracking-wider text-zinc-500",children:"Name"}),r.jsx("th",{className:"px-3 py-2 text-right text-xs font-medium uppercase tracking-wider text-zinc-500",children:"Price"}),r.jsx("th",{className:"px-3 py-2 text-right text-xs font-medium uppercase tracking-wider text-zinc-500",children:"Stock"}),r.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium uppercase tracking-wider text-zinc-500",children:"Status"}),r.jsx("th",{className:"w-10 px-3 py-2"})]})}),r.jsxs("tbody",{children:[o.length===0&&r.jsx("tr",{children:r.jsx("td",{colSpan:6,className:"px-3 py-6 text-center text-sm text-zinc-400",children:"No variants yet. Add one below."})}),o.map(d=>r.jsxs("tr",{className:"border-b border-zinc-100 last:border-0","data-testid":B("product","variant-row",d.id),children:[r.jsx("td",{className:"px-3 py-2",children:r.jsx(xe,{value:d.sku,onChange:h=>i(d.id,"sku",h.target.value),placeholder:"SKU-001",className:"h-7 font-mono text-xs w-28"})}),r.jsx("td",{className:"px-3 py-2",children:r.jsx(xe,{value:d.name,onChange:h=>i(d.id,"name",h.target.value),placeholder:"Variant name",className:"h-7 text-xs"})}),r.jsx("td",{className:"px-3 py-2",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx("span",{className:"text-xs text-zinc-400",children:s}),r.jsx(xe,{value:d._priceDisplay,onChange:h=>i(d.id,"_priceDisplay",h.target.value),"data-testid":B("product","variant-price",d.id),onBlur:h=>{const f=parseFloat(h.target.value);isNaN(f)||i(d.id,"_priceDisplay",f.toFixed(2))},className:"h-7 w-20 text-right font-mono text-xs"})]})}),r.jsx("td",{className:"px-3 py-2 text-right",children:r.jsx(xe,{type:"number",value:d.stock,onChange:h=>i(d.id,"stock",parseInt(h.target.value)||0),className:"h-7 w-16 text-right font-mono text-xs ml-auto",min:0})}),r.jsx("td",{className:"px-3 py-2",children:r.jsxs(yr,{value:d.status,onValueChange:h=>i(d.id,"status",h),children:[r.jsx(Gn,{className:"h-7 w-24 text-xs",children:r.jsx(br,{})}),r.jsxs(Qn,{children:[r.jsx(Ue,{value:"active",children:"Active"}),r.jsx(Ue,{value:"inactive",children:"Inactive"})]})]})}),r.jsx("td",{className:"px-3 py-2",children:r.jsx("button",{onClick:()=>u(d.id),className:"rounded p-1 text-zinc-400 hover:bg-red-50 hover:text-red-500 transition-colors",title:"Remove variant",children:r.jsx(Dc,{className:"h-3.5 w-3.5"})})})]},d.id))]})]})}),r.jsxs("div",{className:"flex items-center justify-between pt-1",children:[r.jsxs("p",{className:"text-xs text-zinc-400",children:[o.length," variant",o.length!==1?"s":"",o.length>0&&r.jsxs(r.Fragment,{children:[" · Total stock: ",o.reduce((d,h)=>d+h.stock,0)]})]}),r.jsxs(le,{variant:"outline",size:"sm",onClick:c,className:"gap-1.5",children:[r.jsx(pr,{className:"h-3.5 w-3.5"}),"Add Variant"]})]})]})}function Pj({media:e,onChange:t}){const[n,s]=l.useState(""),[o,a]=l.useState(""),[i,c]=l.useState(!1),[u,d]=l.useState(null),h=()=>{if(!n.trim())return;const v=[...e,{url:n.trim(),altText:o.trim(),position:e.length}];t(v),s(""),a("")},f=v=>{const p=e.filter((x,y)=>y!==v).map((x,y)=>({...x,position:y}));t(p)},m=v=>{const p=e[v];if(!p)return;const x=[p,...e.filter((y,w)=>w!==v)].map((y,w)=>({...y,position:w}));t(x)},g=(v,p)=>{const x=e.map((y,w)=>w===v?{...y,altText:p}:y);t(x)};return r.jsxs("div",{className:"space-y-3",children:[e.length>0&&r.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:e.map((v,p)=>r.jsxs("div",{className:k("group relative rounded-md border bg-zinc-50 overflow-hidden",p===0?"border-blue-300 ring-1 ring-blue-300":"border-zinc-200"),children:[r.jsx("div",{className:"aspect-square flex items-center justify-center",children:v.url?r.jsx("img",{src:v.url,alt:v.altText||"Product image",className:"h-full w-full object-cover",onError:x=>{x.target.style.display="none"}}):r.jsx(cp,{className:"h-6 w-6 text-zinc-300"})}),p===0&&r.jsx("div",{className:"absolute left-1 top-1 rounded bg-blue-500 px-1 py-0.5 text-[9px] font-semibold text-white",children:"Primary"}),r.jsxs("div",{className:"absolute inset-0 flex items-center justify-center gap-1 bg-black/40 opacity-0 transition-opacity group-hover:opacity-100",children:[p!==0&&r.jsx("button",{onClick:()=>m(p),className:"rounded bg-white/90 p-1 text-zinc-700 hover:bg-white",title:"Set as primary",children:r.jsx(bp,{className:"h-3 w-3"})}),r.jsx("button",{onClick:()=>f(p),className:"rounded bg-white/90 p-1 text-red-600 hover:bg-white",title:"Remove",children:r.jsx(Rr,{className:"h-3 w-3"})})]}),r.jsx("div",{className:"border-t border-zinc-100 px-1.5 py-1",children:u===p?r.jsx("input",{autoFocus:!0,value:v.altText,onChange:x=>g(p,x.target.value),onBlur:()=>d(null),className:"w-full text-[10px] bg-transparent border-b border-zinc-300 outline-none",placeholder:"Alt text..."}):r.jsx("button",{onClick:()=>d(p),className:"w-full text-left text-[10px] text-zinc-400 hover:text-zinc-600 truncate",children:v.altText||"Add alt text"})})]},p))}),r.jsx("div",{className:k("rounded-md border-2 border-dashed p-4 transition-colors",i?"border-blue-400 bg-blue-50":"border-zinc-200"),onDragOver:v=>{v.preventDefault(),c(!0)},onDragLeave:()=>c(!1),onDrop:v=>{v.preventDefault(),c(!1)},children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs text-zinc-500 text-center",children:"Add image by URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("div",{className:"flex-1 space-y-1.5",children:[r.jsx(ze,{className:"text-xs",children:"Image URL"}),r.jsx(xe,{value:n,onChange:v=>s(v.target.value),placeholder:"https://cdn.example.com/image.jpg",className:"text-xs h-8",onKeyDown:v=>v.key==="Enter"&&h()})]}),r.jsxs("div",{className:"flex-1 space-y-1.5",children:[r.jsx(ze,{className:"text-xs",children:"Alt Text"}),r.jsx(xe,{value:o,onChange:v=>a(v.target.value),placeholder:"Describe the image",className:"text-xs h-8",onKeyDown:v=>v.key==="Enter"&&h()})]}),r.jsx("div",{className:"flex items-end",children:r.jsxs(le,{type:"button",size:"sm",onClick:h,disabled:!n.trim(),className:"h-8 gap-1",children:[r.jsx(pr,{className:"h-3.5 w-3.5"}),"Add"]})})]})]})}),r.jsxs("p",{className:"text-xs text-zinc-400",children:[e.length," image",e.length!==1?"s":""," · Drag to reorder (coming soon)"]})]})}function kj({title:e,description:t,url:n}){const a=e.length>60,i=t.length>155,c=a?e.slice(0,60)+"...":e,u=i?t.slice(0,155)+"...":t;return r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"rounded-lg border border-zinc-200 bg-white p-4",children:r.jsxs("div",{className:"max-w-lg",children:[r.jsx("p",{className:"text-xs text-zinc-400 mb-1 truncate",children:n||"https://yourstore.com/products/..."}),r.jsx("p",{className:k("text-[17px] leading-snug text-blue-700 cursor-pointer hover:underline mb-1",!e&&"text-zinc-300 italic"),children:c||"Page title appears here"}),r.jsx("p",{className:k("text-sm leading-relaxed text-zinc-500",!t&&"text-zinc-300 italic"),children:u||"Meta description appears here..."})]})}),(a||i)&&r.jsxs("div",{className:"space-y-1.5",children:[a&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-600",children:[r.jsx(is,{className:"h-3.5 w-3.5 shrink-0"}),"Title is ",e.length," chars — Google shows ~60. Consider shortening."]}),i&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-600",children:[r.jsx(is,{className:"h-3.5 w-3.5 shrink-0"}),"Description is ",t.length," chars — Google shows ~155. Consider shortening."]})]}),r.jsxs("div",{className:"flex gap-4 text-xs text-zinc-400",children:[r.jsxs("span",{className:k(a?"text-amber-500":"text-zinc-400"),children:["Title: ",e.length,"/",60]}),r.jsxs("span",{className:k(i?"text-amber-500":"text-zinc-400"),children:["Description: ",t.length,"/",155]})]})]})}function fo({productId:e,field:t,context:n,onApply:s,className:o}){const[a,i]=l.useState(null),c=wj(),u=async()=>{i(null);const f={};n.name&&(f.name=n.name),n.current&&(f.current=n.current);const m=await c.mutateAsync({id:e,field:t,context:f});i(m.suggestion)},d=()=>{a&&(s(a),i(null))},h=()=>{i(null)};return r.jsxs("div",{className:k("space-y-2",o),"data-testid":B("product","ai-enrich",t),children:[r.jsxs(le,{type:"button",variant:"outline",size:"sm",onClick:()=>void u(),disabled:c.isPending,className:"gap-1.5 text-xs text-purple-700 border-purple-200 hover:bg-purple-50 hover:border-purple-300",children:[r.jsx(yp,{className:k("h-3.5 w-3.5",c.isPending&&"animate-spin")}),c.isPending?"Enhancing...":"Enhance with AI"]}),a&&r.jsxs("div",{className:"rounded-md border border-purple-200 bg-purple-50 p-3 space-y-2",children:[r.jsx("p",{className:"text-xs font-medium text-purple-800 uppercase tracking-wider",children:"AI Suggestion"}),r.jsx("p",{className:"text-sm text-zinc-700 whitespace-pre-wrap",children:a}),r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsxs(le,{type:"button",size:"sm",onClick:d,className:"gap-1.5 bg-purple-600 hover:bg-purple-700 text-white text-xs",children:[r.jsx(Xn,{className:"h-3.5 w-3.5"}),"Apply"]}),r.jsxs(le,{type:"button",variant:"ghost",size:"sm",onClick:h,className:"gap-1.5 text-zinc-500 text-xs",children:[r.jsx(Rr,{className:"h-3.5 w-3.5"}),"Dismiss"]})]})]})]})}const Tj={name:"",slug:"",description:"",shortDescription:"",status:"draft",type:"simple",seoTitle:"",seoDescription:"",media:[],variants:[],categoryIds:[],metadata:{}};function Aj(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function qi(){const{slug:e}=Zo(),t=jt(),n=!e||e==="new",{data:s,isLoading:o}=xj(n?"":e??""),a=gj(),i=vj(),[c,u]=l.useState(Tj),[d,h]=l.useState(!1),[f,m]=l.useState(!1),[g,v]=ca();l.useEffect(()=>{s&&u(s)},[s]);const p=(j,C)=>{h(!0),u(E=>{const S={...E,[j]:C};return j==="name"&&!f&&(S.slug=Aj(C)),S})},x=async()=>{const j=g;if(v(),n){const C=await a.mutateAsync({product:c,idempotencyKey:j});t(`/products/${C.slug}`)}else if(s){const C=new Set(s.variants.map(S=>S.id)),E={...c,variants:(c.variants??[]).filter(S=>C.has(S.id))};await i.mutateAsync({id:s.id,data:E,idempotencyKey:j}),h(!1)}},y=a.isPending||i.isPending;if(!n&&o)return r.jsxs("div",{className:"space-y-4",children:[r.jsx(ge,{className:"h-8 w-48"}),r.jsx(ge,{className:"h-96 w-full"})]});if(!n&&!s)return r.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[r.jsx(Vt,{className:"mb-3 h-8 w-8 text-zinc-300"}),r.jsx("p",{className:"text-sm text-zinc-500",children:"Product not found"}),r.jsx(Ft,{to:"/products",className:"mt-3 text-sm text-blue-600 hover:underline",children:"← Back to products"})]});const w=(s==null?void 0:s.id)??"new";return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Ft,{to:"/products",className:"flex items-center gap-1.5 text-sm text-zinc-500 hover:text-zinc-700",children:[r.jsx(oa,{className:"h-4 w-4"}),"Products"]}),r.jsx("span",{className:"text-zinc-300",children:"/"}),r.jsx("h1",{className:"text-base font-semibold text-zinc-900",children:n?"New Product":c.name||"Edit Product"}),d&&r.jsx("span",{className:"rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-medium text-amber-700",children:"Unsaved changes"})]}),r.jsx(le,{onClick:()=>void x(),disabled:y||!c.name,className:"gap-1.5","data-testid":B("product","save"),children:y?r.jsxs(r.Fragment,{children:[r.jsx(aa,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):r.jsxs(r.Fragment,{children:[r.jsx(gp,{className:"h-4 w-4"}),n?"Create Product":"Save Changes"]})})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-3",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsxs(Ha,{defaultValue:"general",children:[r.jsxs(Vs,{className:"mb-4",children:[r.jsx(Ge,{value:"general",children:"General"}),r.jsx(Ge,{value:"variants","data-testid":B("product","tab","variants"),children:"Variants"}),r.jsx(Ge,{value:"media",children:"Media"}),r.jsx(Ge,{value:"seo",children:"SEO"}),s&&r.jsx(Ge,{value:"history","data-testid":B("product","tab","history"),children:"History"})]}),r.jsx(Qe,{value:"general",className:"space-y-4",children:r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-white p-5 space-y-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(ze,{children:["Product Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(xe,{value:c.name??"",onChange:j=>p("name",j.target.value),placeholder:"e.g. Classic White T-Shirt","data-testid":B("product","name"),className:"text-base"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Slug"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-zinc-400 shrink-0",children:"/products/"}),r.jsx(xe,{value:c.slug??"",onChange:j=>{m(!0),p("slug",j.target.value)},placeholder:"classic-white-t-shirt",className:"font-mono text-sm"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{children:"Description"}),!n&&r.jsx(fo,{productId:w,field:"description",context:{...c.name?{name:c.name}:{},...c.description?{current:c.description}:{}},onApply:j=>p("description",j)})]}),r.jsx(ln,{value:c.description??"",onChange:j=>p("description",j.target.value),placeholder:"Describe this product...",rows:5})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Short Description"}),r.jsx(ln,{value:c.shortDescription??"",onChange:j=>p("shortDescription",j.target.value),placeholder:"Brief one-line description...",rows:2})]})]})}),r.jsx(Qe,{value:"variants",children:r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-white p-5",children:[r.jsx("h3",{className:"text-sm font-semibold text-zinc-900 mb-3",children:"Variants"}),r.jsx(Rj,{productId:w,variants:c.variants??[],onChange:j=>p("variants",j),currency:"GBP"})]})}),r.jsx(Qe,{value:"media",children:r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-white p-5",children:[r.jsx("h3",{className:"text-sm font-semibold text-zinc-900 mb-3",children:"Media"}),r.jsx(Pj,{media:c.media??[],onChange:j=>p("media",j)})]})}),r.jsx(Qe,{value:"seo",className:"space-y-4",children:r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-white p-5 space-y-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{children:"SEO Title"}),!n&&r.jsx(fo,{productId:w,field:"title",context:c.name?{name:c.name}:{},onApply:j=>p("seoTitle",j),className:"scale-90 origin-right"})]}),r.jsx(xe,{value:c.seoTitle??"",onChange:j=>p("seoTitle",j.target.value),placeholder:c.name??"SEO title..."})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{children:"SEO Description"}),!n&&r.jsx(fo,{productId:w,field:"seoDescription",context:{...c.name?{name:c.name}:{},...c.seoDescription?{current:c.seoDescription}:{}},onApply:j=>p("seoDescription",j),className:"scale-90 origin-right"})]}),r.jsx(ln,{value:c.seoDescription??"",onChange:j=>p("seoDescription",j.target.value),placeholder:"Meta description for search engines...",rows:3})]}),r.jsxs("div",{className:"pt-2 border-t border-zinc-100",children:[r.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-zinc-400 mb-3",children:"Preview"}),r.jsx(kj,{title:c.seoTitle||c.name||"",description:c.seoDescription||c.shortDescription||"",url:`https://yourstore.com/products/${c.slug??""}`})]})]})}),s&&r.jsx(Qe,{value:"history",children:r.jsx("div",{className:"rounded-lg border border-zinc-200 bg-white p-5",children:r.jsx(Ga,{collection:"products",id:s.id,detailPath:`/api/admin/products/${encodeURIComponent(s.id)}`})})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-white p-4 space-y-3",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-400",children:"Status"}),r.jsxs(yr,{value:c.status??"draft",onValueChange:j=>p("status",j),children:[r.jsx(Gn,{"data-testid":B("product","status"),children:r.jsx(br,{})}),r.jsxs(Qn,{children:[r.jsx(Ue,{value:"draft",children:"Draft"}),r.jsx(Ue,{value:"active",children:"Active"}),r.jsx(Ue,{value:"archived",children:"Archived"})]})]}),r.jsxs("p",{className:"text-xs text-zinc-400",children:[c.status==="draft"&&"Not visible to customers.",c.status==="active"&&"Visible and purchasable.",c.status==="archived"&&"Hidden, not purchasable."]})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-white p-4 space-y-3",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-400",children:"Product Type"}),r.jsxs(yr,{value:c.type??"simple",onValueChange:j=>p("type",j),children:[r.jsx(Gn,{children:r.jsx(br,{})}),r.jsxs(Qn,{children:[r.jsx(Ue,{value:"simple",children:"Simple"}),r.jsx(Ue,{value:"variable",children:"Variable"})]})]})]}),!n&&s&&r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-white p-4 space-y-2 text-xs text-zinc-500",children:[r.jsx("h3",{className:"font-semibold uppercase tracking-wider text-zinc-400",children:"Summary"}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Variants"}),r.jsx("span",{className:"font-medium text-zinc-700",children:s.variants.length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Total stock"}),r.jsx("span",{className:"font-mono font-medium text-zinc-700",children:s.variants.reduce((j,C)=>j+C.stock,0)})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Media"}),r.jsx("span",{className:"font-medium text-zinc-700",children:s.media.length})]})]})]})]})]})}const Mj={breadcrumb:e=>"Edit"},_j={breadcrumb:()=>"New Product"},Oj=[{value:"manual",label:"Manual"},{value:"return",label:"Return"},{value:"import",label:"Import"},{value:"sale",label:"Sale"},{value:"reservation-commit",label:"Reservation"},{value:"reservation-release",label:"Release"}];function Ij({row:e,onAdjust:t}){const[n,s]=l.useState(0),[o,a]=l.useState("manual"),[i,c]=l.useState(!1),[u,d]=ca(),h=()=>{n!==0&&(t(n,o,u),d(),s(0),c(!0),setTimeout(()=>c(!1),1500))};return r.jsxs("div",{className:"flex items-center gap-2","data-testid":B("inventory","adjust",e.variantId),children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{onClick:()=>s(f=>f-1),className:"flex h-7 w-7 items-center justify-center rounded border border-zinc-200 text-zinc-500 hover:bg-zinc-50 hover:text-zinc-700",children:r.jsx(pp,{className:"h-3 w-3"})}),r.jsx("input",{type:"number",value:n,onChange:f=>s(parseInt(f.target.value)||0),className:k("h-7 w-16 rounded border text-center text-sm font-mono focus:outline-none focus:ring-1 focus:ring-blue-500",n>0&&"border-green-300 text-green-700 bg-green-50",n<0&&"border-red-300 text-red-700 bg-red-50",n===0&&"border-zinc-200")}),r.jsx("button",{onClick:()=>s(f=>f+1),className:"flex h-7 w-7 items-center justify-center rounded border border-zinc-200 text-zinc-500 hover:bg-zinc-50 hover:text-zinc-700",children:r.jsx(pr,{className:"h-3 w-3"})})]}),r.jsxs(yr,{value:o,onValueChange:f=>a(f),children:[r.jsx(Gn,{className:"h-7 w-28 text-xs",children:r.jsx(br,{})}),r.jsx(Qn,{children:Oj.map(f=>r.jsx(Ue,{value:f.value,children:f.label},f.value))})]}),r.jsx(le,{size:"sm",variant:i?"secondary":"default",className:"h-7 px-2 text-xs gap-1",onClick:h,disabled:n===0||i,children:i?r.jsxs(r.Fragment,{children:[r.jsx(Xn,{className:"h-3 w-3 text-green-600"}),r.jsx("span",{className:"text-green-600",children:"Done"})]}):"Apply"})]})}const Dj=Ea,zj=Ra,Of=l.forwardRef(({className:e,...t},n)=>r.jsx(Ts,{className:k("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));Of.displayName="SheetOverlay";const Lj=ys("fixed z-50 gap-4 bg-white p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-lg"}},defaultVariants:{side:"right"}}),If=l.forwardRef(({side:e="right",className:t,children:n,...s},o)=>r.jsxs(zj,{children:[r.jsx(Of,{}),r.jsxs(As,{ref:o,className:k(Lj({side:e}),"border-zinc-200",t),...s,children:[n,r.jsxs(sd,{className:"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:pointer-events-none",children:[r.jsx(Rr,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));If.displayName="SheetContent";const Df=({className:e,...t})=>r.jsx("div",{className:k("flex flex-col space-y-2 text-left",e),...t});Df.displayName="SheetHeader";const zf=l.forwardRef(({className:e,...t},n)=>r.jsx(Pa,{ref:n,className:k("text-lg font-semibold text-zinc-900",e),...t}));zf.displayName="SheetTitle";const Fj=l.forwardRef(({className:e,...t},n)=>r.jsx(ka,{ref:n,className:k("text-sm text-zinc-500",e),...t}));Fj.displayName="SheetDescription";function $j(e={}){return Pe({queryKey:["inventory","list",e],queryFn:()=>se.get("/api/admin/inventory",e)})}function Uj(e){return Pe({queryKey:["inventory","history",e],queryFn:()=>se.get(`/api/admin/inventory/${e}/history`),enabled:!!e})}function Vj(){const e=be();return Ne({mutationFn:({variantId:t,delta:n,reason:s,idempotencyKey:o})=>se.post(`/api/admin/inventory/${t}/adjust`,{delta:n,reason:s},o===void 0?void 0:{idempotencyKey:o}),onMutate:async({variantId:t,delta:n})=>{await e.cancelQueries({queryKey:["inventory","list"]});const s=e.getQueryData(["inventory","list",{}]);return s&&e.setQueryData(["inventory","list",{}],s.map(o=>o.variantId===t?{...o,stock:Math.max(0,o.stock+n)}:o)),{previousData:s}},onError:(t,n,s)=>{s!=null&&s.previousData&&e.setQueryData(["inventory","list",{}],s.previousData)},onSuccess:()=>{e.invalidateQueries({queryKey:["inventory"]})}})}function Bj({variantId:e,productName:t,sku:n,onClose:s}){const{data:o,isLoading:a}=Uj(e);return r.jsx(Dj,{open:!0,onOpenChange:i=>!i&&s(),children:r.jsxs(If,{className:"w-[480px] sm:max-w-[480px] overflow-y-auto",children:[r.jsxs(Df,{children:[r.jsx(zf,{children:"Stock History"}),r.jsxs("div",{className:"mt-1",children:[r.jsx("p",{className:"text-sm font-medium text-zinc-700",children:t}),r.jsx("p",{className:"font-mono text-xs text-zinc-400",children:n})]})]}),r.jsx("div",{className:"mt-6",children:a?r.jsx("div",{className:"space-y-3",children:Array.from({length:5}).map((i,c)=>r.jsx(ge,{className:"h-12 w-full"},c))}):!o||o.length===0?r.jsx("p",{className:"text-sm text-zinc-400 text-center py-8",children:"No adjustment history found."}):r.jsx("div",{className:"rounded-md border border-zinc-200 overflow-hidden",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{className:"bg-zinc-50 border-b border-zinc-200",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium uppercase tracking-wider text-zinc-500",children:"Date"}),r.jsx("th",{className:"px-3 py-2 text-right text-xs font-medium uppercase tracking-wider text-zinc-500",children:"Adj"}),r.jsx("th",{className:"px-3 py-2 text-right text-xs font-medium uppercase tracking-wider text-zinc-500",children:"New Qty"}),r.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium uppercase tracking-wider text-zinc-500",children:"Reason"}),r.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium uppercase tracking-wider text-zinc-500",children:"Actor"})]})}),r.jsx("tbody",{children:o.map(i=>r.jsxs("tr",{className:"border-b border-zinc-100 last:border-0",children:[r.jsx("td",{className:"px-3 py-2 text-xs text-zinc-500 whitespace-nowrap",children:Ke(i.timestamp)}),r.jsxs("td",{className:k("px-3 py-2 text-right font-mono text-sm font-medium",i.adjustment>0?"text-green-600":"text-red-600"),children:[i.adjustment>0?"+":"",i.adjustment]}),r.jsx("td",{className:"px-3 py-2 text-right font-mono text-sm text-zinc-700",children:i.newQty}),r.jsx("td",{className:"px-3 py-2 text-xs text-zinc-500 capitalize",children:i.reason.replace(/-/g," ")}),r.jsx("td",{className:"px-3 py-2 text-xs text-zinc-500",children:i.actor})]},i.id))})]})})})]})})}const Kj={in_stock:"success",low_stock:"warning",out_of_stock:"destructive"},Hi={in_stock:"In Stock",low_stock:"Low Stock",out_of_stock:"Out of Stock"};function qj(){const[e,t]=l.useState(""),[n,s]=l.useState("all"),[o,a]=l.useState(null),{data:i,isLoading:c}=$j({q:e||void 0,status:n==="all"?void 0:n,sort:"urgency",limit:200}),u=Vj(),d=f=>(m,g,v)=>{u.mutateAsync({variantId:f,delta:m,reason:g,idempotencyKey:v})},h=f=>f==="out_of_stock"?"border-l-4 border-l-red-300":f==="low_stock"?"border-l-4 border-l-amber-300":"";return r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-lg font-semibold text-zinc-900",children:"Inventory"}),r.jsx("p",{className:"text-sm text-zinc-500",children:i?`${i.length} variants`:"Loading..."})]})}),r.jsxs("div",{className:"flex gap-3 items-center",children:[r.jsx("div",{className:"flex gap-1.5",children:["all","out_of_stock","low_stock","in_stock"].map(f=>r.jsx("button",{onClick:()=>s(f),className:k("rounded-full px-3 py-1 text-xs font-medium transition-colors",n===f?"bg-zinc-900 text-white":"bg-zinc-100 text-zinc-600 hover:bg-zinc-200"),children:f==="all"?"All":Hi[f]},f))}),r.jsxs("div",{className:"relative ml-auto max-w-xs flex-1",children:[r.jsx(Zn,{className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-zinc-400"}),r.jsx(xe,{placeholder:"Search SKU or product...",value:e,onChange:f=>t(f.target.value),className:"pl-9 h-8 text-sm"})]})]}),r.jsx("div",{className:"rounded-lg border border-zinc-200 bg-white overflow-hidden",children:c?r.jsx("div",{className:"p-4 space-y-2",children:Array.from({length:8}).map((f,m)=>r.jsx(ge,{className:"h-11 w-full"},m))}):i!=null&&i.length?r.jsxs(vn,{children:[r.jsx(yn,{children:r.jsxs(Fe,{children:[r.jsx(te,{children:"Product"}),r.jsx(te,{children:"SKU / Options"}),r.jsx(te,{className:"text-right",children:"Stock"}),r.jsx(te,{className:"text-right",children:"Threshold"}),r.jsx(te,{children:"Status"}),r.jsx(te,{children:"Adjust"}),r.jsx(te,{className:"text-right",children:"History"})]})}),r.jsx(bn,{children:i.map(f=>r.jsxs(Fe,{"data-testid":B("inventory","row",f.variantId),className:k("transition-colors",h(f.status)),children:[r.jsx(ne,{children:r.jsx("p",{className:"font-medium text-zinc-800 text-sm",children:f.productName})}),r.jsx(ne,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-mono text-xs text-zinc-500",children:f.sku}),f.options.length>0&&r.jsx("p",{className:"text-[10px] text-zinc-400",children:f.options.map(m=>`${m.name}: ${m.value}`).join(" · ")})]})}),r.jsx(ne,{className:k("text-right font-mono text-base font-semibold",f.status==="out_of_stock"?"text-red-600":f.status==="low_stock"?"text-amber-600":"text-zinc-800"),children:f.stock}),r.jsx(ne,{className:"text-right font-mono text-sm text-zinc-400",children:f.threshold}),r.jsx(ne,{children:r.jsx(_f,{variant:Kj[f.status],className:"text-[10px]",children:Hi[f.status]})}),r.jsx(ne,{children:r.jsx(Ij,{row:f,onAdjust:d(f.variantId)})}),r.jsx(ne,{className:"text-right",children:r.jsxs("button",{onClick:()=>a(f),className:"flex items-center gap-1.5 text-xs text-blue-600 hover:text-blue-700 font-medium ml-auto",children:[r.jsx(Bn,{className:"h-3.5 w-3.5"}),"History"]})})]},f.variantId))})]}):r.jsx(ct,{icon:r.jsx(Tc,{className:"h-5 w-5"}),title:"No inventory found",description:"No variants match your filters."})}),o&&r.jsx(Bj,{variantId:o.variantId,productName:o.productName,sku:o.sku,onClose:()=>a(null)})]})}const Hj={breadcrumb:()=>"Inventory"};function Wj(e={}){return Pe({queryKey:["customers","list",e],queryFn:async()=>(await se.get("/api/admin/customers",e)).customers})}function Gj(e){return Pe({queryKey:["customers","detail",e],queryFn:()=>se.get(`/api/admin/customers/${e}`),enabled:!!e})}function Qj(e){return Pe({queryKey:["customers","orders",e],queryFn:async()=>(await se.get(`/api/admin/customers/${e}/orders`)).orders,enabled:!!e})}function Yj(){const e=be();return Ne({mutationFn:({customerId:t,body:n})=>se.post(`/api/admin/customers/${t}/notes`,{body:n}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["customers","detail",n.customerId]})}})}function Xj(){const e=jt(),[t,n]=l.useState(""),{data:s,isLoading:o}=Wj({q:t||void 0,limit:100});return r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-lg font-semibold text-zinc-900",children:"Customers"}),r.jsx("p",{className:"text-sm text-zinc-500",children:s?`${s.length} customers`:"Loading..."})]})}),r.jsxs("div",{className:"relative max-w-sm",children:[r.jsx(Zn,{className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-zinc-400"}),r.jsx(xe,{placeholder:"Search by name or email...",value:t,onChange:a=>n(a.target.value),className:"pl-9 h-8 text-sm"})]}),r.jsx("div",{className:"rounded-lg border border-zinc-200 bg-white overflow-hidden",children:o?r.jsx("div",{className:"p-4 space-y-2",children:Array.from({length:8}).map((a,i)=>r.jsx(ge,{className:"h-11 w-full"},i))}):s!=null&&s.length?r.jsxs(vn,{children:[r.jsx(yn,{children:r.jsxs(Fe,{children:[r.jsx(te,{children:"Customer"}),r.jsx(te,{className:"text-right",children:"Orders"}),r.jsx(te,{className:"text-right",children:"Total Spent"}),r.jsx(te,{children:"Since"}),r.jsx(te,{className:"text-right",children:"Last Order"})]})}),r.jsx(bn,{children:s.map(a=>{var c;const i=[a.firstName,a.lastName].filter(Boolean).join(" ");return r.jsxs(Fe,{"data-testid":B("customers","row",a.id),className:"cursor-pointer",onClick:()=>e(`/customers/${a.id}`),children:[r.jsx(ne,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-zinc-100 text-xs font-semibold text-zinc-600",children:(((c=a.firstName)==null?void 0:c[0])??a.email[0]??"?").toUpperCase()}),r.jsxs("div",{children:[i&&r.jsx("p",{className:"text-sm font-medium text-zinc-800",children:i}),r.jsx("p",{className:"text-xs text-zinc-500",children:a.email})]})]})}),r.jsx(ne,{className:"text-right font-mono text-sm text-zinc-700",children:a.orderCount}),r.jsx(ne,{className:"text-right font-mono text-sm text-zinc-700",children:pe(a.totalSpentMinor,"GBP")}),r.jsx(ne,{className:"text-sm text-zinc-500",children:Ke(a.createdAt)}),r.jsx(ne,{className:"text-right text-sm text-zinc-400",children:a.orderCount>0?ut(a.updatedAt):"—"})]},a.id)})})]}):r.jsx(ct,{icon:r.jsx(ia,{className:"h-5 w-5"}),title:"No customers found",description:t?"Try a different search.":"Customers will appear as orders are placed."})})]})}const Zj={breadcrumb:()=>"Customers"};function Jj({customer:e,stats:t}){var s;const n=[e.firstName,e.lastName].filter(Boolean).join(" ")||e.email;return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-zinc-200 text-lg font-semibold text-zinc-600",children:(((s=e.firstName)==null?void 0:s[0])??e.email[0]??"?").toUpperCase()}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h2",{className:"text-base font-semibold text-zinc-900 truncate",children:n}),r.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-3 text-sm text-zinc-500",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx(Oc,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"min-w-0 [overflow-wrap:anywhere]",children:e.email})]}),e.phone&&r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(xp,{className:"h-3.5 w-3.5"}),e.phone]})]}),r.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-xs text-zinc-400",children:[r.jsx(Xm,{className:"h-3 w-3"}),"Customer since ",Ke(e.createdAt)]})]}),e.requiresPasswordReset&&r.jsx("span",{className:"shrink-0 rounded-full bg-amber-100 px-2.5 py-0.5 text-xs font-medium text-amber-700",children:"Needs reset"})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[r.jsx(ho,{icon:r.jsx(Kn,{className:"h-4 w-4 text-blue-500"}),label:"Total Orders",value:String(t.orderCount)}),r.jsx(ho,{icon:r.jsx(Ao,{className:"h-4 w-4 text-green-500"}),label:"Lifetime Value",value:pe(t.lifetimeRevenueMinor,"GBP"),mono:!0}),r.jsx(ho,{icon:r.jsx(Ao,{className:"h-4 w-4 text-indigo-500"}),label:"Avg Order",value:pe(t.avgOrderValueMinor,"GBP"),mono:!0})]}),t.lastOrderAt&&r.jsxs("p",{className:"text-xs text-zinc-400",children:["Last order: ",ut(t.lastOrderAt)]})]})}function ho({icon:e,label:t,value:n,mono:s}){return r.jsxs("div",{className:"rounded-md border border-zinc-200 bg-white p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e,r.jsx("span",{className:"text-xs text-zinc-500",children:t})]}),r.jsx("p",{className:`text-base font-semibold text-zinc-900 ${s?"font-mono":""}`,children:n})]})}function eN({orders:e,isLoading:t}){const n=jt();return t?r.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((s,o)=>r.jsx(ge,{className:"h-11 w-full"},o))}):!e||e.length===0?r.jsx(ct,{icon:r.jsx(Kn,{className:"h-5 w-5"}),title:"No orders",description:"This customer hasn't placed any orders yet."}):r.jsx("div",{className:"rounded-md border border-zinc-200 overflow-hidden",children:r.jsxs(vn,{children:[r.jsx(yn,{children:r.jsxs(Fe,{children:[r.jsx(te,{children:"Order #"}),r.jsx(te,{children:"Status"}),r.jsx(te,{children:"Items"}),r.jsx(te,{className:"text-right",children:"Total"}),r.jsx(te,{className:"text-right",children:"Date"})]})}),r.jsx(bn,{children:e.map(s=>r.jsxs(Fe,{className:"cursor-pointer",onClick:()=>n(`/orders/${s.orderNumber}`),children:[r.jsxs(ne,{className:"font-mono text-sm font-medium text-blue-600",children:["#",s.orderNumber]}),r.jsx(ne,{children:r.jsx(Wn,{status:s.status})}),r.jsxs(ne,{className:"text-zinc-500",children:[s.lineItems.length," item",s.lineItems.length!==1?"s":""]}),r.jsx(ne,{className:"text-right font-mono text-sm",children:pe(s.totalMinor,s.currency)}),r.jsx(ne,{className:"text-right text-sm text-zinc-500",children:ut(s.createdAt)})]},s.id))})]})})}function tN({notes:e}){return r.jsx("div",{className:"space-y-2",children:e.length===0?r.jsx("p",{className:"text-sm text-zinc-400 italic",children:"No notes yet."}):[...e].sort((t,n)=>new Date(n.at).getTime()-new Date(t.at).getTime()).map((t,n)=>r.jsxs("div",{className:"rounded-md border border-zinc-200 bg-zinc-50 p-3",children:[r.jsx("p",{className:"text-sm text-zinc-700 whitespace-pre-wrap",children:t.body}),r.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-xs text-zinc-400",children:[r.jsx("span",{className:"font-medium text-zinc-500",children:t.actor}),r.jsx("span",{children:"·"}),r.jsx("time",{dateTime:t.at,title:Ke(t.at),children:ut(t.at)})]})]},n))})}function nN(){const{id:e}=Zo(),[t,n]=l.useState(""),s=l.useRef(!1),[o,a]=l.useState(!1),{data:i,isLoading:c}=Gj(e??""),{data:u,isLoading:d}=Qj(e??""),h=Yj(),f=async x=>{if(x.preventDefault(),!(!t.trim()||!e||s.current)){s.current=!0,a(!0);try{await h.mutateAsync({customerId:e,body:t.trim()}),n("")}finally{s.current=!1,a(!1)}}};if(c)return r.jsxs("div",{className:"space-y-4",children:[r.jsx(ge,{className:"h-8 w-32"}),r.jsx(ge,{className:"h-32 w-full"}),r.jsx(ge,{className:"h-48 w-full"})]});if(!i)return r.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[r.jsx("p",{className:"text-sm text-zinc-500",children:"Customer not found"}),r.jsx(Ft,{to:"/customers",className:"mt-3 text-sm text-blue-600 hover:underline",children:"← Back to customers"})]});const{customer:m,stats:g}=i,v=[m.firstName,m.lastName].filter(Boolean).join(" ")||m.email,p=m.metadata.adminNotes??[];return r.jsxs("div",{className:"space-y-5","data-testid":B("customer","detail"),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Ft,{to:"/customers",className:"flex items-center gap-1.5 text-sm text-zinc-500 hover:text-zinc-700",children:[r.jsx(oa,{className:"h-4 w-4"}),"Customers"]}),r.jsx("span",{className:"text-zinc-300",children:"/"}),r.jsx("span",{className:"min-w-0 text-sm font-medium text-zinc-900 [overflow-wrap:anywhere]",children:v})]}),r.jsxs(Ha,{defaultValue:"overview",children:[r.jsxs(Vs,{children:[r.jsx(Ge,{value:"overview","data-testid":B("customer","tab","overview"),children:"Overview"}),r.jsx(Ge,{value:"history","data-testid":B("customer","tab","history"),children:"History"})]}),r.jsxs(Qe,{value:"overview",className:"space-y-5",children:[r.jsx("div",{className:"rounded-lg border border-zinc-200 bg-white p-5",children:r.jsx(Jj,{customer:m,stats:g})}),r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-white overflow-hidden",children:[r.jsx("div",{className:"border-b border-zinc-100 px-4 py-3",children:r.jsx("h2",{className:"text-sm font-semibold text-zinc-900",children:"Order History"})}),r.jsx("div",{className:"p-4",children:r.jsx(eN,{orders:u,isLoading:d})})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-white p-5 space-y-3","data-testid":B("customer","notes"),children:[r.jsx("h2",{className:"text-sm font-semibold text-zinc-900",children:"Notes"}),r.jsx(tN,{notes:p}),r.jsxs("form",{onSubmit:x=>void f(x),className:"flex gap-2 pt-2",children:[r.jsx(ln,{placeholder:"Add a note about this customer...",value:t,onChange:x=>n(x.target.value),rows:2,className:"flex-1 text-sm"}),r.jsx(le,{type:"submit",size:"icon",disabled:!t.trim()||o,className:"self-end h-9 w-9",children:r.jsx(Ic,{className:"h-4 w-4"})})]})]})]}),r.jsx(Qe,{value:"history",children:r.jsx("div",{className:"rounded-lg border border-zinc-200 bg-white p-5",children:r.jsx(Ga,{collection:"customers",id:m.id,detailPath:`/api/admin/customers/${encodeURIComponent(m.id)}`})})})]})]})}const rN={breadcrumb:e=>"Customer"},Lf=(e,t)=>`/api/admin/settings/${encodeURIComponent(e)}/${encodeURIComponent(t)}`;function sN(){return Pe({queryKey:["settings"],queryFn:()=>se.get("/api/admin/settings")})}function oN(){const e=be();return Ne({mutationFn:({slot:t,path:n,value:s})=>se.put(Lf(t,n),{value:s}),onSuccess:()=>e.invalidateQueries({queryKey:["settings"]})})}function aN(){const e=be();return Ne({mutationFn:({slot:t,path:n})=>se.delete(Lf(t,n)),onSuccess:()=>e.invalidateQueries({queryKey:["settings"]})})}const iN={payments:"Payments",email:"Email",reviews:"Reviews",search:"Search",analytics:"Analytics",shipping:"Shipping",tax:"Tax",ai:"AI"},cN=(e,t)=>`${e}-${t}`;function lN(e){return e.source==="config"||e.source==="env"?"Set by environment":e.secret?e.state==="set"?"Set":"Not set":e.state==="set"?String(e.value??""):"Not set"}function dN({slot:e,field:t,onSaved:n}){const s=l.useRef(null),o=oN(),a=aN(),[i,c]=l.useState(null),u=l.useRef(!1),d=cN(e,t.path),h=t.source==="config"||t.source==="env",f=async()=>{var v;const g=((v=s.current)==null?void 0:v.value)??"";if(!(g===""||u.current)){u.current=!0,c(null);try{await o.mutateAsync({slot:e,path:t.path,value:g}),s.current&&(s.current.value=""),n()}catch(p){c(p instanceof un?p.message:"The value was not saved")}finally{u.current=!1}}},m=async()=>{c(null);try{await a.mutateAsync({slot:e,path:t.path}),n()}catch(g){c(g instanceof un?g.message:"The value was not cleared")}};return r.jsxs("div",{"data-testid":`settings-field-${d}`,className:"flex flex-col gap-2 border-b border-zinc-100 py-3 last:border-b-0 sm:flex-row sm:items-center",children:[r.jsxs("div",{className:"min-w-0 sm:w-56",children:[r.jsx("label",{htmlFor:`settings-input-${d}`,className:"text-sm font-medium text-zinc-900",children:t.label}),r.jsx("p",{className:"font-mono text-[11px] text-zinc-500",children:t.path})]}),r.jsx("span",{"data-testid":`settings-state-${d}`,className:"min-w-0 truncate text-sm text-zinc-600 sm:w-44",children:lN(t)}),!h&&r.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xe,{ref:s,id:`settings-input-${d}`,"data-testid":`settings-input-${d}`,type:t.secret?"password":"text",autoComplete:"off",spellCheck:!1,placeholder:t.secret&&t.state==="set"?"Enter a new value":""}),r.jsx(le,{type:"button",size:"sm",className:"h-9","data-testid":`settings-save-${d}`,disabled:o.isPending,onClick:()=>void f(),children:"Save"}),t.source==="settings"&&r.jsx(le,{type:"button",size:"sm",variant:"outline",className:"h-9","data-testid":`settings-clear-${d}`,disabled:a.isPending,onClick:()=>void m(),children:"Clear"})]}),i!==null&&r.jsx("p",{role:"alert",className:"text-xs text-red-600",children:i})]})]})}function uN({slot:e,onSaved:t}){return r.jsxs("section",{className:"rounded-lg border border-zinc-200 bg-white px-4",children:[r.jsxs("header",{className:"flex items-baseline gap-2 border-b border-zinc-100 py-3",children:[r.jsx("h2",{className:"text-sm font-semibold text-zinc-900",children:iN[e.slot]??e.slot}),r.jsx("span",{className:"text-xs text-zinc-500",children:e.provider})]}),e.fields.map(n=>r.jsx(dN,{slot:e.slot,field:n,onSaved:t},n.path))]})}function fN(){const{data:e,isLoading:t}=sN(),[n,s]=l.useState(!1);return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-lg font-semibold text-zinc-900",children:"Settings"}),r.jsx("p",{className:"text-sm text-zinc-500",children:"Keys and credentials for the services this store uses. The config and environment always win."})]}),n&&r.jsx("p",{"data-testid":"settings-restart-note",role:"status",className:"rounded-md border border-blue-200 bg-blue-50 px-3 py-2 text-sm text-blue-800",children:"Saved. Restart the store to apply."}),t?r.jsx(ge,{className:"h-40 w-full"}):e===void 0||e.slots.length===0?r.jsx(ct,{icon:r.jsx(dp,{className:"h-5 w-5"}),title:"Nothing to set here",description:"None of this store's providers takes keys from Settings."}):e.slots.map(o=>r.jsx(uN,{slot:o,onSaved:()=>s(!0)},o.slot))]})}const hN={breadcrumb:()=>"Settings"},mN=100;function pN(e){return Cc({queryKey:["activity",e],initialPageParam:void 0,queryFn:({pageParam:t})=>se.getPage("/api/admin/activity",{...e,limit:mN,cursor:t}),getNextPageParam:t=>{var s;const n=(s=t.meta)==null?void 0:s.nextCursor;return typeof n=="string"&&n!==""?n:void 0}})}function xN(e){return se.getText("/api/admin/activity/export",e)}const gN={applied:"bg-green-50 text-green-700",refused:"bg-red-50 text-red-700",replayed:"bg-zinc-100 text-zinc-600"};function Wi(e){if(e==="")return;const t=new Date(e);return Number.isNaN(t.getTime())?void 0:t.toISOString()}function vN(e){const t={};for(const o of["actor","command","subject","correlation","outcome"]){const a=e[o].trim();a!==""&&(t[o]=a)}const n=Wi(e.since),s=Wi(e.until);return n!==void 0&&(t.since=n),s!==void 0&&(t.until=s),t}function yN(e){const t=URL.createObjectURL(new Blob([e],{type:"application/x-ndjson"})),n=document.createElement("a");n.href=t,n.download=`activity-${new Date().toISOString().slice(0,10)}.ndjson`,document.body.appendChild(n),n.click(),n.remove(),URL.revokeObjectURL(t)}const bN={actor:"",command:"",subject:"",correlation:"",outcome:"",since:"",until:""};function wN(){const[e,t]=l.useState(bN),[n,s]=l.useState(!1),[o,a]=l.useState(null),i=vN(e),{data:c,isLoading:u,isError:d,fetchNextPage:h,hasNextPage:f,isFetchingNextPage:m}=pN(i),g=(c==null?void 0:c.pages.flatMap(x=>x.data))??[],v=x=>y=>t(w=>({...w,[x]:y})),p=async()=>{s(!0),a(null);try{const{since:x,until:y,correlation:w}=i;yN(await xN({...x!==void 0&&{since:x},...y!==void 0&&{until:y},...w!==void 0&&{correlation:w}}))}catch(x){a(x instanceof Error?x.message:String(x))}finally{s(!1)}};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-lg font-semibold text-zinc-900",children:"Activity"}),r.jsx("p",{className:"text-sm text-zinc-500",children:"Who changed what, newest first. The export covers the time and correlation filters."})]}),r.jsxs(le,{variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>void p(),disabled:n,"data-testid":"activity-export",children:[n?r.jsx(aa,{className:"h-3.5 w-3.5 animate-spin"}):r.jsx(ap,{className:"h-3.5 w-3.5"}),"Export"]})]}),o&&r.jsxs("p",{className:"text-sm text-red-600",children:["Export failed: ",o]}),r.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4",children:[r.jsx(xe,{placeholder:"Actor (admin:<id>, system, …)",value:e.actor,onChange:x=>v("actor")(x.target.value),className:"h-8 text-sm","aria-label":"Actor","data-testid":"activity-filter-actor"}),r.jsx(xe,{placeholder:"Command (inventory.adjust, …)",value:e.command,onChange:x=>v("command")(x.target.value),className:"h-8 text-sm","aria-label":"Command","data-testid":"activity-filter-command"}),r.jsx(xe,{placeholder:"Subject id",value:e.subject,onChange:x=>v("subject")(x.target.value),className:"h-8 text-sm","aria-label":"Subject","data-testid":"activity-filter-subject"}),r.jsx(xe,{placeholder:"Correlation id",value:e.correlation,onChange:x=>v("correlation")(x.target.value),className:"h-8 text-sm","aria-label":"Correlation id","data-testid":"activity-filter-correlation"}),r.jsxs("select",{value:e.outcome,onChange:x=>v("outcome")(x.target.value),className:"h-8 rounded-md border border-zinc-200 bg-white px-2 text-sm","aria-label":"Outcome","data-testid":"activity-filter-outcome",children:[r.jsx("option",{value:"",children:"Any outcome"}),r.jsx("option",{value:"applied",children:"Applied"}),r.jsx("option",{value:"refused",children:"Refused"}),r.jsx("option",{value:"replayed",children:"Replayed"})]}),r.jsx(xe,{type:"datetime-local",value:e.since,onChange:x=>v("since")(x.target.value),className:"h-8 text-sm","aria-label":"From","data-testid":"activity-filter-since"}),r.jsx(xe,{type:"datetime-local",value:e.until,onChange:x=>v("until")(x.target.value),className:"h-8 text-sm","aria-label":"Until","data-testid":"activity-filter-until"})]}),r.jsx("div",{className:"rounded-lg border border-zinc-200 bg-white overflow-x-auto",children:u?r.jsx("div",{className:"p-4 space-y-2",children:Array.from({length:8}).map((x,y)=>r.jsx(ge,{className:"h-11 w-full"},y))}):d?r.jsx(ct,{icon:r.jsx(Bn,{className:"h-5 w-5"}),title:"Activity could not be loaded"}):g.length===0?r.jsx(ct,{icon:r.jsx(Bn,{className:"h-5 w-5"}),title:"No activity found",description:"Changes to the store appear here as they are made."}):r.jsxs(vn,{children:[r.jsx(yn,{children:r.jsxs(Fe,{children:[r.jsx(te,{children:"Time"}),r.jsx(te,{children:"Actor"}),r.jsx(te,{children:"Command"}),r.jsx(te,{children:"Subjects"}),r.jsx(te,{children:"Outcome"}),r.jsx(te,{children:"Correlation id"})]})}),r.jsx(bn,{children:g.map(x=>r.jsxs(Fe,{"data-testid":`activity-row-${x.id}`,children:[r.jsx(ne,{className:"whitespace-nowrap text-xs text-zinc-500",children:Ke(x.at)}),r.jsxs(ne,{className:"font-mono text-xs",children:[x.actor.kind,":",x.actor.id]}),r.jsx(ne,{className:"font-mono text-xs",children:x.command}),r.jsx(ne,{className:"font-mono text-xs text-zinc-600",children:x.subjects.map(y=>r.jsxs("div",{children:[y.type,":",y.id]},`${y.type}:${y.id}`))}),r.jsx(ne,{children:r.jsxs("span",{className:k("rounded-full px-2 py-0.5 text-[11px] font-medium",gN[x.outcome]),children:[x.outcome,x.responseStatus!==null&&` ${x.responseStatus}`]})}),r.jsx(ne,{className:"font-mono text-xs text-zinc-500",children:x.correlationId??""})]},x.id))})]})}),f&&r.jsx(le,{variant:"outline",size:"sm",onClick:()=>void h(),disabled:m,children:m?"Loading…":"Load more"})]})}const jN={breadcrumb:()=>"Activity"};function NN(){const e=jt();return r.jsxs("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:[r.jsx("p",{className:"font-mono text-5xl font-bold text-zinc-200",children:"404"}),r.jsx("h2",{className:"mt-3 text-base font-semibold text-zinc-700",children:"Page not found"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"The page you're looking for doesn't exist."}),r.jsx("div",{className:"mt-6",children:r.jsx(le,{variant:"outline",onClick:()=>e("/"),children:"Go to Dashboard"})})]})}let Gi=null;async function CN(){return as()?null:(Gi??(Gi=qm()),await Gi,as()?null:Wf("/login"))}const Ff=Hf([{path:"/login",element:r.jsx(wy,{})},{path:"/",element:r.jsx(gy,{}),loader:CN,handle:{breadcrumb:()=>null},children:[{index:!0,element:r.jsx(ky,{}),handle:{breadcrumb:()=>"Dashboard"}},{path:"orders",handle:dw,children:[{index:!0,element:r.jsx(lw,{})},{path:":orderNumber",element:r.jsx(fj,{}),handle:hj}]},{path:"products",handle:Sj,children:[{index:!0,element:r.jsx(Cj,{})},{path:"new",element:r.jsx(qi,{}),handle:_j},{path:":slug",element:r.jsx(qi,{}),handle:Mj}]},{path:"inventory",element:r.jsx(qj,{}),handle:Hj},{path:"customers",handle:Zj,children:[{index:!0,element:r.jsx(Xj,{})},{path:":id",element:r.jsx(nN,{}),handle:rN}]},{path:"activity",element:r.jsx(wN,{}),handle:jN},{path:"settings",element:r.jsx(fN,{}),handle:hN},{path:"*",element:r.jsx(NN,{})}]}],{basename:"/admin"});Um(()=>{os.clear(),Ff.navigate("/login")});const $f=document.getElementById("root");if(!$f)throw new Error("Root element not found");cc($f).render(r.jsx(l.StrictMode,{children:r.jsx(Rh,{client:os,children:r.jsx(Gf,{router:Ff})})}));
|