lantern-harness 0.1.6 → 0.1.8
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/CHANGELOG.md +25 -0
- package/README.md +1 -1
- package/builtin/session/update-check.mjs +517 -0
- package/cli/lantern.mjs +123 -22
- package/cli/server.mjs +5 -2
- package/dist/500.html +3 -3
- package/dist/_astro/Base.DjIEQkT7.css +1 -0
- package/dist/_astro/Base.astro_astro_type_script_index_0_lang.D0snmAJ_.js +1 -0
- package/dist/_astro/{CaseExecBoard.FJ1Y9b4e.js → CaseExecBoard.BAV4EE3o.js} +1 -1
- package/dist/_astro/{CaseGenerateApp.CT2n4VOf.js → CaseGenerateApp.Bz4ryNJG.js} +1 -1
- package/dist/_astro/{CasesLibrary.BjrehOiI.js → CasesLibrary.BPifyHUA.js} +1 -1
- package/dist/_astro/{ChatApp.Dqfx4FcI.js → ChatApp.DLo31SYZ.js} +5 -5
- package/dist/_astro/{DashboardBoard.wILBO_CD.js → DashboardBoard.Bd3eUPwZ.js} +2 -2
- package/dist/_astro/{DocsFileBrowser.D32MgVAR.js → DocsFileBrowser.D3cKurQE.js} +1 -1
- package/dist/_astro/{DocsPager.BARD7JvD.js → DocsPager.rzu4mnzw.js} +1 -1
- package/dist/_astro/{KnowledgeLibrary.C-Sg2R6B.js → KnowledgeLibrary.B0sO4QR1.js} +1 -1
- package/dist/_astro/{NavLibraries.BzInZVDf.js → NavLibraries.Cvg3wery.js} +1 -1
- package/dist/_astro/{PluginsPage.CVyua_fb.js → PluginsPage.DIltPILi.js} +2 -2
- package/dist/_astro/PluginsPage.uvmSuXzi.js +1 -0
- package/dist/_astro/PmBugsBoard.CiaIhCHv.js +1 -0
- package/dist/_astro/PmIterationsBoard.H67QwKFw.js +1 -0
- package/dist/_astro/{PmProjectDetail.CtQdpGes.js → PmProjectDetail.DqDoIg8a.js} +1 -1
- package/dist/_astro/PmProjectsBoard.nOC1Hugt.js +1 -0
- package/dist/_astro/PmRequirementsBoard.BPjZ7khP.js +1 -0
- package/dist/_astro/PmRequirementsBoard.CanxvcKg.js +1 -0
- package/dist/_astro/PmShared.CZnXaUq-.js +1 -0
- package/dist/_astro/{PromptsLibrary.Z1DQBrFL.js → PromptsLibrary.DU9EuSim.js} +1 -1
- package/dist/_astro/{ReportsPage.CGpIPPr9.js → ReportsPage.Cr88iz8c.js} +1 -1
- package/dist/_astro/{RequirementsLibrary.D8078xLd.js → RequirementsLibrary.BwriF8F0.js} +1 -1
- package/dist/_astro/{SearchableSelect.BTJoZC_a.js → SearchableSelect.Ctg8V1Z1.js} +1 -1
- package/dist/_astro/SettingsDialog.DEgsVfaL.js +1 -0
- package/dist/_astro/SpaceSwitcher.BEJo5KFi.js +7 -0
- package/dist/_astro/{TasksBoard.CL-sNPZN.js → TasksBoard.BZi_GBPG.js} +1 -1
- package/dist/_astro/{TemplatesLibrary.d6uIe7I-.js → TemplatesLibrary.T4K9jUex.js} +1 -1
- package/dist/_astro/{TestStatsBoard.CSdXWc4Q.js → TestStatsBoard.Dd1Kcmx6.js} +1 -1
- package/dist/_astro/{TodosBoard.nl23X5Gi.js → TodosBoard.C4yd_JFb.js} +1 -1
- package/dist/_astro/app-config.DKMxjv3g.js +1 -0
- package/dist/_astro/i18n.BXeGGutk.js +7 -0
- package/dist/_astro/{open-docs-in-session.B5cUxqHi.js → open-docs-in-session.B0ZdZNj2.js} +1 -1
- package/dist/_astro/{plugins.DaDJq-mn.js → plugins.D5ypJIXn.js} +1 -1
- package/dist/_astro/pm.BsnTv63L.js +4 -0
- package/dist/_astro/{settings.CMK4PEak.js → settings.CnDCvwnQ.js} +2 -2
- package/dist/_astro/{spaces-client.CoQfaOIO.js → spaces-client.Cai2tHEI.js} +1 -1
- package/dist/_astro/update.DXCPfU4a.js +1 -0
- package/dist/_astro/{view-prefs.Dhdh8Z5a.js → view-prefs.HCowOWXL.js} +1 -1
- package/dist/case-exec/index.html +4 -4
- package/dist/cases/generate/index.html +4 -4
- package/dist/cases/library/index.html +4 -4
- package/dist/dashboard/index.html +4 -4
- package/dist/docs/changelog/index.html +25 -4
- package/dist/docs/install/index.html +3 -3
- package/dist/docs/manual/index.html +15 -5
- package/dist/index.html +4 -4
- package/dist/knowledge/index.html +4 -4
- package/dist/knowledge//345/212/237/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213/347/274/226/345/206/231/350/247/204/350/214/203/index.html +3 -3
- package/dist/plugins/index.html +4 -4
- package/dist/pm/bugs/index.html +4 -4
- package/dist/pm/iterations/index.html +4 -4
- package/dist/pm/projects/detail/index.html +4 -4
- package/dist/pm/projects/index.html +4 -4
- package/dist/pm/requirements/index.html +4 -4
- package/dist/prompts/index.html +4 -4
- package/dist/reports/index.html +4 -4
- package/dist/requirements/index.html +4 -4
- package/dist/tasks/index.html +4 -4
- package/dist/templates/index.html +4 -4
- package/dist/templates//345/212/237/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212//345/212/237/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +3 -3
- package/dist/templates//346/200/247/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212//346/200/247/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +3 -3
- package/dist/templates//346/200/247/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213//346/200/247/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213/346/250/241/346/235/277/index.html +3 -3
- package/dist/templates//346/216/245/345/217/243/346/265/213/350/257/225/346/212/245/345/221/212//346/216/245/345/217/243/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +3 -3
- package/dist/templates//350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/347/224/250/344/276/213//350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/347/224/250/344/276/213/346/250/241/346/235/277/index.html +3 -3
- package/dist/test-stats/index.html +4 -4
- package/dist/todos/index.html +4 -4
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +13 -2
- package/lh-plugins/lh-pm.mjs +18 -4
- package/lh-plugins/lh-update.mjs +171 -0
- package/package.json +1 -1
- package/dist/_astro/Base.DGaLtzMo.css +0 -1
- package/dist/_astro/Base.astro_astro_type_script_index_0_lang.uhTNjhRY.js +0 -1
- package/dist/_astro/PluginsPage.CS1GaJtR.js +0 -1
- package/dist/_astro/PmBugsBoard.BXUu0kNL.js +0 -1
- package/dist/_astro/PmIterationsBoard.Deso1uyK.js +0 -1
- package/dist/_astro/PmProjectsBoard.MM4vxneK.js +0 -1
- package/dist/_astro/PmRequirementsBoard.62ONLCH5.js +0 -1
- package/dist/_astro/PmRequirementsBoard.SLVDgspp.js +0 -1
- package/dist/_astro/PmShared.CwCmF-kI.js +0 -1
- package/dist/_astro/SettingsDialog.BA57gp90.js +0 -1
- package/dist/_astro/SpaceSwitcher.DZ8b_85M.js +0 -7
- package/dist/_astro/app-config.huKxSIlN.js +0 -1
- package/dist/_astro/i18n.Bbh04ngD.js +0 -7
- package/dist/_astro/pm.CpFmMslU.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{c as e,n as t,r as n,t as r}from"./react-dom.CqAxpHMt.js";import{i}from"./app-config.huKxSIlN.js";import{a,o,r as s}from"./plugins.DaDJq-mn.js";import{a as c,i as l,n as u,o as d,r as f,t as p}from"./view-prefs.Dhdh8Z5a.js";import{i as m,n as h,r as g,t as _}from"./dialog.DXHznyjD.js";import{t as v}from"./jsx-runtime.BUXbF_vF.js";import{v as y,y as b}from"./pm.CpFmMslU.js";import{A as x,C as S,D as C,E as w,P as T,b as E,f as D,i as ee,k as O,n as k,s as A,u as j,v as M,w as N}from"./tasks.otRBFydq.js";import{a as te,r as ne}from"./test-stats.MEm3K2rB.js";import{d as re}from"./spaces-client.CoQfaOIO.js";function ie(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=ie(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function ae(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=ie(e))&&(r&&(r+=` `),r+=t);return r}function P(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function F(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function oe(e,t,n,r,i,a,o){let{margin:s,containerPadding:c,rowHeight:l}=e,u=P(e),d,f,p,m;if(o?(d=Math.round(o.width),f=Math.round(o.height)):(d=F(r,u,s[0]),f=F(i,l,s[1])),a?(p=Math.round(a.top),m=Math.round(a.left)):o?(p=Math.round(o.top),m=Math.round(o.left)):(p=Math.round((l+s[1])*n+c[1]),m=Math.round((u+s[0])*t+c[0])),!a&&!o){if(Number.isFinite(r)){let e=Math.round((u+s[0])*(t+r)+c[0])-m-d;e!==s[0]&&(d+=e-s[0])}if(Number.isFinite(i)){let e=Math.round((l+s[1])*(n+i)+c[1])-p-f;e!==s[1]&&(f+=e-s[1])}}return{top:p,left:m,width:d,height:f}}function se(e,t,n,r,i){let{margin:a,containerPadding:o,cols:s,rowHeight:c,maxRows:l}=e,u=P(e),d=Math.round((n-o[0])/(u+a[0])),f=Math.round((t-o[1])/(c+a[1]));return d=L(d,0,s-r),f=L(f,0,l-i),{x:d,y:f}}function I(e,t,n){let{margin:r,containerPadding:i,rowHeight:a}=e,o=P(e);return{x:Math.round((n-i[0])/(o+r[0])),y:Math.round((t-i[1])/(a+r[1]))}}function ce(e,t,n){let{margin:r,rowHeight:i}=e,a=P(e);return{w:Math.max(1,Math.round((t+r[0])/(a+r[0]))),h:Math.max(1,Math.round((n+r[1])/(i+r[1])))}}function L(e,t,n){return Math.max(Math.min(e,n),t)}function le(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function ue(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0&&le(r,t))return r}}function de(e,t){return e.filter(e=>le(e,t))}function R(e,t){return t===`horizontal`?B(e):t===`vertical`||t===`wrap`?z(e):[...e]}function z(e){return[...e].sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y)}function B(e){return[...e].sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x)}function fe(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0){let e=r.y+r.h;e>t&&(t=e)}}return t}function pe(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0&&r.i===t)return r}}function V(e){return e.filter(e=>e.static===!0)}function H(e){return{i:e.i,x:e.x,y:e.y,w:e.w,h:e.h,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,constraints:e.constraints,isBounded:e.isBounded}}function U(e){let t=Array(e.length);for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(t[n]=H(r))}return t}function me(e,t){let n=Array(e.length);for(let r=0;r<e.length;r++){let i=e[r];i!==void 0&&(t.i===i.i?n[r]=t:n[r]=i)}return n}function he(e,t,n){let r=pe(e,t);return r?(r=n(H(r)),[me(e,r),r]):[[...e],null]}function W(e,t){let n=V(e);for(let r=0;r<e.length;r++){let i=e[r];if(i!==void 0){if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),i.y===1/0&&(i.y=fe(n)),!i.static)n.push(i);else for(;ue(n,i);)i.y++}}return e}function ge(e,t,n,r,i,a,o,s,c){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return[...e];let l=t.x,u=t.y;typeof n==`number`&&(t.x=n),typeof r==`number`&&(t.y=r),t.moved=!0;let d=R(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(d=d.reverse());let f=de(d,t),p=f.length>0;if(p&&c)return U(e);if(p&&a)return t.x=l,t.y=u,t.moved=!1,e;let m=[...e];for(let e=0;e<f.length;e++){let n=f[e];n!==void 0&&(n.moved||(m=n.static?G(m,n,t,i,o):G(m,t,n,i,o)))}return m}function G(e,t,n,r,i,a){let o=i===`horizontal`||i===`wrap`,s=i===`vertical`,c=t.static;if(r){r=!1;let a={x:o?Math.max(t.x-n.w,0):n.x,y:s?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:`-1`},l=ue(e,a),u=l!==void 0&&l.y+l.h>t.y,d=l!==void 0&&t.x+t.w>l.x;if(!l)return ge(e,n,o?a.x:void 0,s?a.y:void 0,r,c,i);if(u&&s)return ge(e,n,void 0,n.y+1,r,c,i);if(u&&i===null){let r=n.y;return t.y=r,n.y=r+t.h,[...e]}if(d&&o)return ge(e,t,n.x,void 0,r,c,i)}let l=o?n.x+1:void 0,u=s?n.y+1:void 0;return l===void 0&&u===void 0?[...e]:ge(e,n,l,u,r,c,i)}function K(e,t,n){return Math.max(t,Math.min(n,e))}var _e=[{name:`gridBounds`,constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:K(t,0,Math.max(0,r-e.w)),y:K(n,0,Math.max(0,i-e.h))}},constrainSize(e,t,n,r,{cols:i,maxRows:a}){let o=r===`w`||r===`nw`||r===`sw`?e.x+e.w:i-e.x,s=r===`n`||r===`nw`||r===`ne`?e.y+e.h:a-e.y;return{w:K(t,1,Math.max(1,o)),h:K(n,1,Math.max(1,s))}}},{name:`minMaxSize`,constrainSize(e,t,n){return{w:K(t,e.minW??1,e.maxW??1/0),h:K(n,e.minH??1,e.maxH??1/0)}}}];function ve(e,t,n,r,i){let a={x:n,y:r};for(let n of e)n.constrainPosition&&(a=n.constrainPosition(t,a.x,a.y,i));if(t.constraints)for(let e of t.constraints)e.constrainPosition&&(a=e.constrainPosition(t,a.x,a.y,i));return a}function q(e,t,n,r,i,a){let o={w:n,h:r};for(let n of e)n.constrainSize&&(o=n.constrainSize(t,o.w,o.h,i,a));if(t.constraints)for(let e of t.constraints)e.constrainSize&&(o=e.constrainSize(t,o.w,o.h,i,a));return o}function ye({top:e,left:t,width:n,height:r}){let i=`translate(${t}px,${e}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${n}px`,height:`${r}px`,position:`absolute`}}function be({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:`absolute`}}function xe(e){return e*100+`%`}function Se(e,t,n,r){return e+n>r?t:n}function J(e,t,n){return e<0?t:n}function Ce(e){return Math.max(0,e)}function Y(e){return Math.max(0,e)}var we=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:J(o,e.height,i),top:Y(o)}},Te=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:Se(e.left,e.width,o,n),left:Ce(i)}},Ee=(e,t,n)=>{let{top:r,height:i,width:a}=t,o=e.left+e.width-a;return o<0?{height:i,width:e.left+e.width,top:Y(r),left:0}:{height:i,width:a,top:Y(r),left:o}},De=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:J(r,e.height,a),top:Y(r)}},Oe={n:we,ne:(e,t,n)=>we(e,Te(e,t,n)),e:Te,se:(e,t,n)=>De(e,Te(e,t,n)),s:De,sw:(e,t,n)=>De(e,Ee(e,t)),w:Ee,nw:(e,t,n)=>we(e,Ee(e,t))};function ke(e,t,n,r){let i=Oe[e];return i?i(t,{...t,...n},r):n}var Ae={type:`transform`,scale:1,calcStyle(e){return ye(e)}},je={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},Me={enabled:!0,bounded:!1,threshold:3},Ne={enabled:!0,handles:[`se`]},Pe={enabled:!1,defaultItem:{w:1,h:1},touchEnabled:!0,touchDragSource:`[data-rgl-draggable]`};function Fe(e,t,n,r,i){let a=r===`x`?`w`:`h`;t[r]+=1;let o=e.findIndex(e=>e.i===t.i),s=i??V(e).length>0;for(let i=o+1;i<e.length;i++){let o=e[i];if(o!==void 0&&!o.static){if(!s&&o.y>t.y+t.h)break;le(t,o)&&Fe(e,o,n+t[a],r,s)}}t[r]=n}function Ie(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0),t.y=Math.min(r,t.y);t.y>0&&!ue(e,t);)t.y--;let i;for(;(i=ue(e,t))!==void 0;)Fe(n,t,i.y+i.h,`y`);return t.y=Math.max(t.y,0),t}function Le(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!ue(e,t);)t.x--;let i;for(;(i=ue(e,t))!==void 0;)if(Fe(r,t,i.x+i.w,`x`),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!ue(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var Re={type:`vertical`,allowOverlap:!1,compact(e,t){let n=V(e),r=fe(n),i=z(e),a=Array(e.length);for(let t=0;t<i.length;t++){let o=i[t];if(o===void 0)continue;let s=H(o);s.static||(s=Ie(n,s,i,r),r=Math.max(r,s.y+s.h),n.push(s));let c=e.indexOf(o);a[c]=s,s.moved=!1}return a}},ze={type:`horizontal`,allowOverlap:!1,compact(e,t){let n=V(e),r=B(e),i=Array(e.length);for(let a=0;a<r.length;a++){let o=r[a];if(o===void 0)continue;let s=H(o);s.static||(s=Le(n,s,t,r),n.push(s));let c=e.indexOf(o);i[c]=s,s.moved=!1}return i}},Be={type:null,allowOverlap:!1,compact(e,t){return U(e)}},Ve={...Re,allowOverlap:!0,compact(e,t){return U(e)}},He={...ze,allowOverlap:!0,compact(e,t){return U(e)}},Ue={...Be,allowOverlap:!0};function We(e,t=!1,n=!1){let r;return r=t?e===`vertical`?Ve:e===`horizontal`?He:Ue:e===`vertical`?Re:e===`horizontal`?ze:Be,n?{...r,preventCollision:n}:r}function Ge(e){return Object.keys(e).sort((t,n)=>e[t]-e[n])}function Ke(e,t){let n=Ge(e),r=n[0];if(r===void 0)throw Error(`No breakpoints defined`);for(let i=1;i<n.length;i++){let a=n[i];a!==void 0&&t>e[a]&&(r=a)}return r}function qe(e,t){let n=t[e];if(n===void 0)throw Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function Je(e,t,n,r,i,a){let o=e[n];if(o)return U(o);let s=e[r],c=Ge(t),l=c.slice(c.indexOf(n));for(let t=0;t<l.length;t++){let n=l[t];if(n===void 0)continue;let r=e[n];if(r){s=r;break}}let u=W(U(s||[]),{cols:i});return(typeof a==`object`&&a?a:We(a)).compact(u,i)}function Ye(e,t){if(Array.isArray(e))return e;let n=e,r=n[t];if(r!==void 0)return r;let i=Object.keys(n);for(let e of i){let t=n[e];if(t!==void 0)return t}return[10,10]}var Xe=n(((e,t,n)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n[`fast-equals`]={}))})(n,(function(e){function t(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function n(e){return function(t,n,r,i){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r,i);var a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);var s=e(t,n,r,i);return i.delete(t),i.delete(n),s}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function i(e){return e.constructor===Object||e.constructor==null}function a(e){return typeof e.then==`function`}function o(e,t){return e===t||e!==e&&t!==t}var s=Object.prototype.toString;function c(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,c=e.areObjectsEqual,l=e.areRegExpsEqual,u=e.areSetsEqual,d=e.createIsNestedEqual,f=d(p);function p(e,d,p){if(e===d)return!0;if(!e||!d||typeof e!=`object`||typeof d!=`object`)return e!==e&&d!==d;if(i(e)&&i(d))return c(e,d,f,p);var m=Array.isArray(e),h=Array.isArray(d);if(m||h)return m===h&&t(e,d,f,p);var g=s.call(e);return g===s.call(d)?g===`[object Date]`?n(e,d,f,p):g===`[object RegExp]`?l(e,d,f,p):g===`[object Map]`?r(e,d,f,p):g===`[object Set]`?u(e,d,f,p):g===`[object Object]`||g===`[object Arguments]`?a(e)||a(d)?!1:c(e,d,f,p):g===`[object Boolean]`||g===`[object Number]`||g===`[object String]`?o(e.valueOf(),d.valueOf()):!1:!1}return p}function l(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-->0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var u=n(l);function d(e,t){return o(e.valueOf(),t.valueOf())}function f(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={},o=0;return e.forEach(function(s,c){if(i){var l=!1,u=0;t.forEach(function(i,d){!l&&!a[u]&&(l=n(c,d,o,u,e,t,r)&&n(s,i,c,d,e,t,r))&&(a[u]=!0),u++}),o++,i=l}}),i}var p=n(f),m=`_owner`,h=Object.prototype.hasOwnProperty;function g(e,t,n,r){var i=Object.keys(e),a=i.length;if(Object.keys(t).length!==a)return!1;for(var o;a-->0;){if(o=i[a],o===m){var s=!!e.$$typeof,c=!!t.$$typeof;if((s||c)&&s!==c)return!1}if(!h.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var _=n(g);function v(e,t){return e.source===t.source&&e.flags===t.flags}function y(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={};return e.forEach(function(o,s){if(i){var c=!1,l=0;t.forEach(function(i,u){!c&&!a[l]&&(c=n(o,i,s,u,e,t,r))&&(a[l]=!0),l++}),i=c}}),i}var b=n(y),x=Object.freeze({areArraysEqual:l,areDatesEqual:d,areMapsEqual:f,areObjectsEqual:g,areRegExpsEqual:v,areSetsEqual:y,createIsNestedEqual:t}),S=Object.freeze({areArraysEqual:u,areDatesEqual:d,areMapsEqual:p,areObjectsEqual:_,areRegExpsEqual:v,areSetsEqual:b,createIsNestedEqual:t}),C=c(x);function w(e,t){return C(e,t,void 0)}var T=c(r(x,{createIsNestedEqual:function(){return o}}));function E(e,t){return T(e,t,void 0)}var D=c(S);function ee(e,t){return D(e,t,new WeakMap)}var O=c(r(S,{createIsNestedEqual:function(){return o}}));function k(e,t){return O(e,t,new WeakMap)}function A(e){return c(r(x,e(x)))}function j(e){var t=c(r(S,e(S)));return(function(e,n,r){return r===void 0&&(r=new WeakMap),t(e,n,r)})}e.circularDeepEqual=ee,e.circularShallowEqual=k,e.createCustomCircularEqual=j,e.createCustomEqual=A,e.deepEqual=w,e.sameValueZeroEqual=o,e.shallowEqual=E,Object.defineProperty(e,"__esModule",{value:!0})}))})),Ze=n(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Qe=n(((e,t)=>{var n=Ze();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),$e=n(((e,t)=>{t.exports=Qe()()})),X=e(t(),1),Z=e($e(),1),et=e(r(),1);function tt(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function nt(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function rt(e){return typeof e==`number`&&!isNaN(e)}function Q(e){return parseInt(e,10)}function it(e,t,n){if(e[t])return Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}var at=[`Moz`,`Webkit`,`O`,`ms`];function ot(e=`transform`){if(typeof window>`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;n<at.length;n++)if(st(e,at[n])in t)return at[n];return``}function st(e,t){return t?`${t}${ct(e)}`:e}function ct(e){let t=``,n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]===`-`?n=!0:t+=e[r];return t}var lt=ot(),ut=``;function dt(e,t){ut||=tt([`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`],function(t){return nt(e[t])})??``;let n=e[ut];return nt(n)?!!n.call(e,t):!1}function ft(e,t,n){let r=e;do{if(dt(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function pt(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.addEventListener?e.addEventListener(t,a,i):e.attachEvent?e.attachEvent(`on`+t,a):e[`on`+t]=a}function mt(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.removeEventListener?e.removeEventListener(t,a,i):e.detachEvent?e.detachEvent(`on`+t,a):e[`on`+t]=null}function ht(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=Q(n.borderTopWidth),t+=Q(n.borderBottomWidth),t}function gt(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=Q(n.borderLeftWidth),t+=Q(n.borderRightWidth),t}function _t(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=Q(n.paddingTop),t-=Q(n.paddingBottom),t}function vt(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=Q(n.paddingLeft),t-=Q(n.paddingRight),t}function yt(e,t,n){let r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-r.left)/n,y:(e.clientY+t.scrollTop-r.top)/n}}function bt(e,t){let n=St(e,t,`px`);return{[st(`transform`,lt)]:n}}function xt(e,t){return St(e,t,``)}function St({x:e,y:t},n,r){let i=`translate(${e}${r},${t}${r})`;return n&&(i=`translate(${`${typeof n.x==`string`?n.x:n.x+r}`}, ${`${typeof n.y==`string`?n.y:n.y+r}`})`+i),i}function Ct(e,t){return e.targetTouches&&tt(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&tt(e.changedTouches,e=>t===e.identifier)}function wt(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function Tt(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function Et(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??Tt();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
1
|
+
import{c as e,n as t,r as n,t as r}from"./react-dom.CqAxpHMt.js";import{i}from"./app-config.DKMxjv3g.js";import{a,o,r as s}from"./plugins.D5ypJIXn.js";import{a as c,i as l,n as u,o as d,r as f,t as p}from"./view-prefs.HCowOWXL.js";import{i as m,n as h,r as g,t as _}from"./dialog.DXHznyjD.js";import{t as v}from"./jsx-runtime.BUXbF_vF.js";import{v as y,y as b}from"./pm.BsnTv63L.js";import{A as x,C as S,D as C,E as w,P as T,b as E,f as D,i as ee,k as O,n as k,s as A,u as j,v as M,w as N}from"./tasks.otRBFydq.js";import{a as te,r as ne}from"./test-stats.MEm3K2rB.js";import{d as re}from"./spaces-client.Cai2tHEI.js";function ie(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=ie(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function ae(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=ie(e))&&(r&&(r+=` `),r+=t);return r}function P(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function F(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function oe(e,t,n,r,i,a,o){let{margin:s,containerPadding:c,rowHeight:l}=e,u=P(e),d,f,p,m;if(o?(d=Math.round(o.width),f=Math.round(o.height)):(d=F(r,u,s[0]),f=F(i,l,s[1])),a?(p=Math.round(a.top),m=Math.round(a.left)):o?(p=Math.round(o.top),m=Math.round(o.left)):(p=Math.round((l+s[1])*n+c[1]),m=Math.round((u+s[0])*t+c[0])),!a&&!o){if(Number.isFinite(r)){let e=Math.round((u+s[0])*(t+r)+c[0])-m-d;e!==s[0]&&(d+=e-s[0])}if(Number.isFinite(i)){let e=Math.round((l+s[1])*(n+i)+c[1])-p-f;e!==s[1]&&(f+=e-s[1])}}return{top:p,left:m,width:d,height:f}}function se(e,t,n,r,i){let{margin:a,containerPadding:o,cols:s,rowHeight:c,maxRows:l}=e,u=P(e),d=Math.round((n-o[0])/(u+a[0])),f=Math.round((t-o[1])/(c+a[1]));return d=L(d,0,s-r),f=L(f,0,l-i),{x:d,y:f}}function I(e,t,n){let{margin:r,containerPadding:i,rowHeight:a}=e,o=P(e);return{x:Math.round((n-i[0])/(o+r[0])),y:Math.round((t-i[1])/(a+r[1]))}}function ce(e,t,n){let{margin:r,rowHeight:i}=e,a=P(e);return{w:Math.max(1,Math.round((t+r[0])/(a+r[0]))),h:Math.max(1,Math.round((n+r[1])/(i+r[1])))}}function L(e,t,n){return Math.max(Math.min(e,n),t)}function le(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function ue(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0&&le(r,t))return r}}function de(e,t){return e.filter(e=>le(e,t))}function R(e,t){return t===`horizontal`?B(e):t===`vertical`||t===`wrap`?z(e):[...e]}function z(e){return[...e].sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y)}function B(e){return[...e].sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x)}function fe(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0){let e=r.y+r.h;e>t&&(t=e)}}return t}function pe(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0&&r.i===t)return r}}function V(e){return e.filter(e=>e.static===!0)}function H(e){return{i:e.i,x:e.x,y:e.y,w:e.w,h:e.h,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,constraints:e.constraints,isBounded:e.isBounded}}function U(e){let t=Array(e.length);for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(t[n]=H(r))}return t}function me(e,t){let n=Array(e.length);for(let r=0;r<e.length;r++){let i=e[r];i!==void 0&&(t.i===i.i?n[r]=t:n[r]=i)}return n}function he(e,t,n){let r=pe(e,t);return r?(r=n(H(r)),[me(e,r),r]):[[...e],null]}function W(e,t){let n=V(e);for(let r=0;r<e.length;r++){let i=e[r];if(i!==void 0){if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),i.y===1/0&&(i.y=fe(n)),!i.static)n.push(i);else for(;ue(n,i);)i.y++}}return e}function ge(e,t,n,r,i,a,o,s,c){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return[...e];let l=t.x,u=t.y;typeof n==`number`&&(t.x=n),typeof r==`number`&&(t.y=r),t.moved=!0;let d=R(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(d=d.reverse());let f=de(d,t),p=f.length>0;if(p&&c)return U(e);if(p&&a)return t.x=l,t.y=u,t.moved=!1,e;let m=[...e];for(let e=0;e<f.length;e++){let n=f[e];n!==void 0&&(n.moved||(m=n.static?G(m,n,t,i,o):G(m,t,n,i,o)))}return m}function G(e,t,n,r,i,a){let o=i===`horizontal`||i===`wrap`,s=i===`vertical`,c=t.static;if(r){r=!1;let a={x:o?Math.max(t.x-n.w,0):n.x,y:s?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:`-1`},l=ue(e,a),u=l!==void 0&&l.y+l.h>t.y,d=l!==void 0&&t.x+t.w>l.x;if(!l)return ge(e,n,o?a.x:void 0,s?a.y:void 0,r,c,i);if(u&&s)return ge(e,n,void 0,n.y+1,r,c,i);if(u&&i===null){let r=n.y;return t.y=r,n.y=r+t.h,[...e]}if(d&&o)return ge(e,t,n.x,void 0,r,c,i)}let l=o?n.x+1:void 0,u=s?n.y+1:void 0;return l===void 0&&u===void 0?[...e]:ge(e,n,l,u,r,c,i)}function K(e,t,n){return Math.max(t,Math.min(n,e))}var _e=[{name:`gridBounds`,constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:K(t,0,Math.max(0,r-e.w)),y:K(n,0,Math.max(0,i-e.h))}},constrainSize(e,t,n,r,{cols:i,maxRows:a}){let o=r===`w`||r===`nw`||r===`sw`?e.x+e.w:i-e.x,s=r===`n`||r===`nw`||r===`ne`?e.y+e.h:a-e.y;return{w:K(t,1,Math.max(1,o)),h:K(n,1,Math.max(1,s))}}},{name:`minMaxSize`,constrainSize(e,t,n){return{w:K(t,e.minW??1,e.maxW??1/0),h:K(n,e.minH??1,e.maxH??1/0)}}}];function ve(e,t,n,r,i){let a={x:n,y:r};for(let n of e)n.constrainPosition&&(a=n.constrainPosition(t,a.x,a.y,i));if(t.constraints)for(let e of t.constraints)e.constrainPosition&&(a=e.constrainPosition(t,a.x,a.y,i));return a}function q(e,t,n,r,i,a){let o={w:n,h:r};for(let n of e)n.constrainSize&&(o=n.constrainSize(t,o.w,o.h,i,a));if(t.constraints)for(let e of t.constraints)e.constrainSize&&(o=e.constrainSize(t,o.w,o.h,i,a));return o}function ye({top:e,left:t,width:n,height:r}){let i=`translate(${t}px,${e}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${n}px`,height:`${r}px`,position:`absolute`}}function be({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:`absolute`}}function xe(e){return e*100+`%`}function Se(e,t,n,r){return e+n>r?t:n}function J(e,t,n){return e<0?t:n}function Ce(e){return Math.max(0,e)}function Y(e){return Math.max(0,e)}var we=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:J(o,e.height,i),top:Y(o)}},Te=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:Se(e.left,e.width,o,n),left:Ce(i)}},Ee=(e,t,n)=>{let{top:r,height:i,width:a}=t,o=e.left+e.width-a;return o<0?{height:i,width:e.left+e.width,top:Y(r),left:0}:{height:i,width:a,top:Y(r),left:o}},De=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:J(r,e.height,a),top:Y(r)}},Oe={n:we,ne:(e,t,n)=>we(e,Te(e,t,n)),e:Te,se:(e,t,n)=>De(e,Te(e,t,n)),s:De,sw:(e,t,n)=>De(e,Ee(e,t)),w:Ee,nw:(e,t,n)=>we(e,Ee(e,t))};function ke(e,t,n,r){let i=Oe[e];return i?i(t,{...t,...n},r):n}var Ae={type:`transform`,scale:1,calcStyle(e){return ye(e)}},je={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},Me={enabled:!0,bounded:!1,threshold:3},Ne={enabled:!0,handles:[`se`]},Pe={enabled:!1,defaultItem:{w:1,h:1},touchEnabled:!0,touchDragSource:`[data-rgl-draggable]`};function Fe(e,t,n,r,i){let a=r===`x`?`w`:`h`;t[r]+=1;let o=e.findIndex(e=>e.i===t.i),s=i??V(e).length>0;for(let i=o+1;i<e.length;i++){let o=e[i];if(o!==void 0&&!o.static){if(!s&&o.y>t.y+t.h)break;le(t,o)&&Fe(e,o,n+t[a],r,s)}}t[r]=n}function Ie(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0),t.y=Math.min(r,t.y);t.y>0&&!ue(e,t);)t.y--;let i;for(;(i=ue(e,t))!==void 0;)Fe(n,t,i.y+i.h,`y`);return t.y=Math.max(t.y,0),t}function Le(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!ue(e,t);)t.x--;let i;for(;(i=ue(e,t))!==void 0;)if(Fe(r,t,i.x+i.w,`x`),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!ue(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var Re={type:`vertical`,allowOverlap:!1,compact(e,t){let n=V(e),r=fe(n),i=z(e),a=Array(e.length);for(let t=0;t<i.length;t++){let o=i[t];if(o===void 0)continue;let s=H(o);s.static||(s=Ie(n,s,i,r),r=Math.max(r,s.y+s.h),n.push(s));let c=e.indexOf(o);a[c]=s,s.moved=!1}return a}},ze={type:`horizontal`,allowOverlap:!1,compact(e,t){let n=V(e),r=B(e),i=Array(e.length);for(let a=0;a<r.length;a++){let o=r[a];if(o===void 0)continue;let s=H(o);s.static||(s=Le(n,s,t,r),n.push(s));let c=e.indexOf(o);i[c]=s,s.moved=!1}return i}},Be={type:null,allowOverlap:!1,compact(e,t){return U(e)}},Ve={...Re,allowOverlap:!0,compact(e,t){return U(e)}},He={...ze,allowOverlap:!0,compact(e,t){return U(e)}},Ue={...Be,allowOverlap:!0};function We(e,t=!1,n=!1){let r;return r=t?e===`vertical`?Ve:e===`horizontal`?He:Ue:e===`vertical`?Re:e===`horizontal`?ze:Be,n?{...r,preventCollision:n}:r}function Ge(e){return Object.keys(e).sort((t,n)=>e[t]-e[n])}function Ke(e,t){let n=Ge(e),r=n[0];if(r===void 0)throw Error(`No breakpoints defined`);for(let i=1;i<n.length;i++){let a=n[i];a!==void 0&&t>e[a]&&(r=a)}return r}function qe(e,t){let n=t[e];if(n===void 0)throw Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function Je(e,t,n,r,i,a){let o=e[n];if(o)return U(o);let s=e[r],c=Ge(t),l=c.slice(c.indexOf(n));for(let t=0;t<l.length;t++){let n=l[t];if(n===void 0)continue;let r=e[n];if(r){s=r;break}}let u=W(U(s||[]),{cols:i});return(typeof a==`object`&&a?a:We(a)).compact(u,i)}function Ye(e,t){if(Array.isArray(e))return e;let n=e,r=n[t];if(r!==void 0)return r;let i=Object.keys(n);for(let e of i){let t=n[e];if(t!==void 0)return t}return[10,10]}var Xe=n(((e,t,n)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n[`fast-equals`]={}))})(n,(function(e){function t(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function n(e){return function(t,n,r,i){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r,i);var a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);var s=e(t,n,r,i);return i.delete(t),i.delete(n),s}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function i(e){return e.constructor===Object||e.constructor==null}function a(e){return typeof e.then==`function`}function o(e,t){return e===t||e!==e&&t!==t}var s=Object.prototype.toString;function c(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,c=e.areObjectsEqual,l=e.areRegExpsEqual,u=e.areSetsEqual,d=e.createIsNestedEqual,f=d(p);function p(e,d,p){if(e===d)return!0;if(!e||!d||typeof e!=`object`||typeof d!=`object`)return e!==e&&d!==d;if(i(e)&&i(d))return c(e,d,f,p);var m=Array.isArray(e),h=Array.isArray(d);if(m||h)return m===h&&t(e,d,f,p);var g=s.call(e);return g===s.call(d)?g===`[object Date]`?n(e,d,f,p):g===`[object RegExp]`?l(e,d,f,p):g===`[object Map]`?r(e,d,f,p):g===`[object Set]`?u(e,d,f,p):g===`[object Object]`||g===`[object Arguments]`?a(e)||a(d)?!1:c(e,d,f,p):g===`[object Boolean]`||g===`[object Number]`||g===`[object String]`?o(e.valueOf(),d.valueOf()):!1:!1}return p}function l(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-->0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var u=n(l);function d(e,t){return o(e.valueOf(),t.valueOf())}function f(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={},o=0;return e.forEach(function(s,c){if(i){var l=!1,u=0;t.forEach(function(i,d){!l&&!a[u]&&(l=n(c,d,o,u,e,t,r)&&n(s,i,c,d,e,t,r))&&(a[u]=!0),u++}),o++,i=l}}),i}var p=n(f),m=`_owner`,h=Object.prototype.hasOwnProperty;function g(e,t,n,r){var i=Object.keys(e),a=i.length;if(Object.keys(t).length!==a)return!1;for(var o;a-->0;){if(o=i[a],o===m){var s=!!e.$$typeof,c=!!t.$$typeof;if((s||c)&&s!==c)return!1}if(!h.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var _=n(g);function v(e,t){return e.source===t.source&&e.flags===t.flags}function y(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={};return e.forEach(function(o,s){if(i){var c=!1,l=0;t.forEach(function(i,u){!c&&!a[l]&&(c=n(o,i,s,u,e,t,r))&&(a[l]=!0),l++}),i=c}}),i}var b=n(y),x=Object.freeze({areArraysEqual:l,areDatesEqual:d,areMapsEqual:f,areObjectsEqual:g,areRegExpsEqual:v,areSetsEqual:y,createIsNestedEqual:t}),S=Object.freeze({areArraysEqual:u,areDatesEqual:d,areMapsEqual:p,areObjectsEqual:_,areRegExpsEqual:v,areSetsEqual:b,createIsNestedEqual:t}),C=c(x);function w(e,t){return C(e,t,void 0)}var T=c(r(x,{createIsNestedEqual:function(){return o}}));function E(e,t){return T(e,t,void 0)}var D=c(S);function ee(e,t){return D(e,t,new WeakMap)}var O=c(r(S,{createIsNestedEqual:function(){return o}}));function k(e,t){return O(e,t,new WeakMap)}function A(e){return c(r(x,e(x)))}function j(e){var t=c(r(S,e(S)));return(function(e,n,r){return r===void 0&&(r=new WeakMap),t(e,n,r)})}e.circularDeepEqual=ee,e.circularShallowEqual=k,e.createCustomCircularEqual=j,e.createCustomEqual=A,e.deepEqual=w,e.sameValueZeroEqual=o,e.shallowEqual=E,Object.defineProperty(e,"__esModule",{value:!0})}))})),Ze=n(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Qe=n(((e,t)=>{var n=Ze();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),$e=n(((e,t)=>{t.exports=Qe()()})),X=e(t(),1),Z=e($e(),1),et=e(r(),1);function tt(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function nt(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function rt(e){return typeof e==`number`&&!isNaN(e)}function Q(e){return parseInt(e,10)}function it(e,t,n){if(e[t])return Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}var at=[`Moz`,`Webkit`,`O`,`ms`];function ot(e=`transform`){if(typeof window>`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;n<at.length;n++)if(st(e,at[n])in t)return at[n];return``}function st(e,t){return t?`${t}${ct(e)}`:e}function ct(e){let t=``,n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]===`-`?n=!0:t+=e[r];return t}var lt=ot(),ut=``;function dt(e,t){ut||=tt([`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`],function(t){return nt(e[t])})??``;let n=e[ut];return nt(n)?!!n.call(e,t):!1}function ft(e,t,n){let r=e;do{if(dt(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function pt(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.addEventListener?e.addEventListener(t,a,i):e.attachEvent?e.attachEvent(`on`+t,a):e[`on`+t]=a}function mt(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.removeEventListener?e.removeEventListener(t,a,i):e.detachEvent?e.detachEvent(`on`+t,a):e[`on`+t]=null}function ht(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=Q(n.borderTopWidth),t+=Q(n.borderBottomWidth),t}function gt(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=Q(n.borderLeftWidth),t+=Q(n.borderRightWidth),t}function _t(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=Q(n.paddingTop),t-=Q(n.paddingBottom),t}function vt(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=Q(n.paddingLeft),t-=Q(n.paddingRight),t}function yt(e,t,n){let r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-r.left)/n,y:(e.clientY+t.scrollTop-r.top)/n}}function bt(e,t){let n=St(e,t,`px`);return{[st(`transform`,lt)]:n}}function xt(e,t){return St(e,t,``)}function St({x:e,y:t},n,r){let i=`translate(${e}${r},${t}${r})`;return n&&(i=`translate(${`${typeof n.x==`string`?n.x:n.x+r}`}, ${`${typeof n.y==`string`?n.y:n.y+r}`})`+i),i}function Ct(e,t){return e.targetTouches&&tt(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&tt(e.changedTouches,e=>t===e.identifier)}function wt(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function Tt(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function Et(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??Tt();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
2
2
|
`,n.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
3
3
|
`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&kt(e.body,`react-draggable-transparent-selection`)}function Dt(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{Ot(e)}):Ot(e)}function Ot(e){if(e)try{e.body&&At(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function kt(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function At(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function jt(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:Rt(r);let i=zt(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+Q(s.paddingLeft)+Q(o.marginLeft),top:-i.offsetTop+Q(s.paddingTop)+Q(o.marginTop),right:vt(a)-gt(i)-i.offsetLeft+Q(s.paddingRight)-Q(o.marginRight),bottom:_t(a)-ht(i)-i.offsetTop+Q(s.paddingBottom)-Q(o.marginBottom)}}return rt(r.right)&&(t=Math.min(t,r.right)),rt(r.bottom)&&(n=Math.min(n,r.bottom)),rt(r.left)&&(t=Math.max(t,r.left)),rt(r.top)&&(n=Math.max(n,r.top)),[t,n]}function Mt(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function Nt(e){return e.props.axis===`both`||e.props.axis===`x`}function Pt(e){return e.props.axis===`both`||e.props.axis===`y`}function Ft(e,t,n){let r=typeof t==`number`?Ct(e,t):null;if(typeof t==`number`&&!r)return null;let i=zt(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return yt(r||e,a,n.props.scale)}function It(e,t,n){let r=!rt(e.lastX),i=zt(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function Lt(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function Rt(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function zt(e){let t=e.findDOMNode();if(!t)throw Error(`<DraggableCore>: Unmounted during event!`);return t}var Bt=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},Vt={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},Ht=Vt.mouse,Ut=class extends X.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(`<DraggableCore> not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!ft(e.target,this.props.handle,t)||this.props.cancel&&ft(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=wt(e);this.touchIdentifier=r;let i=Ft(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=It(this,a,o);Bt(`DraggableCore: handleDragStart: %j`,s),Bt(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&Et(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,pt(n,Ht.move,this.handleDrag),pt(n,Ht.stop,this.handleDragStop))},this.handleDrag=e=>{let t=Ft(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=Mt(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=It(this,n,r);if(Bt(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1)try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}else this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=Ft(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=Mt(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=It(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&Dt(a.ownerDocument),Bt(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(Bt(`DraggableCore: Removing handlers`),mt(a.ownerDocument,Ht.move,this.handleDrag),mt(a.ownerDocument,Ht.stop,this.handleDragStop))},this.onMouseDown=e=>(Ht=Vt.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(Ht=Vt.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(Ht=Vt.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(Ht=Vt.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&pt(e,Vt.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;mt(t,Vt.mouse.move,this.handleDrag),mt(t,Vt.touch.move,this.handleDrag),mt(t,Vt.mouse.stop,this.handleDragStop),mt(t,Vt.touch.stop,this.handleDragStop),mt(e,Vt.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&Dt(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=et.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(Bt(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return X.cloneElement(X.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Ut.displayName=`DraggableCore`,Ut.propTypes={allowAnyClick:Z.default.bool,allowMobileScroll:Z.default.bool,children:Z.default.node.isRequired,disabled:Z.default.bool,enableUserSelectHack:Z.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:Z.default.arrayOf(Z.default.number),handle:Z.default.string,cancel:Z.default.string,nodeRef:Z.default.object,nonce:Z.default.string,onStart:Z.default.func,onDrag:Z.default.func,onStop:Z.default.func,onMouseDown:Z.default.func,scale:Z.default.number,className:it,style:it,transform:it},Ut.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var Wt=class extends X.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(Bt(`Draggable: onDragStart: %j`,t),this.props.onStart(e,Lt(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;Bt(`Draggable: onDrag: %j`,t);let n=Lt(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=jt(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,Lt(this,t))===!1)return!1;Bt(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(Bt(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=et.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,m=s||r,h={x:Nt(this)&&p?this.state.x:m.x,y:Pt(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=xt(h,c):d=bt(h,c);let g=X.Children.only(n),_=ae(g.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return X.createElement(Ut,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},X.cloneElement(g,{className:_,style:{...g.props.style,...d},transform:f}))}};Wt.displayName=`Draggable`,Wt.propTypes={...Ut.propTypes,axis:Z.default.oneOf([`both`,`x`,`y`,`none`]),bounds:Z.default.oneOfType([Z.default.shape({left:Z.default.number,right:Z.default.number,top:Z.default.number,bottom:Z.default.number}),Z.default.string,Z.default.oneOf([!1])]),defaultClassName:Z.default.string,defaultClassNameDragging:Z.default.string,defaultClassNameDragged:Z.default.string,defaultPosition:Z.default.shape({x:Z.default.number,y:Z.default.number}),positionOffset:Z.default.shape({x:Z.default.oneOfType([Z.default.number,Z.default.string]),y:Z.default.oneOfType([Z.default.number,Z.default.string])}),position:Z.default.shape({x:Z.default.number,y:Z.default.number}),className:it,style:it,transform:it},Wt.defaultProps={...Ut.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1};var Gt=n(((e,t)=>{function n(e){var t,r,i=``;if(typeof e==`string`||typeof e==`number`)i+=e;else if(typeof e==`object`){if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=n(e[t]))&&(i&&(i+=` `),i+=r)}else for(r in e)e[r]&&(i&&(i+=` `),i+=r)}return i}function r(){for(var e,t,r=0,i=``,a=arguments.length;r<a;r++)(e=arguments[r])&&(t=n(e))&&(i&&(i+=` `),i+=t);return i}t.exports=r,t.exports.clsx=r})),Kt=n(((e,n)=>{var i=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of s(t))!l.call(e,i)&&i!==n&&a(e,i,{get:()=>t[i],enumerable:!(r=o(t,i))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:i(c(e)),d(t||!e||!e.__esModule?a(n,`default`,{value:e,enumerable:!0}):n,e)),p=e=>d(a({},`__esModule`,{value:!0}),e),m={};u(m,{DraggableCore:()=>ve,default:()=>q}),n.exports=p(m);var h=f(t()),g=f($e()),_=f(r()),v=Gt();function y(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function b(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function x(e){return typeof e==`number`&&!isNaN(e)}function S(e){return parseInt(e,10)}function C(e,t,n){if(e[t])return Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}var w=[`Moz`,`Webkit`,`O`,`ms`];function T(e=`transform`){if(typeof window>`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;n<w.length;n++)if(E(e,w[n])in t)return w[n];return``}function E(e,t){return t?`${t}${D(e)}`:e}function D(e){let t=``,n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]===`-`?n=!0:t+=e[r];return t}var ee=T(),O=``;function k(e,t){O||=y([`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`],function(t){return b(e[t])})??``;let n=e[O];return b(n)?!!n.call(e,t):!1}function A(e,t,n){let r=e;do{if(k(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function j(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.addEventListener?e.addEventListener(t,a,i):e.attachEvent?e.attachEvent(`on`+t,a):e[`on`+t]=a}function M(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.removeEventListener?e.removeEventListener(t,a,i):e.detachEvent?e.detachEvent(`on`+t,a):e[`on`+t]=null}function N(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=S(n.borderTopWidth),t+=S(n.borderBottomWidth),t}function te(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=S(n.borderLeftWidth),t+=S(n.borderRightWidth),t}function ne(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=S(n.paddingTop),t-=S(n.paddingBottom),t}function re(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=S(n.paddingLeft),t-=S(n.paddingRight),t}function ie(e,t,n){let r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-r.left)/n,y:(e.clientY+t.scrollTop-r.top)/n}}function ae(e,t){let n=F(e,t,`px`);return{[E(`transform`,ee)]:n}}function P(e,t){return F(e,t,``)}function F({x:e,y:t},n,r){let i=`translate(${e}${r},${t}${r})`;return n&&(i=`translate(${`${typeof n.x==`string`?n.x:n.x+r}`}, ${`${typeof n.y==`string`?n.y:n.y+r}`})`+i),i}function oe(e,t){return e.targetTouches&&y(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&y(e.changedTouches,e=>t===e.identifier)}function se(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function I(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function ce(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??I();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
4
4
|
`,n.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
5
|
-
`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&ue(e.body,`react-draggable-transparent-selection`)}function L(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{le(e)}):le(e)}function le(e){if(e)try{e.body&&de(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function ue(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function de(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function R(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:U(r);let i=me(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+S(s.paddingLeft)+S(o.marginLeft),top:-i.offsetTop+S(s.paddingTop)+S(o.marginTop),right:re(a)-te(i)-i.offsetLeft+S(s.paddingRight)-S(o.marginRight),bottom:ne(a)-N(i)-i.offsetTop+S(s.paddingBottom)-S(o.marginBottom)}}return x(r.right)&&(t=Math.min(t,r.right)),x(r.bottom)&&(n=Math.min(n,r.bottom)),x(r.left)&&(t=Math.max(t,r.left)),x(r.top)&&(n=Math.max(n,r.top)),[t,n]}function z(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function B(e){return e.props.axis===`both`||e.props.axis===`x`}function fe(e){return e.props.axis===`both`||e.props.axis===`y`}function pe(e,t,n){let r=typeof t==`number`?oe(e,t):null;if(typeof t==`number`&&!r)return null;let i=me(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return ie(r||e,a,n.props.scale)}function V(e,t,n){let r=!x(e.lastX),i=me(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function H(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function U(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function me(e){let t=e.findDOMNode();if(!t)throw Error(`<DraggableCore>: Unmounted during event!`);return t}var he=f(t()),W=f($e()),ge=f(r()),G=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},K={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},_e=K.mouse,ve=class extends he.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(`<DraggableCore> not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!A(e.target,this.props.handle,t)||this.props.cancel&&A(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=se(e);this.touchIdentifier=r;let i=pe(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=V(this,a,o);G(`DraggableCore: handleDragStart: %j`,s),G(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&ce(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,j(n,_e.move,this.handleDrag),j(n,_e.stop,this.handleDragStop))},this.handleDrag=e=>{let t=pe(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=z(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=V(this,n,r);if(G(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1)try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}else this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=pe(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=z(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=V(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&L(a.ownerDocument),G(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(G(`DraggableCore: Removing handlers`),M(a.ownerDocument,_e.move,this.handleDrag),M(a.ownerDocument,_e.stop,this.handleDragStop))},this.onMouseDown=e=>(_e=K.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(_e=K.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(_e=K.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(_e=K.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&j(e,K.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;M(t,K.mouse.move,this.handleDrag),M(t,K.touch.move,this.handleDrag),M(t,K.mouse.stop,this.handleDragStop),M(t,K.touch.stop,this.handleDragStop),M(e,K.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&L(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=ge.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(G(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return he.cloneElement(he.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};ve.displayName=`DraggableCore`,ve.propTypes={allowAnyClick:W.default.bool,allowMobileScroll:W.default.bool,children:W.default.node.isRequired,disabled:W.default.bool,enableUserSelectHack:W.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:W.default.arrayOf(W.default.number),handle:W.default.string,cancel:W.default.string,nodeRef:W.default.object,nonce:W.default.string,onStart:W.default.func,onDrag:W.default.func,onStop:W.default.func,onMouseDown:W.default.func,scale:W.default.number,className:C,style:C,transform:C},ve.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var q=class extends h.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(G(`Draggable: onDragStart: %j`,t),this.props.onStart(e,H(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;G(`Draggable: onDrag: %j`,t);let n=H(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=R(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,H(this,t))===!1)return!1;G(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(G(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=_.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,m=s||r,g={x:B(this)&&p?this.state.x:m.x,y:fe(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=P(g,c):d=ae(g,c);let _=h.Children.only(n),y=(0,v.clsx)(_.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return h.createElement(ve,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},h.cloneElement(_,{className:y,style:{..._.props.style,...d},transform:f}))}};q.displayName=`Draggable`,q.propTypes={...ve.propTypes,axis:g.default.oneOf([`both`,`x`,`y`,`none`]),bounds:g.default.oneOfType([g.default.shape({left:g.default.number,right:g.default.number,top:g.default.number,bottom:g.default.number}),g.default.string,g.default.oneOf([!1])]),defaultClassName:g.default.string,defaultClassNameDragging:g.default.string,defaultClassNameDragged:g.default.string,defaultPosition:g.default.shape({x:g.default.number,y:g.default.number}),positionOffset:g.default.shape({x:g.default.oneOfType([g.default.number,g.default.string]),y:g.default.oneOfType([g.default.number,g.default.string])}),position:g.default.shape({x:g.default.number,y:g.default.number}),className:C,style:C,transform:C},q.defaultProps={...ve.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1},0&&(n.exports={DraggableCore:ve})})),qt=n(((e,t)=>{var n=Kt(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),Jt=n((e=>{e.__esModule=!0,e.cloneElement=l;var n=r(t());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?i(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function o(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e){var t=c(e,`string`);return typeof t==`symbol`?t:t+``}function c(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function l(e,t){return t.style&&e.props.style&&(t.style=a(a({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+` `+t.className),n.default.cloneElement(e,t)}})),Yt=n((e=>{e.__esModule=!0,e.resizableProps=void 0;var t=n($e());qt();function n(e){return e&&e.__esModule?e:{default:e}}e.resizableProps={axis:t.default.oneOf([`both`,`x`,`y`,`none`]),className:t.default.string,children:t.default.element.isRequired,draggableOpts:t.default.shape({allowAnyClick:t.default.bool,cancel:t.default.string,children:t.default.node,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:typeof Element<`u`?t.default.instanceOf(Element):t.default.any,grid:t.default.arrayOf(t.default.number),handle:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number}),height:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`y`?t.default.number.isRequired(...e):t.default.number(...e)},handle:t.default.oneOfType([t.default.node,t.default.func]),handleSize:t.default.arrayOf(t.default.number),lockAspectRatio:t.default.bool,maxConstraints:t.default.arrayOf(t.default.number),minConstraints:t.default.arrayOf(t.default.number),onResizeStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,resizeHandles:t.default.arrayOf(t.default.oneOf([`s`,`w`,`e`,`n`,`sw`,`nw`,`se`,`ne`])),transformScale:t.default.number,width:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`x`?t.default.number.isRequired(...e):t.default.number(...e)}}})),Xt=n((e=>{e.__esModule=!0,e.default=void 0;var n=s(t()),r=qt(),i=Jt(),a=Yt(),o=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function s(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(s=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(null,arguments)}function l(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?u(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){var t=m(e,`string`);return typeof t==`symbol`?t:t+``}function m(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var h=class extends n.Component{constructor(){super(...arguments),this.handleRefs={},this.lastHandleRect=null,this.slack=null,this.lastSize=null}componentWillUnmount(){this.resetData()}resetData(){this.lastHandleRect=this.slack=this.lastSize=null}runConstraints(e,t){let n=this.props,r=n.minConstraints,i=n.maxConstraints,a=n.lockAspectRatio;if(!r&&!i&&!a)return[e,t];if(a){let n=this.props.width/this.props.height,r=e-this.props.width,i=t-this.props.height;Math.abs(r)>Math.abs(i*n)?t=e/n:e=t*n}let o=e,s=t,c=this.slack||[0,0],l=c[0],u=c[1];return e+=l,t+=u,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),i&&(e=Math.min(i[0],e),t=Math.min(i[1],t)),this.slack=[l+(o-e),u+(s-t)],[e,t]}resizeHandler(e,t){return(n,r)=>{let i=r.node,a=r.deltaX,o=r.deltaY;e===`onResizeStart`&&this.resetData();let s=(this.props.axis===`both`||this.props.axis===`x`)&&t!==`n`&&t!==`s`,c=(this.props.axis===`both`||this.props.axis===`y`)&&t!==`e`&&t!==`w`;if(!s&&!c)return;let l=t[0],u=t[t.length-1],d=i.getBoundingClientRect();if(this.lastHandleRect!=null){if(u===`w`){let e=d.left-this.lastHandleRect.left;a+=e}if(l===`n`){let e=d.top-this.lastHandleRect.top;o+=e}}this.lastHandleRect=d,u===`w`&&(a=-a),l===`n`&&(o=-o);let f=this.lastSize?.width??this.props.width,p=this.lastSize?.height??this.props.height,m=f+(s?a/this.props.transformScale:0),h=p+(c?o/this.props.transformScale:0);var g=this.runConstraints(m,h);if(m=g[0],h=g[1],e===`onResizeStop`&&this.lastSize){var _=this.lastSize;m=_.width,h=_.height}let v=m!==f||h!==p;e!==`onResizeStop`&&(this.lastSize={width:m,height:h});let y=typeof this.props[e]==`function`?this.props[e]:null;y&&(e!==`onResize`||v)&&(n.persist==null||n.persist(),y(n,{node:i,size:{width:m,height:h},handle:t})),e===`onResizeStop`&&this.resetData()}}renderResizeHandle(e,t){let r=this.props.handle;if(!r)return n.createElement(`span`,{className:`react-resizable-handle react-resizable-handle-`+e,ref:t});if(typeof r==`function`)return r(e,t);let i=typeof r.type==`string`,a=d({ref:t},i?{}:{handleAxis:e});return n.cloneElement(r,a)}render(){let e=this.props,t=e.children,a=e.className,s=e.draggableOpts;e.width,e.height,e.handle,e.handleSize,e.lockAspectRatio,e.axis,e.minConstraints,e.maxConstraints,e.onResize,e.onResizeStop,e.onResizeStart;let u=e.resizeHandles;e.transformScale;let f=l(e,o);return(0,i.cloneElement)(t,d(d({},f),{},{className:(a?a+` `:``)+`react-resizable`,children:[...n.Children.toArray(t.props.children),...u.map(e=>{let t=this.handleRefs[e]??(this.handleRefs[e]=n.createRef());return n.createElement(r.DraggableCore,c({},s,{nodeRef:t,key:`resizableHandle-`+e,onStop:this.resizeHandler(`onResizeStop`,e),onStart:this.resizeHandler(`onResizeStart`,e),onDrag:this.resizeHandler(`onResize`,e)}),this.renderResizeHandle(e,t))})]}))}};e.default=h,h.propTypes=a.resizableProps,h.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),Zt=n((e=>{e.__esModule=!0,e.default=void 0;var n=c(t()),r=s($e()),i=s(Xt()),a=Yt(),o=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(c=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(null,arguments)}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?u(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){var t=m(e,`string`);return typeof t==`symbol`?t:t+``}function m(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function h(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var g=class extends n.Component{constructor(){super(...arguments),this.state={width:this.props.width,height:this.props.height,propsWidth:this.props.width,propsHeight:this.props.height},this.onResize=(e,t)=>{let n=t.size;this.props.onResize?(e.persist==null||e.persist(),this.setState(n,()=>this.props.onResize&&this.props.onResize(e,t))):this.setState(n)}}static getDerivedStateFromProps(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null}render(){let e=this.props,t=e.handle,r=e.handleSize;e.onResize;let a=e.onResizeStart,s=e.onResizeStop,c=e.draggableOpts,u=e.minConstraints,f=e.maxConstraints,p=e.lockAspectRatio,m=e.axis;e.width,e.height;let g=e.resizeHandles,_=e.style,v=e.transformScale,y=h(e,o);return n.createElement(i.default,{axis:m,draggableOpts:c,handle:t,handleSize:r,height:this.state.height,lockAspectRatio:p,maxConstraints:f,minConstraints:u,onResizeStart:a,onResize:this.onResize,onResizeStop:s,resizeHandles:g,transformScale:v,width:this.state.width},n.createElement(`div`,l({},y,{style:d(d({},_),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=g,g.propTypes=d(d({},a.resizableProps),{},{children:r.default.element})})),Qt=n(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=Xt().default,t.exports.ResizableBox=Zt().default}))(),$=v(),$t=Xe(),en=50,tn=12;function nn(e){let t=e;for(;t;){let e=window.getComputedStyle(t).overflowY;if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}function rn(e){let t=nn(e),n=null,r=0,i=0,a=!1;function o(){let e=t;if(!e)return;let s=e.getBoundingClientRect(),{clientHeight:c,scrollTop:l,scrollHeight:u}=e,{scrollLeft:d,scrollWidth:f,clientWidth:p}=e,m=0,h=0;i<s.top+en&&l>0?m=-tn:i>s.bottom-en&&l+c<u&&(m=tn),r<s.left+en&&d>0?h=-tn:r>s.right-en&&d+p<f&&(h=tn),(m!==0||h!==0)&&(e.scrollTop+=m,e.scrollLeft+=h),a&&(n=requestAnimationFrame(o))}return{feed(e,t){r=e,i=t,a||(a=!0,n=requestAnimationFrame(o))},stop(){a=!1,n!==null&&(cancelAnimationFrame(n),n=null)}}}function an(e){let{children:t,cols:n,containerWidth:r,margin:i,containerPadding:a,rowHeight:o,maxRows:s,isDraggable:c,isResizable:l,isBounded:u,allowMobileScroll:d,static:f,useCSSTransforms:p=!0,usePercentages:m=!1,transformScale:h=1,positionStrategy:g,dragThreshold:_=0,droppingPosition:v,className:y=``,style:b,handle:x=``,cancel:S=``,x:C,y:w,w:T,h:E,minW:D=1,maxW:ee=1/0,minH:O=1,maxH:k=1/0,i:A,resizeHandles:j,resizeHandle:M,constraints:N=_e,layoutItem:te,layout:ne=[],onDragStart:re,onDrag:ie,onDragStop:se,onResizeStart:le,onResize:ue,onResizeStop:de}=e,[R,z]=(0,X.useState)(!1),[B,fe]=(0,X.useState)(!1),pe=(0,X.useRef)(null),V=(0,X.useRef)({left:0,top:0}),H=(0,X.useRef)({top:0,left:0,width:0,height:0}),U=(0,X.useRef)(void 0),me=(0,X.useRef)(ne);me.current=ne;let he=(0,X.useRef)(null),W=(0,X.useRef)(null),ge=(0,X.useRef)(!1),G=(0,X.useRef)({x:0,y:0}),K=(0,X.useRef)(!1),Se=(0,X.useRef)(null),J=(0,X.useMemo)(()=>({cols:n,containerPadding:a,containerWidth:r,margin:i,maxRows:s,rowHeight:o}),[n,a,r,i,s,o]),Ce=(0,X.useMemo)(()=>({cols:n,maxRows:s,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,s,r,o,i]),Y=(0,X.useCallback)(e=>({...Ce,containerHeight:e??Ce.containerHeight,layout:me.current}),[Ce]),we=(0,X.useMemo)(()=>te??{i:A,x:C,y:w,w:T,h:E,minW:D,maxW:ee,minH:O,maxH:k},[te,A,C,w,T,E,D,ee,O,k]),Te=(0,X.useCallback)(e=>{if(g?.calcStyle)return g.calcStyle(e);if(p)return ye(e);let t=be(e);return m?{...t,left:xe(e.left/r),width:xe(e.width/r)}:t},[g,p,m,r]),Ee=(0,X.useCallback)((e,{node:t})=>{if(!re)return;let{offsetParent:n}=t;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left/h,o=r.left/h,s=i.top/h,c=r.top/h,l;if(g?.calcDragPosition){let t=e;l=g.calcDragPosition(t.clientX,t.clientY,t.clientX-i.left,t.clientY-i.top)}else l={left:a-o+n.scrollLeft,top:s-c+n.scrollTop};if(V.current=l,Se.current||=rn(t instanceof HTMLElement?t:null),_>0){let t=e;G.current={x:t.clientX,y:t.clientY},ge.current=!0,K.current=!1,z(!0);return}z(!0);let u=I(J,l.top,l.left),{x:d,y:f}=ve(N,we,u.x,u.y,Y());re(A,d,f,{e,node:t,newPosition:l})},[re,h,J,g,_,N,we,Y,A]),De=(0,X.useCallback)((e,{node:t,deltaX:n,deltaY:a})=>{if(!ie||!R)return;let s=e;if(ge.current&&!K.current){let n=s.clientX-G.current.x,r=s.clientY-G.current.y;if(Math.hypot(n,r)<_)return;if(K.current=!0,ge.current=!1,re){let n=I(J,V.current.top,V.current.left),{x:r,y:i}=ve(N,we,n.x,n.y,Y());re(A,r,i,{e,node:t,newPosition:V.current})}}Se.current?.feed(s.clientX,s.clientY);let c=V.current.top+a,l=V.current.left+n;if(u){let{offsetParent:e}=t;if(e){let t=e.clientHeight-F(E,o,i[1]);c=L(c,0,t);let n=P(J),a=r-F(T,n,i[0]);l=L(l,0,a)}}let d={top:c,left:l};V.current=d;let f=I(J,c,l),{x:p,y:m}=ve(N,we,f.x,f.y,Y());ie(A,p,m,{e,node:t,newPosition:d})},[ie,re,R,_,u,E,o,i,J,r,T,A,N,we,Y]),Oe=(0,X.useCallback)((e,{node:t})=>{if(!se||!R)return;Se.current?.stop(),Se.current=null;let n=ge.current;if(ge.current=!1,K.current=!1,G.current={x:0,y:0},n){z(!1),V.current={left:0,top:0};return}let{left:r,top:i}=V.current,a={top:i,left:r};z(!1),V.current={left:0,top:0};let o=I(J,i,r),{x:s,y:c}=ve(N,we,o.x,o.y,Y());se(A,s,c,{e,node:t,newPosition:a})},[se,R,J,N,we,Y,A]);he.current=Ee,W.current=De;let Ae=(0,X.useCallback)((e,{node:t,size:n,handle:i},a,o)=>{let s=o===`onResizeStart`?le:o===`onResize`?ue:de;if(!s)return;let c;c=t?ke(i,a,n,r):{...n,top:a.top,left:a.left},H.current=c;let l=t?.offsetParent?.clientHeight??0,u=ce(J,c.width,c.height),{w:d,h:f}=q(N,we,u.w,u.h,i,Y(l));s(A,d,f,{e:e.nativeEvent??e,node:t,size:c,handle:i})},[le,ue,de,r,J,A,N,we,Y]),je=(0,X.useCallback)((e,t)=>{fe(!0);let n=oe(J,C,w,T,E),r={...t,handle:t.handle};Ae(e,r,n,`onResizeStart`)},[Ae,J,C,w,T,E]),Me=(0,X.useCallback)((e,t)=>{let n=oe(J,C,w,T,E),r={...t,handle:t.handle};Ae(e,r,n,`onResize`)},[Ae,J,C,w,T,E]),Ne=(0,X.useCallback)((e,t)=>{fe(!1),H.current={top:0,left:0,width:0,height:0};let n=oe(J,C,w,T,E),r={...t,handle:t.handle};Ae(e,r,n,`onResizeStop`)},[Ae,J,C,w,T,E]);(0,X.useEffect)(()=>{if(!v)return;let e=pe.current;if(!e)return;let t=U.current||{left:0,top:0},n=R&&(v.left!==t.left||v.top!==t.top);if(!R){let t={node:e,deltaX:v.left,deltaY:v.top,lastX:0,lastY:0,x:v.left,y:v.top};he.current?.(v.e,t)}else if(n){let t={node:e,deltaX:v.left-V.current.left,deltaY:v.top-V.current.top,lastX:V.current.left,lastY:V.current.top,x:v.left,y:v.top};W.current?.(v.e,t)}U.current=v},[v,R,A]);let Pe=oe(J,C,w,T,E,R?V.current:null,B?H.current:null),Fe=X.Children.only(t),Ie=P(J),Le=[F(D,Ie,i[0]),F(O,o,i[1])],Re=[F(ee,Ie,i[0]),F(k,o,i[1])],ze=Fe.props,Be=ze.className,Ve=ze.style,He=X.cloneElement(Fe,{ref:pe,className:ae(`react-grid-item`,Be,y,{static:f,resizing:B,"react-draggable":c,"react-draggable-dragging":R,dropping:!!v,cssTransforms:p}),style:{...b,...Ve,...Te(Pe)}}),Ue=M;return He=(0,$.jsx)(Qt.Resizable,{draggableOpts:{disabled:!l},className:l?void 0:`react-resizable-hide`,width:Pe.width,height:Pe.height,minConstraints:Le,maxConstraints:Re,onResizeStart:je,onResize:Me,onResizeStop:Ne,transformScale:h,resizeHandles:j,handle:Ue,children:He}),He=(0,$.jsx)(Ut,{disabled:!c,onStart:Ee,onDrag:De,onStop:Oe,handle:x,cancel:`.react-resizable-handle`+(S?`,`+S:``),scale:h,allowMobileScroll:d,nodeRef:pe,children:He}),He}var on=X.memo(an,(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h&&e.minW===t.minW&&e.maxW===t.maxW&&e.minH===t.minH&&e.maxH===t.maxH&&e.cols===t.cols&&e.containerWidth===t.containerWidth&&e.rowHeight===t.rowHeight&&e.maxRows===t.maxRows&&e.margin===t.margin&&e.containerPadding===t.containerPadding&&e.transformScale===t.transformScale&&e.isDraggable===t.isDraggable&&e.isResizable===t.isResizable&&e.isBounded===t.isBounded&&e.allowMobileScroll===t.allowMobileScroll&&e.useCSSTransforms===t.useCSSTransforms&&e.usePercentages===t.usePercentages&&e.children===t.children&&e.onDrag===t.onDrag&&e.onDragStop===t.onDragStop&&e.onResize===t.onResize&&e.onResizeStop===t.onResizeStop&&e.droppingPosition===t.droppingPosition);on.displayName=`GridItem`;function sn(e){let{clientX:t,clientY:n,gridElement:r,droppingItem:i,event:a,dragOffsetX:o=0,dragOffsetY:s=0,transformScale:c,cols:l,margin:u,maxRows:d,rowHeight:f,width:p,containerPadding:m}=e,h=r.getBoundingClientRect(),g={cols:l,margin:u,maxRows:d,rowHeight:f,containerWidth:p,containerPadding:m},_=P(g),v=F(i.w,_,u[0]),y=F(i.h,f,u[1]),b=v/2,x=y/2,S=r.scrollLeft??0,C=r.scrollTop??0,w=t-h.left+S+o-b,T=n-h.top+C+s-x,E=Math.max(0,w),D=Math.max(0,T);return{newDroppingPosition:{left:E/c,top:D/c,e:a},calculatedXY:se(g,D,E,i.w,i.h)}}var cn=()=>{},ln=`react-grid-layout`,un=!1;try{un=/firefox/i.test(navigator.userAgent)}catch{}function dn(e,t){let n=X.Children.toArray(e),r=X.Children.toArray(t);if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++){let t=n[e],i=r[e];if(t?.key!==i?.key)return!1}return!0}function fn(e,t,n,r){let i=[],a=new Set;X.Children.forEach(t,t=>{if(!X.isValidElement(t)||t.key===null)return;let n=String(t.key);a.add(n);let r=e.find(e=>e.i===n);if(r)i.push(H(r));else{let e=t.props[`data-grid`];e?i.push({i:n,x:e.x??0,y:e.y??0,w:e.w??1,h:e.h??1,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,static:e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}):i.push({i:n,x:0,y:fe(i),w:1,h:1})}});let o=W(i,{cols:n});return r.compact(o,n)}function pn(e){let{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:a,dropConfig:o,positionStrategy:s=Ae,compactor:c,constraints:l=_e,layout:u=[],droppingItem:d,autoSize:f=!0,className:p=``,style:m={},innerRef:h,onLayoutChange:g=cn,onDragStart:_=cn,onDrag:v=cn,onDragStop:y=cn,onResizeStart:b=cn,onResize:x=cn,onResizeStop:S=cn,onDrop:C=cn,onDropDragOver:w=cn}=e,T=(0,X.useMemo)(()=>({...je,...r}),[r]),E=(0,X.useMemo)(()=>({...Me,...i}),[i]),D=(0,X.useMemo)(()=>({...Ne,...a}),[a]),ee=(0,X.useMemo)(()=>({...Pe,...o}),[o]),{cols:O,rowHeight:k,maxRows:A,margin:j,containerPadding:M}=T,{enabled:N,bounded:te,handle:ne,cancel:re,threshold:ie,allowMobileScroll:P}=E,{enabled:F,handles:oe,handleComponent:se}=D,{enabled:I,defaultItem:ce,onDragOver:L,touchEnabled:le=!0,touchDragSource:ue=`[data-rgl-draggable]`}=ee,R=c??We(`vertical`),z=R.type,B=R.allowOverlap,V=R.preventCollision??!1,U=(0,X.useMemo)(()=>d??{i:`__dropping-elem__`,...ce},[d,ce]),me=s.type===`transform`,W=s.scale,G=M??j,[K,ve]=(0,X.useState)(!1),[q,ye]=(0,X.useState)(()=>fn(u,t,O,R)),[be,xe]=(0,X.useState)(null),[Se,J]=(0,X.useState)(!1),[Ce,Y]=(0,X.useState)(null),[we,Te]=(0,X.useState)(),Ee=(0,X.useRef)(void 0);Ee.current=we;let De=(0,X.useRef)(null),Oe=(0,X.useRef)(null),ke=(0,X.useRef)(null),Fe=(0,X.useRef)(0),Ie=(0,X.useRef)(q),Le=(0,X.useRef)(u),Re=(0,X.useRef)(t),ze=(0,X.useRef)(z),Be=(0,X.useRef)(null),Ve=(0,X.useRef)(!1),He=(0,X.useRef)(null),Ue=(0,X.useRef)(null);Ue.current=Ce;let Ge=(0,X.useRef)(C);(0,X.useLayoutEffect)(()=>{Ge.current=C});let Ke=(0,X.useRef)(q);Ke.current=q,(0,X.useEffect)(()=>{ve(!0),(0,$t.deepEqual)(q,u)||g(q)},[]),(0,X.useEffect)(()=>{if(be||Ce)return;let e=!(0,$t.deepEqual)(u,Le.current),n=!dn(t,Re.current),r=z!==ze.current;if(e||n||r){let n=fn(e?u:q,t,O,R);(0,$t.deepEqual)(n,q)||ye(n)}Le.current=u,Re.current=t,ze.current=z},[u,t,O,z,R,be,Ce,q]),(0,X.useEffect)(()=>{if(!be&&!Ce&&!(0,$t.deepEqual)(q,Ie.current)){Ie.current=q;let e=q.filter(e=>e.i!==U.i);g(e)}},[q,be,Ce,g,U.i]);let qe=(0,X.useMemo)(()=>{if(!f)return;let e=fe(q),t=G[1];return e*k+(e-1)*j[1]+t*2+`px`},[f,q,k,j,G]),Je=(0,X.useCallback)((e,t,n,r)=>{let i=Ke.current,a=pe(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};De.current=H(a),ke.current=i,xe(o),_(i,a,a,null,r.e,r.node)},[_]),Ye=(0,X.useCallback)((e,t,n,r)=>{let i=Ke.current,a=De.current,o=pe(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=ge(i,o,t,n,!0,V,z,O,B);v(c,a,o,s,r.e,r.node),ye(R.compact(c,O)),xe(s)},[V,z,O,B,R,v]),Xe=(0,X.useCallback)((e,t,n,r)=>{if(!De.current)return;let i=Ke.current,a=De.current,o=pe(i,e);if(!o)return;let s=ge(i,o,t,n,!0,V,z,O,B),c=R.compact(s,O);y(c,a,o,null,r.e,r.node);let l=ke.current;De.current=null,ke.current=null,xe(null),ye(c),l&&!(0,$t.deepEqual)(l,c)&&g(c)},[V,z,O,B,R,y,g]),Ze=(0,X.useCallback)((e,t,n,r)=>{let i=Ke.current,a=pe(i,e);a&&(Oe.current=H(a),ke.current=i,J(!0),b(i,a,a,null,r.e,r.node))},[b]),Qe=(0,X.useCallback)((e,t,n,r)=>{let i=Ke.current,a=Oe.current,{handle:o}=r,s=!1,c,l,[u,d]=he(i,e,e=>(c=e.x,l=e.y,[`sw`,`w`,`nw`,`n`,`ne`].includes(o)&&([`sw`,`nw`,`w`].includes(o)&&(c=e.x+(e.w-t),t=e.x!==c&&c<0?e.w:t,c=c<0?0:c),[`ne`,`n`,`nw`].includes(o)&&(l=e.y+(e.h-n),n=e.y!==l&&l<0?e.h:n,l=l<0?0:l),s=!0),V&&!B&&de(i,{...e,w:t,h:n,x:c??e.x,y:l??e.y}).filter(t=>t.i!==e.i).length>0&&(l=e.y,n=e.h,c=e.x,t=e.w,s=!1),e.w=t,e.h=n,(o===`n`||o===`nw`||o===`ne`)&&(e.y=l??e.y),e));if(!d)return;let f=u;s&&c!==void 0&&l!==void 0&&(f=ge(u,d,c,l,!0,V,z,O,B));let p={w:d.w,h:d.h,x:d.x,y:d.y,i:e,static:!0};x(f,a,d,p,r.e,r.node);let m=R.compact(f,O);if(o===`n`||o===`nw`||o===`ne`){let t=m.find(t=>t.i===e);t&&(t.y=d.y)}ye(m),xe(p)},[V,z,O,B,R,x]),$e=(0,X.useCallback)((e,t,n,r)=>{let i=Ke.current,a=Oe.current,o=pe(i,e),s=R.compact(i,O);S(s,a,o??null,null,r.e,r.node);let c=ke.current;Oe.current=null,ke.current=null,xe(null),J(!1),ye(s),c&&!(0,$t.deepEqual)(c,s)&&g(s)},[O,R,S,g]),Z=(0,X.useCallback)((e,t,n,r)=>{if(r)Ee.current&&(Ee.current.left!==t.left||Ee.current.top!==t.top)&&(Te(t),ye(t=>t.map(t=>t.i===e.i&&(t.x!==n.x||t.y!==n.y)?{...t,x:n.x,y:n.y}:t)));else{Y((0,$.jsx)(`div`,{},e.i)),Te(t);let r=Ke.current.filter(t=>t.i!==e.i);ye([...r,{...e,x:n.x,y:n.y,static:!1,isDraggable:!0}])}},[]),et=(0,X.useCallback)((e,t,r)=>{let i=Be.current;if(!i)return;let{newDroppingPosition:a,calculatedXY:o}=sn({clientX:e,clientY:t,gridElement:i,droppingItem:U,event:r,transformScale:W,cols:O,margin:j,maxRows:A,rowHeight:k,width:n,containerPadding:G});Z(U,a,o,!!Ue.current)},[U,W,O,j,A,k,n,G,Z]),tt=(0,X.useCallback)(()=>{let e=Ke.current;if(!e.some(e=>e.i===U.i)){Y(null),xe(null),Te(void 0);return}let t=R.compact(e.filter(e=>e.i!==U.i),O);ye(t),Y(null),xe(null),Te(void 0)},[U.i,O,R]),nt=(0,X.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),un&&!e.nativeEvent.target?.classList.contains(ln))return!1;let t=L?L(e.nativeEvent):w(e);if(t===!1)return Ce&&tt(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...U,...a},{newDroppingPosition:s,calculatedXY:c}=sn({clientX:e.clientX,clientY:e.clientY,gridElement:e.currentTarget,droppingItem:o,event:e.nativeEvent,dragOffsetX:r,dragOffsetY:i,transformScale:W,cols:O,margin:j,maxRows:A,rowHeight:k,width:n,containerPadding:G});Z(o,s,c,!!Ce)},[Ce,U,L,w,tt,Z,W,O,j,A,k,n,G]),rt=(0,X.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Fe.current--,Fe.current<0&&(Fe.current=0),Fe.current===0&&tt()},[tt]),Q=(0,X.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Fe.current++},[]),it=(0,X.useCallback)(e=>{let t=Ke.current,n=t.find(e=>e.i===U.i);tt(),Ge.current(t,n,e)},[U.i,tt]),at=(0,X.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Fe.current=0,it(e.nativeEvent)},[it]);(0,X.useEffect)(()=>{if(!I||!le)return;let e=Be.current;if(!e)return;let t=(t,n)=>{let r=document.elementFromPoint(t,n);return r?e.contains(r):!1},n=e=>e instanceof HTMLElement&&e.closest(ue)!==null,r=e=>{let t=e.changedTouches;if(!t||t.length===0)return;let n=He.current;if(n===null)return t[0];for(let e=0;e<t.length;e++){let r=t[e];if(r&&r.identifier===n)return r}},i=e=>{if(!n(e.target)||He.current!==null)return;e.preventDefault();let t=e.changedTouches?.[0];t&&(He.current=t.identifier,Ve.current=!0)},a=e=>{if(!Ve.current)return;e.preventDefault();let n=r(e);n&&(t(n.clientX,n.clientY)?et(n.clientX,n.clientY,e):Ue.current&&tt())},o=e=>{if(!Ve.current)return;e.preventDefault();let n=r(e);Ve.current=!1,He.current=null,n&&(t(n.clientX,n.clientY)?it(e):tt())},s=()=>{Ve.current&&(Ve.current=!1,He.current=null,tt())},c={passive:!1};return document.addEventListener(`touchstart`,i,c),document.addEventListener(`touchmove`,a,c),document.addEventListener(`touchend`,o,c),document.addEventListener(`touchcancel`,s,c),()=>{document.removeEventListener(`touchstart`,i,c),document.removeEventListener(`touchmove`,a,c),document.removeEventListener(`touchend`,o,c),document.removeEventListener(`touchcancel`,s,c)}},[I,le,ue,et,tt,it,U.i]);let ot=(0,X.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=pe(q,String(e.key));if(!r)return null;let i=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&N,a=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&F,o=r.resizeHandles||[...oe],c=i&&te&&r.isBounded!==!1,u=se;return(0,$.jsx)(on,{containerWidth:n,cols:O,margin:j,containerPadding:G,maxRows:A,rowHeight:k,cancel:re,handle:ne,onDragStart:Je,onDrag:Ye,onDragStop:Xe,onResizeStart:Ze,onResize:Qe,onResizeStop:$e,isDraggable:i,isResizable:a,isBounded:c,allowMobileScroll:P,useCSSTransforms:me&&K,usePercentages:!K,transformScale:W,positionStrategy:s,dragThreshold:ie,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:t?we:void 0,resizeHandles:o,resizeHandle:u,constraints:l,layoutItem:r,layout:q,children:e},r.i)},[q,n,O,j,G,A,k,re,ne,Je,Ye,Xe,Ze,Qe,$e,N,F,te,me,K,W,s,ie,we,oe,se,l]),st=()=>be?(0,$.jsx)(on,{w:be.w,h:be.h,x:be.x,y:be.y,i:be.i,className:`react-grid-placeholder ${Se?`placeholder-resizing`:``}`,containerWidth:n,cols:O,margin:j,containerPadding:G,maxRows:A,rowHeight:k,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:me,transformScale:W,constraints:l,layout:q,children:(0,$.jsx)(`div`,{})}):null,ct=(0,X.useCallback)(e=>{Be.current=e,typeof h==`function`?h(e):h&&`current`in h&&(h.current=e)},[h]),lt=ae(ln,p),ut={height:qe,...m};return(0,$.jsxs)(`div`,{ref:ct,className:lt,style:ut,onDrop:I?at:void 0,onDragLeave:I?rt:void 0,onDragEnter:I?Q:void 0,onDragOver:I?nt:void 0,children:[X.Children.map(t,e=>X.isValidElement(e)?ot(e):null),I&&Ce&&ot(Ce,!0),st()]})}var mn={lg:1200,md:996,sm:768,xs:480,xxs:0},hn={lg:12,md:10,sm:6,xs:4,xxs:2},gn=()=>{};function _n(e,t,n,r,i=!1){let a=[];X.Children.forEach(t,t=>{if(!X.isValidElement(t)||t.key===null)return;let n=String(t.key),r=t.props[`data-grid`],o=e.find(e=>e.i===n);o?i&&r?a.push({...o,i:n,w:r.w??o.w,h:r.h??o.h,minW:r.minW??o.minW,maxW:r.maxW??o.maxW,minH:r.minH??o.minH,maxH:r.maxH??o.maxH}):a.push({...o,i:n}):r?a.push({i:n,x:r.x??0,y:r.y??0,w:r.w??1,h:r.h??1,minW:r.minW,maxW:r.maxW,minH:r.minH,maxH:r.maxH,static:r.static,isDraggable:r.isDraggable,isResizable:r.isResizable,resizeHandles:r.resizeHandles,isBounded:r.isBounded}):a.push({i:n,x:0,y:fe(a),w:1,h:1})});let o=W(a,{cols:n});return r.compact(o,n)}function vn(e){let{children:t,width:n,breakpoint:r,breakpoints:i=mn,cols:a=hn,layouts:o={},rowHeight:s=150,maxRows:c=1/0,margin:l=[10,10],containerPadding:u=null,compactor:d,onBreakpointChange:f=gn,onLayoutChange:p=gn,onWidthChange:m=gn,...h}=e,g=d??We(`vertical`),_=g.type,v=g.allowOverlap,y=(0,X.useMemo)(()=>r??Ke(i,n),[]),b=(0,X.useMemo)(()=>qe(y,a),[y,a]),x=(0,X.useMemo)(()=>Je(o,i,y,y,b,_),[]),[S,C]=(0,X.useState)(y),[w,T]=(0,X.useState)(b),[E,D]=(0,X.useState)(x),[ee,O]=(0,X.useState)(o),k=(0,X.useRef)(n),A=(0,X.useRef)(r),j=(0,X.useRef)(i),M=(0,X.useRef)(a),N=(0,X.useRef)(o),te=(0,X.useRef)(_),ne=(0,X.useRef)(ee);(0,X.useEffect)(()=>{ne.current=ee},[ee]);let re=(0,X.useMemo)(()=>(0,$t.deepEqual)(o,N.current)?null:Je(o,i,S,S,w,g),[o,i,S,w,g]),ie=re??E;(0,X.useEffect)(()=>{re!==null&&(D(re),O(o),ne.current=o,N.current=o)},[re,o]),(0,X.useEffect)(()=>{if(_!==te.current){let e=g.compact(U(ie),w),t={...ne.current,[S]:e};D(e),O(t),ne.current=t,p(e,t),te.current=_}},[_,g,ie,w,v,S,p]),(0,X.useEffect)(()=>{let e=n!==k.current,o=r!==A.current,s=!(0,$t.deepEqual)(i,j.current),c=!(0,$t.deepEqual)(a,M.current);if(e||o||s||c){let e=r??Ke(i,n),o=qe(e,a),d=S;if(d!==e||s||c){let n={...ne.current};n[d]||(n[d]=U(E));let r=Je(n,i,e,d,o,g),a=!n[e];r=_n(r,t,o,g,a),n[e]=r,C(e),T(o),D(r),O(n),ne.current=n,f(e,o),p(r,n)}let h=Ye(l,e),_=u?Ye(u,e):null;m(n,h,o,_),k.current=n,A.current=r,j.current=i,M.current=a}},[n,r,i,a,S,w,E,t,g,_,v,l,u,f,p,m]);let ae=(0,X.useCallback)(e=>{let t={...ne.current,[S]:e};D(e),O(t),ne.current=t,p(e,t)},[S,p]),P=(0,X.useMemo)(()=>Ye(l,S),[l,S]),F=(0,X.useMemo)(()=>u===null?null:Ye(u,S),[u,S]),oe=(0,X.useMemo)(()=>({cols:w,rowHeight:s,maxRows:c,margin:P,containerPadding:F}),[w,s,c,P,F]);return(0,$.jsx)(pn,{...h,width:n,gridConfig:oe,compactor:g,onLayoutChange:ae,layout:ie,children:t})}var yn=X.forwardRef(function(e,t){let{innerRef:n,...r}=e,i=n??t;return(0,$.jsx)(vn,{...r,innerRef:i})});yn.displayName=`ResponsiveGridLayout`;var bn={holidayName:new Map,makeup:new Set,years:new Set,provisionalYears:new Set},xn=/^\d{4}-\d{2}-\d{2}$/;function Sn(e){if(!xn.test(e))return null;let[t,n,r]=e.split(`-`).map(Number),i=new Date(t,(n??1)-1,r??1);return Number.isNaN(i.getTime())?null:Cn(i)===e?i:null}function Cn(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function wn(e){let t=new Map,n=new Set,r=new Set,i=new Set;if(!e||typeof e!=`object`)return{holidayName:t,makeup:n,years:r,provisionalYears:i};let a=e.years;if(!a||typeof a!=`object`)return{holidayName:t,makeup:n,years:r,provisionalYears:i};for(let[e,o]of Object.entries(a)){let a=Number(e);if(!Number.isInteger(a)||!o||typeof o!=`object`)continue;let s=o.holidays;if(Array.isArray(s)){r.add(a),o.provisional&&i.add(a);for(let e of s){if(!e||typeof e.name!=`string`)continue;let r=Sn(e.from),i=Sn(e.to);if(!(!r||!i||r>i)){for(let n=new Date(r);n<=i;n.setDate(n.getDate()+1))t.set(Cn(n),e.name);for(let t of e.workdays??[])xn.test(t)&&n.add(t)}}}}return{holidayName:t,makeup:n,years:r,provisionalYears:i}}var Tn=null;function En(){return Tn??=fetch(`/cn-holidays.json`,{cache:`no-cache`}).then(e=>e.ok?e.json():null).then(e=>e?wn(e):bn).catch(()=>bn),Tn}function Dn(e,t){if(e.makeup.has(t))return!1;if(e.holidayName.has(t))return!0;let n=Sn(t);if(!n)return!1;let r=n.getDay();return r===0||r===6}function On(e,t){return Dn(e,t)?e.holidayName.get(t)??`周末`:null}var kn=[`todoInProgress`,`taskInProgress`,`overdue`,`todoRate`,`taskRate`],An=`kpi`,jn=[{id:`todoInProgress`,title:`进行中待办`,desc:`状态为进行中的待办数量`,w:3,h:8,minW:2,minRows:7},{id:`taskInProgress`,title:`进行中任务`,desc:`状态为进行中的任务数量`,w:3,h:8,minW:2,minRows:7},{id:`overdue`,title:`已逾期`,desc:`已过截止日期且未完成的待办`,w:3,h:8,minW:2,minRows:7},{id:`todoRate`,title:`待办完成率`,desc:`已完成占全部待办的比例`,w:3,h:8,minW:2,minRows:7},{id:`taskRate`,title:`任务完成率`,desc:`已完成占全部任务的比例`,w:3,h:8,minW:2,minRows:7},{id:`activeProjects`,title:`活跃项目`,desc:`项目管理里状态为进行中的项目数量`,w:3,h:8,minW:2,minRows:7},{id:`spaces`,title:`数据空间`,desc:`当前账号下共有多少个数据空间`,w:3,h:8,minW:2,minRows:7},{id:`countdown`,title:`倒计时`,desc:`距离今天结束 / 周末 / 今年结束,可切换`,w:3,h:10,minW:3,minRows:9},{id:`todayTodos`,title:`今日待办`,desc:`开始 ~ 截止区间含今天,可勾选完成`,w:6,h:12,minW:4},{id:`activeTasks`,title:`进行中任务列表`,desc:`状态为进行中的任务`,w:6,h:19,minW:4},{id:`testChart`,title:`测试统计`,desc:`各维度最新一天的数量`,w:6,h:19,minW:4},{id:`todoCalendar`,title:`待办日历`,desc:`日 / 周 / 月视图`,w:12,h:36,minW:6,minHeight:320}],Mn=jn.map(e=>e.id),Nn=new Set(Mn);function Pn(e){return typeof e==`string`&&Nn.has(e)}function Fn(e){return jn.find(t=>t.id===e)}function In(e){return Math.max(1,Math.ceil((e+12)/20))}function Ln(e){let t=Fn(e),n=t.minRows??In(180);return Math.max(n,In(t.minHeight??0))}function Rn(e){return Math.max(1,Fn(e).minW??4)}function zn(e,t){return e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h}function Bn(e,t){return Math.min(e.y+e.h,t.y+t.h)-Math.max(e.y,t.y)>Math.min(e.h,t.h)/2}function Vn(e,t=[]){let n={},r=[...t];for(let t of e){let e=Math.min(12,Math.max(1,t.w)),i=Math.max(1,Math.min(49,t.h)),a=t.at?{x:t.at.x,y:t.at.y,w:e,h:i}:null,o=a&&!r.some(e=>zn(e,a))?a:null;for(let t=0;!o&&t<=98;t+=1)for(let n=0;n+e<=12;n+=1){let a={x:n,y:t,w:e,h:i};if(!r.some(e=>zn(e,a))){o=a;break}}let s=o??{x:0,y:0,w:e,h:i};n[t.id]=s,r.push(s)}return n}function Hn(e){return Vn(e.map(e=>{let t=Fn(e);return{id:e,w:Math.min(12,Math.max(Rn(e),t.w)),h:Math.max(Ln(e),t.h)}}))}var Un=Hn(Mn);function Wn(e){return{...Un[e]}}function Gn(){return{hidden:[...Mn],rects:{}}}function Kn(e){let t={...e?.rects??{}},n=Mn.filter(e=>t[e]).map(e=>t[e]),r=Mn.filter(e=>!t[e]).map(e=>{let t=Wn(e);return{id:e,w:t.w,h:t.h,at:t}});return Object.assign(t,Vn(r,n)),rr({hidden:[],rects:t})}function qn(e){if(!Array.isArray(e))return[];let t=[];for(let n of e)Pn(n)&&!t.includes(n)&&t.push(n);return t}function Jn(e){let t=qn(e);if(Array.isArray(e)&&e.includes(An))for(let e of kn)t.includes(e)||t.push(e);return t}function Yn(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e))Pn(n)&&(r===`half`||r===`full`)&&(t[n]=r);return t}function Xn(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e)){if(!Pn(n))continue;let e=typeof r==`number`?r:Number(r);Number.isFinite(e)&&(t[n]=Math.round(Math.min(960,Math.max(180,e))))}return t}function Zn(e){let t=Jn(e.hidden),n=qn(e.order);for(let e of Mn)n.includes(e)||n.push(e);let r=Yn(e.spans),i=Xn(e.heights),a={},o=0,s=null;for(let e of n){if(t.includes(e))continue;let n=Fn(e),c=r[e]===`full`?12:r[e]===`half`?Math.max(Rn(e),6):n.w,l=i[e]?In(i[e]):n.h;c>=12?(s&&=(o=s.top+s.h,null),a[e]={x:0,y:o,w:12,h:l},o+=l):s?(a[e]={x:12-c,y:s.top,w:c,h:l},o=s.top+Math.max(s.h,l),s=null):(s={top:o,h:l},a[e]={x:0,y:o,w:c,h:l})}return{hidden:t,rects:a}}function Qn(e,t){return $n(t,Rn(e),Ln(e))}function $n(e,t,n){if(!e||typeof e!=`object`||Array.isArray(e))return null;let r=e,i=e=>{let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.round(t):null},a=i(r.x),o=i(r.y),s=i(r.w),c=i(r.h);if(a===null||o===null||s===null||c===null)return null;let l=Math.max(t,Math.min(12,s)),u=Math.max(n,Math.min(49,c));return{x:Math.max(0,Math.min(12-l,a)),y:Math.max(0,o),w:l,h:u}}function er(e,t){let n=$n(e,2,10);if(!n||kn.some(e=>t[e]))return;let r=n.x,i=n.y,a=0;for(let e of kn){let n=Fn(e);r>0&&r+n.w>12&&(r=0,i+=a,a=0),t[e]={x:r,y:i,w:n.w,h:n.h},r+=n.w,a=Math.max(a,n.h),r>=12&&(r=0,i+=a,a=0)}}function tr(e,t){let n=new Set(e),r=Mn.filter(e=>!n.has(e)&&t[e]).sort((e,n)=>t[e].y-t[n].y||t[e].x-t[n].x),i=[];for(let e of r){let n=t[e];for(let e=0;e<=r.length;e+=1){let e=i.filter(e=>zn(e,n));if(e.length===0)break;n.y=Math.max(...e.map(e=>e.y+e.h))}i.push(n)}}function nr(e,t){let n=new Set(e),r=Mn.filter(e=>!n.has(e)&&!t[e]);if(!r.length)return;let i=Mn.filter(e=>t[e]).map(e=>t[e]);Object.assign(t,Vn(r.map(e=>{let t=Wn(e);return{id:e,w:t.w,h:t.h,at:t}}),i))}function rr(e){let t=ir(e);return tr(t.hidden,t.rects),t}function ir(e){if(!e||typeof e!=`object`||Array.isArray(e))return Gn();let t=e;if(!t.rects||typeof t.rects!=`object`)return Array.isArray(t.order)?Zn(t):{hidden:Jn(t.hidden),rects:{}};let n={};for(let[e,r]of Object.entries(t.rects)){if(!Pn(e))continue;let t=Qn(e,r);t&&(n[e]=t)}let r=Jn(t.hidden),i=t.rects[An];return i===void 0?(nr(r,n),{hidden:r,rects:n}):(er(i,n),ur({hidden:r,rects:n}))}function ar(e){let t=[...sr(e)].sort((e,t)=>e.rect.y-t.rect.y||e.rect.x-t.rect.x),n=0;return t.map(({id:e,rect:t})=>{let r={x:0,y:n,w:12,h:t.h};return n+=t.h,{id:e,rect:r}})}function or(e,t){return e.rects[t]??Wn(t)}function sr(e){let t=new Set(e.hidden);return Mn.filter(e=>!t.has(e)).map(t=>({id:t,def:Fn(t),rect:or(e,t)}))}function cr(e,t){let n=new Set(e.hidden);n.delete(t);let r=Mn.filter(e=>e!==t&&!n.has(e)).map(t=>[t,e.rects[t]??Wn(t)]),i=e.rects[t],a=(i&&!r.some(([,e])=>zn(i,e))?i:null)??{x:0,y:r.reduce((e,[,t])=>Math.max(e,t.y+t.h),0),w:Fn(t).w,h:Fn(t).h};return rr({...e,hidden:[...n],rects:{...e.rects,[t]:a}})}function lr(e,t,n=`resize`,r={}){let i=new Set(e.hidden);if(i.has(t))return e;let a=Mn.filter(e=>!i.has(e)),o={};for(let t of Mn){let n=e.rects[t];n&&(o[t]={...n})}for(let e of a)o[e]||(o[e]=Wn(e));let s=[...a].sort((e,t)=>o[e].y-o[t].y||o[e].x-o[t].x),c=[t],l=new Set,u=n===`drag`&&r.direction===`up`,d=600;for(;c.length>0&&d>0;){--d;let e=c.shift(),r=o[e];for(let i of s){if(i===e||i===t)continue;let a=o[i];if(zn(r,a)){if(n===`drag`&&!l.has(i)&&Bn(r,a)){let e=(a.x+a.w/2>=r.x+r.w/2?[r.x+r.w,r.x-a.w]:[r.x-a.w,r.x+r.w]).find(e=>e>=0&&e+a.w<=12&&e!==a.x&&!s.some(n=>{if(n===i||n===t)return!1;let r=o[n];return r!==void 0&&zn(r,{x:e,y:a.y,w:a.w,h:a.h})}));if(e!==void 0){a.x=e,l.add(i),c.push(i);continue}}if(u&&a.y<r.y){let e=r.y-a.h;if(e>=0&&e<a.y&&!s.some(t=>{if(t===i)return!1;let n=o[t];return n!==void 0&&zn(n,{x:a.x,y:e,w:a.w,h:a.h})})){a.y=e,l.add(i),c.push(i);continue}}a.y=r.y+r.h,l.add(i),c.push(i)}}}return{hidden:e.hidden,rects:o}}function ur(e){let t=new Set(e.hidden),n=Mn.filter(e=>!t.has(e)).map(t=>({id:t,rect:{...e.rects[t]??Wn(t)}})).sort((e,t)=>e.rect.y-t.rect.y||e.rect.x-t.rect.x),r={};for(let t of e.hidden){let n=e.rects[t];n&&(r[t]={...n})}let i=[];for(let{id:e,rect:t}of n){let n=Math.min(12,Math.max(Rn(e),t.w)),a=Math.min(49,Math.max(Ln(e),t.h)),o={x:Math.max(0,Math.min(12-n,t.x)),y:0,w:n,h:a};for(let e=0;e<=i.length+1;e+=1){let e=i.filter(e=>zn(e,o));if(e.length===0)break;o={...o,y:Math.max(...e.map(e=>e.y+e.h))}}r[e]=o,i.push(o)}return rr({...e,rects:r})}function dr(e,t){return t>0?Math.round(e/t*100):0}function fr(e,t,n=x()){let r=0,i=0,a=0,o=0;for(let t of e)t.status!==`cancelled`&&(o+=1,t.status===`done`&&(a+=1),t.status===`in_progress`&&(r+=1),S(t,n)===`overdue`&&(i+=1));let s=0,c=0,l=0;for(let e of t)e.status!==`closed`&&e.status!==`cancelled`&&(l+=1,e.status===`done`&&(c+=1),e.status===`in_progress`&&(s+=1));return{todoInProgress:r,taskInProgress:s,overdue:i,todoDone:a,todoTotal:o,todoRate:dr(a,o),taskDone:c,taskTotal:l,taskRate:dr(c,l)}}function pr(e){let t=e.startDate||e.dueDate,n=e.dueDate||e.startDate;return!t||!n?null:t<=n?{start:t,end:n}:{start:n,end:t}}function mr(e,t=x()){return O(e.filter(e=>{if(w(e.status))return!1;let n=pr(e);return n&&n.start<=t&&t<=n.end?!0:!!(e.dueDate&&e.dueDate<t)}))}function hr(e){return D(e.filter(e=>e.status===`in_progress`))}var gr=/^\d{4}-\d{2}-\d{2}$/;function _r(e){if(!gr.test(e))return null;let[t,n,r]=e.split(`-`).map(Number),i=new Date(t,(n??1)-1,r??1);return Number.isNaN(i.getTime())?null:i}function vr(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function yr(e,t){let n=_r(e);return n?(n.setDate(n.getDate()+t),vr(n)):e}function br(e,t){let n=_r(e),r=_r(t);return!n||!r?0:Math.round((r.getTime()-n.getTime())/864e5)}function xr(e,t){let n=_r(e);return n?vr(new Date(n.getFullYear(),n.getMonth()+t,1)):e}function Sr(e=x()){let t=_r(e)??new Date,n=new Date(t.getFullYear(),t.getMonth(),1),r=(n.getDay()+6)%7,i=new Date(n.getFullYear(),n.getMonth(),1-r);return Array.from({length:42},(e,t)=>vr(new Date(i.getFullYear(),i.getMonth(),i.getDate()+t)))}function Cr(e=x()){let t=_r(e)??new Date,n=(t.getDay()+6)%7,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()-n);return Array.from({length:7},(e,t)=>vr(new Date(r.getFullYear(),r.getMonth(),r.getDate()+t)))}var wr={days:0,hours:0,minutes:0,seconds:0,resting:!0,target:`周末`,targetDate:``};function Tr(e=new Date,t=bn){let n=vr(e);if(Dn(t,n))return{...wr,target:On(t,n)??`周末`,targetDate:n};let r=null,i=n;for(let e=1;e<=400;e+=1)if(i=yr(i,1),Dn(t,i)){r=i;break}if(!r)return{...wr,resting:!1};let a=_r(r),o=Math.max(0,(a?.getTime()??e.getTime())-e.getTime()),s=Math.floor(o/1e3);return{days:Math.floor(s/86400),hours:Math.floor(s%86400/3600),minutes:Math.floor(s%3600/60),seconds:s%60,resting:!1,target:On(t,r)??`周末`,targetDate:r}}var Er=[`today`,`offWork`,`weekend`,`year`],Dr=`18:00`,Or=`00:00`;function kr(e){if(typeof e!=`string`)return null;let t=/^(\d{1,2}):(\d{1,2})$/.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return!Number.isFinite(n)||!Number.isFinite(r)||n>23||r>59?null:`${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`}var Ar=kr;function jr(e){let t=Math.max(0,Math.floor(e/1e3));return{days:Math.floor(t/86400),hours:Math.floor(t%86400/3600),minutes:Math.floor(t%3600/60),seconds:t%60}}var Mr={today:`距离今天结束`,offWork:`距离下班`,year:`距离今年结束`};function Nr(e=new Date,t=bn,n=`weekend`,r=Dr,i=Or){if(n===`offWork`){let t=Ar(r)??`18:00`,[i,a]=t.split(`:`).map(Number),o=new Date(e.getFullYear(),e.getMonth(),e.getDate(),i??18,a??0,0,0),s=vr(o),c=o.getTime()-e.getTime(),l=jr(c),u=c<=0;return{kind:n,...l,targetDate:s,title:u?`已经下班啦`:Mr.offWork,note:u?`今天 ${t} 下班,辛苦啦`:`今天 ${t} 下班`,reached:u,provisional:!1}}if(n===`today`){let t=new Date(e.getFullYear(),e.getMonth(),e.getDate()+1),r=vr(t),i=jr(t.getTime()-e.getTime());return{kind:n,...i,targetDate:r,title:Mr.today,note:`到 ${r} 00:00 结束今天`,reached:i.days+i.hours+i.minutes+i.seconds===0,provisional:!1}}if(n===`year`){let t=new Date(e.getFullYear()+1,0,1),r=vr(t),i=jr(t.getTime()-e.getTime());return{kind:n,...i,targetDate:r,title:Mr.year,note:`到 ${r} 00:00 跨年`,reached:i.days+i.hours+i.minutes+i.seconds===0,provisional:!1}}let a=Tr(e,t),o=a.targetDate!==``&&t.provisionalYears.has(Number(a.targetDate.slice(0,4))),s=kr(i)??`00:00`,[c,l]=s.split(`:`).map(Number),u=_r(a.targetDate),d=u?new Date(u.getFullYear(),u.getMonth(),u.getDate()-(s===`00:00`?0:1),c??0,l??0,0,0):null;if(!d)return{kind:n,...jr(0),targetDate:a.targetDate,title:`距离${a.target}`,note:`暂时算不出下一个休息日`,reached:!1,provisional:o};let f=d.getTime()-e.getTime(),p=jr(f),m=f<=0,h=vr(d);return{kind:n,...p,targetDate:h,title:m?`${a.target}愉快`:`距离${a.target}`,note:m?`好好休息,回来再战`:o?`${a.targetDate.slice(0,4)} 年安排待公布,先按已公布假日计算`:`到 ${h} ${s} 开始${a.target===`周末`?`休息`:`放假`}`,reached:m,provisional:o}}function Pr(e,t=10){let n=new Map;for(let t of e){if(t.draft)continue;let e=t.dimensions[0]?.trim();if(!e)continue;let r=n.get(e);(!r||t.date>r.date||t.date===r.date&&t.createdAt>r.createdAt)&&n.set(e,t)}return[...n.values()].map(e=>({dimension:e.dimensions[0],count:e.count,date:e.date})).sort((e,t)=>t.count-e.count||e.dimension.localeCompare(t.dimension,`zh`)).slice(0,Math.max(0,t))}function Fr(e,t=3){if(!Number.isFinite(e)||e<=0)return[0,1];let n=e/Math.max(1,t),r=10**Math.floor(Math.log10(n)),i=n/r,a=Math.max(1,(i<=1?1:i<=2?2:i<=5?5:10)*r),o=Math.max(a,Math.ceil(e/a)*a),s=[];for(let e=0;e<=o+a/1e3;e+=a)s.push(Math.round(e));return s}function Ir(e,t,n){let r=e.length,i=Math.max(1,Math.floor(n)),a=Math.max(1,Math.ceil(r/i)),o=Math.min(a,Math.max(1,Math.floor(t)||1));return{items:e.slice((o-1)*i,o*i),page:o,pages:a,total:r}}function Lr(e,t){if(t.length===0)return{spans:[],lanes:0};let n=t[0],r=t[t.length-1],i=[],a=[],o=e.filter(e=>e.status!==`cancelled`).map(e=>{let i=e.startDate||e.dueDate,a=e.dueDate||e.startDate;if(!i||!a)return null;let o=i<=a?i:a,s=i<=a?a:i;return s<n||o>r?null:{item:e,start:Math.max(0,Math.min(t.length-1,br(n,o))),end:Math.max(0,Math.min(t.length-1,br(n,s)))}}).filter(e=>!!e).sort((e,t)=>e.start-t.start||t.end-e.end);for(let e of o){let t=i.findIndex(t=>t<e.start);t<0?(t=i.length,i.push(e.end)):i[t]=e.end,a.push({...e,lane:t})}return{spans:a,lanes:i.length}}function Rr(e,t){let n=Lr(e,t),r=[];for(let e=0;e<t.length;e+=7){let i=Math.min(t.length-1,e+6),a=n.spans.filter(t=>t.end>=e&&t.start<=i).map(t=>({...t,start:Math.max(t.start,e)-e,end:Math.min(t.end,i)-e}));r.push({days:t.slice(e,e+7),spans:a})}return r}function zr(e,t){if(e.status===`cancelled`)return!1;let n=e.startDate||e.dueDate,r=e.dueDate||e.startDate;return!n||!r?!1:t>=(n<=r?n:r)&&t<=(n<=r?r:n)}var Br=`inline-flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[11px] leading-4 text-stone-400 transition-colors hover:bg-stone-100 hover:text-[#3370ff] whitespace-nowrap`;function Vr(){return(0,$.jsx)(`svg`,{viewBox:`0 0 12 12`,width:`10`,height:`10`,"aria-hidden":`true`,children:(0,$.jsx)(`path`,{d:`M4.5 2.75 7.75 6 4.5 9.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Hr({tone:e,children:t}){return(0,$.jsx)(`span`,{className:`tw-dash-ico`,"data-tone":e,"aria-hidden":`true`,children:t})}function Ur(e){let{title:t,icon:n,tone:r=`blue`,href:i,action:a,fill:o,children:s}=e;return(0,$.jsxs)(`section`,{className:`tw-dash-surface flex h-full min-h-0 flex-col overflow-hidden rounded-2xl border border-stone-200 bg-white p-4`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[n?(0,$.jsx)(Hr,{tone:r,children:n}):null,(0,$.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-[14px] font-semibold tracking-tight text-stone-900`,children:t}),i&&a?(0,$.jsxs)(`a`,{href:`/${i}`,className:Br,children:[a,(0,$.jsx)(Vr,{})]}):null]}),(0,$.jsx)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col ${o?``:`tw-dash-scroll overflow-y-auto`}`,children:s})]})}function Wr({children:e}){return(0,$.jsx)(`p`,{className:`flex flex-1 items-center justify-center py-8 text-sm text-stone-400`,children:e})}function Gr({name:e,detail:t}){return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-1.5 py-8 text-center`,children:[(0,$.jsxs)(`p`,{className:`text-sm text-stone-500`,children:[`「`,e,`」插件未启用`]}),t?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-stone-400`,children:t}):null,(0,$.jsx)(`a`,{href:`/plugins/`,className:`mt-1 rounded-md bg-stone-100 px-2.5 py-1 text-xs font-medium text-[#3370ff] transition-colors hover:bg-[#e8f0fe]`,children:`去开启`})]})}function Kr({message:e}){return(0,$.jsxs)(`p`,{className:`flex flex-1 items-center justify-center px-2 py-6 text-center text-xs text-[#c02a26]`,children:[`读取失败:`,e]})}function qr(e){let{text:t,className:n}=e,r=(0,X.useRef)(null),[i,a]=(0,X.useState)(null);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{ref:r,className:`block truncate ${n??``}`,onMouseEnter:()=>{let e=r.current;if(!e||e.scrollWidth<=e.clientWidth+1)return;let t=e.getBoundingClientRect();a({x:t.left+t.width/2,y:t.top})},onMouseLeave:()=>a(null),children:t}),i?(0,et.createPortal)((0,$.jsx)(`span`,{role:`tooltip`,className:`tw-dash-tip`,style:{left:i.x,top:i.y},children:t}),document.body):null]})}var Jr={pool:`bg-stone-100 text-stone-600`,in_progress:`bg-[#e1eaff] text-[#1f4ec2]`,pending:`bg-stone-100 text-stone-600`,done:`bg-[#d9f5d2] text-[#1d7a12]`,closed:`bg-stone-100 text-stone-400`,cancelled:`bg-stone-100 text-stone-400`,overdue:`bg-[#fee4e3] text-[#c02a26]`},Yr={urgent_important:`bg-[#fee4e3] text-[#c02a26]`,important:`bg-[#fff1e3] text-[#a85b00]`,urgent:`bg-[#fff7d6] text-[#8a6100]`,normal:`bg-stone-100 text-stone-600`,"":`bg-transparent text-stone-400`},Xr=`tw-dash-th sticky top-0 z-1 whitespace-nowrap border-b border-stone-200 px-2.5 py-2 text-left text-[11px] font-medium text-stone-400`,Zr=`px-2.5 py-2.5 align-middle`;function Qr({status:e,label:t}){return(0,$.jsx)(`span`,{className:`inline-flex whitespace-nowrap rounded-full px-2 py-0.5 text-[10px] leading-4 ${Jr[e]??Jr.pending}`,children:t})}function $r({priority:e,label:t}){return(0,$.jsx)(`span`,{className:`inline-flex whitespace-nowrap rounded-full px-2 py-0.5 text-[10px] leading-4 ${Yr[e]??Yr[``]}`,children:t})}function ei(e){let{page:t,pages:n,total:r,onPage:i}=e;return r<=0?null:(0,$.jsxs)(`div`,{className:`mt-auto flex shrink-0 items-center justify-end gap-3 border-t border-stone-100 pt-2.5 text-[11px] text-stone-400`,children:[(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[`共 `,r,` 条`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`上一页`,disabled:t<=1,onClick:()=>i(t-1),className:`flex h-6 w-6 items-center justify-center rounded-md transition-colors hover:bg-stone-100 hover:text-stone-700 disabled:pointer-events-none disabled:opacity-30`,children:`‹`}),(0,$.jsx)(`span`,{className:`min-w-5 text-center text-stone-600 tabular-nums`,children:t}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`下一页`,disabled:t>=n,onClick:()=>i(t+1),className:`flex h-6 w-6 items-center justify-center rounded-md transition-colors hover:bg-stone-100 hover:text-stone-700 disabled:pointer-events-none disabled:opacity-30`,children:`›`})]})]})}function ti({children:e}){return(0,$.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`15`,height:`15`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:e})}function ni(){return(0,$.jsxs)(ti,{children:[(0,$.jsx)(`path`,{d:`M9 6h11M9 12h11M9 18h11`}),(0,$.jsx)(`path`,{d:`m3.5 6 1 1 2-2M3.5 12l1 1 2-2M3.5 18l1 1 2-2`})]})}function ri(){return(0,$.jsxs)(ti,{children:[(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`}),(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]})}function ii(){return(0,$.jsxs)(ti,{children:[(0,$.jsx)(`circle`,{cx:`12`,cy:`13`,r:`8`}),(0,$.jsx)(`path`,{d:`M12 9v4l2.5 1.5M9 2h6`})]})}function ai(){return(0,$.jsx)(ti,{children:(0,$.jsx)(`path`,{d:`M4 20V10M10 20V4M16 20v-7M22 20H2`})})}function oi(){return(0,$.jsxs)(ti,{children:[(0,$.jsx)(`rect`,{x:`3`,y:`4.5`,width:`18`,height:`16`,rx:`2.5`}),(0,$.jsx)(`path`,{d:`M8 2.5v4M16 2.5v4M3 9.5h18`})]})}function si(){return(0,$.jsxs)(ti,{children:[(0,$.jsx)(`path`,{d:`M12 3.5c3-2 6 0 6 3.5 0 4.5-2.2 7.5-6 10-3.8-2.5-6-5.5-6-10 0-3.5 3-5.5 6-3.5Z`}),(0,$.jsx)(`path`,{d:`M12 8.5v3.5`})]})}function ci(){return(0,$.jsxs)(ti,{children:[(0,$.jsx)(`path`,{d:`m3 16 5.5-5.5 3.5 3.5L21 5`}),(0,$.jsx)(`path`,{d:`M15 5h6v6`})]})}function li(){return(0,$.jsxs)(ti,{children:[(0,$.jsx)(`path`,{d:`M3 7.5h6l2 2.5h10v8.5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z`}),(0,$.jsx)(`path`,{d:`M3 10V6a2 2 0 0 1 2-2h4l2 3.5`})]})}function ui(){return(0,$.jsxs)(ti,{children:[(0,$.jsx)(`path`,{d:`m12 3 8.5 4.5L12 12 3.5 7.5Z`}),(0,$.jsx)(`path`,{d:`m3.5 12 8.5 4.5 8.5-4.5`}),(0,$.jsx)(`path`,{d:`m3.5 16.5 8.5 4.5 8.5-4.5`})]})}function di(e){return e?e.split(`-`).join(`/`):`—`}function fi(e){let{tasks:t,enabled:n,error:r}=e,i=x(),[a,o]=(0,X.useState)(1),s=Ir(hr(t),a,5),c;return c=n?r?(0,$.jsx)(Kr,{message:r}):s.total?(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsx)(`div`,{className:`tw-dash-scroll min-h-0 flex-1 overflow-auto`,children:(0,$.jsxs)(`table`,{className:`w-full min-w-[440px] table-fixed border-collapse text-[12px]`,children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{}),(0,$.jsx)(`col`,{style:{width:80}}),(0,$.jsx)(`col`,{style:{width:100}}),(0,$.jsx)(`col`,{style:{width:84}}),(0,$.jsx)(`col`,{style:{width:84}})]}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{className:Xr,children:`任务描述`}),(0,$.jsx)(`th`,{className:Xr,children:`任务状态`}),(0,$.jsx)(`th`,{className:Xr,children:`重要紧急程度`}),(0,$.jsx)(`th`,{className:Xr,children:`开始日期`}),(0,$.jsx)(`th`,{className:Xr,children:`结束日期`})]})}),(0,$.jsx)(`tbody`,{children:s.items.map(e=>{let t=!!e.dueDate&&e.dueDate<i;return(0,$.jsxs)(`tr`,{className:`border-b border-stone-100 transition-colors last:border-0 hover:bg-stone-50`,children:[(0,$.jsx)(`td`,{className:Zr,children:(0,$.jsx)(qr,{text:e.title,className:`text-stone-700`})}),(0,$.jsx)(`td`,{className:Zr,children:(0,$.jsx)(Qr,{status:e.status,label:ee[e.status]})}),(0,$.jsx)(`td`,{className:Zr,children:(0,$.jsx)($r,{priority:e.priority,label:e.priority?k[e.priority]:`—`})}),(0,$.jsx)(`td`,{className:`${Zr} whitespace-nowrap text-[11px] text-stone-400 tabular-nums`,children:di(e.startDate)}),(0,$.jsx)(`td`,{className:`${Zr} whitespace-nowrap text-[11px] tabular-nums ${t?`text-[#c02a26]`:`text-stone-400`}`,children:di(e.dueDate)})]},e.id)})})]})}),(0,$.jsx)(ei,{page:s.page,pages:s.pages,total:s.total,onPage:o})]}):(0,$.jsx)(Wr,{children:`没有进行中的任务`}):(0,$.jsx)(Gr,{name:`任务管理`,detail:`启用后这里会显示进行中的任务`}),(0,$.jsx)(Ur,{title:`进行中任务列表`,icon:(0,$.jsx)(ri,{}),tone:`indigo`,href:`tasks/`,action:`打开任务`,children:c})}var pi={today:`今天`,offWork:`下班`,weekend:`周末`,year:`今年`},mi={today:`距离今天结束`,offWork:`距离下班`,weekend:`距离下一个休息日`,year:`距离今年结束`},hi={offWork:{fallback:Dr,pref:`dashboard.offWork`,label:`下班时间`},weekend:{fallback:Or,pref:`dashboard.weekendTime`,label:`周末开始时间`}};function gi(){let[e,t]=(0,X.useState)(()=>new Date),[n,r]=(0,X.useState)(bn),[i,a]=(0,X.useState)(()=>u(`dashboard.countdown`,Er,`weekend`)),[o,s]=(0,X.useState)(()=>({offWork:f(`dashboard.offWork`,``),weekend:f(`dashboard.weekendTime`,``)})),[l,p]=(0,X.useState)(()=>i===`offWork`&&!kr(f(`dashboard.offWork`,``))?`offWork`:null),[m,h]=(0,X.useState)(()=>kr(f(`dashboard.offWork`,``))??`18:00`),g=(0,X.useRef)(`weekend`),_=(0,X.useRef)(null);(0,X.useEffect)(()=>{let e=!0;return En().then(t=>{e&&r(t)}),()=>{e=!1}},[]),(0,X.useEffect)(()=>{let e=window.setInterval(()=>t(new Date),1e3);return()=>window.clearInterval(e)},[]);let v=e=>{let t=hi[e];t&&(g.current=e===i?e:i,h(kr(o[e])??t.fallback),p(e))};(0,X.useEffect)(()=>{l&&_.current?.focus()},[l]);let y=()=>{let e=l?hi[l]:null,t=kr(m);if(!e||!t)return;let n=l;s(e=>({...e,[n]:t})),d(e.pref,t),p(null)},b=()=>{let e=l;p(null),e===`offWork`&&!kr(o.offWork)&&(a(g.current),c(`dashboard.countdown`,g.current))},x=Nr(e,n,i,o.offWork,o.weekend),S=e=>String(e).padStart(2,`0`),C=[{value:x.days,label:`天`},{value:x.hours,label:`时`},{value:x.minutes,label:`分`},{value:x.seconds,label:`秒`}],w=hi[i],T=l===i&&!!w;return(0,$.jsxs)(`section`,{className:`tw-dash-surface flex h-full min-h-0 flex-col overflow-hidden rounded-2xl border border-stone-200 bg-white p-4`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center gap-2`,children:[(0,$.jsx)(Hr,{tone:`amber`,children:(0,$.jsx)(ii,{})}),(0,$.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold tracking-tight text-stone-900`,children:x.title}),(0,$.jsx)(`div`,{role:`group`,"aria-label":`倒计时目标`,className:`flex shrink-0 items-center gap-0.5 rounded-lg bg-stone-100 p-0.5`,children:Er.map(e=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":i===e,"aria-label":mi[e],onClick:()=>{let t=i;a(e),c(`dashboard.countdown`,e),e===`offWork`&&!kr(o.offWork)?v(t):p(null)},className:`h-6 rounded-md px-1.5 text-[10px] leading-4 transition-colors ${i===e?`bg-white font-medium text-stone-900 shadow-sm`:`text-stone-500 hover:text-stone-800`}`,children:pi[e]},e))})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex min-h-0 flex-1 flex-col justify-center gap-1.5 overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`tw-countdown-tile grid grid-cols-4 gap-1.5`,children:C.map(e=>(0,$.jsxs)(`div`,{className:`tw-countdown-block`,children:[(0,$.jsx)(`span`,{className:`tw-countdown-num`,children:S(e.value)}),(0,$.jsx)(`span`,{className:`tw-countdown-unit`,children:e.label})]},e.label))}),w&&T?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`input`,{ref:_,type:`time`,value:m,"aria-label":w.label,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&y(),e.key===`Escape`&&b()},className:`h-6 min-w-0 flex-1 rounded-md border border-stone-200 bg-white px-1.5 text-[11px] text-stone-700 tabular-nums`}),(0,$.jsx)(`button`,{type:`button`,onClick:y,className:`h-6 shrink-0 rounded-md bg-[#3370ff] px-2 text-[10px] font-medium text-white transition-colors hover:bg-[#2b5fd9]`,children:`确定`}),(0,$.jsx)(`button`,{type:`button`,onClick:b,className:`h-6 shrink-0 rounded-md px-1.5 text-[10px] text-stone-500 transition-colors hover:bg-stone-100 hover:text-stone-700`,children:`取消`})]}):w?(0,$.jsxs)(`button`,{type:`button`,onClick:()=>v(i),"aria-label":`修改${w.label}`,className:`tw-countdown-edit group flex min-w-0 shrink-0 items-center gap-1 text-left`,children:[(0,$.jsx)(`span`,{className:`truncate text-[10px] leading-4 text-stone-400`,children:x.note}),(0,$.jsx)(`span`,{className:`tw-countdown-edit-hint shrink-0 text-[10px] leading-4`,children:`修改`})]}):(0,$.jsx)(`p`,{className:`truncate text-[10px] leading-4 text-stone-400`,children:x.note})]})]})}function _i(e){let{label:t,icon:n,tone:r,value:i,rate:a,bar:o,hint:s,href:c,danger:l,disabled:u,pluginLink:d=!0}=e,f=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`tw-dash-ico`,"data-tone":r,"aria-hidden":`true`,children:n}),(0,$.jsx)(`span`,{className:`truncate text-[13px] font-medium text-stone-500`,children:t})]}),(0,$.jsxs)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col justify-center`,children:[(0,$.jsx)(`div`,{className:`min-h-0`,children:a===void 0?(0,$.jsx)(`p`,{className:`text-[30px] leading-9 font-semibold tracking-tight tabular-nums ${u?`text-stone-300`:l?`text-[#c02a26]`:`text-stone-900`}`,children:i}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`p`,{className:`text-[30px] leading-9 font-semibold tracking-tight text-stone-900 tabular-nums`,children:[a,(0,$.jsx)(`span`,{className:`ml-0.5 text-sm font-normal text-stone-400`,children:`%`})]}),(0,$.jsx)(`div`,{className:`tw-dash-track mt-2 h-1.5 w-full overflow-hidden rounded-full`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full transition-[width] ${o??`bg-[#3370ff]`}`,style:{width:`${Math.min(100,Math.max(0,a))}%`}})})]})}),s?(0,$.jsx)(`p`,{className:`shrink-0 truncate pt-1.5 text-[11px] text-stone-400`,children:s}):null,u&&d?(0,$.jsx)(`a`,{href:`/plugins/`,className:`mt-1 inline-block text-[11px] font-medium text-[#3370ff] hover:underline`,children:`去开启`}):null]})]}),p=`tw-metric-card flex h-full min-h-0 flex-col overflow-hidden rounded-2xl p-4 ${u?`border border-dashed border-stone-200 bg-transparent`:`tw-dash-surface border border-stone-200 bg-white`}`;return c?(0,$.jsx)(`a`,{href:`/${c}`,"data-tone":r,className:p,children:f}):(0,$.jsx)(`div`,{"data-tone":r,className:p,children:f})}function vi({projects:e,enabled:t,error:n}){let r=(0,X.useMemo)(()=>e.filter(e=>e.status===`in_progress`).length,[e]);return(0,$.jsx)(_i,{label:`活跃项目`,tone:`violet`,icon:(0,$.jsx)(li,{}),value:t&&!n?r:`—`,hint:t?n?`项目管理服务未就绪`:`共 ${e.length} 个项目`:`项目列表未开启`,href:`pm/projects/`,disabled:!t})}function yi({todos:e,enabled:t}){let n=fr(e,[]),r=t&&n.overdue>0;return(0,$.jsx)(_i,{label:`已逾期`,tone:`red`,icon:(0,$.jsx)(si,{}),value:t?n.overdue:`—`,hint:t?r?`需要关注`:`一切正常`:`「待办事项」插件未启用`,href:t?`todos/`:void 0,danger:r,disabled:!t})}function bi({total:e,activeName:t}){return(0,$.jsx)(_i,{label:`数据空间`,tone:`indigo`,icon:(0,$.jsx)(ui,{}),value:e??`—`,hint:t?`当前:${t}`:`本地服务未就绪`,disabled:e===null,pluginLink:!1})}function xi({tasks:e,enabled:t}){let n=fr([],e);return(0,$.jsx)(_i,{label:`进行中任务`,tone:`indigo`,icon:(0,$.jsx)(ri,{}),value:t?n.taskInProgress:`—`,hint:t?`共 ${n.taskTotal} 个任务`:`「任务管理」插件未启用`,href:t?`tasks/`:void 0,disabled:!t})}function Si({tasks:e,enabled:t}){let n=fr([],e);return(0,$.jsx)(_i,{label:`任务完成率`,tone:`violet`,icon:(0,$.jsx)(ci,{}),rate:t?n.taskRate:void 0,value:`—`,bar:`bg-[#34c724]`,hint:t?`${n.taskDone} / ${n.taskTotal}`:`「任务管理」插件未启用`,href:t?`tasks/`:void 0,disabled:!t})}function Ci({todos:e,enabled:t}){let n=fr(e,[]);return(0,$.jsx)(_i,{label:`进行中待办`,tone:`blue`,icon:(0,$.jsx)(ni,{}),value:t?n.todoInProgress:`—`,hint:t?`共 ${n.todoTotal} 条待办`:`「待办事项」插件未启用`,href:t?`todos/`:void 0,disabled:!t})}function wi({todos:e,enabled:t}){let n=fr(e,[]);return(0,$.jsx)(_i,{label:`待办完成率`,tone:`emerald`,icon:(0,$.jsx)(ci,{}),rate:t?n.todoRate:void 0,value:`—`,bar:`bg-[#3370ff]`,hint:t?`${n.todoDone} / ${n.todoTotal}`:`「待办事项」插件未启用`,href:t?`todos/`:void 0,disabled:!t})}function Ti(e){let{items:t,enabled:n,error:r}=e,i=Pr(t,10),a=Fr(i.reduce((e,t)=>Math.max(e,t.count),0),3),o=a[a.length-1]??1,s;return s=n?r?(0,$.jsx)(Kr,{message:r}):i.length?(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 text-[11px] leading-4 text-stone-500`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-[#3370ff]`,"aria-hidden":`true`}),`统计数量`]}),(0,$.jsxs)(`div`,{className:`mt-8 flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(`div`,{className:`relative min-h-[88px] flex-1`,children:[(0,$.jsx)(`div`,{className:`absolute inset-y-0 left-0 w-8`,"aria-hidden":`true`,children:a.map(e=>(0,$.jsx)(`span`,{className:`absolute right-1 -translate-y-1/2 text-[10px] leading-none text-stone-400 tabular-nums`,style:{bottom:`${e/o*100}%`},children:e},e))}),(0,$.jsxs)(`div`,{className:`absolute inset-y-0 left-9 right-0`,children:[a.map(e=>(0,$.jsx)(`div`,{className:`absolute inset-x-0 border-t border-stone-100`,style:{bottom:`${e/o*100}%`},"aria-hidden":`true`},e)),(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-end gap-1.5`,children:i.map(e=>(0,$.jsx)(`div`,{className:`flex h-full min-w-0 flex-1 items-end justify-center`,children:(0,$.jsx)(`div`,{className:`group/bar relative w-full max-w-8 rounded-t-[3px] bg-[#3370ff]`,style:{height:e.count>0?`${e.count/o*100}%`:`1px`},children:(0,$.jsx)(`span`,{className:`absolute bottom-full left-1/2 mb-1 -translate-x-1/2 text-[10px] leading-none text-[#3370ff] tabular-nums`,children:e.count})})},e.dimension))})]})]}),(0,$.jsx)(`div`,{className:`mt-3 flex shrink-0 gap-1.5 pl-9`,children:i.map(e=>(0,$.jsx)(`div`,{className:`min-w-0 flex-1 text-center`,children:(0,$.jsx)(qr,{text:e.dimension,className:`text-[10px] leading-4 text-stone-400`})},e.dimension))})]})]}):(0,$.jsx)(Wr,{children:`还没有测试统计数据`}):(0,$.jsx)(Gr,{name:`测试统计`,detail:`启用后这里会按维度显示最新一天的数量`}),(0,$.jsx)(Ur,{title:`测试统计`,icon:(0,$.jsx)(ai,{}),tone:`emerald`,href:`test-stats/`,action:`打开测试统计`,children:s})}function Ei(e){let{todos:t,enabled:n,error:r,onToggle:i}=e,[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(1),l=x(),u=Ir(mr(t,l),s,5),d;return d=n?r?(0,$.jsx)(Kr,{message:r}):u.total?(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsx)(`div`,{className:`tw-dash-scroll min-h-0 flex-1 overflow-auto`,children:(0,$.jsxs)(`table`,{className:`w-full min-w-[440px] table-fixed border-collapse text-[12px]`,children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{}),(0,$.jsx)(`col`,{style:{width:80}}),(0,$.jsx)(`col`,{style:{width:100}}),(0,$.jsx)(`col`,{style:{width:84}}),(0,$.jsx)(`col`,{style:{width:84}})]}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{className:Xr,children:`待办名称`}),(0,$.jsx)(`th`,{className:Xr,children:`待办状态`}),(0,$.jsx)(`th`,{className:Xr,children:`所属任务`}),(0,$.jsx)(`th`,{className:Xr,children:`开始日期`}),(0,$.jsx)(`th`,{className:Xr,children:`截止日期`})]})}),(0,$.jsx)(`tbody`,{children:u.items.map(e=>{let t=a===e.id,n=S(e,l);return(0,$.jsxs)(`tr`,{className:`border-b border-stone-100 transition-colors last:border-0 hover:bg-stone-50`,children:[(0,$.jsx)(`td`,{className:Zr,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,disabled:t,"aria-label":`标记完成 ${e.title}`,onClick:()=>{o(e.id),i(e).finally(()=>o(null))},className:`group/tick flex h-4 w-4 shrink-0 items-center justify-center rounded-full border border-stone-300 transition-colors hover:border-[#3370ff] focus-visible:border-[#3370ff] disabled:opacity-40`,children:(0,$.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-[#3370ff] transition-opacity ${t?`animate-pulse opacity-100`:`opacity-0 group-hover/tick:opacity-100 group-focus-visible/tick:opacity-100`}`})}),(0,$.jsx)(qr,{text:e.title,className:`min-w-0 text-stone-700`})]})}),(0,$.jsx)(`td`,{className:Zr,children:(0,$.jsx)(Qr,{status:n,label:E[n]})}),(0,$.jsx)(`td`,{className:Zr,children:e.linkedTask?(0,$.jsx)(qr,{text:e.linkedTask,className:`rounded-md bg-stone-100 px-1.5 py-0.5 text-[10px] text-stone-500`}):(0,$.jsx)(`span`,{className:`text-stone-300`,children:`—`})}),(0,$.jsx)(`td`,{className:`${Zr} whitespace-nowrap text-[11px] text-stone-400 tabular-nums`,children:di(e.startDate)}),(0,$.jsx)(`td`,{className:`${Zr} whitespace-nowrap text-[11px] tabular-nums ${n===`overdue`?`text-[#c02a26]`:`text-stone-400`}`,children:di(e.dueDate)})]},e.id)})})]})}),(0,$.jsx)(ei,{page:u.page,pages:u.pages,total:u.total,onPage:c})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-1 py-6 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm text-stone-400`,children:`今天没有进行中的待办`}),(0,$.jsx)(`a`,{href:`/todos/`,className:`text-xs text-stone-400 hover:underline`,children:`打开待办事项`})]}):(0,$.jsx)(Gr,{name:`待办事项`,detail:`启用后这里会显示今天进行中的待办`}),(0,$.jsx)(Ur,{title:`今日待办`,icon:(0,$.jsx)(ni,{}),tone:`blue`,href:`todos/`,action:`打开待办`,children:d})}var Di=[`一`,`二`,`三`,`四`,`五`,`六`,`日`],Oi=0,ki=34,Ai=Array.from({length:24},(e,t)=>Oi+t),ji=[{id:`day`,label:`日`},{id:`week`,label:`周`},{id:`month`,label:`月`}],Mi=ji.map(e=>e.id),Ni=[`blue`,`green`,`purple`,`orange`,`cyan`,`pink`,`lime`,`indigo`];function Pi(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return`tw-cal-tone-${Ni[t%Ni.length]}`}function Fi(e){return w(e.status)?`tw-cal-pill--done`:Pi(e.id)}function Ii(e){return w(e.status)?void 0:Li[e.priority]}var Li={urgent_important:`#e5484d`,important:`#f5a524`,urgent:`#e3b341`,normal:`#3370ff`,"":`#c7c7cc`},Ri=18,zi=28,Bi=15;function Vi(e){return String(e).padStart(2,`0`)}function Hi(e){return Number(e.slice(8,10))}function Ui(e){let[t,n,r]=e.split(`-`).map(Number);return(new Date(t??1970,(n??1)-1,r??1).getDay()+6)%7}function Wi(e){let[t,n]=e.split(`-`).map(Number);return`${t}年${n}月`}function Gi(e){let t=e[0]??``,n=e[e.length-1]??``,[r,i,a]=t.split(`-`).map(Number),[o,s,c]=n.split(`-`).map(Number);return t===n?`${r}年${i}月${a}日(周${Di[Ui(t)]})`:r===o?i===s?`${r}年${i}月${a}日 – ${c}日`:`${r}年${i}月${a}日 – ${s}月${c}日`:`${r}年${i}月${a}日 – ${o}年${s}月${c}日`}function Ki(e){let[,t,n]=e.split(`-`).map(Number);return`${t}月${n}日 周${Di[Ui(e)]??``}`}var qi=288;function Ji({state:e,todos:t,today:n,onClose:r}){let{day:i,detailId:a}=e,o=(0,X.useRef)(null),[s,c]=(0,X.useState)(a);(0,X.useEffect)(()=>c(a),[i,a]);let l=(0,X.useMemo)(()=>O(t.filter(e=>zr(e,i))),[t,i]),u=s?l.find(e=>e.id===s)??null:null;return(0,X.useEffect)(()=>{let e=e=>{o.current&&e.target instanceof Node&&!o.current.contains(e.target)&&r()},t=e=>{e.key===`Escape`&&c(e=>(e||r(),null))},n=()=>r(),i=e=>{o.current&&e.target instanceof Node&&o.current.contains(e.target)||r()};return document.addEventListener(`mousedown`,e,!0),document.addEventListener(`keydown`,t),document.addEventListener(`scroll`,i,!0),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`mousedown`,e,!0),document.removeEventListener(`keydown`,t),document.removeEventListener(`scroll`,i,!0),window.removeEventListener(`resize`,n)}},[r]),(0,et.createPortal)((0,$.jsxs)(`div`,{ref:o,role:`dialog`,"aria-label":u?u.title:`${Ki(i)} 的待办`,className:`tw-cal-pop`,style:{left:e.left,top:e.top,bottom:e.bottom},children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`tw-cal-pop-arrow tw-cal-pop-arrow--${e.arrowSide}`,style:{left:e.arrowX}}),(0,$.jsxs)(`div`,{className:`tw-cal-pop-head`,children:[u?(0,$.jsx)(`button`,{type:`button`,"aria-label":`返回当天待办`,onClick:()=>c(null),className:`tw-cal-pop-icon`,children:`‹`}):null,(0,$.jsx)(`span`,{className:`tw-cal-pop-title`,children:u?u.title:Ki(i)}),u?null:(0,$.jsxs)(`span`,{className:`tw-cal-pop-count`,children:[l.length,` 条`]}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`关闭`,onClick:r,className:`tw-cal-pop-icon`,children:`×`})]}),u?(0,$.jsxs)(`div`,{className:`tw-cal-pop-detail`,children:[(0,$.jsxs)(`div`,{className:`tw-cal-pop-field`,children:[(0,$.jsx)(`span`,{className:`tw-cal-pop-label`,children:`待办名称`}),(0,$.jsx)(`span`,{className:`tw-cal-pop-value`,children:u.title})]}),(0,$.jsxs)(`div`,{className:`tw-cal-pop-field`,children:[(0,$.jsx)(`span`,{className:`tw-cal-pop-label`,children:`待办状态`}),(0,$.jsx)(`span`,{children:(0,$.jsx)(Qr,{status:S(u,n),label:E[S(u,n)]})})]}),u.priority?(0,$.jsxs)(`div`,{className:`tw-cal-pop-field`,children:[(0,$.jsx)(`span`,{className:`tw-cal-pop-label`,children:`重要紧急程度`}),(0,$.jsx)(`span`,{children:(0,$.jsx)($r,{priority:u.priority,label:M[u.priority]})})]}):null,(0,$.jsxs)(`div`,{className:`tw-cal-pop-dates`,children:[(0,$.jsxs)(`div`,{className:`tw-cal-pop-field`,children:[(0,$.jsx)(`span`,{className:`tw-cal-pop-label`,children:`开始日期`}),(0,$.jsx)(`span`,{className:`tw-cal-pop-value`,children:di(u.startDate)})]}),(0,$.jsxs)(`div`,{className:`tw-cal-pop-field`,children:[(0,$.jsx)(`span`,{className:`tw-cal-pop-label`,children:`截止日期`}),(0,$.jsx)(`span`,{className:`tw-cal-pop-value`,children:di(u.dueDate)})]})]}),u.note?(0,$.jsxs)(`div`,{className:`tw-cal-pop-field`,children:[(0,$.jsx)(`span`,{className:`tw-cal-pop-label`,children:`备注`}),(0,$.jsx)(`span`,{className:`tw-cal-pop-value tw-cal-pop-note`,children:u.note})]}):null]}):l.length===0?(0,$.jsx)(`p`,{className:`tw-cal-pop-empty`,children:`这一天没有待办`}):(0,$.jsx)(`div`,{className:`tw-cal-pop-list`,children:l.map(e=>{let t=S(e,n);return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>c(e.id),className:`tw-cal-pop-row`,children:[(0,$.jsx)(`span`,{className:`tw-cal-pop-bar`,style:{background:w(e.status)?`#d1d5db`:Li[e.priority]}}),(0,$.jsx)(`span`,{className:`tw-cal-pop-row-title`,children:e.title}),t===`overdue`?(0,$.jsx)(`span`,{className:`tw-cal-pop-tag tw-cal-pop-tag--overdue`,children:E.overdue}):w(e.status)?(0,$.jsx)(`span`,{className:`tw-cal-pop-tag`,children:E[e.status]}):null]},e.id)})})]}),document.body)}function Yi({days:e,today:t,now:n}){let r=(0,X.useRef)(null),[i,a]=(0,X.useState)(0),o=e.indexOf(t),s=ki*Ai.length,c=i>0?Math.max(ki,Math.floor(i/Ai.length)):ki,l=i>s?i-c*Ai.length:0,u=e=>e===23?c+l:c,d=c*Ai.length+l,f=i>0&&d<=i+1,p=(n.getHours()*60+n.getMinutes()-0)/60*c,m=p>=0&&p<=d,h=`44px repeat(${e.length}, minmax(0, 1fr))`;return(0,X.useEffect)(()=>{let e=r.current;if(!e)return;let t=()=>a(e.clientHeight);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,X.useEffect)(()=>{let e=r.current;e&&(e.scrollTop=!f&&o>=0&&m?Math.max(0,p-80):0)},[e.length,i,f]),(0,$.jsx)(`div`,{ref:r,className:`tw-dash-scroll min-h-[120px] flex-1 ${f?`overflow-hidden`:`overflow-y-auto`}`,children:(0,$.jsxs)(`div`,{className:`relative grid`,style:{gridTemplateColumns:h},children:[Ai.map(t=>(0,$.jsxs)(`div`,{className:`contents`,children:[(0,$.jsx)(`div`,{className:`relative`,style:{height:u(t)},children:(0,$.jsxs)(`span`,{className:`absolute -top-1.5 right-1.5 text-[10px] text-stone-400 tabular-nums`,children:[Vi(t),`:00`]})}),e.map(e=>(0,$.jsx)(`div`,{className:`border-t border-l border-stone-100`,style:{height:u(t)}},`${e}-${t}`))]},t)),o>=0&&m?(0,$.jsxs)(`div`,{className:`pointer-events-none absolute flex items-center`,style:{top:p,left:`calc(44px + (100% - 44px) * ${o} / ${e.length})`,width:`calc((100% - 44px) / ${e.length})`},children:[(0,$.jsxs)(`span`,{className:`absolute right-full mr-1 text-[10px] text-[#f54a45] tabular-nums`,children:[Vi(n.getHours()),`:`,Vi(n.getMinutes())]}),(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[#f54a45]`}),(0,$.jsx)(`span`,{className:`h-px flex-1 bg-[#f54a45]`})]}):null]})})}function Xi(e){let{todos:t,enabled:n,error:r}=e,i=x(),[a,o]=(0,X.useState)(()=>u(`dashboard.calendar`,Mi,`week`)),[s,l]=(0,X.useState)(i),[d,f]=(0,X.useState)(()=>new Date),[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(0);(0,X.useEffect)(()=>{if(!h)return;let e=()=>v(h.clientHeight);if(e(),typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e);return t.observe(h),()=>t.disconnect()},[h]),(0,X.useEffect)(()=>{let e=window.setInterval(()=>f(new Date),3e4);return()=>window.clearInterval(e)},[]);let y=()=>m(null),b=a===`month`?Sr(s):a===`day`?[s]:Cr(s),S=Lr(t,b),C=Math.min(S.lanes,a===`day`?6:3),w=`44px repeat(${b.length}, minmax(0, 1fr))`,T=e=>{m(null),l(a===`month`?xr(s,e):yr(s,e*(a===`week`?7:1)))},E=(e,t,n=null)=>{if(!t)return;let r=t.getBoundingClientRect(),i=window.innerHeight-r.bottom,a=r.top,o=i<300&&a>i,s=Math.min(Math.max(8,r.left+r.width/2-qi/2),Math.max(8,window.innerWidth-qi-8)),c=Math.round(Math.min(268,Math.max(20,r.left+r.width/2-s)));m({day:e,detailId:n,left:s,arrowX:c,arrowSide:o?`bottom`:`top`,top:o?void 0:r.bottom+10,bottom:o?Math.max(8,window.innerHeight-r.top+10):void 0})},D;if(!n)D=(0,$.jsx)(Gr,{name:`待办事项`,detail:`启用后这里会按截止日期显示待办日历`});else if(r)D=(0,$.jsx)(Kr,{message:r});else if(a===`month`){let e=Number(s.slice(5,7)),n=Rr(t,b),r=_>0?_/n.length:0,a=Math.max(1,Math.min(4,Math.floor((r-zi-4)/18)));D=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsx)(`div`,{className:`grid shrink-0 grid-cols-7 border-b border-stone-200 pb-1.5`,children:Di.map(e=>(0,$.jsxs)(`span`,{className:`text-center text-[11px] text-stone-400`,children:[`周`,e]},e))}),(0,$.jsx)(`div`,{ref:g,className:`grid min-h-0 flex-1`,style:{gridTemplateRows:`repeat(${n.length}, minmax(0, 1fr))`},children:n.map(({days:t,spans:n})=>{let r=n.filter(e=>e.lane<a),o=n.filter(e=>e.lane>=a);return(0,$.jsxs)(`div`,{className:`relative flex min-h-0 flex-col border-t border-stone-100`,children:[(0,$.jsx)(`div`,{className:`grid shrink-0 grid-cols-7`,children:t.map(t=>{let n=Number(t.slice(5,7))!==e;return(0,$.jsx)(`button`,{type:`button`,onClick:e=>E(t,e.currentTarget),className:`flex h-7 min-w-0 items-center px-1.5 text-left transition-colors hover:bg-stone-50`,children:(0,$.jsx)(`span`,{className:`flex h-5 min-w-5 items-center justify-center rounded-full px-1 text-[11px] tabular-nums ${t===i?`bg-[#3370ff] font-semibold text-white`:n?`text-stone-300`:`text-stone-500`}`,children:Hi(t)})},t)})}),(0,$.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-0 grid grid-cols-7`,children:t.map(e=>(0,$.jsx)(`div`,{className:`border-l border-stone-100`},e))}),r.map(({item:e,start:n,end:r,lane:a})=>(0,$.jsx)(`button`,{type:`button`,onClick:r=>E(t[n]??i,r.currentTarget,e.id),className:`tw-cal-bar absolute flex items-center text-left ${Fi(e)}`,style:{top:a*18,left:`calc(100% * ${n} / 7)`,width:`calc(100% * ${r-n+1} / 7)`,height:Bi,borderLeftColor:Ii(e)},children:(0,$.jsx)(`span`,{className:`truncate px-1`,children:e.title})},e.id)),o.length>0?(0,$.jsxs)(`button`,{type:`button`,onClick:e=>{let n=o[0];E(t[n.start]??i,e.currentTarget)},className:`absolute right-1 bottom-0 rounded bg-white/85 px-1 text-[10px] leading-4 text-stone-400 transition-colors hover:text-[#3370ff]`,children:[`+`,o.length]}):null]})]},t[0])})})]})}else D=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(`div`,{className:`grid shrink-0 border-b border-stone-200`,style:{gridTemplateColumns:w},children:[(0,$.jsx)(`div`,{}),b.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:t=>E(e,t.currentTarget),className:`flex flex-col items-center gap-0.5 py-1 transition-colors hover:bg-stone-50`,children:[(0,$.jsxs)(`span`,{className:`text-[11px] text-stone-400`,children:[`周`,Di[Ui(e)]??``]}),(0,$.jsx)(`span`,{className:`flex h-7 w-7 items-center justify-center rounded-full text-[13px] tabular-nums ${e===i?`bg-[#3370ff] font-semibold text-white`:`font-medium text-stone-700`}`,children:Hi(e)})]},e))]}),(0,$.jsxs)(`div`,{className:`relative shrink-0 border-b border-stone-200`,children:[(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 right-0 left-[44px] grid`,style:{gridTemplateColumns:`repeat(${b.length}, minmax(0, 1fr))`},children:b.map(e=>(0,$.jsx)(`div`,{className:`border-l border-stone-100`},e))}),(0,$.jsxs)(`div`,{className:`flex items-start`,children:[(0,$.jsx)(`div`,{className:`flex h-[22px] w-11 shrink-0 items-center justify-end pr-1.5 text-[10px] text-stone-400`,children:`全天`}),(0,$.jsx)(`div`,{className:`relative min-w-0 flex-1 overflow-hidden`,style:{height:Math.max(1,C)*21},children:S.spans.filter(e=>e.lane<C).map(({item:e,start:t,end:n,lane:r})=>{let a=n-t+1;return(0,$.jsx)(`button`,{type:`button`,onClick:n=>E(b[t]??i,n.currentTarget,e.id),className:`tw-cal-bar absolute flex items-center gap-1 text-left ${Fi(e)}`,style:{top:r*21,left:`calc(100% * ${t} / ${b.length})`,width:`calc(100% * ${a} / ${b.length})`,height:Ri,borderLeftColor:Ii(e)},children:(0,$.jsx)(`span`,{className:`truncate px-1`,children:e.title})},e.id)})})]})]}),(0,$.jsx)(Yi,{days:b,today:i,now:d})]});return(0,$.jsxs)(Ur,{title:`待办日历`,icon:(0,$.jsx)(oi,{}),tone:`violet`,href:`todos/`,action:`打开待办`,fill:!0,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex shrink-0 flex-wrap items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>{m(null),l(i)},className:`h-7 rounded-lg border border-stone-200 bg-white px-2.5 text-xs font-medium text-stone-600 transition-colors hover:bg-stone-50 hover:text-stone-900`,children:`今天`}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`上一页`,onClick:()=>T(-1),className:`flex h-7 w-7 items-center justify-center rounded-lg text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-700`,children:`‹`}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`下一页`,onClick:()=>T(1),className:`flex h-7 w-7 items-center justify-center rounded-lg text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-700`,children:`›`}),(0,$.jsx)(`span`,{className:`ml-1 text-[13px] font-semibold text-stone-800 tabular-nums`,children:a===`month`?Wi(s):Gi(b)}),(0,$.jsx)(`div`,{className:`ml-auto flex items-center gap-0.5 rounded-lg bg-stone-100 p-0.5`,children:ji.map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>{m(null),o(e.id),c(`dashboard.calendar`,e.id)},className:`h-6 w-8 rounded-md text-[11px] transition-colors ${a===e.id?`bg-white font-medium text-stone-900 shadow-sm`:`text-stone-500 hover:text-stone-800`}`,children:e.label},e.id))})]}),D,p?(0,$.jsx)(Ji,{state:p,todos:t,today:i,onClose:y}):null]})}function Zi({id:e,data:t}){switch(e){case`todoInProgress`:return(0,$.jsx)(Ci,{todos:t.todos,enabled:t.todosOn});case`taskInProgress`:return(0,$.jsx)(xi,{tasks:t.tasks,enabled:t.tasksOn});case`overdue`:return(0,$.jsx)(yi,{todos:t.todos,enabled:t.todosOn});case`todoRate`:return(0,$.jsx)(wi,{todos:t.todos,enabled:t.todosOn});case`taskRate`:return(0,$.jsx)(Si,{tasks:t.tasks,enabled:t.tasksOn});case`activeProjects`:return(0,$.jsx)(vi,{projects:t.projects,enabled:t.projectsOn,error:t.errors.projects});case`spaces`:return(0,$.jsx)(bi,{total:t.spaces?.total??null,activeName:t.spaces?.activeName??``});case`countdown`:return(0,$.jsx)(gi,{});case`todayTodos`:return(0,$.jsx)(Ei,{todos:t.todos,enabled:t.todosOn,error:t.errors.todos,onToggle:t.onToggleTodo});case`activeTasks`:return(0,$.jsx)(fi,{tasks:t.tasks,enabled:t.tasksOn,error:t.errors.tasks});case`testChart`:return(0,$.jsx)(Ti,{items:t.stats,enabled:t.statsOn,error:t.errors.stats});case`todoCalendar`:return(0,$.jsx)(Xi,{todos:t.todos,enabled:t.todosOn,error:t.errors.todos})}}var Qi=15e3,$i=`dashboard.layout`,ea=`dashboard.scroll`,ta=760,na=[`日`,`一`,`二`,`三`,`四`,`五`,`六`];function ra(e){let t=e.getHours();return t<5?`夜深了`:t<9?`早上好`:t<12?`上午好`:t<14?`中午好`:t<18?`下午好`:t<23?`晚上好`:`夜深了`}function ia(e){return`${e.getFullYear()}年${e.getMonth()+1}月${e.getDate()}日 星期${na[e.getDay()]}`}function aa(e){return e instanceof Error?e.message:String(e)}async function oa(e,t,n,r){if(!e)return{ok:!0,items:r};if(!t)return{ok:!1,error:`本地服务未就绪`};try{return{ok:!0,items:await n()}}catch(e){return{ok:!1,error:aa(e)}}}function sa(){return(0,$.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,"aria-hidden":`true`,children:[6.5,9.5].map(e=>[5,8,11].map(t=>(0,$.jsx)(`circle`,{cx:t,cy:e,r:`1.15`,fill:`currentColor`},`${t}-${e}`)))})}function ca(){return(0,$.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`11`,height:`11`,"aria-hidden":`true`,children:(0,$.jsx)(`path`,{d:`M3.5 8.5 6.5 11.5 12.5 4.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function la(){return(0,$.jsxs)(`svg`,{viewBox:`0 0 20 20`,width:`15`,height:`15`,"aria-hidden":`true`,children:[(0,$.jsx)(`rect`,{x:`2.5`,y:`2.5`,width:`6`,height:`6`,rx:`1.5`,fill:`currentColor`}),(0,$.jsx)(`rect`,{x:`11.5`,y:`2.5`,width:`6`,height:`6`,rx:`1.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`}),(0,$.jsx)(`rect`,{x:`2.5`,y:`11.5`,width:`6`,height:`6`,rx:`1.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`}),(0,$.jsx)(`rect`,{x:`11.5`,y:`11.5`,width:`6`,height:`6`,rx:`1.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`})]})}function ua(e){let{open:t,layout:n,onChange:r,onClose:i}=e,a=new Set(n.hidden),o=e=>{a.has(e)?r(cr({...n,hidden:n.hidden.filter(t=>t!==e)},e)):r({...n,hidden:[...n.hidden,e]})},s=jn.filter(e=>!a.has(e.id)).length;return(0,$.jsxs)(g,{open:t,onClose:i,transition:!0,className:`relative z-110`,children:[(0,$.jsx)(_,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,$.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,$.jsxs)(m,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim flex max-h-[85vh] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-stone-200 bg-white p-6 shadow-xl`,children:[(0,$.jsx)(h,{className:`tw-confirm-title shrink-0 text-base font-semibold text-stone-900`,children:`编辑组件`}),(0,$.jsx)(`p`,{className:`mt-1.5 shrink-0 text-[11px] leading-5 text-stone-400`,children:`点选要放进画布的组件;卡片按住顶部圆点拖到任意位置,拖右下角把手可独立改宽 / 改高,双击把手恢复默认大小。`}),(0,$.jsx)(`div`,{className:`mt-4 grid min-h-0 flex-1 auto-rows-min grid-cols-3 gap-2 overflow-y-auto pr-1`,children:jn.map(e=>{let t=!a.has(e.id);return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>o(e.id),"aria-pressed":t,className:`tw-widget-option`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`tw-widget-check`,children:(0,$.jsx)(ca,{})}),(0,$.jsx)(`span`,{className:`tw-widget-option-title min-w-0 truncate`,children:e.title})]}),(0,$.jsx)(`span`,{className:`tw-widget-option-desc pl-6`,children:e.desc})]},e.id)})}),(0,$.jsxs)(`div`,{className:`mt-5 flex shrink-0 items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(Kn(n)),className:`h-8 rounded-lg px-2.5 text-xs text-stone-500 transition-colors hover:bg-stone-100 hover:text-stone-700`,children:`全部添加`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(ur(n)),className:`h-8 rounded-lg px-2.5 text-xs text-stone-500 transition-colors hover:bg-stone-100 hover:text-stone-700`,children:`自动整理`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsxs)(`span`,{className:`text-[11px] text-stone-400 tabular-nums`,children:[`已添加 `,s,` / `,jn.length]}),(0,$.jsx)(`button`,{type:`button`,onClick:i,className:`h-8 rounded-lg bg-[#3370ff] px-4 text-sm font-medium text-white transition-colors hover:bg-[#2b5fd9]`,children:`完成`})]})]})]})})]})}function da(){let[e,t]=(0,X.useState)(!1),[n,r]=(0,X.useState)(!1),[c,u]=(0,X.useState)({todos:!1,tasks:!1,stats:!1,projects:!1}),[d,f]=(0,X.useState)([]),[m,h]=(0,X.useState)([]),[g,_]=(0,X.useState)([]),[v,x]=(0,X.useState)([]),[S,w]=(0,X.useState)(null),[E,D]=(0,X.useState)({}),[ee,O]=(0,X.useState)(!1),[k,M]=(0,X.useState)(null),[ie,ae]=(0,X.useState)(null),[P,F]=(0,X.useState)(null),[oe,se]=(0,X.useState)(0),[I,ce]=(0,X.useState)(()=>rr(p($i,null))),L=(0,X.useRef)(I);L.current=I,(0,X.useEffect)(()=>{l($i,L.current)},[]);let le=(0,X.useRef)(!0),ue=(0,X.useRef)(c);ue.current=c,(0,X.useEffect)(()=>(le.current=!0,()=>{le.current=!1,document.body.classList.remove(`tw-reordering`,`tw-resizing`)}),[]),(0,X.useEffect)(()=>{let e=ea,t=0;try{t=Number(window.sessionStorage.getItem(e)??0)||0}catch{t=0}if(t<=0){let t=!1,n=()=>{t||(t=!0,window.requestAnimationFrame(()=>{t=!1;try{window.sessionStorage.setItem(e,String(window.scrollY))}catch{}}))};return window.addEventListener(`scroll`,n,{passive:!0}),()=>window.removeEventListener(`scroll`,n)}let n=!1,r=!0,i=0,a=Date.now(),o=()=>{if(n)return;let e=Math.max(0,document.documentElement.scrollHeight-window.innerHeight);e+2>=t||i>=30?(window.scrollTo({top:Math.min(t,e),behavior:`instant`}),r=!1):(i+=1,window.setTimeout(o,100))};window.setTimeout(o,50);let s=()=>{if(!r&&!(window.scrollY===0&&Date.now()-a<1500))try{window.sessionStorage.setItem(e,String(window.scrollY))}catch{}};window.addEventListener(`scroll`,s,{passive:!0});let c=()=>{!n&&window.scrollY===0&&window.setTimeout(o,0)};return document.addEventListener(`astro:page-load`,c),()=>{n=!0,window.removeEventListener(`scroll`,s),document.removeEventListener(`astro:page-load`,c)}},[]);let de=(0,X.useRef)({todos:!1,tasks:!1,stats:!1,projects:!1}),R=(0,X.useCallback)(async()=>{if(!le.current)return;let e=ue.current,t=async(e,t,n)=>{if(!t)return!1;if(de.current[e])return!0;let r=await n();return de.current[e]=r,r},[n,r,i,a]=await Promise.all([t(`todos`,e.todos,N),t(`tasks`,e.tasks,A),t(`stats`,e.stats,ne),t(`projects`,e.projects,y)]),[o,s,c,l,u]=await Promise.all([oa(e.todos,n,C,[]),oa(e.tasks,r,j,[]),oa(e.stats,i,()=>te().then(e=>e.items),[]),oa(e.projects,a,()=>b().then(e=>e.projects),[]),re().then(e=>{if(!e)return null;let t=e.spaces.filter(e=>e.exists);return{total:t.length,activeName:t.find(e=>e.isActive)?.name??``}})]);le.current&&(o.ok?f(o.items):de.current.todos=!1,s.ok?h(s.items):de.current.tasks=!1,c.ok?_(c.items):de.current.stats=!1,l.ok?x(l.items):de.current.projects=!1,w(u),D({todos:o.ok?void 0:o.error,tasks:s.ok?void 0:s.error,stats:c.ok?void 0:c.error,projects:l.ok?void 0:l.error}))},[]);(0,X.useEffect)(()=>{let e=a(e=>{r(!!e.dashboard),u({todos:!!e.todos,tasks:!!e.tasks,stats:!!e.testStats,projects:!!e.projects})});return i().then(()=>{r(s(`dashboard`)),u({todos:s(`todos`),tasks:s(`tasks`),stats:s(`testStats`),projects:s(`projects`)}),t(!0)}),e},[]),(0,X.useEffect)(()=>{e&&n&&R()},[e,n,c.todos,c.tasks,c.stats,c.projects,R]),(0,X.useEffect)(()=>{if(!e||!n)return;let t=window.setInterval(()=>{document.hidden||R()},Qi),r=()=>{document.hidden||R()};return window.addEventListener(`focus`,r),document.addEventListener(`visibilitychange`,r),()=>{window.clearInterval(t),window.removeEventListener(`focus`,r),document.removeEventListener(`visibilitychange`,r)}},[e,n,R]);function z(e){let t=rr(e);L.current=t,ce(t),l($i,t)}let B=(0,X.useMemo)(()=>sr(I),[I]),fe=(0,X.useMemo)(()=>c.todos?fr(d,m).overdue:0,[c.todos,d,m]),pe=new Date,V=(0,$.jsxs)(`header`,{className:`mb-7 flex shrink-0 items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3.5`,children:[(0,$.jsx)(`span`,{className:`tw-dash-hero-icon`,"aria-hidden":`true`,children:(0,$.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`20`,height:`20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,$.jsx)(`path`,{d:`M12 3.2 13.9 9l5.8 1.9-5.8 1.9L12 18.6l-1.9-5.8L4.3 10.9 10.1 9Z`}),(0,$.jsx)(`path`,{d:`M18.5 4.2v2.6M17.2 5.5h2.6M6 16.5v2M5 17.5h2`})]})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`h1`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-1 text-[26px] font-semibold leading-9 tracking-tight text-stone-900`,children:[ra(pe),fe>0?(0,$.jsxs)(`span`,{className:`tw-dash-overdue text-sm font-medium`,children:[fe,` 项已延期`]}):null]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-stone-500`,children:ia(pe)})]})]}),(0,$.jsx)(`div`,{className:`shrink-0 pt-1`,children:e&&n?(0,$.jsxs)(`button`,{type:`button`,onClick:()=>O(!0),className:`inline-flex h-9 shrink-0 items-center gap-2 rounded-lg border border-stone-200 bg-white px-3.5 text-sm font-medium text-stone-700 shadow-sm transition-colors hover:bg-stone-50 hover:text-stone-900`,children:[(0,$.jsx)(`span`,{className:`text-[#3370ff]`,children:(0,$.jsx)(la,{})}),`编辑组件`]}):null})]});(0,X.useEffect)(()=>{if(!P)return;let e=()=>se(Math.round(P.getBoundingClientRect().width));if(e(),typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e);return t.observe(P),()=>t.disconnect()},[P]);let H=oe>0&&oe<ta,U=(0,X.useMemo)(()=>{let e=B.reduce((e,{rect:t})=>Math.max(e,t.y+t.h),0);return Math.max(49,e+40)},[B]),me=(0,X.useMemo)(()=>H?ar(I).map(({id:e,rect:t})=>({i:e,x:t.x,y:t.y,w:t.w,h:t.h,minW:12})):B.map(({id:e,rect:t})=>({i:e,x:t.x,y:t.y,w:t.w,h:t.h,minW:Rn(e),minH:Ln(e),maxH:49})),[B,H]);function he(e,t,n=`drag`,r=`down`){let i={...L.current.rects},a=!1;for(let t of e){if(!Pn(t.i))continue;let e=i[t.i];e&&e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h||(i[t.i]={x:t.x,y:t.y,w:t.w,h:t.h},a=!0)}if(!a)return;let o={...L.current,rects:i};z(t?lr(o,t,n,{direction:r}):o)}function W(e){let t={...L.current.rects},n=t[e],r=Wn(e);t[e]=n?{...r,x:n.x,y:n.y}:r,z(cr({...L.current,rects:t},e))}async function ge(e){let t=d;f(t=>t.map(t=>t.id===e.id?{...t,status:`done`,doneAt:new Date().toISOString()}:t));try{let t=await T(e.id,{status:`done`});if(!le.current)return;f(n=>n.map(n=>n.id===e.id?t:n)),D(e=>({...e,todos:void 0}))}catch(e){if(!le.current)return;f(t),D(t=>({...t,todos:aa(e)}))}}if(!e)return(0,$.jsxs)($.Fragment,{children:[V,(0,$.jsx)(`div`,{className:`tw-dash-surface flex min-h-[280px] flex-col overflow-hidden rounded-2xl border border-stone-200 bg-white`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,$.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})]});if(!n)return(0,$.jsxs)($.Fragment,{children:[V,(0,$.jsx)(`div`,{className:`tw-lib-notice rounded-2xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:o(`dashboard`)})]});let G;return G=B.length===0?(0,$.jsxs)(`div`,{className:`tw-dash-surface flex flex-col items-center justify-center gap-2 rounded-2xl border border-dashed border-stone-200 bg-white px-5 py-24 text-center`,children:[(0,$.jsx)(`span`,{className:`mb-1 flex h-10 w-10 items-center justify-center rounded-xl bg-stone-100 text-stone-400`,children:(0,$.jsx)(la,{})}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-stone-700`,children:`画布上还没有组件`}),(0,$.jsx)(`p`,{className:`text-xs text-stone-400`,children:`先挑要显示的卡片,之后布局会按当前空间记住`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>O(!0),className:`mt-2 h-8 rounded-lg bg-[#3370ff] px-3.5 text-xs font-medium text-white transition-colors hover:bg-[#2b5fd9]`,children:`添加组件`})]}):(0,$.jsx)(`div`,{ref:F,className:`tw-dash-grid w-full${H?` tw-dash-grid--stacked`:``}`,onMouseDown:e=>{e.target.closest(`.react-grid-item`)||M(null)},onDoubleClick:e=>{let t=e.target.closest(`.react-resizable-handle`);if(!t)return;let n=t.closest(`[data-sort-key]`)?.dataset.sortKey;Pn(n)&&W(n)},children:oe>0?(0,$.jsx)(pn,{width:oe,layout:me,gridConfig:{cols:12,rowHeight:20,margin:[0,0],containerPadding:[0,0],maxRows:U},compactor:Ue,dragConfig:{enabled:!H,handle:`.tw-dash-handle`,cancel:`.react-resizable-handle`},resizeConfig:{enabled:!H,handles:[`se`]},onDragStart:(e,t)=>{t&&Pn(t.i)&&(ae(t.i),M(t.i)),document.body.classList.add(`tw-reordering`)},onDragStop:(e,t)=>{document.body.classList.remove(`tw-reordering`),ae(null);let n=t&&Pn(t.i)?t.i:void 0,r=n?L.current.rects[n]:void 0,i=n?e.find(e=>e.i===n):void 0;he(e,n,`drag`,i&&r&&i.y<r.y?`up`:`down`)},onResizeStart:(e,t)=>{t&&Pn(t.i)&&(ae(t.i),M(t.i)),document.body.classList.add(`tw-resizing`)},onResizeStop:(e,t)=>{document.body.classList.remove(`tw-resizing`),ae(null),he(e,t&&Pn(t.i)?t.i:void 0)},children:B.map(({id:e,def:t})=>{let n=k===e,r=ie===e;return(0,$.jsx)(`div`,{"data-sort-key":e,className:`tw-dash-cell min-w-0 p-1.5`,onClick:()=>M(e),children:(0,$.jsxs)(`div`,{className:`tw-dash-card group relative h-full min-h-0 rounded-2xl ${n?`tw-dash-card-selected`:``} ${r?`tw-dash-card-selected opacity-70`:``}`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`拖动 ${t.title}`,draggable:!1,onDragStart:e=>e.preventDefault(),className:`tw-dash-handle absolute left-1/2 top-0 z-10 flex h-7 w-12 -translate-x-1/2 cursor-move touch-none items-center justify-center rounded-b-md text-stone-400 transition-[opacity,color,background-color] hover:bg-stone-100 hover:text-stone-600 focus-visible:opacity-100 ${n||r?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`}`,children:(0,$.jsx)(sa,{})}),(0,$.jsx)(Zi,{id:e,data:{todos:d,tasks:m,stats:g,projects:v,spaces:S,todosOn:c.todos,tasksOn:c.tasks,statsOn:c.stats,projectsOn:c.projects,errors:E,onToggleTodo:ge}})]})},e)})}):null}),(0,$.jsxs)($.Fragment,{children:[V,G,(0,$.jsx)(ua,{open:ee,layout:I,onChange:z,onClose:()=>O(!1)})]})}export{da as default};
|
|
5
|
+
`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&ue(e.body,`react-draggable-transparent-selection`)}function L(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{le(e)}):le(e)}function le(e){if(e)try{e.body&&de(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function ue(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function de(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function R(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:U(r);let i=me(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+S(s.paddingLeft)+S(o.marginLeft),top:-i.offsetTop+S(s.paddingTop)+S(o.marginTop),right:re(a)-te(i)-i.offsetLeft+S(s.paddingRight)-S(o.marginRight),bottom:ne(a)-N(i)-i.offsetTop+S(s.paddingBottom)-S(o.marginBottom)}}return x(r.right)&&(t=Math.min(t,r.right)),x(r.bottom)&&(n=Math.min(n,r.bottom)),x(r.left)&&(t=Math.max(t,r.left)),x(r.top)&&(n=Math.max(n,r.top)),[t,n]}function z(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function B(e){return e.props.axis===`both`||e.props.axis===`x`}function fe(e){return e.props.axis===`both`||e.props.axis===`y`}function pe(e,t,n){let r=typeof t==`number`?oe(e,t):null;if(typeof t==`number`&&!r)return null;let i=me(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return ie(r||e,a,n.props.scale)}function V(e,t,n){let r=!x(e.lastX),i=me(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function H(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function U(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function me(e){let t=e.findDOMNode();if(!t)throw Error(`<DraggableCore>: Unmounted during event!`);return t}var he=f(t()),W=f($e()),ge=f(r()),G=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},K={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},_e=K.mouse,ve=class extends he.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(`<DraggableCore> not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!A(e.target,this.props.handle,t)||this.props.cancel&&A(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=se(e);this.touchIdentifier=r;let i=pe(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=V(this,a,o);G(`DraggableCore: handleDragStart: %j`,s),G(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&ce(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,j(n,_e.move,this.handleDrag),j(n,_e.stop,this.handleDragStop))},this.handleDrag=e=>{let t=pe(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=z(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=V(this,n,r);if(G(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1)try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}else this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=pe(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=z(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=V(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&L(a.ownerDocument),G(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(G(`DraggableCore: Removing handlers`),M(a.ownerDocument,_e.move,this.handleDrag),M(a.ownerDocument,_e.stop,this.handleDragStop))},this.onMouseDown=e=>(_e=K.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(_e=K.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(_e=K.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(_e=K.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&j(e,K.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;M(t,K.mouse.move,this.handleDrag),M(t,K.touch.move,this.handleDrag),M(t,K.mouse.stop,this.handleDragStop),M(t,K.touch.stop,this.handleDragStop),M(e,K.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&L(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=ge.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(G(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return he.cloneElement(he.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};ve.displayName=`DraggableCore`,ve.propTypes={allowAnyClick:W.default.bool,allowMobileScroll:W.default.bool,children:W.default.node.isRequired,disabled:W.default.bool,enableUserSelectHack:W.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:W.default.arrayOf(W.default.number),handle:W.default.string,cancel:W.default.string,nodeRef:W.default.object,nonce:W.default.string,onStart:W.default.func,onDrag:W.default.func,onStop:W.default.func,onMouseDown:W.default.func,scale:W.default.number,className:C,style:C,transform:C},ve.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var q=class extends h.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(G(`Draggable: onDragStart: %j`,t),this.props.onStart(e,H(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;G(`Draggable: onDrag: %j`,t);let n=H(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=R(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,H(this,t))===!1)return!1;G(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(G(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=_.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,m=s||r,g={x:B(this)&&p?this.state.x:m.x,y:fe(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=P(g,c):d=ae(g,c);let _=h.Children.only(n),y=(0,v.clsx)(_.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return h.createElement(ve,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},h.cloneElement(_,{className:y,style:{..._.props.style,...d},transform:f}))}};q.displayName=`Draggable`,q.propTypes={...ve.propTypes,axis:g.default.oneOf([`both`,`x`,`y`,`none`]),bounds:g.default.oneOfType([g.default.shape({left:g.default.number,right:g.default.number,top:g.default.number,bottom:g.default.number}),g.default.string,g.default.oneOf([!1])]),defaultClassName:g.default.string,defaultClassNameDragging:g.default.string,defaultClassNameDragged:g.default.string,defaultPosition:g.default.shape({x:g.default.number,y:g.default.number}),positionOffset:g.default.shape({x:g.default.oneOfType([g.default.number,g.default.string]),y:g.default.oneOfType([g.default.number,g.default.string])}),position:g.default.shape({x:g.default.number,y:g.default.number}),className:C,style:C,transform:C},q.defaultProps={...ve.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1},0&&(n.exports={DraggableCore:ve})})),qt=n(((e,t)=>{var n=Kt(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),Jt=n((e=>{e.__esModule=!0,e.cloneElement=l;var n=r(t());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?i(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function o(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e){var t=c(e,`string`);return typeof t==`symbol`?t:t+``}function c(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function l(e,t){return t.style&&e.props.style&&(t.style=a(a({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+` `+t.className),n.default.cloneElement(e,t)}})),Yt=n((e=>{e.__esModule=!0,e.resizableProps=void 0;var t=n($e());qt();function n(e){return e&&e.__esModule?e:{default:e}}e.resizableProps={axis:t.default.oneOf([`both`,`x`,`y`,`none`]),className:t.default.string,children:t.default.element.isRequired,draggableOpts:t.default.shape({allowAnyClick:t.default.bool,cancel:t.default.string,children:t.default.node,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:typeof Element<`u`?t.default.instanceOf(Element):t.default.any,grid:t.default.arrayOf(t.default.number),handle:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number}),height:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`y`?t.default.number.isRequired(...e):t.default.number(...e)},handle:t.default.oneOfType([t.default.node,t.default.func]),handleSize:t.default.arrayOf(t.default.number),lockAspectRatio:t.default.bool,maxConstraints:t.default.arrayOf(t.default.number),minConstraints:t.default.arrayOf(t.default.number),onResizeStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,resizeHandles:t.default.arrayOf(t.default.oneOf([`s`,`w`,`e`,`n`,`sw`,`nw`,`se`,`ne`])),transformScale:t.default.number,width:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`x`?t.default.number.isRequired(...e):t.default.number(...e)}}})),Xt=n((e=>{e.__esModule=!0,e.default=void 0;var n=s(t()),r=qt(),i=Jt(),a=Yt(),o=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function s(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(s=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(null,arguments)}function l(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?u(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){var t=m(e,`string`);return typeof t==`symbol`?t:t+``}function m(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var h=class extends n.Component{constructor(){super(...arguments),this.handleRefs={},this.lastHandleRect=null,this.slack=null,this.lastSize=null}componentWillUnmount(){this.resetData()}resetData(){this.lastHandleRect=this.slack=this.lastSize=null}runConstraints(e,t){let n=this.props,r=n.minConstraints,i=n.maxConstraints,a=n.lockAspectRatio;if(!r&&!i&&!a)return[e,t];if(a){let n=this.props.width/this.props.height,r=e-this.props.width,i=t-this.props.height;Math.abs(r)>Math.abs(i*n)?t=e/n:e=t*n}let o=e,s=t,c=this.slack||[0,0],l=c[0],u=c[1];return e+=l,t+=u,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),i&&(e=Math.min(i[0],e),t=Math.min(i[1],t)),this.slack=[l+(o-e),u+(s-t)],[e,t]}resizeHandler(e,t){return(n,r)=>{let i=r.node,a=r.deltaX,o=r.deltaY;e===`onResizeStart`&&this.resetData();let s=(this.props.axis===`both`||this.props.axis===`x`)&&t!==`n`&&t!==`s`,c=(this.props.axis===`both`||this.props.axis===`y`)&&t!==`e`&&t!==`w`;if(!s&&!c)return;let l=t[0],u=t[t.length-1],d=i.getBoundingClientRect();if(this.lastHandleRect!=null){if(u===`w`){let e=d.left-this.lastHandleRect.left;a+=e}if(l===`n`){let e=d.top-this.lastHandleRect.top;o+=e}}this.lastHandleRect=d,u===`w`&&(a=-a),l===`n`&&(o=-o);let f=this.lastSize?.width??this.props.width,p=this.lastSize?.height??this.props.height,m=f+(s?a/this.props.transformScale:0),h=p+(c?o/this.props.transformScale:0);var g=this.runConstraints(m,h);if(m=g[0],h=g[1],e===`onResizeStop`&&this.lastSize){var _=this.lastSize;m=_.width,h=_.height}let v=m!==f||h!==p;e!==`onResizeStop`&&(this.lastSize={width:m,height:h});let y=typeof this.props[e]==`function`?this.props[e]:null;y&&(e!==`onResize`||v)&&(n.persist==null||n.persist(),y(n,{node:i,size:{width:m,height:h},handle:t})),e===`onResizeStop`&&this.resetData()}}renderResizeHandle(e,t){let r=this.props.handle;if(!r)return n.createElement(`span`,{className:`react-resizable-handle react-resizable-handle-`+e,ref:t});if(typeof r==`function`)return r(e,t);let i=typeof r.type==`string`,a=d({ref:t},i?{}:{handleAxis:e});return n.cloneElement(r,a)}render(){let e=this.props,t=e.children,a=e.className,s=e.draggableOpts;e.width,e.height,e.handle,e.handleSize,e.lockAspectRatio,e.axis,e.minConstraints,e.maxConstraints,e.onResize,e.onResizeStop,e.onResizeStart;let u=e.resizeHandles;e.transformScale;let f=l(e,o);return(0,i.cloneElement)(t,d(d({},f),{},{className:(a?a+` `:``)+`react-resizable`,children:[...n.Children.toArray(t.props.children),...u.map(e=>{let t=this.handleRefs[e]??(this.handleRefs[e]=n.createRef());return n.createElement(r.DraggableCore,c({},s,{nodeRef:t,key:`resizableHandle-`+e,onStop:this.resizeHandler(`onResizeStop`,e),onStart:this.resizeHandler(`onResizeStart`,e),onDrag:this.resizeHandler(`onResize`,e)}),this.renderResizeHandle(e,t))})]}))}};e.default=h,h.propTypes=a.resizableProps,h.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),Zt=n((e=>{e.__esModule=!0,e.default=void 0;var n=c(t()),r=s($e()),i=s(Xt()),a=Yt(),o=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(c=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(null,arguments)}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?u(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){var t=m(e,`string`);return typeof t==`symbol`?t:t+``}function m(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function h(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var g=class extends n.Component{constructor(){super(...arguments),this.state={width:this.props.width,height:this.props.height,propsWidth:this.props.width,propsHeight:this.props.height},this.onResize=(e,t)=>{let n=t.size;this.props.onResize?(e.persist==null||e.persist(),this.setState(n,()=>this.props.onResize&&this.props.onResize(e,t))):this.setState(n)}}static getDerivedStateFromProps(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null}render(){let e=this.props,t=e.handle,r=e.handleSize;e.onResize;let a=e.onResizeStart,s=e.onResizeStop,c=e.draggableOpts,u=e.minConstraints,f=e.maxConstraints,p=e.lockAspectRatio,m=e.axis;e.width,e.height;let g=e.resizeHandles,_=e.style,v=e.transformScale,y=h(e,o);return n.createElement(i.default,{axis:m,draggableOpts:c,handle:t,handleSize:r,height:this.state.height,lockAspectRatio:p,maxConstraints:f,minConstraints:u,onResizeStart:a,onResize:this.onResize,onResizeStop:s,resizeHandles:g,transformScale:v,width:this.state.width},n.createElement(`div`,l({},y,{style:d(d({},_),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=g,g.propTypes=d(d({},a.resizableProps),{},{children:r.default.element})})),Qt=n(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=Xt().default,t.exports.ResizableBox=Zt().default}))(),$=v(),$t=Xe(),en=50,tn=12;function nn(e){let t=e;for(;t;){let e=window.getComputedStyle(t).overflowY;if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}function rn(e){let t=nn(e),n=null,r=0,i=0,a=!1;function o(){let e=t;if(!e)return;let s=e.getBoundingClientRect(),{clientHeight:c,scrollTop:l,scrollHeight:u}=e,{scrollLeft:d,scrollWidth:f,clientWidth:p}=e,m=0,h=0;i<s.top+en&&l>0?m=-tn:i>s.bottom-en&&l+c<u&&(m=tn),r<s.left+en&&d>0?h=-tn:r>s.right-en&&d+p<f&&(h=tn),(m!==0||h!==0)&&(e.scrollTop+=m,e.scrollLeft+=h),a&&(n=requestAnimationFrame(o))}return{feed(e,t){r=e,i=t,a||(a=!0,n=requestAnimationFrame(o))},stop(){a=!1,n!==null&&(cancelAnimationFrame(n),n=null)}}}function an(e){let{children:t,cols:n,containerWidth:r,margin:i,containerPadding:a,rowHeight:o,maxRows:s,isDraggable:c,isResizable:l,isBounded:u,allowMobileScroll:d,static:f,useCSSTransforms:p=!0,usePercentages:m=!1,transformScale:h=1,positionStrategy:g,dragThreshold:_=0,droppingPosition:v,className:y=``,style:b,handle:x=``,cancel:S=``,x:C,y:w,w:T,h:E,minW:D=1,maxW:ee=1/0,minH:O=1,maxH:k=1/0,i:A,resizeHandles:j,resizeHandle:M,constraints:N=_e,layoutItem:te,layout:ne=[],onDragStart:re,onDrag:ie,onDragStop:se,onResizeStart:le,onResize:ue,onResizeStop:de}=e,[R,z]=(0,X.useState)(!1),[B,fe]=(0,X.useState)(!1),pe=(0,X.useRef)(null),V=(0,X.useRef)({left:0,top:0}),H=(0,X.useRef)({top:0,left:0,width:0,height:0}),U=(0,X.useRef)(void 0),me=(0,X.useRef)(ne);me.current=ne;let he=(0,X.useRef)(null),W=(0,X.useRef)(null),ge=(0,X.useRef)(!1),G=(0,X.useRef)({x:0,y:0}),K=(0,X.useRef)(!1),Se=(0,X.useRef)(null),J=(0,X.useMemo)(()=>({cols:n,containerPadding:a,containerWidth:r,margin:i,maxRows:s,rowHeight:o}),[n,a,r,i,s,o]),Ce=(0,X.useMemo)(()=>({cols:n,maxRows:s,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,s,r,o,i]),Y=(0,X.useCallback)(e=>({...Ce,containerHeight:e??Ce.containerHeight,layout:me.current}),[Ce]),we=(0,X.useMemo)(()=>te??{i:A,x:C,y:w,w:T,h:E,minW:D,maxW:ee,minH:O,maxH:k},[te,A,C,w,T,E,D,ee,O,k]),Te=(0,X.useCallback)(e=>{if(g?.calcStyle)return g.calcStyle(e);if(p)return ye(e);let t=be(e);return m?{...t,left:xe(e.left/r),width:xe(e.width/r)}:t},[g,p,m,r]),Ee=(0,X.useCallback)((e,{node:t})=>{if(!re)return;let{offsetParent:n}=t;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left/h,o=r.left/h,s=i.top/h,c=r.top/h,l;if(g?.calcDragPosition){let t=e;l=g.calcDragPosition(t.clientX,t.clientY,t.clientX-i.left,t.clientY-i.top)}else l={left:a-o+n.scrollLeft,top:s-c+n.scrollTop};if(V.current=l,Se.current||=rn(t instanceof HTMLElement?t:null),_>0){let t=e;G.current={x:t.clientX,y:t.clientY},ge.current=!0,K.current=!1,z(!0);return}z(!0);let u=I(J,l.top,l.left),{x:d,y:f}=ve(N,we,u.x,u.y,Y());re(A,d,f,{e,node:t,newPosition:l})},[re,h,J,g,_,N,we,Y,A]),De=(0,X.useCallback)((e,{node:t,deltaX:n,deltaY:a})=>{if(!ie||!R)return;let s=e;if(ge.current&&!K.current){let n=s.clientX-G.current.x,r=s.clientY-G.current.y;if(Math.hypot(n,r)<_)return;if(K.current=!0,ge.current=!1,re){let n=I(J,V.current.top,V.current.left),{x:r,y:i}=ve(N,we,n.x,n.y,Y());re(A,r,i,{e,node:t,newPosition:V.current})}}Se.current?.feed(s.clientX,s.clientY);let c=V.current.top+a,l=V.current.left+n;if(u){let{offsetParent:e}=t;if(e){let t=e.clientHeight-F(E,o,i[1]);c=L(c,0,t);let n=P(J),a=r-F(T,n,i[0]);l=L(l,0,a)}}let d={top:c,left:l};V.current=d;let f=I(J,c,l),{x:p,y:m}=ve(N,we,f.x,f.y,Y());ie(A,p,m,{e,node:t,newPosition:d})},[ie,re,R,_,u,E,o,i,J,r,T,A,N,we,Y]),Oe=(0,X.useCallback)((e,{node:t})=>{if(!se||!R)return;Se.current?.stop(),Se.current=null;let n=ge.current;if(ge.current=!1,K.current=!1,G.current={x:0,y:0},n){z(!1),V.current={left:0,top:0};return}let{left:r,top:i}=V.current,a={top:i,left:r};z(!1),V.current={left:0,top:0};let o=I(J,i,r),{x:s,y:c}=ve(N,we,o.x,o.y,Y());se(A,s,c,{e,node:t,newPosition:a})},[se,R,J,N,we,Y,A]);he.current=Ee,W.current=De;let Ae=(0,X.useCallback)((e,{node:t,size:n,handle:i},a,o)=>{let s=o===`onResizeStart`?le:o===`onResize`?ue:de;if(!s)return;let c;c=t?ke(i,a,n,r):{...n,top:a.top,left:a.left},H.current=c;let l=t?.offsetParent?.clientHeight??0,u=ce(J,c.width,c.height),{w:d,h:f}=q(N,we,u.w,u.h,i,Y(l));s(A,d,f,{e:e.nativeEvent??e,node:t,size:c,handle:i})},[le,ue,de,r,J,A,N,we,Y]),je=(0,X.useCallback)((e,t)=>{fe(!0);let n=oe(J,C,w,T,E),r={...t,handle:t.handle};Ae(e,r,n,`onResizeStart`)},[Ae,J,C,w,T,E]),Me=(0,X.useCallback)((e,t)=>{let n=oe(J,C,w,T,E),r={...t,handle:t.handle};Ae(e,r,n,`onResize`)},[Ae,J,C,w,T,E]),Ne=(0,X.useCallback)((e,t)=>{fe(!1),H.current={top:0,left:0,width:0,height:0};let n=oe(J,C,w,T,E),r={...t,handle:t.handle};Ae(e,r,n,`onResizeStop`)},[Ae,J,C,w,T,E]);(0,X.useEffect)(()=>{if(!v)return;let e=pe.current;if(!e)return;let t=U.current||{left:0,top:0},n=R&&(v.left!==t.left||v.top!==t.top);if(!R){let t={node:e,deltaX:v.left,deltaY:v.top,lastX:0,lastY:0,x:v.left,y:v.top};he.current?.(v.e,t)}else if(n){let t={node:e,deltaX:v.left-V.current.left,deltaY:v.top-V.current.top,lastX:V.current.left,lastY:V.current.top,x:v.left,y:v.top};W.current?.(v.e,t)}U.current=v},[v,R,A]);let Pe=oe(J,C,w,T,E,R?V.current:null,B?H.current:null),Fe=X.Children.only(t),Ie=P(J),Le=[F(D,Ie,i[0]),F(O,o,i[1])],Re=[F(ee,Ie,i[0]),F(k,o,i[1])],ze=Fe.props,Be=ze.className,Ve=ze.style,He=X.cloneElement(Fe,{ref:pe,className:ae(`react-grid-item`,Be,y,{static:f,resizing:B,"react-draggable":c,"react-draggable-dragging":R,dropping:!!v,cssTransforms:p}),style:{...b,...Ve,...Te(Pe)}}),Ue=M;return He=(0,$.jsx)(Qt.Resizable,{draggableOpts:{disabled:!l},className:l?void 0:`react-resizable-hide`,width:Pe.width,height:Pe.height,minConstraints:Le,maxConstraints:Re,onResizeStart:je,onResize:Me,onResizeStop:Ne,transformScale:h,resizeHandles:j,handle:Ue,children:He}),He=(0,$.jsx)(Ut,{disabled:!c,onStart:Ee,onDrag:De,onStop:Oe,handle:x,cancel:`.react-resizable-handle`+(S?`,`+S:``),scale:h,allowMobileScroll:d,nodeRef:pe,children:He}),He}var on=X.memo(an,(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h&&e.minW===t.minW&&e.maxW===t.maxW&&e.minH===t.minH&&e.maxH===t.maxH&&e.cols===t.cols&&e.containerWidth===t.containerWidth&&e.rowHeight===t.rowHeight&&e.maxRows===t.maxRows&&e.margin===t.margin&&e.containerPadding===t.containerPadding&&e.transformScale===t.transformScale&&e.isDraggable===t.isDraggable&&e.isResizable===t.isResizable&&e.isBounded===t.isBounded&&e.allowMobileScroll===t.allowMobileScroll&&e.useCSSTransforms===t.useCSSTransforms&&e.usePercentages===t.usePercentages&&e.children===t.children&&e.onDrag===t.onDrag&&e.onDragStop===t.onDragStop&&e.onResize===t.onResize&&e.onResizeStop===t.onResizeStop&&e.droppingPosition===t.droppingPosition);on.displayName=`GridItem`;function sn(e){let{clientX:t,clientY:n,gridElement:r,droppingItem:i,event:a,dragOffsetX:o=0,dragOffsetY:s=0,transformScale:c,cols:l,margin:u,maxRows:d,rowHeight:f,width:p,containerPadding:m}=e,h=r.getBoundingClientRect(),g={cols:l,margin:u,maxRows:d,rowHeight:f,containerWidth:p,containerPadding:m},_=P(g),v=F(i.w,_,u[0]),y=F(i.h,f,u[1]),b=v/2,x=y/2,S=r.scrollLeft??0,C=r.scrollTop??0,w=t-h.left+S+o-b,T=n-h.top+C+s-x,E=Math.max(0,w),D=Math.max(0,T);return{newDroppingPosition:{left:E/c,top:D/c,e:a},calculatedXY:se(g,D,E,i.w,i.h)}}var cn=()=>{},ln=`react-grid-layout`,un=!1;try{un=/firefox/i.test(navigator.userAgent)}catch{}function dn(e,t){let n=X.Children.toArray(e),r=X.Children.toArray(t);if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++){let t=n[e],i=r[e];if(t?.key!==i?.key)return!1}return!0}function fn(e,t,n,r){let i=[],a=new Set;X.Children.forEach(t,t=>{if(!X.isValidElement(t)||t.key===null)return;let n=String(t.key);a.add(n);let r=e.find(e=>e.i===n);if(r)i.push(H(r));else{let e=t.props[`data-grid`];e?i.push({i:n,x:e.x??0,y:e.y??0,w:e.w??1,h:e.h??1,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,static:e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}):i.push({i:n,x:0,y:fe(i),w:1,h:1})}});let o=W(i,{cols:n});return r.compact(o,n)}function pn(e){let{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:a,dropConfig:o,positionStrategy:s=Ae,compactor:c,constraints:l=_e,layout:u=[],droppingItem:d,autoSize:f=!0,className:p=``,style:m={},innerRef:h,onLayoutChange:g=cn,onDragStart:_=cn,onDrag:v=cn,onDragStop:y=cn,onResizeStart:b=cn,onResize:x=cn,onResizeStop:S=cn,onDrop:C=cn,onDropDragOver:w=cn}=e,T=(0,X.useMemo)(()=>({...je,...r}),[r]),E=(0,X.useMemo)(()=>({...Me,...i}),[i]),D=(0,X.useMemo)(()=>({...Ne,...a}),[a]),ee=(0,X.useMemo)(()=>({...Pe,...o}),[o]),{cols:O,rowHeight:k,maxRows:A,margin:j,containerPadding:M}=T,{enabled:N,bounded:te,handle:ne,cancel:re,threshold:ie,allowMobileScroll:P}=E,{enabled:F,handles:oe,handleComponent:se}=D,{enabled:I,defaultItem:ce,onDragOver:L,touchEnabled:le=!0,touchDragSource:ue=`[data-rgl-draggable]`}=ee,R=c??We(`vertical`),z=R.type,B=R.allowOverlap,V=R.preventCollision??!1,U=(0,X.useMemo)(()=>d??{i:`__dropping-elem__`,...ce},[d,ce]),me=s.type===`transform`,W=s.scale,G=M??j,[K,ve]=(0,X.useState)(!1),[q,ye]=(0,X.useState)(()=>fn(u,t,O,R)),[be,xe]=(0,X.useState)(null),[Se,J]=(0,X.useState)(!1),[Ce,Y]=(0,X.useState)(null),[we,Te]=(0,X.useState)(),Ee=(0,X.useRef)(void 0);Ee.current=we;let De=(0,X.useRef)(null),Oe=(0,X.useRef)(null),ke=(0,X.useRef)(null),Fe=(0,X.useRef)(0),Ie=(0,X.useRef)(q),Le=(0,X.useRef)(u),Re=(0,X.useRef)(t),ze=(0,X.useRef)(z),Be=(0,X.useRef)(null),Ve=(0,X.useRef)(!1),He=(0,X.useRef)(null),Ue=(0,X.useRef)(null);Ue.current=Ce;let Ge=(0,X.useRef)(C);(0,X.useLayoutEffect)(()=>{Ge.current=C});let Ke=(0,X.useRef)(q);Ke.current=q,(0,X.useEffect)(()=>{ve(!0),(0,$t.deepEqual)(q,u)||g(q)},[]),(0,X.useEffect)(()=>{if(be||Ce)return;let e=!(0,$t.deepEqual)(u,Le.current),n=!dn(t,Re.current),r=z!==ze.current;if(e||n||r){let n=fn(e?u:q,t,O,R);(0,$t.deepEqual)(n,q)||ye(n)}Le.current=u,Re.current=t,ze.current=z},[u,t,O,z,R,be,Ce,q]),(0,X.useEffect)(()=>{if(!be&&!Ce&&!(0,$t.deepEqual)(q,Ie.current)){Ie.current=q;let e=q.filter(e=>e.i!==U.i);g(e)}},[q,be,Ce,g,U.i]);let qe=(0,X.useMemo)(()=>{if(!f)return;let e=fe(q),t=G[1];return e*k+(e-1)*j[1]+t*2+`px`},[f,q,k,j,G]),Je=(0,X.useCallback)((e,t,n,r)=>{let i=Ke.current,a=pe(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};De.current=H(a),ke.current=i,xe(o),_(i,a,a,null,r.e,r.node)},[_]),Ye=(0,X.useCallback)((e,t,n,r)=>{let i=Ke.current,a=De.current,o=pe(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=ge(i,o,t,n,!0,V,z,O,B);v(c,a,o,s,r.e,r.node),ye(R.compact(c,O)),xe(s)},[V,z,O,B,R,v]),Xe=(0,X.useCallback)((e,t,n,r)=>{if(!De.current)return;let i=Ke.current,a=De.current,o=pe(i,e);if(!o)return;let s=ge(i,o,t,n,!0,V,z,O,B),c=R.compact(s,O);y(c,a,o,null,r.e,r.node);let l=ke.current;De.current=null,ke.current=null,xe(null),ye(c),l&&!(0,$t.deepEqual)(l,c)&&g(c)},[V,z,O,B,R,y,g]),Ze=(0,X.useCallback)((e,t,n,r)=>{let i=Ke.current,a=pe(i,e);a&&(Oe.current=H(a),ke.current=i,J(!0),b(i,a,a,null,r.e,r.node))},[b]),Qe=(0,X.useCallback)((e,t,n,r)=>{let i=Ke.current,a=Oe.current,{handle:o}=r,s=!1,c,l,[u,d]=he(i,e,e=>(c=e.x,l=e.y,[`sw`,`w`,`nw`,`n`,`ne`].includes(o)&&([`sw`,`nw`,`w`].includes(o)&&(c=e.x+(e.w-t),t=e.x!==c&&c<0?e.w:t,c=c<0?0:c),[`ne`,`n`,`nw`].includes(o)&&(l=e.y+(e.h-n),n=e.y!==l&&l<0?e.h:n,l=l<0?0:l),s=!0),V&&!B&&de(i,{...e,w:t,h:n,x:c??e.x,y:l??e.y}).filter(t=>t.i!==e.i).length>0&&(l=e.y,n=e.h,c=e.x,t=e.w,s=!1),e.w=t,e.h=n,(o===`n`||o===`nw`||o===`ne`)&&(e.y=l??e.y),e));if(!d)return;let f=u;s&&c!==void 0&&l!==void 0&&(f=ge(u,d,c,l,!0,V,z,O,B));let p={w:d.w,h:d.h,x:d.x,y:d.y,i:e,static:!0};x(f,a,d,p,r.e,r.node);let m=R.compact(f,O);if(o===`n`||o===`nw`||o===`ne`){let t=m.find(t=>t.i===e);t&&(t.y=d.y)}ye(m),xe(p)},[V,z,O,B,R,x]),$e=(0,X.useCallback)((e,t,n,r)=>{let i=Ke.current,a=Oe.current,o=pe(i,e),s=R.compact(i,O);S(s,a,o??null,null,r.e,r.node);let c=ke.current;Oe.current=null,ke.current=null,xe(null),J(!1),ye(s),c&&!(0,$t.deepEqual)(c,s)&&g(s)},[O,R,S,g]),Z=(0,X.useCallback)((e,t,n,r)=>{if(r)Ee.current&&(Ee.current.left!==t.left||Ee.current.top!==t.top)&&(Te(t),ye(t=>t.map(t=>t.i===e.i&&(t.x!==n.x||t.y!==n.y)?{...t,x:n.x,y:n.y}:t)));else{Y((0,$.jsx)(`div`,{},e.i)),Te(t);let r=Ke.current.filter(t=>t.i!==e.i);ye([...r,{...e,x:n.x,y:n.y,static:!1,isDraggable:!0}])}},[]),et=(0,X.useCallback)((e,t,r)=>{let i=Be.current;if(!i)return;let{newDroppingPosition:a,calculatedXY:o}=sn({clientX:e,clientY:t,gridElement:i,droppingItem:U,event:r,transformScale:W,cols:O,margin:j,maxRows:A,rowHeight:k,width:n,containerPadding:G});Z(U,a,o,!!Ue.current)},[U,W,O,j,A,k,n,G,Z]),tt=(0,X.useCallback)(()=>{let e=Ke.current;if(!e.some(e=>e.i===U.i)){Y(null),xe(null),Te(void 0);return}let t=R.compact(e.filter(e=>e.i!==U.i),O);ye(t),Y(null),xe(null),Te(void 0)},[U.i,O,R]),nt=(0,X.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),un&&!e.nativeEvent.target?.classList.contains(ln))return!1;let t=L?L(e.nativeEvent):w(e);if(t===!1)return Ce&&tt(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...U,...a},{newDroppingPosition:s,calculatedXY:c}=sn({clientX:e.clientX,clientY:e.clientY,gridElement:e.currentTarget,droppingItem:o,event:e.nativeEvent,dragOffsetX:r,dragOffsetY:i,transformScale:W,cols:O,margin:j,maxRows:A,rowHeight:k,width:n,containerPadding:G});Z(o,s,c,!!Ce)},[Ce,U,L,w,tt,Z,W,O,j,A,k,n,G]),rt=(0,X.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Fe.current--,Fe.current<0&&(Fe.current=0),Fe.current===0&&tt()},[tt]),Q=(0,X.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Fe.current++},[]),it=(0,X.useCallback)(e=>{let t=Ke.current,n=t.find(e=>e.i===U.i);tt(),Ge.current(t,n,e)},[U.i,tt]),at=(0,X.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Fe.current=0,it(e.nativeEvent)},[it]);(0,X.useEffect)(()=>{if(!I||!le)return;let e=Be.current;if(!e)return;let t=(t,n)=>{let r=document.elementFromPoint(t,n);return r?e.contains(r):!1},n=e=>e instanceof HTMLElement&&e.closest(ue)!==null,r=e=>{let t=e.changedTouches;if(!t||t.length===0)return;let n=He.current;if(n===null)return t[0];for(let e=0;e<t.length;e++){let r=t[e];if(r&&r.identifier===n)return r}},i=e=>{if(!n(e.target)||He.current!==null)return;e.preventDefault();let t=e.changedTouches?.[0];t&&(He.current=t.identifier,Ve.current=!0)},a=e=>{if(!Ve.current)return;e.preventDefault();let n=r(e);n&&(t(n.clientX,n.clientY)?et(n.clientX,n.clientY,e):Ue.current&&tt())},o=e=>{if(!Ve.current)return;e.preventDefault();let n=r(e);Ve.current=!1,He.current=null,n&&(t(n.clientX,n.clientY)?it(e):tt())},s=()=>{Ve.current&&(Ve.current=!1,He.current=null,tt())},c={passive:!1};return document.addEventListener(`touchstart`,i,c),document.addEventListener(`touchmove`,a,c),document.addEventListener(`touchend`,o,c),document.addEventListener(`touchcancel`,s,c),()=>{document.removeEventListener(`touchstart`,i,c),document.removeEventListener(`touchmove`,a,c),document.removeEventListener(`touchend`,o,c),document.removeEventListener(`touchcancel`,s,c)}},[I,le,ue,et,tt,it,U.i]);let ot=(0,X.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=pe(q,String(e.key));if(!r)return null;let i=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&N,a=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&F,o=r.resizeHandles||[...oe],c=i&&te&&r.isBounded!==!1,u=se;return(0,$.jsx)(on,{containerWidth:n,cols:O,margin:j,containerPadding:G,maxRows:A,rowHeight:k,cancel:re,handle:ne,onDragStart:Je,onDrag:Ye,onDragStop:Xe,onResizeStart:Ze,onResize:Qe,onResizeStop:$e,isDraggable:i,isResizable:a,isBounded:c,allowMobileScroll:P,useCSSTransforms:me&&K,usePercentages:!K,transformScale:W,positionStrategy:s,dragThreshold:ie,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:t?we:void 0,resizeHandles:o,resizeHandle:u,constraints:l,layoutItem:r,layout:q,children:e},r.i)},[q,n,O,j,G,A,k,re,ne,Je,Ye,Xe,Ze,Qe,$e,N,F,te,me,K,W,s,ie,we,oe,se,l]),st=()=>be?(0,$.jsx)(on,{w:be.w,h:be.h,x:be.x,y:be.y,i:be.i,className:`react-grid-placeholder ${Se?`placeholder-resizing`:``}`,containerWidth:n,cols:O,margin:j,containerPadding:G,maxRows:A,rowHeight:k,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:me,transformScale:W,constraints:l,layout:q,children:(0,$.jsx)(`div`,{})}):null,ct=(0,X.useCallback)(e=>{Be.current=e,typeof h==`function`?h(e):h&&`current`in h&&(h.current=e)},[h]),lt=ae(ln,p),ut={height:qe,...m};return(0,$.jsxs)(`div`,{ref:ct,className:lt,style:ut,onDrop:I?at:void 0,onDragLeave:I?rt:void 0,onDragEnter:I?Q:void 0,onDragOver:I?nt:void 0,children:[X.Children.map(t,e=>X.isValidElement(e)?ot(e):null),I&&Ce&&ot(Ce,!0),st()]})}var mn={lg:1200,md:996,sm:768,xs:480,xxs:0},hn={lg:12,md:10,sm:6,xs:4,xxs:2},gn=()=>{};function _n(e,t,n,r,i=!1){let a=[];X.Children.forEach(t,t=>{if(!X.isValidElement(t)||t.key===null)return;let n=String(t.key),r=t.props[`data-grid`],o=e.find(e=>e.i===n);o?i&&r?a.push({...o,i:n,w:r.w??o.w,h:r.h??o.h,minW:r.minW??o.minW,maxW:r.maxW??o.maxW,minH:r.minH??o.minH,maxH:r.maxH??o.maxH}):a.push({...o,i:n}):r?a.push({i:n,x:r.x??0,y:r.y??0,w:r.w??1,h:r.h??1,minW:r.minW,maxW:r.maxW,minH:r.minH,maxH:r.maxH,static:r.static,isDraggable:r.isDraggable,isResizable:r.isResizable,resizeHandles:r.resizeHandles,isBounded:r.isBounded}):a.push({i:n,x:0,y:fe(a),w:1,h:1})});let o=W(a,{cols:n});return r.compact(o,n)}function vn(e){let{children:t,width:n,breakpoint:r,breakpoints:i=mn,cols:a=hn,layouts:o={},rowHeight:s=150,maxRows:c=1/0,margin:l=[10,10],containerPadding:u=null,compactor:d,onBreakpointChange:f=gn,onLayoutChange:p=gn,onWidthChange:m=gn,...h}=e,g=d??We(`vertical`),_=g.type,v=g.allowOverlap,y=(0,X.useMemo)(()=>r??Ke(i,n),[]),b=(0,X.useMemo)(()=>qe(y,a),[y,a]),x=(0,X.useMemo)(()=>Je(o,i,y,y,b,_),[]),[S,C]=(0,X.useState)(y),[w,T]=(0,X.useState)(b),[E,D]=(0,X.useState)(x),[ee,O]=(0,X.useState)(o),k=(0,X.useRef)(n),A=(0,X.useRef)(r),j=(0,X.useRef)(i),M=(0,X.useRef)(a),N=(0,X.useRef)(o),te=(0,X.useRef)(_),ne=(0,X.useRef)(ee);(0,X.useEffect)(()=>{ne.current=ee},[ee]);let re=(0,X.useMemo)(()=>(0,$t.deepEqual)(o,N.current)?null:Je(o,i,S,S,w,g),[o,i,S,w,g]),ie=re??E;(0,X.useEffect)(()=>{re!==null&&(D(re),O(o),ne.current=o,N.current=o)},[re,o]),(0,X.useEffect)(()=>{if(_!==te.current){let e=g.compact(U(ie),w),t={...ne.current,[S]:e};D(e),O(t),ne.current=t,p(e,t),te.current=_}},[_,g,ie,w,v,S,p]),(0,X.useEffect)(()=>{let e=n!==k.current,o=r!==A.current,s=!(0,$t.deepEqual)(i,j.current),c=!(0,$t.deepEqual)(a,M.current);if(e||o||s||c){let e=r??Ke(i,n),o=qe(e,a),d=S;if(d!==e||s||c){let n={...ne.current};n[d]||(n[d]=U(E));let r=Je(n,i,e,d,o,g),a=!n[e];r=_n(r,t,o,g,a),n[e]=r,C(e),T(o),D(r),O(n),ne.current=n,f(e,o),p(r,n)}let h=Ye(l,e),_=u?Ye(u,e):null;m(n,h,o,_),k.current=n,A.current=r,j.current=i,M.current=a}},[n,r,i,a,S,w,E,t,g,_,v,l,u,f,p,m]);let ae=(0,X.useCallback)(e=>{let t={...ne.current,[S]:e};D(e),O(t),ne.current=t,p(e,t)},[S,p]),P=(0,X.useMemo)(()=>Ye(l,S),[l,S]),F=(0,X.useMemo)(()=>u===null?null:Ye(u,S),[u,S]),oe=(0,X.useMemo)(()=>({cols:w,rowHeight:s,maxRows:c,margin:P,containerPadding:F}),[w,s,c,P,F]);return(0,$.jsx)(pn,{...h,width:n,gridConfig:oe,compactor:g,onLayoutChange:ae,layout:ie,children:t})}var yn=X.forwardRef(function(e,t){let{innerRef:n,...r}=e,i=n??t;return(0,$.jsx)(vn,{...r,innerRef:i})});yn.displayName=`ResponsiveGridLayout`;var bn={holidayName:new Map,makeup:new Set,years:new Set,provisionalYears:new Set},xn=/^\d{4}-\d{2}-\d{2}$/;function Sn(e){if(!xn.test(e))return null;let[t,n,r]=e.split(`-`).map(Number),i=new Date(t,(n??1)-1,r??1);return Number.isNaN(i.getTime())?null:Cn(i)===e?i:null}function Cn(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function wn(e){let t=new Map,n=new Set,r=new Set,i=new Set;if(!e||typeof e!=`object`)return{holidayName:t,makeup:n,years:r,provisionalYears:i};let a=e.years;if(!a||typeof a!=`object`)return{holidayName:t,makeup:n,years:r,provisionalYears:i};for(let[e,o]of Object.entries(a)){let a=Number(e);if(!Number.isInteger(a)||!o||typeof o!=`object`)continue;let s=o.holidays;if(Array.isArray(s)){r.add(a),o.provisional&&i.add(a);for(let e of s){if(!e||typeof e.name!=`string`)continue;let r=Sn(e.from),i=Sn(e.to);if(!(!r||!i||r>i)){for(let n=new Date(r);n<=i;n.setDate(n.getDate()+1))t.set(Cn(n),e.name);for(let t of e.workdays??[])xn.test(t)&&n.add(t)}}}}return{holidayName:t,makeup:n,years:r,provisionalYears:i}}var Tn=null;function En(){return Tn??=fetch(`/cn-holidays.json`,{cache:`no-cache`}).then(e=>e.ok?e.json():null).then(e=>e?wn(e):bn).catch(()=>bn),Tn}function Dn(e,t){if(e.makeup.has(t))return!1;if(e.holidayName.has(t))return!0;let n=Sn(t);if(!n)return!1;let r=n.getDay();return r===0||r===6}function On(e,t){return Dn(e,t)?e.holidayName.get(t)??`周末`:null}var kn=[`todoInProgress`,`taskInProgress`,`overdue`,`todoRate`,`taskRate`],An=`kpi`,jn=[{id:`todoInProgress`,title:`进行中待办`,desc:`状态为进行中的待办数量`,w:3,h:8,minW:2,minRows:7},{id:`taskInProgress`,title:`进行中任务`,desc:`状态为进行中的任务数量`,w:3,h:8,minW:2,minRows:7},{id:`overdue`,title:`已逾期`,desc:`已过截止日期且未完成的待办`,w:3,h:8,minW:2,minRows:7},{id:`todoRate`,title:`待办完成率`,desc:`已完成占全部待办的比例`,w:3,h:8,minW:2,minRows:7},{id:`taskRate`,title:`任务完成率`,desc:`已完成占全部任务的比例`,w:3,h:8,minW:2,minRows:7},{id:`activeProjects`,title:`活跃项目`,desc:`项目管理里状态为进行中的项目数量`,w:3,h:8,minW:2,minRows:7},{id:`spaces`,title:`数据空间`,desc:`当前账号下共有多少个数据空间`,w:3,h:8,minW:2,minRows:7},{id:`countdown`,title:`倒计时`,desc:`距离今天结束 / 周末 / 今年结束,可切换`,w:3,h:10,minW:3,minRows:8},{id:`todayTodos`,title:`今日待办`,desc:`开始 ~ 截止区间含今天,可勾选完成`,w:6,h:12,minW:4},{id:`activeTasks`,title:`进行中任务列表`,desc:`状态为进行中的任务`,w:6,h:19,minW:4},{id:`testChart`,title:`测试统计`,desc:`各维度最新一天的数量`,w:6,h:19,minW:4},{id:`todoCalendar`,title:`待办日历`,desc:`日 / 周 / 月视图`,w:12,h:36,minW:6,minHeight:320}],Mn=jn.map(e=>e.id),Nn=new Set(Mn);function Pn(e){return typeof e==`string`&&Nn.has(e)}function Fn(e){return jn.find(t=>t.id===e)}function In(e){return Math.max(1,Math.ceil((e+12)/20))}function Ln(e){let t=Fn(e),n=t.minRows??In(180);return Math.max(n,In(t.minHeight??0))}function Rn(e){return Math.max(1,Fn(e).minW??4)}function zn(e,t){return e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h}function Bn(e,t){return Math.min(e.y+e.h,t.y+t.h)-Math.max(e.y,t.y)>Math.min(e.h,t.h)/2}function Vn(e,t=[]){let n={},r=[...t];for(let t of e){let e=Math.min(12,Math.max(1,t.w)),i=Math.max(1,Math.min(49,t.h)),a=t.at?{x:t.at.x,y:t.at.y,w:e,h:i}:null,o=a&&!r.some(e=>zn(e,a))?a:null;for(let t=0;!o&&t<=98;t+=1)for(let n=0;n+e<=12;n+=1){let a={x:n,y:t,w:e,h:i};if(!r.some(e=>zn(e,a))){o=a;break}}let s=o??{x:0,y:0,w:e,h:i};n[t.id]=s,r.push(s)}return n}function Hn(e){return Vn(e.map(e=>{let t=Fn(e);return{id:e,w:Math.min(12,Math.max(Rn(e),t.w)),h:Math.max(Ln(e),t.h)}}))}var Un=Hn(Mn);function Wn(e){return{...Un[e]}}function Gn(){return{hidden:[...Mn],rects:{}}}function Kn(e){let t={...e?.rects??{}},n=Mn.filter(e=>t[e]).map(e=>t[e]),r=Mn.filter(e=>!t[e]).map(e=>{let t=Wn(e);return{id:e,w:t.w,h:t.h,at:t}});return Object.assign(t,Vn(r,n)),rr({hidden:[],rects:t})}function qn(e){if(!Array.isArray(e))return[];let t=[];for(let n of e)Pn(n)&&!t.includes(n)&&t.push(n);return t}function Jn(e){let t=qn(e);if(Array.isArray(e)&&e.includes(An))for(let e of kn)t.includes(e)||t.push(e);return t}function Yn(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e))Pn(n)&&(r===`half`||r===`full`)&&(t[n]=r);return t}function Xn(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e)){if(!Pn(n))continue;let e=typeof r==`number`?r:Number(r);Number.isFinite(e)&&(t[n]=Math.round(Math.min(960,Math.max(180,e))))}return t}function Zn(e){let t=Jn(e.hidden),n=qn(e.order);for(let e of Mn)n.includes(e)||n.push(e);let r=Yn(e.spans),i=Xn(e.heights),a={},o=0,s=null;for(let e of n){if(t.includes(e))continue;let n=Fn(e),c=r[e]===`full`?12:r[e]===`half`?Math.max(Rn(e),6):n.w,l=i[e]?In(i[e]):n.h;c>=12?(s&&=(o=s.top+s.h,null),a[e]={x:0,y:o,w:12,h:l},o+=l):s?(a[e]={x:12-c,y:s.top,w:c,h:l},o=s.top+Math.max(s.h,l),s=null):(s={top:o,h:l},a[e]={x:0,y:o,w:c,h:l})}return{hidden:t,rects:a}}function Qn(e,t){return $n(t,Rn(e),Ln(e))}function $n(e,t,n){if(!e||typeof e!=`object`||Array.isArray(e))return null;let r=e,i=e=>{let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.round(t):null},a=i(r.x),o=i(r.y),s=i(r.w),c=i(r.h);if(a===null||o===null||s===null||c===null)return null;let l=Math.max(t,Math.min(12,s)),u=Math.max(n,Math.min(49,c));return{x:Math.max(0,Math.min(12-l,a)),y:Math.max(0,o),w:l,h:u}}function er(e,t){let n=$n(e,2,10);if(!n||kn.some(e=>t[e]))return;let r=n.x,i=n.y,a=0;for(let e of kn){let n=Fn(e);r>0&&r+n.w>12&&(r=0,i+=a,a=0),t[e]={x:r,y:i,w:n.w,h:n.h},r+=n.w,a=Math.max(a,n.h),r>=12&&(r=0,i+=a,a=0)}}function tr(e,t){let n=new Set(e),r=Mn.filter(e=>!n.has(e)&&t[e]).sort((e,n)=>t[e].y-t[n].y||t[e].x-t[n].x),i=[];for(let e of r){let n=t[e];for(let e=0;e<=r.length;e+=1){let e=i.filter(e=>zn(e,n));if(e.length===0)break;n.y=Math.max(...e.map(e=>e.y+e.h))}i.push(n)}}function nr(e,t){let n=new Set(e),r=Mn.filter(e=>!n.has(e)&&!t[e]);if(!r.length)return;let i=Mn.filter(e=>t[e]).map(e=>t[e]);Object.assign(t,Vn(r.map(e=>{let t=Wn(e);return{id:e,w:t.w,h:t.h,at:t}}),i))}function rr(e){let t=ir(e);return tr(t.hidden,t.rects),t}function ir(e){if(!e||typeof e!=`object`||Array.isArray(e))return Gn();let t=e;if(!t.rects||typeof t.rects!=`object`)return Array.isArray(t.order)?Zn(t):{hidden:Jn(t.hidden),rects:{}};let n={};for(let[e,r]of Object.entries(t.rects)){if(!Pn(e))continue;let t=Qn(e,r);t&&(n[e]=t)}let r=Jn(t.hidden),i=t.rects[An];return i===void 0?(nr(r,n),{hidden:r,rects:n}):(er(i,n),ur({hidden:r,rects:n}))}function ar(e){let t=[...sr(e)].sort((e,t)=>e.rect.y-t.rect.y||e.rect.x-t.rect.x),n=0;return t.map(({id:e,rect:t})=>{let r={x:0,y:n,w:12,h:t.h};return n+=t.h,{id:e,rect:r}})}function or(e,t){return e.rects[t]??Wn(t)}function sr(e){let t=new Set(e.hidden);return Mn.filter(e=>!t.has(e)).map(t=>({id:t,def:Fn(t),rect:or(e,t)}))}function cr(e,t){let n=new Set(e.hidden);n.delete(t);let r=Mn.filter(e=>e!==t&&!n.has(e)).map(t=>[t,e.rects[t]??Wn(t)]),i=e.rects[t],a=(i&&!r.some(([,e])=>zn(i,e))?i:null)??{x:0,y:r.reduce((e,[,t])=>Math.max(e,t.y+t.h),0),w:Fn(t).w,h:Fn(t).h};return rr({...e,hidden:[...n],rects:{...e.rects,[t]:a}})}function lr(e,t,n=`resize`,r={}){let i=new Set(e.hidden);if(i.has(t))return e;let a=Mn.filter(e=>!i.has(e)),o={};for(let t of Mn){let n=e.rects[t];n&&(o[t]={...n})}for(let e of a)o[e]||(o[e]=Wn(e));let s=[...a].sort((e,t)=>o[e].y-o[t].y||o[e].x-o[t].x),c=[t],l=new Set,u=n===`drag`&&r.direction===`up`,d=600;for(;c.length>0&&d>0;){--d;let e=c.shift(),r=o[e];for(let i of s){if(i===e||i===t)continue;let a=o[i];if(zn(r,a)){if(n===`drag`&&!l.has(i)&&Bn(r,a)){let e=(a.x+a.w/2>=r.x+r.w/2?[r.x+r.w,r.x-a.w]:[r.x-a.w,r.x+r.w]).find(e=>e>=0&&e+a.w<=12&&e!==a.x&&!s.some(n=>{if(n===i||n===t)return!1;let r=o[n];return r!==void 0&&zn(r,{x:e,y:a.y,w:a.w,h:a.h})}));if(e!==void 0){a.x=e,l.add(i),c.push(i);continue}}if(u&&a.y<r.y){let e=r.y-a.h;if(e>=0&&e<a.y&&!s.some(t=>{if(t===i)return!1;let n=o[t];return n!==void 0&&zn(n,{x:a.x,y:e,w:a.w,h:a.h})})){a.y=e,l.add(i),c.push(i);continue}}a.y=r.y+r.h,l.add(i),c.push(i)}}}return{hidden:e.hidden,rects:o}}function ur(e){let t=new Set(e.hidden),n=Mn.filter(e=>!t.has(e)).map(t=>({id:t,rect:{...e.rects[t]??Wn(t)}})).sort((e,t)=>e.rect.y-t.rect.y||e.rect.x-t.rect.x),r={};for(let t of e.hidden){let n=e.rects[t];n&&(r[t]={...n})}let i=[];for(let{id:e,rect:t}of n){let n=Math.min(12,Math.max(Rn(e),t.w)),a=Math.min(49,Math.max(Ln(e),t.h)),o={x:Math.max(0,Math.min(12-n,t.x)),y:0,w:n,h:a};for(let e=0;e<=i.length+1;e+=1){let e=i.filter(e=>zn(e,o));if(e.length===0)break;o={...o,y:Math.max(...e.map(e=>e.y+e.h))}}r[e]=o,i.push(o)}return rr({...e,rects:r})}function dr(e,t){return t>0?Math.round(e/t*100):0}function fr(e,t,n=x()){let r=0,i=0,a=0,o=0;for(let t of e)t.status!==`cancelled`&&(o+=1,t.status===`done`&&(a+=1),t.status===`in_progress`&&(r+=1),S(t,n)===`overdue`&&(i+=1));let s=0,c=0,l=0;for(let e of t)e.status!==`closed`&&e.status!==`cancelled`&&(l+=1,e.status===`done`&&(c+=1),e.status===`in_progress`&&(s+=1));return{todoInProgress:r,taskInProgress:s,overdue:i,todoDone:a,todoTotal:o,todoRate:dr(a,o),taskDone:c,taskTotal:l,taskRate:dr(c,l)}}function pr(e){let t=e.startDate||e.dueDate,n=e.dueDate||e.startDate;return!t||!n?null:t<=n?{start:t,end:n}:{start:n,end:t}}function mr(e,t=x()){return O(e.filter(e=>{if(w(e.status))return!1;let n=pr(e);return n&&n.start<=t&&t<=n.end?!0:!!(e.dueDate&&e.dueDate<t)}))}function hr(e){return D(e.filter(e=>e.status===`in_progress`))}var gr=/^\d{4}-\d{2}-\d{2}$/;function _r(e){if(!gr.test(e))return null;let[t,n,r]=e.split(`-`).map(Number),i=new Date(t,(n??1)-1,r??1);return Number.isNaN(i.getTime())?null:i}function vr(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function yr(e,t){let n=_r(e);return n?(n.setDate(n.getDate()+t),vr(n)):e}function br(e,t){let n=_r(e),r=_r(t);return!n||!r?0:Math.round((r.getTime()-n.getTime())/864e5)}function xr(e,t){let n=_r(e);return n?vr(new Date(n.getFullYear(),n.getMonth()+t,1)):e}function Sr(e=x()){let t=_r(e)??new Date,n=new Date(t.getFullYear(),t.getMonth(),1),r=(n.getDay()+6)%7,i=new Date(n.getFullYear(),n.getMonth(),1-r);return Array.from({length:42},(e,t)=>vr(new Date(i.getFullYear(),i.getMonth(),i.getDate()+t)))}function Cr(e=x()){let t=_r(e)??new Date,n=(t.getDay()+6)%7,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()-n);return Array.from({length:7},(e,t)=>vr(new Date(r.getFullYear(),r.getMonth(),r.getDate()+t)))}var wr={days:0,hours:0,minutes:0,seconds:0,resting:!0,target:`周末`,targetDate:``};function Tr(e=new Date,t=bn){let n=vr(e);if(Dn(t,n))return{...wr,target:On(t,n)??`周末`,targetDate:n};let r=null,i=n;for(let e=1;e<=400;e+=1)if(i=yr(i,1),Dn(t,i)){r=i;break}if(!r)return{...wr,resting:!1};let a=_r(r),o=Math.max(0,(a?.getTime()??e.getTime())-e.getTime()),s=Math.floor(o/1e3);return{days:Math.floor(s/86400),hours:Math.floor(s%86400/3600),minutes:Math.floor(s%3600/60),seconds:s%60,resting:!1,target:On(t,r)??`周末`,targetDate:r}}var Er=[`today`,`offWork`,`weekend`,`year`],Dr=`18:00`,Or=`00:00`;function kr(e){if(typeof e!=`string`)return null;let t=/^(\d{1,2}):(\d{1,2})$/.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return!Number.isFinite(n)||!Number.isFinite(r)||n>23||r>59?null:`${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`}var Ar=kr;function jr(e){let t=Math.max(0,Math.floor(e/1e3));return{days:Math.floor(t/86400),hours:Math.floor(t%86400/3600),minutes:Math.floor(t%3600/60),seconds:t%60}}var Mr={today:`距离今天结束`,offWork:`距离下班`,year:`距离今年结束`};function Nr(e=new Date,t=bn,n=`weekend`,r=Dr,i=Or){if(n===`offWork`){let t=Ar(r)??`18:00`,[i,a]=t.split(`:`).map(Number),o=new Date(e.getFullYear(),e.getMonth(),e.getDate(),i??18,a??0,0,0),s=vr(o),c=o.getTime()-e.getTime(),l=jr(c),u=c<=0;return{kind:n,...l,targetDate:s,title:u?`已经下班啦`:Mr.offWork,note:u?`今天 ${t} 下班,辛苦啦`:`今天 ${t} 下班`,reached:u,provisional:!1}}if(n===`today`){let t=new Date(e.getFullYear(),e.getMonth(),e.getDate()+1),r=vr(t),i=jr(t.getTime()-e.getTime());return{kind:n,...i,targetDate:r,title:Mr.today,note:`到 ${r} 00:00 结束今天`,reached:i.days+i.hours+i.minutes+i.seconds===0,provisional:!1}}if(n===`year`){let t=new Date(e.getFullYear()+1,0,1),r=vr(t),i=jr(t.getTime()-e.getTime());return{kind:n,...i,targetDate:r,title:Mr.year,note:`到 ${r} 00:00 跨年`,reached:i.days+i.hours+i.minutes+i.seconds===0,provisional:!1}}let a=Tr(e,t),o=a.targetDate!==``&&t.provisionalYears.has(Number(a.targetDate.slice(0,4))),s=kr(i)??`00:00`,[c,l]=s.split(`:`).map(Number),u=_r(a.targetDate),d=u?new Date(u.getFullYear(),u.getMonth(),u.getDate()-(s===`00:00`?0:1),c??0,l??0,0,0):null;if(!d)return{kind:n,...jr(0),targetDate:a.targetDate,title:`距离${a.target}`,note:`暂时算不出下一个休息日`,reached:!1,provisional:o};let f=d.getTime()-e.getTime(),p=jr(f),m=f<=0,h=vr(d);return{kind:n,...p,targetDate:h,title:m?`${a.target}愉快`:`距离${a.target}`,note:m?`好好休息,回来再战`:o?`${a.targetDate.slice(0,4)} 年安排待公布,先按已公布假日计算`:`到 ${h} ${s} 开始${a.target===`周末`?`休息`:`放假`}`,reached:m,provisional:o}}function Pr(e,t=10){let n=new Map;for(let t of e){if(t.draft)continue;let e=t.dimensions[0]?.trim();if(!e)continue;let r=n.get(e);(!r||t.date>r.date||t.date===r.date&&t.createdAt>r.createdAt)&&n.set(e,t)}return[...n.values()].map(e=>({dimension:e.dimensions[0],count:e.count,date:e.date})).sort((e,t)=>t.count-e.count||e.dimension.localeCompare(t.dimension,`zh`)).slice(0,Math.max(0,t))}function Fr(e,t=3){if(!Number.isFinite(e)||e<=0)return[0,1];let n=e/Math.max(1,t),r=10**Math.floor(Math.log10(n)),i=n/r,a=Math.max(1,(i<=1?1:i<=2?2:i<=5?5:10)*r),o=Math.max(a,Math.ceil(e/a)*a),s=[];for(let e=0;e<=o+a/1e3;e+=a)s.push(Math.round(e));return s}function Ir(e,t,n){let r=e.length,i=Math.max(1,Math.floor(n)),a=Math.max(1,Math.ceil(r/i)),o=Math.min(a,Math.max(1,Math.floor(t)||1));return{items:e.slice((o-1)*i,o*i),page:o,pages:a,total:r}}function Lr(e,t){if(t.length===0)return{spans:[],lanes:0};let n=t[0],r=t[t.length-1],i=[],a=[],o=e.filter(e=>e.status!==`cancelled`).map(e=>{let i=e.startDate||e.dueDate,a=e.dueDate||e.startDate;if(!i||!a)return null;let o=i<=a?i:a,s=i<=a?a:i;return s<n||o>r?null:{item:e,start:Math.max(0,Math.min(t.length-1,br(n,o))),end:Math.max(0,Math.min(t.length-1,br(n,s)))}}).filter(e=>!!e).sort((e,t)=>e.start-t.start||t.end-e.end);for(let e of o){let t=i.findIndex(t=>t<e.start);t<0?(t=i.length,i.push(e.end)):i[t]=e.end,a.push({...e,lane:t})}return{spans:a,lanes:i.length}}function Rr(e,t){let n=Lr(e,t),r=[];for(let e=0;e<t.length;e+=7){let i=Math.min(t.length-1,e+6),a=n.spans.filter(t=>t.end>=e&&t.start<=i).map(t=>({...t,start:Math.max(t.start,e)-e,end:Math.min(t.end,i)-e}));r.push({days:t.slice(e,e+7),spans:a})}return r}function zr(e,t){if(e.status===`cancelled`)return!1;let n=e.startDate||e.dueDate,r=e.dueDate||e.startDate;return!n||!r?!1:t>=(n<=r?n:r)&&t<=(n<=r?r:n)}var Br=`inline-flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[11px] leading-4 text-stone-400 transition-colors hover:bg-stone-100 hover:text-[#3370ff] whitespace-nowrap`;function Vr(){return(0,$.jsx)(`svg`,{viewBox:`0 0 12 12`,width:`10`,height:`10`,"aria-hidden":`true`,children:(0,$.jsx)(`path`,{d:`M4.5 2.75 7.75 6 4.5 9.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Hr({tone:e,children:t}){return(0,$.jsx)(`span`,{className:`tw-dash-ico`,"data-tone":e,"aria-hidden":`true`,children:t})}function Ur(e){let{title:t,icon:n,tone:r=`blue`,href:i,action:a,fill:o,children:s}=e;return(0,$.jsxs)(`section`,{className:`tw-dash-surface flex h-full min-h-0 flex-col overflow-hidden rounded-2xl border border-stone-200 bg-white p-4`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[n?(0,$.jsx)(Hr,{tone:r,children:n}):null,(0,$.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-[14px] font-semibold tracking-tight text-stone-900`,children:t}),i&&a?(0,$.jsxs)(`a`,{href:`/${i}`,className:Br,children:[a,(0,$.jsx)(Vr,{})]}):null]}),(0,$.jsx)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col ${o?``:`tw-dash-scroll overflow-y-auto`}`,children:s})]})}function Wr({children:e}){return(0,$.jsx)(`p`,{className:`flex flex-1 items-center justify-center py-8 text-sm text-stone-400`,children:e})}function Gr({name:e,detail:t}){return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-1.5 py-8 text-center`,children:[(0,$.jsxs)(`p`,{className:`text-sm text-stone-500`,children:[`「`,e,`」插件未启用`]}),t?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-stone-400`,children:t}):null,(0,$.jsx)(`a`,{href:`/plugins/`,className:`mt-1 rounded-md bg-stone-100 px-2.5 py-1 text-xs font-medium text-[#3370ff] transition-colors hover:bg-[#e8f0fe]`,children:`去开启`})]})}function Kr({message:e}){return(0,$.jsxs)(`p`,{className:`flex flex-1 items-center justify-center px-2 py-6 text-center text-xs text-[#c02a26]`,children:[`读取失败:`,e]})}function qr(e){let{text:t,className:n}=e,r=(0,X.useRef)(null),[i,a]=(0,X.useState)(null);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{ref:r,className:`block truncate ${n??``}`,onMouseEnter:()=>{let e=r.current;if(!e||e.scrollWidth<=e.clientWidth+1)return;let t=e.getBoundingClientRect();a({x:t.left+t.width/2,y:t.top})},onMouseLeave:()=>a(null),children:t}),i?(0,et.createPortal)((0,$.jsx)(`span`,{role:`tooltip`,className:`tw-dash-tip`,style:{left:i.x,top:i.y},children:t}),document.body):null]})}var Jr={pool:`bg-stone-100 text-stone-600`,in_progress:`bg-[#e1eaff] text-[#1f4ec2]`,pending:`bg-stone-100 text-stone-600`,done:`bg-[#d9f5d2] text-[#1d7a12]`,closed:`bg-stone-100 text-stone-400`,cancelled:`bg-stone-100 text-stone-400`,overdue:`bg-[#fee4e3] text-[#c02a26]`},Yr={urgent_important:`bg-[#fee4e3] text-[#c02a26]`,important:`bg-[#fff1e3] text-[#a85b00]`,urgent:`bg-[#fff7d6] text-[#8a6100]`,normal:`bg-stone-100 text-stone-600`,"":`bg-transparent text-stone-400`},Xr=`tw-dash-th sticky top-0 z-1 whitespace-nowrap border-b border-stone-200 px-2.5 py-2 text-left text-[11px] font-medium text-stone-400`,Zr=`px-2.5 py-2.5 align-middle`;function Qr({status:e,label:t}){return(0,$.jsx)(`span`,{className:`inline-flex whitespace-nowrap rounded-full px-2 py-0.5 text-[10px] leading-4 ${Jr[e]??Jr.pending}`,children:t})}function $r({priority:e,label:t}){return(0,$.jsx)(`span`,{className:`inline-flex whitespace-nowrap rounded-full px-2 py-0.5 text-[10px] leading-4 ${Yr[e]??Yr[``]}`,children:t})}function ei(e){let{page:t,pages:n,total:r,onPage:i}=e;return r<=0?null:(0,$.jsxs)(`div`,{className:`mt-auto flex shrink-0 items-center justify-end gap-3 border-t border-stone-100 pt-2.5 text-[11px] text-stone-400`,children:[(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[`共 `,r,` 条`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`上一页`,disabled:t<=1,onClick:()=>i(t-1),className:`flex h-6 w-6 items-center justify-center rounded-md transition-colors hover:bg-stone-100 hover:text-stone-700 disabled:pointer-events-none disabled:opacity-30`,children:`‹`}),(0,$.jsx)(`span`,{className:`min-w-5 text-center text-stone-600 tabular-nums`,children:t}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`下一页`,disabled:t>=n,onClick:()=>i(t+1),className:`flex h-6 w-6 items-center justify-center rounded-md transition-colors hover:bg-stone-100 hover:text-stone-700 disabled:pointer-events-none disabled:opacity-30`,children:`›`})]})]})}function ti({children:e}){return(0,$.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`15`,height:`15`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:e})}function ni(){return(0,$.jsxs)(ti,{children:[(0,$.jsx)(`path`,{d:`M9 6h11M9 12h11M9 18h11`}),(0,$.jsx)(`path`,{d:`m3.5 6 1 1 2-2M3.5 12l1 1 2-2M3.5 18l1 1 2-2`})]})}function ri(){return(0,$.jsxs)(ti,{children:[(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`}),(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]})}function ii(){return(0,$.jsxs)(ti,{children:[(0,$.jsx)(`circle`,{cx:`12`,cy:`13`,r:`8`}),(0,$.jsx)(`path`,{d:`M12 9v4l2.5 1.5M9 2h6`})]})}function ai(){return(0,$.jsx)(ti,{children:(0,$.jsx)(`path`,{d:`M4 20V10M10 20V4M16 20v-7M22 20H2`})})}function oi(){return(0,$.jsxs)(ti,{children:[(0,$.jsx)(`rect`,{x:`3`,y:`4.5`,width:`18`,height:`16`,rx:`2.5`}),(0,$.jsx)(`path`,{d:`M8 2.5v4M16 2.5v4M3 9.5h18`})]})}function si(){return(0,$.jsxs)(ti,{children:[(0,$.jsx)(`path`,{d:`M12 3.5c3-2 6 0 6 3.5 0 4.5-2.2 7.5-6 10-3.8-2.5-6-5.5-6-10 0-3.5 3-5.5 6-3.5Z`}),(0,$.jsx)(`path`,{d:`M12 8.5v3.5`})]})}function ci(){return(0,$.jsxs)(ti,{children:[(0,$.jsx)(`path`,{d:`m3 16 5.5-5.5 3.5 3.5L21 5`}),(0,$.jsx)(`path`,{d:`M15 5h6v6`})]})}function li(){return(0,$.jsxs)(ti,{children:[(0,$.jsx)(`path`,{d:`M3 7.5h6l2 2.5h10v8.5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z`}),(0,$.jsx)(`path`,{d:`M3 10V6a2 2 0 0 1 2-2h4l2 3.5`})]})}function ui(){return(0,$.jsxs)(ti,{children:[(0,$.jsx)(`path`,{d:`m12 3 8.5 4.5L12 12 3.5 7.5Z`}),(0,$.jsx)(`path`,{d:`m3.5 12 8.5 4.5 8.5-4.5`}),(0,$.jsx)(`path`,{d:`m3.5 16.5 8.5 4.5 8.5-4.5`})]})}function di(e){return e?e.split(`-`).join(`/`):`—`}function fi(e){let{tasks:t,enabled:n,error:r}=e,i=x(),[a,o]=(0,X.useState)(1),s=Ir(hr(t),a,5),c;return c=n?r?(0,$.jsx)(Kr,{message:r}):s.total?(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsx)(`div`,{className:`tw-dash-scroll min-h-0 flex-1 overflow-auto`,children:(0,$.jsxs)(`table`,{className:`w-full min-w-[440px] table-fixed border-collapse text-[12px]`,children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{}),(0,$.jsx)(`col`,{style:{width:80}}),(0,$.jsx)(`col`,{style:{width:100}}),(0,$.jsx)(`col`,{style:{width:84}}),(0,$.jsx)(`col`,{style:{width:84}})]}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{className:Xr,children:`任务描述`}),(0,$.jsx)(`th`,{className:Xr,children:`任务状态`}),(0,$.jsx)(`th`,{className:Xr,children:`重要紧急程度`}),(0,$.jsx)(`th`,{className:Xr,children:`开始日期`}),(0,$.jsx)(`th`,{className:Xr,children:`结束日期`})]})}),(0,$.jsx)(`tbody`,{children:s.items.map(e=>{let t=!!e.dueDate&&e.dueDate<i;return(0,$.jsxs)(`tr`,{className:`border-b border-stone-100 transition-colors last:border-0 hover:bg-stone-50`,children:[(0,$.jsx)(`td`,{className:Zr,children:(0,$.jsx)(qr,{text:e.title,className:`text-stone-700`})}),(0,$.jsx)(`td`,{className:Zr,children:(0,$.jsx)(Qr,{status:e.status,label:ee[e.status]})}),(0,$.jsx)(`td`,{className:Zr,children:(0,$.jsx)($r,{priority:e.priority,label:e.priority?k[e.priority]:`—`})}),(0,$.jsx)(`td`,{className:`${Zr} whitespace-nowrap text-[11px] text-stone-400 tabular-nums`,children:di(e.startDate)}),(0,$.jsx)(`td`,{className:`${Zr} whitespace-nowrap text-[11px] tabular-nums ${t?`text-[#c02a26]`:`text-stone-400`}`,children:di(e.dueDate)})]},e.id)})})]})}),(0,$.jsx)(ei,{page:s.page,pages:s.pages,total:s.total,onPage:o})]}):(0,$.jsx)(Wr,{children:`没有进行中的任务`}):(0,$.jsx)(Gr,{name:`任务管理`,detail:`启用后这里会显示进行中的任务`}),(0,$.jsx)(Ur,{title:`进行中任务列表`,icon:(0,$.jsx)(ri,{}),tone:`indigo`,href:`tasks/`,action:`打开任务`,children:c})}var pi={today:`今天`,offWork:`下班`,weekend:`周末`,year:`今年`},mi={today:`距离今天结束`,offWork:`距离下班`,weekend:`距离下一个休息日`,year:`距离今年结束`},hi={offWork:{fallback:Dr,pref:`dashboard.offWork`,label:`下班时间`},weekend:{fallback:Or,pref:`dashboard.weekendTime`,label:`周末开始时间`}};function gi(){let[e,t]=(0,X.useState)(()=>new Date),[n,r]=(0,X.useState)(bn),[i,a]=(0,X.useState)(()=>u(`dashboard.countdown`,Er,`weekend`)),[o,s]=(0,X.useState)(()=>({offWork:f(`dashboard.offWork`,``),weekend:f(`dashboard.weekendTime`,``)})),[l,p]=(0,X.useState)(()=>i===`offWork`&&!kr(f(`dashboard.offWork`,``))?`offWork`:null),[m,h]=(0,X.useState)(()=>kr(f(`dashboard.offWork`,``))??`18:00`),g=(0,X.useRef)(`weekend`),_=(0,X.useRef)(null);(0,X.useEffect)(()=>{let e=!0;return En().then(t=>{e&&r(t)}),()=>{e=!1}},[]),(0,X.useEffect)(()=>{let e=window.setInterval(()=>t(new Date),1e3);return()=>window.clearInterval(e)},[]);let v=e=>{let t=hi[e];t&&(g.current=e===i?e:i,h(kr(o[e])??t.fallback),p(e))};(0,X.useEffect)(()=>{l&&_.current?.focus()},[l]);let y=()=>{let e=l?hi[l]:null,t=kr(m);if(!e||!t)return;let n=l;s(e=>({...e,[n]:t})),d(e.pref,t),p(null)},b=()=>{let e=l;p(null),e===`offWork`&&!kr(o.offWork)&&(a(g.current),c(`dashboard.countdown`,g.current))},x=Nr(e,n,i,o.offWork,o.weekend),S=e=>String(e).padStart(2,`0`),C=[{value:x.days,label:`天`},{value:x.hours,label:`时`},{value:x.minutes,label:`分`},{value:x.seconds,label:`秒`}],w=hi[i],T=l===i&&!!w;return(0,$.jsxs)(`section`,{className:`tw-dash-surface flex h-full min-h-0 flex-col overflow-hidden rounded-2xl border border-stone-200 bg-white p-4`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center gap-2`,children:[(0,$.jsx)(Hr,{tone:`amber`,children:(0,$.jsx)(ii,{})}),(0,$.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold tracking-tight text-stone-900`,children:x.title}),(0,$.jsx)(`div`,{role:`group`,"aria-label":`倒计时目标`,className:`flex shrink-0 items-center gap-0.5 rounded-lg bg-stone-100 p-0.5`,children:Er.map(e=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":i===e,"aria-label":mi[e],onClick:()=>{let t=i;a(e),c(`dashboard.countdown`,e),e===`offWork`&&!kr(o.offWork)?v(t):p(null)},className:`h-6 rounded-md px-1.5 text-[10px] leading-4 transition-colors ${i===e?`bg-white font-medium text-stone-900 shadow-sm`:`text-stone-500 hover:text-stone-800`}`,children:pi[e]},e))})]}),(0,$.jsxs)(`div`,{className:`tw-countdown-body mt-2 flex min-h-0 flex-1 flex-col justify-center gap-1.5 overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`tw-countdown-tile grid grid-cols-4 gap-1.5`,children:C.map(e=>(0,$.jsxs)(`div`,{className:`tw-countdown-block`,children:[(0,$.jsx)(`span`,{className:`tw-countdown-num`,children:S(e.value)}),(0,$.jsx)(`span`,{className:`tw-countdown-unit`,children:e.label})]},e.label))}),w&&T?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`input`,{ref:_,type:`time`,value:m,"aria-label":w.label,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&y(),e.key===`Escape`&&b()},className:`h-6 min-w-0 flex-1 rounded-md border border-stone-200 bg-white px-1.5 text-[11px] text-stone-700 tabular-nums`}),(0,$.jsx)(`button`,{type:`button`,onClick:y,className:`h-6 shrink-0 rounded-md bg-[#3370ff] px-2 text-[10px] font-medium text-white transition-colors hover:bg-[#2b5fd9]`,children:`确定`}),(0,$.jsx)(`button`,{type:`button`,onClick:b,className:`h-6 shrink-0 rounded-md px-1.5 text-[10px] text-stone-500 transition-colors hover:bg-stone-100 hover:text-stone-700`,children:`取消`})]}):w?(0,$.jsxs)(`button`,{type:`button`,onClick:()=>v(i),"aria-label":`修改${w.label}`,className:`tw-countdown-edit group flex min-w-0 shrink-0 items-center gap-1 text-left`,children:[(0,$.jsx)(`span`,{className:`truncate text-[10px] leading-4 text-stone-400`,children:x.note}),(0,$.jsx)(`span`,{className:`tw-countdown-edit-hint shrink-0 text-[10px] leading-4`,children:`修改`})]}):(0,$.jsx)(`p`,{className:`truncate text-[10px] leading-4 text-stone-400`,children:x.note})]})]})}function _i(e){let{label:t,icon:n,tone:r,value:i,rate:a,bar:o,hint:s,href:c,danger:l,disabled:u,pluginLink:d=!0}=e,f=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`tw-dash-ico`,"data-tone":r,"aria-hidden":`true`,children:n}),(0,$.jsx)(`span`,{className:`truncate text-[13px] font-medium text-stone-500`,children:t})]}),(0,$.jsxs)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col justify-center`,children:[(0,$.jsx)(`div`,{className:`min-h-0`,children:a===void 0?(0,$.jsx)(`p`,{className:`text-[30px] leading-9 font-semibold tracking-tight tabular-nums ${u?`text-stone-300`:l?`text-[#c02a26]`:`text-stone-900`}`,children:i}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`p`,{className:`text-[30px] leading-9 font-semibold tracking-tight text-stone-900 tabular-nums`,children:[a,(0,$.jsx)(`span`,{className:`ml-0.5 text-sm font-normal text-stone-400`,children:`%`})]}),(0,$.jsx)(`div`,{className:`tw-dash-track mt-2 h-1.5 w-full overflow-hidden rounded-full`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full transition-[width] ${o??`bg-[#3370ff]`}`,style:{width:`${Math.min(100,Math.max(0,a))}%`}})})]})}),s?(0,$.jsx)(`p`,{className:`shrink-0 truncate pt-1.5 text-[11px] text-stone-400`,children:s}):null,u&&d?(0,$.jsx)(`a`,{href:`/plugins/`,className:`mt-1 inline-block text-[11px] font-medium text-[#3370ff] hover:underline`,children:`去开启`}):null]})]}),p=`tw-metric-card flex h-full min-h-0 flex-col overflow-hidden rounded-2xl p-4 ${u?`border border-dashed border-stone-200 bg-transparent`:`tw-dash-surface border border-stone-200 bg-white`}`;return c?(0,$.jsx)(`a`,{href:`/${c}`,"data-tone":r,className:p,children:f}):(0,$.jsx)(`div`,{"data-tone":r,className:p,children:f})}function vi({projects:e,enabled:t,error:n}){let r=(0,X.useMemo)(()=>e.filter(e=>e.status===`in_progress`).length,[e]);return(0,$.jsx)(_i,{label:`活跃项目`,tone:`violet`,icon:(0,$.jsx)(li,{}),value:t&&!n?r:`—`,hint:t?n?`项目管理服务未就绪`:`共 ${e.length} 个项目`:`项目列表未开启`,href:`pm/projects/`,disabled:!t})}function yi({todos:e,enabled:t}){let n=fr(e,[]),r=t&&n.overdue>0;return(0,$.jsx)(_i,{label:`已逾期`,tone:`red`,icon:(0,$.jsx)(si,{}),value:t?n.overdue:`—`,hint:t?r?`需要关注`:`一切正常`:`「待办事项」插件未启用`,href:t?`todos/`:void 0,danger:r,disabled:!t})}function bi({total:e,activeName:t}){return(0,$.jsx)(_i,{label:`数据空间`,tone:`indigo`,icon:(0,$.jsx)(ui,{}),value:e??`—`,hint:t?`当前:${t}`:`本地服务未就绪`,disabled:e===null,pluginLink:!1})}function xi({tasks:e,enabled:t}){let n=fr([],e);return(0,$.jsx)(_i,{label:`进行中任务`,tone:`indigo`,icon:(0,$.jsx)(ri,{}),value:t?n.taskInProgress:`—`,hint:t?`共 ${n.taskTotal} 个任务`:`「任务管理」插件未启用`,href:t?`tasks/`:void 0,disabled:!t})}function Si({tasks:e,enabled:t}){let n=fr([],e);return(0,$.jsx)(_i,{label:`任务完成率`,tone:`violet`,icon:(0,$.jsx)(ci,{}),rate:t?n.taskRate:void 0,value:`—`,bar:`bg-[#34c724]`,hint:t?`${n.taskDone} / ${n.taskTotal}`:`「任务管理」插件未启用`,href:t?`tasks/`:void 0,disabled:!t})}function Ci({todos:e,enabled:t}){let n=fr(e,[]);return(0,$.jsx)(_i,{label:`进行中待办`,tone:`blue`,icon:(0,$.jsx)(ni,{}),value:t?n.todoInProgress:`—`,hint:t?`共 ${n.todoTotal} 条待办`:`「待办事项」插件未启用`,href:t?`todos/`:void 0,disabled:!t})}function wi({todos:e,enabled:t}){let n=fr(e,[]);return(0,$.jsx)(_i,{label:`待办完成率`,tone:`emerald`,icon:(0,$.jsx)(ci,{}),rate:t?n.todoRate:void 0,value:`—`,bar:`bg-[#3370ff]`,hint:t?`${n.todoDone} / ${n.todoTotal}`:`「待办事项」插件未启用`,href:t?`todos/`:void 0,disabled:!t})}function Ti(e){let{items:t,enabled:n,error:r}=e,i=Pr(t,10),a=Fr(i.reduce((e,t)=>Math.max(e,t.count),0),3),o=a[a.length-1]??1,s;return s=n?r?(0,$.jsx)(Kr,{message:r}):i.length?(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 text-[11px] leading-4 text-stone-500`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-[#3370ff]`,"aria-hidden":`true`}),`统计数量`]}),(0,$.jsxs)(`div`,{className:`mt-8 flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(`div`,{className:`relative min-h-[88px] flex-1`,children:[(0,$.jsx)(`div`,{className:`absolute inset-y-0 left-0 w-8`,"aria-hidden":`true`,children:a.map(e=>(0,$.jsx)(`span`,{className:`absolute right-1 -translate-y-1/2 text-[10px] leading-none text-stone-400 tabular-nums`,style:{bottom:`${e/o*100}%`},children:e},e))}),(0,$.jsxs)(`div`,{className:`absolute inset-y-0 left-9 right-0`,children:[a.map(e=>(0,$.jsx)(`div`,{className:`absolute inset-x-0 border-t border-stone-100`,style:{bottom:`${e/o*100}%`},"aria-hidden":`true`},e)),(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-end gap-1.5`,children:i.map(e=>(0,$.jsx)(`div`,{className:`flex h-full min-w-0 flex-1 items-end justify-center`,children:(0,$.jsx)(`div`,{className:`group/bar relative w-full max-w-8 rounded-t-[3px] bg-[#3370ff]`,style:{height:e.count>0?`${e.count/o*100}%`:`1px`},children:(0,$.jsx)(`span`,{className:`absolute bottom-full left-1/2 mb-1 -translate-x-1/2 text-[10px] leading-none text-[#3370ff] tabular-nums`,children:e.count})})},e.dimension))})]})]}),(0,$.jsx)(`div`,{className:`mt-3 flex shrink-0 gap-1.5 pl-9`,children:i.map(e=>(0,$.jsx)(`div`,{className:`min-w-0 flex-1 text-center`,children:(0,$.jsx)(qr,{text:e.dimension,className:`text-[10px] leading-4 text-stone-400`})},e.dimension))})]})]}):(0,$.jsx)(Wr,{children:`还没有测试统计数据`}):(0,$.jsx)(Gr,{name:`测试统计`,detail:`启用后这里会按维度显示最新一天的数量`}),(0,$.jsx)(Ur,{title:`测试统计`,icon:(0,$.jsx)(ai,{}),tone:`emerald`,href:`test-stats/`,action:`打开测试统计`,children:s})}function Ei(e){let{todos:t,enabled:n,error:r,onToggle:i}=e,[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(1),l=x(),u=Ir(mr(t,l),s,5),d;return d=n?r?(0,$.jsx)(Kr,{message:r}):u.total?(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsx)(`div`,{className:`tw-dash-scroll min-h-0 flex-1 overflow-auto`,children:(0,$.jsxs)(`table`,{className:`w-full min-w-[440px] table-fixed border-collapse text-[12px]`,children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{}),(0,$.jsx)(`col`,{style:{width:80}}),(0,$.jsx)(`col`,{style:{width:100}}),(0,$.jsx)(`col`,{style:{width:84}}),(0,$.jsx)(`col`,{style:{width:84}})]}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{className:Xr,children:`待办名称`}),(0,$.jsx)(`th`,{className:Xr,children:`待办状态`}),(0,$.jsx)(`th`,{className:Xr,children:`所属任务`}),(0,$.jsx)(`th`,{className:Xr,children:`开始日期`}),(0,$.jsx)(`th`,{className:Xr,children:`截止日期`})]})}),(0,$.jsx)(`tbody`,{children:u.items.map(e=>{let t=a===e.id,n=S(e,l);return(0,$.jsxs)(`tr`,{className:`border-b border-stone-100 transition-colors last:border-0 hover:bg-stone-50`,children:[(0,$.jsx)(`td`,{className:Zr,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,disabled:t,"aria-label":`标记完成 ${e.title}`,onClick:()=>{o(e.id),i(e).finally(()=>o(null))},className:`group/tick flex h-4 w-4 shrink-0 items-center justify-center rounded-full border border-stone-300 transition-colors hover:border-[#3370ff] focus-visible:border-[#3370ff] disabled:opacity-40`,children:(0,$.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-[#3370ff] transition-opacity ${t?`animate-pulse opacity-100`:`opacity-0 group-hover/tick:opacity-100 group-focus-visible/tick:opacity-100`}`})}),(0,$.jsx)(qr,{text:e.title,className:`min-w-0 text-stone-700`})]})}),(0,$.jsx)(`td`,{className:Zr,children:(0,$.jsx)(Qr,{status:n,label:E[n]})}),(0,$.jsx)(`td`,{className:Zr,children:e.linkedTask?(0,$.jsx)(qr,{text:e.linkedTask,className:`rounded-md bg-stone-100 px-1.5 py-0.5 text-[10px] text-stone-500`}):(0,$.jsx)(`span`,{className:`text-stone-300`,children:`—`})}),(0,$.jsx)(`td`,{className:`${Zr} whitespace-nowrap text-[11px] text-stone-400 tabular-nums`,children:di(e.startDate)}),(0,$.jsx)(`td`,{className:`${Zr} whitespace-nowrap text-[11px] tabular-nums ${n===`overdue`?`text-[#c02a26]`:`text-stone-400`}`,children:di(e.dueDate)})]},e.id)})})]})}),(0,$.jsx)(ei,{page:u.page,pages:u.pages,total:u.total,onPage:c})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-1 py-6 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm text-stone-400`,children:`今天没有进行中的待办`}),(0,$.jsx)(`a`,{href:`/todos/`,className:`text-xs text-stone-400 hover:underline`,children:`打开待办事项`})]}):(0,$.jsx)(Gr,{name:`待办事项`,detail:`启用后这里会显示今天进行中的待办`}),(0,$.jsx)(Ur,{title:`今日待办`,icon:(0,$.jsx)(ni,{}),tone:`blue`,href:`todos/`,action:`打开待办`,children:d})}var Di=[`一`,`二`,`三`,`四`,`五`,`六`,`日`],Oi=0,ki=34,Ai=Array.from({length:24},(e,t)=>Oi+t),ji=[{id:`day`,label:`日`},{id:`week`,label:`周`},{id:`month`,label:`月`}],Mi=ji.map(e=>e.id),Ni=[`blue`,`green`,`purple`,`orange`,`cyan`,`pink`,`lime`,`indigo`];function Pi(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return`tw-cal-tone-${Ni[t%Ni.length]}`}function Fi(e){return w(e.status)?`tw-cal-pill--done`:Pi(e.id)}function Ii(e){return w(e.status)?void 0:Li[e.priority]}var Li={urgent_important:`#e5484d`,important:`#f5a524`,urgent:`#e3b341`,normal:`#3370ff`,"":`#c7c7cc`},Ri=18,zi=28,Bi=15;function Vi(e){return String(e).padStart(2,`0`)}function Hi(e){return Number(e.slice(8,10))}function Ui(e){let[t,n,r]=e.split(`-`).map(Number);return(new Date(t??1970,(n??1)-1,r??1).getDay()+6)%7}function Wi(e){let[t,n]=e.split(`-`).map(Number);return`${t}年${n}月`}function Gi(e){let t=e[0]??``,n=e[e.length-1]??``,[r,i,a]=t.split(`-`).map(Number),[o,s,c]=n.split(`-`).map(Number);return t===n?`${r}年${i}月${a}日(周${Di[Ui(t)]})`:r===o?i===s?`${r}年${i}月${a}日 – ${c}日`:`${r}年${i}月${a}日 – ${s}月${c}日`:`${r}年${i}月${a}日 – ${o}年${s}月${c}日`}function Ki(e){let[,t,n]=e.split(`-`).map(Number);return`${t}月${n}日 周${Di[Ui(e)]??``}`}var qi=288;function Ji({state:e,todos:t,today:n,onClose:r}){let{day:i,detailId:a}=e,o=(0,X.useRef)(null),[s,c]=(0,X.useState)(a);(0,X.useEffect)(()=>c(a),[i,a]);let l=(0,X.useMemo)(()=>O(t.filter(e=>zr(e,i))),[t,i]),u=s?l.find(e=>e.id===s)??null:null;return(0,X.useEffect)(()=>{let e=e=>{o.current&&e.target instanceof Node&&!o.current.contains(e.target)&&r()},t=e=>{e.key===`Escape`&&c(e=>(e||r(),null))},n=()=>r(),i=e=>{o.current&&e.target instanceof Node&&o.current.contains(e.target)||r()};return document.addEventListener(`mousedown`,e,!0),document.addEventListener(`keydown`,t),document.addEventListener(`scroll`,i,!0),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`mousedown`,e,!0),document.removeEventListener(`keydown`,t),document.removeEventListener(`scroll`,i,!0),window.removeEventListener(`resize`,n)}},[r]),(0,et.createPortal)((0,$.jsxs)(`div`,{ref:o,role:`dialog`,"aria-label":u?u.title:`${Ki(i)} 的待办`,className:`tw-cal-pop`,style:{left:e.left,top:e.top,bottom:e.bottom},children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`tw-cal-pop-arrow tw-cal-pop-arrow--${e.arrowSide}`,style:{left:e.arrowX}}),(0,$.jsxs)(`div`,{className:`tw-cal-pop-head`,children:[u?(0,$.jsx)(`button`,{type:`button`,"aria-label":`返回当天待办`,onClick:()=>c(null),className:`tw-cal-pop-icon`,children:`‹`}):null,(0,$.jsx)(`span`,{className:`tw-cal-pop-title`,children:u?u.title:Ki(i)}),u?null:(0,$.jsxs)(`span`,{className:`tw-cal-pop-count`,children:[l.length,` 条`]}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`关闭`,onClick:r,className:`tw-cal-pop-icon`,children:`×`})]}),u?(0,$.jsxs)(`div`,{className:`tw-cal-pop-detail`,children:[(0,$.jsxs)(`div`,{className:`tw-cal-pop-field`,children:[(0,$.jsx)(`span`,{className:`tw-cal-pop-label`,children:`待办名称`}),(0,$.jsx)(`span`,{className:`tw-cal-pop-value`,children:u.title})]}),(0,$.jsxs)(`div`,{className:`tw-cal-pop-field`,children:[(0,$.jsx)(`span`,{className:`tw-cal-pop-label`,children:`待办状态`}),(0,$.jsx)(`span`,{children:(0,$.jsx)(Qr,{status:S(u,n),label:E[S(u,n)]})})]}),u.priority?(0,$.jsxs)(`div`,{className:`tw-cal-pop-field`,children:[(0,$.jsx)(`span`,{className:`tw-cal-pop-label`,children:`重要紧急程度`}),(0,$.jsx)(`span`,{children:(0,$.jsx)($r,{priority:u.priority,label:M[u.priority]})})]}):null,(0,$.jsxs)(`div`,{className:`tw-cal-pop-dates`,children:[(0,$.jsxs)(`div`,{className:`tw-cal-pop-field`,children:[(0,$.jsx)(`span`,{className:`tw-cal-pop-label`,children:`开始日期`}),(0,$.jsx)(`span`,{className:`tw-cal-pop-value`,children:di(u.startDate)})]}),(0,$.jsxs)(`div`,{className:`tw-cal-pop-field`,children:[(0,$.jsx)(`span`,{className:`tw-cal-pop-label`,children:`截止日期`}),(0,$.jsx)(`span`,{className:`tw-cal-pop-value`,children:di(u.dueDate)})]})]}),u.note?(0,$.jsxs)(`div`,{className:`tw-cal-pop-field`,children:[(0,$.jsx)(`span`,{className:`tw-cal-pop-label`,children:`备注`}),(0,$.jsx)(`span`,{className:`tw-cal-pop-value tw-cal-pop-note`,children:u.note})]}):null]}):l.length===0?(0,$.jsx)(`p`,{className:`tw-cal-pop-empty`,children:`这一天没有待办`}):(0,$.jsx)(`div`,{className:`tw-cal-pop-list`,children:l.map(e=>{let t=S(e,n);return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>c(e.id),className:`tw-cal-pop-row`,children:[(0,$.jsx)(`span`,{className:`tw-cal-pop-bar`,style:{background:w(e.status)?`#d1d5db`:Li[e.priority]}}),(0,$.jsx)(`span`,{className:`tw-cal-pop-row-title`,children:e.title}),t===`overdue`?(0,$.jsx)(`span`,{className:`tw-cal-pop-tag tw-cal-pop-tag--overdue`,children:E.overdue}):w(e.status)?(0,$.jsx)(`span`,{className:`tw-cal-pop-tag`,children:E[e.status]}):null]},e.id)})})]}),document.body)}function Yi({days:e,today:t,now:n}){let r=(0,X.useRef)(null),[i,a]=(0,X.useState)(0),o=e.indexOf(t),s=ki*Ai.length,c=i>0?Math.max(ki,Math.floor(i/Ai.length)):ki,l=i>s?i-c*Ai.length:0,u=e=>e===23?c+l:c,d=c*Ai.length+l,f=i>0&&d<=i+1,p=(n.getHours()*60+n.getMinutes()-0)/60*c,m=p>=0&&p<=d,h=`44px repeat(${e.length}, minmax(0, 1fr))`;return(0,X.useEffect)(()=>{let e=r.current;if(!e)return;let t=()=>a(e.clientHeight);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,X.useEffect)(()=>{let e=r.current;e&&(e.scrollTop=!f&&o>=0&&m?Math.max(0,p-80):0)},[e.length,i,f]),(0,$.jsx)(`div`,{ref:r,className:`tw-dash-scroll min-h-[120px] flex-1 ${f?`overflow-hidden`:`overflow-y-auto`}`,children:(0,$.jsxs)(`div`,{className:`relative grid`,style:{gridTemplateColumns:h},children:[Ai.map(t=>(0,$.jsxs)(`div`,{className:`contents`,children:[(0,$.jsx)(`div`,{className:`relative`,style:{height:u(t)},children:(0,$.jsxs)(`span`,{className:`absolute -top-1.5 right-1.5 text-[10px] text-stone-400 tabular-nums`,children:[Vi(t),`:00`]})}),e.map(e=>(0,$.jsx)(`div`,{className:`border-t border-l border-stone-100`,style:{height:u(t)}},`${e}-${t}`))]},t)),o>=0&&m?(0,$.jsxs)(`div`,{className:`pointer-events-none absolute flex items-center`,style:{top:p,left:`calc(44px + (100% - 44px) * ${o} / ${e.length})`,width:`calc((100% - 44px) / ${e.length})`},children:[(0,$.jsxs)(`span`,{className:`absolute right-full mr-1 text-[10px] text-[#f54a45] tabular-nums`,children:[Vi(n.getHours()),`:`,Vi(n.getMinutes())]}),(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[#f54a45]`}),(0,$.jsx)(`span`,{className:`h-px flex-1 bg-[#f54a45]`})]}):null]})})}function Xi(e){let{todos:t,enabled:n,error:r}=e,i=x(),[a,o]=(0,X.useState)(()=>u(`dashboard.calendar`,Mi,`week`)),[s,l]=(0,X.useState)(i),[d,f]=(0,X.useState)(()=>new Date),[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(0);(0,X.useEffect)(()=>{if(!h)return;let e=()=>v(h.clientHeight);if(e(),typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e);return t.observe(h),()=>t.disconnect()},[h]),(0,X.useEffect)(()=>{let e=window.setInterval(()=>f(new Date),3e4);return()=>window.clearInterval(e)},[]);let y=()=>m(null),b=a===`month`?Sr(s):a===`day`?[s]:Cr(s),S=Lr(t,b),C=Math.min(S.lanes,a===`day`?6:3),w=`44px repeat(${b.length}, minmax(0, 1fr))`,T=e=>{m(null),l(a===`month`?xr(s,e):yr(s,e*(a===`week`?7:1)))},E=(e,t,n=null)=>{if(!t)return;let r=t.getBoundingClientRect(),i=window.innerHeight-r.bottom,a=r.top,o=i<300&&a>i,s=Math.min(Math.max(8,r.left+r.width/2-qi/2),Math.max(8,window.innerWidth-qi-8)),c=Math.round(Math.min(268,Math.max(20,r.left+r.width/2-s)));m({day:e,detailId:n,left:s,arrowX:c,arrowSide:o?`bottom`:`top`,top:o?void 0:r.bottom+10,bottom:o?Math.max(8,window.innerHeight-r.top+10):void 0})},D;if(!n)D=(0,$.jsx)(Gr,{name:`待办事项`,detail:`启用后这里会按截止日期显示待办日历`});else if(r)D=(0,$.jsx)(Kr,{message:r});else if(a===`month`){let e=Number(s.slice(5,7)),n=Rr(t,b),r=_>0?_/n.length:0,a=Math.max(1,Math.min(4,Math.floor((r-zi-4)/18)));D=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsx)(`div`,{className:`grid shrink-0 grid-cols-7 border-b border-stone-200 pb-1.5`,children:Di.map(e=>(0,$.jsxs)(`span`,{className:`text-center text-[11px] text-stone-400`,children:[`周`,e]},e))}),(0,$.jsx)(`div`,{ref:g,className:`grid min-h-0 flex-1`,style:{gridTemplateRows:`repeat(${n.length}, minmax(0, 1fr))`},children:n.map(({days:t,spans:n})=>{let r=n.filter(e=>e.lane<a),o=n.filter(e=>e.lane>=a);return(0,$.jsxs)(`div`,{className:`relative flex min-h-0 flex-col border-t border-stone-100`,children:[(0,$.jsx)(`div`,{className:`grid shrink-0 grid-cols-7`,children:t.map(t=>{let n=Number(t.slice(5,7))!==e;return(0,$.jsx)(`button`,{type:`button`,onClick:e=>E(t,e.currentTarget),className:`flex h-7 min-w-0 items-center px-1.5 text-left transition-colors hover:bg-stone-50`,children:(0,$.jsx)(`span`,{className:`flex h-5 min-w-5 items-center justify-center rounded-full px-1 text-[11px] tabular-nums ${t===i?`bg-[#3370ff] font-semibold text-white`:n?`text-stone-300`:`text-stone-500`}`,children:Hi(t)})},t)})}),(0,$.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-0 grid grid-cols-7`,children:t.map(e=>(0,$.jsx)(`div`,{className:`border-l border-stone-100`},e))}),r.map(({item:e,start:n,end:r,lane:a})=>(0,$.jsx)(`button`,{type:`button`,onClick:r=>E(t[n]??i,r.currentTarget,e.id),className:`tw-cal-bar absolute flex items-center text-left ${Fi(e)}`,style:{top:a*18,left:`calc(100% * ${n} / 7)`,width:`calc(100% * ${r-n+1} / 7)`,height:Bi,borderLeftColor:Ii(e)},children:(0,$.jsx)(`span`,{className:`truncate px-1`,children:e.title})},e.id)),o.length>0?(0,$.jsxs)(`button`,{type:`button`,onClick:e=>{let n=o[0];E(t[n.start]??i,e.currentTarget)},className:`absolute right-1 bottom-0 rounded bg-white/85 px-1 text-[10px] leading-4 text-stone-400 transition-colors hover:text-[#3370ff]`,children:[`+`,o.length]}):null]})]},t[0])})})]})}else D=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(`div`,{className:`grid shrink-0 border-b border-stone-200`,style:{gridTemplateColumns:w},children:[(0,$.jsx)(`div`,{}),b.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:t=>E(e,t.currentTarget),className:`flex flex-col items-center gap-0.5 py-1 transition-colors hover:bg-stone-50`,children:[(0,$.jsxs)(`span`,{className:`text-[11px] text-stone-400`,children:[`周`,Di[Ui(e)]??``]}),(0,$.jsx)(`span`,{className:`flex h-7 w-7 items-center justify-center rounded-full text-[13px] tabular-nums ${e===i?`bg-[#3370ff] font-semibold text-white`:`font-medium text-stone-700`}`,children:Hi(e)})]},e))]}),(0,$.jsxs)(`div`,{className:`relative shrink-0 border-b border-stone-200`,children:[(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 right-0 left-[44px] grid`,style:{gridTemplateColumns:`repeat(${b.length}, minmax(0, 1fr))`},children:b.map(e=>(0,$.jsx)(`div`,{className:`border-l border-stone-100`},e))}),(0,$.jsxs)(`div`,{className:`flex items-start`,children:[(0,$.jsx)(`div`,{className:`flex h-[22px] w-11 shrink-0 items-center justify-end pr-1.5 text-[10px] text-stone-400`,children:`全天`}),(0,$.jsx)(`div`,{className:`relative min-w-0 flex-1 overflow-hidden`,style:{height:Math.max(1,C)*21},children:S.spans.filter(e=>e.lane<C).map(({item:e,start:t,end:n,lane:r})=>{let a=n-t+1;return(0,$.jsx)(`button`,{type:`button`,onClick:n=>E(b[t]??i,n.currentTarget,e.id),className:`tw-cal-bar absolute flex items-center gap-1 text-left ${Fi(e)}`,style:{top:r*21,left:`calc(100% * ${t} / ${b.length})`,width:`calc(100% * ${a} / ${b.length})`,height:Ri,borderLeftColor:Ii(e)},children:(0,$.jsx)(`span`,{className:`truncate px-1`,children:e.title})},e.id)})})]})]}),(0,$.jsx)(Yi,{days:b,today:i,now:d})]});return(0,$.jsxs)(Ur,{title:`待办日历`,icon:(0,$.jsx)(oi,{}),tone:`violet`,href:`todos/`,action:`打开待办`,fill:!0,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex shrink-0 flex-wrap items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>{m(null),l(i)},className:`h-7 rounded-lg border border-stone-200 bg-white px-2.5 text-xs font-medium text-stone-600 transition-colors hover:bg-stone-50 hover:text-stone-900`,children:`今天`}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`上一页`,onClick:()=>T(-1),className:`flex h-7 w-7 items-center justify-center rounded-lg text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-700`,children:`‹`}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`下一页`,onClick:()=>T(1),className:`flex h-7 w-7 items-center justify-center rounded-lg text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-700`,children:`›`}),(0,$.jsx)(`span`,{className:`ml-1 text-[13px] font-semibold text-stone-800 tabular-nums`,children:a===`month`?Wi(s):Gi(b)}),(0,$.jsx)(`div`,{className:`ml-auto flex items-center gap-0.5 rounded-lg bg-stone-100 p-0.5`,children:ji.map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>{m(null),o(e.id),c(`dashboard.calendar`,e.id)},className:`h-6 w-8 rounded-md text-[11px] transition-colors ${a===e.id?`bg-white font-medium text-stone-900 shadow-sm`:`text-stone-500 hover:text-stone-800`}`,children:e.label},e.id))})]}),D,p?(0,$.jsx)(Ji,{state:p,todos:t,today:i,onClose:y}):null]})}function Zi({id:e,data:t}){switch(e){case`todoInProgress`:return(0,$.jsx)(Ci,{todos:t.todos,enabled:t.todosOn});case`taskInProgress`:return(0,$.jsx)(xi,{tasks:t.tasks,enabled:t.tasksOn});case`overdue`:return(0,$.jsx)(yi,{todos:t.todos,enabled:t.todosOn});case`todoRate`:return(0,$.jsx)(wi,{todos:t.todos,enabled:t.todosOn});case`taskRate`:return(0,$.jsx)(Si,{tasks:t.tasks,enabled:t.tasksOn});case`activeProjects`:return(0,$.jsx)(vi,{projects:t.projects,enabled:t.projectsOn,error:t.errors.projects});case`spaces`:return(0,$.jsx)(bi,{total:t.spaces?.total??null,activeName:t.spaces?.activeName??``});case`countdown`:return(0,$.jsx)(gi,{});case`todayTodos`:return(0,$.jsx)(Ei,{todos:t.todos,enabled:t.todosOn,error:t.errors.todos,onToggle:t.onToggleTodo});case`activeTasks`:return(0,$.jsx)(fi,{tasks:t.tasks,enabled:t.tasksOn,error:t.errors.tasks});case`testChart`:return(0,$.jsx)(Ti,{items:t.stats,enabled:t.statsOn,error:t.errors.stats});case`todoCalendar`:return(0,$.jsx)(Xi,{todos:t.todos,enabled:t.todosOn,error:t.errors.todos})}}var Qi=15e3,$i=`dashboard.layout`,ea=`dashboard.scroll`,ta=760,na=[`日`,`一`,`二`,`三`,`四`,`五`,`六`];function ra(e){let t=e.getHours();return t<5?`夜深了`:t<9?`早上好`:t<12?`上午好`:t<14?`中午好`:t<18?`下午好`:t<23?`晚上好`:`夜深了`}function ia(e){return`${e.getFullYear()}年${e.getMonth()+1}月${e.getDate()}日 星期${na[e.getDay()]}`}function aa(e){return e instanceof Error?e.message:String(e)}async function oa(e,t,n,r){if(!e)return{ok:!0,items:r};if(!t)return{ok:!1,error:`本地服务未就绪`};try{return{ok:!0,items:await n()}}catch(e){return{ok:!1,error:aa(e)}}}function sa(){return(0,$.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,"aria-hidden":`true`,children:[6.5,9.5].map(e=>[5,8,11].map(t=>(0,$.jsx)(`circle`,{cx:t,cy:e,r:`1.15`,fill:`currentColor`},`${t}-${e}`)))})}function ca(){return(0,$.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`11`,height:`11`,"aria-hidden":`true`,children:(0,$.jsx)(`path`,{d:`M3.5 8.5 6.5 11.5 12.5 4.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function la(){return(0,$.jsxs)(`svg`,{viewBox:`0 0 20 20`,width:`15`,height:`15`,"aria-hidden":`true`,children:[(0,$.jsx)(`rect`,{x:`2.5`,y:`2.5`,width:`6`,height:`6`,rx:`1.5`,fill:`currentColor`}),(0,$.jsx)(`rect`,{x:`11.5`,y:`2.5`,width:`6`,height:`6`,rx:`1.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`}),(0,$.jsx)(`rect`,{x:`2.5`,y:`11.5`,width:`6`,height:`6`,rx:`1.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`}),(0,$.jsx)(`rect`,{x:`11.5`,y:`11.5`,width:`6`,height:`6`,rx:`1.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`})]})}function ua(e){let{open:t,layout:n,onChange:r,onClose:i}=e,a=new Set(n.hidden),o=e=>{a.has(e)?r(cr({...n,hidden:n.hidden.filter(t=>t!==e)},e)):r({...n,hidden:[...n.hidden,e]})},s=jn.filter(e=>!a.has(e.id)).length;return(0,$.jsxs)(g,{open:t,onClose:i,transition:!0,className:`relative z-110`,children:[(0,$.jsx)(_,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,$.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,$.jsxs)(m,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim flex max-h-[85vh] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-stone-200 bg-white p-6 shadow-xl`,children:[(0,$.jsx)(h,{className:`tw-confirm-title shrink-0 text-base font-semibold text-stone-900`,children:`编辑组件`}),(0,$.jsx)(`p`,{className:`mt-1.5 shrink-0 text-[11px] leading-5 text-stone-400`,children:`点选要放进画布的组件;卡片按住顶部圆点拖到任意位置,拖右下角把手可独立改宽 / 改高,双击把手恢复默认大小。`}),(0,$.jsx)(`div`,{className:`mt-4 grid min-h-0 flex-1 auto-rows-min grid-cols-3 gap-2 overflow-y-auto pr-1`,children:jn.map(e=>{let t=!a.has(e.id);return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>o(e.id),"aria-pressed":t,className:`tw-widget-option`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`tw-widget-check`,children:(0,$.jsx)(ca,{})}),(0,$.jsx)(`span`,{className:`tw-widget-option-title min-w-0 truncate`,children:e.title})]}),(0,$.jsx)(`span`,{className:`tw-widget-option-desc pl-6`,children:e.desc})]},e.id)})}),(0,$.jsxs)(`div`,{className:`mt-5 flex shrink-0 items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(Kn(n)),className:`h-8 rounded-lg px-2.5 text-xs text-stone-500 transition-colors hover:bg-stone-100 hover:text-stone-700`,children:`全部添加`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(ur(n)),className:`h-8 rounded-lg px-2.5 text-xs text-stone-500 transition-colors hover:bg-stone-100 hover:text-stone-700`,children:`自动整理`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsxs)(`span`,{className:`text-[11px] text-stone-400 tabular-nums`,children:[`已添加 `,s,` / `,jn.length]}),(0,$.jsx)(`button`,{type:`button`,onClick:i,className:`h-8 rounded-lg bg-[#3370ff] px-4 text-sm font-medium text-white transition-colors hover:bg-[#2b5fd9]`,children:`完成`})]})]})]})})]})}function da(){let[e,t]=(0,X.useState)(!1),[n,r]=(0,X.useState)(!1),[c,u]=(0,X.useState)({todos:!1,tasks:!1,stats:!1,projects:!1}),[d,f]=(0,X.useState)([]),[m,h]=(0,X.useState)([]),[g,_]=(0,X.useState)([]),[v,x]=(0,X.useState)([]),[S,w]=(0,X.useState)(null),[E,D]=(0,X.useState)({}),[ee,O]=(0,X.useState)(!1),[k,M]=(0,X.useState)(null),[ie,ae]=(0,X.useState)(null),[P,F]=(0,X.useState)(null),[oe,se]=(0,X.useState)(0),[I,ce]=(0,X.useState)(()=>rr(p($i,null))),L=(0,X.useRef)(I);L.current=I,(0,X.useEffect)(()=>{l($i,L.current)},[]);let le=(0,X.useRef)(!0),ue=(0,X.useRef)(c);ue.current=c,(0,X.useEffect)(()=>(le.current=!0,()=>{le.current=!1,document.body.classList.remove(`tw-reordering`,`tw-resizing`)}),[]),(0,X.useEffect)(()=>{let e=ea,t=0;try{t=Number(window.sessionStorage.getItem(e)??0)||0}catch{t=0}if(t<=0){let t=!1,n=()=>{t||(t=!0,window.requestAnimationFrame(()=>{t=!1;try{window.sessionStorage.setItem(e,String(window.scrollY))}catch{}}))};return window.addEventListener(`scroll`,n,{passive:!0}),()=>window.removeEventListener(`scroll`,n)}let n=!1,r=!0,i=0,a=Date.now(),o=()=>{if(n)return;let e=Math.max(0,document.documentElement.scrollHeight-window.innerHeight);e+2>=t||i>=30?(window.scrollTo({top:Math.min(t,e),behavior:`instant`}),r=!1):(i+=1,window.setTimeout(o,100))};window.setTimeout(o,50);let s=()=>{if(!r&&!(window.scrollY===0&&Date.now()-a<1500))try{window.sessionStorage.setItem(e,String(window.scrollY))}catch{}};window.addEventListener(`scroll`,s,{passive:!0});let c=()=>{!n&&window.scrollY===0&&window.setTimeout(o,0)};return document.addEventListener(`astro:page-load`,c),()=>{n=!0,window.removeEventListener(`scroll`,s),document.removeEventListener(`astro:page-load`,c)}},[]);let de=(0,X.useRef)({todos:!1,tasks:!1,stats:!1,projects:!1}),R=(0,X.useCallback)(async()=>{if(!le.current)return;let e=ue.current,t=async(e,t,n)=>{if(!t)return!1;if(de.current[e])return!0;let r=await n();return de.current[e]=r,r},[n,r,i,a]=await Promise.all([t(`todos`,e.todos,N),t(`tasks`,e.tasks,A),t(`stats`,e.stats,ne),t(`projects`,e.projects,y)]),[o,s,c,l,u]=await Promise.all([oa(e.todos,n,C,[]),oa(e.tasks,r,j,[]),oa(e.stats,i,()=>te().then(e=>e.items),[]),oa(e.projects,a,()=>b().then(e=>e.projects),[]),re().then(e=>{if(!e)return null;let t=e.spaces.filter(e=>e.exists);return{total:t.length,activeName:t.find(e=>e.isActive)?.name??``}})]);le.current&&(o.ok?f(o.items):de.current.todos=!1,s.ok?h(s.items):de.current.tasks=!1,c.ok?_(c.items):de.current.stats=!1,l.ok?x(l.items):de.current.projects=!1,w(u),D({todos:o.ok?void 0:o.error,tasks:s.ok?void 0:s.error,stats:c.ok?void 0:c.error,projects:l.ok?void 0:l.error}))},[]);(0,X.useEffect)(()=>{let e=a(e=>{r(!!e.dashboard),u({todos:!!e.todos,tasks:!!e.tasks,stats:!!e.testStats,projects:!!e.projects})});return i().then(()=>{r(s(`dashboard`)),u({todos:s(`todos`),tasks:s(`tasks`),stats:s(`testStats`),projects:s(`projects`)}),t(!0)}),e},[]),(0,X.useEffect)(()=>{e&&n&&R()},[e,n,c.todos,c.tasks,c.stats,c.projects,R]),(0,X.useEffect)(()=>{if(!e||!n)return;let t=window.setInterval(()=>{document.hidden||R()},Qi),r=()=>{document.hidden||R()};return window.addEventListener(`focus`,r),document.addEventListener(`visibilitychange`,r),()=>{window.clearInterval(t),window.removeEventListener(`focus`,r),document.removeEventListener(`visibilitychange`,r)}},[e,n,R]);function z(e){let t=rr(e);L.current=t,ce(t),l($i,t)}let B=(0,X.useMemo)(()=>sr(I),[I]),fe=(0,X.useMemo)(()=>c.todos?fr(d,m).overdue:0,[c.todos,d,m]),pe=new Date,V=(0,$.jsxs)(`header`,{className:`mb-7 flex shrink-0 items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3.5`,children:[(0,$.jsx)(`span`,{className:`tw-dash-hero-icon`,"aria-hidden":`true`,children:(0,$.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`20`,height:`20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,$.jsx)(`path`,{d:`M12 3.2 13.9 9l5.8 1.9-5.8 1.9L12 18.6l-1.9-5.8L4.3 10.9 10.1 9Z`}),(0,$.jsx)(`path`,{d:`M18.5 4.2v2.6M17.2 5.5h2.6M6 16.5v2M5 17.5h2`})]})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`h1`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-1 text-[26px] font-semibold leading-9 tracking-tight text-stone-900`,children:[ra(pe),fe>0?(0,$.jsxs)(`span`,{className:`tw-dash-overdue text-sm font-medium`,children:[fe,` 项已延期`]}):null]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-stone-500`,children:ia(pe)})]})]}),(0,$.jsx)(`div`,{className:`shrink-0 pt-1`,children:e&&n?(0,$.jsxs)(`button`,{type:`button`,onClick:()=>O(!0),className:`inline-flex h-9 shrink-0 items-center gap-2 rounded-lg border border-stone-200 bg-white px-3.5 text-sm font-medium text-stone-700 shadow-sm transition-colors hover:bg-stone-50 hover:text-stone-900`,children:[(0,$.jsx)(`span`,{className:`text-[#3370ff]`,children:(0,$.jsx)(la,{})}),`编辑组件`]}):null})]});(0,X.useEffect)(()=>{if(!P)return;let e=()=>se(Math.round(P.getBoundingClientRect().width));if(e(),typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e);return t.observe(P),()=>t.disconnect()},[P]);let H=oe>0&&oe<ta,U=(0,X.useMemo)(()=>{let e=B.reduce((e,{rect:t})=>Math.max(e,t.y+t.h),0);return Math.max(49,e+40)},[B]),me=(0,X.useMemo)(()=>H?ar(I).map(({id:e,rect:t})=>({i:e,x:t.x,y:t.y,w:t.w,h:t.h,minW:12})):B.map(({id:e,rect:t})=>({i:e,x:t.x,y:t.y,w:t.w,h:t.h,minW:Rn(e),minH:Ln(e),maxH:49})),[B,H,I]);function he(e,t,n=`drag`,r=`down`){let i={...L.current.rects},a=!1;for(let t of e){if(!Pn(t.i))continue;let e=i[t.i];e&&e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h||(i[t.i]={x:t.x,y:t.y,w:t.w,h:t.h},a=!0)}if(!a)return;let o={...L.current,rects:i};z(t?lr(o,t,n,{direction:r}):o)}function W(e){let t={...L.current.rects},n=t[e],r=Wn(e);t[e]=n?{...r,x:n.x,y:n.y}:r,z(cr({...L.current,rects:t},e))}async function ge(e){let t=d;f(t=>t.map(t=>t.id===e.id?{...t,status:`done`,doneAt:new Date().toISOString()}:t));try{let t=await T(e.id,{status:`done`});if(!le.current)return;f(n=>n.map(n=>n.id===e.id?t:n)),D(e=>({...e,todos:void 0}))}catch(e){if(!le.current)return;f(t),D(t=>({...t,todos:aa(e)}))}}if(!e)return(0,$.jsxs)($.Fragment,{children:[V,(0,$.jsx)(`div`,{className:`tw-dash-surface flex min-h-[280px] flex-col overflow-hidden rounded-2xl border border-stone-200 bg-white`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,$.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})]});if(!n)return(0,$.jsxs)($.Fragment,{children:[V,(0,$.jsx)(`div`,{className:`tw-lib-notice rounded-2xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:o(`dashboard`)})]});let G;return G=B.length===0?(0,$.jsxs)(`div`,{className:`tw-dash-surface flex flex-col items-center justify-center gap-2 rounded-2xl border border-dashed border-stone-200 bg-white px-5 py-24 text-center`,children:[(0,$.jsx)(`span`,{className:`mb-1 flex h-10 w-10 items-center justify-center rounded-xl bg-stone-100 text-stone-400`,children:(0,$.jsx)(la,{})}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-stone-700`,children:`画布上还没有组件`}),(0,$.jsx)(`p`,{className:`text-xs text-stone-400`,children:`先挑要显示的卡片,之后布局会按当前空间记住`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>O(!0),className:`mt-2 h-8 rounded-lg bg-[#3370ff] px-3.5 text-xs font-medium text-white transition-colors hover:bg-[#2b5fd9]`,children:`添加组件`})]}):(0,$.jsx)(`div`,{ref:F,className:`tw-dash-grid w-full${H?` tw-dash-grid--stacked`:``}`,onMouseDown:e=>{e.target.closest(`.react-grid-item`)||M(null)},onDoubleClick:e=>{let t=e.target.closest(`.react-resizable-handle`);if(!t)return;let n=t.closest(`[data-sort-key]`)?.dataset.sortKey;Pn(n)&&W(n)},children:oe>0?(0,$.jsx)(pn,{width:oe,layout:me,gridConfig:{cols:12,rowHeight:20,margin:[0,0],containerPadding:[0,0],maxRows:U},compactor:Ue,dragConfig:{enabled:!H,handle:`.tw-dash-handle`,cancel:`.react-resizable-handle`},resizeConfig:{enabled:!H,handles:[`se`]},onDragStart:(e,t)=>{t&&Pn(t.i)&&(ae(t.i),M(t.i)),document.body.classList.add(`tw-reordering`)},onDragStop:(e,t)=>{document.body.classList.remove(`tw-reordering`),ae(null);let n=t&&Pn(t.i)?t.i:void 0,r=n?L.current.rects[n]:void 0,i=n?e.find(e=>e.i===n):void 0;he(e,n,`drag`,i&&r&&i.y<r.y?`up`:`down`)},onResizeStart:(e,t)=>{t&&Pn(t.i)&&(ae(t.i),M(t.i)),document.body.classList.add(`tw-resizing`)},onResizeStop:(e,t)=>{document.body.classList.remove(`tw-resizing`),ae(null),he(e,t&&Pn(t.i)?t.i:void 0)},children:B.map(({id:e,def:t})=>{let n=k===e,r=ie===e;return(0,$.jsx)(`div`,{"data-sort-key":e,className:`tw-dash-cell min-w-0 p-1.5`,onClick:()=>M(e),children:(0,$.jsxs)(`div`,{className:`tw-dash-card group relative h-full min-h-0 rounded-2xl ${n?`tw-dash-card-selected`:``} ${r?`tw-dash-card-selected opacity-70`:``}`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`拖动 ${t.title}`,draggable:!1,onDragStart:e=>e.preventDefault(),className:`tw-dash-handle absolute left-1/2 top-0 z-10 flex h-7 w-12 -translate-x-1/2 cursor-move touch-none items-center justify-center rounded-b-md text-stone-400 transition-[opacity,color,background-color] hover:bg-stone-100 hover:text-stone-600 focus-visible:opacity-100 ${n||r?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`}`,children:(0,$.jsx)(sa,{})}),(0,$.jsx)(Zi,{id:e,data:{todos:d,tasks:m,stats:g,projects:v,spaces:S,todosOn:c.todos,tasksOn:c.tasks,statsOn:c.stats,projectsOn:c.projects,errors:E,onToggleTodo:ge}})]})},e)})}):null}),(0,$.jsxs)($.Fragment,{children:[V,G,(0,$.jsx)(ua,{open:ee,layout:I,onChange:z,onClose:()=>O(!1)})]})}export{da as default};
|