@moontra/moonui-pro 3.4.29 → 3.4.31
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/cdn/index.global.js +1 -1
- package/dist/cdn/index.global.js.map +1 -1
- package/dist/index.mjs +23 -19
- package/package.json +1 -1
package/dist/cdn/index.global.js
CHANGED
|
@@ -513,7 +513,7 @@ ${e.description}`:e.title;e.variant==="destructive"?console.error(t):console.log
|
|
|
513
513
|
color: hsl(${Math.max(0,Math.min(120-120*f,120))}deg 100% 31%);`,r?.key)}return o}}function Ar(e,t,r,n){return{debug:()=>{var o;return(o=e?.debugAll)!=null?o:e[t]},key:!1,onChange:n}}function qUt(e,t,r,n){let o=()=>{var i;return(i=a.getValue())!=null?i:e.options.renderFallbackValue},a={id:`${t.id}_${r.id}`,row:t,column:r,getValue:()=>t.getValue(n),renderValue:o,getContext:Tr(()=>[e,r,t,a],(i,s,l,c)=>({table:i,column:s,row:l,cell:c,getValue:c.getValue,renderValue:c.renderValue}),Ar(e.options,"debugCells","cell.getContext"))};return e._features.forEach(i=>{i.createCell==null||i.createCell(a,r,t,e)},{}),a}function GUt(e,t,r,n){var o,a;let s={...e._getDefaultColumnDef(),...t},l=s.accessorKey,c=(o=(a=s.id)!=null?a:l?typeof String.prototype.replaceAll=="function"?l.replaceAll(".","_"):l.replace(/\./g,"_"):void 0)!=null?o:typeof s.header=="string"?s.header:void 0,u;if(s.accessorFn?u=s.accessorFn:l&&(l.includes(".")?u=f=>{let p=f;for(let h of l.split(".")){var m;p=(m=p)==null?void 0:m[h]}return p}:u=f=>f[s.accessorKey]),!c)throw new Error;let d={id:`${String(c)}`,accessorFn:u,parent:n,depth:r,columnDef:s,columns:[],getFlatColumns:Tr(()=>[!0],()=>{var f;return[d,...(f=d.columns)==null?void 0:f.flatMap(p=>p.getFlatColumns())]},Ar(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:Tr(()=>[e._getOrderColumnsFn()],f=>{var p;if((p=d.columns)!=null&&p.length){let m=d.columns.flatMap(h=>h.getLeafColumns());return f(m)}return[d]},Ar(e.options,"debugColumns","column.getLeafColumns"))};for(let f of e._features)f.createColumn==null||f.createColumn(d,e);return d}var Oc="debugHeaders";function Lje(e,t,r){var n;let a={id:(n=r.id)!=null?n:t.id,column:t,index:r.index,isPlaceholder:!!r.isPlaceholder,placeholderId:r.placeholderId,depth:r.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let i=[],s=l=>{l.subHeaders&&l.subHeaders.length&&l.subHeaders.map(s),i.push(l)};return s(a),i},getContext:()=>({table:e,header:a,column:t})};return e._features.forEach(i=>{i.createHeader==null||i.createHeader(a,e)}),a}var KUt={createTable:e=>{e.getHeaderGroups=Tr(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,n,o)=>{var a,i;let s=(a=n?.map(d=>r.find(f=>f.id===d)).filter(Boolean))!=null?a:[],l=(i=o?.map(d=>r.find(f=>f.id===d)).filter(Boolean))!=null?i:[],c=r.filter(d=>!(n!=null&&n.includes(d.id))&&!(o!=null&&o.includes(d.id)));return QH(t,[...s,...c,...l],e)},Ar(e.options,Oc,"getHeaderGroups")),e.getCenterHeaderGroups=Tr(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,n,o)=>(r=r.filter(a=>!(n!=null&&n.includes(a.id))&&!(o!=null&&o.includes(a.id))),QH(t,r,e,"center")),Ar(e.options,Oc,"getCenterHeaderGroups")),e.getLeftHeaderGroups=Tr(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,r,n)=>{var o;let a=(o=n?.map(i=>r.find(s=>s.id===i)).filter(Boolean))!=null?o:[];return QH(t,a,e,"left")},Ar(e.options,Oc,"getLeftHeaderGroups")),e.getRightHeaderGroups=Tr(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,r,n)=>{var o;let a=(o=n?.map(i=>r.find(s=>s.id===i)).filter(Boolean))!=null?o:[];return QH(t,a,e,"right")},Ar(e.options,Oc,"getRightHeaderGroups")),e.getFooterGroups=Tr(()=>[e.getHeaderGroups()],t=>[...t].reverse(),Ar(e.options,Oc,"getFooterGroups")),e.getLeftFooterGroups=Tr(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),Ar(e.options,Oc,"getLeftFooterGroups")),e.getCenterFooterGroups=Tr(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),Ar(e.options,Oc,"getCenterFooterGroups")),e.getRightFooterGroups=Tr(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),Ar(e.options,Oc,"getRightFooterGroups")),e.getFlatHeaders=Tr(()=>[e.getHeaderGroups()],t=>t.map(r=>r.headers).flat(),Ar(e.options,Oc,"getFlatHeaders")),e.getLeftFlatHeaders=Tr(()=>[e.getLeftHeaderGroups()],t=>t.map(r=>r.headers).flat(),Ar(e.options,Oc,"getLeftFlatHeaders")),e.getCenterFlatHeaders=Tr(()=>[e.getCenterHeaderGroups()],t=>t.map(r=>r.headers).flat(),Ar(e.options,Oc,"getCenterFlatHeaders")),e.getRightFlatHeaders=Tr(()=>[e.getRightHeaderGroups()],t=>t.map(r=>r.headers).flat(),Ar(e.options,Oc,"getRightFlatHeaders")),e.getCenterLeafHeaders=Tr(()=>[e.getCenterFlatHeaders()],t=>t.filter(r=>{var n;return!((n=r.subHeaders)!=null&&n.length)}),Ar(e.options,Oc,"getCenterLeafHeaders")),e.getLeftLeafHeaders=Tr(()=>[e.getLeftFlatHeaders()],t=>t.filter(r=>{var n;return!((n=r.subHeaders)!=null&&n.length)}),Ar(e.options,Oc,"getLeftLeafHeaders")),e.getRightLeafHeaders=Tr(()=>[e.getRightFlatHeaders()],t=>t.filter(r=>{var n;return!((n=r.subHeaders)!=null&&n.length)}),Ar(e.options,Oc,"getRightLeafHeaders")),e.getLeafHeaders=Tr(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,r,n)=>{var o,a,i,s,l,c;return[...(o=(a=t[0])==null?void 0:a.headers)!=null?o:[],...(i=(s=r[0])==null?void 0:s.headers)!=null?i:[],...(l=(c=n[0])==null?void 0:c.headers)!=null?l:[]].map(u=>u.getLeafHeaders()).flat()},Ar(e.options,Oc,"getLeafHeaders"))}};function QH(e,t,r,n){var o,a;let i=0,s=function(f,p){p===void 0&&(p=1),i=Math.max(i,p),f.filter(m=>m.getIsVisible()).forEach(m=>{var h;(h=m.columns)!=null&&h.length&&s(m.columns,p+1)},0)};s(e);let l=[],c=(f,p)=>{let m={depth:p,id:[n,`${p}`].filter(Boolean).join("_"),headers:[]},h=[];f.forEach(g=>{let v=[...h].reverse()[0],y=g.column.depth===m.depth,b,w=!1;if(y&&g.column.parent?b=g.column.parent:(b=g.column,w=!0),v&&v?.column===b)v.subHeaders.push(g);else{let x=Lje(r,b,{id:[n,p,b.id,g?.id].filter(Boolean).join("_"),isPlaceholder:w,placeholderId:w?`${h.filter(C=>C.column===b).length}`:void 0,depth:p,index:h.length});x.subHeaders.push(g),h.push(x)}m.headers.push(g),g.headerGroup=m}),l.push(m),p>0&&c(h,p-1)},u=t.map((f,p)=>Lje(r,f,{depth:i,index:p}));c(u,i-1),l.reverse();let d=f=>f.filter(m=>m.column.getIsVisible()).map(m=>{let h=0,g=0,v=[0];m.subHeaders&&m.subHeaders.length?(v=[],d(m.subHeaders).forEach(b=>{let{colSpan:w,rowSpan:x}=b;h+=w,v.push(x)})):h=1;let y=Math.min(...v);return g=g+y,m.colSpan=h,m.rowSpan=g,{colSpan:h,rowSpan:g}});return d((o=(a=l[0])==null?void 0:a.headers)!=null?o:[]),l}var Ine=(e,t,r,n,o,a,i)=>{let s={id:t,index:n,original:r,depth:o,parentId:i,_valuesCache:{},_uniqueValuesCache:{},getValue:l=>{if(s._valuesCache.hasOwnProperty(l))return s._valuesCache[l];let c=e.getColumn(l);if(c!=null&&c.accessorFn)return s._valuesCache[l]=c.accessorFn(s.original,n),s._valuesCache[l]},getUniqueValues:l=>{if(s._uniqueValuesCache.hasOwnProperty(l))return s._uniqueValuesCache[l];let c=e.getColumn(l);if(c!=null&&c.accessorFn)return c.columnDef.getUniqueValues?(s._uniqueValuesCache[l]=c.columnDef.getUniqueValues(s.original,n),s._uniqueValuesCache[l]):(s._uniqueValuesCache[l]=[s.getValue(l)],s._uniqueValuesCache[l])},renderValue:l=>{var c;return(c=s.getValue(l))!=null?c:e.options.renderFallbackValue},subRows:a??[],getLeafRows:()=>WUt(s.subRows,l=>l.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let l=[],c=s;for(;;){let u=c.getParentRow();if(!u)break;l.push(u),c=u}return l.reverse()},getAllCells:Tr(()=>[e.getAllLeafColumns()],l=>l.map(c=>qUt(e,s,c,c.id)),Ar(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:Tr(()=>[s.getAllCells()],l=>l.reduce((c,u)=>(c[u.column.id]=u,c),{}),Ar(e.options,"debugRows","getAllCellsByColumnId"))};for(let l=0;l<e._features.length;l++){let c=e._features[l];c==null||c.createRow==null||c.createRow(s,e)}return s},YUt={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Oje=(e,t,r)=>{var n,o;let a=r==null||(n=r.toString())==null?void 0:n.toLowerCase();return!!(!((o=e.getValue(t))==null||(o=o.toString())==null||(o=o.toLowerCase())==null)&&o.includes(a))};Oje.autoRemove=e=>Wm(e);var _je=(e,t,r)=>{var n;return!!(!((n=e.getValue(t))==null||(n=n.toString())==null)&&n.includes(r))};_je.autoRemove=e=>Wm(e);var Fje=(e,t,r)=>{var n;return((n=e.getValue(t))==null||(n=n.toString())==null?void 0:n.toLowerCase())===r?.toLowerCase()};Fje.autoRemove=e=>Wm(e);var Bje=(e,t,r)=>{var n;return(n=e.getValue(t))==null?void 0:n.includes(r)};Bje.autoRemove=e=>Wm(e);var zje=(e,t,r)=>!r.some(n=>{var o;return!((o=e.getValue(t))!=null&&o.includes(n))});zje.autoRemove=e=>Wm(e)||!(e!=null&&e.length);var Uje=(e,t,r)=>r.some(n=>{var o;return(o=e.getValue(t))==null?void 0:o.includes(n)});Uje.autoRemove=e=>Wm(e)||!(e!=null&&e.length);var Vje=(e,t,r)=>e.getValue(t)===r;Vje.autoRemove=e=>Wm(e);var $je=(e,t,r)=>e.getValue(t)==r;$je.autoRemove=e=>Wm(e);var Lne=(e,t,r)=>{let[n,o]=r,a=e.getValue(t);return a>=n&&a<=o};Lne.resolveFilterValue=e=>{let[t,r]=e,n=typeof t!="number"?parseFloat(t):t,o=typeof r!="number"?parseFloat(r):r,a=t===null||Number.isNaN(n)?-1/0:n,i=r===null||Number.isNaN(o)?1/0:o;if(a>i){let s=a;a=i,i=s}return[a,i]};Lne.autoRemove=e=>Wm(e)||Wm(e[0])&&Wm(e[1]);var hy={includesString:Oje,includesStringSensitive:_je,equalsString:Fje,arrIncludes:Bje,arrIncludesAll:zje,arrIncludesSome:Uje,equals:Vje,weakEquals:$je,inNumberRange:Lne};function Wm(e){return e==null||e===""}var XUt={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Rf("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let r=t.getCoreRowModel().flatRows[0],n=r?.getValue(e.id);return typeof n=="string"?hy.includesString:typeof n=="number"?hy.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?hy.equals:Array.isArray(n)?hy.arrIncludes:hy.weakEquals},e.getFilterFn=()=>{var r,n;return tj(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(r=(n=t.options.filterFns)==null?void 0:n[e.columnDef.filterFn])!=null?r:hy[e.columnDef.filterFn]},e.getCanFilter=()=>{var r,n,o;return((r=e.columnDef.enableColumnFilter)!=null?r:!0)&&((n=t.options.enableColumnFilters)!=null?n:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var r;return(r=t.getState().columnFilters)==null||(r=r.find(n=>n.id===e.id))==null?void 0:r.value},e.getFilterIndex=()=>{var r,n;return(r=(n=t.getState().columnFilters)==null?void 0:n.findIndex(o=>o.id===e.id))!=null?r:-1},e.setFilterValue=r=>{t.setColumnFilters(n=>{let o=e.getFilterFn(),a=n?.find(u=>u.id===e.id),i=qb(r,a?a.value:void 0);if(Dje(o,i,e)){var s;return(s=n?.filter(u=>u.id!==e.id))!=null?s:[]}let l={id:e.id,value:i};if(a){var c;return(c=n?.map(u=>u.id===e.id?l:u))!=null?c:[]}return n!=null&&n.length?[...n,l]:[l]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let r=e.getAllLeafColumns(),n=o=>{var a;return(a=qb(t,o))==null?void 0:a.filter(i=>{let s=r.find(l=>l.id===i.id);if(s){let l=s.getFilterFn();if(Dje(l,i.value,s))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(n)},e.resetColumnFilters=t=>{var r,n;e.setColumnFilters(t?[]:(r=(n=e.initialState)==null?void 0:n.columnFilters)!=null?r:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Dje(e,t,r){return(e&&e.autoRemove?e.autoRemove(t,r):!1)||typeof t>"u"||typeof t=="string"&&!t}var JUt=(e,t,r)=>r.reduce((n,o)=>{let a=o.getValue(e);return n+(typeof a=="number"?a:0)},0),QUt=(e,t,r)=>{let n;return r.forEach(o=>{let a=o.getValue(e);a!=null&&(n>a||n===void 0&&a>=a)&&(n=a)}),n},ZUt=(e,t,r)=>{let n;return r.forEach(o=>{let a=o.getValue(e);a!=null&&(n<a||n===void 0&&a>=a)&&(n=a)}),n},eVt=(e,t,r)=>{let n,o;return r.forEach(a=>{let i=a.getValue(e);i!=null&&(n===void 0?i>=i&&(n=o=i):(n>i&&(n=i),o<i&&(o=i)))}),[n,o]},tVt=(e,t)=>{let r=0,n=0;if(t.forEach(o=>{let a=o.getValue(e);a!=null&&(a=+a)>=a&&(++r,n+=a)}),r)return n/r},rVt=(e,t)=>{if(!t.length)return;let r=t.map(a=>a.getValue(e));if(!jUt(r))return;if(r.length===1)return r[0];let n=Math.floor(r.length/2),o=r.sort((a,i)=>a-i);return r.length%2!==0?o[n]:(o[n-1]+o[n])/2},nVt=(e,t)=>Array.from(new Set(t.map(r=>r.getValue(e))).values()),oVt=(e,t)=>new Set(t.map(r=>r.getValue(e))).size,aVt=(e,t)=>t.length,xne={sum:JUt,min:QUt,max:ZUt,extent:eVt,mean:tVt,median:rVt,unique:nVt,uniqueCount:oVt,count:aVt},iVt={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,r;return(t=(r=e.getValue())==null||r.toString==null?void 0:r.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Rf("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(r=>r!=null&&r.includes(e.id)?r.filter(n=>n!==e.id):[...r??[],e.id])},e.getCanGroup=()=>{var r,n;return((r=e.columnDef.enableGrouping)!=null?r:!0)&&((n=t.options.enableGrouping)!=null?n:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var r;return(r=t.getState().grouping)==null?void 0:r.includes(e.id)},e.getGroupedIndex=()=>{var r;return(r=t.getState().grouping)==null?void 0:r.indexOf(e.id)},e.getToggleGroupingHandler=()=>{let r=e.getCanGroup();return()=>{r&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let r=t.getCoreRowModel().flatRows[0],n=r?.getValue(e.id);if(typeof n=="number")return xne.sum;if(Object.prototype.toString.call(n)==="[object Date]")return xne.extent},e.getAggregationFn=()=>{var r,n;if(!e)throw new Error;return tj(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(r=(n=t.options.aggregationFns)==null?void 0:n[e.columnDef.aggregationFn])!=null?r:xne[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var r,n;e.setGrouping(t?[]:(r=(n=e.initialState)==null?void 0:n.grouping)!=null?r:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=r=>{if(e._groupingValuesCache.hasOwnProperty(r))return e._groupingValuesCache[r];let n=t.getColumn(r);return n!=null&&n.columnDef.getGroupingValue?(e._groupingValuesCache[r]=n.columnDef.getGroupingValue(e.original),e._groupingValuesCache[r]):e.getValue(r)},e._groupingValuesCache={}},createCell:(e,t,r,n)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===r.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=r.subRows)!=null&&o.length)}}};function sVt(e,t,r){if(!(t!=null&&t.length)||!r)return e;let n=e.filter(a=>!t.includes(a.id));return r==="remove"?n:[...t.map(a=>e.find(i=>i.id===a)).filter(Boolean),...n]}var lVt={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Rf("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Tr(r=>[sD(t,r)],r=>r.findIndex(n=>n.id===e.id),Ar(t.options,"debugColumns","getIndex")),e.getIsFirstColumn=r=>{var n;return((n=sD(t,r)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=r=>{var n;let o=sD(t,r);return((n=o[o.length-1])==null?void 0:n.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var r;e.setColumnOrder(t?[]:(r=e.initialState.columnOrder)!=null?r:[])},e._getOrderColumnsFn=Tr(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,r,n)=>o=>{let a=[];if(!(t!=null&&t.length))a=o;else{let i=[...t],s=[...o];for(;s.length&&i.length;){let l=i.shift(),c=s.findIndex(u=>u.id===l);c>-1&&a.push(s.splice(c,1)[0])}a=[...a,...s]}return sVt(a,r,n)},Ar(e.options,"debugTable","_getOrderColumnsFn"))}},wne=()=>({left:[],right:[]}),cVt={getInitialState:e=>({columnPinning:wne(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Rf("columnPinning",e)}),createColumn:(e,t)=>{e.pin=r=>{let n=e.getLeafColumns().map(o=>o.id).filter(Boolean);t.setColumnPinning(o=>{var a,i;if(r==="right"){var s,l;return{left:((s=o?.left)!=null?s:[]).filter(d=>!(n!=null&&n.includes(d))),right:[...((l=o?.right)!=null?l:[]).filter(d=>!(n!=null&&n.includes(d))),...n]}}if(r==="left"){var c,u;return{left:[...((c=o?.left)!=null?c:[]).filter(d=>!(n!=null&&n.includes(d))),...n],right:((u=o?.right)!=null?u:[]).filter(d=>!(n!=null&&n.includes(d)))}}return{left:((a=o?.left)!=null?a:[]).filter(d=>!(n!=null&&n.includes(d))),right:((i=o?.right)!=null?i:[]).filter(d=>!(n!=null&&n.includes(d)))}})},e.getCanPin=()=>e.getLeafColumns().some(n=>{var o,a,i;return((o=n.columnDef.enablePinning)!=null?o:!0)&&((a=(i=t.options.enableColumnPinning)!=null?i:t.options.enablePinning)!=null?a:!0)}),e.getIsPinned=()=>{let r=e.getLeafColumns().map(s=>s.id),{left:n,right:o}=t.getState().columnPinning,a=r.some(s=>n?.includes(s)),i=r.some(s=>o?.includes(s));return a?"left":i?"right":!1},e.getPinnedIndex=()=>{var r,n;let o=e.getIsPinned();return o?(r=(n=t.getState().columnPinning)==null||(n=n[o])==null?void 0:n.indexOf(e.id))!=null?r:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Tr(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(r,n,o)=>{let a=[...n??[],...o??[]];return r.filter(i=>!a.includes(i.column.id))},Ar(t.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=Tr(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(r,n)=>(n??[]).map(a=>r.find(i=>i.column.id===a)).filter(Boolean).map(a=>({...a,position:"left"})),Ar(t.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=Tr(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(r,n)=>(n??[]).map(a=>r.find(i=>i.column.id===a)).filter(Boolean).map(a=>({...a,position:"right"})),Ar(t.options,"debugRows","getRightVisibleCells"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var r,n;return e.setColumnPinning(t?wne():(r=(n=e.initialState)==null?void 0:n.columnPinning)!=null?r:wne())},e.getIsSomeColumnsPinned=t=>{var r;let n=e.getState().columnPinning;if(!t){var o,a;return!!((o=n.left)!=null&&o.length||(a=n.right)!=null&&a.length)}return!!((r=n[t])!=null&&r.length)},e.getLeftLeafColumns=Tr(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,r)=>(r??[]).map(n=>t.find(o=>o.id===n)).filter(Boolean),Ar(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=Tr(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,r)=>(r??[]).map(n=>t.find(o=>o.id===n)).filter(Boolean),Ar(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=Tr(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,n)=>{let o=[...r??[],...n??[]];return t.filter(a=>!o.includes(a.id))},Ar(e.options,"debugColumns","getCenterLeafColumns"))}};function uVt(e){return e||(typeof document<"u"?document:null)}var ZH={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Cne=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),dVt={getDefaultColumnDef:()=>ZH,getInitialState:e=>({columnSizing:{},columnSizingInfo:Cne(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Rf("columnSizing",e),onColumnSizingInfoChange:Rf("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var r,n,o;let a=t.getState().columnSizing[e.id];return Math.min(Math.max((r=e.columnDef.minSize)!=null?r:ZH.minSize,(n=a??e.columnDef.size)!=null?n:ZH.size),(o=e.columnDef.maxSize)!=null?o:ZH.maxSize)},e.getStart=Tr(r=>[r,sD(t,r),t.getState().columnSizing],(r,n)=>n.slice(0,e.getIndex(r)).reduce((o,a)=>o+a.getSize(),0),Ar(t.options,"debugColumns","getStart")),e.getAfter=Tr(r=>[r,sD(t,r),t.getState().columnSizing],(r,n)=>n.slice(e.getIndex(r)+1).reduce((o,a)=>o+a.getSize(),0),Ar(t.options,"debugColumns","getAfter")),e.resetSize=()=>{t.setColumnSizing(r=>{let{[e.id]:n,...o}=r;return o})},e.getCanResize=()=>{var r,n;return((r=e.columnDef.enableResizing)!=null?r:!0)&&((n=t.options.enableColumnResizing)!=null?n:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let r=0,n=o=>{if(o.subHeaders.length)o.subHeaders.forEach(n);else{var a;r+=(a=o.column.getSize())!=null?a:0}};return n(e),r},e.getStart=()=>{if(e.index>0){let r=e.headerGroup.headers[e.index-1];return r.getStart()+r.getSize()}return 0},e.getResizeHandler=r=>{let n=t.getColumn(e.column.id),o=n?.getCanResize();return a=>{if(!n||!o||(a.persist==null||a.persist(),Sne(a)&&a.touches&&a.touches.length>1))return;let i=e.getSize(),s=e?e.getLeafHeaders().map(v=>[v.column.id,v.column.getSize()]):[[n.id,n.getSize()]],l=Sne(a)?Math.round(a.touches[0].clientX):a.clientX,c={},u=(v,y)=>{typeof y=="number"&&(t.setColumnSizingInfo(b=>{var w,x;let C=t.options.columnResizeDirection==="rtl"?-1:1,P=(y-((w=b?.startOffset)!=null?w:0))*C,R=Math.max(P/((x=b?.startSize)!=null?x:0),-.999999);return b.columnSizingStart.forEach(L=>{let[$,I]=L;c[$]=Math.round(Math.max(I+I*R,0)*100)/100}),{...b,deltaOffset:P,deltaPercentage:R}}),(t.options.columnResizeMode==="onChange"||v==="end")&&t.setColumnSizing(b=>({...b,...c})))},d=v=>u("move",v),f=v=>{u("end",v),t.setColumnSizingInfo(y=>({...y,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=uVt(r),m={moveHandler:v=>d(v.clientX),upHandler:v=>{p?.removeEventListener("mousemove",m.moveHandler),p?.removeEventListener("mouseup",m.upHandler),f(v.clientX)}},h={moveHandler:v=>(v.cancelable&&(v.preventDefault(),v.stopPropagation()),d(v.touches[0].clientX),!1),upHandler:v=>{var y;p?.removeEventListener("touchmove",h.moveHandler),p?.removeEventListener("touchend",h.upHandler),v.cancelable&&(v.preventDefault(),v.stopPropagation()),f((y=v.touches[0])==null?void 0:y.clientX)}},g=fVt()?{passive:!1}:!1;Sne(a)?(p?.addEventListener("touchmove",h.moveHandler,g),p?.addEventListener("touchend",h.upHandler,g)):(p?.addEventListener("mousemove",m.moveHandler,g),p?.addEventListener("mouseup",m.upHandler,g)),t.setColumnSizingInfo(v=>({...v,startOffset:l,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:n.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var r;e.setColumnSizing(t?{}:(r=e.initialState.columnSizing)!=null?r:{})},e.resetHeaderSizeInfo=t=>{var r;e.setColumnSizingInfo(t?Cne():(r=e.initialState.columnSizingInfo)!=null?r:Cne())},e.getTotalSize=()=>{var t,r;return(t=(r=e.getHeaderGroups()[0])==null?void 0:r.headers.reduce((n,o)=>n+o.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,r;return(t=(r=e.getLeftHeaderGroups()[0])==null?void 0:r.headers.reduce((n,o)=>n+o.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,r;return(t=(r=e.getCenterHeaderGroups()[0])==null?void 0:r.headers.reduce((n,o)=>n+o.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,r;return(t=(r=e.getRightHeaderGroups()[0])==null?void 0:r.headers.reduce((n,o)=>n+o.getSize(),0))!=null?t:0}}},ej=null;function fVt(){if(typeof ej=="boolean")return ej;let e=!1;try{let t={get passive(){return e=!0,!1}},r=()=>{};window.addEventListener("test",r,t),window.removeEventListener("test",r)}catch{e=!1}return ej=e,ej}function Sne(e){return e.type==="touchstart"}var pVt={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Rf("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=r=>{e.getCanHide()&&t.setColumnVisibility(n=>({...n,[e.id]:r??!e.getIsVisible()}))},e.getIsVisible=()=>{var r,n;let o=e.columns;return(r=o.length?o.some(a=>a.getIsVisible()):(n=t.getState().columnVisibility)==null?void 0:n[e.id])!=null?r:!0},e.getCanHide=()=>{var r,n;return((r=e.columnDef.enableHiding)!=null?r:!0)&&((n=t.options.enableHiding)!=null?n:!0)},e.getToggleVisibilityHandler=()=>r=>{e.toggleVisibility==null||e.toggleVisibility(r.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Tr(()=>[e.getAllCells(),t.getState().columnVisibility],r=>r.filter(n=>n.column.getIsVisible()),Ar(t.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=Tr(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(r,n,o)=>[...r,...n,...o],Ar(t.options,"debugRows","getVisibleCells"))},createTable:e=>{let t=(r,n)=>Tr(()=>[n(),n().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(a=>a.getIsVisible==null?void 0:a.getIsVisible()),Ar(e.options,"debugColumns",r));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=r=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(r),e.resetColumnVisibility=r=>{var n;e.setColumnVisibility(r?{}:(n=e.initialState.columnVisibility)!=null?n:{})},e.toggleAllColumnsVisible=r=>{var n;r=(n=r)!=null?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,a)=>({...o,[a.id]:r||!(a.getCanHide!=null&&a.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(r=>!(r.getIsVisible!=null&&r.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(r=>r.getIsVisible==null?void 0:r.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>r=>{var n;e.toggleAllColumnsVisible((n=r.target)==null?void 0:n.checked)}}};function sD(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var mVt={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},hVt={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Rf("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var r;let n=(r=e.getCoreRowModel().flatRows[0])==null||(r=r._getAllCellsByColumnId()[t.id])==null?void 0:r.getValue();return typeof n=="string"||typeof n=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var r,n,o,a;return((r=e.columnDef.enableGlobalFilter)!=null?r:!0)&&((n=t.options.enableGlobalFilter)!=null?n:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&((a=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?a:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>hy.includesString,e.getGlobalFilterFn=()=>{var t,r;let{globalFilterFn:n}=e.options;return tj(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(t=(r=e.options.filterFns)==null?void 0:r[n])!=null?t:hy[n]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},gVt={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Rf("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,r=!1;e._autoResetExpanded=()=>{var n,o;if(!t){e._queue(()=>{t=!0});return}if((n=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?n:!e.options.manualExpanding){if(r)return;r=!0,e._queue(()=>{e.resetExpanded(),r=!1})}},e.setExpanded=n=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(n),e.toggleAllRowsExpanded=n=>{n??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=n=>{var o,a;e.setExpanded(n?{}:(o=(a=e.initialState)==null?void 0:a.expanded)!=null?o:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(n=>n.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>n=>{n.persist==null||n.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let n=e.getState().expanded;return n===!0||Object.values(n).some(Boolean)},e.getIsAllRowsExpanded=()=>{let n=e.getState().expanded;return typeof n=="boolean"?n===!0:!(!Object.keys(n).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(a=>{let i=a.split(".");n=Math.max(n,i.length)}),n},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=r=>{t.setExpanded(n=>{var o;let a=n===!0?!0:!!(n!=null&&n[e.id]),i={};if(n===!0?Object.keys(t.getRowModel().rowsById).forEach(s=>{i[s]=!0}):i=n,r=(o=r)!=null?o:!a,!a&&r)return{...i,[e.id]:!0};if(a&&!r){let{[e.id]:s,...l}=i;return l}return n})},e.getIsExpanded=()=>{var r;let n=t.getState().expanded;return!!((r=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?r:n===!0||n?.[e.id])},e.getCanExpand=()=>{var r,n,o;return(r=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?r:((n=t.options.enableExpanding)!=null?n:!0)&&!!((o=e.subRows)!=null&&o.length)},e.getIsAllParentsExpanded=()=>{let r=!0,n=e;for(;r&&n.parentId;)n=t.getRow(n.parentId,!0),r=n.getIsExpanded();return r},e.getToggleExpandedHandler=()=>{let r=e.getCanExpand();return()=>{r&&e.toggleExpanded()}}}},Rne=0,Mne=10,Pne=()=>({pageIndex:Rne,pageSize:Mne}),vVt={getInitialState:e=>({...e,pagination:{...Pne(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Rf("pagination",e)}),createTable:e=>{let t=!1,r=!1;e._autoResetPageIndex=()=>{var n,o;if(!t){e._queue(()=>{t=!0});return}if((n=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(r)return;r=!0,e._queue(()=>{e.resetPageIndex(),r=!1})}},e.setPagination=n=>{let o=a=>qb(n,a);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=n=>{var o;e.setPagination(n?Pne():(o=e.initialState.pagination)!=null?o:Pne())},e.setPageIndex=n=>{e.setPagination(o=>{let a=qb(n,o.pageIndex),i=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return a=Math.max(0,Math.min(a,i)),{...o,pageIndex:a}})},e.resetPageIndex=n=>{var o,a;e.setPageIndex(n?Rne:(o=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageIndex)!=null?o:Rne)},e.resetPageSize=n=>{var o,a;e.setPageSize(n?Mne:(o=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageSize)!=null?o:Mne)},e.setPageSize=n=>{e.setPagination(o=>{let a=Math.max(1,qb(n,o.pageSize)),i=o.pageSize*o.pageIndex,s=Math.floor(i/a);return{...o,pageIndex:s,pageSize:a}})},e.setPageCount=n=>e.setPagination(o=>{var a;let i=qb(n,(a=e.options.pageCount)!=null?a:-1);return typeof i=="number"&&(i=Math.max(-1,i)),{...o,pageCount:i}}),e.getPageOptions=Tr(()=>[e.getPageCount()],n=>{let o=[];return n&&n>0&&(o=[...new Array(n)].fill(null).map((a,i)=>i)),o},Ar(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:n}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:n<o-1},e.previousPage=()=>e.setPageIndex(n=>n-1),e.nextPage=()=>e.setPageIndex(n=>n+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var n;return(n=e.options.pageCount)!=null?n:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var n;return(n=e.options.rowCount)!=null?n:e.getPrePaginationRowModel().rows.length}}},Nne=()=>({top:[],bottom:[]}),yVt={getInitialState:e=>({rowPinning:Nne(),...e}),getDefaultOptions:e=>({onRowPinningChange:Rf("rowPinning",e)}),createRow:(e,t)=>{e.pin=(r,n,o)=>{let a=n?e.getLeafRows().map(l=>{let{id:c}=l;return c}):[],i=o?e.getParentRows().map(l=>{let{id:c}=l;return c}):[],s=new Set([...i,e.id,...a]);t.setRowPinning(l=>{var c,u;if(r==="bottom"){var d,f;return{top:((d=l?.top)!=null?d:[]).filter(h=>!(s!=null&&s.has(h))),bottom:[...((f=l?.bottom)!=null?f:[]).filter(h=>!(s!=null&&s.has(h))),...Array.from(s)]}}if(r==="top"){var p,m;return{top:[...((p=l?.top)!=null?p:[]).filter(h=>!(s!=null&&s.has(h))),...Array.from(s)],bottom:((m=l?.bottom)!=null?m:[]).filter(h=>!(s!=null&&s.has(h)))}}return{top:((c=l?.top)!=null?c:[]).filter(h=>!(s!=null&&s.has(h))),bottom:((u=l?.bottom)!=null?u:[]).filter(h=>!(s!=null&&s.has(h)))}})},e.getCanPin=()=>{var r;let{enableRowPinning:n,enablePinning:o}=t.options;return typeof n=="function"?n(e):(r=n??o)!=null?r:!0},e.getIsPinned=()=>{let r=[e.id],{top:n,bottom:o}=t.getState().rowPinning,a=r.some(s=>n?.includes(s)),i=r.some(s=>o?.includes(s));return a?"top":i?"bottom":!1},e.getPinnedIndex=()=>{var r,n;let o=e.getIsPinned();if(!o)return-1;let a=(r=o==="top"?t.getTopRows():t.getBottomRows())==null?void 0:r.map(i=>{let{id:s}=i;return s});return(n=a?.indexOf(e.id))!=null?n:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var r,n;return e.setRowPinning(t?Nne():(r=(n=e.initialState)==null?void 0:n.rowPinning)!=null?r:Nne())},e.getIsSomeRowsPinned=t=>{var r;let n=e.getState().rowPinning;if(!t){var o,a;return!!((o=n.top)!=null&&o.length||(a=n.bottom)!=null&&a.length)}return!!((r=n[t])!=null&&r.length)},e._getPinnedRows=(t,r,n)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(r??[]).map(i=>{let s=e.getRow(i,!0);return s.getIsAllParentsExpanded()?s:null}):(r??[]).map(i=>t.find(s=>s.id===i))).filter(Boolean).map(i=>({...i,position:n}))},e.getTopRows=Tr(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,r)=>e._getPinnedRows(t,r,"top"),Ar(e.options,"debugRows","getTopRows")),e.getBottomRows=Tr(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,r)=>e._getPinnedRows(t,r,"bottom"),Ar(e.options,"debugRows","getBottomRows")),e.getCenterRows=Tr(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,r,n)=>{let o=new Set([...r??[],...n??[]]);return t.filter(a=>!o.has(a.id))},Ar(e.options,"debugRows","getCenterRows"))}},bVt={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Rf("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var r;return e.setRowSelection(t?{}:(r=e.initialState.rowSelection)!=null?r:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(r=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();let n={...r},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach(a=>{a.getCanSelect()&&(n[a.id]=!0)}):o.forEach(a=>{delete n[a.id]}),n})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(r=>{let n=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),o={...r};return e.getRowModel().rows.forEach(a=>{Ene(o,a.id,n,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Tr(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,r)=>Object.keys(t).length?kne(e,r):{rows:[],flatRows:[],rowsById:{}},Ar(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=Tr(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,r)=>Object.keys(t).length?kne(e,r):{rows:[],flatRows:[],rowsById:{}},Ar(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=Tr(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,r)=>Object.keys(t).length?kne(e,r):{rows:[],flatRows:[],rowsById:{}},Ar(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:r}=e.getState(),n=!!(t.length&&Object.keys(r).length);return n&&t.some(o=>o.getCanSelect()&&!r[o.id])&&(n=!1),n},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:r}=e.getState(),n=!!t.length;return n&&t.some(o=>!r[o.id])&&(n=!1),n},e.getIsSomeRowsSelected=()=>{var t;let r=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return r>0&&r<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(r=>r.getCanSelect()).some(r=>r.getIsSelected()||r.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(r,n)=>{let o=e.getIsSelected();t.setRowSelection(a=>{var i;if(r=typeof r<"u"?r:!o,e.getCanSelect()&&o===r)return a;let s={...a};return Ene(s,e.id,r,(i=n?.selectChildren)!=null?i:!0,t),s})},e.getIsSelected=()=>{let{rowSelection:r}=t.getState();return Dne(e,r)},e.getIsSomeSelected=()=>{let{rowSelection:r}=t.getState();return Tne(e,r)==="some"},e.getIsAllSubRowsSelected=()=>{let{rowSelection:r}=t.getState();return Tne(e,r)==="all"},e.getCanSelect=()=>{var r;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(r=t.options.enableRowSelection)!=null?r:!0},e.getCanSelectSubRows=()=>{var r;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(r=t.options.enableSubRowSelection)!=null?r:!0},e.getCanMultiSelect=()=>{var r;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(r=t.options.enableMultiRowSelection)!=null?r:!0},e.getToggleSelectedHandler=()=>{let r=e.getCanSelect();return n=>{var o;r&&e.toggleSelected((o=n.target)==null?void 0:o.checked)}}}},Ene=(e,t,r,n,o)=>{var a;let i=o.getRow(t,!0);r?(i.getCanMultiSelect()||Object.keys(e).forEach(s=>delete e[s]),i.getCanSelect()&&(e[t]=!0)):delete e[t],n&&(a=i.subRows)!=null&&a.length&&i.getCanSelectSubRows()&&i.subRows.forEach(s=>Ene(e,s.id,r,n,o))};function kne(e,t){let r=e.getState().rowSelection,n=[],o={},a=function(i,s){return i.map(l=>{var c;let u=Dne(l,r);if(u&&(n.push(l),o[l.id]=l),(c=l.subRows)!=null&&c.length&&(l={...l,subRows:a(l.subRows)}),u)return l}).filter(Boolean)};return{rows:a(t.rows),flatRows:n,rowsById:o}}function Dne(e,t){var r;return(r=t[e.id])!=null?r:!1}function Tne(e,t,r){var n;if(!((n=e.subRows)!=null&&n.length))return!1;let o=!0,a=!1;return e.subRows.forEach(i=>{if(!(a&&!o)&&(i.getCanSelect()&&(Dne(i,t)?a=!0:o=!1),i.subRows&&i.subRows.length)){let s=Tne(i,t);s==="all"?a=!0:(s==="some"&&(a=!0),o=!1)}}),o?"all":a?"some":!1}var Ane=/([0-9]+)/gm,xVt=(e,t,r)=>Hje(Gb(e.getValue(r)).toLowerCase(),Gb(t.getValue(r)).toLowerCase()),wVt=(e,t,r)=>Hje(Gb(e.getValue(r)),Gb(t.getValue(r))),CVt=(e,t,r)=>One(Gb(e.getValue(r)).toLowerCase(),Gb(t.getValue(r)).toLowerCase()),SVt=(e,t,r)=>One(Gb(e.getValue(r)),Gb(t.getValue(r))),PVt=(e,t,r)=>{let n=e.getValue(r),o=t.getValue(r);return n>o?1:n<o?-1:0},NVt=(e,t,r)=>One(e.getValue(r),t.getValue(r));function One(e,t){return e===t?0:e>t?1:-1}function Gb(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Hje(e,t){let r=e.split(Ane).filter(Boolean),n=t.split(Ane).filter(Boolean);for(;r.length&&n.length;){let o=r.shift(),a=n.shift(),i=parseInt(o,10),s=parseInt(a,10),l=[i,s].sort();if(isNaN(l[0])){if(o>a)return 1;if(a>o)return-1;continue}if(isNaN(l[1]))return isNaN(i)?-1:1;if(i>s)return 1;if(s>i)return-1}return r.length-n.length}var iD={alphanumeric:xVt,alphanumericCaseSensitive:wVt,text:CVt,textCaseSensitive:SVt,datetime:PVt,basic:NVt},kVt={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Rf("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let r=t.getFilteredRowModel().flatRows.slice(10),n=!1;for(let o of r){let a=o?.getValue(e.id);if(Object.prototype.toString.call(a)==="[object Date]")return iD.datetime;if(typeof a=="string"&&(n=!0,a.split(Ane).length>1))return iD.alphanumeric}return n?iD.text:iD.basic},e.getAutoSortDir=()=>{let r=t.getFilteredRowModel().flatRows[0];return typeof r?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var r,n;if(!e)throw new Error;return tj(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(r=(n=t.options.sortingFns)==null?void 0:n[e.columnDef.sortingFn])!=null?r:iD[e.columnDef.sortingFn]},e.toggleSorting=(r,n)=>{let o=e.getNextSortingOrder(),a=typeof r<"u"&&r!==null;t.setSorting(i=>{let s=i?.find(p=>p.id===e.id),l=i?.findIndex(p=>p.id===e.id),c=[],u,d=a?r:o==="desc";if(i!=null&&i.length&&e.getCanMultiSort()&&n?s?u="toggle":u="add":i!=null&&i.length&&l!==i.length-1?u="replace":s?u="toggle":u="replace",u==="toggle"&&(a||o||(u="remove")),u==="add"){var f;c=[...i,{id:e.id,desc:d}],c.splice(0,c.length-((f=t.options.maxMultiSortColCount)!=null?f:Number.MAX_SAFE_INTEGER))}else u==="toggle"?c=i.map(p=>p.id===e.id?{...p,desc:d}:p):u==="remove"?c=i.filter(p=>p.id!==e.id):c=[{id:e.id,desc:d}];return c})},e.getFirstSortDir=()=>{var r,n;return((r=(n=e.columnDef.sortDescFirst)!=null?n:t.options.sortDescFirst)!=null?r:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=r=>{var n,o;let a=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==a&&((n=t.options.enableSortingRemoval)==null||n)&&(!(r&&(o=t.options.enableMultiRemove)!=null)||o)?!1:i==="desc"?"asc":"desc":a},e.getCanSort=()=>{var r,n;return((r=e.columnDef.enableSorting)!=null?r:!0)&&((n=t.options.enableSorting)!=null?n:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var r,n;return(r=(n=e.columnDef.enableMultiSort)!=null?n:t.options.enableMultiSort)!=null?r:!!e.accessorFn},e.getIsSorted=()=>{var r;let n=(r=t.getState().sorting)==null?void 0:r.find(o=>o.id===e.id);return n?n.desc?"desc":"asc":!1},e.getSortIndex=()=>{var r,n;return(r=(n=t.getState().sorting)==null?void 0:n.findIndex(o=>o.id===e.id))!=null?r:-1},e.clearSorting=()=>{t.setSorting(r=>r!=null&&r.length?r.filter(n=>n.id!==e.id):[])},e.getToggleSortingHandler=()=>{let r=e.getCanSort();return n=>{r&&(n.persist==null||n.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(n):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var r,n;e.setSorting(t?[]:(r=(n=e.initialState)==null?void 0:n.sorting)!=null?r:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},RVt=[KUt,pVt,lVt,cVt,YUt,XUt,mVt,hVt,kVt,iVt,gVt,vVt,yVt,bVt,dVt];function jje(e){var t,r;let n=[...RVt,...(t=e._features)!=null?t:[]],o={_features:n},a=o._features.reduce((f,p)=>Object.assign(f,p.getDefaultOptions==null?void 0:p.getDefaultOptions(o)),{}),i=f=>o.options.mergeOptions?o.options.mergeOptions(a,f):{...a,...f},l={...{},...(r=e.initialState)!=null?r:{}};o._features.forEach(f=>{var p;l=(p=f.getInitialState==null?void 0:f.getInitialState(l))!=null?p:l});let c=[],u=!1,d={_features:n,options:{...a,...e},initialState:l,_queue:f=>{c.push(f),u||(u=!0,Promise.resolve().then(()=>{for(;c.length;)c.shift()();u=!1}).catch(p=>setTimeout(()=>{throw p})))},reset:()=>{o.setState(o.initialState)},setOptions:f=>{let p=qb(f,o.options);o.options=i(p)},getState:()=>o.options.state,setState:f=>{o.options.onStateChange==null||o.options.onStateChange(f)},_getRowId:(f,p,m)=>{var h;return(h=o.options.getRowId==null?void 0:o.options.getRowId(f,p,m))!=null?h:`${m?[m.id,p].join("."):p}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(f,p)=>{let m=(p?o.getPrePaginationRowModel():o.getRowModel()).rowsById[f];if(!m&&(m=o.getCoreRowModel().rowsById[f],!m))throw new Error;return m},_getDefaultColumnDef:Tr(()=>[o.options.defaultColumn],f=>{var p;return f=(p=f)!=null?p:{},{header:m=>{let h=m.header.column.columnDef;return h.accessorKey?h.accessorKey:h.accessorFn?h.id:null},cell:m=>{var h,g;return(h=(g=m.renderValue())==null||g.toString==null?void 0:g.toString())!=null?h:null},...o._features.reduce((m,h)=>Object.assign(m,h.getDefaultColumnDef==null?void 0:h.getDefaultColumnDef()),{}),...f}},Ar(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>o.options.columns,getAllColumns:Tr(()=>[o._getColumnDefs()],f=>{let p=function(m,h,g){return g===void 0&&(g=0),m.map(v=>{let y=GUt(o,v,g,h),b=v;return y.columns=b.columns?p(b.columns,y,g+1):[],y})};return p(f)},Ar(e,"debugColumns","getAllColumns")),getAllFlatColumns:Tr(()=>[o.getAllColumns()],f=>f.flatMap(p=>p.getFlatColumns()),Ar(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:Tr(()=>[o.getAllFlatColumns()],f=>f.reduce((p,m)=>(p[m.id]=m,p),{}),Ar(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:Tr(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(f,p)=>{let m=f.flatMap(h=>h.getLeafColumns());return p(m)},Ar(e,"debugColumns","getAllLeafColumns")),getColumn:f=>o._getAllFlatColumnsById()[f]};Object.assign(o,d);for(let f=0;f<o._features.length;f++){let p=o._features[f];p==null||p.createTable==null||p.createTable(o)}return o}function Wje(){return e=>Tr(()=>[e.options.data],t=>{let r={rows:[],flatRows:[],rowsById:{}},n=function(o,a,i){a===void 0&&(a=0);let s=[];for(let c=0;c<o.length;c++){let u=Ine(e,e._getRowId(o[c],c,i),o[c],c,a,void 0,i?.id);if(r.flatRows.push(u),r.rowsById[u.id]=u,s.push(u),e.options.getSubRows){var l;u.originalSubRows=e.options.getSubRows(o[c],c),(l=u.originalSubRows)!=null&&l.length&&(u.subRows=n(u.originalSubRows,a+1,u))}}return s};return r.rows=n(t),r},Ar(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function MVt(e){let t=[],r=n=>{var o;t.push(n),(o=n.subRows)!=null&&o.length&&n.getIsExpanded()&&n.subRows.forEach(r)};return e.rows.forEach(r),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function EVt(e,t,r){return r.options.filterFromLeafRows?TVt(e,t,r):AVt(e,t,r)}function TVt(e,t,r){var n;let o=[],a={},i=(n=r.options.maxLeafRowFilterDepth)!=null?n:100,s=function(l,c){c===void 0&&(c=0);let u=[];for(let f=0;f<l.length;f++){var d;let p=l[f],m=Ine(r,p.id,p.original,p.index,p.depth,void 0,p.parentId);if(m.columnFilters=p.columnFilters,(d=p.subRows)!=null&&d.length&&c<i){if(m.subRows=s(p.subRows,c+1),p=m,t(p)&&!m.subRows.length){u.push(p),a[p.id]=p,o.push(p);continue}if(t(p)||m.subRows.length){u.push(p),a[p.id]=p,o.push(p);continue}}else p=m,t(p)&&(u.push(p),a[p.id]=p,o.push(p))}return u};return{rows:s(e),flatRows:o,rowsById:a}}function AVt(e,t,r){var n;let o=[],a={},i=(n=r.options.maxLeafRowFilterDepth)!=null?n:100,s=function(l,c){c===void 0&&(c=0);let u=[];for(let f=0;f<l.length;f++){let p=l[f];if(t(p)){var d;if((d=p.subRows)!=null&&d.length&&c<i){let h=Ine(r,p.id,p.original,p.index,p.depth,void 0,p.parentId);h.subRows=s(p.subRows,c+1),p=h}u.push(p),o.push(p),a[p.id]=p}}return u};return{rows:s(e),flatRows:o,rowsById:a}}function qje(){return e=>Tr(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,r,n)=>{if(!t.rows.length||!(r!=null&&r.length)&&!n){for(let f=0;f<t.flatRows.length;f++)t.flatRows[f].columnFilters={},t.flatRows[f].columnFiltersMeta={};return t}let o=[],a=[];(r??[]).forEach(f=>{var p;let m=e.getColumn(f.id);if(!m)return;let h=m.getFilterFn();h&&o.push({id:f.id,filterFn:h,resolvedValue:(p=h.resolveFilterValue==null?void 0:h.resolveFilterValue(f.value))!=null?p:f.value})});let i=(r??[]).map(f=>f.id),s=e.getGlobalFilterFn(),l=e.getAllLeafColumns().filter(f=>f.getCanGlobalFilter());n&&s&&l.length&&(i.push("__global__"),l.forEach(f=>{var p;a.push({id:f.id,filterFn:s,resolvedValue:(p=s.resolveFilterValue==null?void 0:s.resolveFilterValue(n))!=null?p:n})}));let c,u;for(let f=0;f<t.flatRows.length;f++){let p=t.flatRows[f];if(p.columnFilters={},o.length)for(let m=0;m<o.length;m++){c=o[m];let h=c.id;p.columnFilters[h]=c.filterFn(p,h,c.resolvedValue,g=>{p.columnFiltersMeta[h]=g})}if(a.length){for(let m=0;m<a.length;m++){u=a[m];let h=u.id;if(u.filterFn(p,h,u.resolvedValue,g=>{p.columnFiltersMeta[h]=g})){p.columnFilters.__global__=!0;break}}p.columnFilters.__global__!==!0&&(p.columnFilters.__global__=!1)}}let d=f=>{for(let p=0;p<i.length;p++)if(f.columnFilters[i[p]]===!1)return!1;return!0};return EVt(t.rows,d,e)},Ar(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function Gje(e){return t=>Tr(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(r,n)=>{if(!n.rows.length)return n;let{pageSize:o,pageIndex:a}=r,{rows:i,flatRows:s,rowsById:l}=n,c=o*a,u=c+o;i=i.slice(c,u);let d;t.options.paginateExpandedRows?d={rows:i,flatRows:s,rowsById:l}:d=MVt({rows:i,flatRows:s,rowsById:l}),d.flatRows=[];let f=p=>{d.flatRows.push(p),p.subRows.length&&p.subRows.forEach(f)};return d.rows.forEach(f),d},Ar(t.options,"debugTable","getPaginationRowModel"))}function Kje(){return e=>Tr(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,r)=>{if(!r.rows.length||!(t!=null&&t.length))return r;let n=e.getState().sorting,o=[],a=n.filter(l=>{var c;return(c=e.getColumn(l.id))==null?void 0:c.getCanSort()}),i={};a.forEach(l=>{let c=e.getColumn(l.id);c&&(i[l.id]={sortUndefined:c.columnDef.sortUndefined,invertSorting:c.columnDef.invertSorting,sortingFn:c.getSortingFn()})});let s=l=>{let c=l.map(u=>({...u}));return c.sort((u,d)=>{for(let p=0;p<a.length;p+=1){var f;let m=a[p],h=i[m.id],g=h.sortUndefined,v=(f=m?.desc)!=null?f:!1,y=0;if(g){let b=u.getValue(m.id),w=d.getValue(m.id),x=b===void 0,C=w===void 0;if(x||C){if(g==="first")return x?-1:1;if(g==="last")return x?1:-1;y=x&&C?0:x?g:-g}}if(y===0&&(y=h.sortingFn(u,d,m.id)),y!==0)return v&&(y*=-1),h.invertSorting&&(y*=-1),y}return u.index-d.index}),c.forEach(u=>{var d;o.push(u),(d=u.subRows)!=null&&d.length&&(u.subRows=s(u.subRows))}),c};return{rows:s(r.rows),flatRows:o,rowsById:r.rowsById}},Ar(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function _ne(e,t){return e?IVt(e)?lD.createElement(e,t):e:null}function IVt(e){return LVt(e)||typeof e=="function"||DVt(e)}function LVt(e){return typeof e=="function"&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function DVt(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Yje(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=lD.useState(()=>({current:jje(t)})),[n,o]=lD.useState(()=>r.current.initialState);return r.current.setOptions(a=>({...a,...e,state:{...n,...e.state},onStateChange:i=>{o(i),e.onStateChange==null||e.onStateChange(i)}})),r.current}var Fne=_(ye(),1);var io=_(ue(),1);function Xje({table:e,trigger:t}){let[r,n]=Fne.default.useState(""),o=e.getAllColumns().filter(l=>l.getCanHide()&&l.id!=="select"&&l.id!=="actions"&&l.id!=="expander"),a=Fne.default.useMemo(()=>r?o.filter(l=>{let c=l.columnDef.header;return(typeof c=="string"?c:l.id).toLowerCase().includes(r.toLowerCase())}):o,[o,r]),i=o.filter(l=>l.getIsVisible()).length,s=l=>{e.toggleAllColumnsVisible(l)};return(0,io.jsxs)(Cr,{children:[(0,io.jsx)(Sr,{asChild:!0,children:t||(0,io.jsxs)(xe,{variant:"outline",size:"sm",className:"gap-2",children:[(0,io.jsx)(m0,{className:"h-4 w-4"}),"Columns",i<o.length&&(0,io.jsxs)("span",{className:"ml-1 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs",children:[i,"/",o.length]})]})}),(0,io.jsxs)(xr,{align:"end",className:"w-56",children:[(0,io.jsx)(Eh,{children:"Toggle Columns"}),o.length>5&&(0,io.jsxs)(io.Fragment,{children:[(0,io.jsx)("div",{className:"px-2 py-1.5",children:(0,io.jsxs)("div",{className:"relative",children:[(0,io.jsx)($n,{className:"absolute left-2 top-2.5 h-3 w-3 text-muted-foreground"}),(0,io.jsx)(Zt,{placeholder:"Search columns...",value:r,onChange:l=>n(l.target.value),className:"h-8 pl-7 text-xs"})]})}),(0,io.jsx)(qr,{})]}),(0,io.jsxs)("div",{className:"flex items-center justify-between px-2 py-1.5",children:[(0,io.jsx)(xe,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>s(!0),children:"Show all"}),(0,io.jsx)(xe,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>s(!1),children:"Hide all"})]}),(0,io.jsx)(qr,{}),(0,io.jsx)("div",{className:"max-h-64 overflow-y-auto",children:a.length===0?(0,io.jsx)("div",{className:"px-2 py-4 text-center text-xs text-muted-foreground",children:"No columns found"}):a.map(l=>{let c=l.getIsVisible(),u=l.columnDef.header,d=typeof u=="string"?u:l.id;return(0,io.jsx)(Ye,{className:E("cursor-pointer",!c&&"text-muted-foreground"),onSelect:f=>{f.preventDefault(),l.toggleVisibility()},children:(0,io.jsxs)("div",{className:"flex items-center gap-2 flex-1",children:[(0,io.jsx)("div",{className:E("flex h-4 w-4 items-center justify-center rounded-sm border",c?"border-primary bg-primary text-primary-foreground":"border-muted-foreground"),children:c&&(0,io.jsx)(Qr,{className:"h-3 w-3"})}),(0,io.jsx)("span",{className:"truncate",children:d})]})},l.id)})}),o.length>0&&(0,io.jsxs)(io.Fragment,{children:[(0,io.jsx)(qr,{}),(0,io.jsxs)("div",{className:"px-2 py-1.5 text-xs text-muted-foreground text-center",children:[i," of ",o.length," columns visible"]})]})]})]})}var Bne=_(ye(),1);var Ln=_(ue(),1);function Jje({selectedRows:e,actions:t,onClearSelection:r,className:n}){let[o,a]=Bne.default.useState(!1),[i,s]=Bne.default.useState(null),l=e.length,c=async f=>{if(f.confirmMessage){s(f);return}await u(f)},u=async f=>{a(!0);try{await f.action(e),r&&r()}catch(p){console.error("Bulk action failed:",p)}finally{a(!1),s(null)}},d=async()=>{i&&await u(i)};return l===0?null:(0,Ln.jsxs)(Ln.Fragment,{children:[(0,Ln.jsxs)("div",{className:E("flex items-center gap-2",n),children:[(0,Ln.jsxs)(ht,{variant:"secondary",className:"gap-1",children:[(0,Ln.jsx)("span",{className:"font-semibold",children:l}),(0,Ln.jsx)("span",{children:" Selected"})]}),(0,Ln.jsxs)(Cr,{children:[(0,Ln.jsx)(Sr,{asChild:!0,children:(0,Ln.jsx)(xe,{variant:"outline",size:"sm",disabled:o,className:"gap-2",children:o?(0,Ln.jsxs)(Ln.Fragment,{children:[(0,Ln.jsx)(Nr,{className:"h-4 w-4 animate-spin"}),"Processing..."]}):(0,Ln.jsxs)(Ln.Fragment,{children:[(0,Ln.jsx)(ei,{className:"h-4 w-4"}),"Bulk Actions"]})})}),(0,Ln.jsxs)(xr,{align:"end",className:"w-48",children:[t.map((f,p)=>{let m=typeof f.disabled=="function"?f.disabled(e):f.disabled;return(0,Ln.jsxs)(Ye,{disabled:m||o,onSelect:()=>c(f),className:E("cursor-pointer",f.variant==="destructive"&&"text-destructive focus:text-destructive"),children:[f.icon&&(0,Ln.jsx)("span",{className:"mr-2 h-4 w-4",children:f.icon}),f.label]},p)}),r&&(0,Ln.jsxs)(Ln.Fragment,{children:[(0,Ln.jsx)(qr,{}),(0,Ln.jsx)(Ye,{onSelect:r,className:"cursor-pointer text-muted-foreground",children:"Clear selection"})]})]})]})]}),(0,Ln.jsx)(oA,{open:!!i,onOpenChange:f=>!f&&s(null),children:(0,Ln.jsxs)(CP,{children:[(0,Ln.jsxs)(SP,{children:[(0,Ln.jsxs)(NP,{className:"flex items-center gap-2",children:[i?.variant==="destructive"&&(0,Ln.jsx)(ua,{className:"h-5 w-5 text-destructive"}),i?.confirmTitle||"Confirm Action"]}),(0,Ln.jsx)(kP,{children:i?.confirmMessage||`This action will affect ${l} selected item${l>1?"s":""}. This action cannot be undone.`})]}),(0,Ln.jsxs)(PP,{children:[(0,Ln.jsx)(MP,{disabled:o,children:"Cancel"}),(0,Ln.jsx)(RP,{onClick:d,disabled:o,className:E(i?.variant==="destructive"&&"bg-destructive text-destructive-foreground hover:bg-destructive/90"),children:o?(0,Ln.jsxs)(Ln.Fragment,{children:[(0,Ln.jsx)(Nr,{className:"mr-2 h-4 w-4 animate-spin"}),"Processing..."]}):"Confirm"})]})]})})]})}function OVt(e,t,r=!0){if(e.length===0)return"";let n=t||Object.keys(e[0]),o=[];if(r){let a=n.map(i=>{let s=String(i);return s.includes(",")||s.includes('"')||s.includes(`
|
|
514
514
|
`)?`"${s.replace(/"/g,'""')}"`:s});o.push(a.join(","))}return e.forEach(a=>{let i=n.map(s=>{let l=a[s];if(l==null)return"";if(l instanceof Date)return l.toISOString();if(typeof l=="object")return JSON.stringify(l);let c=String(l);return c.includes(",")||c.includes('"')||c.includes(`
|
|
515
515
|
`)?`"${c.replace(/"/g,'""')}"`:c});o.push(i.join(","))}),o.join(`
|
|
516
|
-
`)}function _Vt(e,t){if(!t||t.length===0)return JSON.stringify(e,null,2);let r=e.map(n=>{let o={};return t.forEach(a=>{a in n&&(o[a]=n[a])}),o});return JSON.stringify(r,null,2)}function FVt(e,t,r){let n=new Blob([e],{type:r}),o=URL.createObjectURL(n),a=document.createElement("a");a.href=o,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(o)}async function Qje(e,t){let{format:r,filename:n="data-export",columns:o,includeHeaders:a=!0}=t,i,s,l;switch(r){case"csv":i=OVt(e,o,a),s="text/csv;charset=utf-8;",l="csv";break;case"json":i=_Vt(e,o),s="application/json;charset=utf-8;",l="json";break;case"xlsx":throw new Error("XLSX export requires additional dependencies. Use CSV format instead.");default:throw new Error(`Unsupported export format: ${r}`)}let c=`${n}-${new Date().toISOString().split("T")[0]}.${l}`;FVt(i,c,s)}function Zje(e,t){return e.filter(r=>{let n=r.id||r.accessorKey;return n&&t[n]!==!1}).map(r=>r.id||r.accessorKey).filter(Boolean)}var c1=_(ye(),1),e6e=_(dh(),1);var $t=_(ue(),1),BVt={equals:"Equals",notEquals:"Not equals",contains:"Contains",notContains:"Not contains",startsWith:"Starts with",endsWith:"Ends with",greaterThan:"Greater than",lessThan:"Less than",greaterThanOrEqual:"Greater than or equal",lessThanOrEqual:"Less than or equal",between:"Between",in:"In",notIn:"Not in",isNull:"Is empty",isNotNull:"Is not empty"};function zVt(e){switch(e){case"number":return["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","between","isNull","isNotNull"];case"date":return["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","between","isNull","isNotNull"];case"boolean":return["equals","notEquals","isNull","isNotNull"];case"select":return["equals","notEquals","in","notIn","isNull","isNotNull"];default:return["equals","notEquals","contains","notContains","startsWith","endsWith","isNull","isNotNull"]}}function t6e({table:e,open:t,onOpenChange:r,position:n="right",width:o="400px",filters:a,onFiltersChange:i,customFilters:s,matchAll:l,onMatchAllChange:c}){let[u,d]=(0,c1.useState)([]),[f,p]=(0,c1.useState)(!0),m=a||u,h=i||d,g=l!==void 0?l:f,v=c||p,y=(0,c1.useMemo)(()=>e.getAllColumns().filter(L=>L.id==="select"||L.id==="actions"||L.id==="expander"?!1:L.getCanFilter()),[e]),b=()=>{let L=y[0];if(!L)return;let $={column:L.id,operator:"contains",value:""};h([...m,$])},w=(L,$)=>{let I=[...m];I[L]={...I[L],...$},h(I)},x=L=>{h(m.filter(($,I)=>I!==L))},C=()=>{h([]),e.resetColumnFilters()},P=()=>{e.resetColumnFilters(),[...new Set(m.map($=>$.column))].forEach($=>{let I=e.getColumn($);I&&I.setFilterValue({custom:!0,filters:m,matchAll:g})}),m.length===0&&e.resetColumnFilters(),r(!1)};if(typeof document>"u")return null;let R=(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(kt,{children:t&&(0,$t.jsx)(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/20",style:{zIndex:9998},onClick:()=>r(!1)})}),(0,$t.jsx)(kt,{children:t&&(0,$t.jsx)(me.div,{initial:{x:n==="right"?"100%":"-100%"},animate:{x:0},exit:{x:n==="right"?"100%":"-100%"},transition:{type:"spring",damping:30,stiffness:300},className:E("fixed top-0 bottom-0 bg-background border-l shadow-xl",n==="right"?"right-0":"left-0"),style:{width:o,zIndex:9999},children:(0,$t.jsxs)("div",{className:"flex flex-col h-full",children:[(0,$t.jsxs)("div",{className:"flex items-center justify-between p-4 border-b",children:[(0,$t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,$t.jsx)(Oi,{className:"h-5 w-5"}),(0,$t.jsx)("h2",{className:"text-lg font-semibold",children:"Filters"}),m.length>0&&(0,$t.jsxs)("span",{className:"text-sm text-muted-foreground",children:["(",m.length," active)"]})]}),(0,$t.jsx)(xe,{variant:"ghost",size:"icon",onClick:()=>r(!1),children:(0,$t.jsx)(fr,{className:"h-4 w-4"})})]}),(0,$t.jsxs)("div",{className:"flex-1 overflow-y-auto p-4",children:[(0,$t.jsxs)("div",{className:"mb-6",children:[(0,$t.jsx)(Lt,{className:"text-sm font-medium mb-2 block",children:"Match conditions"}),(0,$t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,$t.jsx)(xe,{variant:g?"primary":"outline",size:"sm",onClick:()=>v(!0),className:"flex-1",children:"Match all"}),(0,$t.jsx)(xe,{variant:g?"outline":"primary",size:"sm",onClick:()=>v(!1),className:"flex-1",children:"Match any"})]})]}),(0,$t.jsx)(Ps,{className:"mb-6"}),s&&(0,$t.jsxs)($t.Fragment,{children:[s,(0,$t.jsx)(Ps,{className:"my-6"})]}),(0,$t.jsx)("div",{className:"space-y-4",children:m.map((L,$)=>(0,$t.jsx)(UVt,{filter:L,columns:y,onUpdate:I=>w($,I),onRemove:()=>x($)},$))}),(0,$t.jsxs)(xe,{variant:"outline",size:"sm",onClick:b,className:"w-full mt-4",children:[(0,$t.jsx)(xi,{className:"h-4 w-4 mr-2"}),"Add filter"]})]}),(0,$t.jsx)("div",{className:"p-4 border-t space-y-2",children:(0,$t.jsxs)("div",{className:"flex gap-2",children:[(0,$t.jsxs)(xe,{variant:"outline",onClick:C,disabled:m.length===0,className:"flex-1",children:[(0,$t.jsx)(Ji,{className:"h-4 w-4 mr-2"}),"Clear all"]}),(0,$t.jsx)(xe,{onClick:P,className:"flex-1",children:"Apply filters"})]})})]})})})]});return(0,e6e.createPortal)(R,document.body)}function UVt({filter:e,columns:t,onUpdate:r,onRemove:n}){let a=t.find(p=>p.id===e.column)?.columnDef,i=a?.meta?.filterType||"string",s=a?.meta?.filterOptions,l=a?.meta?.filterValueAccessor,c=zVt(i),u=e.operator!=="isNull"&&e.operator!=="isNotNull",d=e.operator==="in"||e.operator==="notIn",f=c1.default.useMemo(()=>i!=="select"&&!s?null:s||null,[i,s]);return(0,$t.jsxs)("div",{className:"space-y-2 p-3 border rounded-lg bg-muted/30",children:[(0,$t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,$t.jsxs)(Oo,{value:e.column,onValueChange:p=>r({column:p}),children:[(0,$t.jsx)(_o,{className:"flex-1",children:(0,$t.jsx)(Yo,{})}),(0,$t.jsx)(Fo,{style:{zIndex:1e4},children:t.map(p=>{let m=p.columnDef.header,h=typeof m=="function"?p.id:m||p.id;return(0,$t.jsx)(Ut,{value:p.id,children:h},p.id)})})]}),(0,$t.jsx)(xe,{variant:"ghost",size:"icon",onClick:n,className:"h-8 w-8",children:(0,$t.jsx)(fr,{className:"h-4 w-4"})})]}),(0,$t.jsxs)(Oo,{value:e.operator,onValueChange:p=>r({operator:p}),children:[(0,$t.jsx)(_o,{children:(0,$t.jsx)(Yo,{})}),(0,$t.jsx)(Fo,{style:{zIndex:1e4},children:c.map(p=>(0,$t.jsx)(Ut,{value:p,children:BVt[p]},p))})]}),u&&(0,$t.jsx)("div",{children:i==="boolean"?(0,$t.jsxs)(Oo,{value:String(e.value),onValueChange:p=>r({value:p==="true"}),children:[(0,$t.jsx)(_o,{children:(0,$t.jsx)(Yo,{})}),(0,$t.jsxs)(Fo,{style:{zIndex:1e4},children:[(0,$t.jsx)(Ut,{value:"true",children:"True"}),(0,$t.jsx)(Ut,{value:"false",children:"False"})]})]}):(i==="select"||f)&&!d?(0,$t.jsxs)(Oo,{value:e.value||"",onValueChange:p=>r({value:p}),children:[(0,$t.jsx)(_o,{children:(0,$t.jsx)(Yo,{placeholder:"Select value..."})}),(0,$t.jsx)(Fo,{style:{zIndex:1e4},children:f?.map(p=>(0,$t.jsx)(Ut,{value:p,children:p},p))})]}):(i==="select"||f)&&d?(0,$t.jsxs)("div",{className:"space-y-2",children:[(0,$t.jsx)("div",{className:"text-xs text-muted-foreground",children:"Select multiple values:"}),(0,$t.jsx)("div",{className:"space-y-1 max-h-32 overflow-y-auto border rounded-md p-2",children:f?.map(p=>{let m=Array.isArray(e.value)?e.value:[],h=m.includes(p);return(0,$t.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer hover:bg-muted/50 p-1 rounded",children:[(0,$t.jsx)("input",{type:"checkbox",checked:h,onChange:g=>{let v=g.target.checked?[...m,p]:m.filter(y=>y!==p);r({value:v})},className:"rounded border-gray-300"}),(0,$t.jsx)("span",{className:"text-sm",children:p})]},p)})})]}):i==="number"?(0,$t.jsx)(Zt,{type:"number",value:e.value||"",onChange:p=>r({value:p.target.value}),placeholder:"Enter value..."}):d?(0,$t.jsx)(Zt,{value:Array.isArray(e.value)?e.value.join(", "):e.value||"",onChange:p=>r({value:p.target.value}),placeholder:"Enter values separated by comma..."}):(0,$t.jsx)(Zt,{value:e.value||"",onChange:p=>r({value:p.target.value}),placeholder:"Enter value..."})})]})}var Pg=_(ye(),1);var Zo=_(ue(),1);function r6e({table:e,filter:t,data:r}){let[n,o]=(0,Pg.useState)(!1),[a,i]=(0,Pg.useState)(""),s=Pg.default.useMemo(()=>{let v=e.getColumn(t.column);return v||(v=e.getAllColumns().find(b=>b.id===t.column||b.columnDef.accessorKey===t.column)),v},[e,t.column]),l=(0,Pg.useMemo)(()=>{if(t.options&&t.options!=="auto")return t.options;let v=new Set;return r.forEach(y=>{let b=y[t.column];if(b===void 0&&t.column.includes(".")){let w=t.column.split(".");b=y;for(let x of w)b=b?.[x]}b!=null&&b!==""&&v.add(String(b))}),Array.from(v).sort()},[r,t.column,t.options]),c=s?.getFilterValue(),u=(0,Pg.useMemo)(()=>c?Array.isArray(c)?new Set(c):new Set([String(c)]):new Set,[c]),d=(0,Pg.useMemo)(()=>{if(!t.showCounts)return{};let v={};return r.forEach(y=>{let b=y[t.column];if(b===void 0&&t.column.includes(".")){let w=t.column.split(".");b=y;for(let x of w)b=b?.[x]}if(b!=null&&b!==""){let w=String(b);v[w]=(v[w]||0)+1}}),v},[r,t.column,t.showCounts]),f=v=>{if(s)if(t.multi){let y=new Set(u);y.has(v)?y.delete(v):y.add(v),y.size===0?s.setFilterValue(void 0):s.setFilterValue(Array.from(y))}else u.has(v)?s.setFilterValue(void 0):s.setFilterValue(v)},p=()=>{s?.setFilterValue(void 0),i("")},m=t.label||t.column,h=(0,Pg.useMemo)(()=>a?l.filter(v=>v.toLowerCase().includes(a.toLowerCase())):l,[l,a]),g=!s||l.length===0;return(0,Zo.jsxs)(Fi,{open:n,onOpenChange:o,children:[(0,Zo.jsx)(Bi,{asChild:!0,children:(0,Zo.jsxs)(xe,{variant:"outline",size:"sm",disabled:g,className:E("h-8 border-dashed",u.size>0&&"border-solid"),children:[m,u.size>0&&(0,Zo.jsxs)(Zo.Fragment,{children:[(0,Zo.jsx)("span",{className:"mx-2 h-4 w-px bg-border"}),(0,Zo.jsx)(ht,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:u.size})]})]})}),(0,Zo.jsx)(Ri,{className:"w-[250px] p-0",align:"start",children:(0,Zo.jsxs)("div",{className:"p-2",children:[l.length>0&&(0,Zo.jsx)("div",{className:"pb-2",children:(0,Zo.jsxs)("div",{className:"relative",children:[(0,Zo.jsx)($n,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),(0,Zo.jsx)(Zt,{placeholder:`Search ${m.toLowerCase()}...`,value:a,onChange:v=>i(v.target.value),className:"h-8 w-full pl-8"})]})}),l.length===0?(0,Zo.jsx)("div",{className:"text-center text-sm text-muted-foreground py-4",children:"No options available"}):h.length===0?(0,Zo.jsx)("div",{className:"text-center text-sm text-muted-foreground py-4",children:"No results found"}):(0,Zo.jsx)("div",{className:"space-y-1 max-h-[300px] overflow-y-auto",children:h.map(v=>{let y=u.has(v);return(0,Zo.jsxs)("button",{onClick:()=>f(v),className:E("flex w-full items-center justify-between rounded px-2 py-1.5 text-sm hover:bg-accent",y&&"bg-accent"),children:[(0,Zo.jsxs)("div",{className:"flex items-center",children:[(0,Zo.jsx)("div",{className:E("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",y?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:(0,Zo.jsx)(Qr,{className:"h-4 w-4"})}),(0,Zo.jsx)("span",{children:v})]}),t.showCounts&&d[v]!==void 0&&(0,Zo.jsx)("span",{className:"text-xs text-muted-foreground",children:d[v]})]},v)})}),u.size>0&&(0,Zo.jsx)("div",{className:"border-t mt-2 pt-2",children:(0,Zo.jsx)(xe,{variant:"ghost",size:"sm",className:"w-full justify-center",onClick:p,children:"Clear filter"})})]})})]})}var cD=_(ye(),1);var Rn=_(ue(),1);function n6e({table:e,column:t,title:r,options:n="auto",data:o}){let a=e.getColumn(t),[i,s]=(0,cD.useState)("");if(!a)return null;let l=a.columnDef,c=l?.meta?.filterValueAccessor,u=l?.meta?.filterOptions,d=x=>c?c(x):x[t],{availableOptions:f,optionCounts:p}=(0,cD.useMemo)(()=>{let x={},C=new Set;o.forEach(R=>{let L=d(R);if(L!=null&&L!==""){let $=String(L);C.add($),x[$]=(x[$]||0)+1}});let P=[];return n!=="auto"?P=n:u?P=u.map(R=>({value:R,label:R})):P=Array.from(C).sort().slice(0,50).map(R=>({value:R,label:R})),{availableOptions:P,optionCounts:x}},[o,n,u]),m=a.getFilterValue(),h=new Set(m||[]),g=(0,cD.useMemo)(()=>i?f.filter(x=>(x.label||x.value).toLowerCase().includes(i.toLowerCase())):f,[f,i]),v=r||a.columnDef.header||t,y=x=>{let C=new Set(h);C.has(x)?C.delete(x):C.add(x),C.size===0?a.setFilterValue(void 0):a.setFilterValue(Array.from(C))},b=()=>{a.setFilterValue(void 0),s("")},w=()=>{let x=g.map(C=>C.value);a.setFilterValue(x)};return(0,Rn.jsxs)(Fi,{children:[(0,Rn.jsx)(Bi,{asChild:!0,children:(0,Rn.jsxs)(xe,{variant:"outline",size:"sm",className:E("h-8 border-dashed",h.size>0&&"border-solid"),children:[(0,Rn.jsx)(p0,{className:"mr-2 h-4 w-4"}),v,h.size>0&&(0,Rn.jsxs)(Rn.Fragment,{children:[(0,Rn.jsx)(Ps,{orientation:"vertical",className:"mx-2 h-4"}),(0,Rn.jsx)(ht,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:h.size}),(0,Rn.jsx)("div",{className:"hidden space-x-1 lg:flex",children:h.size>2?(0,Rn.jsxs)(ht,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[h.size," selected"]}):Array.from(h).slice(0,2).map(x=>{let C=f.find(P=>P.value===x);return(0,Rn.jsx)(ht,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:C?.label||x},x)})})]})]})}),(0,Rn.jsxs)(Ri,{className:"w-[300px] p-0",align:"start",children:[(0,Rn.jsx)("div",{className:"p-3",children:(0,Rn.jsxs)("div",{className:"relative",children:[(0,Rn.jsx)($n,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),(0,Rn.jsx)(Zt,{placeholder:`Search ${v.toLowerCase()}...`,value:i,onChange:x=>s(x.target.value),className:"h-8 pl-8"})]})}),(0,Rn.jsx)(Ps,{}),(0,Rn.jsx)("div",{className:"max-h-[300px] overflow-y-auto",children:g.length===0?(0,Rn.jsx)("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"No results found"}):(0,Rn.jsx)("div",{className:"p-2",children:g.map(x=>{let C=h.has(x.value),P=p[x.value]||0;return(0,Rn.jsxs)(xe,{variant:"ghost",size:"sm",className:"w-full justify-start font-normal",onClick:()=>y(x.value),children:[(0,Rn.jsx)("div",{className:E("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",C?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:(0,Rn.jsx)(Qr,{className:E("h-4 w-4")})}),x.icon&&(0,Rn.jsx)("span",{className:"mr-2",children:x.icon}),(0,Rn.jsx)("span",{className:"flex-1 text-left",children:x.label||x.value}),P>0&&(0,Rn.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:P})]},x.value)})})}),(h.size>0||g.length>0)&&(0,Rn.jsxs)(Rn.Fragment,{children:[(0,Rn.jsx)(Ps,{}),(0,Rn.jsxs)("div",{className:"flex items-center justify-between p-2",children:[h.size>0?(0,Rn.jsxs)(xe,{variant:"ghost",size:"sm",onClick:b,className:"h-8 px-2 lg:px-3",children:["Clear",(0,Rn.jsx)(fr,{className:"ml-2 h-4 w-4"})]}):(0,Rn.jsxs)(xe,{variant:"ghost",size:"sm",onClick:w,className:"h-8 px-2 lg:px-3",children:["Select all",(0,Rn.jsx)(Qr,{className:"ml-2 h-4 w-4"})]}),(0,Rn.jsxs)("span",{className:"text-xs text-muted-foreground",children:[h.size," of ",f.length," selected"]})]})]})]})]})}var mt=_(ue(),1);function zne({columns:e,data:t,searchable:r=!0,filterable:n=!0,exportable:o=!0,selectable:a=!1,pagination:i=!0,pageSize:s=10,pageSizeOptions:l=[5,10,20,50,100],className:c,onRowSelect:u,onExport:d,enableExpandable:f=!1,renderSubComponent:p,expandedRows:m,onRowExpandChange:h,bulkActions:g=[],quickFilters:v=[],facetedFilters:y=[],features:b={},theme:w={},texts:x={},enableSorting:C=!0,enableFiltering:P=!0,enablePagination:R=!0,enableColumnVisibility:L=!0,enableRowSelection:$,filterPlaceholder:I="Search all columns...",defaultPageSize:A,manualPagination:j=!1,pageCount:V,onPaginationChange:S,onSortingChange:N,onColumnFiltersChange:k,state:T}){let B=qi.default.useMemo(()=>e.map(De=>{let{enableHiding:ct,...We}=De;return{...We,enableHiding:!0,filterFn:"custom"}}),[e]),{hasProAccess:D,isLoading:z}=Ee();if(!z&&!D)return(0,mt.jsx)(Ve,{componentName:"Data Table",className:E("w-full",c)});let[M,G]=qi.default.useState([]),[q,H]=qi.default.useState([]),[F,W]=qi.default.useState({}),[U,O]=qi.default.useState({}),[Y,re]=qi.default.useState(""),[Q,ae]=qi.default.useState({pageIndex:0,pageSize:A||s||10}),[te,se]=qi.default.useState(!1),[oe,le]=qi.default.useState(new Set),[J,ee]=qi.default.useState(!1),X=m||oe,K=h?De=>h(De):le,ne=A||s,ce=qi.default.useMemo(()=>t,[t]),Z=De=>()=>{let We=(T?.sorting??M).find(it=>it.id===De),bt=[];We?We.desc?bt=[]:bt=[{id:De,desc:!0}]:bt=[{id:De,desc:!1}];let It=N!==void 0?N:G;typeof It=="function"&&It(bt)},we=qi.default.useRef(null),de=qi.default.useCallback(De=>{let ct=typeof De=="function"?De(U):De;if(O(ct),u&&we.current){let We=Object.keys(ct).filter(It=>ct[It]),bt=we.current.getRowModel().rows.filter(It=>We.includes(It.id)).map(It=>It.original);u(bt)}},[U,u]),ge=qi.default.useMemo(()=>{let De=B.map(We=>!We.id&&We.accessorKey?{...We,id:We.accessorKey}:We),ct=De.some(We=>{if(We.id==="select")return!0;let bt=We.header?.toString()||"",It=We.cell?.toString()||"";return bt.includes("Checkbox")||It.includes("Checkbox")});return(a||$)&&!ct&&(De=[{id:"select",header:({table:bt})=>{let It=bt.getIsAllPageRowsSelected(),it=bt.getIsSomePageRowsSelected();return(0,mt.jsx)("div",{className:"flex items-center justify-center",children:(0,mt.jsx)(Wl,{checked:It?!0:it?"indeterminate":!1,onCheckedChange:Ft=>{bt.toggleAllPageRowsSelected(!!Ft)},"aria-label":"Select all",className:"h-4 w-4"})})},cell:({row:bt})=>{let It=bt.getIsSelected();return(0,mt.jsx)("div",{className:"flex items-center justify-center",children:(0,mt.jsx)(Wl,{checked:It,onCheckedChange:it=>bt.toggleSelected(!!it),disabled:!bt.getCanSelect(),"aria-label":"Select row",className:"h-4 w-4"},`select-${bt.id}-${It}`)})},enableSorting:!1,enableHiding:!1,size:40,maxSize:40},...De]),De},[B,a,$]),pe=Yje({data:ce,columns:ge,onSortingChange:N!==void 0?N:G,onColumnFiltersChange:k!==void 0?k:H,onPaginationChange:S!==void 0?S:ae,getCoreRowModel:Wje(),getPaginationRowModel:Gje(),getSortedRowModel:Kje(),getFilteredRowModel:qje(),enableSortingRemoval:!0,enableMultiSort:!1,sortDescFirst:!1,onColumnVisibilityChange:W,onRowSelectionChange:de,onGlobalFilterChange:re,globalFilterFn:"includesString",enableRowSelection:a||$||!1,filterFns:{custom:(De,ct,We)=>{if(Array.isArray(We)){let Ue=pe.getColumn(ct)?.columnDef?.meta?.filterValueAccessor,Be=Ue?Ue(De.original):De.getValue(ct);return We.includes(String(Be))}if(typeof We=="string"||typeof We=="number"||typeof We=="boolean"){let Ue=pe.getColumn(ct)?.columnDef?.meta?.filterValueAccessor,Be=Ue?Ue(De.original):De.getValue(ct);return String(Be)===String(We)}if(!We?.custom||!We?.filters)return!0;let bt=We.filters,It=We.matchAll!==void 0?We.matchAll:!0,it=bt.map(Ft=>{let Be=pe.getColumn(Ft.column)?.columnDef?.meta?.filterValueAccessor,He=Be?Be(De.original):De.getValue(Ft.column),st=Ft.value;switch(Ft.operator){case"equals":return He===st;case"notEquals":return He!==st;case"contains":return String(He).toLowerCase().includes(String(st).toLowerCase());case"notContains":return!String(He).toLowerCase().includes(String(st).toLowerCase());case"startsWith":return String(He).toLowerCase().startsWith(String(st).toLowerCase());case"endsWith":return String(He).toLowerCase().endsWith(String(st).toLowerCase());case"greaterThan":return Number(He)>Number(st);case"lessThan":return Number(He)<Number(st);case"greaterThanOrEqual":return Number(He)>=Number(st);case"lessThanOrEqual":return Number(He)<=Number(st);case"in":return Array.isArray(st)?st.includes(He):String(st).split(",").map(xt=>xt.trim()).includes(String(He));case"notIn":return Array.isArray(st)?!st.includes(He):!String(st).split(",").map(xt=>xt.trim()).includes(String(He));case"isNull":return He==null||He==="";case"isNotNull":return He!=null&&He!=="";default:return!0}});return It?it.every(Ft=>Ft):it.some(Ft=>Ft)}},manualPagination:j,pageCount:V,state:{sorting:T?.sorting??M,columnFilters:T?.columnFilters??q,columnVisibility:T?.columnVisibility??F,rowSelection:T?.rowSelection??U,globalFilter:T?.globalFilter??Y,pagination:T?.pagination??Q},initialState:{pagination:{pageSize:ne}},autoResetAll:!1,autoResetPageIndex:!1,autoResetExpanded:!1,getRowId:(De,ct)=>{let We=De;return We.id!==void 0&&We.id!==null&&We.id!==""?String(We.id):We.orderId!==void 0&&We.orderId!==null?String(We.orderId):We.orderNumber!==void 0&&We.orderNumber!==null?String(We.orderNumber):We.email?`email-${We.email}`:We.name&&We.email?`${We.name}-${We.email}`:We.name?`name-${We.name}-${ct}`:String(ct)}});we.current=pe;let ve=pe.getState(),Pe=pe.getRowModel(),ze=qi.default.useRef(Pe.rows),Oe=qi.default.useMemo(()=>{let De=ze.current!==Pe.rows;return De&&(ze.current=Pe.rows),De},[Pe.rows]),Me=ze.current,fe={sorting:b.sorting!==!1,filtering:b.filtering!==!1||n,pagination:b.pagination!==!1||i,search:b.search!==!1||r,columnVisibility:b.columnVisibility!==!1,rowSelection:b.rowSelection!==!1||a,export:b.export!==!1||o},be=async De=>{let ct=pe.getFilteredSelectedRowModel().rows,We=ct.length>0?ct.map(it=>it.original):pe.getFilteredRowModel().rows.map(it=>it.original);if(typeof o=="object"&&o.onExport){o.onExport(We,De);return}if(d){d(We);return}let bt=typeof o=="object"&&o.filename?o.filename:"data-export",It=Zje(B,F);await Qje(We,{format:De,filename:bt,columns:It,includeHeaders:!0})},Ae=qi.default.useMemo(()=>o?o===!0?["csv","json"]:typeof o=="object"&&o.formats?o.formats:["csv","json"]:[],[o]),Te=()=>{pe.resetRowSelection()};return(0,mt.jsxs)("div",{className:E("moonui-pro-datatable-container flex flex-col gap-4",c),children:[a&&pe.getFilteredSelectedRowModel().rows.length>0&&(0,mt.jsxs)("div",{className:"flex items-center justify-between rounded-md bg-muted/50 px-4 py-2",children:[(0,mt.jsxs)("span",{className:"text-sm text-muted-foreground",children:[pe.getFilteredSelectedRowModel().rows.length," Selected"]}),g.length>0&&(0,mt.jsx)(Jje,{selectedRows:pe.getFilteredSelectedRowModel().rows.map(De=>De.original),actions:g,onClearSelection:Te})]}),(0,mt.jsxs)("div",{className:"moonui-pro-datatable-toolbar flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,mt.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[r&&(0,mt.jsxs)("div",{className:"relative",children:[(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)($n,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"})}),(0,mt.jsx)(Zt,{placeholder:I,value:Y,onChange:De=>re(De.target.value),className:"pl-8 w-full sm:w-64"})]}),v.length>0&&(0,mt.jsx)("div",{className:"flex items-center gap-2",children:v.map((De,ct)=>(0,mt.jsx)(r6e,{table:pe,filter:De,data:t},`quick-${De.column}-${ct}`))}),y.length>0&&(0,mt.jsx)("div",{className:"flex items-center gap-2",children:y.map((De,ct)=>{let We=typeof De=="string"?De:De.column,bt=typeof De=="string"?void 0:De.label;return(0,mt.jsx)(n6e,{table:pe,column:We,title:bt,data:t},`faceted-${We}-${ct}`)})}),n&&(0,mt.jsxs)(xe,{variant:"outline",size:"sm",onClick:()=>ee(!0),children:[(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(Oi,{className:"mr-2 h-4 w-4"})}),"Filters",q.length>0&&(0,mt.jsx)("span",{className:"ml-2 rounded-full bg-primary px-2 py-0.5 text-xs text-primary-foreground",children:q.length})]})]}),(0,mt.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[o&&Ae.length>0&&(0,mt.jsxs)(Cr,{children:[(0,mt.jsx)(Sr,{asChild:!0,children:(0,mt.jsxs)(xe,{variant:"outline",size:"sm",children:[(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(vn,{className:"mr-2 h-4 w-4"})}),"Export"]})}),(0,mt.jsxs)(xr,{align:"end",children:[Ae.includes("csv")&&(0,mt.jsxs)(Ye,{onClick:()=>be("csv"),children:[(0,mt.jsx)(iv,{className:"mr-2 h-4 w-4"}),"Export as CSV"]}),Ae.includes("json")&&(0,mt.jsxs)(Ye,{onClick:()=>be("json"),children:[(0,mt.jsx)(Bx,{className:"mr-2 h-4 w-4"}),"Export as JSON"]}),Ae.includes("xlsx")&&(0,mt.jsxs)(Ye,{onClick:()=>be("xlsx"),children:[(0,mt.jsx)(oT,{className:"mr-2 h-4 w-4"}),"Export as Excel"]})]})]}),(0,mt.jsx)(Xje,{table:pe})]})]}),(0,mt.jsx)("div",{className:"moonui-pro-datatable-wrapper rounded-md border overflow-hidden",style:{contain:"layout style"},children:(0,mt.jsx)("div",{style:{overflowX:"auto"},children:(0,mt.jsxs)("table",{className:"moonui-pro-datatable",style:{width:"100%",tableLayout:"auto"},children:[(0,mt.jsx)("thead",{className:"moonui-data-table-header",children:pe.getHeaderGroups().map(De=>(0,mt.jsx)("tr",{className:"moonui-data-table-row border-b",children:De.headers.filter(ct=>ct.column.getIsVisible()).map(ct=>(0,mt.jsx)("th",{className:"moonui-data-table-th h-12 px-4 text-left align-middle font-medium text-muted-foreground",children:ct.isPlaceholder?null:(0,mt.jsxs)("div",{className:E("flex items-center space-x-2",ct.column.getCanSort()&&"cursor-pointer select-none"),onClick:ct.column.getCanSort()?Z(ct.column.id):void 0,children:[_ne(ct.column.columnDef.header,ct.getContext()),ct.column.getCanSort()&&(0,mt.jsx)("div",{className:"ml-2",children:ct.column.getIsSorted()==="asc"?(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(ov,{className:"h-4 w-4"})}):ct.column.getIsSorted()==="desc"?(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(Uf,{className:"h-4 w-4"})}):(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(nv,{className:"h-4 w-4"})})})]})},ct.id))},De.id))}),(0,mt.jsx)("tbody",{className:"moonui-data-table-body",children:te?(0,mt.jsx)(me.tr,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:(0,mt.jsx)("td",{colSpan:pe.getAllLeafColumns().filter(De=>De.getIsVisible()).length,className:"h-24 text-center",children:(0,mt.jsxs)("div",{className:"flex items-center justify-center space-x-2",children:[(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(Nr,{className:"h-4 w-4 animate-spin"})}),(0,mt.jsx)("span",{className:"text-sm text-muted-foreground",children:"Loading..."})]})})},"loading"):Me?.length?(0,mt.jsx)(mt.Fragment,{children:Me.map((De,ct)=>{let We=De.original.id||De.id,bt=f&&X.has(We);return(0,mt.jsx)(o6e,{row:De,columns:B,isExpanded:bt,enableExpandable:f,renderSubComponent:p,visibilityState:pe.getState().columnVisibility},We)})}):(0,mt.jsx)(me.tr,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:(0,mt.jsx)("td",{colSpan:pe.getAllLeafColumns().filter(De=>De.getIsVisible()).length,className:"h-24 text-center",children:"No results found."})},"no-results")})]})})}),i&&(0,mt.jsxs)("div",{className:"flex items-center justify-between px-2",children:[(0,mt.jsx)("div",{className:"flex-1 text-sm text-muted-foreground",children:a&&pe.getFilteredSelectedRowModel().rows.length>0&&(0,mt.jsxs)("span",{children:[pe.getFilteredSelectedRowModel().rows.length," ","of ",pe.getFilteredRowModel().rows.length," ","row(s) selected."]})}),(0,mt.jsxs)("div",{className:"flex items-center space-x-6 lg:space-x-8",children:[(0,mt.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,mt.jsx)("p",{className:"text-sm font-medium",children:"Rows per page"}),(0,mt.jsx)("select",{value:pe.getState().pagination.pageSize,onChange:async De=>{let ct=Number(De.target.value);S?S({pageIndex:pe.getState().pagination.pageIndex,pageSize:ct}):(se(!0),await new Promise(We=>setTimeout(We,300)),pe.setPageSize(ct),se(!1))},className:"h-8 w-[70px] rounded border border-input bg-background px-3 py-1 text-sm",disabled:te,children:l.map(De=>(0,mt.jsx)("option",{value:De,children:De},De))})]}),(0,mt.jsxs)("div",{className:"flex w-[100px] items-center justify-center text-sm font-medium",children:["Page ",pe.getState().pagination.pageIndex+1," of"," ",pe.getPageCount()]}),(0,mt.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,mt.jsx)(xe,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:async()=>{S?S({pageIndex:0,pageSize:pe.getState().pagination.pageSize}):(se(!0),await new Promise(De=>setTimeout(De,300)),pe.setPageIndex(0),se(!1))},disabled:!pe.getCanPreviousPage()||te,children:(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(ZE,{className:"h-4 w-4"})})}),(0,mt.jsx)(xe,{variant:"outline",className:"h-8 w-8 p-0",onClick:async()=>{if(S){let De=pe.getState().pagination.pageIndex;S({pageIndex:De-1,pageSize:pe.getState().pagination.pageSize})}else se(!0),await new Promise(De=>setTimeout(De,300)),pe.previousPage(),se(!1)},disabled:!pe.getCanPreviousPage()||te,children:(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(Za,{className:"h-4 w-4"})})}),(0,mt.jsx)(xe,{variant:"outline",className:"h-8 w-8 p-0",onClick:async()=>{se(!0),await new Promise(De=>setTimeout(De,300)),pe.nextPage(),se(!1)},disabled:!pe.getCanNextPage()||te,children:(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(Sn,{className:"h-4 w-4"})})}),(0,mt.jsx)(xe,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:async()=>{se(!0),await new Promise(De=>setTimeout(De,300)),pe.setPageIndex(pe.getPageCount()-1),se(!1)},disabled:!pe.getCanNextPage()||te,children:(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(eT,{className:"h-4 w-4"})})})]})]})]}),n&&(0,mt.jsx)(t6e,{table:pe,open:J,onOpenChange:ee})]})}function VVt(e,t){return{id:"expander",header:()=>null,size:50,cell:({row:r})=>{let n=r.original.id||r.id,o=e.has(n);return(0,mt.jsx)("button",{onClick:a=>{a.stopPropagation(),t(n)},className:"p-2 hover:bg-muted rounded-md transition-colors","aria-label":o?"Collapse row":"Expand row",children:(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:o?(0,mt.jsx)(qo,{className:"h-4 w-4 text-muted-foreground"}):(0,mt.jsx)(Sn,{className:"h-4 w-4 text-muted-foreground"})})})}}}function $Vt(e=new Set){let[t,r]=qi.default.useState(e),n=qi.default.useCallback(i=>{r(s=>{let l=new Set(s);return l.has(i)?l.delete(i):l.add(i),l})},[]),o=qi.default.useCallback(i=>{r(new Set(i))},[]),a=qi.default.useCallback(()=>{r(new Set)},[]);return{expandedRows:t,setExpandedRows:r,toggleRow:n,expandAll:o,collapseAll:a}}var o6e=({row:e,columns:t,isExpanded:r,enableExpandable:n,renderSubComponent:o,visibilityState:a})=>{let i=e.original.id||e.id;return(0,mt.jsxs)(mt.Fragment,{children:[(0,mt.jsx)("tr",{className:E("border-b transition-colors hover:bg-muted/50",e.getIsSelected()&&"bg-muted",r&&"border-b-0"),children:e.getAllCells().filter(s=>a[s.column.id]!==!1).map(s=>(0,mt.jsx)("td",{className:"moonui-data-table-td p-4 align-middle",children:_ne(s.column.columnDef.cell,s.getContext())},s.id))}),r&&o&&(0,mt.jsx)("tr",{className:"border-b",children:(0,mt.jsx)("td",{colSpan:e.getAllCells().filter(s=>a[s.column.id]!==!1).length||1,className:"p-0 overflow-hidden",children:(0,mt.jsx)("div",{className:"transition-all duration-300 ease-out",style:{maxHeight:r?"1000px":"0",opacity:r?1:0},children:(0,mt.jsx)("div",{className:"border-t border-border/50",children:o({row:{original:e.original,id:i}})})})})})]})};o6e.displayName="TableRow";var HVt=zne;var Cn=_(ye(),1);var rj=_(Vne(),1);var ot=_(ue(),1),$ne=Cn.default.memo(({searchInputRef:e,searchPlaceholder:t,initialValue:r,onSearchChange:n,keyboardShortcuts:o})=>{let[a,i]=(0,Cn.useState)(r||""),s=(0,Cn.useRef)(void 0);(0,Cn.useEffect)(()=>{i(r)},[r]);let l=(0,Cn.useCallback)(c=>{let u=c.target.value;i(u),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{n(u),e.current&&e.current.focus()},150)},[n,e]);return(0,Cn.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]),(0,ot.jsx)("div",{className:"p-4 border-b",children:(0,ot.jsxs)("div",{className:"relative",children:[(0,ot.jsx)($n,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),(0,ot.jsx)("input",{ref:e,type:"text",placeholder:t,value:a,onChange:l,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false",className:"w-full h-10 pl-9 pr-9 text-sm bg-background border border-input rounded-md 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&&(0,ot.jsxs)("kbd",{className:"absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 hidden sm:flex",children:[(0,ot.jsx)("span",{className:"text-xs",children:"\u2318"}),"K"]})]})})});$ne.displayName="SearchInput";function jVt({sections:e,footer:t,showSearch:r=!0,searchPlaceholder:n="Search...",searchQuery:o="",onSearchChange:a,showThemeToggle:i=!1,theme:s="system",onThemeChange:l,branding:c,collapsible:u=!0,defaultCollapsed:d=!1,floatingActionButton:f=!0,floatingActionButtonPosition:p={bottom:"1rem",left:"1rem"},floatingActionButtonClassName:m,glassmorphism:h=!1,animatedBackground:g=!1,keyboardShortcuts:v=!0,persistState:y=!0,persistKey:b="moonui-sidebar-state",onStateChange:w,customStyles:x,fullWidthItems:C=!0,enableNProgress:P=!0,className:R,activePath:L,onNavigate:$}){let[I,A]=(0,Cn.useState)(!1),[j,V]=(0,Cn.useState)(!1),[S,N]=(0,Cn.useState)(d),[k,T]=(0,Cn.useState)([]),[B,D]=(0,Cn.useState)(o),[z,M]=(0,Cn.useState)([]),G=(0,Cn.useRef)(null);(0,Cn.useEffect)(()=>{P&&rj.default.configure({easing:"ease",speed:800,showSpinner:!1,trickleSpeed:200,minimum:.2})},[P]);let q=aa(0),H=aa(0),F=Hp(q,{stiffness:300,damping:30}),W=Hp(H,{stiffness:300,damping:30});(0,Cn.useEffect)(()=>{if(y&&typeof window<"u"){let K=localStorage.getItem(b);if(K){let ne=JSON.parse(K);N(ne.collapsed),T(ne.expandedSections),M(ne.pinnedItems||[])}}},[y,b]),(0,Cn.useEffect)(()=>{if(y&&typeof window<"u"){let K={collapsed:S,expandedSections:k,searchQuery:B,pinnedItems:z,recentItems:[]};localStorage.setItem(b,JSON.stringify(K)),w?.(K)}},[S,k,B,z,y,b,w]),(0,Cn.useEffect)(()=>{let K=()=>{A(window.innerWidth<768)};return K(),window.addEventListener("resize",K),()=>window.removeEventListener("resize",K)},[]),(0,Cn.useEffect)(()=>{let K=e.filter(ne=>ne.defaultExpanded!==!1).map(ne=>ne.id);T(K)},[e]),(0,Cn.useEffect)(()=>{if(!v)return;let K=ne=>{(ne.metaKey||ne.ctrlKey)&&ne.key==="k"&&(ne.preventDefault(),G.current?.focus()),(ne.metaKey||ne.ctrlKey)&&ne.key==="b"&&(ne.preventDefault(),I?V(!j):N(!S))};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[v,I,j,S]),(0,Cn.useEffect)(()=>{if(!g)return;let K=ne=>{let ce=document.querySelector(".sidebar-container")?.getBoundingClientRect();ce&&(q.set(ne.clientX-ce.left),H.set(ne.clientY-ce.top))};return document.addEventListener("mousemove",K),()=>document.removeEventListener("mousemove",K)},[g,q,H]);let U=(0,Cn.useCallback)(K=>{T(ne=>ne.includes(K)?ne.filter(ce=>ce!==K):[...ne,K])},[]),O=(0,Cn.useCallback)(K=>{M(ne=>ne.includes(K)?ne.filter(ce=>ce!==K):[...ne,K])},[]),Y=(0,Cn.useCallback)(K=>{K.action?K.action():K.href&&(P&&(rj.default.start(),setTimeout(()=>rj.default.done(),500)),$?$(K.href):window.location.href=K.href,I&&V(!1))},[$,I,P]);(0,Cn.useEffect)(()=>{D(o)},[o]);let re=(0,Cn.useCallback)(K=>{D(K),a?.(K)},[a]),Q=(0,Cn.useCallback)((K,ne)=>ne?K.filter(ce=>{let Z=ce.title.toLowerCase().includes(ne.toLowerCase()),we=ce.items?.some(de=>de.title.toLowerCase().includes(ne.toLowerCase()));return Z||we}):K,[]),ae=(0,Cn.useMemo)(()=>B?e.map(K=>({...K,filteredItems:Q(K.items,B).map(ne=>({...ne,filteredChildren:ne.items?Q(ne.items,B):void 0}))})).filter(K=>K.filteredItems.length>0):e.map(K=>({...K,filteredItems:K.items.map(ne=>({...ne,filteredChildren:ne.items}))})),[e,B,Q]),te=(0,Cn.useCallback)(K=>{let ne=K.items&&K.items.length>0;return!ne&&!K.title?null:(0,ot.jsxs)("div",{className:E("min-w-[240px] max-w-[320px] p-3",h&&"bg-background/95 backdrop-blur-sm"),children:[(0,ot.jsx)("div",{className:"font-medium px-2 py-1.5 text-sm",children:K.title}),ne&&(0,ot.jsx)("div",{className:"mt-1 space-y-0.5",children:K.items?.map(ce=>{let Z=ce.href===L,we=ce.items&&ce.items.length>0;return(0,ot.jsx)("div",{className:"relative",children:we?(0,ot.jsxs)(tI,{openDelay:200,closeDelay:100,children:[(0,ot.jsx)(rI,{asChild:!0,children:(0,ot.jsxs)("button",{onClick:()=>Y(ce),disabled:ce.disabled,className:E("w-full flex items-center justify-between gap-2 rounded-md px-2 py-1.5 text-sm transition-colors","hover:bg-accent hover:text-accent-foreground cursor-pointer",Z&&"bg-primary/10 text-primary font-medium",ce.disabled&&"opacity-50 cursor-not-allowed"),children:[(0,ot.jsxs)("div",{className:"flex items-center gap-2",children:[ce.icon&&(0,ot.jsx)("span",{className:"flex-shrink-0",children:ce.icon}),(0,ot.jsx)("span",{className:"truncate",children:ce.title})]}),(0,ot.jsx)(Sn,{className:"h-3 w-3 flex-shrink-0"})]})}),(0,ot.jsx)(mN,{side:"right",align:"start",sideOffset:20,collisionPadding:20,avoidCollisions:!0,className:E("p-2 min-w-[200px] max-w-[280px] z-[99999]",h&&"bg-background/95 backdrop-blur-sm"),children:(0,ot.jsx)("div",{className:"space-y-0.5",children:ce.items?.map(de=>{let ge=de.href===L;return(0,ot.jsxs)("button",{onClick:()=>Y(de),disabled:de.disabled,className:E("w-full flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors","hover:bg-accent hover:text-accent-foreground cursor-pointer",ge&&"bg-primary/10 text-primary font-medium",de.disabled&&"opacity-50 cursor-not-allowed"),children:[de.icon&&(0,ot.jsx)("span",{className:"flex-shrink-0",children:de.icon}),(0,ot.jsx)("span",{className:"truncate",children:de.title}),de.badge&&(0,ot.jsx)(ht,{variant:de.badgeVariant||"secondary",className:"ml-auto flex-shrink-0 text-[10px] px-1.5 py-0 h-5",children:de.badge})]},de.id)})})})]}):(0,ot.jsxs)("button",{onClick:()=>Y(ce),disabled:ce.disabled,className:E("w-full flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors","hover:bg-accent hover:text-accent-foreground",Z&&"bg-primary/10 text-primary font-medium",ce.disabled&&"opacity-50 cursor-not-allowed"),children:[ce.icon&&(0,ot.jsx)("span",{className:"flex-shrink-0",children:ce.icon}),(0,ot.jsx)("span",{className:"truncate",children:ce.title}),ce.badge&&(0,ot.jsx)(ht,{variant:ce.badgeVariant||"secondary",className:"ml-auto flex-shrink-0 text-[10px] px-1.5 py-0 h-5",children:ce.badge})]})},ce.id)})})]})},[L,h,Y]),se=(0,Cn.useCallback)((K,ne=0,ce)=>{let Z=K.href===L,we=z.includes(K.id),de=K.items&&K.items.length>0,ge=k.includes(K.id),pe=S&&!I&&ne===0,ve=K.tooltip&&!S&&!pe,Pe=K.icon||(ne===0?(0,ot.jsx)(Uu,{className:"h-4 w-4"}):(0,ot.jsx)(Bu,{className:"h-3 w-3"})),ze=(0,ot.jsxs)("button",{onClick:()=>{de&&!S?U(K.id):de||Y(K)},className:E("group relative flex items-center gap-3 rounded-lg text-sm transition-all","w-full px-3 py-2.5","hover:bg-accent hover:text-accent-foreground",Z&&"bg-primary/10 text-primary font-medium",K.disabled&&"opacity-50 cursor-not-allowed",ne>0&&"ml-6 text-xs py-2",S&&ne===0&&"justify-center px-0 h-12",x?.hover),disabled:K.disabled,children:[(0,ot.jsx)("span",{className:E("flex-shrink-0 flex items-center justify-center",S&&ne===0&&"w-full",!S&&"w-5"),children:Pe}),(!S||ne>0)&&(0,ot.jsxs)(ot.Fragment,{children:[(0,ot.jsx)("span",{className:"flex-1 text-left truncate",children:K.title}),K.badge&&(0,ot.jsx)(ht,{variant:K.badgeVariant||"secondary",className:"ml-auto flex-shrink-0 text-[10px] px-1.5 py-0 h-5",children:K.badge}),de&&ne===0&&(0,ot.jsx)(qo,{className:E("h-4 w-4 flex-shrink-0 transition-transform",ge&&"rotate-180")}),we&&(0,ot.jsx)(ET,{className:"h-3 w-3 flex-shrink-0"})]})]});return pe?(0,ot.jsx)("div",{children:(0,ot.jsxs)(tI,{openDelay:200,closeDelay:100,children:[(0,ot.jsx)(rI,{asChild:!0,children:ze}),(0,ot.jsx)(mN,{side:"right",align:"start",sideOffset:20,collisionPadding:20,avoidCollisions:!0,className:E("p-0 w-auto min-w-[240px] max-w-[320px] z-[9999]",h&&"bg-background/95 backdrop-blur-sm","animate-in fade-in-0 slide-in-from-left-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-left-2"),children:(0,ot.jsx)(me.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15,ease:"easeOut"},children:te(K)})})]})},K.id):(0,ot.jsxs)("div",{children:[ve?(0,ot.jsx)(Xs,{children:(0,ot.jsxs)(xs,{children:[(0,ot.jsx)(ws,{asChild:!0,children:ze}),(0,ot.jsx)(ts,{side:"right",children:(0,ot.jsx)("p",{children:K.tooltip})})]})}):ze,de&&!S&&ce&&(0,ot.jsx)(kt,{initial:!1,children:ge&&(0,ot.jsx)(me.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},style:{overflow:"hidden"},children:(0,ot.jsx)("div",{className:"pt-1 space-y-1",children:ce.map(Oe=>se(Oe,ne+1))})},`${K.id}-children`)})]},K.id)},[L,z,k,S,x,Y,U,I,h,te,C]),oe=Cn.default.memo(()=>(0,ot.jsxs)("div",{className:E("flex items-center h-16 px-4 border-b",S&&!I&&"px-0 justify-center"),children:[c&&(0,ot.jsxs)(ot.Fragment,{children:[c.logo,(!S||I)&&c.title&&(0,ot.jsx)("span",{className:"font-semibold text-lg",children:c.title})]}),I&&(0,ot.jsx)(xe,{variant:"ghost",size:"sm",className:"ml-auto h-8 w-8 p-0",onClick:()=>V(!1),children:(0,ot.jsx)(fr,{className:"h-4 w-4"})}),!I&&u&&(0,ot.jsx)(xe,{variant:"ghost",size:"sm",className:E("h-8 w-8 p-0 transition-all",!S&&"ml-auto",S&&"mx-auto"),onClick:()=>N(!S),children:(0,ot.jsx)(me.div,{animate:{rotate:S?0:180},transition:{duration:.2},children:(0,ot.jsx)(Sn,{className:"h-4 w-4"})})})]})),le=Cn.default.memo(()=>(0,ot.jsx)("div",{className:"flex-1 overflow-y-auto overscroll-contain",style:{scrollbarWidth:"thin"},children:(0,ot.jsxs)("div",{className:"p-4 space-y-6",children:[z.length>0&&(!S||I)&&(0,ot.jsxs)("div",{children:[(0,ot.jsx)("h4",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Pinned"}),(0,ot.jsx)("div",{className:"space-y-1",children:e.flatMap(K=>K.items.filter(ne=>z.includes(ne.id))).map(K=>se(K))}),(0,ot.jsx)(Ps,{className:"mt-4"})]}),ae.map((K,ne)=>(0,ot.jsxs)("div",{children:[K.title&&(!S||I)&&(0,ot.jsx)("h4",{className:"text-xs font-medium text-muted-foreground mb-2",children:K.title}),(0,ot.jsx)("div",{className:"space-y-1",children:K.filteredItems.map(ce=>se(ce,0,ce.filteredChildren))}),K.showDivider&&ne<ae.length-1&&(0,ot.jsx)(Ps,{className:"mt-4"})]},K.id))]})}));le.displayName="SidebarMenuContent";let J=Cn.default.memo(()=>t?(0,ot.jsxs)("div",{className:"border-t p-4",children:[(0,ot.jsx)("div",{className:"space-y-1",children:t.items.map(K=>se(K))}),i&&(!S||I)&&(0,ot.jsxs)("div",{className:"mt-3 flex items-center justify-between",children:[(0,ot.jsx)("span",{className:"text-xs text-muted-foreground",children:"Theme"}),(0,ot.jsxs)(Cr,{children:[(0,ot.jsx)(Sr,{asChild:!0,children:(0,ot.jsxs)(xe,{variant:"ghost",size:"sm",className:"h-7 px-2",children:[s==="light"&&(0,ot.jsx)(ju,{className:"h-3 w-3"}),s==="dark"&&(0,ot.jsx)(Hu,{className:"h-3 w-3"}),s==="system"&&(0,ot.jsx)($u,{className:"h-3 w-3"})]})}),(0,ot.jsxs)(xr,{align:"end",children:[(0,ot.jsxs)(Ye,{onClick:()=>l?.("light"),children:[(0,ot.jsx)(ju,{className:"mr-2 h-4 w-4"}),"Light"]}),(0,ot.jsxs)(Ye,{onClick:()=>l?.("dark"),children:[(0,ot.jsx)(Hu,{className:"mr-2 h-4 w-4"}),"Dark"]}),(0,ot.jsxs)(Ye,{onClick:()=>l?.("system"),children:[(0,ot.jsx)($u,{className:"mr-2 h-4 w-4"}),"System"]})]})]})]})]}):null);J.displayName="SidebarFooter";let ee=Cn.default.memo(()=>(0,ot.jsxs)(ot.Fragment,{children:[(0,ot.jsx)(le,{}),(0,ot.jsx)(J,{})]}));ee.displayName="SidebarContent";let X=E("moonui-pro flex h-full flex-col bg-background border-r transition-all duration-300 ease-in-out relative z-[9990]",h&&"bg-background/80 backdrop-blur-xl border-white/10",S&&!I&&"w-20",!S&&!I&&"w-64",x?.background,x?.border,R);return I?(0,ot.jsxs)(ot.Fragment,{children:[f&&(0,ot.jsx)(xe,{onClick:()=>V(!0),className:E("fixed z-40 h-12 w-12 rounded-full shadow-lg md:hidden",m),size:"icon",style:{bottom:p?.bottom,left:p?.left,right:p?.right,top:p?.top},children:(0,ot.jsx)(Hf,{className:"h-5 w-5"})}),(0,ot.jsx)(J0,{open:j,onOpenChange:V,children:(0,ot.jsx)(Rv,{side:"left",className:"w-80 p-0",children:(0,ot.jsxs)("div",{className:E(X,"sidebar-container flex flex-col"),children:[g&&(0,ot.jsx)(me.div,{className:"absolute inset-0 opacity-30",style:{background:`radial-gradient(circle at ${F}px ${W}px, rgba(var(--primary-rgb), 0.15), transparent 50%)`}}),(0,ot.jsx)(oe,{}),r&&(!S||I)&&(0,ot.jsx)($ne,{searchInputRef:G,searchPlaceholder:n,initialValue:B,onSearchChange:re,keyboardShortcuts:v},"sidebar-search-mobile"),(0,ot.jsx)(ee,{})]})})})]}):(0,ot.jsxs)("aside",{className:E(X,"sidebar-container hidden md:flex flex-col"),children:[g&&(0,ot.jsx)(me.div,{className:"absolute inset-0 opacity-30",style:{background:`radial-gradient(circle at ${F}px ${W}px, rgba(var(--primary-rgb), 0.15), transparent 50%)`}}),(0,ot.jsx)(oe,{}),r&&(!S||I)&&(0,ot.jsx)($ne,{searchInputRef:G,searchPlaceholder:n,initialValue:B,onSearchChange:re,keyboardShortcuts:v},"sidebar-search-desktop"),(0,ot.jsx)(ee,{})]})}function i6e(e){let{hasProAccess:t,isLoading:r}=Ee();return!r&&!t?(0,ot.jsx)(Ve,{componentName:"Advanced Sidebar",compact:!0,className:E("w-full max-w-xs",e.className)}):(0,ot.jsx)(jVt,{...e})}var sl=_(ye(),1);var Mf=_(hr(),1),WVt=(e,t,r,n,o,a,i,s)=>{let l=document.documentElement,c=["light","dark"];function u(p){(Array.isArray(e)?e:[e]).forEach(m=>{let h=m==="class",g=h&&a?o.map(v=>a[v]||v):o;h?(l.classList.remove(...g),l.classList.add(a&&a[p]?a[p]:p)):l.setAttribute(m,p)}),d(p)}function d(p){s&&c.includes(p)&&(l.style.colorScheme=p)}function f(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(n)u(n);else try{let p=localStorage.getItem(t)||r,m=i&&p==="system"?f():p;u(m)}catch{}};var qVt=Mf.createContext(void 0),GVt={setTheme:e=>{},themes:[]},nj=()=>{var e;return(e=Mf.useContext(qVt))!=null?e:GVt};var Fcn=Mf.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:n,enableColorScheme:o,defaultTheme:a,value:i,themes:s,nonce:l,scriptProps:c})=>{let u=JSON.stringify([r,t,a,e,s,i,n,o]).slice(1,-1);return Mf.createElement("script",{...c,suppressHydrationWarning:!0,nonce:typeof window>"u"?l:"",dangerouslySetInnerHTML:{__html:`(${WVt.toString()})(${u})`}})});var bd=_(ye(),1);function s6e({sticky:e=!0,hideOnScroll:t=!1,showScrollProgress:r=!1,scrollBehavior:n="static",minimalConfig:o={}}={}){let[a,i]=(0,bd.useState)(!1),[s,l]=(0,bd.useState)(!1),[c,u]=(0,bd.useState)(0),[d,f]=(0,bd.useState)(!1),[p,m]=(0,bd.useState)(0),h=(0,bd.useRef)(0),g=(0,bd.useRef)(!1),{scrollThreshold:v=50,animationDuration:y=300}=o,b=(0,bd.useCallback)(()=>{let x=window.scrollY;m(x);let C=x>10;if(i(C),n==="hide"||t)x>h.current&&x>100?l(!0):l(!1);else if(n==="minimal"){let P=x>v;f(R=>R!==P?P:R)}if(r){let P=window.scrollY,R=document.documentElement.scrollHeight-document.documentElement.clientHeight,L=R>0?P/R*100:0;u(Math.min(100,Math.max(0,L)))}h.current=x,g.current=!1},[t,n,r,v]),w=(0,bd.useCallback)(()=>{g.current||(requestAnimationFrame(b),g.current=!0)},[b]);return(0,bd.useEffect)(()=>{if(!(!e&&n==="static"&&!r))return b(),window.addEventListener("scroll",w,{passive:!0}),()=>{window.removeEventListener("scroll",w)}},[e,n,r,w,b]),{scrolled:a,hidden:s,scrollProgress:c,isMinimal:d,scrollY:p}}var oj=_(Vne(),1);var Ce=_(ue(),1);function KVt({sections:e=[],branding:t,showSearch:r=!0,enableCommandAI:n=!1,commandAIShortcut:o="\u2318K",commandAIPlaceholder:a="Search commands...",onCommandAIOpen:i,onCommandAIClose:s,onCommandAISelect:l,searchPlaceholder:c="Search...",onSearch:u,showThemeToggle:d=!1,theme:f="system",onThemeChange:p,themeToggleVariant:m="dropdown",userMenu:h,notifications:g,cta:v,sticky:y=!0,glassmorphism:b=!1,animatedBackground:w=!1,keyboardShortcuts:x=!0,hideNavItems:C=!1,mobileBreakpoint:P=768,customStyles:R,variant:L="default",size:$="md",blur:I=!0,shadow:A=!1,rounded:j=!1,logoPosition:V="left",navItemsPosition:S="left",mobileMenuPosition:N="left",hideOnScroll:k=!1,showScrollProgress:T=!1,scrollBehavior:B="static",minimalConfig:D={},maxWidth:z="2xl",fullWidth:M=!1,overlayMode:G=!1,autoExpand:q=!1,containerMaxWidth:H="5xl",enableNProgress:F=!0,progressBarInset:W=!0,pushContent:U,className:O,activePath:Y,onNavigate:re}){let[Q,ae]=(0,sl.useState)(!1),[te,se]=(0,sl.useState)(!1),[oe,le]=(0,sl.useState)(!1),[J,ee]=(0,sl.useState)(!1),[X,K]=(0,sl.useState)(""),{theme:ne,setTheme:ce}=nj(),Z=ne==="dark",we=(0,sl.useRef)(null),de=U??(y&&!G),{scrolled:ge,hidden:pe,scrollProgress:ve,isMinimal:Pe}=s6e({sticky:y,hideOnScroll:k,showScrollProgress:T,scrollBehavior:B,minimalConfig:D}),ze=d_({scrolledThreshold:50,hiddenThreshold:150,disableHiding:L==="floating-sticky"});(0,sl.useEffect)(()=>{F&&oj.default.configure({easing:"ease",speed:800,showSpinner:!1,trickleSpeed:200,minimum:.2})},[F]),(0,sl.useEffect)(()=>{let Ue=()=>{ae(window.innerWidth<P)};return Ue(),window.addEventListener("resize",Ue),()=>window.removeEventListener("resize",Ue)},[P]),(0,sl.useEffect)(()=>{if(!x&&!n)return;let Ue=Be=>{(Be.metaKey||Be.ctrlKey)&&Be.key==="k"&&(Be.preventDefault(),ee(!0),n&&i?.())};return document.addEventListener("keydown",Ue),()=>document.removeEventListener("keydown",Ue)},[x,n,i]);let Oe=(0,sl.useCallback)(()=>{if(!t?.logo)return null;let Be=(ze.isScrolled||ge)&&t.logoSmall?t.logoSmall:null,He=Z?t.logoDark||null:t.logoLight||null;return Be||He||t.logo},[t,ze.isScrolled,ge,Z]),Me=(0,sl.useCallback)(Ue=>{if(Ue.action)Ue.action();else if(Ue.href)if(Ue.href.startsWith("#")){let Be=document.querySelector(Ue.href);Be&&Be.scrollIntoView({behavior:"smooth",block:"start"}),Q&&se(!1)}else F&&(oj.default.start(),setTimeout(()=>oj.default.done(),500)),re?re(Ue.href):window.location.href=Ue.href,Q&&se(!1)},[re,Q,F]),fe=(0,sl.useCallback)(Ue=>{K(Ue),u?.(Ue)},[u]),be=Ue=>(0,Ce.jsx)("div",{className:"grid gap-3 p-6 md:w-[400px] lg:w-[500px] lg:grid-cols-[.75fr_1fr]",children:Ue.map(Be=>(0,Ce.jsxs)(wN,{className:E("block select-none space-y-1 rounded-md p-3 leading-none no-underline outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground cursor-pointer",Be.disabled&&"opacity-50 cursor-not-allowed"),onClick:()=>!Be.disabled&&Me(Be),children:[(0,Ce.jsxs)("div",{className:"flex items-center gap-2",children:[Be.icon&&(0,Ce.jsx)("span",{className:"flex-shrink-0",children:Be.icon}),(0,Ce.jsx)("div",{className:"text-sm font-medium leading-none",children:Be.title}),Be.badge&&(0,Ce.jsx)(ht,{variant:Be.badgeVariant||"secondary",className:"ml-auto",children:Be.badge})]}),Be.description&&(0,Ce.jsx)("p",{className:"line-clamp-2 text-sm leading-snug text-muted-foreground",children:Be.description})]},Be.id))}),Ae=Ue=>(0,Ce.jsx)(Ce.Fragment,{children:Ue.map(Be=>Be.items&&Be.items.length>0?(0,Ce.jsxs)(ed,{children:[(0,Ce.jsx)(ou,{disabled:Be.disabled,children:(0,Ce.jsxs)("span",{className:"flex items-center gap-2",children:[Be.icon&&(0,Ce.jsx)("span",{children:Be.icon}),Be.title]})}),(0,Ce.jsx)(au,{children:Ae(Be.items)})]},Be.id):(0,Ce.jsxs)(Ye,{disabled:Be.disabled,onClick:()=>Me(Be),children:[(0,Ce.jsxs)("span",{className:"flex items-center gap-2",children:[Be.icon&&(0,Ce.jsx)("span",{children:Be.icon}),Be.title]}),Be.badge&&(0,Ce.jsx)(ht,{variant:Be.badgeVariant||"secondary",className:"ml-auto",children:Be.badge})]},Be.id))}),Te=()=>(0,Ce.jsxs)(J0,{open:te,onOpenChange:se,children:[(0,Ce.jsx)(t3,{asChild:!0,children:(0,Ce.jsx)(xe,{variant:"ghost",size:"icon",className:"lg:hidden",children:(0,Ce.jsx)(Hf,{className:"h-5 w-5"})})}),(0,Ce.jsxs)(Rv,{side:N,className:"w-80 p-0",children:[(0,Ce.jsx)(Mw,{className:"sr-only",children:"Navigation Menu"}),(0,Ce.jsxs)("div",{className:"flex h-full flex-col",children:[(0,Ce.jsx)("div",{className:"flex items-center p-4 border-b",children:t&&(0,Ce.jsxs)("div",{className:"flex items-center gap-2",children:[Oe(),t.title&&(0,Ce.jsx)("span",{className:"font-semibold text-lg",children:t.title})]})}),(0,Ce.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:!C&&e.map(Ue=>(0,Ce.jsxs)("div",{className:"space-y-1",children:[Ue.items.map(Be=>(0,Ce.jsx)("div",{children:Be.items&&Be.items.length>0?(0,Ce.jsxs)(Cr,{children:[(0,Ce.jsx)(Sr,{asChild:!0,children:(0,Ce.jsxs)(xe,{variant:"ghost",className:"w-full justify-between",disabled:Be.disabled,children:[(0,Ce.jsxs)("span",{className:"flex items-center gap-2",children:[Be.icon&&(0,Ce.jsx)("span",{children:Be.icon}),Be.title]}),(0,Ce.jsx)(qo,{className:"h-4 w-4"})]})}),(0,Ce.jsx)(xr,{align:"start",className:"w-56",children:Be.items&&Ae(Be.items)})]}):(0,Ce.jsxs)(xe,{variant:"ghost",className:"w-full justify-start",disabled:Be.disabled,onClick:()=>Me(Be),children:[(0,Ce.jsxs)("span",{className:"flex items-center gap-2",children:[Be.icon&&(0,Ce.jsx)("span",{children:Be.icon}),Be.title]}),Be.badge&&(0,Ce.jsx)(ht,{variant:Be.badgeVariant||"secondary",className:"ml-auto",children:Be.badge})]})},Be.id)),(0,Ce.jsx)(Ps,{className:"my-2"})]},Ue.id))})]})]})]}),De=(Ue=!1)=>{switch($){case"sm":return Ue?"h-12":"h-14";case"lg":return Ue?"h-16":"h-20";case"xl":return Ue?"h-20":"h-24";case"2xl":return Ue?"h-24":"h-28";default:return Ue?"h-14":"h-16"}},ct=()=>{if(B==="minimal"&&D?.heightOnScroll)return D.heightOnScroll;let Ue={sm:"h-14",md:"h-16",lg:"h-20",xl:"h-24","2xl":"h-28"};return Ue[$]||Ue.md},We=()=>{switch($){case"sm":return{text:"text-sm",logoText:"text-base",spacing:"space-x-2",gap:"gap-2",buttonSize:"sm",iconSize:"h-4 w-4",padding:"px-2 py-1"};case"lg":return{text:"text-base",logoText:"text-xl",spacing:"space-x-4",gap:"gap-3",buttonSize:"md",iconSize:"h-5 w-5",padding:"px-3 py-2"};case"xl":return{text:"text-lg",logoText:"text-2xl",spacing:"space-x-6",gap:"gap-4",buttonSize:"lg",iconSize:"h-6 w-6",padding:"px-4 py-2.5"};case"2xl":return{text:"text-xl",logoText:"text-3xl",spacing:"space-x-8",gap:"gap-5",buttonSize:"lg",iconSize:"h-7 w-7",padding:"px-5 py-3"};default:return{text:"text-sm",logoText:"text-lg",spacing:"space-x-4",gap:"gap-2",buttonSize:"md",iconSize:"h-5 w-5",padding:"px-3 py-1.5"}}},bt=L==="floating-auto-hide"||L==="floating-sticky",It=E("moonui-pro",!bt&&"transition-all duration-300 ease-in-out",!(L==="floating-centered"&&G)&&"w-full",L==="default"&&"border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",L==="floating"&&"mx-4 mt-4 rounded-lg border bg-background/95 backdrop-blur shadow-lg",L==="floating-centered"&&E("mx-auto rounded-2xl border border-border/40 bg-background/70 backdrop-blur-xl shadow-lg shadow-black/5 dark:shadow-black/20 px-6",G&&"left-1/2 -translate-x-1/2 top-4",!G&&!y&&"my-4",H==="3xl"&&"max-w-3xl",H==="4xl"&&"max-w-4xl",H==="5xl"&&"max-w-5xl",H==="6xl"&&"max-w-6xl",H==="7xl"&&"max-w-7xl",H==="full"&&"max-w-full px-8",!H&&q&&"max-w-max"),L==="floating-auto-hide"&&E("fixed top-0 z-50 w-full border-b",ze.isScrolled?"border-b bg-background/80 backdrop-blur-xl shadow-lg":"border-b border-transparent bg-background/95 backdrop-blur"),L==="floating-sticky"&&E("fixed top-0 z-50 w-full border-b",ze.isScrolled?"border-b bg-background/80 backdrop-blur-xl shadow-lg":"border-b border-transparent bg-background/95 backdrop-blur"),L==="minimal"&&"bg-background",L==="transparent"&&"bg-transparent",G&&"absolute z-50",!G&&y&&"sticky top-0 z-50",ge&&y&&L!=="transparent"&&"shadow-sm",ge&&L==="transparent"&&"bg-background/95 backdrop-blur border-b",B==="hide"&&pe&&!bt&&"-translate-y-full",b&&"bg-background/80 backdrop-blur-xl border-white/10",I&&"backdrop-blur-md",A&&"shadow-lg",j&&"rounded-lg",R?.background,R?.border,O),it=bt?me.nav:"nav";console.log("\u{1F680} NAVBAR PACKAGE VERSION CHECK:",{variant:L,isFloatingVariant:bt,isHidden:ze.isHidden,isScrolled:ze.isScrolled,NavWrapper:it===me.nav?"motion.nav \u2705":"plain nav \u274C",timestamp:new Date().toISOString()});let Ft=bt?{animate:{y:ze.isHidden?-100:0,opacity:ze.isHidden?0:1},transition:{duration:.3,ease:"easeInOut"}}:{};console.log("\u{1F3AC} MOTION PROPS:",{hasProps:Object.keys(Ft).length>0,animate:Ft.animate,transition:Ft.transition});let yr=bt?E("fixed top-0 z-50 w-full transition-all duration-300",ze.isScrolled?"border-b bg-background/80 backdrop-blur-xl shadow-lg":"border-b border-transparent bg-background/95 backdrop-blur"):It;return(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsxs)(it,{ref:we,className:yr,...Ft,children:[L==="floating-auto-hide"||L==="floating-sticky"?(0,Ce.jsx)("div",{className:E("transition-all duration-300",ze.isScrolled?"max-w-6xl mx-auto px-2 sm:px-3 lg:px-4":"w-full px-2 sm:px-3 lg:px-4"),children:(0,Ce.jsxs)("div",{className:E("flex items-center justify-between transition-all duration-300",De(ze.isScrolled)),children:[t&&(0,Ce.jsxs)("div",{className:E("flex items-center gap-2",V==="center"&&!Q?"absolute left-1/2 -translate-x-1/2":"mr-4"),children:[V==="left"&&N==="left"&&(0,Ce.jsx)(Te,{}),(0,Ce.jsxs)("a",{href:t.href||"/",onClick:Ue=>{t.href&&re&&(Ue.preventDefault(),re(t.href))},className:"flex items-center gap-2",suppressHydrationWarning:!0,children:[(0,Ce.jsx)(kt,{mode:"wait",children:(0,Ce.jsx)(me.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeInOut"},suppressHydrationWarning:!0,children:Oe()},`logo-${ze.isScrolled?"scrolled":"default"}-${Z?"dark":"light"}`)}),(0,Ce.jsx)(kt,{mode:"wait",children:t.title&&!Q&&!ze.isScrolled&&(0,Ce.jsx)(me.span,{className:E("font-semibold overflow-hidden",We().logoText),initial:{opacity:0,width:0},animate:{opacity:1,width:"auto"},exit:{opacity:0,width:0},transition:{duration:.2,ease:"easeInOut"},children:t.title},"logo-text")})]})]}),!Q&&!C&&(0,Ce.jsx)(gN,{className:E("hidden lg:flex",q||!bt&&L==="minimal"?"flex-nowrap":"flex-wrap overflow-x-auto scrollbar-hide scroll-smooth",S==="center"&&"flex-1 justify-center mx-4",S==="right"&&"ml-auto",S==="left"&&"ml-4",Pe&&D?.centerOnScroll&&S!=="center"&&"flex-1 justify-center",S==="center"&&"absolute left-1/2 transform -translate-x-1/2"),children:(0,Ce.jsx)(vN,{children:e.map(Ue=>(0,Ce.jsx)(sl.default.Fragment,{children:Ue.items.map(Be=>{let He=Be.items&&Be.items.length>0,st=Be.href===Y;return He?(0,Ce.jsxs)(zw,{children:[(0,Ce.jsx)(bN,{className:E(st&&"bg-accent text-accent-foreground",Be.disabled&&"opacity-50 cursor-not-allowed"),disabled:Be.disabled,children:(0,Ce.jsxs)("span",{className:"flex items-center gap-2",children:[Be.icon&&(0,Ce.jsx)("span",{children:Be.icon}),Be.title]})}),(0,Ce.jsx)(xN,{children:Be.items&&be(Be.items)})]},Be.id):(0,Ce.jsx)(zw,{children:(0,Ce.jsxs)(wN,{className:E(yN(),"cursor-pointer",We().text,We().padding,st&&"bg-accent text-accent-foreground",Be.disabled&&"opacity-50 cursor-not-allowed"),onClick:()=>!Be.disabled&&Me(Be),children:[(0,Ce.jsxs)("span",{className:E("flex items-center",We().gap),children:[Be.icon&&(0,Ce.jsx)("span",{className:We().iconSize,children:Be.icon}),Be.title]}),Be.badge&&(0,Ce.jsx)(ht,{variant:Be.badgeVariant||"secondary",className:"ml-2",children:Be.badge})]})},Be.id)})},Ue.id))})}),(0,Ce.jsxs)("div",{className:"ml-auto flex items-center gap-1 sm:gap-2",children:[r&&!ze.isScrolled&&(0,Ce.jsx)(Ce.Fragment,{children:Q?(0,Ce.jsx)(xe,{variant:"ghost",size:"icon",onClick:()=>ee(!0),children:(0,Ce.jsx)($n,{className:"h-5 w-5"})}):(0,Ce.jsxs)("div",{className:"relative",children:[(0,Ce.jsx)($n,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,Ce.jsx)(Zt,{type:"search",placeholder:c,className:"w-64 pl-9 pr-4 h-9 cursor-pointer",value:X,onChange:Ue=>fe(Ue.target.value),onClick:()=>{n&&(ee(!0),i?.())},readOnly:n}),(x||n)&&(0,Ce.jsx)("kbd",{className:"absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 hidden sm:flex",children:n?o:(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)("span",{className:"text-xs",children:"\u2318"}),"K"]})})]})}),d&&(m==="button"?(0,Ce.jsx)(me.div,{whileTap:{scale:.95},className:"relative",children:(0,Ce.jsx)(xe,{variant:"ghost",size:We().buttonSize,onClick:()=>{let Ue=ne==="dark"?"light":"dark";ce(Ue),p?.(Ue)},className:"relative overflow-hidden",suppressHydrationWarning:!0,children:(0,Ce.jsx)(kt,{mode:"wait",children:ne==="dark"?(0,Ce.jsx)(me.div,{initial:{y:-20,opacity:0},animate:{y:0,opacity:1},exit:{y:20,opacity:0},transition:{duration:.2},suppressHydrationWarning:!0,children:(0,Ce.jsx)(Hu,{className:We().iconSize})},"moon"):(0,Ce.jsx)(me.div,{initial:{y:-20,opacity:0,rotate:-90},animate:{y:0,opacity:1,rotate:0},exit:{y:20,opacity:0,rotate:90},transition:{duration:.2},suppressHydrationWarning:!0,children:(0,Ce.jsx)(ju,{className:We().iconSize})},"sun")})})}):(0,Ce.jsxs)(Cr,{children:[(0,Ce.jsx)(Sr,{asChild:!0,children:(0,Ce.jsxs)(xe,{variant:"ghost",size:"icon",suppressHydrationWarning:!0,children:[ne==="light"&&(0,Ce.jsx)(ju,{className:"h-5 w-5"}),ne==="dark"&&(0,Ce.jsx)(Hu,{className:"h-5 w-5"}),ne==="system"&&(0,Ce.jsx)($u,{className:"h-5 w-5"})]})}),(0,Ce.jsxs)(xr,{align:"end",children:[(0,Ce.jsxs)(Ye,{onClick:()=>{ce("light"),p?.("light")},children:[(0,Ce.jsx)(ju,{className:"mr-2 h-4 w-4"}),"Light"]}),(0,Ce.jsxs)(Ye,{onClick:()=>{ce("dark"),p?.("dark")},children:[(0,Ce.jsx)(Hu,{className:"mr-2 h-4 w-4"}),"Dark"]}),(0,Ce.jsxs)(Ye,{onClick:()=>{ce("system"),p?.("system")},children:[(0,Ce.jsx)($u,{className:"mr-2 h-4 w-4"}),"System"]})]})]})),g&&!ze.isScrolled&&(0,Ce.jsxs)(Cr,{children:[(0,Ce.jsx)(Sr,{asChild:!0,children:(0,Ce.jsxs)(xe,{variant:"ghost",size:"icon",className:"relative",children:[(0,Ce.jsx)(Bd,{className:"h-5 w-5"}),g.count&&g.count>0&&(0,Ce.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] rounded-full bg-red-500 text-[11px] font-medium text-white flex items-center justify-center px-1",children:g.count>9?"9+":g.count})]})}),(0,Ce.jsxs)(xr,{align:"end",className:"w-[380px] p-0",sideOffset:8,children:[(0,Ce.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b",children:[(0,Ce.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Ce.jsx)("h4",{className:"text-base font-semibold",children:"Notifications"}),g.count&&g.count>0&&(0,Ce.jsxs)(ht,{variant:"secondary",className:"h-5 px-2 rounded-full bg-primary/10 text-primary border-0",children:[g.count," ","new"]})]}),g.items&&g.items.length>0&&(0,Ce.jsx)(xe,{variant:"ghost",size:"sm",className:"text-xs h-7 px-2 text-muted-foreground hover:text-foreground",onClick:Ue=>{Ue.preventDefault(),console.log("Mark all as read")},children:"Mark all read"})]}),(0,Ce.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:g.items&&g.items.length>0?(0,Ce.jsx)("div",{className:"py-1",children:g.items.map((Ue,Be)=>(0,Ce.jsxs)("div",{children:[(0,Ce.jsx)("button",{className:E("w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors","focus:outline-none focus:bg-muted/50",!Ue.read&&"bg-primary/5 hover:bg-primary/10"),onClick:()=>g.onNotificationClick?.(Ue.id),children:(0,Ce.jsxs)("div",{className:"flex gap-3",children:[(0,Ce.jsx)("div",{className:"mt-1.5",children:(0,Ce.jsx)("div",{className:E("h-2 w-2 rounded-full",Ue.read?"bg-transparent":"bg-primary")})}),(0,Ce.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,Ce.jsx)("p",{className:E("text-sm leading-tight",Ue.read?"font-normal":"font-medium"),children:Ue.title}),Ue.description&&(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:Ue.description}),Ue.time&&(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground/70 mt-1",children:Ue.time})]})]})}),Be<(g.items?.length||0)-1&&(0,Ce.jsx)("div",{className:"mx-4 border-b"})]},Ue.id))}):(0,Ce.jsxs)("div",{className:"py-12 text-center",children:[(0,Ce.jsx)(Bd,{className:"h-10 w-10 mx-auto text-muted-foreground/30 mb-3"}),(0,Ce.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"No new notifications"}),(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"You're all caught up!"})]})}),g.items&&g.items.length>0&&(0,Ce.jsx)("div",{className:"border-t p-2",children:(0,Ce.jsx)(xe,{variant:"ghost",className:"w-full h-8 text-xs text-muted-foreground hover:text-foreground",onClick:Ue=>{Ue.preventDefault(),console.log("View all notifications")},children:"View all notifications"})})]})]}),v&&!ze.isScrolled&&(0,Ce.jsx)(xe,{variant:v.variant||"primary",size:Q?"sm":We().buttonSize,onClick:()=>{if(v.action)v.action();else if(v.href)if(v.href.startsWith("#")){let Ue=document.querySelector(v.href);Ue&&Ue.scrollIntoView({behavior:"smooth",block:"start"})}else re?re(v.href):window.location.href=v.href},className:Q?"":"ml-2",children:v.text}),h&&!ze.isScrolled&&(0,Ce.jsxs)(Cr,{children:[(0,Ce.jsx)(Sr,{asChild:!0,children:(0,Ce.jsx)(xe,{variant:"ghost",size:"icon",className:"relative",children:(0,Ce.jsxs)(pa,{className:"h-8 w-8",children:[(0,Ce.jsx)(Si,{src:h.user?.avatar,alt:h.user?.name}),(0,Ce.jsx)(Oa,{children:h.user?.name?.charAt(0)||(0,Ce.jsx)(Hd,{className:"h-4 w-4"})})]})})}),(0,Ce.jsxs)(xr,{align:"end",className:"w-56",children:[h.user&&(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsxs)("div",{className:"p-2",children:[(0,Ce.jsx)("p",{className:"text-sm font-medium",children:h.user.name}),(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground",children:h.user.email})]}),(0,Ce.jsx)(qr,{})]}),h.items&&Ae(h.items)]})]})]})]})}):(0,Ce.jsxs)("div",{className:E("flex items-center transition-all duration-300 ease-in-out","transition-[height] duration-300 ease-in-out",De(),L==="floating-centered"?"w-full px-6":L==="minimal"||M?"w-full px-4 sm:px-6 lg:px-8":z==="sm"&&"container max-w-screen-sm"||z==="md"&&"container max-w-screen-md"||z==="lg"&&"container max-w-screen-lg"||z==="xl"&&"container max-w-screen-xl"||z==="2xl"&&"container max-w-screen-2xl"||z==="full"&&"w-full px-4 sm:px-6 lg:px-8"),children:[t&&(0,Ce.jsxs)("div",{className:E("flex items-center gap-2",V==="center"&&!Q&&L!=="floating-centered"?"absolute left-1/2 -translate-x-1/2":"mr-4"),children:[V==="left"&&N==="left"&&(0,Ce.jsx)(Te,{}),(0,Ce.jsxs)("a",{href:t.href||"/",onClick:Ue=>{t.href&&re&&(Ue.preventDefault(),re(t.href))},className:"flex items-center gap-2",children:[(0,Ce.jsx)(kt,{mode:"wait",children:(0,Ce.jsx)(me.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeInOut"},children:Oe()},`logo-${ze.isScrolled?"scrolled":"default"}-${Z?"dark":"light"}`)}),(0,Ce.jsx)(kt,{mode:"wait",children:t.title&&!Q&&!ze.isScrolled&&(0,Ce.jsx)(me.span,{className:E("font-semibold overflow-hidden",We().logoText),initial:{opacity:0,width:0},animate:{opacity:1,width:"auto"},exit:{opacity:0,width:0},transition:{duration:.2,ease:"easeInOut"},children:t.title},"logo-text")})]})]}),!Q&&!C&&(0,Ce.jsx)(gN,{className:E("hidden lg:flex",L==="minimal"&&"flex-1 w-full",q||!bt&&L==="minimal"?"flex-nowrap":"flex-wrap overflow-x-auto scrollbar-hide scroll-smooth",S==="center"&&L!=="floating-centered"&&"flex-1 justify-center mx-4",S==="center"&&L==="floating-centered"&&"flex-1 justify-center",S==="right"&&"ml-auto",S==="left"&&"ml-4",Pe&&D?.centerOnScroll&&S!=="center"&&"flex-1 justify-center",S==="center"&&L!=="floating-centered"&&"absolute left-1/2 transform -translate-x-1/2"),children:(0,Ce.jsx)(vN,{className:E(L==="minimal"&&"w-full justify-between gap-1"),children:e.map(Ue=>(0,Ce.jsx)(sl.default.Fragment,{children:Ue.items.map(Be=>{let He=Be.items&&Be.items.length>0,st=Be.href===Y;return He?(0,Ce.jsxs)(zw,{children:[(0,Ce.jsx)(bN,{className:E(st&&"bg-accent text-accent-foreground",Be.disabled&&"opacity-50 cursor-not-allowed"),disabled:Be.disabled,children:(0,Ce.jsxs)("span",{className:"flex items-center gap-2",children:[Be.icon&&(0,Ce.jsx)("span",{children:Be.icon}),Be.title]})}),(0,Ce.jsx)(xN,{children:Be.items&&be(Be.items)})]},Be.id):(0,Ce.jsx)(zw,{children:(0,Ce.jsxs)(wN,{className:E(yN(),"cursor-pointer",We().text,We().padding,st&&"bg-accent text-accent-foreground",Be.disabled&&"opacity-50 cursor-not-allowed"),onClick:()=>!Be.disabled&&Me(Be),children:[(0,Ce.jsxs)("span",{className:E("flex items-center",We().gap),children:[Be.icon&&(0,Ce.jsx)("span",{className:We().iconSize,children:Be.icon}),Be.title]}),Be.badge&&(0,Ce.jsx)(ht,{variant:Be.badgeVariant||"secondary",className:"ml-2",children:Be.badge})]})},Be.id)})},Ue.id))})}),(0,Ce.jsxs)("div",{className:"ml-auto flex items-center gap-1 sm:gap-2",children:[r&&!ze.isScrolled&&(0,Ce.jsx)(Ce.Fragment,{children:Q?(0,Ce.jsx)(xe,{variant:"ghost",size:"icon",onClick:()=>ee(!0),children:(0,Ce.jsx)($n,{className:"h-5 w-5"})}):(0,Ce.jsxs)("div",{className:"relative",children:[(0,Ce.jsx)($n,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,Ce.jsx)(Zt,{type:"search",placeholder:c,className:"w-64 pl-9 pr-4 h-9 cursor-pointer",value:X,onChange:Ue=>fe(Ue.target.value),onClick:()=>{n&&(ee(!0),i?.())},readOnly:n}),(x||n)&&(0,Ce.jsx)("kbd",{className:"absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 hidden sm:flex",children:n?o:(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)("span",{className:"text-xs",children:"\u2318"}),"K"]})})]})}),d&&(m==="button"?(0,Ce.jsx)(me.div,{whileTap:{scale:.95},className:"relative",children:(0,Ce.jsx)(xe,{variant:"ghost",size:We().buttonSize,onClick:()=>{let Ue=ne==="dark"?"light":"dark";ce(Ue),p?.(Ue)},className:"relative overflow-hidden",suppressHydrationWarning:!0,children:(0,Ce.jsx)(kt,{mode:"wait",children:ne==="dark"?(0,Ce.jsx)(me.div,{initial:{y:-20,opacity:0},animate:{y:0,opacity:1},exit:{y:20,opacity:0},transition:{duration:.2},suppressHydrationWarning:!0,children:(0,Ce.jsx)(Hu,{className:We().iconSize})},"moon"):(0,Ce.jsx)(me.div,{initial:{y:-20,opacity:0,rotate:-90},animate:{y:0,opacity:1,rotate:0},exit:{y:20,opacity:0,rotate:90},transition:{duration:.2},suppressHydrationWarning:!0,children:(0,Ce.jsx)(ju,{className:We().iconSize})},"sun")})})}):(0,Ce.jsxs)(Cr,{children:[(0,Ce.jsx)(Sr,{asChild:!0,children:(0,Ce.jsxs)(xe,{variant:"ghost",size:"icon",suppressHydrationWarning:!0,children:[ne==="light"&&(0,Ce.jsx)(ju,{className:"h-5 w-5"}),ne==="dark"&&(0,Ce.jsx)(Hu,{className:"h-5 w-5"}),ne==="system"&&(0,Ce.jsx)($u,{className:"h-5 w-5"})]})}),(0,Ce.jsxs)(xr,{align:"end",children:[(0,Ce.jsxs)(Ye,{onClick:()=>{ce("light"),p?.("light")},children:[(0,Ce.jsx)(ju,{className:"mr-2 h-4 w-4"}),"Light"]}),(0,Ce.jsxs)(Ye,{onClick:()=>{ce("dark"),p?.("dark")},children:[(0,Ce.jsx)(Hu,{className:"mr-2 h-4 w-4"}),"Dark"]}),(0,Ce.jsxs)(Ye,{onClick:()=>{ce("system"),p?.("system")},children:[(0,Ce.jsx)($u,{className:"mr-2 h-4 w-4"}),"System"]})]})]})),g&&!ze.isScrolled&&(0,Ce.jsxs)(Cr,{children:[(0,Ce.jsx)(Sr,{asChild:!0,children:(0,Ce.jsxs)(xe,{variant:"ghost",size:"icon",className:"relative",children:[(0,Ce.jsx)(Bd,{className:"h-5 w-5"}),g.count&&g.count>0&&(0,Ce.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] rounded-full bg-red-500 text-[11px] font-medium text-white flex items-center justify-center px-1",children:g.count>9?"9+":g.count})]})}),(0,Ce.jsxs)(xr,{align:"end",className:"w-[380px] p-0",sideOffset:8,children:[(0,Ce.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b",children:[(0,Ce.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Ce.jsx)("h4",{className:"text-base font-semibold",children:"Notifications"}),g.count&&g.count>0&&(0,Ce.jsxs)(ht,{variant:"secondary",className:"h-5 px-2 rounded-full bg-primary/10 text-primary border-0",children:[g.count," ","new"]})]}),g.items&&g.items.length>0&&(0,Ce.jsx)(xe,{variant:"ghost",size:"sm",className:"text-xs h-7 px-2 text-muted-foreground hover:text-foreground",onClick:Ue=>{Ue.preventDefault(),console.log("Mark all as read")},children:"Mark all read"})]}),(0,Ce.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:g.items&&g.items.length>0?(0,Ce.jsx)("div",{className:"py-1",children:g.items.map((Ue,Be)=>(0,Ce.jsxs)("div",{children:[(0,Ce.jsx)("button",{className:E("w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors","focus:outline-none focus:bg-muted/50",!Ue.read&&"bg-primary/5 hover:bg-primary/10"),onClick:()=>g.onNotificationClick?.(Ue.id),children:(0,Ce.jsxs)("div",{className:"flex gap-3",children:[(0,Ce.jsx)("div",{className:"mt-1.5",children:(0,Ce.jsx)("div",{className:E("h-2 w-2 rounded-full",Ue.read?"bg-transparent":"bg-primary")})}),(0,Ce.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,Ce.jsx)("p",{className:E("text-sm leading-tight",Ue.read?"font-normal":"font-medium"),children:Ue.title}),Ue.description&&(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:Ue.description}),Ue.time&&(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground/70 mt-1",children:Ue.time})]})]})}),Be<(g.items?.length||0)-1&&(0,Ce.jsx)("div",{className:"mx-4 border-b"})]},Ue.id))}):(0,Ce.jsxs)("div",{className:"py-12 text-center",children:[(0,Ce.jsx)(Bd,{className:"h-10 w-10 mx-auto text-muted-foreground/30 mb-3"}),(0,Ce.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"No new notifications"}),(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"You're all caught up!"})]})}),g.items&&g.items.length>0&&(0,Ce.jsx)("div",{className:"border-t p-2",children:(0,Ce.jsx)(xe,{variant:"ghost",className:"w-full h-8 text-xs text-muted-foreground hover:text-foreground",onClick:Ue=>{Ue.preventDefault(),console.log("View all notifications")},children:"View all notifications"})})]})]}),v&&!ze.isScrolled&&(0,Ce.jsx)(xe,{variant:v.variant||"primary",size:Q?"sm":We().buttonSize,onClick:()=>{if(v.action)v.action();else if(v.href)if(v.href.startsWith("#")){let Ue=document.querySelector(v.href);Ue&&Ue.scrollIntoView({behavior:"smooth",block:"start"})}else re?re(v.href):window.location.href=v.href},className:Q?"":"ml-2",children:v.text}),h&&!ze.isScrolled&&(0,Ce.jsxs)(Cr,{children:[(0,Ce.jsx)(Sr,{asChild:!0,children:(0,Ce.jsx)(xe,{variant:"ghost",size:"icon",className:"relative",children:(0,Ce.jsxs)(pa,{className:"h-8 w-8",children:[(0,Ce.jsx)(Si,{src:h.user?.avatar,alt:h.user?.name}),(0,Ce.jsx)(Oa,{children:h.user?.name?.charAt(0)||(0,Ce.jsx)(Hd,{className:"h-4 w-4"})})]})})}),(0,Ce.jsxs)(xr,{align:"end",className:"w-56",children:[h.user&&(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsxs)("div",{className:"p-2",children:[(0,Ce.jsx)("p",{className:"text-sm font-medium",children:h.user.name}),(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground",children:h.user.email})]}),(0,Ce.jsx)(qr,{})]}),h.items&&Ae(h.items)]})]})]})]}),w&&(0,Ce.jsx)(me.div,{className:"absolute inset-0 -z-10 opacity-30",animate:{background:["radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3), transparent 50%)","radial-gradient(circle at 80% 50%, rgba(120, 119, 198, 0.3), transparent 50%)","radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3), transparent 50%)"]},transition:{duration:10,repeat:1/0,ease:"linear"}}),T&&(0,Ce.jsx)("div",{className:E("absolute h-0.5 bg-muted transition-all",W?E("bottom-1 overflow-hidden",L==="floating-centered"&&"left-6 right-6",L==="floating"&&"left-4 right-4",(!L||L==="default")&&"left-2 right-2",L==="minimal"&&"left-2 right-2",L==="transparent"&&"left-2 right-2",L==="floating-auto-hide"&&"left-2 right-2",L==="floating-sticky"&&"left-2 right-2",j&&"rounded-b-lg",L==="floating-centered"&&"rounded-b-2xl",L==="floating"&&"rounded-b-lg"):"bottom-0 left-0 right-0"),children:(0,Ce.jsx)("div",{className:"h-full bg-primary transition-all duration-150",style:{width:`${ve}%`}})})]}),(0,Ce.jsxs)(OA,{open:J,onOpenChange:Ue=>{ee(Ue),Ue||s?.()},children:[(0,Ce.jsx)(Rh,{placeholder:n?a:c,value:X,onValueChange:fe}),(0,Ce.jsxs)(nN,{children:[(0,Ce.jsx)(Mh,{children:n?(0,Ce.jsxs)("div",{className:"flex flex-col items-center py-6",children:[(0,Ce.jsx)(jt,{className:"h-8 w-8 text-muted-foreground mb-2"}),(0,Ce.jsx)("p",{className:"text-sm text-muted-foreground",children:"No results found"}),(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Try searching for pages, actions, or commands"})]}):"No results found."}),n&&!X&&(0,Ce.jsxs)(op,{heading:"Quick Actions",children:[(0,Ce.jsxs)(Zu,{onSelect:()=>{let Ue={id:"home",title:"Go Home",href:"/"};l?.(Ue),Me(Ue),ee(!1)},children:[(0,Ce.jsx)(h0,{className:"mr-2 h-4 w-4"}),"Go Home",(0,Ce.jsx)("kbd",{className:"ml-auto text-xs",children:"\u2318H"})]}),(0,Ce.jsxs)(Zu,{onSelect:()=>{le(!0),ee(!1),l?.({id:"search",title:"Search",action:()=>le(!0)})},children:[(0,Ce.jsx)($n,{className:"mr-2 h-4 w-4"}),"Search",(0,Ce.jsx)("kbd",{className:"ml-auto text-xs",children:"\u2318S"})]}),d&&(0,Ce.jsxs)(Zu,{onSelect:()=>{p?.(f==="dark"?"light":"dark"),ee(!1)},children:[f==="dark"?(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)(ju,{className:"mr-2 h-4 w-4"}),"Switch to Light Mode"]}):(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)(Hu,{className:"mr-2 h-4 w-4"}),"Switch to Dark Mode"]}),(0,Ce.jsx)("kbd",{className:"ml-auto text-xs",children:"\u2318T"})]})]}),e&&e.length>0&&e.map(Ue=>{if(!Ue||!Ue.items||Ue.items.length===0)return null;let Be=X?Ue.items.filter(He=>He.title.toLowerCase().includes(X.toLowerCase())||He.description?.toLowerCase().includes(X.toLowerCase())):Ue.items;return Be.length===0?null:(0,Ce.jsx)(op,{heading:Ue.title||Ue.id,children:Be.map(He=>(0,Ce.jsxs)(Zu,{disabled:He.disabled,onSelect:()=>{n&&l?.(He),Me(He),ee(!1)},children:[(0,Ce.jsxs)("span",{className:"flex items-center gap-2",children:[He.icon&&(0,Ce.jsx)("span",{children:He.icon}),He.title]}),He.badge&&(0,Ce.jsx)(ht,{variant:He.badgeVariant||"secondary",className:"ml-auto",children:He.badge}),He.description&&n&&(0,Ce.jsx)("span",{className:"ml-2 text-xs text-muted-foreground",children:He.description})]},He.id))},Ue.id)}),n&&h?.items&&(0,Ce.jsx)(op,{heading:"Account",children:h.items.map(Ue=>(0,Ce.jsx)(Zu,{disabled:Ue.disabled,onSelect:()=>{let Be={...Ue,action:Ue.onClick||Ue.action};Be.action?Be.action():Be.href&&(window.location.href=Be.href),l?.(Be),ee(!1)},children:(0,Ce.jsxs)("span",{className:"flex items-center gap-2",children:[Ue.icon&&(0,Ce.jsx)("span",{children:Ue.icon}),Ue.title]})},Ue.id))})]})]}),de&&!G&&(0,Ce.jsx)("div",{className:E(ct()),"aria-hidden":"true"})]})}function l6e(e){let{hasProAccess:t,isLoading:r}=Ee();return!r&&!t?(0,Ce.jsx)(Ve,{componentName:"Advanced Navbar",className:E("w-full",e.className)}):(0,Ce.jsx)(KVt,{...e})}var Hne=_(ye(),1);var di=_(ye(),1),d6e=_(ue(),1),c6e=(0,di.createContext)(null),Kb=()=>{let e=(0,di.useContext)(c6e);if(!e)throw new Error("useFormWizard must be used within a FormWizardProvider");return e},u6e=({children:e,steps:t,initialStep:r=0,onStepChange:n,onComplete:o,validateOnStepChange:a=!0,allowBackNavigation:i=!0,allowStepSkip:s=!1,autoSave:l=!1,autoSaveDelay:c=2e3,onAutoSave:u,persistData:d=!1,storageKey:f="form-wizard-data"})=>{let[p,m]=(0,di.useState)(r),[h,g]=(0,di.useState)({}),[v,y]=(0,di.useState)(new Set),[b,w]=(0,di.useState)(!1),[x,C]=(0,di.useState)(null);(0,di.useEffect)(()=>{if(d&&typeof window<"u"){let k=localStorage.getItem(f);if(k)try{let T=JSON.parse(k);g(T.stepData||{}),m(T.currentStep||0),y(new Set(T.completedSteps||[]))}catch(T){console.error("Failed to load persisted wizard data:",T)}}},[d,f]),(0,di.useEffect)(()=>{if(!l||!u)return;let k=setTimeout(()=>{let T=h[t[p].id];T&&u(t[p].id,T)},c);return()=>clearTimeout(k)},[h,p,l,c,u,t]),(0,di.useEffect)(()=>{if(d&&typeof window<"u"){let k={stepData:h,currentStep:p,completedSteps:Array.from(v)};localStorage.setItem(f,JSON.stringify(k))}},[h,p,v,d,f]);let P=(0,di.useCallback)(async()=>{let k=t[p];if(k.requiredFields!==!1&&typeof window<"u"){let B=document.querySelector("[data-wizard-step-content]");if(B)if(Array.isArray(k.requiredFields)){let D=[];if(k.requiredFields.forEach(z=>{let M=B.querySelector(`[name="${z}"], [id="${z}"]`);if(M){let G=M;M.tagName==="INPUT"&&M.type==="checkbox"?M.checked||D.push(z):(!G.value||G.value.trim()==="")&&D.push(z)}}),D.length>0)return C(`Please fill in the following required fields: ${D.join(", ")}`),!1}else{let D=B.querySelectorAll("input[required], select[required], textarea[required]"),z=[];if(D.forEach(G=>{let q=G;if(!q.value||q.value.trim()===""){let H=document.querySelector(`label[for="${q.id}"]`),F=H?H.textContent?.replace(" *","")||"Field":q.name||q.id||"Field";z.push(F)}}),B.querySelectorAll('input[type="checkbox"][required]').forEach(G=>{let q=G;if(!q.checked){let H=document.querySelector(`label[for="${q.id}"]`),F=H?H.textContent?.replace(" *","")||"Checkbox":q.name||q.id||"Checkbox";z.push(F)}}),z.length>0)return C(`Please fill in the following required fields: ${z.join(", ")}`),!1}}if(!k.validation)return!0;w(!0),C(null);try{let B=await k.validation();if(typeof B=="boolean")return B||C("Please complete all required fields before proceeding"),B;if(typeof B=="object"&&B!==null&&"isValid"in B){let D=B;return D.isValid||(D.error?C(D.error):D.errors&&Array.isArray(D.errors)?C(D.errors.join(", ")):C("Please complete all required fields before proceeding")),D.isValid}return C("Invalid validation response"),!1}catch(B){return C(B instanceof Error?B.message:"Validation failed"),!1}finally{w(!1)}},[p,t]),R=(0,di.useCallback)((k,T)=>{g(B=>({...B,[k]:{...B[k],...T}})),C(null)},[]),L=(0,di.useCallback)(async k=>{if(k<0||k>=t.length||k===p)return;let T=t[k];if((typeof T.isDisabled=="function"?T.isDisabled(p,t):T.isDisabled)||a&&k>p&&!await P())return;let D=t[p];D.onExit&&await D.onExit(),k>p&&y(M=>new Set([...M,p])),T.onEnter&&await T.onEnter();let z=p;m(k),n?.(k,z)},[p,t,a,P,n]),$=(0,di.useCallback)(()=>{L(p+1)},[p,L]),I=(0,di.useCallback)(()=>{i&&L(p-1)},[p,L,i]),A=(0,di.useCallback)(async()=>{if(await P()&&(y(T=>new Set([...T,p])),o)){w(!0);try{await o(h),d&&typeof window<"u"&&localStorage.removeItem(f)}catch(T){C(T instanceof Error?T.message:"Failed to complete wizard")}finally{w(!1)}}},[p,h,P,o,d,f]),j=(0,di.useCallback)(()=>{m(0),g({}),y(new Set),C(null),d&&typeof window<"u"&&localStorage.removeItem(f)},[d,f]),V=(0,di.useCallback)(k=>v.has(k),[v]),S=(0,di.useCallback)(k=>{if(k===0||s)return!0;for(let T=0;T<k;T++)if(!v.has(T)&&!t[T].isOptional)return!1;return!0},[v,s,t]),N={steps:t,currentStep:p,stepData:h,isLoading:b,error:x,goToNext:$,goToPrevious:I,goToStep:L,updateStepData:k=>R(t[p].id,k),validateCurrentStep:P,completeWizard:A,resetWizard:j,isStepCompleted:V,isStepAccessible:S,canGoNext:p<t.length-1,canGoPrevious:i&&p>0};return(0,d6e.jsx)(c6e.Provider,{value:N,children:e})};var Ir=_(ue(),1),aj=({className:e,progressType:t="linear",orientation:r="horizontal",showStepNumbers:n=!0,showStepTitles:o=!0,stepIconPosition:a="top",completedStepIcon:i=(0,Ir.jsx)(Mo,{className:"w-5 h-5"}),activeStepIcon:s,errorStepIcon:l=(0,Ir.jsx)(eo,{className:"w-5 h-5"})})=>{let{steps:c,currentStep:u,isStepCompleted:d,isStepAccessible:f,error:p}=Kb();if(t==="linear")return(0,Ir.jsx)("div",{className:E("relative w-full",r==="vertical"?"flex flex-col space-y-8":"",e),children:r==="horizontal"?(0,Ir.jsx)("div",{className:"relative w-full",children:(0,Ir.jsxs)("div",{className:E("relative flex items-start justify-between w-full",a==="left"&&"pl-14"),children:[c.length>1&&(0,Ir.jsx)("div",{className:"absolute left-0 right-0 h-[2px] bg-border",style:{top:o?"calc(44px + 24px + 24px)":"24px",left:"calc(100% / 6)",right:"calc(100% / 6)"},children:(0,Ir.jsx)(me.div,{className:"absolute inset-0 bg-primary",initial:{scaleX:0},animate:{scaleX:u/(c.length-1)},transition:{duration:.5},style:{transformOrigin:"left"}})}),c.map((m,h)=>{let g=h===u,v=d(h),y=f(h),b=g&&p,w=typeof m.icon=="function"?m.icon({isActive:g,isCompleted:v}):m.icon;return(0,Ir.jsxs)("div",{className:"relative flex-1 flex flex-col items-center",children:[a==="left"&&w&&(0,Ir.jsx)("div",{className:"absolute -left-12 top-1/2 -translate-y-1/2 flex items-center justify-center",children:(0,Ir.jsx)("span",{className:E("w-8 h-8 flex items-center justify-center transition-colors",g&&"text-primary",v&&!g&&"text-primary",!g&&!v&&"text-muted-foreground"),children:w})}),a==="top"&&w&&(0,Ir.jsx)("div",{className:"flex items-center justify-center mb-2",children:(0,Ir.jsx)("span",{className:E("w-8 h-8 flex items-center justify-center transition-colors",g&&"text-primary",v&&!g&&"text-primary",!g&&!v&&"text-muted-foreground"),children:w})}),o&&(0,Ir.jsx)("div",{className:"mb-3 min-h-[44px] flex items-center justify-center text-center w-full",children:(0,Ir.jsx)("p",{className:E("text-sm font-semibold transition-colors whitespace-nowrap",g&&"text-primary",v&&!g&&"text-primary",!g&&!v&&"text-muted-foreground"),children:m.title})}),(0,Ir.jsx)("div",{className:"flex justify-center",children:(0,Ir.jsx)(me.div,{initial:{scale:.8},animate:{scale:g?1.05:1},transition:{duration:.2},className:E("relative z-10 flex items-center justify-center rounded-full transition-all duration-300","w-12 h-12 border-2",g&&"border-primary bg-primary text-primary-foreground shadow-lg shadow-primary/20",v&&!g&&"border-primary bg-primary text-primary-foreground",!g&&!v&&y&&"border-border bg-background text-muted-foreground hover:border-accent",!y&&"border-border/50 bg-muted text-muted-foreground/50 cursor-not-allowed",b&&"border-destructive bg-destructive text-destructive-foreground"),children:b?l:v&&!g?i:g&&s?s:w&&a==="inside"?(0,Ir.jsx)("span",{className:"w-5 h-5 flex items-center justify-center",children:w}):n?(0,Ir.jsx)("span",{className:"text-sm font-semibold",children:h+1}):(0,Ir.jsx)(Bu,{className:"w-4 h-4"})})}),(0,Ir.jsx)("div",{className:"mt-3 text-center",children:(0,Ir.jsxs)("p",{className:"text-xs text-muted-foreground font-medium whitespace-nowrap",children:["Step ",h+1," of"," ",c.length]})})]},m.id)})]})}):(0,Ir.jsxs)("div",{className:"relative pl-12",children:[c.length>1&&(0,Ir.jsxs)(Ir.Fragment,{children:[(0,Ir.jsx)("div",{className:"absolute left-6 top-8 bottom-8 w-[2px] bg-border"}),(0,Ir.jsx)(me.div,{className:"absolute left-6 top-8 w-[2px] bg-primary",initial:{height:0},animate:{height:`${u/(c.length-1)*(100-16)}%`},transition:{duration:.5}})]}),c.map((m,h)=>{let g=h===u,v=d(h),y=f(h),b=g&&p,w=typeof m.icon=="function"?m.icon({isActive:g,isCompleted:v}):m.icon;return(0,Ir.jsxs)("div",{className:"relative flex items-center mb-8 last:mb-0",children:[(0,Ir.jsx)(me.div,{initial:{scale:.8},animate:{scale:g?1.05:1},className:E("relative left-0 mt-5 z-20 flex items-center justify-center rounded-full border-2 transition-all duration-300","w-12 h-12",g&&"border-primary bg-primary text-primary-foreground shadow-lg",v&&!g&&"border-primary bg-primary text-primary-foreground",!g&&!v&&y&&"border-border bg-background text-muted-foreground hover:border-accent",!y&&"border-border/50 bg-muted text-muted-foreground/50 cursor-not-allowed",b&&"border-destructive bg-destructive text-destructive-foreground"),children:b?l:v&&!g?i:g&&s?s:w?(0,Ir.jsx)("span",{className:"w-5 h-5 flex items-center justify-center",children:w}):n?(0,Ir.jsx)("span",{className:"text-sm font-semibold",children:h+1}):(0,Ir.jsx)(Bu,{className:"w-4 h-4"})}),(0,Ir.jsx)("div",{style:{marginLeft:"12px"},children:o&&(0,Ir.jsxs)(Ir.Fragment,{children:[(0,Ir.jsx)("p",{className:E("text-sm font-semibold transition-colors",g&&"text-primary",v&&!g&&"text-primary",!g&&!v&&"text-muted-foreground"),children:m.title}),m.description&&(0,Ir.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:m.description})]})})]},m.id)})]})});if(t==="dots")return(0,Ir.jsx)("div",{className:E("flex items-center justify-center space-x-2",e),children:c.map((m,h)=>{let g=h===u,v=d(h);return(0,Ir.jsx)(me.div,{initial:{scale:.8},animate:{scale:g?1.2:1},className:E("rounded-full transition-all duration-300",g?"w-3 h-3 bg-primary":"w-2 h-2",v&&!g&&"bg-primary/60",!g&&!v&&"bg-muted")},h)})});if(t==="circular"){let m=(u+1)/c.length*100,h=2*Math.PI*45,g=h-m/100*h;return(0,Ir.jsxs)("div",{className:E("relative w-36 h-36 mx-auto",e),children:[(0,Ir.jsxs)("svg",{className:"w-full h-full -rotate-90",viewBox:"0 0 144 144",children:[(0,Ir.jsx)("circle",{cx:"72",cy:"72",r:"45",fill:"none",stroke:"currentColor",strokeWidth:"8",className:"text-border"}),(0,Ir.jsx)(me.circle,{cx:"72",cy:"72",r:"45",fill:"none",stroke:"currentColor",strokeWidth:"8",strokeDasharray:h,initial:{strokeDashoffset:h},animate:{strokeDashoffset:g},className:"text-primary",transition:{duration:.5}})]}),(0,Ir.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,Ir.jsxs)("div",{className:"text-center",children:[(0,Ir.jsx)("p",{className:"text-3xl font-bold",children:u+1}),(0,Ir.jsxs)("p",{className:"text-sm text-muted-foreground",children:["of ",c.length]})]})})]})}return null};var ij=_(ye(),1);var Yb=_(ue(),1),YVt={slide:{initial:e=>({x:e>0?1e3:-1e3,opacity:0}),animate:{x:0,opacity:1},exit:e=>({x:e<0?1e3:-1e3,opacity:0})},fade:{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},scale:{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8}},none:{initial:{},animate:{},exit:{}}},sj=({className:e,animationType:t="slide",animationDuration:r=.3})=>{let{steps:n,currentStep:o,goToNext:a,goToPrevious:i,goToStep:s,updateStepData:l,stepData:c,error:u}=Kb(),[d,f]=ij.default.useState(0),p=ij.default.useRef(o);ij.default.useEffect(()=>{f(o>p.current?1:-1),p.current=o},[o]);let m=n[o],h=o===0,g=o===n.length-1,v={currentStep:o,totalSteps:n.length,goToNext:a,goToPrevious:i,goToStep:s,isFirstStep:h,isLastStep:g,stepData:c[m.id]||{},updateStepData:b=>l(m.id,b)},y=typeof m.content=="function"?m.content(v):m.content;return(0,Yb.jsx)(kt,{mode:"wait",custom:d,children:(0,Yb.jsx)(me.div,{custom:d,variants:YVt[t],initial:"initial",animate:"animate",exit:"exit",transition:{duration:r,ease:"easeInOut"},className:E("w-full",e),"data-wizard-step-content":!0,children:(0,Yb.jsxs)("div",{className:"space-y-4",children:[u&&(0,Yb.jsxs)(S0,{variant:"error",children:[(0,Yb.jsx)(Pn,{className:"h-4 w-4"}),(0,Yb.jsx)(P0,{children:u})]}),y]})},o)})};var ll=_(ue(),1),lj=({className:e,showStepIndicator:t=!0,previousText:r="Previous",nextText:n="Next",completeText:o="Complete",loadingText:a="Processing...",onPreviousClick:i,onNextClick:s,onCompleteClick:l})=>{let{steps:c,currentStep:u,isLoading:d,canGoNext:f,canGoPrevious:p,goToNext:m,goToPrevious:h,completeWizard:g}=Kb(),v=u===c.length-1,y=c[u],b=()=>{i?.(),h()},w=()=>{v?(l?.(),g()):(s?.(),m())};return(0,ll.jsxs)("div",{className:E("flex items-center justify-between",e),children:[(0,ll.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ll.jsxs)(xe,{type:"button",variant:"outline",onClick:b,disabled:!p||d,className:E("transition-all duration-200",!p&&"invisible"),children:[(0,ll.jsx)(Za,{className:"w-4 h-4 mr-1"}),r]}),t&&(0,ll.jsxs)(me.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"px-3 py-1 text-sm text-muted-foreground",children:["Step ",u+1," of ",c.length,y.isOptional&&(0,ll.jsx)("span",{className:"ml-1 text-xs",children:"(Optional)"})]})]}),(0,ll.jsx)(xe,{type:"button",onClick:w,disabled:d||!f&&!v,className:"min-w-[120px]",children:d?(0,ll.jsxs)(ll.Fragment,{children:[(0,ll.jsx)(Nr,{className:"w-4 h-4 mr-2 animate-spin"}),a]}):v?(0,ll.jsxs)(ll.Fragment,{children:[(0,ll.jsx)(Qr,{className:"w-4 h-4 mr-2"}),o]}):(0,ll.jsxs)(ll.Fragment,{children:[n,(0,ll.jsx)(Sn,{className:"w-4 h-4 ml-1"})]})})]})};var fi=_(ue(),1),f6e=Hne.default.forwardRef(({steps:e,currentStep:t=0,onStepChange:r,onComplete:n,orientation:o="horizontal",progressType:a="linear",allowStepSkip:i=!1,allowBackNavigation:s=!0,validateOnStepChange:l=!0,animationType:c="slide",animationDuration:u=.3,showStepNumbers:d=!0,showStepTitles:f=!0,showProgressBar:p=!0,stepIconPosition:m="top",completedStepIcon:h,activeStepIcon:g,errorStepIcon:v,className:y,progressClassName:b,navigationClassName:w,contentClassName:x,stepClassName:C,autoSave:P=!1,autoSaveDelay:R=2e3,onAutoSave:L,persistData:$=!1,storageKey:I="form-wizard-data"},A)=>(0,fi.jsx)(u6e,{steps:e,initialStep:t,onStepChange:r,onComplete:n,validateOnStepChange:l,allowBackNavigation:s,allowStepSkip:i,autoSave:P,autoSaveDelay:R,onAutoSave:L,persistData:$,storageKey:I,children:(0,fi.jsxs)("div",{ref:A,className:E("w-full",y),children:[p&&(0,fi.jsx)(fi.Fragment,{children:(0,fi.jsx)(aj,{className:E("mb-12",b),progressType:a,orientation:o,showStepNumbers:d,showStepTitles:f,stepIconPosition:m,completedStepIcon:h,activeStepIcon:g,errorStepIcon:v})}),(0,fi.jsx)(Ze,{className:E("border-0 shadow-none",x),children:(0,fi.jsx)(tt,{className:"p-0",children:(0,fi.jsx)(sj,{className:C,animationType:c,animationDuration:u})})}),(0,fi.jsx)(lj,{className:E("mt-8",w)})]})}));f6e.displayName="FormWizardInternal";var uD=Hne.default.forwardRef((e,t)=>{let{hasProAccess:r,isLoading:n}=Ee();return!n&&!r?(0,fi.jsx)(Ze,{className:E("w-full",e.className),children:(0,fi.jsx)(tt,{className:"py-12 text-center",children:(0,fi.jsxs)("div",{className:"max-w-md mx-auto space-y-4",children:[(0,fi.jsx)("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:(0,fi.jsx)(Qt,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),(0,fi.jsxs)("div",{children:[(0,fi.jsx)("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),(0,fi.jsx)("p",{className:"text-muted-foreground text-sm mb-4",children:"Form Wizard is available exclusively to MoonUI Pro subscribers."}),(0,fi.jsx)("a",{href:"/pricing",children:(0,fi.jsxs)(xe,{size:"sm",children:[(0,fi.jsx)(jt,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})]})]})})}):(0,fi.jsx)(f6e,{...e,ref:t})});uD.displayName="MoonUIFormWizardPro";var XVt=uD;var xd=_(ye(),1);var Tt=_(ue(),1);function p6e(e){let t=[...e];for(let r=t.length-1;r>0;r--){let n=Math.floor(Math.random()*(r+1));[t[r],t[n]]=[t[n],t[r]]}return t}var JVt=({title:e,description:t,questions:r,onComplete:n,showTimer:o=!0,totalTimeLimit:a,showProgress:i=!0,showQuestionNumbers:s=!0,allowReview:l=!0,allowSkip:c=!0,shuffleQuestions:u=!1,shuffleOptions:d=!1,passingScore:f=70,instantFeedback:p=!1,showHints:m=!1,className:h})=>{let[g]=(0,xd.useState)(()=>u?p6e(r):r),[v,y]=(0,xd.useState)({}),[b,w]=(0,xd.useState)([]),[x,C]=(0,xd.useState)(a||0),[P,R]=(0,xd.useState)({}),[L,$]=(0,xd.useState)(!1),[I,A]=(0,xd.useState)(0);(0,xd.useEffect)(()=>{if(!o||!a||L)return;let k=setInterval(()=>{C(T=>T<=1?(V(),0):T-1)},1e3);return()=>clearInterval(k)},[o,a,L]),(0,xd.useEffect)(()=>{if(!o||L)return;let k=setInterval(()=>{A(T=>T+1)},1e3);return()=>clearInterval(k)},[o,L]);let j=(0,xd.useCallback)(()=>{let k=0,T=0;return{results:g.map(D=>{let z=v[D.id],M=D.points||1;T+=M;let G=!1;if(z!=null&&z!==""){if(D.type==="single-choice"||D.type==="true-false")G=z===D.correctAnswer;else if(D.type==="multiple-choice"){let H=Array.isArray(z)?z:[],F=Array.isArray(D.correctAnswer)?D.correctAnswer:[];G=H.length===F.length&&H.every(W=>F.includes(W))}}let q=G?M:0;return k+=q,{questionId:D.id,answer:z,isCorrect:G,points:q,timeSpent:P[D.id]||0}}),score:k,totalScore:T}},[g,v,P]),V=async()=>{let{results:k,score:T,totalScore:B}=j();w(k),$(!0),n&&await n(k,T,B)},S=k=>{let T=Math.floor(k/60),B=k%60;return`${T}:${B.toString().padStart(2,"0")}`},N=g.map((k,T)=>({id:k.id,title:`Question ${T+1}`,description:k.tags?.join(", "),content:({updateStepData:B,goToNext:D})=>{let z=v[k.id],M=d&&k.options?p6e(k.options):k.options;(0,xd.useEffect)(()=>{P[k.id]||R(q=>({...q,[k.id]:I}))},[]);let G=q=>{y(H=>({...H,[k.id]:q})),p&&k.type};return(0,Tt.jsxs)(Ze,{className:"border-0 shadow-none",children:[(0,Tt.jsxs)(wr,{children:[(0,Tt.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[s&&(0,Tt.jsxs)(ht,{variant:"secondary",children:["Question ",T+1," of ",g.length]}),k.points&&k.points>1&&(0,Tt.jsxs)(ht,{variant:"outline",children:[k.points," points"]})]}),(0,Tt.jsx)(zr,{className:"text-xl",children:k.question}),k.description&&(0,Tt.jsx)(Zi,{children:k.description})]}),(0,Tt.jsxs)(tt,{className:"space-y-4",children:[k.image&&(0,Tt.jsx)("img",{src:k.image,alt:"Question illustration",className:"w-full rounded-lg"}),k.type==="single-choice"&&M&&(0,Tt.jsx)(Rw,{value:z||"",onValueChange:G,children:M.map((q,H)=>(0,Tt.jsxs)(me.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:H*.1},className:"flex items-center space-x-2 p-3 rounded-lg hover:bg-muted/50 transition-colors",children:[(0,Tt.jsx)(kv,{value:String(q.value),id:`${k.id}-${q.value}`}),(0,Tt.jsx)(Lt,{htmlFor:`${k.id}-${q.value}`,className:"flex-1 cursor-pointer",children:q.label||q.value})]},String(q.value)))}),k.type==="multiple-choice"&&M&&(0,Tt.jsx)("div",{className:"space-y-2",children:M.map((q,H)=>(0,Tt.jsxs)(me.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:H*.1},className:"flex items-center space-x-2 p-3 rounded-lg hover:bg-muted/50 transition-colors",children:[(0,Tt.jsx)(Wl,{id:`${k.id}-${q.value}`,checked:(z||[]).includes(q.value),onCheckedChange:F=>{let W=z||[];G(F?[...W,q.value]:W.filter(U=>U!==q.value))}}),(0,Tt.jsx)(Lt,{htmlFor:`${k.id}-${q.value}`,className:"flex-1 cursor-pointer",children:q.label||q.value})]},String(q.value)))}),k.type==="true-false"&&(0,Tt.jsxs)(Rw,{value:z?.toString()||"",onValueChange:q=>G(q==="true"),children:[(0,Tt.jsxs)("div",{className:"flex items-center space-x-2 p-3 rounded-lg hover:bg-muted/50",children:[(0,Tt.jsx)(kv,{value:"true",id:`${k.id}-true`}),(0,Tt.jsx)(Lt,{htmlFor:`${k.id}-true`,className:"flex-1 cursor-pointer",children:"True"})]}),(0,Tt.jsxs)("div",{className:"flex items-center space-x-2 p-3 rounded-lg hover:bg-muted/50",children:[(0,Tt.jsx)(kv,{value:"false",id:`${k.id}-false`}),(0,Tt.jsx)(Lt,{htmlFor:`${k.id}-false`,className:"flex-1 cursor-pointer",children:"False"})]})]}),k.type==="text"&&(0,Tt.jsx)(su,{value:z||"",onChange:q=>G(q.target.value),placeholder:"Type your answer here...",className:"min-h-[120px]"}),k.type==="rating"&&(0,Tt.jsxs)("div",{className:"space-y-4",children:[(0,Tt.jsx)(Z0,{value:[z||5],onValueChange:([q])=>G(q),max:10,min:1,step:1,className:"w-full"}),(0,Tt.jsxs)("div",{className:"text-center text-2xl font-bold",children:[z||5,"/10"]})]}),m&&k.hint&&(0,Tt.jsx)(S0,{children:(0,Tt.jsxs)(P0,{children:[(0,Tt.jsx)("strong",{children:"Hint:"})," ",k.hint]})})]})]})},validation:()=>!(k.required&&!v[k.id]),isOptional:!k.required}));if(L){let{score:k,totalScore:T}=j(),B=Math.round(k/T*100),D=B>=f;return(0,Tt.jsx)(me.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:E("w-full max-w-2xl mx-auto",h),children:(0,Tt.jsxs)(Ze,{children:[(0,Tt.jsxs)(wr,{className:"text-center",children:[(0,Tt.jsx)("div",{className:"mx-auto mb-4",children:(0,Tt.jsx)(jT,{className:E("w-16 h-16",D?"text-yellow-500":"text-muted-foreground")})}),(0,Tt.jsx)(zr,{className:"text-3xl",children:"Quiz Complete!"}),(0,Tt.jsx)(Zi,{children:"Here's how you performed"})]}),(0,Tt.jsxs)(tt,{className:"space-y-6",children:[(0,Tt.jsxs)("div",{className:"text-center",children:[(0,Tt.jsxs)("div",{className:"text-5xl font-bold mb-2",children:[B,"%"]}),(0,Tt.jsx)(bo,{value:B,className:"h-3 mb-4"}),(0,Tt.jsxs)("div",{className:"flex justify-between text-sm text-muted-foreground",children:[(0,Tt.jsxs)("span",{children:["Score: ",k,"/",T]}),(0,Tt.jsx)("span",{children:D?(0,Tt.jsx)(ht,{variant:"success",children:"Passed"}):(0,Tt.jsx)(ht,{variant:"destructive",children:"Failed"})})]})]}),l&&(0,Tt.jsxs)("div",{className:"space-y-2",children:[(0,Tt.jsx)("h3",{className:"font-semibold",children:"Review Answers"}),b.map((z,M)=>{let G=g.find(q=>q.id===z.questionId);return(0,Tt.jsxs)("div",{className:"flex items-center justify-between p-2 rounded-lg bg-muted/50",children:[(0,Tt.jsxs)("span",{className:"text-sm",children:[s&&`Q${M+1}: `,G?.question.substring(0,50),"..."]}),(0,Tt.jsxs)(ht,{variant:z.isCorrect?"success":"destructive",children:[z.points,"/",G?.points||1]})]},z.questionId)})]}),(0,Tt.jsxs)("div",{className:"flex gap-2",children:[(0,Tt.jsxs)(xe,{className:"flex-1",onClick:()=>window.location.reload(),children:[(0,Tt.jsx)(dv,{className:"w-4 h-4 mr-2"}),"Retake Quiz"]}),(0,Tt.jsxs)(xe,{variant:"outline",children:[(0,Tt.jsx)(vn,{className:"w-4 h-4 mr-2"}),"Download Results"]}),(0,Tt.jsxs)(xe,{variant:"outline",children:[(0,Tt.jsx)(fv,{className:"w-4 h-4 mr-2"}),"Share"]})]})]})]})})}return(0,Tt.jsxs)("div",{className:E("w-full",h),children:[o&&a&&(0,Tt.jsxs)("div",{className:"mb-6 flex items-center justify-between",children:[(0,Tt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Tt.jsx)(cn,{className:"w-4 h-4"}),(0,Tt.jsxs)("span",{className:"text-sm font-medium",children:["Time Remaining: ",S(x)]})]}),(0,Tt.jsx)(bo,{value:x/a*100,className:"w-32 h-2"})]}),(0,Tt.jsx)(uD,{steps:N,onComplete:V,allowStepSkip:c,validateOnStepChange:!0,showProgressBar:i,progressType:"dots",animationType:"slide"})]})},QVt=e=>{let{hasProAccess:t,isLoading:r}=Ee();return!r&&!t?(0,Tt.jsx)(Ze,{className:E("w-full",e.className),children:(0,Tt.jsx)(tt,{className:"py-12 text-center",children:(0,Tt.jsxs)("div",{className:"max-w-md mx-auto space-y-4",children:[(0,Tt.jsx)("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:(0,Tt.jsx)(Qt,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),(0,Tt.jsxs)("div",{children:[(0,Tt.jsx)("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),(0,Tt.jsx)("p",{className:"text-muted-foreground text-sm mb-4",children:"Quiz Form is available exclusively to MoonUI Pro subscribers."}),(0,Tt.jsx)("a",{href:"/pricing",children:(0,Tt.jsxs)(xe,{size:"sm",children:[(0,Tt.jsx)(jt,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})]})]})})}):(0,Tt.jsx)(JVt,{...e})},ZVt=QVt;var wd=_(ye(),1);var Gr=_(ue(),1),e$t={visa:/^4/,mastercard:/^5[1-5]/,amex:/^3[47]/,discover:/^6(?:011|5)/,diners:/^3(?:0[0-5]|[68])/,jcb:/^35/,unionpay:/^62/};function t$t(e,t){let r=e.replace(/\s+/g,"").replace(/[^0-9]/gi,""),n=t==="amex"?r.match(/\d{1,4}/g):r.match(/\d{1,4}/g);return n?n.join(" "):r}function r$t(e){let t=e.replace(/\s+/g,"").replace(/[^0-9]/gi,"");return t.length>=2?t.slice(0,2)+(t.length>2?"/"+t.slice(2,4):""):t}function n$t(e){let t=e.replace(/\s+/g,"");for(let[r,n]of Object.entries(e$t))if(n.test(t))return r;return null}function o$t(e){let t=e.replace(/\s+/g,"");if(!/^\d+$/.test(t))return!1;let r=0,n=!1;for(let o=t.length-1;o>=0;o--){let a=parseInt(t.charAt(o),10);n&&(a*=2,a>9&&(a-=9)),r+=a,n=!n}return r%10===0}function a$t(e){let t=e.split("/");if(t.length!==2)return!1;let r=parseInt(t[0],10),n=parseInt("20"+t[1],10);if(r<1||r>12)return!1;let o=new Date;return new Date(n,r-1)>o}var m6e=wd.default.forwardRef(({value:e={number:"",expiry:"",cvc:"",name:""},onChange:t,showCardPreview:r=!0,showCardType:n=!0,showSecurityBadge:o=!0,autoFormat:a=!0,validateOnChange:i=!1,labels:s={},placeholders:l={},errors:c={},className:u,inputClassName:d,labelClassName:f,errorClassName:p,disabled:m,required:h,...g},v)=>{let[y,b]=(0,wd.useState)(null),[w,x]=(0,wd.useState)(null),[C,P]=(0,wd.useState)({}),R=(0,wd.useRef)(null),L=(0,wd.useRef)(null),$=(0,wd.useRef)(null),I=(0,wd.useRef)(null);(0,wd.useEffect)(()=>{let V=n$t(e.number);b(V)},[e.number]),(0,wd.useEffect)(()=>{if(!i)return;let V={};e.number&&!o$t(e.number)&&(V.number="Invalid card number"),e.expiry&&!a$t(e.expiry)&&(V.expiry="Invalid expiry date"),e.cvc&&(e.cvc.length<3||e.cvc.length>4)&&(V.cvc="Invalid CVC"),P(V)},[e,i]);let A=(V,S)=>{let N=S;if(a){if(V==="number"){N=t$t(S,y||void 0);let k=y==="amex"?18:19;if(N.length>k)return}else if(V==="expiry"){if(N=r$t(S),N.length>5)return}else if(V==="cvc"){N=S.replace(/\D/g,"");let k=y==="amex"?4:3;if(N.length>k)return}}t?.({...e,[V]:N}),a&&(V==="number"&&N.length===(y==="amex"?18:19)?L.current?.focus():V==="expiry"&&N.length===5?$.current?.focus():V==="cvc"&&N.length===(y==="amex"?4:3)&&I.current?.focus())},j={...C,...c};return(0,Gr.jsxs)("div",{ref:v,className:E("space-y-4",u),...g,children:[r&&(0,Gr.jsxs)(me.div,{className:"relative w-full max-w-md mx-auto h-48 rounded-xl bg-gradient-to-r from-blue-600 to-purple-600 dark:from-blue-700 dark:to-purple-700 p-6 text-white shadow-xl overflow-hidden",initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{duration:.3},children:[(0,Gr.jsxs)("div",{className:"flex justify-between items-start mb-8",children:[(0,Gr.jsx)("div",{className:"text-lg font-semibold",children:y?y.toUpperCase():"CARD"}),(0,Gr.jsx)(av,{className:"w-8 h-8 text-white/80"})]}),(0,Gr.jsxs)("div",{className:"space-y-4",children:[(0,Gr.jsx)("div",{className:"text-xl font-mono tracking-wider",children:e.number||"\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022"}),(0,Gr.jsxs)("div",{className:"flex justify-between",children:[(0,Gr.jsxs)("div",{children:[(0,Gr.jsx)("div",{className:"text-xs text-white/70",children:"NAME"}),(0,Gr.jsx)("div",{className:"text-sm uppercase",children:e.name||"YOUR NAME"})]}),(0,Gr.jsxs)("div",{children:[(0,Gr.jsx)("div",{className:"text-xs text-white/70",children:"EXPIRES"}),(0,Gr.jsx)("div",{className:"text-sm",children:e.expiry||"MM/YY"})]})]})]})]}),(0,Gr.jsxs)("div",{className:"space-y-4",children:[(0,Gr.jsxs)("div",{className:"space-y-1",children:[(0,Gr.jsxs)(Lt,{htmlFor:"card-number",className:f,children:[s.number||"Card Number",h&&(0,Gr.jsx)("span",{className:"text-destructive ml-1",children:"*"})]}),(0,Gr.jsxs)("div",{className:"relative",children:[(0,Gr.jsx)(Zt,{ref:R,id:"card-number",type:"text",inputMode:"numeric",value:e.number,onChange:V=>A("number",V.target.value),onFocus:()=>x("number"),onBlur:()=>x(null),placeholder:l.number||"1234 5678 9012 3456",className:E("pr-20",j.number&&"border-destructive",d),disabled:m}),n&&y&&(0,Gr.jsx)("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm font-medium text-muted-foreground",children:y.toUpperCase()})]}),j.number&&(0,Gr.jsx)("p",{className:E("text-sm text-destructive",p),children:j.number})]}),(0,Gr.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Gr.jsxs)("div",{className:"space-y-1",children:[(0,Gr.jsxs)(Lt,{htmlFor:"card-expiry",className:f,children:[s.expiry||"Expiry Date",h&&(0,Gr.jsx)("span",{className:"text-destructive ml-1",children:"*"})]}),(0,Gr.jsx)(Zt,{ref:L,id:"card-expiry",type:"text",inputMode:"numeric",value:e.expiry,onChange:V=>A("expiry",V.target.value),onFocus:()=>x("expiry"),onBlur:()=>x(null),placeholder:l.expiry||"MM/YY",className:E(j.expiry&&"border-destructive",d),disabled:m}),j.expiry&&(0,Gr.jsx)("p",{className:E("text-sm text-destructive",p),children:j.expiry})]}),(0,Gr.jsxs)("div",{className:"space-y-1",children:[(0,Gr.jsxs)(Lt,{htmlFor:"card-cvc",className:f,children:[s.cvc||"CVC",h&&(0,Gr.jsx)("span",{className:"text-destructive ml-1",children:"*"})]}),(0,Gr.jsxs)("div",{className:"relative",children:[(0,Gr.jsx)(Zt,{ref:$,id:"card-cvc",type:"text",inputMode:"numeric",value:e.cvc,onChange:V=>A("cvc",V.target.value),onFocus:()=>x("cvc"),onBlur:()=>x(null),placeholder:l.cvc||y==="amex"?"1234":"123",className:E(j.cvc&&"border-destructive",d),disabled:m}),o&&(0,Gr.jsx)(Qt,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"})]}),j.cvc&&(0,Gr.jsx)("p",{className:E("text-sm text-destructive",p),children:j.cvc})]})]}),(0,Gr.jsxs)("div",{className:"space-y-1",children:[(0,Gr.jsx)(Lt,{htmlFor:"card-name",className:f,children:s.name||"Cardholder Name"}),(0,Gr.jsx)(Zt,{ref:I,id:"card-name",type:"text",value:e.name,onChange:V=>A("name",V.target.value),onFocus:()=>x("name"),onBlur:()=>x(null),placeholder:l.name||"John Doe",className:E(j.name&&"border-destructive",d),disabled:m}),j.name&&(0,Gr.jsx)("p",{className:E("text-sm text-destructive",p),children:j.name})]})]}),o&&(0,Gr.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,Gr.jsx)(Qt,{className:"w-4 h-4"}),(0,Gr.jsx)("span",{children:"Your payment information is secure and encrypted"})]})]})});m6e.displayName="MoonUICreditCardInputPro";var ac=_(ye(),1);var lt=_(ue(),1),h6e=gt("relative w-full rounded-lg border bg-card text-card-foreground shadow-sm",{variants:{variant:{default:"border-border",exam:"border-primary/20 bg-primary/5",personality:"border-secondary/20 bg-secondary/5"},size:{sm:"p-4",md:"p-6",lg:"p-8"}},defaultVariants:{variant:"default",size:"md"}}),g6e=ac.default.forwardRef(({className:e,variant:t,size:r,questions:n,settings:o={},onComplete:a,onProgress:i,title:s,description:l,...c},u)=>{let[d,f]=(0,ac.useState)([]),[p,m]=(0,ac.useState)(0),[h,g]=(0,ac.useState)({}),[v,y]=(0,ac.useState)(!1),[b,w]=(0,ac.useState)(null),[x,C]=(0,ac.useState)(o.timeLimit?o.timeLimit*60:null),[P,R]=(0,ac.useState)(Date.now()),[L,$]=(0,ac.useState)(!1),[I,A]=(0,ac.useState)(0);(0,ac.useEffect)(()=>{let q=[...n];o.shuffleQuestions&&(q=V(q)),o.shuffleOptions&&(q=q.map(H=>H.options?{...H,options:V([...H.options])}:H)),f(q)},[n,o.shuffleQuestions,o.shuffleOptions]),(0,ac.useEffect)(()=>{if(x===null||x<=0||v)return;let q=setInterval(()=>{C(H=>H===null||H<=1?(T(),0):H-1)},1e3);return()=>clearInterval(q)},[x,v]),(0,ac.useEffect)(()=>{i&&i(p+1,d.length)},[p,d.length,i]);let j=d[p],V=q=>{let H=[...q];for(let F=H.length-1;F>0;F--){let W=Math.floor(Math.random()*(F+1));[H[F],H[W]]=[H[W],H[F]]}return H},S=q=>{let H=Date.now()-P;g(F=>({...F,[j.id]:{questionId:j.id,answer:q,timeSpent:H}}))},N=()=>{p<d.length-1?(m(q=>q+1),R(Date.now()),$(!1)):T()},k=()=>{p>0&&(m(q=>q-1),$(!1))},T=()=>{let q=B();w(q),y(!0),A(H=>H+1),a&&a(q)},B=()=>{let q=0,H=0,F=[];d.forEach(O=>{let Y=h[O.id],re=O.points||1;q+=re;let Q=!1;if(Y?.answer&&O.correctAnswer!==void 0)switch(O.type){case"single-choice":case"true-false":case"text":Q=Y.answer===O.correctAnswer;break;case"multiple-choice":Array.isArray(Y.answer)&&Array.isArray(O.correctAnswer)&&(Q=Y.answer.length===O.correctAnswer.length&&Y.answer.every(ae=>O.correctAnswer.includes(ae)));break;case"matching":if(typeof Y.answer=="object"&&typeof O.correctAnswer=="object"){let ae=O.correctAnswer,te=Y.answer;Q=Object.keys(ae).every(se=>ae[se]===te[se])}break;case"rating":Q=!0;break}Q&&(H+=re),F.push({questionId:O.id,userAnswer:Y?.answer||null,correctAnswer:O.correctAnswer,isCorrect:Q,points:Q?re:0})});let W=q>0?H/q*100:0,U=Object.values(h).reduce((O,Y)=>O+(Y.timeSpent||0),0);return{score:H,totalScore:q,percentage:W,passed:o.passingScore?W>=o.passingScore:void 0,answers:F,timeSpent:U,completedAt:new Date}},D=()=>{m(0),g({}),y(!1),w(null),C(o.timeLimit?o.timeLimit*60:null),R(Date.now()),$(!1),o.shuffleQuestions&&f(V([...n]))},z=()=>{if(!b)return;let q={title:s,completedAt:b.completedAt,score:b.score,totalScore:b.totalScore,percentage:b.percentage,passed:b.passed,timeSpent:b.timeSpent,answers:b.answers.map(U=>({question:d.find(Y=>Y.id===U.questionId)?.question,userAnswer:U.userAnswer,correctAnswer:U.correctAnswer,isCorrect:U.isCorrect,points:U.points}))},H=new Blob([JSON.stringify(q,null,2)],{type:"application/json"}),F=URL.createObjectURL(H),W=document.createElement("a");W.href=F,W.download=`quiz-results-${Date.now()}.json`,W.click(),URL.revokeObjectURL(F)},M=q=>{let H=Math.floor(q/60),F=q%60;return`${H}:${F.toString().padStart(2,"0")}`},G=()=>{if(!j)return null;let q=h[j.id]?.answer;switch(j.type){case"single-choice":case"true-false":return(0,lt.jsx)("div",{className:"space-y-3",children:j.options?.map((U,O)=>(0,lt.jsx)(me.button,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:O*.1},onClick:()=>S(U),className:E("w-full text-left p-4 rounded-lg border transition-colors",q===U?"border-primary bg-primary/10":"border-border hover:border-primary/50"),children:U},O))});case"multiple-choice":return(0,lt.jsx)("div",{className:"space-y-3",children:j.options?.map((U,O)=>{let Y=Array.isArray(q)&&q.includes(U);return(0,lt.jsx)(me.button,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:O*.1},onClick:()=>{let re=q||[],Q=Y?re.filter(ae=>ae!==U):[...re,U];S(Q)},className:E("w-full text-left p-4 rounded-lg border transition-colors",Y?"border-primary bg-primary/10":"border-border hover:border-primary/50"),children:(0,lt.jsxs)("div",{className:"flex items-center gap-3",children:[(0,lt.jsx)("div",{className:E("w-5 h-5 rounded border-2 transition-colors",Y?"bg-primary border-primary":"border-border"),children:Y&&(0,lt.jsx)(Xi,{className:"w-full h-full text-primary-foreground"})}),U]})},O)})});case"text":return(0,lt.jsx)(me.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:(0,lt.jsx)("textarea",{className:"w-full p-4 rounded-lg border border-input bg-background resize-none",rows:4,placeholder:"Type your answer here...",value:q||"",onChange:U=>S(U.target.value)})});case"rating":let H=j.maxRating||5,F=typeof q=="number"?q:0;return(0,lt.jsxs)(me.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"space-y-4",children:[(0,lt.jsx)("div",{className:"flex justify-center gap-2",children:Array.from({length:H},(U,O)=>O+1).map(U=>(0,lt.jsx)("button",{onClick:()=>S(U),className:"transition-transform hover:scale-110",children:(0,lt.jsx)(vs,{className:E("w-10 h-10 transition-colors",U<=F?"fill-yellow-500 text-yellow-500":"text-muted-foreground")})},U))}),j.ratingLabels&&(0,lt.jsxs)("div",{className:"flex justify-between text-sm text-muted-foreground",children:[(0,lt.jsx)("span",{children:j.ratingLabels[0]}),(0,lt.jsx)("span",{children:j.ratingLabels[1]})]})]});case"matching":let W=q||{};return(0,lt.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,lt.jsxs)("div",{className:"space-y-3",children:[(0,lt.jsx)("h4",{className:"font-medium mb-2",children:"Match these items:"}),j.leftOptions?.map((U,O)=>(0,lt.jsx)(me.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:O*.1},className:"p-3 rounded-lg border bg-muted/50",children:U},U))]}),(0,lt.jsxs)("div",{className:"space-y-3",children:[(0,lt.jsx)("h4",{className:"font-medium mb-2",children:"With these:"}),j.leftOptions?.map(U=>(0,lt.jsx)(me.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},children:(0,lt.jsxs)("select",{className:"w-full p-3 rounded-lg border bg-background",value:W[U]||"",onChange:O=>S({...W,[U]:O.target.value}),children:[(0,lt.jsx)("option",{value:"",children:"Select..."}),j.rightOptions?.map(O=>(0,lt.jsx)("option",{value:O,children:O},O))]})},U))]})]});default:return null}};return v&&b?(0,lt.jsx)("div",{ref:u,className:E(h6e({variant:t,size:r}),e),...c,children:(0,lt.jsxs)(me.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"space-y-6",children:[(0,lt.jsxs)("div",{className:"text-center",children:[(0,lt.jsx)("h2",{className:"text-2xl font-bold mb-2",children:"Quiz Completed!"}),(0,lt.jsxs)("div",{className:"text-5xl font-bold mb-4",children:[b.percentage.toFixed(1),"%"]}),(0,lt.jsxs)("p",{className:"text-muted-foreground",children:["You scored ",b.score," out of ",b.totalScore," points"]}),b.passed!==void 0&&(0,lt.jsx)("div",{className:E("mt-4 inline-flex items-center gap-2 px-4 py-2 rounded-full",b.passed?"bg-green-100 text-green-700":"bg-red-100 text-red-700"),children:b.passed?(0,lt.jsxs)(lt.Fragment,{children:[(0,lt.jsx)(Xi,{className:"w-5 h-5"}),"Passed"]}):(0,lt.jsxs)(lt.Fragment,{children:[(0,lt.jsx)(eo,{className:"w-5 h-5"}),"Failed"]})})]}),o.allowReview&&(0,lt.jsxs)("div",{className:"space-y-4",children:[(0,lt.jsx)("h3",{className:"font-semibold",children:"Review Answers:"}),b.answers.map((q,H)=>{let F=d.find(W=>W.id===q.questionId);return F?(0,lt.jsx)("div",{className:"p-4 rounded-lg border bg-muted/50",children:(0,lt.jsxs)("div",{className:"flex items-start gap-3",children:[q.isCorrect?(0,lt.jsx)(Xi,{className:"w-5 h-5 text-green-600 mt-0.5"}):(0,lt.jsx)(eo,{className:"w-5 h-5 text-red-600 mt-0.5"}),(0,lt.jsxs)("div",{className:"flex-1",children:[(0,lt.jsxs)("p",{className:"font-medium mb-2",children:[H+1,". ",F.question]}),(0,lt.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Your answer: ",JSON.stringify(q.userAnswer)]}),!q.isCorrect&&F.correctAnswer!==void 0&&(0,lt.jsxs)("p",{className:"text-sm text-green-600 mt-1",children:["Correct answer: ",JSON.stringify(F.correctAnswer)]}),F.explanation&&(0,lt.jsx)("p",{className:"text-sm text-muted-foreground mt-2",children:F.explanation})]})]})},q.questionId):null})]}),(0,lt.jsxs)("div",{className:"flex gap-3 justify-center",children:[(!o.maxAttempts||I<o.maxAttempts)&&(0,lt.jsxs)("button",{onClick:D,className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90",children:[(0,lt.jsx)(dv,{className:"w-4 h-4"}),"Try Again"]}),(0,lt.jsxs)("button",{onClick:z,className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg border hover:bg-muted",children:[(0,lt.jsx)(vn,{className:"w-4 h-4"}),"Download Results"]})]})]})}):(0,lt.jsxs)("div",{ref:u,className:E(h6e({variant:t,size:r}),e),...c,children:[(s||x!==null)&&(0,lt.jsxs)("div",{className:"mb-6 flex items-center justify-between",children:[(0,lt.jsxs)("div",{children:[s&&(0,lt.jsx)("h2",{className:"text-2xl font-bold",children:s}),l&&(0,lt.jsx)("p",{className:"text-muted-foreground mt-1",children:l})]}),x!==null&&(0,lt.jsxs)("div",{className:E("flex items-center gap-2 px-3 py-1 rounded-full text-sm font-medium",x<60?"bg-red-100 text-red-700":"bg-muted"),children:[(0,lt.jsx)(cn,{className:"w-4 h-4"}),M(x)]})]}),(0,lt.jsxs)("div",{className:"mb-6",children:[(0,lt.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground mb-2",children:[(0,lt.jsxs)("span",{children:["Question ",p+1," of ",d.length]}),(0,lt.jsxs)("span",{children:[Math.round((p+1)/d.length*100),"%"]})]}),(0,lt.jsx)("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:(0,lt.jsx)(me.div,{className:"h-full bg-primary",initial:{width:0},animate:{width:`${(p+1)/d.length*100}%`},transition:{duration:.3}})})]}),(0,lt.jsx)(kt,{mode:"wait",children:j&&(0,lt.jsxs)(me.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"mb-6",children:[(0,lt.jsxs)("h3",{className:"text-lg font-semibold mb-4",children:[j.question,j.required&&(0,lt.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),G(),o.showHints&&j.hint&&(0,lt.jsxs)("div",{className:"mt-4",children:[(0,lt.jsxs)("button",{onClick:()=>$(!L),className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground",children:[(0,lt.jsx)(tm,{className:"w-4 h-4"}),L?"Hide":"Show"," Hint"]}),L&&(0,lt.jsx)(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},className:"mt-2 p-3 rounded-lg bg-muted/50 text-sm",children:j.hint})]}),o.showInstantFeedback&&h[j.id]&&j.correctAnswer!==void 0&&(0,lt.jsx)(me.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"mt-4",children:(()=>{let q=h[j.id].answer,H=!1;switch(j.type){case"single-choice":case"true-false":H=q===j.correctAnswer;break}return(0,lt.jsxs)("div",{className:E("p-3 rounded-lg flex items-start gap-2",H?"bg-green-100 text-green-700":"bg-red-100 text-red-700"),children:[H?(0,lt.jsx)(Xi,{className:"w-5 h-5 mt-0.5"}):(0,lt.jsx)(eo,{className:"w-5 h-5 mt-0.5"}),(0,lt.jsxs)("div",{children:[(0,lt.jsx)("p",{className:"font-medium",children:H?"Correct!":"Incorrect"}),j.explanation&&(0,lt.jsx)("p",{className:"text-sm mt-1",children:j.explanation})]})]})})()})]},j.id)}),(0,lt.jsxs)("div",{className:"flex items-center justify-between",children:[(0,lt.jsxs)("button",{onClick:k,disabled:p===0,className:E("inline-flex items-center gap-2 px-4 py-2 rounded-lg transition-colors",p===0?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":"bg-muted hover:bg-muted/80"),children:[(0,lt.jsx)(Za,{className:"w-4 h-4"}),"Previous"]}),(0,lt.jsxs)("button",{onClick:p===d.length-1?T:N,disabled:j?.required&&!h[j.id],className:E("inline-flex items-center gap-2 px-4 py-2 rounded-lg transition-colors",j?.required&&!h[j.id]?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":"bg-primary text-primary-foreground hover:bg-primary/90"),children:[p===d.length-1?"Complete":"Next",(0,lt.jsx)(Sn,{className:"w-4 h-4"})]})]})]})});g6e.displayName="MoonUIQuizFormProInternal";var jne=ac.default.forwardRef((e,t)=>{let{hasProAccess:r,isLoading:n}=Ee();return!n&&!r?(0,lt.jsx)(Ze,{className:E("w-full",e.className),children:(0,lt.jsx)(tt,{className:"py-12 text-center",children:(0,lt.jsxs)("div",{className:"max-w-md mx-auto space-y-4",children:[(0,lt.jsx)("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:(0,lt.jsx)(Qt,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),(0,lt.jsxs)("div",{children:[(0,lt.jsx)("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),(0,lt.jsx)("p",{className:"text-muted-foreground text-sm mb-4",children:"MoonUI Quiz Form is available exclusively to MoonUI Pro subscribers."}),(0,lt.jsx)("a",{href:"/pricing",children:(0,lt.jsxs)(xe,{size:"sm",children:[(0,lt.jsx)(jt,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})]})]})})}):(0,lt.jsx)(g6e,{...e,ref:t})});jne.displayName="MoonUIQuizFormPro";var u1=_(ye(),1);var cj=_(ue(),1),i$t={sm:"text-2xl md:text-3xl",md:"text-3xl md:text-4xl",lg:"text-4xl md:text-5xl",xl:"text-5xl md:text-6xl","2xl":"text-6xl md:text-7xl","3xl":"text-7xl md:text-8xl",custom:""};function s$t({children:e,speed:t=.5,enableShadows:r=!0,enableOnHover:n=!1,className:o="",size:a="lg",shadowColors:i={primary:"#ff00ff",secondary:"#00ffff"},intensity:s=1}){let l=(0,u1.useRef)(null),[c,u]=(0,u1.useState)(!1),d=(0,u1.useRef)(null);return(0,u1.useEffect)(()=>{let f=`glitch-${Math.random().toString(36).substr(2,9)}`;l.current&&l.current.setAttribute("data-glitch-id",f);let p=document.createElement("style");d.current=p;let m=t*2,h=i.primary,g=i.secondary,v=r?s:0;return p.textContent=`
|
|
516
|
+
`)}function _Vt(e,t){if(!t||t.length===0)return JSON.stringify(e,null,2);let r=e.map(n=>{let o={};return t.forEach(a=>{a in n&&(o[a]=n[a])}),o});return JSON.stringify(r,null,2)}function FVt(e,t,r){let n=new Blob([e],{type:r}),o=URL.createObjectURL(n),a=document.createElement("a");a.href=o,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(o)}async function Qje(e,t){let{format:r,filename:n="data-export",columns:o,includeHeaders:a=!0}=t,i,s,l;switch(r){case"csv":i=OVt(e,o,a),s="text/csv;charset=utf-8;",l="csv";break;case"json":i=_Vt(e,o),s="application/json;charset=utf-8;",l="json";break;case"xlsx":throw new Error("XLSX export requires additional dependencies. Use CSV format instead.");default:throw new Error(`Unsupported export format: ${r}`)}let c=`${n}-${new Date().toISOString().split("T")[0]}.${l}`;FVt(i,c,s)}function Zje(e,t){return e.filter(r=>{let n=r.id||r.accessorKey;return n&&t[n]!==!1}).map(r=>r.id||r.accessorKey).filter(Boolean)}var c1=_(ye(),1),e6e=_(dh(),1);var $t=_(ue(),1),BVt={equals:"Equals",notEquals:"Not equals",contains:"Contains",notContains:"Not contains",startsWith:"Starts with",endsWith:"Ends with",greaterThan:"Greater than",lessThan:"Less than",greaterThanOrEqual:"Greater than or equal",lessThanOrEqual:"Less than or equal",between:"Between",in:"In",notIn:"Not in",isNull:"Is empty",isNotNull:"Is not empty"};function zVt(e){switch(e){case"number":return["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","between","isNull","isNotNull"];case"date":return["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","between","isNull","isNotNull"];case"boolean":return["equals","notEquals","isNull","isNotNull"];case"select":return["equals","notEquals","in","notIn","isNull","isNotNull"];default:return["equals","notEquals","contains","notContains","startsWith","endsWith","isNull","isNotNull"]}}function t6e({table:e,open:t,onOpenChange:r,position:n="right",width:o="400px",filters:a,onFiltersChange:i,customFilters:s,matchAll:l,onMatchAllChange:c}){let[u,d]=(0,c1.useState)([]),[f,p]=(0,c1.useState)(!0),m=a||u,h=i||d,g=l!==void 0?l:f,v=c||p,y=(0,c1.useMemo)(()=>e.getAllColumns().filter(L=>L.id==="select"||L.id==="actions"||L.id==="expander"?!1:L.getCanFilter()),[e]),b=()=>{let L=y[0];if(!L)return;let $={column:L.id,operator:"contains",value:""};h([...m,$])},w=(L,$)=>{let I=[...m];I[L]={...I[L],...$},h(I)},x=L=>{h(m.filter(($,I)=>I!==L))},C=()=>{h([]),e.resetColumnFilters()},P=()=>{e.resetColumnFilters(),[...new Set(m.map($=>$.column))].forEach($=>{let I=e.getColumn($);I&&I.setFilterValue({custom:!0,filters:m,matchAll:g})}),m.length===0&&e.resetColumnFilters(),r(!1)};if(typeof document>"u")return null;let R=(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(kt,{children:t&&(0,$t.jsx)(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/20",style:{zIndex:9998},onClick:()=>r(!1)})}),(0,$t.jsx)(kt,{children:t&&(0,$t.jsx)(me.div,{initial:{x:n==="right"?"100%":"-100%"},animate:{x:0},exit:{x:n==="right"?"100%":"-100%"},transition:{type:"spring",damping:30,stiffness:300},className:E("fixed top-0 bottom-0 bg-background border-l shadow-xl",n==="right"?"right-0":"left-0"),style:{width:o,zIndex:9999},children:(0,$t.jsxs)("div",{className:"flex flex-col h-full",children:[(0,$t.jsxs)("div",{className:"flex items-center justify-between p-4 border-b",children:[(0,$t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,$t.jsx)(Oi,{className:"h-5 w-5"}),(0,$t.jsx)("h2",{className:"text-lg font-semibold",children:"Filters"}),m.length>0&&(0,$t.jsxs)("span",{className:"text-sm text-muted-foreground",children:["(",m.length," active)"]})]}),(0,$t.jsx)(xe,{variant:"ghost",size:"icon",onClick:()=>r(!1),children:(0,$t.jsx)(fr,{className:"h-4 w-4"})})]}),(0,$t.jsxs)("div",{className:"flex-1 overflow-y-auto p-4",children:[(0,$t.jsxs)("div",{className:"mb-6",children:[(0,$t.jsx)(Lt,{className:"text-sm font-medium mb-2 block",children:"Match conditions"}),(0,$t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,$t.jsx)(xe,{variant:g?"primary":"outline",size:"sm",onClick:()=>v(!0),className:"flex-1",children:"Match all"}),(0,$t.jsx)(xe,{variant:g?"outline":"primary",size:"sm",onClick:()=>v(!1),className:"flex-1",children:"Match any"})]})]}),(0,$t.jsx)(Ps,{className:"mb-6"}),s&&(0,$t.jsxs)($t.Fragment,{children:[s,(0,$t.jsx)(Ps,{className:"my-6"})]}),(0,$t.jsx)("div",{className:"space-y-4",children:m.map((L,$)=>(0,$t.jsx)(UVt,{filter:L,columns:y,onUpdate:I=>w($,I),onRemove:()=>x($)},$))}),(0,$t.jsxs)(xe,{variant:"outline",size:"sm",onClick:b,className:"w-full mt-4",children:[(0,$t.jsx)(xi,{className:"h-4 w-4 mr-2"}),"Add filter"]})]}),(0,$t.jsx)("div",{className:"p-4 border-t space-y-2",children:(0,$t.jsxs)("div",{className:"flex gap-2",children:[(0,$t.jsxs)(xe,{variant:"outline",onClick:C,disabled:m.length===0,className:"flex-1",children:[(0,$t.jsx)(Ji,{className:"h-4 w-4 mr-2"}),"Clear all"]}),(0,$t.jsx)(xe,{onClick:P,className:"flex-1",children:"Apply filters"})]})})]})})})]});return(0,e6e.createPortal)(R,document.body)}function UVt({filter:e,columns:t,onUpdate:r,onRemove:n}){let a=t.find(p=>p.id===e.column)?.columnDef,i=a?.meta?.filterType||"string",s=a?.meta?.filterOptions,l=a?.meta?.filterValueAccessor,c=zVt(i),u=e.operator!=="isNull"&&e.operator!=="isNotNull",d=e.operator==="in"||e.operator==="notIn",f=c1.default.useMemo(()=>i!=="select"&&!s?null:s||null,[i,s]);return(0,$t.jsxs)("div",{className:"space-y-2 p-3 border rounded-lg bg-muted/30",children:[(0,$t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,$t.jsxs)(Oo,{value:e.column,onValueChange:p=>r({column:p}),children:[(0,$t.jsx)(_o,{className:"flex-1",children:(0,$t.jsx)(Yo,{})}),(0,$t.jsx)(Fo,{style:{zIndex:1e4},children:t.map(p=>{let m=p.columnDef.header,h=typeof m=="function"?p.id:m||p.id;return(0,$t.jsx)(Ut,{value:p.id,children:h},p.id)})})]}),(0,$t.jsx)(xe,{variant:"ghost",size:"icon",onClick:n,className:"h-8 w-8",children:(0,$t.jsx)(fr,{className:"h-4 w-4"})})]}),(0,$t.jsxs)(Oo,{value:e.operator,onValueChange:p=>r({operator:p}),children:[(0,$t.jsx)(_o,{children:(0,$t.jsx)(Yo,{})}),(0,$t.jsx)(Fo,{style:{zIndex:1e4},children:c.map(p=>(0,$t.jsx)(Ut,{value:p,children:BVt[p]},p))})]}),u&&(0,$t.jsx)("div",{children:i==="boolean"?(0,$t.jsxs)(Oo,{value:String(e.value),onValueChange:p=>r({value:p==="true"}),children:[(0,$t.jsx)(_o,{children:(0,$t.jsx)(Yo,{})}),(0,$t.jsxs)(Fo,{style:{zIndex:1e4},children:[(0,$t.jsx)(Ut,{value:"true",children:"True"}),(0,$t.jsx)(Ut,{value:"false",children:"False"})]})]}):(i==="select"||f)&&!d?(0,$t.jsxs)(Oo,{value:e.value||"",onValueChange:p=>r({value:p}),children:[(0,$t.jsx)(_o,{children:(0,$t.jsx)(Yo,{placeholder:"Select value..."})}),(0,$t.jsx)(Fo,{style:{zIndex:1e4},children:f?.map(p=>(0,$t.jsx)(Ut,{value:p,children:p},p))})]}):(i==="select"||f)&&d?(0,$t.jsxs)("div",{className:"space-y-2",children:[(0,$t.jsx)("div",{className:"text-xs text-muted-foreground",children:"Select multiple values:"}),(0,$t.jsx)("div",{className:"space-y-1 max-h-32 overflow-y-auto border rounded-md p-2",children:f?.map(p=>{let m=Array.isArray(e.value)?e.value:[],h=m.includes(p);return(0,$t.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer hover:bg-muted/50 p-1 rounded",children:[(0,$t.jsx)("input",{type:"checkbox",checked:h,onChange:g=>{let v=g.target.checked?[...m,p]:m.filter(y=>y!==p);r({value:v})},className:"rounded border-gray-300"}),(0,$t.jsx)("span",{className:"text-sm",children:p})]},p)})})]}):i==="number"?(0,$t.jsx)(Zt,{type:"number",value:e.value||"",onChange:p=>r({value:p.target.value}),placeholder:"Enter value..."}):d?(0,$t.jsx)(Zt,{value:Array.isArray(e.value)?e.value.join(", "):e.value||"",onChange:p=>r({value:p.target.value}),placeholder:"Enter values separated by comma..."}):(0,$t.jsx)(Zt,{value:e.value||"",onChange:p=>r({value:p.target.value}),placeholder:"Enter value..."})})]})}var Pg=_(ye(),1);var Zo=_(ue(),1);function r6e({table:e,filter:t,data:r}){let[n,o]=(0,Pg.useState)(!1),[a,i]=(0,Pg.useState)(""),s=Pg.default.useMemo(()=>{let v=e.getColumn(t.column);return v||(v=e.getAllColumns().find(b=>b.id===t.column||b.columnDef.accessorKey===t.column)),v},[e,t.column]),l=(0,Pg.useMemo)(()=>{if(t.options&&t.options!=="auto")return t.options;let v=new Set;return r.forEach(y=>{let b=y[t.column];if(b===void 0&&t.column.includes(".")){let w=t.column.split(".");b=y;for(let x of w)b=b?.[x]}b!=null&&b!==""&&v.add(String(b))}),Array.from(v).sort()},[r,t.column,t.options]),c=s?.getFilterValue(),u=(0,Pg.useMemo)(()=>c?Array.isArray(c)?new Set(c):new Set([String(c)]):new Set,[c]),d=(0,Pg.useMemo)(()=>{if(!t.showCounts)return{};let v={};return r.forEach(y=>{let b=y[t.column];if(b===void 0&&t.column.includes(".")){let w=t.column.split(".");b=y;for(let x of w)b=b?.[x]}if(b!=null&&b!==""){let w=String(b);v[w]=(v[w]||0)+1}}),v},[r,t.column,t.showCounts]),f=v=>{if(s)if(t.multi){let y=new Set(u);y.has(v)?y.delete(v):y.add(v),y.size===0?s.setFilterValue(void 0):s.setFilterValue(Array.from(y))}else u.has(v)?s.setFilterValue(void 0):s.setFilterValue(v)},p=()=>{s?.setFilterValue(void 0),i("")},m=t.label||t.column,h=(0,Pg.useMemo)(()=>a?l.filter(v=>v.toLowerCase().includes(a.toLowerCase())):l,[l,a]),g=!s||l.length===0;return(0,Zo.jsxs)(Fi,{open:n,onOpenChange:o,children:[(0,Zo.jsx)(Bi,{asChild:!0,children:(0,Zo.jsxs)(xe,{variant:"outline",size:"sm",disabled:g,className:E("h-8 border-dashed",u.size>0&&"border-solid"),children:[m,u.size>0&&(0,Zo.jsxs)(Zo.Fragment,{children:[(0,Zo.jsx)("span",{className:"mx-2 h-4 w-px bg-border"}),(0,Zo.jsx)(ht,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:u.size})]})]})}),(0,Zo.jsx)(Ri,{className:"w-[250px] p-0",align:"start",children:(0,Zo.jsxs)("div",{className:"p-2",children:[l.length>0&&(0,Zo.jsx)("div",{className:"pb-2",children:(0,Zo.jsxs)("div",{className:"relative",children:[(0,Zo.jsx)($n,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),(0,Zo.jsx)(Zt,{placeholder:`Search ${m.toLowerCase()}...`,value:a,onChange:v=>i(v.target.value),className:"h-8 w-full pl-8"})]})}),l.length===0?(0,Zo.jsx)("div",{className:"text-center text-sm text-muted-foreground py-4",children:"No options available"}):h.length===0?(0,Zo.jsx)("div",{className:"text-center text-sm text-muted-foreground py-4",children:"No results found"}):(0,Zo.jsx)("div",{className:"space-y-1 max-h-[300px] overflow-y-auto",children:h.map(v=>{let y=u.has(v);return(0,Zo.jsxs)("button",{onClick:()=>f(v),className:E("flex w-full items-center justify-between rounded px-2 py-1.5 text-sm hover:bg-accent",y&&"bg-accent"),children:[(0,Zo.jsxs)("div",{className:"flex items-center",children:[(0,Zo.jsx)("div",{className:E("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",y?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:(0,Zo.jsx)(Qr,{className:"h-4 w-4"})}),(0,Zo.jsx)("span",{children:v})]}),t.showCounts&&d[v]!==void 0&&(0,Zo.jsx)("span",{className:"text-xs text-muted-foreground",children:d[v]})]},v)})}),u.size>0&&(0,Zo.jsx)("div",{className:"border-t mt-2 pt-2",children:(0,Zo.jsx)(xe,{variant:"ghost",size:"sm",className:"w-full justify-center",onClick:p,children:"Clear filter"})})]})})]})}var cD=_(ye(),1);var Rn=_(ue(),1);function n6e({table:e,column:t,title:r,options:n="auto",data:o}){let a=e.getColumn(t),[i,s]=(0,cD.useState)("");if(!a)return null;let l=a.columnDef,c=l?.meta?.filterValueAccessor,u=l?.meta?.filterOptions,d=x=>c?c(x):x[t],{availableOptions:f,optionCounts:p}=(0,cD.useMemo)(()=>{let x={},C=new Set;o.forEach(R=>{let L=d(R);if(L!=null&&L!==""){let $=String(L);C.add($),x[$]=(x[$]||0)+1}});let P=[];return n!=="auto"?P=n:u?P=u.map(R=>({value:R,label:R})):P=Array.from(C).sort().slice(0,50).map(R=>({value:R,label:R})),{availableOptions:P,optionCounts:x}},[o,n,u]),m=a.getFilterValue(),h=new Set(m||[]),g=(0,cD.useMemo)(()=>i?f.filter(x=>(x.label||x.value).toLowerCase().includes(i.toLowerCase())):f,[f,i]),v=r||a.columnDef.header||t,y=x=>{let C=new Set(h);C.has(x)?C.delete(x):C.add(x),C.size===0?a.setFilterValue(void 0):a.setFilterValue(Array.from(C))},b=()=>{a.setFilterValue(void 0),s("")},w=()=>{let x=g.map(C=>C.value);a.setFilterValue(x)};return(0,Rn.jsxs)(Fi,{children:[(0,Rn.jsx)(Bi,{asChild:!0,children:(0,Rn.jsxs)(xe,{variant:"outline",size:"sm",className:E("h-8 border-dashed",h.size>0&&"border-solid"),children:[(0,Rn.jsx)(p0,{className:"mr-2 h-4 w-4"}),v,h.size>0&&(0,Rn.jsxs)(Rn.Fragment,{children:[(0,Rn.jsx)(Ps,{orientation:"vertical",className:"mx-2 h-4"}),(0,Rn.jsx)(ht,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:h.size}),(0,Rn.jsx)("div",{className:"hidden space-x-1 lg:flex",children:h.size>2?(0,Rn.jsxs)(ht,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[h.size," selected"]}):Array.from(h).slice(0,2).map(x=>{let C=f.find(P=>P.value===x);return(0,Rn.jsx)(ht,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:C?.label||x},x)})})]})]})}),(0,Rn.jsxs)(Ri,{className:"w-[300px] p-0",align:"start",children:[(0,Rn.jsx)("div",{className:"p-3",children:(0,Rn.jsxs)("div",{className:"relative",children:[(0,Rn.jsx)($n,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),(0,Rn.jsx)(Zt,{placeholder:`Search ${v.toLowerCase()}...`,value:i,onChange:x=>s(x.target.value),className:"h-8 pl-8"})]})}),(0,Rn.jsx)(Ps,{}),(0,Rn.jsx)("div",{className:"max-h-[300px] overflow-y-auto",children:g.length===0?(0,Rn.jsx)("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"No results found"}):(0,Rn.jsx)("div",{className:"p-2",children:g.map(x=>{let C=h.has(x.value),P=p[x.value]||0;return(0,Rn.jsxs)(xe,{variant:"ghost",size:"sm",className:"w-full justify-start font-normal",onClick:()=>y(x.value),children:[(0,Rn.jsx)("div",{className:E("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",C?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:(0,Rn.jsx)(Qr,{className:E("h-4 w-4")})}),x.icon&&(0,Rn.jsx)("span",{className:"mr-2",children:x.icon}),(0,Rn.jsx)("span",{className:"flex-1 text-left",children:x.label||x.value}),P>0&&(0,Rn.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:P})]},x.value)})})}),(h.size>0||g.length>0)&&(0,Rn.jsxs)(Rn.Fragment,{children:[(0,Rn.jsx)(Ps,{}),(0,Rn.jsxs)("div",{className:"flex items-center justify-between p-2",children:[h.size>0?(0,Rn.jsxs)(xe,{variant:"ghost",size:"sm",onClick:b,className:"h-8 px-2 lg:px-3",children:["Clear",(0,Rn.jsx)(fr,{className:"ml-2 h-4 w-4"})]}):(0,Rn.jsxs)(xe,{variant:"ghost",size:"sm",onClick:w,className:"h-8 px-2 lg:px-3",children:["Select all",(0,Rn.jsx)(Qr,{className:"ml-2 h-4 w-4"})]}),(0,Rn.jsxs)("span",{className:"text-xs text-muted-foreground",children:[h.size," of ",f.length," selected"]})]})]})]})]})}var mt=_(ue(),1);function zne({columns:e,data:t,searchable:r=!0,filterable:n=!0,exportable:o=!0,selectable:a=!1,pagination:i=!0,pageSize:s=10,pageSizeOptions:l=[5,10,20,50,100],className:c,onRowSelect:u,onExport:d,enableExpandable:f=!1,renderSubComponent:p,expandedRows:m,onRowExpandChange:h,bulkActions:g=[],quickFilters:v=[],facetedFilters:y=[],features:b={},theme:w={},texts:x={},enableSorting:C=!0,enableFiltering:P=!0,enablePagination:R=!0,enableColumnVisibility:L=!0,enableRowSelection:$,filterPlaceholder:I="Search all columns...",defaultPageSize:A,manualPagination:j=!1,pageCount:V,onPaginationChange:S,onSortingChange:N,onColumnFiltersChange:k,state:T}){let B=qi.default.useMemo(()=>e.map(De=>{let{enableHiding:ct,...We}=De;return{...We,enableHiding:!0,filterFn:"custom"}}),[e]),{hasProAccess:D,isLoading:z}=Ee();if(!z&&!D)return(0,mt.jsx)(Ve,{componentName:"Data Table",className:E("w-full",c)});let[M,G]=qi.default.useState([]),[q,H]=qi.default.useState([]),[F,W]=qi.default.useState({}),[U,O]=qi.default.useState({}),[Y,re]=qi.default.useState(""),[Q,ae]=qi.default.useState({pageIndex:0,pageSize:A||s||10}),[te,se]=qi.default.useState(!1),[oe,le]=qi.default.useState(new Set),[J,ee]=qi.default.useState(!1),X=m||oe,K=h?De=>h(De):le,ne=A||s,ce=qi.default.useMemo(()=>t,[t]),Z=De=>()=>{let We=(T?.sorting??M).find(it=>it.id===De),bt=[];We?We.desc?bt=[]:bt=[{id:De,desc:!0}]:bt=[{id:De,desc:!1}];let It=N!==void 0?N:G;typeof It=="function"&&It(bt)},we=qi.default.useRef(null),de=qi.default.useCallback(De=>{let ct=typeof De=="function"?De(U):De;if(O(ct),u&&we.current){let We=Object.keys(ct).filter(It=>ct[It]),bt=we.current.getRowModel().rows.filter(It=>We.includes(It.id)).map(It=>It.original);u(bt)}},[U,u]),ge=qi.default.useMemo(()=>{let De=B.map(We=>!We.id&&We.accessorKey?{...We,id:We.accessorKey}:We),ct=De.some(We=>{if(We.id==="select")return!0;let bt=We.header?.toString()||"",It=We.cell?.toString()||"";return bt.includes("Checkbox")||It.includes("Checkbox")});return(a||$)&&!ct&&(De=[{id:"select",header:({table:bt})=>{let It=bt.getIsAllPageRowsSelected(),it=bt.getIsSomePageRowsSelected();return(0,mt.jsx)("div",{className:"flex items-center justify-center",children:(0,mt.jsx)(Wl,{checked:It?!0:it?"indeterminate":!1,onCheckedChange:Ft=>{bt.toggleAllPageRowsSelected(!!Ft)},"aria-label":"Select all",className:"h-4 w-4"})})},cell:({row:bt})=>{let It=bt.getIsSelected();return(0,mt.jsx)("div",{className:"flex items-center justify-center",children:(0,mt.jsx)(Wl,{checked:It,onCheckedChange:it=>bt.toggleSelected(!!it),disabled:!bt.getCanSelect(),"aria-label":"Select row",className:"h-4 w-4"},`select-${bt.id}-${It}`)})},enableSorting:!1,enableHiding:!1,size:40,maxSize:40},...De]),De},[B,a,$]),pe=Yje({data:ce,columns:ge,onSortingChange:N!==void 0?N:G,onColumnFiltersChange:k!==void 0?k:H,onPaginationChange:S!==void 0?S:ae,getCoreRowModel:Wje(),getPaginationRowModel:Gje(),getSortedRowModel:Kje(),getFilteredRowModel:qje(),enableSortingRemoval:!0,enableMultiSort:!1,sortDescFirst:!1,onColumnVisibilityChange:W,onRowSelectionChange:de,onGlobalFilterChange:re,globalFilterFn:"includesString",enableRowSelection:a||$||!1,filterFns:{custom:(De,ct,We)=>{if(Array.isArray(We)){let Ue=pe.getColumn(ct)?.columnDef?.meta?.filterValueAccessor,Be=Ue?Ue(De.original):De.getValue(ct);return We.includes(String(Be))}if(typeof We=="string"||typeof We=="number"||typeof We=="boolean"){let Ue=pe.getColumn(ct)?.columnDef?.meta?.filterValueAccessor,Be=Ue?Ue(De.original):De.getValue(ct);return String(Be)===String(We)}if(!We?.custom||!We?.filters)return!0;let bt=We.filters,It=We.matchAll!==void 0?We.matchAll:!0,it=bt.map(Ft=>{let Be=pe.getColumn(Ft.column)?.columnDef?.meta?.filterValueAccessor,He=Be?Be(De.original):De.getValue(Ft.column),st=Ft.value;switch(Ft.operator){case"equals":return He===st;case"notEquals":return He!==st;case"contains":return String(He).toLowerCase().includes(String(st).toLowerCase());case"notContains":return!String(He).toLowerCase().includes(String(st).toLowerCase());case"startsWith":return String(He).toLowerCase().startsWith(String(st).toLowerCase());case"endsWith":return String(He).toLowerCase().endsWith(String(st).toLowerCase());case"greaterThan":return Number(He)>Number(st);case"lessThan":return Number(He)<Number(st);case"greaterThanOrEqual":return Number(He)>=Number(st);case"lessThanOrEqual":return Number(He)<=Number(st);case"in":return Array.isArray(st)?st.includes(He):String(st).split(",").map(xt=>xt.trim()).includes(String(He));case"notIn":return Array.isArray(st)?!st.includes(He):!String(st).split(",").map(xt=>xt.trim()).includes(String(He));case"isNull":return He==null||He==="";case"isNotNull":return He!=null&&He!=="";default:return!0}});return It?it.every(Ft=>Ft):it.some(Ft=>Ft)}},manualPagination:j,pageCount:V,state:{sorting:T?.sorting??M,columnFilters:T?.columnFilters??q,columnVisibility:T?.columnVisibility??F,rowSelection:T?.rowSelection??U,globalFilter:T?.globalFilter??Y,pagination:T?.pagination??Q},initialState:{pagination:{pageSize:ne}},autoResetAll:!1,autoResetPageIndex:!1,autoResetExpanded:!1,getRowId:(De,ct)=>{let We=De;return We.id!==void 0&&We.id!==null&&We.id!==""?String(We.id):We.orderId!==void 0&&We.orderId!==null?String(We.orderId):We.orderNumber!==void 0&&We.orderNumber!==null?String(We.orderNumber):We.email?`email-${We.email}`:We.name&&We.email?`${We.name}-${We.email}`:We.name?`name-${We.name}-${ct}`:String(ct)}});we.current=pe;let ve=pe.getState(),Pe=pe.getRowModel(),ze=qi.default.useRef(Pe.rows),Oe=qi.default.useMemo(()=>{let De=ze.current!==Pe.rows;return De&&(ze.current=Pe.rows),De},[Pe.rows]),Me=ze.current,fe={sorting:b.sorting!==!1,filtering:b.filtering!==!1||n,pagination:b.pagination!==!1||i,search:b.search!==!1||r,columnVisibility:b.columnVisibility!==!1,rowSelection:b.rowSelection!==!1||a,export:b.export!==!1||o},be=async De=>{let ct=pe.getFilteredSelectedRowModel().rows,We=ct.length>0?ct.map(it=>it.original):pe.getFilteredRowModel().rows.map(it=>it.original);if(typeof o=="object"&&o.onExport){o.onExport(We,De);return}if(d){d(We);return}let bt=typeof o=="object"&&o.filename?o.filename:"data-export",It=Zje(B,F);await Qje(We,{format:De,filename:bt,columns:It,includeHeaders:!0})},Ae=qi.default.useMemo(()=>o?o===!0?["csv","json"]:typeof o=="object"&&o.formats?o.formats:["csv","json"]:[],[o]),Te=()=>{pe.resetRowSelection()};return(0,mt.jsxs)("div",{className:E("moonui-pro-datatable-container flex flex-col gap-4",c),children:[a&&pe.getFilteredSelectedRowModel().rows.length>0&&(0,mt.jsxs)("div",{className:"flex items-center justify-between rounded-md bg-muted/50 px-4 py-2",children:[(0,mt.jsxs)("span",{className:"text-sm text-muted-foreground",children:[pe.getFilteredSelectedRowModel().rows.length," Selected"]}),g.length>0&&(0,mt.jsx)(Jje,{selectedRows:pe.getFilteredSelectedRowModel().rows.map(De=>De.original),actions:g,onClearSelection:Te})]}),(0,mt.jsxs)("div",{className:"moonui-pro-datatable-toolbar flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,mt.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[r&&(0,mt.jsxs)("div",{className:"relative",children:[(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)($n,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"})}),(0,mt.jsx)(Zt,{placeholder:I,value:Y,onChange:De=>re(De.target.value),className:"pl-8 w-full sm:w-64"})]}),v.length>0&&(0,mt.jsx)("div",{className:"flex items-center gap-2",children:v.map((De,ct)=>(0,mt.jsx)(r6e,{table:pe,filter:De,data:t},`quick-${De.column}-${ct}`))}),y.length>0&&(0,mt.jsx)("div",{className:"flex items-center gap-2",children:y.map((De,ct)=>{let We=typeof De=="string"?De:De.column,bt=typeof De=="string"?void 0:De.label;return(0,mt.jsx)(n6e,{table:pe,column:We,title:bt,data:t},`faceted-${We}-${ct}`)})}),n&&(0,mt.jsxs)(xe,{variant:"outline",size:"sm",onClick:()=>ee(!0),children:[(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(Oi,{className:"mr-2 h-4 w-4"})}),"Filters",q.length>0&&(0,mt.jsx)("span",{className:"ml-2 rounded-full bg-primary px-2 py-0.5 text-xs text-primary-foreground",children:q.length})]})]}),(0,mt.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[o&&Ae.length>0&&(0,mt.jsxs)(Cr,{children:[(0,mt.jsx)(Sr,{asChild:!0,children:(0,mt.jsxs)(xe,{variant:"outline",size:"sm",children:[(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(vn,{className:"mr-2 h-4 w-4"})}),"Export"]})}),(0,mt.jsxs)(xr,{align:"end",children:[Ae.includes("csv")&&(0,mt.jsxs)(Ye,{onClick:()=>be("csv"),children:[(0,mt.jsx)(iv,{className:"mr-2 h-4 w-4"}),"Export as CSV"]}),Ae.includes("json")&&(0,mt.jsxs)(Ye,{onClick:()=>be("json"),children:[(0,mt.jsx)(Bx,{className:"mr-2 h-4 w-4"}),"Export as JSON"]}),Ae.includes("xlsx")&&(0,mt.jsxs)(Ye,{onClick:()=>be("xlsx"),children:[(0,mt.jsx)(oT,{className:"mr-2 h-4 w-4"}),"Export as Excel"]})]})]}),(0,mt.jsx)(Xje,{table:pe})]})]}),(0,mt.jsx)("div",{className:"moonui-pro-datatable-wrapper rounded-md border overflow-hidden",style:{contain:"layout style"},children:(0,mt.jsx)("div",{style:{overflowX:"auto"},children:(0,mt.jsxs)("table",{className:"moonui-pro-datatable",style:{width:"100%",tableLayout:"auto"},children:[(0,mt.jsx)("thead",{className:"moonui-data-table-header",children:pe.getHeaderGroups().map(De=>(0,mt.jsx)("tr",{className:"moonui-data-table-row border-b",children:De.headers.filter(ct=>ct.column.getIsVisible()).map(ct=>(0,mt.jsx)("th",{className:"moonui-data-table-th h-12 px-4 text-left align-middle font-medium text-muted-foreground",children:ct.isPlaceholder?null:(0,mt.jsxs)("div",{className:E("flex items-center space-x-2",ct.column.getCanSort()&&"cursor-pointer select-none"),onClick:ct.column.getCanSort()?Z(ct.column.id):void 0,children:[_ne(ct.column.columnDef.header,ct.getContext()),ct.column.getCanSort()&&(0,mt.jsx)("div",{className:"ml-2",children:ct.column.getIsSorted()==="asc"?(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(ov,{className:"h-4 w-4"})}):ct.column.getIsSorted()==="desc"?(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(Uf,{className:"h-4 w-4"})}):(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(nv,{className:"h-4 w-4"})})})]})},ct.id))},De.id))}),(0,mt.jsx)("tbody",{className:"moonui-data-table-body",children:te?(0,mt.jsx)(me.tr,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:(0,mt.jsx)("td",{colSpan:pe.getAllLeafColumns().filter(De=>De.getIsVisible()).length,className:"h-24 text-center",children:(0,mt.jsxs)("div",{className:"flex items-center justify-center space-x-2",children:[(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(Nr,{className:"h-4 w-4 animate-spin"})}),(0,mt.jsx)("span",{className:"text-sm text-muted-foreground",children:"Loading..."})]})})},"loading"):Me?.length?(0,mt.jsx)(mt.Fragment,{children:Me.map((De,ct)=>{let We=De.original.id||De.id,bt=f&&X.has(We);return(0,mt.jsx)(o6e,{row:De,columns:B,isExpanded:bt,enableExpandable:f,renderSubComponent:p,visibilityState:pe.getState().columnVisibility},We)})}):(0,mt.jsx)(me.tr,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:(0,mt.jsx)("td",{colSpan:pe.getAllLeafColumns().filter(De=>De.getIsVisible()).length,className:"h-24 text-center",children:"No results found."})},"no-results")})]})})}),i&&(0,mt.jsxs)("div",{className:"flex items-center justify-between px-2",children:[(0,mt.jsx)("div",{className:"flex-1 text-sm text-muted-foreground",children:a&&pe.getFilteredSelectedRowModel().rows.length>0&&(0,mt.jsxs)("span",{children:[pe.getFilteredSelectedRowModel().rows.length," ","of ",pe.getFilteredRowModel().rows.length," ","row(s) selected."]})}),(0,mt.jsxs)("div",{className:"flex items-center space-x-6 lg:space-x-8",children:[(0,mt.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,mt.jsx)("p",{className:"text-sm font-medium",children:"Rows per page"}),(0,mt.jsx)("select",{value:pe.getState().pagination.pageSize,onChange:async De=>{let ct=Number(De.target.value);S?S({pageIndex:pe.getState().pagination.pageIndex,pageSize:ct}):(se(!0),await new Promise(We=>setTimeout(We,300)),pe.setPageSize(ct),se(!1))},className:"h-8 w-[70px] rounded border border-input bg-background px-3 py-1 text-sm",disabled:te,children:l.map(De=>(0,mt.jsx)("option",{value:De,children:De},De))})]}),(0,mt.jsxs)("div",{className:"flex w-[100px] items-center justify-center text-sm font-medium",children:["Page ",pe.getState().pagination.pageIndex+1," of"," ",pe.getPageCount()]}),(0,mt.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,mt.jsx)(xe,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:async()=>{S?S({pageIndex:0,pageSize:pe.getState().pagination.pageSize}):(se(!0),await new Promise(De=>setTimeout(De,300)),pe.setPageIndex(0),se(!1))},disabled:!pe.getCanPreviousPage()||te,children:(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(ZE,{className:"h-4 w-4"})})}),(0,mt.jsx)(xe,{variant:"outline",className:"h-8 w-8 p-0",onClick:async()=>{if(S){let De=pe.getState().pagination.pageIndex;S({pageIndex:De-1,pageSize:pe.getState().pagination.pageSize})}else se(!0),await new Promise(De=>setTimeout(De,300)),pe.previousPage(),se(!1)},disabled:!pe.getCanPreviousPage()||te,children:(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(Za,{className:"h-4 w-4"})})}),(0,mt.jsx)(xe,{variant:"outline",className:"h-8 w-8 p-0",onClick:async()=>{se(!0),await new Promise(De=>setTimeout(De,300)),pe.nextPage(),se(!1)},disabled:!pe.getCanNextPage()||te,children:(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(Sn,{className:"h-4 w-4"})})}),(0,mt.jsx)(xe,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:async()=>{se(!0),await new Promise(De=>setTimeout(De,300)),pe.setPageIndex(pe.getPageCount()-1),se(!1)},disabled:!pe.getCanNextPage()||te,children:(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:(0,mt.jsx)(eT,{className:"h-4 w-4"})})})]})]})]}),n&&(0,mt.jsx)(t6e,{table:pe,open:J,onOpenChange:ee})]})}function VVt(e,t){return{id:"expander",header:()=>null,size:50,cell:({row:r})=>{let n=r.original.id||r.id,o=e.has(n);return(0,mt.jsx)("button",{onClick:a=>{a.stopPropagation(),t(n)},className:"p-2 hover:bg-muted rounded-md transition-colors","aria-label":o?"Collapse row":"Expand row",children:(0,mt.jsx)("span",{suppressHydrationWarning:!0,children:o?(0,mt.jsx)(qo,{className:"h-4 w-4 text-muted-foreground"}):(0,mt.jsx)(Sn,{className:"h-4 w-4 text-muted-foreground"})})})}}}function $Vt(e=new Set){let[t,r]=qi.default.useState(e),n=qi.default.useCallback(i=>{r(s=>{let l=new Set(s);return l.has(i)?l.delete(i):l.add(i),l})},[]),o=qi.default.useCallback(i=>{r(new Set(i))},[]),a=qi.default.useCallback(()=>{r(new Set)},[]);return{expandedRows:t,setExpandedRows:r,toggleRow:n,expandAll:o,collapseAll:a}}var o6e=({row:e,columns:t,isExpanded:r,enableExpandable:n,renderSubComponent:o,visibilityState:a})=>{let i=e.original.id||e.id;return(0,mt.jsxs)(mt.Fragment,{children:[(0,mt.jsx)("tr",{className:E("border-b transition-colors hover:bg-muted/50",e.getIsSelected()&&"bg-muted",r&&"border-b-0"),children:e.getAllCells().filter(s=>a[s.column.id]!==!1).map(s=>(0,mt.jsx)("td",{className:"moonui-data-table-td p-4 align-middle",children:_ne(s.column.columnDef.cell,s.getContext())},s.id))}),r&&o&&(0,mt.jsx)("tr",{className:"border-b",children:(0,mt.jsx)("td",{colSpan:e.getAllCells().filter(s=>a[s.column.id]!==!1).length||1,className:"p-0 overflow-hidden",children:(0,mt.jsx)("div",{className:"transition-all duration-300 ease-out",style:{maxHeight:r?"1000px":"0",opacity:r?1:0},children:(0,mt.jsx)("div",{className:"border-t border-border/50",children:o({row:{original:e.original,id:i}})})})})})]})};o6e.displayName="TableRow";var HVt=zne;var Cn=_(ye(),1);var rj=_(Vne(),1);var ot=_(ue(),1),$ne=Cn.default.memo(({searchInputRef:e,searchPlaceholder:t,initialValue:r,onSearchChange:n,keyboardShortcuts:o})=>{let[a,i]=(0,Cn.useState)(r||""),s=(0,Cn.useRef)(void 0);(0,Cn.useEffect)(()=>{i(r)},[r]);let l=(0,Cn.useCallback)(c=>{let u=c.target.value;i(u),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{n(u),e.current&&e.current.focus()},150)},[n,e]);return(0,Cn.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]),(0,ot.jsx)("div",{className:"p-4 border-b",children:(0,ot.jsxs)("div",{className:"relative",children:[(0,ot.jsx)($n,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),(0,ot.jsx)("input",{ref:e,type:"text",placeholder:t,value:a,onChange:l,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false",className:"w-full h-10 pl-9 pr-9 text-sm bg-background border border-input rounded-md 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&&(0,ot.jsxs)("kbd",{className:"absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 hidden sm:flex",children:[(0,ot.jsx)("span",{className:"text-xs",children:"\u2318"}),"K"]})]})})});$ne.displayName="SearchInput";function jVt({sections:e,footer:t,showSearch:r=!0,searchPlaceholder:n="Search...",searchQuery:o="",onSearchChange:a,showThemeToggle:i=!1,theme:s="system",onThemeChange:l,branding:c,collapsible:u=!0,defaultCollapsed:d=!1,floatingActionButton:f=!0,floatingActionButtonPosition:p={bottom:"1rem",left:"1rem"},floatingActionButtonClassName:m,glassmorphism:h=!1,animatedBackground:g=!1,keyboardShortcuts:v=!0,persistState:y=!0,persistKey:b="moonui-sidebar-state",onStateChange:w,customStyles:x,fullWidthItems:C=!0,enableNProgress:P=!0,className:R,activePath:L,onNavigate:$}){let[I,A]=(0,Cn.useState)(!1),[j,V]=(0,Cn.useState)(!1),[S,N]=(0,Cn.useState)(d),[k,T]=(0,Cn.useState)([]),[B,D]=(0,Cn.useState)(o),[z,M]=(0,Cn.useState)([]),G=(0,Cn.useRef)(null);(0,Cn.useEffect)(()=>{P&&rj.default.configure({easing:"ease",speed:800,showSpinner:!1,trickleSpeed:200,minimum:.2})},[P]);let q=aa(0),H=aa(0),F=Hp(q,{stiffness:300,damping:30}),W=Hp(H,{stiffness:300,damping:30});(0,Cn.useEffect)(()=>{if(y&&typeof window<"u"){let K=localStorage.getItem(b);if(K){let ne=JSON.parse(K);N(ne.collapsed),T(ne.expandedSections),M(ne.pinnedItems||[])}}},[y,b]),(0,Cn.useEffect)(()=>{if(y&&typeof window<"u"){let K={collapsed:S,expandedSections:k,searchQuery:B,pinnedItems:z,recentItems:[]};localStorage.setItem(b,JSON.stringify(K)),w?.(K)}},[S,k,B,z,y,b,w]),(0,Cn.useEffect)(()=>{let K=()=>{A(window.innerWidth<768)};return K(),window.addEventListener("resize",K),()=>window.removeEventListener("resize",K)},[]),(0,Cn.useEffect)(()=>{let K=e.filter(ne=>ne.defaultExpanded!==!1).map(ne=>ne.id);T(K)},[e]),(0,Cn.useEffect)(()=>{if(!v)return;let K=ne=>{(ne.metaKey||ne.ctrlKey)&&ne.key==="k"&&(ne.preventDefault(),G.current?.focus()),(ne.metaKey||ne.ctrlKey)&&ne.key==="b"&&(ne.preventDefault(),I?V(!j):N(!S))};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[v,I,j,S]),(0,Cn.useEffect)(()=>{if(!g)return;let K=ne=>{let ce=document.querySelector(".sidebar-container")?.getBoundingClientRect();ce&&(q.set(ne.clientX-ce.left),H.set(ne.clientY-ce.top))};return document.addEventListener("mousemove",K),()=>document.removeEventListener("mousemove",K)},[g,q,H]);let U=(0,Cn.useCallback)(K=>{T(ne=>ne.includes(K)?ne.filter(ce=>ce!==K):[...ne,K])},[]),O=(0,Cn.useCallback)(K=>{M(ne=>ne.includes(K)?ne.filter(ce=>ce!==K):[...ne,K])},[]),Y=(0,Cn.useCallback)(K=>{K.action?K.action():K.href&&(P&&(rj.default.start(),setTimeout(()=>rj.default.done(),500)),$?$(K.href):window.location.href=K.href,I&&V(!1))},[$,I,P]);(0,Cn.useEffect)(()=>{D(o)},[o]);let re=(0,Cn.useCallback)(K=>{D(K),a?.(K)},[a]),Q=(0,Cn.useCallback)((K,ne)=>ne?K.filter(ce=>{let Z=ce.title.toLowerCase().includes(ne.toLowerCase()),we=ce.items?.some(de=>de.title.toLowerCase().includes(ne.toLowerCase()));return Z||we}):K,[]),ae=(0,Cn.useMemo)(()=>B?e.map(K=>({...K,filteredItems:Q(K.items,B).map(ne=>({...ne,filteredChildren:ne.items?Q(ne.items,B):void 0}))})).filter(K=>K.filteredItems.length>0):e.map(K=>({...K,filteredItems:K.items.map(ne=>({...ne,filteredChildren:ne.items}))})),[e,B,Q]),te=(0,Cn.useCallback)(K=>{let ne=K.items&&K.items.length>0;return!ne&&!K.title?null:(0,ot.jsxs)("div",{className:E("min-w-[240px] max-w-[320px] p-3",h&&"bg-background/95 backdrop-blur-sm"),children:[(0,ot.jsx)("div",{className:"font-medium px-2 py-1.5 text-sm",children:K.title}),ne&&(0,ot.jsx)("div",{className:"mt-1 space-y-0.5",children:K.items?.map(ce=>{let Z=ce.href===L,we=ce.items&&ce.items.length>0;return(0,ot.jsx)("div",{className:"relative",children:we?(0,ot.jsxs)(tI,{openDelay:200,closeDelay:100,children:[(0,ot.jsx)(rI,{asChild:!0,children:(0,ot.jsxs)("button",{onClick:()=>Y(ce),disabled:ce.disabled,className:E("w-full flex items-center justify-between gap-2 rounded-md px-2 py-1.5 text-sm transition-colors","hover:bg-accent hover:text-accent-foreground cursor-pointer",Z&&"bg-primary/10 text-primary font-medium",ce.disabled&&"opacity-50 cursor-not-allowed"),children:[(0,ot.jsxs)("div",{className:"flex items-center gap-2",children:[ce.icon&&(0,ot.jsx)("span",{className:"flex-shrink-0",children:ce.icon}),(0,ot.jsx)("span",{className:"truncate",children:ce.title})]}),(0,ot.jsx)(Sn,{className:"h-3 w-3 flex-shrink-0"})]})}),(0,ot.jsx)(mN,{side:"right",align:"start",sideOffset:20,collisionPadding:20,avoidCollisions:!0,className:E("p-2 min-w-[200px] max-w-[280px] z-[99999]",h&&"bg-background/95 backdrop-blur-sm"),children:(0,ot.jsx)("div",{className:"space-y-0.5",children:ce.items?.map(de=>{let ge=de.href===L;return(0,ot.jsxs)("button",{onClick:()=>Y(de),disabled:de.disabled,className:E("w-full flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors","hover:bg-accent hover:text-accent-foreground cursor-pointer",ge&&"bg-primary/10 text-primary font-medium",de.disabled&&"opacity-50 cursor-not-allowed"),children:[de.icon&&(0,ot.jsx)("span",{className:"flex-shrink-0",children:de.icon}),(0,ot.jsx)("span",{className:"truncate",children:de.title}),de.badge&&(0,ot.jsx)(ht,{variant:de.badgeVariant||"secondary",className:"ml-auto flex-shrink-0 text-[10px] px-1.5 py-0 h-5",children:de.badge})]},de.id)})})})]}):(0,ot.jsxs)("button",{onClick:()=>Y(ce),disabled:ce.disabled,className:E("w-full flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors","hover:bg-accent hover:text-accent-foreground",Z&&"bg-primary/10 text-primary font-medium",ce.disabled&&"opacity-50 cursor-not-allowed"),children:[ce.icon&&(0,ot.jsx)("span",{className:"flex-shrink-0",children:ce.icon}),(0,ot.jsx)("span",{className:"truncate",children:ce.title}),ce.badge&&(0,ot.jsx)(ht,{variant:ce.badgeVariant||"secondary",className:"ml-auto flex-shrink-0 text-[10px] px-1.5 py-0 h-5",children:ce.badge})]})},ce.id)})})]})},[L,h,Y]),se=(0,Cn.useCallback)((K,ne=0,ce)=>{let Z=K.href===L,we=z.includes(K.id),de=K.items&&K.items.length>0,ge=k.includes(K.id),pe=S&&!I&&ne===0,ve=K.tooltip&&!S&&!pe,Pe=K.icon||(ne===0?(0,ot.jsx)(Uu,{className:"h-4 w-4"}):(0,ot.jsx)(Bu,{className:"h-3 w-3"})),ze=(0,ot.jsxs)("button",{onClick:()=>{de&&!S?U(K.id):de||Y(K)},className:E("group relative flex items-center gap-3 rounded-lg text-sm transition-all","w-full px-3 py-2.5","hover:bg-accent hover:text-accent-foreground",Z&&"bg-primary/10 text-primary font-medium",K.disabled&&"opacity-50 cursor-not-allowed",ne>0&&"ml-6 text-xs py-2",S&&ne===0&&"justify-center px-0 h-12",x?.hover),disabled:K.disabled,children:[(0,ot.jsx)("span",{className:E("flex-shrink-0 flex items-center justify-center",S&&ne===0&&"w-full",!S&&"w-5"),children:Pe}),(!S||ne>0)&&(0,ot.jsxs)(ot.Fragment,{children:[(0,ot.jsx)("span",{className:"flex-1 text-left truncate",children:K.title}),K.badge&&(0,ot.jsx)(ht,{variant:K.badgeVariant||"secondary",className:"ml-auto flex-shrink-0 text-[10px] px-1.5 py-0 h-5",children:K.badge}),de&&ne===0&&(0,ot.jsx)(qo,{className:E("h-4 w-4 flex-shrink-0 transition-transform",ge&&"rotate-180")}),we&&(0,ot.jsx)(ET,{className:"h-3 w-3 flex-shrink-0"})]})]});return pe?(0,ot.jsx)("div",{children:(0,ot.jsxs)(tI,{openDelay:200,closeDelay:100,children:[(0,ot.jsx)(rI,{asChild:!0,children:ze}),(0,ot.jsx)(mN,{side:"right",align:"start",sideOffset:20,collisionPadding:20,avoidCollisions:!0,className:E("p-0 w-auto min-w-[240px] max-w-[320px] z-[9999]",h&&"bg-background/95 backdrop-blur-sm","animate-in fade-in-0 slide-in-from-left-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-left-2"),children:(0,ot.jsx)(me.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15,ease:"easeOut"},children:te(K)})})]})},K.id):(0,ot.jsxs)("div",{children:[ve?(0,ot.jsx)(Xs,{children:(0,ot.jsxs)(xs,{children:[(0,ot.jsx)(ws,{asChild:!0,children:ze}),(0,ot.jsx)(ts,{side:"right",children:(0,ot.jsx)("p",{children:K.tooltip})})]})}):ze,de&&!S&&ce&&(0,ot.jsx)(kt,{initial:!1,children:ge&&(0,ot.jsx)(me.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},style:{overflow:"hidden"},children:(0,ot.jsx)("div",{className:"pt-1 space-y-1",children:ce.map(Oe=>se(Oe,ne+1))})},`${K.id}-children`)})]},K.id)},[L,z,k,S,x,Y,U,I,h,te,C]),oe=Cn.default.memo(()=>(0,ot.jsxs)("div",{className:E("flex items-center h-16 px-4 border-b",S&&!I&&"px-0 justify-center"),children:[c&&(0,ot.jsxs)(ot.Fragment,{children:[c.logo,(!S||I)&&c.title&&(0,ot.jsx)("span",{className:"font-semibold text-lg",children:c.title})]}),I&&(0,ot.jsx)(xe,{variant:"ghost",size:"sm",className:"ml-auto h-8 w-8 p-0",onClick:()=>V(!1),children:(0,ot.jsx)(fr,{className:"h-4 w-4"})}),!I&&u&&(0,ot.jsx)(xe,{variant:"ghost",size:"sm",className:E("h-8 w-8 p-0 transition-all",!S&&"ml-auto",S&&"mx-auto"),onClick:()=>N(!S),children:(0,ot.jsx)(me.div,{animate:{rotate:S?0:180},transition:{duration:.2},children:(0,ot.jsx)(Sn,{className:"h-4 w-4"})})})]})),le=Cn.default.memo(()=>(0,ot.jsx)("div",{className:"flex-1 overflow-y-auto overscroll-contain",style:{scrollbarWidth:"thin"},children:(0,ot.jsxs)("div",{className:"p-4 space-y-6",children:[z.length>0&&(!S||I)&&(0,ot.jsxs)("div",{children:[(0,ot.jsx)("h4",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Pinned"}),(0,ot.jsx)("div",{className:"space-y-1",children:e.flatMap(K=>K.items.filter(ne=>z.includes(ne.id))).map(K=>se(K))}),(0,ot.jsx)(Ps,{className:"mt-4"})]}),ae.map((K,ne)=>(0,ot.jsxs)("div",{children:[K.title&&(!S||I)&&(0,ot.jsx)("h4",{className:"text-xs font-medium text-muted-foreground mb-2",children:K.title}),(0,ot.jsx)("div",{className:"space-y-1",children:K.filteredItems.map(ce=>se(ce,0,ce.filteredChildren))}),K.showDivider&&ne<ae.length-1&&(0,ot.jsx)(Ps,{className:"mt-4"})]},K.id))]})}));le.displayName="SidebarMenuContent";let J=Cn.default.memo(()=>t?(0,ot.jsxs)("div",{className:"border-t p-4",children:[(0,ot.jsx)("div",{className:"space-y-1",children:t.items.map(K=>se(K))}),i&&(!S||I)&&(0,ot.jsxs)("div",{className:"mt-3 flex items-center justify-between",children:[(0,ot.jsx)("span",{className:"text-xs text-muted-foreground",children:"Theme"}),(0,ot.jsxs)(Cr,{children:[(0,ot.jsx)(Sr,{asChild:!0,children:(0,ot.jsxs)(xe,{variant:"ghost",size:"sm",className:"h-7 px-2",children:[s==="light"&&(0,ot.jsx)(ju,{className:"h-3 w-3"}),s==="dark"&&(0,ot.jsx)(Hu,{className:"h-3 w-3"}),s==="system"&&(0,ot.jsx)($u,{className:"h-3 w-3"})]})}),(0,ot.jsxs)(xr,{align:"end",children:[(0,ot.jsxs)(Ye,{onClick:()=>l?.("light"),children:[(0,ot.jsx)(ju,{className:"mr-2 h-4 w-4"}),"Light"]}),(0,ot.jsxs)(Ye,{onClick:()=>l?.("dark"),children:[(0,ot.jsx)(Hu,{className:"mr-2 h-4 w-4"}),"Dark"]}),(0,ot.jsxs)(Ye,{onClick:()=>l?.("system"),children:[(0,ot.jsx)($u,{className:"mr-2 h-4 w-4"}),"System"]})]})]})]})]}):null);J.displayName="SidebarFooter";let ee=Cn.default.memo(()=>(0,ot.jsxs)(ot.Fragment,{children:[(0,ot.jsx)(le,{}),(0,ot.jsx)(J,{})]}));ee.displayName="SidebarContent";let X=E("moonui-pro flex h-full flex-col bg-background border-r transition-all duration-300 ease-in-out relative z-[9990]",h&&"bg-background/80 backdrop-blur-xl border-white/10",S&&!I&&"w-20",!S&&!I&&"w-64",x?.background,x?.border,R);return I?(0,ot.jsxs)(ot.Fragment,{children:[f&&(0,ot.jsx)(xe,{onClick:()=>V(!0),className:E("fixed z-40 h-12 w-12 rounded-full shadow-lg md:hidden",m),size:"icon",style:{bottom:p?.bottom,left:p?.left,right:p?.right,top:p?.top},children:(0,ot.jsx)(Hf,{className:"h-5 w-5"})}),(0,ot.jsx)(J0,{open:j,onOpenChange:V,children:(0,ot.jsx)(Rv,{side:"left",className:"w-80 p-0",children:(0,ot.jsxs)("div",{className:E(X,"sidebar-container flex flex-col"),children:[g&&(0,ot.jsx)(me.div,{className:"absolute inset-0 opacity-30",style:{background:`radial-gradient(circle at ${F}px ${W}px, rgba(var(--primary-rgb), 0.15), transparent 50%)`}}),(0,ot.jsx)(oe,{}),r&&(!S||I)&&(0,ot.jsx)($ne,{searchInputRef:G,searchPlaceholder:n,initialValue:B,onSearchChange:re,keyboardShortcuts:v},"sidebar-search-mobile"),(0,ot.jsx)(ee,{})]})})})]}):(0,ot.jsxs)("aside",{className:E(X,"sidebar-container hidden md:flex flex-col"),children:[g&&(0,ot.jsx)(me.div,{className:"absolute inset-0 opacity-30",style:{background:`radial-gradient(circle at ${F}px ${W}px, rgba(var(--primary-rgb), 0.15), transparent 50%)`}}),(0,ot.jsx)(oe,{}),r&&(!S||I)&&(0,ot.jsx)($ne,{searchInputRef:G,searchPlaceholder:n,initialValue:B,onSearchChange:re,keyboardShortcuts:v},"sidebar-search-desktop"),(0,ot.jsx)(ee,{})]})}function i6e(e){let{hasProAccess:t,isLoading:r}=Ee();return!r&&!t?(0,ot.jsx)(Ve,{componentName:"Advanced Sidebar",compact:!0,className:E("w-full max-w-xs",e.className)}):(0,ot.jsx)(jVt,{...e})}var sl=_(ye(),1);var Mf=_(hr(),1),WVt=(e,t,r,n,o,a,i,s)=>{let l=document.documentElement,c=["light","dark"];function u(p){(Array.isArray(e)?e:[e]).forEach(m=>{let h=m==="class",g=h&&a?o.map(v=>a[v]||v):o;h?(l.classList.remove(...g),l.classList.add(a&&a[p]?a[p]:p)):l.setAttribute(m,p)}),d(p)}function d(p){s&&c.includes(p)&&(l.style.colorScheme=p)}function f(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(n)u(n);else try{let p=localStorage.getItem(t)||r,m=i&&p==="system"?f():p;u(m)}catch{}};var qVt=Mf.createContext(void 0),GVt={setTheme:e=>{},themes:[]},nj=()=>{var e;return(e=Mf.useContext(qVt))!=null?e:GVt};var Fcn=Mf.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:n,enableColorScheme:o,defaultTheme:a,value:i,themes:s,nonce:l,scriptProps:c})=>{let u=JSON.stringify([r,t,a,e,s,i,n,o]).slice(1,-1);return Mf.createElement("script",{...c,suppressHydrationWarning:!0,nonce:typeof window>"u"?l:"",dangerouslySetInnerHTML:{__html:`(${WVt.toString()})(${u})`}})});var bd=_(ye(),1);function s6e({sticky:e=!0,hideOnScroll:t=!1,showScrollProgress:r=!1,scrollBehavior:n="static",minimalConfig:o={}}={}){let[a,i]=(0,bd.useState)(!1),[s,l]=(0,bd.useState)(!1),[c,u]=(0,bd.useState)(0),[d,f]=(0,bd.useState)(!1),[p,m]=(0,bd.useState)(0),h=(0,bd.useRef)(0),g=(0,bd.useRef)(!1),{scrollThreshold:v=50,animationDuration:y=300}=o,b=(0,bd.useCallback)(()=>{let x=window.scrollY;m(x);let C=x>10;if(i(C),n==="hide"||t)x>h.current&&x>100?l(!0):l(!1);else if(n==="minimal"){let P=x>v;f(R=>R!==P?P:R)}if(r){let P=window.scrollY,R=document.documentElement.scrollHeight-document.documentElement.clientHeight,L=R>0?P/R*100:0;u(Math.min(100,Math.max(0,L)))}h.current=x,g.current=!1},[t,n,r,v]),w=(0,bd.useCallback)(()=>{g.current||(requestAnimationFrame(b),g.current=!0)},[b]);return(0,bd.useEffect)(()=>{if(!(!e&&n==="static"&&!r))return b(),window.addEventListener("scroll",w,{passive:!0}),()=>{window.removeEventListener("scroll",w)}},[e,n,r,w,b]),{scrolled:a,hidden:s,scrollProgress:c,isMinimal:d,scrollY:p}}var oj=_(Vne(),1);var Ce=_(ue(),1);function KVt({sections:e=[],branding:t,showSearch:r=!0,enableCommandAI:n=!1,commandAIShortcut:o="\u2318K",commandAIPlaceholder:a="Search commands...",onCommandAIOpen:i,onCommandAIClose:s,onCommandAISelect:l,searchPlaceholder:c="Search...",onSearch:u,showThemeToggle:d=!1,theme:f="system",onThemeChange:p,themeToggleVariant:m="dropdown",userMenu:h,notifications:g,cta:v,sticky:y=!0,glassmorphism:b=!1,animatedBackground:w=!1,keyboardShortcuts:x=!0,hideNavItems:C=!1,mobileBreakpoint:P=768,customStyles:R,variant:L="default",size:$="md",blur:I=!0,shadow:A=!1,rounded:j=!1,logoPosition:V="left",navItemsPosition:S="left",mobileMenuPosition:N="left",hideOnScroll:k=!1,showScrollProgress:T=!1,scrollBehavior:B="static",minimalConfig:D={},maxWidth:z="2xl",fullWidth:M=!1,overlayMode:G=!1,autoExpand:q=!1,containerMaxWidth:H="5xl",enableNProgress:F=!0,progressBarInset:W=!0,pushContent:U,className:O,activePath:Y,onNavigate:re}){let[Q,ae]=(0,sl.useState)(!1),[te,se]=(0,sl.useState)(!1),[oe,le]=(0,sl.useState)(!1),[J,ee]=(0,sl.useState)(!1),[X,K]=(0,sl.useState)(""),{theme:ne,setTheme:ce}=nj(),Z=ne==="dark",we=(0,sl.useRef)(null),de=U??(y&&!G),{scrolled:ge,hidden:pe,scrollProgress:ve,isMinimal:Pe}=s6e({sticky:y,hideOnScroll:k,showScrollProgress:T,scrollBehavior:B,minimalConfig:D}),ze=d_({scrolledThreshold:50,hiddenThreshold:150,disableHiding:L==="floating-sticky"});(0,sl.useEffect)(()=>{F&&oj.default.configure({easing:"ease",speed:800,showSpinner:!1,trickleSpeed:200,minimum:.2})},[F]),(0,sl.useEffect)(()=>{let Ue=()=>{ae(window.innerWidth<P)};return Ue(),window.addEventListener("resize",Ue),()=>window.removeEventListener("resize",Ue)},[P]),(0,sl.useEffect)(()=>{if(!x&&!n)return;let Ue=Be=>{(Be.metaKey||Be.ctrlKey)&&Be.key==="k"&&(Be.preventDefault(),ee(!0),n&&i?.())};return document.addEventListener("keydown",Ue),()=>document.removeEventListener("keydown",Ue)},[x,n,i]);let Oe=(0,sl.useCallback)(()=>{if(!t?.logo)return null;let Be=(ze.isScrolled||ge)&&t.logoSmall?t.logoSmall:null,He=Z?t.logoDark||null:t.logoLight||null;return Be||He||t.logo},[t,ze.isScrolled,ge,Z]),Me=(0,sl.useCallback)(Ue=>{if(Ue.action)Ue.action();else if(Ue.href)if(Ue.href.startsWith("#")){let Be=document.querySelector(Ue.href);Be&&Be.scrollIntoView({behavior:"smooth",block:"start"}),Q&&se(!1)}else F&&(oj.default.start(),setTimeout(()=>oj.default.done(),500)),re?re(Ue.href):window.location.href=Ue.href,Q&&se(!1)},[re,Q,F]),fe=(0,sl.useCallback)(Ue=>{K(Ue),u?.(Ue)},[u]),be=Ue=>(0,Ce.jsx)("div",{className:"grid gap-3 p-6 md:w-[400px] lg:w-[500px] lg:grid-cols-[.75fr_1fr]",children:Ue.map(Be=>(0,Ce.jsxs)(wN,{className:E("block select-none space-y-1 rounded-md p-3 leading-none no-underline outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground cursor-pointer",Be.disabled&&"opacity-50 cursor-not-allowed"),onClick:()=>!Be.disabled&&Me(Be),children:[(0,Ce.jsxs)("div",{className:"flex items-center gap-2",children:[Be.icon&&(0,Ce.jsx)("span",{className:"flex-shrink-0",children:Be.icon}),(0,Ce.jsx)("div",{className:"text-sm font-medium leading-none",children:Be.title}),Be.badge&&(0,Ce.jsx)(ht,{variant:Be.badgeVariant||"secondary",className:"ml-auto",children:Be.badge})]}),Be.description&&(0,Ce.jsx)("p",{className:"line-clamp-2 text-sm leading-snug text-muted-foreground",children:Be.description})]},Be.id))}),Ae=Ue=>(0,Ce.jsx)(Ce.Fragment,{children:Ue.map(Be=>Be.items&&Be.items.length>0?(0,Ce.jsxs)(ed,{children:[(0,Ce.jsx)(ou,{disabled:Be.disabled,children:(0,Ce.jsxs)("span",{className:"flex items-center gap-2",children:[Be.icon&&(0,Ce.jsx)("span",{children:Be.icon}),Be.title]})}),(0,Ce.jsx)(au,{children:Ae(Be.items)})]},Be.id):(0,Ce.jsxs)(Ye,{disabled:Be.disabled,onClick:()=>Me(Be),children:[(0,Ce.jsxs)("span",{className:"flex items-center gap-2",children:[Be.icon&&(0,Ce.jsx)("span",{children:Be.icon}),Be.title]}),Be.badge&&(0,Ce.jsx)(ht,{variant:Be.badgeVariant||"secondary",className:"ml-auto",children:Be.badge})]},Be.id))}),Te=()=>(0,Ce.jsxs)(J0,{open:te,onOpenChange:se,children:[(0,Ce.jsx)(t3,{asChild:!0,children:(0,Ce.jsx)(xe,{variant:"ghost",size:"icon",className:"lg:hidden",children:(0,Ce.jsx)(Hf,{className:"h-5 w-5"})})}),(0,Ce.jsxs)(Rv,{side:N,className:"w-80 p-0",children:[(0,Ce.jsx)(Mw,{className:"sr-only",children:"Navigation Menu"}),(0,Ce.jsxs)("div",{className:"flex h-full flex-col",children:[(0,Ce.jsx)("div",{className:"flex items-center p-4 border-b",children:t&&(0,Ce.jsxs)("div",{className:"flex items-center gap-2",children:[Oe(),t.title&&(0,Ce.jsx)("span",{className:"font-semibold text-lg",children:t.title})]})}),(0,Ce.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:!C&&e.map(Ue=>(0,Ce.jsxs)("div",{className:"space-y-1",children:[Ue.items.map(Be=>(0,Ce.jsx)("div",{children:Be.items&&Be.items.length>0?(0,Ce.jsxs)(Cr,{children:[(0,Ce.jsx)(Sr,{asChild:!0,children:(0,Ce.jsxs)(xe,{variant:"ghost",className:"w-full justify-between",disabled:Be.disabled,children:[(0,Ce.jsxs)("span",{className:"flex items-center gap-2",children:[Be.icon&&(0,Ce.jsx)("span",{children:Be.icon}),Be.title]}),(0,Ce.jsx)(qo,{className:"h-4 w-4"})]})}),(0,Ce.jsx)(xr,{align:"start",className:"w-56",children:Be.items&&Ae(Be.items)})]}):(0,Ce.jsxs)(xe,{variant:"ghost",className:"w-full justify-start",disabled:Be.disabled,onClick:()=>Me(Be),children:[(0,Ce.jsxs)("span",{className:"flex items-center gap-2",children:[Be.icon&&(0,Ce.jsx)("span",{children:Be.icon}),Be.title]}),Be.badge&&(0,Ce.jsx)(ht,{variant:Be.badgeVariant||"secondary",className:"ml-auto",children:Be.badge})]})},Be.id)),(0,Ce.jsx)(Ps,{className:"my-2"})]},Ue.id))})]})]})]}),De=(Ue=!1)=>{switch($){case"sm":return Ue?"h-12":"h-14";case"lg":return Ue?"h-16":"h-20";case"xl":return Ue?"h-20":"h-24";case"2xl":return Ue?"h-24":"h-28";default:return Ue?"h-14":"h-16"}},ct=()=>{if(B==="minimal"&&D?.heightOnScroll)return D.heightOnScroll;let Ue={sm:"h-14",md:"h-16",lg:"h-20",xl:"h-24","2xl":"h-28"};return Ue[$]||Ue.md},We=()=>{switch($){case"sm":return{text:"text-sm",logoText:"text-base",spacing:"space-x-2",gap:"gap-2",buttonSize:"sm",iconSize:"h-4 w-4",padding:"px-2 py-1"};case"lg":return{text:"text-base",logoText:"text-xl",spacing:"space-x-4",gap:"gap-3",buttonSize:"md",iconSize:"h-5 w-5",padding:"px-3 py-2"};case"xl":return{text:"text-lg",logoText:"text-2xl",spacing:"space-x-6",gap:"gap-4",buttonSize:"lg",iconSize:"h-6 w-6",padding:"px-4 py-2.5"};case"2xl":return{text:"text-xl",logoText:"text-3xl",spacing:"space-x-8",gap:"gap-5",buttonSize:"lg",iconSize:"h-7 w-7",padding:"px-5 py-3"};default:return{text:"text-sm",logoText:"text-lg",spacing:"space-x-4",gap:"gap-2",buttonSize:"md",iconSize:"h-5 w-5",padding:"px-3 py-1.5"}}},bt=L==="floating-auto-hide"||L==="floating-sticky",It=E("moonui-pro",!bt&&"transition-all duration-300 ease-in-out",!(L==="floating-centered"&&G)&&"w-full",L==="default"&&"border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",L==="floating"&&"mx-4 mt-4 rounded-lg border bg-background/95 backdrop-blur shadow-lg",L==="floating-centered"&&E("mx-auto rounded-2xl border border-border/40 bg-background/70 backdrop-blur-xl shadow-lg shadow-black/5 dark:shadow-black/20 px-6",G&&"left-1/2 -translate-x-1/2 top-4",!G&&!y&&"my-4",H==="3xl"&&"max-w-3xl",H==="4xl"&&"max-w-4xl",H==="5xl"&&"max-w-5xl",H==="6xl"&&"max-w-6xl",H==="7xl"&&"max-w-7xl",H==="full"&&"max-w-full px-8",!H&&q&&"max-w-max"),L==="floating-auto-hide"&&E("fixed top-0 z-50 w-full border-b",ze.isScrolled?"border-b bg-background/80 backdrop-blur-xl shadow-lg":"border-b border-transparent bg-background/95 backdrop-blur"),L==="floating-sticky"&&E("fixed top-0 z-50 w-full border-b",ze.isScrolled?"border-b bg-background/80 backdrop-blur-xl shadow-lg":"border-b border-transparent bg-background/95 backdrop-blur"),L==="minimal"&&"bg-background",L==="transparent"&&"bg-transparent",G&&"absolute z-50",!G&&y&&"sticky top-0 z-50",ge&&y&&L!=="transparent"&&"shadow-sm",ge&&L==="transparent"&&"bg-background/95 backdrop-blur border-b",B==="hide"&&pe&&!bt&&"-translate-y-full",b&&"bg-background/80 backdrop-blur-xl border-white/10",I&&"backdrop-blur-md",A&&"shadow-lg",j&&"rounded-lg",R?.background,R?.border,O),it=bt?me.nav:"nav";console.log("\u{1F680} NAVBAR PACKAGE VERSION CHECK:",{variant:L,isFloatingVariant:bt,isHidden:ze.isHidden,isScrolled:ze.isScrolled,NavWrapper:it===me.nav?"motion.nav \u2705":"plain nav \u274C",timestamp:new Date().toISOString()});let Ft=bt?{animate:{y:ze.isHidden?-100:0,opacity:ze.isHidden?0:1},transition:{duration:.3,ease:"easeInOut"}}:{};console.log("\u{1F3AC} MOTION PROPS:",{hasProps:Object.keys(Ft).length>0,animate:Ft.animate,transition:Ft.transition});let yr=bt?E("fixed top-0 z-50 w-full transition-all duration-300",ze.isScrolled?"border-b bg-background/80 backdrop-blur-xl shadow-lg":"border-b border-transparent bg-background/95 backdrop-blur"):It;return(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsxs)(it,{ref:we,className:yr,...Ft,children:[L==="floating-auto-hide"||L==="floating-sticky"?(0,Ce.jsx)("div",{className:E("transition-all duration-300",ze.isScrolled?"max-w-6xl mx-auto px-2 sm:px-3 lg:px-4":"w-full px-2 sm:px-3 lg:px-4"),children:(0,Ce.jsxs)("div",{className:E("flex items-center justify-between transition-all duration-300",De(ze.isScrolled)),children:[t&&(0,Ce.jsxs)("div",{className:E("flex items-center gap-2",V==="center"&&!Q?"absolute left-1/2 -translate-x-1/2":"mr-4"),children:[V==="left"&&N==="left"&&(0,Ce.jsx)(Te,{}),(0,Ce.jsxs)("a",{href:t.href||"/",onClick:Ue=>{t.href&&re&&(Ue.preventDefault(),re(t.href))},className:"flex items-center gap-2",suppressHydrationWarning:!0,children:[(0,Ce.jsx)(kt,{mode:"wait",children:(0,Ce.jsx)(me.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeInOut"},suppressHydrationWarning:!0,children:Oe()},`logo-${ze.isScrolled?"scrolled":"default"}-${Z?"dark":"light"}`)}),(0,Ce.jsx)(kt,{mode:"wait",children:t.title&&!Q&&!ze.isScrolled&&(0,Ce.jsx)(me.span,{className:E("font-semibold overflow-hidden",We().logoText),initial:{opacity:0,width:0},animate:{opacity:1,width:"auto"},exit:{opacity:0,width:0},transition:{duration:.2,ease:"easeInOut"},children:t.title},"logo-text")})]})]}),!Q&&!C&&(0,Ce.jsx)(gN,{className:E("hidden lg:flex",q||!bt&&L==="minimal"?"flex-nowrap":"flex-wrap overflow-x-auto scrollbar-hide scroll-smooth",S==="center"&&"flex-1 justify-center mx-4",S==="right"&&"ml-auto",S==="left"&&"ml-4",Pe&&D?.centerOnScroll&&S!=="center"&&"flex-1 justify-center",S==="center"&&"absolute left-1/2 transform -translate-x-1/2"),children:(0,Ce.jsx)(vN,{children:e.map(Ue=>(0,Ce.jsx)(sl.default.Fragment,{children:Ue.items.map(Be=>{let He=Be.items&&Be.items.length>0,st=Be.href===Y;return He?(0,Ce.jsxs)(zw,{children:[(0,Ce.jsx)(bN,{className:E(st&&"bg-accent text-accent-foreground",Be.disabled&&"opacity-50 cursor-not-allowed"),disabled:Be.disabled,children:(0,Ce.jsxs)("span",{className:"flex items-center gap-2",children:[Be.icon&&(0,Ce.jsx)("span",{children:Be.icon}),Be.title]})}),(0,Ce.jsx)(xN,{children:Be.items&&be(Be.items)})]},Be.id):(0,Ce.jsx)(zw,{children:(0,Ce.jsxs)(wN,{className:E(yN(),"cursor-pointer",We().text,We().padding,st&&"bg-accent text-accent-foreground",Be.disabled&&"opacity-50 cursor-not-allowed"),onClick:()=>!Be.disabled&&Me(Be),children:[(0,Ce.jsxs)("span",{className:E("flex items-center",We().gap),children:[Be.icon&&(0,Ce.jsx)("span",{className:We().iconSize,children:Be.icon}),Be.title]}),Be.badge&&(0,Ce.jsx)(ht,{variant:Be.badgeVariant||"secondary",className:"ml-2",children:Be.badge})]})},Be.id)})},Ue.id))})}),(0,Ce.jsxs)("div",{className:"ml-auto flex items-center gap-1 sm:gap-2",children:[r&&!ze.isScrolled&&(0,Ce.jsx)(Ce.Fragment,{children:Q?(0,Ce.jsx)(xe,{variant:"ghost",size:"icon",onClick:()=>ee(!0),children:(0,Ce.jsx)($n,{className:"h-5 w-5"})}):(0,Ce.jsxs)("div",{className:"relative",children:[(0,Ce.jsx)($n,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,Ce.jsx)(Zt,{type:"search",placeholder:c,className:"w-64 pl-9 pr-4 h-9 cursor-pointer",value:X,onChange:Ue=>fe(Ue.target.value),onClick:()=>{n&&(ee(!0),i?.())},readOnly:n}),(x||n)&&(0,Ce.jsx)("kbd",{className:"absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 hidden sm:flex",children:n?o:(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)("span",{className:"text-xs",children:"\u2318"}),"K"]})})]})}),d&&(m==="button"?(0,Ce.jsx)(me.div,{whileTap:{scale:.95},className:"relative",children:(0,Ce.jsx)(xe,{variant:"ghost",size:We().buttonSize,onClick:()=>{let Ue=ne==="dark"?"light":"dark";ce(Ue),p?.(Ue)},className:"relative overflow-hidden",suppressHydrationWarning:!0,children:(0,Ce.jsx)("div",{suppressHydrationWarning:!0,children:(0,Ce.jsx)(kt,{mode:"wait",children:ne==="dark"?(0,Ce.jsx)(me.div,{initial:{y:-20,opacity:0},animate:{y:0,opacity:1},exit:{y:20,opacity:0},transition:{duration:.2},suppressHydrationWarning:!0,children:(0,Ce.jsx)(Hu,{className:We().iconSize,suppressHydrationWarning:!0})},"moon"):(0,Ce.jsx)(me.div,{initial:{y:-20,opacity:0,rotate:-90},animate:{y:0,opacity:1,rotate:0},exit:{y:20,opacity:0,rotate:90},transition:{duration:.2},suppressHydrationWarning:!0,children:(0,Ce.jsx)(ju,{className:We().iconSize,suppressHydrationWarning:!0})},"sun")})})})}):(0,Ce.jsxs)(Cr,{children:[(0,Ce.jsx)(Sr,{asChild:!0,children:(0,Ce.jsx)(xe,{variant:"ghost",size:"icon",suppressHydrationWarning:!0,children:(0,Ce.jsxs)("div",{suppressHydrationWarning:!0,children:[ne==="light"&&(0,Ce.jsx)(ju,{className:"h-5 w-5",suppressHydrationWarning:!0}),ne==="dark"&&(0,Ce.jsx)(Hu,{className:"h-5 w-5",suppressHydrationWarning:!0}),ne==="system"&&(0,Ce.jsx)($u,{className:"h-5 w-5",suppressHydrationWarning:!0})]})})}),(0,Ce.jsxs)(xr,{align:"end",children:[(0,Ce.jsxs)(Ye,{onClick:()=>{ce("light"),p?.("light")},children:[(0,Ce.jsx)(ju,{className:"mr-2 h-4 w-4"}),"Light"]}),(0,Ce.jsxs)(Ye,{onClick:()=>{ce("dark"),p?.("dark")},children:[(0,Ce.jsx)(Hu,{className:"mr-2 h-4 w-4"}),"Dark"]}),(0,Ce.jsxs)(Ye,{onClick:()=>{ce("system"),p?.("system")},children:[(0,Ce.jsx)($u,{className:"mr-2 h-4 w-4"}),"System"]})]})]})),g&&!ze.isScrolled&&(0,Ce.jsxs)(Cr,{children:[(0,Ce.jsx)(Sr,{asChild:!0,children:(0,Ce.jsxs)(xe,{variant:"ghost",size:"icon",className:"relative",children:[(0,Ce.jsx)(Bd,{className:"h-5 w-5"}),g.count&&g.count>0&&(0,Ce.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] rounded-full bg-red-500 text-[11px] font-medium text-white flex items-center justify-center px-1",children:g.count>9?"9+":g.count})]})}),(0,Ce.jsxs)(xr,{align:"end",className:"w-[380px] p-0",sideOffset:8,children:[(0,Ce.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b",children:[(0,Ce.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Ce.jsx)("h4",{className:"text-base font-semibold",children:"Notifications"}),g.count&&g.count>0&&(0,Ce.jsxs)(ht,{variant:"secondary",className:"h-5 px-2 rounded-full bg-primary/10 text-primary border-0",children:[g.count," ","new"]})]}),g.items&&g.items.length>0&&(0,Ce.jsx)(xe,{variant:"ghost",size:"sm",className:"text-xs h-7 px-2 text-muted-foreground hover:text-foreground",onClick:Ue=>{Ue.preventDefault(),console.log("Mark all as read")},children:"Mark all read"})]}),(0,Ce.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:g.items&&g.items.length>0?(0,Ce.jsx)("div",{className:"py-1",children:g.items.map((Ue,Be)=>(0,Ce.jsxs)("div",{children:[(0,Ce.jsx)("button",{className:E("w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors","focus:outline-none focus:bg-muted/50",!Ue.read&&"bg-primary/5 hover:bg-primary/10"),onClick:()=>g.onNotificationClick?.(Ue.id),children:(0,Ce.jsxs)("div",{className:"flex gap-3",children:[(0,Ce.jsx)("div",{className:"mt-1.5",children:(0,Ce.jsx)("div",{className:E("h-2 w-2 rounded-full",Ue.read?"bg-transparent":"bg-primary")})}),(0,Ce.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,Ce.jsx)("p",{className:E("text-sm leading-tight",Ue.read?"font-normal":"font-medium"),children:Ue.title}),Ue.description&&(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:Ue.description}),Ue.time&&(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground/70 mt-1",children:Ue.time})]})]})}),Be<(g.items?.length||0)-1&&(0,Ce.jsx)("div",{className:"mx-4 border-b"})]},Ue.id))}):(0,Ce.jsxs)("div",{className:"py-12 text-center",children:[(0,Ce.jsx)(Bd,{className:"h-10 w-10 mx-auto text-muted-foreground/30 mb-3"}),(0,Ce.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"No new notifications"}),(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"You're all caught up!"})]})}),g.items&&g.items.length>0&&(0,Ce.jsx)("div",{className:"border-t p-2",children:(0,Ce.jsx)(xe,{variant:"ghost",className:"w-full h-8 text-xs text-muted-foreground hover:text-foreground",onClick:Ue=>{Ue.preventDefault(),console.log("View all notifications")},children:"View all notifications"})})]})]}),v&&!ze.isScrolled&&(0,Ce.jsx)(xe,{variant:v.variant||"primary",size:Q?"sm":We().buttonSize,onClick:()=>{if(v.action)v.action();else if(v.href)if(v.href.startsWith("#")){let Ue=document.querySelector(v.href);Ue&&Ue.scrollIntoView({behavior:"smooth",block:"start"})}else re?re(v.href):window.location.href=v.href},className:Q?"":"ml-2",children:v.text}),h&&!ze.isScrolled&&(0,Ce.jsxs)(Cr,{children:[(0,Ce.jsx)(Sr,{asChild:!0,children:(0,Ce.jsx)(xe,{variant:"ghost",size:"icon",className:"relative",children:(0,Ce.jsxs)(pa,{className:"h-8 w-8",children:[(0,Ce.jsx)(Si,{src:h.user?.avatar,alt:h.user?.name}),(0,Ce.jsx)(Oa,{children:h.user?.name?.charAt(0)||(0,Ce.jsx)(Hd,{className:"h-4 w-4"})})]})})}),(0,Ce.jsxs)(xr,{align:"end",className:"w-56",children:[h.user&&(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsxs)("div",{className:"p-2",children:[(0,Ce.jsx)("p",{className:"text-sm font-medium",children:h.user.name}),(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground",children:h.user.email})]}),(0,Ce.jsx)(qr,{})]}),h.items&&Ae(h.items)]})]})]})]})}):(0,Ce.jsxs)("div",{className:E("flex items-center transition-all duration-300 ease-in-out","transition-[height] duration-300 ease-in-out",De(),L==="floating-centered"?"w-full px-6":L==="minimal"||M?"w-full px-4 sm:px-6 lg:px-8":z==="sm"&&"container max-w-screen-sm"||z==="md"&&"container max-w-screen-md"||z==="lg"&&"container max-w-screen-lg"||z==="xl"&&"container max-w-screen-xl"||z==="2xl"&&"container max-w-screen-2xl"||z==="full"&&"w-full px-4 sm:px-6 lg:px-8"),children:[t&&(0,Ce.jsxs)("div",{className:E("flex items-center gap-2",V==="center"&&!Q&&L!=="floating-centered"?"absolute left-1/2 -translate-x-1/2":"mr-4"),children:[V==="left"&&N==="left"&&(0,Ce.jsx)(Te,{}),(0,Ce.jsxs)("a",{href:t.href||"/",onClick:Ue=>{t.href&&re&&(Ue.preventDefault(),re(t.href))},className:"flex items-center gap-2",children:[(0,Ce.jsx)(kt,{mode:"wait",children:(0,Ce.jsx)(me.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeInOut"},children:Oe()},`logo-${ze.isScrolled?"scrolled":"default"}-${Z?"dark":"light"}`)}),(0,Ce.jsx)(kt,{mode:"wait",children:t.title&&!Q&&!ze.isScrolled&&(0,Ce.jsx)(me.span,{className:E("font-semibold overflow-hidden",We().logoText),initial:{opacity:0,width:0},animate:{opacity:1,width:"auto"},exit:{opacity:0,width:0},transition:{duration:.2,ease:"easeInOut"},children:t.title},"logo-text")})]})]}),!Q&&!C&&(0,Ce.jsx)(gN,{className:E("hidden lg:flex",L==="minimal"&&"flex-1 w-full",q||!bt&&L==="minimal"?"flex-nowrap":"flex-wrap overflow-x-auto scrollbar-hide scroll-smooth",S==="center"&&L!=="floating-centered"&&"flex-1 justify-center mx-4",S==="center"&&L==="floating-centered"&&"flex-1 justify-center",S==="right"&&"ml-auto",S==="left"&&"ml-4",Pe&&D?.centerOnScroll&&S!=="center"&&"flex-1 justify-center",S==="center"&&L!=="floating-centered"&&"absolute left-1/2 transform -translate-x-1/2"),children:(0,Ce.jsx)(vN,{className:E(L==="minimal"&&"w-full justify-between gap-1"),children:e.map(Ue=>(0,Ce.jsx)(sl.default.Fragment,{children:Ue.items.map(Be=>{let He=Be.items&&Be.items.length>0,st=Be.href===Y;return He?(0,Ce.jsxs)(zw,{children:[(0,Ce.jsx)(bN,{className:E(st&&"bg-accent text-accent-foreground",Be.disabled&&"opacity-50 cursor-not-allowed"),disabled:Be.disabled,children:(0,Ce.jsxs)("span",{className:"flex items-center gap-2",children:[Be.icon&&(0,Ce.jsx)("span",{children:Be.icon}),Be.title]})}),(0,Ce.jsx)(xN,{children:Be.items&&be(Be.items)})]},Be.id):(0,Ce.jsx)(zw,{children:(0,Ce.jsxs)(wN,{className:E(yN(),"cursor-pointer",We().text,We().padding,st&&"bg-accent text-accent-foreground",Be.disabled&&"opacity-50 cursor-not-allowed"),onClick:()=>!Be.disabled&&Me(Be),children:[(0,Ce.jsxs)("span",{className:E("flex items-center",We().gap),children:[Be.icon&&(0,Ce.jsx)("span",{className:We().iconSize,children:Be.icon}),Be.title]}),Be.badge&&(0,Ce.jsx)(ht,{variant:Be.badgeVariant||"secondary",className:"ml-2",children:Be.badge})]})},Be.id)})},Ue.id))})}),(0,Ce.jsxs)("div",{className:"ml-auto flex items-center gap-1 sm:gap-2",children:[r&&!ze.isScrolled&&(0,Ce.jsx)(Ce.Fragment,{children:Q?(0,Ce.jsx)(xe,{variant:"ghost",size:"icon",onClick:()=>ee(!0),children:(0,Ce.jsx)($n,{className:"h-5 w-5"})}):(0,Ce.jsxs)("div",{className:"relative",children:[(0,Ce.jsx)($n,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,Ce.jsx)(Zt,{type:"search",placeholder:c,className:"w-64 pl-9 pr-4 h-9 cursor-pointer",value:X,onChange:Ue=>fe(Ue.target.value),onClick:()=>{n&&(ee(!0),i?.())},readOnly:n}),(x||n)&&(0,Ce.jsx)("kbd",{className:"absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 hidden sm:flex",children:n?o:(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)("span",{className:"text-xs",children:"\u2318"}),"K"]})})]})}),d&&(m==="button"?(0,Ce.jsx)(me.div,{whileTap:{scale:.95},className:"relative",children:(0,Ce.jsx)(xe,{variant:"ghost",size:We().buttonSize,onClick:()=>{let Ue=ne==="dark"?"light":"dark";ce(Ue),p?.(Ue)},className:"relative overflow-hidden",suppressHydrationWarning:!0,children:(0,Ce.jsx)("div",{suppressHydrationWarning:!0,children:(0,Ce.jsx)(kt,{mode:"wait",children:ne==="dark"?(0,Ce.jsx)(me.div,{initial:{y:-20,opacity:0},animate:{y:0,opacity:1},exit:{y:20,opacity:0},transition:{duration:.2},suppressHydrationWarning:!0,children:(0,Ce.jsx)(Hu,{className:We().iconSize,suppressHydrationWarning:!0})},"moon"):(0,Ce.jsx)(me.div,{initial:{y:-20,opacity:0,rotate:-90},animate:{y:0,opacity:1,rotate:0},exit:{y:20,opacity:0,rotate:90},transition:{duration:.2},suppressHydrationWarning:!0,children:(0,Ce.jsx)(ju,{className:We().iconSize,suppressHydrationWarning:!0})},"sun")})})})}):(0,Ce.jsxs)(Cr,{children:[(0,Ce.jsx)(Sr,{asChild:!0,children:(0,Ce.jsx)(xe,{variant:"ghost",size:"icon",suppressHydrationWarning:!0,children:(0,Ce.jsxs)("div",{suppressHydrationWarning:!0,children:[ne==="light"&&(0,Ce.jsx)(ju,{className:"h-5 w-5",suppressHydrationWarning:!0}),ne==="dark"&&(0,Ce.jsx)(Hu,{className:"h-5 w-5",suppressHydrationWarning:!0}),ne==="system"&&(0,Ce.jsx)($u,{className:"h-5 w-5",suppressHydrationWarning:!0})]})})}),(0,Ce.jsxs)(xr,{align:"end",children:[(0,Ce.jsxs)(Ye,{onClick:()=>{ce("light"),p?.("light")},children:[(0,Ce.jsx)(ju,{className:"mr-2 h-4 w-4"}),"Light"]}),(0,Ce.jsxs)(Ye,{onClick:()=>{ce("dark"),p?.("dark")},children:[(0,Ce.jsx)(Hu,{className:"mr-2 h-4 w-4"}),"Dark"]}),(0,Ce.jsxs)(Ye,{onClick:()=>{ce("system"),p?.("system")},children:[(0,Ce.jsx)($u,{className:"mr-2 h-4 w-4"}),"System"]})]})]})),g&&!ze.isScrolled&&(0,Ce.jsxs)(Cr,{children:[(0,Ce.jsx)(Sr,{asChild:!0,children:(0,Ce.jsxs)(xe,{variant:"ghost",size:"icon",className:"relative",children:[(0,Ce.jsx)(Bd,{className:"h-5 w-5"}),g.count&&g.count>0&&(0,Ce.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] rounded-full bg-red-500 text-[11px] font-medium text-white flex items-center justify-center px-1",children:g.count>9?"9+":g.count})]})}),(0,Ce.jsxs)(xr,{align:"end",className:"w-[380px] p-0",sideOffset:8,children:[(0,Ce.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b",children:[(0,Ce.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Ce.jsx)("h4",{className:"text-base font-semibold",children:"Notifications"}),g.count&&g.count>0&&(0,Ce.jsxs)(ht,{variant:"secondary",className:"h-5 px-2 rounded-full bg-primary/10 text-primary border-0",children:[g.count," ","new"]})]}),g.items&&g.items.length>0&&(0,Ce.jsx)(xe,{variant:"ghost",size:"sm",className:"text-xs h-7 px-2 text-muted-foreground hover:text-foreground",onClick:Ue=>{Ue.preventDefault(),console.log("Mark all as read")},children:"Mark all read"})]}),(0,Ce.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:g.items&&g.items.length>0?(0,Ce.jsx)("div",{className:"py-1",children:g.items.map((Ue,Be)=>(0,Ce.jsxs)("div",{children:[(0,Ce.jsx)("button",{className:E("w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors","focus:outline-none focus:bg-muted/50",!Ue.read&&"bg-primary/5 hover:bg-primary/10"),onClick:()=>g.onNotificationClick?.(Ue.id),children:(0,Ce.jsxs)("div",{className:"flex gap-3",children:[(0,Ce.jsx)("div",{className:"mt-1.5",children:(0,Ce.jsx)("div",{className:E("h-2 w-2 rounded-full",Ue.read?"bg-transparent":"bg-primary")})}),(0,Ce.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,Ce.jsx)("p",{className:E("text-sm leading-tight",Ue.read?"font-normal":"font-medium"),children:Ue.title}),Ue.description&&(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:Ue.description}),Ue.time&&(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground/70 mt-1",children:Ue.time})]})]})}),Be<(g.items?.length||0)-1&&(0,Ce.jsx)("div",{className:"mx-4 border-b"})]},Ue.id))}):(0,Ce.jsxs)("div",{className:"py-12 text-center",children:[(0,Ce.jsx)(Bd,{className:"h-10 w-10 mx-auto text-muted-foreground/30 mb-3"}),(0,Ce.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"No new notifications"}),(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"You're all caught up!"})]})}),g.items&&g.items.length>0&&(0,Ce.jsx)("div",{className:"border-t p-2",children:(0,Ce.jsx)(xe,{variant:"ghost",className:"w-full h-8 text-xs text-muted-foreground hover:text-foreground",onClick:Ue=>{Ue.preventDefault(),console.log("View all notifications")},children:"View all notifications"})})]})]}),v&&!ze.isScrolled&&(0,Ce.jsx)(xe,{variant:v.variant||"primary",size:Q?"sm":We().buttonSize,onClick:()=>{if(v.action)v.action();else if(v.href)if(v.href.startsWith("#")){let Ue=document.querySelector(v.href);Ue&&Ue.scrollIntoView({behavior:"smooth",block:"start"})}else re?re(v.href):window.location.href=v.href},className:Q?"":"ml-2",children:v.text}),h&&!ze.isScrolled&&(0,Ce.jsxs)(Cr,{children:[(0,Ce.jsx)(Sr,{asChild:!0,children:(0,Ce.jsx)(xe,{variant:"ghost",size:"icon",className:"relative",children:(0,Ce.jsxs)(pa,{className:"h-8 w-8",children:[(0,Ce.jsx)(Si,{src:h.user?.avatar,alt:h.user?.name}),(0,Ce.jsx)(Oa,{children:h.user?.name?.charAt(0)||(0,Ce.jsx)(Hd,{className:"h-4 w-4"})})]})})}),(0,Ce.jsxs)(xr,{align:"end",className:"w-56",children:[h.user&&(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsxs)("div",{className:"p-2",children:[(0,Ce.jsx)("p",{className:"text-sm font-medium",children:h.user.name}),(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground",children:h.user.email})]}),(0,Ce.jsx)(qr,{})]}),h.items&&Ae(h.items)]})]})]})]}),w&&(0,Ce.jsx)(me.div,{className:"absolute inset-0 -z-10 opacity-30",animate:{background:["radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3), transparent 50%)","radial-gradient(circle at 80% 50%, rgba(120, 119, 198, 0.3), transparent 50%)","radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3), transparent 50%)"]},transition:{duration:10,repeat:1/0,ease:"linear"}}),T&&(0,Ce.jsx)("div",{className:E("absolute h-0.5 bg-muted transition-all",W?E("bottom-1 overflow-hidden",L==="floating-centered"&&"left-6 right-6",L==="floating"&&"left-4 right-4",(!L||L==="default")&&"left-2 right-2",L==="minimal"&&"left-2 right-2",L==="transparent"&&"left-2 right-2",L==="floating-auto-hide"&&"left-2 right-2",L==="floating-sticky"&&"left-2 right-2",j&&"rounded-b-lg",L==="floating-centered"&&"rounded-b-2xl",L==="floating"&&"rounded-b-lg"):"bottom-0 left-0 right-0"),children:(0,Ce.jsx)("div",{className:"h-full bg-primary transition-all duration-150",style:{width:`${ve}%`}})})]}),(0,Ce.jsxs)(OA,{open:J,onOpenChange:Ue=>{ee(Ue),Ue||s?.()},children:[(0,Ce.jsx)(Rh,{placeholder:n?a:c,value:X,onValueChange:fe}),(0,Ce.jsxs)(nN,{children:[(0,Ce.jsx)(Mh,{children:n?(0,Ce.jsxs)("div",{className:"flex flex-col items-center py-6",children:[(0,Ce.jsx)(jt,{className:"h-8 w-8 text-muted-foreground mb-2"}),(0,Ce.jsx)("p",{className:"text-sm text-muted-foreground",children:"No results found"}),(0,Ce.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Try searching for pages, actions, or commands"})]}):"No results found."}),n&&!X&&(0,Ce.jsxs)(op,{heading:"Quick Actions",children:[(0,Ce.jsxs)(Zu,{onSelect:()=>{let Ue={id:"home",title:"Go Home",href:"/"};l?.(Ue),Me(Ue),ee(!1)},children:[(0,Ce.jsx)(h0,{className:"mr-2 h-4 w-4"}),"Go Home",(0,Ce.jsx)("kbd",{className:"ml-auto text-xs",children:"\u2318H"})]}),(0,Ce.jsxs)(Zu,{onSelect:()=>{le(!0),ee(!1),l?.({id:"search",title:"Search",action:()=>le(!0)})},children:[(0,Ce.jsx)($n,{className:"mr-2 h-4 w-4"}),"Search",(0,Ce.jsx)("kbd",{className:"ml-auto text-xs",children:"\u2318S"})]}),d&&(0,Ce.jsxs)(Zu,{onSelect:()=>{p?.(f==="dark"?"light":"dark"),ee(!1)},children:[f==="dark"?(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)(ju,{className:"mr-2 h-4 w-4"}),"Switch to Light Mode"]}):(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)(Hu,{className:"mr-2 h-4 w-4"}),"Switch to Dark Mode"]}),(0,Ce.jsx)("kbd",{className:"ml-auto text-xs",children:"\u2318T"})]})]}),e&&e.length>0&&e.map(Ue=>{if(!Ue||!Ue.items||Ue.items.length===0)return null;let Be=X?Ue.items.filter(He=>He.title.toLowerCase().includes(X.toLowerCase())||He.description?.toLowerCase().includes(X.toLowerCase())):Ue.items;return Be.length===0?null:(0,Ce.jsx)(op,{heading:Ue.title||Ue.id,children:Be.map(He=>(0,Ce.jsxs)(Zu,{disabled:He.disabled,onSelect:()=>{n&&l?.(He),Me(He),ee(!1)},children:[(0,Ce.jsxs)("span",{className:"flex items-center gap-2",children:[He.icon&&(0,Ce.jsx)("span",{children:He.icon}),He.title]}),He.badge&&(0,Ce.jsx)(ht,{variant:He.badgeVariant||"secondary",className:"ml-auto",children:He.badge}),He.description&&n&&(0,Ce.jsx)("span",{className:"ml-2 text-xs text-muted-foreground",children:He.description})]},He.id))},Ue.id)}),n&&h?.items&&(0,Ce.jsx)(op,{heading:"Account",children:h.items.map(Ue=>(0,Ce.jsx)(Zu,{disabled:Ue.disabled,onSelect:()=>{let Be={...Ue,action:Ue.onClick||Ue.action};Be.action?Be.action():Be.href&&(window.location.href=Be.href),l?.(Be),ee(!1)},children:(0,Ce.jsxs)("span",{className:"flex items-center gap-2",children:[Ue.icon&&(0,Ce.jsx)("span",{children:Ue.icon}),Ue.title]})},Ue.id))})]})]}),de&&!G&&(0,Ce.jsx)("div",{className:E(ct()),"aria-hidden":"true"})]})}function l6e(e){let{hasProAccess:t,isLoading:r}=Ee();return!r&&!t?(0,Ce.jsx)(Ve,{componentName:"Advanced Navbar",className:E("w-full",e.className)}):(0,Ce.jsx)(KVt,{...e})}var Hne=_(ye(),1);var di=_(ye(),1),d6e=_(ue(),1),c6e=(0,di.createContext)(null),Kb=()=>{let e=(0,di.useContext)(c6e);if(!e)throw new Error("useFormWizard must be used within a FormWizardProvider");return e},u6e=({children:e,steps:t,initialStep:r=0,onStepChange:n,onComplete:o,validateOnStepChange:a=!0,allowBackNavigation:i=!0,allowStepSkip:s=!1,autoSave:l=!1,autoSaveDelay:c=2e3,onAutoSave:u,persistData:d=!1,storageKey:f="form-wizard-data"})=>{let[p,m]=(0,di.useState)(r),[h,g]=(0,di.useState)({}),[v,y]=(0,di.useState)(new Set),[b,w]=(0,di.useState)(!1),[x,C]=(0,di.useState)(null);(0,di.useEffect)(()=>{if(d&&typeof window<"u"){let k=localStorage.getItem(f);if(k)try{let T=JSON.parse(k);g(T.stepData||{}),m(T.currentStep||0),y(new Set(T.completedSteps||[]))}catch(T){console.error("Failed to load persisted wizard data:",T)}}},[d,f]),(0,di.useEffect)(()=>{if(!l||!u)return;let k=setTimeout(()=>{let T=h[t[p].id];T&&u(t[p].id,T)},c);return()=>clearTimeout(k)},[h,p,l,c,u,t]),(0,di.useEffect)(()=>{if(d&&typeof window<"u"){let k={stepData:h,currentStep:p,completedSteps:Array.from(v)};localStorage.setItem(f,JSON.stringify(k))}},[h,p,v,d,f]);let P=(0,di.useCallback)(async()=>{let k=t[p];if(k.requiredFields!==!1&&typeof window<"u"){let B=document.querySelector("[data-wizard-step-content]");if(B)if(Array.isArray(k.requiredFields)){let D=[];if(k.requiredFields.forEach(z=>{let M=B.querySelector(`[name="${z}"], [id="${z}"]`);if(M){let G=M;M.tagName==="INPUT"&&M.type==="checkbox"?M.checked||D.push(z):(!G.value||G.value.trim()==="")&&D.push(z)}}),D.length>0)return C(`Please fill in the following required fields: ${D.join(", ")}`),!1}else{let D=B.querySelectorAll("input[required], select[required], textarea[required]"),z=[];if(D.forEach(G=>{let q=G;if(!q.value||q.value.trim()===""){let H=document.querySelector(`label[for="${q.id}"]`),F=H?H.textContent?.replace(" *","")||"Field":q.name||q.id||"Field";z.push(F)}}),B.querySelectorAll('input[type="checkbox"][required]').forEach(G=>{let q=G;if(!q.checked){let H=document.querySelector(`label[for="${q.id}"]`),F=H?H.textContent?.replace(" *","")||"Checkbox":q.name||q.id||"Checkbox";z.push(F)}}),z.length>0)return C(`Please fill in the following required fields: ${z.join(", ")}`),!1}}if(!k.validation)return!0;w(!0),C(null);try{let B=await k.validation();if(typeof B=="boolean")return B||C("Please complete all required fields before proceeding"),B;if(typeof B=="object"&&B!==null&&"isValid"in B){let D=B;return D.isValid||(D.error?C(D.error):D.errors&&Array.isArray(D.errors)?C(D.errors.join(", ")):C("Please complete all required fields before proceeding")),D.isValid}return C("Invalid validation response"),!1}catch(B){return C(B instanceof Error?B.message:"Validation failed"),!1}finally{w(!1)}},[p,t]),R=(0,di.useCallback)((k,T)=>{g(B=>({...B,[k]:{...B[k],...T}})),C(null)},[]),L=(0,di.useCallback)(async k=>{if(k<0||k>=t.length||k===p)return;let T=t[k];if((typeof T.isDisabled=="function"?T.isDisabled(p,t):T.isDisabled)||a&&k>p&&!await P())return;let D=t[p];D.onExit&&await D.onExit(),k>p&&y(M=>new Set([...M,p])),T.onEnter&&await T.onEnter();let z=p;m(k),n?.(k,z)},[p,t,a,P,n]),$=(0,di.useCallback)(()=>{L(p+1)},[p,L]),I=(0,di.useCallback)(()=>{i&&L(p-1)},[p,L,i]),A=(0,di.useCallback)(async()=>{if(await P()&&(y(T=>new Set([...T,p])),o)){w(!0);try{await o(h),d&&typeof window<"u"&&localStorage.removeItem(f)}catch(T){C(T instanceof Error?T.message:"Failed to complete wizard")}finally{w(!1)}}},[p,h,P,o,d,f]),j=(0,di.useCallback)(()=>{m(0),g({}),y(new Set),C(null),d&&typeof window<"u"&&localStorage.removeItem(f)},[d,f]),V=(0,di.useCallback)(k=>v.has(k),[v]),S=(0,di.useCallback)(k=>{if(k===0||s)return!0;for(let T=0;T<k;T++)if(!v.has(T)&&!t[T].isOptional)return!1;return!0},[v,s,t]),N={steps:t,currentStep:p,stepData:h,isLoading:b,error:x,goToNext:$,goToPrevious:I,goToStep:L,updateStepData:k=>R(t[p].id,k),validateCurrentStep:P,completeWizard:A,resetWizard:j,isStepCompleted:V,isStepAccessible:S,canGoNext:p<t.length-1,canGoPrevious:i&&p>0};return(0,d6e.jsx)(c6e.Provider,{value:N,children:e})};var Ir=_(ue(),1),aj=({className:e,progressType:t="linear",orientation:r="horizontal",showStepNumbers:n=!0,showStepTitles:o=!0,stepIconPosition:a="top",completedStepIcon:i=(0,Ir.jsx)(Mo,{className:"w-5 h-5"}),activeStepIcon:s,errorStepIcon:l=(0,Ir.jsx)(eo,{className:"w-5 h-5"})})=>{let{steps:c,currentStep:u,isStepCompleted:d,isStepAccessible:f,error:p}=Kb();if(t==="linear")return(0,Ir.jsx)("div",{className:E("relative w-full",r==="vertical"?"flex flex-col space-y-8":"",e),children:r==="horizontal"?(0,Ir.jsx)("div",{className:"relative w-full",children:(0,Ir.jsxs)("div",{className:E("relative flex items-start justify-between w-full",a==="left"&&"pl-14"),children:[c.length>1&&(0,Ir.jsx)("div",{className:"absolute left-0 right-0 h-[2px] bg-border",style:{top:o?"calc(44px + 24px + 24px)":"24px",left:"calc(100% / 6)",right:"calc(100% / 6)"},children:(0,Ir.jsx)(me.div,{className:"absolute inset-0 bg-primary",initial:{scaleX:0},animate:{scaleX:u/(c.length-1)},transition:{duration:.5},style:{transformOrigin:"left"}})}),c.map((m,h)=>{let g=h===u,v=d(h),y=f(h),b=g&&p,w=typeof m.icon=="function"?m.icon({isActive:g,isCompleted:v}):m.icon;return(0,Ir.jsxs)("div",{className:"relative flex-1 flex flex-col items-center",children:[a==="left"&&w&&(0,Ir.jsx)("div",{className:"absolute -left-12 top-1/2 -translate-y-1/2 flex items-center justify-center",children:(0,Ir.jsx)("span",{className:E("w-8 h-8 flex items-center justify-center transition-colors",g&&"text-primary",v&&!g&&"text-primary",!g&&!v&&"text-muted-foreground"),children:w})}),a==="top"&&w&&(0,Ir.jsx)("div",{className:"flex items-center justify-center mb-2",children:(0,Ir.jsx)("span",{className:E("w-8 h-8 flex items-center justify-center transition-colors",g&&"text-primary",v&&!g&&"text-primary",!g&&!v&&"text-muted-foreground"),children:w})}),o&&(0,Ir.jsx)("div",{className:"mb-3 min-h-[44px] flex items-center justify-center text-center w-full",children:(0,Ir.jsx)("p",{className:E("text-sm font-semibold transition-colors whitespace-nowrap",g&&"text-primary",v&&!g&&"text-primary",!g&&!v&&"text-muted-foreground"),children:m.title})}),(0,Ir.jsx)("div",{className:"flex justify-center",children:(0,Ir.jsx)(me.div,{initial:{scale:.8},animate:{scale:g?1.05:1},transition:{duration:.2},className:E("relative z-10 flex items-center justify-center rounded-full transition-all duration-300","w-12 h-12 border-2",g&&"border-primary bg-primary text-primary-foreground shadow-lg shadow-primary/20",v&&!g&&"border-primary bg-primary text-primary-foreground",!g&&!v&&y&&"border-border bg-background text-muted-foreground hover:border-accent",!y&&"border-border/50 bg-muted text-muted-foreground/50 cursor-not-allowed",b&&"border-destructive bg-destructive text-destructive-foreground"),children:b?l:v&&!g?i:g&&s?s:w&&a==="inside"?(0,Ir.jsx)("span",{className:"w-5 h-5 flex items-center justify-center",children:w}):n?(0,Ir.jsx)("span",{className:"text-sm font-semibold",children:h+1}):(0,Ir.jsx)(Bu,{className:"w-4 h-4"})})}),(0,Ir.jsx)("div",{className:"mt-3 text-center",children:(0,Ir.jsxs)("p",{className:"text-xs text-muted-foreground font-medium whitespace-nowrap",children:["Step ",h+1," of"," ",c.length]})})]},m.id)})]})}):(0,Ir.jsxs)("div",{className:"relative pl-12",children:[c.length>1&&(0,Ir.jsxs)(Ir.Fragment,{children:[(0,Ir.jsx)("div",{className:"absolute left-6 top-8 bottom-8 w-[2px] bg-border"}),(0,Ir.jsx)(me.div,{className:"absolute left-6 top-8 w-[2px] bg-primary",initial:{height:0},animate:{height:`${u/(c.length-1)*(100-16)}%`},transition:{duration:.5}})]}),c.map((m,h)=>{let g=h===u,v=d(h),y=f(h),b=g&&p,w=typeof m.icon=="function"?m.icon({isActive:g,isCompleted:v}):m.icon;return(0,Ir.jsxs)("div",{className:"relative flex items-center mb-8 last:mb-0",children:[(0,Ir.jsx)(me.div,{initial:{scale:.8},animate:{scale:g?1.05:1},className:E("relative left-0 mt-5 z-20 flex items-center justify-center rounded-full border-2 transition-all duration-300","w-12 h-12",g&&"border-primary bg-primary text-primary-foreground shadow-lg",v&&!g&&"border-primary bg-primary text-primary-foreground",!g&&!v&&y&&"border-border bg-background text-muted-foreground hover:border-accent",!y&&"border-border/50 bg-muted text-muted-foreground/50 cursor-not-allowed",b&&"border-destructive bg-destructive text-destructive-foreground"),children:b?l:v&&!g?i:g&&s?s:w?(0,Ir.jsx)("span",{className:"w-5 h-5 flex items-center justify-center",children:w}):n?(0,Ir.jsx)("span",{className:"text-sm font-semibold",children:h+1}):(0,Ir.jsx)(Bu,{className:"w-4 h-4"})}),(0,Ir.jsx)("div",{style:{marginLeft:"12px"},children:o&&(0,Ir.jsxs)(Ir.Fragment,{children:[(0,Ir.jsx)("p",{className:E("text-sm font-semibold transition-colors",g&&"text-primary",v&&!g&&"text-primary",!g&&!v&&"text-muted-foreground"),children:m.title}),m.description&&(0,Ir.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:m.description})]})})]},m.id)})]})});if(t==="dots")return(0,Ir.jsx)("div",{className:E("flex items-center justify-center space-x-2",e),children:c.map((m,h)=>{let g=h===u,v=d(h);return(0,Ir.jsx)(me.div,{initial:{scale:.8},animate:{scale:g?1.2:1},className:E("rounded-full transition-all duration-300",g?"w-3 h-3 bg-primary":"w-2 h-2",v&&!g&&"bg-primary/60",!g&&!v&&"bg-muted")},h)})});if(t==="circular"){let m=(u+1)/c.length*100,h=2*Math.PI*45,g=h-m/100*h;return(0,Ir.jsxs)("div",{className:E("relative w-36 h-36 mx-auto",e),children:[(0,Ir.jsxs)("svg",{className:"w-full h-full -rotate-90",viewBox:"0 0 144 144",children:[(0,Ir.jsx)("circle",{cx:"72",cy:"72",r:"45",fill:"none",stroke:"currentColor",strokeWidth:"8",className:"text-border"}),(0,Ir.jsx)(me.circle,{cx:"72",cy:"72",r:"45",fill:"none",stroke:"currentColor",strokeWidth:"8",strokeDasharray:h,initial:{strokeDashoffset:h},animate:{strokeDashoffset:g},className:"text-primary",transition:{duration:.5}})]}),(0,Ir.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,Ir.jsxs)("div",{className:"text-center",children:[(0,Ir.jsx)("p",{className:"text-3xl font-bold",children:u+1}),(0,Ir.jsxs)("p",{className:"text-sm text-muted-foreground",children:["of ",c.length]})]})})]})}return null};var ij=_(ye(),1);var Yb=_(ue(),1),YVt={slide:{initial:e=>({x:e>0?1e3:-1e3,opacity:0}),animate:{x:0,opacity:1},exit:e=>({x:e<0?1e3:-1e3,opacity:0})},fade:{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},scale:{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8}},none:{initial:{},animate:{},exit:{}}},sj=({className:e,animationType:t="slide",animationDuration:r=.3})=>{let{steps:n,currentStep:o,goToNext:a,goToPrevious:i,goToStep:s,updateStepData:l,stepData:c,error:u}=Kb(),[d,f]=ij.default.useState(0),p=ij.default.useRef(o);ij.default.useEffect(()=>{f(o>p.current?1:-1),p.current=o},[o]);let m=n[o],h=o===0,g=o===n.length-1,v={currentStep:o,totalSteps:n.length,goToNext:a,goToPrevious:i,goToStep:s,isFirstStep:h,isLastStep:g,stepData:c[m.id]||{},updateStepData:b=>l(m.id,b)},y=typeof m.content=="function"?m.content(v):m.content;return(0,Yb.jsx)(kt,{mode:"wait",custom:d,children:(0,Yb.jsx)(me.div,{custom:d,variants:YVt[t],initial:"initial",animate:"animate",exit:"exit",transition:{duration:r,ease:"easeInOut"},className:E("w-full",e),"data-wizard-step-content":!0,children:(0,Yb.jsxs)("div",{className:"space-y-4",children:[u&&(0,Yb.jsxs)(S0,{variant:"error",children:[(0,Yb.jsx)(Pn,{className:"h-4 w-4"}),(0,Yb.jsx)(P0,{children:u})]}),y]})},o)})};var ll=_(ue(),1),lj=({className:e,showStepIndicator:t=!0,previousText:r="Previous",nextText:n="Next",completeText:o="Complete",loadingText:a="Processing...",onPreviousClick:i,onNextClick:s,onCompleteClick:l})=>{let{steps:c,currentStep:u,isLoading:d,canGoNext:f,canGoPrevious:p,goToNext:m,goToPrevious:h,completeWizard:g}=Kb(),v=u===c.length-1,y=c[u],b=()=>{i?.(),h()},w=()=>{v?(l?.(),g()):(s?.(),m())};return(0,ll.jsxs)("div",{className:E("flex items-center justify-between",e),children:[(0,ll.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ll.jsxs)(xe,{type:"button",variant:"outline",onClick:b,disabled:!p||d,className:E("transition-all duration-200",!p&&"invisible"),children:[(0,ll.jsx)(Za,{className:"w-4 h-4 mr-1"}),r]}),t&&(0,ll.jsxs)(me.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"px-3 py-1 text-sm text-muted-foreground",children:["Step ",u+1," of ",c.length,y.isOptional&&(0,ll.jsx)("span",{className:"ml-1 text-xs",children:"(Optional)"})]})]}),(0,ll.jsx)(xe,{type:"button",onClick:w,disabled:d||!f&&!v,className:"min-w-[120px]",children:d?(0,ll.jsxs)(ll.Fragment,{children:[(0,ll.jsx)(Nr,{className:"w-4 h-4 mr-2 animate-spin"}),a]}):v?(0,ll.jsxs)(ll.Fragment,{children:[(0,ll.jsx)(Qr,{className:"w-4 h-4 mr-2"}),o]}):(0,ll.jsxs)(ll.Fragment,{children:[n,(0,ll.jsx)(Sn,{className:"w-4 h-4 ml-1"})]})})]})};var fi=_(ue(),1),f6e=Hne.default.forwardRef(({steps:e,currentStep:t=0,onStepChange:r,onComplete:n,orientation:o="horizontal",progressType:a="linear",allowStepSkip:i=!1,allowBackNavigation:s=!0,validateOnStepChange:l=!0,animationType:c="slide",animationDuration:u=.3,showStepNumbers:d=!0,showStepTitles:f=!0,showProgressBar:p=!0,stepIconPosition:m="top",completedStepIcon:h,activeStepIcon:g,errorStepIcon:v,className:y,progressClassName:b,navigationClassName:w,contentClassName:x,stepClassName:C,autoSave:P=!1,autoSaveDelay:R=2e3,onAutoSave:L,persistData:$=!1,storageKey:I="form-wizard-data"},A)=>(0,fi.jsx)(u6e,{steps:e,initialStep:t,onStepChange:r,onComplete:n,validateOnStepChange:l,allowBackNavigation:s,allowStepSkip:i,autoSave:P,autoSaveDelay:R,onAutoSave:L,persistData:$,storageKey:I,children:(0,fi.jsxs)("div",{ref:A,className:E("w-full",y),children:[p&&(0,fi.jsx)(fi.Fragment,{children:(0,fi.jsx)(aj,{className:E("mb-12",b),progressType:a,orientation:o,showStepNumbers:d,showStepTitles:f,stepIconPosition:m,completedStepIcon:h,activeStepIcon:g,errorStepIcon:v})}),(0,fi.jsx)(Ze,{className:E("border-0 shadow-none",x),children:(0,fi.jsx)(tt,{className:"p-0",children:(0,fi.jsx)(sj,{className:C,animationType:c,animationDuration:u})})}),(0,fi.jsx)(lj,{className:E("mt-8",w)})]})}));f6e.displayName="FormWizardInternal";var uD=Hne.default.forwardRef((e,t)=>{let{hasProAccess:r,isLoading:n}=Ee();return!n&&!r?(0,fi.jsx)(Ze,{className:E("w-full",e.className),children:(0,fi.jsx)(tt,{className:"py-12 text-center",children:(0,fi.jsxs)("div",{className:"max-w-md mx-auto space-y-4",children:[(0,fi.jsx)("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:(0,fi.jsx)(Qt,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),(0,fi.jsxs)("div",{children:[(0,fi.jsx)("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),(0,fi.jsx)("p",{className:"text-muted-foreground text-sm mb-4",children:"Form Wizard is available exclusively to MoonUI Pro subscribers."}),(0,fi.jsx)("a",{href:"/pricing",children:(0,fi.jsxs)(xe,{size:"sm",children:[(0,fi.jsx)(jt,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})]})]})})}):(0,fi.jsx)(f6e,{...e,ref:t})});uD.displayName="MoonUIFormWizardPro";var XVt=uD;var xd=_(ye(),1);var Tt=_(ue(),1);function p6e(e){let t=[...e];for(let r=t.length-1;r>0;r--){let n=Math.floor(Math.random()*(r+1));[t[r],t[n]]=[t[n],t[r]]}return t}var JVt=({title:e,description:t,questions:r,onComplete:n,showTimer:o=!0,totalTimeLimit:a,showProgress:i=!0,showQuestionNumbers:s=!0,allowReview:l=!0,allowSkip:c=!0,shuffleQuestions:u=!1,shuffleOptions:d=!1,passingScore:f=70,instantFeedback:p=!1,showHints:m=!1,className:h})=>{let[g]=(0,xd.useState)(()=>u?p6e(r):r),[v,y]=(0,xd.useState)({}),[b,w]=(0,xd.useState)([]),[x,C]=(0,xd.useState)(a||0),[P,R]=(0,xd.useState)({}),[L,$]=(0,xd.useState)(!1),[I,A]=(0,xd.useState)(0);(0,xd.useEffect)(()=>{if(!o||!a||L)return;let k=setInterval(()=>{C(T=>T<=1?(V(),0):T-1)},1e3);return()=>clearInterval(k)},[o,a,L]),(0,xd.useEffect)(()=>{if(!o||L)return;let k=setInterval(()=>{A(T=>T+1)},1e3);return()=>clearInterval(k)},[o,L]);let j=(0,xd.useCallback)(()=>{let k=0,T=0;return{results:g.map(D=>{let z=v[D.id],M=D.points||1;T+=M;let G=!1;if(z!=null&&z!==""){if(D.type==="single-choice"||D.type==="true-false")G=z===D.correctAnswer;else if(D.type==="multiple-choice"){let H=Array.isArray(z)?z:[],F=Array.isArray(D.correctAnswer)?D.correctAnswer:[];G=H.length===F.length&&H.every(W=>F.includes(W))}}let q=G?M:0;return k+=q,{questionId:D.id,answer:z,isCorrect:G,points:q,timeSpent:P[D.id]||0}}),score:k,totalScore:T}},[g,v,P]),V=async()=>{let{results:k,score:T,totalScore:B}=j();w(k),$(!0),n&&await n(k,T,B)},S=k=>{let T=Math.floor(k/60),B=k%60;return`${T}:${B.toString().padStart(2,"0")}`},N=g.map((k,T)=>({id:k.id,title:`Question ${T+1}`,description:k.tags?.join(", "),content:({updateStepData:B,goToNext:D})=>{let z=v[k.id],M=d&&k.options?p6e(k.options):k.options;(0,xd.useEffect)(()=>{P[k.id]||R(q=>({...q,[k.id]:I}))},[]);let G=q=>{y(H=>({...H,[k.id]:q})),p&&k.type};return(0,Tt.jsxs)(Ze,{className:"border-0 shadow-none",children:[(0,Tt.jsxs)(wr,{children:[(0,Tt.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[s&&(0,Tt.jsxs)(ht,{variant:"secondary",children:["Question ",T+1," of ",g.length]}),k.points&&k.points>1&&(0,Tt.jsxs)(ht,{variant:"outline",children:[k.points," points"]})]}),(0,Tt.jsx)(zr,{className:"text-xl",children:k.question}),k.description&&(0,Tt.jsx)(Zi,{children:k.description})]}),(0,Tt.jsxs)(tt,{className:"space-y-4",children:[k.image&&(0,Tt.jsx)("img",{src:k.image,alt:"Question illustration",className:"w-full rounded-lg"}),k.type==="single-choice"&&M&&(0,Tt.jsx)(Rw,{value:z||"",onValueChange:G,children:M.map((q,H)=>(0,Tt.jsxs)(me.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:H*.1},className:"flex items-center space-x-2 p-3 rounded-lg hover:bg-muted/50 transition-colors",children:[(0,Tt.jsx)(kv,{value:String(q.value),id:`${k.id}-${q.value}`}),(0,Tt.jsx)(Lt,{htmlFor:`${k.id}-${q.value}`,className:"flex-1 cursor-pointer",children:q.label||q.value})]},String(q.value)))}),k.type==="multiple-choice"&&M&&(0,Tt.jsx)("div",{className:"space-y-2",children:M.map((q,H)=>(0,Tt.jsxs)(me.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:H*.1},className:"flex items-center space-x-2 p-3 rounded-lg hover:bg-muted/50 transition-colors",children:[(0,Tt.jsx)(Wl,{id:`${k.id}-${q.value}`,checked:(z||[]).includes(q.value),onCheckedChange:F=>{let W=z||[];G(F?[...W,q.value]:W.filter(U=>U!==q.value))}}),(0,Tt.jsx)(Lt,{htmlFor:`${k.id}-${q.value}`,className:"flex-1 cursor-pointer",children:q.label||q.value})]},String(q.value)))}),k.type==="true-false"&&(0,Tt.jsxs)(Rw,{value:z?.toString()||"",onValueChange:q=>G(q==="true"),children:[(0,Tt.jsxs)("div",{className:"flex items-center space-x-2 p-3 rounded-lg hover:bg-muted/50",children:[(0,Tt.jsx)(kv,{value:"true",id:`${k.id}-true`}),(0,Tt.jsx)(Lt,{htmlFor:`${k.id}-true`,className:"flex-1 cursor-pointer",children:"True"})]}),(0,Tt.jsxs)("div",{className:"flex items-center space-x-2 p-3 rounded-lg hover:bg-muted/50",children:[(0,Tt.jsx)(kv,{value:"false",id:`${k.id}-false`}),(0,Tt.jsx)(Lt,{htmlFor:`${k.id}-false`,className:"flex-1 cursor-pointer",children:"False"})]})]}),k.type==="text"&&(0,Tt.jsx)(su,{value:z||"",onChange:q=>G(q.target.value),placeholder:"Type your answer here...",className:"min-h-[120px]"}),k.type==="rating"&&(0,Tt.jsxs)("div",{className:"space-y-4",children:[(0,Tt.jsx)(Z0,{value:[z||5],onValueChange:([q])=>G(q),max:10,min:1,step:1,className:"w-full"}),(0,Tt.jsxs)("div",{className:"text-center text-2xl font-bold",children:[z||5,"/10"]})]}),m&&k.hint&&(0,Tt.jsx)(S0,{children:(0,Tt.jsxs)(P0,{children:[(0,Tt.jsx)("strong",{children:"Hint:"})," ",k.hint]})})]})]})},validation:()=>!(k.required&&!v[k.id]),isOptional:!k.required}));if(L){let{score:k,totalScore:T}=j(),B=Math.round(k/T*100),D=B>=f;return(0,Tt.jsx)(me.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:E("w-full max-w-2xl mx-auto",h),children:(0,Tt.jsxs)(Ze,{children:[(0,Tt.jsxs)(wr,{className:"text-center",children:[(0,Tt.jsx)("div",{className:"mx-auto mb-4",children:(0,Tt.jsx)(jT,{className:E("w-16 h-16",D?"text-yellow-500":"text-muted-foreground")})}),(0,Tt.jsx)(zr,{className:"text-3xl",children:"Quiz Complete!"}),(0,Tt.jsx)(Zi,{children:"Here's how you performed"})]}),(0,Tt.jsxs)(tt,{className:"space-y-6",children:[(0,Tt.jsxs)("div",{className:"text-center",children:[(0,Tt.jsxs)("div",{className:"text-5xl font-bold mb-2",children:[B,"%"]}),(0,Tt.jsx)(bo,{value:B,className:"h-3 mb-4"}),(0,Tt.jsxs)("div",{className:"flex justify-between text-sm text-muted-foreground",children:[(0,Tt.jsxs)("span",{children:["Score: ",k,"/",T]}),(0,Tt.jsx)("span",{children:D?(0,Tt.jsx)(ht,{variant:"success",children:"Passed"}):(0,Tt.jsx)(ht,{variant:"destructive",children:"Failed"})})]})]}),l&&(0,Tt.jsxs)("div",{className:"space-y-2",children:[(0,Tt.jsx)("h3",{className:"font-semibold",children:"Review Answers"}),b.map((z,M)=>{let G=g.find(q=>q.id===z.questionId);return(0,Tt.jsxs)("div",{className:"flex items-center justify-between p-2 rounded-lg bg-muted/50",children:[(0,Tt.jsxs)("span",{className:"text-sm",children:[s&&`Q${M+1}: `,G?.question.substring(0,50),"..."]}),(0,Tt.jsxs)(ht,{variant:z.isCorrect?"success":"destructive",children:[z.points,"/",G?.points||1]})]},z.questionId)})]}),(0,Tt.jsxs)("div",{className:"flex gap-2",children:[(0,Tt.jsxs)(xe,{className:"flex-1",onClick:()=>window.location.reload(),children:[(0,Tt.jsx)(dv,{className:"w-4 h-4 mr-2"}),"Retake Quiz"]}),(0,Tt.jsxs)(xe,{variant:"outline",children:[(0,Tt.jsx)(vn,{className:"w-4 h-4 mr-2"}),"Download Results"]}),(0,Tt.jsxs)(xe,{variant:"outline",children:[(0,Tt.jsx)(fv,{className:"w-4 h-4 mr-2"}),"Share"]})]})]})]})})}return(0,Tt.jsxs)("div",{className:E("w-full",h),children:[o&&a&&(0,Tt.jsxs)("div",{className:"mb-6 flex items-center justify-between",children:[(0,Tt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Tt.jsx)(cn,{className:"w-4 h-4"}),(0,Tt.jsxs)("span",{className:"text-sm font-medium",children:["Time Remaining: ",S(x)]})]}),(0,Tt.jsx)(bo,{value:x/a*100,className:"w-32 h-2"})]}),(0,Tt.jsx)(uD,{steps:N,onComplete:V,allowStepSkip:c,validateOnStepChange:!0,showProgressBar:i,progressType:"dots",animationType:"slide"})]})},QVt=e=>{let{hasProAccess:t,isLoading:r}=Ee();return!r&&!t?(0,Tt.jsx)(Ze,{className:E("w-full",e.className),children:(0,Tt.jsx)(tt,{className:"py-12 text-center",children:(0,Tt.jsxs)("div",{className:"max-w-md mx-auto space-y-4",children:[(0,Tt.jsx)("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:(0,Tt.jsx)(Qt,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),(0,Tt.jsxs)("div",{children:[(0,Tt.jsx)("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),(0,Tt.jsx)("p",{className:"text-muted-foreground text-sm mb-4",children:"Quiz Form is available exclusively to MoonUI Pro subscribers."}),(0,Tt.jsx)("a",{href:"/pricing",children:(0,Tt.jsxs)(xe,{size:"sm",children:[(0,Tt.jsx)(jt,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})]})]})})}):(0,Tt.jsx)(JVt,{...e})},ZVt=QVt;var wd=_(ye(),1);var Gr=_(ue(),1),e$t={visa:/^4/,mastercard:/^5[1-5]/,amex:/^3[47]/,discover:/^6(?:011|5)/,diners:/^3(?:0[0-5]|[68])/,jcb:/^35/,unionpay:/^62/};function t$t(e,t){let r=e.replace(/\s+/g,"").replace(/[^0-9]/gi,""),n=t==="amex"?r.match(/\d{1,4}/g):r.match(/\d{1,4}/g);return n?n.join(" "):r}function r$t(e){let t=e.replace(/\s+/g,"").replace(/[^0-9]/gi,"");return t.length>=2?t.slice(0,2)+(t.length>2?"/"+t.slice(2,4):""):t}function n$t(e){let t=e.replace(/\s+/g,"");for(let[r,n]of Object.entries(e$t))if(n.test(t))return r;return null}function o$t(e){let t=e.replace(/\s+/g,"");if(!/^\d+$/.test(t))return!1;let r=0,n=!1;for(let o=t.length-1;o>=0;o--){let a=parseInt(t.charAt(o),10);n&&(a*=2,a>9&&(a-=9)),r+=a,n=!n}return r%10===0}function a$t(e){let t=e.split("/");if(t.length!==2)return!1;let r=parseInt(t[0],10),n=parseInt("20"+t[1],10);if(r<1||r>12)return!1;let o=new Date;return new Date(n,r-1)>o}var m6e=wd.default.forwardRef(({value:e={number:"",expiry:"",cvc:"",name:""},onChange:t,showCardPreview:r=!0,showCardType:n=!0,showSecurityBadge:o=!0,autoFormat:a=!0,validateOnChange:i=!1,labels:s={},placeholders:l={},errors:c={},className:u,inputClassName:d,labelClassName:f,errorClassName:p,disabled:m,required:h,...g},v)=>{let[y,b]=(0,wd.useState)(null),[w,x]=(0,wd.useState)(null),[C,P]=(0,wd.useState)({}),R=(0,wd.useRef)(null),L=(0,wd.useRef)(null),$=(0,wd.useRef)(null),I=(0,wd.useRef)(null);(0,wd.useEffect)(()=>{let V=n$t(e.number);b(V)},[e.number]),(0,wd.useEffect)(()=>{if(!i)return;let V={};e.number&&!o$t(e.number)&&(V.number="Invalid card number"),e.expiry&&!a$t(e.expiry)&&(V.expiry="Invalid expiry date"),e.cvc&&(e.cvc.length<3||e.cvc.length>4)&&(V.cvc="Invalid CVC"),P(V)},[e,i]);let A=(V,S)=>{let N=S;if(a){if(V==="number"){N=t$t(S,y||void 0);let k=y==="amex"?18:19;if(N.length>k)return}else if(V==="expiry"){if(N=r$t(S),N.length>5)return}else if(V==="cvc"){N=S.replace(/\D/g,"");let k=y==="amex"?4:3;if(N.length>k)return}}t?.({...e,[V]:N}),a&&(V==="number"&&N.length===(y==="amex"?18:19)?L.current?.focus():V==="expiry"&&N.length===5?$.current?.focus():V==="cvc"&&N.length===(y==="amex"?4:3)&&I.current?.focus())},j={...C,...c};return(0,Gr.jsxs)("div",{ref:v,className:E("space-y-4",u),...g,children:[r&&(0,Gr.jsxs)(me.div,{className:"relative w-full max-w-md mx-auto h-48 rounded-xl bg-gradient-to-r from-blue-600 to-purple-600 dark:from-blue-700 dark:to-purple-700 p-6 text-white shadow-xl overflow-hidden",initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{duration:.3},children:[(0,Gr.jsxs)("div",{className:"flex justify-between items-start mb-8",children:[(0,Gr.jsx)("div",{className:"text-lg font-semibold",children:y?y.toUpperCase():"CARD"}),(0,Gr.jsx)(av,{className:"w-8 h-8 text-white/80"})]}),(0,Gr.jsxs)("div",{className:"space-y-4",children:[(0,Gr.jsx)("div",{className:"text-xl font-mono tracking-wider",children:e.number||"\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022"}),(0,Gr.jsxs)("div",{className:"flex justify-between",children:[(0,Gr.jsxs)("div",{children:[(0,Gr.jsx)("div",{className:"text-xs text-white/70",children:"NAME"}),(0,Gr.jsx)("div",{className:"text-sm uppercase",children:e.name||"YOUR NAME"})]}),(0,Gr.jsxs)("div",{children:[(0,Gr.jsx)("div",{className:"text-xs text-white/70",children:"EXPIRES"}),(0,Gr.jsx)("div",{className:"text-sm",children:e.expiry||"MM/YY"})]})]})]})]}),(0,Gr.jsxs)("div",{className:"space-y-4",children:[(0,Gr.jsxs)("div",{className:"space-y-1",children:[(0,Gr.jsxs)(Lt,{htmlFor:"card-number",className:f,children:[s.number||"Card Number",h&&(0,Gr.jsx)("span",{className:"text-destructive ml-1",children:"*"})]}),(0,Gr.jsxs)("div",{className:"relative",children:[(0,Gr.jsx)(Zt,{ref:R,id:"card-number",type:"text",inputMode:"numeric",value:e.number,onChange:V=>A("number",V.target.value),onFocus:()=>x("number"),onBlur:()=>x(null),placeholder:l.number||"1234 5678 9012 3456",className:E("pr-20",j.number&&"border-destructive",d),disabled:m}),n&&y&&(0,Gr.jsx)("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm font-medium text-muted-foreground",children:y.toUpperCase()})]}),j.number&&(0,Gr.jsx)("p",{className:E("text-sm text-destructive",p),children:j.number})]}),(0,Gr.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Gr.jsxs)("div",{className:"space-y-1",children:[(0,Gr.jsxs)(Lt,{htmlFor:"card-expiry",className:f,children:[s.expiry||"Expiry Date",h&&(0,Gr.jsx)("span",{className:"text-destructive ml-1",children:"*"})]}),(0,Gr.jsx)(Zt,{ref:L,id:"card-expiry",type:"text",inputMode:"numeric",value:e.expiry,onChange:V=>A("expiry",V.target.value),onFocus:()=>x("expiry"),onBlur:()=>x(null),placeholder:l.expiry||"MM/YY",className:E(j.expiry&&"border-destructive",d),disabled:m}),j.expiry&&(0,Gr.jsx)("p",{className:E("text-sm text-destructive",p),children:j.expiry})]}),(0,Gr.jsxs)("div",{className:"space-y-1",children:[(0,Gr.jsxs)(Lt,{htmlFor:"card-cvc",className:f,children:[s.cvc||"CVC",h&&(0,Gr.jsx)("span",{className:"text-destructive ml-1",children:"*"})]}),(0,Gr.jsxs)("div",{className:"relative",children:[(0,Gr.jsx)(Zt,{ref:$,id:"card-cvc",type:"text",inputMode:"numeric",value:e.cvc,onChange:V=>A("cvc",V.target.value),onFocus:()=>x("cvc"),onBlur:()=>x(null),placeholder:l.cvc||y==="amex"?"1234":"123",className:E(j.cvc&&"border-destructive",d),disabled:m}),o&&(0,Gr.jsx)(Qt,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"})]}),j.cvc&&(0,Gr.jsx)("p",{className:E("text-sm text-destructive",p),children:j.cvc})]})]}),(0,Gr.jsxs)("div",{className:"space-y-1",children:[(0,Gr.jsx)(Lt,{htmlFor:"card-name",className:f,children:s.name||"Cardholder Name"}),(0,Gr.jsx)(Zt,{ref:I,id:"card-name",type:"text",value:e.name,onChange:V=>A("name",V.target.value),onFocus:()=>x("name"),onBlur:()=>x(null),placeholder:l.name||"John Doe",className:E(j.name&&"border-destructive",d),disabled:m}),j.name&&(0,Gr.jsx)("p",{className:E("text-sm text-destructive",p),children:j.name})]})]}),o&&(0,Gr.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,Gr.jsx)(Qt,{className:"w-4 h-4"}),(0,Gr.jsx)("span",{children:"Your payment information is secure and encrypted"})]})]})});m6e.displayName="MoonUICreditCardInputPro";var ac=_(ye(),1);var lt=_(ue(),1),h6e=gt("relative w-full rounded-lg border bg-card text-card-foreground shadow-sm",{variants:{variant:{default:"border-border",exam:"border-primary/20 bg-primary/5",personality:"border-secondary/20 bg-secondary/5"},size:{sm:"p-4",md:"p-6",lg:"p-8"}},defaultVariants:{variant:"default",size:"md"}}),g6e=ac.default.forwardRef(({className:e,variant:t,size:r,questions:n,settings:o={},onComplete:a,onProgress:i,title:s,description:l,...c},u)=>{let[d,f]=(0,ac.useState)([]),[p,m]=(0,ac.useState)(0),[h,g]=(0,ac.useState)({}),[v,y]=(0,ac.useState)(!1),[b,w]=(0,ac.useState)(null),[x,C]=(0,ac.useState)(o.timeLimit?o.timeLimit*60:null),[P,R]=(0,ac.useState)(Date.now()),[L,$]=(0,ac.useState)(!1),[I,A]=(0,ac.useState)(0);(0,ac.useEffect)(()=>{let q=[...n];o.shuffleQuestions&&(q=V(q)),o.shuffleOptions&&(q=q.map(H=>H.options?{...H,options:V([...H.options])}:H)),f(q)},[n,o.shuffleQuestions,o.shuffleOptions]),(0,ac.useEffect)(()=>{if(x===null||x<=0||v)return;let q=setInterval(()=>{C(H=>H===null||H<=1?(T(),0):H-1)},1e3);return()=>clearInterval(q)},[x,v]),(0,ac.useEffect)(()=>{i&&i(p+1,d.length)},[p,d.length,i]);let j=d[p],V=q=>{let H=[...q];for(let F=H.length-1;F>0;F--){let W=Math.floor(Math.random()*(F+1));[H[F],H[W]]=[H[W],H[F]]}return H},S=q=>{let H=Date.now()-P;g(F=>({...F,[j.id]:{questionId:j.id,answer:q,timeSpent:H}}))},N=()=>{p<d.length-1?(m(q=>q+1),R(Date.now()),$(!1)):T()},k=()=>{p>0&&(m(q=>q-1),$(!1))},T=()=>{let q=B();w(q),y(!0),A(H=>H+1),a&&a(q)},B=()=>{let q=0,H=0,F=[];d.forEach(O=>{let Y=h[O.id],re=O.points||1;q+=re;let Q=!1;if(Y?.answer&&O.correctAnswer!==void 0)switch(O.type){case"single-choice":case"true-false":case"text":Q=Y.answer===O.correctAnswer;break;case"multiple-choice":Array.isArray(Y.answer)&&Array.isArray(O.correctAnswer)&&(Q=Y.answer.length===O.correctAnswer.length&&Y.answer.every(ae=>O.correctAnswer.includes(ae)));break;case"matching":if(typeof Y.answer=="object"&&typeof O.correctAnswer=="object"){let ae=O.correctAnswer,te=Y.answer;Q=Object.keys(ae).every(se=>ae[se]===te[se])}break;case"rating":Q=!0;break}Q&&(H+=re),F.push({questionId:O.id,userAnswer:Y?.answer||null,correctAnswer:O.correctAnswer,isCorrect:Q,points:Q?re:0})});let W=q>0?H/q*100:0,U=Object.values(h).reduce((O,Y)=>O+(Y.timeSpent||0),0);return{score:H,totalScore:q,percentage:W,passed:o.passingScore?W>=o.passingScore:void 0,answers:F,timeSpent:U,completedAt:new Date}},D=()=>{m(0),g({}),y(!1),w(null),C(o.timeLimit?o.timeLimit*60:null),R(Date.now()),$(!1),o.shuffleQuestions&&f(V([...n]))},z=()=>{if(!b)return;let q={title:s,completedAt:b.completedAt,score:b.score,totalScore:b.totalScore,percentage:b.percentage,passed:b.passed,timeSpent:b.timeSpent,answers:b.answers.map(U=>({question:d.find(Y=>Y.id===U.questionId)?.question,userAnswer:U.userAnswer,correctAnswer:U.correctAnswer,isCorrect:U.isCorrect,points:U.points}))},H=new Blob([JSON.stringify(q,null,2)],{type:"application/json"}),F=URL.createObjectURL(H),W=document.createElement("a");W.href=F,W.download=`quiz-results-${Date.now()}.json`,W.click(),URL.revokeObjectURL(F)},M=q=>{let H=Math.floor(q/60),F=q%60;return`${H}:${F.toString().padStart(2,"0")}`},G=()=>{if(!j)return null;let q=h[j.id]?.answer;switch(j.type){case"single-choice":case"true-false":return(0,lt.jsx)("div",{className:"space-y-3",children:j.options?.map((U,O)=>(0,lt.jsx)(me.button,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:O*.1},onClick:()=>S(U),className:E("w-full text-left p-4 rounded-lg border transition-colors",q===U?"border-primary bg-primary/10":"border-border hover:border-primary/50"),children:U},O))});case"multiple-choice":return(0,lt.jsx)("div",{className:"space-y-3",children:j.options?.map((U,O)=>{let Y=Array.isArray(q)&&q.includes(U);return(0,lt.jsx)(me.button,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:O*.1},onClick:()=>{let re=q||[],Q=Y?re.filter(ae=>ae!==U):[...re,U];S(Q)},className:E("w-full text-left p-4 rounded-lg border transition-colors",Y?"border-primary bg-primary/10":"border-border hover:border-primary/50"),children:(0,lt.jsxs)("div",{className:"flex items-center gap-3",children:[(0,lt.jsx)("div",{className:E("w-5 h-5 rounded border-2 transition-colors",Y?"bg-primary border-primary":"border-border"),children:Y&&(0,lt.jsx)(Xi,{className:"w-full h-full text-primary-foreground"})}),U]})},O)})});case"text":return(0,lt.jsx)(me.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:(0,lt.jsx)("textarea",{className:"w-full p-4 rounded-lg border border-input bg-background resize-none",rows:4,placeholder:"Type your answer here...",value:q||"",onChange:U=>S(U.target.value)})});case"rating":let H=j.maxRating||5,F=typeof q=="number"?q:0;return(0,lt.jsxs)(me.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"space-y-4",children:[(0,lt.jsx)("div",{className:"flex justify-center gap-2",children:Array.from({length:H},(U,O)=>O+1).map(U=>(0,lt.jsx)("button",{onClick:()=>S(U),className:"transition-transform hover:scale-110",children:(0,lt.jsx)(vs,{className:E("w-10 h-10 transition-colors",U<=F?"fill-yellow-500 text-yellow-500":"text-muted-foreground")})},U))}),j.ratingLabels&&(0,lt.jsxs)("div",{className:"flex justify-between text-sm text-muted-foreground",children:[(0,lt.jsx)("span",{children:j.ratingLabels[0]}),(0,lt.jsx)("span",{children:j.ratingLabels[1]})]})]});case"matching":let W=q||{};return(0,lt.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,lt.jsxs)("div",{className:"space-y-3",children:[(0,lt.jsx)("h4",{className:"font-medium mb-2",children:"Match these items:"}),j.leftOptions?.map((U,O)=>(0,lt.jsx)(me.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:O*.1},className:"p-3 rounded-lg border bg-muted/50",children:U},U))]}),(0,lt.jsxs)("div",{className:"space-y-3",children:[(0,lt.jsx)("h4",{className:"font-medium mb-2",children:"With these:"}),j.leftOptions?.map(U=>(0,lt.jsx)(me.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},children:(0,lt.jsxs)("select",{className:"w-full p-3 rounded-lg border bg-background",value:W[U]||"",onChange:O=>S({...W,[U]:O.target.value}),children:[(0,lt.jsx)("option",{value:"",children:"Select..."}),j.rightOptions?.map(O=>(0,lt.jsx)("option",{value:O,children:O},O))]})},U))]})]});default:return null}};return v&&b?(0,lt.jsx)("div",{ref:u,className:E(h6e({variant:t,size:r}),e),...c,children:(0,lt.jsxs)(me.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"space-y-6",children:[(0,lt.jsxs)("div",{className:"text-center",children:[(0,lt.jsx)("h2",{className:"text-2xl font-bold mb-2",children:"Quiz Completed!"}),(0,lt.jsxs)("div",{className:"text-5xl font-bold mb-4",children:[b.percentage.toFixed(1),"%"]}),(0,lt.jsxs)("p",{className:"text-muted-foreground",children:["You scored ",b.score," out of ",b.totalScore," points"]}),b.passed!==void 0&&(0,lt.jsx)("div",{className:E("mt-4 inline-flex items-center gap-2 px-4 py-2 rounded-full",b.passed?"bg-green-100 text-green-700":"bg-red-100 text-red-700"),children:b.passed?(0,lt.jsxs)(lt.Fragment,{children:[(0,lt.jsx)(Xi,{className:"w-5 h-5"}),"Passed"]}):(0,lt.jsxs)(lt.Fragment,{children:[(0,lt.jsx)(eo,{className:"w-5 h-5"}),"Failed"]})})]}),o.allowReview&&(0,lt.jsxs)("div",{className:"space-y-4",children:[(0,lt.jsx)("h3",{className:"font-semibold",children:"Review Answers:"}),b.answers.map((q,H)=>{let F=d.find(W=>W.id===q.questionId);return F?(0,lt.jsx)("div",{className:"p-4 rounded-lg border bg-muted/50",children:(0,lt.jsxs)("div",{className:"flex items-start gap-3",children:[q.isCorrect?(0,lt.jsx)(Xi,{className:"w-5 h-5 text-green-600 mt-0.5"}):(0,lt.jsx)(eo,{className:"w-5 h-5 text-red-600 mt-0.5"}),(0,lt.jsxs)("div",{className:"flex-1",children:[(0,lt.jsxs)("p",{className:"font-medium mb-2",children:[H+1,". ",F.question]}),(0,lt.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Your answer: ",JSON.stringify(q.userAnswer)]}),!q.isCorrect&&F.correctAnswer!==void 0&&(0,lt.jsxs)("p",{className:"text-sm text-green-600 mt-1",children:["Correct answer: ",JSON.stringify(F.correctAnswer)]}),F.explanation&&(0,lt.jsx)("p",{className:"text-sm text-muted-foreground mt-2",children:F.explanation})]})]})},q.questionId):null})]}),(0,lt.jsxs)("div",{className:"flex gap-3 justify-center",children:[(!o.maxAttempts||I<o.maxAttempts)&&(0,lt.jsxs)("button",{onClick:D,className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90",children:[(0,lt.jsx)(dv,{className:"w-4 h-4"}),"Try Again"]}),(0,lt.jsxs)("button",{onClick:z,className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg border hover:bg-muted",children:[(0,lt.jsx)(vn,{className:"w-4 h-4"}),"Download Results"]})]})]})}):(0,lt.jsxs)("div",{ref:u,className:E(h6e({variant:t,size:r}),e),...c,children:[(s||x!==null)&&(0,lt.jsxs)("div",{className:"mb-6 flex items-center justify-between",children:[(0,lt.jsxs)("div",{children:[s&&(0,lt.jsx)("h2",{className:"text-2xl font-bold",children:s}),l&&(0,lt.jsx)("p",{className:"text-muted-foreground mt-1",children:l})]}),x!==null&&(0,lt.jsxs)("div",{className:E("flex items-center gap-2 px-3 py-1 rounded-full text-sm font-medium",x<60?"bg-red-100 text-red-700":"bg-muted"),children:[(0,lt.jsx)(cn,{className:"w-4 h-4"}),M(x)]})]}),(0,lt.jsxs)("div",{className:"mb-6",children:[(0,lt.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground mb-2",children:[(0,lt.jsxs)("span",{children:["Question ",p+1," of ",d.length]}),(0,lt.jsxs)("span",{children:[Math.round((p+1)/d.length*100),"%"]})]}),(0,lt.jsx)("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:(0,lt.jsx)(me.div,{className:"h-full bg-primary",initial:{width:0},animate:{width:`${(p+1)/d.length*100}%`},transition:{duration:.3}})})]}),(0,lt.jsx)(kt,{mode:"wait",children:j&&(0,lt.jsxs)(me.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"mb-6",children:[(0,lt.jsxs)("h3",{className:"text-lg font-semibold mb-4",children:[j.question,j.required&&(0,lt.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),G(),o.showHints&&j.hint&&(0,lt.jsxs)("div",{className:"mt-4",children:[(0,lt.jsxs)("button",{onClick:()=>$(!L),className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground",children:[(0,lt.jsx)(tm,{className:"w-4 h-4"}),L?"Hide":"Show"," Hint"]}),L&&(0,lt.jsx)(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},className:"mt-2 p-3 rounded-lg bg-muted/50 text-sm",children:j.hint})]}),o.showInstantFeedback&&h[j.id]&&j.correctAnswer!==void 0&&(0,lt.jsx)(me.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"mt-4",children:(()=>{let q=h[j.id].answer,H=!1;switch(j.type){case"single-choice":case"true-false":H=q===j.correctAnswer;break}return(0,lt.jsxs)("div",{className:E("p-3 rounded-lg flex items-start gap-2",H?"bg-green-100 text-green-700":"bg-red-100 text-red-700"),children:[H?(0,lt.jsx)(Xi,{className:"w-5 h-5 mt-0.5"}):(0,lt.jsx)(eo,{className:"w-5 h-5 mt-0.5"}),(0,lt.jsxs)("div",{children:[(0,lt.jsx)("p",{className:"font-medium",children:H?"Correct!":"Incorrect"}),j.explanation&&(0,lt.jsx)("p",{className:"text-sm mt-1",children:j.explanation})]})]})})()})]},j.id)}),(0,lt.jsxs)("div",{className:"flex items-center justify-between",children:[(0,lt.jsxs)("button",{onClick:k,disabled:p===0,className:E("inline-flex items-center gap-2 px-4 py-2 rounded-lg transition-colors",p===0?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":"bg-muted hover:bg-muted/80"),children:[(0,lt.jsx)(Za,{className:"w-4 h-4"}),"Previous"]}),(0,lt.jsxs)("button",{onClick:p===d.length-1?T:N,disabled:j?.required&&!h[j.id],className:E("inline-flex items-center gap-2 px-4 py-2 rounded-lg transition-colors",j?.required&&!h[j.id]?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":"bg-primary text-primary-foreground hover:bg-primary/90"),children:[p===d.length-1?"Complete":"Next",(0,lt.jsx)(Sn,{className:"w-4 h-4"})]})]})]})});g6e.displayName="MoonUIQuizFormProInternal";var jne=ac.default.forwardRef((e,t)=>{let{hasProAccess:r,isLoading:n}=Ee();return!n&&!r?(0,lt.jsx)(Ze,{className:E("w-full",e.className),children:(0,lt.jsx)(tt,{className:"py-12 text-center",children:(0,lt.jsxs)("div",{className:"max-w-md mx-auto space-y-4",children:[(0,lt.jsx)("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:(0,lt.jsx)(Qt,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),(0,lt.jsxs)("div",{children:[(0,lt.jsx)("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),(0,lt.jsx)("p",{className:"text-muted-foreground text-sm mb-4",children:"MoonUI Quiz Form is available exclusively to MoonUI Pro subscribers."}),(0,lt.jsx)("a",{href:"/pricing",children:(0,lt.jsxs)(xe,{size:"sm",children:[(0,lt.jsx)(jt,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})]})]})})}):(0,lt.jsx)(g6e,{...e,ref:t})});jne.displayName="MoonUIQuizFormPro";var u1=_(ye(),1);var cj=_(ue(),1),i$t={sm:"text-2xl md:text-3xl",md:"text-3xl md:text-4xl",lg:"text-4xl md:text-5xl",xl:"text-5xl md:text-6xl","2xl":"text-6xl md:text-7xl","3xl":"text-7xl md:text-8xl",custom:""};function s$t({children:e,speed:t=.5,enableShadows:r=!0,enableOnHover:n=!1,className:o="",size:a="lg",shadowColors:i={primary:"#ff00ff",secondary:"#00ffff"},intensity:s=1}){let l=(0,u1.useRef)(null),[c,u]=(0,u1.useState)(!1),d=(0,u1.useRef)(null);return(0,u1.useEffect)(()=>{let f=`glitch-${Math.random().toString(36).substr(2,9)}`;l.current&&l.current.setAttribute("data-glitch-id",f);let p=document.createElement("style");d.current=p;let m=t*2,h=i.primary,g=i.secondary,v=r?s:0;return p.textContent=`
|
|
517
517
|
[data-glitch-id="${f}"] {
|
|
518
518
|
position: relative;
|
|
519
519
|
display: inline-block;
|