lantern-harness 0.1.10 → 0.1.12
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 +35 -0
- package/builtin/session/lh-nav-groups.mjs +3 -0
- package/config/app.defaults.json +1 -0
- package/dist/500.html +52 -4
- package/dist/_astro/Base.UUIdmKid.css +1 -0
- package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.C30xtpc6.js → Base.astro_astro_type_script_index_0_lang.kD0Cbs0F.js} +1 -1
- package/dist/_astro/{CaseExecBoard.Dttqp0wg.js → CaseExecBoard.D8K4NzrB.js} +1 -1
- package/dist/_astro/CaseGenerateApp.bZ_K72NQ.js +9 -0
- package/dist/_astro/{CasesLibrary.8aMUUGp_.js → CasesLibrary.Dhg2pdwU.js} +1 -1
- package/dist/_astro/ChatApp.B6I3gGKI.js +221 -0
- package/dist/_astro/{ConfirmDialog.BZzZWDci.js → ConfirmDialog.CsMwWevK.js} +1 -1
- package/dist/_astro/{DashboardBoard.CkSbhEDI.js → DashboardBoard.uPjTYpJZ.js} +1 -1
- package/dist/_astro/{DocsFileBrowser.MKVCfZrE.js → DocsFileBrowser.DvBPLCEp.js} +1 -1
- package/dist/_astro/{DocsPager.DJY4foYL.js → DocsPager.EPT5-oEx.js} +1 -1
- package/dist/_astro/{DrawerField.CHRg77LG.js → DrawerField.DqvXFCFh.js} +1 -1
- package/dist/_astro/{ExcelFieldTags.DXMeaDa5.js → ExcelFieldTags.De-C3dqn.js} +1 -1
- package/dist/_astro/{KnowledgeLibrary.B-p1aoQN.js → KnowledgeLibrary.BzFTmNwA.js} +1 -1
- package/dist/_astro/{NamePromptDialog.Wa9O530a.js → NamePromptDialog.CS1pTTVl.js} +1 -1
- package/dist/_astro/{NavLibraries.C6LImMO_.js → NavLibraries.CVdolwYy.js} +1 -1
- package/dist/_astro/PluginsPage.B8U4uvD2.js +39 -0
- package/dist/_astro/{PluginsPage.DkmRPfbU.js → PluginsPage.v6afs984.js} +1 -1
- package/dist/_astro/{PmBugsBoard.CMT4-eoB.js → PmBugsBoard.CSIGq0wz.js} +1 -1
- package/dist/_astro/{PmIterationsBoard.BQM_dzdZ.js → PmIterationsBoard.BmBc90as.js} +1 -1
- package/dist/_astro/{PmProjectDetail.CzU80pat.js → PmProjectDetail.BDKXOQJD.js} +1 -1
- package/dist/_astro/{PmProjectsBoard.Cxsa7SYQ.js → PmProjectsBoard.DIVs_xJu.js} +1 -1
- package/dist/_astro/{PmRequirementsBoard.4_JMDDN0.js → PmRequirementsBoard.DcLiUhBe.js} +1 -1
- package/dist/_astro/PmRequirementsBoard.N0LM5jHo.js +1 -0
- package/dist/_astro/PmShared.D69sPvec.js +1 -0
- package/dist/_astro/PromptsLibrary.B1RVZqj8.js +1 -0
- package/dist/_astro/{ReportsPage.Fh5DRKLT.js → ReportsPage.N1EaH8E-.js} +1 -1
- package/dist/_astro/ReqAnalysisBoard.Bd69wB2p.js +25 -0
- package/dist/_astro/{RequirementsLibrary.CBkuWE8X.js → RequirementsLibrary.BZhxG9VU.js} +1 -1
- package/dist/_astro/SearchableSelect.BIjXzTPD.js +1 -0
- package/dist/_astro/SelectDropdown.B3-XpBpn.js +1 -0
- package/dist/_astro/{SettingsDialog.CJvBRcs9.js → SettingsDialog.DbjLDMDJ.js} +1 -1
- package/dist/_astro/SlideOverDrawer.HqVYaIjP.js +1 -0
- package/dist/_astro/{SpaceSwitcher.BVQLt_tL.js → SpaceSwitcher.BeCumAuj.js} +1 -1
- package/dist/_astro/{TasksBoard.Bu-fpIZ7.js → TasksBoard.B3SzQ5bR.js} +1 -1
- package/dist/_astro/{TemplatesLibrary.DSylQGlN.js → TemplatesLibrary.Ci3yHQTr.js} +1 -1
- package/dist/_astro/{TestStatsBoard.CPyKW4wc.js → TestStatsBoard.CgVvwMzN.js} +1 -1
- package/dist/_astro/{TodosBoard.8kvRTEW-.js → TodosBoard.BNDF1iVZ.js} +1 -1
- package/dist/_astro/UiAutoBoard.Bo0dpRuf.js +9 -0
- package/dist/_astro/app-config.Cq_F8I0l.js +1 -0
- package/dist/_astro/dialog.DZHZCe_T.js +1 -0
- package/dist/_astro/{hydrate-cache.BXX604Bw.js → hydrate-cache.zljz1n5X.js} +1 -1
- package/dist/_astro/i18n.DPw-aTIZ.js +7 -0
- package/dist/_astro/index.astro_astro_type_script_index_0_lang.B9YrqBHf.js +1 -0
- package/dist/_astro/{lib.CgXLzMMd.js → lib.BQbwbnfE.js} +1 -1
- package/dist/_astro/listbox.DNxAJmEo.js +1 -0
- package/dist/_astro/menu.Dnrpz489.js +1 -0
- package/dist/_astro/{open-docs-in-session.CyFNgh1I.js → open-docs-in-session.LWVC43xp.js} +1 -1
- package/dist/_astro/{plugins.C2BMfzv1.js → plugins.CKkgnq4r.js} +1 -1
- package/dist/_astro/{portal.C0hAhXDF.js → portal.Chh6O5xk.js} +2 -2
- package/dist/_astro/prompts-meta.D_2wiFiH.js +2 -0
- package/dist/_astro/req-analysis.C1uUndMm.js +6 -0
- package/dist/_astro/{settings.Ceefeil5.js → settings.HM3DiNh0.js} +2 -2
- package/dist/_astro/{spaces-client.BocUabwy.js → spaces-client.CWqBZccW.js} +1 -1
- package/dist/_astro/ui-auto-prompt.B09MVaTI.js +4 -0
- package/dist/_astro/{update.CvfIVwnq.js → update.BkHtINbZ.js} +1 -1
- package/dist/_astro/{use-text-value.DBQvHeNl.js → use-text-value.B3mOiuGb.js} +1 -1
- package/dist/_astro/{view-prefs.BEAZRcxF.js → view-prefs.7wGuDpzi.js} +1 -1
- package/dist/case-exec/index.html +83 -5
- package/dist/cases/generate/index.html +53 -5
- package/dist/cases/library/index.html +83 -5
- package/dist/dashboard/index.html +83 -5
- package/dist/docs/changelog/index.html +84 -5
- package/dist/docs/install/index.html +52 -4
- package/dist/docs/manual/index.html +80 -4
- package/dist/index.html +1 -1
- package/dist/knowledge/index.html +83 -5
- 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 +52 -4
- package/dist/plugins/index.html +53 -5
- package/dist/pm/bugs/index.html +83 -5
- package/dist/pm/iterations/index.html +83 -5
- package/dist/pm/projects/detail/index.html +83 -5
- package/dist/pm/projects/index.html +83 -5
- package/dist/pm/requirements/index.html +83 -5
- package/dist/prompts/index.html +83 -5
- package/dist/reports/index.html +83 -5
- package/dist/requirement-analysis/index.html +795 -0
- package/dist/requirements/index.html +83 -5
- package/dist/tasks/index.html +83 -5
- package/dist/templates/index.html +83 -5
- 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 +52 -4
- 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 +52 -4
- 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 +52 -4
- 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 +52 -4
- 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 +52 -4
- package/dist/test-automation/index.html +83 -5
- package/dist/test-stats/index.html +83 -5
- package/dist/todos/index.html +83 -5
- package/dist/workbench/index.html +53 -5
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +22 -0
- package/lh-plugins/lh-req-analysis.mjs +672 -0
- package/lh-plugins/plugin-prompts.mjs +2 -0
- package/lh-plugins/req-analysis-prompt.mjs +118 -0
- package/package.json +1 -1
- package/dist/_astro/Base.BOY6F0mi.css +0 -1
- package/dist/_astro/CaseGenerateApp.DqW_nWMc.js +0 -9
- package/dist/_astro/ChatApp.BLxf0h1d.js +0 -219
- package/dist/_astro/PluginsPage.-97n3x2U.js +0 -39
- package/dist/_astro/PmRequirementsBoard.B8HL07cw.js +0 -1
- package/dist/_astro/PmShared.Ca2Ao7v_.js +0 -1
- package/dist/_astro/PromptsLibrary.C9BcIxKK.js +0 -1
- package/dist/_astro/SearchableSelect.DnjoSslK.js +0 -1
- package/dist/_astro/SelectDropdown.CuuDHa8s.js +0 -1
- package/dist/_astro/SlideOverDrawer.B7B5Wu8I.js +0 -1
- package/dist/_astro/UiAutoBoard.DFTiDqCp.js +0 -9
- package/dist/_astro/active-element-history.CED-m1Zp.js +0 -1
- package/dist/_astro/app-config.BUPzGl9f.js +0 -1
- package/dist/_astro/dialog.BAPTk9a_.js +0 -1
- package/dist/_astro/i18n.BGPnP1Bg.js +0 -7
- package/dist/_astro/index.astro_astro_type_script_index_0_lang.LPL9mPQY.js +0 -1
- package/dist/_astro/listbox.C96OCanh.js +0 -1
- package/dist/_astro/menu.IPWdRoNM.js +0 -1
- package/dist/_astro/prompts-meta.Bua-j14I.js +0 -2
- package/dist/_astro/ui-auto-prompt.CX8fju7r.js +0 -3
- package/dist/_astro/use-tree-walker.DFU2AaAP.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,r as n,t as r}from"./dialog.
|
|
1
|
+
import{i as e,n as t,r as n,t as r}from"./dialog.DZHZCe_T.js";import{t as i}from"./jsx-runtime.DUg_B_vD.js";var a=i();function o({open:i,title:o=`确认`,message:s,confirmLabel:c=`确定`,cancelLabel:l=`取消`,danger:u=!1,hideCancel:d=!1,onClose:f,onConfirm:p}){let m=u===!0||u===`solid`?`solid`:u===`outline`?`outline`:null;return(0,a.jsxs)(n,{open:i,onClose:f,transition:!0,className:`relative z-110`,children:[(0,a.jsx)(r,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,a.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,a.jsxs)(e,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim relative w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,a.jsx)(`button`,{type:`button`,onClick:f,className:`tw-confirm-cancel absolute top-3.5 right-3.5 w-7 h-7 flex items-center justify-center rounded-md text-stone-400 hover:bg-stone-100 hover:text-stone-700 transition-colors`,"aria-label":`关闭`,children:`✕`}),(0,a.jsx)(t,{className:`tw-confirm-title pr-8 text-base font-semibold text-stone-900`,children:o}),(0,a.jsx)(`p`,{className:`tw-confirm-msg mt-3 text-sm text-stone-600 leading-relaxed whitespace-pre-wrap`,children:s}),(0,a.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[d?null:(0,a.jsx)(`button`,{type:`button`,onClick:f,className:`tw-confirm-cancel h-8 px-3 text-sm rounded-lg border border-stone-200 text-stone-600 hover:bg-stone-100 transition-colors`,children:l}),(0,a.jsx)(`button`,{type:`button`,onClick:p,className:m===`outline`?`h-8 px-3 text-sm rounded-lg border border-red-300 text-red-600 bg-transparent hover:bg-red-50 transition-colors`:m===`solid`?`h-8 px-3 text-sm rounded-lg text-white bg-red-600 hover:bg-red-700 transition-colors`:`h-8 px-3 text-sm rounded-lg text-white bg-[#4176e6] hover:bg-[#3566d0] transition-colors`,children:c})]})]})})]})}export{o as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,s as t,t as n}from"./react.Blvh0GOs.js";import{i as r}from"./app-config.BUPzGl9f.js";import{i,o as a,s as o}from"./plugins.C2BMfzv1.js";import{a as s,i as c,n as l,o as u,r as d,t as f}from"./view-prefs.BEAZRcxF.js";import{t as p}from"./react-dom.DLW9pGCF.js";import{i as m,n as h,r as g,t as _}from"./dialog.BAPTk9a_.js";import{t as v}from"./jsx-runtime.DUg_B_vD.js";import{v as y,y as b}from"./pm.CagBA-ht.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.BocUabwy.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=e(((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=e(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Qe=e(((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=e(((e,t)=>{t.exports=Qe()()})),X=t(n(),1),Z=t($e(),1),et=t(p(),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{n as e,s as t,t as n}from"./react.Blvh0GOs.js";import{i as r}from"./app-config.Cq_F8I0l.js";import{i,o as a,s as o}from"./plugins.CKkgnq4r.js";import{a as s,i as c,n as l,o as u,r as d,t as f}from"./view-prefs.7wGuDpzi.js";import{t as p}from"./react-dom.DLW9pGCF.js";import{i as m,n as h,r as g,t as _}from"./dialog.DZHZCe_T.js";import{t as v}from"./jsx-runtime.DUg_B_vD.js";import{v as y,y as b}from"./pm.CagBA-ht.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.CWqBZccW.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=e(((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=e(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Qe=e(((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=e(((e,t)=>{t.exports=Qe()()})),X=t(n(),1),Z=t($e(),1),et=t(p(),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=e(((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=e(((e,t)=>{var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!c.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),f=e=>u(i({},`__esModule`,{value:!0}),e),m={};l(m,{DraggableCore:()=>ve,default:()=>q}),t.exports=f(m);var h=d(n()),g=d($e()),_=d(p()),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;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{p as n}from"./app-config.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{p as n}from"./app-config.Cq_F8I0l.js";import{a as r,n as i,o as a,r as o}from"./view-prefs.7wGuDpzi.js";import{t as s}from"./jsx-runtime.DUg_B_vD.js";import{n as c,t as l}from"./DocsPager.EPT5-oEx.js";import{t as u}from"./OverflowHint.D6v4Uj2N.js";import{t as d}from"./SelectDropdown.B3-XpBpn.js";import{t as f}from"./useListAnim.BoerpmsB.js";var p=`tw.docs.files.v1.`;function m(e){try{let t=sessionStorage.getItem(n(p+e));if(!t)return null;let r=JSON.parse(t);return Array.isArray(r)?r:null}catch{return null}}function h(e,t){try{sessionStorage.setItem(n(p+e),JSON.stringify(t))}catch{}}var g=e(t(),1);function _(e){return e==null?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function v(e){if(!e)return`—`;try{return new Date(e).toLocaleString(`zh-CN`,{hour12:!1,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}catch{return`—`}}var y=s(),b=[{value:`mtime`,label:`按修改时间`},{value:`name`,label:`按文件名`}],x=b.map(e=>e.value),S=`h-8 px-3 text-sm border border-stone-300 rounded-lg bg-white text-stone-800 focus:outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6]`,C=`transition-colors duration-150 hover:bg-stone-50 hover:shadow-[inset_3px_0_0_0_var(--tw-accent)] cursor-pointer`,w=`w-38 shrink-0`,T=`w-16 shrink-0 text-left`,E=`w-40 shrink-0 text-right`,D=`text-sm text-stone-400 py-10 text-center border border-dashed border-stone-200 rounded-lg`;function O(e,t,n){let[s,l]=(0,g.useState)(()=>n?o(`docs.${n}.search`):``),[u,d]=(0,g.useState)(()=>n?i(`docs.${n}.sort`,x,`mtime`):`mtime`),[f,p]=(0,g.useState)(1),[m,h]=c(t),_=(0,g.useMemo)(()=>{let t=s.trim().toLowerCase(),n=[...t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e];return u===`name`?n.sort((e,t)=>e.name.localeCompare(t.name,`zh`)):n.sort((e,t)=>(t.mtime??0)-(e.mtime??0)),n},[e,s,u]),v=Math.max(1,Math.ceil(_.length/m)),y=Math.min(f,v);return{query:s,setQuery:e=>{l(e),n&&a(`docs.${n}.search`,e),p(1)},sortBy:u,setSortBy:e=>{d(e),n&&r(`docs.${n}.sort`,e),p(1)},page:y,setPage:p,pageSize:m,setPageSize:e=>{h(e),p(1)},filtered:_,totalPages:v,pageFiles:(0,g.useMemo)(()=>_.slice((y-1)*m,y*m),[_,y,m])}}function k({files:e,filtered:t,pageFiles:n,query:r,onQuery:i,sortBy:a,onSortBy:o,page:s,totalPages:c,pageSize:p,onPage:m,onPageSize:h,busy:g=!1,emptyText:x,searchPlaceholder:O,selectAllLabel:k=`全选本页`,renderBadge:A,renderNameAction:j,renderActions:M,actionsClassName:N=E,extraColumn:P,onRowDoubleClick:F,selectable:I,selected:L,onToggleRow:R,onSelectPage:z}){let B=I??(()=>!0),V=n.filter(B),H=V.length>0&&V.every(e=>L[e.path]),U=!H&&V.some(e=>L[e.path]),{cls:W,play:G}=f(),K=e=>{G(),i(e)};return(0,y.jsxs)(y.Fragment,{children:[e.length>0?(0,y.jsxs)(`div`,{className:`shrink-0 px-4 py-2 border-b border-stone-100 bg-stone-50/60 flex items-center gap-2 flex-wrap`,children:[(0,y.jsx)(`input`,{type:`search`,value:r,onChange:e=>K(e.target.value),placeholder:O,"aria-label":O,className:`${S} flex-1 min-w-48`}),(0,y.jsx)(d,{compact:!0,options:b,value:a,onChange:e=>{G(),o(e)},ariaLabel:`排序方式`,showCheck:!1,className:`w-34 shrink-0`})]}):null,(0,y.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4`,children:e.length===0?(0,y.jsx)(`p`,{className:D,children:x}):t.length===0?(0,y.jsxs)(`p`,{className:D,children:[`没有匹配「`,r.trim(),`」的文件。`]}):(0,y.jsxs)(`ul`,{className:`${W}divide-y divide-stone-100 border border-stone-200 rounded-lg overflow-hidden`,children:[(0,y.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 bg-stone-50 text-xs text-stone-500`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:H,ref:e=>{e&&(e.indeterminate=U)},onChange:()=>z(V.map(e=>e.path),!H),disabled:g||V.length===0,className:`rounded border-stone-300`,"aria-label":k}),(0,y.jsx)(`span`,{className:`flex-1 min-w-0`,children:`文件名`}),P?(0,y.jsx)(`span`,{className:`${P.className??`w-28 shrink-0`} text-xs text-stone-500`,children:P.header}):null,(0,y.jsx)(`span`,{className:w,children:`创建时间`}),(0,y.jsx)(`span`,{className:w,children:`修改时间`}),(0,y.jsx)(`span`,{className:T,children:`大小`}),(0,y.jsx)(`span`,{className:N,children:`操作`})]}),n.map(e=>{let t=B(e);return(0,y.jsxs)(`li`,{className:`group flex items-center gap-2 px-3 py-2.5 ${C}`,onDoubleClick:F?()=>F(e):void 0,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:!!L[e.path],disabled:g||!t,onChange:()=>R(e.path),onDoubleClick:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:`rounded border-stone-300`,"aria-label":`选择 ${e.name}`}),(0,y.jsxs)(`div`,{className:`flex-1 min-w-0 text-left flex items-center gap-2`,children:[(0,y.jsx)(u,{text:e.name,className:`text-sm text-stone-800 truncate`}),A?A(e):null,j?(0,y.jsx)(`span`,{className:`flex shrink-0 items-center opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100`,onDoubleClick:e=>e.stopPropagation(),children:j(e)}):null]}),P?(0,y.jsx)(`div`,{className:`${P.className??`w-28 shrink-0`} truncate`,children:P.render(e)}):null,(0,y.jsx)(`span`,{className:`${w} text-[11px] text-stone-500 tabular-nums`,children:v(e.ctime??e.mtime)}),(0,y.jsx)(`span`,{className:`${w} text-[11px] text-stone-500 tabular-nums`,children:v(e.mtime)}),(0,y.jsx)(`span`,{className:`${T} text-[11px] text-stone-400`,children:_(e.size)}),(0,y.jsx)(`div`,{className:`${N} flex flex-nowrap items-center justify-end gap-1`,onDoubleClick:e=>e.stopPropagation(),children:M(e)})]},e.path)})]})}),e.length>0?(0,y.jsx)(l,{page:s,totalPages:c,pageSize:p,busy:g,onPage:e=>{G(),m(e)},onPageSize:e=>{G(),h(e)}}):null]})}export{h as i,O as n,m as r,k as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{p as n}from"./app-config.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{p as n}from"./app-config.Cq_F8I0l.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{t as i}from"./SelectDropdown.B3-XpBpn.js";var a=e(t(),1),o=[5,10,20,50],s=`tw.docs.page-size.v1`;function c(e){return typeof e==`number`&&o.includes(e)}function l(e,t=s){try{let r=localStorage.getItem(n(t)),i=r===null?NaN:Number(r);return c(i)?i:e}catch{return e}}function u(e,t=s){if(c(e))try{localStorage.setItem(n(t),String(e))}catch{}}var d=r(),f=`h-8 px-3 shrink-0 whitespace-nowrap text-sm text-stone-600 border border-stone-200 rounded-lg hover:bg-stone-50 disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,p=o.map(e=>({value:String(e),label:String(e)}));function m(e,t){let[n,r]=(0,a.useState)(()=>l(e,t));return[n,(0,a.useCallback)(e=>{c(e)&&(u(e,t),r(e))},[t])]}function h({page:e,totalPages:t,pageSize:n,busy:r=!1,onPage:a,onPageSize:o}){return(0,d.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-t border-stone-100 flex items-center justify-between gap-2 flex-wrap`,children:[(0,d.jsxs)(`span`,{className:`text-xs text-stone-500 flex items-center gap-1.5`,children:[(0,d.jsxs)(`span`,{children:[`第 `,e,` / `,t,` 页 ·`]}),(0,d.jsx)(i,{compact:!0,centerContent:!0,options:p,value:String(n),onChange:e=>o(Number(e)),disabled:r,ariaLabel:`每页条数`,showCheck:!1,className:`w-18`}),(0,d.jsx)(`span`,{children:`条`})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,d.jsx)(`button`,{type:`button`,disabled:r||e<=1,onClick:()=>a(1),className:f,children:`首页`}),(0,d.jsx)(`button`,{type:`button`,disabled:r||e<=1,onClick:()=>a(e-1),className:f,children:`上一页`}),(0,d.jsx)(`button`,{type:`button`,disabled:r||e>=t,onClick:()=>a(e+1),className:f,children:`下一页`}),(0,d.jsx)(`button`,{type:`button`,disabled:r||e>=t,onClick:()=>a(t),className:f,children:`末页`})]})]})}export{m as n,h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime.DUg_B_vD.js";import{t}from"./SelectDropdown.
|
|
1
|
+
import{t as e}from"./jsx-runtime.DUg_B_vD.js";import{t}from"./SelectDropdown.B3-XpBpn.js";var n=e(),r=`h-9 w-full rounded-md border border-transparent bg-transparent px-2 text-sm text-stone-800 outline-none transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white placeholder:text-stone-400`;function i(e){return(0,n.jsxs)(`div`,{className:`flex items-start gap-3 px-6 py-2`,children:[(0,n.jsxs)(`div`,{className:`flex w-[132px] shrink-0 items-center gap-2 pt-1.5 text-sm text-stone-600`,children:[(0,n.jsx)(`span`,{className:`flex h-4 w-4 items-center justify-center text-stone-400`,children:e.icon}),(0,n.jsx)(`span`,{className:`truncate`,children:e.label})]}),(0,n.jsx)(`div`,{className:`min-w-0 flex-1`,children:e.children})]})}function a(e){return(0,n.jsx)(t,{flat:!0,menuMatchTrigger:!0,ariaLabel:e.ariaLabel,options:e.options,value:e.value,onChange:e.onChange,disabled:e.disabled,className:`w-full`,renderTrigger:()=>(0,n.jsx)(`span`,{className:`truncate`,children:e.label}),renderOptionPrefix:e.optionDotClassName?t=>(0,n.jsx)(`span`,{className:`h-2 w-2 rounded-full ${e.optionDotClassName?.(t.value)??``}`}):void 0})}function o(){return(0,n.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,n.jsx)(`path`,{d:`M5 19 11 5l6 14`}),(0,n.jsx)(`path`,{d:`M7.5 14h7`}),(0,n.jsx)(`path`,{d:`M18 9v10`})]})}function s(){return(0,n.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,n.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,n.jsx)(`path`,{d:`m8.5 12.5 2.5 2.5 4.5-5`})]})}function c(){return(0,n.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,n.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`}),(0,n.jsx)(`path`,{d:`M9 4v16`})]})}function l(){return(0,n.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,n.jsx)(`rect`,{x:`4`,y:`5`,width:`16`,height:`15`,rx:`2`}),(0,n.jsx)(`path`,{d:`M4 10h16M9 3v4M15 3v4`})]})}function u(){return(0,n.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,n.jsx)(`path`,{d:`M7 4h10l-5 7 5 9H7l5-9Z`})})}function d(e){return(0,n.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:`transition-transform ${e.open?``:`-rotate-90`}`,children:(0,n.jsx)(`path`,{d:`m6 9 6 6 6-6`})})}export{l as a,c,d as i,o as l,i as n,u as o,a as r,s,r as t};
|
|
@@ -149,4 +149,4 @@ EOD`}return{to_workbook:r,to_sheet:n,from_sheet:o}})(),nl=(function(){function e
|
|
|
149
149
|
`)}}function Hb(e){let t=(e.split(/\r?\n/).find(e=>e.trim())??``).split(`,`).map(e=>e.replace(/^"|"$/g,``).trim()).filter(Boolean);return t.length?{headers:t,body:`字段(必须原样作为 JSON 对象键):${t.join(`、`)}\n\n${e.slice(0,4e3)}`}:{headers:[...Fb],body:e.slice(0,4e3)}}function Ub(e){let t=e.match(/^\|(.+)\|\s*$/m);if(t?.[1]){let n=t[1].split(`|`).map(e=>e.trim()).filter(e=>e&&!/^[-:]+$/.test(e));if(n.length)return{headers:n,body:`字段(必须原样作为 JSON 对象键):${n.join(`、`)}\n\n${e.slice(0,4e3)}`}}return{headers:[...Fb],body:e.slice(0,4e3)}}function Wb(e,t){let n=t.length?t:[...Fb];return e.map(e=>{let t=e??{},r={};for(let e of n){let n=t[e],i=typeof n==`string`?n:n==null?``:String(n);r[e]=Lb(e)?Ib(i):i}return r})}async function Gb(e){let t=await zb.default.loadAsync(e,{base64:!0}),n=`xl/styles.xml`,r=t.file(n);if(r){let e=await r.async(`string`);e.includes(`wrapText`)||(/<cellXfs[^>]*count="1"[^>]*>\s*<xf[^/]*\/>\s*<\/cellXfs>/.test(e)?e=e.replace(/<cellXfs([^>]*)count="1"([^>]*)>\s*<xf([^/]*)\/>\s*<\/cellXfs>/,`<cellXfs$1count="2"$2><xf$3/><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" applyAlignment="1"><alignment wrapText="1" vertical="top"/></xf></cellXfs>`):e.includes(`</cellXfs>`)&&(e=e.replace(/<cellXfs([^>]*)count="(\d+)"/,(e,t,n)=>`<cellXfs${t}count="${Number(n)+1}"`).replace(`</cellXfs>`,`<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" applyAlignment="1"><alignment wrapText="1" vertical="top"/></xf></cellXfs>`)),t.file(n,e))}let i=Object.keys(t.files).filter(e=>/^xl\/worksheets\/sheet\d+\.xml$/.test(e));for(let e of i){let n=t.file(e);if(!n)continue;let r=await n.async(`string`);r=r.replace(/<c\b([^>]*)>/g,(e,t)=>!/\bt="str"/.test(t)||/\bs="\d+"/.test(t)?e:`<c s="1"${t.startsWith(` `)?t:` ${t}`}>`),r=r.replace(/<row r="(\d+)"([^>]*)>/g,(e,t,n)=>Number(t)===1||/\bht=/.test(n)?`<row r="${t}"${n}>`:`<row r="${t}" ht="60" customHeight="1"${n}>`),t.file(e,r)}return t.generateAsync({type:`base64`,compression:`DEFLATE`})}function Kb(e){return/[",\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function qb(e){return e.replace(/\|/g,`\\|`).replace(/\n+/g,`<br>`)}function Jb(e,t,n){let r=n.length?n:[...Fb],i=[`# ${t}`,``,`| ${r.join(` | `)} |`,`|${r.map(()=>`---`).join(`|`)}|`];for(let t of e)i.push(`| ${r.map(e=>qb(t[e]??``)).join(` | `)} |`);return i.join(`
|
|
150
150
|
`)+`
|
|
151
151
|
`}function Yb(e,t){let n=t.length?t:[...Fb];return``+[n.join(`,`),...e.map(e=>n.map(t=>Kb(e[t]??``)).join(`,`))].join(`
|
|
152
|
-
`)}async function Xb(e,t,n=`测试用例`){let r=t.length?t:[...Fb],i=e.map(e=>{let t={};for(let n of r){let r=e[n]??``;t[n]=Lb(n)?Ib(r):r}return t}),a=Pb.json_to_sheet(i,{header:[...r]}),o=a[`!ref`]?Pb.decode_range(a[`!ref`]):null;if(o)for(let e=o.s.r;e<=o.e.r;e++)for(let t=o.s.c;t<=o.e.c;t++){let n=a[Pb.encode_cell({r:e,c:t})];n&&typeof n.v==`string`&&e!==0&&Lb(String(a[Pb.encode_cell({r:0,c:t})]?.v??``))&&(n.v=Ib(n.v),n.w!=null&&(n.w=n.v))}a[`!cols`]=r.map(e=>({wch:Lb(e)?48:Math.min(28,Math.max(12,e.length+4))}));let s=Pb.book_new();Pb.book_append_sheet(s,a,n.slice(0,31));let c=mb(s,{bookType:`xlsx`,type:`base64`});try{return await Gb(c)}catch{return c}}var Zb=n(r(),1),Qb=i();function $b({fields:e,sheetNames:t}){let n=(0,Zb.useRef)(null),r=(0,Zb.useRef)(null),i=(0,Zb.useRef)(null),[a,o]=(0,Zb.useState)(e.length),[s,c]=(0,Zb.useState)(!1),l=(0,Zb.useCallback)(()=>{let t=n.current,a=r.current;if(!t||!a||e.length===0)return;let s=t.clientWidth;if(s<=0)return;let c=Array.from(a.querySelectorAll(`[data-chip]`)).map(e=>e.offsetWidth),l=i.current?.offsetWidth??36,u=0;for(let e=0;e<c.length;e++)u+=c[e]+(e>0?4:0);if(u<=s){o(e.length);return}let d=0,f=0;for(let e=0;e<c.length;e++){let t=d+(f>0?4:0)+c[e];if(t+4+l<=s||e===c.length-1&&t<=s)d=t,f=e+1;else break}o(Math.max(1,Math.min(f,e.length-1)))},[e.length]);if((0,Zb.useLayoutEffect)(()=>{c(!1),l()},[e.join(`\0`),l]),(0,Zb.useEffect)(()=>{let e=n.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{s||l()});return t.observe(e),()=>t.disconnect()},[s,e.join(`\0`),l]),!e.length)return null;let u=s?e:e.slice(0,a),d=s?0:Math.max(0,e.length-a);return(0,Qb.jsxs)(`div`,{ref:n,className:`mt-1.5 relative w-full min-w-0`,children:[t&&t.length>1&&(0,Qb.jsxs)(`p`,{className:`mb-1.5 text-xs text-stone-400 truncate`,"data-hint":t.join(` | `),children:[`工作表:`,t.join(` | `)]}),(0,Qb.jsxs)(`div`,{ref:r,className:`absolute
|
|
152
|
+
`)}async function Xb(e,t,n=`测试用例`){let r=t.length?t:[...Fb],i=e.map(e=>{let t={};for(let n of r){let r=e[n]??``;t[n]=Lb(n)?Ib(r):r}return t}),a=Pb.json_to_sheet(i,{header:[...r]}),o=a[`!ref`]?Pb.decode_range(a[`!ref`]):null;if(o)for(let e=o.s.r;e<=o.e.r;e++)for(let t=o.s.c;t<=o.e.c;t++){let n=a[Pb.encode_cell({r:e,c:t})];n&&typeof n.v==`string`&&e!==0&&Lb(String(a[Pb.encode_cell({r:0,c:t})]?.v??``))&&(n.v=Ib(n.v),n.w!=null&&(n.w=n.v))}a[`!cols`]=r.map(e=>({wch:Lb(e)?48:Math.min(28,Math.max(12,e.length+4))}));let s=Pb.book_new();Pb.book_append_sheet(s,a,n.slice(0,31));let c=mb(s,{bookType:`xlsx`,type:`base64`});try{return await Gb(c)}catch{return c}}var Zb=n(r(),1),Qb=i();function $b({fields:e,sheetNames:t}){let n=(0,Zb.useRef)(null),r=(0,Zb.useRef)(null),i=(0,Zb.useRef)(null),[a,o]=(0,Zb.useState)(e.length),[s,c]=(0,Zb.useState)(!1),l=(0,Zb.useCallback)(()=>{let t=n.current,a=r.current;if(!t||!a||e.length===0)return;let s=t.clientWidth;if(s<=0)return;let c=Array.from(a.querySelectorAll(`[data-chip]`)).map(e=>e.offsetWidth),l=i.current?.offsetWidth??36,u=0;for(let e=0;e<c.length;e++)u+=c[e]+(e>0?4:0);if(u<=s){o(e.length);return}let d=0,f=0;for(let e=0;e<c.length;e++){let t=d+(f>0?4:0)+c[e];if(t+4+l<=s||e===c.length-1&&t<=s)d=t,f=e+1;else break}o(Math.max(1,Math.min(f,e.length-1)))},[e.length]);if((0,Zb.useLayoutEffect)(()=>{c(!1),l()},[e.join(`\0`),l]),(0,Zb.useEffect)(()=>{let e=n.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{s||l()});return t.observe(e),()=>t.disconnect()},[s,e.join(`\0`),l]),!e.length)return null;let u=s?e:e.slice(0,a),d=s?0:Math.max(0,e.length-a);return(0,Qb.jsxs)(`div`,{ref:n,className:`mt-1.5 relative w-full min-w-0`,children:[t&&t.length>1&&(0,Qb.jsxs)(`p`,{className:`mb-1.5 text-xs text-stone-400 truncate`,"data-hint":t.join(` | `),children:[`工作表:`,t.join(` | `)]}),(0,Qb.jsxs)(`div`,{ref:r,className:`pointer-events-none absolute inset-x-0 top-0 -z-10 flex w-full gap-1 overflow-hidden opacity-0 whitespace-nowrap`,"aria-hidden":!0,children:[e.map(e=>(0,Qb.jsx)(`span`,{"data-chip":!0,className:`text-[11px] px-1.5 py-0.5 rounded border border-stone-200 max-w-36 shrink-0 truncate`,children:e},`m-${e}`)),(0,Qb.jsx)(`button`,{ref:i,type:`button`,tabIndex:-1,className:`text-[11px] px-1.5 py-0.5 shrink-0`,children:`+99`})]}),(0,Qb.jsxs)(`div`,{className:`flex gap-1 items-center w-full min-w-0 ${s?`flex-wrap`:`flex-nowrap overflow-hidden`}`,children:[u.map(e=>(0,Qb.jsx)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded border border-stone-200 text-stone-500 max-w-36 truncate shrink-0`,"data-hint":e,children:e},e)),d>0&&(0,Qb.jsxs)(`button`,{type:`button`,onClick:()=>c(!0),className:`text-[11px] text-stone-400 hover:text-amber-700 cursor-pointer shrink-0`,children:[`+`,d]}),s&&e.length>a&&(0,Qb.jsx)(`button`,{type:`button`,onClick:()=>c(!1),className:`text-[11px] text-stone-400 hover:text-amber-700 cursor-pointer shrink-0`,children:`收起`})]})]})}export{Vb as a,Xb as c,ab as d,Pb as f,Ub as i,Rb as l,Wb as n,Yb as o,Hb as r,Jb as s,$b as t,Fb as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.Cq_F8I0l.js";import{i as r,o as i,s as a}from"./plugins.CKkgnq4r.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";import{t as s}from"./ConfirmDialog.CsMwWevK.js";import{l as c,n as l,r as u,s as d}from"./project-docs.Cd2gKPKh.js";import{n as f}from"./doc-roots.DAJP9Svr.js";import{i as p,n as m,r as h,t as g}from"./DocsFileBrowser.DvBPLCEp.js";import{t as _,u as v}from"./open-docs-in-session.LWVC43xp.js";var y=e(t(),1),b=o(),x=10;async function S(e=`.`){let{entries:t}=await d(`knowledge`,e),n=[];for(let e of t)e.type===`file`?e.name.endsWith(`.md`)&&n.push(e):n.push(...await S(e.path));return n}function C({staticCount:e=0,base:t}){let o=h(`knowledge`),[d,C]=(0,y.useState)(!1),[w,T]=(0,y.useState)(!0),[E,D]=(0,y.useState)(o?!0:null),[O,k]=(0,y.useState)(()=>o??[]),[A,j]=(0,y.useState)(null),[M,N]=(0,y.useState)(!1),[P,F]=(0,y.useState)({}),[I,L]=(0,y.useState)(null),R=m(O,x,`knowledge`),z=(0,y.useCallback)(async()=>{j(null);try{let e=await S(`.`);k(e),p(`knowledge`,e)}catch(e){j(e instanceof Error?e.message:String(e))}},[]);(0,y.useEffect)(()=>{let e=i(e=>T(!!e.knowledgeLib));return n().then(()=>{T(r(`knowledgeLib`)),C(!0)}),e},[]),(0,y.useEffect)(()=>{d&&w&&(async()=>{await u(`knowledge`)?(await v().catch(()=>null),await z(),D(!0)):D(!1)})()},[d,w,z]);let B=(0,y.useMemo)(()=>Object.keys(P).filter(e=>P[e]),[P]);function V(){r(`knowledgeGen`)?window.location.href=`${t}workbench/?plugin=knowledgeGen`:j(a(`knowledgeGen`))}async function H(e){N(!0),j(null);try{await c(`knowledge`,e.path)}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1)}}async function U(e){N(!0),j(null);try{await _(`knowledge`,e)}catch(e){j(e instanceof Error?e.message:String(e)),N(!1)}}async function W(){let e=I;if(e){L(null),N(!0),j(null);try{if(e.kind===`one`)await l(`knowledge`,e.entry.path);else{for(let t of e.paths)await l(`knowledge`,t);F({})}await z()}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1)}}}let G=I?.kind===`one`?`删除「${I.entry.name}」?将从 ${f(`knowledge`)} 中移除。`:I?.kind===`batch`?`确认删除已选中的 ${I.paths.length} 个知识库文件?此操作不可恢复。`:``;return d?w?E===null?(0,b.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,b.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,b.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):E?(0,b.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,b.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,b.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[R.query.trim()?(0,b.jsxs)(b.Fragment,{children:[`匹配 `,(0,b.jsx)(`span`,{className:`font-medium text-stone-800`,children:R.filtered.length}),` 个`,(0,b.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,O.length]})]}):(0,b.jsxs)(b.Fragment,{children:[`共 `,(0,b.jsx)(`span`,{className:`font-medium text-stone-800`,children:O.length}),` 个知识库文件`]}),B.length>0?(0,b.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,B.length]}):null]}),(0,b.jsx)(`button`,{type:`button`,disabled:M||B.length===0,onClick:()=>L({kind:`batch`,paths:B}),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-red-600 border border-red-200 rounded-lg hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,b.jsx)(`button`,{type:`button`,disabled:M,onClick:V,className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40`,children:`生成知识库`})]}),A?(0,b.jsx)(`div`,{className:`shrink-0 mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:A}):null,(0,b.jsx)(g,{files:O,filtered:R.filtered,pageFiles:R.pageFiles,query:R.query,onQuery:R.setQuery,sortBy:R.sortBy,onSortBy:R.setSortBy,page:R.page,totalPages:R.totalPages,pageSize:R.pageSize,onPage:R.setPage,onPageSize:R.setPageSize,busy:M,emptyText:`暂无知识库文件,点击「生成知识库」前往我的工作台。`,searchPlaceholder:`搜索文件名或路径…`,selected:P,onToggleRow:e=>F(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>F(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void H(e),renderBadge:e=>{let t=e.path.includes(`/`)?e.path.split(`/`)[0]:``;return t?(0,b.jsx)(`span`,{className:`shrink-0 text-[10px] px-1.5 py-0.5 rounded bg-amber-50 text-amber-800 border border-amber-100`,children:t}):null},renderActions:e=>(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{type:`button`,disabled:M,onClick:()=>void U(e),className:`text-xs whitespace-nowrap text-white bg-[#4176e6] px-2 py-1 rounded hover:bg-[#3565c7] cursor-pointer disabled:opacity-40`,children:`在会话中打开`}),(0,b.jsx)(`button`,{type:`button`,disabled:M,onClick:()=>L({kind:`one`,entry:e}),className:`text-xs whitespace-nowrap text-red-600 hover:bg-red-50 px-2 py-1 rounded cursor-pointer disabled:opacity-40`,children:`删除`})]})}),(0,b.jsx)(s,{open:I!=null,title:I?.kind===`batch`?`批量删除`:`删除知识库文件`,message:G,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>L(null),onConfirm:()=>void W()})]}):(0,b.jsxs)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:[`知识库管理需要本地文档服务,当前未就绪`,e>0?`(构建期约有 ${e} 份文档可浏览)`:``,`。`]}):(0,b.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:a(`knowledgeLib`)}):(0,b.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,b.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,b.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,n as r,r as i,t as a}from"./dialog.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,n as r,r as i,t as a}from"./dialog.DZHZCe_T.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";var s=e(t(),1),c=o();function l({open:e,title:t=`新建文件夹`,label:o=`文件夹名称`,placeholder:l=`请输入名称`,initialValue:u=``,lockExtension:d=!1,confirmLabel:f=`创建`,cancelLabel:p=`取消`,error:m=``,onClose:h,onConfirm:g}){let[_,v]=(0,s.useState)(``),[y,b]=(0,s.useState)(``),x=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(e){let e=u,t=``;if(d){let n=u.lastIndexOf(`.`);n>0&&(e=u.slice(0,n),t=u.slice(n))}v(e),b(t);let n=window.setTimeout(()=>{x.current?.focus(),x.current?.select()},50);return()=>window.clearTimeout(n)}},[e,u,d]);function S(){let e=_.trim();e&&g(e+y)}return(0,c.jsxs)(i,{open:e,onClose:h,transition:!0,className:`relative z-50`,children:[(0,c.jsx)(a,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,c.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,c.jsxs)(n,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,c.jsx)(r,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:t}),(0,c.jsxs)(`label`,{className:`tw-confirm-msg mt-4 block text-xs font-medium text-stone-500`,children:[o,(0,c.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-0 rounded-lg border border-stone-200 focus-within:ring-2 focus-within:ring-[#4176e6]/30 focus-within:border-[#4176e6] transition-colors`,children:[(0,c.jsx)(`input`,{ref:x,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),S())},placeholder:l,className:`flex-1 min-w-0 h-9 px-3 text-sm rounded-lg border-0 bg-transparent text-stone-800 outline-none`}),y?(0,c.jsx)(`span`,{className:`shrink-0 pr-3 text-sm text-stone-400 select-none`,children:y}):null]}),m?(0,c.jsx)(`span`,{className:`mt-1.5 block text-[11px] font-normal leading-relaxed text-red-600`,children:m}):null]}),(0,c.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,c.jsx)(`button`,{type:`button`,onClick:h,className:`tw-confirm-cancel h-8 px-3 text-sm rounded-lg text-stone-600 hover:bg-stone-100 transition-colors`,children:p}),(0,c.jsx)(`button`,{type:`button`,disabled:!_.trim(),onClick:S,className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:f})]})]})})]})}export{l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{A as n,C as r,D as i,F as a,I as o,L as s,M as c,N as l,O as u,P as d,R as f,S as p,T as m,_ as h,a as g,b as _,g as v,h as y,i as b,j as x,k as S,m as C,p as w,r as T,t as E,u as D,v as ee,w as O,x as k,y as te}from"./app-config.BUPzGl9f.js";import{a as A,i as j,o as ne}from"./plugins.C2BMfzv1.js";import{t as M}from"./react-dom.DLW9pGCF.js";import{i as N,n as P,r as F,t as I}from"./dialog.BAPTk9a_.js";import{t as L}from"./jsx-runtime.DUg_B_vD.js";import{t as re}from"./ConfirmDialog.BZzZWDci.js";import{n as R}from"./i18n.BGPnP1Bg.js";import{n as ie}from"./hydrate-cache.BXX604Bw.js";var z=e(t(),1),B=e(M(),1),V=`/__tb_nav/groups`;function ae(){return T().navGroups}function oe(){return u(T().navIcons)}function se(e,t){let n={...oe(),[e]:t};return D({navIcons:n}),E(),n}function ce(){return T().navOrder}function le(e,t){let n=i(e),r=S(t,n);return D({navGroups:n,navOrder:r}),E(),{groups:n,order:r}}function H(e,t){return JSON.stringify(e)===JSON.stringify(t)}async function ue(e){if(!g())return null;try{let t=await fetch(V,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({groups:e}),signal:AbortSignal.timeout(4e3)});if(!t.ok)return null;let n=await t.json();return i(n.groups,!1)}catch{return null}}async function de(){if(!g())return;let e=T(),t=null;try{let e=await fetch(V,{signal:AbortSignal.timeout(4e3)});e.ok&&(t=await e.json())}catch{return}if(!t)return;if(t.scanned){let n=i(t.groups,!1),r=S(e.navOrder,n);(!H(n,e.navGroups)||!H(r,e.navOrder))&&(D({navGroups:n,navOrder:r}),E());return}if(!e.navGroups.length)return;let n=await ue(e.navGroups);n&&!H(n,e.navGroups)&&(D({navGroups:n,navOrder:S(e.navOrder,n)}),E())}function U(e,t,n){let[r,i]=(0,z.useState)(null),a=(0,z.useRef)(null),o=(0,z.useRef)(e);o.current=e;let c=(0,z.useRef)(t);c.current=t;let l=(0,z.useRef)(n);l.current=n;function u(e,t){if(t.button!==0)return;t.preventDefault(),t.stopPropagation();let n=a.current;if(!n)return;i(e);let r=e=>{let t=[...n.querySelectorAll(`[data-sort-key]`)];for(let n of t){let t=n.getBoundingClientRect();if(e>=t.top&&e<=t.bottom)return n.dataset.sortKey}return null},u=t=>{let n=r(t.clientY);if(!n||n===e)return;let i=s(o.current,e,n);i.join(`|`)!==o.current.join(`|`)&&(o.current=i,c.current(i))},d=()=>{window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d),i(null),l.current?.()};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)}return{listRef:a,dragId:r,onPointerDown:u}}var W=L(),G=`/`;function K(e){return`${G.endsWith(`/`)?G:`${G}/`}${e.replace(/^\//,``)}`}function q(e,t){let n=G.replace(/\/$/,``),r=e.slice(n.length).replace(/^\/+/,``);return r===t||r.startsWith(`${t}/`)}function fe(e){return[`tw-nav-item`,e?`is-active font-medium`:``].filter(Boolean).join(` `)}function pe(e){return w(`tw.nav.groupOpen.${e}`)}function me(){return w(`tw.nav.docsOpen`)}function he(e,t){try{let t=localStorage.getItem(pe(e));if(t===`1`)return!0;if(t===`0`)return!1;if(e===`docs`){let e=localStorage.getItem(me());if(e===`1`)return!0;if(e===`0`)return!1}}catch{}return t}function J(e,t){try{localStorage.setItem(pe(e),t?`1`:`0`),e===`docs`&&localStorage.setItem(me(),t?`1`:`0`)}catch{}}function Y(e){return e.id===`docs`&&(e.name===`文档库`||e.name===`Documents`)?R(`nav.docs`):e.name}function ge(e){return e.type===`group`?Y(e.group):R(_(e.id).i18n)}function X(e){return e.type===`item`?O(e.id):k(e.group.id)}function _e(){let[e,t]=(0,z.useState)(()=>window.location.pathname);return(0,z.useEffect)(()=>{let e=()=>t(window.location.pathname);return document.addEventListener(`astro:page-load`,e),document.addEventListener(`astro:after-swap`,e),window.addEventListener(`popstate`,e),()=>{document.removeEventListener(`astro:page-load`,e),document.removeEventListener(`astro:after-swap`,e),window.removeEventListener(`popstate`,e)}},[]),e}function Z({children:e}){return(0,W.jsx)(`svg`,{className:`tw-nav-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:e})}function Q({id:e,icon:t}){return(0,W.jsx)(Z,{children:ve[t??C[e]]})}var ve={dashboard:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,W.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,W.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1.5`}),(0,W.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1.5`})]}),check:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M9 11l3 3L22 4`}),(0,W.jsx)(`path`,{d:`M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11`})]}),pencil:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M12 20h9`}),(0,W.jsx)(`path`,{d:`M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`})]}),book:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M4 19.5A2.5 2.5 0 0 1 6.5 17H20`}),(0,W.jsx)(`path`,{d:`M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z`})]}),fileText:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M14 3v5h5`}),(0,W.jsx)(`path`,{d:`M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z`}),(0,W.jsx)(`path`,{d:`M8 13h8`}),(0,W.jsx)(`path`,{d:`M8 17h6`})]}),layers:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M12 3 3 8l9 5 9-5-9-5z`}),(0,W.jsx)(`path`,{d:`m3 13 9 5 9-5`})]}),list:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M8 6h13`}),(0,W.jsx)(`path`,{d:`M8 12h13`}),(0,W.jsx)(`path`,{d:`M8 18h13`}),(0,W.jsx)(`path`,{d:`M3 6h.01`}),(0,W.jsx)(`path`,{d:`M3 12h.01`}),(0,W.jsx)(`path`,{d:`M3 18h.01`})]}),folder:(0,W.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`}),star:(0,W.jsx)(`path`,{d:`m12 3 2.1 5.9L20 11l-5 4.3 1.7 6.2-5.7-3.9-5.7 3.9L7 15.3 2 11l5.9-2.1L12 3z`}),database:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`ellipse`,{cx:`12`,cy:`6`,rx:`8`,ry:`3`}),(0,W.jsx)(`path`,{d:`M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6`}),(0,W.jsx)(`path`,{d:`M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]}),target:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`})]}),code:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`m8 8-4 4 4 4`}),(0,W.jsx)(`path`,{d:`m16 8 4 4-4 4`})]}),flask:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M9 3h6`}),(0,W.jsx)(`path`,{d:`M10 3v6l-5 8a2 2 0 0 0 1.7 3h10.6a2 2 0 0 0 1.7-3l-5-8V3`}),(0,W.jsx)(`path`,{d:`M7.5 14h9`})]}),home:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M3 10.5 12 3l9 7.5`}),(0,W.jsx)(`path`,{d:`M5 9.5V20h14V9.5`})]}),clipboard:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M9 4h6v3H9z`}),(0,W.jsx)(`path`,{d:`M8 4H6a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2`})]}),bug:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`14`,r:`5`}),(0,W.jsx)(`path`,{d:`M9 6l2 2`}),(0,W.jsx)(`path`,{d:`M15 6l-2 2`}),(0,W.jsx)(`path`,{d:`M7 11H4`}),(0,W.jsx)(`path`,{d:`M20 11h-3`}),(0,W.jsx)(`path`,{d:`M7 17H4`}),(0,W.jsx)(`path`,{d:`M20 17h-3`})]}),calendar:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`3`,y:`5`,width:`18`,height:`16`,rx:`2`}),(0,W.jsx)(`path`,{d:`M8 3v4`}),(0,W.jsx)(`path`,{d:`M16 3v4`}),(0,W.jsx)(`path`,{d:`M3 10h18`})]}),chart:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M4 20V10`}),(0,W.jsx)(`path`,{d:`M10 20V4`}),(0,W.jsx)(`path`,{d:`M16 20v-7`}),(0,W.jsx)(`path`,{d:`M2 20h20`})]}),globe:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,W.jsx)(`path`,{d:`M3 12h18`}),(0,W.jsx)(`path`,{d:`M12 3c2.5 2.5 4 5.7 4 9s-1.5 6.5-4 9c-2.5-2.5-4-5.7-4-9s1.5-6.5 4-9z`})]}),link:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M10 13a4 4 0 0 0 5.7 0l2.3-2.3a4 4 0 0 0-5.7-5.7L11 6.3`}),(0,W.jsx)(`path`,{d:`M14 11a4 4 0 0 0-5.7 0L6 13.3a4 4 0 0 0 5.7 5.7L13 17.7`})]}),users:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`9`,cy:`8`,r:`3.5`}),(0,W.jsx)(`path`,{d:`M2.5 20a6.5 6.5 0 0 1 13 0`}),(0,W.jsx)(`path`,{d:`M16 5.5a3.5 3.5 0 0 1 0 7`}),(0,W.jsx)(`path`,{d:`M18 20a6 6 0 0 0-2-4.5`})]}),terminal:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`m5 8 4 4-4 4`}),(0,W.jsx)(`path`,{d:`M13 16h6`})]}),tag:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0l-7.2-7.2a2 2 0 0 1-.6-1.4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 1.4.6l6.2 6.2a2 2 0 0 1 0 2.6z`}),(0,W.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.2`})]}),flag:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M5 21V4`}),(0,W.jsx)(`path`,{d:`M5 5h11l-2 4 2 4H5z`})]}),zap:(0,W.jsx)(`path`,{d:`M13 2 4 14h6l-1 8 9-12h-6l1-8z`})};function ye(){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`svg`,{className:`tw-nav-ico tw-nav-ico--closed`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,W.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`})}),(0,W.jsx)(`svg`,{className:`tw-nav-ico tw-nav-ico--open`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,W.jsx)(`path`,{d:`M6 14l1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`})})]})}function be(){return(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,W.jsx)(`path`,{d:`M21 4H14`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M10 4H3`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M21 12H12`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M8 12H3`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M21 20H16`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M12 20H3`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M14 2v4`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M8 10v4`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M16 18v4`,strokeLinecap:`round`})]})}function xe(){return(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,W.jsx)(`path`,{d:`M12 8v8`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M8 12h8`,strokeLinecap:`round`})]})}function Se(){return(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,children:[(0,W.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.7`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.7`}),(0,W.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.7`})]})}function Ce(){return(0,W.jsx)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,W.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`})})}function we(){return(0,W.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,W.jsx)(`path`,{d:`M9 6H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h4`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M16 8l4 4-4 4`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M20 12H9`,strokeLinecap:`round`})]})}function Te(){return(0,W.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,W.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`4.5`}),(0,W.jsx)(`rect`,{x:`12`,y:`12`,width:`9`,height:`9`,rx:`2`})]})}function Ee(){return(0,W.jsxs)(Z,{children:[(0,W.jsx)(`path`,{d:`M8 6v12`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M5 9l3-3 3 3`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M16 18V6`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M13 15l3 3 3-3`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}function De(){return(0,W.jsxs)(`svg`,{className:`tw-nav-drag-grip`,viewBox:`0 0 20 20`,"aria-hidden":!0,children:[(0,W.jsx)(`circle`,{cx:`7`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,W.jsx)(`circle`,{cx:`13`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,W.jsx)(`circle`,{cx:`7`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,W.jsx)(`circle`,{cx:`13`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,W.jsx)(`circle`,{cx:`7`,cy:`15`,r:`1.25`,fill:`currentColor`}),(0,W.jsx)(`circle`,{cx:`13`,cy:`15`,r:`1.25`,fill:`currentColor`})]})}function $(e,t){if(r(e))return!1;let n=_(e).plugin;return!n||t[n]!==!1}function Oe({id:e,icon:t,pathname:n,actionOpen:r,onMenu:i}){let a=_(e),o=q(n,a.match);return(0,W.jsxs)(`div`,{className:[fe(o),r?`is-action-open`:``].filter(Boolean).join(` `),"data-plugin-nav":a.plugin,children:[(0,W.jsxs)(`a`,{href:K(a.href),className:`tw-nav-item-main`,children:[(0,W.jsx)(Q,{id:e,icon:t}),(0,W.jsx)(`span`,{className:`tw-nav-label`,children:R(a.i18n)})]}),(0,W.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":R(`nav.more`),onClick:e=>{e.preventDefault(),e.stopPropagation(),i(e.currentTarget)},children:(0,W.jsx)(Se,{})})]})}function ke(e,t,n){return e.items.some(e=>{if(r(e))return!1;let t=_(e).plugin;return(!t||j(t))&&q(n,_(e).match)})?!0:m(t,e.id).some(e=>ke(e,t,n))}function Ae(e,t){return e.items.some(e=>{if(r(e))return!1;let t=_(e).plugin;return!t||j(t)})?!0:m(t,e.id).some(e=>Ae(e,t))}function je({group:e,groups:t,order:n,icons:i,pathname:a,openItem:o,openGroupId:s,onMenu:c,onItemMenu:l}){let u=e.items.filter(e=>{if(r(e))return!1;let t=_(e).plugin;return!t||j(t)}),f=d(t,e.id,n),p=ke(e,t,a),[m,h]=(0,z.useState)(()=>he(e.id,!0)),[g,v]=(0,z.useState)(!1),y=(0,z.useRef)(null),b=(0,z.useRef)(null),x=(0,z.useRef)(null);if((0,z.useEffect)(()=>S,[]),!Ae(e,t))return null;function S(){x.current&&y.current&&y.current.removeEventListener(`transitionend`,x.current),x.current=null,b.current!==null&&(window.clearTimeout(b.current),b.current=null)}function C(){S(),J(e.id,!0),v(!1),h(!0)}function w(t){if(t.preventDefault(),!m||g){C();return}v(!0),J(e.id,!1);let n=y.current,r=!1,i=()=>{r||(r=!0,S(),h(!1),v(!1))},a=e=>{e.target===n&&e.propertyName===`grid-template-rows`&&i()};S(),x.current=a,n?.addEventListener(`transitionend`,a),b.current=window.setTimeout(i,360)}return(0,W.jsxs)(`details`,{className:`tw-nav-details ${g?`is-closing`:``}`,open:m||g,"data-nav-group":e.id,children:[(0,W.jsxs)(`summary`,{className:[`tw-nav-item tw-nav-summary`,p?`is-branch-active`:``,s===e.id?`is-action-open`:``].filter(Boolean).join(` `),onClick:w,children:[(0,W.jsx)(ye,{}),(0,W.jsx)(`span`,{className:`tw-nav-label min-w-0 flex-1 truncate`,children:Y(e)}),(0,W.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":R(`nav.groupActions`),onClick:t=>{t.preventDefault(),t.stopPropagation(),c(e,t.currentTarget)},children:(0,W.jsx)(be,{})}),(0,W.jsx)(`svg`,{className:`tw-nav-chevron opacity-70`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,W.jsx)(`path`,{d:`M7 5l6 5-6 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})]}),(0,W.jsx)(`div`,{className:`tw-nav-subtree-anim`,ref:y,children:(0,W.jsxs)(`div`,{className:`tw-nav-subtree`,children:[u.map(e=>(0,W.jsx)(Oe,{id:e,icon:i[e],pathname:a,actionOpen:o===e,onMenu:t=>l(e,t)},e)),f.map(e=>(0,W.jsx)(je,{group:e,groups:t,order:n,icons:i,pathname:a,openItem:o,openGroupId:s,onMenu:c,onItemMenu:l},e.id))]})})]})}function Me({open:e,draft:t,groups:n,plugins:r,icons:i,onClose:a,onSave:o,onDelete:s}){let[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)([]),[f,p]=(0,z.useState)(``),m=(0,z.useRef)(null),h=new Set(n.filter(e=>e.id!==t?.id).flatMap(e=>e.items)),g=y.filter(e=>$(e.id,r)&&(!h.has(e.id)||u.includes(e.id))),_=U(u,d);(0,z.useEffect)(()=>{if(!e||!t)return;l(t.name),d(t.items.filter(e=>$(e,r))),p(``);let n=window.setTimeout(()=>{m.current?.focus(),m.current?.select()},50);return()=>window.clearTimeout(n)},[e,t,r]);function v(e){d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function b(){let e=c.trim();if(!e){p(R(`nav.groupNameRequired`));return}if(!u.length){p(R(`nav.groupItemsRequired`));return}let n=(t?.items??[]).filter(e=>!$(e,r));o({id:t?.id,name:e,items:[...n,...u],parentId:t?.parentId})}let x=[...u.map(e=>g.find(t=>t.id===e)).filter(e=>!!e),...g.filter(e=>!u.includes(e.id))];return(0,W.jsxs)(F,{open:e,onClose:a,transition:!0,className:`relative z-110`,children:[(0,W.jsx)(I,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,W.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,W.jsxs)(N,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,W.jsx)(P,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:t?.id?R(`nav.editGroupTitle`):t?.parentId?R(`nav.addSubgroup`):R(`nav.createGroup`)}),(0,W.jsxs)(`label`,{className:`tw-confirm-msg mt-4 block text-xs font-medium text-stone-500`,children:[R(`nav.groupName`),(0,W.jsx)(`input`,{ref:m,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),b())},className:`mt-1.5 w-full h-9 rounded-lg border border-stone-200 px-3 text-sm text-stone-800 outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6]`})]}),(0,W.jsxs)(`div`,{className:`mt-4`,children:[(0,W.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:R(`nav.groupItems`)}),(0,W.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:R(`nav.groupItemsHint`)}),(0,W.jsxs)(`div`,{ref:_.listRef,className:`mt-2 max-h-52 overflow-auto rounded-lg border border-stone-200 p-1`,children:[x.map(e=>{let t=u.includes(e.id);return(0,W.jsxs)(`label`,{"data-sort-key":t?e.id:void 0,className:[`flex items-center gap-2 rounded-md px-3 py-2 text-sm text-stone-700 cursor-pointer hover:bg-stone-50`,t?`tw-nav-drag-row`:``,_.dragId===e.id?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t?t=>{t.target.closest(`input`)||_.onPointerDown(e.id,t)}:void 0,children:[t?(0,W.jsx)(De,{}):(0,W.jsx)(`span`,{className:`tw-nav-drag-grip`}),(0,W.jsx)(`input`,{type:`checkbox`,checked:t,onChange:()=>v(e.id),className:`rounded border-stone-300 text-[#4176e6] focus:ring-[#4176e6]/40`}),(0,W.jsx)(`span`,{className:`tw-nav-editor-ico`,children:(0,W.jsx)(Q,{id:e.id,icon:i[e.id]})}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:R(e.i18n)})]},e.id)}),x.length?null:(0,W.jsx)(`div`,{className:`px-3 py-4 text-center text-[12px] text-stone-400`,children:R(`nav.noAddableItems`)})]})]}),f?(0,W.jsx)(`p`,{className:`mt-2 text-[12px] text-red-600`,children:f}):null,(0,W.jsxs)(`div`,{className:`mt-5 flex items-center gap-2`,children:[t?.id&&s?(0,W.jsx)(`button`,{type:`button`,onClick:s,className:`h-8 px-3 text-sm rounded-lg border border-red-200 text-red-600 hover:bg-red-50`,children:R(`nav.deleteGroup`)}):null,(0,W.jsx)(`div`,{className:`flex-1`}),(0,W.jsx)(`button`,{type:`button`,onClick:a,className:`tw-confirm-cancel h-8 px-3 text-sm rounded-lg border border-stone-200 text-stone-600 hover:bg-stone-100`,children:R(`nav.groupCancel`)}),(0,W.jsx)(`button`,{type:`button`,onClick:b,className:`h-8 px-3 text-sm rounded-lg text-white bg-[#4176e6] hover:bg-[#3566d0]`,children:R(`nav.groupSave`)})]})]})})]})}function Ne({ids:e,labelOf:t,onChange:n,onEnd:r,indent:i}){let a=U(e,n,r);return(0,W.jsx)(`div`,{ref:a.listRef,className:`flex flex-col`,children:e.map(e=>(0,W.jsxs)(`div`,{"data-sort-key":e,className:[`tw-nav-drag-row px-3 py-2 text-sm text-stone-700 hover:bg-stone-50`,i?`tw-nav-drag-row--nested`:``,a.dragId===e?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t=>a.onPointerDown(e,t),children:[(0,W.jsx)(De,{}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t(e)})]},e))})}function Pe({open:e,focusGroupId:t,nodes:n,groups:r,order:i,visible:a,onClose:o,onCommit:s,onChildCommit:c}){let l=e=>!a||a(e),u=e=>e.items.some(l)||r.filter(t=>t.parentId===e.id).some(e=>u(e)),f=n.filter(e=>e.type===`item`?l(e.id):u(e.group)),[p,m]=(0,z.useState)(()=>f.map(X)),[h,g]=(0,z.useState)(()=>Object.fromEntries(r.map(e=>[e.id,[...e.items]]))),[v,y]=(0,z.useState)([]),b=(0,z.useRef)(p);b.current=p;let x=(0,z.useRef)(h);x.current=h;let S=(0,z.useRef)(r);S.current=r;let C=(0,z.useRef)(i);C.current=i;let w=(0,z.useRef)(f);w.current=f;let T=(0,z.useRef)(v);T.current=v;let E=()=>{let e=S.current.map(e=>({...e,items:x.current[e.id]??e.items}));s(b.current,e)},D=()=>{t&&c(t,T.current)};(0,z.useEffect)(()=>{if(!e)return;let n=w.current.map(X);b.current=n,m(n);let r=Object.fromEntries(S.current.map(e=>[e.id,[...e.items]]));x.current=r,g(r);let i=t?d(S.current,t,C.current).map(e=>e.id):[];T.current=i,y(i)},[e,t]);let ee=e=>{b.current=e,m(e)},O=e=>{T.current=e,y(e)},k=(e,t)=>{let n=(x.current[e]??[]).filter(e=>!l(e)),r={...x.current,[e]:t.length?[...t,...n]:n};x.current=r,g(r)},te=new Map(f.map(e=>[X(e),ge(e)])),A=t?r.find(e=>e.id===t):void 0,j=A?(h[A.id]??A.items).filter(l):[],ne=A?d(r,A.id,i):[],M=v.length?v:ne.map(e=>e.id);return(0,W.jsxs)(F,{open:e,onClose:o,transition:!0,className:`relative z-110`,children:[(0,W.jsx)(I,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,W.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,W.jsxs)(N,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,W.jsx)(P,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:R(`nav.sortMenuTitle`)}),(0,W.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:R(`nav.sortHint`)}),(0,W.jsx)(`div`,{className:`mt-4 max-h-80 overflow-auto rounded-lg border border-stone-200 p-1`,children:A?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Ne,{ids:j,labelOf:e=>R(_(e).i18n),onChange:e=>k(A.id,e),onEnd:E,indent:!0}),M.length?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`mt-1 border-t border-stone-100 px-3 pb-1 pt-2 text-[11px] font-medium text-stone-400`,children:R(`nav.subgroups`)}),(0,W.jsx)(Ne,{ids:M,labelOf:e=>{let t=r.find(t=>t.id===e);return t?Y(t):e},onChange:O,onEnd:D,indent:!0})]}):null]}):(0,W.jsx)(Ne,{ids:p,labelOf:e=>te.get(e)??e,onChange:ee,onEnd:E})})]})})]})}function Fe(e,t){let n=[];for(let r of e.filter(e=>!e.parentId)){n.push({group:r,indent:!1});for(let i of d(e,r.id,t))n.push({group:i,indent:!0})}return n}function Ie(){return(0,W.jsx)(`svg`,{className:`tw-nav-group-pop-arrow`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,W.jsx)(`path`,{d:`M7 5l5 5-5 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var Le=120;function Re(){let[e,t]=(0,z.useState)(null),n=(0,z.useRef)(null),r=(0,z.useCallback)(()=>{n.current!==null&&(window.clearTimeout(n.current),n.current=null)},[]),i=(0,z.useCallback)(e=>{r(),t({value:e,closing:!1})},[r]),a=(0,z.useCallback)(()=>{r(),t(e=>e&&!e.closing?{...e,closing:!0}:e),n.current=window.setTimeout(()=>{n.current=null,t(null)},Le)},[r]),o=(0,z.useCallback)(()=>{r(),t(null)},[r]);return(0,z.useEffect)(()=>r,[r]),{value:e?.value??null,closing:!!e?.closing,open:i,close:a,closeNow:o}}function ze(e,t){return{onMouseOver:()=>e?.(),onMouseOut:e=>{let n=e.relatedTarget;n&&e.currentTarget.contains(n)||t?.()}}}function Be({anchor:e,current:t,itemId:n,closing:r,onPick:i,onHoverEnter:a,onHoverLeave:o}){let s=(0,z.useRef)(null),[c,l]=(0,z.useState)({top:e.top,left:e.right+8});return(0,z.useEffect)(()=>{let t=s.current;if(!t)return;let n=t.offsetWidth,r=t.offsetHeight,i=e.right+8,a=e.top-6;i+n>window.innerWidth-8&&(i=Math.max(8,e.left-n-6)),a+r>window.innerHeight-8&&(a=Math.max(8,window.innerHeight-r-8)),a<8&&(a=8),l({top:a,left:i})},[e]),(0,B.createPortal)((0,W.jsxs)(`div`,{ref:s,className:[`tw-nav-group-pop`,`tw-nav-icon-pop`,r?`is-closing`:``].filter(Boolean).join(` `),style:{top:c.top,left:c.left},...ze(a,o),children:[(0,W.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:R(`nav.chooseIcon`)}),(0,W.jsx)(`div`,{className:`tw-nav-icon-grid`,children:v.map(e=>(0,W.jsx)(`button`,{type:`button`,className:[`tw-nav-icon-cell`,t===e?`is-current`:``].filter(Boolean).join(` `),onClick:()=>i(e),children:(0,W.jsx)(Q,{id:n,icon:e})},e))})]}),document.body)}function Ve({rect:e,closing:t=!1,onClose:n,onHoverEnter:r,onHoverLeave:i,children:a}){let o=(0,z.useRef)(null),[s,c]=(0,z.useState)({top:e.top,left:e.right+6});return(0,z.useEffect)(()=>{let t=o.current;if(!t)return;let n=t.offsetWidth,r=t.offsetHeight,i=e.right+6,a=e.top;i+n>window.innerWidth-8&&(i=Math.max(8,e.left-n-6)),a+r>window.innerHeight-8&&(a=Math.max(8,window.innerHeight-r-8)),c({top:a,left:i})},[e]),(0,z.useEffect)(()=>{let e=e=>{let t=e.target;o.current?.contains(t)||t?.closest?.(`.tw-nav-icon-pop`)||t?.closest?.(`.tw-nav-hover-btn`)||n()},t=e=>{e.key===`Escape`&&n()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t),window.removeEventListener(`resize`,n)}},[n]),(0,B.createPortal)((0,W.jsx)(`div`,{ref:o,className:[`tw-nav-group-pop`,t?`is-closing`:``].filter(Boolean).join(` `),style:{top:s.top,left:s.left},...ze(r,i),children:a}),document.body)}function He(){let e=_e(),[t,r]=(0,z.useState)(()=>ae()),[i,s]=(0,z.useState)(()=>oe()),[u,d]=(0,z.useState)(()=>ce()),[m,g]=(0,z.useState)(()=>A()),[v,y]=(0,z.useState)(null),[S,C]=(0,z.useState)(!1),[w,T]=(0,z.useState)(null),[E,D]=(0,z.useState)(!1),[O,k]=(0,z.useState)(null),j=Re(),M=Re(),N=j.value,P=M.value,F=(0,z.useRef)(null);(0,z.useEffect)(()=>()=>{F.current!==null&&window.clearTimeout(F.current)},[]);function I(e){k(e),D(!0)}function L(e){y(e),C(!0)}function B(){C(!1),T(null)}(0,z.useEffect)(()=>{let e=!0,t=ne(e=>{g({...e})});return b().then(async()=>{e&&(await de(),e&&(r(ae()),d(ce()),s(oe()),g(A())))}),()=>{e=!1,t()}},[]);let V=ee(t,u);(0,z.useEffect)(()=>{let e=window.setTimeout(()=>{let e=document.querySelector(`.tw-nav-libraries > astro-island`);e&&e.querySelector(`.tw-nav-item-main`)&&ie(`nav`,e.innerHTML)},400);return()=>window.clearTimeout(e)});function H(e,t){let n=le(e,t);r(n.groups),d(n.order),ue(n.groups).then(e=>{if(!e||JSON.stringify(e)===JSON.stringify(n.groups))return;let t=le(e,n.order);r(t.groups),d(t.order)})}function U(){G(),M.close(),j.close()}function G(){F.current!==null&&(window.clearTimeout(F.current),F.current=null)}function K(){G(),F.current=window.setTimeout(()=>{F.current=null,M.close()},220)}function q(e,t){G(),M.open({itemId:e,rect:t.getBoundingClientRect()})}function fe(e,t){N?.kind===`itemMenu`&&N.itemId===e?U():(M.closeNow(),j.open({kind:`itemMenu`,itemId:e,rect:t.getBoundingClientRect()}))}function pe(e,t){N?.kind===`groupMenu`&&N.group.id===e.id?U():(M.closeNow(),j.open({kind:`groupMenu`,group:e,rect:t.getBoundingClientRect()}))}function me(e,n){H(h(t,e,n),u),U()}function he(e){let{groups:n,owner:r}=a(t,e);H(n,r?x(u,e,r,n):u),U()}let J=N?.kind===`assign`||N?.kind===`itemMenu`?N.itemId:void 0,ge=N?.kind===`groupMenu`?N.group.id:void 0,X=N?.kind===`itemMenu`?N:null,Z=N?.kind===`groupMenu`?N:null,Q=N?.kind===`assign`?N:null,ve=X?t.find(e=>e.items.includes(X.itemId))??null:null;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`tw-nav-ready`,"aria-hidden":`true`}),V.map(n=>n.type===`item`?$(n.id,m)?(0,W.jsx)(Oe,{id:n.id,icon:i[n.id],pathname:e,actionOpen:J===n.id,onMenu:e=>fe(n.id,e)},n.id):null:(0,W.jsx)(je,{group:n.group,groups:t,order:u,icons:i,pathname:e,openItem:J,openGroupId:ge,onMenu:pe,onItemMenu:fe},n.group.id)),X?(0,W.jsxs)(Ve,{rect:X.rect,closing:j.closing,onClose:U,onHoverEnter:G,onHoverLeave:K,children:[(0,W.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:R(_(X.itemId).i18n)}),(0,W.jsxs)(`div`,{className:`tw-nav-group-pop-list`,onMouseOver:e=>{let t=e.target.closest(`.tw-nav-group-pop-item`);t&&t.getAttribute(`data-submenu`)!==`icons`&&(G(),M.close())},children:[ve?(0,W.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-leave`,onClick:()=>he(X.itemId),children:[(0,W.jsx)(we,{}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:R(`nav.leaveGroup`)})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>j.open({kind:`assign`,itemId:X.itemId,rect:X.rect}),children:[(0,W.jsx)(Ce,{}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:R(`nav.assignGroup`)})]}),(0,W.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=X.itemId;U(),L({name:``,items:[e]})},children:[(0,W.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,W.jsx)(xe,{})}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:R(`nav.addToGroup`)})]})]}),(0,W.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=ve?.id??null;U(),I(e)},children:[(0,W.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,W.jsx)(Ee,{})}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:R(`nav.sortMenu`)})]}),(0,W.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,"data-submenu":`icons`,onMouseEnter:e=>q(X.itemId,e.currentTarget),onClick:e=>q(X.itemId,e.currentTarget),children:[(0,W.jsx)(Te,{}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:R(`nav.chooseIcon`)}),(0,W.jsx)(Ie,{})]})]})]}):null,P&&X&&P.itemId===X.itemId?(0,W.jsx)(Be,{anchor:P.rect,itemId:P.itemId,current:i[P.itemId],closing:M.closing,onHoverEnter:G,onHoverLeave:K,onPick:e=>{s(se(P.itemId,e)),U()}}):null,Z?(0,W.jsxs)(Ve,{rect:Z.rect,closing:j.closing,onClose:U,children:[(0,W.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:Y(Z.group)}),(0,W.jsxs)(`div`,{className:`tw-nav-group-pop-list`,children:[Z.group.parentId?null:(0,W.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-create`,onClick:()=>{let e=Z.group.id;U(),L({name:``,items:[],parentId:e})},children:[(0,W.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,W.jsx)(xe,{})}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:R(`nav.addSubgroup`)})]}),(0,W.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Z.group;U(),I(e.parentId??null)},children:[(0,W.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,W.jsx)(Ee,{})}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:R(`nav.sortMenu`)})]}),(0,W.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Z.group;U(),L({id:e.id,name:e.name,items:[...e.items],parentId:e.parentId})},children:[(0,W.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,W.jsx)(be,{})}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:R(`nav.editGroupTitle`)})]})]})]}):null,Q?(0,W.jsxs)(Ve,{rect:Q.rect,closing:j.closing,onClose:U,children:[(0,W.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:R(`nav.assignGroup`)}),(0,W.jsx)(`div`,{className:`tw-nav-group-pop-list`,children:t.length?Fe(t,u).map(({group:e,indent:t})=>{let n=e.items.includes(Q.itemId);return(0,W.jsxs)(`button`,{type:`button`,className:[`tw-nav-group-pop-item`,n?`is-current`:``,t?`is-child`:``].filter(Boolean).join(` `),onClick:()=>{n||me(e.id,Q.itemId)},children:[(0,W.jsx)(Ce,{}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:Y(e)}),n?(0,W.jsx)(`span`,{className:`tw-nav-group-pop-tag`,children:R(`nav.currentGroup`)}):null]},e.id)}):(0,W.jsx)(`div`,{className:`tw-nav-group-pop-empty`,children:R(`nav.noGroups`)})})]}):null,(0,W.jsx)(Me,{open:S&&!w,draft:v,groups:t,plugins:m,icons:i,onClose:B,onSave:e=>{let n=f(t,e);H(n.groups,l(u,n.groups,n.id)),B()},onDelete:v?.id?()=>T(v.id):void 0}),(0,W.jsx)(Pe,{open:E,focusGroupId:O,nodes:V,groups:t,order:u,visible:e=>$(e,m),onClose:()=>D(!1),onCommit:(e,t)=>{let n=u.filter(e=>p(e,t));H(t,[...e,...n.filter(t=>!e.includes(t))])},onChildCommit:(e,r)=>H(t,n(u,t,e,r))}),(0,W.jsx)(re,{open:!!w,title:R(`nav.deleteGroup`),message:t.find(e=>e.id===w)?.parentId?R(`nav.deleteSubgroupMsg`):R(`nav.deleteGroupMsg`),confirmLabel:R(`nav.deleteGroup`),cancelLabel:R(`nav.groupCancel`),danger:`outline`,onClose:()=>T(null),onConfirm:()=>{if(w){let e=t.find(e=>e.id===w),n=te(t,w),r=o(t,w);H(r,e?c(u,e,r,n):u)}B()}})]})}export{He as default};
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{A as n,C as r,D as i,F as a,I as o,L as s,M as c,N as l,O as u,P as d,R as f,S as p,T as m,_ as h,a as g,b as _,g as v,h as y,i as b,j as x,k as S,m as C,p as w,r as T,t as E,u as D,v as ee,w as O,x as k,y as te}from"./app-config.Cq_F8I0l.js";import{a as A,i as j,o as ne}from"./plugins.CKkgnq4r.js";import{t as M}from"./react-dom.DLW9pGCF.js";import{i as N,n as P,r as F,t as I}from"./dialog.DZHZCe_T.js";import{t as L}from"./jsx-runtime.DUg_B_vD.js";import{t as re}from"./ConfirmDialog.CsMwWevK.js";import{n as R}from"./i18n.DPw-aTIZ.js";import{n as ie}from"./hydrate-cache.zljz1n5X.js";var z=e(t(),1),B=e(M(),1),V=`/__tb_nav/groups`;function ae(){return T().navGroups}function oe(){return u(T().navIcons)}function se(e,t){let n={...oe(),[e]:t};return D({navIcons:n}),E(),n}function ce(){return T().navOrder}function le(e,t){let n=i(e),r=S(t,n);return D({navGroups:n,navOrder:r}),E(),{groups:n,order:r}}function H(e,t){return JSON.stringify(e)===JSON.stringify(t)}async function ue(e){if(!g())return null;try{let t=await fetch(V,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({groups:e}),signal:AbortSignal.timeout(4e3)});if(!t.ok)return null;let n=await t.json();return i(n.groups,!1)}catch{return null}}async function de(){if(!g())return;let e=T(),t=null;try{let e=await fetch(V,{signal:AbortSignal.timeout(4e3)});e.ok&&(t=await e.json())}catch{return}if(!t)return;if(t.scanned){let n=i(t.groups,!1),r=S(e.navOrder,n);(!H(n,e.navGroups)||!H(r,e.navOrder))&&(D({navGroups:n,navOrder:r}),E());return}if(!e.navGroups.length)return;let n=await ue(e.navGroups);n&&!H(n,e.navGroups)&&(D({navGroups:n,navOrder:S(e.navOrder,n)}),E())}function U(e,t,n){let[r,i]=(0,z.useState)(null),a=(0,z.useRef)(null),o=(0,z.useRef)(e);o.current=e;let c=(0,z.useRef)(t);c.current=t;let l=(0,z.useRef)(n);l.current=n;function u(e,t){if(t.button!==0)return;t.preventDefault(),t.stopPropagation();let n=a.current;if(!n)return;i(e);let r=e=>{let t=[...n.querySelectorAll(`[data-sort-key]`)];for(let n of t){let t=n.getBoundingClientRect();if(e>=t.top&&e<=t.bottom)return n.dataset.sortKey}return null},u=t=>{let n=r(t.clientY);if(!n||n===e)return;let i=s(o.current,e,n);i.join(`|`)!==o.current.join(`|`)&&(o.current=i,c.current(i))},d=()=>{window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d),i(null),l.current?.()};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)}return{listRef:a,dragId:r,onPointerDown:u}}var W=L(),G=`/`;function K(e){return`${G.endsWith(`/`)?G:`${G}/`}${e.replace(/^\//,``)}`}function q(e,t){let n=G.replace(/\/$/,``),r=e.slice(n.length).replace(/^\/+/,``);return r===t||r.startsWith(`${t}/`)}function fe(e){return[`tw-nav-item`,e?`is-active font-medium`:``].filter(Boolean).join(` `)}function pe(e){return w(`tw.nav.groupOpen.${e}`)}function me(){return w(`tw.nav.docsOpen`)}function he(e,t){try{let t=localStorage.getItem(pe(e));if(t===`1`)return!0;if(t===`0`)return!1;if(e===`docs`){let e=localStorage.getItem(me());if(e===`1`)return!0;if(e===`0`)return!1}}catch{}return t}function J(e,t){try{localStorage.setItem(pe(e),t?`1`:`0`),e===`docs`&&localStorage.setItem(me(),t?`1`:`0`)}catch{}}function Y(e){return e.id===`docs`&&(e.name===`文档库`||e.name===`Documents`)?R(`nav.docs`):e.name}function ge(e){return e.type===`group`?Y(e.group):R(_(e.id).i18n)}function X(e){return e.type===`item`?O(e.id):k(e.group.id)}function _e(){let[e,t]=(0,z.useState)(()=>window.location.pathname);return(0,z.useEffect)(()=>{let e=()=>t(window.location.pathname);return document.addEventListener(`astro:page-load`,e),document.addEventListener(`astro:after-swap`,e),window.addEventListener(`popstate`,e),()=>{document.removeEventListener(`astro:page-load`,e),document.removeEventListener(`astro:after-swap`,e),window.removeEventListener(`popstate`,e)}},[]),e}function Z({children:e}){return(0,W.jsx)(`svg`,{className:`tw-nav-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:e})}function Q({id:e,icon:t}){return(0,W.jsx)(Z,{children:ve[t??C[e]]})}var ve={dashboard:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,W.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,W.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1.5`}),(0,W.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1.5`})]}),check:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M9 11l3 3L22 4`}),(0,W.jsx)(`path`,{d:`M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11`})]}),pencil:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M12 20h9`}),(0,W.jsx)(`path`,{d:`M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`})]}),book:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M4 19.5A2.5 2.5 0 0 1 6.5 17H20`}),(0,W.jsx)(`path`,{d:`M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z`})]}),fileText:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M14 3v5h5`}),(0,W.jsx)(`path`,{d:`M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z`}),(0,W.jsx)(`path`,{d:`M8 13h8`}),(0,W.jsx)(`path`,{d:`M8 17h6`})]}),layers:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M12 3 3 8l9 5 9-5-9-5z`}),(0,W.jsx)(`path`,{d:`m3 13 9 5 9-5`})]}),list:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M8 6h13`}),(0,W.jsx)(`path`,{d:`M8 12h13`}),(0,W.jsx)(`path`,{d:`M8 18h13`}),(0,W.jsx)(`path`,{d:`M3 6h.01`}),(0,W.jsx)(`path`,{d:`M3 12h.01`}),(0,W.jsx)(`path`,{d:`M3 18h.01`})]}),folder:(0,W.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`}),star:(0,W.jsx)(`path`,{d:`m12 3 2.1 5.9L20 11l-5 4.3 1.7 6.2-5.7-3.9-5.7 3.9L7 15.3 2 11l5.9-2.1L12 3z`}),database:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`ellipse`,{cx:`12`,cy:`6`,rx:`8`,ry:`3`}),(0,W.jsx)(`path`,{d:`M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6`}),(0,W.jsx)(`path`,{d:`M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]}),target:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`})]}),code:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`m8 8-4 4 4 4`}),(0,W.jsx)(`path`,{d:`m16 8 4 4-4 4`})]}),flask:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M9 3h6`}),(0,W.jsx)(`path`,{d:`M10 3v6l-5 8a2 2 0 0 0 1.7 3h10.6a2 2 0 0 0 1.7-3l-5-8V3`}),(0,W.jsx)(`path`,{d:`M7.5 14h9`})]}),home:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M3 10.5 12 3l9 7.5`}),(0,W.jsx)(`path`,{d:`M5 9.5V20h14V9.5`})]}),clipboard:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M9 4h6v3H9z`}),(0,W.jsx)(`path`,{d:`M8 4H6a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2`})]}),bug:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`14`,r:`5`}),(0,W.jsx)(`path`,{d:`M9 6l2 2`}),(0,W.jsx)(`path`,{d:`M15 6l-2 2`}),(0,W.jsx)(`path`,{d:`M7 11H4`}),(0,W.jsx)(`path`,{d:`M20 11h-3`}),(0,W.jsx)(`path`,{d:`M7 17H4`}),(0,W.jsx)(`path`,{d:`M20 17h-3`})]}),calendar:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`rect`,{x:`3`,y:`5`,width:`18`,height:`16`,rx:`2`}),(0,W.jsx)(`path`,{d:`M8 3v4`}),(0,W.jsx)(`path`,{d:`M16 3v4`}),(0,W.jsx)(`path`,{d:`M3 10h18`})]}),chart:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M4 20V10`}),(0,W.jsx)(`path`,{d:`M10 20V4`}),(0,W.jsx)(`path`,{d:`M16 20v-7`}),(0,W.jsx)(`path`,{d:`M2 20h20`})]}),globe:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,W.jsx)(`path`,{d:`M3 12h18`}),(0,W.jsx)(`path`,{d:`M12 3c2.5 2.5 4 5.7 4 9s-1.5 6.5-4 9c-2.5-2.5-4-5.7-4-9s1.5-6.5 4-9z`})]}),link:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M10 13a4 4 0 0 0 5.7 0l2.3-2.3a4 4 0 0 0-5.7-5.7L11 6.3`}),(0,W.jsx)(`path`,{d:`M14 11a4 4 0 0 0-5.7 0L6 13.3a4 4 0 0 0 5.7 5.7L13 17.7`})]}),users:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`circle`,{cx:`9`,cy:`8`,r:`3.5`}),(0,W.jsx)(`path`,{d:`M2.5 20a6.5 6.5 0 0 1 13 0`}),(0,W.jsx)(`path`,{d:`M16 5.5a3.5 3.5 0 0 1 0 7`}),(0,W.jsx)(`path`,{d:`M18 20a6 6 0 0 0-2-4.5`})]}),terminal:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`m5 8 4 4-4 4`}),(0,W.jsx)(`path`,{d:`M13 16h6`})]}),tag:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0l-7.2-7.2a2 2 0 0 1-.6-1.4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 1.4.6l6.2 6.2a2 2 0 0 1 0 2.6z`}),(0,W.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.2`})]}),flag:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M5 21V4`}),(0,W.jsx)(`path`,{d:`M5 5h11l-2 4 2 4H5z`})]}),zap:(0,W.jsx)(`path`,{d:`M13 2 4 14h6l-1 8 9-12h-6l1-8z`})};function ye(){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`svg`,{className:`tw-nav-ico tw-nav-ico--closed`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,W.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`})}),(0,W.jsx)(`svg`,{className:`tw-nav-ico tw-nav-ico--open`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,W.jsx)(`path`,{d:`M6 14l1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`})})]})}function be(){return(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,W.jsx)(`path`,{d:`M21 4H14`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M10 4H3`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M21 12H12`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M8 12H3`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M21 20H16`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M12 20H3`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M14 2v4`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M8 10v4`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M16 18v4`,strokeLinecap:`round`})]})}function xe(){return(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,W.jsx)(`path`,{d:`M12 8v8`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M8 12h8`,strokeLinecap:`round`})]})}function Se(){return(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,children:[(0,W.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.7`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.7`}),(0,W.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.7`})]})}function Ce(){return(0,W.jsx)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,W.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`})})}function we(){return(0,W.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,W.jsx)(`path`,{d:`M9 6H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h4`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M16 8l4 4-4 4`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M20 12H9`,strokeLinecap:`round`})]})}function Te(){return(0,W.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,W.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`4.5`}),(0,W.jsx)(`rect`,{x:`12`,y:`12`,width:`9`,height:`9`,rx:`2`})]})}function Ee(){return(0,W.jsxs)(Z,{children:[(0,W.jsx)(`path`,{d:`M8 6v12`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M5 9l3-3 3 3`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M16 18V6`,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M13 15l3 3 3-3`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}function De(){return(0,W.jsxs)(`svg`,{className:`tw-nav-drag-grip`,viewBox:`0 0 20 20`,"aria-hidden":!0,children:[(0,W.jsx)(`circle`,{cx:`7`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,W.jsx)(`circle`,{cx:`13`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,W.jsx)(`circle`,{cx:`7`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,W.jsx)(`circle`,{cx:`13`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,W.jsx)(`circle`,{cx:`7`,cy:`15`,r:`1.25`,fill:`currentColor`}),(0,W.jsx)(`circle`,{cx:`13`,cy:`15`,r:`1.25`,fill:`currentColor`})]})}function $(e,t){if(r(e))return!1;let n=_(e).plugin;return!n||t[n]!==!1}function Oe({id:e,icon:t,pathname:n,actionOpen:r,onMenu:i}){let a=_(e),o=q(n,a.match);return(0,W.jsxs)(`div`,{className:[fe(o),r?`is-action-open`:``].filter(Boolean).join(` `),"data-plugin-nav":a.plugin,children:[(0,W.jsxs)(`a`,{href:K(a.href),className:`tw-nav-item-main`,children:[(0,W.jsx)(Q,{id:e,icon:t}),(0,W.jsx)(`span`,{className:`tw-nav-label`,children:R(a.i18n)})]}),(0,W.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":R(`nav.more`),onClick:e=>{e.preventDefault(),e.stopPropagation(),i(e.currentTarget)},children:(0,W.jsx)(Se,{})})]})}function ke(e,t,n){return e.items.some(e=>{if(r(e))return!1;let t=_(e).plugin;return(!t||j(t))&&q(n,_(e).match)})?!0:m(t,e.id).some(e=>ke(e,t,n))}function Ae(e,t){return e.items.some(e=>{if(r(e))return!1;let t=_(e).plugin;return!t||j(t)})?!0:m(t,e.id).some(e=>Ae(e,t))}function je({group:e,groups:t,order:n,icons:i,pathname:a,openItem:o,openGroupId:s,onMenu:c,onItemMenu:l}){let u=e.items.filter(e=>{if(r(e))return!1;let t=_(e).plugin;return!t||j(t)}),f=d(t,e.id,n),p=ke(e,t,a),[m,h]=(0,z.useState)(()=>he(e.id,!0)),[g,v]=(0,z.useState)(!1),y=(0,z.useRef)(null),b=(0,z.useRef)(null),x=(0,z.useRef)(null);if((0,z.useEffect)(()=>S,[]),!Ae(e,t))return null;function S(){x.current&&y.current&&y.current.removeEventListener(`transitionend`,x.current),x.current=null,b.current!==null&&(window.clearTimeout(b.current),b.current=null)}function C(){S(),J(e.id,!0),v(!1),h(!0)}function w(t){if(t.preventDefault(),!m||g){C();return}v(!0),J(e.id,!1);let n=y.current,r=!1,i=()=>{r||(r=!0,S(),h(!1),v(!1))},a=e=>{e.target===n&&e.propertyName===`grid-template-rows`&&i()};S(),x.current=a,n?.addEventListener(`transitionend`,a),b.current=window.setTimeout(i,360)}return(0,W.jsxs)(`details`,{className:`tw-nav-details ${g?`is-closing`:``}`,open:m||g,"data-nav-group":e.id,children:[(0,W.jsxs)(`summary`,{className:[`tw-nav-item tw-nav-summary`,p?`is-branch-active`:``,s===e.id?`is-action-open`:``].filter(Boolean).join(` `),onClick:w,children:[(0,W.jsx)(ye,{}),(0,W.jsx)(`span`,{className:`tw-nav-label min-w-0 flex-1 truncate`,children:Y(e)}),(0,W.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":R(`nav.groupActions`),onClick:t=>{t.preventDefault(),t.stopPropagation(),c(e,t.currentTarget)},children:(0,W.jsx)(be,{})}),(0,W.jsx)(`svg`,{className:`tw-nav-chevron opacity-70`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,W.jsx)(`path`,{d:`M7 5l6 5-6 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})]}),(0,W.jsx)(`div`,{className:`tw-nav-subtree-anim`,ref:y,children:(0,W.jsxs)(`div`,{className:`tw-nav-subtree`,children:[u.map(e=>(0,W.jsx)(Oe,{id:e,icon:i[e],pathname:a,actionOpen:o===e,onMenu:t=>l(e,t)},e)),f.map(e=>(0,W.jsx)(je,{group:e,groups:t,order:n,icons:i,pathname:a,openItem:o,openGroupId:s,onMenu:c,onItemMenu:l},e.id))]})})]})}function Me({open:e,draft:t,groups:n,plugins:r,icons:i,onClose:a,onSave:o,onDelete:s}){let[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)([]),[f,p]=(0,z.useState)(``),m=(0,z.useRef)(null),h=new Set(n.filter(e=>e.id!==t?.id).flatMap(e=>e.items)),g=y.filter(e=>$(e.id,r)&&(!h.has(e.id)||u.includes(e.id))),_=U(u,d);(0,z.useEffect)(()=>{if(!e||!t)return;l(t.name),d(t.items.filter(e=>$(e,r))),p(``);let n=window.setTimeout(()=>{m.current?.focus(),m.current?.select()},50);return()=>window.clearTimeout(n)},[e,t,r]);function v(e){d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function b(){let e=c.trim();if(!e){p(R(`nav.groupNameRequired`));return}if(!u.length){p(R(`nav.groupItemsRequired`));return}let n=(t?.items??[]).filter(e=>!$(e,r));o({id:t?.id,name:e,items:[...n,...u],parentId:t?.parentId})}let x=[...u.map(e=>g.find(t=>t.id===e)).filter(e=>!!e),...g.filter(e=>!u.includes(e.id))];return(0,W.jsxs)(F,{open:e,onClose:a,transition:!0,className:`relative z-110`,children:[(0,W.jsx)(I,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,W.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,W.jsxs)(N,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,W.jsx)(P,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:t?.id?R(`nav.editGroupTitle`):t?.parentId?R(`nav.addSubgroup`):R(`nav.createGroup`)}),(0,W.jsxs)(`label`,{className:`tw-confirm-msg mt-4 block text-xs font-medium text-stone-500`,children:[R(`nav.groupName`),(0,W.jsx)(`input`,{ref:m,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),b())},className:`mt-1.5 w-full h-9 rounded-lg border border-stone-200 px-3 text-sm text-stone-800 outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6]`})]}),(0,W.jsxs)(`div`,{className:`mt-4`,children:[(0,W.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:R(`nav.groupItems`)}),(0,W.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:R(`nav.groupItemsHint`)}),(0,W.jsxs)(`div`,{ref:_.listRef,className:`mt-2 max-h-52 overflow-auto rounded-lg border border-stone-200 p-1`,children:[x.map(e=>{let t=u.includes(e.id);return(0,W.jsxs)(`label`,{"data-sort-key":t?e.id:void 0,className:[`flex items-center gap-2 rounded-md px-3 py-2 text-sm text-stone-700 cursor-pointer hover:bg-stone-50`,t?`tw-nav-drag-row`:``,_.dragId===e.id?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t?t=>{t.target.closest(`input`)||_.onPointerDown(e.id,t)}:void 0,children:[t?(0,W.jsx)(De,{}):(0,W.jsx)(`span`,{className:`tw-nav-drag-grip`}),(0,W.jsx)(`input`,{type:`checkbox`,checked:t,onChange:()=>v(e.id),className:`rounded border-stone-300 text-[#4176e6] focus:ring-[#4176e6]/40`}),(0,W.jsx)(`span`,{className:`tw-nav-editor-ico`,children:(0,W.jsx)(Q,{id:e.id,icon:i[e.id]})}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:R(e.i18n)})]},e.id)}),x.length?null:(0,W.jsx)(`div`,{className:`px-3 py-4 text-center text-[12px] text-stone-400`,children:R(`nav.noAddableItems`)})]})]}),f?(0,W.jsx)(`p`,{className:`mt-2 text-[12px] text-red-600`,children:f}):null,(0,W.jsxs)(`div`,{className:`mt-5 flex items-center gap-2`,children:[t?.id&&s?(0,W.jsx)(`button`,{type:`button`,onClick:s,className:`h-8 px-3 text-sm rounded-lg border border-red-200 text-red-600 hover:bg-red-50`,children:R(`nav.deleteGroup`)}):null,(0,W.jsx)(`div`,{className:`flex-1`}),(0,W.jsx)(`button`,{type:`button`,onClick:a,className:`tw-confirm-cancel h-8 px-3 text-sm rounded-lg border border-stone-200 text-stone-600 hover:bg-stone-100`,children:R(`nav.groupCancel`)}),(0,W.jsx)(`button`,{type:`button`,onClick:b,className:`h-8 px-3 text-sm rounded-lg text-white bg-[#4176e6] hover:bg-[#3566d0]`,children:R(`nav.groupSave`)})]})]})})]})}function Ne({ids:e,labelOf:t,onChange:n,onEnd:r,indent:i}){let a=U(e,n,r);return(0,W.jsx)(`div`,{ref:a.listRef,className:`flex flex-col`,children:e.map(e=>(0,W.jsxs)(`div`,{"data-sort-key":e,className:[`tw-nav-drag-row px-3 py-2 text-sm text-stone-700 hover:bg-stone-50`,i?`tw-nav-drag-row--nested`:``,a.dragId===e?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t=>a.onPointerDown(e,t),children:[(0,W.jsx)(De,{}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t(e)})]},e))})}function Pe({open:e,focusGroupId:t,nodes:n,groups:r,order:i,visible:a,onClose:o,onCommit:s,onChildCommit:c}){let l=e=>!a||a(e),u=e=>e.items.some(l)||r.filter(t=>t.parentId===e.id).some(e=>u(e)),f=n.filter(e=>e.type===`item`?l(e.id):u(e.group)),[p,m]=(0,z.useState)(()=>f.map(X)),[h,g]=(0,z.useState)(()=>Object.fromEntries(r.map(e=>[e.id,[...e.items]]))),[v,y]=(0,z.useState)([]),b=(0,z.useRef)(p);b.current=p;let x=(0,z.useRef)(h);x.current=h;let S=(0,z.useRef)(r);S.current=r;let C=(0,z.useRef)(i);C.current=i;let w=(0,z.useRef)(f);w.current=f;let T=(0,z.useRef)(v);T.current=v;let E=()=>{let e=S.current.map(e=>({...e,items:x.current[e.id]??e.items}));s(b.current,e)},D=()=>{t&&c(t,T.current)};(0,z.useEffect)(()=>{if(!e)return;let n=w.current.map(X);b.current=n,m(n);let r=Object.fromEntries(S.current.map(e=>[e.id,[...e.items]]));x.current=r,g(r);let i=t?d(S.current,t,C.current).map(e=>e.id):[];T.current=i,y(i)},[e,t]);let ee=e=>{b.current=e,m(e)},O=e=>{T.current=e,y(e)},k=(e,t)=>{let n=(x.current[e]??[]).filter(e=>!l(e)),r={...x.current,[e]:t.length?[...t,...n]:n};x.current=r,g(r)},te=new Map(f.map(e=>[X(e),ge(e)])),A=t?r.find(e=>e.id===t):void 0,j=A?(h[A.id]??A.items).filter(l):[],ne=A?d(r,A.id,i):[],M=v.length?v:ne.map(e=>e.id);return(0,W.jsxs)(F,{open:e,onClose:o,transition:!0,className:`relative z-110`,children:[(0,W.jsx)(I,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,W.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,W.jsxs)(N,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,W.jsx)(P,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:R(`nav.sortMenuTitle`)}),(0,W.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:R(`nav.sortHint`)}),(0,W.jsx)(`div`,{className:`mt-4 max-h-80 overflow-auto rounded-lg border border-stone-200 p-1`,children:A?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Ne,{ids:j,labelOf:e=>R(_(e).i18n),onChange:e=>k(A.id,e),onEnd:E,indent:!0}),M.length?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`mt-1 border-t border-stone-100 px-3 pb-1 pt-2 text-[11px] font-medium text-stone-400`,children:R(`nav.subgroups`)}),(0,W.jsx)(Ne,{ids:M,labelOf:e=>{let t=r.find(t=>t.id===e);return t?Y(t):e},onChange:O,onEnd:D,indent:!0})]}):null]}):(0,W.jsx)(Ne,{ids:p,labelOf:e=>te.get(e)??e,onChange:ee,onEnd:E})})]})})]})}function Fe(e,t){let n=[];for(let r of e.filter(e=>!e.parentId)){n.push({group:r,indent:!1});for(let i of d(e,r.id,t))n.push({group:i,indent:!0})}return n}function Ie(){return(0,W.jsx)(`svg`,{className:`tw-nav-group-pop-arrow`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,W.jsx)(`path`,{d:`M7 5l5 5-5 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var Le=120;function Re(){let[e,t]=(0,z.useState)(null),n=(0,z.useRef)(null),r=(0,z.useCallback)(()=>{n.current!==null&&(window.clearTimeout(n.current),n.current=null)},[]),i=(0,z.useCallback)(e=>{r(),t({value:e,closing:!1})},[r]),a=(0,z.useCallback)(()=>{r(),t(e=>e&&!e.closing?{...e,closing:!0}:e),n.current=window.setTimeout(()=>{n.current=null,t(null)},Le)},[r]),o=(0,z.useCallback)(()=>{r(),t(null)},[r]);return(0,z.useEffect)(()=>r,[r]),{value:e?.value??null,closing:!!e?.closing,open:i,close:a,closeNow:o}}function ze(e,t){return{onMouseOver:()=>e?.(),onMouseOut:e=>{let n=e.relatedTarget;n&&e.currentTarget.contains(n)||t?.()}}}function Be({anchor:e,current:t,itemId:n,closing:r,onPick:i,onHoverEnter:a,onHoverLeave:o}){let s=(0,z.useRef)(null),[c,l]=(0,z.useState)({top:e.top,left:e.right+8});return(0,z.useEffect)(()=>{let t=s.current;if(!t)return;let n=t.offsetWidth,r=t.offsetHeight,i=e.right+8,a=e.top-6;i+n>window.innerWidth-8&&(i=Math.max(8,e.left-n-6)),a+r>window.innerHeight-8&&(a=Math.max(8,window.innerHeight-r-8)),a<8&&(a=8),l({top:a,left:i})},[e]),(0,B.createPortal)((0,W.jsxs)(`div`,{ref:s,className:[`tw-nav-group-pop`,`tw-nav-icon-pop`,r?`is-closing`:``].filter(Boolean).join(` `),style:{top:c.top,left:c.left},...ze(a,o),children:[(0,W.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:R(`nav.chooseIcon`)}),(0,W.jsx)(`div`,{className:`tw-nav-icon-grid`,children:v.map(e=>(0,W.jsx)(`button`,{type:`button`,className:[`tw-nav-icon-cell`,t===e?`is-current`:``].filter(Boolean).join(` `),onClick:()=>i(e),children:(0,W.jsx)(Q,{id:n,icon:e})},e))})]}),document.body)}function Ve({rect:e,closing:t=!1,onClose:n,onHoverEnter:r,onHoverLeave:i,children:a}){let o=(0,z.useRef)(null),[s,c]=(0,z.useState)({top:e.top,left:e.right+6});return(0,z.useEffect)(()=>{let t=o.current;if(!t)return;let n=t.offsetWidth,r=t.offsetHeight,i=e.right+6,a=e.top;i+n>window.innerWidth-8&&(i=Math.max(8,e.left-n-6)),a+r>window.innerHeight-8&&(a=Math.max(8,window.innerHeight-r-8)),c({top:a,left:i})},[e]),(0,z.useEffect)(()=>{let e=e=>{let t=e.target;o.current?.contains(t)||t?.closest?.(`.tw-nav-icon-pop`)||t?.closest?.(`.tw-nav-hover-btn`)||n()},t=e=>{e.key===`Escape`&&n()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t),window.removeEventListener(`resize`,n)}},[n]),(0,B.createPortal)((0,W.jsx)(`div`,{ref:o,className:[`tw-nav-group-pop`,t?`is-closing`:``].filter(Boolean).join(` `),style:{top:s.top,left:s.left},...ze(r,i),children:a}),document.body)}function He(){let e=_e(),[t,r]=(0,z.useState)(()=>ae()),[i,s]=(0,z.useState)(()=>oe()),[u,d]=(0,z.useState)(()=>ce()),[m,g]=(0,z.useState)(()=>A()),[v,y]=(0,z.useState)(null),[S,C]=(0,z.useState)(!1),[w,T]=(0,z.useState)(null),[E,D]=(0,z.useState)(!1),[O,k]=(0,z.useState)(null),j=Re(),M=Re(),N=j.value,P=M.value,F=(0,z.useRef)(null);(0,z.useEffect)(()=>()=>{F.current!==null&&window.clearTimeout(F.current)},[]);function I(e){k(e),D(!0)}function L(e){y(e),C(!0)}function B(){C(!1),T(null)}(0,z.useEffect)(()=>{let e=!0,t=ne(e=>{g({...e})});return b().then(async()=>{e&&(await de(),e&&(r(ae()),d(ce()),s(oe()),g(A())))}),()=>{e=!1,t()}},[]);let V=ee(t,u);(0,z.useEffect)(()=>{let e=window.setTimeout(()=>{let e=document.querySelector(`.tw-nav-libraries > astro-island`);e&&e.querySelector(`.tw-nav-item-main`)&&ie(`nav`,e.innerHTML)},400);return()=>window.clearTimeout(e)});function H(e,t){let n=le(e,t);r(n.groups),d(n.order),ue(n.groups).then(e=>{if(!e||JSON.stringify(e)===JSON.stringify(n.groups))return;let t=le(e,n.order);r(t.groups),d(t.order)})}function U(){G(),M.close(),j.close()}function G(){F.current!==null&&(window.clearTimeout(F.current),F.current=null)}function K(){G(),F.current=window.setTimeout(()=>{F.current=null,M.close()},220)}function q(e,t){G(),M.open({itemId:e,rect:t.getBoundingClientRect()})}function fe(e,t){N?.kind===`itemMenu`&&N.itemId===e?U():(M.closeNow(),j.open({kind:`itemMenu`,itemId:e,rect:t.getBoundingClientRect()}))}function pe(e,t){N?.kind===`groupMenu`&&N.group.id===e.id?U():(M.closeNow(),j.open({kind:`groupMenu`,group:e,rect:t.getBoundingClientRect()}))}function me(e,n){H(h(t,e,n),u),U()}function he(e){let{groups:n,owner:r}=a(t,e);H(n,r?x(u,e,r,n):u),U()}let J=N?.kind===`assign`||N?.kind===`itemMenu`?N.itemId:void 0,ge=N?.kind===`groupMenu`?N.group.id:void 0,X=N?.kind===`itemMenu`?N:null,Z=N?.kind===`groupMenu`?N:null,Q=N?.kind===`assign`?N:null,ve=X?t.find(e=>e.items.includes(X.itemId))??null:null;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`tw-nav-ready`,"aria-hidden":`true`}),V.map(n=>n.type===`item`?$(n.id,m)?(0,W.jsx)(Oe,{id:n.id,icon:i[n.id],pathname:e,actionOpen:J===n.id,onMenu:e=>fe(n.id,e)},n.id):null:(0,W.jsx)(je,{group:n.group,groups:t,order:u,icons:i,pathname:e,openItem:J,openGroupId:ge,onMenu:pe,onItemMenu:fe},n.group.id)),X?(0,W.jsxs)(Ve,{rect:X.rect,closing:j.closing,onClose:U,onHoverEnter:G,onHoverLeave:K,children:[(0,W.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:R(_(X.itemId).i18n)}),(0,W.jsxs)(`div`,{className:`tw-nav-group-pop-list`,onMouseOver:e=>{let t=e.target.closest(`.tw-nav-group-pop-item`);t&&t.getAttribute(`data-submenu`)!==`icons`&&(G(),M.close())},children:[ve?(0,W.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-leave`,onClick:()=>he(X.itemId),children:[(0,W.jsx)(we,{}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:R(`nav.leaveGroup`)})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>j.open({kind:`assign`,itemId:X.itemId,rect:X.rect}),children:[(0,W.jsx)(Ce,{}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:R(`nav.assignGroup`)})]}),(0,W.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=X.itemId;U(),L({name:``,items:[e]})},children:[(0,W.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,W.jsx)(xe,{})}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:R(`nav.addToGroup`)})]})]}),(0,W.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=ve?.id??null;U(),I(e)},children:[(0,W.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,W.jsx)(Ee,{})}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:R(`nav.sortMenu`)})]}),(0,W.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,"data-submenu":`icons`,onMouseEnter:e=>q(X.itemId,e.currentTarget),onClick:e=>q(X.itemId,e.currentTarget),children:[(0,W.jsx)(Te,{}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:R(`nav.chooseIcon`)}),(0,W.jsx)(Ie,{})]})]})]}):null,P&&X&&P.itemId===X.itemId?(0,W.jsx)(Be,{anchor:P.rect,itemId:P.itemId,current:i[P.itemId],closing:M.closing,onHoverEnter:G,onHoverLeave:K,onPick:e=>{s(se(P.itemId,e)),U()}}):null,Z?(0,W.jsxs)(Ve,{rect:Z.rect,closing:j.closing,onClose:U,children:[(0,W.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:Y(Z.group)}),(0,W.jsxs)(`div`,{className:`tw-nav-group-pop-list`,children:[Z.group.parentId?null:(0,W.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-create`,onClick:()=>{let e=Z.group.id;U(),L({name:``,items:[],parentId:e})},children:[(0,W.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,W.jsx)(xe,{})}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:R(`nav.addSubgroup`)})]}),(0,W.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Z.group;U(),I(e.parentId??null)},children:[(0,W.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,W.jsx)(Ee,{})}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:R(`nav.sortMenu`)})]}),(0,W.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Z.group;U(),L({id:e.id,name:e.name,items:[...e.items],parentId:e.parentId})},children:[(0,W.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,W.jsx)(be,{})}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:R(`nav.editGroupTitle`)})]})]})]}):null,Q?(0,W.jsxs)(Ve,{rect:Q.rect,closing:j.closing,onClose:U,children:[(0,W.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:R(`nav.assignGroup`)}),(0,W.jsx)(`div`,{className:`tw-nav-group-pop-list`,children:t.length?Fe(t,u).map(({group:e,indent:t})=>{let n=e.items.includes(Q.itemId);return(0,W.jsxs)(`button`,{type:`button`,className:[`tw-nav-group-pop-item`,n?`is-current`:``,t?`is-child`:``].filter(Boolean).join(` `),onClick:()=>{n||me(e.id,Q.itemId)},children:[(0,W.jsx)(Ce,{}),(0,W.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:Y(e)}),n?(0,W.jsx)(`span`,{className:`tw-nav-group-pop-tag`,children:R(`nav.currentGroup`)}):null]},e.id)}):(0,W.jsx)(`div`,{className:`tw-nav-group-pop-empty`,children:R(`nav.noGroups`)})})]}):null,(0,W.jsx)(Me,{open:S&&!w,draft:v,groups:t,plugins:m,icons:i,onClose:B,onSave:e=>{let n=f(t,e);H(n.groups,l(u,n.groups,n.id)),B()},onDelete:v?.id?()=>T(v.id):void 0}),(0,W.jsx)(Pe,{open:E,focusGroupId:O,nodes:V,groups:t,order:u,visible:e=>$(e,m),onClose:()=>D(!1),onCommit:(e,t)=>{let n=u.filter(e=>p(e,t));H(t,[...e,...n.filter(t=>!e.includes(t))])},onChildCommit:(e,r)=>H(t,n(u,t,e,r))}),(0,W.jsx)(re,{open:!!w,title:R(`nav.deleteGroup`),message:t.find(e=>e.id===w)?.parentId?R(`nav.deleteSubgroupMsg`):R(`nav.deleteGroupMsg`),confirmLabel:R(`nav.deleteGroup`),cancelLabel:R(`nav.groupCancel`),danger:`outline`,onClose:()=>T(null),onConfirm:()=>{if(w){let e=t.find(e=>e.id===w),n=te(t,w),r=o(t,w);H(r,e?c(u,e,r,n):u)}B()}})]})}export{He as default};
|