@wakastellar/ui 0.2.0 → 0.3.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/dist/blocks/activity-timeline/index.d.ts +73 -0
- package/dist/blocks/calendar-view/index.d.ts +56 -0
- package/dist/blocks/chat/index.d.ts +87 -0
- package/dist/blocks/dashboard/index.d.ts +92 -0
- package/dist/blocks/empty-states/index.d.ts +44 -0
- package/dist/blocks/error-pages/index.d.ts +52 -0
- package/dist/blocks/faq/index.d.ts +54 -0
- package/dist/blocks/file-manager/index.d.ts +81 -0
- package/dist/blocks/header/index.d.ts +86 -0
- package/dist/blocks/index.d.ts +34 -0
- package/dist/blocks/kanban-board/index.d.ts +77 -0
- package/dist/blocks/landing/index.d.ts +101 -0
- package/dist/blocks/pricing/index.d.ts +60 -0
- package/dist/blocks/profile/index.d.ts +98 -0
- package/dist/blocks/settings/index.d.ts +62 -0
- package/dist/blocks/theme-creator-block/index.d.ts +86 -0
- package/dist/blocks/user-management/index.d.ts +95 -0
- package/dist/blocks/wizard/index.d.ts +88 -0
- package/dist/charts.cjs.js +1 -0
- package/dist/charts.d.ts +17 -0
- package/dist/charts.es.js +16 -0
- package/dist/cn-CAc3sAGM.js +21 -0
- package/dist/cn-zrNBeCrC.js +1 -0
- package/dist/components/DataTable/DataTableBody.d.ts +3 -1
- package/dist/components/DataTable/DataTableHeader.d.ts +3 -1
- package/dist/components/index.d.ts +19 -0
- package/dist/components/language-selector/index.d.ts +19 -1
- package/dist/components/waka-barcode/index.d.ts +27 -0
- package/dist/components/waka-breadcrumb/index.d.ts +43 -0
- package/dist/components/waka-combobox/index.d.ts +81 -0
- package/dist/components/waka-date-range-picker/index.d.ts +68 -0
- package/dist/components/waka-drawer/index.d.ts +59 -0
- package/dist/components/waka-image/index.d.ts +57 -0
- package/dist/components/waka-kanban/index.d.ts +68 -0
- package/dist/components/waka-modal/index.d.ts +82 -0
- package/dist/components/waka-number-input/index.d.ts +60 -0
- package/dist/components/waka-pagination/index.d.ts +67 -0
- package/dist/components/waka-qrcode/index.d.ts +32 -0
- package/dist/components/waka-segmented-control/index.d.ts +42 -0
- package/dist/components/waka-spinner/index.d.ts +57 -21
- package/dist/components/waka-stat/index.d.ts +57 -0
- package/dist/components/waka-stepper/index.d.ts +76 -0
- package/dist/components/waka-theme-creator/index.d.ts +73 -22
- package/dist/components/waka-time-picker/index.d.ts +51 -0
- package/dist/components/waka-timeline/index.d.ts +46 -0
- package/dist/components/waka-tree/index.d.ts +67 -0
- package/dist/components/waka-video/index.d.ts +66 -0
- package/dist/components/waka-virtual-list/index.d.ts +54 -0
- package/dist/export.cjs.js +1 -0
- package/dist/export.d.ts +28 -0
- package/dist/export.es.js +5 -0
- package/dist/index-CENPre_9.js +466 -0
- package/dist/index-CHLjUBPo.js +1 -0
- package/dist/index.cjs.js +54 -155
- package/dist/index.es.js +20832 -11710
- package/dist/rich-text.cjs.js +1 -0
- package/dist/rich-text.d.ts +21 -0
- package/dist/rich-text.es.js +4 -0
- package/dist/types-Bjy1Hy76.js +1111 -0
- package/dist/types-CHv7a1SP.js +1 -0
- package/dist/useDataTableImport-DqeEL4GC.js +124 -0
- package/dist/useDataTableImport-sQwBFAJ_.js +775 -0
- package/package.json +53 -5
package/dist/index.cjs.js
CHANGED
|
@@ -1,23 +1,35 @@
|
|
|
1
|
-
"use strict";var gc=Object.create;var tn=Object.defineProperty;var xc=Object.getOwnPropertyDescriptor;var bc=Object.getOwnPropertyNames;var vc=Object.getPrototypeOf,yc=Object.prototype.hasOwnProperty;var wc=(t,a,r,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let n of bc(a))!yc.call(t,n)&&n!==r&&tn(t,n,{get:()=>a[n],enumerable:!(s=xc(a,n))||s.enumerable});return t};var bt=(t,a,r)=>(r=t!=null?gc(vc(t)):{},wc(a||!t||!t.__esModule?tn(r,"default",{value:t,enumerable:!0}):r,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),k=require("react"),On=require("clsx"),jc=require("tailwind-merge"),$e=require("class-variance-authority"),Nc=require("@radix-ui/react-accordion"),S=require("lucide-react"),Cc=require("@radix-ui/react-alert-dialog"),kc=require("@radix-ui/react-aspect-ratio"),Sc=require("@radix-ui/react-avatar"),La=require("@radix-ui/react-slot"),Ec=require("react-day-picker"),Tc=require("@radix-ui/react-checkbox"),H=require("date-fns"),Dc=require("@radix-ui/react-collapsible"),Qe=require("cmdk"),Ac=require("@radix-ui/react-dialog"),Rc=require("@radix-ui/react-context-menu"),Pc=require("@radix-ui/react-dropdown-menu"),Mc=require("@radix-ui/react-label"),Fc=require("@radix-ui/react-hover-card"),Ic=require("@radix-ui/react-select"),Zr=require("react-dom"),Lc=require("@radix-ui/react-menubar"),$c=require("@radix-ui/react-navigation-menu"),Oc=require("@radix-ui/react-popover"),_c=require("@radix-ui/react-progress"),zc=require("@radix-ui/react-radio-group"),Vc=require("@radix-ui/react-scroll-area"),Wc=require("@radix-ui/react-separator"),Uc=require("@radix-ui/react-slider"),Hc=require("@radix-ui/react-switch"),qc=require("@radix-ui/react-tabs"),Bc=require("@radix-ui/react-toast"),Gc=require("@radix-ui/react-toggle"),Xc=require("@radix-ui/react-tooltip"),Tt=require("react-datepicker"),Je=require("react-i18next"),vt=require("i18next"),ge=require("@tanstack/react-table"),Kc=require("@tanstack/react-virtual");function Ne(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(a,r,s.get?s:{enumerable:!0,get:()=>t[r]})}}return a.default=t,Object.freeze(a)}const m=Ne(k),Ot=Ne(Nc),Ue=Ne(Cc),_n=Ne(kc),ea=Ne(Sc),Yc=Ne(La),nr=Ne(Tc),mr=Ne(Dc),je=Ne(Ac),ke=Ne(Rc),Se=Ne(Pc),os=Ne(Mc),$a=Ne(Fc),Re=Ne(Ic),we=Ne(Lc),He=Ne($c),ia=Ne(Oc),or=Ne(_c),la=Ne(zc),It=Ne(Vc),is=Ne(Wc),sa=Ne(Uc),ir=Ne(Hc),_t=Ne(qc),Ze=Ne(Bc),ls=Ne(Gc),ua=Ne(Xc);class zn{constructor(a){this.config={debug:!1,minLevel:"debug",prefix:"[WakaUI]"},a&&(this.config={...this.config,...a})}configure(a){this.config={...this.config,...a}}shouldLog(a){if(a==="error"||a==="warn")return!0;if(process.env.NODE_ENV==="production"&&!this.config.debug)return!1;const r=["debug","info","warn","error"],s=r.indexOf(a),n=r.indexOf(this.config.minLevel||"debug");return s>=n}format(a){return this.config.prefix?`${this.config.prefix} ${a}`:a}debug(a,...r){this.shouldLog("debug")&&console.log(this.format(a),...r)}info(a,...r){this.shouldLog("info")&&console.log(this.format(a),...r)}warn(a,...r){this.shouldLog("warn")&&console.warn(this.format(a),...r)}error(a,...r){this.shouldLog("error")&&console.error(this.format(a),...r)}}const le=new zn,Le={UNKNOWN:"WAKA_UNKNOWN",VALIDATION:"WAKA_VALIDATION",NETWORK:"WAKA_NETWORK",TIMEOUT:"WAKA_TIMEOUT",THEME_LOAD_FAILED:"WAKA_THEME_LOAD_FAILED",THEME_PARSE_FAILED:"WAKA_THEME_PARSE_FAILED",THEME_APPLY_FAILED:"WAKA_THEME_APPLY_FAILED",LANG_LOAD_FAILED:"WAKA_LANG_LOAD_FAILED",LANG_PARSE_FAILED:"WAKA_LANG_PARSE_FAILED",TRANSLATION_MISSING:"WAKA_TRANSLATION_MISSING",DATATABLE_EXPORT_FAILED:"WAKA_DATATABLE_EXPORT_FAILED",DATATABLE_IMPORT_FAILED:"WAKA_DATATABLE_IMPORT_FAILED",DATATABLE_PARSE_FAILED:"WAKA_DATATABLE_PARSE_FAILED",COMPONENT_RENDER_FAILED:"WAKA_COMPONENT_RENDER_FAILED",COMPONENT_INIT_FAILED:"WAKA_COMPONENT_INIT_FAILED",PROVIDER_MISSING:"WAKA_PROVIDER_MISSING",PROVIDER_CONFIG_INVALID:"WAKA_PROVIDER_CONFIG_INVALID"};class nt extends Error{constructor(a,r={}){super(a),this.name="WakaError",this.code=r.code||Le.UNKNOWN,this.context=r.context,this.cause=r.cause,this.metadata=r.metadata,this.timestamp=new Date,Error.captureStackTrace&&Error.captureStackTrace(this,nt)}static from(a,r={}){return a instanceof nt?a:a instanceof Error?new nt(a.message,{...r,cause:a}):new nt(String(a),r)}toJSON(){return{name:this.name,message:this.message,code:this.code,context:this.context,metadata:this.metadata,timestamp:this.timestamp.toISOString(),stack:this.stack,cause:this.cause?.message}}}function Ve(t,a={}){const r=nt.from(t,{code:a.code,context:a.context,metadata:a.metadata});if(a.silent||le.error(`${a.context||"Error"}: ${r.message}`,r.toJSON()),a.onError?.(r),a.rethrow)throw r;return r}function Jc(t,a={}){try{return t()}catch(r){return Ve(r,a),a.fallback}}async function Qc(t,a={}){try{return await t()}catch(r){return Ve(r,a),a.fallback}}function Zc(t,a={}){return async(...r)=>{try{return await t(...r)}catch(s){throw Ve(s,a)}}}function ed(t,a,r={}){if(!t)throw new nt(a,{code:r.code||Le.VALIDATION,context:r.context,metadata:r.metadata})}function Vn(t){return t instanceof nt}function td(t,a){return Vn(t)&&t.code===a}function ad(t){return(a,r=Le.UNKNOWN,s)=>new nt(a,{code:r,context:t,metadata:s})}async function rd(t,a={}){const{maxRetries:r=3,baseDelay:s=1e3,maxDelay:n=1e4,context:i,onRetry:c}=a;let l;for(let o=0;o<=r;o++)try{return await t()}catch(d){if(l=nt.from(d,{context:i}),o<r){const u=Math.min(s*Math.pow(2,o),n);c?.(o+1,l),le.warn(`${i||"Operation"} failed (attempt ${o+1}/${r+1}), retrying in ${u}ms...`),await new Promise(f=>setTimeout(f,u))}}throw l}function lr(...t){return jc.twMerge(On.clsx(...t))}lr.variants=function(t){const a={variants:t.variants??{},defaultVariants:t.defaultVariants},r=$e.cva(t.base??"",a);return s=>{const n=s??{},{class:i,className:c,...l}=n,o=r(l);return lr(o,i,c)}};const N=(...t)=>lr(...t);function sd({error:t,resetErrorBoundary:a,componentName:r}){return e.jsxs("div",{role:"alert",className:N("flex flex-col items-center justify-center p-6","border border-destructive/50 rounded-lg bg-destructive/5","text-center space-y-4"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[e.jsxs("svg",{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",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),e.jsx("h3",{className:"font-semibold text-lg",children:"Something went wrong"})]}),r&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Error in component: ",e.jsx("code",{className:"font-mono",children:r})]}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:t.message}),t.code!==Le.UNKNOWN&&e.jsxs("p",{className:"text-xs text-muted-foreground font-mono",children:["Code: ",t.code]}),e.jsx("button",{onClick:a,className:N("px-4 py-2 text-sm font-medium rounded-md","bg-primary text-primary-foreground","hover:bg-primary/90 transition-colors","focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2"),children:"Try again"})]})}class Wn extends m.Component{constructor(a){super(a),this.reset=()=>{const{onReset:r}=this.props;this.setState({hasError:!1,error:null}),r?.()},this.state={hasError:!1,error:null}}static getDerivedStateFromError(a){return{hasError:!0,error:nt.from(a,{code:Le.COMPONENT_RENDER_FAILED})}}componentDidCatch(a,r){const{onError:s,componentName:n,errorCode:i}=this.props,c=nt.from(a,{code:i||Le.COMPONENT_RENDER_FAILED,context:n,metadata:{componentStack:r.componentStack}});le.error(`ErrorBoundary caught error${n?` in ${n}`:""}`,c.toJSON()),s?.(c,r)}componentDidUpdate(a){const{resetKeys:r}=this.props,{hasError:s}=this.state;if(s&&r){const n=a.resetKeys||[];r.some((c,l)=>c!==n[l])&&this.reset()}}render(){const{children:a,fallback:r,componentName:s,className:n}=this.props,{hasError:i,error:c}=this.state;return i&&c?typeof r=="function"?e.jsx("div",{className:n,children:r({error:c,resetErrorBoundary:this.reset,componentName:s})}):r?e.jsx("div",{className:n,children:r}):e.jsx("div",{className:n,children:e.jsx(sd,{error:c,resetErrorBoundary:this.reset,componentName:s})}):a}}function nd(){const[,t]=m.useState(0);return m.useCallback(()=>t(a=>a+1),[])}function od(t,a){const r=s=>e.jsx(Wn,{...a,children:e.jsx(t,{...s})});return r.displayName=`withErrorBoundary(${t.displayName||t.name||"Component"})`,r}const id=Ot.Root,Un=m.forwardRef(({className:t,...a},r)=>e.jsx(Ot.Item,{ref:r,className:N("border-b",t),...a}));Un.displayName="AccordionItem";const Hn=m.forwardRef(({className:t,children:a,...r},s)=>e.jsx(Ot.Header,{className:"flex",children:e.jsxs(Ot.Trigger,{ref:s,className:N("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...r,children:[a,e.jsx(S.ChevronDown,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Hn.displayName=Ot.Trigger.displayName;const qn=m.forwardRef(({className:t,children:a,...r},s)=>e.jsx(Ot.Content,{ref:s,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:e.jsx("div",{className:N("pb-4 pt-0",t),children:a})}));qn.displayName=Ot.Content.displayName;const cs=Ue.Root,ld=Ue.Trigger,Bn=Ue.Portal,ds=m.forwardRef(({className:t,...a},r)=>e.jsx(Ue.Overlay,{className:N("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...a,ref:r}));ds.displayName=Ue.Overlay.displayName;const fr=m.forwardRef(({className:t,...a},r)=>e.jsxs(Bn,{children:[e.jsx(ds,{}),e.jsx(Ue.Content,{ref:r,className:N("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...a})]}));fr.displayName=Ue.Content.displayName;const hr=({className:t,...a})=>e.jsx("div",{className:N("flex flex-col space-y-2 text-center sm:text-left",t),...a});hr.displayName="AlertDialogHeader";const pr=({className:t,...a})=>e.jsx("div",{className:N("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a});pr.displayName="AlertDialogFooter";const gr=m.forwardRef(({className:t,...a},r)=>e.jsx(Ue.Title,{ref:r,className:N("text-lg font-semibold",t),...a}));gr.displayName=Ue.Title.displayName;const xr=m.forwardRef(({className:t,...a},r)=>e.jsx(Ue.Description,{ref:r,className:N("text-sm text-muted-foreground",t),...a}));xr.displayName=Ue.Description.displayName;const br=m.forwardRef(({className:t,...a},r)=>e.jsx(Ue.Action,{ref:r,className:N("inline-flex h-10 items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground ring-offset-background transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...a}));br.displayName=Ue.Action.displayName;const vr=m.forwardRef(({className:t,...a},r)=>e.jsx(Ue.Cancel,{ref:r,className:N("mt-2 inline-flex h-10 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-semibold ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 sm:mt-0",t),...a}));vr.displayName=Ue.Cancel.displayName;const cd=$e.cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),us=m.forwardRef(({className:t,variant:a,...r},s)=>e.jsx("div",{ref:s,role:"alert",className:N(cd({variant:a}),t),...r}));us.displayName="Alert";const Gn=m.forwardRef(({className:t,...a},r)=>e.jsx("h5",{ref:r,className:N("mb-1 font-medium leading-none tracking-tight",t),...a}));Gn.displayName="AlertTitle";const ms=m.forwardRef(({className:t,...a},r)=>e.jsx("div",{ref:r,className:N("text-sm [&_p]:leading-relaxed",t),...a}));ms.displayName="AlertDescription";const dd=_n.Root,yr=m.forwardRef(({className:t,...a},r)=>e.jsx(ea.Root,{ref:r,className:N("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...a}));yr.displayName=ea.Root.displayName;const wr=m.forwardRef(({className:t,...a},r)=>e.jsx(ea.Image,{ref:r,className:N("aspect-square h-full w-full",t),...a}));wr.displayName=ea.Image.displayName;const jr=m.forwardRef(({className:t,...a},r)=>e.jsx(ea.Fallback,{ref:r,className:N("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...a}));jr.displayName=ea.Fallback.displayName;const Xn=$e.cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Pe({className:t,variant:a,...r}){return e.jsx("div",{className:N(Xn({variant:a}),t),...r})}const ud=$e.cva("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-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),G=m.forwardRef(({className:t,variant:a,size:r,asChild:s=!1,...n},i)=>{const c=s?La.Slot:"button";return e.jsx(c,{className:N(ud({variant:a,size:r,className:t})),ref:i,...n})});G.displayName="Button";function fs({className:t,classNames:a,showOutsideDays:r=!0,...s}){return e.jsx(Ec.DayPicker,{showOutsideDays:r,className:N("p-4 bg-background border border-border rounded-lg shadow-sm",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center mb-4",caption_label:"text-lg font-semibold text-foreground",nav:"space-x-1 flex items-center",nav_button:N("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200","h-8 w-8 bg-background border border-border hover:bg-accent hover:text-accent-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex mb-2",head_cell:"text-muted-foreground rounded-md w-10 h-10 font-medium text-sm flex items-center justify-center",row:"flex w-full",cell:"h-10 w-10 text-center text-sm p-0 relative",day:N("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200","h-10 w-10 p-0 font-normal cursor-pointer","hover:bg-accent hover:text-accent-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50"),day_range_end:"day-range-end",day_selected:N("bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground","focus:bg-primary focus:text-primary-foreground shadow-sm"),day_today:"bg-accent text-accent-foreground font-semibold",day_outside:"text-muted-foreground opacity-50 hover:opacity-70",day_disabled:"text-muted-foreground opacity-30 cursor-not-allowed",day_range_middle:"bg-accent/50 text-accent-foreground",day_hidden:"invisible",...a},components:{Chevron:({...n})=>n.orientation==="left"?e.jsx(S.ChevronLeft,{className:"h-4 w-4"}):e.jsx(S.ChevronRight,{className:"h-4 w-4"})},...s})}fs.displayName="Calendar";const Be=m.forwardRef(({className:t,...a},r)=>e.jsx("div",{ref:r,className:N("rounded-xl border bg-card text-card-foreground shadow",t),...a}));Be.displayName="Card";const rt=m.forwardRef(({className:t,...a},r)=>e.jsx("div",{ref:r,className:N("flex flex-col space-y-1.5 p-6",t),...a}));rt.displayName="CardHeader";const Ge=m.forwardRef(({className:t,...a},r)=>e.jsx("h3",{ref:r,className:N("font-semibold leading-none tracking-tight",t),...a}));Ge.displayName="CardTitle";const Et=m.forwardRef(({className:t,...a},r)=>e.jsx("p",{ref:r,className:N("text-sm text-muted-foreground",t),...a}));Et.displayName="CardDescription";const st=m.forwardRef(({className:t,...a},r)=>e.jsx("div",{ref:r,className:N("p-6 pt-0",t),...a}));st.displayName="CardContent";const Kn=m.forwardRef(({className:t,...a},r)=>e.jsx("div",{ref:r,className:N("flex items-center p-6 pt-0",t),...a}));Kn.displayName="CardFooter";const yt=m.forwardRef(({className:t,...a},r)=>e.jsx(nr.Root,{ref:r,className:N("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...a,children:e.jsx(nr.Indicator,{className:N("flex items-center justify-center text-current"),children:e.jsx(S.Check,{className:"h-4 w-4"})})}));yt.displayName=nr.Root.displayName;function Ee(t){return(a={})=>{const r=a.width?String(a.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}function ce(t){return(a,r)=>{const s=r?.context?String(r.context):"standalone";let n;if(s==="formatting"&&t.formattingValues){const c=t.defaultFormattingWidth||t.defaultWidth,l=r?.width?String(r.width):c;n=t.formattingValues[l]||t.formattingValues[c]}else{const c=t.defaultWidth,l=r?.width?String(r.width):t.defaultWidth;n=t.values[l]||t.values[c]}const i=t.argumentCallback?t.argumentCallback(a):a;return n[i]}}function de(t){return(a,r={})=>{const s=r.width,n=s&&t.matchPatterns[s]||t.matchPatterns[t.defaultMatchWidth],i=a.match(n);if(!i)return null;const c=i[0],l=s&&t.parsePatterns[s]||t.parsePatterns[t.defaultParseWidth],o=Array.isArray(l)?fd(l,f=>f.test(c)):md(l,f=>f.test(c));let d;d=t.valueCallback?t.valueCallback(o):o,d=r.valueCallback?r.valueCallback(d):d;const u=a.slice(c.length);return{value:d,rest:u}}}function md(t,a){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&a(t[r]))return r}function fd(t,a){for(let r=0;r<t.length;r++)if(a(t[r]))return r}function zt(t){return(a,r={})=>{const s=a.match(t.matchPattern);if(!s)return null;const n=s[0],i=a.match(t.parsePattern);if(!i)return null;let c=t.valueCallback?t.valueCallback(i[0]):i[0];c=r.valueCallback?r.valueCallback(c):c;const l=a.slice(n.length);return{value:c,rest:l}}}const an=Symbol.for("constructDateFrom");function Yn(t,a){return typeof t=="function"?t(a):t&&typeof t=="object"&&an in t?t[an](a):t instanceof Date?new t.constructor(a):new Date(a)}function hd(t,...a){const r=Yn.bind(null,t||a.find(s=>typeof s=="object"));return a.map(r)}let pd={};function gd(){return pd}function xd(t,a){return Yn(a||t,t)}function rn(t,a){const r=gd(),s=a?.weekStartsOn??a?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,n=xd(t,a?.in),i=n.getDay(),c=(i<s?7:0)+i-s;return n.setDate(n.getDate()-c),n.setHours(0,0,0,0),n}function es(t,a,r){const[s,n]=hd(r?.in,t,a);return+rn(s,r)==+rn(n,r)}const sn={lessThanXSeconds:{standalone:{one:"weniger als 1 Sekunde",other:"weniger als {{count}} Sekunden"},withPreposition:{one:"weniger als 1 Sekunde",other:"weniger als {{count}} Sekunden"}},xSeconds:{standalone:{one:"1 Sekunde",other:"{{count}} Sekunden"},withPreposition:{one:"1 Sekunde",other:"{{count}} Sekunden"}},halfAMinute:{standalone:"eine halbe Minute",withPreposition:"einer halben Minute"},lessThanXMinutes:{standalone:{one:"weniger als 1 Minute",other:"weniger als {{count}} Minuten"},withPreposition:{one:"weniger als 1 Minute",other:"weniger als {{count}} Minuten"}},xMinutes:{standalone:{one:"1 Minute",other:"{{count}} Minuten"},withPreposition:{one:"1 Minute",other:"{{count}} Minuten"}},aboutXHours:{standalone:{one:"etwa 1 Stunde",other:"etwa {{count}} Stunden"},withPreposition:{one:"etwa 1 Stunde",other:"etwa {{count}} Stunden"}},xHours:{standalone:{one:"1 Stunde",other:"{{count}} Stunden"},withPreposition:{one:"1 Stunde",other:"{{count}} Stunden"}},xDays:{standalone:{one:"1 Tag",other:"{{count}} Tage"},withPreposition:{one:"1 Tag",other:"{{count}} Tagen"}},aboutXWeeks:{standalone:{one:"etwa 1 Woche",other:"etwa {{count}} Wochen"},withPreposition:{one:"etwa 1 Woche",other:"etwa {{count}} Wochen"}},xWeeks:{standalone:{one:"1 Woche",other:"{{count}} Wochen"},withPreposition:{one:"1 Woche",other:"{{count}} Wochen"}},aboutXMonths:{standalone:{one:"etwa 1 Monat",other:"etwa {{count}} Monate"},withPreposition:{one:"etwa 1 Monat",other:"etwa {{count}} Monaten"}},xMonths:{standalone:{one:"1 Monat",other:"{{count}} Monate"},withPreposition:{one:"1 Monat",other:"{{count}} Monaten"}},aboutXYears:{standalone:{one:"etwa 1 Jahr",other:"etwa {{count}} Jahre"},withPreposition:{one:"etwa 1 Jahr",other:"etwa {{count}} Jahren"}},xYears:{standalone:{one:"1 Jahr",other:"{{count}} Jahre"},withPreposition:{one:"1 Jahr",other:"{{count}} Jahren"}},overXYears:{standalone:{one:"mehr als 1 Jahr",other:"mehr als {{count}} Jahre"},withPreposition:{one:"mehr als 1 Jahr",other:"mehr als {{count}} Jahren"}},almostXYears:{standalone:{one:"fast 1 Jahr",other:"fast {{count}} Jahre"},withPreposition:{one:"fast 1 Jahr",other:"fast {{count}} Jahren"}}},bd=(t,a,r)=>{let s;const n=r?.addSuffix?sn[t].withPreposition:sn[t].standalone;return typeof n=="string"?s=n:a===1?s=n.one:s=n.other.replace("{{count}}",String(a)),r?.addSuffix?r.comparison&&r.comparison>0?"in "+s:"vor "+s:s},vd={full:"EEEE, do MMMM y",long:"do MMMM y",medium:"do MMM y",short:"dd.MM.y"},yd={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},wd={full:"{{date}} 'um' {{time}}",long:"{{date}} 'um' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},jd={date:Ee({formats:vd,defaultWidth:"full"}),time:Ee({formats:yd,defaultWidth:"full"}),dateTime:Ee({formats:wd,defaultWidth:"full"})},Nd={lastWeek:"'letzten' eeee 'um' p",yesterday:"'gestern um' p",today:"'heute um' p",tomorrow:"'morgen um' p",nextWeek:"eeee 'um' p",other:"P"},Cd=(t,a,r,s)=>Nd[t],kd={narrow:["v.Chr.","n.Chr."],abbreviated:["v.Chr.","n.Chr."],wide:["vor Christus","nach Christus"]},Sd={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. Quartal","2. Quartal","3. Quartal","4. Quartal"]},ts={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],wide:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},Ed={narrow:ts.narrow,abbreviated:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sep.","Okt.","Nov.","Dez."],wide:ts.wide},Td={narrow:["S","M","D","M","D","F","S"],short:["So","Mo","Di","Mi","Do","Fr","Sa"],abbreviated:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."],wide:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},Dd={narrow:{am:"vm.",pm:"nm.",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachm.",evening:"Abend",night:"Nacht"},abbreviated:{am:"vorm.",pm:"nachm.",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachmittag",evening:"Abend",night:"Nacht"},wide:{am:"vormittags",pm:"nachmittags",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachmittag",evening:"Abend",night:"Nacht"}},Ad={narrow:{am:"vm.",pm:"nm.",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachm.",evening:"abends",night:"nachts"},abbreviated:{am:"vorm.",pm:"nachm.",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachmittags",evening:"abends",night:"nachts"},wide:{am:"vormittags",pm:"nachmittags",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachmittags",evening:"abends",night:"nachts"}},Rd=t=>Number(t)+".",Pd={ordinalNumber:Rd,era:ce({values:kd,defaultWidth:"wide"}),quarter:ce({values:Sd,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ce({values:ts,formattingValues:Ed,defaultWidth:"wide"}),day:ce({values:Td,defaultWidth:"wide"}),dayPeriod:ce({values:Dd,defaultWidth:"wide",formattingValues:Ad,defaultFormattingWidth:"wide"})},Md=/^(\d+)(\.)?/i,Fd=/\d+/i,Id={narrow:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,abbreviated:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,wide:/^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i},Ld={any:[/^v/i,/^n/i]},$d={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? Quartal/i},Od={any:[/1/i,/2/i,/3/i,/4/i]},_d={narrow:/^[jfmasond]/i,abbreviated:/^(j[aä]n|feb|mär[z]?|apr|mai|jun[i]?|jul[i]?|aug|sep|okt|nov|dez)\.?/i,wide:/^(januar|februar|märz|april|mai|juni|juli|august|september|oktober|november|dezember)/i},zd={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^j[aä]/i,/^f/i,/^mär/i,/^ap/i,/^mai/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Vd={narrow:/^[smdmf]/i,short:/^(so|mo|di|mi|do|fr|sa)/i,abbreviated:/^(son?|mon?|die?|mit?|don?|fre?|sam?)\.?/i,wide:/^(sonntag|montag|dienstag|mittwoch|donnerstag|freitag|samstag)/i},Wd={any:[/^so/i,/^mo/i,/^di/i,/^mi/i,/^do/i,/^f/i,/^sa/i]},Ud={narrow:/^(vm\.?|nm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,abbreviated:/^(vorm\.?|nachm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,wide:/^(vormittags|nachmittags|Mitternacht|Mittag|morgens|nachmittags|abends|nachts)/i},Hd={any:{am:/^v/i,pm:/^n/i,midnight:/^Mitte/i,noon:/^Mitta/i,morning:/morgens/i,afternoon:/nachmittags/i,evening:/abends/i,night:/nachts/i}},qd={ordinalNumber:zt({matchPattern:Md,parsePattern:Fd,valueCallback:t=>parseInt(t)}),era:de({matchPatterns:Id,defaultMatchWidth:"wide",parsePatterns:Ld,defaultParseWidth:"any"}),quarter:de({matchPatterns:$d,defaultMatchWidth:"wide",parsePatterns:Od,defaultParseWidth:"any",valueCallback:t=>t+1}),month:de({matchPatterns:_d,defaultMatchWidth:"wide",parsePatterns:zd,defaultParseWidth:"any"}),day:de({matchPatterns:Vd,defaultMatchWidth:"wide",parsePatterns:Wd,defaultParseWidth:"any"}),dayPeriod:de({matchPatterns:Ud,defaultMatchWidth:"wide",parsePatterns:Hd,defaultParseWidth:"any"})},Jn={code:"de",formatDistance:bd,formatLong:jd,formatRelative:Cd,localize:Pd,match:qd,options:{weekStartsOn:1,firstWeekContainsDate:4}},Bd={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Gd=(t,a,r)=>{let s;const n=Bd[t];return typeof n=="string"?s=n:a===1?s=n.one:s=n.other.replace("{{count}}",a.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"in "+s:s+" ago":s},Xd={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Kd=(t,a,r,s)=>Xd[t],Yd={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Jd={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Qd={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Zd={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},eu={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},tu={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},au=(t,a)=>{const r=Number(t),s=r%100;if(s>20||s<10)switch(s%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},ru={ordinalNumber:au,era:ce({values:Yd,defaultWidth:"wide"}),quarter:ce({values:Jd,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ce({values:Qd,defaultWidth:"wide"}),day:ce({values:Zd,defaultWidth:"wide"}),dayPeriod:ce({values:eu,defaultWidth:"wide",formattingValues:tu,defaultFormattingWidth:"wide"})},su=/^(\d+)(th|st|nd|rd)?/i,nu=/\d+/i,ou={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},iu={any:[/^b/i,/^(a|c)/i]},lu={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},cu={any:[/1/i,/2/i,/3/i,/4/i]},du={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},uu={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},mu={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},fu={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},hu={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},pu={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},gu={ordinalNumber:zt({matchPattern:su,parsePattern:nu,valueCallback:t=>parseInt(t,10)}),era:de({matchPatterns:ou,defaultMatchWidth:"wide",parsePatterns:iu,defaultParseWidth:"any"}),quarter:de({matchPatterns:lu,defaultMatchWidth:"wide",parsePatterns:cu,defaultParseWidth:"any",valueCallback:t=>t+1}),month:de({matchPatterns:du,defaultMatchWidth:"wide",parsePatterns:uu,defaultParseWidth:"any"}),day:de({matchPatterns:mu,defaultMatchWidth:"wide",parsePatterns:fu,defaultParseWidth:"any"}),dayPeriod:de({matchPatterns:hu,defaultMatchWidth:"any",parsePatterns:pu,defaultParseWidth:"any"})},xu={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},bu={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},vu={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},yu={date:Ee({formats:xu,defaultWidth:"full"}),time:Ee({formats:bu,defaultWidth:"full"}),dateTime:Ee({formats:vu,defaultWidth:"full"})},Sa={code:"en-US",formatDistance:Gd,formatLong:yu,formatRelative:Kd,localize:ru,match:gu,options:{weekStartsOn:0,firstWeekContainsDate:1}},wu={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},ju=(t,a,r)=>{let s;const n=wu[t];return typeof n=="string"?s=n:a===1?s=n.one:s=n.other.replace("{{count}}",a.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"en "+s:"hace "+s:s},Nu={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},Cu={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},ku={full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Su={date:Ee({formats:Nu,defaultWidth:"full"}),time:Ee({formats:Cu,defaultWidth:"full"}),dateTime:Ee({formats:ku,defaultWidth:"full"})},Eu={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},Tu={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},Du=(t,a,r,s)=>a.getHours()!==1?Tu[t]:Eu[t],Au={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},Ru={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},Pu={narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},Mu={narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},Fu={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},Iu={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},Lu=(t,a)=>Number(t)+"º",$u={ordinalNumber:Lu,era:ce({values:Au,defaultWidth:"wide"}),quarter:ce({values:Ru,defaultWidth:"wide",argumentCallback:t=>Number(t)-1}),month:ce({values:Pu,defaultWidth:"wide"}),day:ce({values:Mu,defaultWidth:"wide"}),dayPeriod:ce({values:Fu,defaultWidth:"wide",formattingValues:Iu,defaultFormattingWidth:"wide"})},Ou=/^(\d+)(º)?/i,_u=/\d+/i,zu={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},Vu={any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},Wu={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},Uu={any:[/1/i,/2/i,/3/i,/4/i]},Hu={narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},qu={narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},Bu={narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},Gu={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},Xu={narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},Ku={any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},Yu={ordinalNumber:zt({matchPattern:Ou,parsePattern:_u,valueCallback:function(t){return parseInt(t,10)}}),era:de({matchPatterns:zu,defaultMatchWidth:"wide",parsePatterns:Vu,defaultParseWidth:"any"}),quarter:de({matchPatterns:Wu,defaultMatchWidth:"wide",parsePatterns:Uu,defaultParseWidth:"any",valueCallback:t=>t+1}),month:de({matchPatterns:Hu,defaultMatchWidth:"wide",parsePatterns:qu,defaultParseWidth:"any"}),day:de({matchPatterns:Bu,defaultMatchWidth:"wide",parsePatterns:Gu,defaultParseWidth:"any"}),dayPeriod:de({matchPatterns:Xu,defaultMatchWidth:"any",parsePatterns:Ku,defaultParseWidth:"any"})},Qn={code:"es",formatDistance:ju,formatLong:Su,formatRelative:Du,localize:$u,match:Yu,options:{weekStartsOn:1,firstWeekContainsDate:1}},Ju={lessThanXSeconds:{one:"moins d’une seconde",other:"moins de {{count}} secondes"},xSeconds:{one:"1 seconde",other:"{{count}} secondes"},halfAMinute:"30 secondes",lessThanXMinutes:{one:"moins d’une minute",other:"moins de {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"environ 1 heure",other:"environ {{count}} heures"},xHours:{one:"1 heure",other:"{{count}} heures"},xDays:{one:"1 jour",other:"{{count}} jours"},aboutXWeeks:{one:"environ 1 semaine",other:"environ {{count}} semaines"},xWeeks:{one:"1 semaine",other:"{{count}} semaines"},aboutXMonths:{one:"environ 1 mois",other:"environ {{count}} mois"},xMonths:{one:"1 mois",other:"{{count}} mois"},aboutXYears:{one:"environ 1 an",other:"environ {{count}} ans"},xYears:{one:"1 an",other:"{{count}} ans"},overXYears:{one:"plus d’un an",other:"plus de {{count}} ans"},almostXYears:{one:"presqu’un an",other:"presque {{count}} ans"}},Qu=(t,a,r)=>{let s;const n=Ju[t];return typeof n=="string"?s=n:a===1?s=n.one:s=n.other.replace("{{count}}",String(a)),r?.addSuffix?r.comparison&&r.comparison>0?"dans "+s:"il y a "+s:s},Zu={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},em={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},tm={full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},am={date:Ee({formats:Zu,defaultWidth:"full"}),time:Ee({formats:em,defaultWidth:"full"}),dateTime:Ee({formats:tm,defaultWidth:"full"})},rm={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"},sm=(t,a,r,s)=>rm[t],nm={narrow:["av. J.-C","ap. J.-C"],abbreviated:["av. J.-C","ap. J.-C"],wide:["avant Jésus-Christ","après Jésus-Christ"]},om={narrow:["T1","T2","T3","T4"],abbreviated:["1er trim.","2ème trim.","3ème trim.","4ème trim."],wide:["1er trimestre","2ème trimestre","3ème trimestre","4ème trimestre"]},im={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],wide:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},lm={narrow:["D","L","M","M","J","V","S"],short:["di","lu","ma","me","je","ve","sa"],abbreviated:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],wide:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},cm={narrow:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"mat.",afternoon:"ap.m.",evening:"soir",night:"mat."},abbreviated:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"matin",afternoon:"après-midi",evening:"soir",night:"matin"},wide:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"du matin",afternoon:"de l’après-midi",evening:"du soir",night:"du matin"}},dm=(t,a)=>{const r=Number(t),s=a?.unit;if(r===0)return"0";const n=["year","week","hour","minute","second"];let i;return r===1?i=s&&n.includes(s)?"ère":"er":i="ème",r+i},um=["MMM","MMMM"],mm={preprocessor:(t,a)=>t.getDate()===1||!a.some(s=>s.isToken&&um.includes(s.value))?a:a.map(s=>s.isToken&&s.value==="do"?{isToken:!0,value:"d"}:s),ordinalNumber:dm,era:ce({values:nm,defaultWidth:"wide"}),quarter:ce({values:om,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ce({values:im,defaultWidth:"wide"}),day:ce({values:lm,defaultWidth:"wide"}),dayPeriod:ce({values:cm,defaultWidth:"wide"})},fm=/^(\d+)(ième|ère|ème|er|e)?/i,hm=/\d+/i,pm={narrow:/^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,abbreviated:/^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,wide:/^(avant Jésus-Christ|après Jésus-Christ)/i},gm={any:[/^av/i,/^ap/i]},xm={narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},bm={any:[/1/i,/2/i,/3/i,/4/i]},vm={narrow:/^[jfmasond]/i,abbreviated:/^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,wide:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i},ym={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^av/i,/^ma/i,/^juin/i,/^juil/i,/^ao/i,/^s/i,/^o/i,/^n/i,/^d/i]},wm={narrow:/^[lmjvsd]/i,short:/^(di|lu|ma|me|je|ve|sa)/i,abbreviated:/^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,wide:/^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i},jm={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^di/i,/^lu/i,/^ma/i,/^me/i,/^je/i,/^ve/i,/^sa/i]},Nm={narrow:/^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,any:/^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i},Cm={any:{am:/^a/i,pm:/^p/i,midnight:/^min/i,noon:/^mid/i,morning:/mat/i,afternoon:/ap/i,evening:/soir/i,night:/nuit/i}},km={ordinalNumber:zt({matchPattern:fm,parsePattern:hm,valueCallback:t=>parseInt(t)}),era:de({matchPatterns:pm,defaultMatchWidth:"wide",parsePatterns:gm,defaultParseWidth:"any"}),quarter:de({matchPatterns:xm,defaultMatchWidth:"wide",parsePatterns:bm,defaultParseWidth:"any",valueCallback:t=>t+1}),month:de({matchPatterns:vm,defaultMatchWidth:"wide",parsePatterns:ym,defaultParseWidth:"any"}),day:de({matchPatterns:wm,defaultMatchWidth:"wide",parsePatterns:jm,defaultParseWidth:"any"}),dayPeriod:de({matchPatterns:Nm,defaultMatchWidth:"any",parsePatterns:Cm,defaultParseWidth:"any"})},wt={code:"fr",formatDistance:Qu,formatLong:am,formatRelative:sm,localize:mm,match:km,options:{weekStartsOn:1,firstWeekContainsDate:4}},Sm={lessThanXSeconds:{one:"meno di un secondo",other:"meno di {{count}} secondi"},xSeconds:{one:"un secondo",other:"{{count}} secondi"},halfAMinute:"alcuni secondi",lessThanXMinutes:{one:"meno di un minuto",other:"meno di {{count}} minuti"},xMinutes:{one:"un minuto",other:"{{count}} minuti"},aboutXHours:{one:"circa un'ora",other:"circa {{count}} ore"},xHours:{one:"un'ora",other:"{{count}} ore"},xDays:{one:"un giorno",other:"{{count}} giorni"},aboutXWeeks:{one:"circa una settimana",other:"circa {{count}} settimane"},xWeeks:{one:"una settimana",other:"{{count}} settimane"},aboutXMonths:{one:"circa un mese",other:"circa {{count}} mesi"},xMonths:{one:"un mese",other:"{{count}} mesi"},aboutXYears:{one:"circa un anno",other:"circa {{count}} anni"},xYears:{one:"un anno",other:"{{count}} anni"},overXYears:{one:"più di un anno",other:"più di {{count}} anni"},almostXYears:{one:"quasi un anno",other:"quasi {{count}} anni"}},Em=(t,a,r)=>{let s;const n=Sm[t];return typeof n=="string"?s=n:a===1?s=n.one:s=n.other.replace("{{count}}",a.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"tra "+s:s+" fa":s},Tm={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},Dm={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Am={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Rm={date:Ee({formats:Tm,defaultWidth:"full"}),time:Ee({formats:Dm,defaultWidth:"full"}),dateTime:Ee({formats:Am,defaultWidth:"full"})},hs=["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"];function Pm(t){switch(t){case 0:return"'domenica scorsa alle' p";default:return"'"+hs[t]+" scorso alle' p"}}function nn(t){return"'"+hs[t]+" alle' p"}function Mm(t){switch(t){case 0:return"'domenica prossima alle' p";default:return"'"+hs[t]+" prossimo alle' p"}}const Fm={lastWeek:(t,a,r)=>{const s=t.getDay();return es(t,a,r)?nn(s):Pm(s)},yesterday:"'ieri alle' p",today:"'oggi alle' p",tomorrow:"'domani alle' p",nextWeek:(t,a,r)=>{const s=t.getDay();return es(t,a,r)?nn(s):Mm(s)},other:"P"},Im=(t,a,r,s)=>{const n=Fm[t];return typeof n=="function"?n(a,r,s):n},Lm={narrow:["aC","dC"],abbreviated:["a.C.","d.C."],wide:["avanti Cristo","dopo Cristo"]},$m={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},Om={narrow:["G","F","M","A","M","G","L","A","S","O","N","D"],abbreviated:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],wide:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"]},_m={narrow:["D","L","M","M","G","V","S"],short:["dom","lun","mar","mer","gio","ven","sab"],abbreviated:["dom","lun","mar","mer","gio","ven","sab"],wide:["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"]},zm={narrow:{am:"m.",pm:"p.",midnight:"mezzanotte",noon:"mezzogiorno",morning:"mattina",afternoon:"pomeriggio",evening:"sera",night:"notte"},abbreviated:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"mattina",afternoon:"pomeriggio",evening:"sera",night:"notte"},wide:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"mattina",afternoon:"pomeriggio",evening:"sera",night:"notte"}},Vm={narrow:{am:"m.",pm:"p.",midnight:"mezzanotte",noon:"mezzogiorno",morning:"di mattina",afternoon:"del pomeriggio",evening:"di sera",night:"di notte"},abbreviated:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"di mattina",afternoon:"del pomeriggio",evening:"di sera",night:"di notte"},wide:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"di mattina",afternoon:"del pomeriggio",evening:"di sera",night:"di notte"}},Wm=(t,a)=>{const r=Number(t);return String(r)},Um={ordinalNumber:Wm,era:ce({values:Lm,defaultWidth:"wide"}),quarter:ce({values:$m,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ce({values:Om,defaultWidth:"wide"}),day:ce({values:_m,defaultWidth:"wide"}),dayPeriod:ce({values:zm,defaultWidth:"wide",formattingValues:Vm,defaultFormattingWidth:"wide"})},Hm=/^(\d+)(º)?/i,qm=/\d+/i,Bm={narrow:/^(aC|dC)/i,abbreviated:/^(a\.?\s?C\.?|a\.?\s?e\.?\s?v\.?|d\.?\s?C\.?|e\.?\s?v\.?)/i,wide:/^(avanti Cristo|avanti Era Volgare|dopo Cristo|Era Volgare)/i},Gm={any:[/^a/i,/^(d|e)/i]},Xm={narrow:/^[1234]/i,abbreviated:/^t[1234]/i,wide:/^[1234](º)? trimestre/i},Km={any:[/1/i,/2/i,/3/i,/4/i]},Ym={narrow:/^[gfmalsond]/i,abbreviated:/^(gen|feb|mar|apr|mag|giu|lug|ago|set|ott|nov|dic)/i,wide:/^(gennaio|febbraio|marzo|aprile|maggio|giugno|luglio|agosto|settembre|ottobre|novembre|dicembre)/i},Jm={narrow:[/^g/i,/^f/i,/^m/i,/^a/i,/^m/i,/^g/i,/^l/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ge/i,/^f/i,/^mar/i,/^ap/i,/^mag/i,/^gi/i,/^l/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},Qm={narrow:/^[dlmgvs]/i,short:/^(do|lu|ma|me|gi|ve|sa)/i,abbreviated:/^(dom|lun|mar|mer|gio|ven|sab)/i,wide:/^(domenica|luned[i|ì]|marted[i|ì]|mercoled[i|ì]|gioved[i|ì]|venerd[i|ì]|sabato)/i},Zm={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^g/i,/^v/i,/^s/i],any:[/^d/i,/^l/i,/^ma/i,/^me/i,/^g/i,/^v/i,/^s/i]},ef={narrow:/^(a|m\.|p|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i,any:/^([ap]\.?\s?m\.?|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i},tf={any:{am:/^a/i,pm:/^p/i,midnight:/^mezza/i,noon:/^mezzo/i,morning:/mattina/i,afternoon:/pomeriggio/i,evening:/sera/i,night:/notte/i}},af={ordinalNumber:zt({matchPattern:Hm,parsePattern:qm,valueCallback:t=>parseInt(t,10)}),era:de({matchPatterns:Bm,defaultMatchWidth:"wide",parsePatterns:Gm,defaultParseWidth:"any"}),quarter:de({matchPatterns:Xm,defaultMatchWidth:"wide",parsePatterns:Km,defaultParseWidth:"any",valueCallback:t=>t+1}),month:de({matchPatterns:Ym,defaultMatchWidth:"wide",parsePatterns:Jm,defaultParseWidth:"any"}),day:de({matchPatterns:Qm,defaultMatchWidth:"wide",parsePatterns:Zm,defaultParseWidth:"any"}),dayPeriod:de({matchPatterns:ef,defaultMatchWidth:"any",parsePatterns:tf,defaultParseWidth:"any"})},Zn={code:"it",formatDistance:Em,formatLong:Rm,formatRelative:Im,localize:Um,match:af,options:{weekStartsOn:1,firstWeekContainsDate:4}},rf={lessThanXSeconds:{one:"1秒未満",other:"{{count}}秒未満",oneWithSuffix:"約1秒",otherWithSuffix:"約{{count}}秒"},xSeconds:{one:"1秒",other:"{{count}}秒"},halfAMinute:"30秒",lessThanXMinutes:{one:"1分未満",other:"{{count}}分未満",oneWithSuffix:"約1分",otherWithSuffix:"約{{count}}分"},xMinutes:{one:"1分",other:"{{count}}分"},aboutXHours:{one:"約1時間",other:"約{{count}}時間"},xHours:{one:"1時間",other:"{{count}}時間"},xDays:{one:"1日",other:"{{count}}日"},aboutXWeeks:{one:"約1週間",other:"約{{count}}週間"},xWeeks:{one:"1週間",other:"{{count}}週間"},aboutXMonths:{one:"約1か月",other:"約{{count}}か月"},xMonths:{one:"1か月",other:"{{count}}か月"},aboutXYears:{one:"約1年",other:"約{{count}}年"},xYears:{one:"1年",other:"{{count}}年"},overXYears:{one:"1年以上",other:"{{count}}年以上"},almostXYears:{one:"1年近く",other:"{{count}}年近く"}},sf=(t,a,r)=>{r=r||{};let s;const n=rf[t];return typeof n=="string"?s=n:a===1?r.addSuffix&&n.oneWithSuffix?s=n.oneWithSuffix:s=n.one:r.addSuffix&&n.otherWithSuffix?s=n.otherWithSuffix.replace("{{count}}",String(a)):s=n.other.replace("{{count}}",String(a)),r.addSuffix?r.comparison&&r.comparison>0?s+"後":s+"前":s},nf={full:"y年M月d日EEEE",long:"y年M月d日",medium:"y/MM/dd",short:"y/MM/dd"},of={full:"H時mm分ss秒 zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},lf={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},cf={date:Ee({formats:nf,defaultWidth:"full"}),time:Ee({formats:of,defaultWidth:"full"}),dateTime:Ee({formats:lf,defaultWidth:"full"})},df={lastWeek:"先週のeeeeのp",yesterday:"昨日のp",today:"今日のp",tomorrow:"明日のp",nextWeek:"翌週のeeeeのp",other:"P"},uf=(t,a,r,s)=>df[t],mf={narrow:["BC","AC"],abbreviated:["紀元前","西暦"],wide:["紀元前","西暦"]},ff={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["第1四半期","第2四半期","第3四半期","第4四半期"]},hf={narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},pf={narrow:["日","月","火","水","木","金","土"],short:["日","月","火","水","木","金","土"],abbreviated:["日","月","火","水","木","金","土"],wide:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"]},gf={narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},xf={narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},bf=(t,a)=>{const r=Number(t);switch(String(a?.unit)){case"year":return`${r}年`;case"quarter":return`第${r}四半期`;case"month":return`${r}月`;case"week":return`第${r}週`;case"date":return`${r}日`;case"hour":return`${r}時`;case"minute":return`${r}分`;case"second":return`${r}秒`;default:return`${r}`}},vf={ordinalNumber:bf,era:ce({values:mf,defaultWidth:"wide"}),quarter:ce({values:ff,defaultWidth:"wide",argumentCallback:t=>Number(t)-1}),month:ce({values:hf,defaultWidth:"wide"}),day:ce({values:pf,defaultWidth:"wide"}),dayPeriod:ce({values:gf,defaultWidth:"wide",formattingValues:xf,defaultFormattingWidth:"wide"})},yf=/^第?\d+(年|四半期|月|週|日|時|分|秒)?/i,wf=/\d+/i,jf={narrow:/^(B\.?C\.?|A\.?D\.?)/i,abbreviated:/^(紀元[前後]|西暦)/i,wide:/^(紀元[前後]|西暦)/i},Nf={narrow:[/^B/i,/^A/i],any:[/^(紀元前)/i,/^(西暦|紀元後)/i]},Cf={narrow:/^[1234]/i,abbreviated:/^Q[1234]/i,wide:/^第[1234一二三四1234]四半期/i},kf={any:[/(1|一|1)/i,/(2|二|2)/i,/(3|三|3)/i,/(4|四|4)/i]},Sf={narrow:/^([123456789]|1[012])/,abbreviated:/^([123456789]|1[012])月/i,wide:/^([123456789]|1[012])月/i},Ef={any:[/^1\D/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},Tf={narrow:/^[日月火水木金土]/,short:/^[日月火水木金土]/,abbreviated:/^[日月火水木金土]/,wide:/^[日月火水木金土]曜日/},Df={any:[/^日/,/^月/,/^火/,/^水/,/^木/,/^金/,/^土/]},Af={any:/^(AM|PM|午前|午後|正午|深夜|真夜中|夜|朝)/i},Rf={any:{am:/^(A|午前)/i,pm:/^(P|午後)/i,midnight:/^深夜|真夜中/i,noon:/^正午/i,morning:/^朝/i,afternoon:/^午後/i,evening:/^夜/i,night:/^深夜/i}},Pf={ordinalNumber:zt({matchPattern:yf,parsePattern:wf,valueCallback:function(t){return parseInt(t,10)}}),era:de({matchPatterns:jf,defaultMatchWidth:"wide",parsePatterns:Nf,defaultParseWidth:"any"}),quarter:de({matchPatterns:Cf,defaultMatchWidth:"wide",parsePatterns:kf,defaultParseWidth:"any",valueCallback:t=>t+1}),month:de({matchPatterns:Sf,defaultMatchWidth:"wide",parsePatterns:Ef,defaultParseWidth:"any"}),day:de({matchPatterns:Tf,defaultMatchWidth:"wide",parsePatterns:Df,defaultParseWidth:"any"}),dayPeriod:de({matchPatterns:Af,defaultMatchWidth:"any",parsePatterns:Rf,defaultParseWidth:"any"})},eo={code:"ja",formatDistance:sf,formatLong:cf,formatRelative:uf,localize:vf,match:Pf,options:{weekStartsOn:0,firstWeekContainsDate:1}},Mf={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"aproximadamente 1 hora",other:"aproximadamente {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"aproximadamente 1 semana",other:"aproximadamente {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"aproximadamente 1 mês",other:"aproximadamente {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"aproximadamente 1 ano",other:"aproximadamente {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},Ff=(t,a,r)=>{let s;const n=Mf[t];return typeof n=="string"?s=n:a===1?s=n.one:s=n.other.replace("{{count}}",String(a)),r?.addSuffix?r.comparison&&r.comparison>0?"daqui a "+s:"há "+s:s},If={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d 'de' MMM 'de' y",short:"dd/MM/y"},Lf={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},$f={full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Of={date:Ee({formats:If,defaultWidth:"full"}),time:Ee({formats:Lf,defaultWidth:"full"}),dateTime:Ee({formats:$f,defaultWidth:"full"})},_f={lastWeek:t=>{const a=t.getDay();return"'"+(a===0||a===6?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},zf=(t,a,r,s)=>{const n=_f[t];return typeof n=="function"?n(a):n},Vf={narrow:["aC","dC"],abbreviated:["a.C.","d.C."],wide:["antes de Cristo","depois de Cristo"]},Wf={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},Uf={narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},Hf={narrow:["d","s","t","q","q","s","s"],short:["dom","seg","ter","qua","qui","sex","sáb"],abbreviated:["dom","seg","ter","qua","qui","sex","sáb"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},qf={narrow:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"noite",night:"madrugada"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"noite",night:"madrugada"},wide:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"noite",night:"madrugada"}},Bf={narrow:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da noite",night:"da madrugada"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da noite",night:"da madrugada"},wide:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da noite",night:"da madrugada"}},Gf=(t,a)=>Number(t)+"º",Xf={ordinalNumber:Gf,era:ce({values:Vf,defaultWidth:"wide"}),quarter:ce({values:Wf,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ce({values:Uf,defaultWidth:"wide"}),day:ce({values:Hf,defaultWidth:"wide"}),dayPeriod:ce({values:qf,defaultWidth:"wide",formattingValues:Bf,defaultFormattingWidth:"wide"})},Kf=/^(\d+)(º|ª)?/i,Yf=/\d+/i,Jf={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes da era comum|depois de cristo|era comum)/i},Qf={any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes da era comum)/i,/^(depois de cristo|era comum)/i]},Zf={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º|ª)? trimestre/i},eh={any:[/1/i,/2/i,/3/i,/4/i]},th={narrow:/^[jfmasond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},ah={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ab/i,/^mai/i,/^jun/i,/^jul/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},rh={narrow:/^[dstq]/i,short:/^(dom|seg|ter|qua|qui|sex|s[áa]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[áa]b)/i,wide:/^(domingo|segunda-?\s?feira|terça-?\s?feira|quarta-?\s?feira|quinta-?\s?feira|sexta-?\s?feira|s[áa]bado)/i},sh={narrow:[/^d/i,/^s/i,/^t/i,/^q/i,/^q/i,/^s/i,/^s/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[áa]/i]},nh={narrow:/^(a|p|meia-?\s?noite|meio-?\s?dia|(da) (manh[ãa]|tarde|noite|madrugada))/i,any:/^([ap]\.?\s?m\.?|meia-?\s?noite|meio-?\s?dia|(da) (manh[ãa]|tarde|noite|madrugada))/i},oh={any:{am:/^a/i,pm:/^p/i,midnight:/^meia/i,noon:/^meio/i,morning:/manh[ãa]/i,afternoon:/tarde/i,evening:/noite/i,night:/madrugada/i}},ih={ordinalNumber:zt({matchPattern:Kf,parsePattern:Yf,valueCallback:t=>parseInt(t,10)}),era:de({matchPatterns:Jf,defaultMatchWidth:"wide",parsePatterns:Qf,defaultParseWidth:"any"}),quarter:de({matchPatterns:Zf,defaultMatchWidth:"wide",parsePatterns:eh,defaultParseWidth:"any",valueCallback:t=>t+1}),month:de({matchPatterns:th,defaultMatchWidth:"wide",parsePatterns:ah,defaultParseWidth:"any"}),day:de({matchPatterns:rh,defaultMatchWidth:"wide",parsePatterns:sh,defaultParseWidth:"any"}),dayPeriod:de({matchPatterns:nh,defaultMatchWidth:"any",parsePatterns:oh,defaultParseWidth:"any"})},to={code:"pt",formatDistance:Ff,formatLong:Of,formatRelative:zf,localize:Xf,match:ih,options:{weekStartsOn:1,firstWeekContainsDate:4}},lh={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},ch=(t,a,r)=>{let s;const n=lh[t];return typeof n=="string"?s=n:a===1?s=n.one:s=n.other.replace("{{count}}",String(a)),r?.addSuffix?r.comparison&&r.comparison>0?s+"内":s+"前":s},dh={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},uh={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},mh={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},fh={date:Ee({formats:dh,defaultWidth:"full"}),time:Ee({formats:uh,defaultWidth:"full"}),dateTime:Ee({formats:mh,defaultWidth:"full"})};function on(t,a,r){const s="eeee p";return es(t,a,r)?s:t.getTime()>a.getTime()?"'下个'"+s:"'上个'"+s}const hh={lastWeek:on,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:on,other:"PP p"},ph=(t,a,r,s)=>{const n=hh[t];return typeof n=="function"?n(a,r,s):n},gh={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},xh={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},bh={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},vh={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},yh={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},wh={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},jh=(t,a)=>{const r=Number(t);switch(a?.unit){case"date":return r.toString()+"日";case"hour":return r.toString()+"时";case"minute":return r.toString()+"分";case"second":return r.toString()+"秒";default:return"第 "+r.toString()}},Nh={ordinalNumber:jh,era:ce({values:gh,defaultWidth:"wide"}),quarter:ce({values:xh,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ce({values:bh,defaultWidth:"wide"}),day:ce({values:vh,defaultWidth:"wide"}),dayPeriod:ce({values:yh,defaultWidth:"wide",formattingValues:wh,defaultFormattingWidth:"wide"})},Ch=/^(第\s*)?\d+(日|时|分|秒)?/i,kh=/\d+/i,Sh={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},Eh={any:[/^(前)/i,/^(公元)/i]},Th={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},Dh={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},Ah={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},Rh={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},Ph={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},Mh={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},Fh={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},Ih={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},Lh={ordinalNumber:zt({matchPattern:Ch,parsePattern:kh,valueCallback:t=>parseInt(t,10)}),era:de({matchPatterns:Sh,defaultMatchWidth:"wide",parsePatterns:Eh,defaultParseWidth:"any"}),quarter:de({matchPatterns:Th,defaultMatchWidth:"wide",parsePatterns:Dh,defaultParseWidth:"any",valueCallback:t=>t+1}),month:de({matchPatterns:Ah,defaultMatchWidth:"wide",parsePatterns:Rh,defaultParseWidth:"any"}),day:de({matchPatterns:Ph,defaultMatchWidth:"wide",parsePatterns:Mh,defaultParseWidth:"any"}),dayPeriod:de({matchPatterns:Fh,defaultMatchWidth:"any",parsePatterns:Ih,defaultParseWidth:"any"})},ao={code:"zh-CN",formatDistance:ch,formatLong:fh,formatRelative:ph,localize:Nh,match:Lh,options:{weekStartsOn:1,firstWeekContainsDate:4}},$h=(t=wt)=>[{label:"Aujourd'hui",value:()=>new Date},{label:"Hier",value:()=>H.subDays(new Date,1)},{label:"Demain",value:()=>H.addDays(new Date,1)},{label:"Cette semaine",range:()=>({from:H.startOfWeek(new Date,{locale:t}),to:H.endOfWeek(new Date,{locale:t})})},{label:"Semaine dernière",range:()=>({from:H.startOfWeek(H.subWeeks(new Date,1),{locale:t}),to:H.endOfWeek(H.subWeeks(new Date,1),{locale:t})})},{label:"Ce mois",range:()=>({from:H.startOfMonth(new Date),to:H.endOfMonth(new Date)})},{label:"Mois dernier",range:()=>({from:H.startOfMonth(H.subMonths(new Date,1)),to:H.endOfMonth(H.subMonths(new Date,1))})},{label:"Ce trimestre",range:()=>({from:H.startOfQuarter(new Date),to:H.endOfQuarter(new Date)})},{label:"Cette année",range:()=>({from:H.startOfYear(new Date),to:H.endOfYear(new Date)})}],Oh=()=>[{label:"7 derniers jours",range:()=>({from:H.subDays(new Date,7),to:new Date})},{label:"30 derniers jours",range:()=>({from:H.subDays(new Date,30),to:new Date})},{label:"90 derniers jours",range:()=>({from:H.subDays(new Date,90),to:new Date})}],_h=t=>t.map(a=>({label:`${a} prochains jours`,range:()=>({from:new Date,to:H.addDays(new Date,a)})})),zh=(t,a)=>{if(typeof a=="function"){const r=a();return"from"in r&&r.from&&r.to?{label:t,range:()=>({from:r.from,to:r.to})}:{label:t,value:a}}return"from"in a&&a.from&&a.to?{label:t,range:{from:a.from,to:a.to}}:{label:t,value:a}},Vh=t=>H.isAfter(t,H.endOfDay(new Date)),ro=t=>H.isBefore(t,H.startOfDay(new Date)),Wh=t=>{const a=new Date;return t.getDate()===a.getDate()&&t.getMonth()===a.getMonth()&&t.getFullYear()===a.getFullYear()},ps=t=>{const a=t.getDay();return a!==0&&a!==6},so=t=>{const a=t.getDay();return a===0||a===6},no=(t,a)=>a.some(r=>H.isEqual(H.startOfDay(r),H.startOfDay(t))),St=(t,a,r)=>H.isWithinInterval(t,{start:a,end:r}),Uh=t=>a=>{const r=H.subYears(new Date,t);return H.isAfter(a,r)?`L'âge minimum est de ${t} ans`:!0},Hh=t=>a=>{const r=H.subYears(new Date,t);return H.isBefore(a,r)?`L'âge maximum est de ${t} ans`:!0},qh=t=>ro(t)?"Cette date est expirée":!0,Bh=(t,a)=>({days:H.differenceInDays(a,t),weeks:H.differenceInWeeks(a,t),months:H.differenceInMonths(a,t)}),Gh=(t,a="PPP",r=wt)=>t.from?t.to?`${H.format(t.from,a,{locale:r})} - ${H.format(t.to,a,{locale:r})}`:H.format(t.from,a,{locale:r}):"",Xh=t=>[new Date(t,0,1),new Date(t,4,1),new Date(t,4,8),new Date(t,6,14),new Date(t,7,15),new Date(t,10,1),new Date(t,10,11),new Date(t,11,25)],gs=(t,a)=>{const r=[],s=H.startOfMonth(new Date(t,a)),n=H.endOfMonth(new Date(t,a));let i=s;for(;H.isBefore(i,n)||H.isEqual(i,n);)r.push(i),i=H.addDays(i,1);return r},Kh=(t,a)=>gs(t,a).filter(so),Yh=(t,a)=>gs(t,a).filter(ps),Jh=()=>t=>{const a=new Date,r=H.endOfMonth(t);if(H.isBefore(r,a))return"La carte est expirée";const s=H.addMonths(a,3);return H.isBefore(r,s)?"La carte expire bientôt":!0},Qh=t=>a=>{const r=H.addDays(new Date,t);return H.isBefore(a,r)?`La réservation doit être faite ${t} jours à l'avance minimum`:!0},Zh=t=>a=>!a.from||!a.to?!0:H.differenceInDays(a.to,a.from)>t?`La période ne peut pas dépasser ${t} jours`:!0,ep=(t,a)=>H.isEqual(H.startOfDay(t),H.startOfDay(a)),tp=(t,a,r=[])=>{let s=0,n=H.startOfDay(t);const i=H.startOfDay(a);for(;H.isBefore(n,i)||H.isEqual(n,i);)ps(n)&&!no(n,r)&&s++,n=H.addDays(n,1);return s},ap=t=>{const a=t||new Date().getFullYear();return[1,2,3,4].map(r=>{const s=H.startOfQuarter(new Date(a,(r-1)*3,1)),n=H.endOfQuarter(s);return{label:`T${r} ${a}`,range:()=>({from:s,to:n})}})},rp=(t,a=wt)=>{const r=t||new Date().getFullYear();return Array.from({length:12},(s,n)=>{const i=H.startOfMonth(new Date(r,n,1)),c=H.endOfMonth(i);return{label:H.format(i,"MMMM yyyy",{locale:a}),range:()=>({from:i,to:c})}})},sp=t=>t.getTime(),np=t=>new Date(t),op=t=>H.startOfDay(t),ip=(t,a)=>!t.from||!t.to||!a.from||!a.to?!1:H.isEqual(H.startOfDay(t.from),H.startOfDay(a.from))&&H.isEqual(H.startOfDay(t.to),H.startOfDay(a.to)),lp=(t,a)=>!t.from||!t.to||!a.from||!a.to||!(St(t.from,a.from,a.to)||St(t.to,a.from,a.to)||St(a.from,t.from,t.to)||St(a.to,t.from,t.to))?null:{from:H.isBefore(t.from,a.from)?t.from:a.from,to:H.isAfter(t.to,a.to)?t.to:a.to},cp=(t,a)=>!t.from||!t.to||!a.from||!a.to?!1:St(t.from,a.from,a.to)||St(t.to,a.from,a.to)||St(a.from,t.from,t.to)||St(a.to,t.from,t.to);class xs{constructor(a){this.loadedThemes=new Set,this.styleElements=new Map,this.config={baseUrl:a.baseUrl,cache:a.cache??!0,timeout:a.timeout??1e4,onError:a.onError??(r=>console.error("Theme loading error:",r)),onSuccess:a.onSuccess??(()=>{})}}async loadTheme(a){if(this.config.cache&&this.loadedThemes.has(a)){le.debug(`Theme "${a}" already loaded from cache`),this.applyTheme(a);return}try{const r=new AbortController,s=setTimeout(()=>r.abort(),this.config.timeout),n=this.buildThemeUrl(a);le.debug(`Loading theme from: ${n}`);const i=await fetch(n,{signal:r.signal,headers:{Accept:"text/css"}});if(clearTimeout(s),!i.ok)throw new Error(`Failed to load theme: ${i.status} ${i.statusText}`);const c=await i.text();if(!c.includes(`[data-theme="${a}"]`))throw new Error(`Invalid theme CSS: missing [data-theme="${a}"] selector`);this.injectThemeStyles(a,c),this.loadedThemes.add(a),this.applyTheme(a),this.config.onSuccess(a)}catch(r){const s=r instanceof Error?r:new Error(String(r));throw this.config.onError(s,a),s}}applyTheme(a){if(typeof document>"u")return;document.documentElement.setAttribute("data-theme",a);try{localStorage.setItem("theme",a)}catch(s){console.warn("Could not save theme to localStorage:",s)}le.debug(`Applied theme: ${a}`)}getCurrentTheme(){return typeof document>"u"?null:document.documentElement.getAttribute("data-theme")}loadSavedTheme(){if(typeof window>"u")return null;try{return localStorage.getItem("theme")}catch(a){return console.warn("Could not load theme from localStorage:",a),null}}async preloadThemes(a){le.debug(`Preloading ${a.length} themes...`),await Promise.allSettled(a.map(r=>this.loadTheme(r))),le.debug(`Preloaded ${this.loadedThemes.size} themes`)}unloadTheme(a){const r=this.styleElements.get(a);r&&(r.remove(),this.styleElements.delete(a)),this.loadedThemes.delete(a),le.debug(`Unloaded theme: ${a}`)}clearCache(){this.styleElements.forEach(a=>a.remove()),this.styleElements.clear(),this.loadedThemes.clear(),le.debug("Theme cache cleared")}getLoadedThemes(){return Array.from(this.loadedThemes)}buildThemeUrl(a){return`${this.config.baseUrl.replace(/\/$/,"")}/${a}.css`}injectThemeStyles(a,r){if(typeof document>"u")return;const s=this.styleElements.get(a);s&&s.remove();const n=document.createElement("style");n.setAttribute("data-theme-name",a),n.textContent=r,document.head.appendChild(n),this.styleElements.set(a,n)}}let Aa=null;function dp(t){return Aa=new xs(t),Aa}function bs(){if(!Aa)throw new Error("ThemeLoader not initialized. Call initThemeLoader() first.");return Aa}async function up(t){return bs().loadTheme(t)}function mp(t){bs().applyTheme(t)}function fp(t){if(typeof window>"u")return{loadTheme:async()=>{},applyTheme:()=>{},currentTheme:null,loadedThemes:[],isLoading:!1};const a=Aa||new xs({baseUrl:t?.baseUrl||"/themes",...t}),[r,s]=m.useState(!1),[n,i]=m.useState(a.getCurrentTheme());return{loadTheme:async o=>{s(!0);try{await a.loadTheme(o),i(o)}finally{s(!1)}},applyTheme:o=>{a.applyTheme(o),i(o)},currentTheme:n,loadedThemes:a.getLoadedThemes(),isLoading:r}}var ln=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var zr={exports:{}},cn;function pp(){return cn||(cn=1,(function(t){var a=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var r=(function(s){var n=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,i=0,c={},l={manual:s.Prism&&s.Prism.manual,disableWorkerMessageHandler:s.Prism&&s.Prism.disableWorkerMessageHandler,util:{encode:function h(b){return b instanceof o?new o(b.type,h(b.content),b.alias):Array.isArray(b)?b.map(h):b.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(h){return Object.prototype.toString.call(h).slice(8,-1)},objId:function(h){return h.__id||Object.defineProperty(h,"__id",{value:++i}),h.__id},clone:function h(b,w){w=w||{};var E,v;switch(l.util.type(b)){case"Object":if(v=l.util.objId(b),w[v])return w[v];E={},w[v]=E;for(var $ in b)b.hasOwnProperty($)&&(E[$]=h(b[$],w));return E;case"Array":return v=l.util.objId(b),w[v]?w[v]:(E=[],w[v]=E,b.forEach(function(D,C){E[C]=h(D,w)}),E);default:return b}},getLanguage:function(h){for(;h;){var b=n.exec(h.className);if(b)return b[1].toLowerCase();h=h.parentElement}return"none"},setLanguage:function(h,b){h.className=h.className.replace(RegExp(n,"gi"),""),h.classList.add("language-"+b)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(E){var h=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(E.stack)||[])[1];if(h){var b=document.getElementsByTagName("script");for(var w in b)if(b[w].src==h)return b[w]}return null}},isActive:function(h,b,w){for(var E="no-"+b;h;){var v=h.classList;if(v.contains(b))return!0;if(v.contains(E))return!1;h=h.parentElement}return!!w}},languages:{plain:c,plaintext:c,text:c,txt:c,extend:function(h,b){var w=l.util.clone(l.languages[h]);for(var E in b)w[E]=b[E];return w},insertBefore:function(h,b,w,E){E=E||l.languages;var v=E[h],$={};for(var D in v)if(v.hasOwnProperty(D)){if(D==b)for(var C in w)w.hasOwnProperty(C)&&($[C]=w[C]);w.hasOwnProperty(D)||($[D]=v[D])}var T=E[h];return E[h]=$,l.languages.DFS(l.languages,function(M,R){R===T&&M!=h&&(this[M]=$)}),$},DFS:function h(b,w,E,v){v=v||{};var $=l.util.objId;for(var D in b)if(b.hasOwnProperty(D)){w.call(b,D,b[D],E||D);var C=b[D],T=l.util.type(C);T==="Object"&&!v[$(C)]?(v[$(C)]=!0,h(C,w,null,v)):T==="Array"&&!v[$(C)]&&(v[$(C)]=!0,h(C,w,D,v))}}},plugins:{},highlightAll:function(h,b){l.highlightAllUnder(document,h,b)},highlightAllUnder:function(h,b,w){var E={callback:w,container:h,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};l.hooks.run("before-highlightall",E),E.elements=Array.prototype.slice.apply(E.container.querySelectorAll(E.selector)),l.hooks.run("before-all-elements-highlight",E);for(var v=0,$;$=E.elements[v++];)l.highlightElement($,b===!0,E.callback)},highlightElement:function(h,b,w){var E=l.util.getLanguage(h),v=l.languages[E];l.util.setLanguage(h,E);var $=h.parentElement;$&&$.nodeName.toLowerCase()==="pre"&&l.util.setLanguage($,E);var D=h.textContent,C={element:h,language:E,grammar:v,code:D};function T(R){C.highlightedCode=R,l.hooks.run("before-insert",C),C.element.innerHTML=C.highlightedCode,l.hooks.run("after-highlight",C),l.hooks.run("complete",C),w&&w.call(C.element)}if(l.hooks.run("before-sanity-check",C),$=C.element.parentElement,$&&$.nodeName.toLowerCase()==="pre"&&!$.hasAttribute("tabindex")&&$.setAttribute("tabindex","0"),!C.code){l.hooks.run("complete",C),w&&w.call(C.element);return}if(l.hooks.run("before-highlight",C),!C.grammar){T(l.util.encode(C.code));return}if(b&&s.Worker){var M=new Worker(l.filename);M.onmessage=function(R){T(R.data)},M.postMessage(JSON.stringify({language:C.language,code:C.code,immediateClose:!0}))}else T(l.highlight(C.code,C.grammar,C.language))},highlight:function(h,b,w){var E={code:h,grammar:b,language:w};if(l.hooks.run("before-tokenize",E),!E.grammar)throw new Error('The language "'+E.language+'" has no grammar.');return E.tokens=l.tokenize(E.code,E.grammar),l.hooks.run("after-tokenize",E),o.stringify(l.util.encode(E.tokens),E.language)},tokenize:function(h,b){var w=b.rest;if(w){for(var E in w)b[E]=w[E];delete b.rest}var v=new f;return p(v,v.head,h),u(h,v,b,v.head,0),y(v)},hooks:{all:{},add:function(h,b){var w=l.hooks.all;w[h]=w[h]||[],w[h].push(b)},run:function(h,b){var w=l.hooks.all[h];if(!(!w||!w.length))for(var E=0,v;v=w[E++];)v(b)}},Token:o};s.Prism=l;function o(h,b,w,E){this.type=h,this.content=b,this.alias=w,this.length=(E||"").length|0}o.stringify=function h(b,w){if(typeof b=="string")return b;if(Array.isArray(b)){var E="";return b.forEach(function(T){E+=h(T,w)}),E}var v={type:b.type,content:h(b.content,w),tag:"span",classes:["token",b.type],attributes:{},language:w},$=b.alias;$&&(Array.isArray($)?Array.prototype.push.apply(v.classes,$):v.classes.push($)),l.hooks.run("wrap",v);var D="";for(var C in v.attributes)D+=" "+C+'="'+(v.attributes[C]||"").replace(/"/g,""")+'"';return"<"+v.tag+' class="'+v.classes.join(" ")+'"'+D+">"+v.content+"</"+v.tag+">"};function d(h,b,w,E){h.lastIndex=b;var v=h.exec(w);if(v&&E&&v[1]){var $=v[1].length;v.index+=$,v[0]=v[0].slice($)}return v}function u(h,b,w,E,v,$){for(var D in w)if(!(!w.hasOwnProperty(D)||!w[D])){var C=w[D];C=Array.isArray(C)?C:[C];for(var T=0;T<C.length;++T){if($&&$.cause==D+","+T)return;var M=C[T],R=M.inside,I=!!M.lookbehind,U=!!M.greedy,O=M.alias;if(U&&!M.pattern.global){var W=M.pattern.toString().match(/[imsuy]*$/)[0];M.pattern=RegExp(M.pattern.source,W+"g")}for(var F=M.pattern||M,L=E.next,_=v;L!==b.tail&&!($&&_>=$.reach);_+=L.value.length,L=L.next){var P=L.value;if(b.length>h.length)return;if(!(P instanceof o)){var V=1,z;if(U){if(z=d(F,_,h,I),!z||z.index>=h.length)break;var J=z.index,X=z.index+z[0].length,q=_;for(q+=L.value.length;J>=q;)L=L.next,q+=L.value.length;if(q-=L.value.length,_=q,L.value instanceof o)continue;for(var B=L;B!==b.tail&&(q<X||typeof B.value=="string");B=B.next)V++,q+=B.value.length;V--,P=h.slice(_,q),z.index-=_}else if(z=d(F,0,P,I),!z)continue;var J=z.index,Q=z[0],te=P.slice(0,J),ee=P.slice(J+Q.length),ue=_+P.length;$&&ue>$.reach&&($.reach=ue);var Y=L.prev;te&&(Y=p(b,Y,te),_+=te.length),g(b,Y,V);var K=new o(D,R?l.tokenize(Q,R):Q,O,Q);if(L=p(b,Y,K),ee&&p(b,L,ee),V>1){var re={cause:D+","+T,reach:ue};u(h,b,w,L.prev,_,re),$&&re.reach>$.reach&&($.reach=re.reach)}}}}}}function f(){var h={value:null,prev:null,next:null},b={value:null,prev:h,next:null};h.next=b,this.head=h,this.tail=b,this.length=0}function p(h,b,w){var E=b.next,v={value:w,prev:b,next:E};return b.next=v,E.prev=v,h.length++,v}function g(h,b,w){for(var E=b.next,v=0;v<w&&E!==h.tail;v++)E=E.next;b.next=E,E.prev=b,h.length-=v}function y(h){for(var b=[],w=h.head.next;w!==h.tail;)b.push(w.value),w=w.next;return b}if(!s.document)return s.addEventListener&&(l.disableWorkerMessageHandler||s.addEventListener("message",function(h){var b=JSON.parse(h.data),w=b.language,E=b.code,v=b.immediateClose;s.postMessage(l.highlight(E,l.languages[w],w)),v&&s.close()},!1)),l;var j=l.util.currentScript();j&&(l.filename=j.src,j.hasAttribute("data-manual")&&(l.manual=!0));function A(){l.manual||l.highlightAll()}if(!l.manual){var x=document.readyState;x==="loading"||x==="interactive"&&j&&j.defer?document.addEventListener("DOMContentLoaded",A):window.requestAnimationFrame?window.requestAnimationFrame(A):window.setTimeout(A,16)}return l})(a);t.exports&&(t.exports=r),typeof ln<"u"&&(ln.Prism=r),r.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},r.languages.markup.tag.inside["attr-value"].inside.entity=r.languages.markup.entity,r.languages.markup.doctype.inside["internal-subset"].inside=r.languages.markup,r.hooks.add("wrap",function(s){s.type==="entity"&&(s.attributes.title=s.content.replace(/&/,"&"))}),Object.defineProperty(r.languages.markup.tag,"addInlined",{value:function(n,i){var c={};c["language-"+i]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:r.languages[i]},c.cdata=/^<!\[CDATA\[|\]\]>$/i;var l={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:c}};l["language-"+i]={pattern:/[\s\S]+/,inside:r.languages[i]};var o={};o[n]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:l},r.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(r.languages.markup.tag,"addAttribute",{value:function(s,n){r.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+s+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:r.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),r.languages.html=r.languages.markup,r.languages.mathml=r.languages.markup,r.languages.svg=r.languages.markup,r.languages.xml=r.languages.extend("markup",{}),r.languages.ssml=r.languages.xml,r.languages.atom=r.languages.xml,r.languages.rss=r.languages.xml,(function(s){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;s.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},s.languages.css.atrule.inside.rest=s.languages.css;var i=s.languages.markup;i&&(i.tag.addInlined("style","css"),i.tag.addAttribute("style","css"))})(r),r.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},r.languages.javascript=r.languages.extend("clike",{"class-name":[r.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),r.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,r.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:r.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:r.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:r.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:r.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:r.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),r.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:r.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),r.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),r.languages.markup&&(r.languages.markup.tag.addInlined("script","javascript"),r.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),r.languages.js=r.languages.javascript,(function(){if(typeof r>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var s="Loading…",n=function(j,A){return"✖ Error "+j+" while fetching file: "+A},i="✖ Error: File does not exist or is empty",c={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},l="data-src-status",o="loading",d="loaded",u="failed",f="pre[data-src]:not(["+l+'="'+d+'"]):not(['+l+'="'+o+'"])';function p(j,A,x){var h=new XMLHttpRequest;h.open("GET",j,!0),h.onreadystatechange=function(){h.readyState==4&&(h.status<400&&h.responseText?A(h.responseText):h.status>=400?x(n(h.status,h.statusText)):x(i))},h.send(null)}function g(j){var A=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(j||"");if(A){var x=Number(A[1]),h=A[2],b=A[3];return h?b?[x,Number(b)]:[x,void 0]:[x,x]}}r.hooks.add("before-highlightall",function(j){j.selector+=", "+f}),r.hooks.add("before-sanity-check",function(j){var A=j.element;if(A.matches(f)){j.code="",A.setAttribute(l,o);var x=A.appendChild(document.createElement("CODE"));x.textContent=s;var h=A.getAttribute("data-src"),b=j.language;if(b==="none"){var w=(/\.(\w+)$/.exec(h)||[,"none"])[1];b=c[w]||w}r.util.setLanguage(x,b),r.util.setLanguage(A,b);var E=r.plugins.autoloader;E&&E.loadLanguages(b),p(h,function(v){A.setAttribute(l,d);var $=g(A.getAttribute("data-range"));if($){var D=v.split(/\r\n?|\n/g),C=$[0],T=$[1]==null?D.length:$[1];C<0&&(C+=D.length),C=Math.max(0,Math.min(C-1,D.length)),T<0&&(T+=D.length),T=Math.max(0,Math.min(T,D.length)),v=D.slice(C,T).join(`
|
|
2
|
-
`),A.hasAttribute("data-start")||A.setAttribute("data-start",String(C+1))}x.textContent=v,r.highlightElement(x)},function(v){A.setAttribute(l,u),x.textContent=v})}}),r.plugins.fileHighlight={highlight:function(A){for(var x=(A||document).querySelectorAll(f),h=0,b;b=x[h++];)r.highlightElement(b)}};var y=!1;r.fileHighlight=function(){y||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),y=!0),r.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(zr)),zr.exports}var gp=pp();const Vr=hp(gp);var dn={},un;function xp(){return un||(un=1,(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var a=t.languages.extend("typescript",{});delete a["class-name"],t.languages.typescript["class-name"].inside=a,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:a}}}}),t.languages.ts=t.languages.typescript})(Prism)),dn}xp();Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;(function(t){var a=t.util.clone(t.languages.javascript),r=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,s=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,n=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function i(o,d){return o=o.replace(/<S>/g,function(){return r}).replace(/<BRACES>/g,function(){return s}).replace(/<SPREAD>/g,function(){return n}),RegExp(o,d)}n=i(n).source,t.languages.jsx=t.languages.extend("markup",a),t.languages.jsx.tag.pattern=i(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),t.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,t.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,t.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,t.languages.jsx.tag.inside.comment=a.comment,t.languages.insertBefore("inside","attr-name",{spread:{pattern:i(/<SPREAD>/.source),inside:t.languages.jsx}},t.languages.jsx.tag),t.languages.insertBefore("inside","special-attr",{script:{pattern:i(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:t.languages.jsx}}},t.languages.jsx.tag);var c=function(o){return o?typeof o=="string"?o:typeof o.content=="string"?o.content:o.content.map(c).join(""):""},l=function(o){for(var d=[],u=0;u<o.length;u++){var f=o[u],p=!1;if(typeof f!="string"&&(f.type==="tag"&&f.content[0]&&f.content[0].type==="tag"?f.content[0].content[0].content==="</"?d.length>0&&d[d.length-1].tagName===c(f.content[0].content[1])&&d.pop():f.content[f.content.length-1].content==="/>"||d.push({tagName:c(f.content[0].content[1]),openedBraces:0}):d.length>0&&f.type==="punctuation"&&f.content==="{"?d[d.length-1].openedBraces++:d.length>0&&d[d.length-1].openedBraces>0&&f.type==="punctuation"&&f.content==="}"?d[d.length-1].openedBraces--:p=!0),(p||typeof f=="string")&&d.length>0&&d[d.length-1].openedBraces===0){var g=c(f);u<o.length-1&&(typeof o[u+1]=="string"||o[u+1].type==="plain-text")&&(g+=c(o[u+1]),o.splice(u+1,1)),u>0&&(typeof o[u-1]=="string"||o[u-1].type==="plain-text")&&(g=c(o[u-1])+g,o.splice(u-1,1),u--),o[u]=new t.Token("plain-text",g,null,g)}f.content&&typeof f.content!="string"&&l(f.content)}};t.hooks.add("after-tokenize",function(o){o.language!=="jsx"&&o.language!=="tsx"||l(o.tokens)})})(Prism);(function(t){var a=t.util.clone(t.languages.typescript);t.languages.tsx=t.languages.extend("jsx",a),delete t.languages.tsx.parameter,delete t.languages.tsx["literal-property"];var r=t.languages.tsx.tag;r.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+r.pattern.source+")",r.pattern.flags),r.lookbehind=!0})(Prism);(function(t){var a=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+a.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+a.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+a.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+a.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:a,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var r=t.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(Prism);var mn={},fn;function bp(){return fn||(fn=1,Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),Prism.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),Prism.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),Prism.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),Prism.languages.scss.atrule.inside.rest=Prism.languages.scss),mn}bp();Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(t){var a="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",r={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},s={bash:r,environment:{pattern:RegExp("\\$"+a),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+a),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+a),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:s},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:r}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:s},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:s.entity}}],environment:{pattern:RegExp("\\$?"+a),alias:"constant"},variable:s.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},r.inside=t.languages.bash;for(var n=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],i=s.variable[1].inside,c=0;c<n.length;c++)i[n[c]]=t.languages.bash[n[c]];t.languages.sh=t.languages.bash,t.languages.shell=t.languages.bash})(Prism);var hn={},pn;function vp(){return pn||(pn=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),hn}vp();var gn={},xn;function yp(){return xn||(xn=1,(function(t){var a=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,r=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,s={pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[s,{pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:s.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+r+/[A-Z]\w*\b/.source),lookbehind:!0,inside:s.inside}],keyword:a,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":s,keyword:a,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+r+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:s.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+r+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:s.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return a.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism)),gn}yp();var bn={},vn;function wp(){return vn||(vn=1,(function(t){function a(_,P){return _.replace(/<<(\d+)>>/g,function(V,z){return"(?:"+P[+z]+")"})}function r(_,P,V){return RegExp(a(_,P),"")}function s(_,P){for(var V=0;V<P;V++)_=_.replace(/<<self>>/g,function(){return"(?:"+_+")"});return _.replace(/<<self>>/g,"[^\\s\\S]")}var n={type:"bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",typeDeclaration:"class enum interface record struct",contextual:"add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",other:"abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"};function i(_){return"\\b(?:"+_.trim().replace(/ /g,"|")+")\\b"}var c=i(n.typeDeclaration),l=RegExp(i(n.type+" "+n.typeDeclaration+" "+n.contextual+" "+n.other)),o=i(n.typeDeclaration+" "+n.contextual+" "+n.other),d=i(n.type+" "+n.typeDeclaration+" "+n.other),u=s(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source,2),f=s(/\((?:[^()]|<<self>>)*\)/.source,2),p=/@?\b[A-Za-z_]\w*\b/.source,g=a(/<<0>>(?:\s*<<1>>)?/.source,[p,u]),y=a(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[o,g]),j=/\[\s*(?:,\s*)*\]/.source,A=a(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[y,j]),x=a(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[u,f,j]),h=a(/\(<<0>>+(?:,<<0>>+)+\)/.source,[x]),b=a(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[h,y,j]),w={keyword:l,punctuation:/[<>()?,.:[\]]/},E=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,v=/"(?:\\.|[^\\"\r\n])*"/.source,$=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;t.languages.csharp=t.languages.extend("clike",{string:[{pattern:r(/(^|[^$\\])<<0>>/.source,[$]),lookbehind:!0,greedy:!0},{pattern:r(/(^|[^@$\\])<<0>>/.source,[v]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:r(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[y]),lookbehind:!0,inside:w},{pattern:r(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[p,b]),lookbehind:!0,inside:w},{pattern:r(/(\busing\s+)<<0>>(?=\s*=)/.source,[p]),lookbehind:!0},{pattern:r(/(\b<<0>>\s+)<<1>>/.source,[c,g]),lookbehind:!0,inside:w},{pattern:r(/(\bcatch\s*\(\s*)<<0>>/.source,[y]),lookbehind:!0,inside:w},{pattern:r(/(\bwhere\s+)<<0>>/.source,[p]),lookbehind:!0},{pattern:r(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[A]),lookbehind:!0,inside:w},{pattern:r(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[b,d,p]),inside:w}],keyword:l,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),t.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),t.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:r(/([(,]\s*)<<0>>(?=\s*:)/.source,[p]),lookbehind:!0,alias:"punctuation"}}),t.languages.insertBefore("csharp","class-name",{namespace:{pattern:r(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[p]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:r(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[f]),lookbehind:!0,alias:"class-name",inside:w},"return-type":{pattern:r(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[b,y]),inside:w,alias:"class-name"},"constructor-invocation":{pattern:r(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[b]),lookbehind:!0,inside:w,alias:"class-name"},"generic-method":{pattern:r(/<<0>>\s*<<1>>(?=\s*\()/.source,[p,u]),inside:{function:r(/^<<0>>/.source,[p]),generic:{pattern:RegExp(u),alias:"class-name",inside:w}}},"type-list":{pattern:r(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[c,g,p,b,l.source,f,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:r(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[g,f]),lookbehind:!0,greedy:!0,inside:t.languages.csharp},keyword:l,"class-name":{pattern:RegExp(b),greedy:!0,inside:w},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var D=v+"|"+E,C=a(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[D]),T=s(a(/[^"'/()]|<<0>>|\(<<self>>*\)/.source,[C]),2),M=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,R=a(/<<0>>(?:\s*\(<<1>>*\))?/.source,[y,T]);t.languages.insertBefore("csharp","class-name",{attribute:{pattern:r(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[M,R]),lookbehind:!0,greedy:!0,inside:{target:{pattern:r(/^<<0>>(?=\s*:)/.source,[M]),alias:"keyword"},"attribute-arguments":{pattern:r(/\(<<0>>*\)/.source,[T]),inside:t.languages.csharp},"class-name":{pattern:RegExp(y),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var I=/:[^}\r\n]+/.source,U=s(a(/[^"'/()]|<<0>>|\(<<self>>*\)/.source,[C]),2),O=a(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[U,I]),W=s(a(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source,[D]),2),F=a(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[W,I]);function L(_,P){return{interpolation:{pattern:r(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[_]),lookbehind:!0,inside:{"format-string":{pattern:r(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[P,I]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:t.languages.csharp}}},string:/[\s\S]+/}}t.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:r(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[O]),lookbehind:!0,greedy:!0,inside:L(O,U)},{pattern:r(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[F]),lookbehind:!0,greedy:!0,inside:L(F,W)}],char:{pattern:RegExp(E),greedy:!0}}),t.languages.dotnet=t.languages.cs=t.languages.csharp})(Prism)),bn}wp();var yn={},wn;function jp(){return wn||(wn=1,(function(t){var a=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,r=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],s=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,n=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,i=/[{}\[\](),:;]/;t.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:a,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:s,operator:n,punctuation:i};var c={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:t.languages.php},l=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:c}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:c}}];t.languages.insertBefore("php","variable",{string:l,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:a,string:l,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,number:s,operator:n,punctuation:i}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),t.hooks.add("before-tokenize",function(o){if(/<\?/.test(o.code)){var d=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;t.languages["markup-templating"].buildPlaceholders(o,"php",d)}}),t.hooks.add("after-tokenize",function(o){t.languages["markup-templating"].tokenizePlaceholders(o,"php")})})(Prism)),yn}jp();var jn={},Nn;function Np(){return Nn||(Nn=1,(function(t){t.languages.ruby=t.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),t.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var a={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:t.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete t.languages.ruby.function;var r="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",s=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;t.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+r+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:a,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:a,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+s),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+s+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),t.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+r),greedy:!0,inside:{interpolation:a,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:a,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:a,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+r),greedy:!0,inside:{interpolation:a,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:a,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete t.languages.ruby.string,t.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),t.languages.rb=t.languages.ruby})(Prism)),jn}Np();Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/});Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}});delete Prism.languages.go["class-name"];var Cn={},kn;function Cp(){return kn||(kn=1,(function(t){for(var a=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,r=0;r<2;r++)a=a.replace(/<self>/g,function(){return a});a=a.replace(/<self>/g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+a),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(Prism)),Cn}Cp();Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};(function(t){var a=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(u){return u=u.replace(/<inner>/g,function(){return a}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+u+")")}var s=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,n=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return s}),i=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+n+i+"(?:"+n+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+n+i+")(?:"+n+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(s),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+n+")"+i+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+n+"$"),inside:{"table-header":{pattern:RegExp(s),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(u){["url","bold","italic","strike","code-snippet"].forEach(function(f){u!==f&&(t.languages.markdown[u].inside.content.inside[f]=t.languages.markdown[f])})}),t.hooks.add("after-tokenize",function(u){if(u.language!=="markdown"&&u.language!=="md")return;function f(p){if(!(!p||typeof p=="string"))for(var g=0,y=p.length;g<y;g++){var j=p[g];if(j.type!=="code"){f(j.content);continue}var A=j.content[1],x=j.content[3];if(A&&x&&A.type==="code-language"&&x.type==="code-block"&&typeof A.content=="string"){var h=A.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");h=(/[a-z][\w-]*/i.exec(h)||[""])[0].toLowerCase();var b="language-"+h;x.alias?typeof x.alias=="string"?x.alias=[x.alias,b]:x.alias.push(b):x.alias=[b]}}}f(u.tokens)}),t.hooks.add("wrap",function(u){if(u.type==="code-block"){for(var f="",p=0,g=u.classes.length;p<g;p++){var y=u.classes[p],j=/language-(.+)/.exec(y);if(j){f=j[1];break}}var A=t.languages[f];if(A)u.content=t.highlight(d(u.content),A,f);else if(f&&f!=="none"&&t.plugins.autoloader){var x="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);u.attributes.id=x,t.plugins.autoloader.loadLanguages(f,function(){var h=document.getElementById(x);h&&(h.innerHTML=t.highlight(h.textContent,t.languages[f],f))})}}});var c=RegExp(t.languages.markup.tag.pattern.source,"gi"),l={amp:"&",lt:"<",gt:">",quot:'"'},o=String.fromCodePoint||String.fromCharCode;function d(u){var f=u.replace(c,"");return f=f.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(p,g){if(g=g.toLowerCase(),g[0]==="#"){var y;return g[1]==="x"?y=parseInt(g.slice(2),16):y=Number(g.slice(1)),o(y)}else{var j=l[g];return j||p}}),f}t.languages.md=t.languages.markdown})(Prism);(function(t){var a=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,s="(?:"+r.source+"(?:[ ]+"+a.source+")?|"+a.source+"(?:[ ]+"+r.source+")?)",n=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),i=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function c(l,o){o=(o||"").replace(/m/g,"")+"m";var d=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return s}).replace(/<<value>>/g,function(){return l});return RegExp(d,o)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return s})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return s}).replace(/<<key>>/g,function(){return"(?:"+n+"|"+i+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:c(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:c(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:c(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:c(i),lookbehind:!0,greedy:!0},number:{pattern:c(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:r,important:a,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(Prism);(function(t){var a=/\\[\r\n](?:\s|\\[\r\n]|#.*(?!.))*(?![\s#]|\\[\r\n])/.source,r=/(?:[ \t]+(?![ \t])(?:<SP_BS>)?|<SP_BS>)/.source.replace(/<SP_BS>/g,function(){return a}),s=/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'/.source,n=/--[\w-]+=(?:<STR>|(?!["'])(?:[^\s\\]|\\.)+)/.source.replace(/<STR>/g,function(){return s}),i={pattern:RegExp(s),greedy:!0},c={pattern:/(^[ \t]*)#.*/m,lookbehind:!0,greedy:!0};function l(o,d){return o=o.replace(/<OPT>/g,function(){return n}).replace(/<SP>/g,function(){return r}),RegExp(o,d)}t.languages.docker={instruction:{pattern:/(^[ \t]*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)(?:\\.|[^\r\n\\])*(?:\\$(?:\s|#.*$)*(?![\s#])(?:\\.|[^\r\n\\])*)*/im,lookbehind:!0,greedy:!0,inside:{options:{pattern:l(/(^(?:ONBUILD<SP>)?\w+<SP>)<OPT>(?:<SP><OPT>)*/.source,"i"),lookbehind:!0,greedy:!0,inside:{property:{pattern:/(^|\s)--[\w-]+/,lookbehind:!0},string:[i,{pattern:/(=)(?!["'])(?:[^\s\\]|\\.)+/,lookbehind:!0}],operator:/\\$/m,punctuation:/=/}},keyword:[{pattern:l(/(^(?:ONBUILD<SP>)?HEALTHCHECK<SP>(?:<OPT><SP>)*)(?:CMD|NONE)\b/.source,"i"),lookbehind:!0,greedy:!0},{pattern:l(/(^(?:ONBUILD<SP>)?FROM<SP>(?:<OPT><SP>)*(?!--)[^ \t\\]+<SP>)AS/.source,"i"),lookbehind:!0,greedy:!0},{pattern:l(/(^ONBUILD<SP>)\w+/.source,"i"),lookbehind:!0,greedy:!0},{pattern:/^\w+/,greedy:!0}],comment:c,string:i,variable:/\$(?:\w+|\{[^{}"'\\]*\})/,operator:/\\$/m}},comment:c},t.languages.dockerfile=t.languages.docker})(Prism);Prism.languages.git={comment:/^#.*/m,deleted:/^[-–].*/m,inserted:/^\+.*/m,string:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s--?\w+/}},coord:/^@@.*@@$/m,"commit-sha1":/^commit \w{40}$/m};const Sn=$e.cva("relative rounded font-mono",{variants:{variant:{inline:"bg-muted px-[0.3rem] py-[0.2rem] text-xs sm:text-sm",block:"block bg-muted overflow-x-auto"},size:{sm:"text-xs sm:text-sm",base:"text-sm sm:text-base",lg:"text-base sm:text-lg"}},defaultVariants:{variant:"inline",size:"base"}}),oo=m.forwardRef(({className:t,variant:a,size:r,language:s,showLineNumbers:n=!1,maxHeight:i,copyable:c=!1,filename:l,theme:o="auto",children:d,...u},f)=>{const[p,g]=m.useState(!1),[y,j]=m.useState("");m.useRef(null),m.useEffect(()=>{if(a==="block"&&s&&d)try{const x=typeof d=="string"?d:String(d),h=Vr.highlight(x,Vr.languages[s]||Vr.languages.text,s);j(h)}catch(x){console.warn(`Failed to highlight code for language: ${s}`,x),j(String(d))}else j(String(d))},[s,d,a]);const A=async()=>{if(typeof d=="string")try{await navigator.clipboard.writeText(d),g(!0),setTimeout(()=>g(!1),2e3)}catch(x){console.error("Failed to copy code:",x)}};return a==="block"?e.jsxs("div",{className:"relative my-4 sm:my-6",children:[(l||c)&&e.jsxs("div",{className:"flex items-center justify-between bg-muted/50 px-3 sm:px-4 py-2 sm:py-3 rounded-t-lg border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[l&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs sm:text-sm text-muted-foreground",children:[e.jsx(S.FileText,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"font-medium",children:l})]}),s&&!l&&e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground uppercase font-medium",children:s})]}),c&&e.jsx(G,{variant:"ghost",size:"sm",onClick:A,className:"h-6 w-6 sm:h-7 sm:w-7 p-0 hover:bg-muted-foreground/10",children:p?e.jsx(S.Check,{className:"h-3 w-3 sm:h-4 sm:w-4 text-green-600"}):e.jsx(S.Copy,{className:"h-3 w-3 sm:h-4 sm:w-4"})})]}),e.jsx("div",{className:N("waka-code relative",i&&"overflow-hidden"),style:{maxHeight:i?`${i}px`:void 0},children:e.jsxs("pre",{className:N(Sn({variant:a,size:r}),"p-3 sm:p-4 lg:p-6","text-xs sm:text-sm lg:text-base","leading-relaxed sm:leading-loose","whitespace-pre-wrap break-words","scrollbar-thin scrollbar-thumb-muted-foreground/20 scrollbar-track-transparent","hover:scrollbar-thumb-muted-foreground/30",i&&"overflow-y-auto",!l&&!c&&s&&"rounded-lg",l||c?"rounded-b-lg":"rounded-lg",t),children:[n&&e.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-8 sm:w-10 lg:w-12 bg-muted/30 border-r border-border/50 flex flex-col text-xs sm:text-sm text-muted-foreground select-none",children:String(d).split(`
|
|
3
|
-
`).map((x,h)=>e.jsx("div",{className:"flex items-center justify-center h-5 sm:h-6 lg:h-7",children:h+1},h))}),e.jsx("code",{ref:f,className:N("block",n&&"ml-8 sm:ml-10 lg:ml-12",s&&"language-"+s),...u,dangerouslySetInnerHTML:a==="block"&&s?{__html:y}:void 0,children:a==="block"&&s?void 0:d})]})}),s&&!l&&!c&&e.jsx("div",{className:"absolute top-2 right-2 text-xs text-muted-foreground/70 bg-background/80 px-2 py-1 rounded uppercase font-medium",children:s})]}):e.jsx("code",{className:N(Sn({variant:a,size:r}),t),ref:f,...u,children:d})});oo.displayName="Code";const io=mr.Root,lo=mr.CollapsibleTrigger,co=mr.CollapsibleContent,Nr=je.Root,kp=je.Trigger,uo=je.Portal,Sp=je.Close,vs=m.forwardRef(({className:t,...a},r)=>e.jsx(je.Overlay,{ref:r,className:N("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...a}));vs.displayName=je.Overlay.displayName;const Oa=m.forwardRef(({className:t,children:a,...r},s)=>e.jsxs(uo,{children:[e.jsx(vs,{}),e.jsxs(je.Content,{ref:s,className:N("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...r,children:[a,e.jsxs(je.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(S.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Oa.displayName=je.Content.displayName;const Cr=({className:t,...a})=>e.jsx("div",{className:N("flex flex-col space-y-1.5 text-center sm:text-left",t),...a});Cr.displayName="DialogHeader";const mo=({className:t,...a})=>e.jsx("div",{className:N("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a});mo.displayName="DialogFooter";const kr=m.forwardRef(({className:t,...a},r)=>e.jsx(je.Title,{ref:r,className:N("text-lg font-semibold leading-none tracking-tight",t),...a}));kr.displayName=je.Title.displayName;const Sr=m.forwardRef(({className:t,...a},r)=>e.jsx(je.Description,{ref:r,className:N("text-sm text-muted-foreground",t),...a}));Sr.displayName=je.Description.displayName;const Kt=m.forwardRef(({className:t,...a},r)=>e.jsx(Qe.Command,{ref:r,className:N("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...a}));Kt.displayName=Qe.Command.displayName;const Ep=({children:t,...a})=>e.jsx(Nr,{...a,children:e.jsx(Oa,{className:"overflow-hidden p-0 shadow-lg",children:e.jsx(Kt,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[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:t})})}),ca=m.forwardRef(({className:t,...a},r)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(S.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Qe.Command.Input,{ref:r,className:N("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...a})]}));ca.displayName=Qe.Command.Input.displayName;const Er=m.forwardRef(({className:t,...a},r)=>e.jsx(Qe.Command.List,{ref:r,className:N("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...a}));Er.displayName=Qe.Command.List.displayName;const da=m.forwardRef((t,a)=>e.jsx(Qe.Command.Empty,{ref:a,className:"py-6 text-center text-sm",...t}));da.displayName=Qe.Command.Empty.displayName;const Yt=m.forwardRef(({className:t,...a},r)=>e.jsx(Qe.Command.Group,{ref:r,className:N("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...a}));Yt.displayName=Qe.Command.Group.displayName;const fo=m.forwardRef(({className:t,...a},r)=>e.jsx(Qe.Command.Separator,{ref:r,className:N("-mx-1 h-px bg-border",t),...a}));fo.displayName=Qe.Command.Separator.displayName;const Jt=m.forwardRef(({className:t,...a},r)=>e.jsx(Qe.Command.Item,{ref:r,className:N("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a}));Jt.displayName=Qe.Command.Item.displayName;const ho=({className:t,...a})=>e.jsx("span",{className:N("ml-auto text-xs tracking-widest text-muted-foreground",t),...a});ho.displayName="CommandShortcut";const po=ke.Root,go=ke.Trigger,Tp=ke.Group,Dp=ke.Portal,Ap=ke.Sub,Rp=ke.RadioGroup,xo=m.forwardRef(({className:t,inset:a,children:r,...s},n)=>e.jsxs(ke.SubTrigger,{ref:n,className:N("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",a&&"pl-8",t),...s,children:[r,e.jsx(S.ChevronRight,{className:"ml-auto h-4 w-4"})]}));xo.displayName=ke.SubTrigger.displayName;const bo=m.forwardRef(({className:t,...a},r)=>e.jsx(ke.SubContent,{ref:r,className:N("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground 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",t),...a}));bo.displayName=ke.SubContent.displayName;const ys=m.forwardRef(({className:t,...a},r)=>e.jsx(ke.Portal,{children:e.jsx(ke.Content,{ref:r,className:N("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 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",t),...a})}));ys.displayName=ke.Content.displayName;const kt=m.forwardRef(({className:t,inset:a,...r},s)=>e.jsx(ke.Item,{ref:s,className:N("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",t),...r}));kt.displayName=ke.Item.displayName;const vo=m.forwardRef(({className:t,children:a,checked:r,...s},n)=>e.jsxs(ke.CheckboxItem,{ref:n,className:N("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:r,...s,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(ke.ItemIndicator,{children:e.jsx(S.Check,{className:"h-4 w-4"})})}),a]}));vo.displayName=ke.CheckboxItem.displayName;const yo=m.forwardRef(({className:t,children:a,...r},s)=>e.jsxs(ke.RadioItem,{ref:s,className:N("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(ke.ItemIndicator,{children:e.jsx(S.Circle,{className:"h-2 w-2 fill-current"})})}),a]}));yo.displayName=ke.RadioItem.displayName;const wo=m.forwardRef(({className:t,inset:a,...r},s)=>e.jsx(ke.Label,{ref:s,className:N("px-2 py-1.5 text-sm font-semibold text-foreground",a&&"pl-8",t),...r}));wo.displayName=ke.Label.displayName;const Ea=m.forwardRef(({className:t,...a},r)=>e.jsx(ke.Separator,{ref:r,className:N("-mx-1 my-1 h-px bg-border",t),...a}));Ea.displayName=ke.Separator.displayName;const jo=({className:t,...a})=>e.jsx("span",{className:N("ml-auto text-xs tracking-widest text-muted-foreground",t),...a});jo.displayName="ContextMenuShortcut";const Gt=Se.Root,Xt=Se.Trigger,Pp=Se.Group,Mp=Se.Portal,Fp=Se.Sub,Ip=Se.RadioGroup,No=m.forwardRef(({className:t,inset:a,children:r,...s},n)=>e.jsxs(Se.SubTrigger,{ref:n,className:N("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",a&&"pl-8",t),...s,children:[r,e.jsx(S.ChevronRight,{className:"ml-auto h-4 w-4"})]}));No.displayName=Se.SubTrigger.displayName;const Co=m.forwardRef(({className:t,...a},r)=>e.jsx(Se.SubContent,{ref:r,className:N("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground 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",t),...a}));Co.displayName=Se.SubContent.displayName;const Lt=m.forwardRef(({className:t,sideOffset:a=4,...r},s)=>e.jsx(Se.Portal,{children:e.jsx(Se.Content,{ref:s,sideOffset:a,className:N("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground 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",t),...r})}));Lt.displayName=Se.Content.displayName;const _a=m.forwardRef(({className:t,inset:a,...r},s)=>e.jsx(Se.Item,{ref:s,className:N("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",t),...r}));_a.displayName=Se.Item.displayName;const Bt=m.forwardRef(({className:t,children:a,checked:r,...s},n)=>e.jsxs(Se.CheckboxItem,{ref:n,className:N("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-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:r,...s,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Se.ItemIndicator,{children:e.jsx(S.Check,{className:"h-4 w-4"})})}),a]}));Bt.displayName=Se.CheckboxItem.displayName;const ko=m.forwardRef(({className:t,children:a,...r},s)=>e.jsxs(Se.RadioItem,{ref:s,className:N("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-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Se.ItemIndicator,{children:e.jsx(S.Circle,{className:"h-2 w-2 fill-current"})})}),a]}));ko.displayName=Se.RadioItem.displayName;const Ta=m.forwardRef(({className:t,inset:a,...r},s)=>e.jsx(Se.Label,{ref:s,className:N("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",t),...r}));Ta.displayName=Se.Label.displayName;const na=m.forwardRef(({className:t,...a},r)=>e.jsx(Se.Separator,{ref:r,className:N("-mx-1 my-1 h-px bg-muted",t),...a}));na.displayName=Se.Separator.displayName;const So=({className:t,...a})=>e.jsx("span",{className:N("ml-auto text-xs tracking-widest opacity-60",t),...a});So.displayName="DropdownMenuShortcut";var Lp=t=>t.type==="checkbox",Na=t=>t instanceof Date,ws=t=>t==null;const Eo=t=>typeof t=="object";var Qt=t=>!ws(t)&&!Array.isArray(t)&&Eo(t)&&!Na(t),$p=t=>Qt(t)&&t.target?Lp(t.target)?t.target.checked:t.target.value:t,Op=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,_p=(t,a)=>t.has(Op(a)),zp=t=>{const a=t.constructor&&t.constructor.prototype;return Qt(a)&&a.hasOwnProperty("isPrototypeOf")},Vp=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function To(t){let a;const r=Array.isArray(t),s=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)a=new Date(t);else if(!(Vp&&(t instanceof Blob||s))&&(r||Qt(t)))if(a=r?[]:Object.create(Object.getPrototypeOf(t)),!r&&!zp(t))a=t;else for(const n in t)t.hasOwnProperty(n)&&(a[n]=To(t[n]));else return t;return a}var Do=t=>/^\w*$/.test(t),as=t=>t===void 0,Wp=t=>Array.isArray(t)?t.filter(Boolean):[],Ao=t=>Wp(t.replace(/["|']|\]/g,"").split(/\.|\[/)),qe=(t,a,r)=>{if(!a||!Qt(t))return r;const s=(Do(a)?[a]:Ao(a)).reduce((n,i)=>ws(n)?n:n[i],t);return as(s)||s===t?as(t[a])?r:t[a]:s},Wr=t=>typeof t=="boolean",En=(t,a,r)=>{let s=-1;const n=Do(a)?[a]:Ao(a),i=n.length,c=i-1;for(;++s<i;){const l=n[s];let o=r;if(s!==c){const d=t[l];o=Qt(d)||Array.isArray(d)?d:isNaN(+n[s+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;t[l]=o,t=t[l]}};const Tn={BLUR:"blur",CHANGE:"change"},Dn={all:"all"},js=k.createContext(null);js.displayName="HookFormContext";const Tr=()=>k.useContext(js),Up=t=>{const{children:a,...r}=t;return k.createElement(js.Provider,{value:r},a)};var Hp=(t,a,r,s=!0)=>{const n={defaultValues:a._defaultValues};for(const i in t)Object.defineProperty(n,i,{get:()=>{const c=i;return a._proxyFormState[c]!==Dn.all&&(a._proxyFormState[c]=!s||Dn.all),r&&(r[c]=!0),t[c]}});return n};const Ro=typeof window<"u"?k.useLayoutEffect:k.useEffect;function qp(t){const a=Tr(),{control:r=a.control,disabled:s,name:n,exact:i}=t||{},[c,l]=k.useState(r._formState),o=k.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ro(()=>r._subscribe({name:n,formState:o.current,exact:i,callback:d=>{!s&&l({...r._formState,...d})}}),[n,s,i]),k.useEffect(()=>{o.current.isValid&&r._setValid(!0)},[r]),k.useMemo(()=>Hp(c,r,o.current,!1),[c,r])}var Bp=t=>typeof t=="string",An=(t,a,r,s,n)=>Bp(t)?qe(r,t,n):Array.isArray(t)?t.map(i=>qe(r,i)):r,Rn=t=>ws(t)||!Eo(t);function er(t,a,r=new WeakSet){if(Rn(t)||Rn(a))return Object.is(t,a);if(Na(t)&&Na(a))return t.getTime()===a.getTime();const s=Object.keys(t),n=Object.keys(a);if(s.length!==n.length)return!1;if(r.has(t)||r.has(a))return!0;r.add(t),r.add(a);for(const i of s){const c=t[i];if(!n.includes(i))return!1;if(i!=="ref"){const l=a[i];if(Na(c)&&Na(l)||Qt(c)&&Qt(l)||Array.isArray(c)&&Array.isArray(l)?!er(c,l,r):!Object.is(c,l))return!1}}return!0}function Gp(t){const a=Tr(),{control:r=a.control,name:s,defaultValue:n,disabled:i,exact:c,compute:l}=t||{},o=k.useRef(n),d=k.useRef(l),u=k.useRef(void 0),f=k.useRef(r),p=k.useRef(s);d.current=l;const[g,y]=k.useState(()=>{const w=r._getWatch(s,o.current);return d.current?d.current(w):w}),j=k.useCallback(w=>{const E=An(s,r._names,w||r._formValues,!1,o.current);return d.current?d.current(E):E},[r._formValues,r._names,s]),A=k.useCallback(w=>{if(!i){const E=An(s,r._names,w||r._formValues,!1,o.current);if(d.current){const v=d.current(E);er(v,u.current)||(y(v),u.current=v)}else y(E)}},[r._formValues,r._names,i,s]);Ro(()=>((f.current!==r||!er(p.current,s))&&(f.current=r,p.current=s,A()),r._subscribe({name:s,formState:{values:!0},exact:c,callback:w=>{A(w.values)}})),[r,c,s,A]),k.useEffect(()=>r._removeUnmounted());const x=f.current!==r,h=p.current,b=k.useMemo(()=>{if(i)return null;const w=!x&&!er(h,s);return x||w?j():null},[i,x,s,h,j]);return b!==null?b:g}function Xp(t){const a=Tr(),{name:r,disabled:s,control:n=a.control,shouldUnregister:i,defaultValue:c,exact:l=!0}=t,o=_p(n._names.array,r),d=k.useMemo(()=>qe(n._formValues,r,qe(n._defaultValues,r,c)),[n,r,c]),u=Gp({control:n,name:r,defaultValue:d,exact:l}),f=qp({control:n,name:r,exact:l}),p=k.useRef(t),g=k.useRef(void 0),y=k.useRef(n.register(r,{...t.rules,value:u,...Wr(t.disabled)?{disabled:t.disabled}:{}}));p.current=t;const j=k.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!qe(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!qe(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!qe(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!qe(f.validatingFields,r)},error:{enumerable:!0,get:()=>qe(f.errors,r)}}),[f,r]),A=k.useCallback(w=>y.current.onChange({target:{value:$p(w),name:r},type:Tn.CHANGE}),[r]),x=k.useCallback(()=>y.current.onBlur({target:{value:qe(n._formValues,r),name:r},type:Tn.BLUR}),[r,n._formValues]),h=k.useCallback(w=>{const E=qe(n._fields,r);E&&w&&(E._f.ref={focus:()=>w.focus&&w.focus(),select:()=>w.select&&w.select(),setCustomValidity:v=>w.setCustomValidity(v),reportValidity:()=>w.reportValidity()})},[n._fields,r]),b=k.useMemo(()=>({name:r,value:u,...Wr(s)||f.disabled?{disabled:f.disabled||s}:{},onChange:A,onBlur:x,ref:h}),[r,s,f.disabled,A,x,h,u]);return k.useEffect(()=>{const w=n._options.shouldUnregister||i,E=g.current;E&&E!==r&&!o&&n.unregister(E),n.register(r,{...p.current.rules,...Wr(p.current.disabled)?{disabled:p.current.disabled}:{}});const v=($,D)=>{const C=qe(n._fields,$);C&&C._f&&(C._f.mount=D)};if(v(r,!0),w){const $=To(qe(n._options.defaultValues,r,p.current.defaultValue));En(n._defaultValues,r,$),as(qe(n._formValues,r))&&En(n._formValues,r,$)}return!o&&n.register(r),g.current=r,()=>{(o?w&&!n._state.action:w)?n.unregister(r):v(r,!1)}},[r,n,o,i]),k.useEffect(()=>{n._setDisabledField({disabled:s,name:r})},[s,r,n]),k.useMemo(()=>({field:b,formState:f,fieldState:j}),[b,f,j])}const Po=t=>t.render(Xp(t)),Kp=$e.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ve=m.forwardRef(({className:t,...a},r)=>e.jsx(os.Root,{ref:r,className:N(Kp(),t),...a}));ve.displayName=os.Root.displayName;const Yp=Up,Mo=m.createContext({}),Jp=({...t})=>e.jsx(Mo.Provider,{value:{name:t.name},children:e.jsx(Po,{...t})}),za=()=>{const t=m.useContext(Mo),a=m.useContext(Fo),{getFieldState:r,formState:s}=Tr(),n=r(t.name,s);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:i}=a;return{id:i,name:t.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...n}},Fo=m.createContext({}),Io=m.forwardRef(({className:t,...a},r)=>{const s=m.useId();return e.jsx(Fo.Provider,{value:{id:s},children:e.jsx("div",{ref:r,className:N("space-y-2",t),...a})})});Io.displayName="FormItem";const Lo=m.forwardRef(({className:t,...a},r)=>{const{error:s,formItemId:n}=za();return e.jsx(ve,{ref:r,className:N(s&&"text-destructive",t),htmlFor:n,...a})});Lo.displayName="FormLabel";const $o=m.forwardRef(({...t},a)=>{const{error:r,formItemId:s,formDescriptionId:n,formMessageId:i}=za();return e.jsx(La.Slot,{ref:a,id:s,"aria-describedby":r?`${n} ${i}`:`${n}`,"aria-invalid":!!r,...t})});$o.displayName="FormControl";const Oo=m.forwardRef(({className:t,...a},r)=>{const{formDescriptionId:s}=za();return e.jsx("p",{ref:r,id:s,className:N("text-sm text-muted-foreground",t),...a})});Oo.displayName="FormDescription";const _o=m.forwardRef(({className:t,children:a,...r},s)=>{const{error:n,formMessageId:i}=za(),c=n?String(n?.message):a;return c?e.jsx("p",{ref:s,id:i,className:N("text-sm font-medium text-destructive",t),...r,children:c}):null});_o.displayName="FormMessage";const Qp=$a.Root,Zp=$a.Trigger,zo=m.forwardRef(({className:t,align:a="center",sideOffset:r=4,...s},n)=>e.jsx($a.Content,{ref:n,align:a,sideOffset:r,className:N("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s}));zo.displayName=$a.Content.displayName;const Vo=m.forwardRef(({length:t=6,value:a="",onChange:r,onComplete:s,pattern:n="numeric",secure:i=!1,disabled:c=!1,className:l,error:o,size:d="md",separator:u,separatorElement:f=e.jsx("span",{className:"text-muted-foreground",children:"-"}),...p},g)=>{const[y,j]=m.useState(a.split("").slice(0,t)),A=m.useRef([]);m.useEffect(()=>{const D=a.split("").slice(0,t);j(D)},[a,t]);const h=(()=>{switch(n){case"numeric":return/^[0-9]$/;case"alpha":return/^[a-zA-Z]$/;case"alphanumeric":return/^[a-zA-Z0-9]$/;default:return/^.$/}})(),b=(D,C)=>{if(c)return;const T=C.slice(-1);if(T&&!h.test(T))return;const M=[...y];M[D]=T,j(M);const R=M.join("");r?.(R),T&&D<t-1&&A.current[D+1]?.focus(),M.every(I=>I!=="")&&M.length===t&&s?.(R)},w=(D,C)=>{if(!c){if(C.key==="Backspace"){C.preventDefault();const T=[...y];T[D]?(T[D]="",j(T),r?.(T.join(""))):D>0&&(T[D-1]="",j(T),r?.(T.join("")),A.current[D-1]?.focus())}if(C.key==="Delete"){C.preventDefault();const T=[...y];T[D]="",j(T),r?.(T.join(""))}C.key==="ArrowLeft"&&D>0&&(C.preventDefault(),A.current[D-1]?.focus()),C.key==="ArrowRight"&&D<t-1&&(C.preventDefault(),A.current[D+1]?.focus()),C.key==="Home"&&(C.preventDefault(),A.current[0]?.focus()),C.key==="End"&&(C.preventDefault(),A.current[t-1]?.focus())}},E=D=>{if(D.preventDefault(),c)return;const T=D.clipboardData.getData("text/plain").split("").filter(I=>h.test(I)).slice(0,t),M=[...y];T.forEach((I,U)=>{M[U]=I}),j(M),r?.(M.join(""));const R=M.findIndex(I=>!I);R!==-1?A.current[R]?.focus():A.current[t-1]?.focus(),M.every(I=>I!=="")&&M.length===t&&s?.(M.join(""))},v=D=>{D.target.select()},$={sm:"h-8 w-8 text-sm",md:"h-12 w-12 text-base",lg:"h-16 w-16 text-lg"}[d];return e.jsxs("div",{ref:g,className:N("flex flex-col gap-2",l),children:[e.jsx("div",{className:"flex items-center gap-2",children:Array.from({length:t}).map((D,C)=>e.jsxs(m.Fragment,{children:[e.jsx("input",{ref:T=>A.current[C]=T,type:i?"password":"text",inputMode:n==="numeric"?"numeric":"text",maxLength:1,value:y[C]||"",onChange:T=>b(C,T.target.value),onKeyDown:T=>w(C,T),onPaste:E,onFocus:v,disabled:c,className:N("flex items-center justify-center rounded-md border border-input bg-background text-center font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50",$,o&&"border-destructive focus-visible:ring-destructive",y[C]&&"border-primary"),"aria-label":`Caractère ${C+1} sur ${t}`,...p}),u&&(C+1)%u===0&&C<t-1&&e.jsx("div",{className:"flex items-center justify-center",children:f})]},C))}),o&&e.jsx("p",{className:"text-sm text-destructive",role:"alert",children:o})]})});Vo.displayName="InputOTP";const me=m.forwardRef(({className:t,type:a,...r},s)=>e.jsx("input",{type:a,className:N("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:s,...r}));me.displayName="Input";const ot=Re.Root,eg=Re.Group,it=Re.Value,Xe=m.forwardRef(({className:t,children:a,...r},s)=>e.jsxs(Re.Trigger,{ref:s,className:N("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...r,children:[a,e.jsx(Re.Icon,{asChild:!0,children:e.jsx(S.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));Xe.displayName=Re.Trigger.displayName;const Ns=m.forwardRef(({className:t,...a},r)=>e.jsx(Re.ScrollUpButton,{ref:r,className:N("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(S.ChevronUp,{className:"h-4 w-4"})}));Ns.displayName=Re.ScrollUpButton.displayName;const Cs=m.forwardRef(({className:t,...a},r)=>e.jsx(Re.ScrollDownButton,{ref:r,className:N("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(S.ChevronDown,{className:"h-4 w-4"})}));Cs.displayName=Re.ScrollDownButton.displayName;const Ke=m.forwardRef(({className:t,children:a,position:r="popper",...s},n)=>e.jsx(Re.Portal,{children:e.jsxs(Re.Content,{ref:n,className:N("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground 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",r==="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",t),position:r,...s,children:[e.jsx(Ns,{}),e.jsx(Re.Viewport,{className:N("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),e.jsx(Cs,{})]})}));Ke.displayName=Re.Content.displayName;const Wo=m.forwardRef(({className:t,...a},r)=>e.jsx(Re.Label,{ref:r,className:N("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...a}));Wo.displayName=Re.Label.displayName;const Oe=m.forwardRef(({className:t,children:a,...r},s)=>e.jsxs(Re.Item,{ref:s,className:N("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Re.ItemIndicator,{children:e.jsx(S.Check,{className:"h-4 w-4"})})}),e.jsx(Re.ItemText,{children:a})]}));Oe.displayName=Re.Item.displayName;const Uo=m.forwardRef(({className:t,...a},r)=>e.jsx(Re.Separator,{ref:r,className:N("-mx-1 my-1 h-px bg-muted",t),...a}));Uo.displayName=Re.Separator.displayName;function tg({languages:t,value:a,onChange:r,showFlags:s=!0,showLabels:n=!0,variant:i="default",isLoading:c=!1,className:l,placeholder:o="Select language",ariaLabel:d="Select language"}){const[u,f]=m.useState(!1),[p,g]=m.useState(!1),y=m.useRef(null),j=m.useRef(null);m.useEffect(()=>{g(!0)},[]);const A=t.find(E=>E.code===a),x=E=>{r?.(E),f(!1)},[h,b]=m.useState({top:0,left:0});if(m.useEffect(()=>{if(u&&y.current&&p){const E=y.current.getBoundingClientRect();b({top:E.bottom+8,left:E.left})}},[u,p]),i==="default")return e.jsxs(ot,{value:a,onValueChange:r,disabled:c,children:[e.jsx(Xe,{className:N("w-[180px]",l),children:e.jsx(it,{placeholder:o,children:A&&e.jsxs("div",{className:"flex items-center gap-2",children:[s&&A.flagEmoji&&e.jsx("span",{className:"text-lg",children:A.flagEmoji}),s&&A.flag&&!A.flagEmoji&&e.jsx("img",{src:A.flag,alt:A.label,className:"h-4 w-6 object-cover rounded"}),!s&&e.jsx(S.Globe,{className:"h-4 w-4 text-muted-foreground"}),n&&e.jsx("span",{children:A.label})]})})}),e.jsx(Ke,{children:t.map(E=>e.jsx(Oe,{value:E.code,children:e.jsxs("div",{className:"flex items-center gap-2",children:[s&&E.flagEmoji&&e.jsx("span",{className:"text-lg",children:E.flagEmoji}),s&&E.flag&&!E.flagEmoji&&e.jsx("img",{src:E.flag,alt:E.label,className:"h-4 w-6 object-cover rounded"}),n&&E.label]})},E.code))})]});if(i==="minimal"){const E=u&&p?e.jsx("div",{ref:j,className:"fixed z-[9999] min-w-[160px] rounded-md border border-border bg-popover text-popover-foreground p-2 shadow-lg",style:{top:`${h.top}px`,left:`${h.left}px`},onMouseDown:v=>v.stopPropagation(),children:e.jsx("div",{className:"grid gap-1",children:t.map(v=>e.jsxs("button",{onMouseDown:$=>{$.preventDefault(),$.stopPropagation(),x(v.code)},type:"button",className:N("flex items-center gap-2 rounded-sm px-2 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer",a===v.code&&"bg-accent"),children:[v.flagEmoji&&e.jsx("span",{className:"text-lg",children:v.flagEmoji}),v.flag&&!v.flagEmoji&&e.jsx("img",{src:v.flag,alt:v.label,className:"h-4 w-6 object-cover rounded"}),e.jsx("span",{className:"flex-1 text-left",children:v.label}),a===v.code&&e.jsx(S.Check,{className:"h-4 w-4 shrink-0"})]},v.code))})}):null;return e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:y,onClick:v=>{v.preventDefault(),v.stopPropagation(),f(!u)},className:N("flex h-9 w-9 items-center justify-center rounded-md border border-input bg-transparent hover:bg-accent hover:text-accent-foreground transition-colors",l),title:"Changer de langue",type:"button",disabled:c,children:[A?.flagEmoji?e.jsx("span",{className:"text-lg",children:A.flagEmoji}):e.jsx(S.Globe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:d})]}),p&&typeof document<"u"&&E&&Zr.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[9998]",onMouseDown:v=>{v.preventDefault(),f(!1)}}),E]}),document.body)]})}const w=u&&p?e.jsx("div",{ref:j,className:"fixed z-[9999] min-w-[180px] rounded-md border border-border bg-popover text-popover-foreground p-2 shadow-lg",style:{top:`${h.top}px`,left:`${h.left}px`},onMouseDown:E=>E.stopPropagation(),children:e.jsx("div",{className:"grid gap-1",children:t.map(E=>e.jsxs("button",{onMouseDown:v=>{v.preventDefault(),v.stopPropagation(),x(E.code)},type:"button",className:N("flex items-center gap-2 rounded-sm px-2 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer",a===E.code&&"bg-accent"),children:[s&&E.flagEmoji&&e.jsx("span",{className:"text-lg",children:E.flagEmoji}),s&&E.flag&&!E.flagEmoji&&e.jsx("img",{src:E.flag,alt:E.label,className:"h-4 w-6 object-cover rounded"}),e.jsx("span",{className:"flex-1 text-left",children:E.label}),a===E.code&&e.jsx(S.Check,{className:"h-4 w-4 shrink-0"})]},E.code))})}):null;return e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:y,onClick:E=>{E.preventDefault(),E.stopPropagation(),c||f(!u)},className:N("inline-flex items-center gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",c&&"opacity-50 cursor-not-allowed",l),disabled:c,type:"button","aria-label":d,children:[s&&A?.flagEmoji&&e.jsx("span",{className:"text-lg",children:A.flagEmoji}),s&&A?.flag&&!A?.flagEmoji&&e.jsx("img",{src:A.flag,alt:A.label,className:"h-4 w-6 object-cover rounded"}),!s&&e.jsx(S.Globe,{className:"h-4 w-4"}),n&&e.jsx("span",{children:A?.label||"Langue"}),e.jsx(S.ChevronDown,{className:"h-4 w-4"})]}),p&&typeof document<"u"&&w&&Zr.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[9998]",onMouseDown:E=>{E.preventDefault(),f(!1)}}),w]}),document.body)]})}const ag=we.Menu,rg=we.Group,sg=we.Portal,ng=we.Sub,og=we.RadioGroup,Ho=m.forwardRef(({className:t,...a},r)=>e.jsx(we.Root,{ref:r,className:N("flex h-10 items-center space-x-1 rounded-md border bg-background p-1",t),...a}));Ho.displayName=we.Root.displayName;const qo=m.forwardRef(({className:t,...a},r)=>e.jsx(we.Trigger,{ref:r,className:N("flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t),...a}));qo.displayName=we.Trigger.displayName;const Bo=m.forwardRef(({className:t,inset:a,children:r,...s},n)=>e.jsxs(we.SubTrigger,{ref:n,className:N("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",a&&"pl-8",t),...s,children:[r,e.jsx(S.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Bo.displayName=we.SubTrigger.displayName;const Go=m.forwardRef(({className:t,...a},r)=>e.jsx(we.SubContent,{ref:r,className:N("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a}));Go.displayName=we.SubContent.displayName;const Xo=m.forwardRef(({className:t,align:a="start",alignOffset:r=-4,sideOffset:s=8,...n},i)=>e.jsx(we.Portal,{children:e.jsx(we.Content,{ref:i,align:a,alignOffset:r,sideOffset:s,className:N("z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in 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",t),...n})}));Xo.displayName=we.Content.displayName;const Ko=m.forwardRef(({className:t,inset:a,...r},s)=>e.jsx(we.Item,{ref:s,className:N("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",t),...r}));Ko.displayName=we.Item.displayName;const Yo=m.forwardRef(({className:t,children:a,checked:r,...s},n)=>e.jsxs(we.CheckboxItem,{ref:n,className:N("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:r,...s,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(we.ItemIndicator,{children:e.jsx(S.Check,{className:"h-4 w-4"})})}),a]}));Yo.displayName=we.CheckboxItem.displayName;const Jo=m.forwardRef(({className:t,children:a,...r},s)=>e.jsxs(we.RadioItem,{ref:s,className:N("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(we.ItemIndicator,{children:e.jsx(S.Circle,{className:"h-2 w-2 fill-current"})})}),a]}));Jo.displayName=we.RadioItem.displayName;const Qo=m.forwardRef(({className:t,inset:a,...r},s)=>e.jsx(we.Label,{ref:s,className:N("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",t),...r}));Qo.displayName=we.Label.displayName;const Zo=m.forwardRef(({className:t,...a},r)=>e.jsx(we.Separator,{ref:r,className:N("-mx-1 my-1 h-px bg-muted",t),...a}));Zo.displayName=we.Separator.displayName;const ei=({className:t,...a})=>e.jsx("span",{className:N("ml-auto text-xs tracking-widest text-muted-foreground",t),...a});ei.displayName="MenubarShortcut";const ti=m.forwardRef(({className:t,children:a,...r},s)=>e.jsxs(He.Root,{ref:s,className:N("relative z-10 flex max-w-max flex-1 items-center justify-center",t),...r,children:[a,e.jsx(ks,{})]}));ti.displayName=He.Root.displayName;const ai=m.forwardRef(({className:t,...a},r)=>e.jsx(He.List,{ref:r,className:N("group flex flex-1 list-none items-center justify-center space-x-1",t),...a}));ai.displayName=He.List.displayName;const ig=He.Item,ri=$e.cva("group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50"),si=m.forwardRef(({className:t,children:a,...r},s)=>e.jsxs(He.Trigger,{ref:s,className:N(ri(),"group",t),...r,children:[a," ",e.jsx(S.ChevronDown,{className:"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180","aria-hidden":"true"})]}));si.displayName=He.Trigger.displayName;const ni=m.forwardRef(({className:t,...a},r)=>e.jsx(He.Content,{ref:r,className:N("left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",t),...a}));ni.displayName=He.Content.displayName;const lg=He.Link,ks=m.forwardRef(({className:t,...a},r)=>e.jsx("div",{className:N("absolute left-0 top-full flex justify-center"),children:e.jsx(He.Viewport,{className:N("origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",t),ref:r,...a})}));ks.displayName=He.Viewport.displayName;const oi=m.forwardRef(({className:t,...a},r)=>e.jsx(He.Indicator,{ref:r,className:N("top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",t),...a,children:e.jsx("div",{className:"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md"})}));oi.displayName=He.Indicator.displayName;const lt=ia.Root,ct=ia.Trigger,Ye=m.forwardRef(({className:t,align:a="center",sideOffset:r=4,...s},n)=>e.jsx(ia.Portal,{children:e.jsx(ia.Content,{ref:n,align:a,sideOffset:r,className:N("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s})}));Ye.displayName=ia.Content.displayName;const Va=m.forwardRef(({className:t,value:a,...r},s)=>e.jsx(or.Root,{ref:s,className:N("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...r,children:e.jsx(or.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(a||0)}%)`}})}));Va.displayName=or.Root.displayName;const ii=m.forwardRef(({className:t,...a},r)=>e.jsx(la.Root,{className:N("grid gap-2",t),...a,ref:r}));ii.displayName=la.Root.displayName;const li=m.forwardRef(({className:t,...a},r)=>e.jsx(la.Item,{ref:r,className:N("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...a,children:e.jsx(la.Indicator,{className:"flex items-center justify-center",children:e.jsx(S.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));li.displayName=la.Item.displayName;const $t=m.forwardRef(({className:t,children:a,...r},s)=>e.jsxs(It.Root,{ref:s,className:N("relative overflow-hidden",t),...r,children:[e.jsx(It.Viewport,{className:"h-full w-full rounded-[inherit]",children:a}),e.jsx(Ss,{}),e.jsx(It.Corner,{})]}));$t.displayName=It.Root.displayName;const Ss=m.forwardRef(({className:t,orientation:a="vertical",...r},s)=>e.jsx(It.ScrollAreaScrollbar,{ref:s,orientation:a,className:N("flex touch-none select-none transition-colors",a==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",a==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:e.jsx(It.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Ss.displayName=It.ScrollAreaScrollbar.displayName;const pt=m.forwardRef(({className:t,orientation:a="horizontal",decorative:r=!0,...s},n)=>e.jsx(is.Root,{ref:n,decorative:r,orientation:a,className:N("shrink-0 bg-border",a==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...s}));pt.displayName=is.Root.displayName;const Wa=je.Root,Es=je.Trigger,cg=je.Close,ci=je.Portal,Ts=m.forwardRef(({className:t,...a},r)=>e.jsx(je.Overlay,{className:N("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...a,ref:r}));Ts.displayName=je.Overlay.displayName;const dg=$e.cva("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{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-sm"}},defaultVariants:{side:"right"}}),ma=m.forwardRef(({side:t="right",className:a,children:r,...s},n)=>e.jsxs(ci,{children:[e.jsx(Ts,{}),e.jsxs(je.Content,{ref:n,className:N(dg({side:t}),a),...s,children:[r,e.jsxs(je.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(S.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ma.displayName=je.Content.displayName;const Dr=({className:t,...a})=>e.jsx("div",{className:N("flex flex-col space-y-2 text-center sm:text-left",t),...a});Dr.displayName="SheetHeader";const di=({className:t,...a})=>e.jsx("div",{className:N("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a});di.displayName="SheetFooter";const Ar=m.forwardRef(({className:t,...a},r)=>e.jsx(je.Title,{ref:r,className:N("text-lg font-semibold text-foreground",t),...a}));Ar.displayName=je.Title.displayName;const Rr=m.forwardRef(({className:t,...a},r)=>e.jsx(je.Description,{ref:r,className:N("text-sm text-muted-foreground",t),...a}));Rr.displayName=je.Description.displayName;function ui({className:t,...a}){return e.jsx("div",{className:N("animate-pulse rounded-md bg-muted",t),...a})}const mi=m.forwardRef(({className:t,...a},r)=>e.jsxs(sa.Root,{ref:r,className:N("relative flex w-full touch-none select-none items-center",t),...a,children:[e.jsx(sa.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:e.jsx(sa.Range,{className:"absolute h-full bg-primary"})}),e.jsx(sa.Thumb,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));mi.displayName=sa.Root.displayName;const Pr=m.forwardRef(({className:t,...a},r)=>e.jsx(ir.Root,{className:N("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...a,ref:r,children:e.jsx(ir.Thumb,{className:N("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Pr.displayName=ir.Root.displayName;const fi=m.forwardRef(({className:t,...a},r)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:r,className:N("w-full caption-bottom text-sm",t),...a})}));fi.displayName="Table";const hi=m.forwardRef(({className:t,...a},r)=>e.jsx("thead",{ref:r,className:N("[&_tr]:border-b",t),...a}));hi.displayName="TableHeader";const pi=m.forwardRef(({className:t,...a},r)=>e.jsx("tbody",{ref:r,className:N("[&_tr:last-child]:border-0",t),...a}));pi.displayName="TableBody";const gi=m.forwardRef(({className:t,...a},r)=>e.jsx("tfoot",{ref:r,className:N("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...a}));gi.displayName="TableFooter";const xi=m.forwardRef(({className:t,...a},r)=>e.jsx("tr",{ref:r,className:N("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...a}));xi.displayName="TableRow";const bi=m.forwardRef(({className:t,...a},r)=>e.jsx("th",{ref:r,className:N("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...a}));bi.displayName="TableHead";const vi=m.forwardRef(({className:t,...a},r)=>e.jsx("td",{ref:r,className:N("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...a}));vi.displayName="TableCell";const yi=m.forwardRef(({className:t,...a},r)=>e.jsx("caption",{ref:r,className:N("mt-4 text-sm text-muted-foreground",t),...a}));yi.displayName="TableCaption";const Ds=_t.Root,Mr=m.forwardRef(({className:t,...a},r)=>e.jsx(_t.List,{ref:r,className:N("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...a}));Mr.displayName=_t.List.displayName;const Ra=m.forwardRef(({className:t,...a},r)=>e.jsx(_t.Trigger,{ref:r,className:N("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...a}));Ra.displayName=_t.Trigger.displayName;const Pa=m.forwardRef(({className:t,...a},r)=>e.jsx(_t.Content,{ref:r,className:N("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...a}));Pa.displayName=_t.Content.displayName;const fa=m.forwardRef(({className:t,...a},r)=>e.jsx("textarea",{className:N("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...a}));fa.displayName="Textarea";const wi=m.forwardRef(({className:t,variant:a="default",ariaLabel:r="Select theme"},s)=>{const{currentTheme:n,changeTheme:i,themes:c,isLoading:l}=Ua(),[o,d]=m.useState(!1),[u,f]=m.useState(!1),p=m.useRef(null),g=m.useRef(null);m.useEffect(()=>{f(!0)},[]);const y=async(x,h)=>{h&&(h.preventDefault(),h.stopPropagation()),await i(x),a==="compact"&&setTimeout(()=>d(!1),100)},[j,A]=m.useState({top:0,right:0});if(m.useEffect(()=>{if(o&&p.current&&u){const x=p.current.getBoundingClientRect();A({top:x.bottom+8,right:window.innerWidth-x.right})}},[o,u]),a==="compact"){const x=o&&u?e.jsxs("div",{ref:g,className:"fixed z-[9999] min-w-[220px] rounded-md border border-border bg-popover text-popover-foreground p-2 shadow-lg",style:{top:`${j.top}px`,right:`${j.right}px`},onMouseDown:h=>{h.stopPropagation()},children:[e.jsx("div",{className:"px-2 py-1.5 border-b border-border mb-2",children:e.jsxs("div",{className:"text-xs font-medium text-muted-foreground flex items-center justify-between",children:[e.jsx("span",{children:"Thèmes"}),l&&e.jsx(S.Loader2,{className:"h-3 w-3 animate-spin"})]})}),l&&c.length===0?e.jsxs("div",{className:"flex items-center justify-center py-6 text-sm text-muted-foreground",children:[e.jsx(S.Loader2,{className:"h-4 w-4 mr-2 animate-spin"}),"Chargement..."]}):e.jsxs("div",{className:"grid gap-1",children:[c.map(h=>e.jsxs("button",{onMouseDown:b=>{b.preventDefault(),b.stopPropagation(),y(h.id,b)},type:"button",className:N("flex items-center gap-3 rounded-sm px-2 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer",n===h.id&&"bg-accent"),children:[h.previewColor&&e.jsx("div",{className:"h-4 w-4 rounded border border-border shrink-0",style:{backgroundColor:h.previewColor}}),e.jsx("span",{className:"flex-1 text-left",children:h.label}),n===h.id&&e.jsx(S.Check,{className:"h-4 w-4 shrink-0"})]},h.id)),c.length===0&&!l&&e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Aucun thème disponible"})]}),e.jsx("div",{className:"px-2 py-1.5 border-t border-border mt-2",children:e.jsxs("div",{className:"text-xs text-muted-foreground",children:[c.length," thème",c.length>1?"s":""," disponible",c.length>1?"s":""]})})]}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:s,className:N("relative",t),children:e.jsxs("button",{ref:p,onMouseDown:h=>{h.preventDefault(),h.stopPropagation()},onClick:h=>{h.preventDefault(),h.stopPropagation(),d(!o)},className:"flex h-9 w-9 items-center justify-center rounded-md border border-input bg-transparent hover:bg-accent hover:text-accent-foreground relative",title:"Changer de thème",type:"button",children:[e.jsx(S.Palette,{className:"h-4 w-4"}),l&&e.jsx(S.Loader2,{className:"h-3 w-3 absolute top-1 right-1 animate-spin text-primary"}),e.jsx("span",{className:"sr-only",children:r})]})}),u&&typeof document<"u"&&x&&Zr.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[9998]",onMouseDown:h=>{h.preventDefault(),d(!1)}}),x]}),document.body)]})}if(a==="select"){const x=c.find(h=>h.id===n);return e.jsx("div",{ref:s,className:N("w-full",t),children:e.jsxs(ot,{value:n,onValueChange:h=>i(h),disabled:l||c.length===0,children:[e.jsx(Xe,{className:"w-full","aria-label":r,children:e.jsx(it,{children:l&&c.length===0?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(S.Loader2,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{children:"Chargement..."})]}):x?e.jsxs("span",{className:"flex items-center gap-3",children:[x.previewColor&&e.jsx("div",{className:"h-4 w-4 rounded border border-border shrink-0",style:{backgroundColor:x.previewColor}}),e.jsx("span",{className:"truncate",children:x.label})]}):e.jsx("span",{className:"text-muted-foreground",children:"Sélectionner un thème"})})}),e.jsxs(Ke,{children:[c.map(h=>e.jsx(Oe,{value:h.id,className:"cursor-pointer",children:e.jsxs("div",{className:"flex items-center gap-3 w-full",children:[h.previewColor&&e.jsx("div",{className:"h-4 w-4 rounded border border-border shrink-0",style:{backgroundColor:h.previewColor}}),e.jsx("span",{className:"flex-1 text-left truncate",children:h.label})]})},h.id)),c.length===0&&!l&&e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Aucun thème disponible"})]})]})})}return e.jsx("div",{ref:s,className:N("grid gap-4",t),children:l&&c.length===0?e.jsxs("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:[e.jsx(S.Loader2,{className:"h-5 w-5 mr-2 animate-spin"}),"Chargement des thèmes..."]}):e.jsxs(e.Fragment,{children:[c.map(x=>e.jsxs("button",{onClick:h=>y(x.id,h),type:"button",className:N("relative flex flex-col items-start gap-2 rounded-lg border-2 p-4 text-left transition-all hover:border-primary",n===x.id?"border-primary bg-primary/5":"border-muted"),children:[e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"font-semibold",children:x.label}),x.description&&e.jsx("span",{className:"text-sm text-muted-foreground",children:x.description})]}),n===x.id&&e.jsx(S.Check,{className:"h-5 w-5 text-primary shrink-0"})]}),x.previewColor&&e.jsx("div",{className:"flex gap-2 w-full",children:e.jsx("div",{className:"h-8 w-full rounded border",style:{backgroundColor:x.previewColor}})})]},x.id)),c.length===0&&!l&&e.jsx("div",{className:"py-12 text-center text-sm text-muted-foreground",children:"Aucun thème disponible"})]})})});wi.displayName="ThemeSelector";const ji=Ze.Provider,As=m.forwardRef(({className:t,...a},r)=>e.jsx(Ze.Viewport,{ref:r,className:N("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...a}));As.displayName=Ze.Viewport.displayName;const ug=$e.cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Rs=m.forwardRef(({className:t,variant:a,...r},s)=>e.jsx(Ze.Root,{ref:s,className:N(ug({variant:a}),t),...r}));Rs.displayName=Ze.Root.displayName;const Ni=m.forwardRef(({className:t,...a},r)=>e.jsx(Ze.Action,{ref:r,className:N("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...a}));Ni.displayName=Ze.Action.displayName;const Ps=m.forwardRef(({className:t,...a},r)=>e.jsx(Ze.Close,{ref:r,className:N("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...a,children:e.jsx(S.X,{className:"h-4 w-4"})}));Ps.displayName=Ze.Close.displayName;const Ms=m.forwardRef(({className:t,...a},r)=>e.jsx(Ze.Title,{ref:r,className:N("text-sm font-semibold",t),...a}));Ms.displayName=Ze.Title.displayName;const Fs=m.forwardRef(({className:t,...a},r)=>e.jsx(Ze.Description,{ref:r,className:N("text-sm opacity-90",t),...a}));Fs.displayName=Ze.Description.displayName;const mg=1,fg=1e6;let Ur=0;function hg(){return Ur=(Ur+1)%Number.MAX_SAFE_INTEGER,Ur.toString()}const Hr=new Map,Pn=t=>{if(Hr.has(t))return;const a=setTimeout(()=>{Hr.delete(t),Da({type:"REMOVE_TOAST",toastId:t})},fg);Hr.set(t,a)},Ci=(t,a)=>{switch(a.type){case"ADD_TOAST":return{...t,toasts:[a.toast,...t.toasts].slice(0,mg)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(r=>r.id===a.toast.id?{...r,...a.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=a;return r?Pn(r):t.toasts.forEach(s=>{Pn(s.id)}),{...t,toasts:t.toasts.map(s=>s.id===r||r===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return a.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(r=>r.id!==a.toastId)}}},tr=[];let ar={toasts:[]};function Da(t){ar=Ci(ar,t),tr.forEach(a=>{a(ar)})}function ki({...t}){const a=hg(),r=n=>Da({type:"UPDATE_TOAST",toast:{...n,id:a}}),s=()=>Da({type:"DISMISS_TOAST",toastId:a});return Da({type:"ADD_TOAST",toast:{...t,id:a,open:!0,onOpenChange:n=>{n||s()}}}),{id:a,dismiss:s,update:r}}function Is(){const[t,a]=m.useState(ar);return m.useEffect(()=>(tr.push(a),()=>{const r=tr.indexOf(a);r>-1&&tr.splice(r,1)}),[t]),{...t,toast:ki,dismiss:r=>Da({type:"DISMISS_TOAST",toastId:r})}}function pg(){const{toasts:t}=Is();return e.jsxs(ji,{children:[t.map(function({id:a,title:r,description:s,action:n,...i}){return e.jsxs(Rs,{...i,children:[e.jsxs("div",{className:"grid gap-1",children:[r&&e.jsx(Ms,{children:r}),s&&e.jsx(Fs,{children:s})]}),n,e.jsx(Ps,{})]},a)}),e.jsx(As,{})]})}const Si=$e.cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),Ei=m.forwardRef(({className:t,variant:a,size:r,...s},n)=>e.jsx(ls.Root,{ref:n,className:N(Si({variant:a,size:r,className:t})),...s}));Ei.displayName=ls.Root.displayName;const cr=ua.Provider,dr=ua.Root,ur=ua.Trigger,Ma=m.forwardRef(({className:t,sideOffset:a=4,...r},s)=>e.jsx(ua.Content,{ref:s,sideOffset:a,className:N("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r}));Ma.displayName=ua.Content.displayName;const Ti=$e.cva("",{variants:{variant:{default:"text-foreground",muted:"text-muted-foreground",destructive:"text-destructive",success:"text-green-600 dark:text-green-400",warning:"text-amber-600 dark:text-amber-400",link:"text-primary underline-offset-4 hover:underline"},size:{xs:"text-xs",sm:"text-sm",base:"text-base",lg:"text-lg",xl:"text-xl"},weight:{normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},align:{left:"text-left",center:"text-center",right:"text-right",justify:"text-justify"}},defaultVariants:{variant:"default",size:"base",weight:"normal",align:"left"}}),Di=m.forwardRef(({className:t,variant:a,size:r,weight:s,align:n,asChild:i=!1,truncate:c=!1,...l},o)=>{const d=i?La.Slot:"p";return e.jsx(d,{className:N(Ti({variant:a,size:r,weight:s,align:n}),c&&"truncate",t),ref:o,...l})});Di.displayName="Text";const Ai=$e.cva("font-bold tracking-tight",{variants:{level:{h1:"text-4xl lg:text-5xl",h2:"text-3xl lg:text-4xl",h3:"text-2xl lg:text-3xl",h4:"text-xl lg:text-2xl",h5:"text-lg lg:text-xl",h6:"text-base lg:text-lg"},variant:{default:"text-foreground",gradient:"bg-gradient-to-r from-primary to-primary/60 bg-clip-text text-transparent",muted:"text-muted-foreground"}},defaultVariants:{level:"h2",variant:"default"}}),Ri=m.forwardRef(({className:t,level:a="h2",variant:r,asChild:s=!1,...n},i)=>{const c=s?La.Slot:a;return e.jsx(c,{className:N(Ai({level:a,variant:r}),t),ref:i,...n})});Ri.displayName="Heading";const Pi=$e.cva("mt-6 border-l-4 pl-6 italic",{variants:{variant:{default:"border-border text-muted-foreground",primary:"border-primary text-foreground",success:"border-green-500 text-green-900 dark:text-green-100",warning:"border-amber-500 text-amber-900 dark:text-amber-100",destructive:"border-destructive text-destructive"}},defaultVariants:{variant:"default"}}),Mi=m.forwardRef(({className:t,variant:a,author:r,cite:s,children:n,...i},c)=>e.jsxs("figure",{className:"my-6",children:[e.jsx("blockquote",{className:N(Pi({variant:a}),t),cite:s,ref:c,...i,children:n}),r&&e.jsxs("figcaption",{className:"mt-2 text-sm text-muted-foreground",children:["— ",r]})]}));Mi.displayName="Blockquote";$e.cva("relative rounded font-mono",{variants:{variant:{inline:"bg-muted px-[0.3rem] py-[0.2rem] text-xs sm:text-sm",block:"block bg-muted overflow-x-auto"},size:{sm:"text-xs sm:text-sm",base:"text-sm sm:text-base",lg:"text-base sm:text-lg"}},defaultVariants:{variant:"inline",size:"base"}});const Fi=$e.cva("inline-flex items-center justify-center rounded border border-border bg-muted px-2 py-1 font-mono text-xs font-medium text-muted-foreground shadow-sm",{variants:{size:{sm:"h-5 min-w-[1.25rem] text-[0.625rem]",default:"h-6 min-w-[1.5rem] text-xs",lg:"h-7 min-w-[1.75rem] text-sm"}},defaultVariants:{size:"default"}}),Ii=m.forwardRef(({className:t,size:a,...r},s)=>e.jsx("kbd",{className:N(Fi({size:a}),t),ref:s,...r}));Ii.displayName="Kbd";const gg=$e.cva("flex items-center",{variants:{variant:{default:"gap-2 p-3 rounded-lg border bg-card shadow-sm",minimal:"gap-2",pills:"gap-2 p-2 rounded-full border bg-muted/30",inline:"gap-1.5 text-sm",compact:"gap-1.5 p-2 rounded-md bg-muted/50"}},defaultVariants:{variant:"default"}}),xg=$e.cva("justify-between gap-2 transition-all",{variants:{variant:{default:"h-9 border-primary/50",minimal:"h-8 border-0 shadow-none hover:bg-accent",pills:"h-8 rounded-full px-4",inline:"h-7 text-sm border-0 shadow-none p-0 hover:bg-transparent hover:underline",compact:"h-7 text-xs px-2"}},defaultVariants:{variant:"default"}}),bg={partner:S.Building2,network:S.Network,customer:S.Users},vg={partner:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",network:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",customer:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"},qr={partner:"Partenaire",network:"Réseau",customer:"Client"},Li=m.forwardRef(({type:t,items:a,selected:r,isLoading:s,onSelect:n,placeholder:i,emptyText:c,showIcon:l,showBadge:o,variant:d},u)=>{const[f,p]=m.useState(!1),[g,y]=m.useState(""),j=bg[t],A=m.useMemo(()=>g?a.filter(b=>b.name.toLowerCase().includes(g.toLowerCase())):a,[a,g]),x=b=>{n(b),p(!1),y("")},h=b=>{b.stopPropagation(),n({id:"",name:"",type:t}),y("")};return e.jsxs(lt,{open:f,onOpenChange:p,children:[e.jsx(ct,{asChild:!0,children:e.jsxs(G,{ref:u,variant:d==="inline"?"ghost":"outline",role:"combobox","aria-expanded":f,className:N(xg({variant:d}),r?.id?"border-primary/50":""),disabled:s||a.length===0,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[l&&j&&e.jsx(j,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:r?.name||i||qr[t]}),o&&r?.id&&e.jsx(Pe,{variant:"secondary",className:N("text-xs",vg[t]),children:t})]}),r?.id?e.jsx(S.X,{className:"h-3 w-3 shrink-0 opacity-50 hover:opacity-100",onClick:h}):e.jsx(S.ChevronRight,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ye,{className:"w-[300px] p-0",align:"start",children:e.jsxs(Kt,{shouldFilter:!1,children:[e.jsxs("div",{className:"flex items-center border-b px-3 py-2 bg-muted/50",children:[e.jsx(S.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(ca,{placeholder:`Rechercher ${qr[t].toLowerCase()}...`,value:g,onValueChange:y,className:"border-0 focus:ring-0"})]}),e.jsxs(Er,{children:[e.jsx(da,{children:c||`Aucun ${qr[t].toLowerCase()} trouvé`}),e.jsx(Yt,{children:A.map(b=>e.jsx(Jt,{value:b.id,onSelect:()=>x(b),className:"cursor-pointer",children:e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[l&&j&&e.jsx(j,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate",children:b.name}),b.metadata?.count!==void 0&&e.jsx(Pe,{variant:"secondary",className:"text-xs",children:b.metadata.count})]})},b.id))})]})]})})]})});Li.displayName="AdmincrumbSelector";const $i=m.forwardRef(({levels:t,separator:a,className:r,onLevelChange:s,showIcons:n=!0,showBadges:i=!1,showHome:c=!1,maxWidth:l="100%",variant:o="default",resetable:d=!1,onReset:u},f)=>{const p=j=>A=>{s?.(j,A)},g=t.some(j=>j.selected?.id),y=d&&g&&u;return e.jsxs("nav",{ref:f,"aria-label":"Fil d'Ariane administrateur",className:N("flex items-center gap-2",r),style:{maxWidth:l},children:[e.jsxs("div",{className:N(gg({variant:o}),"overflow-x-auto"),children:[c&&e.jsxs(e.Fragment,{children:[e.jsx(G,{variant:o==="inline"?"ghost":"outline",size:o==="compact"?"sm":"default",className:N(o==="inline"&&"h-7 px-2",o==="compact"&&"h-7 px-2"),onClick:()=>u?.(),children:e.jsx(S.Home,{className:"h-4 w-4"})}),e.jsx(S.ChevronRight,{className:"h-4 w-4 text-muted-foreground shrink-0","aria-hidden":"true"})]}),e.jsx("ol",{className:"flex items-center gap-2 list-none p-0 m-0",children:t.map((j,A)=>e.jsxs("li",{className:"flex items-center gap-2",children:[A>0&&e.jsx(e.Fragment,{children:a||e.jsx(S.ChevronRight,{className:N("text-muted-foreground shrink-0",o==="compact"||o==="inline"?"h-3 w-3":"h-4 w-4"),"aria-hidden":"true"})}),e.jsx(Li,{...j,onSelect:p(A),showIcon:n,showBadge:i,variant:o||"default"})]},`${j.type}-${A}`))}),y&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-6 bg-border mx-1","aria-hidden":"true"}),e.jsxs(G,{variant:"ghost",size:o==="compact"?"sm":"default",onClick:u,className:N("gap-2",o==="compact"&&"h-7 px-2 text-xs"),children:[e.jsx(S.X,{className:"h-3 w-3"}),"Réinitialiser"]})]})]}),g&&!y&&e.jsxs(Pe,{variant:"secondary",className:"gap-1",children:[e.jsx(S.Filter,{className:"h-3 w-3"}),"Filtré"]})]})});$i.displayName="WakaAdmincrumb";function yg(){const[t,a]=m.useState(),[r,s]=m.useState(),[n,i]=m.useState(),c=m.useCallback((o,d)=>{o===0?(a(d.id?d:void 0),s(void 0),i(void 0)):o===1?(s(d.id?d:void 0),i(void 0)):o===2&&i(d.id?d:void 0)},[]),l=m.useCallback(()=>{a(void 0),s(void 0),i(void 0)},[]);return{partner:t,network:r,customer:n,handleLevelChange:c,reset:l}}const wg=({images:t,autoplay:a=!1,autoplayInterval:r=3e3,showIndicators:s=!0,showNavigation:n=!0,showThumbnails:i=!1,showFullscreen:c=!1,showDownload:l=!1,showShare:o=!1,showCounter:d=!1,showProgress:u=!1,transition:f="fade",layout:p="default",theme:g="auto",aspectRatio:y="16/9",maxHeight:j,className:A,imageClassName:x,indicatorClassName:h,navigationClassName:b,thumbnailClassName:w,overlayClassName:E,counterClassName:v,progressClassName:$,onImageChange:D,onImageClick:C,onFullscreenToggle:T,onDownload:M,onShare:R,onPlayPause:I,onThumbnailClick:U,onIndicatorClick:O,onNavigationClick:W,onKeyboardNavigation:F,onTouchStart:L,onTouchEnd:_,onSwipeLeft:P,onSwipeRight:V,onSwipeUp:z,onSwipeDown:X,onLoadStart:q,onLoadEnd:B,onError:J,onReady:Q,onDestroy:te,loop:ee=!0,pauseOnHover:ue=!0,pauseOnFocus:Y=!0,pauseOnTouch:K=!0,keyboardNavigation:re=!0,touchNavigation:xe=!0,swipeThreshold:pe=50,animationDuration:ye=300,preloadImages:Te=!0,lazyLoading:Me=!0,imageQuality:et="auto",placeholder:Dt,errorImage:dt,loadingSpinner:ut,emptyState:Vt,customControls:ga,customOverlay:xa,customThumbnails:ta,customIndicators:Z,customNavigation:ie,ariaLabel:Fe="Carrousel d'images",ariaLabelledBy:mt,ariaDescribedBy:Ha,role:Ys="region",virtualScrolling:Fr=!1,maxVisibleThumbnails:Ir=10,thumbnailSize:qa="medium",overlayOpacity:Jl=.7,overlayGradient:Ql,navigationSize:jt="medium",indicatorSize:Wt="medium",indicatorShape:At="circle",thumbnailAspectRatio:Ba="1/1",onMount:Lr,onUnmount:$r,onBeforeChange:gt,onAfterChange:Or})=>{const[ft,ba]=k.useState(0),[ht,Nt]=k.useState(a),[Ut,Ga]=k.useState(!1),[Js,_r]=k.useState(!1),[Xa,Qs]=k.useState(!1),[va,ya]=k.useState(null),[Zl,Ct]=k.useState(null),[tt,Ka]=k.useState(new Set),[Ya,Ja]=k.useState(0),oe=k.useRef(null),se=k.useRef(null),_e=k.useRef([]),De=k.useRef(null),Ie=k.useRef(0),ze=t&&t.length>0,Ae=Math.max(0,Math.min(ft,t.length-1)),he=ze?t[Ae]:null,Ht=k.useMemo(()=>{switch(y){case"16/9":return"aspect-video";case"4/3":return"aspect-[4/3]";case"1/1":return"aspect-square";case"3/2":return"aspect-[3/2]";default:return"aspect-video"}},[y]),xt=k.useMemo(()=>g==="auto"?"":g==="dark"?"dark":"light",[g]),Rt=k.useCallback(()=>{oe.current&&clearInterval(oe.current),ht&&ze&&t.length>1&&(oe.current=setInterval(()=>{ba(ae=>ee?(ae+1)%t.length:Math.min(ae+1,t.length-1))},r))},[ht,ze,t.length,r,ee]),qt=k.useCallback(()=>{oe.current&&(clearInterval(oe.current),oe.current=null)},[]),Zs=k.useCallback(()=>{if(!ht||!a)return;const ae=Date.now(),be=()=>{const aa=(Date.now()-ae)/r*100;Ja(Math.min(aa,100)),aa<100&&requestAnimationFrame(be)};requestAnimationFrame(be)},[ht,a,r]);k.useEffect(()=>(ht?(Rt(),Zs()):(qt(),Ja(0)),()=>qt()),[ht,Rt,qt,Zs]);const wa=k.useCallback(()=>{if(!ze)return;const ae=ee?(ft-1+t.length)%t.length:Math.max(ft-1,0);gt&&!gt(ft,ae)||(ba(ae),W?.("prev"))},[ze,ft,t.length,ee,gt,W]),ja=k.useCallback(()=>{if(!ze)return;const ae=ee?(ft+1)%t.length:Math.min(ft+1,t.length-1);gt&&!gt(ft,ae)||(ba(ae),W?.("next"))},[ze,ft,t.length,ee,gt,W]),en=k.useCallback(ae=>{!ze||ae<0||ae>=t.length||gt&&!gt(ft,ae)||(ba(ae),O?.(ae))},[ze,ft,t.length,gt,O]),ec=k.useCallback(ae=>{if(!re)return;const be=ae.key;switch(F?.(be),be){case"ArrowLeft":ae.preventDefault(),wa();break;case"ArrowRight":ae.preventDefault(),ja();break;case"ArrowUp":ae.preventDefault(),z?.();break;case"ArrowDown":ae.preventDefault(),X?.();break;case" ":ae.preventDefault(),Nt(at=>!at),I?.(!ht);break;case"Escape":Ut&&(Ga(!1),T?.(!1));break;case"f":case"F":c&&Ga(at=>(T?.(!at),!at));break}},[re,wa,ja,F,z,X,ht,I,Ut,c,T]),tc=k.useCallback(ae=>{if(!xe)return;const be=ae.touches[0];ya({x:be.clientX,y:be.clientY}),Ie.current=Date.now(),L?.(ae),K&&Nt(!1)},[xe,L,K]),ac=k.useCallback(ae=>{if(!xe||!va)return;const be=ae.changedTouches[0];Ct({x:be.clientX,y:be.clientY}),_?.(ae);const at=be.clientX-va.x,aa=be.clientY-va.y;Date.now()-Ie.current,Math.abs(at)>Math.abs(aa)&&Math.abs(at)>pe?at>0?(V?.(),wa()):(P?.(),ja()):Math.abs(aa)>pe&&(aa>0?X?.():z?.()),ya(null),Ct(null)},[xe,va,_,pe,V,P,X,z,wa,ja]),rc=k.useCallback(ae=>{Ka(be=>new Set([...be,ae])),_r(!1),B?.(ae)},[B]),sc=k.useCallback((ae,be)=>{Qs(!0),_r(!1),J?.(ae,be)},[J]);k.useEffect(()=>{he&&(D?.(Ae,he),Or?.(Ae))},[Ae,he,D,Or]);const nc=k.useCallback(()=>{he&&C?.(he,Ae)},[he,Ae,C]),Pt=k.useCallback(ae=>{ae.stopPropagation()},[]),oc=k.useCallback(()=>{Ga(ae=>(T?.(!ae),!ae))},[T]),ic=k.useCallback(()=>{he&&M?.(he,Ae)},[he,Ae,M]),lc=k.useCallback(()=>{he&&R?.(he,Ae)},[he,Ae,R]),cc=k.useCallback(()=>{ue&&Nt(!1)},[ue]),dc=k.useCallback(()=>{ue&&a&&Nt(!0)},[ue,a]),uc=k.useCallback(()=>{Y&&Nt(!1)},[Y]),mc=k.useCallback(()=>{Y&&a&&Nt(!0)},[Y,a]);if(k.useEffect(()=>(Lr?.(),Q?.(),()=>{$r?.(),te?.(),qt()}),[Lr,Q,$r,te,qt]),k.useEffect(()=>()=>qt(),[qt]),!ze)return e.jsx("div",{className:N("flex items-center justify-center h-64 bg-gray-100 rounded-lg",A),children:Vt||e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-gray-500 mb-2",children:"Aucune image à afficher"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Ajoutez des images pour commencer"})]})});const fc=N("waka-carousel relative w-full mx-auto bg-black rounded-lg overflow-hidden","focus:outline-none focus:ring-2 focus:ring-blue-500",Ut&&"fixed inset-0 z-50 rounded-none",xt,A),hc=N("relative",Ht,x),pc=N("absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-4",E);return e.jsxs("div",{ref:se,className:fc,style:{maxHeight:j},tabIndex:0,onKeyDown:ec,onTouchStart:tc,onTouchEnd:ac,onMouseEnter:cc,onMouseLeave:dc,onFocus:uc,onBlur:mc,role:Ys,"aria-label":Fe,"aria-labelledby":mt,"aria-describedby":Ha,children:[e.jsxs("div",{className:hc,children:[Js&&ut&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 z-20",children:ut}),Xa&&dt?e.jsx("img",{src:dt,alt:"Erreur de chargement",className:N("w-full h-full object-cover",x)}):he?e.jsx("img",{ref:ae=>_e.current[Ae]=ae,src:he.src,alt:he.alt,className:N("w-full h-full object-cover transition-opacity duration-300",x),onClick:nc,loading:Me?"lazy":"eager",onLoad:()=>rc(Ae),onError:ae=>sc(Ae,new Error("Erreur de chargement de l'image"))}):null,he&&(he.title||he.description||he.caption)&&e.jsxs("div",{className:pc,children:[he.title&&e.jsx("h3",{className:"text-white text-lg font-semibold mb-1",children:he.title}),he.description&&e.jsx("p",{className:"text-white/90 text-sm mb-2",children:he.description}),he.caption&&e.jsx("p",{className:"text-white/80 text-xs",children:he.caption})]}),ga&&e.jsx("div",{className:"absolute inset-0 z-10",children:ga}),xa&&e.jsx("div",{className:"absolute inset-0 z-10",children:xa}),n&&t.length>1&&e.jsx(e.Fragment,{children:ie?e.jsx("div",{className:"absolute inset-0 z-10",children:ie}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:ae=>{Pt(ae),wa()},className:N("absolute left-2 top-1/2 -translate-y-1/2 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white",jt==="small"&&"p-1",jt==="large"&&"p-3",b),"aria-label":"Image précédente",children:e.jsx(S.ChevronLeft,{className:N("w-5 h-5",jt==="small"&&"w-4 h-4",jt==="large"&&"w-6 h-6")})}),e.jsx("button",{onClick:ae=>{Pt(ae),ja()},className:N("absolute right-2 top-1/2 -translate-y-1/2 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white",jt==="small"&&"p-1",jt==="large"&&"p-3",b),"aria-label":"Image suivante",children:e.jsx(S.ChevronRight,{className:N("w-5 h-5",jt==="small"&&"w-4 h-4",jt==="large"&&"w-6 h-6")})})]})}),a&&t.length>1&&e.jsx("button",{onClick:ae=>{Pt(ae),Nt(be=>(I?.(!be),!be))},className:N("absolute top-2 right-2 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white"),"aria-label":ht?"Pause":"Lecture",children:ht?e.jsx(S.Pause,{className:"w-4 h-4"}):e.jsx(S.Play,{className:"w-4 h-4"})}),c&&e.jsx("button",{onClick:ae=>{Pt(ae),oc()},className:N("absolute top-2 left-2 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white"),"aria-label":Ut?"Quitter le plein écran":"Plein écran",children:Ut?e.jsx(S.X,{className:"w-4 h-4"}):e.jsx(S.Maximize2,{className:"w-4 h-4"})}),l&&he?.downloadUrl&&e.jsx("button",{onClick:ae=>{Pt(ae),ic()},className:N("absolute top-2 right-12 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white"),"aria-label":"Télécharger l'image",children:e.jsx(S.Download,{className:"w-4 h-4"})}),o&&he?.shareUrl&&e.jsx("button",{onClick:ae=>{Pt(ae),lc()},className:N("absolute top-2 right-20 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white"),"aria-label":"Partager l'image",children:e.jsx(S.Share2,{className:"w-4 h-4"})}),d&&e.jsxs("div",{className:N("absolute top-2 left-1/2 -translate-x-1/2 z-10","bg-black/50 text-white px-3 py-1 rounded-full text-sm",v),children:[Ae+1," / ",t.length]}),u&&ht&&e.jsx("div",{className:N("absolute bottom-0 left-0 right-0 h-1 bg-black/30",$),children:e.jsx("div",{ref:De,className:"h-full bg-white transition-all duration-100",style:{width:`${Ya}%`}})})]}),s&&t.length>1&&e.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex space-x-2",children:Z?e.jsx("div",{className:"flex space-x-2",children:Z}):t.map((ae,be)=>e.jsx("button",{onClick:at=>{Pt(at),en(be)},className:N("transition-all duration-200","focus:outline-none focus:ring-2 focus:ring-white",At==="circle"&&"rounded-full",At==="square"&&"rounded",At==="diamond"&&"rotate-45",At==="line"&&"rounded-none",Wt==="small"&&"w-2 h-2",Wt==="medium"&&"w-3 h-3",Wt==="large"&&"w-4 h-4",At==="line"&&Wt==="small"&&"w-8 h-1",At==="line"&&Wt==="medium"&&"w-12 h-1",At==="line"&&Wt==="large"&&"w-16 h-1",be===Ae?"bg-white":"bg-white/50 hover:bg-white/70",h),"aria-label":`Aller à l'image ${be+1}`},be))}),i&&t.length>1&&e.jsx("div",{className:"flex space-x-2 p-4 bg-gray-100 overflow-x-auto",children:ta?e.jsx("div",{className:"flex space-x-2",children:ta}):t.map((ae,be)=>e.jsx("button",{onClick:at=>{Pt(at),en(be),U?.(be)},className:N("flex-shrink-0 rounded overflow-hidden","border-2 transition-all duration-200","focus:outline-none focus:ring-2 focus:ring-blue-500",qa==="small"&&"w-12 h-12",qa==="medium"&&"w-16 h-16",qa==="large"&&"w-20 h-20",Ba==="1/1"&&"aspect-square",Ba==="4/3"&&"aspect-[4/3]",Ba==="16/9"&&"aspect-video",be===Ae?"border-blue-500":"border-gray-300 hover:border-gray-400",w),children:e.jsx("img",{src:ae.src,alt:ae.alt,className:"w-full h-full object-cover",loading:"lazy"})},be))})]})};let Mn=!1,rs=null;!Mn&&!vt.isInitialized&&(Mn=!0,rs=vt.use(Je.initReactI18next).init({resources:{},fallbackLng:"fr",lng:"fr",defaultNS:"translation",ns:["translation"],debug:!1,interpolation:{escapeValue:!1},react:{useSuspense:!1},ignoreJSONStructure:!0,returnNull:!1,returnEmptyString:!1,returnObjects:!1,load:"languageOnly",detection:void 0,initImmediate:!0}).then(()=>(console.log("[i18n] Initialized successfully"),vt)).catch(t=>(console.error("[i18n] Failed to initialize:",t),vt)));function Oi(t){const[a,r]=k.useState(vt.isInitialized),s=k.useRef(!0);k.useEffect(()=>{if(s.current=!0,vt.isInitialized){r(!0);return}if(rs)rs.then(()=>{s.current&&r(!0)});else{const i=setTimeout(()=>{s.current&&r(!0)},100);return()=>{clearTimeout(i),s.current=!1}}return()=>{s.current=!1}},[]);const n=Je.useTranslation(t);return!a||!vt.isInitialized?{t:(c,l)=>l?.defaultValue??c,i18n:vt,ready:!1}:{t:n.t,i18n:n.i18n,ready:n.ready}}Tt.registerLocale("fr",wt);Tt.registerLocale("en",Sa);Tt.registerLocale("es",Qn);Tt.registerLocale("de",Jn);Tt.registerLocale("it",Zn);Tt.registerLocale("pt",to);Tt.registerLocale("ja",eo);Tt.registerLocale("zh",ao);const Ls=m.forwardRef(({value:t,onChange:a,placeholder:r,disabled:s=!1,className:n,variant:i="date",format:c,minDate:l,maxDate:o,showSeconds:d=!1,showClear:u=!0,showPresets:f=!1,presets:p,locale:g="fr",timeFormat:y="24h",size:j="md",error:A,label:x,required:h=!1,inline:b=!1,monthsShown:w=1,timeIntervals:E=15,validation:v,showWeekNumbers:$=!1,showTodayButton:D=!0,showSelectionInfo:C=!1,allowTimeRange:T=!1,timezone:M,onBeforeChange:R,onAfterChange:I,renderDay:U,popoverClassName:O,disableAnimations:W=!1,readOnly:F=!1,id:L,name:_,autoFocus:P=!1},V)=>{const{t:z}=Oi(),[X,q]=m.useState(!1),[B,J]=m.useState(i==="range"&&t&&!("from"in t)?{from:t,to:void 0}:t),[Q,te]=m.useState(null),[ee,ue]=m.useState(null);m.useEffect(()=>{J(i==="range"&&t&&!("from"in t)?{from:t,to:void 0}:t)},[t,i]);const K={fr:wt,en:Sa,es:Qn,de:Jn,it:Zn,pt:to,ja:eo,zh:ao}[g]||wt,re=[{label:z?.("today")||"Aujourd'hui",value:()=>new Date},{label:z?.("yesterday")||"Hier",value:()=>H.subDays(new Date,1)},{label:z?.("thisWeek")||"Cette semaine",range:()=>({from:H.startOfWeek(new Date,{locale:K}),to:H.endOfWeek(new Date,{locale:K})})},{label:z?.("lastWeek")||"Semaine dernière",range:()=>({from:H.startOfWeek(H.subWeeks(new Date,1),{locale:K}),to:H.endOfWeek(H.subWeeks(new Date,1),{locale:K})})},{label:z?.("thisMonth")||"Ce mois",range:()=>({from:H.startOfMonth(new Date),to:H.endOfMonth(new Date)})},{label:z?.("lastMonth")||"Mois dernier",range:()=>({from:H.startOfMonth(H.subMonths(new Date,1)),to:H.endOfMonth(H.subMonths(new Date,1))})},{label:z?.("last7Days")||"7 derniers jours",range:()=>({from:H.subDays(new Date,7),to:new Date})},{label:z?.("last30Days")||"30 derniers jours",range:()=>({from:H.subDays(new Date,30),to:new Date})},{label:z?.("thisYear")||"Cette année",range:()=>({from:H.startOfYear(new Date),to:H.endOfYear(new Date)})}],xe=p||(f?re:[]),pe={sm:"h-8 px-3 text-xs",md:"h-10 px-4 text-sm",lg:"h-12 px-5 text-base"},Te=c||(()=>{switch(i){case"time":return d?y==="12h"?"h:mm:ss a":"HH:mm:ss":y==="12h"?"h:mm a":"HH:mm";case"datetime":return d?y==="12h"?"PPP h:mm:ss a":"PPP HH:mm:ss":y==="12h"?"PPP h:mm a":"PPP HH:mm";case"range":return"PPP";case"multiple":return"PPP";default:return"PPP"}})(),Me=Z=>{if(!v)return null;if(l&&H.isBefore(Z,H.startOfDay(l)))return z?.("dateBeforeMin")||`Date antérieure au ${H.format(l,Te,{locale:K})}`;if(o&&H.isAfter(Z,H.endOfDay(o)))return z?.("dateAfterMax")||`Date postérieure au ${H.format(o,Te,{locale:K})}`;if(v.disabledDates?.some(ie=>H.isEqual(H.startOfDay(ie),H.startOfDay(Z)))||v.disabledDatesFn?.(Z))return v.message||z?.("dateDisabled")||"Date désactivée";if(v.disabledDaysOfWeek?.includes(Z.getDay()))return v.message||z?.("dayOfWeekDisabled")||"Jour de la semaine désactivé";if(v.validate){const ie=v.validate(Z);if(ie===!1)return v.message||z?.("invalidDate")||"Date invalide";if(typeof ie=="string")return ie}return null},et=Z=>{if(F)return;let ie=null;if(i==="range"){if(Array.isArray(Z)&&Z[0]&&Z[1])ie={from:Z[0],to:Z[1]};else if(Z){const Fe=B;Fe?.from&&!Fe.to?ie={from:Fe.from,to:Z}:ie={from:Z,to:void 0}}}else if(i==="multiple")if(Array.isArray(B)){const Fe=[...B],mt=Fe.findIndex(Ha=>H.isEqual(H.startOfDay(Ha),H.startOfDay(Z)));mt>=0?Fe.splice(mt,1):Fe.push(Z),ie=Fe}else ie=Z?[Z]:[];else ie=Z;if(!(R&&!R(ie))){if(ie&&!ie.from&&!Array.isArray(ie)){const Fe=Me(ie);if(Fe){te(Fe);return}}te(null),J(ie),a?.(ie),I?.(ie),i!=="range"&&i!=="multiple"&&!b&&q(!1)}},Dt=Z=>{if(Z.range){const ie=typeof Z.range=="function"?Z.range():Z.range;et([ie.from,ie.to])}else if(Z.value){const ie=typeof Z.value=="function"?Z.value():Z.value;et(ie)}b||q(!1)},dt=Z=>{Z&&Z.stopPropagation(),!F&&(J(null),te(null),a?.(null),I?.(null))},ut=()=>{et(new Date)},Vt=()=>{if(!B)return r||z?.("selectDate")||"Sélectionner une date";try{if(i==="range"){const Z=B;return Z.from&&Z.to?`${H.format(Z.from,Te,{locale:K})} - ${H.format(Z.to,Te,{locale:K})}`:Z.from?`${H.format(Z.from,Te,{locale:K})} - ...`:r||z?.("selectDateRange")||"Sélectionner une période"}if(i==="multiple"){const Z=B;return Z.length===0?r||z?.("selectDates")||"Sélectionner des dates":Z.length===1?H.format(Z[0],Te,{locale:K}):`${Z.length} ${z?.("datesSelected")||"dates sélectionnées"}`}return H.format(B,Te,{locale:K})}catch(Z){return console.error("Error formatting date:",Z),r||z?.("selectDate")||"Sélectionner une date"}},ga=Z=>!!(l&&H.isBefore(Z,H.startOfDay(l))||o&&H.isAfter(Z,H.endOfDay(o))||v?.disabledDates?.some(ie=>H.isEqual(H.startOfDay(ie),H.startOfDay(Z)))||v?.disabledDatesFn?.(Z)||v?.disabledDaysOfWeek?.includes(Z.getDay())),xa=Z=>!!(v?.highlightedDates?.some(ie=>H.isEqual(H.startOfDay(ie),H.startOfDay(Z)))||v?.highlightedDatesFn?.(Z)),ta=()=>{const Z={selected:i==="range"?B?.from:i==="multiple"?void 0:B,onChange:et,startDate:i==="range"?B?.from:void 0,endDate:i==="range"?B?.to:void 0,selectsRange:i==="range",selectsMultiple:i==="multiple",highlightDates:i==="multiple"?B:void 0,showTimeSelect:i==="time"||i==="datetime",showTimeSelectOnly:i==="time",timeFormat:d?y==="12h"?"h:mm:ss aa":"HH:mm:ss":y==="12h"?"h:mm aa":"HH:mm",timeIntervals:E,timeCaption:z?.("time")||"Heure",dateFormat:Te,locale:g,placeholderText:r,disabled:s,minDate:l,maxDate:o,inline:!0,monthsShown:i==="range"?Math.max(2,w):w,showWeekNumbers:$,filterDate:ie=>!ga(ie),dayClassName:ie=>{const Fe=[];if(xa(ie)&&Fe.push("highlighted-date"),ee&&i==="range"){const mt=B;mt?.from&&!mt.to&&H.isWithinInterval(ie,{start:mt.from<ee?mt.from:ee,end:mt.from>ee?mt.from:ee})&&Fe.push("in-selecting-range")}return Fe.join(" ")},onDayMouseEnter:ie=>ue(ie),calendarClassName:N("waka-datepicker",W&&"no-animations"),wrapperClassName:"w-full",autoFocus:P};return e.jsxs("div",{className:"flex gap-3",children:[f&&xe.length>0&&e.jsxs("div",{className:"flex flex-col gap-1 min-w-[150px] border-r border-border pr-3",children:[e.jsx(ve,{className:"text-xs font-semibold text-muted-foreground mb-1",children:z?.("quickSelection")||"Sélection rapide"}),e.jsx($t,{className:"h-[300px]",children:e.jsx("div",{className:"space-y-1",children:xe.map((ie,Fe)=>e.jsx(G,{variant:"ghost",size:"sm",className:"w-full justify-start text-xs",onClick:()=>Dt(ie),children:ie.label},Fe))})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx(Tt,{...Z}),C&&B&&e.jsxs("div",{className:"mt-3 p-2 bg-muted rounded-md text-xs space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S.Info,{className:"h-3 w-3 text-muted-foreground"}),e.jsxs("span",{className:"font-medium",children:[z?.("selection")||"Sélection"," :"]})]}),e.jsx("div",{className:"text-muted-foreground pl-5",children:Vt()})]})]})]})};return b?e.jsxs("div",{ref:V,className:N("space-y-2",n),id:L,children:[x&&e.jsxs(ve,{className:"text-sm font-medium text-foreground",children:[x,h&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.jsx("div",{className:"border border-border rounded-lg p-4 bg-card",children:ta()}),(A||Q)&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-destructive",children:[e.jsx(S.AlertCircle,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:A||Q})]})]}):e.jsxs("div",{ref:V,className:N("space-y-2",n),id:L,children:[x&&e.jsxs(ve,{htmlFor:`${L}-input`,className:"text-sm font-medium text-foreground",children:[x,h&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.jsxs(lt,{open:X,onOpenChange:q,children:[e.jsx(ct,{asChild:!0,children:e.jsxs(G,{id:`${L}-input`,name:_,variant:"outline",disabled:s||F,className:N("w-full justify-between text-left font-normal",!B&&"text-muted-foreground",pe[j],(A||Q)&&"border-destructive focus-visible:ring-destructive",F&&"cursor-default opacity-70"),"aria-label":x||r,"aria-invalid":!!(A||Q),"aria-required":h,children:[e.jsxs("span",{className:"flex items-center gap-2 flex-1 truncate",children:[i==="time"?e.jsx(S.Clock,{className:"h-4 w-4 flex-shrink-0"}):e.jsx(S.Calendar,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:Vt()})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-2",children:[B&&u&&!F&&e.jsx(cr,{children:e.jsxs(dr,{children:[e.jsx(ur,{asChild:!0,children:e.jsx("div",{className:"h-5 w-5 rounded hover:bg-destructive/10 flex items-center justify-center cursor-pointer",onClick:dt,role:"button","aria-label":z?.("clear")||"Effacer",children:e.jsx(S.X,{className:"h-3 w-3 text-muted-foreground hover:text-destructive"})})}),e.jsx(Ma,{children:e.jsx("p",{children:z?.("clear")||"Effacer"})})]})}),Q&&e.jsx(cr,{children:e.jsxs(dr,{children:[e.jsx(ur,{asChild:!0,children:e.jsx(S.AlertCircle,{className:"h-4 w-4 text-destructive"})}),e.jsx(Ma,{children:e.jsx("p",{children:Q})})]})})]})]})}),e.jsxs(Ye,{className:N("w-auto p-0",O),align:"start",sideOffset:4,children:[e.jsx("div",{className:"p-4",children:ta()}),(D||u)&&e.jsxs(e.Fragment,{children:[e.jsx(pt,{}),e.jsxs("div",{className:"flex items-center justify-between p-3 gap-2",children:[D&&e.jsxs(G,{variant:"outline",size:"sm",onClick:ut,disabled:s||F,children:[e.jsx(S.Calendar,{className:"h-3.5 w-3.5 mr-1.5"}),z?.("today")||"Aujourd'hui"]}),u&&B&&e.jsxs(G,{variant:"outline",size:"sm",onClick:dt,disabled:s||F,className:"ml-auto",children:[e.jsx(S.X,{className:"h-3.5 w-3.5 mr-1.5"}),z?.("clear")||"Effacer"]})]})]})]})]}),(A||Q)&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-destructive",children:[e.jsx(S.AlertCircle,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:A||Q})]})]})});Ls.displayName="WakaDateTimePicker";function jg({name:t,control:a,defaultValue:r,...s}){return e.jsx(Po,{name:t,control:a,defaultValue:r,render:({field:n,fieldState:i})=>e.jsx(Ls,{...s,value:n.value,onChange:n.onChange,error:i.error?.message})})}function Ng(t){return m.useMemo(()=>({formatDateForSubmit:r=>r?r.toISOString():null,formatRangeForSubmit:r=>!r?.from||!r?.to?null:{from:r.from.toISOString(),to:r.to.toISOString()},parseDateFromServer:r=>r?new Date(r):null,parseRangeFromServer:r=>r?{from:new Date(r.from),to:new Date(r.to)}:null}),[])}const Cg={info:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",success:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",warning:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",error:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"},rr=m.forwardRef(({notification:t,onMarkAsRead:a,onDelete:r},s)=>{const n=i=>{const l=new Date().getTime()-i.getTime(),o=Math.floor(l/6e4),d=Math.floor(l/36e5),u=Math.floor(l/864e5);return o<1?"À l'instant":o<60?`Il y a ${o} min`:d<24?`Il y a ${d}h`:u<7?`Il y a ${u}j`:i.toLocaleDateString("fr-FR")};return e.jsxs("div",{ref:s,className:N("flex gap-3 p-4 hover:bg-muted/50 transition-colors border-l-4",t.read?"border-l-transparent opacity-60":"border-l-primary","relative group"),children:[e.jsx("div",{className:N("flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center",Cg[t.type]),children:t.icon||e.jsx(S.Bell,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:N("text-sm font-semibold",t.read&&"font-normal"),children:t.title}),e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:n(t.timestamp)})]}),e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:t.message}),t.action&&e.jsx(G,{variant:"link",size:"sm",className:"h-auto p-0 text-primary",onClick:t.action.onClick,children:t.action.label})]}),e.jsxs("div",{className:"flex-shrink-0 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[!t.read&&a&&e.jsxs(G,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>a(t.id),children:[e.jsx(S.Check,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Marquer comme lu"})]}),r&&e.jsxs(G,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>r(t.id),children:[e.jsx(S.Trash2,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Supprimer"})]})]})]})});rr.displayName="NotificationItem";const _i=m.forwardRef(({notifications:t,onMarkAsRead:a,onMarkAllAsRead:r,onDelete:s,onDeleteAll:n,onSettingsClick:i,maxHeight:c="400px",className:l,iconClassName:o,badgeClassName:d,showBadge:u=!0,showTabs:f=!0,emptyMessage:p="Aucune notification",emptyIcon:g},y)=>{const[j,A]=m.useState(!1),[x,h]=m.useState("all"),b=t.filter(v=>!v.read).length,w=m.useMemo(()=>x==="all"?t:x==="unread"?t.filter(v=>!v.read):t,[t,x]),E=()=>e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[g||e.jsx(S.Bell,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:p})]});return e.jsxs(lt,{open:j,onOpenChange:A,children:[e.jsx(ct,{asChild:!0,children:e.jsxs(G,{ref:y,variant:"ghost",size:"icon",className:N("relative",l),children:[e.jsx(S.Bell,{className:N("h-5 w-5",o)}),u&&b>0&&e.jsx(Pe,{variant:"destructive",className:N("absolute -top-1 -right-1 h-5 min-w-[20px] flex items-center justify-center p-0 text-xs",d),children:b>99?"99+":b}),e.jsxs("span",{className:"sr-only",children:["Notifications (",b," non lues)"]})]})}),e.jsxs(Ye,{className:"w-[380px] p-0",align:"end",sideOffset:8,children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-base",children:"Notifications"}),b>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[b," non ",b>1?"lues":"lue"]})]}),e.jsxs("div",{className:"flex gap-1",children:[r&&b>0&&e.jsxs(G,{variant:"ghost",size:"sm",className:"h-8 text-xs",onClick:r,children:[e.jsx(S.Check,{className:"h-3 w-3 mr-1"}),"Tout marquer"]}),i&&e.jsxs(G,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:i,children:[e.jsx(S.Settings,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Paramètres"})]})]})]}),f&&t.length>0&&e.jsxs(Ds,{value:x,onValueChange:h,className:"w-full",children:[e.jsxs(Mr,{className:"w-full rounded-none border-b bg-transparent p-0",children:[e.jsxs(Ra,{value:"all",className:"flex-1 rounded-none data-[state=active]:border-b-2 data-[state=active]:border-primary",children:["Toutes (",t.length,")"]}),e.jsxs(Ra,{value:"unread",className:"flex-1 rounded-none data-[state=active]:border-b-2 data-[state=active]:border-primary",children:["Non lues (",b,")"]})]}),e.jsx(Pa,{value:"all",className:"m-0",children:e.jsx($t,{className:"h-[400px]",style:{maxHeight:c},children:e.jsx("div",{className:"p-0",children:w.length===0?e.jsx(E,{}):e.jsx("div",{className:"divide-y",children:w.map(v=>e.jsx(rr,{notification:v,onMarkAsRead:a,onDelete:s},v.id))})})})}),e.jsx(Pa,{value:"unread",className:"m-0",children:e.jsx($t,{className:"h-[400px]",style:{maxHeight:c},children:e.jsx("div",{className:"p-0",children:w.length===0?e.jsx(E,{}):e.jsx("div",{className:"divide-y",children:w.map(v=>e.jsx(rr,{notification:v,onMarkAsRead:a,onDelete:s},v.id))})})})})]}),!f&&e.jsx($t,{className:"h-[400px]",style:{maxHeight:c},children:e.jsx("div",{className:"p-0",children:t.length===0?e.jsx(E,{}):e.jsx("div",{className:"divide-y",children:t.map(v=>e.jsx(rr,{notification:v,onMarkAsRead:a,onDelete:s},v.id))})})}),t.length>0&&n&&e.jsxs(e.Fragment,{children:[e.jsx(pt,{}),e.jsx("div",{className:"p-2",children:e.jsxs(G,{variant:"ghost",size:"sm",className:"w-full text-destructive hover:text-destructive",onClick:n,children:[e.jsx(S.Trash2,{className:"h-3 w-3 mr-2"}),"Tout supprimer"]})})]})]})]})});_i.displayName="WakaNotifications";function kg(t=[]){const[a,r]=m.useState(t),s=m.useCallback(d=>{const u={...d,id:`notification-${Date.now()}-${Math.random()}`,timestamp:new Date,read:!1};r(f=>[u,...f])},[]),n=m.useCallback(d=>{r(u=>u.map(f=>f.id===d?{...f,read:!0}:f))},[]),i=m.useCallback(()=>{r(d=>d.map(u=>({...u,read:!0})))},[]),c=m.useCallback(d=>{r(u=>u.filter(f=>f.id!==d))},[]),l=m.useCallback(()=>{r([])},[]),o=m.useMemo(()=>a.filter(d=>!d.read).length,[a]);return{notifications:a,addNotification:s,markAsRead:n,markAllAsRead:i,deleteNotification:c,deleteAllNotifications:l,unreadCount:o}}const Sg=$e.cva("relative inline-flex items-center justify-center",{variants:{size:{sm:"w-12 h-12",md:"w-16 h-16",lg:"w-24 h-24",xl:"w-32 h-32"}},defaultVariants:{size:"md"}}),zi=m.forwardRef(({className:t,size:a,showAsteroids:r=!0,speed:s=2,rocketColor:n="text-primary",asteroidColor:i="text-muted-foreground",...c},l)=>{const d={sm:{orbit:40,rocket:16,asteroid:6},md:{orbit:56,rocket:20,asteroid:8},lg:{orbit:88,rocket:28,asteroid:12},xl:{orbit:120,rocket:36,asteroid:16}}[a||"md"],u=d.orbit,f=d.orbit;return e.jsxs("div",{ref:l,className:N(Sg({size:a,className:t})),role:"status","aria-label":"Chargement en cours",...c,children:[e.jsxs("svg",{width:d.orbit*2,height:d.orbit*2,viewBox:`0 0 ${d.orbit*2} ${d.orbit*2}`,className:"overflow-visible",children:[e.jsx("circle",{cx:u,cy:f,r:d.orbit-d.rocket,fill:"none",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 4",className:"opacity-20"}),r&&e.jsxs("g",{className:i,children:[e.jsx("g",{style:{animation:`waka-float ${s*1.5}s ease-in-out infinite`,transformOrigin:`${u+d.orbit*.6}px ${f-d.orbit*.5}px`},children:e.jsx("polygon",{points:Br(u+d.orbit*.6,f-d.orbit*.5,d.asteroid),fill:"currentColor",opacity:"0.3"})}),e.jsx("g",{style:{animation:`waka-float ${s*2}s ease-in-out infinite 0.5s`,transformOrigin:`${u-d.orbit*.7}px ${f+d.orbit*.4}px`},children:e.jsx("polygon",{points:Br(u-d.orbit*.7,f+d.orbit*.4,d.asteroid*.8),fill:"currentColor",opacity:"0.3"})}),e.jsx("g",{style:{animation:`waka-float ${s*1.8}s ease-in-out infinite 1s`,transformOrigin:`${u-d.orbit*.8}px ${f-d.orbit*.2}px`},children:e.jsx("polygon",{points:Br(u-d.orbit*.8,f-d.orbit*.2,d.asteroid*.6),fill:"currentColor",opacity:"0.3"})})]}),e.jsx("g",{className:n,style:{animation:`waka-orbit ${s}s linear infinite`,transformOrigin:`${u}px ${f}px`},children:e.jsxs("g",{transform:`translate(${u}, ${f-d.orbit+d.rocket/2})`,children:[e.jsx("path",{d:`M 0,-${d.rocket/2} L ${d.rocket/4},-${d.rocket/6} L ${d.rocket/4},${d.rocket/3} L 0,${d.rocket/2} L -${d.rocket/4},${d.rocket/3} L -${d.rocket/4},-${d.rocket/6} Z`,fill:"currentColor"}),e.jsx("circle",{cx:"0",cy:-d.rocket/6,r:d.rocket/8,fill:"white",opacity:"0.8"}),e.jsxs("g",{opacity:"0.8",children:[e.jsx("path",{d:`M -${d.rocket/6},${d.rocket/2} L -${d.rocket/8},${d.rocket/1.5} L 0,${d.rocket/2} Z`,fill:"#FF6B35",style:{animation:`waka-flicker ${s/4}s ease-in-out infinite`}}),e.jsx("path",{d:`M 0,${d.rocket/2} L ${d.rocket/8},${d.rocket/1.5} L ${d.rocket/6},${d.rocket/2} Z`,fill:"#FF6B35",style:{animation:`waka-flicker ${s/4}s ease-in-out infinite 0.1s`}}),e.jsx("path",{d:`M -${d.rocket/12},${d.rocket/2} L 0,${d.rocket/1.3} L ${d.rocket/12},${d.rocket/2} Z`,fill:"#FFA500",style:{animation:`waka-flicker ${s/4}s ease-in-out infinite 0.05s`}})]})]})}),[...Array(3)].map((p,g)=>e.jsx("circle",{cx:u+(g-1)*d.orbit*.3,cy:f-d.orbit*1.2,r:"1",fill:"currentColor",className:"opacity-40",style:{animation:`waka-twinkle ${s*1.5}s ease-in-out infinite ${g*.3}s`}},g))]}),e.jsx("style",{dangerouslySetInnerHTML:{__html:`
|
|
4
|
-
@keyframes waka-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),O=require("react"),ne=require("./useDataTableImport-DqeEL4GC.js"),b=require("./cn-zrNBeCrC.js"),ad=require("@radix-ui/react-accordion"),h=require("lucide-react"),nd=require("@radix-ui/react-alert-dialog"),lt=require("class-variance-authority"),rd=require("@radix-ui/react-aspect-ratio"),od=require("@radix-ui/react-avatar"),j=require("./index-CHLjUBPo.js"),id=require("react-day-picker"),ld=require("@radix-ui/react-checkbox"),V=require("date-fns"),cd=require("@radix-ui/react-collapsible"),xt=require("cmdk"),dd=require("@radix-ui/react-dialog"),ud=require("@radix-ui/react-context-menu"),md=require("@radix-ui/react-dropdown-menu"),Aa=require("@radix-ui/react-slot"),hd=require("@radix-ui/react-hover-card"),fd=require("@radix-ui/react-select"),ln=require("react-dom"),pd=require("@radix-ui/react-menubar"),xd=require("@radix-ui/react-navigation-menu"),gd=require("@radix-ui/react-progress"),bd=require("@radix-ui/react-radio-group"),jd=require("@radix-ui/react-scroll-area"),gt=require("./types-CHv7a1SP.js"),vd=require("@radix-ui/react-slider"),yd=require("@radix-ui/react-switch"),wd=require("@radix-ui/react-tabs"),Nd=require("@radix-ui/react-toast"),Cd=require("@radix-ui/react-toggle"),kd=require("@radix-ui/react-tooltip"),es=require("react-datepicker"),pt=require("react-i18next"),$t=require("i18next"),Te=require("@tanstack/react-table"),Sd=require("clsx"),Dd=require("@tanstack/react-virtual"),Td=require("@radix-ui/react-label"),Ed=require("@radix-ui/react-popover"),Pd=require("@radix-ui/react-separator");function Fe(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,n.get?n:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const d=Fe(O),ls=Fe(ad),ct=Fe(nd),Io=Fe(rd),Ms=Fe(od),Sa=Fe(ld),Fa=Fe(cd),xe=Fe(dd),Ie=Fe(ud),Le=Fe(md),Md=Fe(Aa),ca=Fe(hd),Ge=Fe(fd),Ae=Fe(pd),ut=Fe(xd),Da=Fe(gd),$s=Fe(bd),os=Fe(jd),Rs=Fe(vd),Ta=Fe(yd),ms=Fe(wd),bt=Fe(Nd),jn=Fe(Cd),zs=Fe(kd),Ad=Fe(Td),Fd=Fe(Ed),Rd=Fe(Pd);function Id({error:t,resetErrorBoundary:s,componentName:a}){return e.jsxs("div",{role:"alert",className:b.cn("flex flex-col items-center justify-center p-6","border border-destructive/50 rounded-lg bg-destructive/5","text-center space-y-4"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[e.jsxs("svg",{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",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),e.jsx("h3",{className:"font-semibold text-lg",children:"Something went wrong"})]}),a&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Error in component: ",e.jsx("code",{className:"font-mono",children:a})]}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:t.message}),t.code!==ne.ErrorCode.UNKNOWN&&e.jsxs("p",{className:"text-xs text-muted-foreground font-mono",children:["Code: ",t.code]}),e.jsx("button",{onClick:s,className:b.cn("px-4 py-2 text-sm font-medium rounded-md","bg-primary text-primary-foreground","hover:bg-primary/90 transition-colors","focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2"),children:"Try again"})]})}class Lo extends d.Component{constructor(s){super(s),this.reset=()=>{const{onReset:a}=this.props;this.setState({hasError:!1,error:null}),a?.()},this.state={hasError:!1,error:null}}static getDerivedStateFromError(s){return{hasError:!0,error:ne.WakaError.from(s,{code:ne.ErrorCode.COMPONENT_RENDER_FAILED})}}componentDidCatch(s,a){const{onError:n,componentName:r,errorCode:o}=this.props,i=ne.WakaError.from(s,{code:o||ne.ErrorCode.COMPONENT_RENDER_FAILED,context:r,metadata:{componentStack:a.componentStack}});ne.logger.error(`ErrorBoundary caught error${r?` in ${r}`:""}`,i.toJSON()),n?.(i,a)}componentDidUpdate(s){const{resetKeys:a}=this.props,{hasError:n}=this.state;if(n&&a){const r=s.resetKeys||[];a.some((i,c)=>i!==r[c])&&this.reset()}}render(){const{children:s,fallback:a,componentName:n,className:r}=this.props,{hasError:o,error:i}=this.state;return o&&i?typeof a=="function"?e.jsx("div",{className:r,children:a({error:i,resetErrorBoundary:this.reset,componentName:n})}):a?e.jsx("div",{className:r,children:a}):e.jsx("div",{className:r,children:e.jsx(Id,{error:i,resetErrorBoundary:this.reset,componentName:n})}):s}}function Ld(){const[,t]=d.useState(0);return d.useCallback(()=>t(s=>s+1),[])}function $d(t,s){const a=n=>e.jsx(Lo,{...s,children:e.jsx(t,{...n})});return a.displayName=`withErrorBoundary(${t.displayName||t.name||"Component"})`,a}const cn=ls.Root,vn=d.forwardRef(({className:t,...s},a)=>e.jsx(ls.Item,{ref:a,className:b.cn("border-b",t),...s}));vn.displayName="AccordionItem";const yn=d.forwardRef(({className:t,children:s,...a},n)=>e.jsx(ls.Header,{className:"flex",children:e.jsxs(ls.Trigger,{ref:n,className:b.cn("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...a,children:[s,e.jsx(h.ChevronDown,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));yn.displayName=ls.Trigger.displayName;const wn=d.forwardRef(({className:t,children:s,...a},n)=>e.jsx(ls.Content,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...a,children:e.jsx("div",{className:b.cn("pb-4 pt-0",t),children:s})}));wn.displayName=ls.Content.displayName;const cs=ct.Root,$o=ct.Trigger,Oo=ct.Portal,Nn=d.forwardRef(({className:t,...s},a)=>e.jsx(ct.Overlay,{className:b.cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s,ref:a}));Nn.displayName=ct.Overlay.displayName;const qt=d.forwardRef(({className:t,...s},a)=>e.jsxs(Oo,{children:[e.jsx(Nn,{}),e.jsx(ct.Content,{ref:a,className:b.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...s})]}));qt.displayName=ct.Content.displayName;const Ut=({className:t,...s})=>e.jsx("div",{className:b.cn("flex flex-col space-y-2 text-center sm:text-left",t),...s});Ut.displayName="AlertDialogHeader";const Ht=({className:t,...s})=>e.jsx("div",{className:b.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});Ht.displayName="AlertDialogFooter";const Gt=d.forwardRef(({className:t,...s},a)=>e.jsx(ct.Title,{ref:a,className:b.cn("text-lg font-semibold",t),...s}));Gt.displayName=ct.Title.displayName;const Xt=d.forwardRef(({className:t,...s},a)=>e.jsx(ct.Description,{ref:a,className:b.cn("text-sm text-muted-foreground",t),...s}));Xt.displayName=ct.Description.displayName;const Yt=d.forwardRef(({className:t,...s},a)=>e.jsx(ct.Action,{ref:a,className:b.cn("inline-flex h-10 items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground ring-offset-background transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...s}));Yt.displayName=ct.Action.displayName;const Qt=d.forwardRef(({className:t,...s},a)=>e.jsx(ct.Cancel,{ref:a,className:b.cn("mt-2 inline-flex h-10 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-semibold ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 sm:mt-0",t),...s}));Qt.displayName=ct.Cancel.displayName;const Od=lt.cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Cn=d.forwardRef(({className:t,variant:s,...a},n)=>e.jsx("div",{ref:n,role:"alert",className:b.cn(Od({variant:s}),t),...a}));Cn.displayName="Alert";const zo=d.forwardRef(({className:t,...s},a)=>e.jsx("h5",{ref:a,className:b.cn("mb-1 font-medium leading-none tracking-tight",t),...s}));zo.displayName="AlertTitle";const kn=d.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b.cn("text-sm [&_p]:leading-relaxed",t),...s}));kn.displayName="AlertDescription";const zd=Io.Root,Dt=d.forwardRef(({className:t,...s},a)=>e.jsx(Ms.Root,{ref:a,className:b.cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...s}));Dt.displayName=Ms.Root.displayName;const Tt=d.forwardRef(({className:t,...s},a)=>e.jsx(Ms.Image,{ref:a,className:b.cn("aspect-square h-full w-full",t),...s}));Tt.displayName=Ms.Image.displayName;const Et=d.forwardRef(({className:t,...s},a)=>e.jsx(Ms.Fallback,{ref:a,className:b.cn("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...s}));Et.displayName=Ms.Fallback.displayName;const _o=lt.cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ye({className:t,variant:s,...a}){return e.jsx("div",{className:b.cn(_o({variant:s}),t),...a})}function Ra({className:t,classNames:s,showOutsideDays:a=!0,...n}){return e.jsx(id.DayPicker,{showOutsideDays:a,className:b.cn("p-4 bg-background border border-border rounded-lg shadow-sm",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center mb-4",caption_label:"text-lg font-semibold text-foreground",nav:"space-x-1 flex items-center",nav_button:b.cn("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200","h-8 w-8 bg-background border border-border hover:bg-accent hover:text-accent-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex mb-2",head_cell:"text-muted-foreground rounded-md w-10 h-10 font-medium text-sm flex items-center justify-center",row:"flex w-full",cell:"h-10 w-10 text-center text-sm p-0 relative",day:b.cn("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200","h-10 w-10 p-0 font-normal cursor-pointer","hover:bg-accent hover:text-accent-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50"),day_range_end:"day-range-end",day_selected:b.cn("bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground","focus:bg-primary focus:text-primary-foreground shadow-sm"),day_today:"bg-accent text-accent-foreground font-semibold",day_outside:"text-muted-foreground opacity-50 hover:opacity-70",day_disabled:"text-muted-foreground opacity-30 cursor-not-allowed",day_range_middle:"bg-accent/50 text-accent-foreground",day_hidden:"invisible",...s},components:{Chevron:({...r})=>r.orientation==="left"?e.jsx(h.ChevronLeft,{className:"h-4 w-4"}):e.jsx(h.ChevronRight,{className:"h-4 w-4"})},...n})}Ra.displayName="Calendar";const Ce=d.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b.cn("rounded-xl border bg-card text-card-foreground shadow",t),...s}));Ce.displayName="Card";const Ve=d.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b.cn("flex flex-col space-y-1.5 p-6",t),...s}));Ve.displayName="CardHeader";const Oe=d.forwardRef(({className:t,...s},a)=>e.jsx("h3",{ref:a,className:b.cn("font-semibold leading-none tracking-tight",t),...s}));Oe.displayName="CardTitle";const et=d.forwardRef(({className:t,...s},a)=>e.jsx("p",{ref:a,className:b.cn("text-sm text-muted-foreground",t),...s}));et.displayName="CardDescription";const Pe=d.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b.cn("p-6 pt-0",t),...s}));Pe.displayName="CardContent";const Sn=d.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b.cn("flex items-center p-6 pt-0",t),...s}));Sn.displayName="CardFooter";const st=d.forwardRef(({className:t,...s},a)=>e.jsx(Sa.Root,{ref:a,className:b.cn("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...s,children:e.jsx(Sa.Indicator,{className:b.cn("flex items-center justify-center text-current"),children:e.jsx(h.Check,{className:"h-4 w-4"})})}));st.displayName=Sa.Root.displayName;function qe(t){return(s={})=>{const a=s.width?String(s.width):t.defaultWidth;return t.formats[a]||t.formats[t.defaultWidth]}}function ge(t){return(s,a)=>{const n=a?.context?String(a.context):"standalone";let r;if(n==="formatting"&&t.formattingValues){const i=t.defaultFormattingWidth||t.defaultWidth,c=a?.width?String(a.width):i;r=t.formattingValues[c]||t.formattingValues[i]}else{const i=t.defaultWidth,c=a?.width?String(a.width):t.defaultWidth;r=t.values[c]||t.values[i]}const o=t.argumentCallback?t.argumentCallback(s):s;return r[o]}}function be(t){return(s,a={})=>{const n=a.width,r=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],o=s.match(r);if(!o)return null;const i=o[0],c=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(c)?Vd(c,m=>m.test(i)):_d(c,m=>m.test(i));let u;u=t.valueCallback?t.valueCallback(l):l,u=a.valueCallback?a.valueCallback(u):u;const f=s.slice(i.length);return{value:u,rest:f}}}function _d(t,s){for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&s(t[a]))return a}function Vd(t,s){for(let a=0;a<t.length;a++)if(s(t[a]))return a}function hs(t){return(s,a={})=>{const n=s.match(t.matchPattern);if(!n)return null;const r=n[0],o=s.match(t.parsePattern);if(!o)return null;let i=t.valueCallback?t.valueCallback(o[0]):o[0];i=a.valueCallback?a.valueCallback(i):i;const c=s.slice(r.length);return{value:i,rest:c}}}const Er=Symbol.for("constructDateFrom");function Vo(t,s){return typeof t=="function"?t(s):t&&typeof t=="object"&&Er in t?t[Er](s):t instanceof Date?new t.constructor(s):new Date(s)}function Bd(t,...s){const a=Vo.bind(null,t||s.find(n=>typeof n=="object"));return s.map(a)}let Wd={};function qd(){return Wd}function Ud(t,s){return Vo(s||t,t)}function Pr(t,s){const a=qd(),n=s?.weekStartsOn??s?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,r=Ud(t,s?.in),o=r.getDay(),i=(o<n?7:0)+o-n;return r.setDate(r.getDate()-i),r.setHours(0,0,0,0),r}function dn(t,s,a){const[n,r]=Bd(a?.in,t,s);return+Pr(n,a)==+Pr(r,a)}const Mr={lessThanXSeconds:{standalone:{one:"weniger als 1 Sekunde",other:"weniger als {{count}} Sekunden"},withPreposition:{one:"weniger als 1 Sekunde",other:"weniger als {{count}} Sekunden"}},xSeconds:{standalone:{one:"1 Sekunde",other:"{{count}} Sekunden"},withPreposition:{one:"1 Sekunde",other:"{{count}} Sekunden"}},halfAMinute:{standalone:"eine halbe Minute",withPreposition:"einer halben Minute"},lessThanXMinutes:{standalone:{one:"weniger als 1 Minute",other:"weniger als {{count}} Minuten"},withPreposition:{one:"weniger als 1 Minute",other:"weniger als {{count}} Minuten"}},xMinutes:{standalone:{one:"1 Minute",other:"{{count}} Minuten"},withPreposition:{one:"1 Minute",other:"{{count}} Minuten"}},aboutXHours:{standalone:{one:"etwa 1 Stunde",other:"etwa {{count}} Stunden"},withPreposition:{one:"etwa 1 Stunde",other:"etwa {{count}} Stunden"}},xHours:{standalone:{one:"1 Stunde",other:"{{count}} Stunden"},withPreposition:{one:"1 Stunde",other:"{{count}} Stunden"}},xDays:{standalone:{one:"1 Tag",other:"{{count}} Tage"},withPreposition:{one:"1 Tag",other:"{{count}} Tagen"}},aboutXWeeks:{standalone:{one:"etwa 1 Woche",other:"etwa {{count}} Wochen"},withPreposition:{one:"etwa 1 Woche",other:"etwa {{count}} Wochen"}},xWeeks:{standalone:{one:"1 Woche",other:"{{count}} Wochen"},withPreposition:{one:"1 Woche",other:"{{count}} Wochen"}},aboutXMonths:{standalone:{one:"etwa 1 Monat",other:"etwa {{count}} Monate"},withPreposition:{one:"etwa 1 Monat",other:"etwa {{count}} Monaten"}},xMonths:{standalone:{one:"1 Monat",other:"{{count}} Monate"},withPreposition:{one:"1 Monat",other:"{{count}} Monaten"}},aboutXYears:{standalone:{one:"etwa 1 Jahr",other:"etwa {{count}} Jahre"},withPreposition:{one:"etwa 1 Jahr",other:"etwa {{count}} Jahren"}},xYears:{standalone:{one:"1 Jahr",other:"{{count}} Jahre"},withPreposition:{one:"1 Jahr",other:"{{count}} Jahren"}},overXYears:{standalone:{one:"mehr als 1 Jahr",other:"mehr als {{count}} Jahre"},withPreposition:{one:"mehr als 1 Jahr",other:"mehr als {{count}} Jahren"}},almostXYears:{standalone:{one:"fast 1 Jahr",other:"fast {{count}} Jahre"},withPreposition:{one:"fast 1 Jahr",other:"fast {{count}} Jahren"}}},Hd=(t,s,a)=>{let n;const r=a?.addSuffix?Mr[t].withPreposition:Mr[t].standalone;return typeof r=="string"?n=r:s===1?n=r.one:n=r.other.replace("{{count}}",String(s)),a?.addSuffix?a.comparison&&a.comparison>0?"in "+n:"vor "+n:n},Gd={full:"EEEE, do MMMM y",long:"do MMMM y",medium:"do MMM y",short:"dd.MM.y"},Xd={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Yd={full:"{{date}} 'um' {{time}}",long:"{{date}} 'um' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Qd={date:qe({formats:Gd,defaultWidth:"full"}),time:qe({formats:Xd,defaultWidth:"full"}),dateTime:qe({formats:Yd,defaultWidth:"full"})},Kd={lastWeek:"'letzten' eeee 'um' p",yesterday:"'gestern um' p",today:"'heute um' p",tomorrow:"'morgen um' p",nextWeek:"eeee 'um' p",other:"P"},Jd=(t,s,a,n)=>Kd[t],Zd={narrow:["v.Chr.","n.Chr."],abbreviated:["v.Chr.","n.Chr."],wide:["vor Christus","nach Christus"]},eu={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. Quartal","2. Quartal","3. Quartal","4. Quartal"]},un={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],wide:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},tu={narrow:un.narrow,abbreviated:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sep.","Okt.","Nov.","Dez."],wide:un.wide},su={narrow:["S","M","D","M","D","F","S"],short:["So","Mo","Di","Mi","Do","Fr","Sa"],abbreviated:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."],wide:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},au={narrow:{am:"vm.",pm:"nm.",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachm.",evening:"Abend",night:"Nacht"},abbreviated:{am:"vorm.",pm:"nachm.",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachmittag",evening:"Abend",night:"Nacht"},wide:{am:"vormittags",pm:"nachmittags",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachmittag",evening:"Abend",night:"Nacht"}},nu={narrow:{am:"vm.",pm:"nm.",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachm.",evening:"abends",night:"nachts"},abbreviated:{am:"vorm.",pm:"nachm.",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachmittags",evening:"abends",night:"nachts"},wide:{am:"vormittags",pm:"nachmittags",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachmittags",evening:"abends",night:"nachts"}},ru=t=>Number(t)+".",ou={ordinalNumber:ru,era:ge({values:Zd,defaultWidth:"wide"}),quarter:ge({values:eu,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ge({values:un,formattingValues:tu,defaultWidth:"wide"}),day:ge({values:su,defaultWidth:"wide"}),dayPeriod:ge({values:au,defaultWidth:"wide",formattingValues:nu,defaultFormattingWidth:"wide"})},iu=/^(\d+)(\.)?/i,lu=/\d+/i,cu={narrow:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,abbreviated:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,wide:/^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i},du={any:[/^v/i,/^n/i]},uu={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? Quartal/i},mu={any:[/1/i,/2/i,/3/i,/4/i]},hu={narrow:/^[jfmasond]/i,abbreviated:/^(j[aä]n|feb|mär[z]?|apr|mai|jun[i]?|jul[i]?|aug|sep|okt|nov|dez)\.?/i,wide:/^(januar|februar|märz|april|mai|juni|juli|august|september|oktober|november|dezember)/i},fu={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^j[aä]/i,/^f/i,/^mär/i,/^ap/i,/^mai/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},pu={narrow:/^[smdmf]/i,short:/^(so|mo|di|mi|do|fr|sa)/i,abbreviated:/^(son?|mon?|die?|mit?|don?|fre?|sam?)\.?/i,wide:/^(sonntag|montag|dienstag|mittwoch|donnerstag|freitag|samstag)/i},xu={any:[/^so/i,/^mo/i,/^di/i,/^mi/i,/^do/i,/^f/i,/^sa/i]},gu={narrow:/^(vm\.?|nm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,abbreviated:/^(vorm\.?|nachm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,wide:/^(vormittags|nachmittags|Mitternacht|Mittag|morgens|nachmittags|abends|nachts)/i},bu={any:{am:/^v/i,pm:/^n/i,midnight:/^Mitte/i,noon:/^Mitta/i,morning:/morgens/i,afternoon:/nachmittags/i,evening:/abends/i,night:/nachts/i}},ju={ordinalNumber:hs({matchPattern:iu,parsePattern:lu,valueCallback:t=>parseInt(t)}),era:be({matchPatterns:cu,defaultMatchWidth:"wide",parsePatterns:du,defaultParseWidth:"any"}),quarter:be({matchPatterns:uu,defaultMatchWidth:"wide",parsePatterns:mu,defaultParseWidth:"any",valueCallback:t=>t+1}),month:be({matchPatterns:hu,defaultMatchWidth:"wide",parsePatterns:fu,defaultParseWidth:"any"}),day:be({matchPatterns:pu,defaultMatchWidth:"wide",parsePatterns:xu,defaultParseWidth:"any"}),dayPeriod:be({matchPatterns:gu,defaultMatchWidth:"wide",parsePatterns:bu,defaultParseWidth:"any"})},Bo={code:"de",formatDistance:Hd,formatLong:Qd,formatRelative:Jd,localize:ou,match:ju,options:{weekStartsOn:1,firstWeekContainsDate:4}},vu={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},yu=(t,s,a)=>{let n;const r=vu[t];return typeof r=="string"?n=r:s===1?n=r.one:n=r.other.replace("{{count}}",s.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"in "+n:n+" ago":n},wu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Nu=(t,s,a,n)=>wu[t],Cu={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},ku={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Su={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Du={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Tu={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Eu={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Pu=(t,s)=>{const a=Number(t),n=a%100;if(n>20||n<10)switch(n%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},Mu={ordinalNumber:Pu,era:ge({values:Cu,defaultWidth:"wide"}),quarter:ge({values:ku,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ge({values:Su,defaultWidth:"wide"}),day:ge({values:Du,defaultWidth:"wide"}),dayPeriod:ge({values:Tu,defaultWidth:"wide",formattingValues:Eu,defaultFormattingWidth:"wide"})},Au=/^(\d+)(th|st|nd|rd)?/i,Fu=/\d+/i,Ru={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Iu={any:[/^b/i,/^(a|c)/i]},Lu={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},$u={any:[/1/i,/2/i,/3/i,/4/i]},Ou={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},zu={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},_u={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Vu={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Bu={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Wu={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},qu={ordinalNumber:hs({matchPattern:Au,parsePattern:Fu,valueCallback:t=>parseInt(t,10)}),era:be({matchPatterns:Ru,defaultMatchWidth:"wide",parsePatterns:Iu,defaultParseWidth:"any"}),quarter:be({matchPatterns:Lu,defaultMatchWidth:"wide",parsePatterns:$u,defaultParseWidth:"any",valueCallback:t=>t+1}),month:be({matchPatterns:Ou,defaultMatchWidth:"wide",parsePatterns:zu,defaultParseWidth:"any"}),day:be({matchPatterns:_u,defaultMatchWidth:"wide",parsePatterns:Vu,defaultParseWidth:"any"}),dayPeriod:be({matchPatterns:Bu,defaultMatchWidth:"any",parsePatterns:Wu,defaultParseWidth:"any"})},Uu={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Hu={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Gu={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Xu={date:qe({formats:Uu,defaultWidth:"full"}),time:qe({formats:Hu,defaultWidth:"full"}),dateTime:qe({formats:Gu,defaultWidth:"full"})},Js={code:"en-US",formatDistance:yu,formatLong:Xu,formatRelative:Nu,localize:Mu,match:qu,options:{weekStartsOn:0,firstWeekContainsDate:1}},Yu={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},Qu=(t,s,a)=>{let n;const r=Yu[t];return typeof r=="string"?n=r:s===1?n=r.one:n=r.other.replace("{{count}}",s.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"en "+n:"hace "+n:n},Ku={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},Ju={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Zu={full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},em={date:qe({formats:Ku,defaultWidth:"full"}),time:qe({formats:Ju,defaultWidth:"full"}),dateTime:qe({formats:Zu,defaultWidth:"full"})},tm={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},sm={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},am=(t,s,a,n)=>s.getHours()!==1?sm[t]:tm[t],nm={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},rm={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},om={narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},im={narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},lm={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},cm={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},dm=(t,s)=>Number(t)+"º",um={ordinalNumber:dm,era:ge({values:nm,defaultWidth:"wide"}),quarter:ge({values:rm,defaultWidth:"wide",argumentCallback:t=>Number(t)-1}),month:ge({values:om,defaultWidth:"wide"}),day:ge({values:im,defaultWidth:"wide"}),dayPeriod:ge({values:lm,defaultWidth:"wide",formattingValues:cm,defaultFormattingWidth:"wide"})},mm=/^(\d+)(º)?/i,hm=/\d+/i,fm={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},pm={any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},xm={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},gm={any:[/1/i,/2/i,/3/i,/4/i]},bm={narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},jm={narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},vm={narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},ym={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},wm={narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},Nm={any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},Cm={ordinalNumber:hs({matchPattern:mm,parsePattern:hm,valueCallback:function(t){return parseInt(t,10)}}),era:be({matchPatterns:fm,defaultMatchWidth:"wide",parsePatterns:pm,defaultParseWidth:"any"}),quarter:be({matchPatterns:xm,defaultMatchWidth:"wide",parsePatterns:gm,defaultParseWidth:"any",valueCallback:t=>t+1}),month:be({matchPatterns:bm,defaultMatchWidth:"wide",parsePatterns:jm,defaultParseWidth:"any"}),day:be({matchPatterns:vm,defaultMatchWidth:"wide",parsePatterns:ym,defaultParseWidth:"any"}),dayPeriod:be({matchPatterns:wm,defaultMatchWidth:"any",parsePatterns:Nm,defaultParseWidth:"any"})},Wo={code:"es",formatDistance:Qu,formatLong:em,formatRelative:am,localize:um,match:Cm,options:{weekStartsOn:1,firstWeekContainsDate:1}},km={lessThanXSeconds:{one:"moins d’une seconde",other:"moins de {{count}} secondes"},xSeconds:{one:"1 seconde",other:"{{count}} secondes"},halfAMinute:"30 secondes",lessThanXMinutes:{one:"moins d’une minute",other:"moins de {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"environ 1 heure",other:"environ {{count}} heures"},xHours:{one:"1 heure",other:"{{count}} heures"},xDays:{one:"1 jour",other:"{{count}} jours"},aboutXWeeks:{one:"environ 1 semaine",other:"environ {{count}} semaines"},xWeeks:{one:"1 semaine",other:"{{count}} semaines"},aboutXMonths:{one:"environ 1 mois",other:"environ {{count}} mois"},xMonths:{one:"1 mois",other:"{{count}} mois"},aboutXYears:{one:"environ 1 an",other:"environ {{count}} ans"},xYears:{one:"1 an",other:"{{count}} ans"},overXYears:{one:"plus d’un an",other:"plus de {{count}} ans"},almostXYears:{one:"presqu’un an",other:"presque {{count}} ans"}},Sm=(t,s,a)=>{let n;const r=km[t];return typeof r=="string"?n=r:s===1?n=r.one:n=r.other.replace("{{count}}",String(s)),a?.addSuffix?a.comparison&&a.comparison>0?"dans "+n:"il y a "+n:n},Dm={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},Tm={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Em={full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Pm={date:qe({formats:Dm,defaultWidth:"full"}),time:qe({formats:Tm,defaultWidth:"full"}),dateTime:qe({formats:Em,defaultWidth:"full"})},Mm={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"},Am=(t,s,a,n)=>Mm[t],Fm={narrow:["av. J.-C","ap. J.-C"],abbreviated:["av. J.-C","ap. J.-C"],wide:["avant Jésus-Christ","après Jésus-Christ"]},Rm={narrow:["T1","T2","T3","T4"],abbreviated:["1er trim.","2ème trim.","3ème trim.","4ème trim."],wide:["1er trimestre","2ème trimestre","3ème trimestre","4ème trimestre"]},Im={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],wide:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},Lm={narrow:["D","L","M","M","J","V","S"],short:["di","lu","ma","me","je","ve","sa"],abbreviated:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],wide:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},$m={narrow:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"mat.",afternoon:"ap.m.",evening:"soir",night:"mat."},abbreviated:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"matin",afternoon:"après-midi",evening:"soir",night:"matin"},wide:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"du matin",afternoon:"de l’après-midi",evening:"du soir",night:"du matin"}},Om=(t,s)=>{const a=Number(t),n=s?.unit;if(a===0)return"0";const r=["year","week","hour","minute","second"];let o;return a===1?o=n&&r.includes(n)?"ère":"er":o="ème",a+o},zm=["MMM","MMMM"],_m={preprocessor:(t,s)=>t.getDate()===1||!s.some(n=>n.isToken&&zm.includes(n.value))?s:s.map(n=>n.isToken&&n.value==="do"?{isToken:!0,value:"d"}:n),ordinalNumber:Om,era:ge({values:Fm,defaultWidth:"wide"}),quarter:ge({values:Rm,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ge({values:Im,defaultWidth:"wide"}),day:ge({values:Lm,defaultWidth:"wide"}),dayPeriod:ge({values:$m,defaultWidth:"wide"})},Vm=/^(\d+)(ième|ère|ème|er|e)?/i,Bm=/\d+/i,Wm={narrow:/^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,abbreviated:/^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,wide:/^(avant Jésus-Christ|après Jésus-Christ)/i},qm={any:[/^av/i,/^ap/i]},Um={narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},Hm={any:[/1/i,/2/i,/3/i,/4/i]},Gm={narrow:/^[jfmasond]/i,abbreviated:/^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,wide:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i},Xm={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^av/i,/^ma/i,/^juin/i,/^juil/i,/^ao/i,/^s/i,/^o/i,/^n/i,/^d/i]},Ym={narrow:/^[lmjvsd]/i,short:/^(di|lu|ma|me|je|ve|sa)/i,abbreviated:/^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,wide:/^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i},Qm={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^di/i,/^lu/i,/^ma/i,/^me/i,/^je/i,/^ve/i,/^sa/i]},Km={narrow:/^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,any:/^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i},Jm={any:{am:/^a/i,pm:/^p/i,midnight:/^min/i,noon:/^mid/i,morning:/mat/i,afternoon:/ap/i,evening:/soir/i,night:/nuit/i}},Zm={ordinalNumber:hs({matchPattern:Vm,parsePattern:Bm,valueCallback:t=>parseInt(t)}),era:be({matchPatterns:Wm,defaultMatchWidth:"wide",parsePatterns:qm,defaultParseWidth:"any"}),quarter:be({matchPatterns:Um,defaultMatchWidth:"wide",parsePatterns:Hm,defaultParseWidth:"any",valueCallback:t=>t+1}),month:be({matchPatterns:Gm,defaultMatchWidth:"wide",parsePatterns:Xm,defaultParseWidth:"any"}),day:be({matchPatterns:Ym,defaultMatchWidth:"wide",parsePatterns:Qm,defaultParseWidth:"any"}),dayPeriod:be({matchPatterns:Km,defaultMatchWidth:"any",parsePatterns:Jm,defaultParseWidth:"any"})},Ft={code:"fr",formatDistance:Sm,formatLong:Pm,formatRelative:Am,localize:_m,match:Zm,options:{weekStartsOn:1,firstWeekContainsDate:4}},eh={lessThanXSeconds:{one:"meno di un secondo",other:"meno di {{count}} secondi"},xSeconds:{one:"un secondo",other:"{{count}} secondi"},halfAMinute:"alcuni secondi",lessThanXMinutes:{one:"meno di un minuto",other:"meno di {{count}} minuti"},xMinutes:{one:"un minuto",other:"{{count}} minuti"},aboutXHours:{one:"circa un'ora",other:"circa {{count}} ore"},xHours:{one:"un'ora",other:"{{count}} ore"},xDays:{one:"un giorno",other:"{{count}} giorni"},aboutXWeeks:{one:"circa una settimana",other:"circa {{count}} settimane"},xWeeks:{one:"una settimana",other:"{{count}} settimane"},aboutXMonths:{one:"circa un mese",other:"circa {{count}} mesi"},xMonths:{one:"un mese",other:"{{count}} mesi"},aboutXYears:{one:"circa un anno",other:"circa {{count}} anni"},xYears:{one:"un anno",other:"{{count}} anni"},overXYears:{one:"più di un anno",other:"più di {{count}} anni"},almostXYears:{one:"quasi un anno",other:"quasi {{count}} anni"}},th=(t,s,a)=>{let n;const r=eh[t];return typeof r=="string"?n=r:s===1?n=r.one:n=r.other.replace("{{count}}",s.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"tra "+n:n+" fa":n},sh={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},ah={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},nh={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},rh={date:qe({formats:sh,defaultWidth:"full"}),time:qe({formats:ah,defaultWidth:"full"}),dateTime:qe({formats:nh,defaultWidth:"full"})},Dn=["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"];function oh(t){switch(t){case 0:return"'domenica scorsa alle' p";default:return"'"+Dn[t]+" scorso alle' p"}}function Ar(t){return"'"+Dn[t]+" alle' p"}function ih(t){switch(t){case 0:return"'domenica prossima alle' p";default:return"'"+Dn[t]+" prossimo alle' p"}}const lh={lastWeek:(t,s,a)=>{const n=t.getDay();return dn(t,s,a)?Ar(n):oh(n)},yesterday:"'ieri alle' p",today:"'oggi alle' p",tomorrow:"'domani alle' p",nextWeek:(t,s,a)=>{const n=t.getDay();return dn(t,s,a)?Ar(n):ih(n)},other:"P"},ch=(t,s,a,n)=>{const r=lh[t];return typeof r=="function"?r(s,a,n):r},dh={narrow:["aC","dC"],abbreviated:["a.C.","d.C."],wide:["avanti Cristo","dopo Cristo"]},uh={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},mh={narrow:["G","F","M","A","M","G","L","A","S","O","N","D"],abbreviated:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],wide:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"]},hh={narrow:["D","L","M","M","G","V","S"],short:["dom","lun","mar","mer","gio","ven","sab"],abbreviated:["dom","lun","mar","mer","gio","ven","sab"],wide:["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"]},fh={narrow:{am:"m.",pm:"p.",midnight:"mezzanotte",noon:"mezzogiorno",morning:"mattina",afternoon:"pomeriggio",evening:"sera",night:"notte"},abbreviated:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"mattina",afternoon:"pomeriggio",evening:"sera",night:"notte"},wide:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"mattina",afternoon:"pomeriggio",evening:"sera",night:"notte"}},ph={narrow:{am:"m.",pm:"p.",midnight:"mezzanotte",noon:"mezzogiorno",morning:"di mattina",afternoon:"del pomeriggio",evening:"di sera",night:"di notte"},abbreviated:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"di mattina",afternoon:"del pomeriggio",evening:"di sera",night:"di notte"},wide:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"di mattina",afternoon:"del pomeriggio",evening:"di sera",night:"di notte"}},xh=(t,s)=>{const a=Number(t);return String(a)},gh={ordinalNumber:xh,era:ge({values:dh,defaultWidth:"wide"}),quarter:ge({values:uh,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ge({values:mh,defaultWidth:"wide"}),day:ge({values:hh,defaultWidth:"wide"}),dayPeriod:ge({values:fh,defaultWidth:"wide",formattingValues:ph,defaultFormattingWidth:"wide"})},bh=/^(\d+)(º)?/i,jh=/\d+/i,vh={narrow:/^(aC|dC)/i,abbreviated:/^(a\.?\s?C\.?|a\.?\s?e\.?\s?v\.?|d\.?\s?C\.?|e\.?\s?v\.?)/i,wide:/^(avanti Cristo|avanti Era Volgare|dopo Cristo|Era Volgare)/i},yh={any:[/^a/i,/^(d|e)/i]},wh={narrow:/^[1234]/i,abbreviated:/^t[1234]/i,wide:/^[1234](º)? trimestre/i},Nh={any:[/1/i,/2/i,/3/i,/4/i]},Ch={narrow:/^[gfmalsond]/i,abbreviated:/^(gen|feb|mar|apr|mag|giu|lug|ago|set|ott|nov|dic)/i,wide:/^(gennaio|febbraio|marzo|aprile|maggio|giugno|luglio|agosto|settembre|ottobre|novembre|dicembre)/i},kh={narrow:[/^g/i,/^f/i,/^m/i,/^a/i,/^m/i,/^g/i,/^l/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ge/i,/^f/i,/^mar/i,/^ap/i,/^mag/i,/^gi/i,/^l/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},Sh={narrow:/^[dlmgvs]/i,short:/^(do|lu|ma|me|gi|ve|sa)/i,abbreviated:/^(dom|lun|mar|mer|gio|ven|sab)/i,wide:/^(domenica|luned[i|ì]|marted[i|ì]|mercoled[i|ì]|gioved[i|ì]|venerd[i|ì]|sabato)/i},Dh={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^g/i,/^v/i,/^s/i],any:[/^d/i,/^l/i,/^ma/i,/^me/i,/^g/i,/^v/i,/^s/i]},Th={narrow:/^(a|m\.|p|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i,any:/^([ap]\.?\s?m\.?|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i},Eh={any:{am:/^a/i,pm:/^p/i,midnight:/^mezza/i,noon:/^mezzo/i,morning:/mattina/i,afternoon:/pomeriggio/i,evening:/sera/i,night:/notte/i}},Ph={ordinalNumber:hs({matchPattern:bh,parsePattern:jh,valueCallback:t=>parseInt(t,10)}),era:be({matchPatterns:vh,defaultMatchWidth:"wide",parsePatterns:yh,defaultParseWidth:"any"}),quarter:be({matchPatterns:wh,defaultMatchWidth:"wide",parsePatterns:Nh,defaultParseWidth:"any",valueCallback:t=>t+1}),month:be({matchPatterns:Ch,defaultMatchWidth:"wide",parsePatterns:kh,defaultParseWidth:"any"}),day:be({matchPatterns:Sh,defaultMatchWidth:"wide",parsePatterns:Dh,defaultParseWidth:"any"}),dayPeriod:be({matchPatterns:Th,defaultMatchWidth:"any",parsePatterns:Eh,defaultParseWidth:"any"})},qo={code:"it",formatDistance:th,formatLong:rh,formatRelative:ch,localize:gh,match:Ph,options:{weekStartsOn:1,firstWeekContainsDate:4}},Mh={lessThanXSeconds:{one:"1秒未満",other:"{{count}}秒未満",oneWithSuffix:"約1秒",otherWithSuffix:"約{{count}}秒"},xSeconds:{one:"1秒",other:"{{count}}秒"},halfAMinute:"30秒",lessThanXMinutes:{one:"1分未満",other:"{{count}}分未満",oneWithSuffix:"約1分",otherWithSuffix:"約{{count}}分"},xMinutes:{one:"1分",other:"{{count}}分"},aboutXHours:{one:"約1時間",other:"約{{count}}時間"},xHours:{one:"1時間",other:"{{count}}時間"},xDays:{one:"1日",other:"{{count}}日"},aboutXWeeks:{one:"約1週間",other:"約{{count}}週間"},xWeeks:{one:"1週間",other:"{{count}}週間"},aboutXMonths:{one:"約1か月",other:"約{{count}}か月"},xMonths:{one:"1か月",other:"{{count}}か月"},aboutXYears:{one:"約1年",other:"約{{count}}年"},xYears:{one:"1年",other:"{{count}}年"},overXYears:{one:"1年以上",other:"{{count}}年以上"},almostXYears:{one:"1年近く",other:"{{count}}年近く"}},Ah=(t,s,a)=>{a=a||{};let n;const r=Mh[t];return typeof r=="string"?n=r:s===1?a.addSuffix&&r.oneWithSuffix?n=r.oneWithSuffix:n=r.one:a.addSuffix&&r.otherWithSuffix?n=r.otherWithSuffix.replace("{{count}}",String(s)):n=r.other.replace("{{count}}",String(s)),a.addSuffix?a.comparison&&a.comparison>0?n+"後":n+"前":n},Fh={full:"y年M月d日EEEE",long:"y年M月d日",medium:"y/MM/dd",short:"y/MM/dd"},Rh={full:"H時mm分ss秒 zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},Ih={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Lh={date:qe({formats:Fh,defaultWidth:"full"}),time:qe({formats:Rh,defaultWidth:"full"}),dateTime:qe({formats:Ih,defaultWidth:"full"})},$h={lastWeek:"先週のeeeeのp",yesterday:"昨日のp",today:"今日のp",tomorrow:"明日のp",nextWeek:"翌週のeeeeのp",other:"P"},Oh=(t,s,a,n)=>$h[t],zh={narrow:["BC","AC"],abbreviated:["紀元前","西暦"],wide:["紀元前","西暦"]},_h={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["第1四半期","第2四半期","第3四半期","第4四半期"]},Vh={narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},Bh={narrow:["日","月","火","水","木","金","土"],short:["日","月","火","水","木","金","土"],abbreviated:["日","月","火","水","木","金","土"],wide:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"]},Wh={narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},qh={narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},Uh=(t,s)=>{const a=Number(t);switch(String(s?.unit)){case"year":return`${a}年`;case"quarter":return`第${a}四半期`;case"month":return`${a}月`;case"week":return`第${a}週`;case"date":return`${a}日`;case"hour":return`${a}時`;case"minute":return`${a}分`;case"second":return`${a}秒`;default:return`${a}`}},Hh={ordinalNumber:Uh,era:ge({values:zh,defaultWidth:"wide"}),quarter:ge({values:_h,defaultWidth:"wide",argumentCallback:t=>Number(t)-1}),month:ge({values:Vh,defaultWidth:"wide"}),day:ge({values:Bh,defaultWidth:"wide"}),dayPeriod:ge({values:Wh,defaultWidth:"wide",formattingValues:qh,defaultFormattingWidth:"wide"})},Gh=/^第?\d+(年|四半期|月|週|日|時|分|秒)?/i,Xh=/\d+/i,Yh={narrow:/^(B\.?C\.?|A\.?D\.?)/i,abbreviated:/^(紀元[前後]|西暦)/i,wide:/^(紀元[前後]|西暦)/i},Qh={narrow:[/^B/i,/^A/i],any:[/^(紀元前)/i,/^(西暦|紀元後)/i]},Kh={narrow:/^[1234]/i,abbreviated:/^Q[1234]/i,wide:/^第[1234一二三四1234]四半期/i},Jh={any:[/(1|一|1)/i,/(2|二|2)/i,/(3|三|3)/i,/(4|四|4)/i]},Zh={narrow:/^([123456789]|1[012])/,abbreviated:/^([123456789]|1[012])月/i,wide:/^([123456789]|1[012])月/i},ef={any:[/^1\D/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},tf={narrow:/^[日月火水木金土]/,short:/^[日月火水木金土]/,abbreviated:/^[日月火水木金土]/,wide:/^[日月火水木金土]曜日/},sf={any:[/^日/,/^月/,/^火/,/^水/,/^木/,/^金/,/^土/]},af={any:/^(AM|PM|午前|午後|正午|深夜|真夜中|夜|朝)/i},nf={any:{am:/^(A|午前)/i,pm:/^(P|午後)/i,midnight:/^深夜|真夜中/i,noon:/^正午/i,morning:/^朝/i,afternoon:/^午後/i,evening:/^夜/i,night:/^深夜/i}},rf={ordinalNumber:hs({matchPattern:Gh,parsePattern:Xh,valueCallback:function(t){return parseInt(t,10)}}),era:be({matchPatterns:Yh,defaultMatchWidth:"wide",parsePatterns:Qh,defaultParseWidth:"any"}),quarter:be({matchPatterns:Kh,defaultMatchWidth:"wide",parsePatterns:Jh,defaultParseWidth:"any",valueCallback:t=>t+1}),month:be({matchPatterns:Zh,defaultMatchWidth:"wide",parsePatterns:ef,defaultParseWidth:"any"}),day:be({matchPatterns:tf,defaultMatchWidth:"wide",parsePatterns:sf,defaultParseWidth:"any"}),dayPeriod:be({matchPatterns:af,defaultMatchWidth:"any",parsePatterns:nf,defaultParseWidth:"any"})},Uo={code:"ja",formatDistance:Ah,formatLong:Lh,formatRelative:Oh,localize:Hh,match:rf,options:{weekStartsOn:0,firstWeekContainsDate:1}},of={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"aproximadamente 1 hora",other:"aproximadamente {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"aproximadamente 1 semana",other:"aproximadamente {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"aproximadamente 1 mês",other:"aproximadamente {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"aproximadamente 1 ano",other:"aproximadamente {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},lf=(t,s,a)=>{let n;const r=of[t];return typeof r=="string"?n=r:s===1?n=r.one:n=r.other.replace("{{count}}",String(s)),a?.addSuffix?a.comparison&&a.comparison>0?"daqui a "+n:"há "+n:n},cf={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d 'de' MMM 'de' y",short:"dd/MM/y"},df={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},uf={full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},mf={date:qe({formats:cf,defaultWidth:"full"}),time:qe({formats:df,defaultWidth:"full"}),dateTime:qe({formats:uf,defaultWidth:"full"})},hf={lastWeek:t=>{const s=t.getDay();return"'"+(s===0||s===6?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},ff=(t,s,a,n)=>{const r=hf[t];return typeof r=="function"?r(s):r},pf={narrow:["aC","dC"],abbreviated:["a.C.","d.C."],wide:["antes de Cristo","depois de Cristo"]},xf={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},gf={narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},bf={narrow:["d","s","t","q","q","s","s"],short:["dom","seg","ter","qua","qui","sex","sáb"],abbreviated:["dom","seg","ter","qua","qui","sex","sáb"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},jf={narrow:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"noite",night:"madrugada"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"noite",night:"madrugada"},wide:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"noite",night:"madrugada"}},vf={narrow:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da noite",night:"da madrugada"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da noite",night:"da madrugada"},wide:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da noite",night:"da madrugada"}},yf=(t,s)=>Number(t)+"º",wf={ordinalNumber:yf,era:ge({values:pf,defaultWidth:"wide"}),quarter:ge({values:xf,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ge({values:gf,defaultWidth:"wide"}),day:ge({values:bf,defaultWidth:"wide"}),dayPeriod:ge({values:jf,defaultWidth:"wide",formattingValues:vf,defaultFormattingWidth:"wide"})},Nf=/^(\d+)(º|ª)?/i,Cf=/\d+/i,kf={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes da era comum|depois de cristo|era comum)/i},Sf={any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes da era comum)/i,/^(depois de cristo|era comum)/i]},Df={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º|ª)? trimestre/i},Tf={any:[/1/i,/2/i,/3/i,/4/i]},Ef={narrow:/^[jfmasond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},Pf={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ab/i,/^mai/i,/^jun/i,/^jul/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},Mf={narrow:/^[dstq]/i,short:/^(dom|seg|ter|qua|qui|sex|s[áa]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[áa]b)/i,wide:/^(domingo|segunda-?\s?feira|terça-?\s?feira|quarta-?\s?feira|quinta-?\s?feira|sexta-?\s?feira|s[áa]bado)/i},Af={narrow:[/^d/i,/^s/i,/^t/i,/^q/i,/^q/i,/^s/i,/^s/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[áa]/i]},Ff={narrow:/^(a|p|meia-?\s?noite|meio-?\s?dia|(da) (manh[ãa]|tarde|noite|madrugada))/i,any:/^([ap]\.?\s?m\.?|meia-?\s?noite|meio-?\s?dia|(da) (manh[ãa]|tarde|noite|madrugada))/i},Rf={any:{am:/^a/i,pm:/^p/i,midnight:/^meia/i,noon:/^meio/i,morning:/manh[ãa]/i,afternoon:/tarde/i,evening:/noite/i,night:/madrugada/i}},If={ordinalNumber:hs({matchPattern:Nf,parsePattern:Cf,valueCallback:t=>parseInt(t,10)}),era:be({matchPatterns:kf,defaultMatchWidth:"wide",parsePatterns:Sf,defaultParseWidth:"any"}),quarter:be({matchPatterns:Df,defaultMatchWidth:"wide",parsePatterns:Tf,defaultParseWidth:"any",valueCallback:t=>t+1}),month:be({matchPatterns:Ef,defaultMatchWidth:"wide",parsePatterns:Pf,defaultParseWidth:"any"}),day:be({matchPatterns:Mf,defaultMatchWidth:"wide",parsePatterns:Af,defaultParseWidth:"any"}),dayPeriod:be({matchPatterns:Ff,defaultMatchWidth:"any",parsePatterns:Rf,defaultParseWidth:"any"})},Ho={code:"pt",formatDistance:lf,formatLong:mf,formatRelative:ff,localize:wf,match:If,options:{weekStartsOn:1,firstWeekContainsDate:4}},Lf={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},$f=(t,s,a)=>{let n;const r=Lf[t];return typeof r=="string"?n=r:s===1?n=r.one:n=r.other.replace("{{count}}",String(s)),a?.addSuffix?a.comparison&&a.comparison>0?n+"内":n+"前":n},Of={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},zf={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},_f={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Vf={date:qe({formats:Of,defaultWidth:"full"}),time:qe({formats:zf,defaultWidth:"full"}),dateTime:qe({formats:_f,defaultWidth:"full"})};function Fr(t,s,a){const n="eeee p";return dn(t,s,a)?n:t.getTime()>s.getTime()?"'下个'"+n:"'上个'"+n}const Bf={lastWeek:Fr,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:Fr,other:"PP p"},Wf=(t,s,a,n)=>{const r=Bf[t];return typeof r=="function"?r(s,a,n):r},qf={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},Uf={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},Hf={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},Gf={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},Xf={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},Yf={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},Qf=(t,s)=>{const a=Number(t);switch(s?.unit){case"date":return a.toString()+"日";case"hour":return a.toString()+"时";case"minute":return a.toString()+"分";case"second":return a.toString()+"秒";default:return"第 "+a.toString()}},Kf={ordinalNumber:Qf,era:ge({values:qf,defaultWidth:"wide"}),quarter:ge({values:Uf,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ge({values:Hf,defaultWidth:"wide"}),day:ge({values:Gf,defaultWidth:"wide"}),dayPeriod:ge({values:Xf,defaultWidth:"wide",formattingValues:Yf,defaultFormattingWidth:"wide"})},Jf=/^(第\s*)?\d+(日|时|分|秒)?/i,Zf=/\d+/i,ep={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},tp={any:[/^(前)/i,/^(公元)/i]},sp={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},ap={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},np={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},rp={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},op={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},ip={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},lp={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},cp={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},dp={ordinalNumber:hs({matchPattern:Jf,parsePattern:Zf,valueCallback:t=>parseInt(t,10)}),era:be({matchPatterns:ep,defaultMatchWidth:"wide",parsePatterns:tp,defaultParseWidth:"any"}),quarter:be({matchPatterns:sp,defaultMatchWidth:"wide",parsePatterns:ap,defaultParseWidth:"any",valueCallback:t=>t+1}),month:be({matchPatterns:np,defaultMatchWidth:"wide",parsePatterns:rp,defaultParseWidth:"any"}),day:be({matchPatterns:op,defaultMatchWidth:"wide",parsePatterns:ip,defaultParseWidth:"any"}),dayPeriod:be({matchPatterns:lp,defaultMatchWidth:"any",parsePatterns:cp,defaultParseWidth:"any"})},Go={code:"zh-CN",formatDistance:$f,formatLong:Vf,formatRelative:Wf,localize:Kf,match:dp,options:{weekStartsOn:1,firstWeekContainsDate:4}},up=(t=Ft)=>[{label:"Aujourd'hui",value:()=>new Date},{label:"Hier",value:()=>V.subDays(new Date,1)},{label:"Demain",value:()=>V.addDays(new Date,1)},{label:"Cette semaine",range:()=>({from:V.startOfWeek(new Date,{locale:t}),to:V.endOfWeek(new Date,{locale:t})})},{label:"Semaine dernière",range:()=>({from:V.startOfWeek(V.subWeeks(new Date,1),{locale:t}),to:V.endOfWeek(V.subWeeks(new Date,1),{locale:t})})},{label:"Ce mois",range:()=>({from:V.startOfMonth(new Date),to:V.endOfMonth(new Date)})},{label:"Mois dernier",range:()=>({from:V.startOfMonth(V.subMonths(new Date,1)),to:V.endOfMonth(V.subMonths(new Date,1))})},{label:"Ce trimestre",range:()=>({from:V.startOfQuarter(new Date),to:V.endOfQuarter(new Date)})},{label:"Cette année",range:()=>({from:V.startOfYear(new Date),to:V.endOfYear(new Date)})}],mp=()=>[{label:"7 derniers jours",range:()=>({from:V.subDays(new Date,7),to:new Date})},{label:"30 derniers jours",range:()=>({from:V.subDays(new Date,30),to:new Date})},{label:"90 derniers jours",range:()=>({from:V.subDays(new Date,90),to:new Date})}],hp=t=>t.map(s=>({label:`${s} prochains jours`,range:()=>({from:new Date,to:V.addDays(new Date,s)})})),fp=(t,s)=>{if(typeof s=="function"){const a=s();return"from"in a&&a.from&&a.to?{label:t,range:()=>({from:a.from,to:a.to})}:{label:t,value:s}}return"from"in s&&s.from&&s.to?{label:t,range:{from:s.from,to:s.to}}:{label:t,value:s}},pp=t=>V.isAfter(t,V.endOfDay(new Date)),Xo=t=>V.isBefore(t,V.startOfDay(new Date)),xp=t=>{const s=new Date;return t.getDate()===s.getDate()&&t.getMonth()===s.getMonth()&&t.getFullYear()===s.getFullYear()},Tn=t=>{const s=t.getDay();return s!==0&&s!==6},Yo=t=>{const s=t.getDay();return s===0||s===6},Qo=(t,s)=>s.some(a=>V.isEqual(V.startOfDay(a),V.startOfDay(t))),Bt=(t,s,a)=>V.isWithinInterval(t,{start:s,end:a}),gp=t=>s=>{const a=V.subYears(new Date,t);return V.isAfter(s,a)?`L'âge minimum est de ${t} ans`:!0},bp=t=>s=>{const a=V.subYears(new Date,t);return V.isBefore(s,a)?`L'âge maximum est de ${t} ans`:!0},jp=t=>Xo(t)?"Cette date est expirée":!0,vp=(t,s)=>({days:V.differenceInDays(s,t),weeks:V.differenceInWeeks(s,t),months:V.differenceInMonths(s,t)}),yp=(t,s="PPP",a=Ft)=>t.from?t.to?`${V.format(t.from,s,{locale:a})} - ${V.format(t.to,s,{locale:a})}`:V.format(t.from,s,{locale:a}):"",wp=t=>[new Date(t,0,1),new Date(t,4,1),new Date(t,4,8),new Date(t,6,14),new Date(t,7,15),new Date(t,10,1),new Date(t,10,11),new Date(t,11,25)],En=(t,s)=>{const a=[],n=V.startOfMonth(new Date(t,s)),r=V.endOfMonth(new Date(t,s));let o=n;for(;V.isBefore(o,r)||V.isEqual(o,r);)a.push(o),o=V.addDays(o,1);return a},Np=(t,s)=>En(t,s).filter(Yo),Cp=(t,s)=>En(t,s).filter(Tn),kp=()=>t=>{const s=new Date,a=V.endOfMonth(t);if(V.isBefore(a,s))return"La carte est expirée";const n=V.addMonths(s,3);return V.isBefore(a,n)?"La carte expire bientôt":!0},Sp=t=>s=>{const a=V.addDays(new Date,t);return V.isBefore(s,a)?`La réservation doit être faite ${t} jours à l'avance minimum`:!0},Dp=t=>s=>!s.from||!s.to?!0:V.differenceInDays(s.to,s.from)>t?`La période ne peut pas dépasser ${t} jours`:!0,Tp=(t,s)=>V.isEqual(V.startOfDay(t),V.startOfDay(s)),Ep=(t,s,a=[])=>{let n=0,r=V.startOfDay(t);const o=V.startOfDay(s);for(;V.isBefore(r,o)||V.isEqual(r,o);)Tn(r)&&!Qo(r,a)&&n++,r=V.addDays(r,1);return n},Pp=t=>{const s=t||new Date().getFullYear();return[1,2,3,4].map(a=>{const n=V.startOfQuarter(new Date(s,(a-1)*3,1)),r=V.endOfQuarter(n);return{label:`T${a} ${s}`,range:()=>({from:n,to:r})}})},Mp=(t,s=Ft)=>{const a=t||new Date().getFullYear();return Array.from({length:12},(n,r)=>{const o=V.startOfMonth(new Date(a,r,1)),i=V.endOfMonth(o);return{label:V.format(o,"MMMM yyyy",{locale:s}),range:()=>({from:o,to:i})}})},Ap=t=>t.getTime(),Fp=t=>new Date(t),Rp=t=>V.startOfDay(t),Ip=(t,s)=>!t.from||!t.to||!s.from||!s.to?!1:V.isEqual(V.startOfDay(t.from),V.startOfDay(s.from))&&V.isEqual(V.startOfDay(t.to),V.startOfDay(s.to)),Lp=(t,s)=>!t.from||!t.to||!s.from||!s.to||!(Bt(t.from,s.from,s.to)||Bt(t.to,s.from,s.to)||Bt(s.from,t.from,t.to)||Bt(s.to,t.from,t.to))?null:{from:V.isBefore(t.from,s.from)?t.from:s.from,to:V.isAfter(t.to,s.to)?t.to:s.to},$p=(t,s)=>!t.from||!t.to||!s.from||!s.to?!1:Bt(t.from,s.from,s.to)||Bt(t.to,s.from,s.to)||Bt(s.from,t.from,t.to)||Bt(s.to,t.from,t.to);class Pn{constructor(s){this.loadedThemes=new Set,this.styleElements=new Map,this.config={baseUrl:s.baseUrl,cache:s.cache??!0,timeout:s.timeout??1e4,onError:s.onError??(a=>console.error("Theme loading error:",a)),onSuccess:s.onSuccess??(()=>{})}}async loadTheme(s){if(this.config.cache&&this.loadedThemes.has(s)){ne.logger.debug(`Theme "${s}" already loaded from cache`),this.applyTheme(s);return}try{const a=new AbortController,n=setTimeout(()=>a.abort(),this.config.timeout),r=this.buildThemeUrl(s);ne.logger.debug(`Loading theme from: ${r}`);const o=await fetch(r,{signal:a.signal,headers:{Accept:"text/css"}});if(clearTimeout(n),!o.ok)throw new Error(`Failed to load theme: ${o.status} ${o.statusText}`);const i=await o.text();if(!i.includes(`[data-theme="${s}"]`))throw new Error(`Invalid theme CSS: missing [data-theme="${s}"] selector`);this.injectThemeStyles(s,i),this.loadedThemes.add(s),this.applyTheme(s),this.config.onSuccess(s)}catch(a){const n=a instanceof Error?a:new Error(String(a));throw this.config.onError(n,s),n}}applyTheme(s){if(typeof document>"u")return;document.documentElement.setAttribute("data-theme",s);try{localStorage.setItem("theme",s)}catch(n){console.warn("Could not save theme to localStorage:",n)}ne.logger.debug(`Applied theme: ${s}`)}getCurrentTheme(){return typeof document>"u"?null:document.documentElement.getAttribute("data-theme")}loadSavedTheme(){if(typeof window>"u")return null;try{return localStorage.getItem("theme")}catch(s){return console.warn("Could not load theme from localStorage:",s),null}}async preloadThemes(s){ne.logger.debug(`Preloading ${s.length} themes...`),await Promise.allSettled(s.map(a=>this.loadTheme(a))),ne.logger.debug(`Preloaded ${this.loadedThemes.size} themes`)}unloadTheme(s){const a=this.styleElements.get(s);a&&(a.remove(),this.styleElements.delete(s)),this.loadedThemes.delete(s),ne.logger.debug(`Unloaded theme: ${s}`)}clearCache(){this.styleElements.forEach(s=>s.remove()),this.styleElements.clear(),this.loadedThemes.clear(),ne.logger.debug("Theme cache cleared")}getLoadedThemes(){return Array.from(this.loadedThemes)}buildThemeUrl(s){return`${this.config.baseUrl.replace(/\/$/,"")}/${s}.css`}injectThemeStyles(s,a){if(typeof document>"u")return;const n=this.styleElements.get(s);n&&n.remove();const r=document.createElement("style");r.setAttribute("data-theme-name",s),r.textContent=a,document.head.appendChild(r),this.styleElements.set(s,r)}}let sa=null;function Op(t){return sa=new Pn(t),sa}function Mn(){if(!sa)throw new Error("ThemeLoader not initialized. Call initThemeLoader() first.");return sa}async function zp(t){return Mn().loadTheme(t)}function _p(t){Mn().applyTheme(t)}function Vp(t){if(typeof window>"u")return{loadTheme:async()=>{},applyTheme:()=>{},currentTheme:null,loadedThemes:[],isLoading:!1};const s=sa||new Pn({baseUrl:t?.baseUrl||"/themes",...t}),[a,n]=d.useState(!1),[r,o]=d.useState(s.getCurrentTheme());return{loadTheme:async l=>{n(!0);try{await s.loadTheme(l),o(l)}finally{n(!1)}},applyTheme:l=>{s.applyTheme(l),o(l)},currentTheme:r,loadedThemes:s.getLoadedThemes(),isLoading:a}}var Rr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ga={exports:{}},Ir;function Wp(){return Ir||(Ir=1,(function(t){var s=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var a=(function(n){var r=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,o=0,i={},c={manual:n.Prism&&n.Prism.manual,disableWorkerMessageHandler:n.Prism&&n.Prism.disableWorkerMessageHandler,util:{encode:function x(w){return w instanceof l?new l(w.type,x(w.content),w.alias):Array.isArray(w)?w.map(x):w.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(x){return Object.prototype.toString.call(x).slice(8,-1)},objId:function(x){return x.__id||Object.defineProperty(x,"__id",{value:++o}),x.__id},clone:function x(w,k){k=k||{};var D,S;switch(c.util.type(w)){case"Object":if(S=c.util.objId(w),k[S])return k[S];D={},k[S]=D;for(var F in w)w.hasOwnProperty(F)&&(D[F]=x(w[F],k));return D;case"Array":return S=c.util.objId(w),k[S]?k[S]:(D=[],k[S]=D,w.forEach(function(A,T){D[T]=x(A,k)}),D);default:return w}},getLanguage:function(x){for(;x;){var w=r.exec(x.className);if(w)return w[1].toLowerCase();x=x.parentElement}return"none"},setLanguage:function(x,w){x.className=x.className.replace(RegExp(r,"gi"),""),x.classList.add("language-"+w)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(D){var x=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(D.stack)||[])[1];if(x){var w=document.getElementsByTagName("script");for(var k in w)if(w[k].src==x)return w[k]}return null}},isActive:function(x,w,k){for(var D="no-"+w;x;){var S=x.classList;if(S.contains(w))return!0;if(S.contains(D))return!1;x=x.parentElement}return!!k}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(x,w){var k=c.util.clone(c.languages[x]);for(var D in w)k[D]=w[D];return k},insertBefore:function(x,w,k,D){D=D||c.languages;var S=D[x],F={};for(var A in S)if(S.hasOwnProperty(A)){if(A==w)for(var T in k)k.hasOwnProperty(T)&&(F[T]=k[T]);k.hasOwnProperty(A)||(F[A]=S[A])}var M=D[x];return D[x]=F,c.languages.DFS(c.languages,function(I,E){E===M&&I!=x&&(this[I]=F)}),F},DFS:function x(w,k,D,S){S=S||{};var F=c.util.objId;for(var A in w)if(w.hasOwnProperty(A)){k.call(w,A,w[A],D||A);var T=w[A],M=c.util.type(T);M==="Object"&&!S[F(T)]?(S[F(T)]=!0,x(T,k,null,S)):M==="Array"&&!S[F(T)]&&(S[F(T)]=!0,x(T,k,A,S))}}},plugins:{},highlightAll:function(x,w){c.highlightAllUnder(document,x,w)},highlightAllUnder:function(x,w,k){var D={callback:k,container:x,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};c.hooks.run("before-highlightall",D),D.elements=Array.prototype.slice.apply(D.container.querySelectorAll(D.selector)),c.hooks.run("before-all-elements-highlight",D);for(var S=0,F;F=D.elements[S++];)c.highlightElement(F,w===!0,D.callback)},highlightElement:function(x,w,k){var D=c.util.getLanguage(x),S=c.languages[D];c.util.setLanguage(x,D);var F=x.parentElement;F&&F.nodeName.toLowerCase()==="pre"&&c.util.setLanguage(F,D);var A=x.textContent,T={element:x,language:D,grammar:S,code:A};function M(E){T.highlightedCode=E,c.hooks.run("before-insert",T),T.element.innerHTML=T.highlightedCode,c.hooks.run("after-highlight",T),c.hooks.run("complete",T),k&&k.call(T.element)}if(c.hooks.run("before-sanity-check",T),F=T.element.parentElement,F&&F.nodeName.toLowerCase()==="pre"&&!F.hasAttribute("tabindex")&&F.setAttribute("tabindex","0"),!T.code){c.hooks.run("complete",T),k&&k.call(T.element);return}if(c.hooks.run("before-highlight",T),!T.grammar){M(c.util.encode(T.code));return}if(w&&n.Worker){var I=new Worker(c.filename);I.onmessage=function(E){M(E.data)},I.postMessage(JSON.stringify({language:T.language,code:T.code,immediateClose:!0}))}else M(c.highlight(T.code,T.grammar,T.language))},highlight:function(x,w,k){var D={code:x,grammar:w,language:k};if(c.hooks.run("before-tokenize",D),!D.grammar)throw new Error('The language "'+D.language+'" has no grammar.');return D.tokens=c.tokenize(D.code,D.grammar),c.hooks.run("after-tokenize",D),l.stringify(c.util.encode(D.tokens),D.language)},tokenize:function(x,w){var k=w.rest;if(k){for(var D in k)w[D]=k[D];delete w.rest}var S=new m;return p(S,S.head,x),f(x,S,w,S.head,0),C(S)},hooks:{all:{},add:function(x,w){var k=c.hooks.all;k[x]=k[x]||[],k[x].push(w)},run:function(x,w){var k=c.hooks.all[x];if(!(!k||!k.length))for(var D=0,S;S=k[D++];)S(w)}},Token:l};n.Prism=c;function l(x,w,k,D){this.type=x,this.content=w,this.alias=k,this.length=(D||"").length|0}l.stringify=function x(w,k){if(typeof w=="string")return w;if(Array.isArray(w)){var D="";return w.forEach(function(M){D+=x(M,k)}),D}var S={type:w.type,content:x(w.content,k),tag:"span",classes:["token",w.type],attributes:{},language:k},F=w.alias;F&&(Array.isArray(F)?Array.prototype.push.apply(S.classes,F):S.classes.push(F)),c.hooks.run("wrap",S);var A="";for(var T in S.attributes)A+=" "+T+'="'+(S.attributes[T]||"").replace(/"/g,""")+'"';return"<"+S.tag+' class="'+S.classes.join(" ")+'"'+A+">"+S.content+"</"+S.tag+">"};function u(x,w,k,D){x.lastIndex=w;var S=x.exec(k);if(S&&D&&S[1]){var F=S[1].length;S.index+=F,S[0]=S[0].slice(F)}return S}function f(x,w,k,D,S,F){for(var A in k)if(!(!k.hasOwnProperty(A)||!k[A])){var T=k[A];T=Array.isArray(T)?T:[T];for(var M=0;M<T.length;++M){if(F&&F.cause==A+","+M)return;var I=T[M],E=I.inside,P=!!I.lookbehind,G=!!I.greedy,H=I.alias;if(G&&!I.pattern.global){var X=I.pattern.toString().match(/[imsuy]*$/)[0];I.pattern=RegExp(I.pattern.source,X+"g")}for(var z=I.pattern||I,L=D.next,_=S;L!==w.tail&&!(F&&_>=F.reach);_+=L.value.length,L=L.next){var R=L.value;if(w.length>x.length)return;if(!(R instanceof l)){var U=1,$;if(G){if($=u(z,_,x,P),!$||$.index>=x.length)break;var q=$.index,Z=$.index+$[0].length,Q=_;for(Q+=L.value.length;q>=Q;)L=L.next,Q+=L.value.length;if(Q-=L.value.length,_=Q,L.value instanceof l)continue;for(var K=L;K!==w.tail&&(Q<Z||typeof K.value=="string");K=K.next)U++,Q+=K.value.length;U--,R=x.slice(_,Q),$.index-=_}else if($=u(z,0,R,P),!$)continue;var q=$.index,W=$[0],J=R.slice(0,q),B=R.slice(q+W.length),te=_+R.length;F&&te>F.reach&&(F.reach=te);var se=L.prev;J&&(se=p(w,se,J),_+=J.length),g(w,se,U);var ee=new l(A,E?c.tokenize(W,E):W,H,W);if(L=p(w,se,ee),B&&p(w,L,B),U>1){var le={cause:A+","+M,reach:te};f(x,w,k,L.prev,_,le),F&&le.reach>F.reach&&(F.reach=le.reach)}}}}}}function m(){var x={value:null,prev:null,next:null},w={value:null,prev:x,next:null};x.next=w,this.head=x,this.tail=w,this.length=0}function p(x,w,k){var D=w.next,S={value:k,prev:w,next:D};return w.next=S,D.prev=S,x.length++,S}function g(x,w,k){for(var D=w.next,S=0;S<k&&D!==x.tail;S++)D=D.next;w.next=D,D.prev=w,x.length-=S}function C(x){for(var w=[],k=x.head.next;k!==x.tail;)w.push(k.value),k=k.next;return w}if(!n.document)return n.addEventListener&&(c.disableWorkerMessageHandler||n.addEventListener("message",function(x){var w=JSON.parse(x.data),k=w.language,D=w.code,S=w.immediateClose;n.postMessage(c.highlight(D,c.languages[k],k)),S&&n.close()},!1)),c;var y=c.util.currentScript();y&&(c.filename=y.src,y.hasAttribute("data-manual")&&(c.manual=!0));function N(){c.manual||c.highlightAll()}if(!c.manual){var v=document.readyState;v==="loading"||v==="interactive"&&y&&y.defer?document.addEventListener("DOMContentLoaded",N):window.requestAnimationFrame?window.requestAnimationFrame(N):window.setTimeout(N,16)}return c})(s);t.exports&&(t.exports=a),typeof Rr<"u"&&(Rr.Prism=a),a.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},a.languages.markup.tag.inside["attr-value"].inside.entity=a.languages.markup.entity,a.languages.markup.doctype.inside["internal-subset"].inside=a.languages.markup,a.hooks.add("wrap",function(n){n.type==="entity"&&(n.attributes.title=n.content.replace(/&/,"&"))}),Object.defineProperty(a.languages.markup.tag,"addInlined",{value:function(r,o){var i={};i["language-"+o]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:a.languages[o]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var c={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};c["language-"+o]={pattern:/[\s\S]+/,inside:a.languages[o]};var l={};l[r]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return r}),"i"),lookbehind:!0,greedy:!0,inside:c},a.languages.insertBefore("markup","cdata",l)}}),Object.defineProperty(a.languages.markup.tag,"addAttribute",{value:function(n,r){a.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+n+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[r,"language-"+r],inside:a.languages[r]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),a.languages.html=a.languages.markup,a.languages.mathml=a.languages.markup,a.languages.svg=a.languages.markup,a.languages.xml=a.languages.extend("markup",{}),a.languages.ssml=a.languages.xml,a.languages.atom=a.languages.xml,a.languages.rss=a.languages.xml,(function(n){var r=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+r.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+r.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+r.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+r.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:r,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},n.languages.css.atrule.inside.rest=n.languages.css;var o=n.languages.markup;o&&(o.tag.addInlined("style","css"),o.tag.addAttribute("style","css"))})(a),a.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},a.languages.javascript=a.languages.extend("clike",{"class-name":[a.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),a.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,a.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:a.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:a.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:a.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:a.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:a.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),a.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:a.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),a.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),a.languages.markup&&(a.languages.markup.tag.addInlined("script","javascript"),a.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),a.languages.js=a.languages.javascript,(function(){if(typeof a>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var n="Loading…",r=function(y,N){return"✖ Error "+y+" while fetching file: "+N},o="✖ Error: File does not exist or is empty",i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},c="data-src-status",l="loading",u="loaded",f="failed",m="pre[data-src]:not(["+c+'="'+u+'"]):not(['+c+'="'+l+'"])';function p(y,N,v){var x=new XMLHttpRequest;x.open("GET",y,!0),x.onreadystatechange=function(){x.readyState==4&&(x.status<400&&x.responseText?N(x.responseText):x.status>=400?v(r(x.status,x.statusText)):v(o))},x.send(null)}function g(y){var N=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(y||"");if(N){var v=Number(N[1]),x=N[2],w=N[3];return x?w?[v,Number(w)]:[v,void 0]:[v,v]}}a.hooks.add("before-highlightall",function(y){y.selector+=", "+m}),a.hooks.add("before-sanity-check",function(y){var N=y.element;if(N.matches(m)){y.code="",N.setAttribute(c,l);var v=N.appendChild(document.createElement("CODE"));v.textContent=n;var x=N.getAttribute("data-src"),w=y.language;if(w==="none"){var k=(/\.(\w+)$/.exec(x)||[,"none"])[1];w=i[k]||k}a.util.setLanguage(v,w),a.util.setLanguage(N,w);var D=a.plugins.autoloader;D&&D.loadLanguages(w),p(x,function(S){N.setAttribute(c,u);var F=g(N.getAttribute("data-range"));if(F){var A=S.split(/\r\n?|\n/g),T=F[0],M=F[1]==null?A.length:F[1];T<0&&(T+=A.length),T=Math.max(0,Math.min(T-1,A.length)),M<0&&(M+=A.length),M=Math.max(0,Math.min(M,A.length)),S=A.slice(T,M).join(`
|
|
2
|
+
`),N.hasAttribute("data-start")||N.setAttribute("data-start",String(T+1))}v.textContent=S,a.highlightElement(v)},function(S){N.setAttribute(c,f),v.textContent=S})}}),a.plugins.fileHighlight={highlight:function(N){for(var v=(N||document).querySelectorAll(m),x=0,w;w=v[x++];)a.highlightElement(w)}};var C=!1;a.fileHighlight=function(){C||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),C=!0),a.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(Ga)),Ga.exports}var qp=Wp();const Xa=Bp(qp);var Lr={},$r;function Up(){return $r||($r=1,(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var s=t.languages.extend("typescript",{});delete s["class-name"],t.languages.typescript["class-name"].inside=s,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:s}}}}),t.languages.ts=t.languages.typescript})(Prism)),Lr}Up();Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;(function(t){var s=t.util.clone(t.languages.javascript),a=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,n=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,r=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function o(l,u){return l=l.replace(/<S>/g,function(){return a}).replace(/<BRACES>/g,function(){return n}).replace(/<SPREAD>/g,function(){return r}),RegExp(l,u)}r=o(r).source,t.languages.jsx=t.languages.extend("markup",s),t.languages.jsx.tag.pattern=o(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),t.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,t.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,t.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,t.languages.jsx.tag.inside.comment=s.comment,t.languages.insertBefore("inside","attr-name",{spread:{pattern:o(/<SPREAD>/.source),inside:t.languages.jsx}},t.languages.jsx.tag),t.languages.insertBefore("inside","special-attr",{script:{pattern:o(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:t.languages.jsx}}},t.languages.jsx.tag);var i=function(l){return l?typeof l=="string"?l:typeof l.content=="string"?l.content:l.content.map(i).join(""):""},c=function(l){for(var u=[],f=0;f<l.length;f++){var m=l[f],p=!1;if(typeof m!="string"&&(m.type==="tag"&&m.content[0]&&m.content[0].type==="tag"?m.content[0].content[0].content==="</"?u.length>0&&u[u.length-1].tagName===i(m.content[0].content[1])&&u.pop():m.content[m.content.length-1].content==="/>"||u.push({tagName:i(m.content[0].content[1]),openedBraces:0}):u.length>0&&m.type==="punctuation"&&m.content==="{"?u[u.length-1].openedBraces++:u.length>0&&u[u.length-1].openedBraces>0&&m.type==="punctuation"&&m.content==="}"?u[u.length-1].openedBraces--:p=!0),(p||typeof m=="string")&&u.length>0&&u[u.length-1].openedBraces===0){var g=i(m);f<l.length-1&&(typeof l[f+1]=="string"||l[f+1].type==="plain-text")&&(g+=i(l[f+1]),l.splice(f+1,1)),f>0&&(typeof l[f-1]=="string"||l[f-1].type==="plain-text")&&(g=i(l[f-1])+g,l.splice(f-1,1),f--),l[f]=new t.Token("plain-text",g,null,g)}m.content&&typeof m.content!="string"&&c(m.content)}};t.hooks.add("after-tokenize",function(l){l.language!=="jsx"&&l.language!=="tsx"||c(l.tokens)})})(Prism);(function(t){var s=t.util.clone(t.languages.typescript);t.languages.tsx=t.languages.extend("jsx",s),delete t.languages.tsx.parameter,delete t.languages.tsx["literal-property"];var a=t.languages.tsx.tag;a.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+a.pattern.source+")",a.pattern.flags),a.lookbehind=!0})(Prism);(function(t){var s=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+s.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+s.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+s.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+s.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:s,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var a=t.languages.markup;a&&(a.tag.addInlined("style","css"),a.tag.addAttribute("style","css"))})(Prism);var Or={},zr;function Hp(){return zr||(zr=1,Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),Prism.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),Prism.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),Prism.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),Prism.languages.scss.atrule.inside.rest=Prism.languages.scss),Or}Hp();Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(t){var s="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",a={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},n={bash:a,environment:{pattern:RegExp("\\$"+s),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+s),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+s),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:n},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:a}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:n},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:n.entity}}],environment:{pattern:RegExp("\\$?"+s),alias:"constant"},variable:n.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},a.inside=t.languages.bash;for(var r=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=n.variable[1].inside,i=0;i<r.length;i++)o[r[i]]=t.languages.bash[r[i]];t.languages.sh=t.languages.bash,t.languages.shell=t.languages.bash})(Prism);var _r={},Vr;function Gp(){return Vr||(Vr=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),_r}Gp();var Br={},Wr;function Xp(){return Wr||(Wr=1,(function(t){var s=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,a=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,n={pattern:RegExp(/(^|[^\w.])/.source+a+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[n,{pattern:RegExp(/(^|[^\w.])/.source+a+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:n.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+a+/[A-Z]\w*\b/.source),lookbehind:!0,inside:n.inside}],keyword:s,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":n,keyword:s,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+a+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:n.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+a+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:n.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return s.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism)),Br}Xp();var qr={},Ur;function Yp(){return Ur||(Ur=1,(function(t){function s(_,R){return _.replace(/<<(\d+)>>/g,function(U,$){return"(?:"+R[+$]+")"})}function a(_,R,U){return RegExp(s(_,R),"")}function n(_,R){for(var U=0;U<R;U++)_=_.replace(/<<self>>/g,function(){return"(?:"+_+")"});return _.replace(/<<self>>/g,"[^\\s\\S]")}var r={type:"bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",typeDeclaration:"class enum interface record struct",contextual:"add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",other:"abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"};function o(_){return"\\b(?:"+_.trim().replace(/ /g,"|")+")\\b"}var i=o(r.typeDeclaration),c=RegExp(o(r.type+" "+r.typeDeclaration+" "+r.contextual+" "+r.other)),l=o(r.typeDeclaration+" "+r.contextual+" "+r.other),u=o(r.type+" "+r.typeDeclaration+" "+r.other),f=n(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source,2),m=n(/\((?:[^()]|<<self>>)*\)/.source,2),p=/@?\b[A-Za-z_]\w*\b/.source,g=s(/<<0>>(?:\s*<<1>>)?/.source,[p,f]),C=s(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[l,g]),y=/\[\s*(?:,\s*)*\]/.source,N=s(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[C,y]),v=s(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[f,m,y]),x=s(/\(<<0>>+(?:,<<0>>+)+\)/.source,[v]),w=s(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[x,C,y]),k={keyword:c,punctuation:/[<>()?,.:[\]]/},D=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,S=/"(?:\\.|[^\\"\r\n])*"/.source,F=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;t.languages.csharp=t.languages.extend("clike",{string:[{pattern:a(/(^|[^$\\])<<0>>/.source,[F]),lookbehind:!0,greedy:!0},{pattern:a(/(^|[^@$\\])<<0>>/.source,[S]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:a(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[C]),lookbehind:!0,inside:k},{pattern:a(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[p,w]),lookbehind:!0,inside:k},{pattern:a(/(\busing\s+)<<0>>(?=\s*=)/.source,[p]),lookbehind:!0},{pattern:a(/(\b<<0>>\s+)<<1>>/.source,[i,g]),lookbehind:!0,inside:k},{pattern:a(/(\bcatch\s*\(\s*)<<0>>/.source,[C]),lookbehind:!0,inside:k},{pattern:a(/(\bwhere\s+)<<0>>/.source,[p]),lookbehind:!0},{pattern:a(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[N]),lookbehind:!0,inside:k},{pattern:a(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[w,u,p]),inside:k}],keyword:c,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),t.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),t.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:a(/([(,]\s*)<<0>>(?=\s*:)/.source,[p]),lookbehind:!0,alias:"punctuation"}}),t.languages.insertBefore("csharp","class-name",{namespace:{pattern:a(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[p]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:a(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[m]),lookbehind:!0,alias:"class-name",inside:k},"return-type":{pattern:a(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[w,C]),inside:k,alias:"class-name"},"constructor-invocation":{pattern:a(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[w]),lookbehind:!0,inside:k,alias:"class-name"},"generic-method":{pattern:a(/<<0>>\s*<<1>>(?=\s*\()/.source,[p,f]),inside:{function:a(/^<<0>>/.source,[p]),generic:{pattern:RegExp(f),alias:"class-name",inside:k}}},"type-list":{pattern:a(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[i,g,p,w,c.source,m,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:a(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[g,m]),lookbehind:!0,greedy:!0,inside:t.languages.csharp},keyword:c,"class-name":{pattern:RegExp(w),greedy:!0,inside:k},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var A=S+"|"+D,T=s(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[A]),M=n(s(/[^"'/()]|<<0>>|\(<<self>>*\)/.source,[T]),2),I=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,E=s(/<<0>>(?:\s*\(<<1>>*\))?/.source,[C,M]);t.languages.insertBefore("csharp","class-name",{attribute:{pattern:a(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[I,E]),lookbehind:!0,greedy:!0,inside:{target:{pattern:a(/^<<0>>(?=\s*:)/.source,[I]),alias:"keyword"},"attribute-arguments":{pattern:a(/\(<<0>>*\)/.source,[M]),inside:t.languages.csharp},"class-name":{pattern:RegExp(C),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var P=/:[^}\r\n]+/.source,G=n(s(/[^"'/()]|<<0>>|\(<<self>>*\)/.source,[T]),2),H=s(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[G,P]),X=n(s(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source,[A]),2),z=s(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[X,P]);function L(_,R){return{interpolation:{pattern:a(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[_]),lookbehind:!0,inside:{"format-string":{pattern:a(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[R,P]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:t.languages.csharp}}},string:/[\s\S]+/}}t.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:a(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[H]),lookbehind:!0,greedy:!0,inside:L(H,G)},{pattern:a(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[z]),lookbehind:!0,greedy:!0,inside:L(z,X)}],char:{pattern:RegExp(D),greedy:!0}}),t.languages.dotnet=t.languages.cs=t.languages.csharp})(Prism)),qr}Yp();var Hr={},Gr;function Qp(){return Gr||(Gr=1,(function(t){var s=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,a=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],n=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,r=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,o=/[{}\[\](),:;]/;t.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:s,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:a,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:n,operator:r,punctuation:o};var i={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:t.languages.php},c=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:i}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:i}}];t.languages.insertBefore("php","variable",{string:c,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:s,string:c,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:a,number:n,operator:r,punctuation:o}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),t.hooks.add("before-tokenize",function(l){if(/<\?/.test(l.code)){var u=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;t.languages["markup-templating"].buildPlaceholders(l,"php",u)}}),t.hooks.add("after-tokenize",function(l){t.languages["markup-templating"].tokenizePlaceholders(l,"php")})})(Prism)),Hr}Qp();var Xr={},Yr;function Kp(){return Yr||(Yr=1,(function(t){t.languages.ruby=t.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),t.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var s={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:t.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete t.languages.ruby.function;var a="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",n=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;t.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+a+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:s,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:s,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+n),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+n+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),t.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+a),greedy:!0,inside:{interpolation:s,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:s,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:s,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+a),greedy:!0,inside:{interpolation:s,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:s,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete t.languages.ruby.string,t.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),t.languages.rb=t.languages.ruby})(Prism)),Xr}Kp();Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/});Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}});delete Prism.languages.go["class-name"];var Qr={},Kr;function Jp(){return Kr||(Kr=1,(function(t){for(var s=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,a=0;a<2;a++)s=s.replace(/<self>/g,function(){return s});s=s.replace(/<self>/g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+s),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(Prism)),Qr}Jp();Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};(function(t){var s=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function a(f){return f=f.replace(/<inner>/g,function(){return s}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+f+")")}var n=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,r=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return n}),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+r+o+"(?:"+r+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+r+o+")(?:"+r+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(n),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+r+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+r+"$"),inside:{"table-header":{pattern:RegExp(n),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:a(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:a(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:a(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:a(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(f){["url","bold","italic","strike","code-snippet"].forEach(function(m){f!==m&&(t.languages.markdown[f].inside.content.inside[m]=t.languages.markdown[m])})}),t.hooks.add("after-tokenize",function(f){if(f.language!=="markdown"&&f.language!=="md")return;function m(p){if(!(!p||typeof p=="string"))for(var g=0,C=p.length;g<C;g++){var y=p[g];if(y.type!=="code"){m(y.content);continue}var N=y.content[1],v=y.content[3];if(N&&v&&N.type==="code-language"&&v.type==="code-block"&&typeof N.content=="string"){var x=N.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");x=(/[a-z][\w-]*/i.exec(x)||[""])[0].toLowerCase();var w="language-"+x;v.alias?typeof v.alias=="string"?v.alias=[v.alias,w]:v.alias.push(w):v.alias=[w]}}}m(f.tokens)}),t.hooks.add("wrap",function(f){if(f.type==="code-block"){for(var m="",p=0,g=f.classes.length;p<g;p++){var C=f.classes[p],y=/language-(.+)/.exec(C);if(y){m=y[1];break}}var N=t.languages[m];if(N)f.content=t.highlight(u(f.content),N,m);else if(m&&m!=="none"&&t.plugins.autoloader){var v="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);f.attributes.id=v,t.plugins.autoloader.loadLanguages(m,function(){var x=document.getElementById(v);x&&(x.innerHTML=t.highlight(x.textContent,t.languages[m],m))})}}});var i=RegExp(t.languages.markup.tag.pattern.source,"gi"),c={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;function u(f){var m=f.replace(i,"");return m=m.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(p,g){if(g=g.toLowerCase(),g[0]==="#"){var C;return g[1]==="x"?C=parseInt(g.slice(2),16):C=Number(g.slice(1)),l(C)}else{var y=c[g];return y||p}}),m}t.languages.md=t.languages.markdown})(Prism);(function(t){var s=/[*&][^\s[\]{},]+/,a=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,n="(?:"+a.source+"(?:[ ]+"+s.source+")?|"+s.source+"(?:[ ]+"+a.source+")?)",r=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function i(c,l){l=(l||"").replace(/m/g,"")+"m";var u=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return n}).replace(/<<value>>/g,function(){return c});return RegExp(u,l)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return n})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return n}).replace(/<<key>>/g,function(){return"(?:"+r+"|"+o+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(o),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:a,important:s,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(Prism);(function(t){var s=/\\[\r\n](?:\s|\\[\r\n]|#.*(?!.))*(?![\s#]|\\[\r\n])/.source,a=/(?:[ \t]+(?![ \t])(?:<SP_BS>)?|<SP_BS>)/.source.replace(/<SP_BS>/g,function(){return s}),n=/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'/.source,r=/--[\w-]+=(?:<STR>|(?!["'])(?:[^\s\\]|\\.)+)/.source.replace(/<STR>/g,function(){return n}),o={pattern:RegExp(n),greedy:!0},i={pattern:/(^[ \t]*)#.*/m,lookbehind:!0,greedy:!0};function c(l,u){return l=l.replace(/<OPT>/g,function(){return r}).replace(/<SP>/g,function(){return a}),RegExp(l,u)}t.languages.docker={instruction:{pattern:/(^[ \t]*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)(?:\\.|[^\r\n\\])*(?:\\$(?:\s|#.*$)*(?![\s#])(?:\\.|[^\r\n\\])*)*/im,lookbehind:!0,greedy:!0,inside:{options:{pattern:c(/(^(?:ONBUILD<SP>)?\w+<SP>)<OPT>(?:<SP><OPT>)*/.source,"i"),lookbehind:!0,greedy:!0,inside:{property:{pattern:/(^|\s)--[\w-]+/,lookbehind:!0},string:[o,{pattern:/(=)(?!["'])(?:[^\s\\]|\\.)+/,lookbehind:!0}],operator:/\\$/m,punctuation:/=/}},keyword:[{pattern:c(/(^(?:ONBUILD<SP>)?HEALTHCHECK<SP>(?:<OPT><SP>)*)(?:CMD|NONE)\b/.source,"i"),lookbehind:!0,greedy:!0},{pattern:c(/(^(?:ONBUILD<SP>)?FROM<SP>(?:<OPT><SP>)*(?!--)[^ \t\\]+<SP>)AS/.source,"i"),lookbehind:!0,greedy:!0},{pattern:c(/(^ONBUILD<SP>)\w+/.source,"i"),lookbehind:!0,greedy:!0},{pattern:/^\w+/,greedy:!0}],comment:i,string:o,variable:/\$(?:\w+|\{[^{}"'\\]*\})/,operator:/\\$/m}},comment:i},t.languages.dockerfile=t.languages.docker})(Prism);Prism.languages.git={comment:/^#.*/m,deleted:/^[-–].*/m,inserted:/^\+.*/m,string:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s--?\w+/}},coord:/^@@.*@@$/m,"commit-sha1":/^commit \w{40}$/m};const Jr=lt.cva("relative rounded font-mono",{variants:{variant:{inline:"bg-muted px-[0.3rem] py-[0.2rem] text-xs sm:text-sm",block:"block bg-muted overflow-x-auto"},size:{sm:"text-xs sm:text-sm",base:"text-sm sm:text-base",lg:"text-base sm:text-lg"}},defaultVariants:{variant:"inline",size:"base"}}),Ko=d.forwardRef(({className:t,variant:s,size:a,language:n,showLineNumbers:r=!1,maxHeight:o,copyable:i=!1,filename:c,theme:l="auto",children:u,...f},m)=>{const[p,g]=d.useState(!1),[C,y]=d.useState("");d.useRef(null),d.useEffect(()=>{if(s==="block"&&n&&u)try{const v=typeof u=="string"?u:String(u),x=Xa.highlight(v,Xa.languages[n]||Xa.languages.text,n);y(x)}catch(v){console.warn(`Failed to highlight code for language: ${n}`,v),y(String(u))}else y(String(u))},[n,u,s]);const N=async()=>{if(typeof u=="string")try{await navigator.clipboard.writeText(u),g(!0),setTimeout(()=>g(!1),2e3)}catch(v){console.error("Failed to copy code:",v)}};return s==="block"?e.jsxs("div",{className:"relative my-4 sm:my-6",children:[(c||i)&&e.jsxs("div",{className:"flex items-center justify-between bg-muted/50 px-3 sm:px-4 py-2 sm:py-3 rounded-t-lg border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[c&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs sm:text-sm text-muted-foreground",children:[e.jsx(h.FileText,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"font-medium",children:c})]}),n&&!c&&e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground uppercase font-medium",children:n})]}),i&&e.jsx(j.Button,{variant:"ghost",size:"sm",onClick:N,className:"h-6 w-6 sm:h-7 sm:w-7 p-0 hover:bg-muted-foreground/10",children:p?e.jsx(h.Check,{className:"h-3 w-3 sm:h-4 sm:w-4 text-green-600"}):e.jsx(h.Copy,{className:"h-3 w-3 sm:h-4 sm:w-4"})})]}),e.jsx("div",{className:b.cn("waka-code relative",o&&"overflow-hidden"),style:{maxHeight:o?`${o}px`:void 0},children:e.jsxs("pre",{className:b.cn(Jr({variant:s,size:a}),"p-3 sm:p-4 lg:p-6","text-xs sm:text-sm lg:text-base","leading-relaxed sm:leading-loose","whitespace-pre-wrap break-words","scrollbar-thin scrollbar-thumb-muted-foreground/20 scrollbar-track-transparent","hover:scrollbar-thumb-muted-foreground/30",o&&"overflow-y-auto",!c&&!i&&n&&"rounded-lg",c||i?"rounded-b-lg":"rounded-lg",t),children:[r&&e.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-8 sm:w-10 lg:w-12 bg-muted/30 border-r border-border/50 flex flex-col text-xs sm:text-sm text-muted-foreground select-none",children:String(u).split(`
|
|
3
|
+
`).map((v,x)=>e.jsx("div",{className:"flex items-center justify-center h-5 sm:h-6 lg:h-7",children:x+1},x))}),e.jsx("code",{ref:m,className:b.cn("block",r&&"ml-8 sm:ml-10 lg:ml-12",n&&"language-"+n),...f,dangerouslySetInnerHTML:s==="block"&&n?{__html:C}:void 0,children:s==="block"&&n?void 0:u})]})}),n&&!c&&!i&&e.jsx("div",{className:"absolute top-2 right-2 text-xs text-muted-foreground/70 bg-background/80 px-2 py-1 rounded uppercase font-medium",children:n})]}):e.jsx("code",{className:b.cn(Jr({variant:s,size:a}),t),ref:m,...f,children:u})});Ko.displayName="Code";const An=Fa.Root,Fn=Fa.CollapsibleTrigger,Rn=Fa.CollapsibleContent,ds=xe.Root,Zp=xe.Trigger,Jo=xe.Portal,Zo=xe.Close,In=d.forwardRef(({className:t,...s},a)=>e.jsx(xe.Overlay,{ref:a,className:b.cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s}));In.displayName=xe.Overlay.displayName;const Kt=d.forwardRef(({className:t,children:s,...a},n)=>e.jsxs(Jo,{children:[e.jsx(In,{}),e.jsxs(xe.Content,{ref:n,className:b.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...a,children:[s,e.jsxs(xe.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(h.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Kt.displayName=xe.Content.displayName;const Cs=({className:t,...s})=>e.jsx("div",{className:b.cn("flex flex-col space-y-1.5 text-center sm:text-left",t),...s});Cs.displayName="DialogHeader";const aa=({className:t,...s})=>e.jsx("div",{className:b.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});aa.displayName="DialogFooter";const ks=d.forwardRef(({className:t,...s},a)=>e.jsx(xe.Title,{ref:a,className:b.cn("text-lg font-semibold leading-none tracking-tight",t),...s}));ks.displayName=xe.Title.displayName;const da=d.forwardRef(({className:t,...s},a)=>e.jsx(xe.Description,{ref:a,className:b.cn("text-sm text-muted-foreground",t),...s}));da.displayName=xe.Description.displayName;const us=d.forwardRef(({className:t,...s},a)=>e.jsx(xt.Command,{ref:a,className:b.cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...s}));us.displayName=xt.Command.displayName;const ex=({children:t,...s})=>e.jsx(ds,{...s,children:e.jsx(Kt,{className:"overflow-hidden p-0 shadow-lg",children:e.jsx(us,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[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:t})})}),Ss=d.forwardRef(({className:t,...s},a)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(h.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(xt.Command.Input,{ref:a,className:b.cn("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...s})]}));Ss.displayName=xt.Command.Input.displayName;const ua=d.forwardRef(({className:t,...s},a)=>e.jsx(xt.Command.List,{ref:a,className:b.cn("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...s}));ua.displayName=xt.Command.List.displayName;const Ds=d.forwardRef((t,s)=>e.jsx(xt.Command.Empty,{ref:s,className:"py-6 text-center text-sm",...t}));Ds.displayName=xt.Command.Empty.displayName;const Jt=d.forwardRef(({className:t,...s},a)=>e.jsx(xt.Command.Group,{ref:a,className:b.cn("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...s}));Jt.displayName=xt.Command.Group.displayName;const Ea=d.forwardRef(({className:t,...s},a)=>e.jsx(xt.Command.Separator,{ref:a,className:b.cn("-mx-1 h-px bg-border",t),...s}));Ea.displayName=xt.Command.Separator.displayName;const Zt=d.forwardRef(({className:t,...s},a)=>e.jsx(xt.Command.Item,{ref:a,className:b.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...s}));Zt.displayName=xt.Command.Item.displayName;const ei=({className:t,...s})=>e.jsx("span",{className:b.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...s});ei.displayName="CommandShortcut";const ti=Ie.Root,si=Ie.Trigger,tx=Ie.Group,sx=Ie.Portal,ax=Ie.Sub,nx=Ie.RadioGroup,ai=d.forwardRef(({className:t,inset:s,children:a,...n},r)=>e.jsxs(Ie.SubTrigger,{ref:r,className:b.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",s&&"pl-8",t),...n,children:[a,e.jsx(h.ChevronRight,{className:"ml-auto h-4 w-4"})]}));ai.displayName=Ie.SubTrigger.displayName;const ni=d.forwardRef(({className:t,...s},a)=>e.jsx(Ie.SubContent,{ref:a,className:b.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground 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",t),...s}));ni.displayName=Ie.SubContent.displayName;const Ln=d.forwardRef(({className:t,...s},a)=>e.jsx(Ie.Portal,{children:e.jsx(Ie.Content,{ref:a,className:b.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 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",t),...s})}));Ln.displayName=Ie.Content.displayName;const Vt=d.forwardRef(({className:t,inset:s,...a},n)=>e.jsx(Ie.Item,{ref:n,className:b.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s&&"pl-8",t),...a}));Vt.displayName=Ie.Item.displayName;const ri=d.forwardRef(({className:t,children:s,checked:a,...n},r)=>e.jsxs(Ie.CheckboxItem,{ref:r,className:b.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:a,...n,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ie.ItemIndicator,{children:e.jsx(h.Check,{className:"h-4 w-4"})})}),s]}));ri.displayName=Ie.CheckboxItem.displayName;const oi=d.forwardRef(({className:t,children:s,...a},n)=>e.jsxs(Ie.RadioItem,{ref:n,className:b.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ie.ItemIndicator,{children:e.jsx(h.Circle,{className:"h-2 w-2 fill-current"})})}),s]}));oi.displayName=Ie.RadioItem.displayName;const ii=d.forwardRef(({className:t,inset:s,...a},n)=>e.jsx(Ie.Label,{ref:n,className:b.cn("px-2 py-1.5 text-sm font-semibold text-foreground",s&&"pl-8",t),...a}));ii.displayName=Ie.Label.displayName;const Zs=d.forwardRef(({className:t,...s},a)=>e.jsx(Ie.Separator,{ref:a,className:b.cn("-mx-1 my-1 h-px bg-border",t),...s}));Zs.displayName=Ie.Separator.displayName;const li=({className:t,...s})=>e.jsx("span",{className:b.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...s});li.displayName="ContextMenuShortcut";const Je=Le.Root,Ze=Le.Trigger,rx=Le.Group,ox=Le.Portal,ix=Le.Sub,lx=Le.RadioGroup,ci=d.forwardRef(({className:t,inset:s,children:a,...n},r)=>e.jsxs(Le.SubTrigger,{ref:r,className:b.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",s&&"pl-8",t),...n,children:[a,e.jsx(h.ChevronRight,{className:"ml-auto h-4 w-4"})]}));ci.displayName=Le.SubTrigger.displayName;const di=d.forwardRef(({className:t,...s},a)=>e.jsx(Le.SubContent,{ref:a,className:b.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground 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",t),...s}));di.displayName=Le.SubContent.displayName;const Ye=d.forwardRef(({className:t,sideOffset:s=4,...a},n)=>e.jsx(Le.Portal,{children:e.jsx(Le.Content,{ref:n,sideOffset:s,className:b.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground 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",t),...a})}));Ye.displayName=Le.Content.displayName;const Ne=d.forwardRef(({className:t,inset:s,...a},n)=>e.jsx(Le.Item,{ref:n,className:b.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s&&"pl-8",t),...a}));Ne.displayName=Le.Item.displayName;const vs=d.forwardRef(({className:t,children:s,checked:a,...n},r)=>e.jsxs(Le.CheckboxItem,{ref:r,className:b.cn("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-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:a,...n,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Le.ItemIndicator,{children:e.jsx(h.Check,{className:"h-4 w-4"})})}),s]}));vs.displayName=Le.CheckboxItem.displayName;const ui=d.forwardRef(({className:t,children:s,...a},n)=>e.jsxs(Le.RadioItem,{ref:n,className:b.cn("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-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Le.ItemIndicator,{children:e.jsx(h.Circle,{className:"h-2 w-2 fill-current"})})}),s]}));ui.displayName=Le.RadioItem.displayName;const ys=d.forwardRef(({className:t,inset:s,...a},n)=>e.jsx(Le.Label,{ref:n,className:b.cn("px-2 py-1.5 text-sm font-semibold",s&&"pl-8",t),...a}));ys.displayName=Le.Label.displayName;const dt=d.forwardRef(({className:t,...s},a)=>e.jsx(Le.Separator,{ref:a,className:b.cn("-mx-1 my-1 h-px bg-muted",t),...s}));dt.displayName=Le.Separator.displayName;const mi=({className:t,...s})=>e.jsx("span",{className:b.cn("ml-auto text-xs tracking-widest opacity-60",t),...s});mi.displayName="DropdownMenuShortcut";var cx=t=>t.type==="checkbox",Ys=t=>t instanceof Date,$n=t=>t==null;const hi=t=>typeof t=="object";var Ts=t=>!$n(t)&&!Array.isArray(t)&&hi(t)&&!Ys(t),dx=t=>Ts(t)&&t.target?cx(t.target)?t.target.checked:t.target.value:t,ux=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,mx=(t,s)=>t.has(ux(s)),hx=t=>{const s=t.constructor&&t.constructor.prototype;return Ts(s)&&s.hasOwnProperty("isPrototypeOf")},fx=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function fi(t){let s;const a=Array.isArray(t),n=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)s=new Date(t);else if(!(fx&&(t instanceof Blob||n))&&(a||Ts(t)))if(s=a?[]:Object.create(Object.getPrototypeOf(t)),!a&&!hx(t))s=t;else for(const r in t)t.hasOwnProperty(r)&&(s[r]=fi(t[r]));else return t;return s}var pi=t=>/^\w*$/.test(t),mn=t=>t===void 0,px=t=>Array.isArray(t)?t.filter(Boolean):[],xi=t=>px(t.replace(/["|']|\]/g,"").split(/\.|\[/)),ht=(t,s,a)=>{if(!s||!Ts(t))return a;const n=(pi(s)?[s]:xi(s)).reduce((r,o)=>$n(r)?r:r[o],t);return mn(n)||n===t?mn(t[s])?a:t[s]:n},Ya=t=>typeof t=="boolean",Zr=(t,s,a)=>{let n=-1;const r=pi(s)?[s]:xi(s),o=r.length,i=o-1;for(;++n<o;){const c=r[n];let l=a;if(n!==i){const u=t[c];l=Ts(u)||Array.isArray(u)?u:isNaN(+r[n+1])?{}:[]}if(c==="__proto__"||c==="constructor"||c==="prototype")return;t[c]=l,t=t[c]}};const eo={BLUR:"blur",CHANGE:"change"},to={all:"all"},On=O.createContext(null);On.displayName="HookFormContext";const Ia=()=>O.useContext(On),xx=t=>{const{children:s,...a}=t;return O.createElement(On.Provider,{value:a},s)};var gx=(t,s,a,n=!0)=>{const r={defaultValues:s._defaultValues};for(const o in t)Object.defineProperty(r,o,{get:()=>{const i=o;return s._proxyFormState[i]!==to.all&&(s._proxyFormState[i]=!n||to.all),a&&(a[i]=!0),t[i]}});return r};const gi=typeof window<"u"?O.useLayoutEffect:O.useEffect;function bx(t){const s=Ia(),{control:a=s.control,disabled:n,name:r,exact:o}=t||{},[i,c]=O.useState(a._formState),l=O.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return gi(()=>a._subscribe({name:r,formState:l.current,exact:o,callback:u=>{!n&&c({...a._formState,...u})}}),[r,n,o]),O.useEffect(()=>{l.current.isValid&&a._setValid(!0)},[a]),O.useMemo(()=>gx(i,a,l.current,!1),[i,a])}var jx=t=>typeof t=="string",so=(t,s,a,n,r)=>jx(t)?ht(a,t,r):Array.isArray(t)?t.map(o=>ht(a,o)):a,ao=t=>$n(t)||!hi(t);function ya(t,s,a=new WeakSet){if(ao(t)||ao(s))return Object.is(t,s);if(Ys(t)&&Ys(s))return t.getTime()===s.getTime();const n=Object.keys(t),r=Object.keys(s);if(n.length!==r.length)return!1;if(a.has(t)||a.has(s))return!0;a.add(t),a.add(s);for(const o of n){const i=t[o];if(!r.includes(o))return!1;if(o!=="ref"){const c=s[o];if(Ys(i)&&Ys(c)||Ts(i)&&Ts(c)||Array.isArray(i)&&Array.isArray(c)?!ya(i,c,a):!Object.is(i,c))return!1}}return!0}function vx(t){const s=Ia(),{control:a=s.control,name:n,defaultValue:r,disabled:o,exact:i,compute:c}=t||{},l=O.useRef(r),u=O.useRef(c),f=O.useRef(void 0),m=O.useRef(a),p=O.useRef(n);u.current=c;const[g,C]=O.useState(()=>{const k=a._getWatch(n,l.current);return u.current?u.current(k):k}),y=O.useCallback(k=>{const D=so(n,a._names,k||a._formValues,!1,l.current);return u.current?u.current(D):D},[a._formValues,a._names,n]),N=O.useCallback(k=>{if(!o){const D=so(n,a._names,k||a._formValues,!1,l.current);if(u.current){const S=u.current(D);ya(S,f.current)||(C(S),f.current=S)}else C(D)}},[a._formValues,a._names,o,n]);gi(()=>((m.current!==a||!ya(p.current,n))&&(m.current=a,p.current=n,N()),a._subscribe({name:n,formState:{values:!0},exact:i,callback:k=>{N(k.values)}})),[a,i,n,N]),O.useEffect(()=>a._removeUnmounted());const v=m.current!==a,x=p.current,w=O.useMemo(()=>{if(o)return null;const k=!v&&!ya(x,n);return v||k?y():null},[o,v,n,x,y]);return w!==null?w:g}function yx(t){const s=Ia(),{name:a,disabled:n,control:r=s.control,shouldUnregister:o,defaultValue:i,exact:c=!0}=t,l=mx(r._names.array,a),u=O.useMemo(()=>ht(r._formValues,a,ht(r._defaultValues,a,i)),[r,a,i]),f=vx({control:r,name:a,defaultValue:u,exact:c}),m=bx({control:r,name:a,exact:c}),p=O.useRef(t),g=O.useRef(void 0),C=O.useRef(r.register(a,{...t.rules,value:f,...Ya(t.disabled)?{disabled:t.disabled}:{}}));p.current=t;const y=O.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ht(m.errors,a)},isDirty:{enumerable:!0,get:()=>!!ht(m.dirtyFields,a)},isTouched:{enumerable:!0,get:()=>!!ht(m.touchedFields,a)},isValidating:{enumerable:!0,get:()=>!!ht(m.validatingFields,a)},error:{enumerable:!0,get:()=>ht(m.errors,a)}}),[m,a]),N=O.useCallback(k=>C.current.onChange({target:{value:dx(k),name:a},type:eo.CHANGE}),[a]),v=O.useCallback(()=>C.current.onBlur({target:{value:ht(r._formValues,a),name:a},type:eo.BLUR}),[a,r._formValues]),x=O.useCallback(k=>{const D=ht(r._fields,a);D&&k&&(D._f.ref={focus:()=>k.focus&&k.focus(),select:()=>k.select&&k.select(),setCustomValidity:S=>k.setCustomValidity(S),reportValidity:()=>k.reportValidity()})},[r._fields,a]),w=O.useMemo(()=>({name:a,value:f,...Ya(n)||m.disabled?{disabled:m.disabled||n}:{},onChange:N,onBlur:v,ref:x}),[a,n,m.disabled,N,v,x,f]);return O.useEffect(()=>{const k=r._options.shouldUnregister||o,D=g.current;D&&D!==a&&!l&&r.unregister(D),r.register(a,{...p.current.rules,...Ya(p.current.disabled)?{disabled:p.current.disabled}:{}});const S=(F,A)=>{const T=ht(r._fields,F);T&&T._f&&(T._f.mount=A)};if(S(a,!0),k){const F=fi(ht(r._options.defaultValues,a,p.current.defaultValue));Zr(r._defaultValues,a,F),mn(ht(r._formValues,a))&&Zr(r._formValues,a,F)}return!l&&r.register(a),g.current=a,()=>{(l?k&&!r._state.action:k)?r.unregister(a):S(a,!1)}},[a,r,l,o]),O.useEffect(()=>{r._setDisabledField({disabled:n,name:a})},[n,a,r]),O.useMemo(()=>({field:w,formState:m,fieldState:y}),[w,m,y])}const bi=t=>t.render(yx(t)),wx=xx,ji=d.createContext({}),Nx=({...t})=>e.jsx(ji.Provider,{value:{name:t.name},children:e.jsx(bi,{...t})}),ma=()=>{const t=d.useContext(ji),s=d.useContext(vi),{getFieldState:a,formState:n}=Ia(),r=a(t.name,n);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:o}=s;return{id:o,name:t.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...r}},vi=d.createContext({}),yi=d.forwardRef(({className:t,...s},a)=>{const n=d.useId();return e.jsx(vi.Provider,{value:{id:n},children:e.jsx("div",{ref:a,className:b.cn("space-y-2",t),...s})})});yi.displayName="FormItem";const wi=d.forwardRef(({className:t,...s},a)=>{const{error:n,formItemId:r}=ma();return e.jsx(j.Label,{ref:a,className:b.cn(n&&"text-destructive",t),htmlFor:r,...s})});wi.displayName="FormLabel";const Ni=d.forwardRef(({...t},s)=>{const{error:a,formItemId:n,formDescriptionId:r,formMessageId:o}=ma();return e.jsx(Aa.Slot,{ref:s,id:n,"aria-describedby":a?`${r} ${o}`:`${r}`,"aria-invalid":!!a,...t})});Ni.displayName="FormControl";const Ci=d.forwardRef(({className:t,...s},a)=>{const{formDescriptionId:n}=ma();return e.jsx("p",{ref:a,id:n,className:b.cn("text-sm text-muted-foreground",t),...s})});Ci.displayName="FormDescription";const ki=d.forwardRef(({className:t,children:s,...a},n)=>{const{error:r,formMessageId:o}=ma(),i=r?String(r?.message):s;return i?e.jsx("p",{ref:n,id:o,className:b.cn("text-sm font-medium text-destructive",t),...a,children:i}):null});ki.displayName="FormMessage";const Cx=ca.Root,kx=ca.Trigger,Si=d.forwardRef(({className:t,align:s="center",sideOffset:a=4,...n},r)=>e.jsx(ca.Content,{ref:r,align:s,sideOffset:a,className:b.cn("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n}));Si.displayName=ca.Content.displayName;const Di=d.forwardRef(({length:t=6,value:s="",onChange:a,onComplete:n,pattern:r="numeric",secure:o=!1,disabled:i=!1,className:c,error:l,size:u="md",separator:f,separatorElement:m=e.jsx("span",{className:"text-muted-foreground",children:"-"}),...p},g)=>{const[C,y]=d.useState(s.split("").slice(0,t)),N=d.useRef([]);d.useEffect(()=>{const A=s.split("").slice(0,t);y(A)},[s,t]);const x=(()=>{switch(r){case"numeric":return/^[0-9]$/;case"alpha":return/^[a-zA-Z]$/;case"alphanumeric":return/^[a-zA-Z0-9]$/;default:return/^.$/}})(),w=(A,T)=>{if(i)return;const M=T.slice(-1);if(M&&!x.test(M))return;const I=[...C];I[A]=M,y(I);const E=I.join("");a?.(E),M&&A<t-1&&N.current[A+1]?.focus(),I.every(P=>P!=="")&&I.length===t&&n?.(E)},k=(A,T)=>{if(!i){if(T.key==="Backspace"){T.preventDefault();const M=[...C];M[A]?(M[A]="",y(M),a?.(M.join(""))):A>0&&(M[A-1]="",y(M),a?.(M.join("")),N.current[A-1]?.focus())}if(T.key==="Delete"){T.preventDefault();const M=[...C];M[A]="",y(M),a?.(M.join(""))}T.key==="ArrowLeft"&&A>0&&(T.preventDefault(),N.current[A-1]?.focus()),T.key==="ArrowRight"&&A<t-1&&(T.preventDefault(),N.current[A+1]?.focus()),T.key==="Home"&&(T.preventDefault(),N.current[0]?.focus()),T.key==="End"&&(T.preventDefault(),N.current[t-1]?.focus())}},D=A=>{if(A.preventDefault(),i)return;const M=A.clipboardData.getData("text/plain").split("").filter(P=>x.test(P)).slice(0,t),I=[...C];M.forEach((P,G)=>{I[G]=P}),y(I),a?.(I.join(""));const E=I.findIndex(P=>!P);E!==-1?N.current[E]?.focus():N.current[t-1]?.focus(),I.every(P=>P!=="")&&I.length===t&&n?.(I.join(""))},S=A=>{A.target.select()},F={sm:"h-8 w-8 text-sm",md:"h-12 w-12 text-base",lg:"h-16 w-16 text-lg"}[u];return e.jsxs("div",{ref:g,className:b.cn("flex flex-col gap-2",c),children:[e.jsx("div",{className:"flex items-center gap-2",children:Array.from({length:t}).map((A,T)=>e.jsxs(d.Fragment,{children:[e.jsx("input",{ref:M=>N.current[T]=M,type:o?"password":"text",inputMode:r==="numeric"?"numeric":"text",maxLength:1,value:C[T]||"",onChange:M=>w(T,M.target.value),onKeyDown:M=>k(T,M),onPaste:D,onFocus:S,disabled:i,className:b.cn("flex items-center justify-center rounded-md border border-input bg-background text-center font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50",F,l&&"border-destructive focus-visible:ring-destructive",C[T]&&"border-primary"),"aria-label":`Caractère ${T+1} sur ${t}`,...p}),f&&(T+1)%f===0&&T<t-1&&e.jsx("div",{className:"flex items-center justify-center",children:m})]},T))}),l&&e.jsx("p",{className:"text-sm text-destructive",role:"alert",children:l})]})});Di.displayName="InputOTP";const Be=Ge.Root,Sx=Ge.Group,We=Ge.Value,ze=d.forwardRef(({className:t,children:s,...a},n)=>e.jsxs(Ge.Trigger,{ref:n,className:b.cn("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[s,e.jsx(Ge.Icon,{asChild:!0,children:e.jsx(h.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));ze.displayName=Ge.Trigger.displayName;const zn=d.forwardRef(({className:t,...s},a)=>e.jsx(Ge.ScrollUpButton,{ref:a,className:b.cn("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(h.ChevronUp,{className:"h-4 w-4"})}));zn.displayName=Ge.ScrollUpButton.displayName;const _n=d.forwardRef(({className:t,...s},a)=>e.jsx(Ge.ScrollDownButton,{ref:a,className:b.cn("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(h.ChevronDown,{className:"h-4 w-4"})}));_n.displayName=Ge.ScrollDownButton.displayName;const _e=d.forwardRef(({className:t,children:s,position:a="popper",...n},r)=>e.jsx(Ge.Portal,{children:e.jsxs(Ge.Content,{ref:r,className:b.cn("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground 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",a==="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",t),position:a,...n,children:[e.jsx(zn,{}),e.jsx(Ge.Viewport,{className:b.cn("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx(_n,{})]})}));_e.displayName=Ge.Content.displayName;const Ti=d.forwardRef(({className:t,...s},a)=>e.jsx(Ge.Label,{ref:a,className:b.cn("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...s}));Ti.displayName=Ge.Label.displayName;const ke=d.forwardRef(({className:t,children:s,...a},n)=>e.jsxs(Ge.Item,{ref:n,className:b.cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ge.ItemIndicator,{children:e.jsx(h.Check,{className:"h-4 w-4"})})}),e.jsx(Ge.ItemText,{children:s})]}));ke.displayName=Ge.Item.displayName;const Ei=d.forwardRef(({className:t,...s},a)=>e.jsx(Ge.Separator,{ref:a,className:b.cn("-mx-1 my-1 h-px bg-muted",t),...s}));Ei.displayName=Ge.Separator.displayName;const is=xe.Root,Vn=xe.Trigger,Dx=xe.Close,Pi=xe.Portal,Bn=d.forwardRef(({className:t,...s},a)=>e.jsx(xe.Overlay,{className:b.cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s,ref:a}));Bn.displayName=xe.Overlay.displayName;const Tx=lt.cva("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{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-sm"}},defaultVariants:{side:"right"}}),Wt=d.forwardRef(({side:t="right",className:s,children:a,...n},r)=>e.jsxs(Pi,{children:[e.jsx(Bn,{}),e.jsxs(xe.Content,{ref:r,className:b.cn(Tx({side:t}),s),...n,children:[a,e.jsxs(xe.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(h.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Wt.displayName=xe.Content.displayName;const ws=({className:t,...s})=>e.jsx("div",{className:b.cn("flex flex-col space-y-2 text-center sm:text-left",t),...s});ws.displayName="SheetHeader";const Mi=({className:t,...s})=>e.jsx("div",{className:b.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});Mi.displayName="SheetFooter";const Ns=d.forwardRef(({className:t,...s},a)=>e.jsx(xe.Title,{ref:a,className:b.cn("text-lg font-semibold text-foreground",t),...s}));Ns.displayName=xe.Title.displayName;const La=d.forwardRef(({className:t,...s},a)=>e.jsx(xe.Description,{ref:a,className:b.cn("text-sm text-muted-foreground",t),...s}));La.displayName=xe.Description.displayName;function Ex({languages:t,value:s,onChange:a,showFlags:n=!0,showLabels:r=!0,variant:o="default",isLoading:i=!1,className:c,placeholder:l="Select language",ariaLabel:u="Select language",title:f="Select Language",continueLabel:m="Continue",recentLanguages:p=[],recentLabel:g="Recently Used",allLabel:C="All Countries",searchPlaceholder:y="Search",mobileBreakpoint:N=640,disableMobileFullscreen:v=!1}){const[x,w]=d.useState(!1),[k,D]=d.useState(!1),[S,F]=d.useState(!1),[A,T]=d.useState(""),[M,I]=d.useState(s),[E,P]=d.useState(!1),G=d.useRef(null),H=d.useRef(null);d.useEffect(()=>{F(!0);const q=()=>{P(window.innerWidth<N)};return q(),window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[N]),d.useEffect(()=>{I(s)},[s]),d.useEffect(()=>{k||(T(""),I(s))},[k,s]);const X=t.find(q=>q.code===s),z=q=>{E&&!v?I(q):(a?.(q),w(!1))},L=()=>{M&&a?.(M),D(!1)},_=q=>{q.preventDefault(),q.stopPropagation(),E&&!v?D(!0):w(!x)},[R,U]=d.useState({top:0,left:0});d.useEffect(()=>{if(x&&G.current&&S){const q=G.current.getBoundingClientRect();U({top:q.bottom+8,left:q.left})}},[x,S]);const $=d.useMemo(()=>{if(!A)return t;const q=A.toLowerCase();return t.filter(W=>W.label.toLowerCase().includes(q)||W.code.toLowerCase().includes(q)||W.shortLabel?.toLowerCase().includes(q))},[t,A]),Z=d.useMemo(()=>p.map(q=>t.find(W=>W.code===q)).filter(q=>q!==void 0),[t,p]),Q=()=>e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"p-4 border-b",children:e.jsxs("div",{className:"relative",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(j.Input,{placeholder:y,value:A,onChange:q=>T(q.target.value),className:"pl-10 pr-10 h-12 rounded-full border-2"}),A&&e.jsx("button",{onClick:()=>T(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:e.jsx(h.X,{className:"h-4 w-4"})})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-24",children:[!A&&Z.length>0&&e.jsxs("div",{className:"mb-6 pt-4",children:[e.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:g}),e.jsx("div",{className:"flex gap-3 overflow-x-auto pb-2 -mx-4 px-4",children:Z.map(q=>e.jsxs("button",{onClick:()=>I(q.code),className:b.cn("flex flex-col items-center justify-center min-w-[100px] h-[100px] rounded-xl border-2 transition-all shrink-0",M===q.code?"border-primary bg-primary/5":"border-border hover:border-primary/50 bg-background"),children:[q.flag?e.jsx("img",{src:q.flag,alt:q.label,className:"h-10 w-14 object-cover rounded shadow-sm"}):q.flagEmoji?e.jsx("span",{className:"text-4xl",children:q.flagEmoji}):e.jsx(h.Globe,{className:"h-10 w-10 text-muted-foreground"}),e.jsx("span",{className:"mt-2 text-sm font-medium",children:q.shortLabel||q.code.toUpperCase()})]},q.code))})]}),e.jsxs("div",{className:b.cn(!A&&Z.length===0&&"pt-4"),children:[e.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:C}),e.jsx("div",{className:"space-y-2",children:$.map(q=>e.jsxs("button",{onClick:()=>I(q.code),className:b.cn("flex items-center gap-4 w-full p-4 rounded-xl border-2 transition-all",M===q.code?"border-primary bg-primary/5":"border-border hover:border-primary/50 bg-background"),children:[q.flag?e.jsx("img",{src:q.flag,alt:q.label,className:"h-8 w-12 object-cover rounded shadow-sm"}):q.flagEmoji?e.jsx("span",{className:"text-2xl",children:q.flagEmoji}):e.jsx(h.Globe,{className:"h-8 w-8 text-muted-foreground"}),e.jsx("span",{className:"flex-1 text-left font-medium",children:q.label}),e.jsx("div",{className:b.cn("w-6 h-6 rounded-full border-2 flex items-center justify-center transition-colors",M===q.code?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/30"),children:M===q.code&&e.jsx(h.Check,{className:"h-4 w-4"})})]},q.code))})]}),$.length===0&&e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[e.jsx(h.Globe,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No languages found"})]})]}),e.jsx("div",{className:"absolute bottom-0 left-0 right-0 p-4 bg-gradient-to-t from-background via-background to-transparent pt-8",children:e.jsxs(j.Button,{onClick:L,disabled:!M,className:"w-full h-14 text-lg rounded-xl",size:"lg",children:[m,e.jsx(h.ChevronRight,{className:"h-5 w-5 ml-2"})]})})]});if(o==="default")return e.jsxs(e.Fragment,{children:[e.jsxs(Be,{value:s,onValueChange:a,disabled:i,open:E&&!v?!1:void 0,onOpenChange:q=>{E&&!v&&q&&D(!0)},children:[e.jsx(ze,{className:b.cn("w-[180px]",c),children:e.jsx(We,{placeholder:l,children:X&&e.jsxs("div",{className:"flex items-center gap-2",children:[n&&X.flagEmoji&&e.jsx("span",{className:"text-lg",children:X.flagEmoji}),n&&X.flag&&!X.flagEmoji&&e.jsx("img",{src:X.flag,alt:X.label,className:"h-4 w-6 object-cover rounded"}),!n&&e.jsx(h.Globe,{className:"h-4 w-4 text-muted-foreground"}),r&&e.jsx("span",{children:X.label})]})})}),e.jsx(_e,{children:t.map(q=>e.jsx(ke,{value:q.code,children:e.jsxs("div",{className:"flex items-center gap-2",children:[n&&q.flagEmoji&&e.jsx("span",{className:"text-lg",children:q.flagEmoji}),n&&q.flag&&!q.flagEmoji&&e.jsx("img",{src:q.flag,alt:q.label,className:"h-4 w-6 object-cover rounded"}),r&&q.label]})},q.code))})]}),e.jsx(is,{open:k,onOpenChange:D,children:e.jsxs(Wt,{side:"bottom",className:"h-[85vh] p-0 rounded-t-3xl",children:[e.jsx(ws,{className:"p-4 border-b",children:e.jsx(Ns,{children:f})}),e.jsx(Q,{})]})})]});if(o==="minimal"){const q=x&&S&&!E?e.jsx("div",{ref:H,className:"fixed z-[9999] min-w-[160px] rounded-md border border-border bg-popover text-popover-foreground p-2 shadow-lg",style:{top:`${R.top}px`,left:`${R.left}px`},onMouseDown:W=>W.stopPropagation(),children:e.jsx("div",{className:"grid gap-1",children:t.map(W=>e.jsxs("button",{onMouseDown:J=>{J.preventDefault(),J.stopPropagation(),z(W.code)},type:"button",className:b.cn("flex items-center gap-2 rounded-sm px-2 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer",s===W.code&&"bg-accent"),children:[W.flagEmoji&&e.jsx("span",{className:"text-lg",children:W.flagEmoji}),W.flag&&!W.flagEmoji&&e.jsx("img",{src:W.flag,alt:W.label,className:"h-4 w-6 object-cover rounded"}),e.jsx("span",{className:"flex-1 text-left",children:W.label}),s===W.code&&e.jsx(h.Check,{className:"h-4 w-4 shrink-0"})]},W.code))})}):null;return e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:G,onClick:_,className:b.cn("flex h-9 w-9 items-center justify-center rounded-md border border-input bg-transparent hover:bg-accent hover:text-accent-foreground transition-colors",c),title:"Changer de langue",type:"button",disabled:i,children:[X?.flagEmoji?e.jsx("span",{className:"text-lg",children:X.flagEmoji}):e.jsx(h.Globe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:u})]}),S&&typeof document<"u"&&q&&ln.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[9998]",onMouseDown:W=>{W.preventDefault(),w(!1)}}),q]}),document.body),e.jsx(is,{open:k,onOpenChange:D,children:e.jsxs(Wt,{side:"bottom",className:"h-[85vh] p-0 rounded-t-3xl",children:[e.jsx(ws,{className:"p-4 border-b",children:e.jsx(Ns,{children:f})}),e.jsx(Q,{})]})})]})}const K=x&&S&&!E?e.jsx("div",{ref:H,className:"fixed z-[9999] min-w-[180px] rounded-md border border-border bg-popover text-popover-foreground p-2 shadow-lg",style:{top:`${R.top}px`,left:`${R.left}px`},onMouseDown:q=>q.stopPropagation(),children:e.jsx("div",{className:"grid gap-1",children:t.map(q=>e.jsxs("button",{onMouseDown:W=>{W.preventDefault(),W.stopPropagation(),z(q.code)},type:"button",className:b.cn("flex items-center gap-2 rounded-sm px-2 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer",s===q.code&&"bg-accent"),children:[n&&q.flagEmoji&&e.jsx("span",{className:"text-lg",children:q.flagEmoji}),n&&q.flag&&!q.flagEmoji&&e.jsx("img",{src:q.flag,alt:q.label,className:"h-4 w-6 object-cover rounded"}),e.jsx("span",{className:"flex-1 text-left",children:q.label}),s===q.code&&e.jsx(h.Check,{className:"h-4 w-4 shrink-0"})]},q.code))})}):null;return e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:G,onClick:_,className:b.cn("inline-flex items-center gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",i&&"opacity-50 cursor-not-allowed",c),disabled:i,type:"button","aria-label":u,children:[n&&X?.flagEmoji&&e.jsx("span",{className:"text-lg",children:X.flagEmoji}),n&&X?.flag&&!X?.flagEmoji&&e.jsx("img",{src:X.flag,alt:X.label,className:"h-4 w-6 object-cover rounded"}),!n&&e.jsx(h.Globe,{className:"h-4 w-4"}),r&&e.jsx("span",{children:X?.label||"Langue"}),e.jsx(h.ChevronDown,{className:"h-4 w-4"})]}),S&&typeof document<"u"&&K&&ln.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[9998]",onMouseDown:q=>{q.preventDefault(),w(!1)}}),K]}),document.body),e.jsx(is,{open:k,onOpenChange:D,children:e.jsxs(Wt,{side:"bottom",className:"h-[85vh] p-0 rounded-t-3xl",children:[e.jsx(ws,{className:"p-4 border-b",children:e.jsx(Ns,{children:f})}),e.jsx(Q,{})]})})]})}const Px=Ae.Menu,Mx=Ae.Group,Ax=Ae.Portal,Fx=Ae.Sub,Rx=Ae.RadioGroup,Ai=d.forwardRef(({className:t,...s},a)=>e.jsx(Ae.Root,{ref:a,className:b.cn("flex h-10 items-center space-x-1 rounded-md border bg-background p-1",t),...s}));Ai.displayName=Ae.Root.displayName;const Fi=d.forwardRef(({className:t,...s},a)=>e.jsx(Ae.Trigger,{ref:a,className:b.cn("flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t),...s}));Fi.displayName=Ae.Trigger.displayName;const Ri=d.forwardRef(({className:t,inset:s,children:a,...n},r)=>e.jsxs(Ae.SubTrigger,{ref:r,className:b.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",s&&"pl-8",t),...n,children:[a,e.jsx(h.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Ri.displayName=Ae.SubTrigger.displayName;const Ii=d.forwardRef(({className:t,...s},a)=>e.jsx(Ae.SubContent,{ref:a,className:b.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s}));Ii.displayName=Ae.SubContent.displayName;const Li=d.forwardRef(({className:t,align:s="start",alignOffset:a=-4,sideOffset:n=8,...r},o)=>e.jsx(Ae.Portal,{children:e.jsx(Ae.Content,{ref:o,align:s,alignOffset:a,sideOffset:n,className:b.cn("z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in 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",t),...r})}));Li.displayName=Ae.Content.displayName;const $i=d.forwardRef(({className:t,inset:s,...a},n)=>e.jsx(Ae.Item,{ref:n,className:b.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s&&"pl-8",t),...a}));$i.displayName=Ae.Item.displayName;const Oi=d.forwardRef(({className:t,children:s,checked:a,...n},r)=>e.jsxs(Ae.CheckboxItem,{ref:r,className:b.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:a,...n,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ae.ItemIndicator,{children:e.jsx(h.Check,{className:"h-4 w-4"})})}),s]}));Oi.displayName=Ae.CheckboxItem.displayName;const zi=d.forwardRef(({className:t,children:s,...a},n)=>e.jsxs(Ae.RadioItem,{ref:n,className:b.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ae.ItemIndicator,{children:e.jsx(h.Circle,{className:"h-2 w-2 fill-current"})})}),s]}));zi.displayName=Ae.RadioItem.displayName;const _i=d.forwardRef(({className:t,inset:s,...a},n)=>e.jsx(Ae.Label,{ref:n,className:b.cn("px-2 py-1.5 text-sm font-semibold",s&&"pl-8",t),...a}));_i.displayName=Ae.Label.displayName;const Vi=d.forwardRef(({className:t,...s},a)=>e.jsx(Ae.Separator,{ref:a,className:b.cn("-mx-1 my-1 h-px bg-muted",t),...s}));Vi.displayName=Ae.Separator.displayName;const Bi=({className:t,...s})=>e.jsx("span",{className:b.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...s});Bi.displayName="MenubarShortcut";const Wi=d.forwardRef(({className:t,children:s,...a},n)=>e.jsxs(ut.Root,{ref:n,className:b.cn("relative z-10 flex max-w-max flex-1 items-center justify-center",t),...a,children:[s,e.jsx(Wn,{})]}));Wi.displayName=ut.Root.displayName;const qi=d.forwardRef(({className:t,...s},a)=>e.jsx(ut.List,{ref:a,className:b.cn("group flex flex-1 list-none items-center justify-center space-x-1",t),...s}));qi.displayName=ut.List.displayName;const Ix=ut.Item,Ui=lt.cva("group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50"),Hi=d.forwardRef(({className:t,children:s,...a},n)=>e.jsxs(ut.Trigger,{ref:n,className:b.cn(Ui(),"group",t),...a,children:[s," ",e.jsx(h.ChevronDown,{className:"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180","aria-hidden":"true"})]}));Hi.displayName=ut.Trigger.displayName;const Gi=d.forwardRef(({className:t,...s},a)=>e.jsx(ut.Content,{ref:a,className:b.cn("left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",t),...s}));Gi.displayName=ut.Content.displayName;const Lx=ut.Link,Wn=d.forwardRef(({className:t,...s},a)=>e.jsx("div",{className:b.cn("absolute left-0 top-full flex justify-center"),children:e.jsx(ut.Viewport,{className:b.cn("origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",t),ref:a,...s})}));Wn.displayName=ut.Viewport.displayName;const Xi=d.forwardRef(({className:t,...s},a)=>e.jsx(ut.Indicator,{ref:a,className:b.cn("top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",t),...s,children:e.jsx("div",{className:"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md"})}));Xi.displayName=ut.Indicator.displayName;const Es=d.forwardRef(({className:t,value:s,...a},n)=>e.jsx(Da.Root,{ref:n,className:b.cn("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...a,children:e.jsx(Da.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(s||0)}%)`}})}));Es.displayName=Da.Root.displayName;const Yi=d.forwardRef(({className:t,...s},a)=>e.jsx($s.Root,{className:b.cn("grid gap-2",t),...s,ref:a}));Yi.displayName=$s.Root.displayName;const Qi=d.forwardRef(({className:t,...s},a)=>e.jsx($s.Item,{ref:a,className:b.cn("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx($s.Indicator,{className:"flex items-center justify-center",children:e.jsx(h.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Qi.displayName=$s.Item.displayName;const St=d.forwardRef(({className:t,children:s,...a},n)=>e.jsxs(os.Root,{ref:n,className:b.cn("relative overflow-hidden",t),...a,children:[e.jsx(os.Viewport,{className:"h-full w-full rounded-[inherit]",children:s}),e.jsx(qn,{}),e.jsx(os.Corner,{})]}));St.displayName=os.Root.displayName;const qn=d.forwardRef(({className:t,orientation:s="vertical",...a},n)=>e.jsx(os.ScrollAreaScrollbar,{ref:n,orientation:s,className:b.cn("flex touch-none select-none transition-colors",s==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",s==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...a,children:e.jsx(os.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));qn.displayName=os.ScrollAreaScrollbar.displayName;const Pa=d.forwardRef(({className:t,...s},a)=>e.jsxs(Rs.Root,{ref:a,className:b.cn("relative flex w-full touch-none select-none items-center",t),...s,children:[e.jsx(Rs.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:e.jsx(Rs.Range,{className:"absolute h-full bg-primary"})}),e.jsx(Rs.Thumb,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));Pa.displayName=Rs.Root.displayName;const _s=d.forwardRef(({className:t,...s},a)=>e.jsx(Ta.Root,{className:b.cn("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...s,ref:a,children:e.jsx(Ta.Thumb,{className:b.cn("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));_s.displayName=Ta.Root.displayName;const $a=d.forwardRef(({className:t,...s},a)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:a,className:b.cn("w-full caption-bottom text-sm",t),...s})}));$a.displayName="Table";const Oa=d.forwardRef(({className:t,...s},a)=>e.jsx("thead",{ref:a,className:b.cn("[&_tr]:border-b",t),...s}));Oa.displayName="TableHeader";const za=d.forwardRef(({className:t,...s},a)=>e.jsx("tbody",{ref:a,className:b.cn("[&_tr:last-child]:border-0",t),...s}));za.displayName="TableBody";const Ki=d.forwardRef(({className:t,...s},a)=>e.jsx("tfoot",{ref:a,className:b.cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...s}));Ki.displayName="TableFooter";const rs=d.forwardRef(({className:t,...s},a)=>e.jsx("tr",{ref:a,className:b.cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...s}));rs.displayName="TableRow";const ft=d.forwardRef(({className:t,...s},a)=>e.jsx("th",{ref:a,className:b.cn("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...s}));ft.displayName="TableHead";const ot=d.forwardRef(({className:t,...s},a)=>e.jsx("td",{ref:a,className:b.cn("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...s}));ot.displayName="TableCell";const Ji=d.forwardRef(({className:t,...s},a)=>e.jsx("caption",{ref:a,className:b.cn("mt-4 text-sm text-muted-foreground",t),...s}));Ji.displayName="TableCaption";const Vs=ms.Root,As=d.forwardRef(({className:t,...s},a)=>e.jsx(ms.List,{ref:a,className:b.cn("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...s}));As.displayName=ms.List.displayName;const Mt=d.forwardRef(({className:t,...s},a)=>e.jsx(ms.Trigger,{ref:a,className:b.cn("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...s}));Mt.displayName=ms.Trigger.displayName;const At=d.forwardRef(({className:t,...s},a)=>e.jsx(ms.Content,{ref:a,className:b.cn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...s}));At.displayName=ms.Content.displayName;const Zi=d.forwardRef(({className:t,variant:s="default",ariaLabel:a="Select theme"},n)=>{const{currentTheme:r,changeTheme:o,themes:i,isLoading:c}=Bs(),[l,u]=d.useState(!1),[f,m]=d.useState(!1),p=d.useRef(null),g=d.useRef(null);d.useEffect(()=>{m(!0)},[]);const C=async(v,x)=>{x&&(x.preventDefault(),x.stopPropagation()),await o(v),s==="compact"&&setTimeout(()=>u(!1),100)},[y,N]=d.useState({top:0,right:0});if(d.useEffect(()=>{if(l&&p.current&&f){const v=p.current.getBoundingClientRect();N({top:v.bottom+8,right:window.innerWidth-v.right})}},[l,f]),s==="compact"){const v=l&&f?e.jsxs("div",{ref:g,className:"fixed z-[9999] min-w-[220px] rounded-md border border-border bg-popover text-popover-foreground p-2 shadow-lg",style:{top:`${y.top}px`,right:`${y.right}px`},onMouseDown:x=>{x.stopPropagation()},children:[e.jsx("div",{className:"px-2 py-1.5 border-b border-border mb-2",children:e.jsxs("div",{className:"text-xs font-medium text-muted-foreground flex items-center justify-between",children:[e.jsx("span",{children:"Thèmes"}),c&&e.jsx(h.Loader2,{className:"h-3 w-3 animate-spin"})]})}),c&&i.length===0?e.jsxs("div",{className:"flex items-center justify-center py-6 text-sm text-muted-foreground",children:[e.jsx(h.Loader2,{className:"h-4 w-4 mr-2 animate-spin"}),"Chargement..."]}):e.jsxs("div",{className:"grid gap-1",children:[i.map(x=>e.jsxs("button",{onMouseDown:w=>{w.preventDefault(),w.stopPropagation(),C(x.id,w)},type:"button",className:b.cn("flex items-center gap-3 rounded-sm px-2 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer",r===x.id&&"bg-accent"),children:[x.previewColor&&e.jsx("div",{className:"h-4 w-4 rounded border border-border shrink-0",style:{backgroundColor:x.previewColor}}),e.jsx("span",{className:"flex-1 text-left",children:x.label}),r===x.id&&e.jsx(h.Check,{className:"h-4 w-4 shrink-0"})]},x.id)),i.length===0&&!c&&e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Aucun thème disponible"})]}),e.jsx("div",{className:"px-2 py-1.5 border-t border-border mt-2",children:e.jsxs("div",{className:"text-xs text-muted-foreground",children:[i.length," thème",i.length>1?"s":""," disponible",i.length>1?"s":""]})})]}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:n,className:b.cn("relative",t),children:e.jsxs("button",{ref:p,onMouseDown:x=>{x.preventDefault(),x.stopPropagation()},onClick:x=>{x.preventDefault(),x.stopPropagation(),u(!l)},className:"flex h-9 w-9 items-center justify-center rounded-md border border-input bg-transparent hover:bg-accent hover:text-accent-foreground relative",title:"Changer de thème",type:"button",children:[e.jsx(h.Palette,{className:"h-4 w-4"}),c&&e.jsx(h.Loader2,{className:"h-3 w-3 absolute top-1 right-1 animate-spin text-primary"}),e.jsx("span",{className:"sr-only",children:a})]})}),f&&typeof document<"u"&&v&&ln.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[9998]",onMouseDown:x=>{x.preventDefault(),u(!1)}}),v]}),document.body)]})}if(s==="select"){const v=i.find(x=>x.id===r);return e.jsx("div",{ref:n,className:b.cn("w-full",t),children:e.jsxs(Be,{value:r,onValueChange:x=>o(x),disabled:c||i.length===0,children:[e.jsx(ze,{className:"w-full","aria-label":a,children:e.jsx(We,{children:c&&i.length===0?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(h.Loader2,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{children:"Chargement..."})]}):v?e.jsxs("span",{className:"flex items-center gap-3",children:[v.previewColor&&e.jsx("div",{className:"h-4 w-4 rounded border border-border shrink-0",style:{backgroundColor:v.previewColor}}),e.jsx("span",{className:"truncate",children:v.label})]}):e.jsx("span",{className:"text-muted-foreground",children:"Sélectionner un thème"})})}),e.jsxs(_e,{children:[i.map(x=>e.jsx(ke,{value:x.id,className:"cursor-pointer",children:e.jsxs("div",{className:"flex items-center gap-3 w-full",children:[x.previewColor&&e.jsx("div",{className:"h-4 w-4 rounded border border-border shrink-0",style:{backgroundColor:x.previewColor}}),e.jsx("span",{className:"flex-1 text-left truncate",children:x.label})]})},x.id)),i.length===0&&!c&&e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Aucun thème disponible"})]})]})})}return e.jsx("div",{ref:n,className:b.cn("grid gap-4",t),children:c&&i.length===0?e.jsxs("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:[e.jsx(h.Loader2,{className:"h-5 w-5 mr-2 animate-spin"}),"Chargement des thèmes..."]}):e.jsxs(e.Fragment,{children:[i.map(v=>e.jsxs("button",{onClick:x=>C(v.id,x),type:"button",className:b.cn("relative flex flex-col items-start gap-2 rounded-lg border-2 p-4 text-left transition-all hover:border-primary",r===v.id?"border-primary bg-primary/5":"border-muted"),children:[e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"font-semibold",children:v.label}),v.description&&e.jsx("span",{className:"text-sm text-muted-foreground",children:v.description})]}),r===v.id&&e.jsx(h.Check,{className:"h-5 w-5 text-primary shrink-0"})]}),v.previewColor&&e.jsx("div",{className:"flex gap-2 w-full",children:e.jsx("div",{className:"h-8 w-full rounded border",style:{backgroundColor:v.previewColor}})})]},v.id)),i.length===0&&!c&&e.jsx("div",{className:"py-12 text-center text-sm text-muted-foreground",children:"Aucun thème disponible"})]})})});Zi.displayName="ThemeSelector";const el=bt.Provider,Un=d.forwardRef(({className:t,...s},a)=>e.jsx(bt.Viewport,{ref:a,className:b.cn("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...s}));Un.displayName=bt.Viewport.displayName;const $x=lt.cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Hn=d.forwardRef(({className:t,variant:s,...a},n)=>e.jsx(bt.Root,{ref:n,className:b.cn($x({variant:s}),t),...a}));Hn.displayName=bt.Root.displayName;const tl=d.forwardRef(({className:t,...s},a)=>e.jsx(bt.Action,{ref:a,className:b.cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...s}));tl.displayName=bt.Action.displayName;const Gn=d.forwardRef(({className:t,...s},a)=>e.jsx(bt.Close,{ref:a,className:b.cn("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...s,children:e.jsx(h.X,{className:"h-4 w-4"})}));Gn.displayName=bt.Close.displayName;const Xn=d.forwardRef(({className:t,...s},a)=>e.jsx(bt.Title,{ref:a,className:b.cn("text-sm font-semibold",t),...s}));Xn.displayName=bt.Title.displayName;const Yn=d.forwardRef(({className:t,...s},a)=>e.jsx(bt.Description,{ref:a,className:b.cn("text-sm opacity-90",t),...s}));Yn.displayName=bt.Description.displayName;const Ox=1,zx=1e6;let Qa=0;function _x(){return Qa=(Qa+1)%Number.MAX_SAFE_INTEGER,Qa.toString()}const Ka=new Map,no=t=>{if(Ka.has(t))return;const s=setTimeout(()=>{Ka.delete(t),ea({type:"REMOVE_TOAST",toastId:t})},zx);Ka.set(t,s)},sl=(t,s)=>{switch(s.type){case"ADD_TOAST":return{...t,toasts:[s.toast,...t.toasts].slice(0,Ox)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(a=>a.id===s.toast.id?{...a,...s.toast}:a)};case"DISMISS_TOAST":{const{toastId:a}=s;return a?no(a):t.toasts.forEach(n=>{no(n.id)}),{...t,toasts:t.toasts.map(n=>n.id===a||a===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return s.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(a=>a.id!==s.toastId)}}},wa=[];let Na={toasts:[]};function ea(t){Na=sl(Na,t),wa.forEach(s=>{s(Na)})}function al({...t}){const s=_x(),a=r=>ea({type:"UPDATE_TOAST",toast:{...r,id:s}}),n=()=>ea({type:"DISMISS_TOAST",toastId:s});return ea({type:"ADD_TOAST",toast:{...t,id:s,open:!0,onOpenChange:r=>{r||n()}}}),{id:s,dismiss:n,update:a}}function _a(){const[t,s]=d.useState(Na);return d.useEffect(()=>(wa.push(s),()=>{const a=wa.indexOf(s);a>-1&&wa.splice(a,1)}),[t]),{...t,toast:al,dismiss:a=>ea({type:"DISMISS_TOAST",toastId:a})}}function Vx(){const{toasts:t}=_a();return e.jsxs(el,{children:[t.map(function({id:s,title:a,description:n,action:r,...o}){return e.jsxs(Hn,{...o,children:[e.jsxs("div",{className:"grid gap-1",children:[a&&e.jsx(Xn,{children:a}),n&&e.jsx(Yn,{children:n})]}),r,e.jsx(Gn,{})]},s)}),e.jsx(Un,{})]})}const nl=lt.cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),rl=d.forwardRef(({className:t,variant:s,size:a,...n},r)=>e.jsx(jn.Root,{ref:r,className:b.cn(nl({variant:s,size:a,className:t})),...n}));rl.displayName=jn.Root.displayName;const na=zs.Provider,ra=zs.Root,oa=zs.Trigger,Os=d.forwardRef(({className:t,sideOffset:s=4,...a},n)=>e.jsx(zs.Content,{ref:n,sideOffset:s,className:b.cn("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a}));Os.displayName=zs.Content.displayName;const ol=lt.cva("",{variants:{variant:{default:"text-foreground",muted:"text-muted-foreground",destructive:"text-destructive",success:"text-green-600 dark:text-green-400",warning:"text-amber-600 dark:text-amber-400",link:"text-primary underline-offset-4 hover:underline"},size:{xs:"text-xs",sm:"text-sm",base:"text-base",lg:"text-lg",xl:"text-xl"},weight:{normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},align:{left:"text-left",center:"text-center",right:"text-right",justify:"text-justify"}},defaultVariants:{variant:"default",size:"base",weight:"normal",align:"left"}}),il=d.forwardRef(({className:t,variant:s,size:a,weight:n,align:r,asChild:o=!1,truncate:i=!1,...c},l)=>{const u=o?Aa.Slot:"p";return e.jsx(u,{className:b.cn(ol({variant:s,size:a,weight:n,align:r}),i&&"truncate",t),ref:l,...c})});il.displayName="Text";const ll=lt.cva("font-bold tracking-tight",{variants:{level:{h1:"text-4xl lg:text-5xl",h2:"text-3xl lg:text-4xl",h3:"text-2xl lg:text-3xl",h4:"text-xl lg:text-2xl",h5:"text-lg lg:text-xl",h6:"text-base lg:text-lg"},variant:{default:"text-foreground",gradient:"bg-gradient-to-r from-primary to-primary/60 bg-clip-text text-transparent",muted:"text-muted-foreground"}},defaultVariants:{level:"h2",variant:"default"}}),cl=d.forwardRef(({className:t,level:s="h2",variant:a,asChild:n=!1,...r},o)=>{const i=n?Aa.Slot:s;return e.jsx(i,{className:b.cn(ll({level:s,variant:a}),t),ref:o,...r})});cl.displayName="Heading";const dl=lt.cva("mt-6 border-l-4 pl-6 italic",{variants:{variant:{default:"border-border text-muted-foreground",primary:"border-primary text-foreground",success:"border-green-500 text-green-900 dark:text-green-100",warning:"border-amber-500 text-amber-900 dark:text-amber-100",destructive:"border-destructive text-destructive"}},defaultVariants:{variant:"default"}}),ul=d.forwardRef(({className:t,variant:s,author:a,cite:n,children:r,...o},i)=>e.jsxs("figure",{className:"my-6",children:[e.jsx("blockquote",{className:b.cn(dl({variant:s}),t),cite:n,ref:i,...o,children:r}),a&&e.jsxs("figcaption",{className:"mt-2 text-sm text-muted-foreground",children:["— ",a]})]}));ul.displayName="Blockquote";lt.cva("relative rounded font-mono",{variants:{variant:{inline:"bg-muted px-[0.3rem] py-[0.2rem] text-xs sm:text-sm",block:"block bg-muted overflow-x-auto"},size:{sm:"text-xs sm:text-sm",base:"text-sm sm:text-base",lg:"text-base sm:text-lg"}},defaultVariants:{variant:"inline",size:"base"}});const ml=lt.cva("inline-flex items-center justify-center rounded border border-border bg-muted px-2 py-1 font-mono text-xs font-medium text-muted-foreground shadow-sm",{variants:{size:{sm:"h-5 min-w-[1.25rem] text-[0.625rem]",default:"h-6 min-w-[1.5rem] text-xs",lg:"h-7 min-w-[1.75rem] text-sm"}},defaultVariants:{size:"default"}}),hl=d.forwardRef(({className:t,size:s,...a},n)=>e.jsx("kbd",{className:b.cn(ml({size:s}),t),ref:n,...a}));hl.displayName="Kbd";const Bx=lt.cva("flex items-center",{variants:{variant:{default:"gap-2 p-3 rounded-lg border bg-card shadow-sm",minimal:"gap-2",pills:"gap-2 p-2 rounded-full border bg-muted/30",inline:"gap-1.5 text-sm",compact:"gap-1.5 p-2 rounded-md bg-muted/50"}},defaultVariants:{variant:"default"}}),Wx=lt.cva("justify-between gap-2 transition-all",{variants:{variant:{default:"h-9 border-primary/50",minimal:"h-8 border-0 shadow-none hover:bg-accent",pills:"h-8 rounded-full px-4",inline:"h-7 text-sm border-0 shadow-none p-0 hover:bg-transparent hover:underline",compact:"h-7 text-xs px-2"}},defaultVariants:{variant:"default"}}),qx={partner:h.Building2,network:h.Network,customer:h.Users},Ux={partner:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",network:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",customer:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"},Ja={partner:"Partenaire",network:"Réseau",customer:"Client"},fl=d.forwardRef(({type:t,items:s,selected:a,isLoading:n,onSelect:r,placeholder:o,emptyText:i,showIcon:c,showBadge:l,variant:u},f)=>{const[m,p]=d.useState(!1),[g,C]=d.useState(""),y=qx[t],N=d.useMemo(()=>g?s.filter(w=>w.name.toLowerCase().includes(g.toLowerCase())):s,[s,g]),v=w=>{r(w),p(!1),C("")},x=w=>{w.stopPropagation(),r({id:"",name:"",type:t}),C("")};return e.jsxs(j.Popover,{open:m,onOpenChange:p,children:[e.jsx(j.PopoverTrigger,{asChild:!0,children:e.jsxs(j.Button,{ref:f,variant:u==="inline"?"ghost":"outline",role:"combobox","aria-expanded":m,className:b.cn(Wx({variant:u}),a?.id?"border-primary/50":""),disabled:n||s.length===0,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c&&y&&e.jsx(y,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:a?.name||o||Ja[t]}),l&&a?.id&&e.jsx(ye,{variant:"secondary",className:b.cn("text-xs",Ux[t]),children:t})]}),a?.id?e.jsx(h.X,{className:"h-3 w-3 shrink-0 opacity-50 hover:opacity-100",onClick:x}):e.jsx(h.ChevronRight,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(j.PopoverContent,{className:"w-[300px] p-0",align:"start",children:e.jsxs(us,{shouldFilter:!1,children:[e.jsxs("div",{className:"flex items-center border-b px-3 py-2 bg-muted/50",children:[e.jsx(h.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Ss,{placeholder:`Rechercher ${Ja[t].toLowerCase()}...`,value:g,onValueChange:C,className:"border-0 focus:ring-0"})]}),e.jsxs(ua,{children:[e.jsx(Ds,{children:i||`Aucun ${Ja[t].toLowerCase()} trouvé`}),e.jsx(Jt,{children:N.map(w=>e.jsx(Zt,{value:w.id,onSelect:()=>v(w),className:"cursor-pointer",children:e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[c&&y&&e.jsx(y,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate",children:w.name}),w.metadata?.count!==void 0&&e.jsx(ye,{variant:"secondary",className:"text-xs",children:w.metadata.count})]})},w.id))})]})]})})]})});fl.displayName="AdmincrumbSelector";const pl=d.forwardRef(({levels:t,separator:s,className:a,onLevelChange:n,showIcons:r=!0,showBadges:o=!1,showHome:i=!1,maxWidth:c="100%",variant:l="default",resetable:u=!1,onReset:f},m)=>{const p=y=>N=>{n?.(y,N)},g=t.some(y=>y.selected?.id),C=u&&g&&f;return e.jsxs("nav",{ref:m,"aria-label":"Fil d'Ariane administrateur",className:b.cn("flex items-center gap-2",a),style:{maxWidth:c},children:[e.jsxs("div",{className:b.cn(Bx({variant:l}),"overflow-x-auto"),children:[i&&e.jsxs(e.Fragment,{children:[e.jsx(j.Button,{variant:l==="inline"?"ghost":"outline",size:l==="compact"?"sm":"default",className:b.cn(l==="inline"&&"h-7 px-2",l==="compact"&&"h-7 px-2"),onClick:()=>f?.(),children:e.jsx(h.Home,{className:"h-4 w-4"})}),e.jsx(h.ChevronRight,{className:"h-4 w-4 text-muted-foreground shrink-0","aria-hidden":"true"})]}),e.jsx("ol",{className:"flex items-center gap-2 list-none p-0 m-0",children:t.map((y,N)=>e.jsxs("li",{className:"flex items-center gap-2",children:[N>0&&e.jsx(e.Fragment,{children:s||e.jsx(h.ChevronRight,{className:b.cn("text-muted-foreground shrink-0",l==="compact"||l==="inline"?"h-3 w-3":"h-4 w-4"),"aria-hidden":"true"})}),e.jsx(fl,{...y,onSelect:p(N),showIcon:r,showBadge:o,variant:l||"default"})]},`${y.type}-${N}`))}),C&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-6 bg-border mx-1","aria-hidden":"true"}),e.jsxs(j.Button,{variant:"ghost",size:l==="compact"?"sm":"default",onClick:f,className:b.cn("gap-2",l==="compact"&&"h-7 px-2 text-xs"),children:[e.jsx(h.X,{className:"h-3 w-3"}),"Réinitialiser"]})]})]}),g&&!C&&e.jsxs(ye,{variant:"secondary",className:"gap-1",children:[e.jsx(h.Filter,{className:"h-3 w-3"}),"Filtré"]})]})});pl.displayName="WakaAdmincrumb";function Hx(){const[t,s]=d.useState(),[a,n]=d.useState(),[r,o]=d.useState(),i=d.useCallback((l,u)=>{l===0?(s(u.id?u:void 0),n(void 0),o(void 0)):l===1?(n(u.id?u:void 0),o(void 0)):l===2&&o(u.id?u:void 0)},[]),c=d.useCallback(()=>{s(void 0),n(void 0),o(void 0)},[]);return{partner:t,network:a,customer:r,handleLevelChange:i,reset:c}}const Gx=({images:t,autoplay:s=!1,autoplayInterval:a=3e3,showIndicators:n=!0,showNavigation:r=!0,showThumbnails:o=!1,showFullscreen:i=!1,showDownload:c=!1,showShare:l=!1,showCounter:u=!1,showProgress:f=!1,transition:m="fade",layout:p="default",theme:g="auto",aspectRatio:C="16/9",maxHeight:y,className:N,imageClassName:v,indicatorClassName:x,navigationClassName:w,thumbnailClassName:k,overlayClassName:D,counterClassName:S,progressClassName:F,onImageChange:A,onImageClick:T,onFullscreenToggle:M,onDownload:I,onShare:E,onPlayPause:P,onThumbnailClick:G,onIndicatorClick:H,onNavigationClick:X,onKeyboardNavigation:z,onTouchStart:L,onTouchEnd:_,onSwipeLeft:R,onSwipeRight:U,onSwipeUp:$,onSwipeDown:Z,onLoadStart:Q,onLoadEnd:K,onError:q,onReady:W,onDestroy:J,loop:B=!0,pauseOnHover:te=!0,pauseOnFocus:se=!0,pauseOnTouch:ee=!0,keyboardNavigation:le=!0,touchNavigation:Me=!0,swipeThreshold:re=50,animationDuration:pe=300,preloadImages:je=!0,lazyLoading:he=!0,imageQuality:Qe="auto",placeholder:yt,errorImage:tt,loadingSpinner:wt,emptyState:Nt,customControls:mt,customOverlay:Rt,customThumbnails:ce,customIndicators:Y,customNavigation:oe,ariaLabel:ve="Carrousel d'images",ariaLabelledBy:Xe,ariaDescribedBy:ae,role:me="region",virtualScrolling:$e=!1,maxVisibleThumbnails:at=10,thumbnailSize:Pt="medium",overlayOpacity:Oc=.7,overlayGradient:zc,navigationSize:Ot="medium",indicatorSize:ps="medium",indicatorShape:ts="circle",thumbnailAspectRatio:ha="1/1",onMount:Ba,onUnmount:Wa,onBeforeChange:It,onAfterChange:qa})=>{const[Ct,qs]=O.useState(0),[kt,zt]=O.useState(s),[xs,fa]=O.useState(!1),[Ua,Ha]=O.useState(!1),[pa,Sr]=O.useState(!1),[Us,Hs]=O.useState(null),[_c,_t]=O.useState(null),[jt,xa]=O.useState(new Set),[ga,ba]=O.useState(0),fe=O.useRef(null),de=O.useRef(null),nt=O.useRef([]),Ue=O.useRef(null),Ke=O.useRef(0),rt=t&&t.length>0,He=Math.max(0,Math.min(Ct,t.length-1)),Se=rt?t[He]:null,gs=O.useMemo(()=>{switch(C){case"16/9":return"aspect-video";case"4/3":return"aspect-[4/3]";case"1/1":return"aspect-square";case"3/2":return"aspect-[3/2]";default:return"aspect-video"}},[C]),Lt=O.useMemo(()=>g==="auto"?"":g==="dark"?"dark":"light",[g]),ss=O.useCallback(()=>{fe.current&&clearInterval(fe.current),kt&&rt&&t.length>1&&(fe.current=setInterval(()=>{qs(ie=>B?(ie+1)%t.length:Math.min(ie+1,t.length-1))},a))},[kt,rt,t.length,a,B]),bs=O.useCallback(()=>{fe.current&&(clearInterval(fe.current),fe.current=null)},[]),Dr=O.useCallback(()=>{if(!kt||!s)return;const ie=Date.now(),Ee=()=>{const Fs=(Date.now()-ie)/a*100;ba(Math.min(Fs,100)),Fs<100&&requestAnimationFrame(Ee)};requestAnimationFrame(Ee)},[kt,s,a]);O.useEffect(()=>(kt?(ss(),Dr()):(bs(),ba(0)),()=>bs()),[kt,ss,bs,Dr]);const Gs=O.useCallback(()=>{if(!rt)return;const ie=B?(Ct-1+t.length)%t.length:Math.max(Ct-1,0);It&&!It(Ct,ie)||(qs(ie),X?.("prev"))},[rt,Ct,t.length,B,It,X]),Xs=O.useCallback(()=>{if(!rt)return;const ie=B?(Ct+1)%t.length:Math.min(Ct+1,t.length-1);It&&!It(Ct,ie)||(qs(ie),X?.("next"))},[rt,Ct,t.length,B,It,X]),Tr=O.useCallback(ie=>{!rt||ie<0||ie>=t.length||It&&!It(Ct,ie)||(qs(ie),H?.(ie))},[rt,Ct,t.length,It,H]),Vc=O.useCallback(ie=>{if(!le)return;const Ee=ie.key;switch(z?.(Ee),Ee){case"ArrowLeft":ie.preventDefault(),Gs();break;case"ArrowRight":ie.preventDefault(),Xs();break;case"ArrowUp":ie.preventDefault(),$?.();break;case"ArrowDown":ie.preventDefault(),Z?.();break;case" ":ie.preventDefault(),zt(vt=>!vt),P?.(!kt);break;case"Escape":xs&&(fa(!1),M?.(!1));break;case"f":case"F":i&&fa(vt=>(M?.(!vt),!vt));break}},[le,Gs,Xs,z,$,Z,kt,P,xs,i,M]),Bc=O.useCallback(ie=>{if(!Me)return;const Ee=ie.touches[0];Hs({x:Ee.clientX,y:Ee.clientY}),Ke.current=Date.now(),L?.(ie),ee&&zt(!1)},[Me,L,ee]),Wc=O.useCallback(ie=>{if(!Me||!Us)return;const Ee=ie.changedTouches[0];_t({x:Ee.clientX,y:Ee.clientY}),_?.(ie);const vt=Ee.clientX-Us.x,Fs=Ee.clientY-Us.y;Date.now()-Ke.current,Math.abs(vt)>Math.abs(Fs)&&Math.abs(vt)>re?vt>0?(U?.(),Gs()):(R?.(),Xs()):Math.abs(Fs)>re&&(Fs>0?Z?.():$?.()),Hs(null),_t(null)},[Me,Us,_,re,U,R,Z,$,Gs,Xs]),qc=O.useCallback(ie=>{xa(Ee=>new Set([...Ee,ie])),Ha(!1),K?.(ie)},[K]),Uc=O.useCallback((ie,Ee)=>{Sr(!0),Ha(!1),q?.(ie,Ee)},[q]);O.useEffect(()=>{Se&&(A?.(He,Se),qa?.(He))},[He,Se,A,qa]);const Hc=O.useCallback(()=>{Se&&T?.(Se,He)},[Se,He,T]),as=O.useCallback(ie=>{ie.stopPropagation()},[]),Gc=O.useCallback(()=>{fa(ie=>(M?.(!ie),!ie))},[M]),Xc=O.useCallback(()=>{Se&&I?.(Se,He)},[Se,He,I]),Yc=O.useCallback(()=>{Se&&E?.(Se,He)},[Se,He,E]),Qc=O.useCallback(()=>{te&&zt(!1)},[te]),Kc=O.useCallback(()=>{te&&s&&zt(!0)},[te,s]),Jc=O.useCallback(()=>{se&&zt(!1)},[se]),Zc=O.useCallback(()=>{se&&s&&zt(!0)},[se,s]);if(O.useEffect(()=>(Ba?.(),W?.(),()=>{Wa?.(),J?.(),bs()}),[Ba,W,Wa,J,bs]),O.useEffect(()=>()=>bs(),[bs]),!rt)return e.jsx("div",{className:b.cn("flex items-center justify-center h-64 bg-gray-100 rounded-lg",N),children:Nt||e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-gray-500 mb-2",children:"Aucune image à afficher"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Ajoutez des images pour commencer"})]})});const ed=b.cn("waka-carousel relative w-full mx-auto bg-black rounded-lg overflow-hidden","focus:outline-none focus:ring-2 focus:ring-blue-500",xs&&"fixed inset-0 z-50 rounded-none",Lt,N),td=b.cn("relative",gs,v),sd=b.cn("absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-4",D);return e.jsxs("div",{ref:de,className:ed,style:{maxHeight:y},tabIndex:0,onKeyDown:Vc,onTouchStart:Bc,onTouchEnd:Wc,onMouseEnter:Qc,onMouseLeave:Kc,onFocus:Jc,onBlur:Zc,role:me,"aria-label":ve,"aria-labelledby":Xe,"aria-describedby":ae,"aria-busy":Ua,"aria-roledescription":"carrousel",children:[e.jsxs("div",{className:td,"aria-live":"polite",children:[Ua&&wt&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 z-20",role:"status","aria-label":"Chargement de l'image",children:wt}),pa&&tt?e.jsx("img",{src:tt,alt:"Erreur de chargement",className:b.cn("w-full h-full object-cover",v)}):Se?e.jsx("img",{ref:ie=>nt.current[He]=ie,src:Se.src,alt:Se.alt,className:b.cn("w-full h-full object-cover transition-opacity duration-300",v),onClick:Hc,loading:he?"lazy":"eager",onLoad:()=>qc(He),onError:ie=>Uc(He,new Error("Erreur de chargement de l'image"))}):null,Se&&(Se.title||Se.description||Se.caption)&&e.jsxs("div",{className:sd,children:[Se.title&&e.jsx("h3",{className:"text-white text-lg font-semibold mb-1",children:Se.title}),Se.description&&e.jsx("p",{className:"text-white/90 text-sm mb-2",children:Se.description}),Se.caption&&e.jsx("p",{className:"text-white/80 text-xs",children:Se.caption})]}),mt&&e.jsx("div",{className:"absolute inset-0 z-10",children:mt}),Rt&&e.jsx("div",{className:"absolute inset-0 z-10",children:Rt}),r&&t.length>1&&e.jsx(e.Fragment,{children:oe?e.jsx("div",{className:"absolute inset-0 z-10",children:oe}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:ie=>{as(ie),Gs()},className:b.cn("absolute left-2 top-1/2 -translate-y-1/2 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white",Ot==="small"&&"p-1",Ot==="large"&&"p-3",w),"aria-label":"Image précédente",children:e.jsx(h.ChevronLeft,{className:b.cn("w-5 h-5",Ot==="small"&&"w-4 h-4",Ot==="large"&&"w-6 h-6")})}),e.jsx("button",{onClick:ie=>{as(ie),Xs()},className:b.cn("absolute right-2 top-1/2 -translate-y-1/2 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white",Ot==="small"&&"p-1",Ot==="large"&&"p-3",w),"aria-label":"Image suivante",children:e.jsx(h.ChevronRight,{className:b.cn("w-5 h-5",Ot==="small"&&"w-4 h-4",Ot==="large"&&"w-6 h-6")})})]})}),s&&t.length>1&&e.jsx("button",{onClick:ie=>{as(ie),zt(Ee=>(P?.(!Ee),!Ee))},className:b.cn("absolute top-2 right-2 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white"),"aria-label":kt?"Pause":"Lecture",children:kt?e.jsx(h.Pause,{className:"w-4 h-4"}):e.jsx(h.Play,{className:"w-4 h-4"})}),i&&e.jsx("button",{onClick:ie=>{as(ie),Gc()},className:b.cn("absolute top-2 left-2 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white"),"aria-label":xs?"Quitter le plein écran":"Plein écran",children:xs?e.jsx(h.X,{className:"w-4 h-4"}):e.jsx(h.Maximize2,{className:"w-4 h-4"})}),c&&Se?.downloadUrl&&e.jsx("button",{onClick:ie=>{as(ie),Xc()},className:b.cn("absolute top-2 right-12 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white"),"aria-label":"Télécharger l'image",children:e.jsx(h.Download,{className:"w-4 h-4"})}),l&&Se?.shareUrl&&e.jsx("button",{onClick:ie=>{as(ie),Yc()},className:b.cn("absolute top-2 right-20 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white"),"aria-label":"Partager l'image",children:e.jsx(h.Share2,{className:"w-4 h-4"})}),u&&e.jsxs("div",{className:b.cn("absolute top-2 left-1/2 -translate-x-1/2 z-10","bg-black/50 text-white px-3 py-1 rounded-full text-sm",S),children:[He+1," / ",t.length]}),f&&kt&&e.jsx("div",{className:b.cn("absolute bottom-0 left-0 right-0 h-1 bg-black/30",F),children:e.jsx("div",{ref:Ue,className:"h-full bg-white transition-all duration-100",style:{width:`${ga}%`}})})]}),n&&t.length>1&&e.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex space-x-2",children:Y?e.jsx("div",{className:"flex space-x-2",children:Y}):t.map((ie,Ee)=>e.jsx("button",{onClick:vt=>{as(vt),Tr(Ee)},className:b.cn("transition-all duration-200","focus:outline-none focus:ring-2 focus:ring-white",ts==="circle"&&"rounded-full",ts==="square"&&"rounded",ts==="diamond"&&"rotate-45",ts==="line"&&"rounded-none",ps==="small"&&"w-2 h-2",ps==="medium"&&"w-3 h-3",ps==="large"&&"w-4 h-4",ts==="line"&&ps==="small"&&"w-8 h-1",ts==="line"&&ps==="medium"&&"w-12 h-1",ts==="line"&&ps==="large"&&"w-16 h-1",Ee===He?"bg-white":"bg-white/50 hover:bg-white/70",x),"aria-label":`Aller à l'image ${Ee+1}`},Ee))}),o&&t.length>1&&e.jsx("div",{className:"flex space-x-2 p-4 bg-gray-100 overflow-x-auto",children:ce?e.jsx("div",{className:"flex space-x-2",children:ce}):t.map((ie,Ee)=>e.jsx("button",{onClick:vt=>{as(vt),Tr(Ee),G?.(Ee)},className:b.cn("flex-shrink-0 rounded overflow-hidden","border-2 transition-all duration-200","focus:outline-none focus:ring-2 focus:ring-blue-500",Pt==="small"&&"w-12 h-12",Pt==="medium"&&"w-16 h-16",Pt==="large"&&"w-20 h-20",ha==="1/1"&&"aspect-square",ha==="4/3"&&"aspect-[4/3]",ha==="16/9"&&"aspect-video",Ee===He?"border-blue-500":"border-gray-300 hover:border-gray-400",k),children:e.jsx("img",{src:ie.src,alt:ie.alt,className:"w-full h-full object-cover",loading:"lazy"})},Ee))})]})};let ro=!1,hn=null;!ro&&!$t.isInitialized&&(ro=!0,hn=$t.use(pt.initReactI18next).init({resources:{},fallbackLng:"fr",lng:"fr",defaultNS:"translation",ns:["translation"],debug:!1,interpolation:{escapeValue:!1},react:{useSuspense:!1},ignoreJSONStructure:!0,returnNull:!1,returnEmptyString:!1,returnObjects:!1,load:"languageOnly",detection:void 0,initImmediate:!0}).then(()=>(console.log("[i18n] Initialized successfully"),$t)).catch(t=>(console.error("[i18n] Failed to initialize:",t),$t)));function xl(t){const[s,a]=O.useState($t.isInitialized),n=O.useRef(!0);O.useEffect(()=>{if(n.current=!0,$t.isInitialized){a(!0);return}if(hn)hn.then(()=>{n.current&&a(!0)});else{const o=setTimeout(()=>{n.current&&a(!0)},100);return()=>{clearTimeout(o),n.current=!1}}return()=>{n.current=!1}},[]);const r=pt.useTranslation(t);return!s||!$t.isInitialized?{t:(i,c)=>c?.defaultValue??i,i18n:$t,ready:!1}:{t:r.t,i18n:r.i18n,ready:r.ready}}es.registerLocale("fr",Ft);es.registerLocale("en",Js);es.registerLocale("es",Wo);es.registerLocale("de",Bo);es.registerLocale("it",qo);es.registerLocale("pt",Ho);es.registerLocale("ja",Uo);es.registerLocale("zh",Go);const Qn=d.forwardRef(({value:t,onChange:s,placeholder:a,disabled:n=!1,className:r,variant:o="date",format:i,minDate:c,maxDate:l,showSeconds:u=!1,showClear:f=!0,showPresets:m=!1,presets:p,locale:g="fr",timeFormat:C="24h",size:y="md",error:N,label:v,required:x=!1,inline:w=!1,monthsShown:k=1,timeIntervals:D=15,validation:S,showWeekNumbers:F=!1,showTodayButton:A=!0,showSelectionInfo:T=!1,allowTimeRange:M=!1,timezone:I,onBeforeChange:E,onAfterChange:P,renderDay:G,popoverClassName:H,disableAnimations:X=!1,readOnly:z=!1,id:L,name:_,autoFocus:R=!1},U)=>{const{t:$}=xl(),[Z,Q]=d.useState(!1),[K,q]=d.useState(o==="range"&&t&&!("from"in t)?{from:t,to:void 0}:t),[W,J]=d.useState(null),[B,te]=d.useState(null);d.useEffect(()=>{q(o==="range"&&t&&!("from"in t)?{from:t,to:void 0}:t)},[t,o]);const ee={fr:Ft,en:Js,es:Wo,de:Bo,it:qo,pt:Ho,ja:Uo,zh:Go}[g]||Ft,le=[{label:$?.("today")||"Aujourd'hui",value:()=>new Date},{label:$?.("yesterday")||"Hier",value:()=>V.subDays(new Date,1)},{label:$?.("tomorrow")||"Demain",value:()=>V.addDays(new Date,1)},{label:$?.("inOneWeek")||"Dans une semaine",value:()=>V.addWeeks(new Date,1)},{label:$?.("inOneMonth")||"Dans un mois",value:()=>V.addMonths(new Date,1)},{label:$?.("startOfWeek")||"Début de semaine",value:()=>V.startOfWeek(new Date,{locale:ee})},{label:$?.("endOfWeek")||"Fin de semaine",value:()=>V.endOfWeek(new Date,{locale:ee})},{label:$?.("startOfMonth")||"Début du mois",value:()=>V.startOfMonth(new Date)},{label:$?.("endOfMonth")||"Fin du mois",value:()=>V.endOfMonth(new Date)}],Me=[{label:$?.("today")||"Aujourd'hui",range:()=>({from:V.startOfDay(new Date),to:V.endOfDay(new Date)})},{label:$?.("yesterday")||"Hier",range:()=>({from:V.startOfDay(V.subDays(new Date,1)),to:V.endOfDay(V.subDays(new Date,1))})},{label:$?.("thisWeek")||"Cette semaine",range:()=>({from:V.startOfWeek(new Date,{locale:ee}),to:V.endOfWeek(new Date,{locale:ee})})},{label:$?.("lastWeek")||"Semaine dernière",range:()=>({from:V.startOfWeek(V.subWeeks(new Date,1),{locale:ee}),to:V.endOfWeek(V.subWeeks(new Date,1),{locale:ee})})},{label:$?.("thisMonth")||"Ce mois",range:()=>({from:V.startOfMonth(new Date),to:V.endOfMonth(new Date)})},{label:$?.("lastMonth")||"Mois dernier",range:()=>({from:V.startOfMonth(V.subMonths(new Date,1)),to:V.endOfMonth(V.subMonths(new Date,1))})},{label:$?.("last7Days")||"7 derniers jours",range:()=>({from:V.subDays(new Date,7),to:new Date})},{label:$?.("last30Days")||"30 derniers jours",range:()=>({from:V.subDays(new Date,30),to:new Date})},{label:$?.("thisYear")||"Cette année",range:()=>({from:V.startOfYear(new Date),to:V.endOfYear(new Date)})}],pe=p||(m?o==="range"?Me:le:[]),je={sm:"h-8 px-3 text-xs",md:"h-10 px-4 text-sm",lg:"h-12 px-5 text-base"},Qe=i||(()=>{switch(o){case"time":return u?C==="12h"?"h:mm:ss a":"HH:mm:ss":C==="12h"?"h:mm a":"HH:mm";case"datetime":return u?C==="12h"?"PPP h:mm:ss a":"PPP HH:mm:ss":C==="12h"?"PPP h:mm a":"PPP HH:mm";case"range":return"PPP";case"multiple":return"PPP";default:return"PPP"}})(),yt=ae=>{if(!S)return null;if(c&&V.isBefore(ae,V.startOfDay(c)))return $?.("dateBeforeMin")||`Date antérieure au ${V.format(c,Qe,{locale:ee})}`;if(l&&V.isAfter(ae,V.endOfDay(l)))return $?.("dateAfterMax")||`Date postérieure au ${V.format(l,Qe,{locale:ee})}`;if(S.disabledDates?.some(me=>V.isEqual(V.startOfDay(me),V.startOfDay(ae)))||S.disabledDatesFn?.(ae))return S.message||$?.("dateDisabled")||"Date désactivée";if(S.disabledDaysOfWeek?.includes(ae.getDay()))return S.message||$?.("dayOfWeekDisabled")||"Jour de la semaine désactivé";if(S.validate){const me=S.validate(ae);if(me===!1)return S.message||$?.("invalidDate")||"Date invalide";if(typeof me=="string")return me}return null},tt=ae=>{if(z)return;let me=null;if(o==="range"){if(Array.isArray(ae)&&ae[0]&&ae[1])me={from:ae[0],to:ae[1]};else if(ae){const $e=K;$e?.from&&!$e.to?me={from:$e.from,to:ae}:me={from:ae,to:void 0}}}else if(o==="multiple")if(Array.isArray(K)){const $e=[...K],at=$e.findIndex(Pt=>V.isEqual(V.startOfDay(Pt),V.startOfDay(ae)));at>=0?$e.splice(at,1):$e.push(ae),me=$e}else me=ae?[ae]:[];else me=ae;if(!(E&&!E(me))){if(me&&!me.from&&!Array.isArray(me)){const $e=yt(me);if($e){J($e);return}}J(null),q(me),s?.(me),P?.(me),o!=="range"&&o!=="multiple"&&!w&&Q(!1)}},wt=ae=>{if(ae.range){const me=typeof ae.range=="function"?ae.range():ae.range;tt(o==="range"?[me.from,me.to]:me.from)}else if(ae.value){const me=typeof ae.value=="function"?ae.value():ae.value;tt(me)}w||Q(!1)},Nt=ae=>{ae&&ae.stopPropagation(),!z&&(q(null),J(null),s?.(null),P?.(null))},mt=()=>{tt(new Date)},Rt=ae=>ae?!ae.from&&!ae.to:!0,ce=d.useMemo(()=>K?o==="range"?!Rt(K):o==="multiple"?Array.isArray(K)&&K.length>0:K instanceof Date&&!isNaN(K.getTime()):!1,[K,o]),Y=()=>{if(!K)return a||$?.("selectDate")||"Sélectionner une date";try{if(o==="range"){const ae=K;return Rt(ae)?a||$?.("selectDateRange")||"Sélectionner une période":ae.from&&ae.to?`${V.format(ae.from,Qe,{locale:ee})} - ${V.format(ae.to,Qe,{locale:ee})}`:ae.from?`${V.format(ae.from,Qe,{locale:ee})} - ...`:a||$?.("selectDateRange")||"Sélectionner une période"}if(o==="multiple"){const ae=K;return!ae||ae.length===0?a||$?.("selectDates")||"Sélectionner des dates":ae.length===1?V.format(ae[0],Qe,{locale:ee}):`${ae.length} ${$?.("datesSelected")||"dates sélectionnées"}`}return!(K instanceof Date)||isNaN(K.getTime())?a||$?.("selectDate")||"Sélectionner une date":V.format(K,Qe,{locale:ee})}catch(ae){return console.error("Error formatting date:",ae),a||$?.("selectDate")||"Sélectionner une date"}},oe=ae=>!!(c&&V.isBefore(ae,V.startOfDay(c))||l&&V.isAfter(ae,V.endOfDay(l))||S?.disabledDates?.some(me=>V.isEqual(V.startOfDay(me),V.startOfDay(ae)))||S?.disabledDatesFn?.(ae)||S?.disabledDaysOfWeek?.includes(ae.getDay())),ve=ae=>!!(S?.highlightedDates?.some(me=>V.isEqual(V.startOfDay(me),V.startOfDay(ae)))||S?.highlightedDatesFn?.(ae)),Xe=()=>{const ae={selected:o==="range"?K?.from:o==="multiple"?void 0:K,onChange:tt,startDate:o==="range"?K?.from:void 0,endDate:o==="range"?K?.to:void 0,selectsRange:o==="range",selectsMultiple:o==="multiple",highlightDates:o==="multiple"?K:void 0,showTimeSelect:o==="time"||o==="datetime",showTimeSelectOnly:o==="time",timeFormat:u?C==="12h"?"h:mm:ss aa":"HH:mm:ss":C==="12h"?"h:mm aa":"HH:mm",timeIntervals:D,timeCaption:$?.("time")||"Heure",dateFormat:Qe,locale:g,placeholderText:a,disabled:n,minDate:c,maxDate:l,inline:!0,monthsShown:o==="range"?Math.max(2,k):k,showWeekNumbers:F,filterDate:me=>!oe(me),dayClassName:me=>{const $e=[];if(ve(me)&&$e.push("highlighted-date"),B&&o==="range"){const at=K;at?.from&&!at.to&&V.isWithinInterval(me,{start:at.from<B?at.from:B,end:at.from>B?at.from:B})&&$e.push("in-selecting-range")}return $e.join(" ")},onDayMouseEnter:me=>te(me),calendarClassName:b.cn("waka-datepicker",X&&"no-animations"),wrapperClassName:"w-full",autoFocus:R};return e.jsxs("div",{className:"flex gap-3",children:[m&&pe.length>0&&e.jsxs("div",{className:"flex flex-col gap-1 min-w-[150px] border-r border-border pr-3",children:[e.jsx(j.Label,{className:"text-xs font-semibold text-muted-foreground mb-1",children:$?.("quickSelection")||"Sélection rapide"}),e.jsx(St,{className:"h-[300px]",children:e.jsx("div",{className:"space-y-1",children:pe.map((me,$e)=>e.jsx(j.Button,{variant:"ghost",size:"sm",className:"w-full justify-start text-xs",onClick:()=>wt(me),children:me.label},$e))})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx(es,{...ae}),T&&K&&e.jsxs("div",{className:"mt-3 p-2 bg-muted rounded-md text-xs space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Info,{className:"h-3 w-3 text-muted-foreground"}),e.jsxs("span",{className:"font-medium",children:[$?.("selection")||"Sélection"," :"]})]}),e.jsx("div",{className:"text-muted-foreground pl-5",children:Y()})]})]})]})};return w?e.jsxs("div",{ref:U,className:b.cn("space-y-2",r),id:L,children:[v&&e.jsxs(j.Label,{className:"text-sm font-medium text-foreground",children:[v,x&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.jsx("div",{className:"border border-border rounded-lg p-4 bg-card",children:Xe()}),(N||W)&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-destructive",children:[e.jsx(h.AlertCircle,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:N||W})]})]}):e.jsxs("div",{ref:U,className:b.cn("space-y-2",r),id:L,children:[v&&e.jsxs(j.Label,{htmlFor:`${L}-input`,className:"text-sm font-medium text-foreground",children:[v,x&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.jsxs(j.Popover,{open:Z,onOpenChange:Q,children:[e.jsx(j.PopoverTrigger,{asChild:!0,children:e.jsxs(j.Button,{id:`${L}-input`,name:_,variant:"outline",disabled:n||z,className:b.cn("w-full justify-between text-left font-normal",!ce&&"text-muted-foreground",je[y],(N||W)&&"border-destructive focus-visible:ring-destructive",z&&"cursor-default opacity-70"),"aria-label":v||a,"aria-invalid":!!(N||W),"aria-required":x,"aria-describedby":N||W?`${L}-error`:void 0,"aria-haspopup":"dialog","aria-expanded":Z,children:[e.jsxs("span",{className:"flex items-center gap-2 flex-1 truncate",children:[o==="time"?e.jsx(h.Clock,{className:"h-4 w-4 flex-shrink-0"}):e.jsx(h.Calendar,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:Y()})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-2",children:[ce&&f&&!z&&e.jsx(na,{children:e.jsxs(ra,{children:[e.jsx(oa,{asChild:!0,children:e.jsx("div",{className:"h-5 w-5 rounded hover:bg-destructive/10 flex items-center justify-center cursor-pointer",onClick:Nt,role:"button","aria-label":$?.("clear")||"Effacer",children:e.jsx(h.X,{className:"h-3 w-3 text-muted-foreground hover:text-destructive"})})}),e.jsx(Os,{children:e.jsx("p",{children:$?.("clear")||"Effacer"})})]})}),W&&e.jsx(na,{children:e.jsxs(ra,{children:[e.jsx(oa,{asChild:!0,children:e.jsx(h.AlertCircle,{className:"h-4 w-4 text-destructive"})}),e.jsx(Os,{children:e.jsx("p",{children:W})})]})})]})]})}),e.jsxs(j.PopoverContent,{className:b.cn("w-auto p-0",H),align:"start",sideOffset:4,children:[e.jsx("div",{className:"p-4",children:Xe()}),(A||f)&&e.jsxs(e.Fragment,{children:[e.jsx(j.Separator,{}),e.jsxs("div",{className:"flex items-center justify-between p-3 gap-2",children:[A&&e.jsxs(j.Button,{variant:"outline",size:"sm",onClick:mt,disabled:n||z,children:[e.jsx(h.Calendar,{className:"h-3.5 w-3.5 mr-1.5"}),$?.("today")||"Aujourd'hui"]}),f&&ce&&e.jsxs(j.Button,{variant:"outline",size:"sm",onClick:Nt,disabled:n||z,className:"ml-auto",children:[e.jsx(h.X,{className:"h-3.5 w-3.5 mr-1.5"}),$?.("clear")||"Effacer"]})]})]})]})]}),(N||W)&&e.jsxs("div",{id:`${L}-error`,className:"flex items-center gap-1.5 text-sm text-destructive",role:"alert","aria-live":"polite",children:[e.jsx(h.AlertCircle,{className:"h-3.5 w-3.5","aria-hidden":"true"}),e.jsx("span",{children:N||W})]})]})});Qn.displayName="WakaDateTimePicker";function Xx({name:t,control:s,defaultValue:a,...n}){return e.jsx(bi,{name:t,control:s,defaultValue:a,render:({field:r,fieldState:o})=>e.jsx(Qn,{...n,value:r.value,onChange:r.onChange,error:o.error?.message})})}function Yx(t){return d.useMemo(()=>({formatDateForSubmit:a=>a?a.toISOString():null,formatRangeForSubmit:a=>!a?.from||!a?.to?null:{from:a.from.toISOString(),to:a.to.toISOString()},parseDateFromServer:a=>a?new Date(a):null,parseRangeFromServer:a=>a?{from:new Date(a.from),to:new Date(a.to)}:null}),[])}const Qx={info:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",success:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",warning:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",error:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"},Ca=d.forwardRef(({notification:t,onMarkAsRead:s,onDelete:a},n)=>{const r=o=>{const c=new Date().getTime()-o.getTime(),l=Math.floor(c/6e4),u=Math.floor(c/36e5),f=Math.floor(c/864e5);return l<1?"À l'instant":l<60?`Il y a ${l} min`:u<24?`Il y a ${u}h`:f<7?`Il y a ${f}j`:o.toLocaleDateString("fr-FR")};return e.jsxs("article",{ref:n,className:b.cn("flex gap-3 p-4 hover:bg-muted/50 transition-colors border-l-4",t.read?"border-l-transparent opacity-60":"border-l-primary","relative group"),role:"listitem","aria-label":`${t.type}: ${t.title}`,children:[e.jsx("div",{className:b.cn("flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center",Qx[t.type]),"aria-hidden":"true",children:t.icon||e.jsx(h.Bell,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:b.cn("text-sm font-semibold",t.read&&"font-normal"),children:t.title}),e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:r(t.timestamp)})]}),e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:t.message}),t.action&&e.jsx(j.Button,{variant:"link",size:"sm",className:"h-auto p-0 text-primary",onClick:t.action.onClick,children:t.action.label})]}),e.jsxs("div",{className:"flex-shrink-0 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[!t.read&&s&&e.jsxs(j.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>s(t.id),children:[e.jsx(h.Check,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Marquer comme lu"})]}),a&&e.jsxs(j.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>a(t.id),children:[e.jsx(h.Trash2,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Supprimer"})]})]})]})});Ca.displayName="NotificationItem";const gl=d.forwardRef(({notifications:t,onMarkAsRead:s,onMarkAllAsRead:a,onDelete:n,onDeleteAll:r,onSettingsClick:o,maxHeight:i="400px",className:c,iconClassName:l,badgeClassName:u,showBadge:f=!0,showTabs:m=!0,emptyMessage:p="Aucune notification",emptyIcon:g},C)=>{const[y,N]=d.useState(!1),[v,x]=d.useState("all"),w=t.filter(S=>!S.read).length,k=d.useMemo(()=>v==="all"?t:v==="unread"?t.filter(S=>!S.read):t,[t,v]),D=()=>e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[g||e.jsx(h.Bell,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:p})]});return e.jsxs(j.Popover,{open:y,onOpenChange:N,children:[e.jsx(j.PopoverTrigger,{asChild:!0,children:e.jsxs(j.Button,{ref:C,variant:"ghost",size:"icon",className:b.cn("relative",c),children:[e.jsx(h.Bell,{className:b.cn("h-5 w-5",l)}),f&&w>0&&e.jsx(ye,{variant:"destructive",className:b.cn("absolute -top-1 -right-1 h-5 min-w-[20px] flex items-center justify-center p-0 text-xs",u),children:w>99?"99+":w}),e.jsxs("span",{className:"sr-only",children:["Notifications (",w," non lues)"]})]})}),e.jsxs(j.PopoverContent,{className:"w-[380px] p-0",align:"end",sideOffset:8,children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-base",children:"Notifications"}),w>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[w," non ",w>1?"lues":"lue"]})]}),e.jsxs("div",{className:"flex gap-1",children:[a&&w>0&&e.jsxs(j.Button,{variant:"ghost",size:"sm",className:"h-8 text-xs",onClick:a,children:[e.jsx(h.Check,{className:"h-3 w-3 mr-1"}),"Tout marquer"]}),o&&e.jsxs(j.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:o,children:[e.jsx(h.Settings,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Paramètres"})]})]})]}),m&&t.length>0&&e.jsxs(Vs,{value:v,onValueChange:x,className:"w-full",children:[e.jsxs(As,{className:"w-full rounded-none border-b bg-transparent p-0",children:[e.jsxs(Mt,{value:"all",className:"flex-1 rounded-none data-[state=active]:border-b-2 data-[state=active]:border-primary",children:["Toutes (",t.length,")"]}),e.jsxs(Mt,{value:"unread",className:"flex-1 rounded-none data-[state=active]:border-b-2 data-[state=active]:border-primary",children:["Non lues (",w,")"]})]}),e.jsx(At,{value:"all",className:"m-0",children:e.jsx(St,{className:"h-[400px]",style:{maxHeight:i},children:e.jsx("div",{className:"p-0",role:"list","aria-live":"polite","aria-label":"Liste des notifications",children:k.length===0?e.jsx(D,{}):e.jsx("div",{className:"divide-y",children:k.map(S=>e.jsx(Ca,{notification:S,onMarkAsRead:s,onDelete:n},S.id))})})})}),e.jsx(At,{value:"unread",className:"m-0",children:e.jsx(St,{className:"h-[400px]",style:{maxHeight:i},children:e.jsx("div",{className:"p-0",role:"list","aria-live":"polite","aria-label":"Notifications non lues",children:k.length===0?e.jsx(D,{}):e.jsx("div",{className:"divide-y",children:k.map(S=>e.jsx(Ca,{notification:S,onMarkAsRead:s,onDelete:n},S.id))})})})})]}),!m&&e.jsx(St,{className:"h-[400px]",style:{maxHeight:i},children:e.jsx("div",{className:"p-0",role:"list","aria-live":"polite","aria-label":"Liste des notifications",children:t.length===0?e.jsx(D,{}):e.jsx("div",{className:"divide-y",children:t.map(S=>e.jsx(Ca,{notification:S,onMarkAsRead:s,onDelete:n},S.id))})})}),t.length>0&&r&&e.jsxs(e.Fragment,{children:[e.jsx(j.Separator,{}),e.jsx("div",{className:"p-2",children:e.jsxs(j.Button,{variant:"ghost",size:"sm",className:"w-full text-destructive hover:text-destructive",onClick:r,children:[e.jsx(h.Trash2,{className:"h-3 w-3 mr-2"}),"Tout supprimer"]})})]})]})]})});gl.displayName="WakaNotifications";function Kx(t=[]){const[s,a]=d.useState(t),n=d.useCallback(u=>{const f={...u,id:`notification-${Date.now()}-${Math.random()}`,timestamp:new Date,read:!1};a(m=>[f,...m])},[]),r=d.useCallback(u=>{a(f=>f.map(m=>m.id===u?{...m,read:!0}:m))},[]),o=d.useCallback(()=>{a(u=>u.map(f=>({...f,read:!0})))},[]),i=d.useCallback(u=>{a(f=>f.filter(m=>m.id!==u))},[]),c=d.useCallback(()=>{a([])},[]),l=d.useMemo(()=>s.filter(u=>!u.read).length,[s]);return{notifications:s,addNotification:n,markAsRead:r,markAllAsRead:o,deleteNotification:i,deleteAllNotifications:c,unreadCount:l}}const Jx=lt.cva("relative inline-flex items-center justify-center",{variants:{size:{xs:"w-12 h-12",sm:"w-16 h-16",md:"w-24 h-24",lg:"w-32 h-32",xl:"w-48 h-48"}},defaultVariants:{size:"md"}}),bl=d.forwardRef(({className:t,size:s,mode:a="infinite",label:n,subLabel:r,speed:o=3,color:i="primary",rings:c=3,showParticles:l=!0,showPulse:u=!0,ringOpacity:f=.6,...m},p)=>{const g=d.useId(),y={xs:{size:48,labelSize:8,subLabelSize:6},sm:{size:64,labelSize:10,subLabelSize:7},md:{size:96,labelSize:12,subLabelSize:8},lg:{size:128,labelSize:14,subLabelSize:10},xl:{size:192,labelSize:18,subLabelSize:12}}[s||"md"],N=y.size/2,v=N-4,w={primary:"hsl(var(--primary))",secondary:"hsl(var(--secondary))",accent:"hsl(var(--accent))",destructive:"hsl(var(--destructive))",muted:"hsl(var(--muted-foreground))"}[i]||i,k=d.useMemo(()=>{const S=[],F=v*.3,A=(v-F)/c;for(let T=0;T<c;T++)S.push(F+A*(T+1));return S},[c,v]),D=d.useMemo(()=>{if(!l)return[];const S=s==="xs"?4:s==="sm"?6:s==="xl"?12:8;return Array.from({length:S},(F,A)=>({id:A,angle:360/S*A,radius:v*(.5+Math.random()*.4),size:1+Math.random()*2,delay:Math.random()*2,duration:2+Math.random()*2}))},[l,v,s]);return e.jsxs("div",{ref:p,className:b.cn(Jx({size:s,className:t})),role:"status","aria-label":n||"Chargement en cours",...m,children:[e.jsxs("svg",{width:y.size,height:y.size,viewBox:`0 0 ${y.size} ${y.size}`,className:"overflow-visible",children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:`ring-gradient-${g}`,x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:w,stopOpacity:f}),e.jsx("stop",{offset:"50%",stopColor:w,stopOpacity:f*.3}),e.jsx("stop",{offset:"100%",stopColor:w,stopOpacity:f})]}),e.jsxs("linearGradient",{id:`scan-gradient-${g}`,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:w,stopOpacity:"0"}),e.jsx("stop",{offset:"40%",stopColor:w,stopOpacity:"0.8"}),e.jsx("stop",{offset:"50%",stopColor:w,stopOpacity:"1"}),e.jsx("stop",{offset:"60%",stopColor:w,stopOpacity:"0.8"}),e.jsx("stop",{offset:"100%",stopColor:w,stopOpacity:"0"})]}),e.jsxs("filter",{id:`glow-${g}`,x:"-50%",y:"-50%",width:"200%",height:"200%",children:[e.jsx("feGaussianBlur",{stdDeviation:"2",result:"coloredBlur"}),e.jsxs("feMerge",{children:[e.jsx("feMergeNode",{in:"coloredBlur"}),e.jsx("feMergeNode",{in:"SourceGraphic"})]})]}),e.jsx("clipPath",{id:`scan-clip-${g}`,children:e.jsx("rect",{x:"0",y:"0",width:y.size,height:y.size/2})})]}),u&&e.jsx("circle",{cx:N,cy:N,r:v*.15,fill:w,opacity:"0.3",style:{animation:`waka-pulse ${o*.5}s ease-in-out infinite`,transformOrigin:`${N}px ${N}px`}}),e.jsx("circle",{cx:N,cy:N,r:v*.08,fill:w,filter:`url(#glow-${g})`}),k.map((S,F)=>{const A=F%2===0,T=2*Math.PI*S/(8+F*4),M=T*.5,I=o*(1+F*.3),E=A?1:-1;return e.jsxs("g",{children:[e.jsx("circle",{cx:N,cy:N,r:S,fill:"none",stroke:`url(#ring-gradient-${g})`,strokeWidth:1.5+F*.3,strokeDasharray:`${T} ${M}`,strokeLinecap:"round",style:{animation:`waka-spin-${E>0?"cw":"ccw"} ${I}s linear infinite`,transformOrigin:`${N}px ${N}px`}}),F===c-1&&e.jsx(e.Fragment,{children:[0,90,180,270].map(P=>e.jsx("circle",{cx:N+S*Math.cos(P*Math.PI/180),cy:N+S*Math.sin(P*Math.PI/180),r:2,fill:w,opacity:.8,style:{animation:`waka-spin-${E>0?"cw":"ccw"} ${I}s linear infinite`,transformOrigin:`${N}px ${N}px`}},P))})]},F)}),a==="loading"&&e.jsxs("g",{style:{animation:`waka-scan ${o*.8}s ease-in-out infinite`,transformOrigin:`${N}px ${N}px`},children:[e.jsx("line",{x1:N-v,y1:N,x2:N+v,y2:N,stroke:w,strokeWidth:"2",opacity:"0.8",filter:`url(#glow-${g})`}),e.jsx("ellipse",{cx:N,cy:N,rx:v,ry:v*.15,fill:`url(#scan-gradient-${g})`,opacity:"0.4"})]}),a==="loading"&&e.jsx("g",{children:[...Array(6)].map((S,F)=>{const A=(60*F+30)*(Math.PI/180),T=v*.7;return e.jsx("circle",{cx:N+T*Math.cos(A),cy:N+T*Math.sin(A),r:2,fill:w,style:{animation:`waka-data-pulse ${o*.3}s ease-in-out infinite ${F*.1}s`}},F)})}),D.map(S=>{const F=N+S.radius*Math.cos(S.angle*Math.PI/180),A=N+S.radius*Math.sin(S.angle*Math.PI/180);return e.jsx("circle",{cx:F,cy:A,r:S.size,fill:w,opacity:"0.5",style:{animation:`waka-particle ${S.duration}s ease-in-out infinite ${S.delay}s`,transformOrigin:`${N}px ${N}px`}},S.id)}),e.jsx("path",{d:io(N,N,v+2,0,60),fill:"none",stroke:w,strokeWidth:"1",opacity:"0.4",strokeLinecap:"round",style:{animation:`waka-spin-cw ${o*2}s linear infinite`,transformOrigin:`${N}px ${N}px`}}),e.jsx("path",{d:io(N,N,v+2,180,240),fill:"none",stroke:w,strokeWidth:"1",opacity:"0.4",strokeLinecap:"round",style:{animation:`waka-spin-cw ${o*2}s linear infinite`,transformOrigin:`${N}px ${N}px`}})]}),(n||r)&&e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",style:{color:w},children:[n&&e.jsx("span",{className:"font-mono font-semibold tracking-wider uppercase",style:{fontSize:y.labelSize},children:n}),r&&e.jsx("span",{className:"font-mono opacity-70",style:{fontSize:y.subLabelSize,animation:a==="loading"?`waka-blink ${o*.5}s ease-in-out infinite`:void 0},children:r})]}),e.jsx("style",{dangerouslySetInnerHTML:{__html:`
|
|
4
|
+
@keyframes waka-spin-cw {
|
|
5
5
|
from { transform: rotate(0deg); }
|
|
6
6
|
to { transform: rotate(360deg); }
|
|
7
7
|
}
|
|
8
|
-
@keyframes waka-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
@keyframes waka-spin-ccw {
|
|
9
|
+
from { transform: rotate(360deg); }
|
|
10
|
+
to { transform: rotate(0deg); }
|
|
11
11
|
}
|
|
12
|
-
@keyframes waka-
|
|
13
|
-
0%, 100% {
|
|
14
|
-
50% {
|
|
12
|
+
@keyframes waka-pulse {
|
|
13
|
+
0%, 100% { transform: scale(1); opacity: 0.3; }
|
|
14
|
+
50% { transform: scale(2); opacity: 0.1; }
|
|
15
15
|
}
|
|
16
|
-
@keyframes waka-
|
|
17
|
-
0%, 100% { opacity: 0.
|
|
18
|
-
50% { opacity:
|
|
16
|
+
@keyframes waka-particle {
|
|
17
|
+
0%, 100% { opacity: 0.5; transform: scale(1); }
|
|
18
|
+
50% { opacity: 0.8; transform: scale(1.5); }
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
@keyframes waka-scan {
|
|
21
|
+
0% { transform: rotate(0deg); }
|
|
22
|
+
100% { transform: rotate(360deg); }
|
|
23
|
+
}
|
|
24
|
+
@keyframes waka-data-pulse {
|
|
25
|
+
0%, 100% { opacity: 0.3; transform: scale(0.8); }
|
|
26
|
+
50% { opacity: 1; transform: scale(1.2); }
|
|
27
|
+
}
|
|
28
|
+
@keyframes waka-blink {
|
|
29
|
+
0%, 100% { opacity: 0.7; }
|
|
30
|
+
50% { opacity: 0.3; }
|
|
31
|
+
}
|
|
32
|
+
`}})]})});bl.displayName="WakaSpinner";function oo(t,s,a,n){const r=(n-90)*Math.PI/180;return{x:t+a*Math.cos(r),y:s+a*Math.sin(r)}}function io(t,s,a,n,r){const o=oo(t,s,a,r),i=oo(t,s,a,n),c=r-n<=180?"0":"1";return`M ${o.x} ${o.y} A ${a} ${a} 0 ${c} 0 ${i.x} ${i.y}`}function jl({apiConfig:t,existingThemes:s=[],onSaveSuccess:a,onDeleteSuccess:n,className:r}){const{toast:o}=_a(),[i,c]=d.useState(""),[l,u]=d.useState(""),[f,m]=d.useState(""),[p,g]=d.useState("#3b82f6"),[C,y]=d.useState(""),[N,v]=d.useState(""),[x,w]=d.useState(""),[k,D]=d.useState({}),[S,F]=d.useState([]),[A,T]=d.useState(""),[M,I]=d.useState(!1),[E,P]=d.useState(null),[G,H]=d.useState(!1),[X,z]=d.useState(!1),[L,_]=d.useState(!1),[R,U]=d.useState(!1),[$,Z]=d.useState(null),[Q,K]=d.useState([]),[q,W]=d.useState("1.0.0"),[J,B]=d.useState("info"),te=d.useRef(null),se=d.useRef({}),ee=d.useCallback(Y=>{if(!Y.trim())return{valid:!1,error:"Le CSS ne peut pas être vide"};const oe=Y.includes(":root")||Y.includes(".dark"),ve=Y.includes("@theme inline");return!oe&&!ve?{valid:!1,error:"Le CSS doit contenir :root, .dark ou @theme inline"}:Y.includes("--")?{valid:!0}:{valid:!1,error:"Le CSS doit contenir des variables CSS (--variable)"}},[]),le=d.useCallback(()=>{const Y=ee(N);if(!Y.valid){o({title:"CSS invalide",description:Y.error,variant:"destructive"});return}te.current&&te.current.parentNode&&te.current.parentNode.removeChild(te.current);const oe=document.createElement("style");oe.setAttribute("data-theme-preview",i),oe.textContent=N,document.head.appendChild(oe),te.current=oe,document.documentElement.setAttribute("data-theme",i),H(!0),o({title:"Prévisualisation activée",description:`Le thème "${l}" est maintenant actif`})},[N,i,l,ee,o]),Me=d.useCallback(()=>{te.current&&te.current.parentNode&&te.current.parentNode.removeChild(te.current),document.documentElement.removeAttribute("data-theme"),H(!1),o({title:"Prévisualisation arrêtée",description:"Thème par défaut restauré"})},[o]),re=d.useCallback(async(Y,oe,ve)=>{if(!i)return o({title:"ID requis",description:"Veuillez d'abord définir l'ID du thème",variant:"destructive"}),null;const Xe=oe==="custom"?`custom-${ve}`:oe;P(Xe);try{const ae=oe==="custom"?`custom/${ve}`:oe,me=await t.onUploadFile(Y,i,ae);return o({title:"Asset uploadé",description:`${Y.name} a été uploadé avec succès`}),me}catch(ae){return console.error("[ThemeCreator] Asset upload error:",ae),o({title:"Erreur d'upload",description:ae instanceof Error?ae.message:"Une erreur est survenue",variant:"destructive"}),null}finally{P(null)}},[i,t,o]),pe=d.useCallback(async(Y,oe)=>{const ve=Y.target.files?.[0];if(!ve)return;const Xe=await re(ve,oe);Xe&&D(ae=>({...ae,[oe]:Xe.url})),Y.target.value=""},[re]),je=d.useCallback(async(Y,oe)=>{const ve=Y.target.files?.[0];if(!ve)return;const Xe=await re(ve,"custom",oe);if(Xe){const ae=ve.type.startsWith("image/")?"image":ve.type.startsWith("font/")?"font":ve.name.endsWith(".ico")||ve.name.endsWith(".svg")?"icon":"other",me={key:oe,url:Xe.url,type:ae,filename:Xe.filename||ve.name,size:Xe.size||ve.size};F($e=>{const at=$e.findIndex(Pt=>Pt.key===oe);if(at>=0){const Pt=[...$e];return Pt[at]=me,Pt}return[...$e,me]})}Y.target.value=""},[re]),he=d.useCallback(Y=>{D(oe=>{const ve={...oe};return delete ve[Y],ve})},[]),Qe=d.useCallback(Y=>{F(oe=>oe.filter(ve=>ve.key!==Y))},[]),yt=d.useCallback(()=>{if(!A.trim()){o({title:"Clé requise",description:"Veuillez entrer une clé pour la ressource",variant:"destructive"});return}if(S.some(oe=>oe.key===A.trim())){o({title:"Clé existante",description:"Cette clé existe déjà",variant:"destructive"});return}const Y=A.trim();T(""),se.current[`custom-${Y}`]?.click()},[A,S,o]),tt=d.useCallback(async()=>{const Y=ee(N);if(!Y.valid){o({title:"CSS invalide",description:Y.error,variant:"destructive"});return}if(!i||!l){o({title:"Informations manquantes",description:"Veuillez renseigner l'ID et le nom du thème",variant:"destructive"});return}I(!0);try{const oe={version:q,createdAt:new Date,createdBy:C||"Anonymous",changelog:x||"No changelog provided",css:N},ve=[...Q,oe];K(ve);const Xe={id:i,label:l,description:f,previewColor:p,author:C,versions:ve,currentVersion:q,assets:Object.keys(k).length>0?k:void 0,customResources:S.length>0?S:void 0};await t.onSaveTheme(Xe),o({title:"Thème sauvegardé !",description:`Le thème "${l}" v${q} a été sauvegardé`}),a?.(Xe),w("")}catch(oe){console.error("[ThemeCreator] Save error:",oe),o({title:"Erreur de sauvegarde",description:oe instanceof Error?oe.message:"Une erreur est survenue",variant:"destructive"})}finally{I(!1)}},[N,i,l,f,p,C,q,x,Q,t,ee,o,a,k,S]),wt=d.useCallback(async()=>{try{await navigator.clipboard.writeText(N),z(!0),setTimeout(()=>z(!1),2e3),o({title:"CSS copié !",description:"Le code CSS a été copié dans le presse-papiers"})}catch{o({title:"Erreur de copie",description:"Impossible de copier le CSS",variant:"destructive"})}},[N,o]),Nt=d.useCallback(async Y=>{U(!0);try{let oe=Y;if(t.onLoadTheme&&(!Y.versions||Y.versions.length===0||!Y.versions[0].css)){const Xe=await t.onLoadTheme(Y.id);if(Xe)oe=Xe,o({title:"Thème chargé",description:`Thème "${oe.label}" chargé`});else{o({title:"Erreur",description:`Impossible de charger le thème "${Y.label}"`,variant:"destructive"});return}}c(oe.id),u(oe.label),m(oe.description||""),g(oe.previewColor||"#3b82f6"),y(oe.author||""),K(oe.versions),W(oe.currentVersion),D(oe.assets||{}),F(oe.customResources||[]);const ve=oe.versions[oe.versions.length-1];ve&&v(ve.css),Z(oe)}catch(oe){console.error("[WakaThemeCreator] Error loading theme:",oe),o({title:"Erreur",description:"Erreur lors du chargement du thème",variant:"destructive"})}finally{U(!1)}},[t,o]),mt=d.useCallback(()=>{c(""),u(""),m(""),g("#3b82f6"),y(""),v(""),w(""),K([]),W("1.0.0"),Z(null),D({}),F([]),B("info"),G&&Me()},[G,Me]),Rt=d.useCallback(()=>{const Y=new Blob([N],{type:"text/css"}),oe=URL.createObjectURL(Y),ve=document.createElement("a");ve.href=oe,ve.download=`${i||"theme"}.css`,document.body.appendChild(ve),ve.click(),document.body.removeChild(ve),URL.revokeObjectURL(oe),o({title:"CSS téléchargé",description:`Fichier ${i||"theme"}.css téléchargé`})},[N,i,o]);return e.jsxs("div",{className:b.cn("w-full max-w-6xl mx-auto space-y-6",r),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Créateur de Thèmes"}),e.jsx("p",{className:"text-muted-foreground",children:"Créez et publiez des thèmes TweakCN sur S3"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(j.Button,{variant:"outline",onClick:mt,children:[e.jsx(h.Plus,{className:"mr-2 h-4 w-4"}),"Nouveau thème"]}),G&&e.jsx(j.Button,{variant:"destructive",onClick:Me,children:"Arrêter la prévisualisation"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs(Ce,{className:"lg:col-span-1",children:[e.jsxs(Ve,{children:[e.jsx(Oe,{children:"Thèmes existants"}),e.jsx(et,{children:"Chargez un thème pour le modifier"})]}),e.jsx(Pe,{className:"space-y-2",children:s.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Aucun thème existant"}):s.map(Y=>e.jsxs("button",{onClick:()=>Nt(Y),disabled:R,className:b.cn("w-full flex items-center gap-3 p-3 rounded-lg border-2 transition-all text-left",$?.id===Y.id?"border-primary bg-primary/10":"border-border hover:border-primary/50",R&&"opacity-50 cursor-not-allowed"),children:[e.jsx("div",{className:"w-8 h-8 rounded-full flex-shrink-0",style:{backgroundColor:Y.previewColor||"#3b82f6"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"font-medium truncate flex items-center gap-2",children:[Y.label,R&&$?.id===Y.id&&e.jsx(h.Loader2,{className:"h-4 w-4 animate-spin"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["v",Y.currentVersion||"1.0.0"," • ",Y.versions?.length||0," versions"]})]})]},Y.id))})]}),e.jsx("div",{className:"lg:col-span-2 space-y-6",children:e.jsxs(Vs,{value:J,onValueChange:B,className:"w-full",children:[e.jsxs(As,{className:"grid w-full grid-cols-4",children:[e.jsxs(Mt,{value:"info",className:"flex items-center gap-2",children:[e.jsx(h.Palette,{className:"h-4 w-4"}),"Infos"]}),e.jsxs(Mt,{value:"css",className:"flex items-center gap-2",children:[e.jsx(h.FileCode,{className:"h-4 w-4"}),"CSS"]}),e.jsxs(Mt,{value:"resources",className:"flex items-center gap-2",children:[e.jsx(h.Image,{className:"h-4 w-4"}),"Ressources"]}),e.jsxs(Mt,{value:"history",className:"flex items-center gap-2",children:[e.jsx(h.History,{className:"h-4 w-4"}),"Historique"]})]}),e.jsx(At,{value:"info",className:"mt-6",children:e.jsxs(Ce,{children:[e.jsx(Ve,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Palette,{className:"h-5 w-5"}),"Informations du thème"]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{htmlFor:"theme-id",children:"ID du thème *"}),e.jsx(j.Input,{id:"theme-id",placeholder:"ex: forest",value:i,onChange:Y=>c(Y.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{htmlFor:"theme-label",children:"Nom d'affichage *"}),e.jsx(j.Input,{id:"theme-label",placeholder:"ex: Forêt",value:l,onChange:Y=>u(Y.target.value)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{htmlFor:"theme-description",children:"Description"}),e.jsx(j.Input,{id:"theme-description",placeholder:"Thème inspiré de la nature",value:f,onChange:Y=>m(Y.target.value)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{htmlFor:"theme-color",children:"Couleur de prévisualisation"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j.Input,{id:"theme-color",type:"color",value:p,onChange:Y=>g(Y.target.value),className:"w-16 h-10 p-1"}),e.jsx(j.Input,{value:p,onChange:Y=>g(Y.target.value),placeholder:"#3b82f6"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{htmlFor:"theme-author",children:"Auteur"}),e.jsx(j.Input,{id:"theme-author",placeholder:"Votre nom",value:C,onChange:Y=>y(Y.target.value)})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{htmlFor:"theme-version",children:"Version"}),e.jsx(j.Input,{id:"theme-version",placeholder:"1.0.0",value:q,onChange:Y=>W(Y.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{htmlFor:"theme-changelog",children:"Changelog"}),e.jsx(j.Input,{id:"theme-changelog",placeholder:"Modifications apportées",value:x,onChange:Y=>w(Y.target.value)})]})]})]})]})}),e.jsx(At,{value:"css",className:"mt-6",children:e.jsxs(Ce,{children:[e.jsxs(Ve,{children:[e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.FileCode,{className:"h-5 w-5"}),"Code CSS TweakCN"]}),e.jsx(et,{children:"Collez le CSS généré par TweakCN ici"})]}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsx(j.Textarea,{placeholder:`:root {
|
|
21
33
|
--background: oklch(0.9911 0 0);
|
|
22
34
|
--foreground: oklch(0.2046 0 0);
|
|
23
35
|
--primary: oklch(0.8348 0.1302 160.9080);
|
|
@@ -48,151 +60,38 @@
|
|
|
48
60
|
--color-primary: var(--primary);
|
|
49
61
|
--color-primary-foreground: var(--primary-foreground);
|
|
50
62
|
/* ... autres couleurs ... */
|
|
51
|
-
}`,value:x,onChange:Y=>h(Y.target.value),className:"font-mono text-sm min-h-[300px]"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(G,{onClick:X,disabled:$,children:[e.jsx(S.Eye,{className:"mr-2 h-4 w-4"}),"Prévisualiser"]}),e.jsx(G,{variant:"outline",onClick:J,children:C?e.jsxs(e.Fragment,{children:[e.jsx(S.Check,{className:"mr-2 h-4 w-4"}),"Copié !"]}):e.jsxs(e.Fragment,{children:[e.jsx(S.Copy,{className:"mr-2 h-4 w-4"}),"Copier CSS"]})}),e.jsxs(G,{variant:"outline",onClick:ee,children:[e.jsx(S.Download,{className:"mr-2 h-4 w-4"}),"Télécharger"]}),e.jsx("div",{className:"ml-auto",children:e.jsx(G,{onClick:B,disabled:E,children:E?e.jsxs(e.Fragment,{children:[e.jsx(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Publication..."]}):e.jsxs(e.Fragment,{children:[e.jsx(S.Upload,{className:"mr-2 h-4 w-4"}),"Publier sur S3"]})})})]})]})]}),F.length>0&&e.jsxs(Be,{children:[e.jsx(rt,{children:e.jsxs(Ge,{className:"flex items-center gap-2",children:[e.jsx(S.History,{className:"h-5 w-5"}),"Historique des versions"]})}),e.jsx(st,{children:e.jsx("div",{className:"space-y-3",children:F.slice().reverse().map((Y,K)=>e.jsxs("div",{className:"flex items-start gap-3 p-3 border rounded-lg",children:[e.jsxs(Pe,{variant:"outline",children:["v",Y.version]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:Y.changelog||"Aucune description"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Par ",Y.createdBy," • ",Y.createdAt.toLocaleDateString()]})]}),e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>h(Y.css),children:"Charger"})]},K))})})]})]})]}),e.jsx(cs,{open:M,onOpenChange:R,children:e.jsxs(fr,{children:[e.jsxs(hr,{children:[e.jsx(gr,{children:"Supprimer le thème ?"}),e.jsx(xr,{children:"Cette action est irréversible. Le thème sera supprimé de S3."})]}),e.jsxs(pr,{children:[e.jsx(vr,{children:"Annuler"}),e.jsx(br,{onClick:()=>{O&&(r?.(O.id),te()),R(!1)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})})]})}Vi.displayName="WakaThemeCreator";const Wi=m.createContext(void 0);function Gr(t,a){const r=[];if(a.css?.["@layer base"]){const i=[];for(const[c,l]of Object.entries(a.css["@layer base"]))if(typeof l=="object"&&l!==null){const o=Object.entries(l).map(([d,u])=>` ${d}: ${u};`).join(`
|
|
52
|
-
`);
|
|
53
|
-
${
|
|
54
|
-
}`)}
|
|
55
|
-
${
|
|
63
|
+
}`,value:N,onChange:Y=>v(Y.target.value),className:"font-mono text-sm min-h-[300px]"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(j.Button,{onClick:le,disabled:G,children:[e.jsx(h.Eye,{className:"mr-2 h-4 w-4"}),"Prévisualiser"]}),e.jsx(j.Button,{variant:"outline",onClick:wt,children:X?e.jsxs(e.Fragment,{children:[e.jsx(h.Check,{className:"mr-2 h-4 w-4"}),"Copié !"]}):e.jsxs(e.Fragment,{children:[e.jsx(h.Copy,{className:"mr-2 h-4 w-4"}),"Copier CSS"]})}),e.jsxs(j.Button,{variant:"outline",onClick:Rt,children:[e.jsx(h.Download,{className:"mr-2 h-4 w-4"}),"Télécharger"]}),e.jsx("div",{className:"ml-auto",children:e.jsx(j.Button,{onClick:tt,disabled:M,children:M?e.jsxs(e.Fragment,{children:[e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Sauvegarde..."]}):e.jsxs(e.Fragment,{children:[e.jsx(h.Save,{className:"mr-2 h-4 w-4"}),"Sauvegarder"]})})})]})]})]})}),e.jsxs(At,{value:"resources",className:"mt-6 space-y-6",children:[e.jsxs(Ce,{children:[e.jsxs(Ve,{children:[e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Image,{className:"h-5 w-5"}),"Assets du thème"]}),e.jsx(et,{children:"Logos et images de fond pour le bloc Login et autres composants"})]}),e.jsxs(Pe,{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold mb-4",children:"Logos"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{children:"Logo (Mode clair)"}),e.jsx("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:k.logo_light?e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:k.logo_light,alt:"Logo Light",className:"max-h-20 mx-auto object-contain"}),e.jsx(j.Button,{variant:"destructive",size:"icon",className:"absolute top-0 right-0 h-6 w-6",onClick:()=>he("logo_light"),children:e.jsx(h.X,{className:"h-4 w-4"})})]}):e.jsxs("div",{children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",ref:Y=>{se.current.logo_light=Y},onChange:Y=>pe(Y,"logo_light")}),e.jsxs(j.Button,{variant:"outline",onClick:()=>se.current.logo_light?.click(),disabled:E==="logo_light"||!i,children:[E==="logo_light"?e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(h.ImagePlus,{className:"mr-2 h-4 w-4"}),"Ajouter"]})]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{children:"Logo (Mode sombre)"}),e.jsx("div",{className:"border-2 border-dashed rounded-lg p-4 text-center bg-slate-900",children:k.logo_dark?e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:k.logo_dark,alt:"Logo Dark",className:"max-h-20 mx-auto object-contain"}),e.jsx(j.Button,{variant:"destructive",size:"icon",className:"absolute top-0 right-0 h-6 w-6",onClick:()=>he("logo_dark"),children:e.jsx(h.X,{className:"h-4 w-4"})})]}):e.jsxs("div",{children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",ref:Y=>{se.current.logo_dark=Y},onChange:Y=>pe(Y,"logo_dark")}),e.jsxs(j.Button,{variant:"outline",onClick:()=>se.current.logo_dark?.click(),disabled:E==="logo_dark"||!i,children:[E==="logo_dark"?e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(h.ImagePlus,{className:"mr-2 h-4 w-4"}),"Ajouter"]})]})})]})]})]}),e.jsx(j.Separator,{}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold mb-4",children:"Images de fond (Login)"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{children:"Fond (Mode clair)"}),e.jsx("div",{className:"border-2 border-dashed rounded-lg p-4 text-center min-h-[120px] flex items-center justify-center",children:k.background_light?e.jsxs("div",{className:"relative w-full",children:[e.jsx("img",{src:k.background_light,alt:"Background Light",className:"max-h-24 mx-auto object-cover rounded"}),e.jsx(j.Button,{variant:"destructive",size:"icon",className:"absolute top-0 right-0 h-6 w-6",onClick:()=>he("background_light"),children:e.jsx(h.X,{className:"h-4 w-4"})})]}):e.jsxs("div",{children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",ref:Y=>{se.current.background_light=Y},onChange:Y=>pe(Y,"background_light")}),e.jsxs(j.Button,{variant:"outline",onClick:()=>se.current.background_light?.click(),disabled:E==="background_light"||!i,children:[E==="background_light"?e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(h.ImagePlus,{className:"mr-2 h-4 w-4"}),"Ajouter"]})]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{children:"Fond (Mode sombre)"}),e.jsx("div",{className:"border-2 border-dashed rounded-lg p-4 text-center min-h-[120px] flex items-center justify-center bg-slate-900",children:k.background_dark?e.jsxs("div",{className:"relative w-full",children:[e.jsx("img",{src:k.background_dark,alt:"Background Dark",className:"max-h-24 mx-auto object-cover rounded"}),e.jsx(j.Button,{variant:"destructive",size:"icon",className:"absolute top-0 right-0 h-6 w-6",onClick:()=>he("background_dark"),children:e.jsx(h.X,{className:"h-4 w-4"})})]}):e.jsxs("div",{children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",ref:Y=>{se.current.background_dark=Y},onChange:Y=>pe(Y,"background_dark")}),e.jsxs(j.Button,{variant:"outline",onClick:()=>se.current.background_dark?.click(),disabled:E==="background_dark"||!i,children:[E==="background_dark"?e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(h.ImagePlus,{className:"mr-2 h-4 w-4"}),"Ajouter"]})]})})]})]})]}),e.jsx(j.Separator,{}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold mb-4",children:"Favicon & Sponsor"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{children:"Favicon"}),e.jsx("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:k.favicon?e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:k.favicon,alt:"Favicon",className:"h-8 w-8 mx-auto object-contain"}),e.jsx(j.Button,{variant:"destructive",size:"icon",className:"absolute top-0 right-0 h-6 w-6",onClick:()=>he("favicon"),children:e.jsx(h.X,{className:"h-4 w-4"})})]}):e.jsxs("div",{children:[e.jsx("input",{type:"file",accept:"image/*,.ico",className:"hidden",ref:Y=>{se.current.favicon=Y},onChange:Y=>pe(Y,"favicon")}),e.jsx(j.Button,{variant:"outline",size:"sm",onClick:()=>se.current.favicon?.click(),disabled:E==="favicon"||!i,children:E==="favicon"?e.jsx(h.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(h.Plus,{className:"h-4 w-4"})})]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{children:"Sponsor (Clair)"}),e.jsx("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:k.sponsor_light?e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:k.sponsor_light,alt:"Sponsor Light",className:"max-h-12 mx-auto object-contain"}),e.jsx(j.Button,{variant:"destructive",size:"icon",className:"absolute top-0 right-0 h-6 w-6",onClick:()=>he("sponsor_light"),children:e.jsx(h.X,{className:"h-4 w-4"})})]}):e.jsxs("div",{children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",ref:Y=>{se.current.sponsor_light=Y},onChange:Y=>pe(Y,"sponsor_light")}),e.jsx(j.Button,{variant:"outline",size:"sm",onClick:()=>se.current.sponsor_light?.click(),disabled:E==="sponsor_light"||!i,children:E==="sponsor_light"?e.jsx(h.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(h.Plus,{className:"h-4 w-4"})})]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{children:"Sponsor (Sombre)"}),e.jsx("div",{className:"border-2 border-dashed rounded-lg p-4 text-center bg-slate-900",children:k.sponsor_dark?e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:k.sponsor_dark,alt:"Sponsor Dark",className:"max-h-12 mx-auto object-contain"}),e.jsx(j.Button,{variant:"destructive",size:"icon",className:"absolute top-0 right-0 h-6 w-6",onClick:()=>he("sponsor_dark"),children:e.jsx(h.X,{className:"h-4 w-4"})})]}):e.jsxs("div",{children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",ref:Y=>{se.current.sponsor_dark=Y},onChange:Y=>pe(Y,"sponsor_dark")}),e.jsx(j.Button,{variant:"outline",size:"sm",onClick:()=>se.current.sponsor_dark?.click(),disabled:E==="sponsor_dark"||!i,children:E==="sponsor_dark"?e.jsx(h.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(h.Plus,{className:"h-4 w-4"})})]})})]})]})]}),!i&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-amber-600 bg-amber-50 dark:bg-amber-950 dark:text-amber-400 p-3 rounded-lg",children:[e.jsx(h.AlertCircle,{className:"h-4 w-4"}),`Définissez d'abord l'ID du thème dans l'onglet "Infos" pour uploader des assets`]})]})]}),e.jsxs(Ce,{children:[e.jsxs(Ve,{children:[e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.FolderOpen,{className:"h-5 w-5"}),"Ressources personnalisées"]}),e.jsx(et,{children:"Ajoutez des ressources supplémentaires (images, icônes, polices...)"})]}),e.jsxs(Pe,{className:"space-y-4",children:[S.length>0&&e.jsx("div",{className:"space-y-2",children:S.map(Y=>e.jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-lg",children:[Y.type==="image"||Y.type==="icon"?e.jsx("img",{src:Y.url,alt:Y.key,className:"h-10 w-10 object-contain rounded"}):e.jsx("div",{className:"h-10 w-10 bg-muted rounded flex items-center justify-center",children:e.jsx(h.FolderOpen,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:Y.key}),e.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[Y.filename,Y.size&&` • ${(Y.size/1024).toFixed(1)} KB`]})]}),e.jsx(ye,{variant:"outline",children:Y.type}),e.jsx(j.Button,{variant:"ghost",size:"icon",onClick:()=>Qe(Y.key),children:e.jsx(h.Trash2,{className:"h-4 w-4 text-destructive"})})]},Y.key))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j.Input,{placeholder:"Clé de la ressource (ex: hero-image)",value:A,onChange:Y=>T(Y.target.value),onKeyDown:Y=>Y.key==="Enter"&&yt()}),e.jsxs(j.Button,{onClick:yt,disabled:!i||!A.trim(),children:[e.jsx(h.Plus,{className:"mr-2 h-4 w-4"}),"Ajouter"]})]}),S.map(Y=>e.jsx("input",{type:"file",className:"hidden",ref:oe=>{se.current[`custom-${Y.key}`]=oe},onChange:oe=>je(oe,Y.key)},`input-${Y.key}`)),e.jsx("input",{type:"file",className:"hidden",ref:Y=>{se.current[`custom-${A.trim()}`]=Y},onChange:Y=>je(Y,A.trim())})]})]})]}),e.jsx(At,{value:"history",className:"mt-6",children:e.jsxs(Ce,{children:[e.jsx(Ve,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.History,{className:"h-5 w-5"}),"Historique des versions"]})}),e.jsx(Pe,{children:Q.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"Aucune version publiée. Publiez votre thème pour voir l'historique ici."}):e.jsx("div",{className:"space-y-3",children:Q.slice().reverse().map((Y,oe)=>e.jsxs("div",{className:"flex items-start gap-3 p-3 border rounded-lg",children:[e.jsxs(ye,{variant:"outline",children:["v",Y.version]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:Y.changelog||"Aucune description"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Par ",Y.createdBy," • ",Y.createdAt.toLocaleDateString()]})]}),e.jsx(j.Button,{variant:"ghost",size:"sm",onClick:()=>{v(Y.css),B("css")},children:"Charger"})]},oe))})})]})})]})})]}),e.jsx(cs,{open:L,onOpenChange:_,children:e.jsxs(qt,{children:[e.jsxs(Ut,{children:[e.jsx(Gt,{children:"Supprimer le thème ?"}),e.jsx(Xt,{children:"Cette action est irréversible. Le thème sera définitivement supprimé."})]}),e.jsxs(Ht,{children:[e.jsx(Qt,{children:"Annuler"}),e.jsx(Yt,{onClick:async()=>{if($)try{await t.onDeleteTheme?.($.id),n?.($.id),mt(),o({title:"Thème supprimé",description:`Le thème "${$.label}" a été supprimé`})}catch{o({title:"Erreur",description:"Impossible de supprimer le thème",variant:"destructive"})}_(!1)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})})]})}jl.displayName="WakaThemeCreator";const vl=d.createContext(void 0);function Za(t,s){const a=[];if(s.css?.["@layer base"]){const o=[];for(const[i,c]of Object.entries(s.css["@layer base"]))if(typeof c=="object"&&c!==null){const l=Object.entries(c).map(([u,f])=>` ${u}: ${f};`).join(`
|
|
64
|
+
`);o.push(` ${i} {
|
|
65
|
+
${l}
|
|
66
|
+
}`)}o.length>0&&a.push(`@layer base {
|
|
67
|
+
${o.join(`
|
|
56
68
|
|
|
57
69
|
`)}
|
|
58
|
-
}`)}const s
|
|
59
|
-
${
|
|
70
|
+
}`)}const n=s.cssVars;if(n){const o=[];if(n.theme)for(const[i,c]of Object.entries(n.theme)){const l=i.startsWith("--")?i:`--${i}`;o.push(` ${l}: ${c};`)}if(n.light)for(const[i,c]of Object.entries(n.light)){const l=i.startsWith("--")?i:`--${i}`;o.push(` ${l}: ${c};`)}if(o.length>0&&a.push(`:root[data-theme="${t}"],
|
|
71
|
+
[data-theme="${t}"] {
|
|
72
|
+
${o.join(`
|
|
60
73
|
`)}
|
|
61
|
-
}`),
|
|
62
|
-
[data-theme="${t}"]
|
|
63
|
-
${
|
|
74
|
+
}`),n.dark){const i=[];for(const[c,l]of Object.entries(n.dark)){const u=c.startsWith("--")?c:`--${c}`;i.push(` ${u}: ${l};`)}i.length>0&&a.push(`:root.dark[data-theme="${t}"],
|
|
75
|
+
.dark [data-theme="${t}"],
|
|
76
|
+
[data-theme="${t}"].dark {
|
|
77
|
+
${i.join(`
|
|
64
78
|
`)}
|
|
65
|
-
}`)}}const
|
|
66
|
-
|
|
67
|
-
`);if(!n||n.trim().length===0)throw new Error(`No CSS generated for theme "${t}"`);return le.debug(`Generated CSS for theme "${t}" (${n.length} chars)`),n}function Ui({children:t,themes:a,defaultTheme:r="default",onThemeChange:s,onError:n,enableDarkMode:i=!1,fetchHeaders:c={},fetchTimeout:l=1e4}){const[o,d]=m.useState(r),[u,f]=m.useState(!0),[p,g]=m.useState(new Set),[y,j]=m.useState(!1),[A,x]=m.useState(!1),[h,b]=m.useState([]),w=m.useRef(new Map),E=m.useRef(new Set),v=m.useMemo(()=>[...a,...h],[a,h]);m.useEffect(()=>{E.current=p},[p]);const $=m.useCallback(async F=>{const L=new AbortController,_=setTimeout(()=>L.abort(),l);try{const P=await fetch(F,{signal:L.signal,headers:{Accept:"application/json","Cache-Control":"no-cache",...c}});if(clearTimeout(_),!P.ok)throw new Error(`HTTP ${P.status}: ${P.statusText}`);return await P.json()}catch(P){throw clearTimeout(_),P}},[c,l]),D=m.useCallback(async F=>{const L=v.find(_=>_.id===F);if(!L)return le.debug(`Theme "${F}" not found in config`),null;if(L.registryItem)return Gr(F,L.registryItem);if(L.jsonUrl)try{const _=await $(L.jsonUrl);return Gr(F,_)}catch(_){throw Ve(_,{code:Le.THEME_LOAD_FAILED,context:`ThemeProvider.loadThemeCSS(${F}) from ${L.jsonUrl}`,onError:n})}return le.debug(`No CSS source for theme "${F}"`),null},[v,$,n]),C=m.useCallback((F,L)=>{if(typeof document>"u")return;document.querySelectorAll("style[data-theme-styles]").forEach(V=>V.remove()),w.current.clear();const P=document.createElement("style");P.setAttribute("data-theme-id",F),P.setAttribute("data-theme-styles","active"),P.textContent=L,document.head.appendChild(P),w.current.set(F,P),le.debug(`CSS injected for theme "${F}" (${L.length} chars)`)},[]),T=m.useCallback(F=>{if(typeof document>"u")return;document.documentElement.setAttribute("data-theme",F);try{localStorage.setItem("waka-theme",F)}catch(_){console.warn("[ThemeProvider] Could not save theme to localStorage:",_)}le.debug(`Theme applied: data-theme="${F}"`)},[]),M=m.useCallback(async(F,L)=>{f(!0);try{const _=Gr(F,L);b(P=>{const V=P.findIndex(X=>X.id===F),z={id:F,label:L.name||F,registryItem:L};if(V>=0){const X=[...P];return X[V]=z,X}return[...P,z]}),C(F,_),g(P=>new Set(P).add(F)),await new Promise(P=>requestAnimationFrame(P)),T(F),d(F),s?.(F)}catch(_){throw Ve(_,{code:Le.THEME_LOAD_FAILED,context:`ThemeProvider.loadThemeFromJSON(${F})`,onError:n})}finally{f(!1)}},[C,T,s,n]),R=m.useCallback(async F=>{if(!E.current.has(F))try{await D(F)&&g(_=>new Set(_).add(F))}catch(L){throw Ve(L,{code:Le.THEME_LOAD_FAILED,context:`ThemeProvider.preloadTheme(${F})`,onError:n})}},[D,n]),I=m.useCallback(async F=>{f(!0);try{const L=await D(F);L&&(C(F,L),g(_=>new Set(_).add(F)),await new Promise(_=>requestAnimationFrame(_))),T(F),d(F),s?.(F)}catch(L){throw Ve(L,{code:Le.THEME_APPLY_FAILED,context:`ThemeProvider.changeTheme(${F})`,onError:n})}finally{f(!1)}},[D,C,T,s,n]),U=m.useCallback(F=>p.has(F),[p]);m.useEffect(()=>{if(y)return;(async()=>{f(!0);try{let L=r;if(typeof window<"u"){const P=localStorage.getItem("waka-theme");P&&v.some(V=>V.id===P)&&(L=P)}const _=await D(L);_?(C(L,_),g(new Set([L])),await new Promise(P=>requestAnimationFrame(P))):g(new Set([L])),T(L),d(L)}catch(L){console.error("[ThemeProvider] Error initializing:",L),T(r),d(r),g(new Set([r]))}finally{f(!1),j(!0)}})()},[y,r,v,D,C,T]);const O=m.useCallback(()=>{i&&x(F=>{const L=!F,_=document.documentElement;L?_.classList.add("dark"):_.classList.remove("dark");try{localStorage.setItem("waka-dark-mode",L?"dark":"light")}catch(P){console.warn("[ThemeProvider] Could not save dark mode to localStorage:",P)}return L})},[i]);m.useEffect(()=>{if(!i||typeof window>"u")return;let F=!1;try{const V=localStorage.getItem("waka-dark-mode");V!==null?F=V==="dark":(F=window.matchMedia("(prefers-color-scheme: dark)").matches,localStorage.setItem("waka-dark-mode",F?"dark":"light"))}catch(V){console.warn("[ThemeProvider] Could not read dark mode from localStorage:",V)}x(F);const L=document.documentElement;F?L.classList.add("dark"):L.classList.remove("dark");const _=window.matchMedia("(prefers-color-scheme: dark)"),P=V=>{try{localStorage.getItem("waka-dark-mode")||(x(V.matches),V.matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),localStorage.setItem("waka-dark-mode",V.matches?"dark":"light"))}catch{}};return _.addEventListener("change",P),()=>{_.removeEventListener("change",P)}},[]),m.useEffect(()=>()=>{w.current.forEach(F=>{F.parentNode&&F.parentNode.removeChild(F)}),w.current.clear()},[]);const W={currentTheme:o,themes:v,changeTheme:I,isLoading:u,loadedThemes:p,preloadTheme:R,isThemeLoaded:U,isDarkMode:A,toggleDarkMode:O,loadThemeFromJSON:M};return e.jsx(Wi.Provider,{value:W,children:t})}function Ua(){const t=m.useContext(Wi);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}function Eg(){try{return Ua()}catch{return null}}const Hi=$e.cva("w-full",{variants:{size:{sm:"max-w-2xl",base:"max-w-4xl",lg:"max-w-6xl",full:"max-w-full"}},defaultVariants:{size:"base"}});function Xr(t){return{name:t.name,type:"registry:style",cssVars:{light:{background:t.colors.background,foreground:t.colors.foreground,card:t.colors.card,"card-foreground":t.colors.cardForeground,popover:t.colors.popover,"popover-foreground":t.colors.popoverForeground,primary:t.colors.primary,"primary-foreground":t.colors.primaryForeground,secondary:t.colors.secondary,"secondary-foreground":t.colors.secondaryForeground,muted:t.colors.muted,"muted-foreground":t.colors.mutedForeground,accent:t.colors.accent,"accent-foreground":t.colors.accentForeground,destructive:t.colors.destructive,"destructive-foreground":t.colors.destructiveForeground,border:t.colors.border,input:t.colors.input,ring:t.colors.ring,...t.colors.chart1&&{"chart-1":t.colors.chart1},...t.colors.chart2&&{"chart-2":t.colors.chart2},...t.colors.chart3&&{"chart-3":t.colors.chart3},...t.colors.chart4&&{"chart-4":t.colors.chart4},...t.colors.chart5&&{"chart-5":t.colors.chart5}}}}}function Tg(t){const a=t.cssVars?.light||{};return{name:t.name,colors:{background:a.background||"#ffffff",foreground:a.foreground||"#0a0a0a",card:a.card||"#ffffff",cardForeground:a["card-foreground"]||"#0a0a0a",popover:a.popover||"#ffffff",popoverForeground:a["popover-foreground"]||"#0a0a0a",primary:a.primary||"#0a0a0a",primaryForeground:a["primary-foreground"]||"#fafafa",secondary:a.secondary||"#f4f4f5",secondaryForeground:a["secondary-foreground"]||"#0a0a0a",muted:a.muted||"#f4f4f5",mutedForeground:a["muted-foreground"]||"#737373",accent:a.accent||"#f4f4f5",accentForeground:a["accent-foreground"]||"#0a0a0a",destructive:a.destructive||"#ef4444",destructiveForeground:a["destructive-foreground"]||"#fafafa",border:a.border||"#e4e4e7",input:a.input||"#e4e4e7",ring:a.ring||"#0a0a0a",chart1:a["chart-1"],chart2:a["chart-2"],chart3:a["chart-3"],chart4:a["chart-4"],chart5:a["chart-5"]}}}const qi=m.forwardRef(({className:t,size:a,onThemeChange:r,onThemeLoad:s,onThemeSave:n,initialTheme:i,showPreview:c=!0,showExport:l=!0,showImport:o=!0,allowCustomColors:d=!0,...u},f)=>{const p=Eg(),g=p?.currentTheme,y=p?.themes||[],j=p?.loadThemeFromJSON,A=p?.isDarkMode,x=p?.toggleDarkMode,[h,b]=k.useState(i||{name:"Custom Theme",description:"Thème personnalisé",colors:{background:"#ffffff",foreground:"#0a0a0a",card:"#ffffff",cardForeground:"#0a0a0a",popover:"#ffffff",popoverForeground:"#0a0a0a",primary:"#0a0a0a",primaryForeground:"#fafafa",secondary:"#f4f4f5",secondaryForeground:"#0a0a0a",muted:"#f4f4f5",mutedForeground:"#737373",accent:"#f4f4f5",accentForeground:"#0a0a0a",destructive:"#ef4444",destructiveForeground:"#fafafa",border:"#e4e4e7",input:"#e4e4e7",ring:"#0a0a0a"}}),[w,E]=k.useState(!1),[v,$]=k.useState(null),[D,C]=k.useState(null),[T,M]=k.useState(""),[R,I]=k.useState(!1),[U,O]=k.useState("auto"),W=k.useCallback(async z=>{if(j){const X=z.name.toLowerCase().replace(/\s+/g,"-"),q=Xr(z);try{await j(X,q)}catch(B){console.error("[WakaThemeManager] Failed to apply theme:",B)}}else{const X=document.documentElement;Object.entries(z.colors).forEach(([q,B])=>{const J=`--${q.replace(/([A-Z])/g,"-$1").toLowerCase()}`;X.style.setProperty(J,B)})}},[j]),F=async z=>{E(!0),$(null),C(null);try{const X=await fetch(z);if(!X.ok)throw new Error(`Erreur HTTP: ${X.status}`);const q=await X.json();let B;if(q.cssVars)B=Tg(q),B.description=`Imported from ${z}`;else if(q.colors)B={name:q.name||"Imported Theme",description:q.description||"",author:q.author||"",version:q.version||"1.0.0",colors:{background:q.colors.background||"#ffffff",foreground:q.colors.foreground||"#0a0a0a",card:q.colors.card||"#ffffff",cardForeground:q.colors.cardForeground||"#0a0a0a",popover:q.colors.popover||"#ffffff",popoverForeground:q.colors.popoverForeground||"#0a0a0a",primary:q.colors.primary||"#0a0a0a",primaryForeground:q.colors.primaryForeground||"#fafafa",secondary:q.colors.secondary||"#f4f4f5",secondaryForeground:q.colors.secondaryForeground||"#0a0a0a",muted:q.colors.muted||"#f4f4f5",mutedForeground:q.colors.mutedForeground||"#737373",accent:q.colors.accent||"#f4f4f5",accentForeground:q.colors.accentForeground||"#0a0a0a",destructive:q.colors.destructive||"#ef4444",destructiveForeground:q.colors.destructiveForeground||"#fafafa",border:q.colors.border||"#e4e4e7",input:q.colors.input||"#e4e4e7",ring:q.colors.ring||"#0a0a0a",chart1:q.colors.chart1,chart2:q.colors.chart2,chart3:q.colors.chart3,chart4:q.colors.chart4,chart5:q.colors.chart5}};else throw new Error("Format de thème invalide. Attendu: shadcn registry-item ou TweakCN");b(B),await W(B),s?.(B),C("Thème chargé avec succès !")}catch(X){$(X instanceof Error?X.message:"Erreur lors du chargement du thème")}finally{E(!1)}},L=()=>{const z=Xr(h),X=JSON.stringify(z,null,2),q=new Blob([X],{type:"application/json"}),B=URL.createObjectURL(q),J=document.createElement("a");J.href=B,J.download=`${h.name.toLowerCase().replace(/\s+/g,"-")}-theme.json`,document.body.appendChild(J),J.click(),document.body.removeChild(J),URL.revokeObjectURL(B)},_=async()=>{try{const z=Xr(h);await navigator.clipboard.writeText(JSON.stringify(z,null,2)),I(!0),setTimeout(()=>I(!1),2e3)}catch{$("Impossible de copier le thème")}},P=(z,X)=>{const q={...h,colors:{...h.colors,[z]:X}};b(q),W(q),r?.(q)},V=()=>{n?.(h),C("Thème sauvegardé !")};return k.useEffect(()=>{W(h)},[]),k.useEffect(()=>{U==="dark"?x&&!A?x():document.documentElement.classList.add("dark"):U==="light"&&(x&&A?x():document.documentElement.classList.remove("dark"))},[U,A,x]),e.jsx("div",{ref:f,className:N(Hi({size:a}),t),...u,children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Gestionnaire de Thèmes"}),e.jsx("p",{className:"text-muted-foreground",children:"Créez, importez et prévisualisez vos thèmes (format shadcn registry-item)"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(Pe,{variant:"outline",className:"flex items-center gap-1",children:[e.jsx(S.Palette,{className:"h-3 w-3"}),h.name]})})]}),v&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-lg text-destructive",children:[e.jsx(S.AlertCircle,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:v})]}),D&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-green-500/10 border border-green-500/20 rounded-lg text-green-600",children:[e.jsx(S.CheckCircle,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:D})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs(Be,{children:[e.jsx(rt,{children:e.jsxs(Ge,{className:"flex items-center gap-2",children:[e.jsx(S.Settings,{className:"h-5 w-5"}),"Informations du thème"]})}),e.jsxs(st,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(ve,{htmlFor:"theme-name",children:"Nom"}),e.jsx(me,{id:"theme-name",value:h.name,onChange:z=>b({...h,name:z.target.value}),placeholder:"Mon thème"})]}),e.jsxs("div",{children:[e.jsx(ve,{htmlFor:"theme-author",children:"Auteur"}),e.jsx(me,{id:"theme-author",value:h.author||"",onChange:z=>b({...h,author:z.target.value}),placeholder:"Votre nom"})]})]}),e.jsxs("div",{children:[e.jsx(ve,{htmlFor:"theme-description",children:"Description"}),e.jsx(fa,{id:"theme-description",value:h.description||"",onChange:z=>b({...h,description:z.target.value}),placeholder:"Description du thème...",rows:3})]})]})]}),(o||l)&&e.jsxs(Be,{children:[e.jsxs(rt,{children:[e.jsxs(Ge,{className:"flex items-center gap-2",children:[e.jsx(S.Upload,{className:"h-5 w-5"}),"Import / Export"]}),e.jsx(Et,{children:"Supporte le format shadcn registry-item et TweakCN"})]}),e.jsxs(st,{className:"space-y-4",children:[o&&e.jsxs("div",{children:[e.jsx(ve,{htmlFor:"import-url",children:"URL du thème JSON"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(me,{id:"import-url",value:T,onChange:z=>M(z.target.value),placeholder:"https://example.com/theme.json",className:"flex-1"}),e.jsx(G,{onClick:()=>F(T),disabled:!T||w,size:"sm",children:w?e.jsx(S.RefreshCw,{className:"h-4 w-4 animate-spin"}):e.jsx(S.Download,{className:"h-4 w-4"})})]})]}),l&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(G,{onClick:L,variant:"outline",className:"flex-1",children:[e.jsx(S.Download,{className:"h-4 w-4 mr-2"}),"Exporter JSON"]}),e.jsx(G,{onClick:_,variant:"outline",children:R?e.jsx(S.Check,{className:"h-4 w-4"}):e.jsx(S.Copy,{className:"h-4 w-4"})})]})]})]}),c&&e.jsxs(Be,{children:[e.jsx(rt,{children:e.jsxs(Ge,{className:"flex items-center gap-2",children:[e.jsx(S.Eye,{className:"h-5 w-5"}),"Prévisualisation"]})}),e.jsx(st,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(G,{variant:U==="light"?"default":"outline",size:"sm",onClick:()=>O("light"),children:[e.jsx(S.Sun,{className:"h-4 w-4 mr-2"}),"Clair"]}),e.jsxs(G,{variant:U==="dark"?"default":"outline",size:"sm",onClick:()=>O("dark"),children:[e.jsx(S.Moon,{className:"h-4 w-4 mr-2"}),"Sombre"]}),e.jsxs(G,{variant:U==="auto"?"default":"outline",size:"sm",onClick:()=>O("auto"),children:[e.jsx(S.Monitor,{className:"h-4 w-4 mr-2"}),"Auto"]})]}),g&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Thème actuel:"}),e.jsx("span",{className:"font-medium",children:g})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Mode sombre:"}),e.jsx("span",{className:"font-medium",children:A?"Activé":"Désactivé"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Thèmes disponibles:"}),e.jsx("span",{className:"font-medium",children:y.length})]})]})]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(G,{onClick:V,className:"flex-1",children:"Sauvegarder le thème"}),e.jsxs(G,{variant:"outline",onClick:()=>window.open("https://ui.shadcn.com/themes","_blank"),children:[e.jsx(S.ExternalLink,{className:"h-4 w-4 mr-2"}),"shadcn/ui"]})]})]}),d&&e.jsx("div",{className:"space-y-6",children:e.jsxs(Be,{children:[e.jsxs(rt,{children:[e.jsxs(Ge,{className:"flex items-center gap-2",children:[e.jsx(S.Palette,{className:"h-5 w-5"}),"Couleurs du thème"]}),e.jsx(Et,{children:"Cliquez sur une couleur pour la modifier"})]}),e.jsx(st,{children:e.jsx("div",{className:"grid grid-cols-2 gap-4",children:Object.entries(h.colors).map(([z,X])=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(ve,{htmlFor:`color-${z}`,className:"text-sm font-medium",children:z.replace(/([A-Z])/g," $1").replace(/^./,q=>q.toUpperCase())}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"w-10 h-10 rounded border border-border cursor-pointer",style:{backgroundColor:X},onClick:()=>{document.getElementById(`color-${z}`)?.click()}}),e.jsx(me,{id:`color-${z}`,type:"color",value:X,onChange:q=>P(z,q.target.value),className:"flex-1 h-10"})]})]},z))})})]})})]}),c&&e.jsxs(Be,{children:[e.jsx(rt,{children:e.jsxs(Ge,{className:"flex items-center gap-2",children:[e.jsx(S.Eye,{className:"h-5 w-5"}),"Prévisualisation en temps réel"]})}),e.jsx(st,{children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Boutons"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(G,{size:"sm",children:"Primary"}),e.jsx(G,{variant:"secondary",size:"sm",children:"Secondary"}),e.jsx(G,{variant:"outline",size:"sm",children:"Outline"}),e.jsx(G,{variant:"destructive",size:"sm",children:"Destructive"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Cards"}),e.jsxs(Be,{className:"p-3",children:[e.jsx(Ge,{className:"text-sm",children:"Exemple de carte"}),e.jsx(Et,{className:"text-xs",children:"Contenu de la carte avec le nouveau thème"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Inputs"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{placeholder:"Input normal"}),e.jsx(me,{placeholder:"Input avec erreur",className:"border-destructive"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Badges"}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsx(Pe,{children:"Default"}),e.jsx(Pe,{variant:"secondary",children:"Secondary"}),e.jsx(Pe,{variant:"destructive",children:"Destructive"}),e.jsx(Pe,{variant:"outline",children:"Outline"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Séparateur"}),e.jsx(pt,{}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Texte avec couleur muted"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Progress"}),e.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:e.jsx("div",{className:"bg-primary h-2 rounded-full",style:{width:"60%"}})})]})]})})]})]})})});qi.displayName="WakaThemeManager";const Bi=({discoveryUrl:t,onRealmSelected:a,loginButtonText:r="Se connecter",emailPlaceholder:s="Entrez votre email",modalTitle:n="Sélectionnez votre organisation",modalDescription:i="Plusieurs organisations ont été trouvées pour votre email",onError:c,disabled:l=!1,className:o=""})=>{const[d,u]=k.useState(""),[f,p]=k.useState(!1),[g,y]=k.useState(!1),[j,A]=k.useState([]),[x,h]=k.useState(null),[b,w]=k.useState(null),E=C=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(C),v=async()=>{if(!d.trim()){w("L'email est requis");return}if(!E(d)){w("Format d'email invalide");return}w(null),h(null),p(!0);try{const C=new URL(t);C.searchParams.append("email",d);const T=await fetch(C.toString());if(!T.ok)throw new Error(`Erreur HTTP: ${T.status}`);const M=await T.json();if(!M.realms||M.realms.length===0){h("Aucune organisation trouvée pour cet email");return}if(M.realms.length===1){a(M.realms[0],d);return}A(M.realms),y(!0)}catch(C){const T=C instanceof Error?C.message:"Erreur lors de la découverte des organisations";h(T),c?.(C instanceof Error?C:new Error(T))}finally{p(!1)}},$=C=>{y(!1),a(C,d)},D=C=>{C.key==="Enter"&&!l&&!f&&v()};return e.jsxs("div",{className:`space-y-4 ${o}`,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{type:"email",placeholder:s,value:d,onChange:C=>{u(C.target.value),w(null),h(null)},onKeyPress:D,disabled:l||f,className:b?"border-destructive":""}),b&&e.jsx("p",{className:"text-sm text-destructive",children:b})]}),e.jsx(G,{onClick:v,disabled:l||f||!d.trim(),className:"w-full",children:f?e.jsxs(e.Fragment,{children:[e.jsx(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Recherche en cours..."]}):e.jsxs(e.Fragment,{children:[e.jsx(S.LogIn,{className:"mr-2 h-4 w-4"}),r]})}),x&&e.jsxs(us,{variant:"destructive",children:[e.jsx(S.AlertCircle,{className:"h-4 w-4"}),e.jsx(ms,{children:x})]}),e.jsx(Nr,{open:g,onOpenChange:y,children:e.jsxs(Oa,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Cr,{children:[e.jsx(kr,{children:n}),e.jsx(Sr,{children:i})]}),e.jsx("div",{className:"grid gap-4 py-4",children:j.map((C,T)=>e.jsxs(Be,{className:"cursor-pointer hover:shadow-lg transition-shadow border-2 hover:border-primary",onClick:()=>$(C),children:[e.jsx(rt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(S.Building2,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx(Ge,{className:"text-lg",children:C.displayName||C.name}),C.description&&e.jsx(Et,{className:"mt-1",children:C.description})]})]})}),C.url&&e.jsx(st,{children:e.jsx("p",{className:"text-sm text-muted-foreground",children:C.url})})]},C.name||T))})]})})]})};Bi.displayName="WakaKeycloakLogin";function ne(...t){return On.clsx(t)}function Gi(t,a="export.csv"){if(!t||t.length===0)return;const r=Object.keys(t[0]),s=[r.join(","),...t.map(c=>r.map(l=>{const o=c[l];return typeof o=="string"&&(o.includes(",")||o.includes('"')||o.includes(`
|
|
68
|
-
`))?`"${o.replace(/"/g,'""')}"`:o}).join(","))].join(`
|
|
69
|
-
`),n=new Blob([s],{type:"text/csv;charset=utf-8;"}),i=document.createElement("a");i.href=URL.createObjectURL(n),i.download=a,i.click(),URL.revokeObjectURL(i.href)}function Xi(t,a="export.json"){const r=JSON.stringify(t,null,2),s=new Blob([r],{type:"application/json;charset=utf-8;"}),n=document.createElement("a");n.href=URL.createObjectURL(s),n.download=a,n.click(),URL.revokeObjectURL(n.href)}async function Dg(t){return new Promise((a,r)=>{const s=new FileReader;s.onload=n=>{try{const c=(n.target?.result).split(`
|
|
70
|
-
`).filter(d=>d.trim());if(c.length===0){a([]);return}const l=c[0].split(",").map(d=>d.trim().replace(/^"|"$/g,"")),o=c.slice(1).map(d=>{const u=d.split(",").map(p=>p.trim().replace(/^"|"$/g,"")),f={};return l.forEach((p,g)=>{f[p]=u[g]||""}),f});a(o)}catch(i){r(i)}},s.onerror=()=>r(s.error),s.readAsText(t)})}function Ki(t,a){try{localStorage.setItem(`datatable_${t}`,JSON.stringify(a))}catch(r){console.warn("[DataTable] Failed to save state:",r)}}function Yi(t){try{const a=localStorage.getItem(`datatable_${t}`);return a?JSON.parse(a):null}catch(a){return console.warn("[DataTable] Failed to load state:",a),null}}function Ag(t,a,r){const s=r.toLowerCase();return Object.values(t).some(n=>n==null?!1:String(n).toLowerCase().includes(s))}function Ji({data:t,columns:a,pagination:r,tableId:s,onSortingChange:n,onFiltersChange:i,onSelectionChange:c}){const l=k.useMemo(()=>s?Yi(s):null,[s]),[o,d]=k.useState(l?.sorting||[]),[u,f]=k.useState(l?.columnFilters||[]),[p,g]=k.useState(l?.columnVisibility||{}),[y,j]=k.useState({}),[A,x]=k.useState(l?.globalFilter||""),[h,b]=k.useState({pageIndex:r?.currentPage||0,pageSize:r?.pageSize||10});k.useEffect(()=>{s&&Ki(s,{sorting:o,columnFilters:u,columnVisibility:p,globalFilter:A})},[s,o,u,p,A]),k.useEffect(()=>{n?.(o)},[o,n]),k.useEffect(()=>{i?.(u)},[u,i]),k.useEffect(()=>{const C=w.getFilteredSelectedRowModel().rows.map(T=>T.original);c?.(C)},[y]);const w=ge.useReactTable({data:t,columns:a,state:{sorting:o,columnFilters:u,columnVisibility:p,rowSelection:y,globalFilter:A,pagination:h},enableRowSelection:!0,onRowSelectionChange:j,onSortingChange:d,onColumnFiltersChange:f,onColumnVisibilityChange:g,onGlobalFilterChange:x,onPaginationChange:b,getCoreRowModel:ge.getCoreRowModel(),getFilteredRowModel:ge.getFilteredRowModel(),getPaginationRowModel:ge.getPaginationRowModel(),getSortedRowModel:ge.getSortedRowModel(),globalFilterFn:Ag,manualPagination:r?.mode==="server",pageCount:r?.mode==="server"?Math.ceil((r.totalItems||0)/h.pageSize):void 0}),E=k.useMemo(()=>w.getFilteredSelectedRowModel().rows.map(C=>C.original),[w,y]),v=k.useCallback(()=>{f([]),x("")},[]),$=k.useCallback(()=>{j({})},[]),D=k.useCallback(()=>w.getFilteredRowModel().rows.map(C=>C.original),[w]);return{table:w,sorting:o,setSorting:d,columnFilters:u,setColumnFilters:f,columnVisibility:p,setColumnVisibility:g,rowSelection:y,setRowSelection:j,globalFilter:A,setGlobalFilter:x,pagination:h,setPagination:b,selectedRows:E,resetFilters:v,resetSelection:$,exportData:D}}function $s(t="standard",a="comfortable"){const[r,s]=k.useState(t),[n,i]=k.useState(a),[c,l]=k.useState(!1);k.useEffect(()=>{const f=()=>{l(window.innerWidth<768)};return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[]),k.useEffect(()=>{c&&r==="standard"&&s("card")},[c,r]);const o=k.useCallback(()=>{s(f=>{switch(f){case"standard":return"card";case"card":return"compact";case"compact":return"standard";default:return"standard"}})},[]),d=k.useCallback(()=>{i(f=>f==="comfortable"?"compact":"comfortable")},[]);return{layout:r,setLayout:s,density:n,setDensity:i,toggleLayout:o,toggleDensity:d,isMobile:c,densityClasses:{comfortable:{table:"text-sm",cell:"px-4 py-3",header:"px-4 py-3"},compact:{table:"text-xs",cell:"px-2 py-1.5",header:"px-2 py-2"},spacious:{table:"text-base",cell:"px-6 py-4",header:"px-6 py-4"}}[n]}}function Os(t,a={}){const{onSave:r,onCancel:s,validateField:n,autoSave:i=!1,autoSaveDelay:c=2e3}=a,[l,o]=k.useState(null),[d,u]=k.useState({}),[f,p]=k.useState(null),[g,y]=k.useState({}),[j,A]=k.useState(!1),x=k.useMemo(()=>!f||!l?!1:Object.keys(d).some(M=>{const R=M;return d[R]!==f[R]}),[d,f,l]),h=x&&l!==null,b=k.useCallback((M,R)=>{o(M),u({...R}),p(R),y({})},[]),w=k.useCallback(()=>{!l||!f||(s?.(l,f),o(null),u({}),p(null),y({}))},[l,f,s]),E=k.useCallback((M,R)=>{if(l){if(n){const I=n(M,R);if(I){y(U=>({...U,[M]:I}));return}else y(U=>{const O={...U};return delete O[M],O})}u(I=>({...I,[M]:R}))}},[l,n]),v=k.useCallback(async()=>{if(!(!l||!r||j)){if(Object.keys(g).length>0)throw new Error("Validation errors present");A(!0);try{await r(l,d),o(null),u({}),p(null),y({})}catch(M){throw console.error("Error saving edit:",M),M}finally{A(!1)}}},[l,r,d,g,j]),$=k.useCallback(()=>{f&&(u({...f}),y({}))},[f]),D=k.useMemo(()=>!i||!h?null:setTimeout(()=>{h&&!j&&v().catch(console.error)},c),[i,h,j,v,c]);return k.useEffect(()=>()=>{D&&clearTimeout(D)},[D]),[{editingRowId:l,editedData:d,hasChanges:x,isDirty:h},{startEdit:b,cancelEdit:w,saveEdit:v,updateField:E,resetEdit:$}]}function Fa({table:t,config:a,globalFilter:r,onGlobalFilterChange:s,density:n,onDensityChange:i,onExport:c,onImport:l}){const{t:o}=Je.useTranslation(),d=m.useRef(null),u=t.getFilteredSelectedRowModel().rows,f=u.length>0,p=m.useMemo(()=>a?.actions?a.actions.filter(j=>!(j.requiresSelection&&!f)):[],[a?.actions,f]),g=j=>{const A=f?u.map(x=>x.original):t.getFilteredRowModel().rows.map(x=>x.original);c?c(j):j==="csv"?Gi(A,"export.csv"):Xi(A,"export.json")},y=j=>{const A=j.target.files?.[0];A&&l&&l(A),d.current&&(d.current.value="")};return e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 p-4 border-b",children:[e.jsxs("div",{className:"flex flex-1 flex-col sm:flex-row items-start sm:items-center gap-2 w-full sm:w-auto",children:[a?.showSearch!==!1&&e.jsxs("div",{className:"relative w-full sm:w-64",children:[e.jsx(S.Search,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(me,{placeholder:o("datatable.toolbar.search",{defaultValue:"Search..."}),value:r??"",onChange:j=>s(j.target.value),className:"pl-8 h-9"}),r&&e.jsx("button",{onClick:()=>s(""),className:"absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",children:e.jsx(S.X,{className:"h-4 w-4"})})]}),f&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[u.length," ",o("datatable.toolbar.selected",{defaultValue:"selected"})]}),e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>t.resetRowSelection(),className:"h-7 px-2",children:o("datatable.toolbar.clear",{defaultValue:"Clear"})})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[p.map(j=>e.jsxs(G,{variant:j.variant||"outline",size:"sm",onClick:()=>j.onClick(u.map(A=>A.original)),disabled:j.disabled,className:"h-9",children:[j.icon,e.jsx("span",{className:"ml-2",children:j.label})]},j.id)),a?.showRefresh&&e.jsxs(G,{variant:"outline",size:"icon",onClick:a.onRefresh,className:"h-9 w-9",children:[e.jsx(S.RefreshCw,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:o("datatable.toolbar.refresh",{defaultValue:"Refresh"})})]}),c&&e.jsxs(Gt,{children:[e.jsx(Xt,{asChild:!0,children:e.jsxs(G,{variant:"outline",size:"icon",className:"h-9 w-9",children:[e.jsx(S.Download,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:o("datatable.toolbar.export",{defaultValue:"Export"})})]})}),e.jsxs(Lt,{align:"end",children:[e.jsx(Ta,{children:o("datatable.toolbar.exportAs",{defaultValue:"Export as"})}),e.jsx(na,{}),e.jsx(Bt,{onClick:()=>g("csv"),children:"CSV"}),e.jsx(Bt,{onClick:()=>g("json"),children:"JSON"})]})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:d,type:"file",accept:".csv,.json",onChange:y,className:"hidden"}),e.jsxs(G,{variant:"outline",size:"icon",onClick:()=>d.current?.click(),className:"h-9 w-9",children:[e.jsx(S.Upload,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:o("datatable.toolbar.import",{defaultValue:"Import"})})]})]}),a?.showColumnToggle!==!1&&e.jsxs(Gt,{children:[e.jsx(Xt,{asChild:!0,children:e.jsxs(G,{variant:"outline",size:"icon",className:"h-9 w-9",children:[e.jsx(S.Columns,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:o("datatable.toolbar.columns",{defaultValue:"Columns"})})]})}),e.jsxs(Lt,{align:"end",className:"w-48",children:[e.jsx(Ta,{children:o("datatable.toolbar.toggleColumns",{defaultValue:"Toggle columns"})}),e.jsx(na,{}),t.getAllColumns().filter(j=>j.getCanHide()).map(j=>e.jsx(Bt,{className:"capitalize",checked:j.getIsVisible(),onCheckedChange:A=>j.toggleVisibility(!!A),children:j.id},j.id))]})]}),a?.showDensity&&i&&e.jsxs(Gt,{children:[e.jsx(Xt,{asChild:!0,children:e.jsxs(G,{variant:"outline",size:"icon",className:"h-9 w-9",children:[e.jsx(S.SlidersHorizontal,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:o("datatable.toolbar.density",{defaultValue:"Density"})})]})}),e.jsxs(Lt,{align:"end",children:[e.jsx(Ta,{children:o("datatable.toolbar.tableDensity",{defaultValue:"Table density"})}),e.jsx(na,{}),e.jsx(Bt,{checked:n==="comfortable",onCheckedChange:()=>i("comfortable"),children:o("datatable.toolbar.comfortable",{defaultValue:"Comfortable"})}),e.jsx(Bt,{checked:n==="compact",onCheckedChange:()=>i("compact"),children:o("datatable.toolbar.compact",{defaultValue:"Compact"})})]})]})]})]})}function _s({table:t,pageSizeOptions:a=[25,50,100,500],showInfo:r=!0}){const{t:s}=Je.useTranslation(),n=t.getState().pagination.pageIndex,i=t.getState().pagination.pageSize,c=t.getPageCount(),l=t.getFilteredRowModel().rows.length,o=n*i+1,d=Math.min((n+1)*i,l);return e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[r&&e.jsx("div",{className:"text-sm text-muted-foreground",children:l>0?e.jsxs(e.Fragment,{children:[s("datatable.pagination.showing",{defaultValue:"Showing"})," ",o," ",s("datatable.pagination.to",{defaultValue:"to"})," ",d," ",s("datatable.pagination.of",{defaultValue:"of"})," ",l," ",s("datatable.pagination.results",{defaultValue:"results"})]}):s("datatable.pagination.noResults",{defaultValue:"No results"})}),e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:s("datatable.pagination.rowsPerPage",{defaultValue:"Rows per page"})}),e.jsxs(ot,{value:`${i}`,onValueChange:u=>{t.setPageSize(Number(u))},children:[e.jsx(Xe,{className:"h-8 w-[70px]",children:e.jsx(it,{placeholder:i})}),e.jsx(Ke,{side:"top",children:a.map(u=>e.jsx(Oe,{value:`${u}`,children:u},u))})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"text-sm text-muted-foreground mr-2",children:[s("datatable.pagination.page",{defaultValue:"Page"})," ",n+1," ",s("datatable.pagination.of",{defaultValue:"of"})," ",c]}),e.jsxs(G,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>t.setPageIndex(0),disabled:!t.getCanPreviousPage(),children:[e.jsx(S.ChevronsLeft,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:s("datatable.pagination.firstPage",{defaultValue:"First page"})})]}),e.jsxs(G,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>t.previousPage(),disabled:!t.getCanPreviousPage(),children:[e.jsx(S.ChevronLeft,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:s("datatable.pagination.previousPage",{defaultValue:"Previous page"})})]}),e.jsxs(G,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>t.nextPage(),disabled:!t.getCanNextPage(),children:[e.jsx(S.ChevronRight,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:s("datatable.pagination.nextPage",{defaultValue:"Next page"})})]}),e.jsxs(G,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>t.setPageIndex(c-1),disabled:!t.getCanNextPage(),children:[e.jsx(S.ChevronsRight,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:s("datatable.pagination.lastPage",{defaultValue:"Last page"})})]})]})]})]})}const Rg=t=>{if(t==null)return"";if(t instanceof Date)return t.toLocaleDateString();if(Array.isArray(t))return t.map(a=>String(a)).join(", ");if(typeof t=="object"){const a=t;return"min"in a||"max"in a?`${a.min??""} - ${a.max??""}`:"from"in a||"to"in a?`${a.from??""} - ${a.to??""}`:JSON.stringify(t)}return String(t)};function zs({table:t,filters:a,position:r="top",onFiltersChange:s}){const{t:n}=Je.useTranslation(),[i,c]=m.useState([]),[l,o]=m.useState(!1),d=m.useCallback(x=>{const h=t.getPreFilteredRowModel().rows,b=new Set;return h.forEach(w=>{const E=w.getValue(x);E!=null&&E!==""&&b.add(String(E))}),Array.from(b).sort()},[t]),u={text:[{value:"contains",label:n("datatable.filters.contains",{defaultValue:"Contains"})},{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})},{value:"startsWith",label:n("datatable.filters.startsWith",{defaultValue:"Starts with"})},{value:"endsWith",label:n("datatable.filters.endsWith",{defaultValue:"Ends with"})},{value:"notContains",label:n("datatable.filters.notContains",{defaultValue:"Not contains"})}],select:[{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})},{value:"notEquals",label:n("datatable.filters.notEquals",{defaultValue:"Not equals"})}],multiselect:[{value:"in",label:n("datatable.filters.in",{defaultValue:"In"})},{value:"notIn",label:n("datatable.filters.notIn",{defaultValue:"Not in"})}],range:[{value:"between",label:n("datatable.filters.between",{defaultValue:"Between"})},{value:"greaterThan",label:n("datatable.filters.greaterThan",{defaultValue:"Greater than"})},{value:"lessThan",label:n("datatable.filters.lessThan",{defaultValue:"Less than"})}],date:[{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})},{value:"before",label:n("datatable.filters.before",{defaultValue:"Before"})},{value:"after",label:n("datatable.filters.after",{defaultValue:"After"})},{value:"between",label:n("datatable.filters.between",{defaultValue:"Between"})}],daterange:[{value:"between",label:n("datatable.filters.between",{defaultValue:"Between"})},{value:"before",label:n("datatable.filters.before",{defaultValue:"Before"})},{value:"after",label:n("datatable.filters.after",{defaultValue:"After"})}],checkbox:[{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})}],number:[{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})},{value:"notEquals",label:n("datatable.filters.notEquals",{defaultValue:"Not equals"})},{value:"greaterThan",label:n("datatable.filters.greaterThan",{defaultValue:"Greater than"})},{value:"lessThan",label:n("datatable.filters.lessThan",{defaultValue:"Less than"})},{value:"between",label:n("datatable.filters.between",{defaultValue:"Between"})}],boolean:[{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})},{value:"notEquals",label:n("datatable.filters.notEquals",{defaultValue:"Not equals"})}]},f=(x,h,b)=>{const w=x.column||x.id,E=t.getColumn(w);if(!E)return;const v={id:w,columnId:w,operator:h,value:b,label:x.label};c(C=>[...C,v]),E.setFilterValue({operator:h,value:b});const D=[...i,v].map(C=>({id:C.id,value:C.value}));s?.(D)},p=x=>{const h=i[x],b=t.getColumn(h.columnId);b&&b.setFilterValue(void 0);const w=i.filter((v,$)=>$!==x);c(w);const E=w.map(v=>({id:v.id,value:v.value}));s?.(E)},g=()=>{i.forEach(x=>{const h=t.getColumn(x.columnId);h&&h.setFilterValue(void 0)}),c([]),s?.([])},y=x=>{const[h,b]=m.useState(u[x.type]?.[0]?.value||"equals"),[w,E]=m.useState(typeof x.defaultValue=="string"?x.defaultValue:""),[v,$]=m.useState(x.type==="range"&&x.defaultValue&&typeof x.defaultValue=="object"?x.defaultValue:{min:"",max:""}),[D,C]=m.useState(x.type==="daterange"&&x.defaultValue&&typeof x.defaultValue=="object"?x.defaultValue:{from:"",to:""}),[T,M]=m.useState(typeof x.defaultValue=="boolean"?x.defaultValue:!1),[R,I]=m.useState([]),[U,O]=m.useState(!1),W=x.column?d(x.column):[],F=()=>{switch(x.type){case"multiselect":return R;case"range":return v;case"daterange":return D;case"checkbox":case"boolean":return T;default:return w}},L=()=>{E(""),$({min:"",max:""}),C({from:"",to:""}),M(!1),I([]),O(!1)},_=()=>{const P=F();let V=!1;x.type==="multiselect"?V=R.length>0:x.type==="range"?V=v.min!==""||v.max!=="":x.type==="daterange"?V=D.from!==""||D.to!=="":x.type==="checkbox"||x.type==="boolean"?V=!0:V=w!=="",V&&(f(x,h,P),L())};return e.jsxs("div",{className:"space-y-3 p-4 border rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(ve,{className:"text-sm font-medium",children:x.label}),e.jsx(Pe,{variant:"outline",className:"text-xs",children:x.type})]}),u[x.type]&&u[x.type].length>1&&e.jsxs(ot,{value:h,onValueChange:b,children:[e.jsx(Xe,{className:"h-9",children:e.jsx(it,{})}),e.jsx(Ke,{children:u[x.type].map(P=>e.jsx(Oe,{value:P.value,children:P.label},P.value))})]}),x.type==="text"&&e.jsx("div",{className:"space-y-2",children:e.jsxs(lt,{open:U,onOpenChange:O,children:[e.jsx(ct,{asChild:!0,children:e.jsx(me,{placeholder:x.placeholder||n("datatable.filters.enterValue",{defaultValue:"Enter value..."}),value:w,onChange:P=>{E(P.target.value),O(!0)},className:"h-9"})}),W.length>0&&w&&e.jsx(Ye,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(Kt,{children:[e.jsx(ca,{placeholder:n("datatable.filters.search",{defaultValue:"Search..."})}),e.jsx(da,{children:n("datatable.filters.noResults",{defaultValue:"No results"})}),e.jsx(Yt,{className:"max-h-64 overflow-auto",children:W.filter(P=>P.toLowerCase().includes(w.toLowerCase())).slice(0,50).map(P=>e.jsx(Jt,{onSelect:()=>{E(P),O(!1)},children:P},P))})]})})]})}),x.type==="select"&&e.jsxs(ot,{value:w,onValueChange:E,children:[e.jsx(Xe,{className:"h-9",children:e.jsx(it,{placeholder:x.placeholder})}),e.jsx(Ke,{children:(x.options||W.map(P=>({label:P,value:P}))).map(P=>e.jsx(Oe,{value:String(P.value),children:P.label},P.value))})]}),x.type==="multiselect"&&e.jsxs(lt,{children:[e.jsx(ct,{asChild:!0,children:e.jsxs(G,{variant:"outline",className:"w-full justify-between h-9",children:[R.length>0?`${R.length} ${n("datatable.filters.selected",{defaultValue:"selected"})}`:x.placeholder||n("datatable.filters.selectValues",{defaultValue:"Select values..."}),e.jsx(S.ChevronDown,{className:"ml-2 h-4 w-4 opacity-50"})]})}),e.jsx(Ye,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(Kt,{children:[e.jsx(ca,{placeholder:n("datatable.filters.search",{defaultValue:"Search..."})}),e.jsx(da,{children:n("datatable.filters.noResults",{defaultValue:"No results"})}),e.jsx(Yt,{className:"max-h-64 overflow-auto",children:W.map(P=>e.jsxs(Jt,{onSelect:()=>{I(V=>V.includes(P)?V.filter(z=>z!==P):[...V,P])},children:[e.jsx(yt,{checked:R.includes(P),className:"mr-2"}),P]},P))})]})})]}),x.type==="date"&&e.jsx(me,{type:"date",value:w,onChange:P=>E(P.target.value),className:"h-9"}),x.type==="range"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(me,{type:"number",placeholder:"Min",value:v.min??"",onChange:P=>$({...v,min:P.target.value}),className:"h-9"}),e.jsx(me,{type:"number",placeholder:"Max",value:v.max??"",onChange:P=>$({...v,max:P.target.value}),className:"h-9"})]}),x.type==="daterange"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(me,{type:"date",placeholder:n("datatable.filters.from",{defaultValue:"From"}),value:typeof D.from=="string"?D.from:"",onChange:P=>C({...D,from:P.target.value}),className:"h-9"}),e.jsx(me,{type:"date",placeholder:n("datatable.filters.to",{defaultValue:"To"}),value:typeof D.to=="string"?D.to:"",onChange:P=>C({...D,to:P.target.value}),className:"h-9"})]}),x.type==="checkbox"&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(yt,{id:`checkbox-${x.id}`,checked:T,onCheckedChange:P=>M(P===!0)}),e.jsx(ve,{htmlFor:`checkbox-${x.id}`,className:"text-sm font-normal",children:x.placeholder||n("datatable.filters.checked",{defaultValue:"Checked"})})]}),e.jsxs(G,{onClick:_,size:"sm",className:"w-full",children:[e.jsx(S.Plus,{className:"h-4 w-4 mr-2"}),n("datatable.filters.apply",{defaultValue:"Apply filter"})]})]})};if(!a||a.length===0)return null;const j=e.jsxs("div",{className:"space-y-4",children:[i.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(ve,{className:"text-sm text-muted-foreground",children:n("datatable.filters.active",{defaultValue:"Filtres actifs"})}),e.jsxs(G,{variant:"ghost",size:"sm",onClick:g,children:[e.jsx(S.Trash2,{className:"h-3 w-3 mr-1"}),n("datatable.filters.clearAll",{defaultValue:"Tout effacer"})]})]}),e.jsx("div",{className:"space-y-1",children:i.map((x,h)=>e.jsxs("div",{className:"flex items-center justify-between p-2 bg-muted rounded-md text-sm",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"font-medium",children:x.label}),e.jsx("span",{className:"text-muted-foreground mx-2",children:x.operator}),e.jsx("span",{className:"text-primary truncate",children:Rg(x.value)})]}),e.jsx(G,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:()=>p(h),children:e.jsx(S.X,{className:"h-3 w-3"})})]},h))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(ve,{className:"text-sm text-muted-foreground",children:n("datatable.filters.available",{defaultValue:"Filtres disponibles"})}),a.map(x=>e.jsx("div",{children:y(x)},x.id))]})]}),A=e.jsxs(G,{variant:"outline",size:"sm",children:[e.jsx(S.Filter,{className:"h-4 w-4 mr-2"}),n("datatable.filters.title",{defaultValue:"Filtres"}),i.length>0&&e.jsx(Pe,{variant:"secondary",className:"ml-2",children:i.length})]});return r==="right"||r==="left"?e.jsxs(Wa,{open:l,onOpenChange:o,children:[e.jsx(Es,{asChild:!0,children:A}),e.jsxs(ma,{side:r,className:"w-[400px] sm:w-[540px] overflow-y-auto",children:[e.jsxs(Dr,{children:[e.jsxs(Ar,{className:"flex items-center gap-2",children:[e.jsx(S.Filter,{className:"h-5 w-5"}),n("datatable.filters.title",{defaultValue:"Filtres"})]}),e.jsx(Rr,{children:n("datatable.filters.description",{defaultValue:"Appliquez des filtres pour affiner les résultats"})})]}),e.jsx("div",{className:"mt-6",children:j})]})]}):e.jsxs(lt,{open:l,onOpenChange:o,children:[e.jsx(ct,{asChild:!0,children:A}),e.jsx(Ye,{className:"w-[400px] max-h-[600px] overflow-y-auto",align:r==="top"?"start":"end",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S.Filter,{className:"h-4 w-4"}),e.jsx("h4",{className:"font-semibold text-sm",children:n("datatable.filters.title",{defaultValue:"Filtres"})})]})}),j]})})]})}function Zt({value:t,field:a,config:r,isEditing:s,error:n,onChange:i,onStartEdit:c,onSave:l,onCancel:o,className:d}){const[u,f]=m.useState(t),[p,g]=m.useState(!1);m.useEffect(()=>{f(t)},[t]);const y=()=>{i(u),l()},j=()=>{f(t),o()},A=h=>{h.key==="Enter"&&!h.shiftKey?(h.preventDefault(),y()):h.key==="Escape"&&(h.preventDefault(),j())};if(!s)return e.jsx("div",{className:ne("cursor-pointer hover:bg-muted/50 p-1 rounded transition-colors",d),onClick:c,children:Pg(t,r)});const x=()=>{switch(r.type){case"textarea":return e.jsx(fa,{value:u||"",onChange:h=>f(h.target.value),onKeyDown:A,placeholder:r.placeholder,rows:r.rows||3,disabled:r.disabled,className:ne(n&&"border-destructive","pr-16")});case"select":return e.jsxs(ot,{value:u||"",onValueChange:f,disabled:r.disabled,children:[e.jsx(Xe,{className:ne(n&&"border-destructive","pr-16"),children:e.jsx(it,{placeholder:r.placeholder})}),e.jsx(Ke,{children:r.options?.map(h=>e.jsx(Oe,{value:h.value,children:h.label},h.value))})]});case"checkbox":return e.jsx("div",{className:"flex items-center h-9 px-2",children:e.jsx(yt,{checked:!!u,onCheckedChange:f,disabled:r.disabled})});case"switch":return e.jsx("div",{className:"flex items-center h-9 px-2",children:e.jsx(Pr,{checked:!!u,onCheckedChange:f,disabled:r.disabled})});case"date":case"datetime":return e.jsxs(lt,{open:p,onOpenChange:g,children:[e.jsx(ct,{asChild:!0,children:e.jsxs(G,{variant:"outline",className:ne("w-full justify-start text-left font-normal pr-16",!u&&"text-muted-foreground",n&&"border-destructive"),children:[e.jsx(S.CalendarIcon,{className:"mr-2 h-4 w-4"}),u?H.format(new Date(u),"PPP"):r.placeholder]})}),e.jsx(Ye,{className:"w-auto p-0",align:"start",children:e.jsx(fs,{mode:"single",selected:u?new Date(u):void 0,onSelect:h=>{h&&(f(r.type==="datetime"?h.toISOString():h.toISOString().split("T")[0]),g(!1))},initialFocus:!0})})]});default:return e.jsx(me,{type:r.type,value:u||"",onChange:h=>f(h.target.value),onKeyDown:A,placeholder:r.placeholder,min:r.min,max:r.max,step:r.step,disabled:r.disabled,required:r.required,pattern:r.pattern,title:r.title,className:ne(n&&"border-destructive","pr-16")})}};return e.jsxs("div",{className:ne("relative",d),children:[x(),e.jsxs("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex gap-1",children:[e.jsx(G,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:y,children:e.jsx(S.Check,{className:"h-3 w-3 text-green-600"})}),e.jsx(G,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:j,children:e.jsx(S.X,{className:"h-3 w-3 text-red-600"})})]}),n&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:n})]})}function Pg(t,a){if(t==null)return e.jsx("span",{className:"text-muted-foreground italic",children:"Non défini"});switch(a.type){case"checkbox":case"switch":return e.jsx("span",{className:ne("inline-flex items-center px-2 py-1 rounded-full text-xs font-medium",t?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"),children:t?"Oui":"Non"});case"date":case"datetime":try{const s=new Date(t);return H.format(s,a.type==="datetime"?"PPP p":"PPP")}catch{return t}case"select":const r=a.options?.find(s=>s.value===t);return r?r.label:t;case"textarea":return e.jsx("div",{className:"max-w-xs",children:e.jsx("p",{className:"truncate",children:t})});default:return t}}function Mg({data:t,columns:a,layout:r="standard",variant:s="bordered",density:n="comfortable",filters:i,filterPosition:c="top",toolbar:l,pagination:o,selection:d=!1,actions:u,i18nNamespace:f,loading:p=!1,error:g,emptyState:y,headerSticky:j=!1,columnVisibilityToggle:A=!0,columnResize:x=!1,enableExport:h=!1,enableImport:b=!1,enableReorder:w=!1,enableContextMenu:E=!1,onRowClick:v,onRowDoubleClick:$,onSortingChange:D,onFiltersChange:C,onSelectionChange:T,className:M,tableId:R,virtualization:I,edit:U}){const{t:O}=Je.useTranslation(f),{layout:W,setLayout:F,density:L,setDensity:_,densityClasses:P}=$s(r,n),V=m.useMemo(()=>{const xe=[...a];if(d){const pe={id:"select",header:({table:ye})=>e.jsx(yt,{checked:ye.getIsAllPageRowsSelected(),onCheckedChange:Te=>ye.toggleAllPageRowsSelected(!!Te),"aria-label":O("datatable.selectAll",{defaultValue:"Select all"})}),cell:({row:ye})=>e.jsx(yt,{checked:ye.getIsSelected(),onCheckedChange:Te=>ye.toggleSelected(!!Te),"aria-label":O("datatable.selectRow",{defaultValue:"Select row"})}),enableSorting:!1,enableHiding:!1};xe.unshift(pe)}return xe},[a,d,U,O]),{table:z,globalFilter:X,setGlobalFilter:q,selectedRows:B,resetFilters:J,exportData:Q}=Ji({data:t,columns:V,pagination:o,tableId:R,onSortingChange:D,onFiltersChange:C,onSelectionChange:T}),[te,ee]=Os(z,{onSave:U?.onSave,onCancel:U?.onCancel,autoSave:U?.autoSave,autoSaveDelay:U?.autoSaveDelay});if(U?.editableColumns&&U.editableColumns.length>0){const xe={id:"edit-actions",header:()=>O("datatable.actions",{defaultValue:"Actions"}),cell:({row:pe})=>te.editingRowId===pe.id?e.jsxs("div",{className:"flex gap-1",children:[e.jsx(G,{size:"sm",variant:"ghost",onClick:()=>ee.saveEdit(),disabled:!te.hasChanges,children:O("datatable.save",{defaultValue:"Save"})}),e.jsx(G,{size:"sm",variant:"ghost",onClick:()=>ee.cancelEdit(),children:O("datatable.cancel",{defaultValue:"Cancel"})})]}):e.jsx(G,{size:"sm",variant:"ghost",onClick:()=>{le.debug("🔧 Starting edit for row:",pe.id,pe.original),ee.startEdit(pe.id,pe.original)},children:O("datatable.edit",{defaultValue:"Edit"})}),enableSorting:!1,enableHiding:!1};V.push(xe)}const ue=m.useCallback(xe=>{const pe=Q();le.debug("Export",xe,pe)},[Q]),Y=m.useCallback(xe=>{le.debug("Import",xe)},[]),K={bordered:"border rounded-lg",minimal:"",striped:"[&_tbody_tr:nth-child(even)]:bg-muted/50",glass:"backdrop-blur-sm bg-background/80 border rounded-lg"};if(p)return e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(S.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:O("datatable.loading",{defaultValue:"Loading..."})})]})});if(g)return e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg bg-destructive/10",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-destructive",children:[e.jsx(S.AlertCircle,{className:"h-8 w-8"}),e.jsx("p",{className:"text-sm font-medium",children:g})]})});if(!t||t.length===0)return e.jsxs("div",{className:"flex flex-col",children:[l&&e.jsx(Fa,{table:z,config:l,globalFilter:X,onGlobalFilterChange:q,density:L,onDensityChange:_,onExport:h?ue:void 0,onImport:b?Y:void 0}),e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg",children:y||e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx("p",{className:"text-lg font-medium",children:O("datatable.noData",{defaultValue:"No data"})}),e.jsx("p",{className:"text-sm",children:O("datatable.noDataDescription",{defaultValue:"There are no results to display"})})]})})]});const re=()=>{const xe=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l&&e.jsx("div",{className:"flex-1",children:e.jsx(Fa,{table:z,config:l,globalFilter:X,onGlobalFilterChange:q,density:L,onDensityChange:_,onExport:h?ue:void 0,onImport:b?Y:void 0})}),i&&e.jsx(zs,{table:z,filters:i,position:c,onFiltersChange:C})]}),e.jsx("div",{className:ne("w-full overflow-auto",K[s]),children:e.jsxs("table",{className:ne("w-full caption-bottom text-sm",P.table),children:[e.jsx("thead",{className:ne(j&&"sticky top-0 bg-background z-10"),children:z.getHeaderGroups().map(pe=>e.jsx("tr",{className:"border-b",children:pe.headers.map(ye=>e.jsxs("th",{className:ne("text-left font-medium text-muted-foreground",P.header,ye.column.getCanSort()&&"cursor-pointer select-none hover:text-foreground"),onClick:ye.column.getToggleSortingHandler(),children:[ye.isPlaceholder?null:ge.flexRender(ye.column.columnDef.header,ye.getContext()),ye.column.getIsSorted()&&e.jsx("span",{className:"ml-2",children:ye.column.getIsSorted()==="asc"?"↑":"↓"})]},ye.id))},pe.id))}),e.jsx("tbody",{children:z.getRowModel().rows.map(pe=>e.jsx("tr",{className:ne("border-b transition-colors",v&&"cursor-pointer hover:bg-muted/50",pe.getIsSelected()&&"bg-muted"),onClick:()=>v?.(pe.original),onDoubleClick:()=>$?.(pe.original),children:pe.getVisibleCells().map(ye=>{const Te=ye.getValue(),Me=ye.column.id,et=pe.id,Dt=te.editingRowId===et,dt=U?.editableColumns?.find(ut=>ut.field===Me);return dt&&Dt?e.jsx("td",{className:ne("align-middle",P.cell),children:e.jsx(Zt,{value:Te,field:Me,config:dt.config,isEditing:Dt,onChange:ut=>ee.updateField(Me,ut),onStartEdit:()=>ee.startEdit(et,pe.original),onSave:()=>ee.saveEdit(),onCancel:()=>ee.cancelEdit()})},ye.id):e.jsx("td",{className:ne("align-middle",P.cell),children:ge.flexRender(ye.column.columnDef.cell,ye.getContext())},ye.id)})},pe.id))})]})}),o&&e.jsx(_s,{table:z,pageSizeOptions:o.pageSizeOptions})]});return e.jsx("div",{className:"space-y-4",children:xe})};return e.jsx("div",{className:ne("w-full",M),children:re()})}function Qi({data:t,columns:a,pagination:r,tableId:s,onSortingChange:n,onFiltersChange:i,onSelectionChange:c,onColumnOrderChange:l,onExpandedChange:o,onGroupingChange:d,grouping:u,virtualization:f,sortMode:p="multiple",performance:g}){const y=k.useMemo(()=>s?Fg(s):null,[s]),[j,A]=k.useState(y?.sorting||[]),[x,h]=k.useState(y?.columnFilters||[]),[b,w]=k.useState(y?.columnVisibility||{}),[E,v]=k.useState(y?.columnOrder||[]),[$,D]=k.useState(y?.expanded||{}),[C,T]=k.useState(y?.grouping||[]),[M,R]=k.useState(y?.rowSelection||{}),[I,U]=k.useState(y?.globalFilter||""),[O,W]=k.useState({pageIndex:r?.currentPage||0,pageSize:r?.pageSize||10}),[F,L]=k.useState(x);k.useEffect(()=>{const K=setTimeout(()=>{L(x)},g?.filterDebounceMs||300);return()=>clearTimeout(K)},[x,g?.filterDebounceMs]),k.useEffect(()=>{u?.columns&&u.columns.length>0&&C.length===0&&T([u.columns[0]])},[u?.columns,C.length]),k.useEffect(()=>{s&&Ig(s,{sorting:j,columnFilters:x,columnVisibility:b,columnOrder:E,expanded:$,grouping:C,pagination:O,globalFilter:I,density:"comfortable",layout:"standard",rowSelection:M})},[s,j,x,b,E,$,C,O,I,M]),k.useEffect(()=>{n?.(j)},[j,n]),k.useEffect(()=>{i?.(F)},[F,i]),k.useEffect(()=>{const K=_.getFilteredSelectedRowModel().rows.map(re=>re.original);c?.(K)},[M]),k.useEffect(()=>{l?.(E)},[E,l]),k.useEffect(()=>{o?.($)},[$,o]),k.useEffect(()=>{d?.(C)},[C,d]);const _=ge.useReactTable({data:t,columns:a,state:{sorting:j,columnFilters:F,columnVisibility:b,columnOrder:E,expanded:$,grouping:C,rowSelection:M,globalFilter:I,pagination:O},enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0,enableGrouping:!0,groupedColumnMode:"reorder",enableExpanding:!0,getSubRows:K=>K.subRows,enableColumnResizing:!0,columnResizeMode:"onChange",enableSorting:!0,enableMultiSort:p==="multiple",sortDescFirst:!1,enableFilters:!0,enableGlobalFilter:!0,enableColumnFilters:!0,onRowSelectionChange:R,onSortingChange:A,onColumnFiltersChange:h,onColumnVisibilityChange:w,onColumnOrderChange:v,onExpandedChange:D,onGroupingChange:T,onGlobalFilterChange:U,onPaginationChange:W,getCoreRowModel:ge.getCoreRowModel(),getFilteredRowModel:ge.getFilteredRowModel(),getGroupedRowModel:ge.getGroupedRowModel(),getSortedRowModel:ge.getSortedRowModel(),getExpandedRowModel:ge.getExpandedRowModel(),getPaginationRowModel:ge.getPaginationRowModel(),getFacetedRowModel:ge.getFacetedRowModel(),getFacetedUniqueValues:ge.getFacetedUniqueValues(),globalFilterFn:Lg,manualPagination:r?.mode==="server",pageCount:r?.mode==="server"?Math.ceil((r.totalItems||0)/O.pageSize):void 0}),P=k.useMemo(()=>_.getFilteredSelectedRowModel().rows.map(K=>K.original),[_,M]),V=k.useCallback(()=>{h([]),U("")},[]),z=k.useCallback(()=>{R({})},[]),X=k.useCallback(()=>{A([]),h([]),w({}),v([]),D({}),T([]),R({}),U(""),W({pageIndex:0,pageSize:r?.pageSize||10})},[r?.pageSize]),q=k.useCallback(()=>_.getFilteredRowModel().rows.map(K=>K.original),[_]),B=k.useCallback(()=>u?.columns?.length?_.getGroupedRowModel().rows.map(K=>K.original):t,[_,u,t]),J=k.useCallback(()=>_.getExpandedRowModel().rows.map(K=>K.original),[_]),Q=k.useCallback(K=>{T(re=>re.includes(K)?re.filter(pe=>pe!==K):[...re,K])},[]),te=k.useCallback(()=>{T([])},[]),ee=k.useCallback(K=>{D(re=>({...re,[K]:!re[K]}))},[]),ue=k.useCallback(()=>{const K=_.getRowModel().rows.map(xe=>xe.id),re={};K.forEach(xe=>{re[xe]=!0}),D(re)},[_]),Y=k.useCallback(()=>{D({})},[]);return{table:_,sorting:j,setSorting:A,columnFilters:x,setColumnFilters:h,columnVisibility:b,setColumnVisibility:w,columnOrder:E,setColumnOrder:v,expanded:$,setExpanded:D,grouping:C,setGrouping:T,rowSelection:M,setRowSelection:R,globalFilter:I,setGlobalFilter:U,pagination:O,setPagination:W,selectedRows:P,resetFilters:V,resetSelection:z,resetAll:X,exportData:q,getGroupedData:B,getExpandedData:J,toggleGrouping:Q,clearGrouping:te,toggleRowExpansion:ee,expandAll:ue,collapseAll:Y}}function Fg(t){try{const a=localStorage.getItem(`datatable-${t}`);return a?JSON.parse(a):null}catch{return null}}function Ig(t,a){try{localStorage.setItem(`datatable-${t}`,JSON.stringify(a))}catch{}}function Lg(t,a,r){const s=r.toLowerCase();return t.getVisibleCells().some(n=>{const i=n.getValue();return i==null?!1:String(i).toLowerCase().includes(s)})}function Zi({data:t,virtualization:a,containerRef:r}){const[s,n]=k.useState(a?.containerHeight||600);k.useEffect(()=>{if(!r.current||!a)return;const p=new ResizeObserver(g=>{for(const y of g)n(y.contentRect.height)});return p.observe(r.current),()=>{p.disconnect()}},[r,a]);const i=k.useMemo(()=>{if(!a||a.type==="none")return null;const p={count:t.length,getScrollElement:()=>r.current,estimateSize:()=>a.itemHeight||50,overscan:a.overscan||5};return a.type==="dynamic"?{...p,estimateSize:()=>a.estimatedItemHeight||50}:p},[t.length,a,r]),c=i?Kc.useVirtualizer(i):null,l=k.useCallback((p,g="start")=>{c&&c.scrollToIndex(p,{align:g})},[c]),o=k.useCallback(p=>{c&&c.scrollToOffset(p)},[c]),d=k.useCallback(()=>c?c.getVirtualItems():[],[c]),u=k.useCallback(()=>c?c.getTotalSize():0,[c]),f=a?.type!=="none"&&i!==null;return{virtualizer:c,isVirtualized:f,containerHeight:s,scrollToIndex:l,scrollToOffset:o,getVirtualItems:d,getTotalSize:u,virtualItems:c?c.getVirtualItems():[],totalSize:c?c.getTotalSize():0}}const $g=1e3;function el({data:t,columns:a,exportConfig:r,onError:s}){const[n,i]=k.useState(0),[c,l]=k.useState(!1),o=k.useRef(null);k.useEffect(()=>()=>{o.current&&(o.current.terminate(),o.current=null)},[]);const d=k.useMemo(()=>({formats:["csv","xlsx","json"],filename:"export",includeHeaders:!0,useWorker:!0,workerThreshold:$g,...r}),[r]),u=k.useCallback(D=>{const C=D;return C.accessorKey||C.id},[]),f=k.useCallback(D=>{const C=D;return typeof D.header=="string"?D.header:(typeof D.header=="function",C.accessorKey||C.id||"")},[]),p=k.useCallback((D,C)=>{const T=u(C);if(T)return D[T]},[u]),g=k.useCallback(()=>a.filter(D=>u(D)).map(D=>({key:u(D),header:f(D)})),[a,u,f]),y=k.useCallback(async(D,C,T)=>new Promise((M,R)=>{l(!0),i(0);try{const I=`
|
|
71
|
-
// Fonction pour convertir en CSV
|
|
72
|
-
function convertToCSV(data, columns) {
|
|
73
|
-
const headers = columns.map(col => col.header).join(',');
|
|
74
|
-
const rows = data.map(row => {
|
|
75
|
-
return columns
|
|
76
|
-
.map(col => {
|
|
77
|
-
const value = row[col.key];
|
|
78
|
-
const stringValue = String(value ?? '');
|
|
79
|
-
if (stringValue.includes(',') || stringValue.includes('"') || stringValue.includes('\\n')) {
|
|
80
|
-
return '"' + stringValue.replace(/"/g, '""') + '"';
|
|
81
|
-
}
|
|
82
|
-
return stringValue;
|
|
83
|
-
})
|
|
84
|
-
.join(',');
|
|
85
|
-
});
|
|
86
|
-
return [headers, ...rows].join('\\n');
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Fonction pour convertir en JSON
|
|
90
|
-
function convertToJSON(data) {
|
|
91
|
-
return JSON.stringify(data, null, 2);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Fonction pour convertir en XML
|
|
95
|
-
function convertToXML(data, columns) {
|
|
96
|
-
let xmlContent = '<?xml version="1.0" encoding="UTF-8"?>\\n<data>\\n';
|
|
97
|
-
data.forEach((row, index) => {
|
|
98
|
-
xmlContent += ' <row id="' + index + '">\\n';
|
|
99
|
-
columns.forEach(col => {
|
|
100
|
-
const value = row[col.key];
|
|
101
|
-
const stringValue = String(value ?? '')
|
|
102
|
-
.replace(/&/g, '&')
|
|
103
|
-
.replace(/</g, '<')
|
|
104
|
-
.replace(/>/g, '>');
|
|
105
|
-
xmlContent += ' <' + col.key + '>' + stringValue + '</' + col.key + '>\\n';
|
|
106
|
-
});
|
|
107
|
-
xmlContent += ' </row>\\n';
|
|
108
|
-
});
|
|
109
|
-
xmlContent += '</data>';
|
|
110
|
-
return xmlContent;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Traitement par chunks avec progression
|
|
114
|
-
function processWithProgress(data, columns, format) {
|
|
115
|
-
const CHUNK_SIZE = 500;
|
|
116
|
-
const totalRows = data.length;
|
|
117
|
-
|
|
118
|
-
if (format === 'json') {
|
|
119
|
-
self.postMessage({ type: 'progress', progress: 50 });
|
|
120
|
-
const result = convertToJSON(data);
|
|
121
|
-
self.postMessage({ type: 'progress', progress: 100 });
|
|
122
|
-
return result;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
let result = '';
|
|
126
|
-
|
|
127
|
-
if (format === 'csv') {
|
|
128
|
-
result = columns.map(col => col.header).join(',') + '\\n';
|
|
129
|
-
for (let i = 0; i < totalRows; i += CHUNK_SIZE) {
|
|
130
|
-
const chunk = data.slice(i, Math.min(i + CHUNK_SIZE, totalRows));
|
|
131
|
-
const chunkRows = chunk.map(row => {
|
|
132
|
-
return columns
|
|
133
|
-
.map(col => {
|
|
134
|
-
const value = row[col.key];
|
|
135
|
-
const stringValue = String(value ?? '');
|
|
136
|
-
if (stringValue.includes(',') || stringValue.includes('"') || stringValue.includes('\\n')) {
|
|
137
|
-
return '"' + stringValue.replace(/"/g, '""') + '"';
|
|
138
|
-
}
|
|
139
|
-
return stringValue;
|
|
140
|
-
})
|
|
141
|
-
.join(',');
|
|
142
|
-
});
|
|
143
|
-
result += chunkRows.join('\\n') + (i + CHUNK_SIZE < totalRows ? '\\n' : '');
|
|
144
|
-
self.postMessage({ type: 'progress', progress: Math.round(((i + CHUNK_SIZE) / totalRows) * 100) });
|
|
145
|
-
}
|
|
146
|
-
return result;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (format === 'xml') {
|
|
150
|
-
result = '<?xml version="1.0" encoding="UTF-8"?>\\n<data>\\n';
|
|
151
|
-
for (let i = 0; i < totalRows; i += CHUNK_SIZE) {
|
|
152
|
-
const chunk = data.slice(i, Math.min(i + CHUNK_SIZE, totalRows));
|
|
153
|
-
chunk.forEach((row, idx) => {
|
|
154
|
-
result += ' <row id="' + (i + idx) + '">\\n';
|
|
155
|
-
columns.forEach(col => {
|
|
156
|
-
const value = row[col.key];
|
|
157
|
-
const stringValue = String(value ?? '')
|
|
158
|
-
.replace(/&/g, '&')
|
|
159
|
-
.replace(/</g, '<')
|
|
160
|
-
.replace(/>/g, '>');
|
|
161
|
-
result += ' <' + col.key + '>' + stringValue + '</' + col.key + '>\\n';
|
|
162
|
-
});
|
|
163
|
-
result += ' </row>\\n';
|
|
164
|
-
});
|
|
165
|
-
self.postMessage({ type: 'progress', progress: Math.round(((i + CHUNK_SIZE) / totalRows) * 100) });
|
|
166
|
-
}
|
|
167
|
-
result += '</data>';
|
|
168
|
-
return result;
|
|
169
|
-
}
|
|
79
|
+
}`)}}const r=a.join(`
|
|
170
80
|
|
|
171
|
-
return result;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
self.onmessage = function(e) {
|
|
175
|
-
const { format, data, columns } = e.data;
|
|
176
|
-
try {
|
|
177
|
-
const content = processWithProgress(data, columns, format);
|
|
178
|
-
self.postMessage({ type: 'success', content });
|
|
179
|
-
} catch (error) {
|
|
180
|
-
self.postMessage({ type: 'error', error: error.message || 'Unknown error' });
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
`,U=new Blob([I],{type:"application/javascript"}),O=URL.createObjectURL(U),W=new Worker(O);o.current=W,W.onmessage=L=>{const{type:_,content:P,progress:V,error:z}=L.data;if(_==="progress")i(V);else if(_==="success"){let X,q;switch(C){case"csv":X="text/csv;charset=utf-8;",q="csv";break;case"json":X="application/json",q="json";break;case"xml":X="application/xml",q="xml";break;default:X="text/plain",q="txt"}const B=new Blob([P],{type:X}),J=document.createElement("a");J.href=URL.createObjectURL(B),J.download=`${T}.${q}`,J.click(),URL.revokeObjectURL(J.href),W.terminate(),URL.revokeObjectURL(O),o.current=null,l(!1),i(0),M()}else _==="error"&&(W.terminate(),URL.revokeObjectURL(O),o.current=null,l(!1),i(0),R(new Error(z)))},W.onerror=L=>{W.terminate(),URL.revokeObjectURL(O),o.current=null,l(!1),i(0),R(new Error(L.message))};const F=g();W.postMessage({format:C,data:D,columns:F})}catch(I){l(!1),i(0),R(I)}}),[g]),j=k.useCallback((D,C)=>{if(!D.length)return;const T=a.filter(W=>u(W)),M=T.map(W=>f(W)).join(","),R=D.map(W=>T.map(F=>{const L=p(W,F),_=String(L??"");return _.includes(",")||_.includes('"')||_.includes(`
|
|
184
|
-
`)?`"${_.replace(/"/g,'""')}"`:_}).join(",")),I=[M,...R].join(`
|
|
185
|
-
`),U=new Blob([I],{type:"text/csv;charset=utf-8;"}),O=document.createElement("a");O.href=URL.createObjectURL(U),O.download=`${C||d.filename}.csv`,O.click(),URL.revokeObjectURL(O.href)},[a,d.filename,u,f,p]),A=k.useCallback((D,C)=>{const T=JSON.stringify(D,null,2),M=new Blob([T],{type:"application/json"}),R=document.createElement("a");R.href=URL.createObjectURL(M),R.download=`${C||d.filename}.json`,R.click(),URL.revokeObjectURL(R.href)},[d.filename]),x=k.useCallback(async(D,C)=>{try{if(typeof window>"u")throw new Error("XLSX export not available in server environment");let T;try{T=await import("xlsx")}catch{throw new Error("La dépendance 'xlsx' est requise pour l'export Excel. Installez-la avec: pnpm add xlsx (version >=0.18.0)")}const M=a.filter(W=>u(W)),I=[M.map(W=>f(W)),...D.map(W=>M.map(F=>p(W,F)))],U=T.utils.aoa_to_sheet(I),O=T.utils.book_new();T.utils.book_append_sheet(O,U,"Sheet1"),T.writeFile(O,`${C||d.filename}.xlsx`)}catch(T){throw Ve(T,{code:Le.DATATABLE_EXPORT_FAILED,context:"DataTable.exportToXLSX",onError:s})}},[a,d.filename,u,f,p,s]),h=k.useCallback(async(D,C)=>{try{if(typeof window>"u")throw new Error("PDF export not available in server environment");let T;try{T=await import("jspdf")}catch{throw new Error("La dépendance 'jspdf' est requise pour l'export PDF. Installez-la avec: pnpm add jspdf (version >=2.5.0)")}try{await import("jspdf-autotable")}catch{throw new Error("La dépendance 'jspdf-autotable' est requise pour l'export PDF. Installez-la avec: pnpm add jspdf-autotable (version >=3.5.0)")}const M=new T.default,R=a.filter(O=>u(O)),I=R.map(O=>f(O)),U=D.map(O=>R.map(W=>p(O,W)));M.autoTable({head:[I],body:U,startY:20,styles:{fontSize:8},headStyles:{fillColor:[66,139,202]}}),M.save(`${C||d.filename}.pdf`)}catch(T){throw Ve(T,{code:Le.DATATABLE_EXPORT_FAILED,context:"DataTable.exportToPDF",onError:s})}},[a,d.filename,u,f,p,s]),b=k.useCallback((D,C)=>{const T=a.filter(U=>u(U));let M=`<?xml version="1.0" encoding="UTF-8"?>
|
|
186
|
-
<data>
|
|
187
|
-
`;D.forEach((U,O)=>{M+=` <row id="${O}">
|
|
188
|
-
`,T.forEach(W=>{const F=u(W);if(F){const L=p(U,W),_=String(L??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");M+=` <${F}>${_}</${F}>
|
|
189
|
-
`}}),M+=` </row>
|
|
190
|
-
`}),M+="</data>";const R=new Blob([M],{type:"application/xml"}),I=document.createElement("a");I.href=URL.createObjectURL(R),I.download=`${C||d.filename}.xml`,I.click(),URL.revokeObjectURL(I.href)},[a,d.filename,u,p]),w=k.useCallback(async(D,C,T)=>{const M=C||t,R=T||d.filename;if(d.onExport){d.onExport(M,D);return}const I=["csv","json","xml"];if(d.useWorker&&M.length>=d.workerThreshold&&I.includes(D.toLowerCase())&&typeof Worker<"u"){await y(M,D.toLowerCase(),R);return}switch(D.toLowerCase()){case"csv":j(M,R);break;case"json":A(M,R);break;case"xlsx":await x(M,R);break;case"pdf":await h(M,R);break;case"xml":b(M,R);break;default:throw new Error(`Format d'export non supporté: ${D}`)}},[t,d,y,j,A,x,h,b]),E=k.useCallback(async D=>w(D),[w]),v=k.useCallback(async(D,C)=>w(D,C),[w]),$=k.useCallback(()=>{o.current&&(o.current.terminate(),o.current=null,l(!1),i(0))},[]);return{exportData:w,exportAll:E,exportSelected:v,cancelExport:$,exportProgress:n,isExporting:c,supportedFormats:d.formats,isExportSupported:D=>d.formats.includes(D)}}const Kr=5e3,ra=1e3;function tl({importConfig:t,onError:a}){const[r,s]=k.useState(0),[n,i]=k.useState(!1),c=k.useRef(null),l=k.useMemo(()=>({accept:".csv,.xlsx,.json,.xml",...t}),[t]),o=k.useCallback((v,$=",")=>{const D=v.split(`
|
|
191
|
-
`).filter(M=>M.trim());if(D.length===0)return[];const C=D[0].split($).map(M=>M.trim().replace(/"/g,""));return D.slice(1).map(M=>{const R=M.split($).map(U=>U.trim().replace(/"/g,"")),I={};return C.forEach((U,O)=>{I[U]=R[O]||""}),I})},[]),d=k.useCallback(async(v,$=",",D,C)=>{const T=v.split(`
|
|
192
|
-
`).filter(O=>O.trim());if(T.length===0)return[];const M=T[0].split($).map(O=>O.trim().replace(/"/g,"")),R=T.slice(1),I=R.length,U=[];for(let O=0;O<I;O+=ra){if(C?.aborted)throw new Error("Import annulé");const W=R.slice(O,O+ra),F=W.map(_=>{const P=_.split($).map(z=>z.trim().replace(/"/g,"")),V={};return M.forEach((z,X)=>{V[z]=P[X]||""}),V});U.push(...F);const L=Math.min(100,Math.round((O+W.length)/I*100));D?.(L),await new Promise(_=>setTimeout(_,0))}return U},[]),u=k.useCallback(async(v,$,D)=>{const C=JSON.parse(v),T=Array.isArray(C)?C:[C];if(T.length<Kr)return $?.(100),T;const M=[],R=T.length;for(let I=0;I<R;I+=ra){if(D?.aborted)throw new Error("Import annulé");const U=T.slice(I,I+ra);M.push(...U);const O=Math.min(100,Math.round((I+U.length)/R*100));$?.(O),await new Promise(W=>setTimeout(W,0))}return M},[]),f=k.useCallback(v=>{try{const $=JSON.parse(v);return Array.isArray($)?$:[$]}catch{throw new Error("Format JSON invalide")}},[]),p=k.useCallback(v=>{try{const C=new DOMParser().parseFromString(v,"text/xml").querySelectorAll("row");return Array.from(C).map(T=>{const M={};return Array.from(T.children).forEach(R=>{M[R.tagName]=R.textContent||""}),M})}catch{throw new Error("Format XML invalide")}},[]),g=k.useCallback(async v=>{try{if(typeof window>"u")throw new Error("XLSX parsing not available in server environment");let $;try{$=await import("xlsx")}catch{throw new Error("La dépendance 'xlsx' est requise pour l'import Excel. Installez-la avec: pnpm add xlsx (version >=0.18.0)")}const D=await v.arrayBuffer(),C=$.read(D,{type:"array"}),T=C.SheetNames[0],M=C.Sheets[T],R=$.utils.sheet_to_json(M,{header:1});if(R.length===0)return[];const I=R[0];return R.slice(1).map(U=>{const O=U,W={};return I.forEach((F,L)=>{W[F]=O[L]??""}),W})}catch{throw new Error("Erreur lors du parsing du fichier XLSX")}},[]),y=k.useCallback(v=>l.validate?l.validate(v):Array.isArray(v)?v.length===0?{valid:!1,errors:["Aucune donnée trouvée"]}:{valid:!0,errors:[]}:{valid:!1,errors:["Les données doivent être un tableau"]},[l.validate]),j=k.useCallback(v=>l.columnMapping?v.map($=>{const D={};return Object.entries(l.columnMapping).forEach(([C,T])=>{$[C]!==void 0&&(D[T]=$[C])}),D}):v,[l.columnMapping]),A=k.useCallback(async v=>{const $=v.name.split(".").pop()?.toLowerCase();let D=[];try{const C=await v.text();switch($){case"csv":D=o(C,l.parseOptions?.csv?.delimiter);break;case"json":D=f(C);break;case"xml":D=p(C);break;case"xlsx":D=await g(v);break;default:throw new Error(`Format de fichier non supporté: ${$}`)}const T=y(D);if(!T.valid)throw new Error(`Données invalides: ${T.errors.join(", ")}`);const M=j(D);return l.onImport&&l.onImport(M),M}catch(C){throw Ve(C,{code:Le.DATATABLE_IMPORT_FAILED,context:`DataTable.importData(${v.name})`,onError:a})}},[l,o,f,p,g,y,j,a]),x=k.useCallback(()=>{const v=document.createElement("input");return v.type="file",v.accept=l.accept,v.multiple=!1,v},[l.accept]),h=k.useCallback(()=>new Promise((v,$)=>{const D=x();D.onchange=async C=>{const T=C.target.files?.[0];if(!T){$(new Error("Aucun fichier sélectionné"));return}try{const M=await A(T);v(M)}catch(M){$(M)}},D.click()}),[x,A]),b=k.useCallback(async(v,$)=>{const D=v.name.split(".").pop()?.toLowerCase();c.current=new AbortController;const C=c.current.signal;i(!0),s(0);const T=M=>{s(M),$?.onProgress?.(M)};try{const M=await v.text();let R=[];const I=M.split(`
|
|
193
|
-
`).length;switch(D){case"csv":I>Kr?R=await d(M,l.parseOptions?.csv?.delimiter,T,C):(R=o(M,l.parseOptions?.csv?.delimiter),T(100));break;case"json":R=await u(M,T,C);break;case"xml":R=p(M),T(100);break;case"xlsx":R=await g(v),T(100);break;default:throw new Error(`Format de fichier non supporté: ${D}`)}if(C.aborted)throw new Error("Import annulé");const U=y(R);if(!U.valid)throw new Error(`Données invalides: ${U.errors.join(", ")}`);let O;if(R.length>Kr&&l.columnMapping){O=[];for(let W=0;W<R.length;W+=ra){if(C.aborted)throw new Error("Import annulé");const F=R.slice(W,W+ra),L=j(F);O.push(...L),$?.onChunk?.(L,O.length),await new Promise(_=>setTimeout(_,0))}}else O=j(R);return l.onImport&&l.onImport(O),O}catch(M){throw Ve(M,{code:Le.DATATABLE_IMPORT_FAILED,context:`DataTable.importDataStreaming(${v.name})`,onError:a})}finally{i(!1),c.current=null}},[l,o,d,f,u,p,g,y,j,a]),w=k.useCallback(()=>{c.current&&(c.current.abort(),i(!1),s(0))},[]),E=k.useCallback(v=>new Promise(($,D)=>{const C=x();C.onchange=async T=>{const M=T.target.files?.[0];if(!M){D(new Error("Aucun fichier sélectionné"));return}try{const R=await b(M,v);$(R)}catch(R){D(R)}},C.click()}),[x,b]);return{importData:A,importWithUI:h,importDataStreaming:b,importWithUIStreaming:E,cancelImport:w,importProgress:r,isImporting:n,supportedFormats:l.accept?.split(",")||[],isFormatSupported:v=>{const $=v.split(".").pop()?.toLowerCase();return l.accept?.includes($||"")||!1}}}function al({theme:t,variant:a="bordered",density:r="comfortable"}){const s={colors:{primary:"hsl(var(--primary))",secondary:"hsl(var(--secondary))",accent:"hsl(var(--accent))",background:"hsl(var(--background))",surface:"hsl(var(--card))",text:"hsl(var(--foreground))",textSecondary:"hsl(var(--muted-foreground))",border:"hsl(var(--border))",hover:"hsl(var(--muted))",selected:"hsl(var(--accent))",disabled:"hsl(var(--muted))"},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},typography:{fontFamily:"inherit",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},fontWeight:{normal:"400",medium:"500",semibold:"600",bold:"700"}},borders:{radius:{sm:"0.25rem",md:"0.5rem",lg:"0.75rem"},width:{thin:"1px",medium:"2px",thick:"4px"}},shadows:{sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)"}},n=k.useMemo(()=>t?{colors:{...s.colors,...t.colors},spacing:{...s.spacing,...t.spacing},typography:{...s.typography,...t.typography},borders:{...s.borders,...t.borders},shadows:{...s.shadows,...t.shadows}}:s,[t,s]),i=k.useMemo(()=>{const u="w-full";switch(a){case"bordered":return`${u} border rounded-lg`;case"minimal":return u;case"striped":return`${u} [&_tbody_tr:nth-child(even)]:bg-muted/50`;case"glass":return`${u} backdrop-blur-sm bg-background/80 border rounded-lg`;default:return u}},[a]),c=k.useMemo(()=>{switch(r){case"spacious":return{table:"text-base",header:"px-6 py-4",cell:"px-6 py-4",row:"h-16"};case"compact":return{table:"text-sm",header:"px-3 py-2",cell:"px-3 py-2",row:"h-8"};case"comfortable":default:return{table:"text-sm",header:"px-4 py-3",cell:"px-4 py-3",row:"h-12"}}},[r]),l=k.useMemo(()=>{const u={};return n.colors&&Object.entries(n.colors).forEach(([f,p])=>{u[`--datatable-color-${f}`]=p}),n.spacing&&Object.entries(n.spacing).forEach(([f,p])=>{u[`--datatable-spacing-${f}`]=p}),n.typography&&(n.typography.fontFamily&&(u["--datatable-font-family"]=n.typography.fontFamily),n.typography.fontSize&&Object.entries(n.typography.fontSize).forEach(([f,p])=>{u[`--datatable-font-size-${f}`]=p}),n.typography.fontWeight&&Object.entries(n.typography.fontWeight).forEach(([f,p])=>{u[`--datatable-font-weight-${f}`]=p})),n.borders&&(n.borders.radius&&Object.entries(n.borders.radius).forEach(([f,p])=>{u[`--datatable-radius-${f}`]=p}),n.borders.width&&Object.entries(n.borders.width).forEach(([f,p])=>{u[`--datatable-border-width-${f}`]=p})),n.shadows&&Object.entries(n.shadows).forEach(([f,p])=>{u[`--datatable-shadow-${f}`]=p}),u},[n]),o=k.useCallback((u,f)=>f?`${u} [--datatable-theme-key:${f}]`:u,[]),d=k.useCallback((u={})=>({...u,...l}),[l]);return{theme:n,variantClasses:i,densityClasses:c,customStyles:l,getThemedClass:o,getThemedStyles:d}}function Og({data:t,columns:a,layout:r="standard",variant:s="bordered",density:n="comfortable",filters:i,filterPosition:c="top",toolbar:l,pagination:o,selection:d=!1,actions:u,i18nNamespace:f,loading:p=!1,error:g,emptyState:y,headerSticky:j=!1,columnVisibilityToggle:A=!0,columnResize:x=!1,columnOrder:h,grouping:b,rowExpansion:w,virtualization:E,sortMode:v="multiple",enableExport:$=!1,enableImport:D=!1,enableReorder:C=!1,enableContextMenu:T=!1,onRowClick:M,onRowDoubleClick:R,onSortingChange:I,onFiltersChange:U,onSelectionChange:O,onColumnOrderChange:W,onExpandedChange:F,onGroupingChange:L,className:_,tableId:P,edit:V,theme:z,performance:X}){const{t:q}=Je.useTranslation(f),B=m.useRef(null),{layout:J,setLayout:Q,density:te,setDensity:ee,densityClasses:ue}=$s(r,n),{theme:Y,variantClasses:K,densityClasses:re,customStyles:xe,getThemedClass:pe,getThemedStyles:ye}=al({theme:z,variant:s,density:te}),Te=m.useMemo(()=>{const oe=[...a];if(d){const se={id:"select",header:({table:_e})=>e.jsx(yt,{checked:_e.getIsAllPageRowsSelected(),onCheckedChange:De=>_e.toggleAllPageRowsSelected(!!De),"aria-label":q("datatable.selectAll",{defaultValue:"Select all"})}),cell:({row:_e})=>e.jsx(yt,{checked:_e.getIsSelected(),onCheckedChange:De=>_e.toggleSelected(!!De),"aria-label":q("datatable.selectRow",{defaultValue:"Select row"})}),enableSorting:!1,enableHiding:!1,size:50};oe.unshift(se)}if(w?.enabled){const se={id:"expand",header:()=>null,cell:({row:_e})=>_e.getCanExpand()?e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>_e.toggleExpanded(),className:"h-8 w-8 p-0",children:_e.getIsExpanded()?e.jsx(S.ChevronDown,{className:"h-4 w-4"}):e.jsx(S.ChevronRight,{className:"h-4 w-4"})}):null,enableSorting:!1,enableHiding:!1,size:50};oe.unshift(se)}if(C){const se={id:"reorder",header:()=>null,cell:()=>e.jsx(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 cursor-move",children:e.jsx(S.GripVertical,{className:"h-4 w-4"})}),enableSorting:!1,enableHiding:!1,size:50};oe.unshift(se)}return oe},[a,d,w,C,q]);le.debug("DataTableAdvanced - props:",{grouping:b,rowExpansion:w,dataLength:t.length});const{table:Me,sorting:et,setSorting:Dt,columnFilters:dt,setColumnFilters:ut,columnVisibility:Vt,setColumnVisibility:ga,columnOrder:xa,setColumnOrder:ta,expanded:Z,setExpanded:ie,grouping:Fe,setGrouping:mt,rowSelection:Ha,setRowSelection:Ys,globalFilter:Fr,setGlobalFilter:Ir,pagination:qa,setPagination:Jl,selectedRows:Ql,resetFilters:jt,resetSelection:Wt,resetAll:At,exportData:Ba,getGroupedData:Lr,getExpandedData:$r,toggleGrouping:gt,clearGrouping:Or,toggleRowExpansion:ft,expandAll:ba,collapseAll:ht}=Qi({data:t,columns:Te,pagination:o,tableId:P,onSortingChange:I,onFiltersChange:U,onSelectionChange:O,onColumnOrderChange:W,onExpandedChange:F,onGroupingChange:L,grouping:b,virtualization:E,sortMode:v,performance:X}),{isVirtualized:Nt,virtualItems:Ut,totalSize:Ga,scrollToIndex:Js,scrollToOffset:_r}=Zi({data:t,virtualization:E,containerRef:B}),{exportData:Xa,exportAll:Qs,exportSelected:va}=el({data:t,columns:Te,exportConfig:typeof $=="object"?$:void 0}),{importWithUI:ya,supportedFormats:Zl}=tl({importConfig:typeof D=="object"?D:void 0}),[Ct,tt]=Os(Me,{onSave:V?.onSave,onCancel:V?.onCancel,autoSave:V?.autoSave,autoSaveDelay:V?.autoSaveDelay});m.useMemo(()=>{if(!V?.editableColumns||V.editableColumns.length===0)return Te;const oe={id:"edit-actions",header:()=>q("datatable.actions",{defaultValue:"Actions"}),cell:({row:se})=>Ct.editingRowId===se.id?e.jsxs("div",{className:"flex gap-1",children:[e.jsx(G,{size:"sm",variant:"ghost",onClick:()=>tt.saveEdit(),disabled:!Ct.hasChanges,children:q("datatable.save",{defaultValue:"Save"})}),e.jsx(G,{size:"sm",variant:"ghost",onClick:()=>tt.cancelEdit(),children:q("datatable.cancel",{defaultValue:"Cancel"})})]}):e.jsx(G,{size:"sm",variant:"ghost",onClick:()=>tt.startEdit(se.id,se.original),children:q("datatable.edit",{defaultValue:"Edit"})}),enableSorting:!1,enableHiding:!1};return[...Te,oe]},[Te,V?.editableColumns,Ct.editingRowId,Ct.hasChanges,tt,q]);const Ka=m.useCallback(async oe=>{try{await Xa(oe)}catch(se){console.error("Erreur lors de l'export:",se)}},[Xa]),Ya=m.useCallback(async()=>{try{const oe=await ya();le.debug("Données importées:",oe)}catch(oe){console.error("Erreur lors de l'import:",oe)}},[ya]);if(p)return e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(S.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:q("datatable.loading",{defaultValue:"Loading..."})})]})});if(g)return e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg bg-destructive/10",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-destructive",children:[e.jsx(S.AlertCircle,{className:"h-8 w-8"}),e.jsx("p",{className:"text-sm font-medium",children:g})]})});if(!t||t.length===0)return e.jsxs("div",{className:"flex flex-col",children:[l&&e.jsx(Fa,{table:Me,config:l,globalFilter:Fr,onGlobalFilterChange:Ir,density:te,onDensityChange:ee,onExport:$?Ka:void 0,onImport:D?Ya:void 0}),e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg",children:y||e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx("p",{className:"text-lg font-medium",children:q("datatable.noData",{defaultValue:"No data"})}),e.jsx("p",{className:"text-sm",children:q("datatable.noDataDescription",{defaultValue:"There are no results to display"})})]})})]});const Ja=()=>Nt?e.jsx("div",{ref:B,className:"h-full overflow-auto",style:{height:E?.containerHeight||600},children:e.jsxs("table",{className:ne("w-full caption-bottom text-sm",re.table),style:ye(),children:[e.jsx("thead",{className:ne(j&&"sticky top-0 bg-background z-10"),children:Me.getHeaderGroups().map(oe=>e.jsx("tr",{className:"border-b",children:oe.headers.map(se=>e.jsxs("th",{className:ne("text-left font-medium text-muted-foreground",re.header,se.column.getCanSort()&&"cursor-pointer select-none hover:text-foreground"),onClick:se.column.getToggleSortingHandler(),style:{width:se.getSize(),minWidth:se.column.columnDef.minSize,maxWidth:se.column.columnDef.maxSize},children:[se.isPlaceholder?null:ge.flexRender(se.column.columnDef.header,se.getContext()),se.column.getIsSorted()&&e.jsx("span",{className:"ml-2",children:se.column.getIsSorted()==="asc"?"↑":"↓"})]},se.id))},oe.id))}),e.jsx("tbody",{children:Ut.map(oe=>{const se=Me.getRowModel().rows[oe.index];if(!se)return null;const _e=De=>{const Ie=De.getValue(),ze=De.column.id,Ae=se.id,he=Ct.editingRowId===Ae,Ht=V?.editableColumns?.find(xt=>xt.field===ze);return Ht&&he?e.jsx(Zt,{value:Ie,field:ze,config:Ht.config,isEditing:he,onChange:xt=>tt.updateField(ze,xt),onStartEdit:()=>tt.startEdit(Ae,se.original),onSave:()=>tt.saveEdit(),onCancel:()=>tt.cancelEdit()}):De.getIsGrouped()?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:xt=>{xt.stopPropagation(),se.toggleExpanded()},className:"p-1 hover:bg-muted rounded",children:se.getIsExpanded()?"▼":"▶"}),e.jsx("span",{className:"font-medium",children:ge.flexRender(De.column.columnDef.cell,De.getContext())}),e.jsxs("span",{className:"text-muted-foreground",children:["(",se.subRows.length,")"]})]}):De.getIsAggregated()?ge.flexRender(De.column.columnDef.aggregatedCell??De.column.columnDef.cell,De.getContext()):De.getIsPlaceholder()?null:ge.flexRender(De.column.columnDef.cell,De.getContext())};return e.jsx("tr",{className:ne("border-b transition-colors",M&&"cursor-pointer hover:bg-muted/50",se.getIsSelected()&&"bg-muted"),onClick:()=>M?.(se.original),onDoubleClick:()=>R?.(se.original),style:{position:"absolute",top:oe.start,left:0,width:"100%",height:oe.size},children:se.getVisibleCells().map(De=>e.jsx("td",{className:ne("align-middle",re.cell),children:_e(De)},De.id))},se.id)})})]})}):e.jsx("div",{className:ne("w-full overflow-auto",K),children:e.jsxs("table",{className:ne("w-full caption-bottom text-sm",re.table),style:ye(),children:[e.jsx("thead",{className:ne(j&&"sticky top-0 bg-background z-10"),children:Me.getHeaderGroups().map(oe=>e.jsx("tr",{className:"border-b",children:oe.headers.map(se=>e.jsxs("th",{className:ne("text-left font-medium text-muted-foreground",re.header,se.column.getCanSort()&&"cursor-pointer select-none hover:text-foreground"),onClick:se.column.getToggleSortingHandler(),style:{width:se.getSize(),minWidth:se.column.columnDef.minSize,maxWidth:se.column.columnDef.maxSize},children:[se.isPlaceholder?null:ge.flexRender(se.column.columnDef.header,se.getContext()),se.column.getIsSorted()&&e.jsx("span",{className:"ml-2",children:se.column.getIsSorted()==="asc"?"↑":"↓"})]},se.id))},oe.id))}),e.jsx("tbody",{children:Me.getRowModel().rows.map((oe,se)=>{const _e=oe.getIsExpanded(),De=Ie=>{const ze=Ie.getValue(),Ae=Ie.column.id,he=oe.id,Ht=Ct.editingRowId===he,xt=V?.editableColumns?.find(Rt=>Rt.field===Ae);return xt&&Ht?e.jsx(Zt,{value:ze,field:Ae,config:xt.config,isEditing:Ht,onChange:Rt=>tt.updateField(Ae,Rt),onStartEdit:()=>tt.startEdit(he,oe.original),onSave:()=>tt.saveEdit(),onCancel:()=>tt.cancelEdit()}):Ie.getIsGrouped()?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:Rt=>{Rt.stopPropagation(),oe.toggleExpanded()},className:"p-1 hover:bg-muted rounded",children:oe.getIsExpanded()?"▼":"▶"}),e.jsx("span",{className:"font-medium",children:ge.flexRender(Ie.column.columnDef.cell,Ie.getContext())}),e.jsxs("span",{className:"text-muted-foreground",children:["(",oe.subRows.length,")"]})]}):Ie.getIsAggregated()?ge.flexRender(Ie.column.columnDef.aggregatedCell??Ie.column.columnDef.cell,Ie.getContext()):Ie.getIsPlaceholder()?null:ge.flexRender(Ie.column.columnDef.cell,Ie.getContext())};return e.jsxs(m.Fragment,{children:[e.jsx("tr",{className:ne("border-b transition-colors",M&&"cursor-pointer hover:bg-muted/50",oe.getIsSelected()&&"bg-muted",oe.getIsGrouped()&&"bg-muted/30 font-medium"),onClick:()=>M?.(oe.original),onDoubleClick:()=>R?.(oe.original),children:oe.getVisibleCells().map(Ie=>e.jsx("td",{className:ne("align-middle",re.cell),children:De(Ie)},Ie.id))}),w?.enabled&&_e&&e.jsx("tr",{children:e.jsx("td",{colSpan:oe.getVisibleCells().length,className:"p-0 bg-muted/30",children:e.jsx("div",{className:"border-b p-4",children:w.renderExpanded?.(oe.original)})})},`${oe.id}-expanded`)]},oe.id)})})]})});return e.jsxs("div",{className:ne("w-full",_),style:ye(),children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l&&e.jsx("div",{className:"flex-1",children:e.jsx(Fa,{table:Me,config:l,globalFilter:Fr,onGlobalFilterChange:Ir,density:te,onDensityChange:ee,onExport:$?Ka:void 0,onImport:D?Ya:void 0})}),i&&e.jsx(zs,{table:Me,filters:i,position:c,onFiltersChange:U})]}),Ja(),o&&e.jsx(_s,{table:Me,pageSizeOptions:o.pageSizeOptions})]})}function _g({header:t,column:a,className:r}){const[s,n]=m.useState(!1),i=m.useCallback(c=>{c.preventDefault(),c.stopPropagation(),n(!0);const l=c.clientX,o=a.getSize(),d=f=>{const p=f.clientX-l,g=Math.max(50,o+p);a.setSize(g)},u=()=>{n(!1),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",d),document.addEventListener("mouseup",u)},[a]);return a.getCanResize()?e.jsx("div",{className:ne("absolute right-0 top-0 h-full w-1 cursor-col-resize bg-border opacity-0 hover:opacity-100 transition-opacity",s&&"opacity-100 bg-primary",r),onMouseDown:i,style:{width:"4px",marginRight:"-2px"}}):null}function zg({row:t,table:a,className:r}){const[s,n]=m.useState(t.getIsExpanded()),i=m.useCallback(()=>{n(!s),t.toggleExpanded()},[s,t]);t.getValue(t.groupingColumnId);const c=t.subRows.length;return e.jsxs("div",{className:ne("flex items-center gap-2 py-2",r),children:[e.jsx(G,{variant:"ghost",size:"sm",onClick:i,className:"h-6 w-6 p-0",children:s?e.jsx(S.ChevronDown,{className:"h-4 w-4"}):e.jsx(S.ChevronRight,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:ge.flexRender(t.groupingColumn.columnDef.cell,t.getGroupingValue())}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",c," ",c===1?"item":"items",")"]})]})]})}function Vg({row:t,table:a,className:r}){const s=t.getAggregationValue();return s?e.jsx("div",{className:ne("flex items-center gap-4 py-2 bg-muted/50",r),children:Object.entries(s).map(([n,i])=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:[n,":"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:typeof i=="number"?i.toLocaleString():String(i)})]},n))}):null}function Wg({table:t,groupingColumns:a,onGroupingChange:r,className:s}){const[n,i]=m.useState(a),c=m.useCallback(o=>{const d=n.includes(o)?n.filter(u=>u!==o):[...n,o];i(d),r(d)},[n,r]),l=m.useCallback(()=>{i([]),r([])},[r]);return e.jsxs("div",{className:ne("flex items-center gap-2",s),children:[e.jsx("span",{className:"text-sm font-medium",children:"Group by:"}),t.getAllColumns().filter(o=>o.getCanGroup()).map(o=>e.jsx(G,{variant:n.includes(o.id)?"default":"outline",size:"sm",onClick:()=>c(o.id),children:o.columnDef.header},o.id)),n.length>0&&e.jsx(G,{variant:"ghost",size:"sm",onClick:l,children:"Clear"})]})}function Ug({row:t,rowIndex:a,actions:r=[],columnActions:s=[],onCopy:n,onExport:i,onEdit:c,onDelete:l,onToggleColumnVisibility:o,visibleColumns:d=[],className:u,children:f}){const[p,g]=m.useState(!1),y=m.useCallback(w=>{w.onClick(t),g(!1)},[t]),j=m.useCallback(()=>{if(n)n(t);else{const w=Object.entries(t).map(([E,v])=>`${E}: ${v}`).join(`
|
|
194
|
-
`);navigator.clipboard.writeText(w)}g(!1)},[t,n]),A=m.useCallback(()=>{i&&i(t),g(!1)},[t,i]),x=m.useCallback(()=>{c&&c(t),g(!1)},[t,c]),h=m.useCallback(()=>{l&&l(t),g(!1)},[t,l]),b=m.useCallback(w=>{o&&o(w),g(!1)},[o]);return e.jsxs(po,{onOpenChange:g,children:[e.jsx(go,{asChild:!0,children:f}),e.jsxs(ys,{className:ne("w-64",u),children:[r.length>0&&e.jsxs(e.Fragment,{children:[r.map(w=>e.jsxs(kt,{onClick:()=>y(w),disabled:w.disabled,className:ne(w.destructive&&"text-destructive focus:text-destructive"),children:[w.icon&&e.jsx("span",{className:"mr-2",children:w.icon}),w.label]},w.id)),e.jsx(Ea,{})]}),e.jsxs(kt,{onClick:j,children:[e.jsx(S.Copy,{className:"mr-2 h-4 w-4"}),"Copy row"]}),i&&e.jsxs(kt,{onClick:A,children:[e.jsx(S.Download,{className:"mr-2 h-4 w-4"}),"Export row"]}),c&&e.jsxs(kt,{onClick:x,children:[e.jsx(S.Edit,{className:"mr-2 h-4 w-4"}),"Edit row"]}),l&&e.jsxs(kt,{onClick:h,className:"text-destructive focus:text-destructive",children:[e.jsx(S.Trash2,{className:"mr-2 h-4 w-4"}),"Delete row"]}),s.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ea,{}),e.jsx("div",{className:"px-2 py-1.5 text-sm font-semibold text-muted-foreground",children:"Columns"}),s.map(w=>e.jsxs(kt,{onClick:()=>b(w.id),disabled:w.disabled,children:[w.icon&&e.jsx("span",{className:"mr-2",children:w.icon}),w.label]},w.id))]}),o&&d.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ea,{}),e.jsx("div",{className:"px-2 py-1.5 text-sm font-semibold text-muted-foreground",children:"Toggle Columns"}),d.map(w=>e.jsxs(kt,{onClick:()=>b(w),children:[e.jsx(S.Eye,{className:"mr-2 h-4 w-4"}),w]},w))]})]})]})}function Hg({table:t,selectionMode:a="multiple",selectedRows:r,onSelectionChange:s,selectionActions:n=[],className:i}){const[c,l]=m.useState(null);m.useCallback((p,g)=>{if(a==="single"){t.setRowSelection({[p]:g});return}if(a==="range"&&c!==null){const y=Math.min(c,p),j=Math.max(c,p),A={...t.getState().rowSelection};for(let x=y;x<=j;x++)A[x]=g;t.setRowSelection(A)}else t.setRowSelection(y=>({...y,[p]:g}));l(p)},[t,a,c]);const o=m.useCallback(p=>{if(p){const g=t.getRowModel().rows.reduce((y,j,A)=>(y[A]=!0,y),{});t.setRowSelection(g)}else t.setRowSelection({})},[t]);m.useCallback((p,g,y)=>{const j={...t.getState().rowSelection};for(let A=p;A<=g;A++)j[A]=y;t.setRowSelection(j)},[t]),m.useCallback(p=>{const g={...t.getState().rowSelection};t.getRowModel().rows.forEach((y,j)=>{p(y.original)&&(g[j]=!0)}),t.setRowSelection(g)},[t]);const d=m.useCallback(p=>{p.onClick(r)},[r]),u=t.getIsAllPageRowsSelected(),f=t.getIsSomePageRowsSelected();return e.jsxs("div",{className:ne("flex items-center gap-2",i),children:[e.jsx(yt,{checked:u,onCheckedChange:o,ref:p=>{p&&"indeterminate"in p&&(p.indeterminate=f&&!u)},"aria-label":"Select all rows"}),r.length>0&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[r.length," selected"]}),e.jsx("div",{className:"flex items-center gap-1",children:n.map(p=>e.jsxs(G,{variant:"ghost",size:"sm",onClick:()=>d(p),disabled:p.disabled,className:ne(p.destructive&&"text-destructive hover:text-destructive"),children:[p.icon&&e.jsx("span",{className:"mr-1",children:p.icon}),p.label]},p.id))})]}),e.jsxs(ot,{onValueChange:p=>{switch(p){case"all":o(!0);break;case"none":o(!1);break;case"invert":t.getRowModel().rows.forEach((g,y)=>{const j=t.getState().rowSelection[y];t.setRowSelection(A=>({...A,[y]:!j}))});break}},children:[e.jsx(Xe,{className:"w-32",children:e.jsx(it,{placeholder:"Select"})}),e.jsxs(Ke,{children:[e.jsx(Oe,{value:"all",children:"Select All"}),e.jsx(Oe,{value:"none",children:"Select None"}),e.jsx(Oe,{value:"invert",children:"Invert Selection"})]})]})]})}function qg({table:t,selectionMode:a="multiple",onSelectionChange:r}){const[s,n]=m.useState([]);m.useEffect(()=>{const u=t.getFilteredSelectedRowModel().rows.map(f=>f.original);n(u),r?.(u)},[t,r]);const i=m.useCallback((u,f=!0)=>{t.setRowSelection(p=>({...p,[u]:f}))},[t]),c=m.useCallback((u=!0)=>{if(u){const f=t.getRowModel().rows.reduce((p,g,y)=>(p[y]=!0,p),{});t.setRowSelection(f)}else t.setRowSelection({})},[t]),l=m.useCallback((u,f,p=!0)=>{const g={...t.getState().rowSelection};for(let y=u;y<=f;y++)g[y]=p;t.setRowSelection(g)},[t]),o=m.useCallback(u=>{const f={...t.getState().rowSelection};t.getRowModel().rows.forEach((p,g)=>{u(p.original)&&(f[g]=!0)}),t.setRowSelection(f)},[t]),d=m.useCallback(()=>{t.setRowSelection({})},[t]);return{selectedRows:s,selectRow:i,selectAll:c,selectRange:l,selectByCriteria:o,clearSelection:d,isAllSelected:t.getIsAllPageRowsSelected(),isSomeSelected:t.getIsSomePageRowsSelected()}}function Bg({cell:t,row:a,editingRowId:r,editableColumns:s,onUpdateField:n,onStartEdit:i,onSaveEdit:c,onCancelEdit:l}){const o=t.getValue(),d=t.column.id,u=a.id,f=r===u,p=m.useMemo(()=>s?.find(A=>A.field===d),[s,d]),g=m.useCallback(A=>n?.(d,A),[n,d]),y=m.useCallback(()=>i?.(u,a.original),[i,u,a.original]),j=m.useCallback(A=>{A.stopPropagation(),a.toggleExpanded()},[a]);return p&&f?e.jsx(Zt,{value:o,field:d,config:p.config,isEditing:f,onChange:g,onStartEdit:y,onSave:c??(()=>{}),onCancel:l??(()=>{})}):t.getIsGrouped()?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:j,className:"p-1 hover:bg-muted rounded",children:a.getIsExpanded()?"▼":"▶"}),e.jsx("span",{className:"font-medium",children:ge.flexRender(t.column.columnDef.cell,t.getContext())}),e.jsxs("span",{className:"text-muted-foreground",children:["(",a.subRows.length,")"]})]}):t.getIsAggregated()?e.jsx(e.Fragment,{children:ge.flexRender(t.column.columnDef.aggregatedCell??t.column.columnDef.cell,t.getContext())}):t.getIsPlaceholder()?null:e.jsx(e.Fragment,{children:ge.flexRender(t.column.columnDef.cell,t.getContext())})}function Gg(t,a){if(t.cell.id!==a.cell.id||t.cell.getValue()!==a.cell.getValue())return!1;const r=t.editingRowId===t.row.id,s=a.editingRowId===a.row.id;return!(r!==s||t.row.getIsExpanded()!==a.row.getIsExpanded()||t.cell.getIsGrouped()!==a.cell.getIsGrouped()||t.cell.getIsAggregated()!==a.cell.getIsAggregated()||t.cell.getIsPlaceholder()!==a.cell.getIsPlaceholder())}const rl=m.memo(Bg,Gg);function Xg({table:t,headerSticky:a=!1,densityClasses:r={},enableColumnResize:s=!1,columnResizeMode:n="onEnd"}){return e.jsx("thead",{className:ne(a&&"sticky top-0 bg-background z-10"),children:t.getHeaderGroups().map(i=>e.jsx(sl,{headerGroup:i,densityClasses:r,enableColumnResize:s,columnResizeMode:n,table:t},i.id))})}function sl({headerGroup:t,densityClasses:a,enableColumnResize:r,columnResizeMode:s,table:n}){return e.jsx("tr",{className:"border-b",children:t.headers.map(i=>{const c=i.column.getCanSort(),l=i.column.getIsSorted(),o=r&&i.column.getCanResize();return e.jsxs("th",{className:ne("text-left font-medium text-muted-foreground relative",a.header,c&&"cursor-pointer select-none hover:text-foreground"),onClick:i.column.getToggleSortingHandler(),style:{width:i.getSize(),minWidth:i.column.columnDef.minSize,maxWidth:i.column.columnDef.maxSize},children:[e.jsxs("div",{className:"flex items-center",children:[i.isPlaceholder?null:ge.flexRender(i.column.columnDef.header,i.getContext()),l&&e.jsx("span",{className:"ml-2",children:l==="asc"?"↑":"↓"})]}),o&&e.jsx("div",{onMouseDown:i.getResizeHandler(),onTouchStart:i.getResizeHandler(),className:ne("absolute right-0 top-0 h-full w-1 cursor-col-resize select-none touch-none","hover:bg-primary/50",i.column.getIsResizing()&&"bg-primary")})]},i.id)})})}function Kg({table:t,rowExpansion:a,densityClasses:r={},onRowClick:s,onRowDoubleClick:n,editingRowId:i,editableColumns:c,onUpdateField:l,onStartEdit:o,onSaveEdit:d,onCancelEdit:u}){return e.jsx("tbody",{children:t.getRowModel().rows.map(f=>e.jsx(nl,{row:f,rowExpansion:a,densityClasses:r,onRowClick:s,onRowDoubleClick:n,editingRowId:i,editableColumns:c,onUpdateField:l,onStartEdit:o,onSaveEdit:d,onCancelEdit:u},f.id))})}function nl({row:t,rowExpansion:a,densityClasses:r,onRowClick:s,onRowDoubleClick:n,editingRowId:i,editableColumns:c,onUpdateField:l,onStartEdit:o,onSaveEdit:d,onCancelEdit:u}){const f=t.getIsExpanded();return e.jsxs(m.Fragment,{children:[e.jsx("tr",{className:ne("border-b transition-colors",s&&"cursor-pointer hover:bg-muted/50",t.getIsSelected()&&"bg-muted",t.getIsGrouped()&&"bg-muted/30 font-medium"),onClick:()=>s?.(t.original),onDoubleClick:()=>n?.(t.original),children:t.getVisibleCells().map(p=>e.jsx("td",{className:ne("align-middle",r.cell),children:e.jsx(rl,{cell:p,row:t,editingRowId:i,editableColumns:c,onUpdateField:l,onStartEdit:o,onSaveEdit:d,onCancelEdit:u})},p.id))}),a?.enabled&&f&&e.jsx("tr",{children:e.jsx("td",{colSpan:t.getVisibleCells().length,className:"p-0 bg-muted/30",children:e.jsx("div",{className:"border-b p-4",children:a.renderExpanded?.(t.original)})})})]})}function Yg({row:t,onRowClick:a,onRowDoubleClick:r,themeDensityClasses:s,editState:n,editActions:i,edit:c}){const l=m.useCallback(()=>{a?.(t.original)},[a,t.original]),o=m.useCallback(()=>{r?.(t.original)},[r,t.original]);return e.jsx("tr",{className:ne("border-b transition-colors",a&&"cursor-pointer hover:bg-muted/50",t.getIsSelected()&&"bg-muted"),onClick:l,onDoubleClick:o,children:t.getVisibleCells().map(d=>{const u=d.getValue(),f=d.column.id,p=t.id,g=n?.editingRowId===p,y=c?.editableColumns?.find(j=>j.field===f);return y&&g&&i?e.jsx("td",{className:ne("align-middle",s.cell),children:e.jsx(Zt,{value:u,field:f,config:y.config,isEditing:g,onChange:j=>i.updateField(f,j),onStartEdit:()=>i.startEdit(p,t.original),onSave:()=>i.saveEdit(),onCancel:()=>i.cancelEdit()})},d.id):e.jsx("td",{className:ne("align-middle",s.cell),children:ge.flexRender(d.column.columnDef.cell,d.getContext())},d.id)})})}function Jg(t,a){if(t.row.id!==a.row.id||t.row.getIsSelected()!==a.row.getIsSelected())return!1;const r=t.editState?.editingRowId===t.row.id,s=a.editState?.editingRowId===a.row.id;return!(r!==s||t.themeDensityClasses.cell!==a.themeDensityClasses.cell||t.row.original!==a.row.original)}const Qg=m.memo(Yg,Jg);function Zg({row:t,index:a,columns:r,onRowClick:s,onRowDoubleClick:n,themeDensityClasses:i,editState:c,editActions:l,edit:o,rowExpansion:d}){const u=t.getIsGrouped(),f=t.getIsExpanded();return e.jsxs(m.Fragment,{children:[e.jsx("tr",{className:ne("border-b transition-colors",s&&"cursor-pointer hover:bg-muted/50",t.getIsSelected()&&"bg-muted",u&&"bg-muted/30 font-medium"),onClick:()=>s?.(t.original),onDoubleClick:()=>n?.(t.original),children:t.getVisibleCells().map(p=>{const g=p.getValue(),y=p.column.id,j=t.id,A=c?.editingRowId===j,x=o?.editableColumns?.find(h=>h.field===y);return x&&A&&l?e.jsx("td",{className:ne("align-middle",i.cell),children:e.jsx(Zt,{value:g,field:y,config:x.config,isEditing:A,onChange:h=>l.updateField(y,h),onStartEdit:()=>l.startEdit(j,t.original),onSave:()=>l.saveEdit(),onCancel:()=>l.cancelEdit()})},p.id):p.getIsGrouped()?e.jsx("td",{className:ne("align-middle",i.cell),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:h=>{h.stopPropagation(),t.toggleExpanded()},className:"p-1 hover:bg-muted rounded",children:f?"▼":"▶"}),e.jsxs("span",{className:"font-medium",children:[ge.flexRender(p.column.columnDef.cell,p.getContext())," (",t.subRows.length,")"]})]})},p.id):p.getIsAggregated()?e.jsx("td",{className:ne("align-middle",i.cell),children:ge.flexRender(p.column.columnDef.aggregatedCell??p.column.columnDef.cell,p.getContext())},p.id):p.getIsPlaceholder()?e.jsx("td",{className:ne("align-middle",i.cell)},p.id):e.jsx("td",{className:ne("align-middle",i.cell)},p.id)})}),d?.enabled&&f&&e.jsx("tr",{children:e.jsx("td",{colSpan:r.length,className:"p-0 bg-muted/30",children:e.jsx("div",{className:"border-b p-4",children:d.renderExpanded?.(t.original)})})},`${t.id}-expanded-${a}`)]},`${t.id}-${a}`)}const ex={fr:wt,"fr-FR":wt,en:Sa,"en-US":Sa,"en-GB":Sa};function tx(t){return t&&ex[t]||wt}function ax(t){if(!t)return null;if(t instanceof Date)return H.isValid(t)?t:null;if(typeof t=="string"){const a=H.parseISO(t);if(H.isValid(a))return a;const r=new Date(t);if(H.isValid(r))return r}if(typeof t=="number"){const a=new Date(t);if(H.isValid(a))return a}return null}function Vs(t,a="PP",r){const s=ax(t);if(!s)return"";try{return H.format(s,a,{locale:tx(r)})}catch{return""}}function rx(t,a="PPpp",r){return Vs(t,a,r)}function sx(t,a="HH:mm",r){return Vs(t,a,r)}function nx(t,a="EUR",r="fr-FR",s){if(t==null||t==="")return"";const n=typeof t=="number"?t:parseFloat(String(t));if(isNaN(n))return"";try{return new Intl.NumberFormat(r,{style:"currency",currency:a,...s}).format(n)}catch{return String(n)}}function ox(t,a=0,r=!1){if(t==null||t==="")return"";const s=typeof t=="number"?t:parseFloat(String(t));return isNaN(s)?"":`${(r?s*100:s).toFixed(a)}%`}function ix(t,a="fr-FR",r){if(t==null||t==="")return"";const s=typeof t=="number"?t:parseFloat(String(t));if(isNaN(s))return"";try{return new Intl.NumberFormat(a,r).format(s)}catch{return String(s)}}function lx(t,a="FR"){if(!t)return"";const r=String(t).replace(/\s/g,"");if(a==="FR"||r.startsWith("+33")){let s=r;if(r.startsWith("+33")?s="0"+r.slice(3):r.startsWith("33")&&(s="0"+r.slice(2)),s.length===10)return s.replace(/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/,"$1 $2 $3 $4 $5");if(r.startsWith("+33")&&r.length===12)return r.replace(/(\+33)(\d)(\d{2})(\d{2})(\d{2})(\d{2})/,"$1 $2 $3 $4 $5 $6")}if(a==="US"||r.startsWith("+1")){let s=r;if(r.startsWith("+1")&&(s=r.slice(2)),s.length===10)return s.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3")}return r.length>=8&&r.match(/.{1,3}/g)?.join(" ")||r}function cx(t,a=2){if(t==null||t==="")return"";const r=typeof t=="number"?t:parseFloat(String(t));if(isNaN(r))return"";if(r===0)return"0 Bytes";const s=1024,n=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],i=Math.floor(Math.log(r)/Math.log(s)),c=n[Math.min(i,n.length-1)];return`${parseFloat((r/Math.pow(s,i)).toFixed(a))} ${c}`}function dx(t,a=50,r="..."){if(!t)return"";const s=String(t);return s.length<=a?s:s.slice(0,a-r.length)+r}function ux(t,a=2){return t?String(t).trim().split(/\s+/).slice(0,a).map(n=>n.charAt(0).toUpperCase()).join(""):""}function mx(t,a="Oui",r="Non"){return t==null?"":t?a:r}function fx(t,a=2){if(t==null)return"";try{return JSON.stringify(t,null,a)}catch{return String(t)}}const We={date:Vs,datetime:rx,time:sx,currency:nx,percentage:ox,number:ix,phone:lx,bytes:cx,truncate:dx,initials:ux,boolean:mx,json:fx},Ce=({className:t})=>e.jsx("span",{className:N("text-muted-foreground",t),children:"—"}),Ia=({value:t})=>{const[a,r]=m.useState(!1),s=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)}catch{}};return e.jsx("button",{onClick:s,className:"ml-1 p-1 rounded hover:bg-muted transition-colors",title:a?"Copié !":"Copier",children:a?e.jsx(S.Check,{className:"h-3 w-3 text-green-500"}):e.jsx(S.Copy,{className:"h-3 w-3 text-muted-foreground"})})};function hx({action:t,row:a}){const[r,s]=m.useState(!1),n=()=>{t.requiresConfirm?s(!0):t.onClick(a)},i=()=>{t.onClick(a),s(!1)},c=typeof t.disabled=="function"?t.disabled(a):t.disabled;return e.jsxs(e.Fragment,{children:[e.jsxs(_a,{onClick:n,disabled:c,className:t.variant==="destructive"?"text-destructive focus:text-destructive":"",children:[t.icon&&e.jsx("span",{className:"mr-2",children:t.icon}),t.label]}),e.jsx(cs,{open:r,onOpenChange:s,children:e.jsxs(fr,{children:[e.jsxs(hr,{children:[e.jsx(gr,{children:t.confirmTitle||"Confirmer l'action"}),e.jsx(xr,{children:t.confirmMessage||"Êtes-vous sûr de vouloir effectuer cette action ?"})]}),e.jsxs(pr,{children:[e.jsx(vr,{children:"Annuler"}),e.jsx(br,{onClick:i,className:t.variant==="destructive"?"bg-destructive hover:bg-destructive/90":"",children:"Confirmer"})]})]})})]})}const ol={cell:(t,a,r)=>t?We.date(t,r?.format||"PP",r?.locale)||e.jsx(Ce,{}):e.jsx(Ce,{}),sortingFn:"datetime",size:120,enableSorting:!0,enableFiltering:!0},il={cell:(t,a,r)=>t?We.datetime(t,r?.format||"Pp",r?.locale)||e.jsx(Ce,{}):e.jsx(Ce,{}),sortingFn:"datetime",size:160,enableSorting:!0,enableFiltering:!0},ll={cell:(t,a,r)=>t?We.time(t,r?.format||"HH:mm",r?.locale)||e.jsx(Ce,{}):e.jsx(Ce,{}),sortingFn:"datetime",size:80,enableSorting:!0},cl={cell:(t,a,r)=>{if(t==null||t==="")return e.jsx(Ce,{});const s=We.currency(t,r?.currency||"EUR",r?.locale||"fr-FR",{minimumFractionDigits:r?.minimumFractionDigits,maximumFractionDigits:r?.maximumFractionDigits});return e.jsx("span",{className:"font-mono tabular-nums",children:s})},sortingFn:"basic",size:120,enableSorting:!0,meta:{align:"right"}},dl={cell:(t,a,r)=>{if(t==null)return e.jsx(Ce,{});const s=typeof t=="number"?t:parseFloat(String(t));if(isNaN(s))return e.jsx(Ce,{});const n=r?.showValue!==!1?We.percentage(s):null;return e.jsxs("div",{className:"flex items-center gap-2 min-w-[80px]",children:[e.jsx(Va,{value:Math.min(100,Math.max(0,s)),className:N("h-2 flex-1",r?.trackColor),style:r?.progressColor?{"--progress-color":r.progressColor}:void 0}),n&&e.jsx("span",{className:"text-sm tabular-nums w-10 text-right",children:n})]})},sortingFn:"basic",size:140,enableSorting:!0,meta:{align:"right"}},ul={cell:(t,a,r)=>{if(t==null||t==="")return e.jsx(Ce,{});const s=We.number(t,r?.locale||"fr-FR",{notation:r?.notation,minimumFractionDigits:r?.minimumFractionDigits,maximumFractionDigits:r?.maximumFractionDigits});return e.jsx("span",{className:"font-mono tabular-nums",children:s})},sortingFn:"basic",size:100,enableSorting:!0,meta:{align:"right"}},Ws={cell:(t,a,r)=>{if(!t)return e.jsx(Ce,{});const s=String(t),n=r?.statusColors||{},i=r?.statusLabels||{},c=r?.statusIcons||{},l=n[s]||"bg-gray-100 text-gray-800",o=i[s]||s,d=c[s];return e.jsxs(Pe,{variant:"outline",className:N("capitalize gap-1",l),children:[d&&e.jsx("span",{className:"mr-1",children:d}),o]})},size:120,enableSorting:!0,enableFiltering:!0},ml=Ws,fl={cell:(t,a,r)=>{if(!t)return e.jsx(Ce,{});const s=String(t),n=r?.truncate&&r?.maxLength?We.truncate(s,r.maxLength):s;return e.jsxs("div",{className:"flex items-center gap-1 group",children:[e.jsxs("a",{href:`mailto:${s}`,className:"text-primary hover:underline flex items-center gap-1",onClick:i=>i.stopPropagation(),children:[e.jsx(S.Mail,{className:"h-3 w-3 flex-shrink-0"}),e.jsx("span",{className:"truncate max-w-[200px]",children:n})]}),r?.copyable&&e.jsx("span",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(Ia,{value:s})})]})},size:200,enableSorting:!0,enableFiltering:!0},hl={cell:(t,a,r)=>{if(!t)return e.jsx(Ce,{});const s=String(t),n=We.phone(s,r?.countryCode||"FR");return e.jsxs("div",{className:"flex items-center gap-1 group",children:[e.jsxs("a",{href:`tel:${s}`,className:"text-primary hover:underline flex items-center gap-1",onClick:i=>i.stopPropagation(),children:[e.jsx(S.Phone,{className:"h-3 w-3 flex-shrink-0"}),e.jsx("span",{className:"font-mono",children:n})]}),r?.copyable!==!1&&e.jsx("span",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(Ia,{value:s})})]})},size:150,enableSorting:!1,enableFiltering:!0},pl={cell:(t,a,r)=>{if(!t)return e.jsx(Ce,{});const s=String(t),n=r?.truncate&&r?.maxLength?We.truncate(s,r.maxLength):s;return e.jsxs("a",{href:s,target:r?.target||"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",onClick:i=>i.stopPropagation(),children:[e.jsx("span",{className:"truncate max-w-[200px]",children:n}),r?.showIcon!==!1&&e.jsx(S.ExternalLink,{className:"h-3 w-3 flex-shrink-0"})]})},size:200,enableSorting:!1,enableFiltering:!0},gl={cell:(t,a,r)=>{if(!t)return e.jsx(Ce,{});let s,n;if(typeof t=="string")s=t;else if(typeof t=="object"&&t!==null){const l=t,o=r?.nameKey||"name",d=r?.imageKey||"image";s=l[o],n=l[d]}const i={sm:"h-6 w-6 text-xs",md:"h-8 w-8 text-sm",lg:"h-10 w-10 text-base"},c=r?.avatarSize||"md";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(yr,{className:i[c],children:[e.jsx(wr,{src:n,alt:s}),e.jsx(jr,{children:r?.fallbackInitials!==!1&&s?We.initials(s):"?"})]}),r?.showName&&s&&e.jsx("span",{className:"truncate max-w-[150px]",children:s})]})},size:60,enableSorting:!1,enableFiltering:!1},xl={cell:(t,a,r)=>{if(t==null)return e.jsx(Ce,{});const s=!!t,n=r?.trueIcon||S.Check,i=r?.falseIcon||S.X,c=r?.trueLabel,l=r?.falseLabel,o=r?.trueColor||"text-green-600",d=r?.falseColor||"text-gray-400",u=s?n:i,f=s?c:l,p=s?o:d;return e.jsxs("div",{className:N("flex items-center gap-1",p),children:[typeof u=="function"?e.jsx(u,{className:"h-4 w-4"}):u,f&&e.jsx("span",{className:"text-sm",children:f})]})},size:80,enableSorting:!0,enableFiltering:!0};function Us(){return{cell:(t,a,r)=>{const s=r?.actions||[];return s.length?e.jsxs(Gt,{children:[e.jsx(Xt,{asChild:!0,onClick:n=>n.stopPropagation(),children:e.jsxs(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[e.jsx("span",{className:"sr-only",children:"Actions"}),e.jsx(S.MoreHorizontal,{className:"h-4 w-4"})]})}),e.jsx(Lt,{align:r?.dropdownAlign||"end",children:s.map(n=>e.jsx(hx,{action:n,row:a},n.id))})]}):null},size:50,enableSorting:!1,enableFiltering:!1,enableHiding:!1}}const bl=Us(),vl={cell:(t,a,r)=>e.jsx("span",{className:"text-muted-foreground tabular-nums",children:"#"}),size:50,enableSorting:!1,enableFiltering:!1,enableHiding:!1},yl={cell:(t,a,r)=>{if(!t)return e.jsx(Ce,{});const s=String(t),n=r?.truncate&&r?.maxLength?We.truncate(s,r.maxLength):s;return e.jsxs("div",{className:"flex items-center gap-1 group",children:[e.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:n}),r?.copyable&&e.jsx("span",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(Ia,{value:s})})]})},size:100,enableSorting:!0,enableFiltering:!0},wl={cell:(t,a,r)=>{if(t==null)return e.jsx(Ce,{});const s=typeof t=="number"?t:parseFloat(String(t));if(isNaN(s))return e.jsx(Ce,{});const n=r?.maxRating||5,i=r?.allowHalf||!1,c=r?.color||"text-yellow-400",l=Math.floor(s),o=i&&s%1>=.5,d=n-l-(o?1:0);return e.jsxs("div",{className:"flex items-center gap-0.5",children:[Array.from({length:l}).map((u,f)=>e.jsx(S.Star,{className:N("h-4 w-4 fill-current",c)},`full-${f}`)),o&&e.jsx(S.StarHalf,{className:N("h-4 w-4 fill-current",c)}),Array.from({length:d}).map((u,f)=>e.jsx(S.Star,{className:"h-4 w-4 text-muted-foreground"},`empty-${f}`)),e.jsx("span",{className:"ml-1 text-sm text-muted-foreground",children:s.toFixed(1)})]})},sortingFn:"basic",size:140,enableSorting:!0},jl={cell:(t,a,r)=>{if(t==null)return e.jsx(Ce,{});const s=typeof t=="number"?t:parseFloat(String(t));if(isNaN(s))return e.jsx(Ce,{});const n=Math.min(100,Math.max(0,s)),i=r?.showLabel!==!1;return e.jsxs("div",{className:"flex items-center gap-2 min-w-[100px]",children:[e.jsx(Va,{value:n,className:"h-2 flex-1"}),i&&e.jsxs("span",{className:"text-sm tabular-nums w-10 text-right",children:[Math.round(n),"%"]})]})},sortingFn:"basic",size:140,enableSorting:!0},Nl={cell:(t,a,r)=>{if(!t)return e.jsx(Ce,{});let s;if(typeof t=="string"){const o=r?.separator||",";s=t.split(o).map(d=>d.trim()).filter(Boolean)}else if(Array.isArray(t))s=t.map(String);else return e.jsx(Ce,{});if(!s.length)return e.jsx(Ce,{});const n=r?.maxTags||3,i=s.slice(0,n),c=s.length-n,l=r?.tagColors||{};return e.jsxs("div",{className:"flex flex-wrap gap-1",children:[i.map((o,d)=>e.jsx(Pe,{variant:"secondary",className:N("text-xs",l[o]),children:o},d)),c>0&&e.jsxs(Pe,{variant:"outline",className:"text-xs",children:["+",c]})]})},size:200,enableSorting:!1,enableFiltering:!0},Cl={cell:(t,a,r)=>{if(t==null)return e.jsx(Ce,{});const[s,n]=m.useState(!1),i=We.json(t,2);return r?.expandable!==!1&&i.length>50?e.jsx("div",{className:"relative",children:e.jsx("button",{onClick:l=>{l.stopPropagation(),n(!s)},className:"text-left w-full",children:e.jsx("code",{className:N("text-xs bg-muted px-1.5 py-0.5 rounded font-mono block",s?"whitespace-pre-wrap":"truncate max-w-[200px]"),children:i})})}):e.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded font-mono whitespace-pre-wrap",children:i})},size:200,enableSorting:!1,enableFiltering:!1},kl={cell:(t,a,r)=>{if(t==null||t==="")return e.jsx(Ce,{});const s=String(t),n=r?.truncate&&r?.maxLength?We.truncate(s,r.maxLength):s;if(r?.highlight){const i=new RegExp(`(${r.highlight})`,"gi"),c=n.split(i);return e.jsxs("div",{className:"flex items-center gap-1 group",children:[e.jsx("span",{children:c.map((l,o)=>i.test(l)?e.jsx("mark",{className:"bg-yellow-200 dark:bg-yellow-800",children:l},o):e.jsx(m.Fragment,{children:l},o))}),r?.copyable&&e.jsx("span",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(Ia,{value:s})})]})}return e.jsxs("div",{className:"flex items-center gap-1 group",children:[e.jsx("span",{className:r?.truncate?"truncate":"",children:n}),r?.copyable&&e.jsx("span",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(Ia,{value:s})})]})},enableSorting:!0,enableFiltering:!0},oa={date:ol,datetime:il,time:ll,currency:cl,percentage:dl,number:ul,status:Ws,badge:ml,email:fl,phone:hl,url:pl,avatar:gl,boolean:xl,actions:bl,index:vl,id:yl,rating:wl,progress:jl,tags:Nl,json:Cl,text:kl};function px(t){return oa[t]}const gx=Object.keys(oa);function xx(t){const a=k.useMemo(()=>({locale:"fr-FR",currency:"EUR",dateFormat:"PP",datetimeFormat:"PPpp",timeFormat:"HH:mm",...t}),[t]),r=k.useCallback(o=>{if(typeof o=="object"&&o!==null)return o;const d=o;return d==="actions"?Us():oa[d]},[]),s=k.useCallback(o=>{const{template:d,accessorKey:u,header:f,options:p={}}=o,g=r(d);if(!g)return console.warn(`Template "${String(d)}" not found, falling back to text template`),{accessorKey:u,header:f||String(u),cell:({getValue:h})=>String(h()??"")};const y=typeof d=="string"?d:void 0,j={locale:a.locale,currency:a.currency,format:y==="datetime"?a.datetimeFormat:y==="time"?a.timeFormat:a.dateFormat,...y&&t?.defaultTemplateOptions?.[y]?t.defaultTemplateOptions[y]:{},...p.templateOptions||{}},A=h=>{const b=h.getValue();return g.cell(b,h.row.original,j)},x={accessorKey:u,header:f||String(u),cell:A,size:p.size||g.size,minSize:p.minSize||g.minSize,maxSize:p.maxSize||g.maxSize,enableSorting:p.enableSorting??g.enableSorting,enableColumnFilter:p.enableFiltering??g.enableFiltering,enableHiding:p.enableHiding??g.enableHiding,meta:{...g.meta,templateName:y}};return g.sortingFn&&(x.sortingFn=g.sortingFn),g.filterFn&&(x.filterFn=g.filterFn),x},[a,t?.defaultTemplateOptions,r]),n=k.useCallback(o=>o.map(d=>s(d)),[s]),i=k.useCallback(o=>We[o],[]),c=k.useCallback(o=>o in oa,[]),l=k.useMemo(()=>Object.keys(oa),[]);return{getColumnFromTemplate:s,createColumns:n,getFormatter:i,hasTemplate:c,availableTemplates:l,formatters:We}}function Qa(){return`${Date.now()}-${Math.random().toString(36).slice(2,11)}`}const sr={string:["equals","notEquals","contains","notContains","startsWith","endsWith","isEmpty","isNotEmpty","isNull","isNotNull"],number:["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","isNull","isNotNull"],date:["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","isNull","isNotNull"],datetime:["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","isNull","isNotNull"],boolean:["equals","notEquals","isNull","isNotNull"],enum:["equals","notEquals","in","notIn","isNull","isNotNull"],array:["contains","notContains","isEmpty","isNotEmpty","isNull","isNotNull"]},Sl={equals:"est égal à",notEquals:"est différent de",contains:"contient",notContains:"ne contient pas",startsWith:"commence par",endsWith:"finit par",greaterThan:"supérieur à",greaterThanOrEqual:"supérieur ou égal à",lessThan:"inférieur à",lessThanOrEqual:"inférieur ou égal à",between:"entre",in:"est dans",notIn:"n'est pas dans",isEmpty:"est vide",isNotEmpty:"n'est pas vide",isNull:"est null",isNotNull:"n'est pas null"};function bx(t,a,r){const s=r.find(l=>l.key===a.column);if(s?.filterFn)return s.filterFn(t,a);const n=t[a.column],i=a.value,c=a.valueTo;if(a.operator==="isNull")return n==null;if(a.operator==="isNotNull")return n!=null;if(a.operator==="isEmpty")return Array.isArray(n)?n.length===0:typeof n=="string"?n.trim()==="":n==null;if(a.operator==="isNotEmpty")return Array.isArray(n)?n.length>0:typeof n=="string"?n.trim()!=="":n!=null;if(n==null)return!1;if(typeof n=="string"||s?.type==="string"){const l=String(n).toLowerCase(),o=String(i??"").toLowerCase();switch(a.operator){case"equals":return l===o;case"notEquals":return l!==o;case"contains":return l.includes(o);case"notContains":return!l.includes(o);case"startsWith":return l.startsWith(o);case"endsWith":return l.endsWith(o);default:return!0}}if(typeof n=="number"||s?.type==="number"){const l=Number(n),o=Number(i),d=c!==void 0?Number(c):void 0;switch(a.operator){case"equals":return l===o;case"notEquals":return l!==o;case"greaterThan":return l>o;case"greaterThanOrEqual":return l>=o;case"lessThan":return l<o;case"lessThanOrEqual":return l<=o;case"between":return d!==void 0&&l>=o&&l<=d;default:return!0}}if(n instanceof Date||s?.type==="date"||s?.type==="datetime"){const l=n instanceof Date?n:new Date(n),o=i instanceof Date?i:new Date(i),d=c instanceof Date?c:c?new Date(c):void 0;switch(a.operator){case"equals":return l.getTime()===o.getTime();case"notEquals":return l.getTime()!==o.getTime();case"greaterThan":return l.getTime()>o.getTime();case"greaterThanOrEqual":return l.getTime()>=o.getTime();case"lessThan":return l.getTime()<o.getTime();case"lessThanOrEqual":return l.getTime()<=o.getTime();case"between":return d!==void 0&&l>=o&&l<=d;default:return!0}}if(typeof n=="boolean"||s?.type==="boolean"){const l=!!n,o=i===!0||i==="true";switch(a.operator){case"equals":return l===o;case"notEquals":return l!==o;default:return!0}}if(a.operator==="in")return Array.isArray(i)?i.includes(n):n===i;if(a.operator==="notIn")return Array.isArray(i)?!i.includes(n):n!==i;if(Array.isArray(n))switch(a.operator){case"contains":return n.includes(i);case"notContains":return!n.includes(i);default:return!0}return!0}function El(t,a,r){const s=a.rules.filter(i=>i.enabled!==!1),n=[];for(const i of s)n.push(bx(t,i,r));for(const i of a.groups)n.push(El(t,i,r));return n.length===0?!0:a.connector==="AND"?n.every(Boolean):n.some(Boolean)}function ss(t,a){for(const r of t.rules)if(r.id===a)return{rule:r,parent:t};for(const r of t.groups){const s=ss(r,a);if(s)return s}return null}function Ca(t,a,r=null){if(t.id===a)return{group:t,parent:r};for(const s of t.groups){const n=Ca(s,a,t);if(n)return n}return null}function Mt(t){return JSON.parse(JSON.stringify(t))}function vx({data:t,config:a}){const r=k.useCallback(()=>({id:Qa(),connector:"AND",rules:[],groups:[]}),[]),[s,n]=k.useState(()=>({currentFilter:r(),presets:a.presets||[],activePresetId:null,isEditing:!1,isDirty:!1}));k.useEffect(()=>{if(!a.persistPresets||typeof window>"u")return;const u=a.storageKey||"datatable-filter-presets";try{const f=localStorage.getItem(u);if(f){const p=JSON.parse(f);n(g=>({...g,presets:[...a.presets||[],...p.filter(y=>!a.presets?.some(j=>j.id===y.id))]}))}}catch{}},[a.persistPresets,a.storageKey,a.presets]);const i=k.useCallback(u=>{if(!a.persistPresets||typeof window>"u")return;const f=a.storageKey||"datatable-filter-presets";try{const p=u.filter(g=>!a.presets?.some(y=>y.id===g.id));localStorage.setItem(f,JSON.stringify(p))}catch{}},[a.persistPresets,a.storageKey,a.presets]),c=k.useCallback(u=>{const f=a.columns.find(p=>p.key===u);return f&&(f.operators||sr[f.type])||sr.string},[a.columns]),l=k.useCallback(u=>{const f=[],p=(g,y=0)=>{a.maxNestingDepth!==void 0&&y>a.maxNestingDepth&&f.push(`Profondeur maximale d'imbrication dépassée (${a.maxNestingDepth})`),a.maxRulesPerGroup!==void 0&&g.rules.length>a.maxRulesPerGroup&&f.push(`Nombre maximum de règles par groupe dépassé (${a.maxRulesPerGroup})`);for(const j of g.rules)a.columns.find(h=>h.key===j.column)||f.push(`Colonne inconnue: ${String(j.column)}`),c(j.column).includes(j.operator)||f.push(`Opérateur invalide pour ${String(j.column)}: ${j.operator}`);for(const j of g.groups)p(j,y+1)};return p(u),{valid:f.length===0,errors:f}},[a.columns,a.maxNestingDepth,a.maxRulesPerGroup,c]),o=k.useMemo(()=>({addRule:(u,f)=>{n(p=>{const g=Mt(p.currentFilter),y=Ca(g,u);return y&&y.group.rules.push({...f,id:Qa(),enabled:!0}),{...p,currentFilter:g,isDirty:!0}})},updateRule:(u,f)=>{n(p=>{const g=Mt(p.currentFilter),y=ss(g,u);return y&&Object.assign(y.rule,f),{...p,currentFilter:g,isDirty:!0}})},removeRule:u=>{n(f=>{const p=Mt(f.currentFilter),g=ss(p,u);return g&&(g.parent.rules=g.parent.rules.filter(y=>y.id!==u)),{...f,currentFilter:p,isDirty:!0}})},addGroup:(u,f="AND")=>{n(p=>{const g=Mt(p.currentFilter),y=Ca(g,u);return y&&y.group.groups.push({id:Qa(),connector:f,rules:[],groups:[]}),{...p,currentFilter:g,isDirty:!0}})},removeGroup:u=>{n(f=>{const p=Mt(f.currentFilter),g=Ca(p,u);return g&&g.parent&&(g.parent.groups=g.parent.groups.filter(y=>y.id!==u)),{...f,currentFilter:p,isDirty:!0}})},setGroupConnector:(u,f)=>{n(p=>{const g=Mt(p.currentFilter),y=Ca(g,u);return y&&(y.group.connector=f),{...p,currentFilter:g,isDirty:!0}})},resetFilters:()=>{n(u=>({...u,currentFilter:r(),activePresetId:null,isDirty:!1}))},applyFilters:()=>{n(u=>(a.onFilterChange?.(u.currentFilter),{...u,isEditing:!1}))},saveAsPreset:(u,f)=>{n(p=>{const g={id:Qa(),name:u,description:f,filter:Mt(p.currentFilter),createdAt:new Date},y=[...p.presets,g];return i(y),a.onPresetSave?.(g),{...p,presets:y,activePresetId:g.id,isDirty:!1}})},applyPreset:u=>{n(f=>{const p=f.presets.find(y=>y.id===u);if(!p)return f;const g=Mt(p.filter);return a.onFilterChange?.(g),{...f,currentFilter:g,activePresetId:u,isDirty:!1}})},deletePreset:u=>{n(f=>{const p=f.presets.filter(g=>g.id!==u);return i(p),a.onPresetDelete?.(u),{...f,presets:p,activePresetId:f.activePresetId===u?null:f.activePresetId}})},importFilters:u=>{try{const f=JSON.parse(u),p=l(f);if(!p.valid){console.error("Invalid filter:",p.errors);return}n(g=>({...g,currentFilter:f,activePresetId:null,isDirty:!0}))}catch(f){console.error("Failed to import filters:",f)}},exportFilters:()=>JSON.stringify(s.currentFilter,null,2)}),[a,r,i,l,s.currentFilter]),d=k.useMemo(()=>!a.enabled||s.currentFilter.rules.length===0&&s.currentFilter.groups.length===0?t:t.filter(u=>El(u,s.currentFilter,a.columns)),[t,a.enabled,a.columns,s.currentFilter]);return{state:s,actions:o,filteredData:d,filteredCount:d.length,getOperatorsForColumn:c,createEmptyFilter:r,validateFilter:l}}const yx="wakastart-datatable",wx=1,fe={CACHE:"cache",SYNC_QUEUE:"syncQueue",CONFLICTS:"conflicts"};class Tl{constructor(){this.db=null,this.initPromise=null}async init(){if(!this.db)return this.initPromise?this.initPromise:(this.initPromise=new Promise((a,r)=>{if(!("indexedDB"in window)){r(new Error("IndexedDB is not supported in this browser"));return}const s=indexedDB.open(yx,wx);s.onerror=()=>{r(s.error)},s.onsuccess=()=>{this.db=s.result,a()},s.onupgradeneeded=n=>{const i=n.target.result;if(!i.objectStoreNames.contains(fe.CACHE)){const c=i.createObjectStore(fe.CACHE,{keyPath:"id"});c.createIndex("tableId","tableId",{unique:!1}),c.createIndex("timestamp","timestamp",{unique:!1})}if(!i.objectStoreNames.contains(fe.SYNC_QUEUE)){const c=i.createObjectStore(fe.SYNC_QUEUE,{keyPath:"id"});c.createIndex("tableId","tableId",{unique:!1}),c.createIndex("timestamp","timestamp",{unique:!1}),c.createIndex("rowId","rowId",{unique:!1})}if(!i.objectStoreNames.contains(fe.CONFLICTS)){const c=i.createObjectStore(fe.CONFLICTS,{keyPath:"id"});c.createIndex("tableId","tableId",{unique:!1}),c.createIndex("rowId","rowId",{unique:!1})}}}),this.initPromise)}isAvailable(){return"indexedDB"in window}close(){this.db&&(this.db.close(),this.db=null,this.initPromise=null)}async cacheData(a,r,s=1){if(await this.init(),!this.db)throw new Error("Database not initialized");const n={id:a,tableId:a,data:r,timestamp:new Date,version:s};return new Promise((i,c)=>{const d=this.db.transaction([fe.CACHE],"readwrite").objectStore(fe.CACHE).put(n);d.onsuccess=()=>i(),d.onerror=()=>c(d.error)})}async getCachedData(a){if(await this.init(),!this.db)throw new Error("Database not initialized");return new Promise((r,s)=>{const c=this.db.transaction([fe.CACHE],"readonly").objectStore(fe.CACHE).get(a);c.onsuccess=()=>r(c.result||null),c.onerror=()=>s(c.error)})}async clearCache(a){if(await this.init(),!this.db)throw new Error("Database not initialized");return new Promise((r,s)=>{const c=this.db.transaction([fe.CACHE],"readwrite").objectStore(fe.CACHE).delete(a);c.onsuccess=()=>r(),c.onerror=()=>s(c.error)})}async cleanExpiredCache(a){if(await this.init(),!this.db)throw new Error("Database not initialized");const r=new Date(Date.now()-a);return new Promise((s,n)=>{const l=this.db.transaction([fe.CACHE],"readwrite").objectStore(fe.CACHE).index("timestamp"),o=IDBKeyRange.upperBound(r),d=l.openCursor(o);let u=0;d.onsuccess=f=>{const p=f.target.result;p?(p.delete(),u++,p.continue()):s(u)},d.onerror=()=>n(d.error)})}async queueChange(a,r,s,n){if(await this.init(),!this.db)throw new Error("Database not initialized");const i=`${a}_${r}_${Date.now()}`,c={id:i,tableId:a,rowId:r,type:s,data:n,timestamp:new Date,attempts:0};return new Promise((l,o)=>{const f=this.db.transaction([fe.SYNC_QUEUE],"readwrite").objectStore(fe.SYNC_QUEUE).add(c);f.onsuccess=()=>l(i),f.onerror=()=>o(f.error)})}async getPendingChanges(a){if(await this.init(),!this.db)throw new Error("Database not initialized");return new Promise((r,s)=>{const l=this.db.transaction([fe.SYNC_QUEUE],"readonly").objectStore(fe.SYNC_QUEUE).index("tableId").getAll(a);l.onsuccess=()=>{const o=l.result;o.sort((d,u)=>new Date(d.timestamp).getTime()-new Date(u.timestamp).getTime()),r(o)},l.onerror=()=>s(l.error)})}async countPendingChanges(a){if(await this.init(),!this.db)throw new Error("Database not initialized");return new Promise((r,s)=>{const l=this.db.transaction([fe.SYNC_QUEUE],"readonly").objectStore(fe.SYNC_QUEUE).index("tableId").count(a);l.onsuccess=()=>r(l.result),l.onerror=()=>s(l.error)})}async removeFromQueue(a){if(await this.init(),!this.db)throw new Error("Database not initialized");return new Promise((r,s)=>{const c=this.db.transaction([fe.SYNC_QUEUE],"readwrite").objectStore(fe.SYNC_QUEUE).delete(a);c.onsuccess=()=>r(),c.onerror=()=>s(c.error)})}async updateAttempts(a,r){if(await this.init(),!this.db)throw new Error("Database not initialized");return new Promise((s,n)=>{const c=this.db.transaction([fe.SYNC_QUEUE],"readwrite").objectStore(fe.SYNC_QUEUE),l=c.get(a);l.onsuccess=()=>{const o=l.result;if(o){o.attempts++,r&&(o.lastError=r);const d=c.put(o);d.onsuccess=()=>s(),d.onerror=()=>n(d.error)}else s()},l.onerror=()=>n(l.error)})}async clearQueue(a){if(await this.init(),!this.db)throw new Error("Database not initialized");const r=await this.getPendingChanges(a);return new Promise((s,n)=>{const c=this.db.transaction([fe.SYNC_QUEUE],"readwrite").objectStore(fe.SYNC_QUEUE);let l=0;const o=r.length;if(o===0){s();return}r.forEach(d=>{const u=c.delete(d.id);u.onsuccess=()=>{l++,l===o&&s()},u.onerror=()=>n(u.error)})})}async addConflict(a){if(await this.init(),!this.db)throw new Error("Database not initialized");const r=`conflict_${a.tableId}_${a.rowId}_${Date.now()}`,s={id:r,...a};return new Promise((n,i)=>{const o=this.db.transaction([fe.CONFLICTS],"readwrite").objectStore(fe.CONFLICTS).add(s);o.onsuccess=()=>n(r),o.onerror=()=>i(o.error)})}async getConflicts(a){if(await this.init(),!this.db)throw new Error("Database not initialized");return new Promise((r,s)=>{const l=this.db.transaction([fe.CONFLICTS],"readonly").objectStore(fe.CONFLICTS).index("tableId").getAll(a);l.onsuccess=()=>r(l.result),l.onerror=()=>s(l.error)})}async resolveConflict(a){if(await this.init(),!this.db)throw new Error("Database not initialized");return new Promise((r,s)=>{const c=this.db.transaction([fe.CONFLICTS],"readwrite").objectStore(fe.CONFLICTS).delete(a);c.onsuccess=()=>r(),c.onerror=()=>s(c.error)})}async clearConflicts(a){if(await this.init(),!this.db)throw new Error("Database not initialized");const r=await this.getConflicts(a);return new Promise((s,n)=>{const c=this.db.transaction([fe.CONFLICTS],"readwrite").objectStore(fe.CONFLICTS);let l=0;const o=r.length;if(o===0){s();return}r.forEach(d=>{const u=c.delete(d.id);u.onsuccess=()=>{l++,l===o&&s()},u.onerror=()=>n(u.error)})})}async getStats(a){await this.init();const r=await this.getCachedData(a),s=await this.countPendingChanges(a),n=await this.getConflicts(a);return{cacheSize:r?.data?.length??0,pendingChanges:s,conflicts:n.length,lastCacheUpdate:r?.timestamp?new Date(r.timestamp):null}}}let Yr=null;function Dl(){return Yr||(Yr=new Tl),Yr}function jx(t){const{tableId:a,enabled:r=!0,conflictResolution:s="manual",onSync:n,autoSyncInterval:i=0,cacheExpiration:c,onOnlineStatusChange:l,onSyncComplete:o,onConflict:d}=t,[u,f]=k.useState(typeof navigator<"u"?navigator.onLine:!0),[p,g]=k.useState(!1),[y,j]=k.useState(0),[A,x]=k.useState(null),[h,b]=k.useState(null),[w,E]=k.useState([]),[v,$]=k.useState(null),[D,C]=k.useState(null),[T,M]=k.useState(!1),R=k.useRef(null),I=k.useMemo(()=>r?Dl():null,[r]);k.useEffect(()=>{if(!r||!I){M(!1);return}M(I.isAvailable())},[r,I]),k.useEffect(()=>{if(typeof window>"u")return;const B=()=>{f(!0),l?.(!0)},J=()=>{f(!1),l?.(!1)};return window.addEventListener("online",B),window.addEventListener("offline",J),()=>{window.removeEventListener("online",B),window.removeEventListener("offline",J)}},[l]);const U=k.useCallback(async()=>{if(!(!r||!I||!T))try{await I.init(),c&&await I.cleanExpiredCache(c);const B=await I.getCachedData(a);B&&(x(B.data),b(new Date(B.timestamp)));const J=await I.countPendingChanges(a);j(J);const Q=await I.getConflicts(a);E(Q)}catch(B){console.error("[WakaUI] Error loading offline state:",B)}},[r,I,a,T,c]);k.useEffect(()=>{U()},[U]),k.useEffect(()=>{if(!r||!u||!i||i<=0){R.current&&(clearInterval(R.current),R.current=null);return}return R.current=setInterval(()=>{y>0&&F()},i),()=>{R.current&&clearInterval(R.current)}},[r,u,i,y]);const O=k.useCallback(async B=>{if(!(!r||!I||!T))try{await I.cacheData(a,B),x(B),b(new Date)}catch(J){console.error("[WakaUI] Error caching data:",J)}},[r,I,a,T]),W=k.useCallback(async B=>{if(!(!r||!I||!T))try{await I.queueChange(a,B.rowId,B.type,B.data),j(J=>J+1)}catch(J){console.error("[WakaUI] Error queueing change:",J)}},[r,I,a,T]),F=k.useCallback(async()=>{if(!(!r||!I||!T||!n||p||!u)){g(!0),$(null);try{const B=await I.getPendingChanges(a);if(B.length===0){g(!1);return}const J=await n(B);for(const Q of J){const te=B.find(ee=>ee.id===Q.id);if(te)if(Q.success)await I.removeFromQueue(Q.id),j(ee=>Math.max(0,ee-1));else if(Q.serverData){const ee={tableId:a,rowId:te.rowId,localData:te.data,serverData:Q.serverData,localTimestamp:new Date(te.timestamp),serverTimestamp:Q.serverTimestamp||new Date,type:te.type};if(s==="manual"){const Y={id:await I.addConflict(ee),...ee};E(K=>[...K,Y]),d?.(Y)}else{let ue=null;if(s==="client-wins")ue=te.data;else if(s==="server-wins")ue=Q.serverData;else if(s==="latest-wins"){const Y=new Date(te.timestamp).getTime(),K=(Q.serverTimestamp||new Date).getTime();ue=Y>K?te.data:Q.serverData}if(await I.removeFromQueue(Q.id),j(Y=>Math.max(0,Y-1)),ue&&A){const Y=A.map(K=>K.id===te.rowId?{...K,...ue}:K);await O(Y)}}}else await I.updateAttempts(Q.id,Q.error)}C(new Date),o?.(J)}catch(B){const J=B instanceof Error?B.message:"Sync failed";$(J),console.error("[WakaUI] Sync error:",B)}finally{g(!1)}}},[r,I,a,T,n,p,u,s,A,O,d,o]),L=k.useCallback(async(B,J,Q)=>{if(!(!r||!I||!T))try{const te=w.find(K=>K.id===B);if(!te)return;let ee=null;if(J==="local"?ee=te.localData:J==="server"?ee=te.serverData:J==="merge"&&Q&&(ee=Q),ee&&A){const K=A.map(re=>re.id===te.rowId?{...re,...ee}:re);await O(K)}await I.resolveConflict(B),E(K=>K.filter(re=>re.id!==B));const Y=(await I.getPendingChanges(a)).find(K=>K.rowId===te.rowId);Y&&(await I.removeFromQueue(Y.id),j(K=>Math.max(0,K-1)))}catch(te){console.error("[WakaUI] Error resolving conflict:",te)}},[r,I,a,T,w,A,O]),_=k.useCallback(async()=>{if(!r||!I||!T)return null;try{const B=await I.getCachedData(a);return B?(x(B.data),b(new Date(B.timestamp)),B.data):null}catch(B){return console.error("[WakaUI] Error loading from cache:",B),null}},[r,I,a,T]),P=k.useCallback(async()=>{if(!(!r||!I||!T))try{await I.clearCache(a),x(null),b(null)}catch(B){console.error("[WakaUI] Error clearing cache:",B)}},[r,I,a,T]),V=k.useCallback(async()=>{if(!(!r||!I||!T))try{await I.clearQueue(a),j(0)}catch(B){console.error("[WakaUI] Error clearing queue:",B)}},[r,I,a,T]),z=k.useCallback(async()=>{await U()},[U]);return[{isOnline:u,isSyncing:p,pendingChangesCount:y,cachedData:A,lastCacheUpdate:h,conflicts:w,syncError:v,lastSyncTime:D,isAvailable:T},{cacheData:O,queueChange:W,sync:F,resolveConflict:L,loadFromCache:_,clearCache:P,clearQueue:V,refresh:z}]}function Nx({state:t,actions:a,columns:r,getOperatorsForColumn:s,className:n,maxNestingDepth:i=3}){const[c,l]=m.useState(""),[o,d]=m.useState(!1),u=()=>{c.trim()&&(a.saveAsPreset(c.trim()),l(""),d(!1))},f=()=>{const g=a.exportFilters(),y=new Blob([g],{type:"application/json"}),j=URL.createObjectURL(y),A=document.createElement("a");A.href=j,A.download="filters.json",A.click(),URL.revokeObjectURL(j)},p=()=>{const g=document.createElement("input");g.type="file",g.accept=".json",g.onchange=async y=>{const j=y.target.files?.[0];if(j){const A=await j.text();a.importFilters(A)}},g.click()};return e.jsxs("div",{className:N("space-y-4",n),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:"Filtres avancés"}),t.isDirty&&e.jsx(Pe,{variant:"secondary",className:"text-xs",children:"Modifié"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[t.presets.length>0&&e.jsxs(lt,{children:[e.jsx(ct,{asChild:!0,children:e.jsx(G,{variant:"outline",size:"sm",children:t.activePresetId&&t.presets.find(g=>g.id===t.activePresetId)?.name||"Presets"})}),e.jsx(Ye,{className:"w-64 p-2",align:"end",children:e.jsx("div",{className:"space-y-1",children:t.presets.map(g=>e.jsxs("div",{className:N("flex items-center justify-between p-2 rounded hover:bg-muted cursor-pointer",t.activePresetId===g.id&&"bg-muted"),onClick:()=>a.applyPreset(g.id),children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:g.name}),g.description&&e.jsx("div",{className:"text-xs text-muted-foreground",children:g.description})]}),e.jsx(G,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:y=>{y.stopPropagation(),a.deletePreset(g.id)},children:e.jsx(S.Trash2,{className:"h-3 w-3"})})]},g.id))})})]}),e.jsx(G,{variant:"ghost",size:"icon",onClick:p,title:"Importer",children:e.jsx(S.Upload,{className:"h-4 w-4"})}),e.jsx(G,{variant:"ghost",size:"icon",onClick:f,title:"Exporter",children:e.jsx(S.Download,{className:"h-4 w-4"})}),e.jsx(G,{variant:"ghost",size:"icon",onClick:a.resetFilters,title:"Réinitialiser",children:e.jsx(S.RotateCcw,{className:"h-4 w-4"})})]})]}),e.jsx(pt,{}),e.jsx(Al,{group:t.currentFilter,actions:a,columns:r,getOperatorsForColumn:s,depth:0,maxNestingDepth:i,isRoot:!0}),e.jsx(pt,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-2",children:o?e.jsxs(e.Fragment,{children:[e.jsx(me,{value:c,onChange:g=>l(g.target.value),placeholder:"Nom du preset...",className:"w-40 h-8",onKeyDown:g=>{g.key==="Enter"&&u(),g.key==="Escape"&&d(!1)}}),e.jsxs(G,{size:"sm",onClick:u,children:[e.jsx(S.Save,{className:"h-3 w-3 mr-1"}),"Sauvegarder"]}),e.jsx(G,{size:"sm",variant:"ghost",onClick:()=>d(!1),children:"Annuler"})]}):e.jsxs(G,{size:"sm",variant:"outline",onClick:()=>d(!0),children:[e.jsx(S.Save,{className:"h-3 w-3 mr-1"}),"Sauvegarder comme preset"]})}),e.jsx(G,{size:"sm",onClick:a.applyFilters,children:"Appliquer"})]})]})}function Al({group:t,actions:a,columns:r,getOperatorsForColumn:s,depth:n,maxNestingDepth:i,isRoot:c=!1}){const l=n<i;return e.jsxs("div",{className:N("space-y-2",!c&&"pl-4 ml-2 border-l-2 border-muted"),children:[!c&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1 bg-muted rounded-md p-1",children:[e.jsx(G,{variant:t.connector==="AND"?"default":"ghost",size:"sm",className:"h-6 px-2",onClick:()=>a.setGroupConnector(t.id,"AND"),children:"ET"}),e.jsx(G,{variant:t.connector==="OR"?"default":"ghost",size:"sm",className:"h-6 px-2",onClick:()=>a.setGroupConnector(t.id,"OR"),children:"OU"})]}),e.jsx(G,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-destructive",onClick:()=>a.removeGroup(t.id),children:e.jsx(S.Trash2,{className:"h-3 w-3"})})]}),t.rules.map(o=>e.jsx(Cx,{rule:o,actions:a,columns:r,getOperatorsForColumn:s},o.id)),t.groups.map(o=>e.jsx(Al,{group:o,actions:a,columns:r,getOperatorsForColumn:s,depth:n+1,maxNestingDepth:i},o.id)),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(G,{variant:"outline",size:"sm",onClick:()=>a.addRule(t.id,{column:r[0]?.key||"",operator:"equals",value:""}),children:[e.jsx(S.Plus,{className:"h-3 w-3 mr-1"}),"Ajouter une règle"]}),l&&e.jsxs(G,{variant:"outline",size:"sm",onClick:()=>a.addGroup(t.id,"AND"),children:[e.jsx(S.Plus,{className:"h-3 w-3 mr-1"}),"Ajouter un groupe"]})]})]})}function Cx({rule:t,actions:a,columns:r,getOperatorsForColumn:s}){const n=r.find(o=>o.key===t.column),i=s(t.column),c=!["isEmpty","isNotEmpty","isNull","isNotNull"].includes(t.operator),l=t.operator==="between";return e.jsxs("div",{className:"flex items-center gap-2 group",children:[e.jsx(S.GripVertical,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 cursor-grab"}),e.jsxs(ot,{value:t.column,onValueChange:o=>a.updateRule(t.id,{column:o}),children:[e.jsx(Xe,{className:"w-40 h-8",children:e.jsx(it,{placeholder:"Colonne"})}),e.jsx(Ke,{children:r.map(o=>e.jsx(Oe,{value:o.key,children:o.label},o.key))})]}),e.jsxs(ot,{value:t.operator,onValueChange:o=>a.updateRule(t.id,{operator:o}),children:[e.jsx(Xe,{className:"w-44 h-8",children:e.jsx(it,{placeholder:"Opérateur"})}),e.jsx(Ke,{children:i.map(o=>e.jsx(Oe,{value:o,children:Sl[o]},o))})]}),c&&e.jsx(e.Fragment,{children:n?.type==="enum"&&n.enumOptions?t.operator==="in"||t.operator==="notIn"?e.jsxs(lt,{children:[e.jsx(ct,{asChild:!0,children:e.jsx(G,{variant:"outline",className:"w-40 h-8 justify-start",children:Array.isArray(t.value)&&t.value.length>0?`${t.value.length} sélectionné(s)`:"Sélectionner..."})}),e.jsx(Ye,{className:"w-56 p-2",children:e.jsx("div",{className:"space-y-1 max-h-48 overflow-auto",children:n.enumOptions.map(o=>e.jsxs("label",{className:"flex items-center gap-2 p-1 hover:bg-muted rounded cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.value?.includes(o.value)||!1,onChange:d=>{const u=t.value||[],f=d.target.checked?[...u,o.value]:u.filter(p=>p!==o.value);a.updateRule(t.id,{value:f})},className:"rounded"}),e.jsx("span",{className:"text-sm",children:o.label})]},o.value))})})]}):e.jsxs(ot,{value:t.value,onValueChange:o=>a.updateRule(t.id,{value:o}),children:[e.jsx(Xe,{className:"w-40 h-8",children:e.jsx(it,{placeholder:"Valeur"})}),e.jsx(Ke,{children:n.enumOptions.map(o=>e.jsx(Oe,{value:o.value,children:o.label},o.value))})]}):n?.type==="boolean"?e.jsxs(ot,{value:String(t.value),onValueChange:o=>a.updateRule(t.id,{value:o==="true"}),children:[e.jsx(Xe,{className:"w-32 h-8",children:e.jsx(it,{placeholder:"Valeur"})}),e.jsxs(Ke,{children:[e.jsx(Oe,{value:"true",children:"Oui"}),e.jsx(Oe,{value:"false",children:"Non"})]})]}):n?.type==="number"?e.jsxs(e.Fragment,{children:[e.jsx(me,{type:"number",value:t.value,onChange:o=>a.updateRule(t.id,{value:o.target.valueAsNumber}),placeholder:"Valeur",className:"w-32 h-8"}),l&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"et"}),e.jsx(me,{type:"number",value:t.valueTo,onChange:o=>a.updateRule(t.id,{valueTo:o.target.valueAsNumber}),placeholder:"Valeur max",className:"w-32 h-8"})]})]}):n?.type==="date"||n?.type==="datetime"?e.jsxs(e.Fragment,{children:[e.jsx(me,{type:n.type==="datetime"?"datetime-local":"date",value:t.value,onChange:o=>a.updateRule(t.id,{value:o.target.value}),className:"w-40 h-8"}),l&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"et"}),e.jsx(me,{type:n.type==="datetime"?"datetime-local":"date",value:t.valueTo,onChange:o=>a.updateRule(t.id,{valueTo:o.target.value}),className:"w-40 h-8"})]})]}):e.jsx(me,{value:t.value,onChange:o=>a.updateRule(t.id,{value:o.target.value}),placeholder:"Valeur",className:"w-40 h-8"})}),e.jsx(Pr,{checked:t.enabled!==!1,onCheckedChange:o=>a.updateRule(t.id,{enabled:o}),className:"h-4 w-7"}),e.jsx(G,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-destructive opacity-0 group-hover:opacity-100",onClick:()=>a.removeRule(t.id),children:e.jsx(S.Trash2,{className:"h-3 w-3"})})]})}const kx={online:"En ligne",offline:"Hors ligne",syncing:"Synchronisation...",pending:"en attente",conflicts:"conflits",sync:"Synchroniser",lastSync:"Dernière sync"};function Rl({state:t,onSync:a,showDetails:r=!0,className:s,variant:n="default",labels:i}){const c={...kx,...i},{isOnline:l,isSyncing:o,pendingChangesCount:d,conflicts:u,syncError:f,lastSyncTime:p,isAvailable:g}=t;return g?n==="badge"?e.jsx(cr,{children:e.jsxs(dr,{children:[e.jsx(ur,{asChild:!0,children:e.jsxs(Pe,{variant:l?"outline":"secondary",className:N("gap-1",!l&&"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",s),children:[l?e.jsx(S.Cloud,{className:"h-3 w-3"}):e.jsx(S.CloudOff,{className:"h-3 w-3"}),d>0&&e.jsx("span",{className:"ml-1",children:d})]})}),e.jsxs(Ma,{children:[e.jsx("p",{children:l?c.online:c.offline}),d>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[d," ",c.pending]})]})]})}):n==="compact"?e.jsxs("div",{className:N("flex items-center gap-2",s),children:[e.jsx("div",{className:N("flex items-center gap-1 text-sm",l?"text-green-600 dark:text-green-400":"text-yellow-600 dark:text-yellow-400"),children:l?e.jsx(S.Cloud,{className:"h-4 w-4"}):e.jsx(S.CloudOff,{className:"h-4 w-4"})}),d>0&&e.jsx(Pe,{variant:"secondary",className:"h-5 px-1.5 text-xs",children:d}),u.length>0&&e.jsxs(Pe,{variant:"destructive",className:"h-5 px-1.5 text-xs",children:[u.length,"!"]}),a&&d>0&&l&&e.jsx(G,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:a,disabled:o,children:e.jsx(S.RefreshCw,{className:N("h-3 w-3",o&&"animate-spin")})})]}):e.jsxs("div",{className:N("flex items-center gap-3 rounded-lg border p-2 text-sm",l?"bg-green-50 dark:bg-green-950/20":"bg-yellow-50 dark:bg-yellow-950/20",s),children:[e.jsxs("div",{className:N("flex items-center gap-1.5",l?"text-green-600 dark:text-green-400":"text-yellow-600 dark:text-yellow-400"),children:[o?e.jsx(S.RefreshCw,{className:"h-4 w-4 animate-spin"}):l?e.jsx(S.Cloud,{className:"h-4 w-4"}):e.jsx(S.CloudOff,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:o?c.syncing:l?c.online:c.offline})]}),r&&e.jsxs(e.Fragment,{children:[d>0&&e.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(S.Upload,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:[d," ",c.pending]})]}),u.length>0&&e.jsxs("div",{className:"flex items-center gap-1 text-destructive",children:[e.jsx(S.AlertCircle,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:[u.length," ",c.conflicts]})]}),p&&d===0&&e.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(S.Check,{className:"h-3.5 w-3.5 text-green-600"}),e.jsxs("span",{className:"text-xs",children:[c.lastSync,": ",Sx(p)]})]}),f&&e.jsxs("div",{className:"flex items-center gap-1 text-destructive text-xs",children:[e.jsx(S.AlertCircle,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:f})]})]}),a&&d>0&&l&&e.jsxs(G,{variant:"outline",size:"sm",className:"ml-auto h-7",onClick:a,disabled:o,children:[e.jsx(S.RefreshCw,{className:N("mr-1.5 h-3.5 w-3.5",o&&"animate-spin")}),c.sync]})]}):null}function Sx(t){const r=new Date().getTime()-t.getTime(),s=Math.floor(r/1e3),n=Math.floor(s/60),i=Math.floor(n/60),c=Math.floor(i/24);return s<60?"à l'instant":n<60?`il y a ${n} min`:i<24?`il y a ${i}h`:`il y a ${c}j`}Rl.displayName="DataTableSyncStatus";const Ex={title:"Résolution des conflits",description:"Des modifications ont été effectuées à la fois localement et sur le serveur. Choisissez quelle version conserver.",localVersion:"Version locale",serverVersion:"Version serveur",keepLocal:"Garder local",keepServer:"Garder serveur",merge:"Fusionner",resolve:"Résoudre",skip:"Ignorer",noConflicts:"Aucun conflit à résoudre",conflictType:{create:"Création",update:"Modification",delete:"Suppression"}};function Pl({conflicts:t,onResolve:a,open:r=!1,onOpenChange:s,mode:n="dialog",labels:i,renderData:c,displayKeys:l,keyLabels:o}){const d={...Ex,...i},[u,f]=m.useState(0),[p,g]=m.useState(!1),[y,j]=m.useState(!1),[A,x]=m.useState({}),h=t[u],b=t.length;m.useEffect(()=>{t.length===0?f(0):u>=t.length&&f(Math.max(0,t.length-1))},[t,u]),m.useEffect(()=>{j(!1),h&&x({...h.serverData||{},...h.localData||{}})},[h]);const w=async $=>{if(h){g(!0);try{await a(h.id,$,$==="merge"?A:void 0),u<b-1&&f(D=>D+1)}finally{g(!1)}}},E=()=>{u<b-1&&f($=>$+1)},v=e.jsx(e.Fragment,{children:b===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center text-muted-foreground",children:[e.jsx(S.Check,{className:"h-12 w-12 text-green-500 mb-4"}),e.jsx("p",{children:d.noConflicts})]}):h?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Pe,{variant:"outline",className:"gap-1",children:[e.jsx(S.AlertTriangle,{className:"h-3 w-3"}),d.conflictType?.[h.type]||h.type]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[u+1," / ",b]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ID: ",e.jsx("code",{className:"bg-muted px-1 rounded",children:h.rowId})]}),y?e.jsx(Tx,{localData:h.localData,serverData:h.serverData,mergedData:A,onChange:x,displayKeys:l,keyLabels:o}):e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Fn,{title:d.localVersion,data:h.localData,timestamp:h.localTimestamp,variant:"local",renderData:c,displayKeys:l,keyLabels:o}),e.jsx(Fn,{title:d.serverVersion,data:h.serverData,timestamp:h.serverTimestamp,variant:"server",renderData:c,displayKeys:l,keyLabels:o})]}),e.jsx(pt,{}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(G,{variant:"ghost",size:"sm",onClick:E,children:d.skip}),e.jsx("div",{className:"flex items-center gap-2",children:y?e.jsxs(e.Fragment,{children:[e.jsxs(G,{variant:"outline",size:"sm",onClick:()=>j(!1),children:[e.jsx(S.X,{className:"mr-1.5 h-3.5 w-3.5"}),"Annuler"]}),e.jsxs(G,{size:"sm",onClick:()=>w("merge"),disabled:p,children:[e.jsx(S.Check,{className:"mr-1.5 h-3.5 w-3.5"}),"Appliquer fusion"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{variant:"outline",size:"sm",onClick:()=>w("local"),disabled:p,children:d.keepLocal}),e.jsxs(G,{variant:"outline",size:"sm",onClick:()=>j(!0),children:[e.jsx(S.GitMerge,{className:"mr-1.5 h-3.5 w-3.5"}),d.merge]}),e.jsx(G,{size:"sm",onClick:()=>w("server"),disabled:p,children:d.keepServer})]})})]})]}):null});return n==="sheet"?e.jsx(Wa,{open:r,onOpenChange:s,children:e.jsxs(ma,{className:"sm:max-w-xl",children:[e.jsxs(Dr,{children:[e.jsxs(Ar,{className:"flex items-center gap-2",children:[e.jsx(S.AlertTriangle,{className:"h-5 w-5 text-yellow-500"}),d.title]}),e.jsx(Rr,{children:d.description})]}),e.jsx("div",{className:"mt-6",children:v})]})}):e.jsx(Nr,{open:r,onOpenChange:s,children:e.jsxs(Oa,{className:"max-w-2xl",children:[e.jsxs(Cr,{children:[e.jsxs(kr,{className:"flex items-center gap-2",children:[e.jsx(S.AlertTriangle,{className:"h-5 w-5 text-yellow-500"}),d.title]}),e.jsx(Sr,{children:d.description})]}),v]})})}function Fn({title:t,data:a,timestamp:r,variant:s,renderData:n,displayKeys:i,keyLabels:c}){return e.jsxs("div",{className:N("rounded-lg border p-3",s==="local"?"border-blue-200 bg-blue-50/50 dark:border-blue-800 dark:bg-blue-950/20":"border-green-200 bg-green-50/50 dark:border-green-800 dark:bg-green-950/20"),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"font-medium text-sm",children:t}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(r).toLocaleString()})]}),e.jsx($t,{className:"h-32",children:n?n(a,s):a?e.jsx("div",{className:"space-y-1 text-sm",children:(i||Object.keys(a)).map(l=>{const o=a[l];return o===void 0?null:e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs("span",{className:"text-muted-foreground",children:[c?.[l]||l,":"]}),e.jsx("span",{className:"font-mono truncate max-w-[150px]",children:ns(o)})]},l)})}):e.jsx("span",{className:"text-muted-foreground italic",children:"Aucune donnée"})})]})}function Tx({localData:t,serverData:a,mergedData:r,onChange:s,displayKeys:n,keyLabels:i}){const c=n||[...new Set([...Object.keys(t||{}),...Object.keys(a||{})])],l=(o,d)=>{const u=d==="local"?t?.[o]:a?.[o];s({...r,[o]:u})};return e.jsxs("div",{className:"rounded-lg border p-4 bg-muted/30",children:[e.jsxs("div",{className:"text-sm font-medium mb-3 flex items-center gap-2",children:[e.jsx(S.GitMerge,{className:"h-4 w-4"}),"Choisissez les valeurs pour chaque champ"]}),e.jsx("div",{className:"space-y-3",children:c.map(o=>{const d=t?.[o],u=a?.[o],f=r?.[o],p=f===d&&d!==u,g=f===u&&d!==u;return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:i?.[o]||o}),e.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] gap-2 items-center",children:[e.jsx("button",{type:"button",onClick:()=>l(o,"local"),className:N("p-2 rounded border text-left text-sm truncate",p?"border-blue-500 bg-blue-50 dark:bg-blue-950/50":"border-border hover:border-blue-300"),children:ns(d)}),e.jsx(S.ArrowRight,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("button",{type:"button",onClick:()=>l(o,"server"),className:N("p-2 rounded border text-left text-sm truncate",g?"border-green-500 bg-green-50 dark:bg-green-950/50":"border-border hover:border-green-300"),children:ns(u)})]})]},o)})})]})}function ns(t){if(t===null)return"null";if(t===void 0)return"undefined";if(typeof t=="object")try{return JSON.stringify(t)}catch{return"[Object]"}return String(t)}Pl.displayName="DataTableConflictResolver";const Dx=["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#10b981","#14b8a6","#06b6d4","#0ea5e9","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#000000","#6b7280","#ffffff"];function Ml(t,a,r){a/=100,r/=100;const s=a*Math.min(r,1-r),n=i=>{const c=(i+t/30)%12;return r-s*Math.max(Math.min(c-3,9-c,1),-1)};return[Math.round(n(0)*255),Math.round(n(8)*255),Math.round(n(4)*255)]}function ka(t,a,r){t/=255,a/=255,r/=255;const s=Math.max(t,a,r),n=Math.min(t,a,r);let i=0,c=0;const l=(s+n)/2;if(s!==n){const o=s-n;switch(c=l>.5?o/(2-s-n):o/(s+n),s){case t:i=((a-r)/o+(a<r?6:0))*60;break;case a:i=((r-t)/o+2)*60;break;case r:i=((t-a)/o+4)*60;break}}return[Math.round(i),Math.round(c*100),Math.round(l*100)]}function Ax(t){const a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return a?[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]:null}function In(t,a,r){return"#"+[t,a,r].map(s=>s.toString(16).padStart(2,"0")).join("")}function Za(t){if(t.startsWith("#"))return Ax(t);const a=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(a)return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3])];const r=t.match(/hsl\((\d+),\s*(\d+)%?,\s*(\d+)%?\)/);return r?Ml(parseInt(r[1]),parseInt(r[2]),parseInt(r[3])):null}function Ln(t,a,r,s){switch(s){case"hex":return In(t,a,r);case"rgb":return`rgb(${t}, ${a}, ${r})`;case"hsl":{const[n,i,c]=ka(t,a,r);return`hsl(${n}, ${i}%, ${c}%)`}default:return In(t,a,r)}}const Hs=m.forwardRef(({value:t="#3b82f6",onChange:a,format:r="hex",showAlpha:s=!1,showPresets:n=!0,presets:i=Dx,showEyeDropper:c=!0,disabled:l=!1,placeholder:o="Sélectionner une couleur",className:d,size:u="md"},f)=>{const[p,g]=m.useState(!1),[y,j]=m.useState(0),[A,x]=m.useState(100),[h,b]=m.useState(50),[w,E]=m.useState(t),v=m.useRef(null),$=m.useRef(null);m.useEffect(()=>{const O=Za(t);if(O){const[W,F,L]=ka(...O);j(W),x(F),b(L),E(t)}},[t]);const D=m.useCallback((O,W,F)=>{const[L,_,P]=Ml(O,W,F),V=Ln(L,_,P,r);E(V),a?.(V)},[r,a]),C=O=>{O.preventDefault();const W=v.current?.getBoundingClientRect();if(!W)return;const F=(P,V)=>{const z=Math.max(0,Math.min(100,(P-W.left)/W.width*100)),X=Math.max(0,Math.min(100,100-(V-W.top)/W.height*100));x(z),b(X),D(y,z,X)};F(O.clientX,O.clientY);const L=P=>F(P.clientX,P.clientY),_=()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",_)};document.addEventListener("mousemove",L),document.addEventListener("mouseup",_)},T=O=>{O.preventDefault();const W=$.current?.getBoundingClientRect();if(!W)return;const F=P=>{const V=Math.max(0,Math.min(360,(P-W.left)/W.width*360));j(V),D(V,A,h)};F(O.clientX);const L=P=>F(P.clientX),_=()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",_)};document.addEventListener("mousemove",L),document.addEventListener("mouseup",_)},M=async()=>{if("EyeDropper"in window)try{const W=await new window.EyeDropper().open(),F=Za(W.sRGBHex);if(F){const[L,_,P]=ka(...F);j(L),x(_),b(P),D(L,_,P)}}catch{}},R=O=>{const W=O.target.value;E(W);const F=Za(W);if(F){const[L,_,P]=ka(...F);j(L),x(_),b(P),a?.(Ln(...F,r))}},I={sm:"h-7 w-7",md:"h-9 w-9",lg:"h-11 w-11"},U=c&&typeof window<"u"&&"EyeDropper"in window;return e.jsxs(lt,{open:p,onOpenChange:g,children:[e.jsx(ct,{asChild:!0,children:e.jsx(G,{ref:f,variant:"outline",disabled:l,className:N("p-0.5 rounded-md border",I[u],d),title:o,children:e.jsx("div",{className:"w-full h-full rounded",style:{backgroundColor:t}})})}),e.jsx(Ye,{className:"w-64 p-3",align:"start",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{ref:v,className:"relative w-full h-36 rounded cursor-crosshair",style:{background:`
|
|
81
|
+
`);if(!r||r.trim().length===0)throw new Error(`No CSS generated for theme "${t}"`);return ne.logger.debug(`Generated CSS for theme "${t}" (${r.length} chars)`),r}function yl({children:t,themes:s,defaultTheme:a="default",onThemeChange:n,onError:r,enableDarkMode:o=!1,fetchHeaders:i={},fetchTimeout:c=1e4}){const[l,u]=d.useState(a),[f,m]=d.useState(!0),[p,g]=d.useState(new Set),[C,y]=d.useState(!1),[N,v]=d.useState(!1),[x,w]=d.useState([]),k=d.useRef(new Map),D=d.useRef(new Set),S=d.useMemo(()=>[...s,...x],[s,x]);d.useEffect(()=>{D.current=p},[p]);const F=d.useCallback(async z=>{const L=new AbortController,_=setTimeout(()=>L.abort(),c);try{const R=await fetch(z,{signal:L.signal,headers:{Accept:"application/json","Cache-Control":"no-cache",...i}});if(clearTimeout(_),!R.ok)throw new Error(`HTTP ${R.status}: ${R.statusText}`);return await R.json()}catch(R){throw clearTimeout(_),R}},[i,c]),A=d.useCallback(async z=>{const L=S.find(_=>_.id===z);if(!L)return ne.logger.debug(`Theme "${z}" not found in config`),null;if(L.registryItem)return Za(z,L.registryItem);if(L.jsonUrl)try{const _=await F(L.jsonUrl);return Za(z,_)}catch(_){throw ne.handleError(_,{code:ne.ErrorCode.THEME_LOAD_FAILED,context:`ThemeProvider.loadThemeCSS(${z}) from ${L.jsonUrl}`,onError:r})}return ne.logger.debug(`No CSS source for theme "${z}"`),null},[S,F,r]),T=d.useCallback((z,L)=>{if(typeof document>"u")return;document.querySelectorAll("style[data-theme-styles]").forEach(U=>U.remove()),k.current.clear();const R=document.createElement("style");R.setAttribute("data-theme-id",z),R.setAttribute("data-theme-styles","active"),R.textContent=L,document.head.appendChild(R),k.current.set(z,R),ne.logger.debug(`CSS injected for theme "${z}" (${L.length} chars)`)},[]),M=d.useCallback(z=>{if(typeof document>"u")return;document.documentElement.setAttribute("data-theme",z);try{localStorage.setItem("waka-theme",z)}catch(_){console.warn("[ThemeProvider] Could not save theme to localStorage:",_)}ne.logger.debug(`Theme applied: data-theme="${z}"`)},[]),I=d.useCallback(async(z,L)=>{m(!0);try{const _=Za(z,L);w(R=>{const U=R.findIndex(Z=>Z.id===z),$={id:z,label:L.name||z,registryItem:L};if(U>=0){const Z=[...R];return Z[U]=$,Z}return[...R,$]}),T(z,_),g(R=>new Set(R).add(z)),await new Promise(R=>requestAnimationFrame(R)),M(z),u(z),n?.(z)}catch(_){throw ne.handleError(_,{code:ne.ErrorCode.THEME_LOAD_FAILED,context:`ThemeProvider.loadThemeFromJSON(${z})`,onError:r})}finally{m(!1)}},[T,M,n,r]),E=d.useCallback(async z=>{if(!D.current.has(z))try{await A(z)&&g(_=>new Set(_).add(z))}catch(L){throw ne.handleError(L,{code:ne.ErrorCode.THEME_LOAD_FAILED,context:`ThemeProvider.preloadTheme(${z})`,onError:r})}},[A,r]),P=d.useCallback(async z=>{m(!0);try{const L=await A(z);L&&(T(z,L),g(_=>new Set(_).add(z)),await new Promise(_=>requestAnimationFrame(_))),M(z),u(z),n?.(z)}catch(L){throw ne.handleError(L,{code:ne.ErrorCode.THEME_APPLY_FAILED,context:`ThemeProvider.changeTheme(${z})`,onError:r})}finally{m(!1)}},[A,T,M,n,r]),G=d.useCallback(z=>p.has(z),[p]);d.useEffect(()=>{if(C)return;(async()=>{m(!0);try{let L=a;if(typeof window<"u"){const R=localStorage.getItem("waka-theme");R&&S.some(U=>U.id===R)&&(L=R)}const _=await A(L);_?(T(L,_),g(new Set([L])),await new Promise(R=>requestAnimationFrame(R))):g(new Set([L])),M(L),u(L)}catch(L){console.error("[ThemeProvider] Error initializing:",L),M(a),u(a),g(new Set([a]))}finally{m(!1),y(!0)}})()},[C,a,S,A,T,M]);const H=d.useCallback(()=>{o&&v(z=>{const L=!z,_=document.documentElement;L?_.classList.add("dark"):_.classList.remove("dark");try{localStorage.setItem("waka-dark-mode",L?"dark":"light")}catch(R){console.warn("[ThemeProvider] Could not save dark mode to localStorage:",R)}return L})},[o]);d.useEffect(()=>{if(!o||typeof window>"u")return;let z=!1;try{const U=localStorage.getItem("waka-dark-mode");U!==null?z=U==="dark":(z=window.matchMedia("(prefers-color-scheme: dark)").matches,localStorage.setItem("waka-dark-mode",z?"dark":"light"))}catch(U){console.warn("[ThemeProvider] Could not read dark mode from localStorage:",U)}v(z);const L=document.documentElement;z?L.classList.add("dark"):L.classList.remove("dark");const _=window.matchMedia("(prefers-color-scheme: dark)"),R=U=>{try{localStorage.getItem("waka-dark-mode")||(v(U.matches),U.matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),localStorage.setItem("waka-dark-mode",U.matches?"dark":"light"))}catch{}};return _.addEventListener("change",R),()=>{_.removeEventListener("change",R)}},[]),d.useEffect(()=>()=>{k.current.forEach(z=>{z.parentNode&&z.parentNode.removeChild(z)}),k.current.clear()},[]);const X={currentTheme:l,themes:S,changeTheme:P,isLoading:f,loadedThemes:p,preloadTheme:E,isThemeLoaded:G,isDarkMode:N,toggleDarkMode:H,loadThemeFromJSON:I};return e.jsx(vl.Provider,{value:X,children:t})}function Bs(){const t=d.useContext(vl);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}function Zx(){try{return Bs()}catch{return null}}const wl=lt.cva("w-full",{variants:{size:{sm:"max-w-2xl",base:"max-w-4xl",lg:"max-w-6xl",full:"max-w-full"}},defaultVariants:{size:"base"}});function en(t){return{name:t.name,type:"registry:style",cssVars:{light:{background:t.colors.background,foreground:t.colors.foreground,card:t.colors.card,"card-foreground":t.colors.cardForeground,popover:t.colors.popover,"popover-foreground":t.colors.popoverForeground,primary:t.colors.primary,"primary-foreground":t.colors.primaryForeground,secondary:t.colors.secondary,"secondary-foreground":t.colors.secondaryForeground,muted:t.colors.muted,"muted-foreground":t.colors.mutedForeground,accent:t.colors.accent,"accent-foreground":t.colors.accentForeground,destructive:t.colors.destructive,"destructive-foreground":t.colors.destructiveForeground,border:t.colors.border,input:t.colors.input,ring:t.colors.ring,...t.colors.chart1&&{"chart-1":t.colors.chart1},...t.colors.chart2&&{"chart-2":t.colors.chart2},...t.colors.chart3&&{"chart-3":t.colors.chart3},...t.colors.chart4&&{"chart-4":t.colors.chart4},...t.colors.chart5&&{"chart-5":t.colors.chart5}}}}}function eg(t){const s=t.cssVars?.light||{};return{name:t.name,colors:{background:s.background||"#ffffff",foreground:s.foreground||"#0a0a0a",card:s.card||"#ffffff",cardForeground:s["card-foreground"]||"#0a0a0a",popover:s.popover||"#ffffff",popoverForeground:s["popover-foreground"]||"#0a0a0a",primary:s.primary||"#0a0a0a",primaryForeground:s["primary-foreground"]||"#fafafa",secondary:s.secondary||"#f4f4f5",secondaryForeground:s["secondary-foreground"]||"#0a0a0a",muted:s.muted||"#f4f4f5",mutedForeground:s["muted-foreground"]||"#737373",accent:s.accent||"#f4f4f5",accentForeground:s["accent-foreground"]||"#0a0a0a",destructive:s.destructive||"#ef4444",destructiveForeground:s["destructive-foreground"]||"#fafafa",border:s.border||"#e4e4e7",input:s.input||"#e4e4e7",ring:s.ring||"#0a0a0a",chart1:s["chart-1"],chart2:s["chart-2"],chart3:s["chart-3"],chart4:s["chart-4"],chart5:s["chart-5"]}}}const Nl=d.forwardRef(({className:t,size:s,onThemeChange:a,onThemeLoad:n,onThemeSave:r,initialTheme:o,showPreview:i=!0,showExport:c=!0,showImport:l=!0,allowCustomColors:u=!0,...f},m)=>{const p=Zx(),g=p?.currentTheme,C=p?.themes||[],y=p?.loadThemeFromJSON,N=p?.isDarkMode,v=p?.toggleDarkMode,[x,w]=O.useState(o||{name:"Custom Theme",description:"Thème personnalisé",colors:{background:"#ffffff",foreground:"#0a0a0a",card:"#ffffff",cardForeground:"#0a0a0a",popover:"#ffffff",popoverForeground:"#0a0a0a",primary:"#0a0a0a",primaryForeground:"#fafafa",secondary:"#f4f4f5",secondaryForeground:"#0a0a0a",muted:"#f4f4f5",mutedForeground:"#737373",accent:"#f4f4f5",accentForeground:"#0a0a0a",destructive:"#ef4444",destructiveForeground:"#fafafa",border:"#e4e4e7",input:"#e4e4e7",ring:"#0a0a0a"}}),[k,D]=O.useState(!1),[S,F]=O.useState(null),[A,T]=O.useState(null),[M,I]=O.useState(""),[E,P]=O.useState(!1),[G,H]=O.useState("auto"),X=O.useCallback(async $=>{if(y){const Z=$.name.toLowerCase().replace(/\s+/g,"-"),Q=en($);try{await y(Z,Q)}catch(K){console.error("[WakaThemeManager] Failed to apply theme:",K)}}else{const Z=document.documentElement;Object.entries($.colors).forEach(([Q,K])=>{const q=`--${Q.replace(/([A-Z])/g,"-$1").toLowerCase()}`;Z.style.setProperty(q,K)})}},[y]),z=async $=>{D(!0),F(null),T(null);try{const Z=await fetch($);if(!Z.ok)throw new Error(`Erreur HTTP: ${Z.status}`);const Q=await Z.json();let K;if(Q.cssVars)K=eg(Q),K.description=`Imported from ${$}`;else if(Q.colors)K={name:Q.name||"Imported Theme",description:Q.description||"",author:Q.author||"",version:Q.version||"1.0.0",colors:{background:Q.colors.background||"#ffffff",foreground:Q.colors.foreground||"#0a0a0a",card:Q.colors.card||"#ffffff",cardForeground:Q.colors.cardForeground||"#0a0a0a",popover:Q.colors.popover||"#ffffff",popoverForeground:Q.colors.popoverForeground||"#0a0a0a",primary:Q.colors.primary||"#0a0a0a",primaryForeground:Q.colors.primaryForeground||"#fafafa",secondary:Q.colors.secondary||"#f4f4f5",secondaryForeground:Q.colors.secondaryForeground||"#0a0a0a",muted:Q.colors.muted||"#f4f4f5",mutedForeground:Q.colors.mutedForeground||"#737373",accent:Q.colors.accent||"#f4f4f5",accentForeground:Q.colors.accentForeground||"#0a0a0a",destructive:Q.colors.destructive||"#ef4444",destructiveForeground:Q.colors.destructiveForeground||"#fafafa",border:Q.colors.border||"#e4e4e7",input:Q.colors.input||"#e4e4e7",ring:Q.colors.ring||"#0a0a0a",chart1:Q.colors.chart1,chart2:Q.colors.chart2,chart3:Q.colors.chart3,chart4:Q.colors.chart4,chart5:Q.colors.chart5}};else throw new Error("Format de thème invalide. Attendu: shadcn registry-item ou TweakCN");w(K),await X(K),n?.(K),T("Thème chargé avec succès !")}catch(Z){F(Z instanceof Error?Z.message:"Erreur lors du chargement du thème")}finally{D(!1)}},L=()=>{const $=en(x),Z=JSON.stringify($,null,2),Q=new Blob([Z],{type:"application/json"}),K=URL.createObjectURL(Q),q=document.createElement("a");q.href=K,q.download=`${x.name.toLowerCase().replace(/\s+/g,"-")}-theme.json`,document.body.appendChild(q),q.click(),document.body.removeChild(q),URL.revokeObjectURL(K)},_=async()=>{try{const $=en(x);await navigator.clipboard.writeText(JSON.stringify($,null,2)),P(!0),setTimeout(()=>P(!1),2e3)}catch{F("Impossible de copier le thème")}},R=($,Z)=>{const Q={...x,colors:{...x.colors,[$]:Z}};w(Q),X(Q),a?.(Q)},U=()=>{r?.(x),T("Thème sauvegardé !")};return O.useEffect(()=>{X(x)},[]),O.useEffect(()=>{G==="dark"?v&&!N?v():document.documentElement.classList.add("dark"):G==="light"&&(v&&N?v():document.documentElement.classList.remove("dark"))},[G,N,v]),e.jsx("div",{ref:m,className:b.cn(wl({size:s}),t),...f,children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Gestionnaire de Thèmes"}),e.jsx("p",{className:"text-muted-foreground",children:"Créez, importez et prévisualisez vos thèmes (format shadcn registry-item)"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(ye,{variant:"outline",className:"flex items-center gap-1",children:[e.jsx(h.Palette,{className:"h-3 w-3"}),x.name]})})]}),S&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-lg text-destructive",children:[e.jsx(h.AlertCircle,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:S})]}),A&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-green-500/10 border border-green-500/20 rounded-lg text-green-600",children:[e.jsx(h.CheckCircle,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:A})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs(Ce,{children:[e.jsx(Ve,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Settings,{className:"h-5 w-5"}),"Informations du thème"]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(j.Label,{htmlFor:"theme-name",children:"Nom"}),e.jsx(j.Input,{id:"theme-name",value:x.name,onChange:$=>w({...x,name:$.target.value}),placeholder:"Mon thème"})]}),e.jsxs("div",{children:[e.jsx(j.Label,{htmlFor:"theme-author",children:"Auteur"}),e.jsx(j.Input,{id:"theme-author",value:x.author||"",onChange:$=>w({...x,author:$.target.value}),placeholder:"Votre nom"})]})]}),e.jsxs("div",{children:[e.jsx(j.Label,{htmlFor:"theme-description",children:"Description"}),e.jsx(j.Textarea,{id:"theme-description",value:x.description||"",onChange:$=>w({...x,description:$.target.value}),placeholder:"Description du thème...",rows:3})]})]})]}),(l||c)&&e.jsxs(Ce,{children:[e.jsxs(Ve,{children:[e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Upload,{className:"h-5 w-5"}),"Import / Export"]}),e.jsx(et,{children:"Supporte le format shadcn registry-item et TweakCN"})]}),e.jsxs(Pe,{className:"space-y-4",children:[l&&e.jsxs("div",{children:[e.jsx(j.Label,{htmlFor:"import-url",children:"URL du thème JSON"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j.Input,{id:"import-url",value:M,onChange:$=>I($.target.value),placeholder:"https://example.com/theme.json",className:"flex-1"}),e.jsx(j.Button,{onClick:()=>z(M),disabled:!M||k,size:"sm",children:k?e.jsx(h.RefreshCw,{className:"h-4 w-4 animate-spin"}):e.jsx(h.Download,{className:"h-4 w-4"})})]})]}),c&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(j.Button,{onClick:L,variant:"outline",className:"flex-1",children:[e.jsx(h.Download,{className:"h-4 w-4 mr-2"}),"Exporter JSON"]}),e.jsx(j.Button,{onClick:_,variant:"outline",children:E?e.jsx(h.Check,{className:"h-4 w-4"}):e.jsx(h.Copy,{className:"h-4 w-4"})})]})]})]}),i&&e.jsxs(Ce,{children:[e.jsx(Ve,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Eye,{className:"h-5 w-5"}),"Prévisualisation"]})}),e.jsx(Pe,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(j.Button,{variant:G==="light"?"default":"outline",size:"sm",onClick:()=>H("light"),children:[e.jsx(h.Sun,{className:"h-4 w-4 mr-2"}),"Clair"]}),e.jsxs(j.Button,{variant:G==="dark"?"default":"outline",size:"sm",onClick:()=>H("dark"),children:[e.jsx(h.Moon,{className:"h-4 w-4 mr-2"}),"Sombre"]}),e.jsxs(j.Button,{variant:G==="auto"?"default":"outline",size:"sm",onClick:()=>H("auto"),children:[e.jsx(h.Monitor,{className:"h-4 w-4 mr-2"}),"Auto"]})]}),g&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Thème actuel:"}),e.jsx("span",{className:"font-medium",children:g})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Mode sombre:"}),e.jsx("span",{className:"font-medium",children:N?"Activé":"Désactivé"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Thèmes disponibles:"}),e.jsx("span",{className:"font-medium",children:C.length})]})]})]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j.Button,{onClick:U,className:"flex-1",children:"Sauvegarder le thème"}),e.jsxs(j.Button,{variant:"outline",onClick:()=>window.open("https://ui.shadcn.com/themes","_blank"),children:[e.jsx(h.ExternalLink,{className:"h-4 w-4 mr-2"}),"shadcn/ui"]})]})]}),u&&e.jsx("div",{className:"space-y-6",children:e.jsxs(Ce,{children:[e.jsxs(Ve,{children:[e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Palette,{className:"h-5 w-5"}),"Couleurs du thème"]}),e.jsx(et,{children:"Cliquez sur une couleur pour la modifier"})]}),e.jsx(Pe,{children:e.jsx("div",{className:"grid grid-cols-2 gap-4",children:Object.entries(x.colors).map(([$,Z])=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{htmlFor:`color-${$}`,className:"text-sm font-medium",children:$.replace(/([A-Z])/g," $1").replace(/^./,Q=>Q.toUpperCase())}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"w-10 h-10 rounded border border-border cursor-pointer",style:{backgroundColor:Z},onClick:()=>{document.getElementById(`color-${$}`)?.click()}}),e.jsx(j.Input,{id:`color-${$}`,type:"color",value:Z,onChange:Q=>R($,Q.target.value),className:"flex-1 h-10"})]})]},$))})})]})})]}),i&&e.jsxs(Ce,{children:[e.jsx(Ve,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Eye,{className:"h-5 w-5"}),"Prévisualisation en temps réel"]})}),e.jsx(Pe,{children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Boutons"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(j.Button,{size:"sm",children:"Primary"}),e.jsx(j.Button,{variant:"secondary",size:"sm",children:"Secondary"}),e.jsx(j.Button,{variant:"outline",size:"sm",children:"Outline"}),e.jsx(j.Button,{variant:"destructive",size:"sm",children:"Destructive"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Cards"}),e.jsxs(Ce,{className:"p-3",children:[e.jsx(Oe,{className:"text-sm",children:"Exemple de carte"}),e.jsx(et,{className:"text-xs",children:"Contenu de la carte avec le nouveau thème"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Inputs"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Input,{placeholder:"Input normal"}),e.jsx(j.Input,{placeholder:"Input avec erreur",className:"border-destructive"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Badges"}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsx(ye,{children:"Default"}),e.jsx(ye,{variant:"secondary",children:"Secondary"}),e.jsx(ye,{variant:"destructive",children:"Destructive"}),e.jsx(ye,{variant:"outline",children:"Outline"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Séparateur"}),e.jsx(j.Separator,{}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Texte avec couleur muted"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Progress"}),e.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:e.jsx("div",{className:"bg-primary h-2 rounded-full",style:{width:"60%"}})})]})]})})]})]})})});Nl.displayName="WakaThemeManager";const Cl=({discoveryUrl:t,onRealmSelected:s,loginButtonText:a="Se connecter",emailPlaceholder:n="Entrez votre email",modalTitle:r="Sélectionnez votre organisation",modalDescription:o="Plusieurs organisations ont été trouvées pour votre email",onError:i,disabled:c=!1,className:l=""})=>{const[u,f]=O.useState(""),[m,p]=O.useState(!1),[g,C]=O.useState(!1),[y,N]=O.useState([]),[v,x]=O.useState(null),[w,k]=O.useState(null),D=T=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(T),S=async()=>{if(!u.trim()){k("L'email est requis");return}if(!D(u)){k("Format d'email invalide");return}k(null),x(null),p(!0);try{const T=new URL(t);T.searchParams.append("email",u);const M=await fetch(T.toString());if(!M.ok)throw new Error(`Erreur HTTP: ${M.status}`);const I=await M.json();if(!I.realms||I.realms.length===0){x("Aucune organisation trouvée pour cet email");return}if(I.realms.length===1){s(I.realms[0],u);return}N(I.realms),C(!0)}catch(T){const M=T instanceof Error?T.message:"Erreur lors de la découverte des organisations";x(M),i?.(T instanceof Error?T:new Error(M))}finally{p(!1)}},F=T=>{C(!1),s(T,u)},A=T=>{T.key==="Enter"&&!c&&!m&&S()};return e.jsxs("div",{className:`space-y-4 ${l}`,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Input,{type:"email",placeholder:n,value:u,onChange:T=>{f(T.target.value),k(null),x(null)},onKeyPress:A,disabled:c||m,className:w?"border-destructive":""}),w&&e.jsx("p",{className:"text-sm text-destructive",children:w})]}),e.jsx(j.Button,{onClick:S,disabled:c||m||!u.trim(),className:"w-full",children:m?e.jsxs(e.Fragment,{children:[e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Recherche en cours..."]}):e.jsxs(e.Fragment,{children:[e.jsx(h.LogIn,{className:"mr-2 h-4 w-4"}),a]})}),v&&e.jsxs(Cn,{variant:"destructive",children:[e.jsx(h.AlertCircle,{className:"h-4 w-4"}),e.jsx(kn,{children:v})]}),e.jsx(ds,{open:g,onOpenChange:C,children:e.jsxs(Kt,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Cs,{children:[e.jsx(ks,{children:r}),e.jsx(da,{children:o})]}),e.jsx("div",{className:"grid gap-4 py-4",children:y.map((T,M)=>e.jsxs(Ce,{className:"cursor-pointer hover:shadow-lg transition-shadow border-2 hover:border-primary",onClick:()=>F(T),children:[e.jsx(Ve,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(h.Building2,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx(Oe,{className:"text-lg",children:T.displayName||T.name}),T.description&&e.jsx(et,{className:"mt-1",children:T.description})]})]})}),T.url&&e.jsx(Pe,{children:e.jsx("p",{className:"text-sm text-muted-foreground",children:T.url})})]},T.name||M))})]})})]})};Cl.displayName="WakaKeycloakLogin";function ue(...t){return Sd.clsx(t)}function kl(t,s="export.csv"){if(!t||t.length===0)return;const a=Object.keys(t[0]),n=[a.join(","),...t.map(i=>a.map(c=>{const l=i[c];return typeof l=="string"&&(l.includes(",")||l.includes('"')||l.includes(`
|
|
82
|
+
`))?`"${l.replace(/"/g,'""')}"`:l}).join(","))].join(`
|
|
83
|
+
`),r=new Blob([n],{type:"text/csv;charset=utf-8;"}),o=document.createElement("a");o.href=URL.createObjectURL(r),o.download=s,o.click(),URL.revokeObjectURL(o.href)}function Sl(t,s="export.json"){const a=JSON.stringify(t,null,2),n=new Blob([a],{type:"application/json;charset=utf-8;"}),r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=s,r.click(),URL.revokeObjectURL(r.href)}async function tg(t){return new Promise((s,a)=>{const n=new FileReader;n.onload=r=>{try{const i=(r.target?.result).split(`
|
|
84
|
+
`).filter(u=>u.trim());if(i.length===0){s([]);return}const c=i[0].split(",").map(u=>u.trim().replace(/^"|"$/g,"")),l=i.slice(1).map(u=>{const f=u.split(",").map(p=>p.trim().replace(/^"|"$/g,"")),m={};return c.forEach((p,g)=>{m[p]=f[g]||""}),m});s(l)}catch(o){a(o)}},n.onerror=()=>a(n.error),n.readAsText(t)})}function Dl(t,s){try{localStorage.setItem(`datatable_${t}`,JSON.stringify(s))}catch(a){console.warn("[DataTable] Failed to save state:",a)}}function Tl(t){try{const s=localStorage.getItem(`datatable_${t}`);return s?JSON.parse(s):null}catch(s){return console.warn("[DataTable] Failed to load state:",s),null}}function sg(t,s,a){const n=a.toLowerCase();return Object.values(t).some(r=>r==null?!1:String(r).toLowerCase().includes(n))}function El({data:t,columns:s,pagination:a,tableId:n,onSortingChange:r,onFiltersChange:o,onSelectionChange:i}){const c=O.useMemo(()=>n?Tl(n):null,[n]),[l,u]=O.useState(c?.sorting||[]),[f,m]=O.useState(c?.columnFilters||[]),[p,g]=O.useState(c?.columnVisibility||{}),[C,y]=O.useState({}),[N,v]=O.useState(c?.globalFilter||""),[x,w]=O.useState({pageIndex:a?.currentPage||0,pageSize:a?.pageSize||10});O.useEffect(()=>{n&&Dl(n,{sorting:l,columnFilters:f,columnVisibility:p,globalFilter:N})},[n,l,f,p,N]),O.useEffect(()=>{r?.(l)},[l,r]),O.useEffect(()=>{o?.(f)},[f,o]);const k=Te.useReactTable({data:t,columns:s,state:{sorting:l,columnFilters:f,columnVisibility:p,rowSelection:C,globalFilter:N,pagination:x},enableRowSelection:!0,onRowSelectionChange:y,onSortingChange:u,onColumnFiltersChange:m,onColumnVisibilityChange:g,onGlobalFilterChange:v,onPaginationChange:w,getCoreRowModel:Te.getCoreRowModel(),getFilteredRowModel:Te.getFilteredRowModel(),getPaginationRowModel:Te.getPaginationRowModel(),getSortedRowModel:Te.getSortedRowModel(),globalFilterFn:sg,manualPagination:a?.mode==="server",pageCount:a?.mode==="server"?Math.ceil((a.totalItems||0)/x.pageSize):void 0});O.useEffect(()=>{const T=k.getFilteredSelectedRowModel().rows.map(M=>M.original);i?.(T)},[C,i]);const D=O.useMemo(()=>k.getFilteredSelectedRowModel().rows.map(T=>T.original),[k,C]),S=O.useCallback(()=>{m([]),v("")},[]),F=O.useCallback(()=>{y({})},[]),A=O.useCallback(()=>k.getFilteredRowModel().rows.map(T=>T.original),[k]);return{table:k,sorting:l,setSorting:u,columnFilters:f,setColumnFilters:m,columnVisibility:p,setColumnVisibility:g,rowSelection:C,setRowSelection:y,globalFilter:N,setGlobalFilter:v,pagination:x,setPagination:w,selectedRows:D,resetFilters:S,resetSelection:F,exportData:A}}function Kn(t="standard",s="comfortable"){const[a,n]=O.useState(t),[r,o]=O.useState(s),[i,c]=O.useState(!1);O.useEffect(()=>{const m=()=>{c(window.innerWidth<768)};return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[]),O.useEffect(()=>{i&&a==="standard"&&n("card")},[i,a]);const l=O.useCallback(()=>{n(m=>{switch(m){case"standard":return"card";case"card":return"compact";case"compact":return"standard";default:return"standard"}})},[]),u=O.useCallback(()=>{o(m=>m==="comfortable"?"compact":"comfortable")},[]);return{layout:a,setLayout:n,density:r,setDensity:o,toggleLayout:l,toggleDensity:u,isMobile:i,densityClasses:{comfortable:{table:"text-sm",cell:"px-4 py-3",header:"px-4 py-3"},compact:{table:"text-xs",cell:"px-2 py-1.5",header:"px-2 py-2"},spacious:{table:"text-base",cell:"px-6 py-4",header:"px-6 py-4"}}[r]}}function Jn(t,s={}){const{onSave:a,onCancel:n,validateField:r,autoSave:o=!1,autoSaveDelay:i=2e3}=s,[c,l]=O.useState(null),[u,f]=O.useState({}),[m,p]=O.useState(null),[g,C]=O.useState({}),[y,N]=O.useState(!1),v=O.useMemo(()=>!m||!c?!1:Object.keys(u).some(I=>{const E=I;return u[E]!==m[E]}),[u,m,c]),x=v&&c!==null,w=O.useCallback((I,E)=>{l(I),f({...E}),p(E),C({})},[]),k=O.useCallback(()=>{!c||!m||(n?.(c,m),l(null),f({}),p(null),C({}))},[c,m,n]),D=O.useCallback((I,E)=>{if(c){if(r){const P=r(I,E);if(P){C(G=>({...G,[I]:P}));return}else C(G=>{const H={...G};return delete H[I],H})}f(P=>({...P,[I]:E}))}},[c,r]),S=O.useCallback(async()=>{if(!(!c||!a||y)){if(Object.keys(g).length>0)throw new Error("Validation errors present");N(!0);try{await a(c,u),l(null),f({}),p(null),C({})}catch(I){throw console.error("Error saving edit:",I),I}finally{N(!1)}}},[c,a,u,g,y]),F=O.useCallback(()=>{m&&(f({...m}),C({}))},[m]),A=O.useMemo(()=>!o||!x?null:setTimeout(()=>{x&&!y&&S().catch(console.error)},i),[o,x,y,S,i]);return O.useEffect(()=>()=>{A&&clearTimeout(A)},[A]),[{editingRowId:c,editedData:u,hasChanges:v,isDirty:x},{startEdit:w,cancelEdit:k,saveEdit:S,updateField:D,resetEdit:F}]}function ia({table:t,config:s,globalFilter:a,onGlobalFilterChange:n,density:r,onDensityChange:o,onExport:i,onImport:c}){const{t:l}=pt.useTranslation(),u=d.useRef(null),f=t.getFilteredSelectedRowModel().rows,m=f.length>0,p=d.useMemo(()=>s?.actions?s.actions.filter(y=>!(y.requiresSelection&&!m)):[],[s?.actions,m]),g=y=>{const N=m?f.map(v=>v.original):t.getFilteredRowModel().rows.map(v=>v.original);i?i(y):y==="csv"?kl(N,"export.csv"):Sl(N,"export.json")},C=y=>{const N=y.target.files?.[0];N&&c&&c(N),u.current&&(u.current.value="")};return e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 p-4 border-b",role:"toolbar","aria-label":l("datatable.toolbar.label",{defaultValue:"Table toolbar"}),children:[e.jsxs("div",{className:"flex flex-1 flex-col sm:flex-row items-start sm:items-center gap-2 w-full sm:w-auto",children:[s?.showSearch!==!1&&e.jsxs("div",{className:"relative w-full sm:w-64",children:[e.jsx(h.Search,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground","aria-hidden":"true"}),e.jsx(j.Input,{placeholder:l("datatable.toolbar.search",{defaultValue:"Search..."}),value:a??"",onChange:y=>n(y.target.value),className:"pl-8 h-9","aria-label":l("datatable.toolbar.searchLabel",{defaultValue:"Search in table"}),role:"searchbox"}),a&&e.jsx("button",{onClick:()=>n(""),className:"absolute right-2 top-2.5 text-muted-foreground hover:text-foreground","aria-label":l("datatable.toolbar.clearSearch",{defaultValue:"Clear search"}),children:e.jsx(h.X,{className:"h-4 w-4","aria-hidden":"true"})})]}),m&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",role:"status","aria-live":"polite","aria-atomic":"true",children:[e.jsxs("span",{children:[f.length," ",l("datatable.toolbar.selected",{defaultValue:"selected"})]}),e.jsx(j.Button,{variant:"ghost",size:"sm",onClick:()=>t.resetRowSelection(),className:"h-7 px-2",children:l("datatable.toolbar.clear",{defaultValue:"Clear"})})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[p.map(y=>e.jsxs(j.Button,{variant:y.variant||"outline",size:"sm",onClick:()=>y.onClick(f.map(N=>N.original)),disabled:y.disabled,className:"h-9",children:[y.icon,e.jsx("span",{className:"ml-2",children:y.label})]},y.id)),s?.showRefresh&&e.jsxs(j.Button,{variant:"outline",size:"icon",onClick:s.onRefresh,className:"h-9 w-9",children:[e.jsx(h.RefreshCw,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:l("datatable.toolbar.refresh",{defaultValue:"Refresh"})})]}),i&&e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(j.Button,{variant:"outline",size:"icon",className:"h-9 w-9",children:[e.jsx(h.Download,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:l("datatable.toolbar.export",{defaultValue:"Export"})})]})}),e.jsxs(Ye,{align:"end",children:[e.jsx(ys,{children:l("datatable.toolbar.exportAs",{defaultValue:"Export as"})}),e.jsx(dt,{}),e.jsx(vs,{onClick:()=>g("csv"),children:"CSV"}),e.jsx(vs,{onClick:()=>g("json"),children:"JSON"})]})]}),c&&e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:u,type:"file",accept:".csv,.json",onChange:C,className:"hidden"}),e.jsxs(j.Button,{variant:"outline",size:"icon",onClick:()=>u.current?.click(),className:"h-9 w-9",children:[e.jsx(h.Upload,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:l("datatable.toolbar.import",{defaultValue:"Import"})})]})]}),s?.showColumnToggle!==!1&&e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(j.Button,{variant:"outline",size:"icon",className:"h-9 w-9",children:[e.jsx(h.Columns,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:l("datatable.toolbar.columns",{defaultValue:"Columns"})})]})}),e.jsxs(Ye,{align:"end",className:"w-48",children:[e.jsx(ys,{children:l("datatable.toolbar.toggleColumns",{defaultValue:"Toggle columns"})}),e.jsx(dt,{}),t.getAllColumns().filter(y=>y.getCanHide()).map(y=>e.jsx(vs,{className:"capitalize",checked:y.getIsVisible(),onCheckedChange:N=>y.toggleVisibility(!!N),children:y.id},y.id))]})]}),s?.showDensity&&o&&e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(j.Button,{variant:"outline",size:"icon",className:"h-9 w-9",children:[e.jsx(h.SlidersHorizontal,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:l("datatable.toolbar.density",{defaultValue:"Density"})})]})}),e.jsxs(Ye,{align:"end",children:[e.jsx(ys,{children:l("datatable.toolbar.tableDensity",{defaultValue:"Table density"})}),e.jsx(dt,{}),e.jsx(vs,{checked:r==="comfortable",onCheckedChange:()=>o("comfortable"),children:l("datatable.toolbar.comfortable",{defaultValue:"Comfortable"})}),e.jsx(vs,{checked:r==="compact",onCheckedChange:()=>o("compact"),children:l("datatable.toolbar.compact",{defaultValue:"Compact"})})]})]})]})]})}function Zn({table:t,pageSizeOptions:s=[25,50,100,500],showInfo:a=!0}){const{t:n}=pt.useTranslation(),r=t.getState().pagination.pageIndex,o=t.getState().pagination.pageSize,i=t.getPageCount(),c=t.getFilteredRowModel().rows.length,l=r*o+1,u=Math.min((r+1)*o,c);return e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a&&e.jsx("div",{className:"text-sm text-muted-foreground",children:c>0?e.jsxs(e.Fragment,{children:[n("datatable.pagination.showing",{defaultValue:"Showing"})," ",l," ",n("datatable.pagination.to",{defaultValue:"to"})," ",u," ",n("datatable.pagination.of",{defaultValue:"of"})," ",c," ",n("datatable.pagination.results",{defaultValue:"results"})]}):n("datatable.pagination.noResults",{defaultValue:"No results"})}),e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:n("datatable.pagination.rowsPerPage",{defaultValue:"Rows per page"})}),e.jsxs(Be,{value:`${o}`,onValueChange:f=>{t.setPageSize(Number(f))},children:[e.jsx(ze,{className:"h-8 w-[70px]",children:e.jsx(We,{placeholder:o})}),e.jsx(_e,{side:"top",children:s.map(f=>e.jsx(ke,{value:`${f}`,children:f},f))})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"text-sm text-muted-foreground mr-2",children:[n("datatable.pagination.page",{defaultValue:"Page"})," ",r+1," ",n("datatable.pagination.of",{defaultValue:"of"})," ",i]}),e.jsxs(j.Button,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>t.setPageIndex(0),disabled:!t.getCanPreviousPage(),children:[e.jsx(h.ChevronsLeft,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("datatable.pagination.firstPage",{defaultValue:"First page"})})]}),e.jsxs(j.Button,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>t.previousPage(),disabled:!t.getCanPreviousPage(),children:[e.jsx(h.ChevronLeft,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("datatable.pagination.previousPage",{defaultValue:"Previous page"})})]}),e.jsxs(j.Button,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>t.nextPage(),disabled:!t.getCanNextPage(),children:[e.jsx(h.ChevronRight,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("datatable.pagination.nextPage",{defaultValue:"Next page"})})]}),e.jsxs(j.Button,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>t.setPageIndex(i-1),disabled:!t.getCanNextPage(),children:[e.jsx(h.ChevronsRight,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("datatable.pagination.lastPage",{defaultValue:"Last page"})})]})]})]})]})}const ag=t=>{if(t==null)return"";if(t instanceof Date)return t.toLocaleDateString();if(Array.isArray(t))return t.map(s=>String(s)).join(", ");if(typeof t=="object"){const s=t;return"min"in s||"max"in s?`${s.min??""} - ${s.max??""}`:"from"in s||"to"in s?`${s.from??""} - ${s.to??""}`:JSON.stringify(t)}return String(t)};function er({table:t,filters:s,position:a="top",onFiltersChange:n}){const{t:r}=pt.useTranslation(),[o,i]=d.useState([]),[c,l]=d.useState(!1),u=d.useCallback(v=>{const x=t.getPreFilteredRowModel().rows,w=new Set;return x.forEach(k=>{const D=k.getValue(v);D!=null&&D!==""&&w.add(String(D))}),Array.from(w).sort()},[t]),f=d.useMemo(()=>({text:[{value:"contains",label:r("datatable.filters.contains",{defaultValue:"Contains"})},{value:"equals",label:r("datatable.filters.equals",{defaultValue:"Equals"})},{value:"startsWith",label:r("datatable.filters.startsWith",{defaultValue:"Starts with"})},{value:"endsWith",label:r("datatable.filters.endsWith",{defaultValue:"Ends with"})},{value:"notContains",label:r("datatable.filters.notContains",{defaultValue:"Not contains"})}],select:[{value:"equals",label:r("datatable.filters.equals",{defaultValue:"Equals"})},{value:"notEquals",label:r("datatable.filters.notEquals",{defaultValue:"Not equals"})}],multiselect:[{value:"in",label:r("datatable.filters.in",{defaultValue:"In"})},{value:"notIn",label:r("datatable.filters.notIn",{defaultValue:"Not in"})}],range:[{value:"between",label:r("datatable.filters.between",{defaultValue:"Between"})},{value:"greaterThan",label:r("datatable.filters.greaterThan",{defaultValue:"Greater than"})},{value:"lessThan",label:r("datatable.filters.lessThan",{defaultValue:"Less than"})}],date:[{value:"equals",label:r("datatable.filters.equals",{defaultValue:"Equals"})},{value:"before",label:r("datatable.filters.before",{defaultValue:"Before"})},{value:"after",label:r("datatable.filters.after",{defaultValue:"After"})},{value:"between",label:r("datatable.filters.between",{defaultValue:"Between"})}],daterange:[{value:"between",label:r("datatable.filters.between",{defaultValue:"Between"})},{value:"before",label:r("datatable.filters.before",{defaultValue:"Before"})},{value:"after",label:r("datatable.filters.after",{defaultValue:"After"})}],checkbox:[{value:"equals",label:r("datatable.filters.equals",{defaultValue:"Equals"})}],number:[{value:"equals",label:r("datatable.filters.equals",{defaultValue:"Equals"})},{value:"notEquals",label:r("datatable.filters.notEquals",{defaultValue:"Not equals"})},{value:"greaterThan",label:r("datatable.filters.greaterThan",{defaultValue:"Greater than"})},{value:"lessThan",label:r("datatable.filters.lessThan",{defaultValue:"Less than"})},{value:"between",label:r("datatable.filters.between",{defaultValue:"Between"})}],boolean:[{value:"equals",label:r("datatable.filters.equals",{defaultValue:"Equals"})},{value:"notEquals",label:r("datatable.filters.notEquals",{defaultValue:"Not equals"})}]}),[r]),m=d.useCallback((v,x,w)=>{const k=v.column||v.id,D=t.getColumn(k);if(!D)return;const S={id:k,columnId:k,operator:x,value:w,label:v.label};i(F=>{const A=[...F,S];D.setFilterValue({operator:x,value:w});const T=A.map(M=>({id:M.id,value:M.value}));return n?.(T),A})},[t,n]),p=d.useCallback(v=>{i(x=>{const w=x[v],k=t.getColumn(w.columnId);k&&k.setFilterValue(void 0);const D=x.filter((F,A)=>A!==v),S=D.map(F=>({id:F.id,value:F.value}));return n?.(S),D})},[t,n]),g=d.useCallback(()=>{i(v=>(v.forEach(x=>{const w=t.getColumn(x.columnId);w&&w.setFilterValue(void 0)}),n?.([]),[]))},[t,n]),C=v=>{const[x,w]=d.useState(f[v.type]?.[0]?.value||"equals"),[k,D]=d.useState(typeof v.defaultValue=="string"?v.defaultValue:""),[S,F]=d.useState(v.type==="range"&&v.defaultValue&&typeof v.defaultValue=="object"?v.defaultValue:{min:"",max:""}),[A,T]=d.useState(v.type==="daterange"&&v.defaultValue&&typeof v.defaultValue=="object"?v.defaultValue:{from:"",to:""}),[M,I]=d.useState(typeof v.defaultValue=="boolean"?v.defaultValue:!1),[E,P]=d.useState([]),[G,H]=d.useState(!1),X=v.column?u(v.column):[],z=()=>{switch(v.type){case"multiselect":return E;case"range":return S;case"daterange":return A;case"checkbox":case"boolean":return M;default:return k}},L=()=>{D(""),F({min:"",max:""}),T({from:"",to:""}),I(!1),P([]),H(!1)},_=()=>{const R=z();let U=!1;v.type==="multiselect"?U=E.length>0:v.type==="range"?U=S.min!==""||S.max!=="":v.type==="daterange"?U=A.from!==""||A.to!=="":v.type==="checkbox"||v.type==="boolean"?U=!0:U=k!=="",U&&(m(v,x,R),L())};return e.jsxs("div",{className:"space-y-3 p-4 border rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(j.Label,{className:"text-sm font-medium",children:v.label}),e.jsx(ye,{variant:"outline",className:"text-xs",children:v.type})]}),f[v.type]&&f[v.type].length>1&&e.jsxs(Be,{value:x,onValueChange:w,children:[e.jsx(ze,{className:"h-9",children:e.jsx(We,{})}),e.jsx(_e,{children:f[v.type].map(R=>e.jsx(ke,{value:R.value,children:R.label},R.value))})]}),v.type==="text"&&e.jsx("div",{className:"space-y-2",children:e.jsxs(j.Popover,{open:G,onOpenChange:H,children:[e.jsx(j.PopoverTrigger,{asChild:!0,children:e.jsx(j.Input,{placeholder:v.placeholder||r("datatable.filters.enterValue",{defaultValue:"Enter value..."}),value:k,onChange:R=>{D(R.target.value),H(!0)},className:"h-9"})}),X.length>0&&k&&e.jsx(j.PopoverContent,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(us,{children:[e.jsx(Ss,{placeholder:r("datatable.filters.search",{defaultValue:"Search..."})}),e.jsx(Ds,{children:r("datatable.filters.noResults",{defaultValue:"No results"})}),e.jsx(Jt,{className:"max-h-64 overflow-auto",children:X.filter(R=>R.toLowerCase().includes(k.toLowerCase())).slice(0,50).map(R=>e.jsx(Zt,{onSelect:()=>{D(R),H(!1)},children:R},R))})]})})]})}),v.type==="select"&&e.jsxs(Be,{value:k,onValueChange:D,children:[e.jsx(ze,{className:"h-9",children:e.jsx(We,{placeholder:v.placeholder})}),e.jsx(_e,{children:(v.options||X.map(R=>({label:R,value:R}))).map(R=>e.jsx(ke,{value:String(R.value),children:R.label},R.value))})]}),v.type==="multiselect"&&e.jsxs(j.Popover,{children:[e.jsx(j.PopoverTrigger,{asChild:!0,children:e.jsxs(j.Button,{variant:"outline",className:"w-full justify-between h-9",children:[E.length>0?`${E.length} ${r("datatable.filters.selected",{defaultValue:"selected"})}`:v.placeholder||r("datatable.filters.selectValues",{defaultValue:"Select values..."}),e.jsx(h.ChevronDown,{className:"ml-2 h-4 w-4 opacity-50"})]})}),e.jsx(j.PopoverContent,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(us,{children:[e.jsx(Ss,{placeholder:r("datatable.filters.search",{defaultValue:"Search..."})}),e.jsx(Ds,{children:r("datatable.filters.noResults",{defaultValue:"No results"})}),e.jsx(Jt,{className:"max-h-64 overflow-auto",children:X.map(R=>e.jsxs(Zt,{onSelect:()=>{P(U=>U.includes(R)?U.filter($=>$!==R):[...U,R])},children:[e.jsx(st,{checked:E.includes(R),className:"mr-2"}),R]},R))})]})})]}),v.type==="date"&&e.jsx(j.Input,{type:"date",value:k,onChange:R=>D(R.target.value),className:"h-9"}),v.type==="range"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j.Input,{type:"number",placeholder:"Min",value:S.min??"",onChange:R=>F({...S,min:R.target.value}),className:"h-9"}),e.jsx(j.Input,{type:"number",placeholder:"Max",value:S.max??"",onChange:R=>F({...S,max:R.target.value}),className:"h-9"})]}),v.type==="daterange"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j.Input,{type:"date",placeholder:r("datatable.filters.from",{defaultValue:"From"}),value:typeof A.from=="string"?A.from:"",onChange:R=>T({...A,from:R.target.value}),className:"h-9"}),e.jsx(j.Input,{type:"date",placeholder:r("datatable.filters.to",{defaultValue:"To"}),value:typeof A.to=="string"?A.to:"",onChange:R=>T({...A,to:R.target.value}),className:"h-9"})]}),v.type==="checkbox"&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(st,{id:`checkbox-${v.id}`,checked:M,onCheckedChange:R=>I(R===!0)}),e.jsx(j.Label,{htmlFor:`checkbox-${v.id}`,className:"text-sm font-normal",children:v.placeholder||r("datatable.filters.checked",{defaultValue:"Checked"})})]}),e.jsxs(j.Button,{onClick:_,size:"sm",className:"w-full",children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-2"}),r("datatable.filters.apply",{defaultValue:"Apply filter"})]})]})};if(!s||s.length===0)return null;const y=e.jsxs("div",{className:"space-y-4",children:[o.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(j.Label,{className:"text-sm text-muted-foreground",children:r("datatable.filters.active",{defaultValue:"Filtres actifs"})}),e.jsxs(j.Button,{variant:"ghost",size:"sm",onClick:g,children:[e.jsx(h.Trash2,{className:"h-3 w-3 mr-1"}),r("datatable.filters.clearAll",{defaultValue:"Tout effacer"})]})]}),e.jsx("div",{className:"space-y-1",children:o.map((v,x)=>e.jsxs("div",{className:"flex items-center justify-between p-2 bg-muted rounded-md text-sm",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"font-medium",children:v.label}),e.jsx("span",{className:"text-muted-foreground mx-2",children:v.operator}),e.jsx("span",{className:"text-primary truncate",children:ag(v.value)})]}),e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:()=>p(x),children:e.jsx(h.X,{className:"h-3 w-3"})})]},x))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(j.Label,{className:"text-sm text-muted-foreground",children:r("datatable.filters.available",{defaultValue:"Filtres disponibles"})}),s.map(v=>e.jsx("div",{children:C(v)},v.id))]})]}),N=e.jsxs(j.Button,{variant:"outline",size:"sm",children:[e.jsx(h.Filter,{className:"h-4 w-4 mr-2"}),r("datatable.filters.title",{defaultValue:"Filtres"}),o.length>0&&e.jsx(ye,{variant:"secondary",className:"ml-2",children:o.length})]});return a==="right"||a==="left"?e.jsxs(is,{open:c,onOpenChange:l,children:[e.jsx(Vn,{asChild:!0,children:N}),e.jsxs(Wt,{side:a,className:"w-[400px] sm:w-[540px] overflow-y-auto",children:[e.jsxs(ws,{children:[e.jsxs(Ns,{className:"flex items-center gap-2",children:[e.jsx(h.Filter,{className:"h-5 w-5"}),r("datatable.filters.title",{defaultValue:"Filtres"})]}),e.jsx(La,{children:r("datatable.filters.description",{defaultValue:"Appliquez des filtres pour affiner les résultats"})})]}),e.jsx("div",{className:"mt-6",children:y})]})]}):e.jsxs(j.Popover,{open:c,onOpenChange:l,children:[e.jsx(j.PopoverTrigger,{asChild:!0,children:N}),e.jsx(j.PopoverContent,{className:"w-[400px] max-h-[600px] overflow-y-auto",align:a==="top"?"start":"end",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Filter,{className:"h-4 w-4"}),e.jsx("h4",{className:"font-semibold text-sm",children:r("datatable.filters.title",{defaultValue:"Filtres"})})]})}),y]})})]})}function Ps({value:t,field:s,config:a,isEditing:n,error:r,onChange:o,onStartEdit:i,onSave:c,onCancel:l,className:u}){const[f,m]=d.useState(t),[p,g]=d.useState(!1);d.useEffect(()=>{m(t)},[t]);const C=()=>{o(f),c()},y=()=>{m(t),l()},N=x=>{x.key==="Enter"&&!x.shiftKey?(x.preventDefault(),C()):x.key==="Escape"&&(x.preventDefault(),y())};if(!n)return e.jsx("div",{className:ue("cursor-pointer hover:bg-muted/50 p-1 rounded transition-colors",u),onClick:i,children:ng(t,a)});const v=()=>{switch(a.type){case"textarea":return e.jsx(j.Textarea,{value:f||"",onChange:x=>m(x.target.value),onKeyDown:N,placeholder:a.placeholder,rows:a.rows||3,disabled:a.disabled,className:ue(r&&"border-destructive","pr-16")});case"select":return e.jsxs(Be,{value:f||"",onValueChange:m,disabled:a.disabled,children:[e.jsx(ze,{className:ue(r&&"border-destructive","pr-16"),children:e.jsx(We,{placeholder:a.placeholder})}),e.jsx(_e,{children:a.options?.map(x=>e.jsx(ke,{value:x.value,children:x.label},x.value))})]});case"checkbox":return e.jsx("div",{className:"flex items-center h-9 px-2",children:e.jsx(st,{checked:!!f,onCheckedChange:m,disabled:a.disabled})});case"switch":return e.jsx("div",{className:"flex items-center h-9 px-2",children:e.jsx(_s,{checked:!!f,onCheckedChange:m,disabled:a.disabled})});case"date":case"datetime":return e.jsxs(j.Popover,{open:p,onOpenChange:g,children:[e.jsx(j.PopoverTrigger,{asChild:!0,children:e.jsxs(j.Button,{variant:"outline",className:ue("w-full justify-start text-left font-normal pr-16",!f&&"text-muted-foreground",r&&"border-destructive"),children:[e.jsx(h.CalendarIcon,{className:"mr-2 h-4 w-4"}),f?V.format(new Date(f),"PPP"):a.placeholder]})}),e.jsx(j.PopoverContent,{className:"w-auto p-0",align:"start",children:e.jsx(Ra,{mode:"single",selected:f?new Date(f):void 0,onSelect:x=>{x&&(m(a.type==="datetime"?x.toISOString():x.toISOString().split("T")[0]),g(!1))},initialFocus:!0})})]});default:return e.jsx(j.Input,{type:a.type,value:f||"",onChange:x=>m(x.target.value),onKeyDown:N,placeholder:a.placeholder,min:a.min,max:a.max,step:a.step,disabled:a.disabled,required:a.required,pattern:a.pattern,title:a.title,className:ue(r&&"border-destructive","pr-16")})}};return e.jsxs("div",{className:ue("relative",u),children:[v(),e.jsxs("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex gap-1",children:[e.jsx(j.Button,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:C,children:e.jsx(h.Check,{className:"h-3 w-3 text-green-600"})}),e.jsx(j.Button,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:y,children:e.jsx(h.X,{className:"h-3 w-3 text-red-600"})})]}),r&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:r})]})}function ng(t,s){if(t==null)return e.jsx("span",{className:"text-muted-foreground italic",children:"Non défini"});switch(s.type){case"checkbox":case"switch":return e.jsx("span",{className:ue("inline-flex items-center px-2 py-1 rounded-full text-xs font-medium",t?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"),children:t?"Oui":"Non"});case"date":case"datetime":try{const n=new Date(t);return V.format(n,s.type==="datetime"?"PPP p":"PPP")}catch{return t}case"select":const a=s.options?.find(n=>n.value===t);return a?a.label:t;case"textarea":return e.jsx("div",{className:"max-w-xs",children:e.jsx("p",{className:"truncate",children:t})});default:return t}}function rg({data:t,columns:s,layout:a="standard",variant:n="bordered",density:r="comfortable",filters:o,filterPosition:i="top",toolbar:c,pagination:l,selection:u=!1,actions:f,i18nNamespace:m,loading:p=!1,error:g,emptyState:C,headerSticky:y=!1,columnVisibilityToggle:N=!0,columnResize:v=!1,enableExport:x=!1,enableImport:w=!1,enableReorder:k=!1,enableContextMenu:D=!1,onRowClick:S,onRowDoubleClick:F,onSortingChange:A,onFiltersChange:T,onSelectionChange:M,className:I,tableId:E,virtualization:P,edit:G}){const{t:H}=pt.useTranslation(m),{layout:X,setLayout:z,density:L,setDensity:_,densityClasses:R}=Kn(a,r),U=d.useMemo(()=>{const pe=[...s];if(u){const je={id:"select",header:({table:he})=>e.jsx(st,{checked:he.getIsAllPageRowsSelected(),onCheckedChange:Qe=>he.toggleAllPageRowsSelected(!!Qe),"aria-label":H("datatable.selectAll",{defaultValue:"Select all"})}),cell:({row:he})=>e.jsx(st,{checked:he.getIsSelected(),onCheckedChange:Qe=>he.toggleSelected(!!Qe),"aria-label":H("datatable.selectRow",{defaultValue:"Select row"})}),enableSorting:!1,enableHiding:!1};pe.unshift(je)}return pe},[s,u,G,H]),{table:$,globalFilter:Z,setGlobalFilter:Q,selectedRows:K,resetFilters:q,exportData:W}=El({data:t,columns:U,pagination:l,tableId:E,onSortingChange:A,onFiltersChange:T,onSelectionChange:M}),[J,B]=Jn($,{onSave:G?.onSave,onCancel:G?.onCancel,autoSave:G?.autoSave,autoSaveDelay:G?.autoSaveDelay});if(G?.editableColumns&&G.editableColumns.length>0){const pe={id:"edit-actions",header:()=>H("datatable.actions",{defaultValue:"Actions"}),cell:({row:je})=>J.editingRowId===je.id?e.jsxs("div",{className:"flex gap-1",children:[e.jsx(j.Button,{size:"sm",variant:"ghost",onClick:()=>B.saveEdit(),disabled:!J.hasChanges,children:H("datatable.save",{defaultValue:"Save"})}),e.jsx(j.Button,{size:"sm",variant:"ghost",onClick:()=>B.cancelEdit(),children:H("datatable.cancel",{defaultValue:"Cancel"})})]}):e.jsx(j.Button,{size:"sm",variant:"ghost",onClick:()=>{ne.logger.debug("🔧 Starting edit for row:",je.id,je.original),B.startEdit(je.id,je.original)},children:H("datatable.edit",{defaultValue:"Edit"})}),enableSorting:!1,enableHiding:!1};U.push(pe)}const te=d.useCallback(pe=>{const je=W();ne.logger.debug("Export",pe,je)},[W]),se=d.useCallback(pe=>{ne.logger.debug("Import",pe)},[]),ee=d.useCallback(pe=>S?.(pe),[S]),le=d.useCallback(pe=>F?.(pe),[F]),Me=d.useMemo(()=>({bordered:"border rounded-lg",minimal:"",striped:"[&_tbody_tr:nth-child(even)]:bg-muted/50",glass:"backdrop-blur-sm bg-background/80 border rounded-lg"}),[]);if(p)return e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg",role:"status","aria-busy":"true","aria-label":H("datatable.loading",{defaultValue:"Loading..."}),children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(h.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground","aria-hidden":"true"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:H("datatable.loading",{defaultValue:"Loading..."})})]})});if(g)return e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg bg-destructive/10",role:"alert","aria-live":"assertive",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-destructive",children:[e.jsx(h.AlertCircle,{className:"h-8 w-8","aria-hidden":"true"}),e.jsx("p",{className:"text-sm font-medium",children:g})]})});if(!t||t.length===0)return e.jsxs("div",{className:"flex flex-col",children:[c&&e.jsx(ia,{table:$,config:c,globalFilter:Z,onGlobalFilterChange:Q,density:L,onDensityChange:_,onExport:x?te:void 0,onImport:w?se:void 0}),e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg",children:C||e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx("p",{className:"text-lg font-medium",children:H("datatable.noData",{defaultValue:"No data"})}),e.jsx("p",{className:"text-sm",children:H("datatable.noDataDescription",{defaultValue:"There are no results to display"})})]})})]});const re=()=>{const pe=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c&&e.jsx("div",{className:"flex-1",children:e.jsx(ia,{table:$,config:c,globalFilter:Z,onGlobalFilterChange:Q,density:L,onDensityChange:_,onExport:x?te:void 0,onImport:w?se:void 0})}),o&&e.jsx(er,{table:$,filters:o,position:i,onFiltersChange:T})]}),e.jsx("div",{className:ue("w-full overflow-auto",Me[n]),children:e.jsxs("table",{className:ue("w-full caption-bottom text-sm",R.table),children:[e.jsx("thead",{className:ue(y&&"sticky top-0 bg-background z-10"),children:$.getHeaderGroups().map(je=>e.jsx("tr",{className:"border-b",children:je.headers.map(he=>e.jsxs("th",{className:ue("text-left font-medium text-muted-foreground",R.header,he.column.getCanSort()&&"cursor-pointer select-none hover:text-foreground"),onClick:he.column.getToggleSortingHandler(),children:[he.isPlaceholder?null:Te.flexRender(he.column.columnDef.header,he.getContext()),he.column.getIsSorted()&&e.jsx("span",{className:"ml-2",children:he.column.getIsSorted()==="asc"?"↑":"↓"})]},he.id))},je.id))}),e.jsx("tbody",{children:$.getRowModel().rows.map(je=>e.jsx("tr",{className:ue("border-b transition-colors",S&&"cursor-pointer hover:bg-muted/50",je.getIsSelected()&&"bg-muted"),onClick:()=>ee(je.original),onDoubleClick:()=>le(je.original),children:je.getVisibleCells().map(he=>{const Qe=he.getValue(),yt=he.column.id,tt=je.id,wt=J.editingRowId===tt,Nt=G?.editableColumns?.find(mt=>mt.field===yt);return Nt&&wt?e.jsx("td",{className:ue("align-middle",R.cell),children:e.jsx(Ps,{value:Qe,field:yt,config:Nt.config,isEditing:wt,onChange:mt=>B.updateField(yt,mt),onStartEdit:()=>B.startEdit(tt,je.original),onSave:()=>B.saveEdit(),onCancel:()=>B.cancelEdit()})},he.id):e.jsx("td",{className:ue("align-middle",R.cell),children:Te.flexRender(he.column.columnDef.cell,he.getContext())},he.id)})},je.id))})]})}),l&&e.jsx(Zn,{table:$,pageSizeOptions:l.pageSizeOptions})]});return e.jsx("div",{className:"space-y-4",children:pe})};return e.jsx("div",{className:ue("w-full",I),children:re()})}function Pl({data:t,columns:s,pagination:a,tableId:n,onSortingChange:r,onFiltersChange:o,onSelectionChange:i,onColumnOrderChange:c,onExpandedChange:l,onGroupingChange:u,grouping:f,virtualization:m,sortMode:p="multiple",performance:g}){const C=O.useMemo(()=>n?og(n):null,[n]),[y,N]=O.useState(C?.sorting||[]),[v,x]=O.useState(C?.columnFilters||[]),[w,k]=O.useState(C?.columnVisibility||{}),[D,S]=O.useState(C?.columnOrder||[]),[F,A]=O.useState(C?.expanded||{}),[T,M]=O.useState(C?.grouping||[]),[I,E]=O.useState(C?.rowSelection||{}),[P,G]=O.useState(C?.globalFilter||""),[H,X]=O.useState({pageIndex:a?.currentPage||0,pageSize:a?.pageSize||10}),[z,L]=O.useState(v);O.useEffect(()=>{const ee=setTimeout(()=>{L(v)},g?.filterDebounceMs||300);return()=>clearTimeout(ee)},[v,g?.filterDebounceMs]),O.useEffect(()=>{f?.columns&&f.columns.length>0&&T.length===0&&M([f.columns[0]])},[f?.columns,T.length]),O.useEffect(()=>{n&&ig(n,{sorting:y,columnFilters:v,columnVisibility:w,columnOrder:D,expanded:F,grouping:T,pagination:H,globalFilter:P,density:"comfortable",layout:"standard",rowSelection:I})},[n,y,v,w,D,F,T,H,P,I]),O.useEffect(()=>{r?.(y)},[y,r]),O.useEffect(()=>{o?.(z)},[z,o]),O.useEffect(()=>{const ee=_.getFilteredSelectedRowModel().rows.map(le=>le.original);i?.(ee)},[I]),O.useEffect(()=>{c?.(D)},[D,c]),O.useEffect(()=>{l?.(F)},[F,l]),O.useEffect(()=>{u?.(T)},[T,u]);const _=Te.useReactTable({data:t,columns:s,state:{sorting:y,columnFilters:z,columnVisibility:w,columnOrder:D,expanded:F,grouping:T,rowSelection:I,globalFilter:P,pagination:H},enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0,enableGrouping:!0,groupedColumnMode:"reorder",enableExpanding:!0,getSubRows:ee=>ee.subRows,enableColumnResizing:!0,columnResizeMode:"onChange",enableSorting:!0,enableMultiSort:p==="multiple",sortDescFirst:!1,enableFilters:!0,enableGlobalFilter:!0,enableColumnFilters:!0,onRowSelectionChange:E,onSortingChange:N,onColumnFiltersChange:x,onColumnVisibilityChange:k,onColumnOrderChange:S,onExpandedChange:A,onGroupingChange:M,onGlobalFilterChange:G,onPaginationChange:X,getCoreRowModel:Te.getCoreRowModel(),getFilteredRowModel:Te.getFilteredRowModel(),getGroupedRowModel:Te.getGroupedRowModel(),getSortedRowModel:Te.getSortedRowModel(),getExpandedRowModel:Te.getExpandedRowModel(),getPaginationRowModel:Te.getPaginationRowModel(),getFacetedRowModel:Te.getFacetedRowModel(),getFacetedUniqueValues:Te.getFacetedUniqueValues(),globalFilterFn:lg,manualPagination:a?.mode==="server",pageCount:a?.mode==="server"?Math.ceil((a.totalItems||0)/H.pageSize):void 0}),R=O.useMemo(()=>_.getFilteredSelectedRowModel().rows.map(ee=>ee.original),[_,I]),U=O.useCallback(()=>{x([]),G("")},[]),$=O.useCallback(()=>{E({})},[]),Z=O.useCallback(()=>{N([]),x([]),k({}),S([]),A({}),M([]),E({}),G(""),X({pageIndex:0,pageSize:a?.pageSize||10})},[a?.pageSize]),Q=O.useCallback(()=>_.getFilteredRowModel().rows.map(ee=>ee.original),[_]),K=O.useCallback(()=>f?.columns?.length?_.getGroupedRowModel().rows.map(ee=>ee.original):t,[_,f,t]),q=O.useCallback(()=>_.getExpandedRowModel().rows.map(ee=>ee.original),[_]),W=O.useCallback(ee=>{M(le=>le.includes(ee)?le.filter(re=>re!==ee):[...le,ee])},[]),J=O.useCallback(()=>{M([])},[]),B=O.useCallback(ee=>{A(le=>({...le,[ee]:!le[ee]}))},[]),te=O.useCallback(()=>{const ee=_.getRowModel().rows.map(Me=>Me.id),le={};ee.forEach(Me=>{le[Me]=!0}),A(le)},[_]),se=O.useCallback(()=>{A({})},[]);return{table:_,sorting:y,setSorting:N,columnFilters:v,setColumnFilters:x,columnVisibility:w,setColumnVisibility:k,columnOrder:D,setColumnOrder:S,expanded:F,setExpanded:A,grouping:T,setGrouping:M,rowSelection:I,setRowSelection:E,globalFilter:P,setGlobalFilter:G,pagination:H,setPagination:X,selectedRows:R,resetFilters:U,resetSelection:$,resetAll:Z,exportData:Q,getGroupedData:K,getExpandedData:q,toggleGrouping:W,clearGrouping:J,toggleRowExpansion:B,expandAll:te,collapseAll:se}}function og(t){try{const s=localStorage.getItem(`datatable-${t}`);return s?JSON.parse(s):null}catch{return null}}function ig(t,s){try{localStorage.setItem(`datatable-${t}`,JSON.stringify(s))}catch{}}function lg(t,s,a){const n=a.toLowerCase();return t.getVisibleCells().some(r=>{const o=r.getValue();return o==null?!1:String(o).toLowerCase().includes(n)})}function Ml({data:t,virtualization:s,containerRef:a}){const[n,r]=O.useState(s?.containerHeight||600);O.useEffect(()=>{if(!a.current||!s)return;const p=new ResizeObserver(g=>{for(const C of g)r(C.contentRect.height)});return p.observe(a.current),()=>{p.disconnect()}},[a,s]);const o=O.useMemo(()=>{if(!s||s.type==="none")return null;const p={count:t.length,getScrollElement:()=>a.current,estimateSize:()=>s.itemHeight||50,overscan:s.overscan||5};return s.type==="dynamic"?{...p,estimateSize:()=>s.estimatedItemHeight||50}:p},[t.length,s,a]),i=o?Dd.useVirtualizer(o):null,c=O.useCallback((p,g="start")=>{i&&i.scrollToIndex(p,{align:g})},[i]),l=O.useCallback(p=>{i&&i.scrollToOffset(p)},[i]),u=O.useCallback(()=>i?i.getVirtualItems():[],[i]),f=O.useCallback(()=>i?i.getTotalSize():0,[i]),m=s?.type!=="none"&&o!==null;return{virtualizer:i,isVirtualized:m,containerHeight:n,scrollToIndex:c,scrollToOffset:l,getVirtualItems:u,getTotalSize:f,virtualItems:i?i.getVirtualItems():[],totalSize:i?i.getTotalSize():0}}function Al({theme:t,variant:s="bordered",density:a="comfortable"}){const n={colors:{primary:"hsl(var(--primary))",secondary:"hsl(var(--secondary))",accent:"hsl(var(--accent))",background:"hsl(var(--background))",surface:"hsl(var(--card))",text:"hsl(var(--foreground))",textSecondary:"hsl(var(--muted-foreground))",border:"hsl(var(--border))",hover:"hsl(var(--muted))",selected:"hsl(var(--accent))",disabled:"hsl(var(--muted))"},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},typography:{fontFamily:"inherit",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},fontWeight:{normal:"400",medium:"500",semibold:"600",bold:"700"}},borders:{radius:{sm:"0.25rem",md:"0.5rem",lg:"0.75rem"},width:{thin:"1px",medium:"2px",thick:"4px"}},shadows:{sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)"}},r=O.useMemo(()=>t?{colors:{...n.colors,...t.colors},spacing:{...n.spacing,...t.spacing},typography:{...n.typography,...t.typography},borders:{...n.borders,...t.borders},shadows:{...n.shadows,...t.shadows}}:n,[t,n]),o=O.useMemo(()=>{const f="w-full";switch(s){case"bordered":return`${f} border rounded-lg`;case"minimal":return f;case"striped":return`${f} [&_tbody_tr:nth-child(even)]:bg-muted/50`;case"glass":return`${f} backdrop-blur-sm bg-background/80 border rounded-lg`;default:return f}},[s]),i=O.useMemo(()=>{switch(a){case"spacious":return{table:"text-base",header:"px-6 py-4",cell:"px-6 py-4",row:"h-16"};case"compact":return{table:"text-sm",header:"px-3 py-2",cell:"px-3 py-2",row:"h-8"};case"comfortable":default:return{table:"text-sm",header:"px-4 py-3",cell:"px-4 py-3",row:"h-12"}}},[a]),c=O.useMemo(()=>{const f={};return r.colors&&Object.entries(r.colors).forEach(([m,p])=>{f[`--datatable-color-${m}`]=p}),r.spacing&&Object.entries(r.spacing).forEach(([m,p])=>{f[`--datatable-spacing-${m}`]=p}),r.typography&&(r.typography.fontFamily&&(f["--datatable-font-family"]=r.typography.fontFamily),r.typography.fontSize&&Object.entries(r.typography.fontSize).forEach(([m,p])=>{f[`--datatable-font-size-${m}`]=p}),r.typography.fontWeight&&Object.entries(r.typography.fontWeight).forEach(([m,p])=>{f[`--datatable-font-weight-${m}`]=p})),r.borders&&(r.borders.radius&&Object.entries(r.borders.radius).forEach(([m,p])=>{f[`--datatable-radius-${m}`]=p}),r.borders.width&&Object.entries(r.borders.width).forEach(([m,p])=>{f[`--datatable-border-width-${m}`]=p})),r.shadows&&Object.entries(r.shadows).forEach(([m,p])=>{f[`--datatable-shadow-${m}`]=p}),f},[r]),l=O.useCallback((f,m)=>m?`${f} [--datatable-theme-key:${m}]`:f,[]),u=O.useCallback((f={})=>({...f,...c}),[c]);return{theme:r,variantClasses:o,densityClasses:i,customStyles:c,getThemedClass:l,getThemedStyles:u}}function cg({data:t,columns:s,layout:a="standard",variant:n="bordered",density:r="comfortable",filters:o,filterPosition:i="top",toolbar:c,pagination:l,selection:u=!1,actions:f,i18nNamespace:m,loading:p=!1,error:g,emptyState:C,headerSticky:y=!1,columnVisibilityToggle:N=!0,columnResize:v=!1,columnOrder:x,grouping:w,rowExpansion:k,virtualization:D,sortMode:S="multiple",enableExport:F=!1,enableImport:A=!1,enableReorder:T=!1,enableContextMenu:M=!1,onRowClick:I,onRowDoubleClick:E,onSortingChange:P,onFiltersChange:G,onSelectionChange:H,onColumnOrderChange:X,onExpandedChange:z,onGroupingChange:L,className:_,tableId:R,edit:U,theme:$,performance:Z}){const{t:Q}=pt.useTranslation(m),K=d.useRef(null),{layout:q,setLayout:W,density:J,setDensity:B,densityClasses:te}=Kn(a,r),{theme:se,variantClasses:ee,densityClasses:le,customStyles:Me,getThemedClass:re,getThemedStyles:pe}=Al({theme:$,variant:n,density:J}),je=d.useMemo(()=>{const fe=[...s];if(u){const de={id:"select",header:({table:nt})=>e.jsx(st,{checked:nt.getIsAllPageRowsSelected(),onCheckedChange:Ue=>nt.toggleAllPageRowsSelected(!!Ue),"aria-label":Q("datatable.selectAll",{defaultValue:"Select all"})}),cell:({row:nt})=>e.jsx(st,{checked:nt.getIsSelected(),onCheckedChange:Ue=>nt.toggleSelected(!!Ue),"aria-label":Q("datatable.selectRow",{defaultValue:"Select row"})}),enableSorting:!1,enableHiding:!1,size:50};fe.unshift(de)}if(k?.enabled){const de={id:"expand",header:()=>null,cell:({row:nt})=>nt.getCanExpand()?e.jsx(j.Button,{variant:"ghost",size:"sm",onClick:()=>nt.toggleExpanded(),className:"h-8 w-8 p-0",children:nt.getIsExpanded()?e.jsx(h.ChevronDown,{className:"h-4 w-4"}):e.jsx(h.ChevronRight,{className:"h-4 w-4"})}):null,enableSorting:!1,enableHiding:!1,size:50};fe.unshift(de)}if(T){const de={id:"reorder",header:()=>null,cell:()=>e.jsx(j.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 cursor-move",children:e.jsx(h.GripVertical,{className:"h-4 w-4"})}),enableSorting:!1,enableHiding:!1,size:50};fe.unshift(de)}return fe},[s,u,k,T,Q]);ne.logger.debug("DataTableAdvanced - props:",{grouping:w,rowExpansion:k,dataLength:t.length});const{table:he,sorting:Qe,setSorting:yt,columnFilters:tt,setColumnFilters:wt,columnVisibility:Nt,setColumnVisibility:mt,columnOrder:Rt,setColumnOrder:ce,expanded:Y,setExpanded:oe,grouping:ve,setGrouping:Xe,rowSelection:ae,setRowSelection:me,globalFilter:$e,setGlobalFilter:at,pagination:Pt,setPagination:Oc,selectedRows:zc,resetFilters:Ot,resetSelection:ps,resetAll:ts,exportData:ha,getGroupedData:Ba,getExpandedData:Wa,toggleGrouping:It,clearGrouping:qa,toggleRowExpansion:Ct,expandAll:qs,collapseAll:kt}=Pl({data:t,columns:je,pagination:l,tableId:R,onSortingChange:P,onFiltersChange:G,onSelectionChange:H,onColumnOrderChange:X,onExpandedChange:z,onGroupingChange:L,grouping:w,virtualization:D,sortMode:S,performance:Z}),{isVirtualized:zt,virtualItems:xs,totalSize:fa,scrollToIndex:Ua,scrollToOffset:Ha}=Ml({data:t,virtualization:D,containerRef:K}),{exportData:pa,exportAll:Sr,exportSelected:Us}=ne.useDataTableExport({data:t,columns:je,exportConfig:typeof F=="object"?F:void 0}),{importWithUI:Hs,supportedFormats:_c}=ne.useDataTableImport({importConfig:typeof A=="object"?A:void 0}),[_t,jt]=Jn(he,{onSave:U?.onSave,onCancel:U?.onCancel,autoSave:U?.autoSave,autoSaveDelay:U?.autoSaveDelay});d.useMemo(()=>{if(!U?.editableColumns||U.editableColumns.length===0)return je;const fe={id:"edit-actions",header:()=>Q("datatable.actions",{defaultValue:"Actions"}),cell:({row:de})=>_t.editingRowId===de.id?e.jsxs("div",{className:"flex gap-1",children:[e.jsx(j.Button,{size:"sm",variant:"ghost",onClick:()=>jt.saveEdit(),disabled:!_t.hasChanges,children:Q("datatable.save",{defaultValue:"Save"})}),e.jsx(j.Button,{size:"sm",variant:"ghost",onClick:()=>jt.cancelEdit(),children:Q("datatable.cancel",{defaultValue:"Cancel"})})]}):e.jsx(j.Button,{size:"sm",variant:"ghost",onClick:()=>jt.startEdit(de.id,de.original),children:Q("datatable.edit",{defaultValue:"Edit"})}),enableSorting:!1,enableHiding:!1};return[...je,fe]},[je,U?.editableColumns,_t.editingRowId,_t.hasChanges,jt,Q]);const xa=d.useCallback(async fe=>{try{await pa(fe)}catch(de){console.error("Erreur lors de l'export:",de)}},[pa]),ga=d.useCallback(async()=>{try{const fe=await Hs();ne.logger.debug("Données importées:",fe)}catch(fe){console.error("Erreur lors de l'import:",fe)}},[Hs]);if(p)return e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(h.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:Q("datatable.loading",{defaultValue:"Loading..."})})]})});if(g)return e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg bg-destructive/10",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-destructive",children:[e.jsx(h.AlertCircle,{className:"h-8 w-8"}),e.jsx("p",{className:"text-sm font-medium",children:g})]})});if(!t||t.length===0)return e.jsxs("div",{className:"flex flex-col",children:[c&&e.jsx(ia,{table:he,config:c,globalFilter:$e,onGlobalFilterChange:at,density:J,onDensityChange:B,onExport:F?xa:void 0,onImport:A?ga:void 0}),e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg",children:C||e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx("p",{className:"text-lg font-medium",children:Q("datatable.noData",{defaultValue:"No data"})}),e.jsx("p",{className:"text-sm",children:Q("datatable.noDataDescription",{defaultValue:"There are no results to display"})})]})})]});const ba=()=>zt?e.jsx("div",{ref:K,className:"h-full overflow-auto",style:{height:D?.containerHeight||600},children:e.jsxs("table",{className:ue("w-full caption-bottom text-sm",le.table),style:pe(),children:[e.jsx("thead",{className:ue(y&&"sticky top-0 bg-background z-10"),children:he.getHeaderGroups().map(fe=>e.jsx("tr",{className:"border-b",children:fe.headers.map(de=>e.jsxs("th",{className:ue("text-left font-medium text-muted-foreground",le.header,de.column.getCanSort()&&"cursor-pointer select-none hover:text-foreground"),onClick:de.column.getToggleSortingHandler(),style:{width:de.getSize(),minWidth:de.column.columnDef.minSize,maxWidth:de.column.columnDef.maxSize},children:[de.isPlaceholder?null:Te.flexRender(de.column.columnDef.header,de.getContext()),de.column.getIsSorted()&&e.jsx("span",{className:"ml-2",children:de.column.getIsSorted()==="asc"?"↑":"↓"})]},de.id))},fe.id))}),e.jsx("tbody",{children:xs.map(fe=>{const de=he.getRowModel().rows[fe.index];if(!de)return null;const nt=Ue=>{const Ke=Ue.getValue(),rt=Ue.column.id,He=de.id,Se=_t.editingRowId===He,gs=U?.editableColumns?.find(Lt=>Lt.field===rt);return gs&&Se?e.jsx(Ps,{value:Ke,field:rt,config:gs.config,isEditing:Se,onChange:Lt=>jt.updateField(rt,Lt),onStartEdit:()=>jt.startEdit(He,de.original),onSave:()=>jt.saveEdit(),onCancel:()=>jt.cancelEdit()}):Ue.getIsGrouped()?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:Lt=>{Lt.stopPropagation(),de.toggleExpanded()},className:"p-1 hover:bg-muted rounded",children:de.getIsExpanded()?"▼":"▶"}),e.jsx("span",{className:"font-medium",children:Te.flexRender(Ue.column.columnDef.cell,Ue.getContext())}),e.jsxs("span",{className:"text-muted-foreground",children:["(",de.subRows.length,")"]})]}):Ue.getIsAggregated()?Te.flexRender(Ue.column.columnDef.aggregatedCell??Ue.column.columnDef.cell,Ue.getContext()):Ue.getIsPlaceholder()?null:Te.flexRender(Ue.column.columnDef.cell,Ue.getContext())};return e.jsx("tr",{className:ue("border-b transition-colors",I&&"cursor-pointer hover:bg-muted/50",de.getIsSelected()&&"bg-muted"),onClick:()=>I?.(de.original),onDoubleClick:()=>E?.(de.original),style:{position:"absolute",top:fe.start,left:0,width:"100%",height:fe.size},children:de.getVisibleCells().map(Ue=>e.jsx("td",{className:ue("align-middle",le.cell),children:nt(Ue)},Ue.id))},de.id)})})]})}):e.jsx("div",{className:ue("w-full overflow-auto",ee),children:e.jsxs("table",{className:ue("w-full caption-bottom text-sm",le.table),style:pe(),children:[e.jsx("thead",{className:ue(y&&"sticky top-0 bg-background z-10"),children:he.getHeaderGroups().map(fe=>e.jsx("tr",{className:"border-b",children:fe.headers.map(de=>e.jsxs("th",{className:ue("text-left font-medium text-muted-foreground",le.header,de.column.getCanSort()&&"cursor-pointer select-none hover:text-foreground"),onClick:de.column.getToggleSortingHandler(),style:{width:de.getSize(),minWidth:de.column.columnDef.minSize,maxWidth:de.column.columnDef.maxSize},children:[de.isPlaceholder?null:Te.flexRender(de.column.columnDef.header,de.getContext()),de.column.getIsSorted()&&e.jsx("span",{className:"ml-2",children:de.column.getIsSorted()==="asc"?"↑":"↓"})]},de.id))},fe.id))}),e.jsx("tbody",{children:he.getRowModel().rows.map((fe,de)=>{const nt=fe.getIsExpanded(),Ue=Ke=>{const rt=Ke.getValue(),He=Ke.column.id,Se=fe.id,gs=_t.editingRowId===Se,Lt=U?.editableColumns?.find(ss=>ss.field===He);return Lt&&gs?e.jsx(Ps,{value:rt,field:He,config:Lt.config,isEditing:gs,onChange:ss=>jt.updateField(He,ss),onStartEdit:()=>jt.startEdit(Se,fe.original),onSave:()=>jt.saveEdit(),onCancel:()=>jt.cancelEdit()}):Ke.getIsGrouped()?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:ss=>{ss.stopPropagation(),fe.toggleExpanded()},className:"p-1 hover:bg-muted rounded",children:fe.getIsExpanded()?"▼":"▶"}),e.jsx("span",{className:"font-medium",children:Te.flexRender(Ke.column.columnDef.cell,Ke.getContext())}),e.jsxs("span",{className:"text-muted-foreground",children:["(",fe.subRows.length,")"]})]}):Ke.getIsAggregated()?Te.flexRender(Ke.column.columnDef.aggregatedCell??Ke.column.columnDef.cell,Ke.getContext()):Ke.getIsPlaceholder()?null:Te.flexRender(Ke.column.columnDef.cell,Ke.getContext())};return e.jsxs(d.Fragment,{children:[e.jsx("tr",{className:ue("border-b transition-colors",I&&"cursor-pointer hover:bg-muted/50",fe.getIsSelected()&&"bg-muted",fe.getIsGrouped()&&"bg-muted/30 font-medium"),onClick:()=>I?.(fe.original),onDoubleClick:()=>E?.(fe.original),children:fe.getVisibleCells().map(Ke=>e.jsx("td",{className:ue("align-middle",le.cell),children:Ue(Ke)},Ke.id))}),k?.enabled&&nt&&e.jsx("tr",{children:e.jsx("td",{colSpan:fe.getVisibleCells().length,className:"p-0 bg-muted/30",children:e.jsx("div",{className:"border-b p-4",children:k.renderExpanded?.(fe.original)})})},`${fe.id}-expanded`)]},fe.id)})})]})});return e.jsxs("div",{className:ue("w-full",_),style:pe(),children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c&&e.jsx("div",{className:"flex-1",children:e.jsx(ia,{table:he,config:c,globalFilter:$e,onGlobalFilterChange:at,density:J,onDensityChange:B,onExport:F?xa:void 0,onImport:A?ga:void 0})}),o&&e.jsx(er,{table:he,filters:o,position:i,onFiltersChange:G})]}),ba(),l&&e.jsx(Zn,{table:he,pageSizeOptions:l.pageSizeOptions})]})}function dg({header:t,column:s,className:a}){const[n,r]=d.useState(!1),o=d.useCallback(i=>{i.preventDefault(),i.stopPropagation(),r(!0);const c=i.clientX,l=s.getSize(),u=m=>{const p=m.clientX-c,g=Math.max(50,l+p);s.setSize(g)},f=()=>{r(!1),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",f)};document.addEventListener("mousemove",u),document.addEventListener("mouseup",f)},[s]);return s.getCanResize()?e.jsx("div",{className:ue("absolute right-0 top-0 h-full w-1 cursor-col-resize bg-border opacity-0 hover:opacity-100 transition-opacity",n&&"opacity-100 bg-primary",a),onMouseDown:o,style:{width:"4px",marginRight:"-2px"}}):null}function ug({row:t,table:s,className:a}){const[n,r]=d.useState(t.getIsExpanded()),o=d.useCallback(()=>{r(!n),t.toggleExpanded()},[n,t]);t.getValue(t.groupingColumnId);const i=t.subRows.length;return e.jsxs("div",{className:ue("flex items-center gap-2 py-2",a),children:[e.jsx(j.Button,{variant:"ghost",size:"sm",onClick:o,className:"h-6 w-6 p-0",children:n?e.jsx(h.ChevronDown,{className:"h-4 w-4"}):e.jsx(h.ChevronRight,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:Te.flexRender(t.groupingColumn.columnDef.cell,t.getGroupingValue())}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",i," ",i===1?"item":"items",")"]})]})]})}function mg({row:t,table:s,className:a}){const n=t.getAggregationValue();return n?e.jsx("div",{className:ue("flex items-center gap-4 py-2 bg-muted/50",a),children:Object.entries(n).map(([r,o])=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:[r,":"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:typeof o=="number"?o.toLocaleString():String(o)})]},r))}):null}function hg({table:t,groupingColumns:s,onGroupingChange:a,className:n}){const[r,o]=d.useState(s),i=d.useCallback(l=>{const u=r.includes(l)?r.filter(f=>f!==l):[...r,l];o(u),a(u)},[r,a]),c=d.useCallback(()=>{o([]),a([])},[a]);return e.jsxs("div",{className:ue("flex items-center gap-2",n),children:[e.jsx("span",{className:"text-sm font-medium",children:"Group by:"}),t.getAllColumns().filter(l=>l.getCanGroup()).map(l=>e.jsx(j.Button,{variant:r.includes(l.id)?"default":"outline",size:"sm",onClick:()=>i(l.id),children:l.columnDef.header},l.id)),r.length>0&&e.jsx(j.Button,{variant:"ghost",size:"sm",onClick:c,children:"Clear"})]})}function fg({row:t,rowIndex:s,actions:a=[],columnActions:n=[],onCopy:r,onExport:o,onEdit:i,onDelete:c,onToggleColumnVisibility:l,visibleColumns:u=[],className:f,children:m}){const[p,g]=d.useState(!1),C=d.useCallback(k=>{k.onClick(t),g(!1)},[t]),y=d.useCallback(()=>{if(r)r(t);else{const k=Object.entries(t).map(([D,S])=>`${D}: ${S}`).join(`
|
|
85
|
+
`);navigator.clipboard.writeText(k)}g(!1)},[t,r]),N=d.useCallback(()=>{o&&o(t),g(!1)},[t,o]),v=d.useCallback(()=>{i&&i(t),g(!1)},[t,i]),x=d.useCallback(()=>{c&&c(t),g(!1)},[t,c]),w=d.useCallback(k=>{l&&l(k),g(!1)},[l]);return e.jsxs(ti,{onOpenChange:g,children:[e.jsx(si,{asChild:!0,children:m}),e.jsxs(Ln,{className:ue("w-64",f),children:[a.length>0&&e.jsxs(e.Fragment,{children:[a.map(k=>e.jsxs(Vt,{onClick:()=>C(k),disabled:k.disabled,className:ue(k.destructive&&"text-destructive focus:text-destructive"),children:[k.icon&&e.jsx("span",{className:"mr-2",children:k.icon}),k.label]},k.id)),e.jsx(Zs,{})]}),e.jsxs(Vt,{onClick:y,children:[e.jsx(h.Copy,{className:"mr-2 h-4 w-4"}),"Copy row"]}),o&&e.jsxs(Vt,{onClick:N,children:[e.jsx(h.Download,{className:"mr-2 h-4 w-4"}),"Export row"]}),i&&e.jsxs(Vt,{onClick:v,children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Edit row"]}),c&&e.jsxs(Vt,{onClick:x,className:"text-destructive focus:text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Delete row"]}),n.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Zs,{}),e.jsx("div",{className:"px-2 py-1.5 text-sm font-semibold text-muted-foreground",children:"Columns"}),n.map(k=>e.jsxs(Vt,{onClick:()=>w(k.id),disabled:k.disabled,children:[k.icon&&e.jsx("span",{className:"mr-2",children:k.icon}),k.label]},k.id))]}),l&&u.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Zs,{}),e.jsx("div",{className:"px-2 py-1.5 text-sm font-semibold text-muted-foreground",children:"Toggle Columns"}),u.map(k=>e.jsxs(Vt,{onClick:()=>w(k),children:[e.jsx(h.Eye,{className:"mr-2 h-4 w-4"}),k]},k))]})]})]})}function pg({table:t,selectionMode:s="multiple",selectedRows:a,onSelectionChange:n,selectionActions:r=[],className:o}){const[i,c]=d.useState(null);d.useCallback((p,g)=>{if(s==="single"){t.setRowSelection({[p]:g});return}if(s==="range"&&i!==null){const C=Math.min(i,p),y=Math.max(i,p),N={...t.getState().rowSelection};for(let v=C;v<=y;v++)N[v]=g;t.setRowSelection(N)}else t.setRowSelection(C=>({...C,[p]:g}));c(p)},[t,s,i]);const l=d.useCallback(p=>{if(p){const g=t.getRowModel().rows.reduce((C,y,N)=>(C[N]=!0,C),{});t.setRowSelection(g)}else t.setRowSelection({})},[t]);d.useCallback((p,g,C)=>{const y={...t.getState().rowSelection};for(let N=p;N<=g;N++)y[N]=C;t.setRowSelection(y)},[t]),d.useCallback(p=>{const g={...t.getState().rowSelection};t.getRowModel().rows.forEach((C,y)=>{p(C.original)&&(g[y]=!0)}),t.setRowSelection(g)},[t]);const u=d.useCallback(p=>{p.onClick(a)},[a]),f=t.getIsAllPageRowsSelected(),m=t.getIsSomePageRowsSelected();return e.jsxs("div",{className:ue("flex items-center gap-2",o),children:[e.jsx(st,{checked:f,onCheckedChange:l,ref:p=>{p&&"indeterminate"in p&&(p.indeterminate=m&&!f)},"aria-label":"Select all rows"}),a.length>0&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[a.length," selected"]}),e.jsx("div",{className:"flex items-center gap-1",children:r.map(p=>e.jsxs(j.Button,{variant:"ghost",size:"sm",onClick:()=>u(p),disabled:p.disabled,className:ue(p.destructive&&"text-destructive hover:text-destructive"),children:[p.icon&&e.jsx("span",{className:"mr-1",children:p.icon}),p.label]},p.id))})]}),e.jsxs(Be,{onValueChange:p=>{switch(p){case"all":l(!0);break;case"none":l(!1);break;case"invert":t.getRowModel().rows.forEach((g,C)=>{const y=t.getState().rowSelection[C];t.setRowSelection(N=>({...N,[C]:!y}))});break}},children:[e.jsx(ze,{className:"w-32",children:e.jsx(We,{placeholder:"Select"})}),e.jsxs(_e,{children:[e.jsx(ke,{value:"all",children:"Select All"}),e.jsx(ke,{value:"none",children:"Select None"}),e.jsx(ke,{value:"invert",children:"Invert Selection"})]})]})]})}function xg({table:t,selectionMode:s="multiple",onSelectionChange:a}){const[n,r]=d.useState([]);d.useEffect(()=>{const f=t.getFilteredSelectedRowModel().rows.map(m=>m.original);r(f),a?.(f)},[t,a]);const o=d.useCallback((f,m=!0)=>{t.setRowSelection(p=>({...p,[f]:m}))},[t]),i=d.useCallback((f=!0)=>{if(f){const m=t.getRowModel().rows.reduce((p,g,C)=>(p[C]=!0,p),{});t.setRowSelection(m)}else t.setRowSelection({})},[t]),c=d.useCallback((f,m,p=!0)=>{const g={...t.getState().rowSelection};for(let C=f;C<=m;C++)g[C]=p;t.setRowSelection(g)},[t]),l=d.useCallback(f=>{const m={...t.getState().rowSelection};t.getRowModel().rows.forEach((p,g)=>{f(p.original)&&(m[g]=!0)}),t.setRowSelection(m)},[t]),u=d.useCallback(()=>{t.setRowSelection({})},[t]);return{selectedRows:n,selectRow:o,selectAll:i,selectRange:c,selectByCriteria:l,clearSelection:u,isAllSelected:t.getIsAllPageRowsSelected(),isSomeSelected:t.getIsSomePageRowsSelected()}}function gg({cell:t,row:s,editingRowId:a,editableColumns:n,onUpdateField:r,onStartEdit:o,onSaveEdit:i,onCancelEdit:c}){const l=t.getValue(),u=t.column.id,f=s.id,m=a===f,p=d.useMemo(()=>n?.find(N=>N.field===u),[n,u]),g=d.useCallback(N=>r?.(u,N),[r,u]),C=d.useCallback(()=>o?.(f,s.original),[o,f,s.original]),y=d.useCallback(N=>{N.stopPropagation(),s.toggleExpanded()},[s]);return p&&m?e.jsx(Ps,{value:l,field:u,config:p.config,isEditing:m,onChange:g,onStartEdit:C,onSave:i??(()=>{}),onCancel:c??(()=>{})}):t.getIsGrouped()?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:y,className:"p-1 hover:bg-muted rounded",children:s.getIsExpanded()?"▼":"▶"}),e.jsx("span",{className:"font-medium",children:Te.flexRender(t.column.columnDef.cell,t.getContext())}),e.jsxs("span",{className:"text-muted-foreground",children:["(",s.subRows.length,")"]})]}):t.getIsAggregated()?e.jsx(e.Fragment,{children:Te.flexRender(t.column.columnDef.aggregatedCell??t.column.columnDef.cell,t.getContext())}):t.getIsPlaceholder()?null:e.jsx(e.Fragment,{children:Te.flexRender(t.column.columnDef.cell,t.getContext())})}function bg(t,s){if(t.cell.id!==s.cell.id||t.cell.getValue()!==s.cell.getValue())return!1;const a=t.editingRowId===t.row.id,n=s.editingRowId===s.row.id;return!(a!==n||t.row.getIsExpanded()!==s.row.getIsExpanded()||t.cell.getIsGrouped()!==s.cell.getIsGrouped()||t.cell.getIsAggregated()!==s.cell.getIsAggregated()||t.cell.getIsPlaceholder()!==s.cell.getIsPlaceholder())}const Fl=d.memo(gg,bg);function jg({table:t,headerSticky:s=!1,densityClasses:a={},enableColumnResize:n=!1,columnResizeMode:r="onEnd"}){return e.jsx("thead",{className:ue(s&&"sticky top-0 bg-background z-10"),children:t.getHeaderGroups().map(o=>e.jsx(Rl,{headerGroup:o,densityClasses:a,enableColumnResize:n,columnResizeMode:r,table:t},o.id))})}function vg({headerGroup:t,densityClasses:s,enableColumnResize:a,columnResizeMode:n,table:r}){return e.jsx("tr",{className:"border-b",children:t.headers.map(o=>{const i=o.column.getCanSort(),c=o.column.getIsSorted(),l=a&&o.column.getCanResize();return e.jsxs("th",{className:ue("text-left font-medium text-muted-foreground relative",s.header,i&&"cursor-pointer select-none hover:text-foreground"),onClick:o.column.getToggleSortingHandler(),style:{width:o.getSize(),minWidth:o.column.columnDef.minSize,maxWidth:o.column.columnDef.maxSize},children:[e.jsxs("div",{className:"flex items-center",children:[o.isPlaceholder?null:Te.flexRender(o.column.columnDef.header,o.getContext()),c&&e.jsx("span",{className:"ml-2",children:c==="asc"?"↑":"↓"})]}),l&&e.jsx("div",{onMouseDown:o.getResizeHandler(),onTouchStart:o.getResizeHandler(),className:ue("absolute right-0 top-0 h-full w-1 cursor-col-resize select-none touch-none","hover:bg-primary/50",o.column.getIsResizing()&&"bg-primary")})]},o.id)})})}function yg(t,s){if(t.headerGroup.id!==s.headerGroup.id||t.densityClasses.header!==s.densityClasses.header||t.enableColumnResize!==s.enableColumnResize||t.columnResizeMode!==s.columnResizeMode)return!1;const a=t.headerGroup.headers,n=s.headerGroup.headers;if(a.length!==n.length)return!1;for(let r=0;r<a.length;r++)if(a[r].column.getIsSorted()!==n[r].column.getIsSorted()||a[r].column.getIsResizing()!==n[r].column.getIsResizing()||a[r].getSize()!==n[r].getSize())return!1;return!0}const Rl=d.memo(vg,yg);function wg({table:t,rowExpansion:s,densityClasses:a={},onRowClick:n,onRowDoubleClick:r,editingRowId:o,editableColumns:i,onUpdateField:c,onStartEdit:l,onSaveEdit:u,onCancelEdit:f}){return e.jsx("tbody",{children:t.getRowModel().rows.map(m=>e.jsx(Il,{row:m,rowExpansion:s,densityClasses:a,onRowClick:n,onRowDoubleClick:r,editingRowId:o,editableColumns:i,onUpdateField:c,onStartEdit:l,onSaveEdit:u,onCancelEdit:f},m.id))})}function Ng({row:t,rowExpansion:s,densityClasses:a,onRowClick:n,onRowDoubleClick:r,editingRowId:o,editableColumns:i,onUpdateField:c,onStartEdit:l,onSaveEdit:u,onCancelEdit:f}){const m=t.getIsExpanded(),p=d.useCallback(()=>{n?.(t.original)},[n,t.original]),g=d.useCallback(()=>{r?.(t.original)},[r,t.original]);return e.jsxs(d.Fragment,{children:[e.jsx("tr",{className:ue("border-b transition-colors",n&&"cursor-pointer hover:bg-muted/50",t.getIsSelected()&&"bg-muted",t.getIsGrouped()&&"bg-muted/30 font-medium"),onClick:p,onDoubleClick:g,children:t.getVisibleCells().map(C=>e.jsx("td",{className:ue("align-middle",a.cell),children:e.jsx(Fl,{cell:C,row:t,editingRowId:o,editableColumns:i,onUpdateField:c,onStartEdit:l,onSaveEdit:u,onCancelEdit:f})},C.id))}),s?.enabled&&m&&e.jsx("tr",{children:e.jsx("td",{colSpan:t.getVisibleCells().length,className:"p-0 bg-muted/30",children:e.jsx("div",{className:"border-b p-4",children:s.renderExpanded?.(t.original)})})})]})}function Cg(t,s){if(t.row.id!==s.row.id||t.row.getIsSelected()!==s.row.getIsSelected()||t.row.getIsExpanded()!==s.row.getIsExpanded()||t.row.getIsGrouped()!==s.row.getIsGrouped())return!1;const a=t.editingRowId===t.row.id,n=s.editingRowId===s.row.id;return!(a!==n||t.densityClasses.cell!==s.densityClasses.cell||t.row.original!==s.row.original)}const Il=d.memo(Ng,Cg);function kg({row:t,onRowClick:s,onRowDoubleClick:a,themeDensityClasses:n,editState:r,editActions:o,edit:i}){const c=d.useCallback(()=>{s?.(t.original)},[s,t.original]),l=d.useCallback(()=>{a?.(t.original)},[a,t.original]);return e.jsx("tr",{className:ue("border-b transition-colors",s&&"cursor-pointer hover:bg-muted/50",t.getIsSelected()&&"bg-muted"),onClick:c,onDoubleClick:l,children:t.getVisibleCells().map(u=>{const f=u.getValue(),m=u.column.id,p=t.id,g=r?.editingRowId===p,C=i?.editableColumns?.find(y=>y.field===m);return C&&g&&o?e.jsx("td",{className:ue("align-middle",n.cell),children:e.jsx(Ps,{value:f,field:m,config:C.config,isEditing:g,onChange:y=>o.updateField(m,y),onStartEdit:()=>o.startEdit(p,t.original),onSave:()=>o.saveEdit(),onCancel:()=>o.cancelEdit()})},u.id):e.jsx("td",{className:ue("align-middle",n.cell),children:Te.flexRender(u.column.columnDef.cell,u.getContext())},u.id)})})}function Sg(t,s){if(t.row.id!==s.row.id||t.row.getIsSelected()!==s.row.getIsSelected())return!1;const a=t.editState?.editingRowId===t.row.id,n=s.editState?.editingRowId===s.row.id;return!(a!==n||t.themeDensityClasses.cell!==s.themeDensityClasses.cell||t.row.original!==s.row.original)}const Dg=d.memo(kg,Sg);function Tg({row:t,index:s,columns:a,onRowClick:n,onRowDoubleClick:r,themeDensityClasses:o,editState:i,editActions:c,edit:l,rowExpansion:u}){const f=t.getIsGrouped(),m=t.getIsExpanded();return e.jsxs(d.Fragment,{children:[e.jsx("tr",{className:ue("border-b transition-colors",n&&"cursor-pointer hover:bg-muted/50",t.getIsSelected()&&"bg-muted",f&&"bg-muted/30 font-medium"),onClick:()=>n?.(t.original),onDoubleClick:()=>r?.(t.original),children:t.getVisibleCells().map(p=>{const g=p.getValue(),C=p.column.id,y=t.id,N=i?.editingRowId===y,v=l?.editableColumns?.find(x=>x.field===C);return v&&N&&c?e.jsx("td",{className:ue("align-middle",o.cell),children:e.jsx(Ps,{value:g,field:C,config:v.config,isEditing:N,onChange:x=>c.updateField(C,x),onStartEdit:()=>c.startEdit(y,t.original),onSave:()=>c.saveEdit(),onCancel:()=>c.cancelEdit()})},p.id):p.getIsGrouped()?e.jsx("td",{className:ue("align-middle",o.cell),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:x=>{x.stopPropagation(),t.toggleExpanded()},className:"p-1 hover:bg-muted rounded",children:m?"▼":"▶"}),e.jsxs("span",{className:"font-medium",children:[Te.flexRender(p.column.columnDef.cell,p.getContext())," (",t.subRows.length,")"]})]})},p.id):p.getIsAggregated()?e.jsx("td",{className:ue("align-middle",o.cell),children:Te.flexRender(p.column.columnDef.aggregatedCell??p.column.columnDef.cell,p.getContext())},p.id):p.getIsPlaceholder()?e.jsx("td",{className:ue("align-middle",o.cell)},p.id):e.jsx("td",{className:ue("align-middle",o.cell)},p.id)})}),u?.enabled&&m&&e.jsx("tr",{children:e.jsx("td",{colSpan:a.length,className:"p-0 bg-muted/30",children:e.jsx("div",{className:"border-b p-4",children:u.renderExpanded?.(t.original)})})},`${t.id}-expanded-${s}`)]},`${t.id}-${s}`)}const Eg={fr:Ft,"fr-FR":Ft,en:Js,"en-US":Js,"en-GB":Js};function Pg(t){return t&&Eg[t]||Ft}function Mg(t){if(!t)return null;if(t instanceof Date)return V.isValid(t)?t:null;if(typeof t=="string"){const s=V.parseISO(t);if(V.isValid(s))return s;const a=new Date(t);if(V.isValid(a))return a}if(typeof t=="number"){const s=new Date(t);if(V.isValid(s))return s}return null}function tr(t,s="PP",a){const n=Mg(t);if(!n)return"";try{return V.format(n,s,{locale:Pg(a)})}catch{return""}}function Ag(t,s="PPpp",a){return tr(t,s,a)}function Fg(t,s="HH:mm",a){return tr(t,s,a)}function Rg(t,s="EUR",a="fr-FR",n){if(t==null||t==="")return"";const r=typeof t=="number"?t:parseFloat(String(t));if(isNaN(r))return"";try{return new Intl.NumberFormat(a,{style:"currency",currency:s,...n}).format(r)}catch{return String(r)}}function Ig(t,s=0,a=!1){if(t==null||t==="")return"";const n=typeof t=="number"?t:parseFloat(String(t));return isNaN(n)?"":`${(a?n*100:n).toFixed(s)}%`}function Lg(t,s="fr-FR",a){if(t==null||t==="")return"";const n=typeof t=="number"?t:parseFloat(String(t));if(isNaN(n))return"";try{return new Intl.NumberFormat(s,a).format(n)}catch{return String(n)}}function $g(t,s="FR"){if(!t)return"";const a=String(t).replace(/\s/g,"");if(s==="FR"||a.startsWith("+33")){let n=a;if(a.startsWith("+33")?n="0"+a.slice(3):a.startsWith("33")&&(n="0"+a.slice(2)),n.length===10)return n.replace(/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/,"$1 $2 $3 $4 $5");if(a.startsWith("+33")&&a.length===12)return a.replace(/(\+33)(\d)(\d{2})(\d{2})(\d{2})(\d{2})/,"$1 $2 $3 $4 $5 $6")}if(s==="US"||a.startsWith("+1")){let n=a;if(a.startsWith("+1")&&(n=a.slice(2)),n.length===10)return n.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3")}return a.length>=8&&a.match(/.{1,3}/g)?.join(" ")||a}function Og(t,s=2){if(t==null||t==="")return"";const a=typeof t=="number"?t:parseFloat(String(t));if(isNaN(a))return"";if(a===0)return"0 Bytes";const n=1024,r=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],o=Math.floor(Math.log(a)/Math.log(n)),i=r[Math.min(o,r.length-1)];return`${parseFloat((a/Math.pow(n,o)).toFixed(s))} ${i}`}function zg(t,s=50,a="..."){if(!t)return"";const n=String(t);return n.length<=s?n:n.slice(0,s-a.length)+a}function _g(t,s=2){return t?String(t).trim().split(/\s+/).slice(0,s).map(r=>r.charAt(0).toUpperCase()).join(""):""}function Vg(t,s="Oui",a="Non"){return t==null?"":t?s:a}function Bg(t,s=2){if(t==null)return"";try{return JSON.stringify(t,null,s)}catch{return String(t)}}const it={date:tr,datetime:Ag,time:Fg,currency:Rg,percentage:Ig,number:Lg,phone:$g,bytes:Og,truncate:zg,initials:_g,boolean:Vg,json:Bg},Re=({className:t})=>e.jsx("span",{className:b.cn("text-muted-foreground",t),children:"—"}),la=({value:t})=>{const[s,a]=d.useState(!1),n=async r=>{r.stopPropagation();try{await navigator.clipboard.writeText(t),a(!0),setTimeout(()=>a(!1),2e3)}catch{}};return e.jsx("button",{onClick:n,className:"ml-1 p-1 rounded hover:bg-muted transition-colors",title:s?"Copié !":"Copier",children:s?e.jsx(h.Check,{className:"h-3 w-3 text-green-500"}):e.jsx(h.Copy,{className:"h-3 w-3 text-muted-foreground"})})};function Wg({action:t,row:s}){const[a,n]=d.useState(!1),r=()=>{t.requiresConfirm?n(!0):t.onClick(s)},o=()=>{t.onClick(s),n(!1)},i=typeof t.disabled=="function"?t.disabled(s):t.disabled;return e.jsxs(e.Fragment,{children:[e.jsxs(Ne,{onClick:r,disabled:i,className:t.variant==="destructive"?"text-destructive focus:text-destructive":"",children:[t.icon&&e.jsx("span",{className:"mr-2",children:t.icon}),t.label]}),e.jsx(cs,{open:a,onOpenChange:n,children:e.jsxs(qt,{children:[e.jsxs(Ut,{children:[e.jsx(Gt,{children:t.confirmTitle||"Confirmer l'action"}),e.jsx(Xt,{children:t.confirmMessage||"Êtes-vous sûr de vouloir effectuer cette action ?"})]}),e.jsxs(Ht,{children:[e.jsx(Qt,{children:"Annuler"}),e.jsx(Yt,{onClick:o,className:t.variant==="destructive"?"bg-destructive hover:bg-destructive/90":"",children:"Confirmer"})]})]})})]})}const Ll={cell:(t,s,a)=>t?it.date(t,a?.format||"PP",a?.locale)||e.jsx(Re,{}):e.jsx(Re,{}),sortingFn:"datetime",size:120,enableSorting:!0,enableFiltering:!0},$l={cell:(t,s,a)=>t?it.datetime(t,a?.format||"Pp",a?.locale)||e.jsx(Re,{}):e.jsx(Re,{}),sortingFn:"datetime",size:160,enableSorting:!0,enableFiltering:!0},Ol={cell:(t,s,a)=>t?it.time(t,a?.format||"HH:mm",a?.locale)||e.jsx(Re,{}):e.jsx(Re,{}),sortingFn:"datetime",size:80,enableSorting:!0},zl={cell:(t,s,a)=>{if(t==null||t==="")return e.jsx(Re,{});const n=it.currency(t,a?.currency||"EUR",a?.locale||"fr-FR",{minimumFractionDigits:a?.minimumFractionDigits,maximumFractionDigits:a?.maximumFractionDigits});return e.jsx("span",{className:"font-mono tabular-nums",children:n})},sortingFn:"basic",size:120,enableSorting:!0,meta:{align:"right"}},_l={cell:(t,s,a)=>{if(t==null)return e.jsx(Re,{});const n=typeof t=="number"?t:parseFloat(String(t));if(isNaN(n))return e.jsx(Re,{});const r=a?.showValue!==!1?it.percentage(n):null;return e.jsxs("div",{className:"flex items-center gap-2 min-w-[80px]",children:[e.jsx(Es,{value:Math.min(100,Math.max(0,n)),className:b.cn("h-2 flex-1",a?.trackColor),style:a?.progressColor?{"--progress-color":a.progressColor}:void 0}),r&&e.jsx("span",{className:"text-sm tabular-nums w-10 text-right",children:r})]})},sortingFn:"basic",size:140,enableSorting:!0,meta:{align:"right"}},Vl={cell:(t,s,a)=>{if(t==null||t==="")return e.jsx(Re,{});const n=it.number(t,a?.locale||"fr-FR",{notation:a?.notation,minimumFractionDigits:a?.minimumFractionDigits,maximumFractionDigits:a?.maximumFractionDigits});return e.jsx("span",{className:"font-mono tabular-nums",children:n})},sortingFn:"basic",size:100,enableSorting:!0,meta:{align:"right"}},sr={cell:(t,s,a)=>{if(!t)return e.jsx(Re,{});const n=String(t),r=a?.statusColors||{},o=a?.statusLabels||{},i=a?.statusIcons||{},c=r[n]||"bg-gray-100 text-gray-800",l=o[n]||n,u=i[n];return e.jsxs(ye,{variant:"outline",className:b.cn("capitalize gap-1",c),children:[u&&e.jsx("span",{className:"mr-1",children:u}),l]})},size:120,enableSorting:!0,enableFiltering:!0},Bl=sr,Wl={cell:(t,s,a)=>{if(!t)return e.jsx(Re,{});const n=String(t),r=a?.truncate&&a?.maxLength?it.truncate(n,a.maxLength):n;return e.jsxs("div",{className:"flex items-center gap-1 group",children:[e.jsxs("a",{href:`mailto:${n}`,className:"text-primary hover:underline flex items-center gap-1",onClick:o=>o.stopPropagation(),children:[e.jsx(h.Mail,{className:"h-3 w-3 flex-shrink-0"}),e.jsx("span",{className:"truncate max-w-[200px]",children:r})]}),a?.copyable&&e.jsx("span",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(la,{value:n})})]})},size:200,enableSorting:!0,enableFiltering:!0},ql={cell:(t,s,a)=>{if(!t)return e.jsx(Re,{});const n=String(t),r=it.phone(n,a?.countryCode||"FR");return e.jsxs("div",{className:"flex items-center gap-1 group",children:[e.jsxs("a",{href:`tel:${n}`,className:"text-primary hover:underline flex items-center gap-1",onClick:o=>o.stopPropagation(),children:[e.jsx(h.Phone,{className:"h-3 w-3 flex-shrink-0"}),e.jsx("span",{className:"font-mono",children:r})]}),a?.copyable!==!1&&e.jsx("span",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(la,{value:n})})]})},size:150,enableSorting:!1,enableFiltering:!0},Ul={cell:(t,s,a)=>{if(!t)return e.jsx(Re,{});const n=String(t),r=a?.truncate&&a?.maxLength?it.truncate(n,a.maxLength):n;return e.jsxs("a",{href:n,target:a?.target||"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",onClick:o=>o.stopPropagation(),children:[e.jsx("span",{className:"truncate max-w-[200px]",children:r}),a?.showIcon!==!1&&e.jsx(h.ExternalLink,{className:"h-3 w-3 flex-shrink-0"})]})},size:200,enableSorting:!1,enableFiltering:!0},Hl={cell:(t,s,a)=>{if(!t)return e.jsx(Re,{});let n,r;if(typeof t=="string")n=t;else if(typeof t=="object"&&t!==null){const c=t,l=a?.nameKey||"name",u=a?.imageKey||"image";n=c[l],r=c[u]}const o={sm:"h-6 w-6 text-xs",md:"h-8 w-8 text-sm",lg:"h-10 w-10 text-base"},i=a?.avatarSize||"md";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Dt,{className:o[i],children:[e.jsx(Tt,{src:r,alt:n}),e.jsx(Et,{children:a?.fallbackInitials!==!1&&n?it.initials(n):"?"})]}),a?.showName&&n&&e.jsx("span",{className:"truncate max-w-[150px]",children:n})]})},size:60,enableSorting:!1,enableFiltering:!1},Gl={cell:(t,s,a)=>{if(t==null)return e.jsx(Re,{});const n=!!t,r=a?.trueIcon||h.Check,o=a?.falseIcon||h.X,i=a?.trueLabel,c=a?.falseLabel,l=a?.trueColor||"text-green-600",u=a?.falseColor||"text-gray-400",f=n?r:o,m=n?i:c,p=n?l:u;return e.jsxs("div",{className:b.cn("flex items-center gap-1",p),children:[typeof f=="function"?e.jsx(f,{className:"h-4 w-4"}):f,m&&e.jsx("span",{className:"text-sm",children:m})]})},size:80,enableSorting:!0,enableFiltering:!0};function ar(){return{cell:(t,s,a)=>{const n=a?.actions||[];return n.length?e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,onClick:r=>r.stopPropagation(),children:e.jsxs(j.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[e.jsx("span",{className:"sr-only",children:"Actions"}),e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})]})}),e.jsx(Ye,{align:a?.dropdownAlign||"end",children:n.map(r=>e.jsx(Wg,{action:r,row:s},r.id))})]}):null},size:50,enableSorting:!1,enableFiltering:!1,enableHiding:!1}}const Xl=ar(),Yl={cell:(t,s,a)=>e.jsx("span",{className:"text-muted-foreground tabular-nums",children:"#"}),size:50,enableSorting:!1,enableFiltering:!1,enableHiding:!1},Ql={cell:(t,s,a)=>{if(!t)return e.jsx(Re,{});const n=String(t),r=a?.truncate&&a?.maxLength?it.truncate(n,a.maxLength):n;return e.jsxs("div",{className:"flex items-center gap-1 group",children:[e.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:r}),a?.copyable&&e.jsx("span",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(la,{value:n})})]})},size:100,enableSorting:!0,enableFiltering:!0},Kl={cell:(t,s,a)=>{if(t==null)return e.jsx(Re,{});const n=typeof t=="number"?t:parseFloat(String(t));if(isNaN(n))return e.jsx(Re,{});const r=a?.maxRating||5,o=a?.allowHalf||!1,i=a?.color||"text-yellow-400",c=Math.floor(n),l=o&&n%1>=.5,u=r-c-(l?1:0);return e.jsxs("div",{className:"flex items-center gap-0.5",children:[Array.from({length:c}).map((f,m)=>e.jsx(h.Star,{className:b.cn("h-4 w-4 fill-current",i)},`full-${m}`)),l&&e.jsx(h.StarHalf,{className:b.cn("h-4 w-4 fill-current",i)}),Array.from({length:u}).map((f,m)=>e.jsx(h.Star,{className:"h-4 w-4 text-muted-foreground"},`empty-${m}`)),e.jsx("span",{className:"ml-1 text-sm text-muted-foreground",children:n.toFixed(1)})]})},sortingFn:"basic",size:140,enableSorting:!0},Jl={cell:(t,s,a)=>{if(t==null)return e.jsx(Re,{});const n=typeof t=="number"?t:parseFloat(String(t));if(isNaN(n))return e.jsx(Re,{});const r=Math.min(100,Math.max(0,n)),o=a?.showLabel!==!1;return e.jsxs("div",{className:"flex items-center gap-2 min-w-[100px]",children:[e.jsx(Es,{value:r,className:"h-2 flex-1"}),o&&e.jsxs("span",{className:"text-sm tabular-nums w-10 text-right",children:[Math.round(r),"%"]})]})},sortingFn:"basic",size:140,enableSorting:!0},Zl={cell:(t,s,a)=>{if(!t)return e.jsx(Re,{});let n;if(typeof t=="string"){const l=a?.separator||",";n=t.split(l).map(u=>u.trim()).filter(Boolean)}else if(Array.isArray(t))n=t.map(String);else return e.jsx(Re,{});if(!n.length)return e.jsx(Re,{});const r=a?.maxTags||3,o=n.slice(0,r),i=n.length-r,c=a?.tagColors||{};return e.jsxs("div",{className:"flex flex-wrap gap-1",children:[o.map((l,u)=>e.jsx(ye,{variant:"secondary",className:b.cn("text-xs",c[l]),children:l},u)),i>0&&e.jsxs(ye,{variant:"outline",className:"text-xs",children:["+",i]})]})},size:200,enableSorting:!1,enableFiltering:!0},ec={cell:(t,s,a)=>{if(t==null)return e.jsx(Re,{});const[n,r]=d.useState(!1),o=it.json(t,2);return a?.expandable!==!1&&o.length>50?e.jsx("div",{className:"relative",children:e.jsx("button",{onClick:c=>{c.stopPropagation(),r(!n)},className:"text-left w-full",children:e.jsx("code",{className:b.cn("text-xs bg-muted px-1.5 py-0.5 rounded font-mono block",n?"whitespace-pre-wrap":"truncate max-w-[200px]"),children:o})})}):e.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded font-mono whitespace-pre-wrap",children:o})},size:200,enableSorting:!1,enableFiltering:!1},tc={cell:(t,s,a)=>{if(t==null||t==="")return e.jsx(Re,{});const n=String(t),r=a?.truncate&&a?.maxLength?it.truncate(n,a.maxLength):n;if(a?.highlight){const o=new RegExp(`(${a.highlight})`,"gi"),i=r.split(o);return e.jsxs("div",{className:"flex items-center gap-1 group",children:[e.jsx("span",{children:i.map((c,l)=>o.test(c)?e.jsx("mark",{className:"bg-yellow-200 dark:bg-yellow-800",children:c},l):e.jsx(d.Fragment,{children:c},l))}),a?.copyable&&e.jsx("span",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(la,{value:n})})]})}return e.jsxs("div",{className:"flex items-center gap-1 group",children:[e.jsx("span",{className:a?.truncate?"truncate":"",children:r}),a?.copyable&&e.jsx("span",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(la,{value:n})})]})},enableSorting:!0,enableFiltering:!0},Is={date:Ll,datetime:$l,time:Ol,currency:zl,percentage:_l,number:Vl,status:sr,badge:Bl,email:Wl,phone:ql,url:Ul,avatar:Hl,boolean:Gl,actions:Xl,index:Yl,id:Ql,rating:Kl,progress:Jl,tags:Zl,json:ec,text:tc};function qg(t){return Is[t]}const Ug=Object.keys(Is);function Hg(t){const s=O.useMemo(()=>({locale:"fr-FR",currency:"EUR",dateFormat:"PP",datetimeFormat:"PPpp",timeFormat:"HH:mm",...t}),[t]),a=O.useCallback(l=>{if(typeof l=="object"&&l!==null)return l;const u=l;return u==="actions"?ar():Is[u]},[]),n=O.useCallback(l=>{const{template:u,accessorKey:f,header:m,options:p={}}=l,g=a(u);if(!g)return console.warn(`Template "${String(u)}" not found, falling back to text template`),{accessorKey:f,header:m||String(f),cell:({getValue:x})=>String(x()??"")};const C=typeof u=="string"?u:void 0,y={locale:s.locale,currency:s.currency,format:C==="datetime"?s.datetimeFormat:C==="time"?s.timeFormat:s.dateFormat,...C&&t?.defaultTemplateOptions?.[C]?t.defaultTemplateOptions[C]:{},...p.templateOptions||{}},N=x=>{const w=x.getValue();return g.cell(w,x.row.original,y)},v={accessorKey:f,header:m||String(f),cell:N,size:p.size||g.size,minSize:p.minSize||g.minSize,maxSize:p.maxSize||g.maxSize,enableSorting:p.enableSorting??g.enableSorting,enableColumnFilter:p.enableFiltering??g.enableFiltering,enableHiding:p.enableHiding??g.enableHiding,meta:{...g.meta,templateName:C}};return g.sortingFn&&(v.sortingFn=g.sortingFn),g.filterFn&&(v.filterFn=g.filterFn),v},[s,t?.defaultTemplateOptions,a]),r=O.useCallback(l=>l.map(u=>n(u)),[n]),o=O.useCallback(l=>it[l],[]),i=O.useCallback(l=>l in Is,[]),c=O.useMemo(()=>Object.keys(Is),[]);return{getColumnFromTemplate:n,createColumns:r,getFormatter:o,hasTemplate:i,availableTemplates:c,formatters:it}}function ja(){return`${Date.now()}-${Math.random().toString(36).slice(2,11)}`}const ka={string:["equals","notEquals","contains","notContains","startsWith","endsWith","isEmpty","isNotEmpty","isNull","isNotNull"],number:["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","isNull","isNotNull"],date:["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","isNull","isNotNull"],datetime:["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","isNull","isNotNull"],boolean:["equals","notEquals","isNull","isNotNull"],enum:["equals","notEquals","in","notIn","isNull","isNotNull"],array:["contains","notContains","isEmpty","isNotEmpty","isNull","isNotNull"]},sc={equals:"est égal à",notEquals:"est différent de",contains:"contient",notContains:"ne contient pas",startsWith:"commence par",endsWith:"finit par",greaterThan:"supérieur à",greaterThanOrEqual:"supérieur ou égal à",lessThan:"inférieur à",lessThanOrEqual:"inférieur ou égal à",between:"entre",in:"est dans",notIn:"n'est pas dans",isEmpty:"est vide",isNotEmpty:"n'est pas vide",isNull:"est null",isNotNull:"n'est pas null"};function Gg(t,s,a){const n=a.find(c=>c.key===s.column);if(n?.filterFn)return n.filterFn(t,s);const r=t[s.column],o=s.value,i=s.valueTo;if(s.operator==="isNull")return r==null;if(s.operator==="isNotNull")return r!=null;if(s.operator==="isEmpty")return Array.isArray(r)?r.length===0:typeof r=="string"?r.trim()==="":r==null;if(s.operator==="isNotEmpty")return Array.isArray(r)?r.length>0:typeof r=="string"?r.trim()!=="":r!=null;if(r==null)return!1;if(typeof r=="string"||n?.type==="string"){const c=String(r).toLowerCase(),l=String(o??"").toLowerCase();switch(s.operator){case"equals":return c===l;case"notEquals":return c!==l;case"contains":return c.includes(l);case"notContains":return!c.includes(l);case"startsWith":return c.startsWith(l);case"endsWith":return c.endsWith(l);default:return!0}}if(typeof r=="number"||n?.type==="number"){const c=Number(r),l=Number(o),u=i!==void 0?Number(i):void 0;switch(s.operator){case"equals":return c===l;case"notEquals":return c!==l;case"greaterThan":return c>l;case"greaterThanOrEqual":return c>=l;case"lessThan":return c<l;case"lessThanOrEqual":return c<=l;case"between":return u!==void 0&&c>=l&&c<=u;default:return!0}}if(r instanceof Date||n?.type==="date"||n?.type==="datetime"){const c=r instanceof Date?r:new Date(r),l=o instanceof Date?o:new Date(o),u=i instanceof Date?i:i?new Date(i):void 0;switch(s.operator){case"equals":return c.getTime()===l.getTime();case"notEquals":return c.getTime()!==l.getTime();case"greaterThan":return c.getTime()>l.getTime();case"greaterThanOrEqual":return c.getTime()>=l.getTime();case"lessThan":return c.getTime()<l.getTime();case"lessThanOrEqual":return c.getTime()<=l.getTime();case"between":return u!==void 0&&c>=l&&c<=u;default:return!0}}if(typeof r=="boolean"||n?.type==="boolean"){const c=!!r,l=o===!0||o==="true";switch(s.operator){case"equals":return c===l;case"notEquals":return c!==l;default:return!0}}if(s.operator==="in")return Array.isArray(o)?o.includes(r):r===o;if(s.operator==="notIn")return Array.isArray(o)?!o.includes(r):r!==o;if(Array.isArray(r))switch(s.operator){case"contains":return r.includes(o);case"notContains":return!r.includes(o);default:return!0}return!0}function ac(t,s,a){const n=s.rules.filter(o=>o.enabled!==!1),r=[];for(const o of n)r.push(Gg(t,o,a));for(const o of s.groups)r.push(ac(t,o,a));return r.length===0?!0:s.connector==="AND"?r.every(Boolean):r.some(Boolean)}function fn(t,s){for(const a of t.rules)if(a.id===s)return{rule:a,parent:t};for(const a of t.groups){const n=fn(a,s);if(n)return n}return null}function Qs(t,s,a=null){if(t.id===s)return{group:t,parent:a};for(const n of t.groups){const r=Qs(n,s,t);if(r)return r}return null}function ns(t){return JSON.parse(JSON.stringify(t))}function Xg({data:t,config:s}){const a=O.useCallback(()=>({id:ja(),connector:"AND",rules:[],groups:[]}),[]),[n,r]=O.useState(()=>({currentFilter:a(),presets:s.presets||[],activePresetId:null,isEditing:!1,isDirty:!1}));O.useEffect(()=>{if(!s.persistPresets||typeof window>"u")return;const f=s.storageKey||"datatable-filter-presets";try{const m=localStorage.getItem(f);if(m){const p=JSON.parse(m);r(g=>({...g,presets:[...s.presets||[],...p.filter(C=>!s.presets?.some(y=>y.id===C.id))]}))}}catch{}},[s.persistPresets,s.storageKey,s.presets]);const o=O.useCallback(f=>{if(!s.persistPresets||typeof window>"u")return;const m=s.storageKey||"datatable-filter-presets";try{const p=f.filter(g=>!s.presets?.some(C=>C.id===g.id));localStorage.setItem(m,JSON.stringify(p))}catch{}},[s.persistPresets,s.storageKey,s.presets]),i=O.useCallback(f=>{const m=s.columns.find(p=>p.key===f);return m&&(m.operators||ka[m.type])||ka.string},[s.columns]),c=O.useCallback(f=>{const m=[],p=(g,C=0)=>{s.maxNestingDepth!==void 0&&C>s.maxNestingDepth&&m.push(`Profondeur maximale d'imbrication dépassée (${s.maxNestingDepth})`),s.maxRulesPerGroup!==void 0&&g.rules.length>s.maxRulesPerGroup&&m.push(`Nombre maximum de règles par groupe dépassé (${s.maxRulesPerGroup})`);for(const y of g.rules)s.columns.find(x=>x.key===y.column)||m.push(`Colonne inconnue: ${String(y.column)}`),i(y.column).includes(y.operator)||m.push(`Opérateur invalide pour ${String(y.column)}: ${y.operator}`);for(const y of g.groups)p(y,C+1)};return p(f),{valid:m.length===0,errors:m}},[s.columns,s.maxNestingDepth,s.maxRulesPerGroup,i]),l=O.useMemo(()=>({addRule:(f,m)=>{r(p=>{const g=ns(p.currentFilter),C=Qs(g,f);return C&&C.group.rules.push({...m,id:ja(),enabled:!0}),{...p,currentFilter:g,isDirty:!0}})},updateRule:(f,m)=>{r(p=>{const g=ns(p.currentFilter),C=fn(g,f);return C&&Object.assign(C.rule,m),{...p,currentFilter:g,isDirty:!0}})},removeRule:f=>{r(m=>{const p=ns(m.currentFilter),g=fn(p,f);return g&&(g.parent.rules=g.parent.rules.filter(C=>C.id!==f)),{...m,currentFilter:p,isDirty:!0}})},addGroup:(f,m="AND")=>{r(p=>{const g=ns(p.currentFilter),C=Qs(g,f);return C&&C.group.groups.push({id:ja(),connector:m,rules:[],groups:[]}),{...p,currentFilter:g,isDirty:!0}})},removeGroup:f=>{r(m=>{const p=ns(m.currentFilter),g=Qs(p,f);return g&&g.parent&&(g.parent.groups=g.parent.groups.filter(C=>C.id!==f)),{...m,currentFilter:p,isDirty:!0}})},setGroupConnector:(f,m)=>{r(p=>{const g=ns(p.currentFilter),C=Qs(g,f);return C&&(C.group.connector=m),{...p,currentFilter:g,isDirty:!0}})},resetFilters:()=>{r(f=>({...f,currentFilter:a(),activePresetId:null,isDirty:!1}))},applyFilters:()=>{r(f=>(s.onFilterChange?.(f.currentFilter),{...f,isEditing:!1}))},saveAsPreset:(f,m)=>{r(p=>{const g={id:ja(),name:f,description:m,filter:ns(p.currentFilter),createdAt:new Date},C=[...p.presets,g];return o(C),s.onPresetSave?.(g),{...p,presets:C,activePresetId:g.id,isDirty:!1}})},applyPreset:f=>{r(m=>{const p=m.presets.find(C=>C.id===f);if(!p)return m;const g=ns(p.filter);return s.onFilterChange?.(g),{...m,currentFilter:g,activePresetId:f,isDirty:!1}})},deletePreset:f=>{r(m=>{const p=m.presets.filter(g=>g.id!==f);return o(p),s.onPresetDelete?.(f),{...m,presets:p,activePresetId:m.activePresetId===f?null:m.activePresetId}})},importFilters:f=>{try{const m=JSON.parse(f),p=c(m);if(!p.valid){console.error("Invalid filter:",p.errors);return}r(g=>({...g,currentFilter:m,activePresetId:null,isDirty:!0}))}catch(m){console.error("Failed to import filters:",m)}},exportFilters:()=>JSON.stringify(n.currentFilter,null,2)}),[s,a,o,c,n.currentFilter]),u=O.useMemo(()=>!s.enabled||n.currentFilter.rules.length===0&&n.currentFilter.groups.length===0?t:t.filter(f=>ac(f,n.currentFilter,s.columns)),[t,s.enabled,s.columns,n.currentFilter]);return{state:n,actions:l,filteredData:u,filteredCount:u.length,getOperatorsForColumn:i,createEmptyFilter:a,validateFilter:c}}const Yg="wakastart-datatable",Qg=1,we={CACHE:"cache",SYNC_QUEUE:"syncQueue",CONFLICTS:"conflicts"};class nc{constructor(){this.db=null,this.initPromise=null}async init(){if(!this.db)return this.initPromise?this.initPromise:(this.initPromise=new Promise((s,a)=>{if(!("indexedDB"in window)){a(new Error("IndexedDB is not supported in this browser"));return}const n=indexedDB.open(Yg,Qg);n.onerror=()=>{a(n.error)},n.onsuccess=()=>{this.db=n.result,s()},n.onupgradeneeded=r=>{const o=r.target.result;if(!o.objectStoreNames.contains(we.CACHE)){const i=o.createObjectStore(we.CACHE,{keyPath:"id"});i.createIndex("tableId","tableId",{unique:!1}),i.createIndex("timestamp","timestamp",{unique:!1})}if(!o.objectStoreNames.contains(we.SYNC_QUEUE)){const i=o.createObjectStore(we.SYNC_QUEUE,{keyPath:"id"});i.createIndex("tableId","tableId",{unique:!1}),i.createIndex("timestamp","timestamp",{unique:!1}),i.createIndex("rowId","rowId",{unique:!1})}if(!o.objectStoreNames.contains(we.CONFLICTS)){const i=o.createObjectStore(we.CONFLICTS,{keyPath:"id"});i.createIndex("tableId","tableId",{unique:!1}),i.createIndex("rowId","rowId",{unique:!1})}}}),this.initPromise)}isAvailable(){return"indexedDB"in window}close(){this.db&&(this.db.close(),this.db=null,this.initPromise=null)}async cacheData(s,a,n=1){if(await this.init(),!this.db)throw new Error("Database not initialized");const r={id:s,tableId:s,data:a,timestamp:new Date,version:n};return new Promise((o,i)=>{const u=this.db.transaction([we.CACHE],"readwrite").objectStore(we.CACHE).put(r);u.onsuccess=()=>o(),u.onerror=()=>i(u.error)})}async getCachedData(s){if(await this.init(),!this.db)throw new Error("Database not initialized");return new Promise((a,n)=>{const i=this.db.transaction([we.CACHE],"readonly").objectStore(we.CACHE).get(s);i.onsuccess=()=>a(i.result||null),i.onerror=()=>n(i.error)})}async clearCache(s){if(await this.init(),!this.db)throw new Error("Database not initialized");return new Promise((a,n)=>{const i=this.db.transaction([we.CACHE],"readwrite").objectStore(we.CACHE).delete(s);i.onsuccess=()=>a(),i.onerror=()=>n(i.error)})}async cleanExpiredCache(s){if(await this.init(),!this.db)throw new Error("Database not initialized");const a=new Date(Date.now()-s);return new Promise((n,r)=>{const c=this.db.transaction([we.CACHE],"readwrite").objectStore(we.CACHE).index("timestamp"),l=IDBKeyRange.upperBound(a),u=c.openCursor(l);let f=0;u.onsuccess=m=>{const p=m.target.result;p?(p.delete(),f++,p.continue()):n(f)},u.onerror=()=>r(u.error)})}async queueChange(s,a,n,r){if(await this.init(),!this.db)throw new Error("Database not initialized");const o=`${s}_${a}_${Date.now()}`,i={id:o,tableId:s,rowId:a,type:n,data:r,timestamp:new Date,attempts:0};return new Promise((c,l)=>{const m=this.db.transaction([we.SYNC_QUEUE],"readwrite").objectStore(we.SYNC_QUEUE).add(i);m.onsuccess=()=>c(o),m.onerror=()=>l(m.error)})}async getPendingChanges(s){if(await this.init(),!this.db)throw new Error("Database not initialized");return new Promise((a,n)=>{const c=this.db.transaction([we.SYNC_QUEUE],"readonly").objectStore(we.SYNC_QUEUE).index("tableId").getAll(s);c.onsuccess=()=>{const l=c.result;l.sort((u,f)=>new Date(u.timestamp).getTime()-new Date(f.timestamp).getTime()),a(l)},c.onerror=()=>n(c.error)})}async countPendingChanges(s){if(await this.init(),!this.db)throw new Error("Database not initialized");return new Promise((a,n)=>{const c=this.db.transaction([we.SYNC_QUEUE],"readonly").objectStore(we.SYNC_QUEUE).index("tableId").count(s);c.onsuccess=()=>a(c.result),c.onerror=()=>n(c.error)})}async removeFromQueue(s){if(await this.init(),!this.db)throw new Error("Database not initialized");return new Promise((a,n)=>{const i=this.db.transaction([we.SYNC_QUEUE],"readwrite").objectStore(we.SYNC_QUEUE).delete(s);i.onsuccess=()=>a(),i.onerror=()=>n(i.error)})}async updateAttempts(s,a){if(await this.init(),!this.db)throw new Error("Database not initialized");return new Promise((n,r)=>{const i=this.db.transaction([we.SYNC_QUEUE],"readwrite").objectStore(we.SYNC_QUEUE),c=i.get(s);c.onsuccess=()=>{const l=c.result;if(l){l.attempts++,a&&(l.lastError=a);const u=i.put(l);u.onsuccess=()=>n(),u.onerror=()=>r(u.error)}else n()},c.onerror=()=>r(c.error)})}async clearQueue(s){if(await this.init(),!this.db)throw new Error("Database not initialized");const a=await this.getPendingChanges(s);return new Promise((n,r)=>{const i=this.db.transaction([we.SYNC_QUEUE],"readwrite").objectStore(we.SYNC_QUEUE);let c=0;const l=a.length;if(l===0){n();return}a.forEach(u=>{const f=i.delete(u.id);f.onsuccess=()=>{c++,c===l&&n()},f.onerror=()=>r(f.error)})})}async addConflict(s){if(await this.init(),!this.db)throw new Error("Database not initialized");const a=`conflict_${s.tableId}_${s.rowId}_${Date.now()}`,n={id:a,...s};return new Promise((r,o)=>{const l=this.db.transaction([we.CONFLICTS],"readwrite").objectStore(we.CONFLICTS).add(n);l.onsuccess=()=>r(a),l.onerror=()=>o(l.error)})}async getConflicts(s){if(await this.init(),!this.db)throw new Error("Database not initialized");return new Promise((a,n)=>{const c=this.db.transaction([we.CONFLICTS],"readonly").objectStore(we.CONFLICTS).index("tableId").getAll(s);c.onsuccess=()=>a(c.result),c.onerror=()=>n(c.error)})}async resolveConflict(s){if(await this.init(),!this.db)throw new Error("Database not initialized");return new Promise((a,n)=>{const i=this.db.transaction([we.CONFLICTS],"readwrite").objectStore(we.CONFLICTS).delete(s);i.onsuccess=()=>a(),i.onerror=()=>n(i.error)})}async clearConflicts(s){if(await this.init(),!this.db)throw new Error("Database not initialized");const a=await this.getConflicts(s);return new Promise((n,r)=>{const i=this.db.transaction([we.CONFLICTS],"readwrite").objectStore(we.CONFLICTS);let c=0;const l=a.length;if(l===0){n();return}a.forEach(u=>{const f=i.delete(u.id);f.onsuccess=()=>{c++,c===l&&n()},f.onerror=()=>r(f.error)})})}async getStats(s){await this.init();const a=await this.getCachedData(s),n=await this.countPendingChanges(s),r=await this.getConflicts(s);return{cacheSize:a?.data?.length??0,pendingChanges:n,conflicts:r.length,lastCacheUpdate:a?.timestamp?new Date(a.timestamp):null}}}let tn=null;function rc(){return tn||(tn=new nc),tn}function Kg(t){const{tableId:s,enabled:a=!0,conflictResolution:n="manual",onSync:r,autoSyncInterval:o=0,cacheExpiration:i,onOnlineStatusChange:c,onSyncComplete:l,onConflict:u}=t,[f,m]=O.useState(typeof navigator<"u"?navigator.onLine:!0),[p,g]=O.useState(!1),[C,y]=O.useState(0),[N,v]=O.useState(null),[x,w]=O.useState(null),[k,D]=O.useState([]),[S,F]=O.useState(null),[A,T]=O.useState(null),[M,I]=O.useState(!1),E=O.useRef(null),P=O.useMemo(()=>a?rc():null,[a]);O.useEffect(()=>{if(!a||!P){I(!1);return}I(P.isAvailable())},[a,P]),O.useEffect(()=>{if(typeof window>"u")return;const K=()=>{m(!0),c?.(!0)},q=()=>{m(!1),c?.(!1)};return window.addEventListener("online",K),window.addEventListener("offline",q),()=>{window.removeEventListener("online",K),window.removeEventListener("offline",q)}},[c]);const G=O.useCallback(async()=>{if(!(!a||!P||!M))try{await P.init(),i&&await P.cleanExpiredCache(i);const K=await P.getCachedData(s);K&&(v(K.data),w(new Date(K.timestamp)));const q=await P.countPendingChanges(s);y(q);const W=await P.getConflicts(s);D(W)}catch(K){console.error("[WakaUI] Error loading offline state:",K)}},[a,P,s,M,i]);O.useEffect(()=>{G()},[G]),O.useEffect(()=>{if(!a||!f||!o||o<=0){E.current&&(clearInterval(E.current),E.current=null);return}return E.current=setInterval(()=>{C>0&&z()},o),()=>{E.current&&clearInterval(E.current)}},[a,f,o,C]);const H=O.useCallback(async K=>{if(!(!a||!P||!M))try{await P.cacheData(s,K),v(K),w(new Date)}catch(q){console.error("[WakaUI] Error caching data:",q)}},[a,P,s,M]),X=O.useCallback(async K=>{if(!(!a||!P||!M))try{await P.queueChange(s,K.rowId,K.type,K.data),y(q=>q+1)}catch(q){console.error("[WakaUI] Error queueing change:",q)}},[a,P,s,M]),z=O.useCallback(async()=>{if(!(!a||!P||!M||!r||p||!f)){g(!0),F(null);try{const K=await P.getPendingChanges(s);if(K.length===0){g(!1);return}const q=await r(K);for(const W of q){const J=K.find(B=>B.id===W.id);if(J)if(W.success)await P.removeFromQueue(W.id),y(B=>Math.max(0,B-1));else if(W.serverData){const B={tableId:s,rowId:J.rowId,localData:J.data,serverData:W.serverData,localTimestamp:new Date(J.timestamp),serverTimestamp:W.serverTimestamp||new Date,type:J.type};if(n==="manual"){const se={id:await P.addConflict(B),...B};D(ee=>[...ee,se]),u?.(se)}else{let te=null;if(n==="client-wins")te=J.data;else if(n==="server-wins")te=W.serverData;else if(n==="latest-wins"){const se=new Date(J.timestamp).getTime(),ee=(W.serverTimestamp||new Date).getTime();te=se>ee?J.data:W.serverData}if(await P.removeFromQueue(W.id),y(se=>Math.max(0,se-1)),te&&N){const se=N.map(ee=>ee.id===J.rowId?{...ee,...te}:ee);await H(se)}}}else await P.updateAttempts(W.id,W.error)}T(new Date),l?.(q)}catch(K){const q=K instanceof Error?K.message:"Sync failed";F(q),console.error("[WakaUI] Sync error:",K)}finally{g(!1)}}},[a,P,s,M,r,p,f,n,N,H,u,l]),L=O.useCallback(async(K,q,W)=>{if(!(!a||!P||!M))try{const J=k.find(ee=>ee.id===K);if(!J)return;let B=null;if(q==="local"?B=J.localData:q==="server"?B=J.serverData:q==="merge"&&W&&(B=W),B&&N){const ee=N.map(le=>le.id===J.rowId?{...le,...B}:le);await H(ee)}await P.resolveConflict(K),D(ee=>ee.filter(le=>le.id!==K));const se=(await P.getPendingChanges(s)).find(ee=>ee.rowId===J.rowId);se&&(await P.removeFromQueue(se.id),y(ee=>Math.max(0,ee-1)))}catch(J){console.error("[WakaUI] Error resolving conflict:",J)}},[a,P,s,M,k,N,H]),_=O.useCallback(async()=>{if(!a||!P||!M)return null;try{const K=await P.getCachedData(s);return K?(v(K.data),w(new Date(K.timestamp)),K.data):null}catch(K){return console.error("[WakaUI] Error loading from cache:",K),null}},[a,P,s,M]),R=O.useCallback(async()=>{if(!(!a||!P||!M))try{await P.clearCache(s),v(null),w(null)}catch(K){console.error("[WakaUI] Error clearing cache:",K)}},[a,P,s,M]),U=O.useCallback(async()=>{if(!(!a||!P||!M))try{await P.clearQueue(s),y(0)}catch(K){console.error("[WakaUI] Error clearing queue:",K)}},[a,P,s,M]),$=O.useCallback(async()=>{await G()},[G]);return[{isOnline:f,isSyncing:p,pendingChangesCount:C,cachedData:N,lastCacheUpdate:x,conflicts:k,syncError:S,lastSyncTime:A,isAvailable:M},{cacheData:H,queueChange:X,sync:z,resolveConflict:L,loadFromCache:_,clearCache:R,clearQueue:U,refresh:$}]}function Jg({state:t,actions:s,columns:a,getOperatorsForColumn:n,className:r,maxNestingDepth:o=3}){const[i,c]=d.useState(""),[l,u]=d.useState(!1),f=()=>{i.trim()&&(s.saveAsPreset(i.trim()),c(""),u(!1))},m=()=>{const g=s.exportFilters(),C=new Blob([g],{type:"application/json"}),y=URL.createObjectURL(C),N=document.createElement("a");N.href=y,N.download="filters.json",N.click(),URL.revokeObjectURL(y)},p=()=>{const g=document.createElement("input");g.type="file",g.accept=".json",g.onchange=async C=>{const y=C.target.files?.[0];if(y){const N=await y.text();s.importFilters(N)}},g.click()};return e.jsxs("div",{className:b.cn("space-y-4",r),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:"Filtres avancés"}),t.isDirty&&e.jsx(ye,{variant:"secondary",className:"text-xs",children:"Modifié"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[t.presets.length>0&&e.jsxs(j.Popover,{children:[e.jsx(j.PopoverTrigger,{asChild:!0,children:e.jsx(j.Button,{variant:"outline",size:"sm",children:t.activePresetId&&t.presets.find(g=>g.id===t.activePresetId)?.name||"Presets"})}),e.jsx(j.PopoverContent,{className:"w-64 p-2",align:"end",children:e.jsx("div",{className:"space-y-1",children:t.presets.map(g=>e.jsxs("div",{className:b.cn("flex items-center justify-between p-2 rounded hover:bg-muted cursor-pointer",t.activePresetId===g.id&&"bg-muted"),onClick:()=>s.applyPreset(g.id),children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:g.name}),g.description&&e.jsx("div",{className:"text-xs text-muted-foreground",children:g.description})]}),e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:C=>{C.stopPropagation(),s.deletePreset(g.id)},children:e.jsx(h.Trash2,{className:"h-3 w-3"})})]},g.id))})})]}),e.jsx(j.Button,{variant:"ghost",size:"icon",onClick:p,title:"Importer",children:e.jsx(h.Upload,{className:"h-4 w-4"})}),e.jsx(j.Button,{variant:"ghost",size:"icon",onClick:m,title:"Exporter",children:e.jsx(h.Download,{className:"h-4 w-4"})}),e.jsx(j.Button,{variant:"ghost",size:"icon",onClick:s.resetFilters,title:"Réinitialiser",children:e.jsx(h.RotateCcw,{className:"h-4 w-4"})})]})]}),e.jsx(j.Separator,{}),e.jsx(oc,{group:t.currentFilter,actions:s,columns:a,getOperatorsForColumn:n,depth:0,maxNestingDepth:o,isRoot:!0}),e.jsx(j.Separator,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-2",children:l?e.jsxs(e.Fragment,{children:[e.jsx(j.Input,{value:i,onChange:g=>c(g.target.value),placeholder:"Nom du preset...",className:"w-40 h-8",onKeyDown:g=>{g.key==="Enter"&&f(),g.key==="Escape"&&u(!1)}}),e.jsxs(j.Button,{size:"sm",onClick:f,children:[e.jsx(h.Save,{className:"h-3 w-3 mr-1"}),"Sauvegarder"]}),e.jsx(j.Button,{size:"sm",variant:"ghost",onClick:()=>u(!1),children:"Annuler"})]}):e.jsxs(j.Button,{size:"sm",variant:"outline",onClick:()=>u(!0),children:[e.jsx(h.Save,{className:"h-3 w-3 mr-1"}),"Sauvegarder comme preset"]})}),e.jsx(j.Button,{size:"sm",onClick:s.applyFilters,children:"Appliquer"})]})]})}function oc({group:t,actions:s,columns:a,getOperatorsForColumn:n,depth:r,maxNestingDepth:o,isRoot:i=!1}){const c=r<o;return e.jsxs("div",{className:b.cn("space-y-2",!i&&"pl-4 ml-2 border-l-2 border-muted"),children:[!i&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1 bg-muted rounded-md p-1",children:[e.jsx(j.Button,{variant:t.connector==="AND"?"default":"ghost",size:"sm",className:"h-6 px-2",onClick:()=>s.setGroupConnector(t.id,"AND"),children:"ET"}),e.jsx(j.Button,{variant:t.connector==="OR"?"default":"ghost",size:"sm",className:"h-6 px-2",onClick:()=>s.setGroupConnector(t.id,"OR"),children:"OU"})]}),e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-destructive",onClick:()=>s.removeGroup(t.id),children:e.jsx(h.Trash2,{className:"h-3 w-3"})})]}),t.rules.map(l=>e.jsx(Zg,{rule:l,actions:s,columns:a,getOperatorsForColumn:n},l.id)),t.groups.map(l=>e.jsx(oc,{group:l,actions:s,columns:a,getOperatorsForColumn:n,depth:r+1,maxNestingDepth:o},l.id)),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(j.Button,{variant:"outline",size:"sm",onClick:()=>s.addRule(t.id,{column:a[0]?.key||"",operator:"equals",value:""}),children:[e.jsx(h.Plus,{className:"h-3 w-3 mr-1"}),"Ajouter une règle"]}),c&&e.jsxs(j.Button,{variant:"outline",size:"sm",onClick:()=>s.addGroup(t.id,"AND"),children:[e.jsx(h.Plus,{className:"h-3 w-3 mr-1"}),"Ajouter un groupe"]})]})]})}function Zg({rule:t,actions:s,columns:a,getOperatorsForColumn:n}){const r=a.find(l=>l.key===t.column),o=n(t.column),i=!["isEmpty","isNotEmpty","isNull","isNotNull"].includes(t.operator),c=t.operator==="between";return e.jsxs("div",{className:"flex items-center gap-2 group",children:[e.jsx(h.GripVertical,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 cursor-grab"}),e.jsxs(Be,{value:t.column,onValueChange:l=>s.updateRule(t.id,{column:l}),children:[e.jsx(ze,{className:"w-40 h-8",children:e.jsx(We,{placeholder:"Colonne"})}),e.jsx(_e,{children:a.map(l=>e.jsx(ke,{value:l.key,children:l.label},l.key))})]}),e.jsxs(Be,{value:t.operator,onValueChange:l=>s.updateRule(t.id,{operator:l}),children:[e.jsx(ze,{className:"w-44 h-8",children:e.jsx(We,{placeholder:"Opérateur"})}),e.jsx(_e,{children:o.map(l=>e.jsx(ke,{value:l,children:sc[l]},l))})]}),i&&e.jsx(e.Fragment,{children:r?.type==="enum"&&r.enumOptions?t.operator==="in"||t.operator==="notIn"?e.jsxs(j.Popover,{children:[e.jsx(j.PopoverTrigger,{asChild:!0,children:e.jsx(j.Button,{variant:"outline",className:"w-40 h-8 justify-start",children:Array.isArray(t.value)&&t.value.length>0?`${t.value.length} sélectionné(s)`:"Sélectionner..."})}),e.jsx(j.PopoverContent,{className:"w-56 p-2",children:e.jsx("div",{className:"space-y-1 max-h-48 overflow-auto",children:r.enumOptions.map(l=>e.jsxs("label",{className:"flex items-center gap-2 p-1 hover:bg-muted rounded cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.value?.includes(l.value)||!1,onChange:u=>{const f=t.value||[],m=u.target.checked?[...f,l.value]:f.filter(p=>p!==l.value);s.updateRule(t.id,{value:m})},className:"rounded"}),e.jsx("span",{className:"text-sm",children:l.label})]},l.value))})})]}):e.jsxs(Be,{value:t.value,onValueChange:l=>s.updateRule(t.id,{value:l}),children:[e.jsx(ze,{className:"w-40 h-8",children:e.jsx(We,{placeholder:"Valeur"})}),e.jsx(_e,{children:r.enumOptions.map(l=>e.jsx(ke,{value:l.value,children:l.label},l.value))})]}):r?.type==="boolean"?e.jsxs(Be,{value:String(t.value),onValueChange:l=>s.updateRule(t.id,{value:l==="true"}),children:[e.jsx(ze,{className:"w-32 h-8",children:e.jsx(We,{placeholder:"Valeur"})}),e.jsxs(_e,{children:[e.jsx(ke,{value:"true",children:"Oui"}),e.jsx(ke,{value:"false",children:"Non"})]})]}):r?.type==="number"?e.jsxs(e.Fragment,{children:[e.jsx(j.Input,{type:"number",value:t.value,onChange:l=>s.updateRule(t.id,{value:l.target.valueAsNumber}),placeholder:"Valeur",className:"w-32 h-8"}),c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"et"}),e.jsx(j.Input,{type:"number",value:t.valueTo,onChange:l=>s.updateRule(t.id,{valueTo:l.target.valueAsNumber}),placeholder:"Valeur max",className:"w-32 h-8"})]})]}):r?.type==="date"||r?.type==="datetime"?e.jsxs(e.Fragment,{children:[e.jsx(j.Input,{type:r.type==="datetime"?"datetime-local":"date",value:t.value,onChange:l=>s.updateRule(t.id,{value:l.target.value}),className:"w-40 h-8"}),c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"et"}),e.jsx(j.Input,{type:r.type==="datetime"?"datetime-local":"date",value:t.valueTo,onChange:l=>s.updateRule(t.id,{valueTo:l.target.value}),className:"w-40 h-8"})]})]}):e.jsx(j.Input,{value:t.value,onChange:l=>s.updateRule(t.id,{value:l.target.value}),placeholder:"Valeur",className:"w-40 h-8"})}),e.jsx(_s,{checked:t.enabled!==!1,onCheckedChange:l=>s.updateRule(t.id,{enabled:l}),className:"h-4 w-7"}),e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-destructive opacity-0 group-hover:opacity-100",onClick:()=>s.removeRule(t.id),children:e.jsx(h.Trash2,{className:"h-3 w-3"})})]})}const eb={online:"En ligne",offline:"Hors ligne",syncing:"Synchronisation...",pending:"en attente",conflicts:"conflits",sync:"Synchroniser",lastSync:"Dernière sync"};function ic({state:t,onSync:s,showDetails:a=!0,className:n,variant:r="default",labels:o}){const i={...eb,...o},{isOnline:c,isSyncing:l,pendingChangesCount:u,conflicts:f,syncError:m,lastSyncTime:p,isAvailable:g}=t;return g?r==="badge"?e.jsx(na,{children:e.jsxs(ra,{children:[e.jsx(oa,{asChild:!0,children:e.jsxs(ye,{variant:c?"outline":"secondary",className:b.cn("gap-1",!c&&"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",n),children:[c?e.jsx(h.Cloud,{className:"h-3 w-3"}):e.jsx(h.CloudOff,{className:"h-3 w-3"}),u>0&&e.jsx("span",{className:"ml-1",children:u})]})}),e.jsxs(Os,{children:[e.jsx("p",{children:c?i.online:i.offline}),u>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[u," ",i.pending]})]})]})}):r==="compact"?e.jsxs("div",{className:b.cn("flex items-center gap-2",n),children:[e.jsx("div",{className:b.cn("flex items-center gap-1 text-sm",c?"text-green-600 dark:text-green-400":"text-yellow-600 dark:text-yellow-400"),children:c?e.jsx(h.Cloud,{className:"h-4 w-4"}):e.jsx(h.CloudOff,{className:"h-4 w-4"})}),u>0&&e.jsx(ye,{variant:"secondary",className:"h-5 px-1.5 text-xs",children:u}),f.length>0&&e.jsxs(ye,{variant:"destructive",className:"h-5 px-1.5 text-xs",children:[f.length,"!"]}),s&&u>0&&c&&e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:s,disabled:l,children:e.jsx(h.RefreshCw,{className:b.cn("h-3 w-3",l&&"animate-spin")})})]}):e.jsxs("div",{className:b.cn("flex items-center gap-3 rounded-lg border p-2 text-sm",c?"bg-green-50 dark:bg-green-950/20":"bg-yellow-50 dark:bg-yellow-950/20",n),children:[e.jsxs("div",{className:b.cn("flex items-center gap-1.5",c?"text-green-600 dark:text-green-400":"text-yellow-600 dark:text-yellow-400"),children:[l?e.jsx(h.RefreshCw,{className:"h-4 w-4 animate-spin"}):c?e.jsx(h.Cloud,{className:"h-4 w-4"}):e.jsx(h.CloudOff,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:l?i.syncing:c?i.online:i.offline})]}),a&&e.jsxs(e.Fragment,{children:[u>0&&e.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(h.Upload,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:[u," ",i.pending]})]}),f.length>0&&e.jsxs("div",{className:"flex items-center gap-1 text-destructive",children:[e.jsx(h.AlertCircle,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:[f.length," ",i.conflicts]})]}),p&&u===0&&e.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(h.Check,{className:"h-3.5 w-3.5 text-green-600"}),e.jsxs("span",{className:"text-xs",children:[i.lastSync,": ",tb(p)]})]}),m&&e.jsxs("div",{className:"flex items-center gap-1 text-destructive text-xs",children:[e.jsx(h.AlertCircle,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:m})]})]}),s&&u>0&&c&&e.jsxs(j.Button,{variant:"outline",size:"sm",className:"ml-auto h-7",onClick:s,disabled:l,children:[e.jsx(h.RefreshCw,{className:b.cn("mr-1.5 h-3.5 w-3.5",l&&"animate-spin")}),i.sync]})]}):null}function tb(t){const a=new Date().getTime()-t.getTime(),n=Math.floor(a/1e3),r=Math.floor(n/60),o=Math.floor(r/60),i=Math.floor(o/24);return n<60?"à l'instant":r<60?`il y a ${r} min`:o<24?`il y a ${o}h`:`il y a ${i}j`}ic.displayName="DataTableSyncStatus";const sb={title:"Résolution des conflits",description:"Des modifications ont été effectuées à la fois localement et sur le serveur. Choisissez quelle version conserver.",localVersion:"Version locale",serverVersion:"Version serveur",keepLocal:"Garder local",keepServer:"Garder serveur",merge:"Fusionner",resolve:"Résoudre",skip:"Ignorer",noConflicts:"Aucun conflit à résoudre",conflictType:{create:"Création",update:"Modification",delete:"Suppression"}};function lc({conflicts:t,onResolve:s,open:a=!1,onOpenChange:n,mode:r="dialog",labels:o,renderData:i,displayKeys:c,keyLabels:l}){const u={...sb,...o},[f,m]=d.useState(0),[p,g]=d.useState(!1),[C,y]=d.useState(!1),[N,v]=d.useState({}),x=t[f],w=t.length;d.useEffect(()=>{t.length===0?m(0):f>=t.length&&m(Math.max(0,t.length-1))},[t,f]),d.useEffect(()=>{y(!1),x&&v({...x.serverData||{},...x.localData||{}})},[x]);const k=async F=>{if(x){g(!0);try{await s(x.id,F,F==="merge"?N:void 0),f<w-1&&m(A=>A+1)}finally{g(!1)}}},D=()=>{f<w-1&&m(F=>F+1)},S=e.jsx(e.Fragment,{children:w===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center text-muted-foreground",children:[e.jsx(h.Check,{className:"h-12 w-12 text-green-500 mb-4"}),e.jsx("p",{children:u.noConflicts})]}):x?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(ye,{variant:"outline",className:"gap-1",children:[e.jsx(h.AlertTriangle,{className:"h-3 w-3"}),u.conflictType?.[x.type]||x.type]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[f+1," / ",w]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ID: ",e.jsx("code",{className:"bg-muted px-1 rounded",children:x.rowId})]}),C?e.jsx(ab,{localData:x.localData,serverData:x.serverData,mergedData:N,onChange:v,displayKeys:c,keyLabels:l}):e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(lo,{title:u.localVersion,data:x.localData,timestamp:x.localTimestamp,variant:"local",renderData:i,displayKeys:c,keyLabels:l}),e.jsx(lo,{title:u.serverVersion,data:x.serverData,timestamp:x.serverTimestamp,variant:"server",renderData:i,displayKeys:c,keyLabels:l})]}),e.jsx(j.Separator,{}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(j.Button,{variant:"ghost",size:"sm",onClick:D,children:u.skip}),e.jsx("div",{className:"flex items-center gap-2",children:C?e.jsxs(e.Fragment,{children:[e.jsxs(j.Button,{variant:"outline",size:"sm",onClick:()=>y(!1),children:[e.jsx(h.X,{className:"mr-1.5 h-3.5 w-3.5"}),"Annuler"]}),e.jsxs(j.Button,{size:"sm",onClick:()=>k("merge"),disabled:p,children:[e.jsx(h.Check,{className:"mr-1.5 h-3.5 w-3.5"}),"Appliquer fusion"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(j.Button,{variant:"outline",size:"sm",onClick:()=>k("local"),disabled:p,children:u.keepLocal}),e.jsxs(j.Button,{variant:"outline",size:"sm",onClick:()=>y(!0),children:[e.jsx(h.GitMerge,{className:"mr-1.5 h-3.5 w-3.5"}),u.merge]}),e.jsx(j.Button,{size:"sm",onClick:()=>k("server"),disabled:p,children:u.keepServer})]})})]})]}):null});return r==="sheet"?e.jsx(is,{open:a,onOpenChange:n,children:e.jsxs(Wt,{className:"sm:max-w-xl",children:[e.jsxs(ws,{children:[e.jsxs(Ns,{className:"flex items-center gap-2",children:[e.jsx(h.AlertTriangle,{className:"h-5 w-5 text-yellow-500"}),u.title]}),e.jsx(La,{children:u.description})]}),e.jsx("div",{className:"mt-6",children:S})]})}):e.jsx(ds,{open:a,onOpenChange:n,children:e.jsxs(Kt,{className:"max-w-2xl",children:[e.jsxs(Cs,{children:[e.jsxs(ks,{className:"flex items-center gap-2",children:[e.jsx(h.AlertTriangle,{className:"h-5 w-5 text-yellow-500"}),u.title]}),e.jsx(da,{children:u.description})]}),S]})})}function lo({title:t,data:s,timestamp:a,variant:n,renderData:r,displayKeys:o,keyLabels:i}){return e.jsxs("div",{className:b.cn("rounded-lg border p-3",n==="local"?"border-blue-200 bg-blue-50/50 dark:border-blue-800 dark:bg-blue-950/20":"border-green-200 bg-green-50/50 dark:border-green-800 dark:bg-green-950/20"),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"font-medium text-sm",children:t}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(a).toLocaleString()})]}),e.jsx(St,{className:"h-32",children:r?r(s,n):s?e.jsx("div",{className:"space-y-1 text-sm",children:(o||Object.keys(s)).map(c=>{const l=s[c];return l===void 0?null:e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs("span",{className:"text-muted-foreground",children:[i?.[c]||c,":"]}),e.jsx("span",{className:"font-mono truncate max-w-[150px]",children:pn(l)})]},c)})}):e.jsx("span",{className:"text-muted-foreground italic",children:"Aucune donnée"})})]})}function ab({localData:t,serverData:s,mergedData:a,onChange:n,displayKeys:r,keyLabels:o}){const i=r||[...new Set([...Object.keys(t||{}),...Object.keys(s||{})])],c=(l,u)=>{const f=u==="local"?t?.[l]:s?.[l];n({...a,[l]:f})};return e.jsxs("div",{className:"rounded-lg border p-4 bg-muted/30",children:[e.jsxs("div",{className:"text-sm font-medium mb-3 flex items-center gap-2",children:[e.jsx(h.GitMerge,{className:"h-4 w-4"}),"Choisissez les valeurs pour chaque champ"]}),e.jsx("div",{className:"space-y-3",children:i.map(l=>{const u=t?.[l],f=s?.[l],m=a?.[l],p=m===u&&u!==f,g=m===f&&u!==f;return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:o?.[l]||l}),e.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] gap-2 items-center",children:[e.jsx("button",{type:"button",onClick:()=>c(l,"local"),className:b.cn("p-2 rounded border text-left text-sm truncate",p?"border-blue-500 bg-blue-50 dark:bg-blue-950/50":"border-border hover:border-blue-300"),children:pn(u)}),e.jsx(h.ArrowRight,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("button",{type:"button",onClick:()=>c(l,"server"),className:b.cn("p-2 rounded border text-left text-sm truncate",g?"border-green-500 bg-green-50 dark:bg-green-950/50":"border-border hover:border-green-300"),children:pn(f)})]})]},l)})})]})}function pn(t){if(t===null)return"null";if(t===void 0)return"undefined";if(typeof t=="object")try{return JSON.stringify(t)}catch{return"[Object]"}return String(t)}lc.displayName="DataTableConflictResolver";const nb=["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#10b981","#14b8a6","#06b6d4","#0ea5e9","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#000000","#6b7280","#ffffff"];function cc(t,s,a){s/=100,a/=100;const n=s*Math.min(a,1-a),r=o=>{const i=(o+t/30)%12;return a-n*Math.max(Math.min(i-3,9-i,1),-1)};return[Math.round(r(0)*255),Math.round(r(8)*255),Math.round(r(4)*255)]}function Ks(t,s,a){t/=255,s/=255,a/=255;const n=Math.max(t,s,a),r=Math.min(t,s,a);let o=0,i=0;const c=(n+r)/2;if(n!==r){const l=n-r;switch(i=c>.5?l/(2-n-r):l/(n+r),n){case t:o=((s-a)/l+(s<a?6:0))*60;break;case s:o=((a-t)/l+2)*60;break;case a:o=((t-s)/l+4)*60;break}}return[Math.round(o),Math.round(i*100),Math.round(c*100)]}function rb(t){const s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return s?[parseInt(s[1],16),parseInt(s[2],16),parseInt(s[3],16)]:null}function co(t,s,a){return"#"+[t,s,a].map(n=>n.toString(16).padStart(2,"0")).join("")}function va(t){if(t.startsWith("#"))return rb(t);const s=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(s)return[parseInt(s[1]),parseInt(s[2]),parseInt(s[3])];const a=t.match(/hsl\((\d+),\s*(\d+)%?,\s*(\d+)%?\)/);return a?cc(parseInt(a[1]),parseInt(a[2]),parseInt(a[3])):null}function uo(t,s,a,n){switch(n){case"hex":return co(t,s,a);case"rgb":return`rgb(${t}, ${s}, ${a})`;case"hsl":{const[r,o,i]=Ks(t,s,a);return`hsl(${r}, ${o}%, ${i}%)`}default:return co(t,s,a)}}const nr=d.forwardRef(({value:t="#3b82f6",onChange:s,format:a="hex",showAlpha:n=!1,showPresets:r=!0,presets:o=nb,showEyeDropper:i=!0,disabled:c=!1,placeholder:l="Sélectionner une couleur",className:u,size:f="md"},m)=>{const[p,g]=d.useState(!1),[C,y]=d.useState(0),[N,v]=d.useState(100),[x,w]=d.useState(50),[k,D]=d.useState(t),S=d.useRef(null),F=d.useRef(null);d.useEffect(()=>{const H=va(t);if(H){const[X,z,L]=Ks(...H);y(X),v(z),w(L),D(t)}},[t]);const A=d.useCallback((H,X,z)=>{const[L,_,R]=cc(H,X,z),U=uo(L,_,R,a);D(U),s?.(U)},[a,s]),T=H=>{H.preventDefault();const X=S.current?.getBoundingClientRect();if(!X)return;const z=(R,U)=>{const $=Math.max(0,Math.min(100,(R-X.left)/X.width*100)),Z=Math.max(0,Math.min(100,100-(U-X.top)/X.height*100));v($),w(Z),A(C,$,Z)};z(H.clientX,H.clientY);const L=R=>z(R.clientX,R.clientY),_=()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",_)};document.addEventListener("mousemove",L),document.addEventListener("mouseup",_)},M=H=>{H.preventDefault();const X=F.current?.getBoundingClientRect();if(!X)return;const z=R=>{const U=Math.max(0,Math.min(360,(R-X.left)/X.width*360));y(U),A(U,N,x)};z(H.clientX);const L=R=>z(R.clientX),_=()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",_)};document.addEventListener("mousemove",L),document.addEventListener("mouseup",_)},I=async()=>{if("EyeDropper"in window)try{const X=await new window.EyeDropper().open(),z=va(X.sRGBHex);if(z){const[L,_,R]=Ks(...z);y(L),v(_),w(R),A(L,_,R)}}catch{}},E=H=>{const X=H.target.value;D(X);const z=va(X);if(z){const[L,_,R]=Ks(...z);y(L),v(_),w(R),s?.(uo(...z,a))}},P={sm:"h-7 w-7",md:"h-9 w-9",lg:"h-11 w-11"},G=i&&typeof window<"u"&&"EyeDropper"in window;return e.jsxs(j.Popover,{open:p,onOpenChange:g,children:[e.jsx(j.PopoverTrigger,{asChild:!0,children:e.jsx(j.Button,{ref:m,variant:"outline",disabled:c,className:b.cn("p-0.5 rounded-md border",P[f],u),title:l,children:e.jsx("div",{className:"w-full h-full rounded",style:{backgroundColor:t}})})}),e.jsx(j.PopoverContent,{className:"w-64 p-3",align:"start",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{ref:S,className:"relative w-full h-36 rounded cursor-crosshair",style:{background:`
|
|
195
86
|
linear-gradient(to top, #000, transparent),
|
|
196
87
|
linear-gradient(to right, #fff, transparent),
|
|
197
|
-
hsl(${
|
|
198
|
-
`},onMouseDown:C,children:e.jsx("div",{className:"absolute w-4 h-4 border-2 border-white rounded-full shadow -translate-x-1/2 -translate-y-1/2 pointer-events-none",style:{left:`${A}%`,top:`${100-h}%`,backgroundColor:`hsl(${y}, ${A}%, ${h}%)`}})}),e.jsx("div",{ref:$,className:"relative w-full h-3 rounded cursor-pointer",style:{background:"linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00)"},onMouseDown:T,children:e.jsx("div",{className:"absolute w-3 h-5 border-2 border-white rounded -translate-x-1/2 -top-1 shadow pointer-events-none",style:{left:`${y/360*100}%`,backgroundColor:`hsl(${y}, 100%, 50%)`}})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded border flex-shrink-0",style:{backgroundColor:t}}),e.jsx(me,{value:w,onChange:R,className:"h-8 text-sm font-mono",placeholder:r==="hex"?"#000000":r==="rgb"?"rgb(0,0,0)":"hsl(0,0%,0%)"}),U&&e.jsx(G,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:M,title:"Pipette",children:e.jsx(S.Pipette,{className:"h-4 w-4"})})]}),n&&i.length>0&&e.jsxs("div",{children:[e.jsx(ve,{className:"text-xs text-muted-foreground",children:"Couleurs prédéfinies"}),e.jsx("div",{className:"grid grid-cols-10 gap-1 mt-1",children:i.map(O=>e.jsx("button",{className:N("w-5 h-5 rounded border transition-transform hover:scale-110",t.toLowerCase()===O.toLowerCase()&&"ring-2 ring-primary ring-offset-1"),style:{backgroundColor:O},onClick:()=>{const W=Za(O);if(W){const[F,L,_]=ka(...W);j(F),x(L),b(_),D(F,L,_)}}},O))})]})]})})]})});Hs.displayName="WakaColorPicker";const Fl=m.forwardRef(({error:t,label:a,className:r,...s},n)=>e.jsxs("div",{className:N("space-y-1.5",r),children:[a&&e.jsx(ve,{htmlFor:s.name,children:a}),e.jsx(Hs,{ref:n,...s}),t&&e.jsx("p",{className:"text-sm text-destructive",children:t})]}));Fl.displayName="WakaColorPickerForm";function Jr(t){if(t===0)return"0 Bytes";const a=1024,r=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(t)/Math.log(a));return`${parseFloat((t/Math.pow(a,s)).toFixed(2))} ${r[s]}`}function Rx(t){const a=t.type;return a.startsWith("image/")?S.Image:a.includes("pdf")?S.FileText:a.includes("spreadsheet")||a.includes("excel")||a.includes("csv")?S.FileSpreadsheet:a.includes("zip")||a.includes("archive")||a.includes("compressed")?S.FileArchive:S.File}const Il=m.forwardRef(({variant:t="dropzone",accept:a,maxSize:r=10*1024*1024,maxFiles:s=5,multiple:n=!1,onUpload:i,onComplete:c,onRemove:l,onError:o,showPreview:d=!0,showProgress:u=!0,disabled:f=!1,className:p,placeholder:g="Glissez vos fichiers ici ou cliquez pour sélectionner",label:y,description:j},A)=>{const[x,h]=m.useState([]),[b,w]=m.useState(!1),E=m.useRef(null),v=()=>`${Date.now()}-${Math.random().toString(36).slice(2,11)}`,$=F=>r&&F.size>r?`Le fichier dépasse la taille maximale de ${Jr(r)}`:a&&!a.split(",").map(P=>P.trim()).some(P=>P.startsWith(".")?F.name.toLowerCase().endsWith(P.toLowerCase()):P.endsWith("/*")?F.type.startsWith(P.replace("/*","/")):F.type===P)?`Type de fichier non accepté. Types acceptés: ${a}`:null,D=async F=>{const L=Array.from(F),_=x.filter(q=>q.status!=="error").length,P=s-_,V=L.slice(0,P);L.length>P&&o?.(`Nombre maximum de fichiers atteint (${s})`);const z=V.map(q=>({id:v(),file:q,progress:0,status:"pending"})),X=[];for(const q of z){const B=$(q.file);B&&(q.status="error",q.error=B,o?.(B,q.file)),X.push(q)}if(h(q=>[...q,...X]),i)for(const q of X.filter(B=>B.status==="pending"))try{h(J=>J.map(Q=>Q.id===q.id?{...Q,status:"uploading"}:Q));const B=await i(q.file,J=>{h(Q=>Q.map(te=>te.id===q.id?{...te,progress:J}:te))});h(J=>J.map(Q=>Q.id===q.id?{...Q,status:"success",progress:100,url:B}:Q))}catch(B){const J=B instanceof Error?B.message:"Erreur d'upload";h(Q=>Q.map(te=>te.id===q.id?{...te,status:"error",error:J}:te)),o?.(J,q.file)}else h(q=>q.map(B=>X.some(J=>J.id===B.id)&&B.status==="pending"?{...B,status:"success",progress:100}:B))};m.useEffect(()=>{x.length>0&&x.every(L=>L.status!=="pending"&&L.status!=="uploading")&&c?.(x)},[x,c]);const C=F=>{if(F.preventDefault(),w(!1),f)return;const L=F.dataTransfer.files;L.length>0&&D(n?L:[L[0]])},T=F=>{const L=F.target.files;L&&L.length>0&&D(n?L:[L[0]]),F.target.value=""},M=F=>{h(L=>L.filter(_=>_.id!==F.id)),l?.(F)},R=()=>{f||E.current?.click()},I=()=>e.jsx("div",{className:N("relative border-2 border-dashed rounded-lg p-6 transition-colors",b&&"border-primary bg-primary/5",f&&"opacity-50 cursor-not-allowed",!f&&"cursor-pointer hover:border-primary/50",p),onDragOver:F=>{F.preventDefault(),f||w(!0)},onDragLeave:()=>w(!1),onDrop:C,onClick:R,children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[e.jsx(S.Upload,{className:N("h-10 w-10 mb-3",b?"text-primary":"text-muted-foreground")}),e.jsx("p",{className:"text-sm font-medium",children:g}),j&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:j}),r&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Taille max: ",Jr(r)]})]})}),U=()=>e.jsxs(G,{variant:"outline",disabled:f,onClick:R,className:p,children:[e.jsx(S.Upload,{className:"h-4 w-4 mr-2"}),g||"Sélectionner un fichier"]}),O=()=>e.jsxs("div",{className:N("flex items-center gap-2 p-2 border rounded-lg",f&&"opacity-50 cursor-not-allowed",!f&&"cursor-pointer hover:bg-muted/50",p),onClick:R,children:[e.jsx(S.Upload,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:g||"Ajouter un fichier"})]}),W=F=>{const L=Rx(F.file),_=F.file.type.startsWith("image/");return e.jsxs("div",{className:N("flex items-center gap-3 p-2 rounded-lg border",F.status==="error"&&"border-destructive bg-destructive/5"),children:[e.jsx("div",{className:"w-10 h-10 rounded flex items-center justify-center bg-muted overflow-hidden flex-shrink-0",children:d&&_&&F.status!=="error"?e.jsx("img",{src:URL.createObjectURL(F.file),alt:F.file.name,className:"w-full h-full object-cover"}):e.jsx(L,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:F.file.name}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:Jr(F.file.size)}),F.status==="error"&&e.jsxs("span",{className:"text-destructive flex items-center gap-1",children:[e.jsx(S.AlertCircle,{className:"h-3 w-3"}),F.error]}),F.status==="success"&&e.jsxs("span",{className:"text-green-600 flex items-center gap-1",children:[e.jsx(S.Check,{className:"h-3 w-3"}),"Uploadé"]})]}),u&&F.status==="uploading"&&e.jsx(Va,{value:F.progress,className:"h-1 mt-1"})]}),e.jsx(G,{variant:"ghost",size:"icon",className:"h-8 w-8 flex-shrink-0",onClick:P=>{P.stopPropagation(),M(F)},children:e.jsx(S.X,{className:"h-4 w-4"})})]},F.id)};return e.jsxs("div",{ref:A,className:"space-y-3",children:[y&&e.jsx(ve,{children:y}),e.jsx("input",{ref:E,type:"file",accept:a,multiple:n,onChange:T,className:"sr-only",disabled:f}),t==="dropzone"&&I(),t==="button"&&U(),t==="inline"&&O(),x.length>0&&e.jsx("div",{className:"space-y-2",children:x.map(W)})]})});Il.displayName="WakaFileUpload";const qs=m.forwardRef(({options:t,value:a,onChange:r,onSearch:s,multiple:n=!1,creatable:i=!1,onCreate:c,placeholder:l="Sélectionner...",emptyMessage:o="Aucun résultat.",loading:d=!1,disabled:u=!1,error:f,className:p,label:g,description:y,maxSelections:j,sortOptions:A=!1,searchDebounce:x=300},h)=>{const[b,w]=m.useState(!1),[E,v]=m.useState(""),[$,D]=m.useState(t),[C,T]=m.useState(!1),M=m.useRef();m.useEffect(()=>{s||D(t)},[t,s]);const R=m.useMemo(()=>a?Array.isArray(a)?a:[a]:[],[a]);m.useEffect(()=>{if(s){if(M.current&&clearTimeout(M.current),!E.trim()){D(t);return}return M.current=setTimeout(async()=>{T(!0);try{const V=await s(E);D(V)}catch{D([])}finally{T(!1)}},x),()=>{M.current&&clearTimeout(M.current)}}},[E,s,x,t]);const I=m.useMemo(()=>{let V=$;if(!s&&E.trim()){const z=E.toLowerCase();V=$.filter(X=>X.label.toLowerCase().includes(z)||X.value.toLowerCase().includes(z))}return A&&(V=[...V].sort((z,X)=>z.label.localeCompare(X.label))),V},[$,E,s,A]),U=m.useMemo(()=>{const V={_ungrouped:[]};for(const z of I){const X=z.group||"_ungrouped";V[X]||(V[X]=[]),V[X].push(z)}return V},[I]),O=i&&E.trim()&&!$.some(V=>V.value.toLowerCase()===E.toLowerCase()),W=V=>{if(n){const z=R.includes(V)?R.filter(X=>X!==V):j&&R.length>=j?R:[...R,V];r?.(z.length>0?z:null)}else r?.(V===a?null:V),w(!1);v("")},F=()=>{if(!E.trim())return;const V={value:E.trim(),label:E.trim()};D(z=>[...z,V]),W(V.value),c?.(V.value)},L=(V,z)=>{z.stopPropagation();const X=R.filter(q=>q!==V);r?.(X.length>0?X:null)},_=V=>$.find(X=>X.value===V)?.label||V,P=C||d;return e.jsxs("div",{className:N("space-y-1.5",p),children:[g&&e.jsx(ve,{children:g}),y&&e.jsx("p",{className:"text-sm text-muted-foreground",children:y}),e.jsxs(lt,{open:b,onOpenChange:w,children:[e.jsx(ct,{asChild:!0,children:e.jsxs(G,{ref:h,variant:"outline",role:"combobox","aria-expanded":b,disabled:u,className:N("w-full justify-between font-normal",!a&&"text-muted-foreground",f&&"border-destructive"),children:[n?e.jsx("div",{className:"flex flex-wrap gap-1 flex-1 min-w-0",children:R.length>0?R.map(V=>e.jsxs(Pe,{variant:"secondary",className:"text-xs",children:[_(V),e.jsx("button",{className:"ml-1 hover:text-destructive",onClick:z=>L(V,z),children:e.jsx(S.X,{className:"h-3 w-3"})})]},V)):e.jsx("span",{children:l})}):e.jsx("span",{className:"truncate",children:a?_(a):l}),P?e.jsx(S.Loader2,{className:"ml-2 h-4 w-4 shrink-0 animate-spin"}):e.jsx(S.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ye,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(Kt,{shouldFilter:!1,children:[e.jsx(ca,{placeholder:"Rechercher...",value:E,onValueChange:v}),e.jsxs(Er,{children:[P&&e.jsxs("div",{className:"py-6 text-center text-sm",children:[e.jsx(S.Loader2,{className:"h-4 w-4 animate-spin mx-auto mb-2"}),"Chargement..."]}),!P&&I.length===0&&!O&&e.jsx(da,{children:o}),O&&e.jsx(Yt,{children:e.jsxs(Jt,{onSelect:F,className:"cursor-pointer",children:[e.jsx(S.Plus,{className:"mr-2 h-4 w-4"}),'Créer "',E,'"']})}),Object.entries(U).map(([V,z])=>z.length===0?null:e.jsx(Yt,{heading:V!=="_ungrouped"?V:void 0,children:z.map(X=>e.jsxs(Jt,{value:X.value,onSelect:()=>W(X.value),disabled:X.disabled,className:"cursor-pointer",children:[e.jsx(S.Check,{className:N("mr-2 h-4 w-4",R.includes(X.value)?"opacity-100":"opacity-0")}),X.label]},X.value))},V))]})]})})]}),f&&e.jsx("p",{className:"text-sm text-destructive",children:f})]})});qs.displayName="WakaAutocomplete";const Ll=m.forwardRef((t,a)=>e.jsx(qs,{ref:a,...t}));Ll.displayName="WakaAutocompleteForm";const Px=[["bold","italic","underline","strike"],["h1","h2","h3"],["bulletList","orderedList","blockquote"],["link","code"],["undo","redo"]],$l=m.forwardRef(({value:t="",onChange:a,toolbar:r=Px,placeholder:s="Écrivez ici...",maxLength:n,showCharacterCount:i=!1,minHeight:c=200,disabled:l=!1,error:o,className:d,label:u,description:f,editable:p=!0},g)=>{const[y,j]=m.useState(null),[A,x]=m.useState(null),[h,b]=m.useState(null),[w,E]=m.useState("");return m.useEffect(()=>{(async()=>{try{const[{useEditor:$,EditorContent:D},{default:C},{default:T},{default:M},{default:R}]=await Promise.all([import("@tiptap/react"),import("@tiptap/starter-kit"),import("@tiptap/extension-underline"),import("@tiptap/extension-link"),import("@tiptap/extension-text-align")]);x({useEditor:$,EditorContent:D,StarterKit:C,Underline:T,Link:M,TextAlign:R}),j(!0)}catch{j(!1)}})()},[]),y&&A?e.jsx(Ol,{ref:g,components:A,value:t,onChange:a,toolbar:r,placeholder:s,maxLength:n,showCharacterCount:i,minHeight:c,disabled:l,error:o,className:d,label:u,description:f,editable:p,linkUrl:w,setLinkUrl:E,editor:h,setEditor:b}):e.jsx(_l,{ref:g,value:t,onChange:a,placeholder:s,maxLength:n,showCharacterCount:i,minHeight:c,disabled:l,error:o,className:d,label:u,description:f,loading:y===null})});$l.displayName="WakaRichTextEditor";const Ol=m.forwardRef(({components:t,value:a,onChange:r,toolbar:s,placeholder:n,maxLength:i,showCharacterCount:c,minHeight:l,disabled:o,error:d,className:u,label:f,description:p,editable:g,linkUrl:y,setLinkUrl:j,setEditor:A},x)=>{const{useEditor:h,EditorContent:b,StarterKit:w,Underline:E,Link:v,TextAlign:$}=t,D=h({extensions:[w.configure({heading:{levels:[1,2,3]}}),E,v.configure({openOnClick:!1}),$.configure({types:["heading","paragraph"]})],content:a,editable:g&&!o,onUpdate:({editor:M})=>{const R=M.getHTML();(!i||R.length<=i)&&r?.(R)}});m.useEffect(()=>{A(D)},[D,A]),m.useEffect(()=>{D&&a!==D.getHTML()&&D.commands?.setContent?.(a||"",!1)},[a,D]);const C=()=>{D&&(y?D.chain().focus().setLink({href:y}).run():D.chain().focus().unsetLink().run(),j(""))},T=D?.storage?.characterCount?.characters?.()??a?.replace(/<[^>]*>/g,"").length??0;return e.jsxs("div",{ref:x,className:N("space-y-1.5",u),children:[f&&e.jsx(ve,{children:f}),p&&e.jsx("p",{className:"text-sm text-muted-foreground",children:p}),e.jsxs("div",{className:N("border rounded-lg overflow-hidden",d&&"border-destructive"),children:[D&&s&&e.jsx("div",{className:"flex flex-wrap items-center gap-0.5 p-1 border-b bg-muted/30",children:s.map((M,R)=>e.jsxs(m.Fragment,{children:[R>0&&e.jsx(pt,{orientation:"vertical",className:"mx-1 h-6"}),M.map(I=>e.jsx(Mx,{button:I,editor:D,linkUrl:y,setLinkUrl:j,handleSetLink:C},I))]},R))}),e.jsx("div",{style:{minHeight:l},children:e.jsx(b,{editor:D,className:N("prose prose-sm max-w-none p-3 focus-within:outline-none h-full","[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[inherit]")})}),c&&e.jsxs("div",{className:"flex justify-end p-1.5 border-t bg-muted/30 text-xs text-muted-foreground",children:[T,i&&` / ${i}`," caractères"]})]}),d&&e.jsx("p",{className:"text-sm text-destructive",children:d})]})});Ol.displayName="TiptapEditorComponent";function Mx({button:t,editor:a,linkUrl:r,setLinkUrl:s,handleSetLink:n}){const i={bold:{icon:e.jsx(S.Bold,{className:"h-4 w-4"}),action:()=>a.chain().focus().toggleBold().run(),isActive:()=>a.isActive("bold")},italic:{icon:e.jsx(S.Italic,{className:"h-4 w-4"}),action:()=>a.chain().focus().toggleItalic().run(),isActive:()=>a.isActive("italic")},underline:{icon:e.jsx(S.Underline,{className:"h-4 w-4"}),action:()=>a.chain().focus().toggleUnderline().run(),isActive:()=>a.isActive("underline")},strike:{icon:e.jsx(S.Strikethrough,{className:"h-4 w-4"}),action:()=>a.chain().focus().toggleStrike().run(),isActive:()=>a.isActive("strike")},h1:{icon:e.jsx(S.Heading1,{className:"h-4 w-4"}),action:()=>a.chain().focus().toggleHeading({level:1}).run(),isActive:()=>a.isActive("heading",{level:1})},h2:{icon:e.jsx(S.Heading2,{className:"h-4 w-4"}),action:()=>a.chain().focus().toggleHeading({level:2}).run(),isActive:()=>a.isActive("heading",{level:2})},h3:{icon:e.jsx(S.Heading3,{className:"h-4 w-4"}),action:()=>a.chain().focus().toggleHeading({level:3}).run(),isActive:()=>a.isActive("heading",{level:3})},bulletList:{icon:e.jsx(S.List,{className:"h-4 w-4"}),action:()=>a.chain().focus().toggleBulletList().run(),isActive:()=>a.isActive("bulletList")},orderedList:{icon:e.jsx(S.ListOrdered,{className:"h-4 w-4"}),action:()=>a.chain().focus().toggleOrderedList().run(),isActive:()=>a.isActive("orderedList")},blockquote:{icon:e.jsx(S.Quote,{className:"h-4 w-4"}),action:()=>a.chain().focus().toggleBlockquote().run(),isActive:()=>a.isActive("blockquote")},code:{icon:e.jsx(S.Code,{className:"h-4 w-4"}),action:()=>a.chain().focus().toggleCodeBlock().run(),isActive:()=>a.isActive("codeBlock")},link:{icon:e.jsx(S.Link,{className:"h-4 w-4"}),action:()=>{},isActive:()=>a.isActive("link")},alignLeft:{icon:e.jsx(S.AlignLeft,{className:"h-4 w-4"}),action:()=>a.chain().focus().setTextAlign("left").run(),isActive:()=>a.isActive({textAlign:"left"})},alignCenter:{icon:e.jsx(S.AlignCenter,{className:"h-4 w-4"}),action:()=>a.chain().focus().setTextAlign("center").run(),isActive:()=>a.isActive({textAlign:"center"})},alignRight:{icon:e.jsx(S.AlignRight,{className:"h-4 w-4"}),action:()=>a.chain().focus().setTextAlign("right").run(),isActive:()=>a.isActive({textAlign:"right"})},undo:{icon:e.jsx(S.Undo,{className:"h-4 w-4"}),action:()=>a.chain().focus().undo().run()},redo:{icon:e.jsx(S.Redo,{className:"h-4 w-4"}),action:()=>a.chain().focus().redo().run()}},{icon:c,action:l,isActive:o}=i[t];return t==="link"?e.jsxs(lt,{children:[e.jsx(ct,{asChild:!0,children:e.jsx(G,{type:"button",variant:o?.()?"secondary":"ghost",size:"icon",className:"h-7 w-7",children:c})}),e.jsx(Ye,{className:"w-64 p-2",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(me,{value:r,onChange:d=>s(d.target.value),placeholder:"https://...",className:"h-8"}),e.jsx(G,{size:"sm",onClick:n,children:"OK"})]})})]}):e.jsx(G,{type:"button",variant:o?.()?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:l,children:c})}const _l=m.forwardRef(({value:t,onChange:a,placeholder:r,maxLength:s,showCharacterCount:n,minHeight:i,disabled:c,error:l,className:o,label:d,description:u,loading:f},p)=>e.jsxs("div",{ref:p,className:N("space-y-1.5",o),children:[d&&e.jsx(ve,{children:d}),u&&e.jsx("p",{className:"text-sm text-muted-foreground",children:u}),e.jsxs("div",{className:"relative",children:[e.jsx(fa,{value:t,onChange:g=>a?.(g.target.value),placeholder:r,maxLength:s,disabled:c||f,style:{minHeight:i},className:N(l&&"border-destructive")}),f&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/50",children:e.jsx("span",{className:"text-sm text-muted-foreground",children:"Chargement..."})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[l&&e.jsx("p",{className:"text-sm text-destructive",children:l}),n&&e.jsxs("p",{className:"text-xs text-muted-foreground ml-auto",children:[t?.length||0,s&&` / ${s}`," caractères"]})]})]}));_l.displayName="FallbackEditor";function Bs(){const[t,a]=k.useState(null),[r,s]=k.useState(!0),[n,i]=k.useState(null);return k.useEffect(()=>{let c=!0;return(async()=>{try{const o=await import("recharts");c&&(a({ResponsiveContainer:o.ResponsiveContainer,BarChart:o.BarChart,LineChart:o.LineChart,AreaChart:o.AreaChart,PieChart:o.PieChart,Bar:o.Bar,Line:o.Line,Area:o.Area,Pie:o.Pie,Cell:o.Cell,XAxis:o.XAxis,YAxis:o.YAxis,CartesianGrid:o.CartesianGrid,Tooltip:o.Tooltip,Legend:o.Legend,defs:"defs",linearGradient:"linearGradient",stop:"stop"}),s(!1))}catch(o){c&&(i(o instanceof Error?o:new Error("Failed to load Recharts")),s(!1))}})(),()=>{c=!1}},[]),{components:t,loading:r,error:n,isAvailable:!r&&!n&&t!==null}}const Fx=["hsl(var(--chart-1, 220 70% 50%))","hsl(var(--chart-2, 160 60% 45%))","hsl(var(--chart-3, 30 80% 55%))","hsl(var(--chart-4, 280 65% 60%))","hsl(var(--chart-5, 340 75% 55%))"],Ft={colors:Fx,gridColor:"hsl(var(--border, 220 13% 91%))",axisColor:"hsl(var(--muted-foreground, 220 9% 46%))",textColor:"hsl(var(--foreground, 224 71% 4%))",tooltipBackground:"hsl(var(--popover, 0 0% 100%))",tooltipText:"hsl(var(--popover-foreground, 224 71% 4%))",tooltipBorder:"hsl(var(--border, 220 13% 91%))",fontFamily:"inherit"};function ha(t,a="default"){const r=k.useMemo(()=>({colors:t?.colors??Ft.colors,gridColor:t?.gridColor??Ft.gridColor,axisColor:t?.axisColor??Ft.axisColor,textColor:t?.textColor??Ft.textColor,tooltipBackground:t?.tooltipBackground??Ft.tooltipBackground,tooltipText:t?.tooltipText??Ft.tooltipText,tooltipBorder:t?.tooltipBorder??Ft.tooltipBorder,fontFamily:t?.fontFamily??Ft.fontFamily}),[t]),s=k.useMemo(()=>c=>r.colors[c%r.colors.length],[r.colors]),n=k.useMemo(()=>({contentStyle:{backgroundColor:r.tooltipBackground,color:r.tooltipText,border:`1px solid ${r.tooltipBorder}`,borderRadius:"var(--radius, 0.5rem)",padding:"8px 12px",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",fontFamily:r.fontFamily},wrapperStyle:{outline:"none"},itemStyle:{color:r.tooltipText,padding:"2px 0"},labelStyle:{color:r.textColor,fontWeight:600,marginBottom:"4px"}}),[r]),i=k.useMemo(()=>{const c="relative";switch(a){case"gradient":return`${c} bg-gradient-to-br from-background to-muted/20`;case"outline":return`${c} border border-border rounded-lg p-4`;case"glass":return`${c} bg-background/50 backdrop-blur-sm border border-border/50 rounded-lg p-4`;default:return c}},[a]);return{theme:r,getColor:s,tooltipStyles:n,containerClasses:i}}const Ix={sm:{width:"100%",height:150},md:{width:"100%",height:250},lg:{width:"100%",height:350},xl:{width:"100%",height:450},auto:{width:"100%",height:300}},pa=m.forwardRef(({children:t,variant:a="default",size:r="md",height:s,width:n,theme:i,className:c,style:l,title:o,description:d,loading:u,error:f,responsive:p=!0},g)=>{const{components:y,loading:j,error:A,isAvailable:x}=Bs(),{containerClasses:h}=ha(i,a),b=u||j,w=f||(A?"Recharts non disponible. Installez recharts pour utiliser les graphiques.":null),E=Ix[r],v=n??E.width,$=s??E.height;if(b)return e.jsxs("div",{ref:g,className:N(h,c),style:l,children:[o&&e.jsx(Qr,{title:o,description:d}),e.jsx(ui,{className:"w-full",style:{height:$}})]});if(w||!x)return e.jsxs("div",{ref:g,className:N(h,c),style:l,children:[o&&e.jsx(Qr,{title:o,description:d}),e.jsx("div",{className:"flex items-center justify-center text-muted-foreground text-sm border border-dashed border-border rounded-lg",style:{height:$},children:e.jsxs("div",{className:"text-center p-4",children:[e.jsx("p",{children:w||"Graphique non disponible"}),e.jsx("p",{className:"text-xs mt-1",children:"Installez recharts: pnpm add recharts"})]})})]});const{ResponsiveContainer:D}=y;return e.jsxs("div",{ref:g,className:N(h,c),style:l,children:[o&&e.jsx(Qr,{title:o,description:d}),p?e.jsx(D,{width:v,height:$,children:t(y)}):e.jsx("div",{style:{width:v,height:$},children:t(y)})]})});pa.displayName="WakaChart";function Qr({title:t,description:a}){return e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:t}),a&&e.jsx("p",{className:"text-sm text-muted-foreground",children:a})]})}const zl=m.forwardRef(({data:t,dataKeys:a,series:r,variant:s="default",size:n="md",height:i,width:c,animation:l=!0,animationDuration:o=500,grid:d=!0,tooltip:u=!0,legend:f,axis:p,theme:g,className:y,style:j,title:A,description:x,loading:h,error:b,onClick:w,responsive:E=!0,layout:v="vertical",stacked:$=!1,radius:D=4,barSize:C,barGap:T=4,barCategoryGap:M="20%"},R)=>{const{theme:I,getColor:U,tooltipStyles:O}=ha(g,s),W=m.useMemo(()=>{if(r&&r.length>0)return r;if(a&&a.length>0)return a.map((P,V)=>({dataKey:P,label:P,color:U(V)}));if(t.length>0&&"value"in t[0])return[{dataKey:"value",label:"Value",color:U(0)}];const _=t[0];return _?Object.keys(_).filter(P=>P!=="name"&&typeof _[P]=="number").map((P,V)=>({dataKey:P,label:P,color:U(V)})):[]},[r,a,t,U]),F=m.useMemo(()=>f?typeof f=="boolean"?{enabled:f,position:"bottom",align:"center"}:f:null,[f]),L=m.useMemo(()=>u?typeof u=="boolean"?{enabled:u}:u:null,[u]);return e.jsx(pa,{ref:R,variant:s,size:n,height:i,width:c,theme:g,className:y,style:j,title:A,description:x,loading:h,error:b,responsive:E,children:_=>{if(!_)return null;const{BarChart:P,Bar:V,XAxis:z,YAxis:X,CartesianGrid:q,Tooltip:B,Legend:J}=_;return e.jsxs(P,{data:t,layout:v==="horizontal"?"vertical":"horizontal",barGap:T,barCategoryGap:M,children:[d&&e.jsx(q,{strokeDasharray:"3 3",stroke:I.gridColor,horizontal:!0,vertical:!1}),p?.showXAxis!==!1&&e.jsx(z,{dataKey:"name",axisLine:{stroke:I.axisColor},tickLine:{stroke:I.axisColor},tick:{fill:I.textColor,fontSize:12},tickFormatter:p?.xAxisFormatter}),p?.showYAxis!==!1&&e.jsx(X,{axisLine:{stroke:I.axisColor},tickLine:{stroke:I.axisColor},tick:{fill:I.textColor,fontSize:12},tickFormatter:p?.yAxisFormatter,domain:p?.yAxisDomain,unit:p?.yAxisUnit}),L?.enabled!==!1&&u&&e.jsx(B,{...O,formatter:L&&typeof L!="boolean"&&L.formatter?(Q,te)=>L.formatter(Q,te,t[0]):Q=>{const te=L&&typeof L!="boolean"&&L.valuePrefix||"",ee=L&&typeof L!="boolean"&&L.valueSuffix||"";return`${te}${Q}${ee}`}}),F?.enabled&&e.jsx(J,{align:F.align,verticalAlign:F.position==="top"?"top":"bottom",wrapperStyle:{paddingTop:F.position==="bottom"?16:0}}),W.map((Q,te)=>e.jsx(V,{dataKey:Q.dataKey,name:Q.label,fill:Q.color||U(te),radius:D,stackId:$?"stack":void 0,barSize:C,animationDuration:o,isAnimationActive:l},Q.dataKey))]})}})});zl.displayName="WakaBarChart";const Vl=m.forwardRef(({data:t,dataKeys:a,series:r,variant:s="default",size:n="md",height:i,width:c,animation:l=!0,animationDuration:o=500,grid:d=!0,tooltip:u=!0,legend:f,axis:p,theme:g,className:y,style:j,title:A,description:x,loading:h,error:b,onClick:w,responsive:E=!0,curve:v="monotone",dots:$=!0,dotSize:D=4,activeDot:C=!0,strokeWidth:T=2},M)=>{const{theme:R,getColor:I,tooltipStyles:U}=ha(g,s),O=m.useMemo(()=>{if(r&&r.length>0)return r;if(a&&a.length>0)return a.map((_,P)=>({dataKey:_,label:_,color:I(P),strokeWidth:T}));if(t.length>0&&"value"in t[0])return[{dataKey:"value",label:"Value",color:I(0),strokeWidth:T}];const L=t[0];return L?Object.keys(L).filter(_=>_!=="name"&&typeof L[_]=="number").map((_,P)=>({dataKey:_,label:_,color:I(P),strokeWidth:T})):[]},[r,a,t,I,T]),W=m.useMemo(()=>f?typeof f=="boolean"?{enabled:f,position:"bottom",align:"center"}:f:null,[f]),F=m.useMemo(()=>u?typeof u=="boolean"?{enabled:u}:u:null,[u]);return e.jsx(pa,{ref:M,variant:s,size:n,height:i,width:c,theme:g,className:y,style:j,title:A,description:x,loading:h,error:b,responsive:E,children:L=>{if(!L)return null;const{LineChart:_,Line:P,XAxis:V,YAxis:z,CartesianGrid:X,Tooltip:q,Legend:B}=L;return e.jsxs(_,{data:t,children:[d&&e.jsx(X,{strokeDasharray:"3 3",stroke:R.gridColor,horizontal:!0,vertical:!1}),p?.showXAxis!==!1&&e.jsx(V,{dataKey:"name",axisLine:{stroke:R.axisColor},tickLine:{stroke:R.axisColor},tick:{fill:R.textColor,fontSize:12},tickFormatter:p?.xAxisFormatter}),p?.showYAxis!==!1&&e.jsx(z,{axisLine:{stroke:R.axisColor},tickLine:{stroke:R.axisColor},tick:{fill:R.textColor,fontSize:12},tickFormatter:p?.yAxisFormatter,domain:p?.yAxisDomain,unit:p?.yAxisUnit}),F?.enabled!==!1&&u&&e.jsx(q,{...U,formatter:F&&typeof F!="boolean"&&F.formatter?(J,Q)=>F.formatter(J,Q,t[0]):J=>{const Q=F&&typeof F!="boolean"&&F.valuePrefix||"",te=F&&typeof F!="boolean"&&F.valueSuffix||"";return`${Q}${J}${te}`}}),W?.enabled&&e.jsx(B,{align:W.align,verticalAlign:W.position==="top"?"top":"bottom",wrapperStyle:{paddingTop:W.position==="bottom"?16:0}}),O.map((J,Q)=>e.jsx(P,{dataKey:J.dataKey,name:J.label,stroke:J.color||I(Q),strokeWidth:J.strokeWidth||T,strokeDasharray:J.strokeDasharray,type:v,dot:$?{r:D,fill:J.color||I(Q)}:!1,activeDot:C?{r:D+2}:!1,animationDuration:o,isAnimationActive:l},J.dataKey))]})}})});Vl.displayName="WakaLineChart";const Wl=m.forwardRef(({data:t,dataKeys:a,series:r,variant:s="default",size:n="md",height:i,width:c,animation:l=!0,animationDuration:o=500,grid:d=!0,tooltip:u=!0,legend:f,axis:p,theme:g,className:y,style:j,title:A,description:x,loading:h,error:b,onClick:w,responsive:E=!0,curve:v="monotone",dots:$=!1,dotSize:D=4,activeDot:C=!0,strokeWidth:T=2,stacked:M=!1,fillOpacity:R=.3,gradientDirection:I="vertical"},U)=>{const{theme:O,getColor:W,tooltipStyles:F}=ha(g,s),L=m.useMemo(()=>{if(r&&r.length>0)return r;if(a&&a.length>0)return a.map((z,X)=>({dataKey:z,label:z,color:W(X),strokeWidth:T,fillOpacity:R}));if(t.length>0&&"value"in t[0])return[{dataKey:"value",label:"Value",color:W(0),strokeWidth:T,fillOpacity:R}];const V=t[0];return V?Object.keys(V).filter(z=>z!=="name"&&typeof V[z]=="number").map((z,X)=>({dataKey:z,label:z,color:W(X),strokeWidth:T,fillOpacity:R})):[]},[r,a,t,W,T,R]),_=m.useMemo(()=>f?typeof f=="boolean"?{enabled:f,position:"bottom",align:"center"}:f:null,[f]),P=m.useMemo(()=>u?typeof u=="boolean"?{enabled:u}:u:null,[u]);return e.jsx(pa,{ref:U,variant:s,size:n,height:i,width:c,theme:g,className:y,style:j,title:A,description:x,loading:h,error:b,responsive:E,children:V=>{if(!V)return null;const{AreaChart:z,Area:X,XAxis:q,YAxis:B,CartesianGrid:J,Tooltip:Q,Legend:te}=V;return e.jsxs(z,{data:t,children:[e.jsx("defs",{children:L.map((ee,ue)=>{const Y=ee.color||W(ue),K=`gradient-${ee.dataKey}-${ue}`;return e.jsxs("linearGradient",{id:K,x1:"0",y1:"0",x2:I==="horizontal"?"1":"0",y2:I==="horizontal"?"0":"1",children:[e.jsx("stop",{offset:"5%",stopColor:Y,stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:Y,stopOpacity:.1})]},K)})}),d&&e.jsx(J,{strokeDasharray:"3 3",stroke:O.gridColor,horizontal:!0,vertical:!1}),p?.showXAxis!==!1&&e.jsx(q,{dataKey:"name",axisLine:{stroke:O.axisColor},tickLine:{stroke:O.axisColor},tick:{fill:O.textColor,fontSize:12},tickFormatter:p?.xAxisFormatter}),p?.showYAxis!==!1&&e.jsx(B,{axisLine:{stroke:O.axisColor},tickLine:{stroke:O.axisColor},tick:{fill:O.textColor,fontSize:12},tickFormatter:p?.yAxisFormatter,domain:p?.yAxisDomain,unit:p?.yAxisUnit}),P?.enabled!==!1&&u&&e.jsx(Q,{...F,formatter:P&&typeof P!="boolean"&&P.formatter?(ee,ue)=>P.formatter(ee,ue,t[0]):ee=>{const ue=P&&typeof P!="boolean"&&P.valuePrefix||"",Y=P&&typeof P!="boolean"&&P.valueSuffix||"";return`${ue}${ee}${Y}`}}),_?.enabled&&e.jsx(te,{align:_.align,verticalAlign:_.position==="top"?"top":"bottom",wrapperStyle:{paddingTop:_.position==="bottom"?16:0}}),L.map((ee,ue)=>{const Y=ee.color||W(ue),K=`gradient-${ee.dataKey}-${ue}`;return e.jsx(X,{dataKey:ee.dataKey,name:ee.label,stroke:Y,strokeWidth:ee.strokeWidth||T,fill:`url(#${K})`,fillOpacity:ee.fillOpacity??R,type:v,dot:$?{r:D,fill:Y}:!1,stackId:M?"stack":void 0,animationDuration:o,isAnimationActive:l},ee.dataKey)})]})}})});Wl.displayName="WakaAreaChart";const Ul=m.forwardRef(({data:t,variant:a="default",size:r="md",height:s,width:n,animation:i=!0,animationDuration:c=500,tooltip:l=!0,legend:o=!0,theme:d,className:u,style:f,title:p,description:g,loading:y,error:j,onClick:A,responsive:x=!0,dataKey:h="value",nameKey:b="name",innerRadius:w=0,outerRadius:E="80%",startAngle:v=90,endAngle:$=-270,paddingAngle:D=2,label:C=!1,labelPosition:T="outside"},M)=>{const{theme:R,getColor:I,tooltipStyles:U}=ha(d,a),O=m.useMemo(()=>o?typeof o=="boolean"?{enabled:o,position:"bottom",align:"center"}:o:null,[o]),W=m.useMemo(()=>l?typeof l=="boolean"?{enabled:l}:l:null,[l]),F=m.useCallback(L=>{if(!C)return null;const _=Math.PI/180,P=T==="inside"?L.innerRadius+(L.outerRadius-L.innerRadius)*.5:L.outerRadius*1.1,V=L.cx+P*Math.cos(-L.midAngle*_),z=L.cy+P*Math.sin(-L.midAngle*_);let X="";return C==="percent"?X=`${(L.percent*100).toFixed(0)}%`:C==="value"?X=String(L.value):C==="name"?X=L.name:X=`${(L.percent*100).toFixed(0)}%`,e.jsx("text",{x:V,y:z,fill:T==="inside"?"#fff":R.textColor,textAnchor:V>L.cx?"start":"end",dominantBaseline:"central",fontSize:12,children:X})},[C,T,R.textColor]);return e.jsx(pa,{ref:M,variant:a,size:r,height:s,width:n,theme:d,className:u,style:f,title:p,description:g,loading:y,error:j,responsive:x,children:L=>{if(!L)return null;const{PieChart:_,Pie:P,Cell:V,Tooltip:z,Legend:X}=L;return e.jsxs(_,{children:[W?.enabled!==!1&&l&&e.jsx(z,{...U,formatter:W&&typeof W!="boolean"&&W.formatter?(q,B)=>W.formatter(q,B,t[0]):q=>{const B=W&&typeof W!="boolean"&&W.valuePrefix||"",J=W&&typeof W!="boolean"&&W.valueSuffix||"";return`${B}${q}${J}`}}),O?.enabled&&e.jsx(X,{align:O.align,verticalAlign:O.position==="top"?"top":"bottom",layout:O.position==="left"||O.position==="right"?"vertical":"horizontal",wrapperStyle:{paddingTop:O.position==="bottom"?16:0}}),e.jsx(P,{data:t,dataKey:h,nameKey:b,cx:"50%",cy:"50%",innerRadius:w,outerRadius:E,startAngle:v,endAngle:$,paddingAngle:D,animationDuration:c,isAnimationActive:i,label:C?F:!1,labelLine:C&&T==="outside",children:t.map((q,B)=>e.jsx(V,{fill:I(B),stroke:"transparent"},`cell-${B}`))})]})}})});Ul.displayName="WakaPieChart";const Gs=m.forwardRef(({data:t,type:a="line",width:r=100,height:s=30,color:n="hsl(var(--chart-1))",fillColor:i,fillOpacity:c=.3,showMinMax:l=!1,showValue:o=!1,className:d,animation:u=!0},f)=>{const{components:p,loading:g,isAvailable:y}=Bs(),j=m.useMemo(()=>t.map((T,M)=>({index:M,value:T})),[t]),{min:A,max:x,current:h}=m.useMemo(()=>{const T=t.filter(M=>typeof M=="number"&&!isNaN(M));return{min:Math.min(...T),max:Math.max(...T),current:T[T.length-1]}},[t]);if(g)return e.jsx("div",{ref:f,className:N("inline-flex items-center gap-2",d),children:e.jsx("div",{className:"bg-muted animate-pulse rounded",style:{width:r,height:s}})});if(!y||!p)return e.jsxs("div",{ref:f,className:N("inline-flex items-center gap-2",d),children:[e.jsx(Lx,{data:t,width:r,height:s,color:n,type:a,fillColor:i,fillOpacity:c}),o&&e.jsx("span",{className:"text-sm font-medium",children:h})]});const{ResponsiveContainer:b,LineChart:w,BarChart:E,AreaChart:v,Line:$,Bar:D,Area:C}=p;return e.jsxs("div",{ref:f,className:N("inline-flex items-center gap-2",d),children:[e.jsx("div",{style:{width:r,height:s},children:e.jsx(b,{width:"100%",height:"100%",children:a==="bar"?e.jsx(E,{data:j,children:e.jsx(D,{dataKey:"value",fill:n,radius:1,isAnimationActive:u})}):a==="area"?e.jsxs(v,{data:j,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`sparkline-gradient-${n.replace(/[^a-z0-9]/gi,"")}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:i||n,stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:i||n,stopOpacity:.1})]})}),e.jsx(C,{type:"monotone",dataKey:"value",stroke:n,fill:`url(#sparkline-gradient-${n.replace(/[^a-z0-9]/gi,"")})`,fillOpacity:c,strokeWidth:1.5,dot:!1,isAnimationActive:u})]}):e.jsx(w,{data:j,children:e.jsx($,{type:"monotone",dataKey:"value",stroke:n,strokeWidth:1.5,dot:!1,isAnimationActive:u})})})}),l&&e.jsxs("div",{className:"flex flex-col text-xs text-muted-foreground",children:[e.jsxs("span",{children:["↑ ",x]}),e.jsxs("span",{children:["↓ ",A]})]}),o&&e.jsx("span",{className:"text-sm font-medium",children:h})]})});Gs.displayName="WakaSparkline";function Lx({data:t,width:a,height:r,color:s,type:n,fillColor:i,fillOpacity:c}){const o=a-4,d=r-4,u=Math.min(...t),p=Math.max(...t)-u||1,g=t.map((j,A)=>{const x=2+A/(t.length-1||1)*o,h=2+d-(j-u)/p*d;return{x,y:h,value:j}});if(n==="bar"){const j=o/t.length-1;return e.jsx("svg",{width:a,height:r,children:t.map((A,x)=>{const h=(A-u)/p*d;return e.jsx("rect",{x:2+x*(j+1),y:2+d-h,width:j,height:h,fill:s,rx:1},x)})})}const y=g.map((j,A)=>`${A===0?"M":"L"} ${j.x} ${j.y}`).join(" ");if(n==="area"){const j=`${y} L ${g[g.length-1].x} ${r-2} L 2 ${r-2} Z`;return e.jsxs("svg",{width:a,height:r,children:[e.jsx("path",{d:j,fill:i||s,fillOpacity:c}),e.jsx("path",{d:y,fill:"none",stroke:s,strokeWidth:1.5})]})}return e.jsx("svg",{width:a,height:r,children:e.jsx("path",{d:y,fill:"none",stroke:s,strokeWidth:1.5})})}const Hl=m.forwardRef(({data:t,type:a="sparkline",width:r=80,height:s=24,color:n,showTrend:i=!0,valueFormatter:c,className:l},o)=>{const d=m.useMemo(()=>!t||t.length===0?[]:typeof t[0]=="number"?t:t.map(y=>{const j=y.value??Object.values(y).find(A=>typeof A=="number");return typeof j=="number"?j:0}),[t]),{trend:u,trendPercent:f,currentValue:p}=m.useMemo(()=>{if(d.length<2)return{trend:"neutral",trendPercent:0,currentValue:d[0]??0};const y=d[0],j=d[d.length-1],A=j-y,x=y!==0?A/y*100:0;return{trend:A>0?"up":A<0?"down":"neutral",trendPercent:x,currentValue:j}},[d]),g=m.useMemo(()=>n||(u==="up"?"hsl(var(--chart-2, 142 76% 36%))":u==="down"?"hsl(var(--destructive, 0 84% 60%))":"hsl(var(--muted-foreground, 220 9% 46%))"),[n,u]);return d.length===0?e.jsx("div",{ref:o,className:N("flex items-center gap-1 text-muted-foreground",l),children:e.jsx(S.Minus,{className:"h-3 w-3"})}):(c?c(p):p.toLocaleString(),e.jsxs("div",{ref:o,className:N("flex items-center gap-2",l),children:[e.jsx(Gs,{data:d,type:a==="sparkline"?"line":a,width:r,height:s,color:g,animation:!1}),i&&e.jsxs("div",{className:"flex items-center gap-1",children:[u==="up"&&e.jsx(S.TrendingUp,{className:"h-3 w-3 text-green-600 dark:text-green-400"}),u==="down"&&e.jsx(S.TrendingDown,{className:"h-3 w-3 text-red-600 dark:text-red-400"}),u==="neutral"&&e.jsx(S.Minus,{className:"h-3 w-3 text-muted-foreground"}),e.jsxs("span",{className:N("text-xs font-medium",u==="up"&&"text-green-600 dark:text-green-400",u==="down"&&"text-red-600 dark:text-red-400",u==="neutral"&&"text-muted-foreground"),children:[u!=="neutral"&&(f>0?"+":""),f.toFixed(1),"%"]})]})]}))});Hl.displayName="WakaMiniChart";function $x(t){const{accessorKey:a,header:r=String(a),chartType:s="sparkline",width:n=100,height:i=24,color:c,showValue:l=!1,valueFormatter:o}=t;return{accessorKey:a,header:r,size:n+(l?60:0),enableSorting:!1,enableColumnFilter:!1,cell:d=>{const u=d.getValue();let f=[];return Array.isArray(u)&&(typeof u[0]=="number"?f=u:typeof u[0]=="object"&&u[0]!==null&&(f=u.map(p=>{const g=p.value??Object.values(p).find(y=>typeof y=="number");return typeof g=="number"?g:0}))),{type:"chart",chartType:s,data:f,width:n,height:i,color:c,showTrend:!0,valueFormatter:o}},meta:{isChartColumn:!0,chartConfig:t}}}const Ox={cell:t=>{if(!Array.isArray(t))return null;let a=[];return typeof t[0]=="number"?a=t:typeof t[0]=="object"&&t[0]!==null&&(a=t.map(r=>{const s=r.value??Object.values(r).find(n=>typeof n=="number");return typeof s=="number"?s:0})),{type:"sparkline",data:a}},size:100,enableSorting:!1,enableFiltering:!1},_x=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))"],zx={sm:{width:"100%",height:150},md:{width:"100%",height:250},lg:{width:"100%",height:350},xl:{width:"100%",height:450},auto:{width:"100%",height:300}},ql=m.createContext(void 0);function Bl({children:t,languages:a,defaultLanguage:r="fr",s3Config:s,onLanguageChange:n,onError:i,fetchHeaders:c={},fetchTimeout:l=1e4}){const{i18n:o}=Je.useTranslation(),[d,u]=m.useState(r),[f,p]=m.useState(!0),[g,y]=m.useState(new Set),[j,A]=m.useState(!1),[x,h]=m.useState(a),b=m.useRef(new Set);m.useEffect(()=>{b.current=g},[g]);const w=m.useCallback(async R=>{const I=new AbortController,U=setTimeout(()=>I.abort(),l);try{const O=await fetch(R,{signal:I.signal,headers:{Accept:"application/json","Cache-Control":"no-cache",...c}});if(clearTimeout(U),!O.ok)throw new Error(`HTTP ${O.status}: ${O.statusText}`);const W=await O.json();return le.debug(`Translations loaded from ${R}`),W}catch(O){throw clearTimeout(U),O}},[c,l]),E=m.useCallback(async R=>{const I=x.find(U=>U.code===R);if(I?.translations)return le.debug(`Using inline translations for "${R}"`),I.translations;if(I?.jsonUrl)try{return await w(I.jsonUrl)}catch(U){throw Ve(U,{code:Le.LANG_LOAD_FAILED,context:`LanguageProvider.loadTranslations(${R}) from ${I.jsonUrl}`,onError:i})}if(s){const{baseUrl:U,prefix:O="",extension:W="json"}=s,F=`${U.replace(/\/$/,"")}/${O}${R}.${W}`;try{return await w(F)}catch(L){throw Ve(L,{code:Le.LANG_LOAD_FAILED,context:`LanguageProvider.loadTranslations(${R}) from S3`,onError:i})}}return le.debug(`No translations available for "${R}"`),null},[x,s,w,i]),v=m.useCallback((R,I)=>{if(!o?.addResourceBundle){console.warn("[LanguageProvider] i18next not available");return}o.addResourceBundle(R,"translation",I,!0,!0),le.debug(`Translations added to i18next for "${R}"`)},[o]),$=m.useCallback(async(R,I,U=!0)=>{p(!0);try{h(O=>{const W=O.findIndex(L=>L.code===R),F={code:R,label:R.toUpperCase(),translations:I};if(W>=0){const L=[...O];return L[W]={...L[W],translations:I},L}return[...O,F]}),v(R,I),y(O=>new Set(O).add(R)),U&&(await o?.changeLanguage(R),u(R),typeof window<"u"&&localStorage.setItem("language",R),n?.(R)),le.debug(`Language "${R}" loaded from JSON`)}catch(O){throw Ve(O,{code:Le.LANG_LOAD_FAILED,context:`LanguageProvider.loadLanguageFromJSON(${R})`,onError:i})}finally{p(!1)}},[o,v,n,i]),D=m.useCallback(R=>{h(I=>{const U=I.findIndex(O=>O.code===R.code);if(U>=0){const O=[...I];return O[U]=R,O}return[...I,R]}),le.debug(`Language "${R.code}" added`)},[]),C=m.useCallback(async R=>{y(I=>{const U=new Set(I);return U.delete(R),U}),p(!0);try{const I=await E(R);I&&(v(R,I),y(U=>new Set(U).add(R))),le.debug(`Language "${R}" reloaded`)}catch(I){throw I}finally{p(!1)}},[E,v]),T=m.useCallback(async R=>{if(R!==d){if(!o?.changeLanguage){console.error("[LanguageProvider] i18next is not initialized");return}p(!0);try{if(!b.current.has(R)){le.debug(`Loading translations for "${R}"...`);const I=await E(R);I&&v(R,I),y(U=>new Set(U).add(R))}await o.changeLanguage(R),u(R),typeof window<"u"&&localStorage.setItem("language",R),n?.(R),le.debug(`Language changed to: ${R}`)}catch(I){throw Ve(I,{code:Le.LANG_LOAD_FAILED,context:`LanguageProvider.changeLanguage(${R})`,onError:i})}finally{p(!1)}}},[d,E,v,o,n,i]);m.useEffect(()=>{if(j||!o)return;(async()=>{try{const I=typeof window<"u"?localStorage.getItem("language"):null,U=I&&x.some(W=>W.code===I)?I:r;le.debug(`Initializing with language: ${U}`);const O=await E(U);O&&v(U,O),await o.changeLanguage(U),u(U),y(new Set([U])),A(!0),le.debug(`Initialized with ${U}`)}catch(I){console.error("[LanguageProvider] Error initializing:",I),A(!0)}finally{p(!1)}})()},[j,o,r,x,E,v]);const M={currentLanguage:d,languages:x,changeLanguage:T,isLoading:f,loadedLanguages:g,loadLanguageFromJSON:$,addLanguage:D,reloadLanguage:C};return e.jsx(ql.Provider,{value:M,children:t})}function Xs(){const t=m.useContext(ql);if(!t)throw new Error("useLanguage must be used within a LanguageProvider");return t}const Gl=m.createContext(void 0);function Vx({children:t,config:a}){const{defaultTheme:r="light",storageKey:s="waka-ui-theme",themes:n,enableSystem:i=!0}=a||{},[c,l]=m.useState(r),[o,d]=m.useState(),[u,f]=m.useState([]),[p,g]=m.useState(!0),[y,j]=m.useState("fallback");m.useEffect(()=>{(()=>{if(g(!0),n&&n.length>0){const w=Wx(n);f(w),j("config"),g(!1),le.debug("Using themes from config:",w.length);return}f([{id:"light",label:"Clair",previewColor:"#3b82f6"},{id:"dark",label:"Sombre",previewColor:"#1e293b"}]),j("fallback"),g(!1),le.debug("Using fallback themes")})()},[n]),m.useEffect(()=>{if(!i)return;const h=window.matchMedia("(prefers-color-scheme: dark)"),b=w=>{d(w.matches?"dark":"light")};return d(h.matches?"dark":"light"),h.addEventListener("change",b),()=>h.removeEventListener("change",b)},[i]),m.useEffect(()=>{if(u.length===0)return;const h=localStorage.getItem(s),b=u.map(w=>w.id);h&&b.includes(h)&&l(h)},[s,u]),m.useEffect(()=>{if(u.length===0)return;const h=document.documentElement,b=c==="system"&&o?o:c;u.forEach(w=>h.classList.remove(w.id)),h.classList.add(b),h.setAttribute("data-theme",b),process.env.NODE_ENV==="development"&&le.debug(`Theme applied: ${b}`)},[c,o,u]);const A=m.useCallback(h=>{const b=u.map(w=>w.id);if(!b.includes(h)&&h!=="system"){console.warn(`[WakaUI] Theme "${h}" is not in the list of available themes:`,b);return}l(h),localStorage.setItem(s,h)},[u,s]),x=m.useMemo(()=>({theme:c,setTheme:A,themes:u,systemTheme:o,isLoadingThemes:p,themesSource:y}),[c,A,u,o,p,y]);return e.jsx(Gl.Provider,{value:x,children:t})}function Wx(t){return t.length===0?[]:typeof t[0]=="string"?t.map(a=>({id:a,label:Ux(a),previewColor:Hx(a)})):t}function Ux(t){return t.split("-").map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}function Hx(t){return{light:"#3b82f6",dark:"#1e293b",forest:"#10b981",sunset:"#f59e0b",twilight:"#8b5cf6",monochrome:"#6b7280",perpetuity:"#ec4899"}[t]||"#3b82f6"}function qx(){const t=m.useContext(Gl);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}function Bx({children:t,config:a}){const[r]=m.useState(()=>vt.createInstance()),[s,n]=m.useState(!1);return m.useEffect(()=>{(async()=>{try{const c={};if(a.language.languages)for(const o of a.language.languages)o.translations&&(c[o.code]={translation:o.translations});const l={...c,...a.language.resources||{}};await r.use(Je.initReactI18next).init({lng:a.language.defaultLanguage,fallbackLng:a.language.defaultLanguage,supportedLngs:a.language.supportedLanguages,resources:l,interpolation:{escapeValue:!1},react:{useSuspense:!1},debug:a.debug}),a.language.s3Config&&await Gx(r,a.language.s3Config,a.language.supportedLanguages),n(!0),le.debug("i18n initialized successfully")}catch(c){le.error("Failed to initialize i18n:",c),n(!0)}})()},[r,a]),m.useEffect(()=>{if(!s)return;const i=a.language.storageKey||"waka-ui-language",c=localStorage.getItem(i);c&&a.language.supportedLanguages.includes(c)&&r.changeLanguage(c);const l=o=>{localStorage.setItem(i,o),le.debug(`Language changed to: ${o}`)};return r.on("languageChanged",l),()=>{r.off("languageChanged",l)}},[s,r,a]),s?e.jsx(Je.I18nextProvider,{i18n:r,children:e.jsx(Bl,{languages:a.language.languages||[],defaultLanguage:a.language.defaultLanguage,s3Config:a.language.s3Config?{baseUrl:a.language.s3Config.bucketUrl,prefix:a.language.s3Config.translationsPath?`${a.language.s3Config.translationsPath}/`:"",extension:"json"}:void 0,children:e.jsx(Ui,{themes:a.theme?.themes||[{id:"default",label:"Default"}],defaultTheme:a.theme?.defaultTheme||"default",enableDarkMode:a.theme?.enableSystem,fetchHeaders:a.theme?.fetchHeaders,fetchTimeout:a.theme?.fetchTimeout,children:t})})}):e.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading WakaUI..."})}async function Gx(t,a,r){if(!a)return;const{bucketUrl:s,translationsPath:n="translations"}=a;try{await Promise.all(r.map(async i=>{try{const c=`${s}/${n}/${i}.json`,l=await fetch(c);if(!l.ok){console.warn(`[WakaUI] Failed to load translations for ${i} from S3`);return}const o=await l.json();t.addResourceBundle(i,"translation",o,!0,!0),le.debug(`Loaded translations for ${i} from S3`)}catch(c){le.warn(`Error loading translations for ${i}:`,c)}}))}catch(i){le.error("Error loading translations from S3:",i)}}function Xx(){const{i18n:t,t:a}=Je.useTranslation(),r=Xs(),s=Ua();return{currentLanguage:t.language||r.currentLanguage,changeLanguage:async n=>{await r.changeLanguage(n),await t.changeLanguage(n)},languages:r.languages,isLanguageLoading:r.isLoading,currentTheme:s.currentTheme,changeTheme:s.changeTheme,themes:s.themes,isThemeLoading:s.isLoading,preloadTheme:s.preloadTheme,isThemeLoaded:s.isThemeLoaded,t:a}}const Ks=m.createContext(void 0);function Kx({children:t,initialSelection:a,onSelectionChange:r,persistKey:s="admincrumb-selection"}){const[n,i]=m.useState(()=>{if(typeof window<"u"&&s){const g=localStorage.getItem(s);if(g)try{return JSON.parse(g)}catch(y){console.error("Failed to parse stored admincrumb selection",y)}}return a||{}});m.useEffect(()=>{typeof window<"u"&&s&&localStorage.setItem(s,JSON.stringify(n))},[n,s]),m.useEffect(()=>{r?.(n)},[n,r]);const c=m.useCallback(g=>{i({partner:g,network:void 0,customer:void 0})},[]),l=m.useCallback(g=>{i(y=>({...y,network:g,customer:void 0}))},[]),o=m.useCallback(g=>{i(y=>({...y,customer:g}))},[]),d=m.useCallback(()=>{i({})},[]),u=m.useMemo(()=>!!(n.partner||n.network||n.customer),[n]),f=m.useCallback(()=>({...n.partner?.id&&{partnerId:n.partner.id},...n.network?.id&&{networkId:n.network.id},...n.customer?.id&&{customerId:n.customer.id}}),[n]),p=m.useMemo(()=>({selection:n,setPartner:c,setNetwork:l,setCustomer:o,reset:d,isFiltered:u,getFilterQuery:f}),[n,c,l,o,d,u,f]);return e.jsx(Ks.Provider,{value:p,children:t})}function Yx(){const t=m.useContext(Ks);if(!t)throw new Error("useAdmincrumbContext must be used within AdmincrumbProvider");return t}function Jx(){return m.useContext(Ks)}const Qx={github:S.Github,twitter:S.Twitter,linkedin:S.Linkedin,email:S.Mail};function Zx({columns:t=[],socialLinks:a=[],copyright:r="© 2024 Tous droits réservés.",className:s}){return e.jsx("footer",{className:N("bg-muted/40",s),children:e.jsxs("div",{className:"container mx-auto px-4 py-12",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-4",children:[t.map((n,i)=>e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:n.title}),e.jsx("ul",{className:"space-y-2",children:n.links.map((c,l)=>e.jsx("li",{children:e.jsx("a",{href:c.href,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:c.label})},l))})]},i)),a.length>0&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Suivez-nous"}),e.jsx("div",{className:"flex space-x-4",children:a.map((n,i)=>{const c=Qx[n.platform];return e.jsx(G,{variant:"ghost",size:"icon",asChild:!0,className:"h-8 w-8",children:e.jsx("a",{href:n.url,target:"_blank",rel:"noopener noreferrer","aria-label":n.platform,children:e.jsx(c,{className:"h-4 w-4"})})},i)})})]})]}),e.jsx(pt,{className:"my-8"}),e.jsxs("div",{className:"flex flex-col items-center justify-between space-y-4 md:flex-row md:space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:r}),e.jsxs("div",{className:"flex space-x-6",children:[e.jsx("a",{href:"/privacy",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Politique de confidentialité"}),e.jsx("a",{href:"/terms",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Conditions d'utilisation"})]})]})]})})}function eb({items:t,defaultActiveId:a,variant:r="default",size:s="md",className:n,onTabChange:i}){const[c,l]=m.useState(a||t[0]?.id||""),o=f=>{l(f),i?.(f)},d={sm:"h-8 px-3 text-sm",md:"h-10 px-4 text-sm",lg:"h-12 px-6 text-base"},u={default:"bg-background",pills:"bg-muted rounded-full",underline:"bg-transparent border-b-2 border-transparent data-[state=active]:border-primary"};return e.jsx("div",{className:N("w-full",n),children:e.jsxs(Ds,{value:c,onValueChange:o,children:[e.jsx(Mr,{className:N("grid w-full",r==="pills"&&"grid-cols-auto",r!=="pills"&&`grid-cols-${t.length}`,u[r]),children:t.map(f=>e.jsx(Ra,{value:f.id,disabled:f.disabled,className:N(d[s],r==="underline"&&"rounded-none border-b-2 border-transparent data-[state=active]:border-primary",r==="pills"&&"rounded-full"),children:f.label},f.id))}),t.map(f=>e.jsx(Pa,{value:f.id,className:"mt-6",children:f.content},f.id))]})})}function tb({variant:t="dropdown",showFlags:a=!0,className:r}){const{currentLanguage:s,languages:n,changeLanguage:i,isLoading:c}=Xs(),l=n.find(o=>o.code===s);return t==="select"?e.jsxs(ot,{value:s,onValueChange:i,disabled:c,children:[e.jsx(Xe,{className:N("w-[180px]",r),children:e.jsxs(it,{children:[a&&l?.flagEmoji&&e.jsx("span",{className:"mr-2",children:l.flagEmoji}),l?.label]})}),e.jsx(Ke,{children:n.map(o=>e.jsxs(Oe,{value:o.code,children:[a&&o.flagEmoji&&e.jsx("span",{className:"mr-2",children:o.flagEmoji}),o.label]},o.code))})]}):e.jsxs(Gt,{children:[e.jsx(Xt,{asChild:!0,children:e.jsxs(G,{variant:"outline",size:"sm",className:N("gap-2",r),disabled:c,children:[e.jsx(S.Globe,{className:"h-4 w-4"}),a&&l?.flagEmoji&&e.jsx("span",{children:l.flagEmoji}),l?.label]})}),e.jsx(Lt,{align:"end",children:n.map(o=>e.jsxs(_a,{onClick:()=>i(o.code),className:"cursor-pointer",children:[a&&o.flagEmoji&&e.jsx("span",{className:"mr-2",children:o.flagEmoji}),o.label]},o.code))})]})}function ab({children:t,header:a,sidebar:r,footer:s,collapsible:n=!1,className:i}){const[c,l]=m.useState(!1);return e.jsxs("div",{className:N("min-h-screen bg-background",i),children:[a&&e.jsx("header",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsxs("div",{className:"container flex h-14 max-w-screen-2xl items-center",children:[n&&r&&e.jsxs(Wa,{open:c,onOpenChange:l,children:[e.jsx(Es,{asChild:!0,children:e.jsxs(G,{variant:"ghost",size:"icon",className:"md:hidden",children:[e.jsx(S.Menu,{className:"h-5 w-5"}),e.jsx("span",{className:"sr-only",children:"Ouvrir le menu"})]})}),e.jsx(ma,{side:"left",className:"w-72 p-0",children:e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Navigation"}),e.jsx(G,{variant:"ghost",size:"icon",onClick:()=>l(!1),children:e.jsx(S.X,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:r})]})})]}),a]})}),e.jsxs("div",{className:"flex",children:[r&&!n&&e.jsx("aside",{className:"hidden w-64 border-r bg-muted/40 md:block",children:e.jsx("div",{className:"h-full overflow-y-auto p-4",children:r})}),e.jsx("main",{className:"flex-1",children:e.jsx("div",{className:"container mx-auto p-4",children:t})})]}),s&&e.jsx("footer",{className:"border-t bg-muted/40",children:e.jsx("div",{className:"container mx-auto p-4",children:s})})]})}function rb({config:t,onSubmit:a,onForgotPassword:r,onSignUp:s,onSSOGoogle:n,onSSOMicrosoft:i,onSSOApple:c,onSSOLinkedIn:l,onSSOGithub:o,onSSOFacebook:d,onSSOInstagram:u,onSSOFranceConnect:f,showSocialLogin:p=!1,className:g}){let y=!1;try{y=Ua().isDarkMode}catch{}const j=t?.theme_json?.dark_mode??y,[A,x]=m.useState({email:"",password:"",rememberMe:!1}),[h,b]=m.useState(!1),w=m.useMemo(()=>t?.assets?j?t.assets.theme_logo_dark:t.assets.theme_logo_light:null,[t?.assets,j]),E=m.useMemo(()=>t?.color_json?{"--login-primary":t.color_json.primary,"--login-secondary":t.color_json.secondary,"--login-accent":t.color_json.accent}:{},[t?.color_json]),v=m.useMemo(()=>{const T=[];if(!t?.signup_options)return p&&(o&&T.push({id:"github",label:"GitHub",icon:e.jsx(S.Github,{className:"h-4 w-4"}),onClick:o}),n&&T.push({id:"google",label:"Google",icon:e.jsx(S.Mail,{className:"h-4 w-4"}),onClick:n})),T;const M=t.signup_options;return M.allow_sso_google&&T.push({id:"google",label:"Google",icon:e.jsx(S.Mail,{className:"h-4 w-4"}),onClick:n}),M.allow_sso_microsoft&&T.push({id:"microsoft",label:"Microsoft",icon:e.jsx(S.Mail,{className:"h-4 w-4"}),onClick:i}),M.allow_sso_apple&&T.push({id:"apple",label:"Apple",icon:e.jsx(S.Apple,{className:"h-4 w-4"}),onClick:c}),M.allow_sso_linkedIn&&T.push({id:"linkedin",label:"LinkedIn",icon:e.jsx(S.Linkedin,{className:"h-4 w-4"}),onClick:l}),M.allow_sso_github&&T.push({id:"github",label:"GitHub",icon:e.jsx(S.Github,{className:"h-4 w-4"}),onClick:o}),M.allow_sso_facebook&&T.push({id:"facebook",label:"Facebook",icon:e.jsx(S.Facebook,{className:"h-4 w-4"}),onClick:d}),M.allow_sso_instagram&&T.push({id:"instagram",label:"Instagram",icon:e.jsx(S.Instagram,{className:"h-4 w-4"}),onClick:u}),M.allow_sso_france_connect&&T.push({id:"france-connect",label:"France Connect",icon:e.jsx(S.Mail,{className:"h-4 w-4"}),onClick:f}),T},[t?.signup_options,p,n,i,c,l,o,d,u,f]),$=t?.signup_options?.allow_login!==!1,D=async T=>{T.preventDefault(),b(!0);try{await a?.(A)}finally{b(!1)}},C=T=>M=>{x(R=>({...R,[T]:T==="rememberMe"?M.target.checked:M.target.value}))};return e.jsx("div",{className:N("flex items-center justify-center p-4",g),style:E,children:e.jsxs(Be,{className:"w-full max-w-md",children:[e.jsxs(rt,{className:"space-y-1",children:[w&&e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:w,alt:t?.theme_json?.name||"Logo",className:"max-h-16 max-w-full object-contain"})}),e.jsx(Ge,{className:"text-2xl text-center",children:"Connexion"}),e.jsx(Et,{className:"text-center",children:"Entrez vos identifiants pour accéder à votre compte"})]}),e.jsxs(st,{className:"space-y-4",children:[v.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:N("grid gap-4",v.length===1?"grid-cols-1":"grid-cols-2"),children:v.map(T=>e.jsxs(G,{variant:"outline",className:"w-full",onClick:T.onClick,type:"button",children:[T.icon,T.label]},T.id))}),$&&e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx(pt,{className:"w-full"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Ou continuez avec"})})]})]}),$&&e.jsxs("form",{onSubmit:D,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ve,{htmlFor:"email",children:"Email"}),e.jsx(me,{id:"email",type:"email",placeholder:"votre@email.com",value:A.email,onChange:C("email"),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ve,{htmlFor:"password",children:"Mot de passe"}),e.jsx(me,{id:"password",type:"password",placeholder:"••••••••",value:A.password,onChange:C("password"),required:!0})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{id:"remember",type:"checkbox",checked:A.rememberMe,onChange:C("rememberMe"),className:"h-4 w-4 rounded border-gray-300"}),e.jsx(ve,{htmlFor:"remember",className:"text-sm",children:"Se souvenir de moi"})]}),r&&e.jsx(G,{type:"button",variant:"link",className:"px-0 text-sm",onClick:r,children:"Mot de passe oublié ?"})]}),e.jsx(G,{type:"submit",className:"w-full",disabled:h,style:t?.color_json?.primary?{backgroundColor:t.color_json.primary,color:t.color_json.secondary}:void 0,children:h?"Connexion...":"Se connecter"})]}),s&&e.jsxs("div",{className:"text-center text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Pas encore de compte ? "}),e.jsx(G,{type:"button",variant:"link",className:"px-0 text-sm",onClick:s,children:"S'inscrire"})]}),t?.waka_powered&&e.jsx("div",{className:"text-center text-xs text-muted-foreground mt-4 pt-4 border-t",children:"Powered by Waka"})]})]})})}const Xl=m.createContext(null);function sb(){const t=m.useContext(Xl);if(!t)throw new Error("Sidebar components must be used within WakaSidebar");return t}function nb({config:t}){const a=t.component?t.component:e.jsxs("div",{className:"flex items-center gap-3",children:[t.src&&e.jsx("img",{src:t.src,alt:t.alt||"Logo",className:"h-8 w-auto object-contain"}),t.title&&e.jsx("span",{className:"text-lg font-bold tracking-wide",children:t.title})]});return t.href?e.jsx("a",{href:t.href,className:"block",onClick:t.onClick,children:a}):t.onClick?e.jsx("button",{type:"button",onClick:t.onClick,className:"block text-left",children:a}):e.jsx("div",{children:a})}function Kl({item:t,isChild:a=!1,renderItem:r}){const{activeId:s,setActiveId:n,expandedIds:i,toggleExpanded:c,isMobile:l,closeOnNavigate:o,onClose:d}=sb(),u=t.children&&t.children.length>0,f=i.includes(t.id),p=s===t.id||t.active,g=()=>{t.disabled||(u?c(t.id):(n(t.id),t.onClick?.(),l&&o&&d()))};if(r)return e.jsx(e.Fragment,{children:r(t,a)});const y=e.jsxs("div",{className:N("flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200","hover:bg-white/10",p&&!u&&"bg-sidebar-active text-sidebar-active-foreground",a&&"ml-6 text-[13px]",t.disabled&&"opacity-50 cursor-not-allowed"),children:[t.icon&&e.jsx("span",{className:N("flex-shrink-0",a?"h-4 w-4":"h-5 w-5"),children:t.icon}),e.jsx("span",{className:"flex-1 truncate",children:t.label}),t.badge!==void 0&&e.jsx("span",{className:"ml-auto flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary px-1.5 text-[10px] font-semibold text-primary-foreground",children:t.badge}),u&&e.jsx(S.ChevronDown,{className:N("h-4 w-4 transition-transform duration-200",f&&"rotate-180")})]});return u?e.jsxs(io,{open:f,onOpenChange:()=>c(t.id),children:[e.jsx(lo,{asChild:!0,children:e.jsx("button",{type:"button",className:"w-full text-left",disabled:t.disabled,children:y})}),e.jsx(co,{className:"space-y-1 pt-1",children:t.children?.map(j=>e.jsx(Kl,{item:j,isChild:!0,renderItem:r},j.id))})]}):t.href?e.jsx("a",{href:t.href,onClick:j=>{if(t.disabled){j.preventDefault();return}g()},className:"block",children:y}):e.jsx("button",{type:"button",className:"w-full text-left",disabled:t.disabled,onClick:g,children:y})}function $n({config:t}){const a=t.initials||t.name.split(" ").map(n=>n[0]).join("").slice(0,2).toUpperCase(),r=[{id:"profile",label:"Profil",icon:e.jsx(S.User,{className:"h-4 w-4"})},{id:"settings",label:"Paramètres",icon:e.jsx(S.Settings,{className:"h-4 w-4"})},{id:"logout",label:"Déconnexion",icon:e.jsx(S.LogOut,{className:"h-4 w-4"}),variant:"destructive"}],s=t.actions??r;return e.jsxs(Gt,{children:[e.jsx(Xt,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-lg p-2 text-left transition-colors hover:bg-white/10",children:[e.jsxs(yr,{className:"h-10 w-10 border-2 border-sidebar-active",children:[e.jsx(wr,{src:t.avatarUrl,alt:t.name}),e.jsx(jr,{className:"bg-sidebar-active text-sidebar-active-foreground text-sm font-medium",children:a})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.name}),t.email&&e.jsx("p",{className:"text-xs text-sidebar-foreground/70 truncate",children:t.email})]}),e.jsx(S.ChevronDown,{className:"h-4 w-4 flex-shrink-0 opacity-70"})]})}),e.jsx(Lt,{align:"end",className:"w-56",children:s.map((n,i)=>e.jsxs(m.Fragment,{children:[n.variant==="destructive"&&i>0&&e.jsx(na,{}),e.jsx(_a,{onClick:n.onClick,className:N(n.variant==="destructive"&&"text-destructive focus:text-destructive"),asChild:!!n.href,children:n.href?e.jsxs("a",{href:n.href,className:"flex items-center gap-2",children:[n.icon,n.label]}):e.jsxs("span",{className:"flex items-center gap-2",children:[n.icon,n.label]})})]},n.id))})]})}function ob({logo:t,menu:a,user:r,userPosition:s="bottom",header:n,footer:i,renderItem:c}){return e.jsxs("div",{className:"flex h-full flex-col",children:[t&&e.jsx("div",{className:"flex-shrink-0 p-4 pb-2",children:e.jsx(nb,{config:t})}),n&&e.jsx("div",{className:"flex-shrink-0 px-4 py-2",children:n}),r&&s==="top"&&e.jsx("div",{className:"flex-shrink-0 px-3 py-2 border-b border-white/10",children:e.jsx($n,{config:r})}),e.jsx($t,{className:"flex-1 px-3 py-4",children:e.jsx("nav",{className:"space-y-1",children:a.map(l=>e.jsx(Kl,{item:l,renderItem:c},l.id))})}),i&&e.jsx("div",{className:"flex-shrink-0 px-4 py-2 border-t border-white/10",children:i}),r&&s==="bottom"&&e.jsx("div",{className:"flex-shrink-0 p-3 border-t border-white/10",children:e.jsx($n,{config:r})})]})}function Yl({logo:t,menu:a,user:r,width:s=260,mobileBreakpoint:n=768,open:i,onOpenChange:c,className:l,contentClassName:o,backgroundColor:d,textColor:u,activeColor:f,hoverColor:p,userPosition:g="bottom",showHamburger:y=!0,hamburgerPosition:j="left",renderItem:A,footer:x,header:h,position:b="fixed"}){const[w,E]=m.useState(!1),v=i!==void 0,$=v?i:w,D=v?c:E,[C,T]=m.useState(!1);m.useEffect(()=>{const P=()=>{T(window.innerWidth<n)};return P(),window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[n]);const[M,R]=m.useState(()=>{const P=V=>{for(const z of V){if(z.active)return z.id;if(z.children){const X=P(z.children);if(X)return X}}return null};return P(a)}),[I,U]=m.useState(()=>{const P=(V,z=[])=>{for(const X of V){if(X.active)return z;if(X.children){const q=P(X.children,[...z,X.id]);if(q.length>z.length)return q}}return[]};return P(a)}),O=m.useCallback(P=>{U(V=>V.includes(P)?V.filter(z=>z!==P):[...V,P])},[]),W={activeId:M,setActiveId:R,expandedIds:I,toggleExpanded:O,isMobile:C,closeOnNavigate:!0,onClose:()=>D(!1)},F={"--sidebar-bg":d||"hsl(222 47% 11%)","--sidebar-text":u||"hsl(210 40% 96%)","--sidebar-active":f||"hsl(187 85% 43%)","--sidebar-active-foreground":"hsl(222 47% 11%)","--sidebar-hover":p||"rgba(255, 255, 255, 0.1)"},L=N("bg-[var(--sidebar-bg)] text-[var(--sidebar-text)]","[&_.bg-sidebar-active]:bg-[var(--sidebar-active)]","[&_.text-sidebar-active-foreground]:text-[var(--sidebar-active-foreground)]","[&_.text-sidebar-foreground\\/70]:text-[var(--sidebar-text)]/70","[&_.border-sidebar-active]:border-[var(--sidebar-active)]",o),_=e.jsx(Xl.Provider,{value:W,children:e.jsx("div",{className:N("h-full",L),style:F,children:e.jsx(ob,{logo:t,menu:a,user:r,userPosition:g,header:h,footer:x,renderItem:A})})});return e.jsxs(e.Fragment,{children:[y&&C&&e.jsxs(G,{variant:"ghost",size:"icon",className:N("fixed top-3 z-50",j==="left"?"left-3":"right-3"),onClick:()=>D(!0),children:[e.jsx(S.Menu,{className:"h-6 w-6"}),e.jsx("span",{className:"sr-only",children:"Ouvrir le menu"})]}),!C&&e.jsx("aside",{className:N(b==="fixed"?"fixed left-0 top-0 h-screen z-40":"relative h-full",l),style:{width:s},children:_}),C&&e.jsx(Wa,{open:$,onOpenChange:D,children:e.jsx(ma,{side:"left",className:N("w-[280px] p-0 border-0",l),style:F,children:_})})]})}function ib(){const[t,a]=m.useState(!1),r=m.useCallback(()=>a(!0),[]),s=m.useCallback(()=>a(!1),[]),n=m.useCallback(()=>a(i=>!i),[]);return{isOpen:t,setIsOpen:a,open:r,close:s,toggle:n}}function lb({sidebar:t,children:a,sidebarWidth:r=260,className:s,contentClassName:n}){const[i,c]=m.useState(!1),l=t.mobileBreakpoint||768;return m.useEffect(()=>{const o=()=>c(window.innerWidth<l);return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[l]),e.jsxs("div",{className:N("min-h-screen bg-background",s),children:[e.jsx(Yl,{...t,width:r}),e.jsx("main",{className:N("min-h-screen transition-all duration-300",n),style:{marginLeft:i?0:r},children:a})]})}exports.AccordionPrimitive=Ot;exports.AlertDialogPrimitive=Ue;exports.AspectRatioPrimitive=_n;exports.AvatarPrimitive=ea;exports.SlotPrimitive=Yc;exports.CheckboxPrimitive=nr;exports.CollapsiblePrimitive=mr;exports.DialogPrimitive=je;exports.ContextMenuPrimitive=ke;exports.DropdownMenuPrimitive=Se;exports.LabelPrimitive=os;exports.HoverCardPrimitive=$a;exports.SelectPrimitive=Re;exports.MenubarPrimitive=we;exports.NavigationMenuPrimitive=He;exports.PopoverPrimitive=ia;exports.ProgressPrimitive=or;exports.RadioGroupPrimitive=la;exports.ScrollAreaPrimitive=It;exports.SeparatorPrimitive=is;exports.SliderPrimitive=sa;exports.SwitchPrimitive=ir;exports.TabsPrimitive=_t;exports.ToastPrimitive=Ze;exports.TogglePrimitive=ls;exports.TooltipPrimitive=ua;Object.defineProperty(exports,"I18nextProvider",{enumerable:!0,get:()=>Je.I18nextProvider});Object.defineProperty(exports,"Trans",{enumerable:!0,get:()=>Je.Trans});Object.defineProperty(exports,"useI18nTranslation",{enumerable:!0,get:()=>Je.useTranslation});exports.i18n=vt;exports.Accordion=id;exports.AccordionContent=qn;exports.AccordionItem=Un;exports.AccordionTrigger=Hn;exports.AdmincrumbProvider=Kx;exports.Alert=us;exports.AlertDescription=ms;exports.AlertDialog=cs;exports.AlertDialogAction=br;exports.AlertDialogCancel=vr;exports.AlertDialogContent=fr;exports.AlertDialogDescription=xr;exports.AlertDialogFooter=pr;exports.AlertDialogHeader=hr;exports.AlertDialogOverlay=ds;exports.AlertDialogPortal=Bn;exports.AlertDialogTitle=gr;exports.AlertDialogTrigger=ld;exports.AlertTitle=Gn;exports.AspectRatio=dd;exports.Avatar=yr;exports.AvatarFallback=jr;exports.AvatarImage=wr;exports.Badge=Pe;exports.BlockLanguageSelector=tb;exports.Blockquote=Mi;exports.Button=G;exports.CHART_SIZE_MAP=zx;exports.Calendar=fs;exports.Card=Be;exports.CardContent=st;exports.CardDescription=Et;exports.CardFooter=Kn;exports.CardHeader=rt;exports.CardTitle=Ge;exports.Checkbox=yt;exports.Code=oo;exports.Collapsible=io;exports.CollapsibleContent=co;exports.CollapsibleTrigger=lo;exports.Command=Kt;exports.CommandDialog=Ep;exports.CommandEmpty=da;exports.CommandGroup=Yt;exports.CommandInput=ca;exports.CommandItem=Jt;exports.CommandList=Er;exports.CommandSeparator=fo;exports.CommandShortcut=ho;exports.ContextMenu=po;exports.ContextMenuCheckboxItem=vo;exports.ContextMenuContent=ys;exports.ContextMenuGroup=Tp;exports.ContextMenuItem=kt;exports.ContextMenuLabel=wo;exports.ContextMenuPortal=Dp;exports.ContextMenuRadioGroup=Rp;exports.ContextMenuRadioItem=yo;exports.ContextMenuSeparator=Ea;exports.ContextMenuShortcut=jo;exports.ContextMenuSub=Ap;exports.ContextMenuSubContent=bo;exports.ContextMenuSubTrigger=xo;exports.ContextMenuTrigger=go;exports.DEFAULT_CHART_COLORS=_x;exports.DataTable=Mg;exports.DataTableAdvanced=Og;exports.DataTableBody=Kg;exports.DataTableBodyRow=nl;exports.DataTableCell=rl;exports.DataTableColumnResizer=_g;exports.DataTableConflictResolver=Pl;exports.DataTableContextMenu=Ug;exports.DataTableEditCell=Zt;exports.DataTableFilterBuilder=Nx;exports.DataTableFilters=zs;exports.DataTableGroupRow=Zg;exports.DataTableGroupTotals=Vg;exports.DataTableGrouping=zg;exports.DataTableGroupingControls=Wg;exports.DataTableHeader=Xg;exports.DataTableHeaderRow=sl;exports.DataTablePagination=_s;exports.DataTableRow=Qg;exports.DataTableSelection=Hg;exports.DataTableSyncStatus=Rl;exports.DataTableToolbar=Fa;exports.Dialog=Nr;exports.DialogClose=Sp;exports.DialogContent=Oa;exports.DialogDescription=Sr;exports.DialogFooter=mo;exports.DialogHeader=Cr;exports.DialogOverlay=vs;exports.DialogPortal=uo;exports.DialogTitle=kr;exports.DialogTrigger=kp;exports.DropdownMenu=Gt;exports.DropdownMenuCheckboxItem=Bt;exports.DropdownMenuContent=Lt;exports.DropdownMenuGroup=Pp;exports.DropdownMenuItem=_a;exports.DropdownMenuLabel=Ta;exports.DropdownMenuPortal=Mp;exports.DropdownMenuRadioGroup=Ip;exports.DropdownMenuRadioItem=ko;exports.DropdownMenuSeparator=na;exports.DropdownMenuShortcut=So;exports.DropdownMenuSub=Fp;exports.DropdownMenuSubContent=Co;exports.DropdownMenuSubTrigger=No;exports.DropdownMenuTrigger=Xt;exports.ErrorBoundary=Wn;exports.ErrorCode=Le;exports.Footer=Zx;exports.Form=Yp;exports.FormControl=$o;exports.FormDescription=Oo;exports.FormField=Jp;exports.FormItem=Io;exports.FormLabel=Lo;exports.FormMessage=_o;exports.Heading=Ri;exports.Headtab=eb;exports.HoverCard=Qp;exports.HoverCardContent=zo;exports.HoverCardTrigger=Zp;exports.IndexedDBService=Tl;exports.Input=me;exports.InputOTP=Vo;exports.Kbd=Ii;exports.Label=ve;exports.LanguageProvider=Bl;exports.LanguageSelector=tg;exports.Layout=ab;exports.LegacyThemeProvider=Vx;exports.Logger=zn;exports.Login=rb;exports.Menubar=Ho;exports.MenubarCheckboxItem=Yo;exports.MenubarContent=Xo;exports.MenubarGroup=rg;exports.MenubarItem=Ko;exports.MenubarLabel=Qo;exports.MenubarMenu=ag;exports.MenubarPortal=sg;exports.MenubarRadioGroup=og;exports.MenubarRadioItem=Jo;exports.MenubarSeparator=Zo;exports.MenubarShortcut=ei;exports.MenubarSub=ng;exports.MenubarSubContent=Go;exports.MenubarSubTrigger=Bo;exports.MenubarTrigger=qo;exports.NavigationMenu=ti;exports.NavigationMenuContent=ni;exports.NavigationMenuIndicator=oi;exports.NavigationMenuItem=ig;exports.NavigationMenuLink=lg;exports.NavigationMenuList=ai;exports.NavigationMenuTrigger=si;exports.NavigationMenuViewport=ks;exports.OPERATORS_BY_TYPE=sr;exports.OPERATOR_LABELS=Sl;exports.Popover=lt;exports.PopoverContent=Ye;exports.PopoverTrigger=ct;exports.Progress=Va;exports.RadioGroup=ii;exports.RadioGroupItem=li;exports.ScrollArea=$t;exports.ScrollBar=Ss;exports.Select=ot;exports.SelectContent=Ke;exports.SelectGroup=eg;exports.SelectItem=Oe;exports.SelectLabel=Wo;exports.SelectScrollDownButton=Cs;exports.SelectScrollUpButton=Ns;exports.SelectSeparator=Uo;exports.SelectTrigger=Xe;exports.SelectValue=it;exports.Separator=pt;exports.Sheet=Wa;exports.SheetClose=cg;exports.SheetContent=ma;exports.SheetDescription=Rr;exports.SheetFooter=di;exports.SheetHeader=Dr;exports.SheetOverlay=Ts;exports.SheetPortal=ci;exports.SheetTitle=Ar;exports.SheetTrigger=Es;exports.SidebarLayout=lb;exports.Skeleton=ui;exports.Slider=mi;exports.Switch=Pr;exports.Table=fi;exports.TableBody=pi;exports.TableCaption=yi;exports.TableCell=vi;exports.TableFooter=gi;exports.TableHead=bi;exports.TableHeader=hi;exports.TableRow=xi;exports.Tabs=Ds;exports.TabsContent=Pa;exports.TabsList=Mr;exports.TabsTrigger=Ra;exports.Text=Di;exports.Textarea=fa;exports.ThemeLoader=xs;exports.ThemeProvider=Ui;exports.ThemeSelector=wi;exports.Toast=Rs;exports.ToastAction=Ni;exports.ToastClose=Ps;exports.ToastDescription=Fs;exports.ToastProvider=ji;exports.ToastTitle=Ms;exports.ToastViewport=As;exports.Toaster=pg;exports.Toggle=Ei;exports.Tooltip=dr;exports.TooltipContent=Ma;exports.TooltipProvider=cr;exports.TooltipTrigger=ur;exports.WakaAdmincrumb=$i;exports.WakaAreaChart=Wl;exports.WakaAutocomplete=qs;exports.WakaAutocompleteForm=Ll;exports.WakaBarChart=zl;exports.WakaCarousel=wg;exports.WakaChart=pa;exports.WakaColorPicker=Hs;exports.WakaColorPickerForm=Fl;exports.WakaDateTimePicker=Ls;exports.WakaDateTimePickerForm=jg;exports.WakaError=nt;exports.WakaFileUpload=Il;exports.WakaKeycloakLogin=Bi;exports.WakaLineChart=Vl;exports.WakaMiniChart=Hl;exports.WakaNotifications=_i;exports.WakaPieChart=Ul;exports.WakaProvider=Bx;exports.WakaRichTextEditor=$l;exports.WakaSidebar=Yl;exports.WakaSparkline=Gs;exports.WakaSpinner=zi;exports.WakaThemeCreator=Vi;exports.WakaThemeManager=qi;exports.actionsTemplate=bl;exports.applyTheme=mp;exports.assertCondition=ed;exports.availableTemplateNames=gx;exports.avatarTemplate=gl;exports.badgeTemplate=ml;exports.badgeVariants=Xn;exports.blockquoteVariants=Pi;exports.booleanTemplate=xl;exports.calculateDuration=Bh;exports.cn=N;exports.compareRanges=ip;exports.createActionsTemplate=Us;exports.createBookingDateValidator=Qh;exports.createCardExpiryValidator=Jh;exports.createChartColumn=$x;exports.createCommonPresets=$h;exports.createCustomPreset=zh;exports.createErrorFactory=ad;exports.createLastDaysPresets=Oh;exports.createMaxAgeValidator=Hh;exports.createMaxRangeDaysValidator=Zh;exports.createMinAgeValidator=Uh;exports.createMonthlyPresets=rp;exports.createNextDaysPresets=_h;exports.createQuarterPresets=ap;exports.currencyTemplate=cl;exports.dateTemplate=ol;exports.dateToTimestamp=sp;exports.datetimeTemplate=il;exports.emailTemplate=fl;exports.exportToCSV=Gi;exports.exportToJSON=Xi;exports.formatDateRange=Gh;exports.formatters=We;exports.getDatesInMonth=gs;exports.getFrenchHolidays=Xh;exports.getIndexedDBService=Dl;exports.getTemplate=px;exports.getThemeLoader=bs;exports.getWeekdaysInMonth=Yh;exports.getWeekendsInMonth=Kh;exports.getWorkingDays=tp;exports.handleError=Ve;exports.headingVariants=Ai;exports.idTemplate=yl;exports.indexTemplate=vl;exports.initThemeLoader=dp;exports.isDateInRange=St;exports.isErrorCode=td;exports.isFutureDate=Vh;exports.isHoliday=no;exports.isNotExpired=qh;exports.isPastDate=ro;exports.isSameDay=ep;exports.isToday=Wh;exports.isWakaError=Vn;exports.isWeekday=ps;exports.isWeekend=so;exports.jsonTemplate=Cl;exports.kbdVariants=Fi;exports.loadTableState=Yi;exports.loadTheme=up;exports.logger=le;exports.mergeRanges=lp;exports.navigationMenuTriggerStyle=ri;exports.normalizeDate=op;exports.numberTemplate=ul;exports.parseCSV=Dg;exports.percentageTemplate=dl;exports.phoneTemplate=hl;exports.progressTemplate=jl;exports.rangesOverlap=cp;exports.ratingTemplate=wl;exports.reducer=Ci;exports.retryAsync=rd;exports.saveTableState=Ki;exports.sparklineTemplate=Ox;exports.statusTemplate=Ws;exports.tagsTemplate=Nl;exports.templatesMap=oa;exports.textTemplate=kl;exports.textVariants=Ti;exports.themeManagerVariants=Hi;exports.timeTemplate=ll;exports.timestampToDate=np;exports.toast=ki;exports.toggleVariants=Si;exports.tryCatch=Jc;exports.tryCatchAsync=Qc;exports.tweak=lr;exports.urlTemplate=pl;exports.useAdmincrumb=yg;exports.useAdmincrumbContext=Yx;exports.useAdmincrumbContextOptional=Jx;exports.useChartTheme=ha;exports.useDataTable=Ji;exports.useDataTableAdvanced=Qi;exports.useDataTableAdvancedFilters=vx;exports.useDataTableColumnTemplates=xx;exports.useDataTableEdit=Os;exports.useDataTableExport=el;exports.useDataTableImport=tl;exports.useDataTableOffline=jx;exports.useDataTableSelection=qg;exports.useDataTableTheme=al;exports.useDataTableVirtualization=Zi;exports.useDateForm=Ng;exports.useErrorBoundaryReset=nd;exports.useFormField=za;exports.useLanguage=Xs;exports.useLegacyTheme=qx;exports.useNotifications=kg;exports.useRechartsLoader=Bs;exports.useSidebar=ib;exports.useTableLayout=$s;exports.useTheme=Ua;exports.useThemeLoader=fp;exports.useToast=Is;exports.useTranslation=Oi;exports.useWaka=Xx;exports.withErrorBoundary=od;exports.withErrorHandling=Zc;
|
|
88
|
+
hsl(${C}, 100%, 50%)
|
|
89
|
+
`},onMouseDown:T,children:e.jsx("div",{className:"absolute w-4 h-4 border-2 border-white rounded-full shadow -translate-x-1/2 -translate-y-1/2 pointer-events-none",style:{left:`${N}%`,top:`${100-x}%`,backgroundColor:`hsl(${C}, ${N}%, ${x}%)`}})}),e.jsx("div",{ref:F,className:"relative w-full h-3 rounded cursor-pointer",style:{background:"linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00)"},onMouseDown:M,children:e.jsx("div",{className:"absolute w-3 h-5 border-2 border-white rounded -translate-x-1/2 -top-1 shadow pointer-events-none",style:{left:`${C/360*100}%`,backgroundColor:`hsl(${C}, 100%, 50%)`}})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded border flex-shrink-0",style:{backgroundColor:t}}),e.jsx(j.Input,{value:k,onChange:E,className:"h-8 text-sm font-mono",placeholder:a==="hex"?"#000000":a==="rgb"?"rgb(0,0,0)":"hsl(0,0%,0%)"}),G&&e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:I,title:"Pipette",children:e.jsx(h.Pipette,{className:"h-4 w-4"})})]}),r&&o.length>0&&e.jsxs("div",{children:[e.jsx(j.Label,{className:"text-xs text-muted-foreground",children:"Couleurs prédéfinies"}),e.jsx("div",{className:"grid grid-cols-10 gap-1 mt-1",children:o.map(H=>e.jsx("button",{className:b.cn("w-5 h-5 rounded border transition-transform hover:scale-110",t.toLowerCase()===H.toLowerCase()&&"ring-2 ring-primary ring-offset-1"),style:{backgroundColor:H},onClick:()=>{const X=va(H);if(X){const[z,L,_]=Ks(...X);y(z),v(L),w(_),A(z,L,_)}}},H))})]})]})})]})});nr.displayName="WakaColorPicker";const dc=d.forwardRef(({error:t,label:s,className:a,...n},r)=>e.jsxs("div",{className:b.cn("space-y-1.5",a),children:[s&&e.jsx(j.Label,{htmlFor:n.name,children:s}),e.jsx(nr,{ref:r,...n}),t&&e.jsx("p",{className:"text-sm text-destructive",children:t})]}));dc.displayName="WakaColorPickerForm";function sn(t){if(t===0)return"0 Bytes";const s=1024,a=["Bytes","KB","MB","GB"],n=Math.floor(Math.log(t)/Math.log(s));return`${parseFloat((t/Math.pow(s,n)).toFixed(2))} ${a[n]}`}function ob(t){const s=t.type;return s.startsWith("image/")?h.Image:s.includes("pdf")?h.FileText:s.includes("spreadsheet")||s.includes("excel")||s.includes("csv")?h.FileSpreadsheet:s.includes("zip")||s.includes("archive")||s.includes("compressed")?h.FileArchive:h.File}const uc=d.forwardRef(({variant:t="dropzone",accept:s,maxSize:a=10*1024*1024,maxFiles:n=5,multiple:r=!1,onUpload:o,onComplete:i,onRemove:c,onError:l,showPreview:u=!0,showProgress:f=!0,disabled:m=!1,className:p,placeholder:g="Glissez vos fichiers ici ou cliquez pour sélectionner",label:C,description:y},N)=>{const[v,x]=d.useState([]),[w,k]=d.useState(!1),D=d.useRef(null),S=()=>`${Date.now()}-${Math.random().toString(36).slice(2,11)}`,F=z=>a&&z.size>a?`Le fichier dépasse la taille maximale de ${sn(a)}`:s&&!s.split(",").map(R=>R.trim()).some(R=>R.startsWith(".")?z.name.toLowerCase().endsWith(R.toLowerCase()):R.endsWith("/*")?z.type.startsWith(R.replace("/*","/")):z.type===R)?`Type de fichier non accepté. Types acceptés: ${s}`:null,A=async z=>{const L=Array.from(z),_=v.filter(Q=>Q.status!=="error").length,R=n-_,U=L.slice(0,R);L.length>R&&l?.(`Nombre maximum de fichiers atteint (${n})`);const $=U.map(Q=>({id:S(),file:Q,progress:0,status:"pending"})),Z=[];for(const Q of $){const K=F(Q.file);K&&(Q.status="error",Q.error=K,l?.(K,Q.file)),Z.push(Q)}if(x(Q=>[...Q,...Z]),o)for(const Q of Z.filter(K=>K.status==="pending"))try{x(q=>q.map(W=>W.id===Q.id?{...W,status:"uploading"}:W));const K=await o(Q.file,q=>{x(W=>W.map(J=>J.id===Q.id?{...J,progress:q}:J))});x(q=>q.map(W=>W.id===Q.id?{...W,status:"success",progress:100,url:K}:W))}catch(K){const q=K instanceof Error?K.message:"Erreur d'upload";x(W=>W.map(J=>J.id===Q.id?{...J,status:"error",error:q}:J)),l?.(q,Q.file)}else x(Q=>Q.map(K=>Z.some(q=>q.id===K.id)&&K.status==="pending"?{...K,status:"success",progress:100}:K))};d.useEffect(()=>{v.length>0&&v.every(L=>L.status!=="pending"&&L.status!=="uploading")&&i?.(v)},[v,i]);const T=z=>{if(z.preventDefault(),k(!1),m)return;const L=z.dataTransfer.files;L.length>0&&A(r?L:[L[0]])},M=z=>{const L=z.target.files;L&&L.length>0&&A(r?L:[L[0]]),z.target.value=""},I=z=>{x(L=>L.filter(_=>_.id!==z.id)),c?.(z)},E=()=>{m||D.current?.click()},P=()=>e.jsx("div",{className:b.cn("relative border-2 border-dashed rounded-lg p-6 transition-colors",w&&"border-primary bg-primary/5",m&&"opacity-50 cursor-not-allowed",!m&&"cursor-pointer hover:border-primary/50",p),onDragOver:z=>{z.preventDefault(),m||k(!0)},onDragLeave:()=>k(!1),onDrop:T,onClick:E,children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[e.jsx(h.Upload,{className:b.cn("h-10 w-10 mb-3",w?"text-primary":"text-muted-foreground")}),e.jsx("p",{className:"text-sm font-medium",children:g}),y&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:y}),a&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Taille max: ",sn(a)]})]})}),G=()=>e.jsxs(j.Button,{variant:"outline",disabled:m,onClick:E,className:p,children:[e.jsx(h.Upload,{className:"h-4 w-4 mr-2"}),g||"Sélectionner un fichier"]}),H=()=>e.jsxs("div",{className:b.cn("flex items-center gap-2 p-2 border rounded-lg",m&&"opacity-50 cursor-not-allowed",!m&&"cursor-pointer hover:bg-muted/50",p),onClick:E,children:[e.jsx(h.Upload,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:g||"Ajouter un fichier"})]}),X=z=>{const L=ob(z.file),_=z.file.type.startsWith("image/");return e.jsxs("div",{className:b.cn("flex items-center gap-3 p-2 rounded-lg border",z.status==="error"&&"border-destructive bg-destructive/5"),children:[e.jsx("div",{className:"w-10 h-10 rounded flex items-center justify-center bg-muted overflow-hidden flex-shrink-0",children:u&&_&&z.status!=="error"?e.jsx("img",{src:URL.createObjectURL(z.file),alt:z.file.name,className:"w-full h-full object-cover"}):e.jsx(L,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:z.file.name}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:sn(z.file.size)}),z.status==="error"&&e.jsxs("span",{className:"text-destructive flex items-center gap-1",children:[e.jsx(h.AlertCircle,{className:"h-3 w-3"}),z.error]}),z.status==="success"&&e.jsxs("span",{className:"text-green-600 flex items-center gap-1",children:[e.jsx(h.Check,{className:"h-3 w-3"}),"Uploadé"]})]}),f&&z.status==="uploading"&&e.jsx(Es,{value:z.progress,className:"h-1 mt-1"})]}),e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 flex-shrink-0",onClick:R=>{R.stopPropagation(),I(z)},children:e.jsx(h.X,{className:"h-4 w-4"})})]},z.id)};return e.jsxs("div",{ref:N,className:"space-y-3",children:[C&&e.jsx(j.Label,{children:C}),e.jsx("input",{ref:D,type:"file",accept:s,multiple:r,onChange:M,className:"sr-only",disabled:m}),t==="dropzone"&&P(),t==="button"&&G(),t==="inline"&&H(),v.length>0&&e.jsx("div",{className:"space-y-2",children:v.map(X)})]})});uc.displayName="WakaFileUpload";const rr=d.forwardRef(({options:t,value:s,onChange:a,onSearch:n,multiple:r=!1,creatable:o=!1,onCreate:i,placeholder:c="Sélectionner...",emptyMessage:l="Aucun résultat.",loading:u=!1,disabled:f=!1,error:m,className:p,label:g,description:C,maxSelections:y,sortOptions:N=!1,searchDebounce:v=300},x)=>{const[w,k]=d.useState(!1),[D,S]=d.useState(""),[F,A]=d.useState(t),[T,M]=d.useState(!1),I=d.useRef();d.useEffect(()=>{n||A(t)},[t,n]);const E=d.useMemo(()=>s?Array.isArray(s)?s:[s]:[],[s]);d.useEffect(()=>{if(n){if(I.current&&clearTimeout(I.current),!D.trim()){A(t);return}return I.current=setTimeout(async()=>{M(!0);try{const U=await n(D);A(U)}catch{A([])}finally{M(!1)}},v),()=>{I.current&&clearTimeout(I.current)}}},[D,n,v,t]);const P=d.useMemo(()=>{let U=F;if(!n&&D.trim()){const $=D.toLowerCase();U=F.filter(Z=>Z.label.toLowerCase().includes($)||Z.value.toLowerCase().includes($))}return N&&(U=[...U].sort(($,Z)=>$.label.localeCompare(Z.label))),U},[F,D,n,N]),G=d.useMemo(()=>{const U={_ungrouped:[]};for(const $ of P){const Z=$.group||"_ungrouped";U[Z]||(U[Z]=[]),U[Z].push($)}return U},[P]),H=o&&D.trim()&&!F.some(U=>U.value.toLowerCase()===D.toLowerCase()),X=U=>{if(r){const $=E.includes(U)?E.filter(Z=>Z!==U):y&&E.length>=y?E:[...E,U];a?.($.length>0?$:null)}else a?.(U===s?null:U),k(!1);S("")},z=()=>{if(!D.trim())return;const U={value:D.trim(),label:D.trim()};A($=>[...$,U]),X(U.value),i?.(U.value)},L=(U,$)=>{$.stopPropagation();const Z=E.filter(Q=>Q!==U);a?.(Z.length>0?Z:null)},_=U=>F.find(Z=>Z.value===U)?.label||U,R=T||u;return e.jsxs("div",{className:b.cn("space-y-1.5",p),children:[g&&e.jsx(j.Label,{children:g}),C&&e.jsx("p",{className:"text-sm text-muted-foreground",children:C}),e.jsxs(j.Popover,{open:w,onOpenChange:k,children:[e.jsx(j.PopoverTrigger,{asChild:!0,children:e.jsxs(j.Button,{ref:x,variant:"outline",role:"combobox","aria-expanded":w,disabled:f,className:b.cn("w-full justify-between font-normal",!s&&"text-muted-foreground",m&&"border-destructive"),children:[r?e.jsx("div",{className:"flex flex-wrap gap-1 flex-1 min-w-0",children:E.length>0?E.map(U=>e.jsxs(ye,{variant:"secondary",className:"text-xs",children:[_(U),e.jsx("button",{className:"ml-1 hover:text-destructive",onClick:$=>L(U,$),children:e.jsx(h.X,{className:"h-3 w-3"})})]},U)):e.jsx("span",{children:c})}):e.jsx("span",{className:"truncate",children:s?_(s):c}),R?e.jsx(h.Loader2,{className:"ml-2 h-4 w-4 shrink-0 animate-spin"}):e.jsx(h.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(j.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(us,{shouldFilter:!1,children:[e.jsx(Ss,{placeholder:"Rechercher...",value:D,onValueChange:S}),e.jsxs(ua,{children:[R&&e.jsxs("div",{className:"py-6 text-center text-sm",children:[e.jsx(h.Loader2,{className:"h-4 w-4 animate-spin mx-auto mb-2"}),"Chargement..."]}),!R&&P.length===0&&!H&&e.jsx(Ds,{children:l}),H&&e.jsx(Jt,{children:e.jsxs(Zt,{onSelect:z,className:"cursor-pointer",children:[e.jsx(h.Plus,{className:"mr-2 h-4 w-4"}),'Créer "',D,'"']})}),Object.entries(G).map(([U,$])=>$.length===0?null:e.jsx(Jt,{heading:U!=="_ungrouped"?U:void 0,children:$.map(Z=>e.jsxs(Zt,{value:Z.value,onSelect:()=>X(Z.value),disabled:Z.disabled,className:"cursor-pointer",children:[e.jsx(h.Check,{className:b.cn("mr-2 h-4 w-4",E.includes(Z.value)?"opacity-100":"opacity-0")}),Z.label]},Z.value))},U))]})]})})]}),m&&e.jsx("p",{className:"text-sm text-destructive",children:m})]})});rr.displayName="WakaAutocomplete";const mc=d.forwardRef((t,s)=>e.jsx(rr,{ref:s,...t}));mc.displayName="WakaAutocompleteForm";const or=d.createContext(null);function ir(){const t=d.useContext(or);if(!t)throw new Error("useStepperContext must be used within a WakaStepper");return t}function mo({step:t,index:s,status:a}){const{variant:n,size:r}=ir(),o={sm:"h-6 w-6 text-xs",md:"h-8 w-8 text-sm",lg:"h-10 w-10 text-base"},i={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},c=b.cn("rounded-full flex items-center justify-center font-medium transition-all duration-200",o[r]),l={pending:"bg-muted text-muted-foreground border-2 border-muted",current:"bg-primary text-primary-foreground border-2 border-primary shadow-md",completed:"bg-primary text-primary-foreground border-2 border-primary",error:"bg-destructive text-destructive-foreground border-2 border-destructive"},u=()=>t.icon&&a==="current"?t.icon:a==="completed"?e.jsx(h.Check,{className:i[r]}):a==="error"?e.jsx(h.AlertCircle,{className:i[r]}):n==="simple"?e.jsx(h.Circle,{className:b.cn(i[r],a==="current"?"fill-current":"")}):e.jsx("span",{children:s+1});return e.jsx("div",{className:b.cn(c,l[a]),children:u()})}function ho({isCompleted:t,orientation:s}){const a=b.cn("transition-colors duration-300",s==="horizontal"?"flex-1 h-0.5 mx-2":"w-0.5 min-h-[24px] mx-auto my-1");return e.jsx("div",{className:b.cn(a,t?"bg-primary":"bg-muted")})}function ib({step:t,index:s,isLast:a}){const{currentStep:n,orientation:r,size:o,clickable:i,allowPrevious:c,goToStep:l,getStepStatus:u}=ir(),f=u(s),m=i&&!t.disabled&&(c?s<n:!0),p={sm:"text-xs",md:"text-sm",lg:"text-base"},g={sm:"text-[10px]",md:"text-xs",lg:"text-sm"},C=()=>{m&&l(s)};return r==="vertical"?e.jsxs("div",{className:"flex",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("button",{type:"button",onClick:C,disabled:!m,className:b.cn("flex items-center gap-3 text-left",m&&"cursor-pointer hover:opacity-80",!m&&"cursor-default"),children:e.jsx(mo,{step:t,index:s,status:f})}),!a&&e.jsx(ho,{isCompleted:f==="completed",orientation:"vertical"})]}),e.jsx("div",{className:"ml-3 pb-6",children:e.jsxs("button",{type:"button",onClick:C,disabled:!m,className:b.cn("text-left",m&&"cursor-pointer hover:opacity-80",!m&&"cursor-default"),children:[e.jsxs("p",{className:b.cn("font-medium",p[o],f==="current"?"text-foreground":"text-muted-foreground",t.disabled&&"opacity-50"),children:[t.title,t.optional&&e.jsx("span",{className:"ml-1 text-muted-foreground font-normal",children:"(Optionnel)"})]}),t.description&&e.jsx("p",{className:b.cn("text-muted-foreground mt-0.5",g[o]),children:t.description})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col items-center",children:e.jsxs("button",{type:"button",onClick:C,disabled:!m,className:b.cn("flex flex-col items-center gap-2",m&&"cursor-pointer hover:opacity-80",!m&&"cursor-default"),children:[e.jsx(mo,{step:t,index:s,status:f}),e.jsxs("div",{className:"text-center min-w-[80px] max-w-[120px]",children:[e.jsx("p",{className:b.cn("font-medium",p[o],f==="current"?"text-foreground":"text-muted-foreground",t.disabled&&"opacity-50"),children:t.title}),t.description&&e.jsx("p",{className:b.cn("text-muted-foreground mt-0.5 hidden sm:block",g[o]),children:t.description})]})]})}),!a&&e.jsx(ho,{isCompleted:f==="completed",orientation:"horizontal"})]})}function lb({steps:t,currentStep:s,onStepChange:a,orientation:n="horizontal",variant:r="default",size:o="md",clickable:i=!1,allowPrevious:c=!0,showContent:l=!1,className:u}){const f=d.useCallback(y=>y<s?"completed":y===s?"current":"pending",[s]),m=d.useCallback(y=>{y>=0&&y<t.length&&!t[y].disabled&&a?.(y)},[t,a]),p=d.useCallback(()=>{s<t.length-1&&m(s+1)},[s,t.length,m]),g=d.useCallback(()=>{s>0&&m(s-1)},[s,m]),C={currentStep:s,orientation:n,variant:r,size:o,clickable:i,allowPrevious:c,goToStep:m,nextStep:p,prevStep:g,getStepStatus:f};return e.jsx(or.Provider,{value:C,children:e.jsxs("div",{className:b.cn("w-full",u),children:[e.jsx("nav",{"aria-label":"Progress",className:b.cn(n==="horizontal"?"flex items-start justify-between":"flex flex-col"),children:t.map((y,N)=>e.jsx(ib,{step:y,index:N,isLast:N===t.length-1},y.id))}),l&&t[s]?.content&&e.jsx("div",{className:"mt-6 p-4 rounded-lg border bg-card",children:t[s].content})]})})}function cb({prevLabel:t="Précédent",nextLabel:s="Suivant",finishLabel:a="Terminer",onFinish:n,showCancel:r=!1,cancelLabel:o="Annuler",onCancel:i,disableNext:c=!1,className:l}){const u=d.useContext(or);if(!u)throw new Error("StepperNavigation must be used within a WakaStepper");const{currentStep:f,prevStep:m,nextStep:p}=u;return e.jsxs("div",{className:b.cn("flex items-center justify-between mt-6",l),children:[e.jsx("div",{className:"flex gap-2",children:r&&e.jsx("button",{type:"button",onClick:i,className:"px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",children:o})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:m,disabled:f===0,className:b.cn("px-4 py-2 text-sm font-medium rounded-md border transition-colors",f===0?"opacity-50 cursor-not-allowed":"hover:bg-muted"),children:t}),e.jsx("button",{type:"button",onClick:n||p,disabled:c,className:b.cn("px-4 py-2 text-sm font-medium rounded-md bg-primary text-primary-foreground transition-colors",c?"opacity-50 cursor-not-allowed":"hover:bg-primary/90"),children:n?a:s})]})]})}function fo({item:t,index:s,isLast:a,size:n,variant:r,showHomeIcon:o,renderLink:i,onItemClick:c}){const l={sm:"text-xs py-0.5 px-1.5",md:"text-sm py-1 px-2",lg:"text-base py-1.5 px-3"},u={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},f={default:a?"text-foreground font-medium":"text-muted-foreground hover:text-foreground",ghost:a?"text-foreground font-medium bg-muted rounded-md":"text-muted-foreground hover:text-foreground hover:bg-muted rounded-md",outline:a?"text-foreground font-medium border rounded-md":"text-muted-foreground hover:text-foreground hover:border-foreground border border-transparent rounded-md"},m=e.jsxs("span",{className:"flex items-center gap-1.5",children:[s===0&&o&&!t.icon&&e.jsx(h.Home,{className:u[n]}),t.icon&&e.jsx("span",{className:u[n],children:t.icon}),e.jsx("span",{className:"truncate max-w-[150px]",children:t.label})]}),p=b.cn("inline-flex items-center transition-colors",l[n],f[r],t.disabled&&"opacity-50 pointer-events-none"),g=C=>{c&&(C.preventDefault(),c(t,s))};return a||!t.href?e.jsx("span",{className:b.cn(p,"cursor-default"),"aria-current":a?"page":void 0,children:m}):i?i(t,e.jsx("span",{className:p,onClick:g,children:m})):e.jsx("a",{href:t.href,className:p,onClick:g,children:m})}function db({items:t,startIndex:s,size:a,renderLink:n,onItemClick:r}){const o={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"};return e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex items-center justify-center p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors","aria-label":"Afficher les éléments masqués",children:e.jsx(h.MoreHorizontal,{className:o[a]})})}),e.jsx(Ye,{align:"start",children:t.map((i,c)=>{const l=s+c,u=()=>{r?.(i,l)};return n&&i.href?e.jsx(Ne,{asChild:!0,children:n(i,e.jsxs("span",{className:"flex items-center gap-2 w-full",children:[i.icon,i.label]}))},l):e.jsxs(Ne,{onClick:u,disabled:i.disabled,children:[i.icon&&e.jsx("span",{className:"mr-2",children:i.icon}),i.label]},l)})})]})}function ub({items:t,separator:s,showHomeIcon:a=!1,maxItems:n,renderLink:r,onItemClick:o,size:i="md",variant:c="default",className:l}){const u={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},f=e.jsx(h.ChevronRight,{className:b.cn(u[i],"text-muted-foreground")}),m=()=>s??f,p=n&&t.length>n;let g,C=[],y=0;if(p&&n){const N=Math.max(n-2,1);g=[t[0],...t.slice(-N)],C=t.slice(1,-N),y=1}else g=t;return e.jsx("nav",{"aria-label":"Fil d'Ariane",className:b.cn("flex items-center",l),children:e.jsxs("ol",{className:"flex items-center flex-wrap gap-1",children:[g.length>0&&e.jsx("li",{className:"flex items-center",children:e.jsx(fo,{item:g[0],index:0,isLast:g.length===1&&!p,size:i,variant:c,showHomeIcon:a,renderLink:r,onItemClick:o})}),p&&C.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("li",{className:"flex items-center","aria-hidden":"true",children:m()}),e.jsx("li",{className:"flex items-center",children:e.jsx(db,{items:C,startIndex:y,size:i,renderLink:r,onItemClick:o})})]}),g.slice(1).map((N,v)=>{const x=p?t.length-(g.length-1-v):v+1;return e.jsxs(d.Fragment,{children:[e.jsx("li",{className:"flex items-center","aria-hidden":"true",children:m()}),e.jsx("li",{className:"flex items-center",children:e.jsx(fo,{item:N,index:x,isLast:x===t.length-1,size:i,variant:c,showHomeIcon:!1,renderLink:r,onItemClick:o})})]},x)})]})})}function mb(t,s){const{homeLabel:a="Accueil",labelMap:n={},excludePaths:r=[]}=s||{};return d.useMemo(()=>{const i=t.split("/").filter(Boolean).filter(u=>!r.includes(u)),c=[{label:a,href:"/"}];let l="";return i.forEach(u=>{l+=`/${u}`;const f=n[u]||u.charAt(0).toUpperCase()+u.slice(1).replace(/-/g," ");c.push({label:f,href:l})}),c},[t,a,n,r])}const hb={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-[calc(100vw-2rem)] max-h-[calc(100vh-2rem)]"},fb={fade:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",slide:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",scale:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",none:""},pb={fade:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",slide:"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]:slide-out-to-top-[2%] data-[state=open]:slide-in-from-top-[2%]",scale:"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",none:""},lr=d.forwardRef(({className:t,animation:s="fade",...a},n)=>e.jsx(xe.Overlay,{ref:n,className:b.cn("fixed inset-0 z-50 bg-black/80",fb[s],t),...a}));lr.displayName="ModalOverlay";const cr=d.forwardRef(({className:t,children:s,size:a="md",animation:n="fade",centered:r=!0,showCloseButton:o=!0,...i},c)=>e.jsxs(xe.Content,{ref:c,className:b.cn("fixed z-50 w-full bg-background shadow-lg sm:rounded-lg","left-1/2 -translate-x-1/2",r?"top-1/2 -translate-y-1/2":"top-[10%]",hb[a],pb[n],"duration-200",t),...i,children:[s,o&&e.jsxs(xe.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(h.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Fermer"})]})]}));cr.displayName="ModalContent";const dr=d.forwardRef(({className:t,sticky:s,...a},n)=>e.jsx("div",{ref:n,className:b.cn("flex flex-col space-y-1.5 p-6 pb-4",s&&"sticky top-0 bg-background z-10 border-b",t),...a}));dr.displayName="ModalHeader";const ur=d.forwardRef(({className:t,...s},a)=>e.jsx(xe.Title,{ref:a,className:b.cn("text-lg font-semibold leading-none tracking-tight",t),...s}));ur.displayName="ModalTitle";const mr=d.forwardRef(({className:t,...s},a)=>e.jsx(xe.Description,{ref:a,className:b.cn("text-sm text-muted-foreground",t),...s}));mr.displayName="ModalDescription";const hr=d.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b.cn("px-6 py-4 overflow-auto",t),...s}));hr.displayName="ModalBody";const fr=d.forwardRef(({className:t,sticky:s,...a},n)=>e.jsx("div",{ref:n,className:b.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 p-6 pt-4",s&&"sticky bottom-0 bg-background z-10 border-t",t),...a}));fr.displayName="ModalFooter";function xb({open:t,onOpenChange:s,title:a,description:n,children:r,size:o="md",showCloseButton:i=!0,closeOnOverlayClick:c=!0,closeOnEscape:l=!0,animation:u="scale",centered:f=!0,stickyHeader:m=!1,stickyFooter:p=!1,footer:g,className:C,overlayClassName:y}){const N=x=>{c||x.preventDefault()},v=x=>{l||x.preventDefault()};return e.jsx(xe.Root,{open:t,onOpenChange:s,children:e.jsxs(xe.Portal,{children:[e.jsx(lr,{animation:u,className:y}),e.jsxs(cr,{size:o,animation:u,centered:f,showCloseButton:i,className:C,onInteractOutside:N,onEscapeKeyDown:v,children:[(a||n)&&e.jsxs(dr,{sticky:m,children:[a&&e.jsx(ur,{children:a}),n&&e.jsx(mr,{children:n})]}),e.jsx(hr,{children:r}),g&&e.jsx(fr,{sticky:p,children:g})]})]})})}function gb({children:t,onOpen:s,className:a,disabled:n}){return e.jsx(xe.Trigger,{className:a,disabled:n,onClick:s,asChild:!0,children:t})}function bb(t){const{defaultOpen:s=!1,onOpenChange:a}=t||{},[n,r]=d.useState(s),o=d.useCallback(()=>{r(!0),a?.(!0)},[a]),i=d.useCallback(()=>{r(!1),a?.(!1)},[a]),c=d.useCallback(()=>{r(u=>{const f=!u;return a?.(f),f})},[a]),l=d.useCallback(u=>{r(u),a?.(u)},[a]);return{isOpen:n,open:o,close:i,toggle:c,onOpenChange:l}}const hc=d.createContext(null);function jb(){const t=d.useContext(hc);if(!t)throw new Error("useTreeContext must be used within a WakaTree");return t}function vb(t){const s=[];function a(n){for(const r of n)s.push(r.id),r.children&&a(r.children)}return a(t),s}function fc({node:t,level:s}){const{selectedIds:a,selectionMode:n,showCheckboxes:r,showIcons:o,draggable:i,size:c,toggleSelect:l,toggleExpand:u,isSelected:f,isExpanded:m,onDragStart:p,onDragOver:g,onDragLeave:C,onDrop:y,dragOverId:N,dragPosition:v}=jb(),x=t.children&&t.children.length>0,w=m(t.id),k=f(t.id),D={sm:"py-0.5 text-xs",md:"py-1 text-sm",lg:"py-1.5 text-base"},S={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},F=s*(c==="sm"?12:c==="md"?16:20),A=X=>{X.stopPropagation(),n!=="none"&&t.selectable!==!1&&!t.disabled&&l(t.id)},T=X=>{X.stopPropagation(),u(t.id)},M=X=>{i&&p(X,t.id)},I=X=>{i&&(X.preventDefault(),g(X,t.id))},E=X=>{i&&C(X)},P=X=>{if(!i)return;X.preventDefault();const z=X.currentTarget.getBoundingClientRect(),L=X.clientY-z.top,_=z.height;let R="inside";L<_*.25?R="before":L>_*.75&&(R="after"),y(X,t.id,R)},G=()=>t.icon?t.icon:o?x?w?e.jsx(h.FolderOpen,{className:b.cn(S[c],"text-amber-500")}):e.jsx(h.Folder,{className:b.cn(S[c],"text-amber-500")}):e.jsx(h.File,{className:b.cn(S[c],"text-muted-foreground")}):null,H=N===t.id;return e.jsxs("li",{role:"treeitem","aria-expanded":x?w:void 0,"aria-selected":k,children:[e.jsxs("div",{className:b.cn("flex items-center gap-1 rounded-md cursor-pointer transition-colors group",D[c],k&&"bg-primary/10 text-primary",!k&&"hover:bg-muted",t.disabled&&"opacity-50 cursor-not-allowed",H&&v==="before"&&"border-t-2 border-primary",H&&v==="after"&&"border-b-2 border-primary",H&&v==="inside"&&"bg-primary/20"),style:{paddingLeft:F},onClick:A,draggable:i&&!t.disabled,onDragStart:M,onDragOver:I,onDragLeave:E,onDrop:P,children:[i&&e.jsx(h.GripVertical,{className:b.cn(S[c],"text-muted-foreground opacity-0 group-hover:opacity-100 cursor-grab")}),e.jsx("button",{type:"button",onClick:T,className:b.cn("flex items-center justify-center rounded hover:bg-muted-foreground/10",!x&&"invisible"),tabIndex:-1,children:w?e.jsx(h.ChevronDown,{className:S[c]}):e.jsx(h.ChevronRight,{className:S[c]})}),r&&n!=="none"&&e.jsx(st,{checked:k,onCheckedChange:()=>l(t.id),disabled:t.disabled||t.selectable===!1,className:c==="sm"?"h-3 w-3":c==="lg"?"h-5 w-5":"h-4 w-4"}),G(),e.jsx("span",{className:"truncate flex-1",children:t.label})]}),x&&w&&e.jsx("ul",{role:"group",className:"list-none",children:t.children.map(X=>e.jsx(fc,{node:X,level:s+1},X.id))})]})}function yb({data:t,selectedIds:s,onSelect:a,expandedIds:n,onExpand:r,selectionMode:o="single",showCheckboxes:i=!1,showIcons:c=!0,draggable:l=!1,onDrop:u,size:f="md",className:m,defaultExpandAll:p=!1}){const[g,C]=d.useState([]),[y,N]=d.useState(()=>p?vb(t):[]),[v,x]=d.useState(null),[w,k]=d.useState(null),[D,S]=d.useState(null),F=s??g,A=n??y,T=d.useCallback(L=>{let _;o==="single"?_=F.includes(L)?[]:[L]:_=F.includes(L)?F.filter(R=>R!==L):[...F,L],a?a(_):C(_)},[F,o,a]),M=d.useCallback(L=>{const _=A.includes(L)?A.filter(R=>R!==L):[...A,L];r?r(_):N(_)},[A,r]),I=d.useCallback(L=>F.includes(L),[F]),E=d.useCallback(L=>A.includes(L),[A]),P=d.useCallback((L,_)=>{x(_),L.dataTransfer.effectAllowed="move",L.dataTransfer.setData("text/plain",_)},[]),G=d.useCallback((L,_)=>{if(v===_)return;const R=L.currentTarget.getBoundingClientRect(),U=L.clientY-R.top,$=R.height;let Z="inside";U<$*.25?Z="before":U>$*.75&&(Z="after"),k(_),S(Z)},[v]),H=d.useCallback(()=>{k(null),S(null)},[]),X=d.useCallback((L,_,R)=>{L.preventDefault(),v&&v!==_&&u&&u(v,_,R),x(null),k(null),S(null)},[v,u]),z={selectedIds:F,expandedIds:A,selectionMode:o,showCheckboxes:i,showIcons:c,draggable:l,size:f,toggleSelect:T,toggleExpand:M,isSelected:I,isExpanded:E,onDragStart:P,onDragOver:G,onDragLeave:H,onDrop:X,dragOverId:w,dragPosition:D};return e.jsx(hc.Provider,{value:z,children:e.jsx("ul",{role:"tree","aria-multiselectable":o==="multiple",className:b.cn("list-none",m),children:t.map(L=>e.jsx(fc,{node:L,level:0},L.id))})})}function pr(t,s){for(const a of t){if(a.id===s)return a;if(a.children){const n=pr(a.children,s);if(n)return n}}return null}function pc(t,s,a){return t.map(n=>n.id===s?{...n,...a}:n.children?{...n,children:pc(n.children,s,a)}:n)}function xr(t,s){return t.filter(a=>a.id!==s).map(a=>a.children?{...a,children:xr(a.children,s)}:a)}function gr(t,s,a){return t.map(n=>n.id===s?{...n,children:[...n.children||[],a]}:n.children?{...n,children:gr(n.children,s,a)}:n)}function wb(t,s,a,n){const r=pr(t,s);if(!r)return t;let o=xr(t,s);if(n==="inside")o=gr(o,a,r);else{const i=c=>{const l=[];for(const u of c)u.id===a?n==="before"?(l.push(r),l.push(u)):(l.push(u),l.push(r)):l.push({...u,children:u.children?i(u.children):void 0});return l};o=i(o)}return o}function Nb(t,s,a){if(s<=a)return Array.from({length:s},(o,i)=>i+1);const n=[],r=Math.floor((a-3)/2);if(n.push(1),t<=r+2){for(let o=2;o<=Math.min(a-1,s-1);o++)n.push(o);s>a&&n.push("ellipsis")}else if(t>=s-r-1){n.push("ellipsis");for(let o=Math.max(s-a+2,2);o<=s-1;o++)n.push(o)}else{n.push("ellipsis");for(let o=t-r;o<=t+r;o++)n.push(o);n.push("ellipsis")}return s>1&&n.push(s),n}function Cb({page:t,totalPages:s,onPageChange:a,pageSize:n=10,pageSizeOptions:r=[10,20,50,100],onPageSizeChange:o,totalItems:i,showPageSizeSelector:c=!1,showItemsInfo:l=!1,showFirstLast:u=!0,maxVisiblePages:f=7,size:m="md",variant:p="outline",className:g,labels:C={}}){const{page:y="Page",of:N="sur",items:v="éléments",itemsPerPage:x="par page",first:w="Première page",previous:k="Page précédente",next:D="Page suivante",last:S="Dernière page"}=C,F={sm:"h-7 w-7 text-xs",md:"h-8 w-8 text-sm",lg:"h-10 w-10 text-base"},A={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},T=Nb(t,s,f),M=P=>{P>=1&&P<=s&&P!==t&&a(P)},I=i?(t-1)*n+1:null,E=i?Math.min(t*n,i):null;return e.jsxs("nav",{role:"navigation","aria-label":"Pagination",className:b.cn("flex flex-wrap items-center gap-4 justify-between",g),children:[l&&i!==void 0&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:[I,"-",E," ",N," ",i," ",v]}),c&&o&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:[x,":"]}),e.jsxs(Be,{value:String(n),onValueChange:P=>o(Number(P)),children:[e.jsx(ze,{className:b.cn("w-[70px]",m==="sm"?"h-7":m==="lg"?"h-10":"h-8"),children:e.jsx(We,{})}),e.jsx(_e,{children:r.map(P=>e.jsx(ke,{value:String(P),children:P},P))})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[u&&e.jsx(j.Button,{variant:p,size:"icon",className:F[m],onClick:()=>M(1),disabled:t===1,"aria-label":w,children:e.jsx(h.ChevronsLeft,{className:A[m]})}),e.jsx(j.Button,{variant:p,size:"icon",className:F[m],onClick:()=>M(t-1),disabled:t===1,"aria-label":k,children:e.jsx(h.ChevronLeft,{className:A[m]})}),e.jsx("div",{className:"flex items-center gap-1",children:T.map((P,G)=>{if(P==="ellipsis")return e.jsx("span",{className:b.cn("flex items-center justify-center text-muted-foreground",F[m]),children:e.jsx(h.MoreHorizontal,{className:A[m]})},`ellipsis-${G}`);const H=P===t;return e.jsx(j.Button,{variant:H?"default":p,size:"icon",className:b.cn(F[m],H&&"pointer-events-none"),onClick:()=>M(P),"aria-label":`${y} ${P}`,"aria-current":H?"page":void 0,children:P},P)})}),e.jsx(j.Button,{variant:p,size:"icon",className:F[m],onClick:()=>M(t+1),disabled:t===s,"aria-label":D,children:e.jsx(h.ChevronRight,{className:A[m]})}),u&&e.jsx(j.Button,{variant:p,size:"icon",className:F[m],onClick:()=>M(s),disabled:t===s,"aria-label":S,children:e.jsx(h.ChevronsRight,{className:A[m]})})]}),!l&&s>0&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:[y," ",t," ",N," ",s]})]})}function kb({totalItems:t,initialPageSize:s=10,initialPage:a=1}){const[n,r]=d.useState(a),[o,i]=d.useState(s),c=Math.ceil(t/o);d.useEffect(()=>{n>c&&c>0&&r(c)},[n,c]);const l=y=>{i(y),r(1)},u=()=>{n<c&&r(n+1)},f=()=>{n>1&&r(n-1)},m=()=>r(1),p=()=>r(c),g=(n-1)*o,C=Math.min(g+o-1,t-1);return{page:n,pageSize:o,totalPages:c,setPage:r,setPageSize:l,nextPage:u,prevPage:f,firstPage:m,lastPage:p,canNextPage:n<c,canPrevPage:n>1,startIndex:g,endIndex:C}}function Ma(t){const s=t.split(":");return{hours:parseInt(s[0]||"0",10),minutes:parseInt(s[1]||"0",10),seconds:parseInt(s[2]||"0",10)}}function po(t,s,a,n){const r=t.toString().padStart(2,"0"),o=s.toString().padStart(2,"0"),i=a.toString().padStart(2,"0");return n?`${r}:${o}:${i}`:`${r}:${o}`}function Sb(t){const s=t>=12?"PM":"AM";let a=t%12;return a===0&&(a=12),{display:a,period:s}}function xo(t,s){return s==="AM"?t===12?0:t:t===12?12:t+12}function Db(t,s,a,n,r){const o=t*3600+s*60+a;if(n){const i=Ma(n),c=i.hours*3600+i.minutes*60+i.seconds;if(o<c)return!1}if(r){const i=Ma(r),c=i.hours*3600+i.minutes*60+i.seconds;if(o>c)return!1}return!0}function an({value:t,onChange:s,max:a,step:n=1,disabled:r,label:o}){const i=d.useMemo(()=>{const u=[];for(let f=0;f<a;f+=n)u.push(f);return u},[a,n]),c=()=>{const f=(i.indexOf(t)+1)%i.length;s(i[f])},l=()=>{const u=i.indexOf(t),f=u===0?i.length-1:u-1;s(i[f])};return e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:"text-xs text-muted-foreground mb-1",children:o}),e.jsx(j.Button,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-8",onClick:c,disabled:r,tabIndex:-1,children:e.jsx(h.ChevronUp,{className:"h-4 w-4"})}),e.jsx("div",{className:"h-10 w-12 flex items-center justify-center text-lg font-medium",children:t.toString().padStart(2,"0")}),e.jsx(j.Button,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-8",onClick:l,disabled:r,tabIndex:-1,children:e.jsx(h.ChevronDown,{className:"h-4 w-4"})})]})}function Tb({value:t,onChange:s,disabled:a}){return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(j.Button,{type:"button",variant:t==="AM"?"default":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>s("AM"),disabled:a,children:"AM"}),e.jsx(j.Button,{type:"button",variant:t==="PM"?"default":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>s("PM"),disabled:a,children:"PM"})]})}function Eb({value:t,onChange:s,placeholder:a="Sélectionner une heure",format:n="24h",showSeconds:r=!1,minuteStep:o=1,secondStep:i=1,minTime:c,maxTime:l,disabled:u=!1,error:f=!1,size:m="md",className:p,id:g,name:C}){const[y,N]=d.useState(!1),[v,x]=d.useState(t||""),w=t?Ma(t):{hours:0,minutes:0,seconds:0},[k,D]=d.useState(w.hours),[S,F]=d.useState(w.minutes),[A,T]=d.useState(w.seconds),[M,I]=d.useState(w.hours>=12?"PM":"AM");d.useEffect(()=>{if(t){const $=Ma(t);D($.hours),F($.minutes),T($.seconds),I($.hours>=12?"PM":"AM"),x(t)}},[t]);const E=d.useMemo(()=>{if(!t)return"";if(n==="12h"){const{display:$,period:Z}=Sb(k);return`${$.toString().padStart(2,"0")}:${S.toString().padStart(2,"0")}${r?`:${A.toString().padStart(2,"0")}`:""} ${Z}`}return po(k,S,A,r)},[t,k,S,A,n,r]),P=($,Z,Q)=>{if(!Db($,Z,Q,c,l))return;D($),F(Z),T(Q);const K=po($,Z,Q,r);s?.(K)},G=$=>{const Z=n==="12h"?xo($,M):$;P(Z,S,A)},H=$=>{P(k,$,A)},X=$=>{P(k,S,$)},z=$=>{I($);const Z=k%12||12,Q=xo(Z,$);P(Q,S,A)},L=$=>{const Z=$.target.value;x(Z);const Q=r?/^(\d{1,2}):(\d{2}):(\d{2})$/:/^(\d{1,2}):(\d{2})$/,K=Z.match(Q);if(K){const q=parseInt(K[1],10),W=parseInt(K[2],10),J=r?parseInt(K[3],10):0;q>=0&&q<24&&W>=0&&W<60&&J>=0&&J<60&&P(q,W,J)}},_={sm:"h-8 text-xs",md:"h-9 text-sm",lg:"h-10 text-base"},R={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},U=n==="12h"?k%12||12:k;return e.jsxs(j.Popover,{open:y,onOpenChange:N,children:[e.jsx(j.PopoverTrigger,{asChild:!0,children:e.jsxs("div",{className:b.cn("relative",p),children:[e.jsx(j.Input,{id:g,name:C,value:E,onChange:L,placeholder:a,disabled:u,className:b.cn(_[m],"pr-10",f&&"border-destructive focus-visible:ring-destructive")}),e.jsx(j.Button,{type:"button",variant:"ghost",size:"icon",className:b.cn("absolute right-0 top-0 h-full px-2",u&&"pointer-events-none opacity-50"),onClick:()=>!u&&N(!y),tabIndex:-1,children:e.jsx(h.Clock,{className:R[m]})})]})}),e.jsxs(j.PopoverContent,{className:"w-auto p-4",align:"start",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(an,{value:U,onChange:G,max:n==="12h"?13:24,disabled:u,label:"Heures"}),e.jsx("span",{className:"text-xl font-medium",children:":"}),e.jsx(an,{value:S,onChange:H,max:60,step:o,disabled:u,label:"Minutes"}),r&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xl font-medium",children:":"}),e.jsx(an,{value:A,onChange:X,max:60,step:i,disabled:u,label:"Secondes"})]}),n==="12h"&&e.jsx("div",{className:"ml-2",children:e.jsx(Tb,{value:M,onChange:z,disabled:u})})]}),e.jsxs("div",{className:"flex gap-2 mt-4 pt-4 border-t",children:[e.jsx(j.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>{const $=new Date;P($.getHours(),$.getMinutes(),$.getSeconds())},disabled:u,children:"Maintenant"}),e.jsx(j.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>P(0,0,0),disabled:u,children:"00:00"}),e.jsx(j.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>P(12,0,0),disabled:u,children:"12:00"})]})]})]})}function Pb(t={}){const{initialValue:s="",format:a="24h",showSeconds:n=!1}=t,[r,o]=d.useState(s);return{value:r,onChange:o,clear:()=>o(""),setNow:()=>{const l=new Date,u=l.getHours().toString().padStart(2,"0"),f=l.getMinutes().toString().padStart(2,"0"),m=l.getSeconds().toString().padStart(2,"0");o(n?`${u}:${f}:${m}`:`${u}:${f}`)},format:a,showSeconds:n}}const xc=[{label:"Aujourd'hui",getValue:()=>({from:V.startOfDay(new Date),to:V.endOfDay(new Date)})},{label:"Hier",getValue:()=>({from:V.startOfDay(V.subDays(new Date,1)),to:V.endOfDay(V.subDays(new Date,1))})},{label:"7 derniers jours",getValue:()=>({from:V.startOfDay(V.subDays(new Date,6)),to:V.endOfDay(new Date)})},{label:"30 derniers jours",getValue:()=>({from:V.startOfDay(V.subDays(new Date,29)),to:V.endOfDay(new Date)})},{label:"Ce mois",getValue:()=>({from:V.startOfMonth(new Date),to:V.endOfMonth(new Date)})},{label:"Mois dernier",getValue:()=>({from:V.startOfMonth(V.subMonths(new Date,1)),to:V.endOfMonth(V.subMonths(new Date,1))})},{label:"Cette année",getValue:()=>({from:V.startOfYear(new Date),to:V.endOfDay(new Date)})}];function Mb({value:t,onChange:s,placeholder:a="Sélectionner une période",dateFormat:n="dd/MM/yyyy",minDate:r,maxDate:o,disabled:i=!1,error:c=!1,showPresets:l=!0,presets:u=xc,numberOfMonths:f=2,locale:m=Ft,size:p="md",className:g,id:C,name:y,clearable:N=!0}){const[v,x]=d.useState(!1),[w,k]=d.useState(t);d.useEffect(()=>{k(t)},[t]);const D=E=>{k(E),s?.(E)},S=E=>{const P=E.getValue();D(P),x(!1)},F=E=>{E.stopPropagation(),D(void 0)},A=d.useMemo(()=>{if(!w?.from)return"";const E=V.format(w.from,n,{locale:m});if(!w.to)return E;const P=V.format(w.to,n,{locale:m});return`${E} - ${P}`},[w,n,m]),T={sm:"h-8 text-xs px-2",md:"h-9 text-sm px-3",lg:"h-10 text-base px-4"},M={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},I=d.useMemo(()=>{const E=[];return r&&E.push(P=>V.isBefore(P,V.startOfDay(r))),o&&E.push(P=>V.isAfter(P,V.endOfDay(o))),E.length>0?P=>E.some(G=>G(P)):void 0},[r,o]);return e.jsxs(j.Popover,{open:v,onOpenChange:x,children:[e.jsx(j.PopoverTrigger,{asChild:!0,children:e.jsxs(j.Button,{id:C,variant:"outline",role:"combobox","aria-expanded":v,disabled:i,className:b.cn("w-full justify-start font-normal",T[p],!A&&"text-muted-foreground",c&&"border-destructive focus-visible:ring-destructive",g),children:[e.jsx(h.Calendar,{className:b.cn(M[p],"mr-2")}),e.jsx("span",{className:"flex-1 text-left truncate",children:A||a}),N&&A&&!i&&e.jsx(h.X,{className:b.cn(M[p],"ml-2 opacity-50 hover:opacity-100"),onClick:F})]})}),e.jsxs(j.PopoverContent,{className:"w-auto p-0",align:"start",children:[e.jsxs("div",{className:"flex",children:[l&&u.length>0&&e.jsx("div",{className:"border-r p-2 space-y-1",children:u.map((E,P)=>e.jsx(j.Button,{variant:"ghost",size:"sm",className:"w-full justify-start text-xs",onClick:()=>S(E),children:E.label},P))}),e.jsx("div",{className:"p-3",children:e.jsx(Ra,{mode:"range",selected:w,onSelect:D,numberOfMonths:f,locale:m,disabled:I,initialFocus:!0})})]}),e.jsxs("div",{className:"border-t p-3 flex justify-between items-center",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:w?.from&&w?.to&&e.jsxs(e.Fragment,{children:[Math.ceil((w.to.getTime()-w.from.getTime())/(1e3*60*60*24))+1," ","jours sélectionnés"]})}),e.jsxs("div",{className:"flex gap-2",children:[N&&e.jsx(j.Button,{variant:"ghost",size:"sm",onClick:()=>D(void 0),children:"Effacer"}),e.jsx(j.Button,{size:"sm",onClick:()=>x(!1),children:"Appliquer"})]})]})]})]})}function Ab(t={}){const{initialValue:s,minDate:a,maxDate:n}=t,[r,o]=d.useState(s),i=()=>o(void 0),c=()=>{o({from:V.startOfDay(new Date),to:V.endOfDay(new Date)})},l=()=>{o({from:V.startOfDay(V.subDays(new Date,6)),to:V.endOfDay(new Date)})},u=()=>{o({from:V.startOfMonth(new Date),to:V.endOfMonth(new Date)})},f=p=>!(!p?.from||!p?.to||!V.isValid(p.from)||!V.isValid(p.to)||V.isAfter(p.from,p.to)||a&&V.isBefore(p.from,V.startOfDay(a))||n&&V.isAfter(p.to,V.endOfDay(n)));return{value:r,onChange:o,clear:i,setToday:c,setThisWeek:l,setThisMonth:u,isValidRange:()=>f(r),dayCount:!r?.from||!r?.to?null:Math.ceil((r.to.getTime()-r.from.getTime())/(1e3*60*60*24))+1,minDate:a,maxDate:n}}function Fb(t){const s=new Map;for(const a of t){const n=a.group;s.has(n)||s.set(n,[]),s.get(n).push(a)}return s}function Rb({options:t,value:s,onChange:a,placeholder:n="Sélectionner...",searchPlaceholder:r="Rechercher...",emptyMessage:o="Aucun résultat trouvé.",multiple:i=!1,creatable:c=!1,onCreate:l,createLabel:u="Créer",onSearch:f,searchDebounce:m=300,disabled:p=!1,error:g=!1,loading:C=!1,size:y="md",clearable:N=!0,maxSelections:v,className:x,id:w,name:k}){const[D,S]=d.useState(!1),[F,A]=d.useState(""),[T,M]=d.useState(t),[I,E]=d.useState(!1),[P,G]=d.useState([]),H=C||I;d.useEffect(()=>{f||M(t)},[t,f]),d.useEffect(()=>{if(!f)return;const B=setTimeout(async()=>{E(!0);try{const te=await f(F);M(te)}catch(te){console.error("Search error:",te)}finally{E(!1)}},m);return()=>clearTimeout(B)},[F,f,m]);const X=d.useMemo(()=>[...T,...P],[T,P]),z=d.useMemo(()=>{if(f||!F)return X;const B=F.toLowerCase();return X.filter(te=>te.label.toLowerCase().includes(B)||te.description?.toLowerCase().includes(B))},[X,F,f]),L=d.useMemo(()=>s===void 0?[]:Array.isArray(s)?s:[s],[s]),_=d.useMemo(()=>X.filter(B=>L.some(te=>te===B.value)),[X,L]),R=B=>{if(!B.disabled)if(i){const te=L.includes(B.value);let se;if(te)se=L.filter(ee=>ee!==B.value);else{if(v&&L.length>=v)return;se=[...L,B.value]}a?.(se.length>0?se:void 0)}else{const te=L.includes(B.value);a?.(te?void 0:B.value),S(!1)}},U=async()=>{if(!(!c||!F.trim())){E(!0);try{let B;l?B=await l(F.trim()):B={value:F.trim(),label:F.trim()},G(te=>[...te,B]),R(B),A("")}catch(B){console.error("Creation error:",B)}finally{E(!1)}}},$=B=>{B.stopPropagation(),a?.(void 0),A("")},Z=B=>{if(i){const te=L.filter(se=>se!==B);a?.(te.length>0?te:void 0)}},Q=d.useMemo(()=>{if(!c||!F.trim())return!1;const B=F.trim().toLowerCase();return!X.some(te=>te.label.toLowerCase()===B)},[c,F,X]),K=d.useMemo(()=>Fb(z),[z]),q=d.useMemo(()=>_.length===0?"":i?`${_.length} sélectionné${_.length>1?"s":""}`:_[0]?.label||"",[_,i]),W={sm:"h-8 text-xs",md:"h-9 text-sm",lg:"h-10 text-base"},J={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"};return e.jsxs(j.Popover,{open:D,onOpenChange:S,children:[e.jsx(j.PopoverTrigger,{asChild:!0,children:e.jsxs(j.Button,{id:w,variant:"outline",role:"combobox","aria-expanded":D,disabled:p,className:b.cn("w-full justify-between font-normal",W[y],!q&&"text-muted-foreground",g&&"border-destructive focus-visible:ring-destructive",x),children:[e.jsx("span",{className:"flex-1 text-left truncate",children:q||n}),e.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[H&&e.jsx(h.Loader2,{className:b.cn(J[y],"animate-spin")}),N&&L.length>0&&!p&&e.jsx(h.X,{className:b.cn(J[y],"opacity-50 hover:opacity-100"),onClick:$}),e.jsx(h.ChevronsUpDown,{className:b.cn(J[y],"opacity-50")})]})]})}),e.jsx(j.PopoverContent,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(us,{shouldFilter:!1,children:[e.jsx(Ss,{placeholder:r,value:F,onValueChange:A}),e.jsxs(ua,{children:[H&&e.jsx("div",{className:"flex items-center justify-center py-6",children:e.jsx(h.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!H&&z.length===0&&!Q&&e.jsx(Ds,{children:o}),!H&&Array.from(K.entries()).map(([B,te],se)=>e.jsxs(d.Fragment,{children:[se>0&&e.jsx(Ea,{}),e.jsx(Jt,{heading:B,children:te.map(ee=>{const le=L.includes(ee.value);return e.jsxs(Zt,{value:String(ee.value),onSelect:()=>R(ee),disabled:ee.disabled||i&&!!v&&L.length>=v&&!le,className:b.cn("flex items-center gap-2",ee.disabled&&"opacity-50"),children:[e.jsx("div",{className:b.cn("flex items-center justify-center w-4 h-4 border rounded",le?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30"),children:le&&e.jsx(h.Check,{className:"h-3 w-3"})}),ee.icon&&e.jsx("span",{className:"flex-shrink-0",children:ee.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"truncate",children:ee.label}),ee.description&&e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:ee.description})]})]},String(ee.value))})})]},B||"ungrouped")),Q&&e.jsxs(e.Fragment,{children:[e.jsx(Ea,{}),e.jsx(Jt,{children:e.jsxs(Zt,{onSelect:U,className:"flex items-center gap-2",children:[e.jsx(h.Plus,{className:J[y]}),e.jsxs("span",{children:[u,' "',F.trim(),'"']})]})})]})]})]})}),k&&e.jsx("input",{type:"hidden",name:k,value:i?L.join(","):String(L[0]||"")}),i&&_.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:_.map(B=>e.jsxs(ye,{variant:"secondary",className:"gap-1",children:[B.icon,B.label,e.jsx(h.X,{className:"h-3 w-3 cursor-pointer hover:text-destructive",onClick:()=>Z(B.value)})]},String(B.value)))})]})}function Ib(t={}){const{options:s=[],initialValue:a,multiple:n=!1}=t,[r,o]=d.useState(a),[i,c]=d.useState(s);return{value:r,onChange:o,options:i,setOptions:c,clear:()=>o(void 0),addOption:g=>{c(C=>[...C,g])},removeOption:g=>{c(C=>C.filter(y=>y.value!==g)),n&&Array.isArray(r)?o(r.filter(C=>C!==g)):r===g&&o(void 0)},selectAll:()=>{n&&o(i.filter(g=>!g.disabled).map(g=>g.value))},selectNone:()=>o(n?[]:void 0),multiple:n}}const Lb={left:{sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[480px]",full:"w-screen"},right:{sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[480px]",full:"w-screen"},top:{sm:"h-32",md:"h-48",lg:"h-64",xl:"h-96",full:"h-screen"},bottom:{sm:"h-32",md:"h-48",lg:"h-64",xl:"h-96",full:"h-screen"}},$b={left:"left-0 top-0 h-full",right:"right-0 top-0 h-full",top:"top-0 left-0 w-full",bottom:"bottom-0 left-0 w-full"},Ob={left:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left",right:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",top:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom"},br=d.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b.cn("flex flex-col space-y-1.5 p-4 border-b",t),...s}));br.displayName="DrawerHeader";const jr=d.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b.cn("flex-1 overflow-auto p-4",t),...s}));jr.displayName="DrawerBody";const vr=d.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b.cn("flex items-center justify-end gap-2 p-4 border-t",t),...s}));vr.displayName="DrawerFooter";const yr=d.forwardRef(({className:t,...s},a)=>e.jsx(xe.Title,{ref:a,className:b.cn("text-lg font-semibold leading-none tracking-tight",t),...s}));yr.displayName="DrawerTitle";const wr=d.forwardRef(({className:t,...s},a)=>e.jsx(xe.Description,{ref:a,className:b.cn("text-sm text-muted-foreground",t),...s}));wr.displayName="DrawerDescription";function zb({open:t,onOpenChange:s,position:a="right",size:n="md",title:r,description:o,showCloseButton:i=!0,closeOnOverlayClick:c=!0,closeOnEscape:l=!0,showOverlay:u=!0,children:f,footer:m,className:p,contentClassName:g}){const C=N=>{c||N.preventDefault()},y=N=>{l||N.preventDefault()};return e.jsx(xe.Root,{open:t,onOpenChange:s,children:e.jsxs(xe.Portal,{children:[u&&e.jsx(xe.Overlay,{className:b.cn("fixed inset-0 z-50 bg-black/50","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0")}),e.jsxs(xe.Content,{onPointerDownOutside:C,onEscapeKeyDown:y,className:b.cn("fixed z-50 bg-background shadow-lg flex flex-col","duration-300 ease-in-out",$b[a],Lb[a][n],Ob[a],p),children:[(r||o||i)&&e.jsx(br,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[r&&e.jsx(yr,{children:r}),o&&e.jsx(wr,{children:o})]}),i&&e.jsxs(xe.Close,{className:"rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[e.jsx(h.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Fermer"})]})]})}),e.jsx(jr,{className:g,children:f}),m&&e.jsx(vr,{children:m})]})]})})}function _b(t={}){const{defaultOpen:s=!1,onOpen:a,onClose:n}=t,[r,o]=d.useState(s),i=d.useCallback(f=>{o(f),f?a?.():n?.()},[a,n]),c=d.useCallback(()=>i(!0),[i]),l=d.useCallback(()=>i(!1),[i]),u=d.useCallback(()=>i(!r),[i,r]);return{open:r,onOpenChange:i,openDrawer:c,closeDrawer:l,toggleDrawer:u}}const Vb=xe.Trigger,Bb=xe.Close;function ta(t,s,a){let n=t;return s!==void 0&&n<s&&(n=s),a!==void 0&&n>a&&(n=a),n}function nn(t,s){const a=Math.pow(10,s);return Math.round(t*a)/a}function Wb({value:t,onChange:s,min:a,max:n,step:r=1,precision:o=0,placeholder:i="0",disabled:c=!1,error:l=!1,size:u="md",buttonPosition:f="sides",allowEmpty:m=!1,formatValue:p,parseValue:g,className:C,id:y,name:N}){const[v,x]=d.useState(t!==void 0?p?p(t):String(t):""),[w,k]=d.useState(!1);d.useEffect(()=>{w||x(t!==void 0?p?p(t):String(t):"")},[t,p,w]);const D=z=>{const L=z.target.value;if(x(L),L===""&&m){s?.(void 0);return}let _;if(g)_=g(L);else{const R=L.replace(",",".");_=parseFloat(R)}if(_!==void 0&&!isNaN(_)){const R=ta(nn(_,o),a,n);s?.(R)}},S=()=>{if(k(!1),t!==void 0)x(p?p(t):String(t));else if(!m){const z=a!==void 0?a:0;s?.(z),x(p?p(z):String(z))}},F=()=>{k(!0)},A=()=>{const L=ta(nn((t??(a!==void 0?a:0))+r,o),a,n);s?.(L)},T=()=>{const L=ta(nn((t??(a!==void 0?a:0))-r,o),a,n);s?.(L)},M=z=>{z.key==="ArrowUp"?(z.preventDefault(),A()):z.key==="ArrowDown"&&(z.preventDefault(),T())},I={sm:"h-8 text-xs",md:"h-9 text-sm",lg:"h-10 text-base"},E={sm:"h-8 w-8",md:"h-9 w-9",lg:"h-10 w-10"},P={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},G=n===void 0||(t??0)<n,H=a===void 0||(t??0)>a,X=(z,L)=>{const _=z==="increment",R=_?h.Plus:h.Minus,U=_?A:T,$=_?G:H;return e.jsx(j.Button,{type:"button",variant:"outline",size:"icon",className:b.cn(E[u],"flex-shrink-0",L==="left"&&"rounded-r-none border-r-0",L==="right"&&"rounded-l-none border-l-0"),onClick:U,disabled:c||!$,tabIndex:-1,"aria-label":_?"Augmenter":"Diminuer",children:e.jsx(R,{className:P[u]})})};return f==="none"?e.jsx(j.Input,{id:y,name:N,type:"text",inputMode:"decimal",value:v,onChange:D,onBlur:S,onFocus:F,onKeyDown:M,placeholder:i,disabled:c,className:b.cn(I[u],"text-center",l&&"border-destructive focus-visible:ring-destructive",C)}):f==="right"?e.jsxs("div",{className:b.cn("flex",C),children:[e.jsx(j.Input,{id:y,name:N,type:"text",inputMode:"decimal",value:v,onChange:D,onBlur:S,onFocus:F,onKeyDown:M,placeholder:i,disabled:c,className:b.cn(I[u],"rounded-r-none",l&&"border-destructive focus-visible:ring-destructive")}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx(j.Button,{type:"button",variant:"outline",size:"icon",className:b.cn("h-[50%] w-6 rounded-none rounded-tr-md border-l-0 border-b-0",u==="sm"&&"h-4",u==="lg"&&"h-5"),onClick:A,disabled:c||!G,tabIndex:-1,"aria-label":"Augmenter",children:e.jsx(h.Plus,{className:"h-2.5 w-2.5"})}),e.jsx(j.Button,{type:"button",variant:"outline",size:"icon",className:b.cn("h-[50%] w-6 rounded-none rounded-br-md border-l-0",u==="sm"&&"h-4",u==="lg"&&"h-5"),onClick:T,disabled:c||!H,tabIndex:-1,"aria-label":"Diminuer",children:e.jsx(h.Minus,{className:"h-2.5 w-2.5"})})]})]}):e.jsxs("div",{className:b.cn("flex",C),children:[X("decrement","left"),e.jsx(j.Input,{id:y,name:N,type:"text",inputMode:"decimal",value:v,onChange:D,onBlur:S,onFocus:F,onKeyDown:M,placeholder:i,disabled:c,className:b.cn(I[u],"rounded-none text-center",l&&"border-destructive focus-visible:ring-destructive")}),X("increment","right")]})}function qb(t={}){const{initialValue:s,min:a,max:n,step:r=1}=t,[o,i]=d.useState(s);return{value:o,onChange:i,increment:()=>{i(m=>ta((m??(a!==void 0?a:0))+r,a,n))},decrement:()=>{i(m=>ta((m??(a!==void 0?a:0))-r,a,n))},reset:()=>i(s),clear:()=>i(void 0),min:a,max:n,step:r}}function gc({src:t,alt:s,width:a,height:n,placeholder:r,placeholderColor:o="bg-muted",lazy:i=!0,zoomable:c=!1,maxZoom:l=3,objectFit:u="cover",objectPosition:f="center",rounded:m="md",showLoader:p=!0,onLoad:g,onError:C,onZoomChange:y,className:N,containerClassName:v}){const[x,w]=d.useState(!1),[k,D]=d.useState(!1),[S,F]=d.useState(!1),[A,T]=d.useState(1),[M,I]=d.useState({x:0,y:0}),[E,P]=d.useState(!1),[G,H]=d.useState({x:0,y:0}),X=d.useRef(null),z={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl",full:"rounded-full"},L=()=>{w(!0),g?.()},_=()=>{D(!0),C?.()},R=()=>{c&&(F(!0),T(1),I({x:0,y:0}))},U=()=>{const J=Math.min(A+.5,l);T(J),y?.(J)},$=()=>{const J=Math.max(A-.5,1);T(J),J===1&&I({x:0,y:0}),y?.(J)},Z=J=>{J.preventDefault(),J.deltaY<0?U():$()},Q=J=>{A>1&&(P(!0),H({x:J.clientX-M.x,y:J.clientY-M.y}))},K=J=>{E&&A>1&&I({x:J.clientX-G.x,y:J.clientY-G.y})},q=()=>{P(!1)},W=async()=>{try{const B=await(await fetch(t)).blob(),te=window.URL.createObjectURL(B),se=document.createElement("a");se.href=te,se.download=s||"image",document.body.appendChild(se),se.click(),document.body.removeChild(se),window.URL.revokeObjectURL(te)}catch(J){console.error("Failed to download image:",J)}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:b.cn("relative overflow-hidden",z[m],v),style:{width:a,height:n},children:[(!x||k)&&e.jsx("div",{className:b.cn("absolute inset-0 flex items-center justify-center",o,z[m]),children:r?e.jsx("img",{src:r,alt:"",className:b.cn("w-full h-full",`object-${u}`),style:{objectPosition:f}}):k?e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx(h.ImageIcon,{className:"h-8 w-8"}),e.jsx("span",{className:"text-xs",children:"Erreur de chargement"})]}):p?e.jsx("div",{className:"animate-pulse",children:e.jsx(h.ImageIcon,{className:"h-8 w-8 text-muted-foreground"})}):null}),!k&&e.jsx("img",{ref:X,src:t,alt:s,loading:i?"lazy":"eager",onLoad:L,onError:_,onClick:R,className:b.cn("w-full h-full transition-opacity duration-300",`object-${u}`,x?"opacity-100":"opacity-0",c&&"cursor-zoom-in",z[m],N),style:{objectPosition:f}}),c&&x&&!k&&e.jsx("div",{className:"absolute bottom-2 right-2 p-1 bg-black/50 rounded text-white",children:e.jsx(h.Maximize2,{className:"h-4 w-4"})})]}),c&&e.jsx(ds,{open:S,onOpenChange:F,children:e.jsxs(Kt,{className:"max-w-[95vw] max-h-[95vh] p-0 overflow-hidden bg-black/95",onWheel:Z,children:[e.jsxs("div",{className:"absolute top-4 right-4 z-50 flex gap-2",children:[e.jsx(j.Button,{variant:"secondary",size:"icon",onClick:$,disabled:A<=1,children:e.jsx(h.ZoomOut,{className:"h-4 w-4"})}),e.jsx(j.Button,{variant:"secondary",size:"icon",onClick:U,disabled:A>=l,children:e.jsx(h.ZoomIn,{className:"h-4 w-4"})}),e.jsx(j.Button,{variant:"secondary",size:"icon",onClick:W,children:e.jsx(h.Download,{className:"h-4 w-4"})}),e.jsx(Zo,{asChild:!0,children:e.jsx(j.Button,{variant:"secondary",size:"icon",children:e.jsx(h.X,{className:"h-4 w-4"})})})]}),e.jsxs("div",{className:"absolute bottom-4 left-4 z-50 text-white text-sm bg-black/50 px-2 py-1 rounded",children:[Math.round(A*100),"%"]}),e.jsx("div",{className:b.cn("w-full h-full flex items-center justify-center overflow-hidden",A>1?"cursor-grab":"cursor-default",E&&"cursor-grabbing"),onMouseDown:Q,onMouseMove:K,onMouseUp:q,onMouseLeave:q,children:e.jsx("img",{src:t,alt:s,className:"max-w-none select-none",style:{transform:`scale(${A}) translate(${M.x/A}px, ${M.y/A}px)`,transition:E?"none":"transform 0.2s ease-out"},draggable:!1})})]})})]})}function Ub({images:t,columns:s=3,gap:a=4,aspectRatio:n="1/1",className:r}){return e.jsx("div",{className:b.cn("grid",r),style:{gridTemplateColumns:`repeat(${s}, 1fr)`,gap:`${a*4}px`},children:t.map((o,i)=>e.jsx(gc,{src:o.thumbnail||o.src,alt:o.alt,zoomable:!0,objectFit:"cover",containerClassName:"w-full",aspectRatio:n},i))})}function Hb(t,s){const a=Math.max(21,Math.min(177,21+Math.floor(t.length/10)*4)),n=[];for(let r=0;r<a;r++){n[r]=[];for(let o=0;o<a;o++)if(r<7&&o<7||r<7&&o>=a-7||r>=a-7&&o<7){const c=r<7?r:r-(a-7),l=o<7?o:o>=a-7?o-(a-7):o;c===0||c===6||l===0||l===6||c>=2&&c<=4&&l>=2&&l<=4?n[r][o]=!0:n[r][o]=!1}else{const c=(t.charCodeAt((r*a+o)%t.length)||0)+r*31+o*17;n[r][o]=c%3===0}}return{modules:n,size:a}}function Gb({value:t,size:s=200,errorCorrectionLevel:a="M",fgColor:n="#000000",bgColor:r="#FFFFFF",includeMargin:o=!0,logoUrl:i,logoSize:c=.2,showActions:l=!1,className:u}){const f=d.useRef(null),[m,p]=d.useState(!1);d.useEffect(()=>{const y=f.current;if(!y||!t)return;const N=y.getContext("2d");if(!N)return;const v=Hb(t),x=o?4:0,w=s/(v.size+x*2);N.fillStyle=r,N.fillRect(0,0,s,s),N.fillStyle=n;for(let k=0;k<v.size;k++)for(let D=0;D<v.size;D++)v.modules[k][D]&&N.fillRect((D+x)*w,(k+x)*w,w,w);if(i){const k=new Image;k.crossOrigin="anonymous",k.onload=()=>{const D=s*c,S=(s-D)/2,F=(s-D)/2;N.fillStyle=r,N.fillRect(S-4,F-4,D+8,D+8),N.drawImage(k,S,F,D,D)},k.src=i}},[t,s,a,n,r,o,i,c]);const g=()=>{const y=f.current;if(!y)return;const N=document.createElement("a");N.download=`qrcode-${Date.now()}.png`,N.href=y.toDataURL("image/png"),N.click()},C=async()=>{const y=f.current;if(y)try{const N=await new Promise(v=>{y.toBlob(x=>{x&&v(x)},"image/png")});await navigator.clipboard.write([new ClipboardItem({"image/png":N})]),p(!0),setTimeout(()=>p(!1),2e3)}catch(N){console.error("Failed to copy QR code:",N)}};return e.jsxs("div",{className:b.cn("inline-flex flex-col items-center gap-2",u),children:[e.jsx("canvas",{ref:f,width:s,height:s,className:"rounded-lg",style:{width:s,height:s}}),l&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(j.Button,{variant:"outline",size:"sm",onClick:g,children:[e.jsx(h.Download,{className:"h-4 w-4 mr-1"}),"Télécharger"]}),e.jsxs(j.Button,{variant:"outline",size:"sm",onClick:C,children:[m?e.jsx(h.Check,{className:"h-4 w-4 mr-1"}):e.jsx(h.Copy,{className:"h-4 w-4 mr-1"}),m?"Copié":"Copier"]})]})]})}function Xb(t=""){const[s,a]=d.useState(t);return{value:s,setValue:a,props:{value:s}}}const go={" ":"11011001100","!":"11001101100",'"':"11001100110","#":"10010011000",$:"10010001100","%":"10001001100","&":"10011001000","'":"10011000100","(":"10001100100",")":"11001001000","*":"11001000100","+":"11000100100",",":"10110011100","-":"10011011100",".":"10011001110","/":"10111001100",0:"10011101100",1:"10011100110",2:"11001110010",3:"11001011100",4:"11001001110",5:"11011100100",6:"11001110100",7:"11101101110",8:"11101001100",9:"11100101100",":":"11100100110",";":"11101100100","<":"11100110100","=":"11100110010",">":"11011011000","?":"11011000110","@":"11000110110",A:"10100011000",B:"10001011000",C:"10001000110",D:"10110001000",E:"10001101000",F:"10001100010",G:"11010001000",H:"11000101000",I:"11000100010",J:"10110111000",K:"10110001110",L:"10001101110",M:"10111011000",N:"10111000110",O:"10001110110",P:"11101110110",Q:"11010001110",R:"11000101110",S:"11011101000",T:"11011100010",U:"11011101110",V:"11101011000",W:"11101000110",X:"11100010110",Y:"11101101000",Z:"11101100010"},bo="11010000100",Yb="1100011101011";function rn(t){let s=bo;for(const a of t.toUpperCase()){const n=go[a];n?s+=n:s+=go["?"]}return s+=bo,s+=Yb,s}const on={0:"101001101101",1:"110100101011",2:"101100101011",3:"110110010101",4:"101001101011",5:"110100110101",6:"101100110101",7:"101001011011",8:"110100101101",9:"101100101101",A:"110101001011",B:"101101001011",C:"110110100101",D:"101011001011",E:"110101100101",F:"101101100101",G:"101010011011",H:"110101001101",I:"101101001101",J:"101011001101",K:"110101010011",L:"101101010011",M:"110110101001",N:"101011010011",O:"110101101001",P:"101101101001",Q:"101010110011",R:"110101011001",S:"101101011001",T:"101011011001",U:"110010101011",V:"100110101011",W:"110011010101",X:"100101101011",Y:"110010110101",Z:"100110110101","-":"100101011011",".":"110010101101"," ":"100110101101","*":"100101101101"};function Qb(t){let s=on["*"]+"0";for(const a of t.toUpperCase()){const n=on[a];n&&(s+=n+"0")}return s+=on["*"],s}function Kb(t,s){switch(s){case"CODE128":return rn(t);case"CODE39":return Qb(t);case"EAN13":case"EAN8":case"UPC":case"ITF14":return rn(t);default:return rn(t)}}function Jb({value:t,format:s="CODE128",width:a=200,height:n=80,displayValue:r=!0,lineColor:o="#000000",background:i="#FFFFFF",fontSize:c=14,margin:l=10,showActions:u=!1,className:f}){const m=d.useRef(null),[p,g]=d.useState(!1);d.useEffect(()=>{const N=m.current;if(!N||!t)return;const v=N.getContext("2d");if(!v)return;const x=Kb(t,s),w=r?c+4:0,k=n-w-l*2,D=(a-l*2)/x.length;v.fillStyle=i,v.fillRect(0,0,a,n),v.fillStyle=o;for(let S=0;S<x.length;S++)x[S]==="1"&&v.fillRect(l+S*D,l,D,k);r&&(v.fillStyle=o,v.font=`${c}px monospace`,v.textAlign="center",v.textBaseline="bottom",v.fillText(t,a/2,n-l+2))},[t,s,a,n,r,o,i,c,l]);const C=()=>{const N=m.current;if(!N)return;const v=document.createElement("a");v.download=`barcode-${t}-${Date.now()}.png`,v.href=N.toDataURL("image/png"),v.click()},y=async()=>{const N=m.current;if(N)try{const v=await new Promise(x=>{N.toBlob(w=>{w&&x(w)},"image/png")});await navigator.clipboard.write([new ClipboardItem({"image/png":v})]),g(!0),setTimeout(()=>g(!1),2e3)}catch(v){console.error("Failed to copy barcode:",v)}};return e.jsxs("div",{className:b.cn("inline-flex flex-col items-center gap-2",f),children:[e.jsx("canvas",{ref:m,width:a,height:n,className:"rounded border",style:{width:a,height:n}}),u&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(j.Button,{variant:"outline",size:"sm",onClick:C,children:[e.jsx(h.Download,{className:"h-4 w-4 mr-1"}),"Télécharger"]}),e.jsxs(j.Button,{variant:"outline",size:"sm",onClick:y,children:[p?e.jsx(h.Check,{className:"h-4 w-4 mr-1"}):e.jsx(h.Copy,{className:"h-4 w-4 mr-1"}),p?"Copié":"Copier"]})]})]})}function jo(t){const s=Math.floor(t/3600),a=Math.floor(t%3600/60),n=Math.floor(t%60);return s>0?`${s}:${a.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`:`${a}:${n.toString().padStart(2,"0")}`}function Zb({src:t,poster:s,autoPlay:a=!1,loop:n=!1,muted:r=!1,controls:o=!0,preload:i="metadata",width:c,height:l,aspectRatio:u="16/9",showFullscreen:f=!0,showPlaybackSpeed:m=!0,showQualitySelector:p=!1,playbackSpeeds:g=[.5,.75,1,1.25,1.5,2],onReady:C,onPlay:y,onPause:N,onEnded:v,onTimeUpdate:x,onError:w,className:k}){const D=d.useRef(null),S=d.useRef(null),[F,A]=d.useState(a),[T,M]=d.useState(r),[I,E]=d.useState(1),[P,G]=d.useState(0),[H,X]=d.useState(0),[z,L]=d.useState(!1),[_,R]=d.useState(!0),[U,$]=d.useState(!0),[Z,Q]=d.useState(1),[K,q]=d.useState(""),W=d.useRef(),J=d.useMemo(()=>typeof t=="string"?[{src:t,type:"video/mp4"}]:t,[t]);d.useEffect(()=>{J.length>0&&J[0].quality&&q(J[0].quality)},[J]);const B=()=>{const ce=D.current;ce&&(X(ce.duration),R(!1),C?.())},te=()=>{const ce=D.current;ce&&(G(ce.currentTime),x?.(ce.currentTime))},se=()=>{A(!0),y?.()},ee=()=>{A(!1),N?.()},le=()=>{A(!1),v?.()},Me=()=>{R(!1),w?.(new Error("Video failed to load"))},re=()=>{R(!0)},pe=()=>{R(!1)},je=()=>{const ce=D.current;ce&&(F?ce.pause():ce.play())},he=()=>{const ce=D.current;ce&&(ce.muted=!T,M(!T))},Qe=ce=>{const Y=D.current;if(!Y)return;const oe=ce[0];Y.volume=oe,E(oe),M(oe===0)},yt=ce=>{const Y=D.current;Y&&(Y.currentTime=ce[0],G(ce[0]))},tt=ce=>{const Y=D.current;Y&&(Y.currentTime=Math.max(0,Math.min(H,Y.currentTime+ce)))},wt=ce=>{const Y=D.current;Y&&(Y.playbackRate=ce,Q(ce))},Nt=ce=>{const Y=D.current;if(!Y)return;const oe=Y.currentTime;Y.src=ce.src,Y.currentTime=oe,q(ce.quality||""),F&&Y.play()},mt=async()=>{const ce=S.current;if(ce)try{document.fullscreenElement?(await document.exitFullscreen(),L(!1)):(await ce.requestFullscreen(),L(!0))}catch(Y){console.error("Fullscreen error:",Y)}},Rt=()=>{$(!0),W.current&&clearTimeout(W.current),F&&(W.current=setTimeout(()=>{$(!1)},3e3))};return d.useEffect(()=>()=>{W.current&&clearTimeout(W.current)},[]),d.useEffect(()=>{const ce=()=>{L(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",ce),()=>{document.removeEventListener("fullscreenchange",ce)}},[]),e.jsxs("div",{ref:S,className:b.cn("relative bg-black overflow-hidden group",k),style:{width:c,height:l,aspectRatio:l?void 0:u},onMouseMove:Rt,onMouseLeave:()=>F&&$(!1),children:[e.jsx("video",{ref:D,className:"w-full h-full",poster:s,autoPlay:a,loop:n,muted:r,preload:i,playsInline:!0,onLoadedMetadata:B,onTimeUpdate:te,onPlay:se,onPause:ee,onEnded:le,onError:Me,onWaiting:re,onCanPlay:pe,onClick:je,children:J.map((ce,Y)=>e.jsx("source",{src:ce.src,type:ce.type},Y))}),_&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:e.jsx(h.Loader2,{className:"h-10 w-10 text-white animate-spin"})}),!F&&!_&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30",children:e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-16 w-16 rounded-full bg-white/90 hover:bg-white text-black",onClick:je,children:e.jsx(h.Play,{className:"h-8 w-8 ml-1"})})}),o&&e.jsxs("div",{className:b.cn("absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent p-4 transition-opacity duration-300",U||!F?"opacity-100":"opacity-0"),children:[e.jsx(Pa,{value:[P],max:H||100,step:.1,onValueChange:yt,className:"mb-3"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",onClick:je,children:F?e.jsx(h.Pause,{className:"h-5 w-5"}):e.jsx(h.Play,{className:"h-5 w-5"})}),e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",onClick:()=>tt(-10),children:e.jsx(h.SkipBack,{className:"h-4 w-4"})}),e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",onClick:()=>tt(10),children:e.jsx(h.SkipForward,{className:"h-4 w-4"})}),e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",onClick:he,children:T||I===0?e.jsx(h.VolumeX,{className:"h-5 w-5"}):e.jsx(h.Volume2,{className:"h-5 w-5"})}),e.jsx(Pa,{value:[T?0:I],max:1,step:.1,onValueChange:Qe,className:"w-20"}),e.jsxs("span",{className:"text-white text-sm ml-2",children:[jo(P)," / ",jo(H)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[(m||p)&&e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",children:e.jsx(h.Settings,{className:"h-5 w-5"})})}),e.jsxs(Ye,{align:"end",children:[m&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:"Vitesse"}),g.map(ce=>e.jsxs(Ne,{onClick:()=>wt(ce),className:b.cn(Z===ce&&"bg-muted"),children:[ce,"x"]},ce))]}),p&&J.some(ce=>ce.quality)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-2 py-1 text-xs text-muted-foreground mt-2",children:"Qualité"}),J.filter(ce=>ce.quality).map((ce,Y)=>e.jsx(Ne,{onClick:()=>Nt(ce),className:b.cn(K===ce.quality&&"bg-muted"),children:ce.quality},Y))]})]})]}),f&&e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",onClick:mt,children:z?e.jsx(h.Minimize,{className:"h-5 w-5"}):e.jsx(h.Maximize,{className:"h-5 w-5"})})]})]})]})]})}function ej(t={}){const[s,a]=d.useState(t.autoPlay??!1),[n,r]=d.useState(t.muted??!1),[o,i]=d.useState(0),[c,l]=d.useState(0);return{isPlaying:s,isMuted:n,currentTime:o,duration:c,onPlay:()=>a(!0),onPause:()=>a(!1),onTimeUpdate:i,onReady:()=>{}}}function tj(t,s,a,n,r){return d.useMemo(()=>{const o=typeof s=="number";let i=0;const c=[];for(let m=0;m<t.length;m++){c.push(i);const p=o?s:s(t[m],m);i+=p}let l=0,u=t.length-1;if(o)l=Math.floor(n/s),u=Math.min(t.length-1,Math.ceil((n+a)/s));else{let m=0,p=t.length-1;for(;m<=p;){const g=Math.floor((m+p)/2);c[g]<n?m=g+1:p=g-1}l=Math.max(0,p);for(let g=l;g<t.length;g++){const C=c[g],y=o?s:s(t[g],g);if(C+y>n+a){u=g;break}}}l=Math.max(0,l-r),u=Math.min(t.length-1,u+r);const f=[];for(let m=l;m<=u;m++){const p=o?s:s(t[m],m);f.push({item:t[m],index:m,style:{position:"absolute",top:c[m],left:0,right:0,height:p}})}return{totalHeight:i,visibleItems:f,startIndex:l,endIndex:u}},[t,s,a,n,r])}function sj({items:t,itemHeight:s,height:a,width:n="100%",overscan:r=3,renderItem:o,onScroll:i,onEndReached:c,endReachedThreshold:l=200,isLoading:u=!1,loadingElement:f,emptyElement:m,className:p,innerClassName:g,scrollRef:C}){const y=d.useRef(null),N=C||y,[v,x]=d.useState(0),w=d.useRef(!1),{totalHeight:k,visibleItems:D}=tj(t,s,a,v,r),S=A=>{const T=A.currentTarget,M=T.scrollTop;if(x(M),i?.(M),c){const I=T.scrollHeight-T.scrollTop-T.clientHeight;I<l&&!w.current?(w.current=!0,c()):I>=l&&(w.current=!1)}},F=d.useCallback(A=>{N.current&&(N.current.scrollTop=A)},[N]);return d.useCallback((A,T="start")=>{const M=typeof s=="number";let I=0;if(M)I=A*s;else for(let P=0;P<A&&P<t.length;P++)I+=s(t[P],P);const E=M?s:s(t[A],A);T==="center"?I-=(a-E)/2:T==="end"&&(I-=a-E),F(Math.max(0,I))},[t,s,a,F]),t.length===0&&!u?e.jsx("div",{className:b.cn("flex items-center justify-center text-muted-foreground",p),style:{height:a,width:n},children:m||"Aucun élément"}):e.jsx("div",{ref:N,className:b.cn("overflow-auto",p),style:{height:a,width:n},onScroll:S,children:e.jsxs("div",{className:b.cn("relative",g),style:{height:k+(u?50:0)},children:[D.map(({item:A,index:T,style:M})=>e.jsx(d.Fragment,{children:o(A,T,M)},T)),u&&e.jsx("div",{className:"absolute left-0 right-0 flex items-center justify-center py-4",style:{top:k},children:f||e.jsx("div",{className:"text-muted-foreground text-sm",children:"Chargement..."})})]})})}function aj(t){const{itemCount:s,itemHeight:a,containerHeight:n,overscan:r=3}=t,[o,i]=d.useState(0),c=s*a,l=Math.max(0,Math.floor(o/a)-r),u=Math.min(s-1,Math.ceil((o+n)/a)+r),f=d.useMemo(()=>{const g=[];for(let C=l;C<=u;C++)g.push({index:C,start:C*a,size:a});return g},[l,u,a]);return{totalHeight:c,virtualItems:f,startIndex:l,endIndex:u,handleScroll:g=>{i(g.currentTarget.scrollTop)},scrollToIndex:g=>{i(g*a)},scrollTop:o}}function nj({options:t,value:s,onChange:a,size:n="md",variant:r="default",fullWidth:o=!1,disabled:i=!1,name:c,className:l}){const[u,f]=d.useState({}),m=d.useRef(null),p=d.useRef(new Map),g={sm:"h-7 text-xs px-2",md:"h-9 text-sm px-3",lg:"h-11 text-base px-4"},C={sm:"p-0.5",md:"p-1",lg:"p-1"},y={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"};d.useEffect(()=>{if(s===void 0)return;const x=p.current.get(s),w=m.current;if(x&&w){const k=w.getBoundingClientRect(),D=x.getBoundingClientRect();f({left:D.left-k.left,width:D.width,height:D.height})}},[s,t]);const N=x=>{i||a?.(x)},v=x=>w=>{w?p.current.set(x,w):p.current.delete(x)};return e.jsxs("div",{ref:m,role:"radiogroup",className:b.cn("relative inline-flex items-center bg-muted rounded-lg",C[n],o&&"w-full",i&&"opacity-50",l),children:[s!==void 0&&r==="default"&&e.jsx("div",{className:"absolute bg-background rounded-md shadow-sm transition-all duration-200 ease-out",style:u}),t.map(x=>{const w=x.value===s,k=i||x.disabled;return e.jsxs("button",{ref:v(x.value),type:"button",role:"radio","aria-checked":w,disabled:k,onClick:()=>N(x.value),className:b.cn("relative z-10 inline-flex items-center justify-center gap-1.5 font-medium transition-colors rounded-md",g[n],o&&"flex-1",r==="default"&&[w?"text-foreground":"text-muted-foreground hover:text-foreground"],r==="pills"&&[w?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-background/50"],k&&"cursor-not-allowed opacity-50"),children:[x.icon&&e.jsx("span",{className:y[n],children:x.icon}),x.label]},String(x.value))}),c&&e.jsx("input",{type:"hidden",name:c,value:String(s??"")})]})}function rj(t,s){const[a,n]=d.useState(s??t[0]?.value);return{value:a,onChange:n,selectNext:()=>{const u=(t.findIndex(m=>m.value===a)+1)%t.length,f=t[u];f.disabled||n(f.value)},selectPrevious:()=>{const l=t.findIndex(m=>m.value===a),u=l===0?t.length-1:l-1,f=t[u];f.disabled||n(f.value)},selectFirst:()=>{const l=t.find(u=>!u.disabled);l&&n(l.value)},selectLast:()=>{const l=[...t].reverse().find(u=>!u.disabled);l&&n(l.value)},options:t}}const oj={low:"bg-gray-100 text-gray-700 border-gray-200",medium:"bg-blue-100 text-blue-700 border-blue-200",high:"bg-orange-100 text-orange-700 border-orange-200",urgent:"bg-red-100 text-red-700 border-red-200"};function ij({card:t,columnId:s,onCardClick:a,onCardDelete:n,renderCard:r,onDragStart:o}){return r?e.jsx("div",{draggable:!0,onDragStart:i=>o(i,t.id,s),className:"cursor-grab active:cursor-grabbing",children:r(t,s)}):e.jsxs("div",{draggable:!0,onDragStart:i=>o(i,t.id,s),onClick:()=>a?.(t,s),className:b.cn("group bg-card border rounded-lg p-3 shadow-sm cursor-grab active:cursor-grabbing","hover:border-primary/50 hover:shadow-md transition-all duration-200"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[t.labels&&t.labels.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:t.labels.map(i=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-medium rounded",style:{backgroundColor:i.color+"20",color:i.color},children:i.name},i.id))}),e.jsx("h4",{className:"font-medium text-sm truncate",children:t.title}),t.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:t.description})]}),e.jsx(h.GripVertical,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]}),(t.priority||t.assignee||t.dueDate)&&e.jsxs("div",{className:"flex items-center justify-between mt-3 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t.priority&&e.jsx("span",{className:b.cn("px-1.5 py-0.5 text-[10px] font-medium rounded border",oj[t.priority]),children:t.priority}),t.dueDate&&e.jsx("span",{className:"text-[10px] text-muted-foreground",children:t.dueDate.toLocaleDateString()})]}),t.assignee&&e.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center text-[10px] font-medium",title:t.assignee.name,children:t.assignee.avatar?e.jsx("img",{src:t.assignee.avatar,alt:t.assignee.name,className:"h-full w-full rounded-full object-cover"}):t.assignee.name.charAt(0).toUpperCase()})]}),n&&e.jsx(j.Button,{variant:"ghost",size:"icon",className:"absolute top-1 right-1 h-6 w-6 opacity-0 group-hover:opacity-100",onClick:i=>{i.stopPropagation(),n(t.id,s)},children:e.jsx(h.X,{className:"h-3 w-3"})})]})}function lj({column:t,onCardMove:s,onCardAdd:a,onCardDelete:n,onCardClick:r,onColumnDelete:o,allowAddCard:i,allowColumnDrag:c,renderCard:l,draggedCard:u,setDraggedCard:f,onColumnDragStart:m}){const[p,g]=d.useState(!1),[C,y]=d.useState(""),[N,v]=d.useState(null),x=(T,M,I)=>{f({id:M,fromColumnId:I}),T.dataTransfer.effectAllowed="move"},w=(T,M)=>{T.preventDefault(),u&&v(M)},k=()=>{v(null)},D=(T,M)=>{T.preventDefault(),u&&s&&s(u.id,u.fromColumnId,t.id,M),f(null),v(null)},S=T=>{T.preventDefault(),u&&s&&s(u.id,u.fromColumnId,t.id,t.cards.length),f(null),v(null)},F=()=>{C.trim()&&a&&(a(t.id,{title:C.trim()}),y(""),g(!1))},A=t.limit!==void 0&&t.cards.length>=t.limit;return e.jsxs("div",{className:"flex flex-col bg-muted/50 rounded-lg min-w-[280px] max-w-[320px] h-full",onDragOver:T=>T.preventDefault(),onDrop:S,children:[e.jsxs("div",{className:b.cn("flex items-center justify-between p-3 border-b",c&&"cursor-grab active:cursor-grabbing"),draggable:c,onDragStart:T=>m(T,t.id),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t.color&&e.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:t.color}}),e.jsx("h3",{className:"font-semibold text-sm",children:t.title}),e.jsxs("span",{className:"text-xs text-muted-foreground bg-background px-1.5 py-0.5 rounded",children:[t.cards.length,t.limit&&`/${t.limit}`]})]}),o&&e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsx(Ye,{align:"end",children:e.jsx(Ne,{className:"text-destructive",onClick:()=>o(t.id),children:"Supprimer la colonne"})})]})]}),e.jsx(St,{className:"flex-1 p-2",children:e.jsxs("div",{className:"space-y-2",children:[t.cards.map((T,M)=>e.jsxs("div",{onDragOver:I=>w(I,M),onDragLeave:k,onDrop:I=>D(I,M),children:[N===M&&u&&e.jsx("div",{className:"h-1 bg-primary rounded mb-2"}),e.jsx(ij,{card:T,columnId:t.id,onCardClick:r,onCardDelete:n,renderCard:l,onDragStart:x})]},T.id)),u&&N===null&&e.jsx("div",{className:"h-20 border-2 border-dashed border-primary/30 rounded-lg",onDragOver:T=>{T.preventDefault(),v(t.cards.length)}})]})}),i&&e.jsx("div",{className:"p-2 border-t",children:p?e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Input,{value:C,onChange:T=>y(T.target.value),placeholder:"Titre de la carte...",autoFocus:!0,onKeyDown:T=>{T.key==="Enter"&&F(),T.key==="Escape"&&g(!1)}}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j.Button,{size:"sm",onClick:F,disabled:!C.trim(),children:"Ajouter"}),e.jsx(j.Button,{size:"sm",variant:"ghost",onClick:()=>g(!1),children:"Annuler"})]})]}):e.jsxs(j.Button,{variant:"ghost",className:"w-full justify-start text-muted-foreground",onClick:()=>g(!0),disabled:A,children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-1"}),"Ajouter une carte"]})})]})}function cj({columns:t,onCardMove:s,onColumnMove:a,onCardAdd:n,onCardDelete:r,onCardClick:o,onColumnAdd:i,onColumnDelete:c,allowAddCard:l=!0,allowAddColumn:u=!1,allowColumnDrag:f=!1,renderCard:m,height:p="100%",className:g}){const[C,y]=d.useState(null),[N,v]=d.useState(null),[x,w]=d.useState(!1),[k,D]=d.useState(""),S=(T,M)=>{f&&(v(M),T.dataTransfer.effectAllowed="move")},F=(T,M)=>{T.preventDefault(),N&&a&&a(N,M),v(null)},A=()=>{k.trim()&&i&&(i({title:k.trim()}),D(""),w(!1))};return e.jsxs("div",{className:b.cn("flex gap-4 overflow-x-auto p-4",g),style:{height:p},children:[t.map((T,M)=>e.jsx("div",{onDragOver:I=>I.preventDefault(),onDrop:I=>F(I,M),children:e.jsx(lj,{column:T,onCardMove:s,onCardAdd:n,onCardDelete:r,onCardClick:o,onColumnDelete:c,allowAddCard:l,allowColumnDrag:f,renderCard:m,draggedCard:C,setDraggedCard:y,onColumnDragStart:S})},T.id)),u&&e.jsx("div",{className:"min-w-[280px]",children:x?e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 space-y-2",children:[e.jsx(j.Input,{value:k,onChange:T=>D(T.target.value),placeholder:"Titre de la colonne...",autoFocus:!0,onKeyDown:T=>{T.key==="Enter"&&A(),T.key==="Escape"&&w(!1)}}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j.Button,{size:"sm",onClick:A,disabled:!k.trim(),children:"Ajouter"}),e.jsx(j.Button,{size:"sm",variant:"ghost",onClick:()=>w(!1),children:"Annuler"})]})]}):e.jsxs(j.Button,{variant:"outline",className:"w-full h-auto py-8 border-dashed",onClick:()=>w(!0),children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-2"}),"Ajouter une colonne"]})})]})}function dj(t){const[s,a]=d.useState(t);return{columns:s,setColumns:a,moveCard:(u,f,m,p)=>{a(g=>{const C=[...g],y=C.find(w=>w.id===f);if(!y)return g;const N=y.cards.findIndex(w=>w.id===u);if(N===-1)return g;const[v]=y.cards.splice(N,1),x=C.find(w=>w.id===m);return x?(x.cards.splice(p,0,v),C):g})},moveColumn:(u,f)=>{a(m=>{const p=[...m],g=p.findIndex(y=>y.id===u);if(g===-1)return m;const[C]=p.splice(g,1);return p.splice(f,0,C),p})},addCard:(u,f)=>{a(m=>m.map(p=>p.id===u?{...p,cards:[...p.cards,{id:`card-${Date.now()}`,title:f.title||"Nouvelle carte",...f}]}:p))},deleteCard:(u,f)=>{a(m=>m.map(p=>p.id===f?{...p,cards:p.cards.filter(g=>g.id!==u)}:p))},addColumn:u=>{a(f=>[...f,{id:`column-${Date.now()}`,title:u.title||"Nouvelle colonne",cards:[],...u}])},deleteColumn:u=>{a(f=>f.filter(m=>m.id!==u))}}}const bc={completed:{icon:h.Check,color:"text-green-600",bgColor:"bg-green-100"},current:{icon:h.Circle,color:"text-primary",bgColor:"bg-primary/10"},pending:{icon:h.Clock,color:"text-muted-foreground",bgColor:"bg-muted"},error:{icon:h.AlertCircle,color:"text-destructive",bgColor:"bg-destructive/10"}};function vo({status:t,icon:s,color:a,size:n}){const r=bc[t],o=r.icon,i={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10"},c={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"};return e.jsx("div",{className:b.cn("rounded-full flex items-center justify-center flex-shrink-0 border-2 border-background shadow-sm",i[n],a?"":r.bgColor),style:a?{backgroundColor:a+"20"}:void 0,children:s||e.jsx(o,{className:b.cn(c[n],a?"":r.color),style:a?{color:a}:void 0})})}function yo({item:t,isLast:s,size:a,showDate:n,dateFormat:r,collapsible:o,onItemClick:i,orientation:c,position:l}){const[u,f]=d.useState(!1),m=t.status||"pending",p={sm:{title:"text-sm",desc:"text-xs",date:"text-[10px]"},md:{title:"text-base",desc:"text-sm",date:"text-xs"},lg:{title:"text-lg",desc:"text-base",date:"text-sm"}},g=N=>(typeof N=="string"?new Date(N):N).toLocaleDateString("fr-FR",r||{day:"numeric",month:"short",year:"numeric"}),C=()=>{o&&t.content&&f(!u),i?.(t)};if(c==="horizontal")return e.jsxs("div",{className:"flex flex-col items-center flex-1 min-w-[120px]",children:[n&&t.date&&e.jsx("div",{className:b.cn("mb-2 text-muted-foreground",p[a].date),children:g(t.date)}),e.jsxs("div",{className:"flex items-center w-full",children:[e.jsx("div",{className:b.cn("flex-1 h-0.5",s?"":"bg-border"),style:m==="completed"?{backgroundColor:bc.completed.color.replace("text-","")}:void 0}),e.jsx(vo,{status:m,icon:t.icon,color:t.color,size:a}),e.jsx("div",{className:b.cn("flex-1 h-0.5",s?"":"bg-border")})]}),e.jsxs("div",{className:b.cn("mt-2 text-center",i&&"cursor-pointer hover:opacity-80"),onClick:C,children:[e.jsx("h4",{className:b.cn("font-medium",p[a].title),children:t.title}),t.description&&e.jsx("p",{className:b.cn("text-muted-foreground mt-0.5",p[a].desc),children:t.description})]})]});const y=l==="right";return e.jsxs("div",{className:b.cn("flex gap-4",y&&"flex-row-reverse"),children:[l!=="left"&&n&&t.date&&e.jsx("div",{className:b.cn("w-24 text-muted-foreground pt-1",p[a].date,y?"text-left":"text-right"),children:g(t.date)}),e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx(vo,{status:m,icon:t.icon,color:t.color,size:a}),!s&&e.jsx("div",{className:b.cn("w-0.5 flex-1 min-h-[24px] mt-1",m==="completed"?"bg-green-500":"bg-border")})]}),e.jsxs("div",{className:b.cn("flex-1 pb-8",y&&"text-right"),children:[l==="left"&&n&&t.date&&e.jsx("div",{className:b.cn("text-muted-foreground mb-1",p[a].date),children:g(t.date)}),e.jsxs("div",{className:b.cn("inline-block",(i||o&&t.content)&&"cursor-pointer hover:opacity-80"),onClick:C,children:[e.jsxs("h4",{className:b.cn("font-medium",p[a].title),children:[t.title,o&&t.content&&e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-5 w-5 ml-1",children:u?e.jsx(h.ChevronUp,{className:"h-3 w-3"}):e.jsx(h.ChevronDown,{className:"h-3 w-3"})})]}),t.description&&e.jsx("p",{className:b.cn("text-muted-foreground mt-0.5",p[a].desc),children:t.description})]}),o&&t.content&&u&&e.jsx("div",{className:"mt-3 p-3 bg-muted/50 rounded-lg",children:t.content})]})]})}function uj({items:t,orientation:s="vertical",linePosition:a="left",size:n="md",showDates:r=!0,dateFormat:o,collapsible:i=!1,alternate:c=!1,onItemClick:l,className:u}){return s==="horizontal"?e.jsx("div",{className:b.cn("flex items-start overflow-x-auto",u),children:t.map((f,m)=>e.jsx(yo,{item:f,isLast:m===t.length-1,size:n,showDate:r,dateFormat:o,collapsible:i,onItemClick:l,orientation:"horizontal",position:"left"},f.id))}):e.jsx("div",{className:b.cn("flex flex-col",a==="center"&&"items-center",u),children:t.map((f,m)=>{let p="left";return a==="center"&&c?p=m%2===0?"left":"right":a==="right"&&(p="right"),e.jsx(yo,{item:f,isLast:m===t.length-1,size:n,showDate:r,dateFormat:o,collapsible:i,onItemClick:l,orientation:"vertical",position:p},f.id)})})}const mj={default:{icon:"text-muted-foreground",bg:"bg-muted",gradient:"from-gray-500 to-gray-600"},primary:{icon:"text-primary",bg:"bg-primary/10",gradient:"from-primary to-primary/80"},success:{icon:"text-green-600",bg:"bg-green-100",gradient:"from-green-500 to-green-600"},warning:{icon:"text-yellow-600",bg:"bg-yellow-100",gradient:"from-yellow-500 to-yellow-600"},destructive:{icon:"text-destructive",bg:"bg-destructive/10",gradient:"from-destructive to-destructive/80"},blue:{icon:"text-blue-600",bg:"bg-blue-100",gradient:"from-blue-500 to-blue-600"},purple:{icon:"text-purple-600",bg:"bg-purple-100",gradient:"from-purple-500 to-purple-600"}};function wo({direction:t,value:s,text:a,invert:n,size:r}){const o=n?t==="down":t==="up",i=n?t==="up":t==="down",c={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},l={sm:"text-[10px]",md:"text-xs",lg:"text-sm"},u=t==="up"?h.TrendingUp:t==="down"?h.TrendingDown:h.Minus;return e.jsxs("div",{className:b.cn("flex items-center gap-1",l[r],o&&"text-green-600",i&&"text-destructive",t==="neutral"&&"text-muted-foreground"),children:[e.jsx(u,{className:c[r]}),s&&e.jsx("span",{className:"font-medium",children:s}),a&&e.jsx("span",{className:"text-muted-foreground",children:a})]})}function hj({size:t}){const s={sm:"h-5 w-16",md:"h-7 w-20",lg:"h-9 w-24"};return e.jsxs("div",{className:"animate-pulse",children:[e.jsx("div",{className:"h-3 w-16 bg-muted rounded mb-2"}),e.jsx("div",{className:b.cn("bg-muted rounded",s[t])})]})}function jc({label:t,value:s,description:a,icon:n,trend:r,trendValue:o,trendText:i,invertTrend:c=!1,variant:l="default",size:u="md",color:f="default",loading:m=!1,className:p}){const g=mj[f],y={sm:{container:"p-3",label:"text-xs",value:"text-xl",description:"text-[10px]",icon:"h-8 w-8",iconInner:"h-4 w-4"},md:{container:"p-4",label:"text-sm",value:"text-2xl",description:"text-xs",icon:"h-10 w-10",iconInner:"h-5 w-5"},lg:{container:"p-6",label:"text-base",value:"text-4xl",description:"text-sm",icon:"h-12 w-12",iconInner:"h-6 w-6"}}[u];return m?e.jsx("div",{className:b.cn(l==="card"&&"rounded-lg border bg-card shadow-sm",l==="gradient"&&"rounded-lg text-white",y.container,p),children:e.jsx(hj,{size:u})}):l==="minimal"?e.jsxs("div",{className:b.cn("flex flex-col",p),children:[e.jsx("span",{className:b.cn("text-muted-foreground",y.label),children:t}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:b.cn("font-bold tracking-tight",y.value),children:s}),r&&e.jsx(wo,{direction:r,value:o,text:i,invert:c,size:u})]}),a&&e.jsx("span",{className:b.cn("text-muted-foreground mt-1",y.description),children:a})]}):l==="gradient"?e.jsx("div",{className:b.cn("rounded-lg bg-gradient-to-br text-white",g.gradient,y.container,p),children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:b.cn("text-white/80",y.label),children:t}),e.jsx("p",{className:b.cn("font-bold mt-1",y.value),children:s}),a&&e.jsx("p",{className:b.cn("text-white/70 mt-1",y.description),children:a}),r&&e.jsxs("div",{className:"mt-2 flex items-center gap-1 text-white/90",children:[r==="up"&&e.jsx(h.ArrowUp,{className:y.iconInner}),r==="down"&&e.jsx(h.ArrowDown,{className:y.iconInner}),o&&e.jsx("span",{className:y.description,children:o}),i&&e.jsx("span",{className:b.cn("text-white/70",y.description),children:i})]})]}),n&&e.jsx("div",{className:"rounded-lg bg-white/20 p-2",children:e.jsx("div",{className:y.iconInner,children:n})})]})}):e.jsx("div",{className:b.cn(l==="card"&&"rounded-lg border bg-card shadow-sm",y.container,p),children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:b.cn("text-muted-foreground font-medium",y.label),children:t}),e.jsxs("div",{className:"flex items-baseline gap-2 mt-1",children:[e.jsx("span",{className:b.cn("font-bold tracking-tight",y.value),children:s}),r&&e.jsx(wo,{direction:r,value:o,text:i,invert:c,size:u})]}),a&&e.jsx("p",{className:b.cn("text-muted-foreground mt-1",y.description),children:a})]}),n&&e.jsx("div",{className:b.cn("rounded-lg flex items-center justify-center flex-shrink-0",y.icon,g.bg),children:e.jsx("div",{className:b.cn(y.iconInner,g.icon),children:n})})]})})}function vc({children:t,layout:s="row",columns:a=4,gap:n="md",className:r}){const o={sm:"gap-2",md:"gap-4",lg:"gap-6"},i={2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4"};return e.jsx("div",{className:b.cn(o[n],s==="row"&&"flex flex-wrap",s==="grid"&&b.cn("grid",i[a]),r),children:t})}function fj(t={}){const{initialValue:s=0,format:a,previousValue:n}=t,[r,o]=d.useState(s),i=a?a(r):r.toString(),c=d.useMemo(()=>n===void 0?"neutral":r>n?"up":r<n?"down":"neutral",[r,n]),l=d.useMemo(()=>{if(n===void 0||n===0)return;const u=(r-n)/n*100;return`${u>=0?"+":""}${u.toFixed(1)}%`},[r,n]);return{value:i,rawValue:r,setValue:o,trend:c,trendValue:l}}const yc=d.createContext(void 0);function wc({children:t,languages:s,defaultLanguage:a="fr",s3Config:n,onLanguageChange:r,onError:o,fetchHeaders:i={},fetchTimeout:c=1e4}){const{i18n:l}=pt.useTranslation(),[u,f]=d.useState(a),[m,p]=d.useState(!0),[g,C]=d.useState(new Set),[y,N]=d.useState(!1),[v,x]=d.useState(s),w=d.useRef(new Set);d.useEffect(()=>{w.current=g},[g]);const k=d.useCallback(async E=>{const P=new AbortController,G=setTimeout(()=>P.abort(),c);try{const H=await fetch(E,{signal:P.signal,headers:{Accept:"application/json","Cache-Control":"no-cache",...i}});if(clearTimeout(G),!H.ok)throw new Error(`HTTP ${H.status}: ${H.statusText}`);const X=await H.json();return ne.logger.debug(`Translations loaded from ${E}`),X}catch(H){throw clearTimeout(G),H}},[i,c]),D=d.useCallback(async E=>{const P=v.find(G=>G.code===E);if(P?.translations)return ne.logger.debug(`Using inline translations for "${E}"`),P.translations;if(P?.jsonUrl)try{return await k(P.jsonUrl)}catch(G){throw ne.handleError(G,{code:ne.ErrorCode.LANG_LOAD_FAILED,context:`LanguageProvider.loadTranslations(${E}) from ${P.jsonUrl}`,onError:o})}if(n){const{baseUrl:G,prefix:H="",extension:X="json"}=n,z=`${G.replace(/\/$/,"")}/${H}${E}.${X}`;try{return await k(z)}catch(L){throw ne.handleError(L,{code:ne.ErrorCode.LANG_LOAD_FAILED,context:`LanguageProvider.loadTranslations(${E}) from S3`,onError:o})}}return ne.logger.debug(`No translations available for "${E}"`),null},[v,n,k,o]),S=d.useCallback((E,P)=>{if(!l?.addResourceBundle){console.warn("[LanguageProvider] i18next not available");return}l.addResourceBundle(E,"translation",P,!0,!0),ne.logger.debug(`Translations added to i18next for "${E}"`)},[l]),F=d.useCallback(async(E,P,G=!0)=>{p(!0);try{x(H=>{const X=H.findIndex(L=>L.code===E),z={code:E,label:E.toUpperCase(),translations:P};if(X>=0){const L=[...H];return L[X]={...L[X],translations:P},L}return[...H,z]}),S(E,P),C(H=>new Set(H).add(E)),G&&(await l?.changeLanguage(E),f(E),typeof window<"u"&&localStorage.setItem("language",E),r?.(E)),ne.logger.debug(`Language "${E}" loaded from JSON`)}catch(H){throw ne.handleError(H,{code:ne.ErrorCode.LANG_LOAD_FAILED,context:`LanguageProvider.loadLanguageFromJSON(${E})`,onError:o})}finally{p(!1)}},[l,S,r,o]),A=d.useCallback(E=>{x(P=>{const G=P.findIndex(H=>H.code===E.code);if(G>=0){const H=[...P];return H[G]=E,H}return[...P,E]}),ne.logger.debug(`Language "${E.code}" added`)},[]),T=d.useCallback(async E=>{C(P=>{const G=new Set(P);return G.delete(E),G}),p(!0);try{const P=await D(E);P&&(S(E,P),C(G=>new Set(G).add(E))),ne.logger.debug(`Language "${E}" reloaded`)}catch(P){throw P}finally{p(!1)}},[D,S]),M=d.useCallback(async E=>{if(E!==u){if(!l?.changeLanguage){console.error("[LanguageProvider] i18next is not initialized");return}p(!0);try{if(!w.current.has(E)){ne.logger.debug(`Loading translations for "${E}"...`);const P=await D(E);P&&S(E,P),C(G=>new Set(G).add(E))}await l.changeLanguage(E),f(E),typeof window<"u"&&localStorage.setItem("language",E),r?.(E),ne.logger.debug(`Language changed to: ${E}`)}catch(P){throw ne.handleError(P,{code:ne.ErrorCode.LANG_LOAD_FAILED,context:`LanguageProvider.changeLanguage(${E})`,onError:o})}finally{p(!1)}}},[u,D,S,l,r,o]);d.useEffect(()=>{if(y||!l)return;(async()=>{try{const P=typeof window<"u"?localStorage.getItem("language"):null,G=P&&v.some(X=>X.code===P)?P:a;ne.logger.debug(`Initializing with language: ${G}`);const H=await D(G);H&&S(G,H),await l.changeLanguage(G),f(G),C(new Set([G])),N(!0),ne.logger.debug(`Initialized with ${G}`)}catch(P){console.error("[LanguageProvider] Error initializing:",P),N(!0)}finally{p(!1)}})()},[y,l,a,v,D,S]);const I={currentLanguage:u,languages:v,changeLanguage:M,isLoading:m,loadedLanguages:g,loadLanguageFromJSON:F,addLanguage:A,reloadLanguage:T};return e.jsx(yc.Provider,{value:I,children:t})}function Nr(){const t=d.useContext(yc);if(!t)throw new Error("useLanguage must be used within a LanguageProvider");return t}const Nc=d.createContext(void 0);function pj({children:t,config:s}){const{defaultTheme:a="light",storageKey:n="waka-ui-theme",themes:r,enableSystem:o=!0}=s||{},[i,c]=d.useState(a),[l,u]=d.useState(),[f,m]=d.useState([]),[p,g]=d.useState(!0),[C,y]=d.useState("fallback");d.useEffect(()=>{(()=>{if(g(!0),r&&r.length>0){const k=xj(r);m(k),y("config"),g(!1),ne.logger.debug("Using themes from config:",k.length);return}m([{id:"light",label:"Clair",previewColor:"#3b82f6"},{id:"dark",label:"Sombre",previewColor:"#1e293b"}]),y("fallback"),g(!1),ne.logger.debug("Using fallback themes")})()},[r]),d.useEffect(()=>{if(!o)return;const x=window.matchMedia("(prefers-color-scheme: dark)"),w=k=>{u(k.matches?"dark":"light")};return u(x.matches?"dark":"light"),x.addEventListener("change",w),()=>x.removeEventListener("change",w)},[o]),d.useEffect(()=>{if(f.length===0)return;const x=localStorage.getItem(n),w=f.map(k=>k.id);x&&w.includes(x)&&c(x)},[n,f]),d.useEffect(()=>{if(f.length===0)return;const x=document.documentElement,w=i==="system"&&l?l:i;f.forEach(k=>x.classList.remove(k.id)),x.classList.add(w),x.setAttribute("data-theme",w),process.env.NODE_ENV==="development"&&ne.logger.debug(`Theme applied: ${w}`)},[i,l,f]);const N=d.useCallback(x=>{const w=f.map(k=>k.id);if(!w.includes(x)&&x!=="system"){console.warn(`[WakaUI] Theme "${x}" is not in the list of available themes:`,w);return}c(x),localStorage.setItem(n,x)},[f,n]),v=d.useMemo(()=>({theme:i,setTheme:N,themes:f,systemTheme:l,isLoadingThemes:p,themesSource:C}),[i,N,f,l,p,C]);return e.jsx(Nc.Provider,{value:v,children:t})}function xj(t){return t.length===0?[]:typeof t[0]=="string"?t.map(s=>({id:s,label:gj(s),previewColor:bj(s)})):t}function gj(t){return t.split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function bj(t){return{light:"#3b82f6",dark:"#1e293b",forest:"#10b981",sunset:"#f59e0b",twilight:"#8b5cf6",monochrome:"#6b7280",perpetuity:"#ec4899"}[t]||"#3b82f6"}function jj(){const t=d.useContext(Nc);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}function vj({children:t,config:s}){const[a]=d.useState(()=>$t.createInstance()),[n,r]=d.useState(!1);return d.useEffect(()=>{(async()=>{try{const i={};if(s.language.languages)for(const l of s.language.languages)l.translations&&(i[l.code]={translation:l.translations});const c={...i,...s.language.resources||{}};await a.use(pt.initReactI18next).init({lng:s.language.defaultLanguage,fallbackLng:s.language.defaultLanguage,supportedLngs:s.language.supportedLanguages,resources:c,interpolation:{escapeValue:!1},react:{useSuspense:!1},debug:s.debug}),s.language.s3Config&&await yj(a,s.language.s3Config,s.language.supportedLanguages),r(!0),ne.logger.debug("i18n initialized successfully")}catch(i){ne.logger.error("Failed to initialize i18n:",i),r(!0)}})()},[a,s]),d.useEffect(()=>{if(!n)return;const o=s.language.storageKey||"waka-ui-language",i=localStorage.getItem(o);i&&s.language.supportedLanguages.includes(i)&&a.changeLanguage(i);const c=l=>{localStorage.setItem(o,l),ne.logger.debug(`Language changed to: ${l}`)};return a.on("languageChanged",c),()=>{a.off("languageChanged",c)}},[n,a,s]),n?e.jsx(pt.I18nextProvider,{i18n:a,children:e.jsx(wc,{languages:s.language.languages||[],defaultLanguage:s.language.defaultLanguage,s3Config:s.language.s3Config?{baseUrl:s.language.s3Config.bucketUrl,prefix:s.language.s3Config.translationsPath?`${s.language.s3Config.translationsPath}/`:"",extension:"json"}:void 0,children:e.jsx(yl,{themes:s.theme?.themes||[{id:"default",label:"Default"}],defaultTheme:s.theme?.defaultTheme||"default",enableDarkMode:s.theme?.enableSystem,fetchHeaders:s.theme?.fetchHeaders,fetchTimeout:s.theme?.fetchTimeout,children:t})})}):e.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading WakaUI..."})}async function yj(t,s,a){if(!s)return;const{bucketUrl:n,translationsPath:r="translations"}=s;try{await Promise.all(a.map(async o=>{try{const i=`${n}/${r}/${o}.json`,c=await fetch(i);if(!c.ok){console.warn(`[WakaUI] Failed to load translations for ${o} from S3`);return}const l=await c.json();t.addResourceBundle(o,"translation",l,!0,!0),ne.logger.debug(`Loaded translations for ${o} from S3`)}catch(i){ne.logger.warn(`Error loading translations for ${o}:`,i)}}))}catch(o){ne.logger.error("Error loading translations from S3:",o)}}function wj(){const{i18n:t,t:s}=pt.useTranslation(),a=Nr(),n=Bs();return{currentLanguage:t.language||a.currentLanguage,changeLanguage:async r=>{await a.changeLanguage(r),await t.changeLanguage(r)},languages:a.languages,isLanguageLoading:a.isLoading,currentTheme:n.currentTheme,changeTheme:n.changeTheme,themes:n.themes,isThemeLoading:n.isLoading,preloadTheme:n.preloadTheme,isThemeLoaded:n.isThemeLoaded,t:s}}const Cr=d.createContext(void 0);function Nj({children:t,initialSelection:s,onSelectionChange:a,persistKey:n="admincrumb-selection"}){const[r,o]=d.useState(()=>{if(typeof window<"u"&&n){const g=localStorage.getItem(n);if(g)try{return JSON.parse(g)}catch(C){console.error("Failed to parse stored admincrumb selection",C)}}return s||{}});d.useEffect(()=>{typeof window<"u"&&n&&localStorage.setItem(n,JSON.stringify(r))},[r,n]),d.useEffect(()=>{a?.(r)},[r,a]);const i=d.useCallback(g=>{o({partner:g,network:void 0,customer:void 0})},[]),c=d.useCallback(g=>{o(C=>({...C,network:g,customer:void 0}))},[]),l=d.useCallback(g=>{o(C=>({...C,customer:g}))},[]),u=d.useCallback(()=>{o({})},[]),f=d.useMemo(()=>!!(r.partner||r.network||r.customer),[r]),m=d.useCallback(()=>({...r.partner?.id&&{partnerId:r.partner.id},...r.network?.id&&{networkId:r.network.id},...r.customer?.id&&{customerId:r.customer.id}}),[r]),p=d.useMemo(()=>({selection:r,setPartner:i,setNetwork:c,setCustomer:l,reset:u,isFiltered:f,getFilterQuery:m}),[r,i,c,l,u,f,m]);return e.jsx(Cr.Provider,{value:p,children:t})}function Cj(){const t=d.useContext(Cr);if(!t)throw new Error("useAdmincrumbContext must be used within AdmincrumbProvider");return t}function kj(){return d.useContext(Cr)}const Sj={github:h.Github,twitter:h.Twitter,linkedin:h.Linkedin,email:h.Mail};function Dj({columns:t=[],socialLinks:s=[],copyright:a="© 2024 Tous droits réservés.",className:n}){return e.jsx("footer",{className:b.cn("bg-muted/40",n),children:e.jsxs("div",{className:"container mx-auto px-4 py-12",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-4",children:[t.map((r,o)=>e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:r.title}),e.jsx("ul",{className:"space-y-2",children:r.links.map((i,c)=>e.jsx("li",{children:e.jsx("a",{href:i.href,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:i.label})},c))})]},o)),s.length>0&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Suivez-nous"}),e.jsx("div",{className:"flex space-x-4",children:s.map((r,o)=>{const i=Sj[r.platform];return e.jsx(j.Button,{variant:"ghost",size:"icon",asChild:!0,className:"h-8 w-8",children:e.jsx("a",{href:r.url,target:"_blank",rel:"noopener noreferrer","aria-label":r.platform,children:e.jsx(i,{className:"h-4 w-4"})})},o)})})]})]}),e.jsx(j.Separator,{className:"my-8"}),e.jsxs("div",{className:"flex flex-col items-center justify-between space-y-4 md:flex-row md:space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:a}),e.jsxs("div",{className:"flex space-x-6",children:[e.jsx("a",{href:"/privacy",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Politique de confidentialité"}),e.jsx("a",{href:"/terms",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Conditions d'utilisation"})]})]})]})})}function Tj({items:t,defaultActiveId:s,variant:a="default",size:n="md",className:r,onTabChange:o}){const[i,c]=d.useState(s||t[0]?.id||""),l=m=>{c(m),o?.(m)},u={sm:"h-8 px-3 text-sm",md:"h-10 px-4 text-sm",lg:"h-12 px-6 text-base"},f={default:"bg-background",pills:"bg-muted rounded-full",underline:"bg-transparent border-b-2 border-transparent data-[state=active]:border-primary"};return e.jsx("div",{className:b.cn("w-full",r),children:e.jsxs(Vs,{value:i,onValueChange:l,children:[e.jsx(As,{className:b.cn("grid w-full",a==="pills"&&"grid-cols-auto",a!=="pills"&&`grid-cols-${t.length}`,f[a]),children:t.map(m=>e.jsx(Mt,{value:m.id,disabled:m.disabled,className:b.cn(u[n],a==="underline"&&"rounded-none border-b-2 border-transparent data-[state=active]:border-primary",a==="pills"&&"rounded-full"),children:m.label},m.id))}),t.map(m=>e.jsx(At,{value:m.id,className:"mt-6",children:m.content},m.id))]})})}function Ej({variant:t="dropdown",showFlags:s=!0,className:a}){const{currentLanguage:n,languages:r,changeLanguage:o,isLoading:i}=Nr(),c=r.find(l=>l.code===n);return t==="select"?e.jsxs(Be,{value:n,onValueChange:o,disabled:i,children:[e.jsx(ze,{className:b.cn("w-[180px]",a),children:e.jsxs(We,{children:[s&&c?.flagEmoji&&e.jsx("span",{className:"mr-2",children:c.flagEmoji}),c?.label]})}),e.jsx(_e,{children:r.map(l=>e.jsxs(ke,{value:l.code,children:[s&&l.flagEmoji&&e.jsx("span",{className:"mr-2",children:l.flagEmoji}),l.label]},l.code))})]}):e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(j.Button,{variant:"outline",size:"sm",className:b.cn("gap-2",a),disabled:i,children:[e.jsx(h.Globe,{className:"h-4 w-4"}),s&&c?.flagEmoji&&e.jsx("span",{children:c.flagEmoji}),c?.label]})}),e.jsx(Ye,{align:"end",children:r.map(l=>e.jsxs(Ne,{onClick:()=>o(l.code),className:"cursor-pointer",children:[s&&l.flagEmoji&&e.jsx("span",{className:"mr-2",children:l.flagEmoji}),l.label]},l.code))})]})}function Pj({children:t,header:s,sidebar:a,footer:n,collapsible:r=!1,className:o}){const[i,c]=d.useState(!1);return e.jsxs("div",{className:b.cn("min-h-screen bg-background",o),children:[s&&e.jsx("header",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsxs("div",{className:"container flex h-14 max-w-screen-2xl items-center",children:[r&&a&&e.jsxs(is,{open:i,onOpenChange:c,children:[e.jsx(Vn,{asChild:!0,children:e.jsxs(j.Button,{variant:"ghost",size:"icon",className:"md:hidden",children:[e.jsx(h.Menu,{className:"h-5 w-5"}),e.jsx("span",{className:"sr-only",children:"Ouvrir le menu"})]})}),e.jsx(Wt,{side:"left",className:"w-72 p-0",children:e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Navigation"}),e.jsx(j.Button,{variant:"ghost",size:"icon",onClick:()=>c(!1),children:e.jsx(h.X,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:a})]})})]}),s]})}),e.jsxs("div",{className:"flex",children:[a&&!r&&e.jsx("aside",{className:"hidden w-64 border-r bg-muted/40 md:block",children:e.jsx("div",{className:"h-full overflow-y-auto p-4",children:a})}),e.jsx("main",{className:"flex-1",children:e.jsx("div",{className:"container mx-auto p-4",children:t})})]}),n&&e.jsx("footer",{className:"border-t bg-muted/40",children:e.jsx("div",{className:"container mx-auto p-4",children:n})})]})}function Cc({config:t,onSubmit:s,onForgotPassword:a,onSignUp:n,onSSOGoogle:r,onSSOMicrosoft:o,onSSOApple:i,onSSOLinkedIn:c,onSSOGithub:l,onSSOFacebook:u,onSSOInstagram:f,onSSOFranceConnect:m,showSocialLogin:p=!1,className:g}){let C=!1;try{C=Bs().isDarkMode}catch{}const y=t?.theme_json?.dark_mode??C,[N,v]=d.useState({email:"",password:"",rememberMe:!1}),[x,w]=d.useState(!1),k=d.useMemo(()=>t?.assets?y?t.assets.theme_logo_dark:t.assets.theme_logo_light:null,[t?.assets,y]),D=d.useMemo(()=>t?.color_json?{"--login-primary":t.color_json.primary,"--login-secondary":t.color_json.secondary,"--login-accent":t.color_json.accent}:{},[t?.color_json]),S=d.useMemo(()=>{const M=[];if(!t?.signup_options)return p&&(l&&M.push({id:"github",label:"GitHub",icon:e.jsx(h.Github,{className:"h-4 w-4"}),onClick:l}),r&&M.push({id:"google",label:"Google",icon:e.jsx(h.Mail,{className:"h-4 w-4"}),onClick:r})),M;const I=t.signup_options;return I.allow_sso_google&&M.push({id:"google",label:"Google",icon:e.jsx(h.Mail,{className:"h-4 w-4"}),onClick:r}),I.allow_sso_microsoft&&M.push({id:"microsoft",label:"Microsoft",icon:e.jsx(h.Mail,{className:"h-4 w-4"}),onClick:o}),I.allow_sso_apple&&M.push({id:"apple",label:"Apple",icon:e.jsx(h.Apple,{className:"h-4 w-4"}),onClick:i}),I.allow_sso_linkedIn&&M.push({id:"linkedin",label:"LinkedIn",icon:e.jsx(h.Linkedin,{className:"h-4 w-4"}),onClick:c}),I.allow_sso_github&&M.push({id:"github",label:"GitHub",icon:e.jsx(h.Github,{className:"h-4 w-4"}),onClick:l}),I.allow_sso_facebook&&M.push({id:"facebook",label:"Facebook",icon:e.jsx(h.Facebook,{className:"h-4 w-4"}),onClick:u}),I.allow_sso_instagram&&M.push({id:"instagram",label:"Instagram",icon:e.jsx(h.Instagram,{className:"h-4 w-4"}),onClick:f}),I.allow_sso_france_connect&&M.push({id:"france-connect",label:"France Connect",icon:e.jsx(h.Mail,{className:"h-4 w-4"}),onClick:m}),M},[t?.signup_options,p,r,o,i,c,l,u,f,m]),F=t?.signup_options?.allow_login!==!1,A=async M=>{M.preventDefault(),w(!0);try{await s?.(N)}finally{w(!1)}},T=M=>I=>{v(E=>({...E,[M]:M==="rememberMe"?I.target.checked:I.target.value}))};return e.jsx("div",{className:b.cn("flex items-center justify-center p-4",g),style:D,children:e.jsxs(Ce,{className:"w-full max-w-md",children:[e.jsxs(Ve,{className:"space-y-1",children:[k&&e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:k,alt:t?.theme_json?.name||"Logo",className:"max-h-16 max-w-full object-contain"})}),e.jsx(Oe,{className:"text-2xl text-center",children:"Connexion"}),e.jsx(et,{className:"text-center",children:"Entrez vos identifiants pour accéder à votre compte"})]}),e.jsxs(Pe,{className:"space-y-4",children:[S.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:b.cn("grid gap-4",S.length===1?"grid-cols-1":"grid-cols-2"),children:S.map(M=>e.jsxs(j.Button,{variant:"outline",className:"w-full",onClick:M.onClick,type:"button",children:[M.icon,M.label]},M.id))}),F&&e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx(j.Separator,{className:"w-full"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Ou continuez avec"})})]})]}),F&&e.jsxs("form",{onSubmit:A,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{htmlFor:"email",children:"Email"}),e.jsx(j.Input,{id:"email",type:"email",placeholder:"votre@email.com",value:N.email,onChange:T("email"),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{htmlFor:"password",children:"Mot de passe"}),e.jsx(j.Input,{id:"password",type:"password",placeholder:"••••••••",value:N.password,onChange:T("password"),required:!0})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{id:"remember",type:"checkbox",checked:N.rememberMe,onChange:T("rememberMe"),className:"h-4 w-4 rounded border-gray-300"}),e.jsx(j.Label,{htmlFor:"remember",className:"text-sm",children:"Se souvenir de moi"})]}),a&&e.jsx(j.Button,{type:"button",variant:"link",className:"px-0 text-sm",onClick:a,children:"Mot de passe oublié ?"})]}),e.jsx(j.Button,{type:"submit",className:"w-full",disabled:x,style:t?.color_json?.primary?{backgroundColor:t.color_json.primary,color:t.color_json.secondary}:void 0,children:x?"Connexion...":"Se connecter"})]}),n&&e.jsxs("div",{className:"text-center text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Pas encore de compte ? "}),e.jsx(j.Button,{type:"button",variant:"link",className:"px-0 text-sm",onClick:n,children:"S'inscrire"})]}),t?.waka_powered&&e.jsx("div",{className:"text-center text-xs text-muted-foreground mt-4 pt-4 border-t",children:"Powered by Waka"})]})]})})}const kc=d.createContext(null);function Mj(){const t=d.useContext(kc);if(!t)throw new Error("Sidebar components must be used within WakaSidebar");return t}function Aj({config:t}){const s=t.component?t.component:e.jsxs("div",{className:"flex items-center gap-3",children:[t.src&&e.jsx("img",{src:t.src,alt:t.alt||"Logo",className:"h-8 w-auto object-contain"}),t.title&&e.jsx("span",{className:"text-lg font-bold tracking-wide",children:t.title})]});return t.href?e.jsx("a",{href:t.href,className:"block",onClick:t.onClick,children:s}):t.onClick?e.jsx("button",{type:"button",onClick:t.onClick,className:"block text-left",children:s}):e.jsx("div",{children:s})}function Sc({item:t,isChild:s=!1,renderItem:a}){const{activeId:n,setActiveId:r,expandedIds:o,toggleExpanded:i,isMobile:c,closeOnNavigate:l,onClose:u}=Mj(),f=t.children&&t.children.length>0,m=o.includes(t.id),p=n===t.id||t.active,g=()=>{t.disabled||(f?i(t.id):(r(t.id),t.onClick?.(),c&&l&&u()))};if(a)return e.jsx(e.Fragment,{children:a(t,s)});const C=e.jsxs("div",{className:b.cn("flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200","hover:bg-white/10",p&&!f&&"bg-sidebar-active text-sidebar-active-foreground",s&&"ml-6 text-[13px]",t.disabled&&"opacity-50 cursor-not-allowed"),children:[t.icon&&e.jsx("span",{className:b.cn("flex-shrink-0",s?"h-4 w-4":"h-5 w-5"),children:t.icon}),e.jsx("span",{className:"flex-1 truncate",children:t.label}),t.badge!==void 0&&e.jsx("span",{className:"ml-auto flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary px-1.5 text-[10px] font-semibold text-primary-foreground",children:t.badge}),f&&e.jsx(h.ChevronDown,{className:b.cn("h-4 w-4 transition-transform duration-200",m&&"rotate-180")})]});return f?e.jsxs(An,{open:m,onOpenChange:()=>i(t.id),children:[e.jsx(Fn,{asChild:!0,children:e.jsx("button",{type:"button",className:"w-full text-left",disabled:t.disabled,children:C})}),e.jsx(Rn,{className:"space-y-1 pt-1",children:t.children?.map(y=>e.jsx(Sc,{item:y,isChild:!0,renderItem:a},y.id))})]}):t.href?e.jsx("a",{href:t.href,onClick:y=>{if(t.disabled){y.preventDefault();return}g()},className:"block",children:C}):e.jsx("button",{type:"button",className:"w-full text-left",disabled:t.disabled,onClick:g,children:C})}function No({config:t}){const s=t.initials||t.name.split(" ").map(r=>r[0]).join("").slice(0,2).toUpperCase(),a=[{id:"profile",label:"Profil",icon:e.jsx(h.User,{className:"h-4 w-4"})},{id:"settings",label:"Paramètres",icon:e.jsx(h.Settings,{className:"h-4 w-4"})},{id:"logout",label:"Déconnexion",icon:e.jsx(h.LogOut,{className:"h-4 w-4"}),variant:"destructive"}],n=t.actions??a;return e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-lg p-2 text-left transition-colors hover:bg-white/10",children:[e.jsxs(Dt,{className:"h-10 w-10 border-2 border-sidebar-active",children:[e.jsx(Tt,{src:t.avatarUrl,alt:t.name}),e.jsx(Et,{className:"bg-sidebar-active text-sidebar-active-foreground text-sm font-medium",children:s})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.name}),t.email&&e.jsx("p",{className:"text-xs text-sidebar-foreground/70 truncate",children:t.email})]}),e.jsx(h.ChevronDown,{className:"h-4 w-4 flex-shrink-0 opacity-70"})]})}),e.jsx(Ye,{align:"end",className:"w-56",children:n.map((r,o)=>e.jsxs(d.Fragment,{children:[r.variant==="destructive"&&o>0&&e.jsx(dt,{}),e.jsx(Ne,{onClick:r.onClick,className:b.cn(r.variant==="destructive"&&"text-destructive focus:text-destructive"),asChild:!!r.href,children:r.href?e.jsxs("a",{href:r.href,className:"flex items-center gap-2",children:[r.icon,r.label]}):e.jsxs("span",{className:"flex items-center gap-2",children:[r.icon,r.label]})})]},r.id))})]})}function Fj({logo:t,menu:s,user:a,userPosition:n="bottom",header:r,footer:o,renderItem:i}){return e.jsxs("div",{className:"flex h-full flex-col",children:[t&&e.jsx("div",{className:"flex-shrink-0 p-4 pb-2",children:e.jsx(Aj,{config:t})}),r&&e.jsx("div",{className:"flex-shrink-0 px-4 py-2",children:r}),a&&n==="top"&&e.jsx("div",{className:"flex-shrink-0 px-3 py-2 border-b border-white/10",children:e.jsx(No,{config:a})}),e.jsx(St,{className:"flex-1 px-3 py-4",children:e.jsx("nav",{className:"space-y-1",children:s.map(c=>e.jsx(Sc,{item:c,renderItem:i},c.id))})}),o&&e.jsx("div",{className:"flex-shrink-0 px-4 py-2 border-t border-white/10",children:o}),a&&n==="bottom"&&e.jsx("div",{className:"flex-shrink-0 p-3 border-t border-white/10",children:e.jsx(No,{config:a})})]})}function Dc({logo:t,menu:s,user:a,width:n=260,mobileBreakpoint:r=768,open:o,onOpenChange:i,className:c,contentClassName:l,backgroundColor:u,textColor:f,activeColor:m,hoverColor:p,userPosition:g="bottom",showHamburger:C=!0,hamburgerPosition:y="left",renderItem:N,footer:v,header:x,position:w="fixed"}){const[k,D]=d.useState(!1),S=o!==void 0,F=S?o:k,A=S?i:D,[T,M]=d.useState(!1);d.useEffect(()=>{const R=()=>{M(window.innerWidth<r)};return R(),window.addEventListener("resize",R),()=>window.removeEventListener("resize",R)},[r]);const[I,E]=d.useState(()=>{const R=U=>{for(const $ of U){if($.active)return $.id;if($.children){const Z=R($.children);if(Z)return Z}}return null};return R(s)}),[P,G]=d.useState(()=>{const R=(U,$=[])=>{for(const Z of U){if(Z.active)return $;if(Z.children){const Q=R(Z.children,[...$,Z.id]);if(Q.length>$.length)return Q}}return[]};return R(s)}),H=d.useCallback(R=>{G(U=>U.includes(R)?U.filter($=>$!==R):[...U,R])},[]),X={activeId:I,setActiveId:E,expandedIds:P,toggleExpanded:H,isMobile:T,closeOnNavigate:!0,onClose:()=>A(!1)},z={"--sidebar-bg":u||"hsl(222 47% 11%)","--sidebar-text":f||"hsl(210 40% 96%)","--sidebar-active":m||"hsl(187 85% 43%)","--sidebar-active-foreground":"hsl(222 47% 11%)","--sidebar-hover":p||"rgba(255, 255, 255, 0.1)"},L=b.cn("bg-[var(--sidebar-bg)] text-[var(--sidebar-text)]","[&_.bg-sidebar-active]:bg-[var(--sidebar-active)]","[&_.text-sidebar-active-foreground]:text-[var(--sidebar-active-foreground)]","[&_.text-sidebar-foreground\\/70]:text-[var(--sidebar-text)]/70","[&_.border-sidebar-active]:border-[var(--sidebar-active)]",l),_=e.jsx(kc.Provider,{value:X,children:e.jsx("div",{className:b.cn("h-full",L),style:z,children:e.jsx(Fj,{logo:t,menu:s,user:a,userPosition:g,header:x,footer:v,renderItem:N})})});return e.jsxs(e.Fragment,{children:[C&&T&&e.jsxs(j.Button,{variant:"ghost",size:"icon",className:b.cn("fixed top-3 z-50",y==="left"?"left-3":"right-3"),onClick:()=>A(!0),children:[e.jsx(h.Menu,{className:"h-6 w-6"}),e.jsx("span",{className:"sr-only",children:"Ouvrir le menu"})]}),!T&&e.jsx("aside",{className:b.cn(w==="fixed"?"fixed left-0 top-0 h-screen z-40":"relative h-full",c),style:{width:n},children:_}),T&&e.jsx(is,{open:F,onOpenChange:A,children:e.jsx(Wt,{side:"left",className:b.cn("w-[280px] p-0 border-0",c),style:z,children:_})})]})}function Rj(){const[t,s]=d.useState(!1),a=d.useCallback(()=>s(!0),[]),n=d.useCallback(()=>s(!1),[]),r=d.useCallback(()=>s(o=>!o),[]);return{isOpen:t,setIsOpen:s,open:a,close:n,toggle:r}}function Ij({sidebar:t,children:s,sidebarWidth:a=260,className:n,contentClassName:r}){const[o,i]=d.useState(!1),c=t.mobileBreakpoint||768;return d.useEffect(()=>{const l=()=>i(window.innerWidth<c);return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[c]),e.jsxs("div",{className:b.cn("min-h-screen bg-background",n),children:[e.jsx(Dc,{...t,width:a}),e.jsx("main",{className:b.cn("min-h-screen transition-all duration-300",r),style:{marginLeft:o?0:a},children:s})]})}function Lj({title:t,subtitle:s,showSearch:a=!0,searchPlaceholder:n="Rechercher...",searchValue:r,onSearchChange:o,onSearchSubmit:i,primaryAction:c,secondaryActions:l,filters:u,notifications:f,unreadCount:m=0,onNotificationsClick:p,userMenu:g,leftContent:C,rightContent:y,filterContent:N,className:v,mainBarClassName:x,filterBarClassName:w,sticky:k=!0}){const[D,S]=d.useState(r||""),F=M=>{const I=M.target.value;S(I),o?.(I)},A=M=>{M.key==="Enter"&&i?.(D)},T=u&&u.length>0||N;return e.jsxs("header",{className:b.cn("w-full bg-background border-b",k&&"sticky top-0 z-50",v),children:[e.jsxs("div",{className:b.cn("flex items-center gap-4 px-4 py-2 min-h-[56px]",x),children:[e.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[c&&e.jsxs(j.Button,{variant:c.variant||"default",size:"sm",onClick:c.onClick,className:"gap-2",children:[c.icon||e.jsx(h.Plus,{className:"h-4 w-4"}),c.label]}),a&&e.jsxs("div",{className:"relative",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(j.Input,{type:"search",placeholder:n,value:D,onChange:F,onKeyDown:A,className:"pl-9 w-[200px] h-9 bg-muted/50"})]}),C]}),(t||s)&&e.jsxs("div",{className:"flex-1 text-center",children:[t&&e.jsx("h1",{className:"text-lg font-semibold leading-none",children:t}),s&&e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-auto",children:[l?.map(M=>e.jsxs(j.Button,{variant:M.variant||"ghost",size:"sm",onClick:M.onClick,className:"gap-2",children:[M.icon,M.label]},M.id)),y,(f||p)&&e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(j.Button,{variant:"ghost",size:"icon",className:"relative",onClick:f?void 0:p,children:[e.jsx(h.Bell,{className:"h-5 w-5"}),m>0&&e.jsx(ye,{variant:"destructive",className:"absolute -top-1 -right-1 h-5 w-5 p-0 flex items-center justify-center text-xs",children:m>9?"9+":m})]})}),f&&f.length>0&&e.jsxs(Ye,{align:"end",className:"w-80",children:[e.jsx("div",{className:"p-2 font-semibold border-b",children:"Notifications"}),f.slice(0,5).map(M=>e.jsxs(Ne,{onClick:M.onClick,className:b.cn("flex flex-col items-start gap-1 p-3",!M.read&&"bg-muted/50"),children:[e.jsx("div",{className:"font-medium",children:M.title}),M.description&&e.jsx("div",{className:"text-sm text-muted-foreground",children:M.description}),M.time&&e.jsx("div",{className:"text-xs text-muted-foreground",children:M.time})]},M.id))]})]}),g&&e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(j.Button,{variant:"ghost",size:"sm",className:"gap-2",children:[e.jsxs(Dt,{className:"h-7 w-7",children:[g.avatar&&e.jsx(Tt,{src:g.avatar,alt:g.name}),e.jsx(Et,{className:"text-xs",children:g.initials||g.name.slice(0,2).toUpperCase()})]}),e.jsx(h.ChevronDown,{className:"h-4 w-4"})]})}),e.jsxs(Ye,{align:"end",className:"w-56",children:[e.jsxs("div",{className:"p-2",children:[e.jsx("p",{className:"font-medium",children:g.name}),g.email&&e.jsx("p",{className:"text-sm text-muted-foreground",children:g.email})]}),e.jsx(dt,{}),g.items.map((M,I)=>M.separator?e.jsx(dt,{},I):e.jsxs(Ne,{onClick:M.onClick,children:[M.icon&&e.jsx("span",{className:"mr-2",children:M.icon}),M.label]},I))]})]})]})]}),T&&e.jsxs("div",{className:b.cn("flex items-center gap-2 px-4 py-2 border-t bg-muted/30",w),children:[u?.map(M=>e.jsxs(Be,{value:M.value,onValueChange:M.onChange,children:[e.jsxs(ze,{className:"w-auto h-8 gap-2 bg-muted/50 border-0",children:[M.icon,e.jsx(We,{placeholder:M.placeholder||M.label})]}),e.jsx(_e,{children:M.options.map(I=>e.jsx(ke,{value:I.value,children:I.label},I.value))})]},M.id)),N]})]})}function $j({title:t="Tableau de bord",description:s,period:a,onPeriodChange:n,periods:r=[{value:"today",label:"Aujourd'hui"},{value:"week",label:"Cette semaine"},{value:"month",label:"Ce mois"},{value:"year",label:"Cette année"}],onRefresh:o,loading:i,quickActions:c}){return e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:t}),s&&e.jsx("p",{className:"text-muted-foreground mt-1",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n&&e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(j.Button,{variant:"outline",size:"sm",children:[e.jsx(h.Calendar,{className:"mr-2 h-4 w-4"}),r.find(l=>l.value===a)?.label||"Période"]})}),e.jsx(Ye,{align:"end",children:r.map(l=>e.jsx(Ne,{onClick:()=>n(l.value),className:b.cn(a===l.value&&"bg-muted"),children:l.label},l.value))})]}),o&&e.jsx(j.Button,{variant:"outline",size:"sm",onClick:o,disabled:i,children:e.jsx(h.RefreshCw,{className:b.cn("h-4 w-4",i&&"animate-spin")})}),c?.map(l=>e.jsx(j.Button,{variant:l.variant||"default",size:"sm",onClick:l.onClick,asChild:!!l.href,children:l.href?e.jsxs("a",{href:l.href,children:[l.icon&&e.jsx("span",{className:"mr-2",children:l.icon}),l.label]}):e.jsxs(e.Fragment,{children:[l.icon&&e.jsx("span",{className:"mr-2",children:l.icon}),l.label]})},l.id))]})]})}function Oj({stats:t,layout:s="grid",columns:a=4,loading:n}){return e.jsx(vc,{layout:s,columns:a,gap:"md",children:t.map(r=>e.jsx(jc,{label:r.label,value:r.value,trend:r.trend,trendValue:r.trendValue,trendText:r.trendText,icon:r.icon,color:r.color,variant:"card",loading:n},r.id))})}function zj({config:t}){return e.jsxs(Ce,{children:[e.jsxs(Ve,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsxs("div",{children:[e.jsx(Oe,{className:"text-base",children:t.title}),t.description&&e.jsx(et,{children:t.description})]}),t.actions&&t.actions.length>0&&e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsx(Ye,{align:"end",children:t.actions.map((s,a)=>e.jsx(Ne,{onClick:s.onClick,children:s.label},a))})]})]}),e.jsx(Pe,{children:t.chart})]})}function _j({config:t}){return e.jsxs(Ce,{children:[e.jsxs(Ve,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsxs("div",{children:[e.jsx(Oe,{className:"text-base",children:t.title}),t.description&&e.jsx(et,{children:t.description})]}),t.actions&&t.actions.length>0&&e.jsx("div",{className:"flex gap-2",children:t.actions.map((s,a)=>e.jsx(j.Button,{variant:"outline",size:"sm",onClick:s.onClick,asChild:!!s.href,children:s.href?e.jsxs("a",{href:s.href,children:[s.label,e.jsx(h.ArrowUpRight,{className:"ml-1 h-3 w-3"})]}):s.label},a))})]}),e.jsx(Pe,{children:t.table})]})}function Vj({activities:t}){const s=n=>{const r=typeof n=="string"?new Date(n):n,i=new Date().getTime()-r.getTime(),c=Math.floor(i/6e4),l=Math.floor(c/60),u=Math.floor(l/24);return c<1?"À l'instant":c<60?`Il y a ${c} min`:l<24?`Il y a ${l}h`:u<7?`Il y a ${u}j`:r.toLocaleDateString("fr-FR")},a={info:"bg-blue-500",success:"bg-green-500",warning:"bg-yellow-500",error:"bg-red-500"};return e.jsxs(Ce,{children:[e.jsx(Ve,{children:e.jsx(Oe,{className:"text-base",children:"Activité récente"})}),e.jsx(Pe,{children:e.jsx("div",{className:"space-y-4",children:t.map(n=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:b.cn("h-2 w-2 rounded-full mt-2 flex-shrink-0",a[n.type||"info"])}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:n.title}),n.description&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n.description})]}),e.jsx("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:s(n.timestamp)})]},n.id))})})]})}function Tc({title:t="Tableau de bord",description:s,stats:a,charts:n,tables:r,activities:o,quickActions:i,showHeader:c=!0,onRefresh:l,loading:u=!1,period:f="month",onPeriodChange:m,periods:p,statsLayout:g="grid",statsColumns:C=4,className:y}){return e.jsxs("div",{className:b.cn("space-y-6",y),children:[c&&e.jsx($j,{title:t,description:s,period:f,onPeriodChange:m,periods:p,onRefresh:l,loading:u,quickActions:i}),a&&a.length>0&&e.jsx(Oj,{stats:a,layout:g,columns:C,loading:u}),n&&n.length>0&&e.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:n.map(N=>e.jsx(zj,{config:N},N.id))}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r&&r.length>0&&e.jsx("div",{className:b.cn("space-y-6",o?"lg:col-span-2":"lg:col-span-3"),children:r.map(N=>e.jsx(_j,{config:N},N.id))}),o&&o.length>0&&e.jsx("div",{className:b.cn(!r||r.length===0?"lg:col-span-3":""),children:e.jsx(Vj,{activities:o})})]})]})}const Ec=[{id:"revenue",label:"Revenus",value:"€45,231.89",trend:"up",trendValue:"+20.1%",trendText:"vs mois dernier",icon:e.jsx(h.DollarSign,{className:"h-5 w-5"}),color:"success"},{id:"users",label:"Utilisateurs",value:"2,350",trend:"up",trendValue:"+180",trendText:"cette semaine",icon:e.jsx(h.Users,{className:"h-5 w-5"}),color:"blue"},{id:"orders",label:"Commandes",value:"12,234",trend:"down",trendValue:"-4.3%",trendText:"vs mois dernier",icon:e.jsx(h.ShoppingCart,{className:"h-5 w-5"}),color:"purple"},{id:"performance",label:"Performance",value:"94.2%",trend:"up",trendValue:"+2.4%",icon:e.jsx(h.Activity,{className:"h-5 w-5"}),color:"primary"}];function Bj({field:t,value:s,onChange:a}){const n=r=>{a?.(r)};return t.type==="custom"&&t.customComponent?e.jsx("div",{className:"space-y-2",children:t.customComponent}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(j.Label,{htmlFor:t.id,className:"text-sm font-medium",children:[t.label,t.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.type==="switch"&&e.jsx(_s,{id:t.id,checked:s,onCheckedChange:n,disabled:t.disabled})]}),t.description&&t.type!=="switch"&&e.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}),t.type==="switch"&&t.description&&e.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}),t.type==="text"&&e.jsx(j.Input,{id:t.id,type:"text",value:s||"",onChange:r=>n(r.target.value),placeholder:t.placeholder,disabled:t.disabled}),t.type==="email"&&e.jsx(j.Input,{id:t.id,type:"email",value:s||"",onChange:r=>n(r.target.value),placeholder:t.placeholder,disabled:t.disabled}),t.type==="password"&&e.jsx(j.Input,{id:t.id,type:"password",value:s||"",onChange:r=>n(r.target.value),placeholder:t.placeholder,disabled:t.disabled}),t.type==="textarea"&&e.jsx(j.Textarea,{id:t.id,value:s||"",onChange:r=>n(r.target.value),placeholder:t.placeholder,disabled:t.disabled,rows:3}),t.type==="select"&&t.options&&e.jsxs(Be,{value:s,onValueChange:n,disabled:t.disabled,children:[e.jsx(ze,{id:t.id,children:e.jsx(We,{placeholder:t.placeholder||"Sélectionner..."})}),e.jsx(_e,{children:t.options.map(r=>e.jsx(ke,{value:r.value,children:r.label},r.value))})]})]})}function Wj({section:t,values:s,onChange:a}){return e.jsxs(Ce,{children:[e.jsx(Ve,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[t.icon&&e.jsx("span",{className:"text-muted-foreground",children:t.icon}),e.jsxs("div",{children:[e.jsx(Oe,{className:"text-base",children:t.title}),t.description&&e.jsx(et,{children:t.description})]})]})}),e.jsx(Pe,{className:"space-y-6",children:t.fields.map((n,r)=>e.jsxs(d.Fragment,{children:[e.jsx(Bj,{field:n,value:s?.[n.id],onChange:o=>a?.(n.id,o)}),r<t.fields.length-1&&e.jsx(j.Separator,{className:"my-4"})]},n.id))})]})}function qj({title:t="Paramètres",description:s="Gérez les paramètres de votre compte et de l'application.",tabs:a,sections:n,useTabs:r=!0,defaultTab:o,values:i={},onChange:c,onSave:l,saving:u=!1,showSaveButton:f=!0,showDeleteAccount:m=!1,onDeleteAccount:p,className:g}){const[C,y]=d.useState(i),[N,v]=d.useState(!1);d.useEffect(()=>{y(i)},[i]);const x=(D,S)=>{y(F=>({...F,[D]:S})),v(!0),c?.(D,S)},w=async()=>{await l?.(C),v(!1)},k=D=>e.jsx("div",{className:"space-y-6",children:D.map(S=>e.jsx(Wj,{section:S,values:C,onChange:x},S.id))});return e.jsxs("div",{className:b.cn("space-y-6",g),children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:t}),s&&e.jsx("p",{className:"text-muted-foreground mt-1",children:s})]}),f&&l&&e.jsxs(j.Button,{onClick:w,disabled:u||!N,children:[u?e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(h.Save,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})]}),r&&a&&a.length>0?e.jsxs(Vs,{defaultValue:o||a[0].id,className:"space-y-6",children:[e.jsx(As,{className:"grid w-full grid-cols-2 md:w-auto md:inline-flex",children:a.map(D=>e.jsxs(Mt,{value:D.id,className:"gap-2",children:[D.icon,D.label]},D.id))}),a.map(D=>e.jsx(At,{value:D.id,className:"space-y-6",children:k(D.sections)},D.id))]}):n&&k(n),m&&p&&e.jsxs(Ce,{className:"border-destructive",children:[e.jsxs(Ve,{children:[e.jsxs(Oe,{className:"text-base text-destructive flex items-center gap-2",children:[e.jsx(h.Trash2,{className:"h-4 w-4"}),"Zone dangereuse"]}),e.jsx(et,{children:"Actions irréversibles concernant votre compte."})]}),e.jsx(Pe,{children:e.jsxs(cs,{children:[e.jsx($o,{asChild:!0,children:e.jsxs(j.Button,{variant:"destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer mon compte"]})}),e.jsxs(qt,{children:[e.jsxs(Ut,{children:[e.jsx(Gt,{children:"Êtes-vous sûr ?"}),e.jsx(Xt,{children:"Cette action est irréversible. Toutes vos données seront définitivement supprimées et ne pourront pas être récupérées."})]}),e.jsxs(Ht,{children:[e.jsx(Qt,{children:"Annuler"}),e.jsx(Yt,{onClick:p,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer définitivement"})]})]})]})})]})]})}const Uj=[{id:"profile",label:"Profil",icon:e.jsx(h.User,{className:"h-4 w-4"}),sections:[{id:"personal",title:"Informations personnelles",description:"Mettez à jour vos informations personnelles.",icon:e.jsx(h.User,{className:"h-5 w-5"}),fields:[{id:"name",label:"Nom complet",type:"text",placeholder:"Jean Dupont",required:!0},{id:"email",label:"Adresse email",type:"email",placeholder:"jean@exemple.com",required:!0},{id:"bio",label:"Bio",type:"textarea",placeholder:"Parlez-nous de vous..."}]}]},{id:"notifications",label:"Notifications",icon:e.jsx(h.Bell,{className:"h-4 w-4"}),sections:[{id:"email-notifs",title:"Notifications par email",description:"Gérez vos préférences de notification par email.",icon:e.jsx(h.Mail,{className:"h-5 w-5"}),fields:[{id:"notif-marketing",label:"Marketing",description:"Recevoir des emails marketing et promotionnels.",type:"switch"},{id:"notif-security",label:"Sécurité",description:"Recevoir des alertes de sécurité importantes.",type:"switch"},{id:"notif-updates",label:"Mises à jour",description:"Recevoir les mises à jour de produit.",type:"switch"}]}]},{id:"security",label:"Sécurité",icon:e.jsx(h.Shield,{className:"h-4 w-4"}),sections:[{id:"password",title:"Mot de passe",description:"Changez votre mot de passe.",icon:e.jsx(h.Lock,{className:"h-5 w-5"}),fields:[{id:"current-password",label:"Mot de passe actuel",type:"password",placeholder:"••••••••"},{id:"new-password",label:"Nouveau mot de passe",type:"password",placeholder:"••••••••"},{id:"confirm-password",label:"Confirmer le mot de passe",type:"password",placeholder:"••••••••"}]},{id:"two-factor",title:"Authentification à deux facteurs",description:"Ajoutez une couche de sécurité supplémentaire.",icon:e.jsx(h.Smartphone,{className:"h-5 w-5"}),fields:[{id:"2fa-enabled",label:"Activer la 2FA",description:"Utilisez une application d'authentification.",type:"switch"}]}]},{id:"preferences",label:"Préférences",icon:e.jsx(h.Palette,{className:"h-4 w-4"}),sections:[{id:"appearance",title:"Apparence",description:"Personnalisez l'apparence de l'application.",icon:e.jsx(h.Palette,{className:"h-5 w-5"}),fields:[{id:"theme",label:"Thème",type:"select",options:[{value:"light",label:"Clair"},{value:"dark",label:"Sombre"},{value:"system",label:"Système"}]},{id:"language",label:"Langue",type:"select",options:[{value:"fr",label:"Français"},{value:"en",label:"English"},{value:"es",label:"Español"}]}]}]}];function Co({url:t,name:s,size:a="lg",editable:n,onAvatarChange:r}){const o=d.useRef(null),i={sm:"h-12 w-12",md:"h-16 w-16",lg:"h-24 w-24",xl:"h-32 w-32"},c=s.split(" ").map(u=>u[0]).join("").toUpperCase().slice(0,2),l=u=>{const f=u.target.files?.[0];f&&r&&r(f)};return e.jsxs("div",{className:"relative inline-block",children:[e.jsxs(Dt,{className:b.cn(i[a],"border-4 border-background shadow-lg"),children:[e.jsx(Tt,{src:t,alt:s}),e.jsx(Et,{className:"text-lg font-medium",children:c})]}),n&&r&&e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:o,type:"file",accept:"image/*",onChange:l,className:"hidden"}),e.jsx(j.Button,{size:"icon",variant:"secondary",className:"absolute bottom-0 right-0 h-8 w-8 rounded-full shadow-md",onClick:()=>o.current?.click(),children:e.jsx(h.Camera,{className:"h-4 w-4"})})]})]})}function Hj({field:t,value:s,onChange:a,isEditing:n}){if(!n)return e.jsxs("div",{className:"flex items-center gap-2",children:[t.icon&&e.jsx("span",{className:"text-muted-foreground",children:t.icon}),e.jsx("span",{className:b.cn(!s&&"text-muted-foreground italic"),children:s||"Non renseigné"})]});const r={id:t.id,value:s||"",onChange:o=>a(o.target.value),placeholder:t.placeholder,disabled:t.disabled};return t.type==="textarea"?e.jsx(j.Textarea,{...r,rows:3}):t.type==="select"&&t.options?e.jsxs(Be,{value:s,onValueChange:a,disabled:t.disabled,children:[e.jsx(ze,{children:e.jsx(We,{placeholder:t.placeholder||"Sélectionner..."})}),e.jsx(_e,{children:t.options.map(o=>e.jsx(ke,{value:o.value,children:o.label},o.value))})]}):e.jsx(j.Input,{type:t.type||"text",...r})}function ko({section:t,values:s,onChange:a,isEditing:n}){return e.jsxs(Ce,{children:[e.jsx(Ve,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[t.icon&&e.jsx("span",{className:"text-muted-foreground",children:t.icon}),e.jsxs("div",{children:[e.jsx(Oe,{className:"text-base",children:t.title}),t.description&&e.jsx(et,{children:t.description})]})]})}),e.jsx(Pe,{className:"space-y-4",children:t.fields.map((r,o)=>e.jsxs(d.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(j.Label,{htmlFor:r.id,className:"text-sm font-medium",children:[r.label,r.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.jsx(Hj,{field:r,value:s[r.id]||"",onChange:i=>a(r.id,i),isEditing:n})]}),o<t.fields.length-1&&n&&e.jsx(j.Separator,{className:"my-4"})]},r.id))})]})}function Gj({links:t,isEditing:s}){const a=n=>{switch(n){case"twitter":return e.jsx(h.Twitter,{className:"h-4 w-4"});case"github":return e.jsx(h.Github,{className:"h-4 w-4"});case"linkedin":return e.jsx(h.Linkedin,{className:"h-4 w-4"});case"website":return e.jsx(h.Globe,{className:"h-4 w-4"});default:return e.jsx(h.Link,{className:"h-4 w-4"})}};return s?e.jsx("div",{className:"space-y-2",children:t.map(n=>e.jsxs("div",{className:"flex items-center gap-2",children:[a(n.type),e.jsx(j.Input,{value:n.url,className:"flex-1",readOnly:!0})]},n.id))}):e.jsx("div",{className:"flex gap-2 flex-wrap",children:t.map(n=>e.jsxs("a",{href:n.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 px-3 py-1.5 bg-muted rounded-full text-sm hover:bg-muted/80 transition-colors",children:[a(n.type),e.jsx("span",{children:n.label||n.type})]},n.id))})}function Xj({profile:t,editable:s=!1,isEditing:a,onEditToggle:n,onChange:r,onSave:o,saving:i=!1,onAvatarChange:c,customSections:l,showSocialLinks:u=!0,showStats:f=!1,stats:m,layout:p="card",useTabs:g=!1,className:C}){const[y,N]=d.useState(!1),[v,x]=d.useState(t),w=a??y;d.useEffect(()=>{x(t)},[t]);const k=E=>{n?n(E):N(E),E||x(t)},D=(E,P)=>{x(G=>({...G,[E]:P})),r?.(E,P)},S=async()=>{await o?.(v),k(!1)},F=[{id:"personal",title:"Informations personnelles",icon:e.jsx(h.User,{className:"h-5 w-5"}),fields:[{id:"firstName",label:"Prénom",value:v.firstName||"",type:"text",placeholder:"Jean",icon:e.jsx(h.User,{className:"h-4 w-4"})},{id:"lastName",label:"Nom",value:v.lastName||"",type:"text",placeholder:"Dupont"},{id:"email",label:"Email",value:v.email,type:"email",placeholder:"jean@exemple.com",required:!0,icon:e.jsx(h.Mail,{className:"h-4 w-4"})},{id:"phone",label:"Téléphone",value:v.phone||"",type:"tel",placeholder:"+33 6 12 34 56 78",icon:e.jsx(h.Phone,{className:"h-4 w-4"})},{id:"bio",label:"Bio",value:v.bio||"",type:"textarea",placeholder:"Parlez-nous de vous..."}]},{id:"professional",title:"Informations professionnelles",icon:e.jsx(h.Briefcase,{className:"h-5 w-5"}),fields:[{id:"role",label:"Poste",value:v.role||"",type:"text",placeholder:"Développeur Senior",icon:e.jsx(h.Briefcase,{className:"h-4 w-4"})},{id:"department",label:"Département",value:v.department||"",type:"text",placeholder:"Engineering"},{id:"company",label:"Entreprise",value:v.company||"",type:"text",placeholder:"Acme Inc.",icon:e.jsx(h.Building,{className:"h-4 w-4"})},{id:"location",label:"Localisation",value:v.location||"",type:"text",placeholder:"Paris, France",icon:e.jsx(h.MapPin,{className:"h-4 w-4"})},{id:"website",label:"Site web",value:v.website||"",type:"url",placeholder:"https://exemple.com",icon:e.jsx(h.Globe,{className:"h-4 w-4"})}]}],A=l||F,T={firstName:v.firstName||"",lastName:v.lastName||"",email:v.email,phone:v.phone||"",bio:v.bio||"",role:v.role||"",department:v.department||"",company:v.company||"",location:v.location||"",website:v.website||"",...v.customFields};if(p==="compact")return e.jsxs("div",{className:b.cn("flex items-center gap-4",C),children:[e.jsx(Co,{url:v.avatarUrl,name:v.displayName,size:"md"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:v.displayName}),v.role&&e.jsx("p",{className:"text-sm text-muted-foreground",children:v.role}),v.email&&e.jsx("p",{className:"text-sm text-muted-foreground",children:v.email})]})]});const M=()=>e.jsxs("div",{className:"flex flex-col items-center text-center gap-4 md:flex-row md:text-left",children:[e.jsx(Co,{url:v.avatarUrl,name:v.displayName,size:"xl",editable:s&&w,onAvatarChange:c}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:v.displayName}),v.role&&e.jsx("p",{className:"text-muted-foreground",children:v.role}),v.company&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(h.Building,{className:"h-3 w-3"}),v.company]}),v.location&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(h.MapPin,{className:"h-3 w-3"}),v.location]})]}),s&&e.jsx("div",{className:"flex gap-2",children:w?e.jsxs(e.Fragment,{children:[e.jsxs(j.Button,{variant:"outline",size:"sm",onClick:()=>k(!1),disabled:i,children:[e.jsx(h.X,{className:"mr-2 h-4 w-4"}),"Annuler"]}),e.jsxs(j.Button,{size:"sm",onClick:S,disabled:i,children:[i?e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(h.Save,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})]}):e.jsxs(j.Button,{variant:"outline",size:"sm",onClick:()=>k(!0),children:[e.jsx(h.Edit3,{className:"mr-2 h-4 w-4"}),"Modifier"]})})]}),f&&m&&m.length>0&&e.jsx("div",{className:"flex gap-6 mt-4",children:m.map((E,P)=>e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:E.value}),e.jsx("div",{className:"text-xs text-muted-foreground",children:E.label})]},P))}),u&&v.socialLinks&&v.socialLinks.length>0&&e.jsx("div",{className:"mt-4",children:e.jsx(Gj,{links:v.socialLinks,isEditing:w})}),v.joinedAt&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-4 flex items-center gap-1",children:[e.jsx(h.Calendar,{className:"h-3 w-3"}),"Membre depuis"," ",new Date(v.joinedAt).toLocaleDateString("fr-FR",{month:"long",year:"numeric"})]})]})]}),I=()=>e.jsx("div",{className:"space-y-6",children:A.map(E=>e.jsx(ko,{section:E,values:T,onChange:D,isEditing:w},E.id))});return p==="card"?e.jsx(Ce,{className:C,children:e.jsx(Pe,{className:"pt-6",children:e.jsxs("div",{className:"space-y-6",children:[M(),e.jsx(j.Separator,{}),I()]})})}):e.jsxs("div",{className:b.cn("space-y-6",C),children:[M(),g?e.jsxs(Vs,{defaultValue:A[0]?.id,className:"space-y-6",children:[e.jsx(As,{children:A.map(E=>e.jsxs(Mt,{value:E.id,className:"gap-2",children:[E.icon,E.title]},E.id))}),A.map(E=>e.jsx(At,{value:E.id,children:e.jsx(ko,{section:E,values:T,onChange:D,isEditing:w})},E.id))]}):I()]})}const Yj={displayName:"Jean Dupont",firstName:"Jean",lastName:"Dupont",email:"jean.dupont@exemple.com",phone:"+33 6 12 34 56 78",bio:"Développeur passionné avec plus de 10 ans d'expérience dans le développement web et mobile.",avatarUrl:"",role:"Lead Developer",department:"Engineering",company:"Acme Inc.",location:"Paris, France",website:"https://jeandupont.dev",joinedAt:new Date("2023-01-15"),socialLinks:[{id:"1",type:"twitter",url:"https://twitter.com/jeandupont",label:"@jeandupont"},{id:"2",type:"github",url:"https://github.com/jeandupont",label:"jeandupont"},{id:"3",type:"linkedin",url:"https://linkedin.com/in/jeandupont",label:"Jean Dupont"}]},Pc=[{value:"admin",label:"Administrateur",color:"destructive"},{value:"moderator",label:"Modérateur",color:"warning"},{value:"user",label:"Utilisateur",color:"default"},{value:"guest",label:"Invité",color:"secondary"}],Va={active:{label:"Actif",color:"bg-green-500",icon:h.CheckCircle},inactive:{label:"Inactif",color:"bg-gray-500",icon:h.XCircle},pending:{label:"En attente",color:"bg-yellow-500",icon:h.Mail},banned:{label:"Banni",color:"bg-red-500",icon:h.Ban}};function Qj({user:t,size:s="sm"}){const a={sm:"h-8 w-8",md:"h-10 w-10"},n=t.displayName.split(" ").map(r=>r[0]).join("").toUpperCase().slice(0,2);return e.jsxs(Dt,{className:a[s],children:[e.jsx(Tt,{src:t.avatarUrl,alt:t.displayName}),e.jsx(Et,{className:"text-xs",children:n})]})}function Kj({role:t,roles:s=Pc}){const a=s.find(r=>r.value===t),n=t==="admin"?h.ShieldAlert:t==="moderator"?h.ShieldCheck:h.Shield;return e.jsxs(ye,{variant:a?.color,children:[e.jsx(n,{className:"h-3 w-3 mr-1"}),a?.label||t]})}function Jj({status:t}){const s=Va[t];return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:b.cn("h-2 w-2 rounded-full",s.color)}),e.jsx("span",{className:"text-sm",children:s.label})]})}function So({open:t,onOpenChange:s,user:a,roles:n,permissions:r,onSubmit:o,loading:i}){const[c,l]=d.useState({email:"",displayName:"",firstName:"",lastName:"",role:"user",status:"pending",permissions:[]});d.useEffect(()=>{l(a?{email:a.email,displayName:a.displayName,firstName:a.firstName||"",lastName:a.lastName||"",role:a.role,status:a.status,permissions:a.permissions||[]}:{email:"",displayName:"",firstName:"",lastName:"",role:"user",status:"pending",permissions:[]})},[a,t]);const u=async m=>{m.preventDefault(),await o(c),s(!1)},f=m=>{l(p=>({...p,permissions:p.permissions?.includes(m)?p.permissions.filter(g=>g!==m):[...p.permissions||[],m]}))};return e.jsx(ds,{open:t,onOpenChange:s,children:e.jsx(Kt,{className:"sm:max-w-[500px]",children:e.jsxs("form",{onSubmit:u,children:[e.jsxs(Cs,{children:[e.jsx(ks,{children:a?"Modifier l'utilisateur":"Créer un utilisateur"}),e.jsx(da,{children:a?"Modifiez les informations de l'utilisateur.":"Remplissez les informations pour créer un nouvel utilisateur."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{htmlFor:"firstName",children:"Prénom"}),e.jsx(j.Input,{id:"firstName",value:c.firstName,onChange:m=>l(p=>({...p,firstName:m.target.value})),placeholder:"Jean"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{htmlFor:"lastName",children:"Nom"}),e.jsx(j.Input,{id:"lastName",value:c.lastName,onChange:m=>l(p=>({...p,lastName:m.target.value})),placeholder:"Dupont"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{htmlFor:"displayName",children:"Nom d'affichage *"}),e.jsx(j.Input,{id:"displayName",value:c.displayName,onChange:m=>l(p=>({...p,displayName:m.target.value})),placeholder:"Jean Dupont",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{htmlFor:"email",children:"Email *"}),e.jsx(j.Input,{id:"email",type:"email",value:c.email,onChange:m=>l(p=>({...p,email:m.target.value})),placeholder:"jean@exemple.com",required:!0})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{htmlFor:"role",children:"Rôle"}),e.jsxs(Be,{value:c.role,onValueChange:m=>l(p=>({...p,role:m})),children:[e.jsx(ze,{children:e.jsx(We,{})}),e.jsx(_e,{children:n.map(m=>e.jsx(ke,{value:m.value,children:m.label},m.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{htmlFor:"status",children:"Statut"}),e.jsxs(Be,{value:c.status,onValueChange:m=>l(p=>({...p,status:m})),children:[e.jsx(ze,{children:e.jsx(We,{})}),e.jsx(_e,{children:Object.entries(Va).map(([m,p])=>e.jsx(ke,{value:m,children:p.label},m))})]})]})]}),r&&r.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(j.Label,{children:"Permissions"}),e.jsx("div",{className:"border rounded-md p-3 space-y-2 max-h-[150px] overflow-y-auto",children:r.map(m=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(st,{id:m.id,checked:c.permissions?.includes(m.id),onCheckedChange:()=>f(m.id)}),e.jsx("label",{htmlFor:m.id,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:m.name})]},m.id))})]})]}),e.jsxs(aa,{children:[e.jsx(j.Button,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Annuler"}),e.jsxs(j.Button,{type:"submit",disabled:i,children:[i&&e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),a?"Enregistrer":"Créer"]})]})]})})})}function Zj({user:t,onEdit:s,onDelete:a,onResetPassword:n,onStatusChange:r,onRoleChange:o,roles:i}){return e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(Ye,{align:"end",children:[s&&e.jsxs(Ne,{onClick:s,children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Modifier"]}),n&&e.jsxs(Ne,{onClick:n,children:[e.jsx(h.Key,{className:"mr-2 h-4 w-4"}),"Réinitialiser le mot de passe"]}),o&&e.jsxs(e.Fragment,{children:[e.jsx(dt,{}),e.jsx(ys,{children:"Changer le rôle"}),i.map(c=>e.jsx(Ne,{onClick:()=>o(c.value),disabled:t.role===c.value,children:c.label},c.value))]}),r&&e.jsxs(e.Fragment,{children:[e.jsx(dt,{}),e.jsx(ys,{children:"Changer le statut"}),Object.entries(Va).map(([c,l])=>e.jsx(Ne,{onClick:()=>r(c),disabled:t.status===c,children:l.label},c))]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(dt,{}),e.jsxs(Ne,{onClick:a,className:"text-destructive focus:text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]})}function ev({users:t,roles:s=Pc,permissions:a,selectedUsers:n=[],onSelectionChange:r,onCreate:o,onEdit:i,onDelete:c,onBulkDelete:l,onRoleChange:u,onStatusChange:f,onResetPassword:m,onExport:p,onRefresh:g,loading:C=!1,actionLoading:y=!1,searchQuery:N="",onSearchChange:v,roleFilter:x="all",onRoleFilterChange:w,statusFilter:k="all",onStatusFilterChange:D,showBulkActions:S=!0,showCreateButton:F=!0,title:A="Gestion des utilisateurs",description:T="Gérez les utilisateurs, leurs rôles et permissions.",className:M}){const[I,E]=d.useState(!1),[P,G]=d.useState(null),[H,X]=d.useState(null),[z,L]=d.useState(!1),_=d.useMemo(()=>t.filter(W=>{if(N){const J=N.toLowerCase();if(!(W.displayName.toLowerCase().includes(J)||W.email.toLowerCase().includes(J)))return!1}return!(x!=="all"&&W.role!==x||k!=="all"&&W.status!==k)}),[t,N,x,k]),R=W=>{r?.(W?_.map(J=>J.id):[])},U=(W,J)=>{r?.(J?[...n,W]:n.filter(B=>B!==W))},$=async W=>{await o?.(W)},Z=async W=>{P&&(await i?.(P.id,W),G(null))},Q=async()=>{H&&(await c?.(H.id),X(null))},K=async()=>{await l?.(n),r?.([]),L(!1)},q=W=>(typeof W=="string"?new Date(W):W).toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"});return e.jsxs("div",{className:b.cn("space-y-6",M),children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold tracking-tight flex items-center gap-2",children:[e.jsx(h.Users,{className:"h-6 w-6"}),A]}),T&&e.jsx("p",{className:"text-muted-foreground mt-1",children:T})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[g&&e.jsx(j.Button,{variant:"outline",size:"sm",onClick:g,disabled:C,children:e.jsx(h.RefreshCw,{className:b.cn("h-4 w-4",C&&"animate-spin")})}),p&&e.jsxs(j.Button,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(h.Download,{className:"mr-2 h-4 w-4"}),"Exporter"]}),F&&o&&e.jsxs(j.Button,{size:"sm",onClick:()=>E(!0),children:[e.jsx(h.UserPlus,{className:"mr-2 h-4 w-4"}),"Ajouter"]})]})]}),e.jsx(Ce,{children:e.jsxs(Pe,{className:"pt-6",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center",children:[v&&e.jsxs("div",{className:"relative flex-1",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(j.Input,{placeholder:"Rechercher un utilisateur...",value:N,onChange:W=>v(W.target.value),className:"pl-9"})]}),w&&e.jsxs(Be,{value:x,onValueChange:W=>w(W),children:[e.jsxs(ze,{className:"w-[180px]",children:[e.jsx(h.Filter,{className:"mr-2 h-4 w-4"}),e.jsx(We,{placeholder:"Rôle"})]}),e.jsxs(_e,{children:[e.jsx(ke,{value:"all",children:"Tous les rôles"}),s.map(W=>e.jsx(ke,{value:W.value,children:W.label},W.value))]})]}),D&&e.jsxs(Be,{value:k,onValueChange:W=>D(W),children:[e.jsxs(ze,{className:"w-[180px]",children:[e.jsx(h.Filter,{className:"mr-2 h-4 w-4"}),e.jsx(We,{placeholder:"Statut"})]}),e.jsxs(_e,{children:[e.jsx(ke,{value:"all",children:"Tous les statuts"}),Object.entries(Va).map(([W,J])=>e.jsx(ke,{value:W,children:J.label},W))]})]})]}),S&&n.length>0&&e.jsxs("div",{className:"flex items-center gap-4 mt-4 p-3 bg-muted rounded-lg",children:[e.jsxs("span",{className:"text-sm font-medium",children:[n.length," utilisateur(s) sélectionné(s)"]}),l&&e.jsxs(j.Button,{variant:"destructive",size:"sm",onClick:()=>L(!0),children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]}),e.jsx(j.Button,{variant:"outline",size:"sm",onClick:()=>r?.([]),children:"Désélectionner"})]})]})}),e.jsx(Ce,{children:e.jsx(Pe,{className:"p-0",children:e.jsxs($a,{children:[e.jsx(Oa,{children:e.jsxs(rs,{children:[r&&e.jsx(ft,{className:"w-[50px]",children:e.jsx(st,{checked:_.length>0&&n.length===_.length,onCheckedChange:R})}),e.jsx(ft,{children:"Utilisateur"}),e.jsx(ft,{children:"Rôle"}),e.jsx(ft,{children:"Statut"}),e.jsx(ft,{children:"Inscrit le"}),e.jsx(ft,{children:"Dernière connexion"}),e.jsx(ft,{className:"w-[50px]"})]})}),e.jsx(za,{children:C?e.jsx(rs,{children:e.jsx(ot,{colSpan:r?7:6,className:"text-center py-8",children:e.jsx(h.Loader2,{className:"h-6 w-6 animate-spin mx-auto"})})}):_.length===0?e.jsx(rs,{children:e.jsx(ot,{colSpan:r?7:6,className:"text-center py-8 text-muted-foreground",children:"Aucun utilisateur trouvé"})}):_.map(W=>e.jsxs(rs,{children:[r&&e.jsx(ot,{children:e.jsx(st,{checked:n.includes(W.id),onCheckedChange:J=>U(W.id,J)})}),e.jsx(ot,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Qj,{user:W}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:W.displayName}),e.jsx("div",{className:"text-sm text-muted-foreground",children:W.email})]})]})}),e.jsx(ot,{children:e.jsx(Kj,{role:W.role,roles:s})}),e.jsx(ot,{children:e.jsx(Jj,{status:W.status})}),e.jsx(ot,{className:"text-muted-foreground",children:q(W.createdAt)}),e.jsx(ot,{className:"text-muted-foreground",children:W.lastLogin?q(W.lastLogin):"-"}),e.jsx(ot,{children:e.jsx(Zj,{user:W,roles:s,onEdit:i?()=>G(W):void 0,onDelete:c?()=>X(W):void 0,onResetPassword:m?()=>m(W.id):void 0,onRoleChange:u?J=>u(W.id,J):void 0,onStatusChange:f?J=>f(W.id,J):void 0})})]},W.id))})]})})}),e.jsx(So,{open:I,onOpenChange:E,roles:s,permissions:a,onSubmit:$,loading:y}),e.jsx(So,{open:!!P,onOpenChange:W=>!W&&G(null),user:P||void 0,roles:s,permissions:a,onSubmit:Z,loading:y}),e.jsx(cs,{open:!!H,onOpenChange:W=>!W&&X(null),children:e.jsxs(qt,{children:[e.jsxs(Ut,{children:[e.jsx(Gt,{children:"Supprimer l'utilisateur ?"}),e.jsxs(Xt,{children:["Êtes-vous sûr de vouloir supprimer ",H?.displayName," ? Cette action est irréversible."]})]}),e.jsxs(Ht,{children:[e.jsx(Qt,{children:"Annuler"}),e.jsx(Yt,{onClick:Q,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})}),e.jsx(cs,{open:z,onOpenChange:L,children:e.jsxs(qt,{children:[e.jsxs(Ut,{children:[e.jsx(Gt,{children:"Supprimer les utilisateurs ?"}),e.jsxs(Xt,{children:["Êtes-vous sûr de vouloir supprimer ",n.length," utilisateur(s) ? Cette action est irréversible."]})]}),e.jsxs(Ht,{children:[e.jsx(Qt,{children:"Annuler"}),e.jsx(Yt,{onClick:K,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})})]})}const tv=[{id:"1",email:"admin@exemple.com",displayName:"Admin User",firstName:"Admin",lastName:"User",role:"admin",status:"active",createdAt:new Date("2023-01-01"),lastLogin:new Date("2024-01-15")},{id:"2",email:"moderator@exemple.com",displayName:"Marie Modérateur",firstName:"Marie",lastName:"Modérateur",role:"moderator",status:"active",createdAt:new Date("2023-03-15"),lastLogin:new Date("2024-01-14")},{id:"3",email:"user@exemple.com",displayName:"Jean Utilisateur",firstName:"Jean",lastName:"Utilisateur",role:"user",status:"active",createdAt:new Date("2023-06-01"),lastLogin:new Date("2024-01-10")},{id:"4",email:"pending@exemple.com",displayName:"Paul Pending",firstName:"Paul",lastName:"Pending",role:"user",status:"pending",createdAt:new Date("2024-01-10")},{id:"5",email:"banned@exemple.com",displayName:"Bob Banni",firstName:"Bob",lastName:"Banni",role:"guest",status:"banned",createdAt:new Date("2023-09-01"),lastLogin:new Date("2023-12-01")}],sv=[{id:"read",name:"Lecture",description:"Accès en lecture",category:"Base"},{id:"write",name:"Écriture",description:"Accès en écriture",category:"Base"},{id:"delete",name:"Suppression",description:"Accès suppression",category:"Base"},{id:"admin",name:"Administration",description:"Accès admin",category:"Admin"},{id:"users",name:"Gestion utilisateurs",description:"Gérer les utilisateurs",category:"Admin"}],Mc={404:{code:"404",title:"Page non trouvée",description:"Désolé, la page que vous recherchez n'existe pas ou a été déplacée.",icon:h.FileQuestion},500:{code:"500",title:"Erreur serveur",description:"Une erreur inattendue s'est produite. Notre équipe a été notifiée.",icon:h.ServerCrash},403:{code:"403",title:"Accès refusé",description:"Vous n'avez pas les permissions nécessaires pour accéder à cette page.",icon:h.ShieldX},503:{code:"503",title:"Service indisponible",description:"Le service est temporairement indisponible. Veuillez réessayer plus tard.",icon:h.ServerCrash},offline:{code:"Hors ligne",title:"Vous êtes hors ligne",description:"Vérifiez votre connexion internet et réessayez.",icon:h.Wifi},maintenance:{code:"Maintenance",title:"Maintenance en cours",description:"Nous effectuons une maintenance. Nous serons bientôt de retour.",icon:h.Construction},custom:{code:"",title:"Erreur",description:"Une erreur s'est produite.",icon:h.FileQuestion}};function Do({type:t,className:s}){const n=Mc[t].icon;return e.jsxs("div",{className:b.cn("relative flex items-center justify-center",s),children:[e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"h-48 w-48 rounded-full bg-muted/50"})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"h-32 w-32 rounded-full bg-muted"})}),e.jsx("div",{className:"relative z-10 flex h-20 w-20 items-center justify-center rounded-full bg-background shadow-lg",children:e.jsx(n,{className:"h-10 w-10 text-muted-foreground"})}),e.jsx("div",{className:"absolute -right-4 top-4 h-3 w-3 rounded-full bg-primary/20"}),e.jsx("div",{className:"absolute -left-2 bottom-8 h-2 w-2 rounded-full bg-primary/30"}),e.jsx("div",{className:"absolute right-8 bottom-2 h-4 w-4 rounded-full bg-primary/10"})]})}function Ws({type:t="404",code:s,title:a,description:n,actions:r,illustration:o,showCode:i=!0,showIllustration:c=!0,showBackButton:l=!0,onBack:u,showHomeButton:f=!0,homeUrl:m="/",showRefreshButton:p=!1,children:g,layout:C="centered",size:y="md",className:N}){const v=Mc[t],x=s??v.code,w=a??v.title,k=n??v.description,D={sm:{container:"py-12 px-4",code:"text-6xl",title:"text-xl",description:"text-sm",illustration:"h-32 w-32"},md:{container:"py-16 px-6",code:"text-8xl",title:"text-2xl",description:"text-base",illustration:"h-48 w-48"},lg:{container:"py-24 px-8",code:"text-9xl",title:"text-3xl",description:"text-lg",illustration:"h-64 w-64"}},S=[];l&&S.push({label:"Retour",onClick:u||(()=>window.history.back()),variant:"outline",icon:e.jsx(h.ArrowLeft,{className:"h-4 w-4"})}),f&&S.push({label:"Accueil",href:m,variant:"default",icon:e.jsx(h.Home,{className:"h-4 w-4"})}),p&&S.push({label:"Réessayer",onClick:()=>window.location.reload(),variant:"secondary",icon:e.jsx(h.RefreshCw,{className:"h-4 w-4"})});const F=r||S,A=()=>e.jsxs("div",{className:"flex flex-col items-center text-center",children:[c&&e.jsx("div",{className:b.cn("mb-8",D[y].illustration),children:o||e.jsx(Do,{type:t})}),i&&x&&e.jsx("div",{className:b.cn("font-bold text-muted-foreground/20 mb-4",D[y].code),children:x}),e.jsx("h1",{className:b.cn("font-bold tracking-tight mb-4",D[y].title),children:w}),e.jsx("p",{className:b.cn("text-muted-foreground max-w-md mb-8",D[y].description),children:k}),g&&e.jsx("div",{className:"mb-8",children:g}),F.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3 justify-center",children:F.map((T,M)=>e.jsx(j.Button,{variant:T.variant||"default",onClick:T.onClick,asChild:!!T.href,children:T.href?e.jsxs("a",{href:T.href,children:[T.icon&&e.jsx("span",{className:"mr-2",children:T.icon}),T.label]}):e.jsxs(e.Fragment,{children:[T.icon&&e.jsx("span",{className:"mr-2",children:T.icon}),T.label]})},M))})]});return C==="split"?e.jsxs("div",{className:b.cn("min-h-screen flex flex-col lg:flex-row",N),children:[e.jsx("div",{className:"flex-1 bg-muted/30 flex items-center justify-center p-8 lg:p-16",children:e.jsx("div",{className:D[y].illustration,children:o||e.jsx(Do,{type:t})})}),e.jsx("div",{className:"flex-1 flex items-center justify-center p-8 lg:p-16",children:e.jsxs("div",{className:"max-w-md",children:[i&&x&&e.jsx("div",{className:b.cn("font-bold text-primary mb-4",y==="sm"?"text-4xl":y==="md"?"text-5xl":"text-6xl"),children:x}),e.jsx("h1",{className:b.cn("font-bold tracking-tight mb-4",D[y].title),children:w}),e.jsx("p",{className:b.cn("text-muted-foreground mb-8",D[y].description),children:k}),g&&e.jsx("div",{className:"mb-8",children:g}),F.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3",children:F.map((T,M)=>e.jsx(j.Button,{variant:T.variant||"default",onClick:T.onClick,asChild:!!T.href,children:T.href?e.jsxs("a",{href:T.href,children:[T.icon&&e.jsx("span",{className:"mr-2",children:T.icon}),T.label]}):e.jsxs(e.Fragment,{children:[T.icon&&e.jsx("span",{className:"mr-2",children:T.icon}),T.label]})},M))})]})})]}):e.jsx("div",{className:b.cn("min-h-screen flex items-center justify-center",D[y].container,N),children:A()})}function av(t){return e.jsx(Ws,{type:"404",...t})}function nv(t){return e.jsx(Ws,{type:"500",showRefreshButton:!0,...t})}function rv(t){return e.jsx(Ws,{type:"403",...t})}function ov(t){return e.jsx(Ws,{type:"maintenance",showBackButton:!1,showHomeButton:!1,...t})}function iv(t){return e.jsx(Ws,{type:"offline",showRefreshButton:!0,...t})}function lv({logo:t,brandName:s="Brand",navItems:a=[],showLoginButton:n=!0,loginButtonText:r="Se connecter",onLogin:o,loginHref:i}){const[c,l]=d.useState(!1);return e.jsxs("nav",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[e.jsxs("div",{className:"container flex h-16 items-center justify-between",children:[e.jsxs("a",{href:"/",className:"flex items-center gap-2 font-bold text-xl",children:[t,e.jsx("span",{children:s})]}),e.jsx("div",{className:"hidden md:flex items-center gap-6",children:a.map(u=>e.jsx("a",{href:u.href,className:b.cn("text-sm font-medium transition-colors hover:text-primary",u.isActive?"text-primary":"text-muted-foreground"),children:u.label},u.href))}),e.jsx("div",{className:"hidden md:flex items-center gap-4",children:n&&e.jsx(j.Button,{variant:"default",onClick:o,asChild:!!i,children:i?e.jsx("a",{href:i,children:r}):r})}),e.jsx(j.Button,{variant:"ghost",size:"icon",className:"md:hidden",onClick:()=>l(!c),children:c?e.jsx(h.X,{className:"h-5 w-5"}):e.jsx(h.Menu,{className:"h-5 w-5"})})]}),c&&e.jsx("div",{className:"md:hidden border-t bg-background p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[a.map(u=>e.jsx("a",{href:u.href,className:"text-sm font-medium",onClick:()=>l(!1),children:u.label},u.href)),n&&e.jsx(j.Button,{onClick:o,asChild:!!i,children:i?e.jsx("a",{href:i,children:r}):r})]})})]})}function cv({badge:t,title:s,highlightedTitle:a,description:n,primaryButtonText:r="Commencer",primaryButtonAction:o,primaryButtonHref:i,secondaryButtonText:c,secondaryButtonAction:l,secondaryButtonHref:u,image:f,stats:m}){return e.jsx("section",{className:"container py-24 md:py-32",children:e.jsxs("div",{className:"flex flex-col lg:flex-row items-center gap-12",children:[e.jsxs("div",{className:"flex-1 text-center lg:text-left",children:[t&&e.jsx(ye,{variant:"secondary",className:"mb-4",children:t}),e.jsxs("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight mb-6",children:[s," ",a&&e.jsx("span",{className:"text-primary",children:a})]}),e.jsx("p",{className:"text-lg md:text-xl text-muted-foreground mb-8 max-w-2xl lg:max-w-none",children:n}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center lg:justify-start mb-8",children:[e.jsx(j.Button,{size:"lg",onClick:o,asChild:!!i,children:i?e.jsxs("a",{href:i,children:[r,e.jsx(h.ArrowRight,{className:"ml-2 h-4 w-4"})]}):e.jsxs(e.Fragment,{children:[r,e.jsx(h.ArrowRight,{className:"ml-2 h-4 w-4"})]})}),c&&e.jsx(j.Button,{size:"lg",variant:"outline",onClick:l,asChild:!!u,children:u?e.jsxs("a",{href:u,children:[e.jsx(h.Play,{className:"mr-2 h-4 w-4"}),c]}):e.jsxs(e.Fragment,{children:[e.jsx(h.Play,{className:"mr-2 h-4 w-4"}),c]})})]}),m&&m.length>0&&e.jsx("div",{className:"flex gap-8 justify-center lg:justify-start",children:m.map((p,g)=>e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold",children:p.value}),e.jsx("div",{className:"text-sm text-muted-foreground",children:p.label})]},g))})]}),f&&e.jsx("div",{className:"flex-1 w-full lg:w-auto",children:f})]})})}function dv({title:t="Fonctionnalités",description:s,features:a}){return e.jsxs("section",{className:"container py-24 bg-muted/30",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold tracking-tight mb-4",children:t}),s&&e.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:s})]}),e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:a.map(n=>e.jsxs(Ce,{className:"bg-background",children:[e.jsxs(Ve,{children:[e.jsx("div",{className:"h-12 w-12 rounded-lg bg-primary/10 flex items-center justify-center mb-4",children:e.jsx("span",{className:"text-primary",children:n.icon})}),e.jsx(Oe,{className:"text-xl",children:n.title})]}),e.jsx(Pe,{children:e.jsx(et,{className:"text-base",children:n.description})})]},n.id))})]})}function uv({title:t="Ce que disent nos clients",testimonials:s}){return e.jsxs("section",{className:"container py-24",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold tracking-tight text-center mb-12",children:t}),e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:s.map(a=>e.jsx(Ce,{children:e.jsxs(Pe,{className:"pt-6",children:[a.rating&&e.jsx("div",{className:"flex gap-1 mb-4",children:Array.from({length:5}).map((n,r)=>e.jsx(h.Star,{className:b.cn("h-4 w-4",r<a.rating?"text-yellow-400 fill-yellow-400":"text-muted-foreground")},r))}),e.jsxs("p",{className:"text-muted-foreground mb-6",children:['"',a.content,'"']}),e.jsxs("div",{className:"flex items-center gap-3",children:[a.avatar?e.jsx("img",{src:a.avatar,alt:a.author,className:"h-10 w-10 rounded-full object-cover"}):e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx("span",{className:"text-sm font-medium text-primary",children:a.author.charAt(0)})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:a.author}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[a.role,a.company&&` @ ${a.company}`]})]})]})]})},a.id))})]})}function mv({title:t,description:s,buttonText:a,buttonAction:n,buttonHref:r,secondaryButtonText:o,secondaryButtonAction:i,variant:c="default"}){const l={default:"bg-muted/50",gradient:"bg-gradient-to-r from-primary/10 via-primary/5 to-background",dark:"bg-foreground text-background"};return e.jsx("section",{className:b.cn("py-24",l[c]),children:e.jsx("div",{className:"container",children:e.jsxs("div",{className:"text-center max-w-2xl mx-auto",children:[e.jsx("h2",{className:b.cn("text-3xl md:text-4xl font-bold tracking-tight mb-4",c==="dark"&&"text-background"),children:t}),s&&e.jsx("p",{className:b.cn("text-lg mb-8",c==="dark"?"text-background/80":"text-muted-foreground"),children:s}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[e.jsx(j.Button,{size:"lg",variant:c==="dark"?"secondary":"default",onClick:n,asChild:!!r,children:r?e.jsxs("a",{href:r,children:[a,e.jsx(h.ChevronRight,{className:"ml-2 h-4 w-4"})]}):e.jsxs(e.Fragment,{children:[a,e.jsx(h.ChevronRight,{className:"ml-2 h-4 w-4"})]})}),o&&e.jsx(j.Button,{size:"lg",variant:"outline",onClick:i,className:c==="dark"?"border-background/20 text-background hover:bg-background/10":"",children:o})]})]})})})}function hv({logo:t,brandName:s="Brand",navItems:a,showLoginButton:n=!0,loginButtonText:r="Se connecter",onLogin:o,loginHref:i,hero:c,features:l,featuresTitle:u,featuresDescription:f,testimonials:m,testimonialsTitle:p,cta:g,footer:C,className:y}){return e.jsxs("div",{className:b.cn("min-h-screen",y),children:[e.jsx(lv,{logo:t,brandName:s,navItems:a,showLoginButton:n,loginButtonText:r,onLogin:o,loginHref:i}),c&&e.jsx(cv,{...c}),l&&l.length>0&&e.jsx(dv,{title:u,description:f,features:l}),m&&m.length>0&&e.jsx(uv,{title:p,testimonials:m}),g&&e.jsx(mv,{...g}),C]})}const fv=[{label:"Fonctionnalités",href:"#features"},{label:"Tarifs",href:"#pricing"},{label:"Témoignages",href:"#testimonials"},{label:"Contact",href:"#contact"}],pv=[{id:"1",icon:e.jsx(h.Zap,{className:"h-6 w-6"}),title:"Rapide et performant",description:"Optimisé pour la vitesse avec des temps de chargement minimaux."},{id:"2",icon:e.jsx(h.Shield,{className:"h-6 w-6"}),title:"Sécurisé",description:"Vos données sont protégées avec un chiffrement de bout en bout."},{id:"3",icon:e.jsx(h.Users,{className:"h-6 w-6"}),title:"Collaboration",description:"Travaillez en équipe avec des outils de collaboration intégrés."},{id:"4",icon:e.jsx(h.Globe,{className:"h-6 w-6"}),title:"Accessible partout",description:"Accédez à votre espace depuis n'importe quel appareil."}],xv=[{id:"1",content:"Cette solution a transformé notre façon de travailler. Nous avons gagné un temps précieux.",author:"Marie Dupont",role:"CEO",company:"TechCorp",rating:5},{id:"2",content:"Interface intuitive et support réactif. Je recommande vivement.",author:"Pierre Martin",role:"CTO",company:"StartupXYZ",rating:5},{id:"3",content:"Le meilleur outil que nous ayons utilisé pour gérer nos projets.",author:"Sophie Bernard",role:"Product Manager",company:"InnoLab",rating:5}],gv={badge:"Nouveau",title:"La solution pour",highlightedTitle:"votre entreprise",description:"Simplifiez votre quotidien avec notre plateforme tout-en-un. Gagnez du temps et concentrez-vous sur l'essentiel.",primaryButtonText:"Essayer gratuitement",secondaryButtonText:"Voir la démo",stats:[{value:"10K+",label:"Utilisateurs"},{value:"99.9%",label:"Uptime"},{value:"24/7",label:"Support"}]},bv={title:"Prêt à commencer ?",description:"Rejoignez des milliers d'entreprises qui nous font confiance.",buttonText:"Créer un compte gratuit",secondaryButtonText:"Contacter les ventes",variant:"gradient"};function jv({period:t,onChange:s,yearlyDiscount:a}){return e.jsxs("div",{className:"flex items-center justify-center gap-4 mb-8",children:[e.jsx(j.Label,{htmlFor:"billing-toggle",className:b.cn("cursor-pointer transition-colors",t==="monthly"?"text-foreground":"text-muted-foreground"),children:"Mensuel"}),e.jsx(_s,{id:"billing-toggle",checked:t==="yearly",onCheckedChange:n=>s(n?"yearly":"monthly")}),e.jsxs(j.Label,{htmlFor:"billing-toggle",className:b.cn("cursor-pointer transition-colors flex items-center gap-2",t==="yearly"?"text-foreground":"text-muted-foreground"),children:["Annuel",a&&e.jsxs(ye,{variant:"secondary",className:"text-xs",children:["-",a]})]})]})}function vv({plan:t,billingPeriod:s}){const a=s==="yearly"&&t.priceYearly!==void 0?t.priceYearly:t.price,n=s==="yearly"&&t.periodYearly?t.periodYearly:t.period||"/mois",r=typeof a=="string";return e.jsxs(Ce,{className:b.cn("relative flex flex-col",t.popular&&"border-primary shadow-lg scale-105"),children:[t.popular&&e.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:e.jsxs(ye,{className:"px-3",children:[e.jsx(h.Zap,{className:"h-3 w-3 mr-1"}),t.badge||"Populaire"]})}),e.jsxs(Ve,{className:"text-center pb-2",children:[e.jsx(Oe,{className:"text-xl",children:t.name}),t.description&&e.jsx(et,{children:t.description})]}),e.jsxs(Pe,{className:"flex-1",children:[e.jsx("div",{className:"text-center mb-6",children:r?e.jsx("div",{className:"text-3xl font-bold",children:a}):e.jsxs("div",{className:"flex items-baseline justify-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground mr-1",children:t.currency||"€"}),e.jsx("span",{className:"text-4xl font-bold",children:a}),e.jsx("span",{className:"text-sm text-muted-foreground ml-1",children:n})]})}),e.jsx("ul",{className:"space-y-3",children:t.features.map((o,i)=>e.jsxs("li",{className:"flex items-start gap-2",children:[o.included===!0?e.jsx(h.Check,{className:"h-5 w-5 text-green-500 flex-shrink-0"}):o.included==="partial"||o.included==="limited"?e.jsx(h.Check,{className:"h-5 w-5 text-yellow-500 flex-shrink-0"}):e.jsx(h.X,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"}),e.jsxs("span",{className:b.cn("text-sm",!o.included&&"text-muted-foreground"),children:[o.name,o.value&&e.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",o.value,")"]})]}),o.tooltip&&e.jsx(na,{children:e.jsxs(ra,{children:[e.jsx(oa,{asChild:!0,children:e.jsx(h.HelpCircle,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),e.jsx(Os,{children:e.jsx("p",{className:"max-w-xs",children:o.tooltip})})]})})]},i))})]}),e.jsx(Sn,{children:e.jsx(j.Button,{className:"w-full",variant:t.buttonVariant||(t.popular?"default":"outline"),onClick:t.onSelect,disabled:t.disabled,asChild:!!t.href,children:t.href?e.jsx("a",{href:t.href,children:t.buttonText||"Choisir"}):t.buttonText||"Choisir"})})]})}function yv({plans:t,billingPeriod:s}){const a=Array.from(new Set(t.flatMap(n=>n.features.map(r=>r.name))));return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsxs("thead",{children:[e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-4 border-b bg-muted/50",children:"Fonctionnalité"}),t.map(n=>e.jsxs("th",{className:b.cn("text-center p-4 border-b min-w-[150px]",n.popular&&"bg-primary/5"),children:[e.jsx("div",{className:"font-bold",children:n.name}),n.popular&&e.jsx(ye,{className:"mt-1",variant:"default",children:"Populaire"})]},n.id))]}),e.jsxs("tr",{children:[e.jsx("td",{className:"p-4 border-b bg-muted/50 font-medium",children:"Prix"}),t.map(n=>{const r=s==="yearly"&&n.priceYearly!==void 0?n.priceYearly:n.price,o=s==="yearly"&&n.periodYearly?n.periodYearly:n.period||"/mois",i=typeof r=="string";return e.jsx("td",{className:b.cn("text-center p-4 border-b",n.popular&&"bg-primary/5"),children:i?e.jsx("span",{className:"font-bold",children:r}):e.jsxs("span",{className:"font-bold",children:[n.currency||"€",r,e.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:o})]})},n.id)})]})]}),e.jsxs("tbody",{children:[a.map((n,r)=>e.jsxs("tr",{className:r%2===0?"bg-muted/20":"",children:[e.jsx("td",{className:"p-4 border-b",children:n}),t.map(o=>{const i=o.features.find(c=>c.name===n);return e.jsx("td",{className:b.cn("text-center p-4 border-b",o.popular&&"bg-primary/5"),children:i?i.included===!0?i.value?e.jsx("span",{children:i.value}):e.jsx(h.Check,{className:"h-5 w-5 text-green-500 mx-auto"}):i.included==="partial"||i.included==="limited"?e.jsx("span",{className:"text-yellow-600",children:i.value||"Limité"}):e.jsx(h.X,{className:"h-5 w-5 text-muted-foreground mx-auto"}):e.jsx(h.X,{className:"h-5 w-5 text-muted-foreground mx-auto"})},o.id)})]},r)),e.jsxs("tr",{children:[e.jsx("td",{className:"p-4"}),t.map(n=>e.jsx("td",{className:b.cn("text-center p-4",n.popular&&"bg-primary/5"),children:e.jsx(j.Button,{variant:n.buttonVariant||(n.popular?"default":"outline"),onClick:n.onSelect,disabled:n.disabled,asChild:!!n.href,children:n.href?e.jsx("a",{href:n.href,children:n.buttonText||"Choisir"}):n.buttonText||"Choisir"})},n.id))]})]})]})})}function wv({title:t="Questions fréquentes",items:s}){return e.jsxs("div",{className:"mt-16",children:[e.jsx("h2",{className:"text-2xl font-bold text-center mb-8",children:t}),e.jsx("div",{className:"grid md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:s.map((a,n)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"font-semibold",children:a.question}),e.jsx("p",{className:"text-muted-foreground text-sm",children:a.answer})]},n))})]})}function Nv({title:t="Tarification",description:s,plans:a,showBillingToggle:n=!0,billingPeriod:r,onBillingPeriodChange:o,yearlyDiscount:i,faq:c,faqTitle:l,layout:u="cards",columns:f=3,showComparison:m=!1,className:p}){const[g,C]=d.useState("monthly"),y=r??g,N=x=>{o?o(x):C(x)},v={2:"md:grid-cols-2",3:"md:grid-cols-2 lg:grid-cols-3",4:"md:grid-cols-2 lg:grid-cols-4"};return e.jsxs("div",{className:b.cn("container py-16",p),children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-bold tracking-tight mb-4",children:t}),s&&e.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:s})]}),n&&e.jsx(jv,{period:y,onChange:N,yearlyDiscount:i}),u==="cards"&&!m?e.jsx("div",{className:b.cn("grid gap-6 items-stretch",v[f]),children:a.map(x=>e.jsx(vv,{plan:x,billingPeriod:y},x.id))}):e.jsx(yv,{plans:a,billingPeriod:y}),c&&c.length>0&&e.jsx(wv,{title:l,items:c})]})}const Cv=[{id:"free",name:"Gratuit",description:"Pour démarrer",price:0,priceYearly:0,features:[{name:"1 utilisateur",included:!0},{name:"5 projets",included:!0},{name:"1 Go de stockage",included:!0},{name:"Support email",included:!0},{name:"API Access",included:!1},{name:"Analytics avancés",included:!1},{name:"Support prioritaire",included:!1}],buttonText:"Commencer gratuitement",buttonVariant:"outline"},{id:"pro",name:"Pro",description:"Pour les équipes",price:29,priceYearly:24,periodYearly:"/mois (facturé annuellement)",popular:!0,features:[{name:"5 utilisateurs",included:!0},{name:"Projets illimités",included:!0},{name:"50 Go de stockage",included:!0},{name:"Support email",included:!0},{name:"API Access",included:!0},{name:"Analytics avancés",included:!0},{name:"Support prioritaire",included:!1}],buttonText:"Essai gratuit 14 jours"},{id:"enterprise",name:"Enterprise",description:"Pour les grandes équipes",price:"Sur mesure",features:[{name:"Utilisateurs illimités",included:!0},{name:"Projets illimités",included:!0},{name:"Stockage illimité",included:!0},{name:"Support email",included:!0},{name:"API Access",included:!0},{name:"Analytics avancés",included:!0},{name:"Support prioritaire",included:!0}],buttonText:"Contacter les ventes",buttonVariant:"outline"}],kv=[{question:"Puis-je changer de plan à tout moment ?",answer:"Oui, vous pouvez upgrader ou downgrader votre plan à tout moment. Les changements prennent effet immédiatement."},{question:"Y a-t-il une période d'essai ?",answer:"Oui, tous nos plans payants incluent une période d'essai gratuite de 14 jours, sans carte bancaire requise."},{question:"Quels moyens de paiement acceptez-vous ?",answer:"Nous acceptons les cartes de crédit (Visa, Mastercard, Amex), PayPal et les virements bancaires pour les entreprises."},{question:"Puis-je annuler à tout moment ?",answer:"Absolument. Vous pouvez annuler votre abonnement à tout moment sans frais supplémentaires."}],Ac={"no-data":{title:"Aucune donnée",description:"Il n'y a pas encore de données à afficher.",icon:h.Inbox,actionLabel:"Ajouter",actionIcon:h.Plus},"no-results":{title:"Aucun résultat",description:"Aucun élément ne correspond à votre recherche.",icon:h.Search,actionLabel:"Effacer les filtres",actionIcon:h.Filter},"no-messages":{title:"Aucun message",description:"Votre boîte de réception est vide.",icon:h.MessageSquare,actionLabel:"Nouveau message",actionIcon:h.Plus},"no-files":{title:"Aucun fichier",description:"Vous n'avez pas encore de fichiers.",icon:h.FolderOpen,actionLabel:"Importer un fichier",actionIcon:h.Upload},"no-users":{title:"Aucun utilisateur",description:"Il n'y a pas encore d'utilisateurs.",icon:h.Users,actionLabel:"Inviter des utilisateurs",actionIcon:h.Plus},"no-cart":{title:"Panier vide",description:"Votre panier est vide.",icon:h.ShoppingCart,actionLabel:"Parcourir les produits",actionIcon:h.ArrowRight},"no-notifications":{title:"Aucune notification",description:"Vous êtes à jour !",icon:h.Bell},"no-events":{title:"Aucun événement",description:"Aucun événement prévu.",icon:h.Calendar,actionLabel:"Créer un événement",actionIcon:h.Plus},"no-images":{title:"Aucune image",description:"Vous n'avez pas encore d'images.",icon:h.Image,actionLabel:"Importer des images",actionIcon:h.Upload},"no-bookmarks":{title:"Aucun favori",description:"Vous n'avez pas encore de favoris.",icon:h.Bookmark,actionLabel:"Parcourir",actionIcon:h.ArrowRight},"no-favorites":{title:"Aucun favori",description:"Vous n'avez pas encore aimé de contenu.",icon:h.Heart},error:{title:"Une erreur est survenue",description:"Impossible de charger les données.",icon:h.FileQuestion,actionLabel:"Réessayer",actionIcon:h.RefreshCw},custom:{title:"Aucun élément",description:"Il n'y a rien à afficher.",icon:h.Inbox}};function To({type:t,size:s,className:a}){const r=Ac[t].icon,i={sm:{container:"h-24 w-24",icon:"h-8 w-8",circles:{outer:"h-20 w-20",inner:"h-14 w-14"}},md:{container:"h-32 w-32",icon:"h-10 w-10",circles:{outer:"h-28 w-28",inner:"h-20 w-20"}},lg:{container:"h-40 w-40",icon:"h-12 w-12",circles:{outer:"h-36 w-36",inner:"h-28 w-28"}}}[s];return e.jsxs("div",{className:b.cn("relative flex items-center justify-center",i.container,a),children:[e.jsx("div",{className:b.cn("absolute rounded-full bg-muted/50",i.circles.outer)}),e.jsx("div",{className:b.cn("absolute rounded-full bg-muted",i.circles.inner)}),e.jsx("div",{className:"relative z-10 flex items-center justify-center rounded-full bg-background p-4 shadow-sm",children:e.jsx(r,{className:b.cn(i.icon,"text-muted-foreground")})}),e.jsx("div",{className:"absolute -right-1 top-2 h-2 w-2 rounded-full bg-primary/20"}),e.jsx("div",{className:"absolute -left-1 bottom-4 h-1.5 w-1.5 rounded-full bg-primary/30"}),e.jsx("div",{className:"absolute right-4 bottom-0 h-2.5 w-2.5 rounded-full bg-primary/10"})]})}function fs({type:t="no-data",title:s,description:a,icon:n,actions:r,illustration:o,showIllustration:i=!0,size:c="md",layout:l="vertical",centered:u=!0,children:f,className:m}){const p=Ac[t],g=s??p.title,C=a??p.description;p.icon;const y={sm:{container:"py-8 px-4",title:"text-base",description:"text-sm",icon:"h-8 w-8"},md:{container:"py-12 px-6",title:"text-lg",description:"text-sm",icon:"h-10 w-10"},lg:{container:"py-16 px-8",title:"text-xl",description:"text-base",icon:"h-12 w-12"}},N=[];if(p.actionLabel&&!r){const x=p.actionIcon;N.push({label:p.actionLabel,variant:"default",icon:x?e.jsx(x,{className:"h-4 w-4"}):void 0})}const v=r||(N.length>0?N:void 0);return l==="horizontal"?e.jsxs("div",{className:b.cn("flex items-center gap-6",y[c].container,u&&"justify-center",m),children:[i&&e.jsx("div",{className:"flex-shrink-0",children:o||(n?e.jsx("div",{className:"flex items-center justify-center rounded-full bg-muted p-4",children:n}):e.jsx(To,{type:t,size:c}))}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("h3",{className:b.cn("font-semibold",y[c].title),children:g}),e.jsx("p",{className:b.cn("text-muted-foreground mt-1",y[c].description),children:C}),f&&e.jsx("div",{className:"mt-4",children:f}),v&&v.length>0&&e.jsx("div",{className:"flex gap-3 mt-4",children:v.map((x,w)=>e.jsx(j.Button,{variant:x.variant||"default",size:"sm",onClick:x.onClick,asChild:!!x.href,children:x.href?e.jsxs("a",{href:x.href,children:[x.icon&&e.jsx("span",{className:"mr-2",children:x.icon}),x.label]}):e.jsxs(e.Fragment,{children:[x.icon&&e.jsx("span",{className:"mr-2",children:x.icon}),x.label]})},w))})]})]}):e.jsxs("div",{className:b.cn("flex flex-col items-center",u&&"text-center",y[c].container,m),children:[i&&e.jsx("div",{className:"mb-6",children:o||(n?e.jsx("div",{className:"flex items-center justify-center rounded-full bg-muted p-6",children:d.cloneElement(n,{className:b.cn(y[c].icon,"text-muted-foreground")})}):e.jsx(To,{type:t,size:c}))}),e.jsx("h3",{className:b.cn("font-semibold",y[c].title),children:g}),e.jsx("p",{className:b.cn("text-muted-foreground mt-2 max-w-sm",y[c].description),children:C}),f&&e.jsx("div",{className:"mt-4",children:f}),v&&v.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3 mt-6 justify-center",children:v.map((x,w)=>e.jsx(j.Button,{variant:x.variant||"default",onClick:x.onClick,asChild:!!x.href,children:x.href?e.jsxs("a",{href:x.href,children:[x.icon&&e.jsx("span",{className:"mr-2",children:x.icon}),x.label]}):e.jsxs(e.Fragment,{children:[x.icon&&e.jsx("span",{className:"mr-2",children:x.icon}),x.label]})},w))})]})}function Sv(t){return e.jsx(fs,{type:"no-data",...t})}function Dv(t){return e.jsx(fs,{type:"no-results",...t})}function Tv(t){return e.jsx(fs,{type:"no-messages",...t})}function Ev(t){return e.jsx(fs,{type:"no-files",...t})}function Pv(t){return e.jsx(fs,{type:"no-cart",...t})}function Mv(t){return e.jsx(fs,{type:"no-notifications",...t})}function Av(t){return e.jsx(fs,{type:"error",...t})}const Fc=d.createContext(null);function Fv(){const t=d.useContext(Fc);if(!t)throw new Error("useWizard must be used within a WakaWizard");return t}function Rv({steps:t,currentStep:s,stepStatuses:a,showStepNumbers:n,orientation:r,onStepClick:o,allowBackNavigation:i}){const c=(u,f)=>f==="completed"?e.jsx(h.Check,{className:"h-4 w-4"}):f==="error"?e.jsx(h.AlertCircle,{className:"h-4 w-4"}):f==="skipped"?e.jsx(h.X,{className:"h-4 w-4 text-muted-foreground"}):n?e.jsx("span",{className:"text-xs font-medium",children:u+1}):e.jsx(h.Circle,{className:"h-3 w-3"}),l=u=>{switch(u){case"completed":return"bg-primary text-primary-foreground border-primary";case"current":return"bg-primary text-primary-foreground border-primary";case"error":return"bg-destructive text-destructive-foreground border-destructive";case"skipped":return"bg-muted text-muted-foreground border-muted";default:return"bg-background text-muted-foreground border-border"}};return r==="vertical"?e.jsx("div",{className:"flex flex-col gap-0",children:t.map((u,f)=>{const m=a[f],p=i&&f<s;return e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("button",{type:"button",disabled:!p,onClick:()=>p&&o?.(f),className:b.cn("flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors",l(m),p&&"cursor-pointer hover:opacity-80"),children:u.icon||c(f,m)}),f<t.length-1&&e.jsx("div",{className:b.cn("w-0.5 flex-1 min-h-[24px]",a[f]==="completed"?"bg-primary":"bg-border")})]}),e.jsxs("div",{className:"pb-8",children:[e.jsxs("div",{className:b.cn("font-medium",m==="current"?"text-foreground":"text-muted-foreground"),children:[u.title,u.optional&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(optionnel)"})]}),u.description&&e.jsx("div",{className:"text-sm text-muted-foreground mt-0.5",children:u.description})]})]},u.id)})}):e.jsx("div",{className:"flex items-center gap-0",children:t.map((u,f)=>{const m=a[f],p=i&&f<s;return e.jsxs(d.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("button",{type:"button",disabled:!p,onClick:()=>p&&o?.(f),className:b.cn("flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors",l(m),p&&"cursor-pointer hover:opacity-80"),children:u.icon||c(f,m)}),e.jsx("div",{className:"text-center",children:e.jsx("div",{className:b.cn("text-sm font-medium",m==="current"?"text-foreground":"text-muted-foreground"),children:u.title})})]}),f<t.length-1&&e.jsx("div",{className:b.cn("flex-1 h-0.5 mx-2 mb-6",a[f]==="completed"?"bg-primary":"bg-border")})]},u.id)})})}function Iv({onPrev:t,onNext:s,onSkip:a,onCancel:n,isFirstStep:r,isLastStep:o,isOptional:i,prevButtonText:c,nextButtonText:l,finishButtonText:u,skipButtonText:f,cancelButtonText:m,showCancelButton:p,submitting:g}){return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex gap-2",children:p&&n&&e.jsx(j.Button,{type:"button",variant:"ghost",onClick:n,disabled:g,children:m})}),e.jsxs("div",{className:"flex gap-2",children:[!r&&e.jsxs(j.Button,{type:"button",variant:"outline",onClick:t,disabled:g,children:[e.jsx(h.ArrowLeft,{className:"mr-2 h-4 w-4"}),c]}),i&&a&&!o&&e.jsx(j.Button,{type:"button",variant:"ghost",onClick:a,disabled:g,children:f}),e.jsxs(j.Button,{type:"button",onClick:s,disabled:g,children:[g&&e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),o?u:l,!o&&!g&&e.jsx(h.ArrowRight,{className:"ml-2 h-4 w-4"})]})]})]})}function Lv({steps:t,currentStep:s,onStepChange:a,onSubmit:n,onCancel:r,title:o,description:i,prevButtonText:c="Précédent",nextButtonText:l="Suivant",finishButtonText:u="Terminer",cancelButtonText:f="Annuler",skipButtonText:m="Passer",showCancelButton:p=!0,showProgress:g=!0,showStepNumbers:C=!0,showStepper:y=!0,stepperPosition:N="top",allowBackNavigation:v=!0,confirmCancel:x=!0,cancelConfirmMessage:w="Êtes-vous sûr de vouloir annuler ? Toutes les modifications seront perdues.",submitting:k=!1,layout:D="card",className:S}){const[F,A]=d.useState(0),[T,M]=d.useState(t.map((J,B)=>B===0?"current":"pending")),[I,E]=d.useState(!1),P=s??F,G=P===0,H=P===t.length-1,X=t[P],z=(P+1)/t.length*100,L=(J,B)=>{M(te=>{const se=[...te];if(B==="next"&&P<t.length)se[P]="completed";else if(B==="skip")se[P]="skipped";else if(B==="goto"&&J<P)for(let ee=J+1;ee<t.length;ee++)se[ee]="pending";return se[J]="current",se})},_=async J=>{if(J<0||J>=t.length||J>P&&!v)return;X.onLeave&&await X.onLeave(),L(J,"goto"),a?a(J):A(J);const B=t[J];B.onEnter&&await B.onEnter()},R=async()=>{if(X.validate&&!await X.validate()){M(B=>{const te=[...B];return te[P]="error",te});return}if(X.onLeave&&await X.onLeave(),H){const J={steps:t.map((B,te)=>({id:B.id,status:te===P?"completed":T[te]})),completedSteps:t.filter((B,te)=>T[te]==="completed"||te===P).map(B=>B.id),skippedSteps:t.filter((B,te)=>T[te]==="skipped").map(B=>B.id)};await n?.(J)}else{const J=P+1;L(J,"next"),a?a(J):A(J);const B=t[J];B.onEnter&&await B.onEnter()}},U=async()=>{if(G)return;X.onLeave&&await X.onLeave();const J=P-1;L(J,"prev"),a?a(J):A(J);const B=t[J];B.onEnter&&await B.onEnter()},$=async()=>{if(!X.optional||H)return;X.onLeave&&await X.onLeave();const J=P+1;L(J,"skip"),a?a(J):A(J);const B=t[J];B.onEnter&&await B.onEnter()},Z=()=>{x?E(!0):r?.()},Q={currentStep:P,totalSteps:t.length,stepStatuses:T,goToStep:_,nextStep:R,prevStep:U,skipStep:$,isFirstStep:G,isLastStep:H},K=y&&e.jsx(Rv,{steps:t,currentStep:P,stepStatuses:T,showStepNumbers:C,orientation:N==="left"?"vertical":"horizontal",onStepClick:_,allowBackNavigation:v}),q=e.jsx(Iv,{onPrev:U,onNext:R,onSkip:X.optional?$:void 0,onCancel:r?Z:void 0,isFirstStep:G,isLastStep:H,isOptional:X.optional||!1,prevButtonText:c,nextButtonText:l,finishButtonText:u,skipButtonText:m,cancelButtonText:f,showCancelButton:p,submitting:k}),W=e.jsxs(Fc.Provider,{value:Q,children:[N==="left"?e.jsxs("div",{className:"flex gap-8",children:[e.jsx("div",{className:"w-64 flex-shrink-0",children:K}),e.jsxs("div",{className:"flex-1",children:[g&&e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground mb-2",children:[e.jsxs("span",{children:["Étape ",P+1," sur ",t.length]}),e.jsxs("span",{children:[Math.round(z),"%"]})]}),e.jsx(Es,{value:z})]}),e.jsx("div",{className:"min-h-[300px]",children:X.content}),e.jsx("div",{className:"mt-8",children:q})]})]}):e.jsxs(e.Fragment,{children:[K&&e.jsx("div",{className:"mb-8",children:K}),g&&e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground mb-2",children:[e.jsxs("span",{children:["Étape ",P+1," sur ",t.length]}),e.jsxs("span",{children:[Math.round(z),"%"]})]}),e.jsx(Es,{value:z})]}),e.jsx("div",{className:"min-h-[300px]",children:X.content}),e.jsx("div",{className:"mt-8",children:q})]}),e.jsx(cs,{open:I,onOpenChange:E,children:e.jsxs(qt,{children:[e.jsxs(Ut,{children:[e.jsx(Gt,{children:"Annuler ?"}),e.jsx(Xt,{children:w})]}),e.jsxs(Ht,{children:[e.jsx(Qt,{children:"Non, continuer"}),e.jsx(Yt,{onClick:()=>{E(!1),r?.()},children:"Oui, annuler"})]})]})})]});return D==="minimal"?e.jsx("div",{className:b.cn("space-y-6",S),children:W}):D==="page"?e.jsxs("div",{className:b.cn("container py-8 max-w-4xl",S),children:[(o||i)&&e.jsxs("div",{className:"mb-8",children:[o&&e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:o}),i&&e.jsx("p",{className:"text-muted-foreground mt-1",children:i})]}),W]}):e.jsxs(Ce,{className:S,children:[(o||i)&&e.jsxs(Ve,{children:[o&&e.jsx(Oe,{children:o}),i&&e.jsx(et,{children:i})]}),e.jsx(Pe,{children:W})]})}const $v=[{id:"step-1",title:"Informations de base",description:"Renseignez vos informations personnelles",content:e.jsx("div",{className:"space-y-4",children:e.jsx("p",{className:"text-muted-foreground",children:"Contenu de l'étape 1 - Informations de base"})})},{id:"step-2",title:"Configuration",description:"Configurez vos préférences",optional:!0,content:e.jsx("div",{className:"space-y-4",children:e.jsx("p",{className:"text-muted-foreground",children:"Contenu de l'étape 2 - Configuration (optionnel)"})})},{id:"step-3",title:"Confirmation",description:"Vérifiez et confirmez",content:e.jsx("div",{className:"space-y-4",children:e.jsx("p",{className:"text-muted-foreground",children:"Contenu de l'étape 3 - Confirmation"})})}];function Ov({value:t,onChange:s,placeholder:a}){return e.jsxs("div",{className:"relative",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(j.Input,{type:"text",placeholder:a,value:t,onChange:n=>s(n.target.value),className:"pl-10"})]})}function zv({categories:t,activeCategory:s,onCategoryChange:a,itemCounts:n}){return e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>a(null),className:b.cn("inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors",s===null?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:["Tous",e.jsx(ye,{variant:"secondary",className:"ml-1",children:Object.values(n).reduce((r,o)=>r+o,0)})]}),t.map(r=>e.jsxs("button",{type:"button",onClick:()=>a(r.id),className:b.cn("inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors",s===r.id?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:[r.icon,r.name,e.jsx(ye,{variant:"secondary",className:"ml-1",children:n[r.id]||0})]},r.id))]})}function _v({itemId:t,helpful:s=0,notHelpful:a=0,onFeedback:n}){const[r,o]=d.useState(null),i=c=>{r===null&&(o(c),n(t,c))};return e.jsxs("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Cette réponse vous a-t-elle aidé ?"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>i(!0),disabled:r!==null,className:b.cn("inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors",r===!0?"bg-green-100 text-green-700":r===null?"hover:bg-muted":"opacity-50"),children:["👍 ",s+(r===!0?1:0)]}),e.jsxs("button",{type:"button",onClick:()=>i(!1),disabled:r!==null,className:b.cn("inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors",r===!1?"bg-red-100 text-red-700":r===null?"hover:bg-muted":"opacity-50"),children:["👎 ",a+(r===!1?1:0)]})]})]})}function Vv({items:t,categories:s=[],title:a="Questions fréquentes",description:n,showSearch:r=!0,searchPlaceholder:o="Rechercher une question...",showCategoryFilter:i=!0,activeCategory:c,onCategoryChange:l,allowMultiple:u=!1,defaultOpen:f=[],showFeedback:m=!1,onFeedback:p,layout:g="default",size:C="md",className:y}){const[N,v]=d.useState(""),[x,w]=d.useState(null),k=c??x,D=E=>{l?l(E):w(E)},S=d.useMemo(()=>t.filter(E=>{if(N){const P=N.toLowerCase();if(!(E.question.toLowerCase().includes(P)||typeof E.answer=="string"&&E.answer.toLowerCase().includes(P)||E.tags?.some(H=>H.toLowerCase().includes(P))))return!1}return!(k&&E.category!==k)}),[t,N,k]),F=d.useMemo(()=>{const E={};return t.forEach(P=>{P.category&&(E[P.category]=(E[P.category]||0)+1)}),E},[t]),A=d.useMemo(()=>{if(g!=="grouped")return null;const E={};return S.forEach(P=>{const G=P.category||"other";E[G]||(E[G]=[]),E[G].push(P)}),E},[S,g]),T={sm:{title:"text-xl",question:"text-sm",answer:"text-sm"},md:{title:"text-2xl",question:"text-base",answer:"text-sm"},lg:{title:"text-3xl",question:"text-lg",answer:"text-base"}},M=E=>e.jsx(e.Fragment,{children:E.map(P=>e.jsxs(vn,{value:P.id,className:b.cn(g==="cards"&&"border rounded-lg px-4 bg-card"),children:[e.jsx(yn,{className:b.cn("hover:no-underline",T[C].question),children:e.jsx("span",{className:"text-left",children:P.question})}),e.jsxs(wn,{children:[e.jsx("div",{className:b.cn("text-muted-foreground",T[C].answer),children:typeof P.answer=="string"?e.jsx("p",{children:P.answer}):P.answer}),P.tags&&P.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-3",children:P.tags.map(G=>e.jsx(ye,{variant:"outline",className:"text-xs",children:G},G))}),m&&p&&e.jsx(_v,{itemId:P.id,helpful:P.helpful,notHelpful:P.notHelpful,onFeedback:p})]})]},P.id))}),I=E=>u?e.jsx(cn,{type:"multiple",defaultValue:f,className:"space-y-2",children:M(E)}):e.jsx(cn,{type:"single",defaultValue:f[0],collapsible:!0,className:"space-y-2",children:M(E)});return e.jsxs("div",{className:b.cn("space-y-6",y),children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:b.cn("font-bold tracking-tight",T[C].title),children:a}),n&&e.jsx("p",{className:"text-muted-foreground mt-2 max-w-2xl mx-auto",children:n})]}),r&&e.jsx("div",{className:"max-w-md mx-auto",children:e.jsx(Ov,{value:N,onChange:v,placeholder:o})}),i&&s.length>0&&e.jsx("div",{className:"flex justify-center",children:e.jsx(zv,{categories:s,activeCategory:k,onCategoryChange:D,itemCounts:F})}),S.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(h.HelpCircle,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Aucune question ne correspond à votre recherche."})]}):g==="grouped"&&A?e.jsx("div",{className:"space-y-8",children:Object.entries(A).map(([E,P])=>{const G=s.find(H=>H.id===E);return e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[G?.icon,G?.name||E]}),I(P)]},E)})}):e.jsx("div",{className:"max-w-3xl mx-auto",children:I(S)})]})}const Bv=[{id:"general",name:"Général",icon:e.jsx(h.HelpCircle,{className:"h-4 w-4"})},{id:"billing",name:"Facturation",icon:e.jsx(h.MessageCircle,{className:"h-4 w-4"})},{id:"technical",name:"Technique",icon:e.jsx(h.MessageCircle,{className:"h-4 w-4"})}],Wv=[{id:"1",question:"Comment créer un compte ?",answer:"Pour créer un compte, cliquez sur le bouton 'S'inscrire' en haut à droite de la page, puis remplissez le formulaire avec vos informations personnelles.",category:"general",tags:["compte","inscription"]},{id:"2",question:"Comment réinitialiser mon mot de passe ?",answer:"Cliquez sur 'Mot de passe oublié' sur la page de connexion, entrez votre email et suivez les instructions envoyées par email.",category:"general",tags:["mot de passe","sécurité"]},{id:"3",question:"Quels moyens de paiement acceptez-vous ?",answer:"Nous acceptons les cartes de crédit (Visa, Mastercard, Amex), PayPal et les virements bancaires pour les entreprises.",category:"billing",tags:["paiement","carte"]},{id:"4",question:"Comment annuler mon abonnement ?",answer:"Vous pouvez annuler votre abonnement à tout moment depuis les paramètres de votre compte, section 'Abonnement'.",category:"billing",tags:["abonnement","annulation"]},{id:"5",question:"L'API est-elle disponible ?",answer:"Oui, notre API REST est disponible pour tous les plans payants. Consultez notre documentation développeur pour plus d'informations.",category:"technical",tags:["API","développeur"]}],Rc={created:{icon:h.Plus,color:"text-green-500",label:"créé"},updated:{icon:h.Edit,color:"text-blue-500",label:"modifié"},deleted:{icon:h.Trash2,color:"text-red-500",label:"supprimé"},commented:{icon:h.MessageSquare,color:"text-purple-500",label:"commenté"},uploaded:{icon:h.Upload,color:"text-cyan-500",label:"uploadé"},downloaded:{icon:h.Download,color:"text-gray-500",label:"téléchargé"},shared:{icon:h.User,color:"text-orange-500",label:"partagé"},approved:{icon:h.Check,color:"text-green-500",label:"approuvé"},rejected:{icon:h.X,color:"text-red-500",label:"rejeté"},mentioned:{icon:h.Bell,color:"text-yellow-500",label:"mentionné"},assigned:{icon:h.User,color:"text-indigo-500",label:"assigné"},completed:{icon:h.Check,color:"text-green-500",label:"terminé"},custom:{icon:h.AlertCircle,color:"text-gray-500",label:""}};function Eo({user:t,size:s="sm"}){const a={sm:"h-8 w-8",md:"h-10 w-10"},n=t.name.split(" ").map(r=>r[0]).join("").toUpperCase().slice(0,2);return e.jsxs(Dt,{className:a[s],children:[e.jsx(Tt,{src:t.avatar,alt:t.name}),e.jsx(Et,{className:"text-xs",children:n})]})}function Po({type:t,customIcon:s,customColor:a}){const n=Rc[t],r=n.icon;return e.jsx("div",{className:b.cn("flex h-8 w-8 items-center justify-center rounded-full bg-background border-2 shadow-sm",a||n.color),children:s||e.jsx(r,{className:"h-4 w-4"})})}function qv({activity:t,showAvatar:s,relativeTime:a,layout:n,isLast:r}){const o=c=>{const l=typeof c=="string"?new Date(c):c;if(a){const f=new Date().getTime()-l.getTime(),m=Math.floor(f/6e4),p=Math.floor(m/60),g=Math.floor(p/24);if(m<1)return"À l'instant";if(m<60)return`Il y a ${m} min`;if(p<24)return`Il y a ${p}h`;if(g<7)return`Il y a ${g}j`}return l.toLocaleDateString("fr-FR",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})},i=Rc[t.type];return n==="compact"?e.jsxs("div",{className:"flex items-center gap-3 py-2",children:[e.jsx(Po,{type:t.type,customIcon:t.icon,customColor:t.color}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("p",{className:"text-sm truncate",children:[e.jsx("span",{className:"font-medium",children:t.user.name})," ",e.jsx("span",{className:"text-muted-foreground",children:t.title})]})}),e.jsx("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:o(t.timestamp)})]}):n==="feed"?e.jsx(Ce,{className:"mb-4",children:e.jsx(Pe,{className:"pt-4",children:e.jsxs("div",{className:"flex gap-3",children:[s&&e.jsx(Eo,{user:t.user,size:"md"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium",children:t.user.name}),e.jsx(ye,{variant:"secondary",className:"text-xs",children:i.label||t.type}),e.jsx("span",{className:"text-xs text-muted-foreground",children:o(t.timestamp)})]}),e.jsx("p",{className:"text-sm",children:t.title}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.description}),t.metadata?.comment&&e.jsx("div",{className:"mt-2 p-3 bg-muted rounded-lg text-sm",children:t.metadata.comment})]})]})})}):e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx(Po,{type:t.type,customIcon:t.icon,customColor:t.color}),!r&&e.jsx("div",{className:"w-0.5 flex-1 bg-border mt-2"})]}),e.jsx("div",{className:"flex-1 pb-8",children:e.jsxs("div",{className:"flex items-start gap-3",children:[s&&e.jsx(Eo,{user:t.user}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium",children:t.user.name}),e.jsx("span",{className:"text-muted-foreground",children:t.title})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.description}),t.metadata?.comment&&e.jsx("div",{className:"mt-2 p-3 bg-muted rounded-lg text-sm",children:t.metadata.comment}),e.jsx("span",{className:"text-xs text-muted-foreground mt-2 block",children:o(t.timestamp)})]})]})})]})}function Uv({activities:t,title:s="Activité",showSearch:a=!0,showFilters:n=!0,filters:r=[],activeFilter:o,onFilterChange:i,showRefresh:c=!0,onRefresh:l,loading:u=!1,groupByDay:f=!0,showLoadMore:m=!1,onLoadMore:p,loadingMore:g=!1,showAvatars:C=!0,relativeTime:y=!0,layout:N="timeline",className:v}){const[x,w]=d.useState(""),[k,D]=d.useState(null),S=o??k,F=I=>{i?i(I):D(I)},A=d.useMemo(()=>{let I=t;if(x){const E=x.toLowerCase();I=I.filter(P=>P.title.toLowerCase().includes(E)||P.user.name.toLowerCase().includes(E)||P.description?.toLowerCase().includes(E))}if(S){const E=r.find(P=>P.id===S);E&&(I=I.filter(P=>E.types.includes(P.type)))}return I},[t,x,S,r]),T=d.useMemo(()=>{if(!f)return null;const I={};return A.forEach(E=>{const G=(typeof E.timestamp=="string"?new Date(E.timestamp):E.timestamp).toLocaleDateString("fr-FR",{weekday:"long",day:"numeric",month:"long",year:"numeric"});I[G]||(I[G]=[]),I[G].push(E)}),I},[A,f]),M=I=>e.jsx("div",{children:I.map((E,P)=>e.jsx(qv,{activity:E,showAvatar:C,relativeTime:y,layout:N,isLast:P===I.length-1},E.id))});return e.jsxs("div",{className:b.cn("space-y-4",v),children:[e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold",children:s}),e.jsx("div",{className:"flex items-center gap-2",children:c&&l&&e.jsx(j.Button,{variant:"outline",size:"sm",onClick:l,disabled:u,children:e.jsx(h.RefreshCw,{className:b.cn("h-4 w-4",u&&"animate-spin")})})})]}),(a||n)&&e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center",children:[a&&e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(j.Input,{placeholder:"Rechercher...",value:x,onChange:I=>w(I.target.value),className:"pl-9"})]}),n&&r.length>0&&e.jsxs(Be,{value:S||"all",onValueChange:I=>F(I==="all"?null:I),children:[e.jsxs(ze,{className:"w-[180px]",children:[e.jsx(h.Filter,{className:"h-4 w-4 mr-2"}),e.jsx(We,{placeholder:"Filtrer"})]}),e.jsxs(_e,{children:[e.jsx(ke,{value:"all",children:"Toutes les activités"}),r.map(I=>e.jsx(ke,{value:I.id,children:I.label},I.id))]})]})]}),u?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(h.RefreshCw,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):A.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(h.Clock,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Aucune activité"})]}):f&&T?e.jsx("div",{className:"space-y-6",children:Object.entries(T).map(([I,E])=>e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-4 capitalize",children:I}),M(E)]},I))}):M(A),m&&p&&e.jsx("div",{className:"flex justify-center pt-4",children:e.jsxs(j.Button,{variant:"outline",onClick:p,disabled:g,children:[g?e.jsx(h.RefreshCw,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx(h.ChevronDown,{className:"h-4 w-4 mr-2"}),"Charger plus"]})})]})}const Hv=[{id:"edits",label:"Modifications",types:["created","updated","deleted"]},{id:"comments",label:"Commentaires",types:["commented","mentioned"]},{id:"files",label:"Fichiers",types:["uploaded","downloaded","shared"]},{id:"approvals",label:"Approbations",types:["approved","rejected","completed"]}],Gv=[{id:"1",type:"created",title:"a créé le document 'Rapport Q4'",user:{id:"1",name:"Marie Dupont"},timestamp:new Date(Date.now()-1e3*60*5)},{id:"2",type:"commented",title:"a commenté sur 'Projet Alpha'",user:{id:"2",name:"Pierre Martin"},timestamp:new Date(Date.now()-1e3*60*30),metadata:{comment:"Super travail sur cette partie !"}},{id:"3",type:"uploaded",title:"a uploadé 3 fichiers",user:{id:"3",name:"Sophie Bernard"},timestamp:new Date(Date.now()-1e3*60*60*2)},{id:"4",type:"approved",title:"a approuvé la demande de congés",user:{id:"1",name:"Marie Dupont"},timestamp:new Date(Date.now()-1e3*60*60*24)}],Mo={low:{label:"Basse",color:"bg-gray-500",icon:h.Clock},medium:{label:"Moyenne",color:"bg-blue-500",icon:h.Clock},high:{label:"Haute",color:"bg-orange-500",icon:h.AlertCircle},urgent:{label:"Urgente",color:"bg-red-500",icon:h.AlertCircle}};function Xv({card:t,columnId:s,showAssignees:a,showLabels:n,showPriority:r,showDueDate:o,draggable:i,onCardClick:c,onCardEdit:l,onCardDelete:u,onDragStart:f}){const m=d.useMemo(()=>t.dueDate?(typeof t.dueDate=="string"?new Date(t.dueDate):t.dueDate)<new Date:!1,[t.dueDate]),p=g=>(typeof g=="string"?new Date(g):g).toLocaleDateString("fr-FR",{day:"numeric",month:"short"});return e.jsx(Ce,{className:b.cn("cursor-pointer hover:shadow-md transition-shadow",i&&"cursor-grab active:cursor-grabbing"),draggable:i,onDragStart:g=>f?.(g,t.id,s),onClick:()=>c?.(t,s),children:e.jsxs(Pe,{className:"p-3 space-y-2",children:[n&&t.labels&&t.labels.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:t.labels.map(g=>e.jsx("div",{className:"h-1.5 w-8 rounded-full",style:{backgroundColor:g.color},title:g.name},g.id))}),e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:"text-sm font-medium leading-tight",children:t.title}),e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,onClick:g=>g.stopPropagation(),children:e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0",children:e.jsx(h.MoreHorizontal,{className:"h-3 w-3"})})}),e.jsxs(Ye,{align:"end",children:[e.jsxs(Ne,{onClick:g=>{g.stopPropagation(),c?.(t,s)},children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Modifier"]}),e.jsx(dt,{}),e.jsxs(Ne,{onClick:g=>{g.stopPropagation(),u?.(t.id,s)},className:"text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]}),t.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:t.description}),e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[r&&t.priority&&e.jsx("div",{className:b.cn("h-2 w-2 rounded-full",Mo[t.priority].color),title:Mo[t.priority].label}),o&&t.dueDate&&e.jsxs(ye,{variant:m?"destructive":"outline",className:"text-xs px-1.5 py-0",children:[e.jsx(h.Calendar,{className:"h-3 w-3 mr-1"}),p(t.dueDate)]})]}),a&&t.assignees&&t.assignees.length>0&&e.jsxs("div",{className:"flex -space-x-1",children:[t.assignees.slice(0,3).map(g=>e.jsxs(Dt,{className:"h-5 w-5 border-2 border-background",children:[e.jsx(Tt,{src:g.avatar}),e.jsx(Et,{className:"text-[8px]",children:g.name.charAt(0)})]},g.id)),t.assignees.length>3&&e.jsxs("div",{className:"h-5 w-5 rounded-full bg-muted flex items-center justify-center text-[8px] border-2 border-background",children:["+",t.assignees.length-3]})]})]})]})})}function Yv({column:t,showCardCount:s,showAddCard:a,showAssignees:n,showLabels:r,showPriority:o,showDueDate:i,draggable:c,onCardClick:l,onCardAdd:u,onCardEdit:f,onCardDelete:m,onColumnEdit:p,onColumnDelete:g,onDragStart:C,onDragOver:y,onDrop:N}){const[v,x]=d.useState(!1),[w,k]=d.useState(""),[D,S]=d.useState(!1),[F,A]=d.useState(t.title),T=()=>{w.trim()&&(u?.(t.id,{title:w.trim()}),k(""),x(!1))},M=()=>{F.trim()&&F!==t.title&&p?.(t.id,{title:F.trim()}),S(!1)},I=t.limit&&t.cards.length>=t.limit;return e.jsxs("div",{className:"flex flex-col w-72 flex-shrink-0 bg-muted/50 rounded-lg",onDragOver:y,onDrop:E=>N?.(E,t.id),children:[e.jsxs("div",{className:"flex items-center justify-between p-3 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t.color&&e.jsx("div",{className:"h-3 w-3 rounded-full",style:{backgroundColor:t.color}}),D?e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(j.Input,{value:F,onChange:E=>A(E.target.value),className:"h-7 text-sm font-semibold",autoFocus:!0,onBlur:M,onKeyDown:E=>{E.key==="Enter"&&M(),E.key==="Escape"&&S(!1)}})}):e.jsx("h3",{className:"font-semibold text-sm cursor-pointer",onClick:()=>S(!0),children:t.title}),s&&e.jsxs(ye,{variant:"secondary",className:"text-xs",children:[t.cards.length,t.limit&&`/${t.limit}`]})]}),e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(Ye,{align:"end",children:[e.jsxs(Ne,{onClick:()=>S(!0),children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Renommer"]}),e.jsx(dt,{}),e.jsxs(Ne,{onClick:()=>g?.(t.id),className:"text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]}),e.jsxs("div",{className:"flex-1 p-2 space-y-2 min-h-[200px] overflow-y-auto",children:[t.cards.map(E=>e.jsx(Xv,{card:E,columnId:t.id,showAssignees:n,showLabels:r,showPriority:o,showDueDate:i,draggable:c,onCardClick:l,onCardEdit:f,onCardDelete:m,onDragStart:C},E.id)),v&&e.jsxs(Ce,{className:"p-2",children:[e.jsx(j.Textarea,{placeholder:"Titre de la carte...",value:w,onChange:E=>k(E.target.value),className:"min-h-[60px] text-sm",autoFocus:!0}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(j.Button,{size:"sm",onClick:T,children:"Ajouter"}),e.jsx(j.Button,{size:"sm",variant:"ghost",onClick:()=>{x(!1),k("")},children:e.jsx(h.X,{className:"h-4 w-4"})})]})]})]}),a&&!v&&!I&&e.jsx("div",{className:"p-2 border-t",children:e.jsxs(j.Button,{variant:"ghost",size:"sm",className:"w-full justify-start",onClick:()=>x(!0),children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-2"}),"Ajouter une carte"]})}),I&&e.jsx("div",{className:"p-2 border-t text-center text-xs text-muted-foreground",children:"Limite atteinte"})]})}function Qv({columns:t,onColumnsChange:s,onCardClick:a,onCardAdd:n,onCardEdit:r,onCardDelete:o,onCardMove:i,onColumnAdd:c,onColumnEdit:l,onColumnDelete:u,showAddCard:f=!0,showAddColumn:m=!0,showCardCount:p=!0,showAssignees:g=!0,showLabels:C=!0,showPriority:y=!0,showDueDate:N=!0,draggable:v=!0,availableLabels:x=[],availableAssignees:w=[],className:k}){const[D,S]=d.useState(t),[F,A]=d.useState(null),[T,M]=d.useState(!1),[I,E]=d.useState("");d.useEffect(()=>{S(t)},[t]);const P=(R,U,$)=>{A({cardId:U,columnId:$}),R.dataTransfer.effectAllowed="move"},G=R=>{R.preventDefault(),R.dataTransfer.dropEffect="move"},H=(R,U)=>{if(R.preventDefault(),!F)return;const{cardId:$,columnId:Z}=F;if(Z===U){A(null);return}if(i)i($,Z,U,0);else{const Q=D.map(K=>{if(K.id===Z)return{...K,cards:K.cards.filter(q=>q.id!==$)};if(K.id===U){const q=D.find(W=>W.id===Z)?.cards.find(W=>W.id===$);if(q)return{...K,cards:[...K.cards,q]}}return K});S(Q),s?.(Q)}A(null)},X=(R,U)=>{if(n)n(R,U);else{const $={id:`card-${Date.now()}`,title:U.title||"Nouvelle carte",...U},Z=D.map(Q=>Q.id===R?{...Q,cards:[...Q.cards,$]}:Q);S(Z),s?.(Z)}},z=(R,U)=>{if(o)o(R,U);else{const $=D.map(Z=>Z.id===U?{...Z,cards:Z.cards.filter(Q=>Q.id!==R)}:Z);S($),s?.($)}},L=R=>{if(u)u(R);else{const U=D.filter($=>$.id!==R);S(U),s?.(U)}},_=()=>{if(I.trim()){const R={id:`column-${Date.now()}`,title:I.trim(),cards:[]};if(c)c(R);else{const U=[...D,R];S(U),s?.(U)}E(""),M(!1)}};return e.jsx("div",{className:b.cn("overflow-x-auto",k),children:e.jsxs("div",{className:"flex gap-4 p-4 min-h-[500px]",children:[D.map(R=>e.jsx(Yv,{column:R,showCardCount:p,showAddCard:f,showAssignees:g,showLabels:C,showPriority:y,showDueDate:N,draggable:v,onCardClick:a,onCardAdd:X,onCardEdit:r,onCardDelete:z,onColumnEdit:l,onColumnDelete:L,onDragStart:P,onDragOver:G,onDrop:H},R.id)),m&&e.jsx("div",{className:"w-72 flex-shrink-0",children:T?e.jsxs(Ce,{className:"p-3",children:[e.jsx(j.Input,{placeholder:"Titre de la colonne...",value:I,onChange:R=>E(R.target.value),autoFocus:!0,onKeyDown:R=>{R.key==="Enter"&&_(),R.key==="Escape"&&M(!1)}}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(j.Button,{size:"sm",onClick:_,children:"Ajouter"}),e.jsx(j.Button,{size:"sm",variant:"ghost",onClick:()=>{M(!1),E("")},children:e.jsx(h.X,{className:"h-4 w-4"})})]})]}):e.jsxs(j.Button,{variant:"outline",className:"w-full justify-start h-12",onClick:()=>M(!0),children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-2"}),"Ajouter une colonne"]})})]})})}const Kv=[{id:"todo",title:"À faire",color:"#6b7280",cards:[{id:"1",title:"Implémenter l'authentification",description:"Ajouter le login/logout avec JWT",priority:"high",labels:[{id:"dev",name:"Dev",color:"#3b82f6"}],assignees:[{id:"1",name:"Marie D."}]},{id:"2",title:"Créer les maquettes",priority:"medium",labels:[{id:"design",name:"Design",color:"#8b5cf6"}]}]},{id:"in-progress",title:"En cours",color:"#3b82f6",limit:3,cards:[{id:"3",title:"Refactoring du dashboard",priority:"medium",assignees:[{id:"2",name:"Pierre M."}],dueDate:new Date(Date.now()+1e3*60*60*24*2)}]},{id:"review",title:"En revue",color:"#f59e0b",cards:[]},{id:"done",title:"Terminé",color:"#10b981",cards:[{id:"4",title:"Setup du projet",priority:"low"}]}],Jv=[{id:"dev",name:"Dev",color:"#3b82f6"},{id:"design",name:"Design",color:"#8b5cf6"},{id:"bug",name:"Bug",color:"#ef4444"},{id:"feature",name:"Feature",color:"#10b981"}];function Zv({conversations:t,activeId:s,currentUser:a,onSelect:n,onSearch:r}){const[o,i]=d.useState(""),c=m=>m.name?m.name:m.participants.filter(g=>g.id!==a.id).map(g=>g.name).join(", "),l=m=>{if(m.avatar)return{url:m.avatar,fallback:m.name?.charAt(0)||"G"};if(m.isGroup)return{fallback:"G"};const p=m.participants.find(g=>g.id!==a.id);return{url:p?.avatar,fallback:p?.name.charAt(0)||"?"}},u=m=>{if(!m)return"";const p=typeof m=="string"?new Date(m):m,C=new Date().getTime()-p.getTime(),y=Math.floor(C/(1e3*60*60*24));return y===0?p.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"}):y===1?"Hier":y<7?p.toLocaleDateString("fr-FR",{weekday:"short"}):p.toLocaleDateString("fr-FR",{day:"numeric",month:"short"})},f=t.filter(m=>o?c(m).toLowerCase().includes(o.toLowerCase()):!0);return e.jsxs("div",{className:"flex flex-col h-full border-r",children:[e.jsx("div",{className:"p-3 border-b",children:e.jsxs("div",{className:"relative",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(j.Input,{placeholder:"Rechercher...",value:o,onChange:m=>{i(m.target.value),r?.(m.target.value)},className:"pl-9"})]})}),e.jsx(St,{className:"flex-1",children:f.map(m=>{const p=l(m),g=c(m),C=m.participants.find(y=>y.id!==a.id);return e.jsxs("button",{onClick:()=>n(m),className:b.cn("w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors text-left",s===m.id&&"bg-muted"),children:[e.jsxs("div",{className:"relative",children:[e.jsxs(Dt,{children:[e.jsx(Tt,{src:p.url}),e.jsx(Et,{children:p.fallback})]}),C?.status==="online"&&e.jsx("div",{className:"absolute bottom-0 right-0 h-3 w-3 rounded-full bg-green-500 border-2 border-background"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:g}),e.jsx("span",{className:"text-xs text-muted-foreground",children:u(m.lastMessage?.timestamp)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:m.lastMessage?.content||"Aucun message"}),m.unreadCount&&m.unreadCount>0&&e.jsx(ye,{className:"h-5 min-w-[20px] justify-center",children:m.unreadCount})]})]})]},m.id)})})]})}function ey({conversation:t,currentUser:s,onAudioCall:a,onVideoCall:n}){const r=t.participants.find(c=>c.id!==s.id),o=t.name||r?.name||"Chat",i=()=>t.isGroup?`${t.participants.length} participants`:r?.status==="online"?"En ligne":r?.lastSeen?`Vu ${(typeof r.lastSeen=="string"?new Date(r.lastSeen):r.lastSeen).toLocaleString("fr-FR")}`:"Hors ligne";return e.jsxs("div",{className:"flex items-center justify-between p-3 border-b",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(Dt,{children:[e.jsx(Tt,{src:t.avatar||r?.avatar}),e.jsx(Et,{children:o.charAt(0)})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-sm",children:o}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i()})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[a&&e.jsx(j.Button,{variant:"ghost",size:"icon",onClick:a,children:e.jsx(h.Phone,{className:"h-4 w-4"})}),n&&e.jsx(j.Button,{variant:"ghost",size:"icon",onClick:n,children:e.jsx(h.Video,{className:"h-4 w-4"})}),e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx(j.Button,{variant:"ghost",size:"icon",children:e.jsx(h.MoreVertical,{className:"h-4 w-4"})})}),e.jsx(Ye,{align:"end",children:e.jsxs(Ne,{children:[e.jsx(h.Settings,{className:"mr-2 h-4 w-4"}),"Paramètres"]})})]})]})]})}function ty({message:t,isOwn:s,showStatus:a,showTimestamp:n,onDelete:r,onReply:o}){const i=l=>(typeof l=="string"?new Date(l):l).toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"}),c=()=>{switch(t.status){case"sending":return e.jsx("div",{className:"h-3 w-3 rounded-full border-2 border-current animate-pulse"});case"sent":return e.jsx(h.Check,{className:"h-3 w-3"});case"delivered":return e.jsx(h.CheckCheck,{className:"h-3 w-3"});case"read":return e.jsx(h.CheckCheck,{className:"h-3 w-3 text-blue-500"});case"error":return e.jsx(h.X,{className:"h-3 w-3 text-red-500"});default:return null}};return e.jsxs("div",{className:b.cn("flex gap-2 group",s?"flex-row-reverse":"flex-row"),children:[!s&&e.jsxs(Dt,{className:"h-8 w-8",children:[e.jsx(Tt,{src:t.sender.avatar}),e.jsx(Et,{className:"text-xs",children:t.sender.name.charAt(0)})]}),e.jsxs("div",{className:b.cn("max-w-[70%]",s&&"items-end"),children:[t.replyTo&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-1 p-2 bg-muted/50 rounded border-l-2 border-primary",children:[e.jsx("span",{className:"font-medium",children:t.replyTo.sender.name}),e.jsx("p",{className:"truncate",children:t.replyTo.content})]}),e.jsxs("div",{className:b.cn("relative rounded-2xl px-4 py-2",s?"bg-primary text-primary-foreground rounded-tr-sm":"bg-muted rounded-tl-sm"),children:[t.attachments&&t.attachments.length>0&&e.jsx("div",{className:"space-y-2 mb-2",children:t.attachments.map((l,u)=>e.jsx("div",{children:l.type==="image"?e.jsx("img",{src:l.url,alt:l.name,className:"rounded-lg max-w-full"}):e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-background/10 rounded",children:[e.jsx(h.File,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm truncate",children:l.name})]})},u))}),e.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:t.content}),e.jsxs("div",{className:b.cn("absolute top-0 opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1",s?"-left-20":"-right-20"),children:[e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>o?.(t),children:e.jsx(h.Reply,{className:"h-3 w-3"})}),s&&r&&e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>r(t.id),children:e.jsx(h.Trash2,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:b.cn("flex items-center gap-1 mt-1 text-xs text-muted-foreground",s&&"justify-end"),children:[n&&e.jsx("span",{children:i(t.timestamp)}),t.isEdited&&e.jsx("span",{children:"(modifié)"}),s&&a&&c()]})]})]})}function sy({onSend:t,replyTo:s,onCancelReply:a,showAttachments:n,showEmoji:r,placeholder:o,sending:i}){const[c,l]=d.useState(""),u=d.useRef(null),f=()=>{c.trim()&&!i&&(t(c.trim()),l(""))},m=p=>{p.key==="Enter"&&!p.shiftKey&&(p.preventDefault(),f())};return e.jsxs("div",{className:"border-t p-3",children:[s&&e.jsxs("div",{className:"flex items-center justify-between mb-2 p-2 bg-muted rounded text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Reply,{className:"h-4 w-4 text-primary"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:s.sender.name}),e.jsx("p",{className:"text-muted-foreground truncate",children:s.content})]})]}),e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:a,children:e.jsx(h.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[n&&e.jsx(j.Button,{variant:"ghost",size:"icon",children:e.jsx(h.Paperclip,{className:"h-4 w-4"})}),e.jsx(j.Input,{ref:u,value:c,onChange:p=>l(p.target.value),onKeyDown:m,placeholder:o,className:"flex-1",disabled:i}),r&&e.jsx(j.Button,{variant:"ghost",size:"icon",children:e.jsx(h.Smile,{className:"h-4 w-4"})}),e.jsx(j.Button,{onClick:f,disabled:!c.trim()||i,children:e.jsx(h.Send,{className:"h-4 w-4"})})]})]})}function Ic({conversations:t=[],activeConversation:s,messages:a,currentUser:n,onSendMessage:r,onConversationSelect:o,onMessageDelete:i,onMessageReply:c,onSearch:l,onAudioCall:u,onVideoCall:f,showConversationList:m=!0,showHeader:p=!0,showMessageStatus:g=!0,showTimestamps:C=!0,showAttachments:y=!0,showEmoji:N=!0,inputPlaceholder:v="Écrire un message...",sending:x=!1,loading:w=!1,layout:k="full",className:D}){const[S,F]=d.useState(null),A=d.useRef(null);d.useEffect(()=>{A.current?.scrollIntoView({behavior:"smooth"})},[a]);const T=(E,P)=>{r?.(E,P),F(null)},M=E=>{F(E),c?.(E)},I={full:"h-screen",embedded:"h-[600px]",floating:"h-[500px] w-[400px] rounded-lg shadow-xl"};return e.jsxs("div",{className:b.cn("flex bg-background",I[k],D),children:[m&&e.jsx("div",{className:"w-80 flex-shrink-0",children:e.jsx(Zv,{conversations:t,activeId:s?.id,currentUser:n,onSelect:E=>o?.(E),onSearch:l})}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:s?e.jsxs(e.Fragment,{children:[p&&e.jsx(ey,{conversation:s,currentUser:n,onAudioCall:u,onVideoCall:f}),e.jsx(St,{className:"flex-1 p-4",children:e.jsxs("div",{className:"space-y-4",children:[a.map(E=>e.jsx(ty,{message:E,isOwn:E.sender.id===n.id,showStatus:g,showTimestamp:C,onDelete:i,onReply:M},E.id)),e.jsx("div",{ref:A})]})}),e.jsx(sy,{onSend:T,replyTo:S,onCancelReply:()=>F(null),showAttachments:y,showEmoji:N,placeholder:v,sending:x})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Sélectionnez une conversation"})})]})}const Ls={id:"current",name:"Moi",status:"online"},xn=[{id:"1",participants:[Ls,{id:"2",name:"Marie Dupont",status:"online"}],lastMessage:{id:"m1",content:"D'accord, je m'en occupe !",sender:{id:"2",name:"Marie Dupont"},timestamp:new Date(Date.now()-1e3*60*5),status:"read"},unreadCount:0},{id:"2",participants:[Ls,{id:"3",name:"Pierre Martin",status:"offline"}],lastMessage:{id:"m2",content:"On se voit demain ?",sender:Ls,timestamp:new Date(Date.now()-1e3*60*60),status:"delivered"},unreadCount:2}],Lc=[{id:"1",content:"Salut ! Comment ça va ?",sender:{id:"2",name:"Marie Dupont"},timestamp:new Date(Date.now()-1e3*60*30),status:"read"},{id:"2",content:"Ça va bien merci ! Et toi ?",sender:Ls,timestamp:new Date(Date.now()-1e3*60*25),status:"read"},{id:"3",content:"Super ! Tu as vu le nouveau projet ?",sender:{id:"2",name:"Marie Dupont"},timestamp:new Date(Date.now()-1e3*60*20),status:"read"}],kr={blue:{bg:"bg-blue-100",text:"text-blue-700",border:"border-blue-500"},green:{bg:"bg-green-100",text:"text-green-700",border:"border-green-500"},red:{bg:"bg-red-100",text:"text-red-700",border:"border-red-500"},yellow:{bg:"bg-yellow-100",text:"text-yellow-700",border:"border-yellow-500"},purple:{bg:"bg-purple-100",text:"text-purple-700",border:"border-purple-500"},pink:{bg:"bg-pink-100",text:"text-pink-700",border:"border-pink-500"},orange:{bg:"bg-orange-100",text:"text-orange-700",border:"border-orange-500"},cyan:{bg:"bg-cyan-100",text:"text-cyan-700",border:"border-cyan-500"}};function ay(t,s){const a=[],n=new Date(t,s+1,0);for(let r=1;r<=n.getDate();r++)a.push(new Date(t,s,r));return a}function gn(t,s){return t.getFullYear()===s.getFullYear()&&t.getMonth()===s.getMonth()&&t.getDate()===s.getDate()}function ny(t,s){return t.filter(a=>{const n=typeof a.start=="string"?new Date(a.start):a.start,r=typeof a.end=="string"?new Date(a.end):a.end;return a.allDay?gn(n,s)||s>=n&&s<=r:gn(n,s)})}function ry({currentDate:t,viewMode:s,onPrevious:a,onNext:n,onToday:r,onViewModeChange:o,onAddClick:i,showViewSelector:c,showAddButton:l,locale:u}){const f=()=>{switch(s){case"month":return t.toLocaleDateString(u,{month:"long",year:"numeric"});case"week":return`Semaine du ${t.toLocaleDateString(u,{day:"numeric",month:"long"})}`;case"day":return t.toLocaleDateString(u,{weekday:"long",day:"numeric",month:"long",year:"numeric"});case"agenda":return"Agenda";default:return""}};return e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j.Button,{variant:"outline",size:"icon",onClick:a,children:e.jsx(h.ChevronLeft,{className:"h-4 w-4"})}),e.jsx(j.Button,{variant:"outline",size:"icon",onClick:n,children:e.jsx(h.ChevronRight,{className:"h-4 w-4"})}),e.jsx(j.Button,{variant:"outline",size:"sm",onClick:r,children:"Aujourd'hui"}),e.jsx("h2",{className:"text-xl font-semibold ml-4 capitalize",children:f()})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[c&&o&&e.jsxs(Be,{value:s,onValueChange:m=>o(m),children:[e.jsx(ze,{className:"w-[120px]",children:e.jsx(We,{})}),e.jsxs(_e,{children:[e.jsx(ke,{value:"month",children:"Mois"}),e.jsx(ke,{value:"week",children:"Semaine"}),e.jsx(ke,{value:"day",children:"Jour"}),e.jsx(ke,{value:"agenda",children:"Agenda"})]})]}),l&&i&&e.jsxs(j.Button,{onClick:i,children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-2"}),"Événement"]})]})]})}function oy({event:t,onClick:s,compact:a=!1}){const n=kr[t.color||"blue"],r=typeof t.start=="string"?new Date(t.start):t.start;return e.jsxs("button",{onClick:o=>{o.stopPropagation(),s?.()},className:b.cn("w-full text-left rounded px-1.5 py-0.5 text-xs truncate border-l-2",n.bg,n.text,n.border),children:[!t.allDay&&!a&&e.jsx("span",{className:"font-medium mr-1",children:r.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})}),t.title]})}function iy({event:t,onEdit:s,onDelete:a}){const n=typeof t.start=="string"?new Date(t.start):t.start,r=typeof t.end=="string"?new Date(t.end):t.end,o=kr[t.color||"blue"];return e.jsxs("div",{className:"w-72",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("div",{className:b.cn("w-3 h-3 rounded-full mt-1",o.bg.replace("100","500"))}),e.jsxs("div",{className:"flex gap-1",children:[s&&e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:s,children:e.jsx(h.Edit,{className:"h-3 w-3"})}),a&&e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a,children:e.jsx(h.Trash2,{className:"h-3 w-3"})})]})]}),e.jsx("h4",{className:"font-semibold mt-2",children:t.title}),e.jsxs("div",{className:"space-y-2 mt-3 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Clock,{className:"h-4 w-4"}),t.allDay?e.jsx("span",{children:"Toute la journée"}):e.jsxs("span",{children:[n.toLocaleString("fr-FR",{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})," - ",r.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})]})]}),t.location&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.MapPin,{className:"h-4 w-4"}),e.jsx("span",{children:t.location})]}),t.attendees&&t.attendees.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Users,{className:"h-4 w-4"}),e.jsxs("span",{children:[t.attendees.length," participant(s)"]})]})]}),t.description&&e.jsx("p",{className:"mt-3 text-sm",children:t.description})]})}function ly({currentDate:t,events:s,weekStartsOn:a,locale:n,onDayClick:r,onEventClick:o,onEventEdit:i,onEventDelete:c}){const l=t.getFullYear(),u=t.getMonth(),f=ay(l,u),m=new Date,p=Array.from({length:7},(N,v)=>new Date(2024,0,a+v).toLocaleDateString(n,{weekday:"short"})),C=(new Date(l,u,1).getDay()-a+7)%7,y=[];for(let N=0;N<C;N++)y.push(null);for(y.push(...f);y.length%7!==0;)y.push(null);return e.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[e.jsx("div",{className:"grid grid-cols-7 bg-muted",children:p.map(N=>e.jsx("div",{className:"p-2 text-center text-sm font-medium capitalize",children:N},N))}),e.jsx("div",{className:"grid grid-cols-7",children:y.map((N,v)=>{const x=N?ny(s,N):[],w=N&&gn(N,m),k=N&&N.getMonth()===u;return e.jsx("div",{className:b.cn("min-h-[100px] border-t border-l p-1 cursor-pointer hover:bg-muted/50",!k&&"bg-muted/30 text-muted-foreground"),onClick:()=>N&&r?.(N),children:N&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:b.cn("text-sm font-medium mb-1 w-7 h-7 flex items-center justify-center rounded-full",w&&"bg-primary text-primary-foreground"),children:N.getDate()}),e.jsxs("div",{className:"space-y-1",children:[x.slice(0,3).map(D=>e.jsxs(j.Popover,{children:[e.jsx(j.PopoverTrigger,{asChild:!0,children:e.jsx("div",{children:e.jsx(oy,{event:D,onClick:()=>o?.(D),compact:!0})})}),e.jsx(j.PopoverContent,{children:e.jsx(iy,{event:D,onEdit:()=>i?.(D.id,{}),onDelete:()=>c?.(D.id)})})]},D.id)),x.length>3&&e.jsxs("button",{className:"text-xs text-muted-foreground hover:text-foreground",children:["+",x.length-3," autres"]})]})]})},v)})})]})}function cy({currentDate:t,events:s,locale:a,onEventClick:n}){const r=s.filter(i=>{const c=typeof i.start=="string"?new Date(i.start):i.start,l=new Date(t);return l.setDate(l.getDate()+30),c>=t&&c<=l}).sort((i,c)=>{const l=typeof i.start=="string"?new Date(i.start):i.start,u=typeof c.start=="string"?new Date(c.start):c.start;return l.getTime()-u.getTime()}),o={};return r.forEach(i=>{const l=(typeof i.start=="string"?new Date(i.start):i.start).toDateString();o[l]||(o[l]=[]),o[l].push(i)}),e.jsxs("div",{className:"space-y-4",children:[Object.entries(o).map(([i,c])=>{const l=new Date(i);return e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-2 capitalize",children:l.toLocaleDateString(a,{weekday:"long",day:"numeric",month:"long"})}),e.jsx("div",{className:"space-y-2",children:c.map(u=>{const f=kr[u.color||"blue"],m=typeof u.start=="string"?new Date(u.start):u.start,p=typeof u.end=="string"?new Date(u.end):u.end;return e.jsx(Ce,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>n?.(u),children:e.jsxs(Pe,{className:"p-3 flex gap-3",children:[e.jsx("div",{className:b.cn("w-1 rounded-full",f.bg.replace("100","500"))}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium",children:u.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:u.allDay?"Toute la journée":`${m.toLocaleTimeString(a,{hour:"2-digit",minute:"2-digit"})} - ${p.toLocaleTimeString(a,{hour:"2-digit",minute:"2-digit"})}`}),u.location&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1 mt-1",children:[e.jsx(h.MapPin,{className:"h-3 w-3"}),u.location]})]})]})},u.id)})})]},i)}),Object.keys(o).length===0&&e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Aucun événement à venir"})]})}function dy({events:t,currentDate:s,onDateChange:a,viewMode:n,onViewModeChange:r,onEventClick:o,onEventCreate:i,onEventEdit:c,onEventDelete:l,onDayClick:u,showHeader:f=!0,showViewSelector:m=!0,showAddButton:p=!0,weekStartsOn:g=1,locale:C="fr-FR",className:y}){const[N,v]=d.useState(new Date),[x,w]=d.useState("month"),[k,D]=d.useState(!1),S=s??N,F=n??x,A=P=>{a?a(P):v(P)},T=P=>{r?r(P):w(P)},M=()=>{const P=new Date(S);switch(F){case"month":P.setMonth(P.getMonth()-1);break;case"week":P.setDate(P.getDate()-7);break;case"day":P.setDate(P.getDate()-1);break}A(P)},I=()=>{const P=new Date(S);switch(F){case"month":P.setMonth(P.getMonth()+1);break;case"week":P.setDate(P.getDate()+7);break;case"day":P.setDate(P.getDate()+1);break}A(P)},E=()=>{A(new Date)};return e.jsxs("div",{className:b.cn("space-y-4",y),children:[f&&e.jsx(ry,{currentDate:S,viewMode:F,onPrevious:M,onNext:I,onToday:E,onViewModeChange:T,onAddClick:()=>D(!0),showViewSelector:m,showAddButton:p,locale:C}),F==="month"&&e.jsx(ly,{currentDate:S,events:t,weekStartsOn:g,locale:C,onDayClick:u,onEventClick:o,onEventEdit:c,onEventDelete:l}),F==="agenda"&&e.jsx(cy,{currentDate:S,events:t,locale:C,onEventClick:o}),(F==="week"||F==="day")&&e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:["Vue ",F==="week"?"semaine":"jour"," - À implémenter"]})]})}const uy=[{id:"1",title:"Réunion d'équipe",start:new Date,end:new Date(Date.now()+1e3*60*60),color:"blue",location:"Salle de réunion A"},{id:"2",title:"Déjeuner avec le client",start:new Date(Date.now()+1e3*60*60*24),end:new Date(Date.now()+1e3*60*60*25),color:"green",location:"Restaurant Le Gourmet"},{id:"3",title:"Formation React",start:new Date(Date.now()+1e3*60*60*24*2),end:new Date(Date.now()+1e3*60*60*24*2+1e3*60*60*4),color:"purple",allDay:!0},{id:"4",title:"Deadline projet",start:new Date(Date.now()+1e3*60*60*24*5),end:new Date(Date.now()+1e3*60*60*24*5),color:"red",allDay:!0}],my={folder:{icon:h.Folder,color:"text-yellow-500"},document:{icon:h.FileText,color:"text-blue-500"},image:{icon:h.FileImage,color:"text-green-500"},video:{icon:h.FileVideo,color:"text-purple-500"},audio:{icon:h.FileAudio,color:"text-pink-500"},archive:{icon:h.FileArchive,color:"text-orange-500"},code:{icon:h.FileCode,color:"text-cyan-500"},other:{icon:h.File,color:"text-gray-500"}};function Ao(t){if(!t)return"-";const s=["B","KB","MB","GB","TB"];let a=0,n=t;for(;n>=1024&&a<s.length-1;)n/=1024,a++;return`${n.toFixed(1)} ${s[a]}`}function hy({breadcrumbs:t,viewMode:s,onViewModeChange:a,onNavigate:n,onCreateFolder:r,onUpload:o,onRefresh:i,showSearch:c,onSearch:l,selectedCount:u,onDeleteSelected:f,onDownloadSelected:m}){const[p,g]=d.useState("");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[i&&e.jsx(j.Button,{variant:"outline",size:"icon",onClick:i,children:e.jsx(h.RefreshCw,{className:"h-4 w-4"})}),o&&e.jsxs(j.Button,{variant:"outline",onClick:o,children:[e.jsx(h.Upload,{className:"h-4 w-4 mr-2"}),"Importer"]}),r&&e.jsxs(j.Button,{variant:"outline",onClick:r,children:[e.jsx(h.FolderPlus,{className:"h-4 w-4 mr-2"}),"Nouveau dossier"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[c&&l&&e.jsxs("div",{className:"relative w-64",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(j.Input,{placeholder:"Rechercher...",value:p,onChange:C=>{g(C.target.value),l(C.target.value)},className:"pl-9"})]}),e.jsx(j.Button,{variant:s==="grid"?"secondary":"ghost",size:"icon",onClick:()=>a("grid"),children:e.jsx(h.Grid,{className:"h-4 w-4"})}),e.jsx(j.Button,{variant:s==="list"?"secondary":"ghost",size:"icon",onClick:()=>a("list"),children:e.jsx(h.List,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[e.jsx("button",{onClick:()=>n("/"),className:"flex items-center gap-1 hover:text-primary",children:e.jsx(h.Home,{className:"h-4 w-4"})}),t.map((C,y)=>e.jsxs(d.Fragment,{children:[e.jsx(h.ChevronRight,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("button",{onClick:()=>n(C.path),className:b.cn("hover:text-primary",y===t.length-1&&"font-medium"),children:C.name})]},C.id))]}),u>0&&e.jsxs("div",{className:"flex items-center gap-4 p-3 bg-muted rounded-lg",children:[e.jsxs("span",{className:"text-sm font-medium",children:[u," élément(s) sélectionné(s)"]}),m&&e.jsxs(j.Button,{variant:"outline",size:"sm",onClick:m,children:[e.jsx(h.Download,{className:"h-4 w-4 mr-2"}),"Télécharger"]}),f&&e.jsxs(j.Button,{variant:"destructive",size:"sm",onClick:f,children:[e.jsx(h.Trash2,{className:"h-4 w-4 mr-2"}),"Supprimer"]})]})]})}function Fo({file:t,viewMode:s,isSelected:a,onSelect:n,onOpen:r,onRename:o,onDelete:i,onDownload:c,onShare:l,onToggleStar:u}){const f=my[t.type],m=f.icon,p=typeof t.modifiedAt=="string"?new Date(t.modifiedAt):t.modifiedAt,g=()=>{t.type==="folder"&&r()};return s==="grid"?e.jsxs("div",{className:b.cn("relative group p-4 rounded-lg border cursor-pointer transition-colors",a?"bg-primary/10 border-primary":"hover:bg-muted"),onClick:()=>n(!a),onDoubleClick:g,children:[e.jsx("div",{className:"absolute top-2 left-2 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(st,{checked:a,onCheckedChange:C=>n(C),onClick:C=>C.stopPropagation()})}),t.starred&&e.jsx(h.Star,{className:"absolute top-2 right-2 h-4 w-4 text-yellow-500 fill-yellow-500"}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[t.thumbnail&&t.type==="image"?e.jsx("img",{src:t.thumbnail,alt:t.name,className:"w-16 h-16 object-cover rounded"}):e.jsx(m,{className:b.cn("h-12 w-12",f.color)}),e.jsx("span",{className:"text-sm font-medium text-center line-clamp-2",children:t.name}),t.type!=="folder"&&e.jsx("span",{className:"text-xs text-muted-foreground",children:Ao(t.size)})]}),e.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,onClick:C=>C.stopPropagation(),children:e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(Ye,{align:"end",children:[e.jsxs(Ne,{onClick:r,children:[e.jsx(h.Eye,{className:"mr-2 h-4 w-4"}),"Ouvrir"]}),o&&e.jsxs(Ne,{onClick:o,children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Renommer"]}),c&&t.type!=="folder"&&e.jsxs(Ne,{onClick:c,children:[e.jsx(h.Download,{className:"mr-2 h-4 w-4"}),"Télécharger"]}),l&&e.jsxs(Ne,{onClick:l,children:[e.jsx(h.Share2,{className:"mr-2 h-4 w-4"}),"Partager"]}),u&&e.jsx(Ne,{onClick:u,children:t.starred?e.jsxs(e.Fragment,{children:[e.jsx(h.StarOff,{className:"mr-2 h-4 w-4"}),"Retirer des favoris"]}):e.jsxs(e.Fragment,{children:[e.jsx(h.Star,{className:"mr-2 h-4 w-4"}),"Ajouter aux favoris"]})}),i&&e.jsxs(e.Fragment,{children:[e.jsx(dt,{}),e.jsxs(Ne,{onClick:i,className:"text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]})})]}):e.jsxs(rs,{className:b.cn("cursor-pointer",a&&"bg-primary/10"),onClick:()=>n(!a),onDoubleClick:g,children:[e.jsx(ot,{className:"w-12",children:e.jsx(st,{checked:a,onCheckedChange:C=>n(C),onClick:C=>C.stopPropagation()})}),e.jsx(ot,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(m,{className:b.cn("h-5 w-5",f.color)}),e.jsx("span",{className:"font-medium",children:t.name}),t.starred&&e.jsx(h.Star,{className:"h-4 w-4 text-yellow-500 fill-yellow-500"}),t.shared&&e.jsx(ye,{variant:"secondary",className:"text-xs",children:"Partagé"})]})}),e.jsx(ot,{className:"text-muted-foreground",children:Ao(t.size)}),e.jsx(ot,{className:"text-muted-foreground",children:p.toLocaleDateString("fr-FR")}),e.jsx(ot,{children:e.jsxs(Je,{children:[e.jsx(Ze,{asChild:!0,onClick:C=>C.stopPropagation(),children:e.jsx(j.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(Ye,{align:"end",children:[e.jsxs(Ne,{onClick:r,children:[e.jsx(h.Eye,{className:"mr-2 h-4 w-4"}),"Ouvrir"]}),o&&e.jsxs(Ne,{onClick:o,children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Renommer"]}),c&&t.type!=="folder"&&e.jsxs(Ne,{onClick:c,children:[e.jsx(h.Download,{className:"mr-2 h-4 w-4"}),"Télécharger"]}),i&&e.jsxs(e.Fragment,{children:[e.jsx(dt,{}),e.jsxs(Ne,{onClick:i,className:"text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]})})]})}function fy({files:t,currentPath:s="/",breadcrumbs:a=[],selectedFiles:n=[],onSelectionChange:r,onNavigate:o,onFileOpen:i,onDownload:c,onDelete:l,onRename:u,onCopy:f,onMove:m,onCreateFolder:p,onUpload:g,onShare:C,onToggleStar:y,onRefresh:N,viewMode:v,onViewModeChange:x,showSearch:w=!0,onSearch:k,showHeader:D=!0,showActions:S=!0,loading:F=!1,className:A}){const[T,M]=d.useState("grid"),[I,E]=d.useState(!1),[P,G]=d.useState(null),[H,X]=d.useState(""),[z,L]=d.useState(!1),[_,R]=d.useState([]),[U,$]=d.useState(!1),[Z,Q]=d.useState(""),K=v??T,q=re=>{x?x(re):M(re)},W=(re,pe)=>{r?.(pe?[...n,re]:n.filter(je=>je!==re))},J=re=>{re.type==="folder"?o?.(re.path,re.id):i?.(re)},B=re=>{G(re),X(re.name),E(!0)},te=()=>{P&&H.trim()&&H!==P.name&&u?.(P.id,H.trim()),E(!1),G(null)},se=()=>{R(n),L(!0)},ee=()=>{l?.(_),L(!1),R([]),r?.([])},le=()=>{Z.trim()&&(p?.(Z.trim(),s),$(!1),Q(""))},Me=[...t].sort((re,pe)=>re.type==="folder"&&pe.type!=="folder"?-1:re.type!=="folder"&&pe.type==="folder"?1:re.name.localeCompare(pe.name));return e.jsxs("div",{className:b.cn("space-y-4",A),children:[D&&e.jsx(hy,{breadcrumbs:a,viewMode:K,onViewModeChange:q,onNavigate:re=>o?.(re),onCreateFolder:p?()=>$(!0):void 0,onUpload:g?()=>{}:void 0,onRefresh:N,showSearch:w,onSearch:k,selectedCount:n.length,onDeleteSelected:l?se:void 0,onDownloadSelected:c?()=>c(n):void 0}),F?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(h.RefreshCw,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):Me.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(h.Folder,{className:"h-12 w-12 mb-4"}),e.jsx("p",{children:"Ce dossier est vide"})]}):K==="grid"?e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4",children:Me.map(re=>e.jsx(Fo,{file:re,viewMode:"grid",isSelected:n.includes(re.id),onSelect:pe=>W(re.id,pe),onOpen:()=>J(re),onRename:u?()=>B(re):void 0,onDelete:l?()=>{R([re.id]),L(!0)}:void 0,onDownload:c?()=>c([re.id]):void 0,onShare:C?()=>C(re.id):void 0,onToggleStar:y?()=>y(re.id):void 0},re.id))}):e.jsxs($a,{children:[e.jsx(Oa,{children:e.jsxs(rs,{children:[e.jsx(ft,{className:"w-12",children:e.jsx(st,{checked:n.length===t.length&&t.length>0,onCheckedChange:re=>{r?.(re?t.map(pe=>pe.id):[])}})}),e.jsx(ft,{children:"Nom"}),e.jsx(ft,{children:"Taille"}),e.jsx(ft,{children:"Modifié"}),e.jsx(ft,{className:"w-12"})]})}),e.jsx(za,{children:Me.map(re=>e.jsx(Fo,{file:re,viewMode:"list",isSelected:n.includes(re.id),onSelect:pe=>W(re.id,pe),onOpen:()=>J(re),onRename:u?()=>B(re):void 0,onDelete:l?()=>{R([re.id]),L(!0)}:void 0,onDownload:c?()=>c([re.id]):void 0,onShare:C?()=>C(re.id):void 0,onToggleStar:y?()=>y(re.id):void 0},re.id))})]}),e.jsx(ds,{open:I,onOpenChange:E,children:e.jsxs(Kt,{children:[e.jsx(Cs,{children:e.jsx(ks,{children:"Renommer"})}),e.jsx(j.Input,{value:H,onChange:re=>X(re.target.value),placeholder:"Nouveau nom",onKeyDown:re=>re.key==="Enter"&&te()}),e.jsxs(aa,{children:[e.jsx(j.Button,{variant:"outline",onClick:()=>E(!1),children:"Annuler"}),e.jsx(j.Button,{onClick:te,children:"Renommer"})]})]})}),e.jsx(cs,{open:z,onOpenChange:L,children:e.jsxs(qt,{children:[e.jsxs(Ut,{children:[e.jsx(Gt,{children:"Supprimer ?"}),e.jsxs(Xt,{children:["Êtes-vous sûr de vouloir supprimer ",_.length," élément(s) ? Cette action est irréversible."]})]}),e.jsxs(Ht,{children:[e.jsx(Qt,{children:"Annuler"}),e.jsx(Yt,{onClick:ee,children:"Supprimer"})]})]})}),e.jsx(ds,{open:U,onOpenChange:$,children:e.jsxs(Kt,{children:[e.jsx(Cs,{children:e.jsx(ks,{children:"Nouveau dossier"})}),e.jsx(j.Input,{value:Z,onChange:re=>Q(re.target.value),placeholder:"Nom du dossier",onKeyDown:re=>re.key==="Enter"&&le()}),e.jsxs(aa,{children:[e.jsx(j.Button,{variant:"outline",onClick:()=>$(!1),children:"Annuler"}),e.jsx(j.Button,{onClick:le,children:"Créer"})]})]})})]})}const py=[{id:"1",name:"Documents",type:"folder",path:"/Documents",createdAt:new Date("2024-01-01"),modifiedAt:new Date("2024-01-15")},{id:"2",name:"Images",type:"folder",path:"/Images",createdAt:new Date("2024-01-01"),modifiedAt:new Date("2024-01-10"),starred:!0},{id:"3",name:"Rapport Q4.pdf",type:"document",path:"/Rapport Q4.pdf",size:2456e3,createdAt:new Date("2024-01-05"),modifiedAt:new Date("2024-01-05")},{id:"4",name:"Photo vacances.jpg",type:"image",path:"/Photo vacances.jpg",size:567e4,createdAt:new Date("2024-01-08"),modifiedAt:new Date("2024-01-08")},{id:"5",name:"Présentation.pptx",type:"document",path:"/Présentation.pptx",size:89e5,createdAt:new Date("2024-01-12"),modifiedAt:new Date("2024-01-14"),shared:!0}],xy=[{id:"root",name:"Mes fichiers",path:"/"}];function De(t){t=t.replace(/^#/,"");const s=parseInt(t.slice(0,2),16)/255,a=parseInt(t.slice(2,4),16)/255,n=parseInt(t.slice(4,6),16)/255,r=Math.max(s,a,n),o=Math.min(s,a,n);let i=0,c=0;const l=(r+o)/2;if(r!==o){const u=r-o;switch(c=l>.5?u/(2-r-o):u/(r+o),r){case s:i=((a-n)/u+(a<n?6:0))/6;break;case a:i=((n-s)/u+2)/6;break;case n:i=((s-a)/u+4)/6;break}}return`${Math.round(i*360)} ${Math.round(c*100)}% ${Math.round(l*100)}%`}function Ro(t,s,a,n){const r=o=>({background:De(o.background),foreground:De(o.foreground),card:De(o.card),"card-foreground":De(o.cardForeground),popover:De(o.popover),"popover-foreground":De(o.popoverForeground),primary:De(o.primary),"primary-foreground":De(o.primaryForeground),secondary:De(o.secondary),"secondary-foreground":De(o.secondaryForeground),muted:De(o.muted),"muted-foreground":De(o.mutedForeground),accent:De(o.accent),"accent-foreground":De(o.accentForeground),destructive:De(o.destructive),"destructive-foreground":De(o.destructiveForeground),border:De(o.border),input:De(o.input),ring:De(o.ring),"chart-1":De(o.chart1),"chart-2":De(o.chart2),"chart-3":De(o.chart3),"chart-4":De(o.chart4),"chart-5":De(o.chart5),...o.sidebarBackground&&{"sidebar-background":De(o.sidebarBackground)},...o.sidebarForeground&&{"sidebar-foreground":De(o.sidebarForeground)},...o.sidebarPrimary&&{"sidebar-primary":De(o.sidebarPrimary)},...o.sidebarPrimaryForeground&&{"sidebar-primary-foreground":De(o.sidebarPrimaryForeground)},...o.sidebarAccent&&{"sidebar-accent":De(o.sidebarAccent)},...o.sidebarAccentForeground&&{"sidebar-accent-foreground":De(o.sidebarAccentForeground)},...o.sidebarBorder&&{"sidebar-border":De(o.sidebarBorder)},...o.sidebarRing&&{"sidebar-ring":De(o.sidebarRing)}});return{name:t,type:"registry:theme",cssVars:{theme:{radius:n||"0.5rem"},light:r(s),dark:r(a)}}}const gy={background:"#ffffff",foreground:"#0a0a0a",card:"#ffffff",cardForeground:"#0a0a0a",popover:"#ffffff",popoverForeground:"#0a0a0a",primary:"#171717",primaryForeground:"#fafafa",secondary:"#f5f5f5",secondaryForeground:"#171717",muted:"#f5f5f5",mutedForeground:"#737373",accent:"#f5f5f5",accentForeground:"#171717",destructive:"#ef4444",destructiveForeground:"#fafafa",border:"#e5e5e5",input:"#e5e5e5",ring:"#0a0a0a",chart1:"#e76e50",chart2:"#2a9d90",chart3:"#274754",chart4:"#e8c468",chart5:"#f4a462"},by={background:"#0a0a0a",foreground:"#fafafa",card:"#0a0a0a",cardForeground:"#fafafa",popover:"#0a0a0a",popoverForeground:"#fafafa",primary:"#fafafa",primaryForeground:"#171717",secondary:"#262626",secondaryForeground:"#fafafa",muted:"#262626",mutedForeground:"#a3a3a3",accent:"#262626",accentForeground:"#fafafa",destructive:"#7f1d1d",destructiveForeground:"#fafafa",border:"#262626",input:"#262626",ring:"#d4d4d4",chart1:"#2662d9",chart2:"#2eb88a",chart3:"#e88c30",chart4:"#af57db",chart5:"#e23670"},jy={background:"#f0fdfa",foreground:"#134e4a",card:"#ffffff",cardForeground:"#134e4a",popover:"#ffffff",popoverForeground:"#134e4a",primary:"#14b8a6",primaryForeground:"#ffffff",secondary:"#ccfbf1",secondaryForeground:"#134e4a",muted:"#ccfbf1",mutedForeground:"#5eead4",accent:"#2dd4bf",accentForeground:"#022c22",destructive:"#ef4444",destructiveForeground:"#fafafa",border:"#99f6e4",input:"#99f6e4",ring:"#14b8a6",chart1:"#14b8a6",chart2:"#2dd4bf",chart3:"#5eead4",chart4:"#0d9488",chart5:"#0f766e"},vy={background:"#042f2e",foreground:"#ccfbf1",card:"#134e4a",cardForeground:"#ccfbf1",popover:"#134e4a",popoverForeground:"#ccfbf1",primary:"#2dd4bf",primaryForeground:"#042f2e",secondary:"#115e59",secondaryForeground:"#ccfbf1",muted:"#115e59",mutedForeground:"#5eead4",accent:"#14b8a6",accentForeground:"#042f2e",destructive:"#ef4444",destructiveForeground:"#fafafa",border:"#115e59",input:"#115e59",ring:"#2dd4bf",chart1:"#2dd4bf",chart2:"#14b8a6",chart3:"#5eead4",chart4:"#99f6e4",chart5:"#0d9488"},bn=[{id:"default",name:"Default",lightColors:gy,darkColors:by,radius:"0.5rem"},{id:"ocean",name:"Ocean Breeze",lightColors:jy,darkColors:vy,radius:"0.5rem"}],yy=[{id:"primary",label:"Primary",colors:[{key:"primary",label:"Primary"},{key:"primaryForeground",label:"Foreground"}]},{id:"secondary",label:"Secondary",colors:[{key:"secondary",label:"Secondary"},{key:"secondaryForeground",label:"Foreground"}]},{id:"accent",label:"Accent",colors:[{key:"accent",label:"Accent"},{key:"accentForeground",label:"Foreground"}]},{id:"base",label:"Base",colors:[{key:"background",label:"Background"},{key:"foreground",label:"Foreground"}]},{id:"card",label:"Card",colors:[{key:"card",label:"Card"},{key:"cardForeground",label:"Foreground"}]},{id:"popover",label:"Popover",colors:[{key:"popover",label:"Popover"},{key:"popoverForeground",label:"Foreground"}]},{id:"muted",label:"Muted",colors:[{key:"muted",label:"Muted"},{key:"mutedForeground",label:"Foreground"}]},{id:"destructive",label:"Destructive",colors:[{key:"destructive",label:"Destructive"},{key:"destructiveForeground",label:"Foreground"}]},{id:"border",label:"Border & Input",colors:[{key:"border",label:"Border"},{key:"input",label:"Input"},{key:"ring",label:"Ring"}]},{id:"chart",label:"Charts",colors:[{key:"chart1",label:"1"},{key:"chart2",label:"2"},{key:"chart3",label:"3"},{key:"chart4",label:"4"},{key:"chart5",label:"5"}]}];function wy({label:t,value:s,onChange:a}){return e.jsxs("div",{className:"flex items-center gap-2 py-1",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"color",value:s,onChange:n=>a(n.target.value),className:"w-7 h-7 rounded cursor-pointer border-0 bg-transparent p-0",style:{WebkitAppearance:"none",appearance:"none"}}),e.jsx("div",{className:"absolute inset-0.5 rounded pointer-events-none border border-border/20",style:{backgroundColor:s}})]}),e.jsx("span",{className:"text-[11px] text-muted-foreground flex-1 truncate",children:t}),e.jsx(j.Input,{value:s,onChange:n=>a(n.target.value),className:"h-6 w-16 text-[10px] font-mono px-1.5 bg-muted/50 border-0"})]})}function js({label:t,value:s,onUpload:a,onRemove:n,accept:r="image/*",isUploading:o}){const i=d.useRef(null),c=async l=>{const u=l.target.files?.[0];u&&await a(u),i.current&&(i.current.value="")};return e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border border-border/30 bg-muted/20",children:[s?e.jsx("img",{src:s,alt:t,className:"w-8 h-8 object-contain rounded bg-background"}):e.jsx("div",{className:"w-8 h-8 rounded bg-muted/50 flex items-center justify-center",children:e.jsx(h.ImageIcon,{className:"w-3 h-3 text-muted-foreground"})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("p",{className:"text-[11px] font-medium truncate",children:t})}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(j.Button,{variant:"ghost",size:"sm",onClick:()=>i.current?.click(),disabled:o,className:"h-6 w-6 p-0",children:o?e.jsx(h.Loader2,{className:"h-3 w-3 animate-spin"}):e.jsx(h.Upload,{className:"h-3 w-3"})}),s&&e.jsx(j.Button,{variant:"ghost",size:"sm",onClick:n,className:"h-6 w-6 p-0 text-destructive",children:e.jsx(h.Trash2,{className:"h-3 w-3"})})]}),e.jsx("input",{ref:i,type:"file",accept:r,onChange:c,className:"hidden"})]})}function Ny({group:t,colors:s,onChange:a,defaultOpen:n=!1}){const[r,o]=d.useState(n);return e.jsxs(An,{open:r,onOpenChange:o,children:[e.jsxs(Fn,{className:"flex items-center justify-between w-full py-1.5 px-2 hover:bg-muted/30 rounded transition-colors text-left",children:[e.jsx("span",{className:"text-[11px] font-medium",children:t.label}),e.jsxs("div",{className:"flex items-center gap-1",children:[t.colors.slice(0,3).map(i=>e.jsx("div",{className:"w-2.5 h-2.5 rounded-sm border border-border/30",style:{backgroundColor:s[i.key]||"#000"}},i.key)),e.jsx(h.ChevronDown,{className:b.cn("h-3 w-3 text-muted-foreground ml-1 transition-transform",r&&"rotate-180")})]})]}),e.jsx(Rn,{className:"px-2 pb-1",children:t.colors.map(i=>e.jsx(wy,{label:i.label,value:s[i.key]||"#000000",onChange:c=>a(i.key,c)},i.key))})]})}function Cy({assets:t,isDark:s}){return e.jsx("div",{className:"h-full w-full overflow-auto",children:e.jsx(Cc,{config:{theme_json:{name:"preview",dark_mode:s},assets:{theme_logo_light:t?.logoLight,theme_logo_dark:t?.logoDark,background_image:s?t?.backgroundDark:t?.backgroundLight},signup_options:{allow_login:!0,allow_sso_google:!0,allow_sso_github:!0}},showSocialLogin:!0,onSSOGoogle:()=>{},onSSOGithub:()=>{},className:"min-h-full"})})}function ky(){return e.jsx("div",{className:"h-full w-full overflow-auto p-4",children:e.jsx(Tc,{title:"Tableau de bord",description:"Aperçu de vos statistiques",stats:Ec,showHeader:!0,statsLayout:"grid",statsColumns:4})})}function Sy(){return e.jsx("div",{className:"h-full w-full overflow-hidden",children:e.jsx(Ic,{conversations:xn,activeConversation:xn[0],messages:Lc,currentUser:Ls,showConversationList:!0,showHeader:!0,layout:"full",className:"h-full"})})}function $c({themes:t=bn,initialTheme:s,onThemeChange:a,onSave:n,onUploadAsset:r,showSidebarColors:o=!1,previewTabs:i=["login","dashboard","chat"],className:c}){const{toast:l}=_a(),{loadThemeFromJSON:u,isDarkMode:f,toggleDarkMode:m}=Bs(),[p,g]=d.useState(s||t[0]||bn[0]),[C,y]=d.useState(p.id),[N,v]=d.useState("colors"),[x,w]=d.useState(i[0]),[k,D]=d.useState("light"),[S,F]=d.useState(!1),[A,T]=d.useState(!1),[M,I]=d.useState(null),[E,P]=d.useState([p]),[G,H]=d.useState(0),X=k==="light"?p.lightColors:p.darkColors,z=d.useRef(),L=d.useCallback(B=>{z.current&&clearTimeout(z.current),z.current=setTimeout(async()=>{try{const te=Ro("theme-creator-preview",B.lightColors,B.darkColors,B.radius);await u("theme-creator-preview",te)}catch(te){console.error("Failed to apply theme:",te)}},50)},[u]);d.useEffect(()=>(L(p),()=>{z.current&&clearTimeout(z.current)}),[p,L]),d.useEffect(()=>{f!==(k==="dark")&&m()},[k,f,m]);const _=d.useCallback((B,te)=>{g(se=>{const ee=k==="light"?"lightColors":"darkColors",le={...se,[ee]:{...se[ee],[B]:te}};return a?.(le),le})},[k,a]),R=d.useCallback(()=>{P(B=>[...B.slice(0,G+1),p]),H(B=>B+1)},[p,G]);d.useEffect(()=>{const B=setTimeout(R,500);return()=>clearTimeout(B)},[p,R]);const U=d.useCallback(B=>{const te=t.find(se=>se.id===B);te&&(g(te),y(B),P([te]),H(0),a?.(te))},[t,a]),$=d.useCallback(()=>{G>0&&(H(B=>B-1),g(E[G-1]))},[E,G]),Z=d.useCallback(()=>{G<E.length-1&&(H(B=>B+1),g(E[G+1]))},[E,G]),Q=d.useCallback(()=>{const B=t.find(te=>te.id===C);B&&(g(B),P([B]),H(0),a?.(B),l({title:"Theme reset"}))},[t,C,a,l]),K=d.useCallback(async()=>{if(n){F(!0);try{await n(p),l({title:"Theme saved!"})}catch{l({title:"Error saving theme",variant:"destructive"})}finally{F(!1)}}},[p,n,l]),q=d.useCallback(async()=>{const B=Ro(p.id,p.lightColors,p.darkColors,p.radius),te=Object.entries(B.cssVars?.light||{}).map(([le,Me])=>` --${le}: ${Me};`).join(`
|
|
90
|
+
`),se=Object.entries(B.cssVars?.dark||{}).map(([le,Me])=>` --${le}: ${Me};`).join(`
|
|
91
|
+
`),ee=`:root {
|
|
92
|
+
${te}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.dark {
|
|
96
|
+
${se}
|
|
97
|
+
}`;await navigator.clipboard.writeText(ee),T(!0),setTimeout(()=>T(!1),2e3),l({title:"CSS copied!"})},[p,l]),W=d.useCallback(async(B,te)=>{if(r){I(te);try{const se=await r(B,te);g(ee=>{const le={...ee,assets:{...ee.assets,[te]:se}};return a?.(le),le}),l({title:"Asset uploaded"})}catch{l({title:"Upload failed",variant:"destructive"})}finally{I(null)}}},[r,a,l]),J=d.useCallback(B=>{g(te=>{const se={...te.assets};delete se[B];const ee={...te,assets:se};return a?.(ee),ee})},[a]);return e.jsxs("div",{className:b.cn("flex h-[calc(100vh-180px)] min-h-[500px] border rounded-lg overflow-hidden bg-background",c),children:[e.jsxs("div",{className:"w-56 border-r flex flex-col bg-card/30 shrink-0",children:[e.jsxs("div",{className:"p-2 border-b space-y-1.5",children:[e.jsxs(Be,{value:C,onValueChange:U,children:[e.jsx(ze,{className:"h-7 text-xs",children:e.jsx(We,{})}),e.jsx(_e,{children:t.map(B=>e.jsx(ke,{value:B.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:B.lightColors.primary}}),e.jsx("span",{className:"text-xs",children:B.name})]})},B.id))})]}),e.jsxs("div",{className:"flex gap-0.5 p-0.5 bg-muted rounded",children:[e.jsxs("button",{onClick:()=>v("colors"),className:b.cn("flex-1 flex items-center justify-center gap-1 px-2 py-0.5 rounded text-[10px] transition-all",N==="colors"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(h.Palette,{className:"h-3 w-3"})," Colors"]}),e.jsxs("button",{onClick:()=>v("assets"),className:b.cn("flex-1 flex items-center justify-center gap-1 px-2 py-0.5 rounded text-[10px] transition-all",N==="assets"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(h.Image,{className:"h-3 w-3"})," Assets"]})]}),N==="colors"&&e.jsxs("div",{className:"flex gap-0.5 p-0.5 bg-muted/50 rounded",children:[e.jsxs("button",{onClick:()=>D("light"),className:b.cn("flex-1 flex items-center justify-center gap-1 px-2 py-0.5 rounded text-[10px] transition-all",k==="light"?"bg-background shadow-sm":"text-muted-foreground"),children:[e.jsx(h.Sun,{className:"h-3 w-3"})," Light"]}),e.jsxs("button",{onClick:()=>D("dark"),className:b.cn("flex-1 flex items-center justify-center gap-1 px-2 py-0.5 rounded text-[10px] transition-all",k==="dark"?"bg-background shadow-sm":"text-muted-foreground"),children:[e.jsx(h.Moon,{className:"h-3 w-3"})," Dark"]})]})]}),e.jsx(St,{className:"flex-1",children:N==="colors"?e.jsx("div",{className:"p-1",children:yy.map((B,te)=>e.jsx(Ny,{group:B,colors:X,onChange:_,defaultOpen:te<3},B.id))}):e.jsxs("div",{className:"p-1.5 space-y-1.5",children:[e.jsx("p",{className:"text-[9px] font-semibold text-muted-foreground uppercase tracking-wider px-1",children:"Logos"}),e.jsx(js,{label:"Logo Light",value:p.assets?.logoLight,onUpload:B=>W(B,"logoLight"),onRemove:()=>J("logoLight"),isUploading:M==="logoLight"}),e.jsx(js,{label:"Logo Dark",value:p.assets?.logoDark,onUpload:B=>W(B,"logoDark"),onRemove:()=>J("logoDark"),isUploading:M==="logoDark"}),e.jsx("p",{className:"text-[9px] font-semibold text-muted-foreground uppercase tracking-wider px-1 pt-1",children:"Backgrounds"}),e.jsx(js,{label:"Background Light",value:p.assets?.backgroundLight,onUpload:B=>W(B,"backgroundLight"),onRemove:()=>J("backgroundLight"),isUploading:M==="backgroundLight"}),e.jsx(js,{label:"Background Dark",value:p.assets?.backgroundDark,onUpload:B=>W(B,"backgroundDark"),onRemove:()=>J("backgroundDark"),isUploading:M==="backgroundDark"}),e.jsx("p",{className:"text-[9px] font-semibold text-muted-foreground uppercase tracking-wider px-1 pt-1",children:"Other"}),e.jsx(js,{label:"Favicon",value:p.assets?.favicon,onUpload:B=>W(B,"favicon"),onRemove:()=>J("favicon"),accept:"image/x-icon,image/png,image/svg+xml",isUploading:M==="favicon"}),e.jsx(js,{label:"Sponsor Light",value:p.assets?.sponsorLight,onUpload:B=>W(B,"sponsorLight"),onRemove:()=>J("sponsorLight"),isUploading:M==="sponsorLight"}),e.jsx(js,{label:"Sponsor Dark",value:p.assets?.sponsorDark,onUpload:B=>W(B,"sponsorDark"),onRemove:()=>J("sponsorDark"),isUploading:M==="sponsorDark"})]})}),e.jsxs("div",{className:"p-1.5 border-t space-y-1",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx(j.Button,{variant:"outline",size:"sm",onClick:$,disabled:G===0,className:"flex-1 h-6 text-[10px]",children:e.jsx(h.Undo2,{className:"h-3 w-3"})}),e.jsx(j.Button,{variant:"outline",size:"sm",onClick:Z,disabled:G===E.length-1,className:"flex-1 h-6 text-[10px]",children:e.jsx(h.Redo2,{className:"h-3 w-3"})}),e.jsx(j.Button,{variant:"outline",size:"sm",onClick:Q,className:"flex-1 h-6 text-[10px]",children:e.jsx(h.RotateCcw,{className:"h-3 w-3"})})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsxs(j.Button,{variant:"outline",size:"sm",onClick:q,className:"flex-1 h-6 text-[10px]",children:[A?e.jsx(h.Check,{className:"h-3 w-3 mr-1"}):e.jsx(h.Copy,{className:"h-3 w-3 mr-1"}),A?"Copied":"CSS"]}),n&&e.jsxs(j.Button,{size:"sm",onClick:K,disabled:S,className:"flex-1 h-6 text-[10px]",children:[S?e.jsx(h.Loader2,{className:"h-3 w-3 mr-1 animate-spin"}):e.jsx(h.Save,{className:"h-3 w-3 mr-1"}),"Save"]})]})]})]}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[e.jsxs("div",{className:"h-9 border-b flex items-center justify-between px-2 shrink-0",children:[e.jsxs("div",{className:"flex gap-0.5 p-0.5 bg-muted rounded",children:[i.includes("login")&&e.jsx("button",{onClick:()=>w("login"),className:b.cn("px-2 py-0.5 rounded text-[10px] transition-all",x==="login"?"bg-background shadow-sm":"text-muted-foreground"),children:"Login"}),i.includes("dashboard")&&e.jsx("button",{onClick:()=>w("dashboard"),className:b.cn("px-2 py-0.5 rounded text-[10px] transition-all",x==="dashboard"?"bg-background shadow-sm":"text-muted-foreground"),children:"Dashboard"}),i.includes("chat")&&e.jsx("button",{onClick:()=>w("chat"),className:b.cn("px-2 py-0.5 rounded text-[10px] transition-all",x==="chat"?"bg-background shadow-sm":"text-muted-foreground"),children:"Chat"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[e.jsxs("span",{children:["Mode: ",k==="light"?"Light":"Dark"]}),k==="light"?e.jsx(h.Sun,{className:"h-3 w-3"}):e.jsx(h.Moon,{className:"h-3 w-3"})]})]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[x==="login"&&e.jsx(Cy,{assets:p.assets,isDark:k==="dark"}),x==="dashboard"&&e.jsx(ky,{}),x==="chat"&&e.jsx(Sy,{})]})]})]})}$c.displayName="WakaThemeCreatorBlock";exports.ErrorCode=ne.ErrorCode;exports.Logger=ne.Logger;exports.WakaError=ne.WakaError;exports.assertCondition=ne.assertCondition;exports.createErrorFactory=ne.createErrorFactory;exports.handleError=ne.handleError;exports.isErrorCode=ne.isErrorCode;exports.isWakaError=ne.isWakaError;exports.logger=ne.logger;exports.retryAsync=ne.retryAsync;exports.tryCatch=ne.tryCatch;exports.tryCatchAsync=ne.tryCatchAsync;exports.useDataTableExport=ne.useDataTableExport;exports.useDataTableImport=ne.useDataTableImport;exports.withErrorHandling=ne.withErrorHandling;exports.cn=b.cn;exports.tweak=b.tweak;exports.AccordionPrimitive=ls;exports.AlertDialogPrimitive=ct;exports.AspectRatioPrimitive=Io;exports.AvatarPrimitive=Ms;exports.Button=j.Button;exports.Input=j.Input;exports.Label=j.Label;exports.Popover=j.Popover;exports.PopoverContent=j.PopoverContent;exports.PopoverTrigger=j.PopoverTrigger;exports.Separator=j.Separator;exports.Textarea=j.Textarea;exports.WakaRichTextEditor=j.WakaRichTextEditor;exports.CheckboxPrimitive=Sa;exports.CollapsiblePrimitive=Fa;exports.DialogPrimitive=xe;exports.ContextMenuPrimitive=Ie;exports.DropdownMenuPrimitive=Le;exports.SlotPrimitive=Md;exports.HoverCardPrimitive=ca;exports.SelectPrimitive=Ge;exports.MenubarPrimitive=Ae;exports.NavigationMenuPrimitive=ut;exports.ProgressPrimitive=Da;exports.RadioGroupPrimitive=$s;exports.ScrollAreaPrimitive=os;exports.CHART_SIZE_MAP=gt.CHART_SIZE_MAP;exports.DEFAULT_CHART_COLORS=gt.DEFAULT_CHART_COLORS;exports.Skeleton=gt.Skeleton;exports.WakaAreaChart=gt.WakaAreaChart;exports.WakaBarChart=gt.WakaBarChart;exports.WakaChart=gt.WakaChart;exports.WakaLineChart=gt.WakaLineChart;exports.WakaMiniChart=gt.WakaMiniChart;exports.WakaPieChart=gt.WakaPieChart;exports.WakaSparkline=gt.WakaSparkline;exports.createChartColumn=gt.createChartColumn;exports.sparklineTemplate=gt.sparklineTemplate;exports.useChartTheme=gt.useChartTheme;exports.useRechartsLoader=gt.useRechartsLoader;exports.SliderPrimitive=Rs;exports.SwitchPrimitive=Ta;exports.TabsPrimitive=ms;exports.ToastPrimitive=bt;exports.TogglePrimitive=jn;exports.TooltipPrimitive=zs;Object.defineProperty(exports,"I18nextProvider",{enumerable:!0,get:()=>pt.I18nextProvider});Object.defineProperty(exports,"Trans",{enumerable:!0,get:()=>pt.Trans});Object.defineProperty(exports,"useI18nTranslation",{enumerable:!0,get:()=>pt.useTranslation});exports.i18n=$t;exports.LabelPrimitive=Ad;exports.PopoverPrimitive=Fd;exports.SeparatorPrimitive=Rd;exports.Accordion=cn;exports.AccordionContent=wn;exports.AccordionItem=vn;exports.AccordionTrigger=yn;exports.AdmincrumbProvider=Nj;exports.Alert=Cn;exports.AlertDescription=kn;exports.AlertDialog=cs;exports.AlertDialogAction=Yt;exports.AlertDialogCancel=Qt;exports.AlertDialogContent=qt;exports.AlertDialogDescription=Xt;exports.AlertDialogFooter=Ht;exports.AlertDialogHeader=Ut;exports.AlertDialogOverlay=Nn;exports.AlertDialogPortal=Oo;exports.AlertDialogTitle=Gt;exports.AlertDialogTrigger=$o;exports.AlertTitle=zo;exports.AspectRatio=zd;exports.Avatar=Dt;exports.AvatarFallback=Et;exports.AvatarImage=Tt;exports.Badge=ye;exports.BlockLanguageSelector=Ej;exports.Blockquote=ul;exports.Calendar=Ra;exports.Card=Ce;exports.CardContent=Pe;exports.CardDescription=et;exports.CardFooter=Sn;exports.CardHeader=Ve;exports.CardTitle=Oe;exports.Checkbox=st;exports.Code=Ko;exports.Collapsible=An;exports.CollapsibleContent=Rn;exports.CollapsibleTrigger=Fn;exports.Command=us;exports.CommandDialog=ex;exports.CommandEmpty=Ds;exports.CommandGroup=Jt;exports.CommandInput=Ss;exports.CommandItem=Zt;exports.CommandList=ua;exports.CommandSeparator=Ea;exports.CommandShortcut=ei;exports.ContextMenu=ti;exports.ContextMenuCheckboxItem=ri;exports.ContextMenuContent=Ln;exports.ContextMenuGroup=tx;exports.ContextMenuItem=Vt;exports.ContextMenuLabel=ii;exports.ContextMenuPortal=sx;exports.ContextMenuRadioGroup=nx;exports.ContextMenuRadioItem=oi;exports.ContextMenuSeparator=Zs;exports.ContextMenuShortcut=li;exports.ContextMenuSub=ax;exports.ContextMenuSubContent=ni;exports.ContextMenuSubTrigger=ai;exports.ContextMenuTrigger=si;exports.DataTable=rg;exports.DataTableAdvanced=cg;exports.DataTableBody=wg;exports.DataTableBodyRow=Il;exports.DataTableCell=Fl;exports.DataTableColumnResizer=dg;exports.DataTableConflictResolver=lc;exports.DataTableContextMenu=fg;exports.DataTableEditCell=Ps;exports.DataTableFilterBuilder=Jg;exports.DataTableFilters=er;exports.DataTableGroupRow=Tg;exports.DataTableGroupTotals=mg;exports.DataTableGrouping=ug;exports.DataTableGroupingControls=hg;exports.DataTableHeader=jg;exports.DataTableHeaderRow=Rl;exports.DataTablePagination=Zn;exports.DataTableRow=Dg;exports.DataTableSelection=pg;exports.DataTableSyncStatus=ic;exports.DataTableToolbar=ia;exports.Dialog=ds;exports.DialogClose=Zo;exports.DialogContent=Kt;exports.DialogDescription=da;exports.DialogFooter=aa;exports.DialogHeader=Cs;exports.DialogOverlay=In;exports.DialogPortal=Jo;exports.DialogTitle=ks;exports.DialogTrigger=Zp;exports.DrawerBody=jr;exports.DrawerClose=Bb;exports.DrawerDescription=wr;exports.DrawerFooter=vr;exports.DrawerHeader=br;exports.DrawerTitle=yr;exports.DrawerTrigger=Vb;exports.DropdownMenu=Je;exports.DropdownMenuCheckboxItem=vs;exports.DropdownMenuContent=Ye;exports.DropdownMenuGroup=rx;exports.DropdownMenuItem=Ne;exports.DropdownMenuLabel=ys;exports.DropdownMenuPortal=ox;exports.DropdownMenuRadioGroup=lx;exports.DropdownMenuRadioItem=ui;exports.DropdownMenuSeparator=dt;exports.DropdownMenuShortcut=mi;exports.DropdownMenuSub=ix;exports.DropdownMenuSubContent=di;exports.DropdownMenuSubTrigger=ci;exports.DropdownMenuTrigger=Ze;exports.EmptyCartState=Pv;exports.Error403Page=rv;exports.Error404Page=av;exports.Error500Page=nv;exports.ErrorBoundary=Lo;exports.ErrorState=Av;exports.Footer=Dj;exports.Form=wx;exports.FormControl=Ni;exports.FormDescription=Ci;exports.FormField=Nx;exports.FormItem=yi;exports.FormLabel=wi;exports.FormMessage=ki;exports.Heading=cl;exports.Headtab=Tj;exports.HoverCard=Cx;exports.HoverCardContent=Si;exports.HoverCardTrigger=kx;exports.IndexedDBService=nc;exports.InputOTP=Di;exports.Kbd=hl;exports.LanguageProvider=wc;exports.LanguageSelector=Ex;exports.Layout=Pj;exports.LegacyThemeProvider=pj;exports.Login=Cc;exports.MaintenancePage=ov;exports.Menubar=Ai;exports.MenubarCheckboxItem=Oi;exports.MenubarContent=Li;exports.MenubarGroup=Mx;exports.MenubarItem=$i;exports.MenubarLabel=_i;exports.MenubarMenu=Px;exports.MenubarPortal=Ax;exports.MenubarRadioGroup=Rx;exports.MenubarRadioItem=zi;exports.MenubarSeparator=Vi;exports.MenubarShortcut=Bi;exports.MenubarSub=Fx;exports.MenubarSubContent=Ii;exports.MenubarSubTrigger=Ri;exports.MenubarTrigger=Fi;exports.ModalBody=hr;exports.ModalContent=cr;exports.ModalDescription=mr;exports.ModalFooter=fr;exports.ModalHeader=dr;exports.ModalOverlay=lr;exports.ModalTitle=ur;exports.NavigationMenu=Wi;exports.NavigationMenuContent=Gi;exports.NavigationMenuIndicator=Xi;exports.NavigationMenuItem=Ix;exports.NavigationMenuLink=Lx;exports.NavigationMenuList=qi;exports.NavigationMenuTrigger=Hi;exports.NavigationMenuViewport=Wn;exports.NoDataState=Sv;exports.NoFilesState=Ev;exports.NoMessagesState=Tv;exports.NoNotificationsState=Mv;exports.NoResultsState=Dv;exports.OPERATORS_BY_TYPE=ka;exports.OPERATOR_LABELS=sc;exports.OfflinePage=iv;exports.Progress=Es;exports.RadioGroup=Yi;exports.RadioGroupItem=Qi;exports.ScrollArea=St;exports.ScrollBar=qn;exports.Select=Be;exports.SelectContent=_e;exports.SelectGroup=Sx;exports.SelectItem=ke;exports.SelectLabel=Ti;exports.SelectScrollDownButton=_n;exports.SelectScrollUpButton=zn;exports.SelectSeparator=Ei;exports.SelectTrigger=ze;exports.SelectValue=We;exports.Sheet=is;exports.SheetClose=Dx;exports.SheetContent=Wt;exports.SheetDescription=La;exports.SheetFooter=Mi;exports.SheetHeader=ws;exports.SheetOverlay=Bn;exports.SheetPortal=Pi;exports.SheetTitle=Ns;exports.SheetTrigger=Vn;exports.SidebarLayout=Ij;exports.Slider=Pa;exports.StepperNavigation=cb;exports.Switch=_s;exports.Table=$a;exports.TableBody=za;exports.TableCaption=Ji;exports.TableCell=ot;exports.TableFooter=Ki;exports.TableHead=ft;exports.TableHeader=Oa;exports.TableRow=rs;exports.Tabs=Vs;exports.TabsContent=At;exports.TabsList=As;exports.TabsTrigger=Mt;exports.Text=il;exports.ThemeLoader=Pn;exports.ThemeProvider=yl;exports.ThemeSelector=Zi;exports.Toast=Hn;exports.ToastAction=tl;exports.ToastClose=Gn;exports.ToastDescription=Yn;exports.ToastProvider=el;exports.ToastTitle=Xn;exports.ToastViewport=Un;exports.Toaster=Vx;exports.Toggle=rl;exports.Tooltip=ra;exports.TooltipContent=Os;exports.TooltipProvider=na;exports.TooltipTrigger=oa;exports.WakaActivityTimeline=Uv;exports.WakaAdmincrumb=pl;exports.WakaAutocomplete=rr;exports.WakaAutocompleteForm=mc;exports.WakaBarcode=Jb;exports.WakaBreadcrumb=ub;exports.WakaCalendarView=dy;exports.WakaCarousel=Gx;exports.WakaChat=Ic;exports.WakaColorPicker=nr;exports.WakaColorPickerForm=dc;exports.WakaCombobox=Rb;exports.WakaDashboard=Tc;exports.WakaDateRangePicker=Mb;exports.WakaDateTimePicker=Qn;exports.WakaDateTimePickerForm=Xx;exports.WakaDrawer=zb;exports.WakaEmptyState=fs;exports.WakaErrorPage=Ws;exports.WakaFAQ=Vv;exports.WakaFileManager=fy;exports.WakaFileUpload=uc;exports.WakaHeader=Lj;exports.WakaImage=gc;exports.WakaImageGallery=Ub;exports.WakaKanban=cj;exports.WakaKanbanBoard=Qv;exports.WakaKeycloakLogin=Cl;exports.WakaLanding=hv;exports.WakaModal=xb;exports.WakaModalTrigger=gb;exports.WakaNotifications=gl;exports.WakaNumberInput=Wb;exports.WakaPagination=Cb;exports.WakaPricing=Nv;exports.WakaProfile=Xj;exports.WakaProvider=vj;exports.WakaQRCode=Gb;exports.WakaSegmentedControl=nj;exports.WakaSettings=qj;exports.WakaSidebar=Dc;exports.WakaSpinner=bl;exports.WakaStat=jc;exports.WakaStatGroup=vc;exports.WakaStepper=lb;exports.WakaThemeCreator=jl;exports.WakaThemeCreatorBlock=$c;exports.WakaThemeManager=Nl;exports.WakaTimePicker=Eb;exports.WakaTimeline=uj;exports.WakaTree=yb;exports.WakaUserManagement=ev;exports.WakaVideo=Zb;exports.WakaVirtualList=sj;exports.WakaWizard=Lv;exports.actionsTemplate=Xl;exports.addChildNode=gr;exports.applyTheme=_p;exports.availableTemplateNames=Ug;exports.avatarTemplate=Hl;exports.badgeTemplate=Bl;exports.badgeVariants=_o;exports.blockquoteVariants=dl;exports.booleanTemplate=Gl;exports.calculateDuration=vp;exports.compareRanges=Ip;exports.createActionsTemplate=ar;exports.createBookingDateValidator=Sp;exports.createCardExpiryValidator=kp;exports.createCommonPresets=up;exports.createCustomPreset=fp;exports.createLastDaysPresets=mp;exports.createMaxAgeValidator=bp;exports.createMaxRangeDaysValidator=Dp;exports.createMinAgeValidator=gp;exports.createMonthlyPresets=Mp;exports.createNextDaysPresets=hp;exports.createQuarterPresets=Pp;exports.currencyTemplate=zl;exports.dateTemplate=Ll;exports.dateToTimestamp=Ap;exports.datetimeTemplate=$l;exports.defaultActivities=Gv;exports.defaultActivityFilters=Hv;exports.defaultBreadcrumbs=xy;exports.defaultCalendarEvents=uy;exports.defaultChatConversations=xn;exports.defaultChatMessages=Lc;exports.defaultChatUser=Ls;exports.defaultDashboardStats=Ec;exports.defaultFAQCategories=Bv;exports.defaultFAQItems=Wv;exports.defaultFiles=py;exports.defaultKanbanColumns=Kv;exports.defaultKanbanLabels=Jv;exports.defaultLandingCTA=bv;exports.defaultLandingFeatures=pv;exports.defaultLandingHero=gv;exports.defaultLandingNavItems=fv;exports.defaultLandingTestimonials=xv;exports.defaultPermissions=sv;exports.defaultPresets=xc;exports.defaultPricingFAQ=kv;exports.defaultPricingPlans=Cv;exports.defaultProfileData=Yj;exports.defaultSettingsTabs=Uj;exports.defaultThemes=bn;exports.defaultUsers=tv;exports.defaultWizardSteps=$v;exports.emailTemplate=Wl;exports.exportToCSV=kl;exports.exportToJSON=Sl;exports.findNodeById=pr;exports.formatDateRange=yp;exports.formatters=it;exports.getDatesInMonth=En;exports.getFrenchHolidays=wp;exports.getIndexedDBService=rc;exports.getTemplate=qg;exports.getThemeLoader=Mn;exports.getWeekdaysInMonth=Cp;exports.getWeekendsInMonth=Np;exports.getWorkingDays=Ep;exports.headingVariants=ll;exports.idTemplate=Ql;exports.indexTemplate=Yl;exports.initThemeLoader=Op;exports.isDateInRange=Bt;exports.isFutureDate=pp;exports.isHoliday=Qo;exports.isNotExpired=jp;exports.isPastDate=Xo;exports.isSameDay=Tp;exports.isToday=xp;exports.isWeekday=Tn;exports.isWeekend=Yo;exports.jsonTemplate=ec;exports.kbdVariants=ml;exports.loadTableState=Tl;exports.loadTheme=zp;exports.mergeRanges=Lp;exports.moveNode=wb;exports.navigationMenuTriggerStyle=Ui;exports.normalizeDate=Rp;exports.numberTemplate=Vl;exports.parseCSV=tg;exports.percentageTemplate=_l;exports.phoneTemplate=ql;exports.progressTemplate=Jl;exports.rangesOverlap=$p;exports.ratingTemplate=Kl;exports.reducer=sl;exports.removeNode=xr;exports.saveTableState=Dl;exports.statusTemplate=sr;exports.tagsTemplate=Zl;exports.templatesMap=Is;exports.textTemplate=tc;exports.textVariants=ol;exports.themeManagerVariants=wl;exports.timeTemplate=Ol;exports.timestampToDate=Fp;exports.toast=al;exports.toggleVariants=nl;exports.updateNode=pc;exports.urlTemplate=Ul;exports.useAdmincrumb=Hx;exports.useAdmincrumbContext=Cj;exports.useAdmincrumbContextOptional=kj;exports.useBreadcrumbFromPath=mb;exports.useCombobox=Ib;exports.useDataTable=El;exports.useDataTableAdvanced=Pl;exports.useDataTableAdvancedFilters=Xg;exports.useDataTableColumnTemplates=Hg;exports.useDataTableEdit=Jn;exports.useDataTableOffline=Kg;exports.useDataTableSelection=xg;exports.useDataTableTheme=Al;exports.useDataTableVirtualization=Ml;exports.useDateForm=Yx;exports.useDateRangePicker=Ab;exports.useDrawer=_b;exports.useErrorBoundaryReset=Ld;exports.useFormField=ma;exports.useKanban=dj;exports.useLanguage=Nr;exports.useLegacyTheme=jj;exports.useModal=bb;exports.useNotifications=Kx;exports.useNumberInput=qb;exports.usePagination=kb;exports.useQRCode=Xb;exports.useSegmentedControl=rj;exports.useSidebar=Rj;exports.useStat=fj;exports.useStepperContext=ir;exports.useTableLayout=Kn;exports.useTheme=Bs;exports.useThemeLoader=Vp;exports.useTimePicker=Pb;exports.useToast=_a;exports.useTranslation=xl;exports.useVideo=ej;exports.useVirtualList=aj;exports.useWaka=wj;exports.useWizard=Fv;exports.withErrorBoundary=$d;
|