From 163de1bb43a286faf33f849a1d684d125369ceb8 Mon Sep 17 00:00:00 2001 From: ppppp2005-p <360128433+ppppp2005-p@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:47:22 -0400 Subject: [PATCH 01/11] feat(ui-plugins): add Printable Calendar (printable-calendar) --- marketplace.json | 51 ++ pnpm-lock.yaml | 1490 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 1499 insertions(+), 42 deletions(-) diff --git a/marketplace.json b/marketplace.json index 32e8c8ef..d386c390 100644 --- a/marketplace.json +++ b/marketplace.json @@ -1673,6 +1673,57 @@ "把上一个 Hi3D 任务生成的模型按角色拆分成部件" ] } + }, + { + "name": "printable-calendar", + "componentTypes": [ + "ui" + ], + "source": "./external_plugins/printable-calendar", + "displayName": "Printable Calendar", + "displayName_i18n": { + "en": "Printable Calendar", + "zh-CN": "可打印日历" + }, + "description": "Print a calendar for the year with your holidays and events already written in. Get a monthly calendar with a page per month and big boxes to write in, and a year-at-a-glance page. Optionally pick a list of dates — holidays, make-up working days, birthdays, trips, deadlines — or type holidays straight into the settings. Choose the year and months, Monday or Sunday start, A4 or Letter, Chinese and English labels, week numbers and your colour. Runs locally; no design service or API keys.", + "description_i18n": { + "en": "Print a calendar for the year with your holidays and events already written in. Get a monthly calendar with a page per month and big boxes to write in, and a year-at-a-glance page. Optionally pick a list of dates — holidays, make-up working days, birthdays, trips, deadlines — or type holidays straight into the settings. Choose the year and months, Monday or Sunday start, A4 or Letter, Chinese and English labels, week numbers and your colour. Runs locally; no design service or API keys.", + "zh-CN": "打印一份已经写好节假日和你自己安排的日历。生成每月一页、格子够大可以手写的月历,以及一页看全年的年历。可以选一份日期清单——节假日、调休补班、生日、出差、截止日——也可以直接在设置里输入节假日。年份和月份、每周从周一还是周日开始、A4 或 Letter、中英文、周数和主题色都能选。在本地运行,不用设计服务,无需 API 密钥。" + }, + "version": "0.1.0", + "author": { + "name": "Penova", + "url": "https://github.com/ppppp2005-p" + }, + "license": "MIT", + "category": "productivity", + "keywords": [ + "calendar", + "printable calendar", + "monthly calendar", + "year calendar", + "planner", + "holidays", + "pdf", + "日历", + "月历", + "年历", + "台历", + "可打印", + "节假日" + ], + "examplePrompts": [ + "Make a 2027 calendar with events.csv titled 青禾 2027", + "Start weeks on Sunday, English labels, Letter paper", + "Add 2027-06-09 Dragon Boat holiday and show week numbers" + ], + "examplePrompts_i18n": { + "zh-CN": [ + "用 events.csv 做 2027 年日历,标题 青禾 2027", + "每周从周日开始,英文,Letter 纸", + "加上 2027-06-09 端午假期,显示周数" + ] + } } ] } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 14b35f76..6b5ff0fa 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -224,6 +224,46 @@ importers: ui-plugins/photocraft: {} + ui-plugins/printable-calendar: + dependencies: + '@modelcontextprotocol/sdk': + specifier: 1.29.0 + version: 1.29.0(zod@4.6.5) + exceljs: + specifier: 4.4.0 + version: 4.4.0 + fontkit: + specifier: 2.0.4 + version: 2.0.4 + pdf-lib: + specifier: 1.17.1 + version: 1.17.1 + zod: + specifier: ^4.6.5 + version: 4.6.5 + devDependencies: + '@modelcontextprotocol/core': + specifier: 2.0.0 + version: 2.0.0 + '@modelcontextprotocol/ext-apps': + specifier: 2.0.0 + version: 2.0.0(@modelcontextprotocol/client@2.2.0)(@modelcontextprotocol/core@2.0.0)(@modelcontextprotocol/server@2.0.0)(react-dom@19.2.7(react@19.2.7))(react@19.2.7)(zod@4.6.5) + '@types/node': + specifier: 25.5.0 + version: 25.5.0 + esbuild: + specifier: ^0.25.12 + version: 0.25.12 + playwright-core: + specifier: 1.59.1 + version: 1.59.1 + typescript: + specifier: 6.0.2 + version: 6.0.2 + vitest: + specifier: 4.1.4 + version: 4.1.4(@opentelemetry/api@1.9.1)(@types/node@25.5.0)(msw@2.13.3(@types/node@25.5.0)(typescript@6.0.2))(vite@8.3.1(@types/node@25.5.0)(esbuild@0.25.12)(jiti@2.6.1)(tsx@4.21.0)(yaml@2.9.0)) + ui-plugins/soundcraft: {} ui-plugins/typst-workbench: @@ -745,6 +785,12 @@ packages: resolution: {integrity: sha512-nULYsQxkWHnbmHvcs+efMkJ4/9TtvNyFeLyHdeGxW0zHs6P+jYVqcRff9A6Vq9w9JXeDRnRh2VKvTtS19GW2qA==} engines: {node: '>=10'} + '@fast-csv/format@4.3.5': + resolution: {integrity: sha512-8iRn6QF3I8Ak78lNAa+Gdl5MJJBM5vRHivFtMRUWINdevNo00K7OXxS2PshawLKTejVwieIlPmK5YlLu6w4u8A==} + + '@fast-csv/parse@4.3.6': + resolution: {integrity: sha512-uRsLYksqpbDmWaSmzvJcuApSEe38+6NQZBUsuAyMZKqHxH0g1wcJgsKUvN3WC8tewaqFjBMMGrkHmC+T7k8LvA==} + '@floating-ui/core@1.7.5': resolution: {integrity: sha512-1Ih4WTWyw0+lKyFMcBHGbb5U5FtuHJuujoyyr5zTaWS5EYMeT6Jb2AuDeftsCsEuchO+mM2ij5+q9crhydzLhQ==} @@ -1362,6 +1408,12 @@ packages: cpu: [x64] os: [win32] + '@pdf-lib/standard-fonts@1.0.0': + resolution: {integrity: sha512-hU30BK9IUN/su0Mn9VdlVKsWBS6GyhVfqjwl1FjZN4TxP6cCw0jP2w7V3Hf5uX7M0AZJ16vey9yE0ny7Sa59ZA==} + + '@pdf-lib/upng@1.0.1': + resolution: {integrity: sha512-dQK2FUMQtowVP00mtIksrlZhdFXQZPC+taih1q4CvPZ5vqdxR/LKBaFg0oAfzd1GlHZXXSPdQfzQnt+ViGvEIQ==} + '@radix-ui/primitive@1.0.0': resolution: {integrity: sha512-3e7rn8FDMin4CgeL7Z/49smCA3rFYY3Ha2rUQ7HRWFadS5iCRw08ZgVT1LaNTCNqgvrUiyczLflrVrF0SRQtNA==} @@ -1875,6 +1927,9 @@ packages: '@types/geojson@7946.0.16': resolution: {integrity: sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==} + '@types/node@14.18.63': + resolution: {integrity: sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ==} + '@types/node@22.20.4': resolution: {integrity: sha512-zJRE40jpHtKqE/C4fgHrAKQLJuSpzEnP9ff9Y7YtoR3Wd2pwqzlekDeEuUQXjRd+QCYnVnNwuJYmhdk9XV8gvA==} @@ -2018,36 +2073,109 @@ packages: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} + archiver-utils@2.1.0: + resolution: {integrity: sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==} + engines: {node: '>= 6'} + + archiver-utils@3.0.4: + resolution: {integrity: sha512-KVgf4XQVrTjhyWmx6cte4RxonPLR9onExufI1jhvw/MQ4BB6IsZD5gT8Lq+u/+pRkWna/6JoHpiQioaqFP5Rzw==} + engines: {node: '>= 10'} + + archiver@5.3.2: + resolution: {integrity: sha512-+25nxyyznAXF7Nef3y0EbBeqmGZgeN/BxHX29Rs39djAfaFalmQ89SE6CWyDCHzGL0yt/ycBtNOmGTW0FyGWNw==} + engines: {node: '>= 10'} + aria-hidden@1.2.6: resolution: {integrity: sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA==} engines: {node: '>=10'} + array-buffer-byte-length@1.0.2: + resolution: {integrity: sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==} + engines: {node: '>= 0.4'} + + arraybuffer.prototype.slice@1.0.4: + resolution: {integrity: sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==} + engines: {node: '>= 0.4'} + assertion-error@2.0.1: resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} engines: {node: '>=12'} + async-function@1.0.0: + resolution: {integrity: sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==} + engines: {node: '>= 0.4'} + + async@3.2.6: + resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==} + + available-typed-arrays@1.0.7: + resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} + engines: {node: '>= 0.4'} + + balanced-match@1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + base64-arraybuffer@1.0.2: resolution: {integrity: sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==} engines: {node: '>= 0.6.0'} + base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + + big-integer@1.6.52: + resolution: {integrity: sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==} + engines: {node: '>=0.6'} + binary-extensions@2.3.0: resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} engines: {node: '>=8'} + binary@0.3.0: + resolution: {integrity: sha512-D4H1y5KYwpJgK8wk1Cue5LLPgmwHKYSChkbspQg5JtVuR5ulGckxfR62H3AE9UDkdMC8yyXlqYihuz3Aqg2XZg==} + bind-event-listener@3.0.0: resolution: {integrity: sha512-PJvH288AWQhKs2v9zyfYdPzlPqf5bXbGMmhmUIY9x4dAUGIWgomO771oBQNwJnMQSnUIXhKu6sgzpBRXTlvb8Q==} + bl@4.1.0: + resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} + + bluebird@3.4.7: + resolution: {integrity: sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA==} + body-parser@2.2.2: resolution: {integrity: sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==} engines: {node: '>=18'} + brace-expansion@1.1.22: + resolution: {integrity: sha512-CKLDTuSsN0+r1ThM0WkzzBI7dnPI6xEGfa/JnVYIK9JNBA1N1NyPwXVHor//NKD/y3sDxp764sZdLhFK7pH8XQ==} + + brace-expansion@2.1.8: + resolution: {integrity: sha512-BnlDzDYQoplTsZSvPi86CNzmbcb07X8ufR8fk1zivaiEJlXJkiq1MQyDCVmlWcsWbj6aWXqHnrwwevbrm/Saig==} + braces@3.0.3: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} + brotli@1.3.3: + resolution: {integrity: sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg==} + browser-fs-access@0.29.1: resolution: {integrity: sha512-LSvVX5e21LRrXqVMhqtAwj5xPgDb+fXAIH80NsnCQ9xuZPs2xWsOREi24RKgZa1XOiQRbcmVrv87+ulOKsgjxw==} + buffer-crc32@0.2.13: + resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==} + + buffer-indexof-polyfill@1.0.2: + resolution: {integrity: sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A==} + engines: {node: '>=0.10'} + + buffer@5.7.1: + resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} + + buffers@0.1.1: + resolution: {integrity: sha512-9q/rDEGSb/Qsvv2qvzIzdluL5k7AaJOTrw23z9reQthrbF7is4CtlT0DXyO1oei2DCp4uojjzQ7igaSHp1kAEQ==} + engines: {node: '>=0.2.0'} + bun@1.3.11: resolution: {integrity: sha512-AvXWYFO6j/ZQ7bhGm4X6eilq2JHsDVC90ZM32k2B7/srhC2gs3Sdki1QTbwrdRCo8o7eT+167vcB1yzOvPdbjA==} cpu: [arm64, x64] @@ -2062,6 +2190,10 @@ packages: resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} engines: {node: '>= 0.4'} + call-bind@1.0.9: + resolution: {integrity: sha512-a/hy+pNsFUTR+Iz8TCJvXudKVLAnz/DyeSUo10I5yvFDQJBFU2s9uqQpoSrJlroHUKoKqzg+epxyP9lqFdzfBQ==} + engines: {node: '>= 0.4'} + call-bound@1.0.4: resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==} engines: {node: '>= 0.4'} @@ -2080,6 +2212,9 @@ packages: resolution: {integrity: sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==} engines: {node: '>=18'} + chainsaw@0.1.0: + resolution: {integrity: sha512-75kWfWt6MEKNC8xYXIdRpDehRYY/tNSgwKaJq+dbbDcxORuVrrQ+SEHoWsniVn9XPYfP4gmdWIeDk/4YNp1rNQ==} + chevrotain-allstar@0.3.1: resolution: {integrity: sha512-b7g+y9A0v4mxCW1qUhf3BSVPg+/NvGErk/dOkrDaHA0nQIQGAtrOjlX//9OQtRlSCy+x9rfB5N8yC71lH1nvMw==} peerDependencies: @@ -2109,6 +2244,10 @@ packages: resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} engines: {node: '>=12'} + clone@2.1.2: + resolution: {integrity: sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==} + engines: {node: '>=0.8'} + clsx@1.1.1: resolution: {integrity: sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA==} engines: {node: '>=6'} @@ -2136,6 +2275,13 @@ packages: resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==} engines: {node: '>= 12'} + compress-commons@4.1.2: + resolution: {integrity: sha512-D3uMHtGc/fcO1Gt1/L7i1e33VOvD4A9hfQLP+6ewd+BvG/gQ84Yh4oftEhAdjSMgBgwGL+jsppT7JYNpo6MHHg==} + engines: {node: '>= 10'} + + concat-map@0.0.1: + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + confbox@0.1.8: resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==} @@ -2182,6 +2328,15 @@ packages: resolution: {integrity: sha512-kucVIjOmMc1f0tv53BJ/5WIX+MGLcKuoBhnGqQrgKJNqLByb/sVMWfW/Aw6hw0jgcqjJ2pi9E5y32zOIpaUlsA==} engines: {node: '>=0.8'} + crc-32@1.2.2: + resolution: {integrity: sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==} + engines: {node: '>=0.8'} + hasBin: true + + crc32-stream@4.0.3: + resolution: {integrity: sha512-NT7w2JVU7DFroFdYkeq8cywxrgjPHWkdX1wjpRQXPX5Asews3tA+Ght6lddQO5Mkumffp3X7GEqku3epj2toIw==} + engines: {node: '>= 10'} + crelt@1.0.7: resolution: {integrity: sha512-aK6BbWfhf4U/wCcLHKPJl/xa6VkVstRaPywWtMKGwuOLc/wZTyQYuoxgvZnNsBvv7Kg3YTBQYYBCggcviQczuA==} @@ -2369,6 +2524,18 @@ packages: dagre-d3-es@7.0.14: resolution: {integrity: sha512-P4rFMVq9ESWqmOgK+dlXvOtLwYg0i7u0HBGJER0LZDJT2VHIPAMZ/riPxqJceWMStH5+E61QxFra9kIS3AqdMg==} + data-view-buffer@1.0.2: + resolution: {integrity: sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==} + engines: {node: '>= 0.4'} + + data-view-byte-length@1.0.2: + resolution: {integrity: sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==} + engines: {node: '>= 0.4'} + + data-view-byte-offset@1.0.1: + resolution: {integrity: sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==} + engines: {node: '>= 0.4'} + dayjs@1.11.20: resolution: {integrity: sha512-YbwwqR/uYpeoP4pu043q+LTDLFBLApUP6VxRihdfNTqu4ubqMlGDLd6ErXhEgsyvY0K6nCs7nggYumAN+9uEuQ==} @@ -2381,6 +2548,14 @@ packages: supports-color: optional: true + define-data-property@1.1.4: + resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} + engines: {node: '>= 0.4'} + + define-properties@1.2.1: + resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} + engines: {node: '>= 0.4'} + defu@6.1.7: resolution: {integrity: sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==} @@ -2401,6 +2576,9 @@ packages: detect-node-es@1.1.0: resolution: {integrity: sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==} + dfa@1.2.0: + resolution: {integrity: sha512-ED3jP8saaweFTjeGX8HQPjeC1YYyZs98jGNZx6IiBvxW7JG5v492kamAQB3m2wop07CvU/RQmzcKr6bgcC5D/Q==} + diff@8.0.4: resolution: {integrity: sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==} engines: {node: '>=0.3.1'} @@ -2412,6 +2590,9 @@ packages: resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} engines: {node: '>= 0.4'} + duplexer2@0.1.4: + resolution: {integrity: sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==} + ee-first@1.1.1: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} @@ -2422,10 +2603,21 @@ packages: resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==} engines: {node: '>= 0.8'} + end-of-stream@1.4.5: + resolution: {integrity: sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==} + entities@7.0.1: resolution: {integrity: sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==} engines: {node: '>=0.12'} + es-abstract-get@1.0.0: + resolution: {integrity: sha512-6PMWXpdhshVvFp+FoWYs1EvG1Nj0tvk0dZM+XcK0xMEM1czRVcP6ohqPWHy6qPagSpC8j4+p89WXlT+xXJs/fg==} + engines: {node: '>= 0.4'} + + es-abstract@1.24.2: + resolution: {integrity: sha512-2FpH9Q5i2RRwyEP1AylXe6nYLR5OhaJTZwmlcP0dL/+JCbgg7yyEo/sEK6HeGZRf3dFpWwThaRHVApXSkW3xeg==} + engines: {node: '>= 0.4'} + es-define-property@1.0.1: resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} engines: {node: '>= 0.4'} @@ -2441,6 +2633,18 @@ packages: resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==} engines: {node: '>= 0.4'} + es-object-atoms@1.1.2: + resolution: {integrity: sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==} + engines: {node: '>= 0.4'} + + es-set-tostringtag@2.1.0: + resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==} + engines: {node: '>= 0.4'} + + es-to-primitive@1.3.4: + resolution: {integrity: sha512-yPDz7wqpg1/mmHLmS3tcfTfbw5f1eryXvyghYBffGdERwe+mV7ZcWzTR8LR17Kvqt3qfPurjlonmnq3MKXIOXw==} + engines: {node: '>= 0.4'} + es-toolkit@1.46.1: resolution: {integrity: sha512-5eNtXOs3tbfxXOj04tjjseeWkRWaoCjdEI+96DgwzZoe6c9juL49pXlzAFTI72aWC9Y8p7168g6XIKjh7k6pyQ==} @@ -2475,10 +2679,6 @@ packages: resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} engines: {node: '>= 0.6'} - eventsource-parser@3.1.0: - resolution: {integrity: sha512-kJezFj9YFAMLeORyi7aCLxLbD5/qWMQnoMVlVPyHIll7lgRJCc3JVln9Vgl9nwQi0YkMnhdGTMNn7CkRRAptMg==} - engines: {node: '>=18.0.0'} - eventsource-parser@3.1.1: resolution: {integrity: sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ==} engines: {node: '>=18.0.0'} @@ -2487,6 +2687,10 @@ packages: resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==} engines: {node: '>=18.0.0'} + exceljs@4.4.0: + resolution: {integrity: sha512-XctvKaEMaj1Ii9oDOqbW/6e1gXknSY4g/aLCDicOXqBE4M0nRWkUu0PTp++UPNzoFY12BNHMfs/VadKIS6llvg==} + engines: {node: '>=8.3.0'} + expect-type@1.4.0: resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==} engines: {node: '>=12.0.0'} @@ -2504,6 +2708,10 @@ packages: resolution: {integrity: sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==} engines: {node: '>= 18'} + fast-csv@4.3.6: + resolution: {integrity: sha512-2RNSpuwwsJGP0frGsOmTb9oUF+VkFSM4SyLTDgwf2ciHWTarN0lQTC+F2f/t5J9QjW+c65VFIAAu85GsvMIusw==} + engines: {node: '>=10.0.0'} + fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} @@ -2536,9 +2744,16 @@ packages: font-family-papandreou@0.2.0-patch2: resolution: {integrity: sha512-l/YiRdBSH/eWv6OF3sLGkwErL+n0MqCICi9mppTZBOCL5vixWGDqCYvRcuxB2h7RGCTzaTKOHT2caHvCXQPRlw==} + fontkit@2.0.4: + resolution: {integrity: sha512-syetQadaUEDNdxdugga9CpEYVaQIxOwk7GlwZWWZ19//qW4zE5bknOKeMBDYAASwnpaSHKJITRLMF9m1fp3s6g==} + fontoxpath@3.34.0: resolution: {integrity: sha512-7FgBQRohn4WR/2eVdYqZtKBFZkJNaiP4kGdfqS6bAg465og05ixGA2OgfMdxsO1mnX67+64JX/8JKclVqS+bzA==} + for-each@0.3.5: + resolution: {integrity: sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==} + engines: {node: '>= 0.4'} + forwarded@0.2.0: resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} engines: {node: '>= 0.6'} @@ -2551,14 +2766,32 @@ packages: resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==} engines: {node: '>= 0.8'} + fs-constants@1.0.0: + resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==} + + fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] + fstream@1.0.12: + resolution: {integrity: sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==} + engines: {node: '>=0.6'} + deprecated: This package is no longer supported. + function-bind@1.1.2: resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + function.prototype.name@1.2.0: + resolution: {integrity: sha512-jObKIik1P2QjPHP5nz5BaOtUlfgS0fWo8IUByNXkM+o+02sJOi94em77GwJKQSJ3gfPHdgzLNrHc1uokV4P/ew==} + engines: {node: '>= 0.4'} + + functions-have-names@1.2.3: + resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} + fuzzy@0.1.3: resolution: {integrity: sha512-/gZffu4ykarLrCiP3Ygsa86UAo1E5vEVlvTrpkKywXSbP9Xhln3oSp9QSV57gEq3JFFpGJ4GZ+5zdEp3FcUh4w==} engines: {node: '>= 0.6.0'} @@ -2566,6 +2799,10 @@ packages: fzstd@0.1.1: resolution: {integrity: sha512-dkuVSOKKwh3eas5VkJy1AW1vFpet8TA/fGmVA5krThl8YcOVE/8ZIoEA1+U1vEn5ckxxhLirSdY837azmbaNHA==} + generator-function@2.0.1: + resolution: {integrity: sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==} + engines: {node: '>= 0.4'} + get-caller-file@2.0.5: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} engines: {node: 6.* || 8.* || >= 10.*} @@ -2582,6 +2819,10 @@ packages: resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} engines: {node: '>= 0.4'} + get-symbol-description@1.1.0: + resolution: {integrity: sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==} + engines: {node: '>= 0.4'} + get-tsconfig@4.13.7: resolution: {integrity: sha512-7tN6rFgBlMgpBML5j8typ92BKFi2sFQvIdpAqLA2beia5avZDrMs0FLZiM5etShWq5irVyGcGMEA1jcDaK7A/Q==} @@ -2589,6 +2830,14 @@ packages: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} + glob@7.2.3: + resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me + + globalthis@1.0.4: + resolution: {integrity: sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==} + engines: {node: '>= 0.4'} + glur@1.1.2: resolution: {integrity: sha512-l+8esYHTKOx2G/Aao4lEQ0bnHWg4fWtJbVoZZT9Knxi01pB8C80BR85nONLFwkkQoFRCmXY+BUcGZN3yZ2QsRA==} @@ -2596,6 +2845,9 @@ packages: resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} engines: {node: '>= 0.4'} + graceful-fs@4.2.12: + resolution: {integrity: sha512-iuyGF2E4oafQfPsRrG2wtY2ILupMhvtdrhzrxB+0VcjsPpSPttpfYdjnGFGsTi5MaJFjI1jOKHPQ6UTbTj9TAw==} + graphql@16.13.2: resolution: {integrity: sha512-5bJ+nf/UCpAjHM8i06fl7eLyVC9iuNAjm9qzkiu2ZGhM0VscSvS6WDPfAwkdkBuoXGM9FJSbKl6wylMwP9Ktig==} engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} @@ -2603,14 +2855,33 @@ packages: hachure-fill@0.5.2: resolution: {integrity: sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg==} + has-bigints@1.1.0: + resolution: {integrity: sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==} + engines: {node: '>= 0.4'} + + has-property-descriptors@1.0.2: + resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} + + has-proto@1.2.0: + resolution: {integrity: sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==} + engines: {node: '>= 0.4'} + has-symbols@1.1.0: resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} engines: {node: '>= 0.4'} + has-tostringtag@1.0.2: + resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} + engines: {node: '>= 0.4'} + hasown@2.0.2: resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} engines: {node: '>= 0.4'} + hasown@2.0.4: + resolution: {integrity: sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==} + engines: {node: '>= 0.4'} + headers-polyfill@4.0.3: resolution: {integrity: sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ==} @@ -2637,6 +2908,9 @@ packages: resolution: {integrity: sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==} engines: {node: '>=0.10.0'} + ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + image-blob-reduce@3.0.1: resolution: {integrity: sha512-/VmmWgIryG/wcn4TVrV7cC4mlfUC/oyiKIfSg5eVM3Ten/c1c34RJhMYKCWTnoSMHSqXLt3tsrBR4Q2HInvN+Q==} @@ -2654,9 +2928,17 @@ packages: immutable@4.3.9: resolution: {integrity: sha512-ObHy4YN7ycwZOUCLI1/6svfyAFu7vL8RhAvVu/bh/RZW9EPlOyDaQ9jDQWCtdqzaXUjgXZCW1migtHE7YI7UGQ==} + inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. + inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + internal-slot@1.1.0: + resolution: {integrity: sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==} + engines: {node: '>= 0.4'} + internmap@1.0.1: resolution: {integrity: sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==} @@ -2675,25 +2957,77 @@ packages: resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} engines: {node: '>= 0.10'} + is-array-buffer@3.0.5: + resolution: {integrity: sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==} + engines: {node: '>= 0.4'} + + is-async-function@2.1.1: + resolution: {integrity: sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==} + engines: {node: '>= 0.4'} + + is-bigint@1.1.0: + resolution: {integrity: sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==} + engines: {node: '>= 0.4'} + is-binary-path@2.1.0: resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} engines: {node: '>=8'} + is-boolean-object@1.2.2: + resolution: {integrity: sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==} + engines: {node: '>= 0.4'} + + is-callable@1.2.7: + resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} + engines: {node: '>= 0.4'} + + is-data-view@1.0.2: + resolution: {integrity: sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==} + engines: {node: '>= 0.4'} + + is-date-object@1.1.0: + resolution: {integrity: sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==} + engines: {node: '>= 0.4'} + + is-document.all@1.0.0: + resolution: {integrity: sha512-+XSoyS05OdBbhFuELhgTCpFNHkpBOJqtsZfUFFpe5QTw+9Sjbh8zitxhQkYAo6wV7e1Vb8cAPvpCk9jGam/82g==} + engines: {node: '>= 0.4'} + is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} + is-finalizationregistry@1.1.1: + resolution: {integrity: sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==} + engines: {node: '>= 0.4'} + is-fullwidth-code-point@3.0.0: resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} engines: {node: '>=8'} + is-generator-function@1.1.2: + resolution: {integrity: sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==} + engines: {node: '>= 0.4'} + is-glob@4.0.3: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} + is-map@2.0.3: + resolution: {integrity: sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==} + engines: {node: '>= 0.4'} + + is-negative-zero@2.0.3: + resolution: {integrity: sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==} + engines: {node: '>= 0.4'} + is-node-process@1.2.0: resolution: {integrity: sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==} + is-number-object@1.1.1: + resolution: {integrity: sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==} + engines: {node: '>= 0.4'} + is-number@7.0.0: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} @@ -2701,9 +3035,48 @@ packages: is-promise@4.0.0: resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==} + is-regex@1.2.1: + resolution: {integrity: sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==} + engines: {node: '>= 0.4'} + + is-set@2.0.3: + resolution: {integrity: sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==} + engines: {node: '>= 0.4'} + + is-shared-array-buffer@1.0.4: + resolution: {integrity: sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==} + engines: {node: '>= 0.4'} + + is-string@1.1.1: + resolution: {integrity: sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==} + engines: {node: '>= 0.4'} + + is-symbol@1.1.1: + resolution: {integrity: sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==} + engines: {node: '>= 0.4'} + + is-typed-array@1.1.15: + resolution: {integrity: sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==} + engines: {node: '>= 0.4'} + + is-weakmap@2.0.2: + resolution: {integrity: sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==} + engines: {node: '>= 0.4'} + + is-weakref@1.1.1: + resolution: {integrity: sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==} + engines: {node: '>= 0.4'} + + is-weakset@2.0.4: + resolution: {integrity: sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==} + engines: {node: '>= 0.4'} + isarray@1.0.0: resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} + isarray@2.0.5: + resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} + isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} @@ -2714,9 +3087,6 @@ packages: jose@6.2.12: resolution: {integrity: sha512-9NiFmJEex0sy2Dk58j2UGBSHgUs2ypF9eZSu4L6vjOX3Dp96Sw1F3uL+H+D1sx02jZZdzUT0HgvCy59CuvXcWw==} - jose@6.2.2: - resolution: {integrity: sha512-d7kPDd34KO/YnzaDOlikGpOurfF0ByC2sEV4cANCtdqLlTfBlw2p14O/5d/zv40gJPbIQxfES3nSx1/oYNyuZQ==} - jotai-scope@0.7.2: resolution: {integrity: sha512-Gwed97f3dDObrO43++2lRcgOqw4O2sdr4JCjP/7eHK1oPACDJ7xKHGScpJX9XaflU+KBHXF+VhwECnzcaQiShg==} peerDependencies: @@ -2775,6 +3145,10 @@ packages: layout-base@2.0.1: resolution: {integrity: sha512-dp3s92+uNI1hWIpPGH3jK2kxE2lMjdXdr+DH8ynZHpd6PUlH6x6cbuXnoMmiNumznqaNO31xu9e79F0uuZ0JFg==} + lazystream@1.0.1: + resolution: {integrity: sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==} + engines: {node: '>= 0.6.3'} + lie@3.3.0: resolution: {integrity: sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==} @@ -2855,6 +3229,9 @@ packages: lines-and-columns@1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + listenercount@1.0.1: + resolution: {integrity: sha512-3mk/Zag0+IJxeDrxSgaDPy4zZ3w05PRZeJNnlWhzFz5OkX49J4krc+A8X2d2M69vGMBEX0uyl8M+W+8gH+kBqQ==} + lodash-es@4.17.21: resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==} @@ -2864,9 +3241,49 @@ packages: lodash.debounce@4.0.8: resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==} + lodash.defaults@4.2.0: + resolution: {integrity: sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==} + + lodash.difference@4.5.0: + resolution: {integrity: sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==} + + lodash.escaperegexp@4.1.2: + resolution: {integrity: sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw==} + + lodash.flatten@4.4.0: + resolution: {integrity: sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==} + + lodash.groupby@4.6.0: + resolution: {integrity: sha512-5dcWxm23+VAoz+awKmBaiBvzox8+RqMgFhi7UvX9DHZr2HdxHXM/Wrf8cfKpsW37RNrvtPn6hSwNqurSILbmJw==} + + lodash.isboolean@3.0.3: + resolution: {integrity: sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==} + + lodash.isequal@4.5.0: + resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} + deprecated: This package is deprecated. Use require('node:util').isDeepStrictEqual instead. + + lodash.isfunction@3.0.9: + resolution: {integrity: sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw==} + + lodash.isnil@4.0.0: + resolution: {integrity: sha512-up2Mzq3545mwVnMhTDMdfoG1OurpA/s5t88JmQX809eH3C8491iu2sfKhTfhQtKY78oPNhiaHJUpT/dUDAAtng==} + + lodash.isplainobject@4.0.6: + resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==} + + lodash.isundefined@3.0.1: + resolution: {integrity: sha512-MXB1is3s899/cD8jheYYE2V9qTHwKvt+npCwpD+1Sxm3Q3cECXCiYHjeHWXNwr6Q0SOBPrYUDxendrO6goVTEA==} + lodash.throttle@4.1.1: resolution: {integrity: sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==} + lodash.union@4.6.0: + resolution: {integrity: sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw==} + + lodash.uniq@4.5.0: + resolution: {integrity: sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==} + magic-string@0.30.21: resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} @@ -2906,6 +3323,20 @@ packages: resolution: {integrity: sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==} engines: {node: '>=18'} + minimatch@3.1.5: + resolution: {integrity: sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==} + + minimatch@5.1.9: + resolution: {integrity: sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==} + engines: {node: '>=10'} + + minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + + mkdirp@0.5.6: + resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} + hasBin: true + mlly@1.8.2: resolution: {integrity: sha512-d+ObxMQFmbt10sretNDytwt85VrbkhhUA/JBGm1MPaWJ65Cl4wOgLaB1NYvJSZ0Ef03MMEU/0xpPMXUIQ29UfA==} @@ -2974,6 +3405,14 @@ packages: resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} engines: {node: '>= 0.4'} + object-keys@1.1.1: + resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} + engines: {node: '>= 0.4'} + + object.assign@4.1.7: + resolution: {integrity: sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==} + engines: {node: '>= 0.4'} + obug@2.2.1: resolution: {integrity: sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==} engines: {node: '>=12.20.0'} @@ -3001,6 +3440,10 @@ packages: outvariant@1.4.3: resolution: {integrity: sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA==} + own-keys@1.0.2: + resolution: {integrity: sha512-19YVAg7T+WTrxggPukVq7DjTv6+PJ867TmhCvBsYwmbFCsZd344rq2Ld1p0wo8f8Qrrhgp82c6FJRqdXWtSEhg==} + engines: {node: '>= 0.4'} + oxfmt@0.41.0: resolution: {integrity: sha512-sKLdJZdQ3bw6x9qKiT7+eID4MNEXlDHf5ZacfIircrq6Qwjk0L6t2/JQlZZrVHTXJawK3KaMuBoJnEJPcqCEdg==} engines: {node: ^20.19.0 || >=22.12.0} @@ -3019,6 +3462,9 @@ packages: package-manager-detector@1.6.0: resolution: {integrity: sha512-61A5ThoTiDG/C8s8UMZwSorAGwMJ0ERVGj2OjoW5pAalsNOg15+iQiPzrLJ4jhZ1HJzmC2PIHT2oEiH3R5fzNA==} + pako@0.2.9: + resolution: {integrity: sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==} + pako@1.0.11: resolution: {integrity: sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==} @@ -3035,6 +3481,10 @@ packages: path-data-parser@0.1.0: resolution: {integrity: sha512-NOnmBpt5Y2RWbuv0LMzsayp3lVylAHLPUTut412ZA3l+C4uw4ZVkQbjShYCQ8TCpUMdPapr4YjUqLYD6v68j+w==} + path-is-absolute@1.0.1: + resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} + engines: {node: '>=0.10.0'} + path-key@3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} @@ -3048,6 +3498,9 @@ packages: pathe@2.0.3: resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + pdf-lib@1.17.1: + resolution: {integrity: sha512-V/mpyJAoTsN4cnP31vc0wfNA1+p20evqqnap0KLoRUN0Yk/p3wN52DOEsL4oBFcLdb76hlpKPtzJIgo67j/XLw==} + pdfjs-dist@6.3.289: resolution: {integrity: sha512-ZHjSVpDa3D6izMq8/04lvkhkATUmL9px6ChPaXc1k6nU2Mrhlg1/7F0bdUqCwUjw3NsPTfPZsMDUU6ZIcRaeQw==} engines: {node: '>=22.13.0 || >=24'} @@ -3068,10 +3521,6 @@ packages: resolution: {integrity: sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==} engines: {node: '>=8.6'} - picomatch@4.0.4: - resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==} - engines: {node: '>=12'} - picomatch@4.0.7: resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==} engines: {node: '>=12'} @@ -3110,6 +3559,10 @@ packages: points-on-path@0.2.1: resolution: {integrity: sha512-25ClnWWuw7JbWZcgqY/gJ4FQWadKxGWk+3kR/7kD0tCaDtPPMj7oHu2ToLaVhfpnHrZzYby2w6tUA0eOIuUg8g==} + possible-typed-array-names@1.1.0: + resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==} + engines: {node: '>= 0.4'} + postcss@8.5.28: resolution: {integrity: sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==} engines: {node: ^10 || ^12 || >=14} @@ -3193,13 +3646,28 @@ packages: readable-stream@2.3.8: resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==} + readable-stream@3.6.2: + resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} + engines: {node: '>= 6'} + + readdir-glob@1.1.3: + resolution: {integrity: sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==} + readdirp@3.6.0: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} + reflect.getprototypeof@1.0.10: + resolution: {integrity: sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==} + engines: {node: '>= 0.4'} + regenerator-runtime@0.13.11: resolution: {integrity: sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==} + regexp.prototype.flags@1.5.4: + resolution: {integrity: sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==} + engines: {node: '>= 0.4'} + reka-ui@2.10.4: resolution: {integrity: sha512-kbS5GAbkHkYj0EVKAg5ZPEPndhBjeUFSa1Aq5m5ftQwyHnB1v5tw8X6fcwfKH/ry3StPXblMWM1DW82MVS71cw==} peerDependencies: @@ -3216,6 +3684,9 @@ packages: resolve-pkg-maps@1.0.0: resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + restructure@3.0.2: + resolution: {integrity: sha512-gSfoiOEA0VPE6Tukkrr7I0RBdE0s7H1eFCDBk05l1KIQT1UIKNc5JZy6jdyW6eYH3aR3g5b3PuL77rq0hvwtAw==} + rettime@0.11.7: resolution: {integrity: sha512-DoAm1WjR1eH7z8sHPtvvUMIZh4/CSKkGCz6CxPqOrEAnOGtOuHSnSE9OC+razqxKuf4ub7pAYyl/vZV0vGs5tg==} @@ -3223,6 +3694,11 @@ packages: resolution: {integrity: sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw==} engines: {node: '>= 0.8.15'} + rimraf@2.7.1: + resolution: {integrity: sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==} + deprecated: Rimraf versions prior to v4 are no longer supported + hasBin: true + robust-predicates@3.0.3: resolution: {integrity: sha512-NS3levdsRIUOmiJ8FZWCP7LG3QpJyrs/TE0Zpf1yvZu8cAJJ6QMW92H1c7kWpdIHo8RvmLxN/o2JXTKHp74lUA==} @@ -3244,9 +3720,21 @@ packages: rw@1.3.3: resolution: {integrity: sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==} + safe-array-concat@1.1.4: + resolution: {integrity: sha512-wtZlHyOje6OZTGqAoaDKxFkgRtkF9CnHAVnCHKfuj200wAgL+bSJhdsCD2l0Qx/2ekEXjPWcyKkfGb5CPboslg==} + engines: {node: '>=0.4'} + safe-buffer@5.1.2: resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} + safe-push-apply@1.0.0: + resolution: {integrity: sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==} + engines: {node: '>= 0.4'} + + safe-regex-test@1.1.0: + resolution: {integrity: sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==} + engines: {node: '>= 0.4'} + safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} @@ -3255,6 +3743,10 @@ packages: engines: {node: '>=12.0.0'} hasBin: true + saxes@5.0.1: + resolution: {integrity: sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw==} + engines: {node: '>=10'} + scheduler@0.27.0: resolution: {integrity: sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==} @@ -3266,6 +3758,18 @@ packages: resolution: {integrity: sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==} engines: {node: '>= 18'} + set-function-length@1.2.2: + resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} + engines: {node: '>= 0.4'} + + set-function-name@2.0.2: + resolution: {integrity: sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==} + engines: {node: '>= 0.4'} + + set-proto@1.0.0: + resolution: {integrity: sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==} + engines: {node: '>= 0.4'} + setimmediate@1.0.5: resolution: {integrity: sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==} @@ -3329,6 +3833,10 @@ packages: std-env@4.2.0: resolution: {integrity: sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw==} + stop-iteration-iterator@1.1.0: + resolution: {integrity: sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==} + engines: {node: '>= 0.4'} + strict-event-emitter@0.5.1: resolution: {integrity: sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==} @@ -3336,6 +3844,18 @@ packages: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} + string.prototype.trim@1.2.11: + resolution: {integrity: sha512-PwvK7BU+CMTJGYQCTZb5RWXIML92lftJLhQz1tBzgKiqGxJaMlBAa48POXaNAC2s4y8jr3EFqrkF9+44neS46w==} + engines: {node: '>= 0.4'} + + string.prototype.trimend@1.0.10: + resolution: {integrity: sha512-2+3aDAOmPTmuFwjDnmJG2ctEkQKVki7vOSqaxkv42Mowj1V6PnvuwFCRrR5lChUux1TBskPjfkeTOhqczDMxTw==} + engines: {node: '>= 0.4'} + + string.prototype.trimstart@1.0.8: + resolution: {integrity: sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==} + engines: {node: '>= 0.4'} + string_decoder@1.1.1: resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} @@ -3370,6 +3890,10 @@ packages: resolution: {integrity: sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng==} engines: {node: '>=20'} + tar-stream@2.2.0: + resolution: {integrity: sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==} + engines: {node: '>=6'} + text-segmentation@1.0.3: resolution: {integrity: sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==} @@ -3380,21 +3904,16 @@ packages: thenify@3.3.1: resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + tiny-inflate@1.0.3: + resolution: {integrity: sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==} + tinybench@2.9.0: resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} - tinyexec@1.1.1: - resolution: {integrity: sha512-VKS/ZaQhhkKFMANmAOhhXVoIfBXblQxGX1myCQ2faQrfmobMftXeJPcZGp0gS07ocvGJWDLZGyOZDadDBqYIJg==} - engines: {node: '>=18'} - tinyexec@1.3.1: resolution: {integrity: sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==} engines: {node: '>=18'} - tinyglobby@0.2.16: - resolution: {integrity: sha512-pn99VhoACYR8nFHhxqix+uvsbXineAasWm5ojXoN8xEwK5Kd3/TrhNn1wByuD52UxWRLy8pu+kRMniEi6Eq9Zg==} - engines: {node: '>=12.0.0'} - tinyglobby@0.2.17: resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} engines: {node: '>=12.0.0'} @@ -3414,6 +3933,10 @@ packages: resolution: {integrity: sha512-+Zg3vWhRUv8B1maGSTFdev9mjoo8Etn2Ayfs4cnjlD3CsGkxXX4QyW3j2WJ0wdjYcYmy7Lx2RDsZMhgCWafKIw==} hasBin: true + tmp@0.2.7: + resolution: {integrity: sha512-e0votIpp4Uo2AJYSzVHV6xCcawuiez3DzqDAbrTc3YxBkplN6e+dM13ZeIcZnDg/QpSuU2zfZ3rzwY8ukEnaXw==} + engines: {node: '>=14.14'} + to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} @@ -3426,13 +3949,20 @@ packages: resolution: {integrity: sha512-LktZQb3IeoUWB9lqR5EWTHgW/VTITCXg4D21M+lvybRVdylLrRMnqaIONLVb5mav8vM19m44HIcGq4qASeu2Qw==} engines: {node: '>=16'} - ts-dedent@2.2.0: + traverse@0.3.10: + resolution: {integrity: sha512-pd6fq5qmiFuPA3TpdqBCqJXlOrSdCSt0l9IZDg83Vbf4x3m/X18prEwMMVM5LXp9vGL9NxjeiDGBrTasqyngXQ==} + engines: {node: '>= 0.4'} + + ts-dedent@2.2.0: resolution: {integrity: sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ==} engines: {node: '>=6.10'} ts-interface-checker@0.1.13: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} + tslib@1.14.1: + resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} + tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} @@ -3455,6 +3985,26 @@ packages: resolution: {integrity: sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==} engines: {node: '>= 0.6'} + typed-array-buffer@1.0.3: + resolution: {integrity: sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==} + engines: {node: '>= 0.4'} + + typed-array-byte-length@1.0.3: + resolution: {integrity: sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==} + engines: {node: '>= 0.4'} + + typed-array-byte-offset@1.0.5: + resolution: {integrity: sha512-0FHJvLPqZ7KJzp17O13jfsAjsqazgrxBu2zEK95PmUz8lv2+GjRuxUInCr2Rk9Dms3ihN21zJ929ZO43yJ95QQ==} + engines: {node: '>= 0.4'} + + typed-array-length@1.0.8: + resolution: {integrity: sha512-phPGCwqr2+Qo0fwniCE8e4pKnGu/yFb5nD5Y8bf0EEeiI5GklnACYA9GFy/DrAeRrKHXvHn+1SUsOWgJp6RO+g==} + engines: {node: '>= 0.4'} + + typedarray.prototype.slice@1.0.6: + resolution: {integrity: sha512-r+7YvGfM5TkTiDQ5EqWi/Z4L4KP3jUI+YCmTtWg1tmTHUw6xladLJqzR2heMaHBIM0TTFLZmn/EkIaEHYs/bIA==} + engines: {node: '>= 0.4'} + typescript@6.0.2: resolution: {integrity: sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==} engines: {node: '>=14.17'} @@ -3463,6 +4013,10 @@ packages: ufo@1.6.3: resolution: {integrity: sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==} + unbox-primitive@1.1.0: + resolution: {integrity: sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==} + engines: {node: '>= 0.4'} + undici-types@6.21.0: resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} @@ -3473,6 +4027,12 @@ packages: resolution: {integrity: sha512-/y4/bH9YNU5hi9NIrpOuvGXFcxrj3CMrV+/AYpowAYTpHn8gX/XPFjNy766FPoYY0miQhdW977JFWKGNhBdwyQ==} engines: {node: '>=22.19.0'} + unicode-properties@1.4.1: + resolution: {integrity: sha512-CLjCCLQ6UuMxWnbIylkisbRj31qxHPAurvena/0iwSVbQ2G1VY5/HjV0IRabOEbDHlzZlRdCrD4NhB0JtU40Pg==} + + unicode-trie@2.0.0: + resolution: {integrity: sha512-x7bc76x0bm4prf1VLg79uhAzKw8DVboClSN5VxJuQ+LKDOVEW9CdH+VY7SP+vX7xCYQqzzgQpFqz15zeLvAtZQ==} + unifont@0.7.5: resolution: {integrity: sha512-ULe/Cs+ZIsq+dcFofNkhqielCrUJnb5mr+Yc4EBM2VlL+6OZR6+cjtI2mT1bJvRBrVncqHAbLURxmPLcCXzWMg==} @@ -3483,6 +4043,9 @@ packages: until-async@3.0.2: resolution: {integrity: sha512-IiSk4HlzAMqTUseHHe3VhIGyuFmN90zMTpD3Z3y8jeQbzLIq500MVM7Jq2vUAnTKAFPJrqwkzr6PoTcPhGcOiw==} + unzipper@0.10.14: + resolution: {integrity: sha512-ti4wZj+0bQTiX2KmKWuwj7lhV+2n//uXEotUmGuQqrbVZSEGFMbI68+c6JCQ8aAmUWYvtHEz2A8K6wXvueR/6g==} + use-callback-ref@1.3.3: resolution: {integrity: sha512-jQL3lRnocaFtu3V00JToYz/4QkNWswxijDaCVNZRiRTO3HQDLsdu1ZtmIUvV4yPp+rvWm5j0y0TG/S61cuijTg==} engines: {node: '>=10'} @@ -3518,6 +4081,11 @@ packages: resolution: {integrity: sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==} hasBin: true + uuid@8.3.2: + resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} + deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028). + hasBin: true + vary@1.1.2: resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} engines: {node: '>= 0.8'} @@ -3654,6 +4222,22 @@ packages: webworkify@1.5.0: resolution: {integrity: sha512-AMcUeyXAhbACL8S2hqqdqOLqvJ8ylmIbNwUIqQujRSouf4+eUFaXbG6F1Rbu+srlJMmxQWsiU7mOJi0nMBfM1g==} + which-boxed-primitive@1.1.1: + resolution: {integrity: sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==} + engines: {node: '>= 0.4'} + + which-builtin-type@1.2.1: + resolution: {integrity: sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==} + engines: {node: '>= 0.4'} + + which-collection@1.0.2: + resolution: {integrity: sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==} + engines: {node: '>= 0.4'} + + which-typed-array@1.1.24: + resolution: {integrity: sha512-wk4Mf4pR5mRP7eYuuTBCIQ9d0ud2Fv2jRLQpfgnRjbOxAFHmjKFValgTpitVKzJJS8ajnYQV2Du1SZ8j6b/EUQ==} + engines: {node: '>= 0.4'} + which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} @@ -3690,6 +4274,9 @@ packages: utf-8-validate: optional: true + xmlchars@2.2.0: + resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} + xspattern@3.1.0: resolution: {integrity: sha512-rxtOX8ORJizRqswIdZ72G3thKrHd0Q+TvyUCMByc5VdjDz1nkuZKfPXM3xGdrGi0fwEy+DDJN7DqtAZ06Re4bA==} @@ -3714,6 +4301,10 @@ packages: resolution: {integrity: sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw==} engines: {node: '>=18'} + zip-stream@4.1.1: + resolution: {integrity: sha512-9qv4rlDiopXg4E69k+vMHjNN63YFMe9sZMrdlvKnCjlCRWeCBswPPMPUfx+ipsAWq1LXHe70RcbaHdJJpS6hyQ==} + engines: {node: '>= 10'} + zod-to-json-schema@3.25.2: resolution: {integrity: sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==} peerDependencies: @@ -3742,7 +4333,7 @@ snapshots: '@antfu/install-pkg@1.1.0': dependencies: package-manager-detector: 1.6.0 - tinyexec: 1.1.1 + tinyexec: 1.3.1 '@atlaskit/pragmatic-drag-and-drop-hitbox@1.2.0': dependencies: @@ -4105,6 +4696,25 @@ snapshots: '@excalidraw/random-username@1.1.0': {} + '@fast-csv/format@4.3.5': + dependencies: + '@types/node': 14.18.63 + lodash.escaperegexp: 4.1.2 + lodash.isboolean: 3.0.3 + lodash.isequal: 4.5.0 + lodash.isfunction: 3.0.9 + lodash.isnil: 4.0.0 + + '@fast-csv/parse@4.3.6': + dependencies: + '@types/node': 14.18.63 + lodash.escaperegexp: 4.1.2 + lodash.groupby: 4.6.0 + lodash.isfunction: 3.0.9 + lodash.isnil: 4.0.0 + lodash.isundefined: 3.0.1 + lodash.uniq: 4.5.0 + '@floating-ui/core@1.7.5': dependencies: '@floating-ui/utils': 0.2.11 @@ -4285,11 +4895,11 @@ snapshots: cors: 2.8.6 cross-spawn: 7.0.6 eventsource: 3.0.7 - eventsource-parser: 3.1.0 + eventsource-parser: 3.1.1 express: 5.2.1 express-rate-limit: 8.3.2(express@5.2.1) hono: 4.12.12 - jose: 6.2.2 + jose: 6.2.12 json-schema-typed: 8.0.2 pkce-challenge: 5.0.1 raw-body: 3.0.2 @@ -4631,6 +5241,14 @@ snapshots: '@oxlint/binding-win32-x64-msvc@1.57.0': optional: true + '@pdf-lib/standard-fonts@1.0.0': + dependencies: + pako: 1.0.11 + + '@pdf-lib/upng@1.0.1': + dependencies: + pako: 1.0.11 + '@radix-ui/primitive@1.0.0': dependencies: '@babel/runtime': 7.29.7 @@ -5108,6 +5726,8 @@ snapshots: '@types/geojson@7946.0.16': {} + '@types/node@14.18.63': {} + '@types/node@22.20.4': dependencies: undici-types: 6.21.0 @@ -5288,19 +5908,97 @@ snapshots: normalize-path: 3.0.0 picomatch: 2.3.2 + archiver-utils@2.1.0: + dependencies: + glob: 7.2.3 + graceful-fs: 4.2.12 + lazystream: 1.0.1 + lodash.defaults: 4.2.0 + lodash.difference: 4.5.0 + lodash.flatten: 4.4.0 + lodash.isplainobject: 4.0.6 + lodash.union: 4.6.0 + normalize-path: 3.0.0 + readable-stream: 2.3.8 + + archiver-utils@3.0.4: + dependencies: + glob: 7.2.3 + graceful-fs: 4.2.12 + lazystream: 1.0.1 + lodash.defaults: 4.2.0 + lodash.difference: 4.5.0 + lodash.flatten: 4.4.0 + lodash.isplainobject: 4.0.6 + lodash.union: 4.6.0 + normalize-path: 3.0.0 + readable-stream: 3.6.2 + + archiver@5.3.2: + dependencies: + archiver-utils: 2.1.0 + async: 3.2.6 + buffer-crc32: 0.2.13 + readable-stream: 3.6.2 + readdir-glob: 1.1.3 + tar-stream: 2.2.0 + zip-stream: 4.1.1 + aria-hidden@1.2.6: dependencies: tslib: 2.8.1 + array-buffer-byte-length@1.0.2: + dependencies: + call-bound: 1.0.4 + is-array-buffer: 3.0.5 + + arraybuffer.prototype.slice@1.0.4: + dependencies: + array-buffer-byte-length: 1.0.2 + call-bind: 1.0.9 + define-properties: 1.2.1 + es-abstract: 1.24.2 + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + is-array-buffer: 3.0.5 + assertion-error@2.0.1: {} + async-function@1.0.0: {} + + async@3.2.6: {} + + available-typed-arrays@1.0.7: + dependencies: + possible-typed-array-names: 1.1.0 + + balanced-match@1.0.2: {} + base64-arraybuffer@1.0.2: optional: true + base64-js@1.5.1: {} + + big-integer@1.6.52: {} + binary-extensions@2.3.0: {} + binary@0.3.0: + dependencies: + buffers: 0.1.1 + chainsaw: 0.1.0 + bind-event-listener@3.0.0: {} + bl@4.1.0: + dependencies: + buffer: 5.7.1 + inherits: 2.0.4 + readable-stream: 3.6.2 + + bluebird@3.4.7: {} + body-parser@2.2.2: dependencies: bytes: 3.1.2 @@ -5315,12 +6013,36 @@ snapshots: transitivePeerDependencies: - supports-color + brace-expansion@1.1.22: + dependencies: + balanced-match: 1.0.2 + concat-map: 0.0.1 + + brace-expansion@2.1.8: + dependencies: + balanced-match: 1.0.2 + braces@3.0.3: dependencies: fill-range: 7.1.1 + brotli@1.3.3: + dependencies: + base64-js: 1.5.1 + browser-fs-access@0.29.1: {} + buffer-crc32@0.2.13: {} + + buffer-indexof-polyfill@1.0.2: {} + + buffer@5.7.1: + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + + buffers@0.1.1: {} + bun@1.3.11: optionalDependencies: '@oven/bun-darwin-aarch64': 1.3.11 @@ -5343,6 +6065,13 @@ snapshots: es-errors: 1.3.0 function-bind: 1.1.2 + call-bind@1.0.9: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.1 + get-intrinsic: 1.3.0 + set-function-length: 1.2.2 + call-bound@1.0.4: dependencies: call-bind-apply-helpers: 1.0.2 @@ -5368,6 +6097,10 @@ snapshots: chai@6.2.2: {} + chainsaw@0.1.0: + dependencies: + traverse: 0.3.10 + chevrotain-allstar@0.3.1(chevrotain@11.0.3): dependencies: chevrotain: 11.0.3 @@ -5417,6 +6150,8 @@ snapshots: wrap-ansi: 7.0.0 optional: true + clone@2.1.2: {} + clsx@1.1.1: {} color-convert@2.0.1: @@ -5435,6 +6170,15 @@ snapshots: commander@8.3.0: {} + compress-commons@4.1.2: + dependencies: + buffer-crc32: 0.2.13 + crc32-stream: 4.0.3 + normalize-path: 3.0.0 + readable-stream: 3.6.2 + + concat-map@0.0.1: {} + confbox@0.1.8: {} content-disposition@1.1.0: {} @@ -5470,6 +6214,13 @@ snapshots: crc-32@0.3.0: {} + crc-32@1.2.2: {} + + crc32-stream@4.0.3: + dependencies: + crc-32: 1.2.2 + readable-stream: 3.6.2 + crelt@1.0.7: {} cross-env@7.0.3: @@ -5682,12 +6433,42 @@ snapshots: d3: 7.9.0 lodash-es: 4.18.1 + data-view-buffer@1.0.2: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + is-data-view: 1.0.2 + + data-view-byte-length@1.0.2: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + is-data-view: 1.0.2 + + data-view-byte-offset@1.0.1: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + is-data-view: 1.0.2 + dayjs@1.11.20: {} debug@4.4.3: dependencies: ms: 2.1.3 + define-data-property@1.1.4: + dependencies: + es-define-property: 1.0.1 + es-errors: 1.3.0 + gopd: 1.2.0 + + define-properties@1.2.1: + dependencies: + define-data-property: 1.1.4 + has-property-descriptors: 1.0.2 + object-keys: 1.1.1 + defu@6.1.7: {} delaunator@5.1.0: @@ -5702,6 +6483,8 @@ snapshots: detect-node-es@1.1.0: {} + dfa@1.2.0: {} + diff@8.0.4: {} dompurify@3.3.3: @@ -5714,6 +6497,10 @@ snapshots: es-errors: 1.3.0 gopd: 1.2.0 + duplexer2@0.1.4: + dependencies: + readable-stream: 2.3.8 + ee-first@1.1.1: {} emoji-regex@8.0.0: @@ -5721,8 +6508,76 @@ snapshots: encodeurl@2.0.0: {} + end-of-stream@1.4.5: + dependencies: + once: 1.4.0 + entities@7.0.1: {} + es-abstract-get@1.0.0: + dependencies: + es-errors: 1.3.0 + es-object-atoms: 1.1.2 + is-callable: 1.2.7 + object-inspect: 1.13.4 + + es-abstract@1.24.2: + dependencies: + array-buffer-byte-length: 1.0.2 + arraybuffer.prototype.slice: 1.0.4 + available-typed-arrays: 1.0.7 + call-bind: 1.0.9 + call-bound: 1.0.4 + data-view-buffer: 1.0.2 + data-view-byte-length: 1.0.2 + data-view-byte-offset: 1.0.1 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.1 + es-set-tostringtag: 2.1.0 + es-to-primitive: 1.3.4 + function.prototype.name: 1.2.0 + get-intrinsic: 1.3.0 + get-proto: 1.0.1 + get-symbol-description: 1.1.0 + globalthis: 1.0.4 + gopd: 1.2.0 + has-property-descriptors: 1.0.2 + has-proto: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.2 + internal-slot: 1.1.0 + is-array-buffer: 3.0.5 + is-callable: 1.2.7 + is-data-view: 1.0.2 + is-negative-zero: 2.0.3 + is-regex: 1.2.1 + is-set: 2.0.3 + is-shared-array-buffer: 1.0.4 + is-string: 1.1.1 + is-typed-array: 1.1.15 + is-weakref: 1.1.1 + math-intrinsics: 1.1.0 + object-inspect: 1.13.4 + object-keys: 1.1.1 + object.assign: 4.1.7 + own-keys: 1.0.2 + regexp.prototype.flags: 1.5.4 + safe-array-concat: 1.1.4 + safe-push-apply: 1.0.0 + safe-regex-test: 1.1.0 + set-proto: 1.0.0 + stop-iteration-iterator: 1.1.0 + string.prototype.trim: 1.2.11 + string.prototype.trimend: 1.0.10 + string.prototype.trimstart: 1.0.8 + typed-array-buffer: 1.0.3 + typed-array-byte-length: 1.0.3 + typed-array-byte-offset: 1.0.5 + typed-array-length: 1.0.8 + unbox-primitive: 1.1.0 + which-typed-array: 1.1.24 + es-define-property@1.0.1: {} es-errors@1.3.0: {} @@ -5733,6 +6588,26 @@ snapshots: dependencies: es-errors: 1.3.0 + es-object-atoms@1.1.2: + dependencies: + es-errors: 1.3.0 + + es-set-tostringtag@2.1.0: + dependencies: + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + has-tostringtag: 1.0.2 + hasown: 2.0.2 + + es-to-primitive@1.3.4: + dependencies: + es-abstract-get: 1.0.0 + es-define-property: 1.0.1 + es-errors: 1.3.0 + is-callable: 1.2.7 + is-date-object: 1.1.0 + is-symbol: 1.1.1 + es-toolkit@1.46.1: {} es6-promise-pool@2.5.0: {} @@ -5809,13 +6684,23 @@ snapshots: etag@1.8.1: {} - eventsource-parser@3.1.0: {} - eventsource-parser@3.1.1: {} eventsource@3.0.7: dependencies: - eventsource-parser: 3.1.0 + eventsource-parser: 3.1.1 + + exceljs@4.4.0: + dependencies: + archiver: 5.3.2 + dayjs: 1.11.20 + fast-csv: 4.3.6 + jszip: 3.10.1 + readable-stream: 3.6.2 + saxes: 5.0.1 + tmp: 0.2.7 + unzipper: 0.10.14 + uuid: 8.3.2 expect-type@1.4.0: {} @@ -5859,6 +6744,11 @@ snapshots: transitivePeerDependencies: - supports-color + fast-csv@4.3.6: + dependencies: + '@fast-csv/format': 4.3.5 + '@fast-csv/parse': 4.3.6 + fast-deep-equal@3.1.3: {} fast-png@6.4.0: @@ -5869,10 +6759,6 @@ snapshots: fast-uri@3.1.0: {} - fdir@6.5.0(picomatch@4.0.4): - optionalDependencies: - picomatch: 4.0.4 - fdir@6.5.0(picomatch@4.0.7): optionalDependencies: picomatch: 4.0.7 @@ -5896,26 +6782,69 @@ snapshots: font-family-papandreou@0.2.0-patch2: {} + fontkit@2.0.4: + dependencies: + '@swc/helpers': 0.5.23 + brotli: 1.3.3 + clone: 2.1.2 + dfa: 1.2.0 + fast-deep-equal: 3.1.3 + restructure: 3.0.2 + tiny-inflate: 1.0.3 + unicode-properties: 1.4.1 + unicode-trie: 2.0.0 + fontoxpath@3.34.0: dependencies: prsc: 4.0.0 xspattern: 3.1.0 + for-each@0.3.5: + dependencies: + is-callable: 1.2.7 + forwarded@0.2.0: {} fractional-indexing@3.2.0: {} fresh@2.0.0: {} + fs-constants@1.0.0: {} + + fs.realpath@1.0.0: {} + fsevents@2.3.3: optional: true + fstream@1.0.12: + dependencies: + graceful-fs: 4.2.12 + inherits: 2.0.4 + mkdirp: 0.5.6 + rimraf: 2.7.1 + function-bind@1.1.2: {} + function.prototype.name@1.2.0: + dependencies: + call-bind: 1.0.9 + call-bound: 1.0.4 + es-define-property: 1.0.1 + es-errors: 1.3.0 + functions-have-names: 1.2.3 + has-property-descriptors: 1.0.2 + hasown: 2.0.4 + is-callable: 1.2.7 + is-document.all: 1.0.0 + + functions-have-names@1.2.3: {} + fuzzy@0.1.3: {} fzstd@0.1.1: {} + generator-function@2.0.1: {} + get-caller-file@2.0.5: optional: true @@ -5939,6 +6868,12 @@ snapshots: dunder-proto: 1.0.1 es-object-atoms: 1.1.1 + get-symbol-description@1.1.0: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + get-tsconfig@4.13.7: dependencies: resolve-pkg-maps: 1.0.0 @@ -5948,21 +6883,55 @@ snapshots: dependencies: is-glob: 4.0.3 + glob@7.2.3: + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.5 + once: 1.4.0 + path-is-absolute: 1.0.1 + + globalthis@1.0.4: + dependencies: + define-properties: 1.2.1 + gopd: 1.2.0 + glur@1.1.2: {} gopd@1.2.0: {} + graceful-fs@4.2.12: {} + graphql@16.13.2: optional: true hachure-fill@0.5.2: {} + has-bigints@1.1.0: {} + + has-property-descriptors@1.0.2: + dependencies: + es-define-property: 1.0.1 + + has-proto@1.2.0: + dependencies: + dunder-proto: 1.0.1 + has-symbols@1.1.0: {} + has-tostringtag@1.0.2: + dependencies: + has-symbols: 1.1.0 + hasown@2.0.2: dependencies: function-bind: 1.1.2 + hasown@2.0.4: + dependencies: + function-bind: 1.1.2 + headers-polyfill@4.0.3: optional: true @@ -5992,6 +6961,8 @@ snapshots: dependencies: safer-buffer: 2.1.2 + ieee754@1.2.1: {} + image-blob-reduce@3.0.1: dependencies: pica: 7.1.1 @@ -6007,8 +6978,19 @@ snapshots: immutable@4.3.9: {} + inflight@1.0.6: + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + inherits@2.0.4: {} + internal-slot@1.1.0: + dependencies: + es-errors: 1.3.0 + hasown: 2.0.2 + side-channel: 1.1.0 + internmap@1.0.1: {} internmap@2.0.3: {} @@ -6019,28 +7001,130 @@ snapshots: ipaddr.js@1.9.1: {} + is-array-buffer@3.0.5: + dependencies: + call-bind: 1.0.9 + call-bound: 1.0.4 + get-intrinsic: 1.3.0 + + is-async-function@2.1.1: + dependencies: + async-function: 1.0.0 + call-bound: 1.0.4 + get-proto: 1.0.1 + has-tostringtag: 1.0.2 + safe-regex-test: 1.1.0 + + is-bigint@1.1.0: + dependencies: + has-bigints: 1.1.0 + is-binary-path@2.1.0: dependencies: binary-extensions: 2.3.0 + is-boolean-object@1.2.2: + dependencies: + call-bound: 1.0.4 + has-tostringtag: 1.0.2 + + is-callable@1.2.7: {} + + is-data-view@1.0.2: + dependencies: + call-bound: 1.0.4 + get-intrinsic: 1.3.0 + is-typed-array: 1.1.15 + + is-date-object@1.1.0: + dependencies: + call-bound: 1.0.4 + has-tostringtag: 1.0.2 + + is-document.all@1.0.0: + dependencies: + call-bound: 1.0.4 + is-extglob@2.1.1: {} + is-finalizationregistry@1.1.1: + dependencies: + call-bound: 1.0.4 + is-fullwidth-code-point@3.0.0: optional: true + is-generator-function@1.1.2: + dependencies: + call-bound: 1.0.4 + generator-function: 2.0.1 + get-proto: 1.0.1 + has-tostringtag: 1.0.2 + safe-regex-test: 1.1.0 + is-glob@4.0.3: dependencies: is-extglob: 2.1.1 + is-map@2.0.3: {} + + is-negative-zero@2.0.3: {} + is-node-process@1.2.0: optional: true + is-number-object@1.1.1: + dependencies: + call-bound: 1.0.4 + has-tostringtag: 1.0.2 + is-number@7.0.0: {} is-promise@4.0.0: {} + is-regex@1.2.1: + dependencies: + call-bound: 1.0.4 + gopd: 1.2.0 + has-tostringtag: 1.0.2 + hasown: 2.0.2 + + is-set@2.0.3: {} + + is-shared-array-buffer@1.0.4: + dependencies: + call-bound: 1.0.4 + + is-string@1.1.1: + dependencies: + call-bound: 1.0.4 + has-tostringtag: 1.0.2 + + is-symbol@1.1.1: + dependencies: + call-bound: 1.0.4 + has-symbols: 1.1.0 + safe-regex-test: 1.1.0 + + is-typed-array@1.1.15: + dependencies: + which-typed-array: 1.1.24 + + is-weakmap@2.0.2: {} + + is-weakref@1.1.1: + dependencies: + call-bound: 1.0.4 + + is-weakset@2.0.4: + dependencies: + call-bound: 1.0.4 + get-intrinsic: 1.3.0 + isarray@1.0.0: {} + isarray@2.0.5: {} + isexe@2.0.0: {} jiti@2.6.1: @@ -6048,8 +7132,6 @@ snapshots: jose@6.2.12: {} - jose@6.2.2: {} - jotai-scope@0.7.2(jotai@2.11.0(@types/react@19.2.14)(react@19.2.7))(react@19.2.7): dependencies: jotai: 2.11.0(@types/react@19.2.14)(react@19.2.7) @@ -6115,6 +7197,10 @@ snapshots: layout-base@2.0.1: {} + lazystream@1.0.1: + dependencies: + readable-stream: 2.3.8 + lie@3.3.0: dependencies: immediate: 3.0.6 @@ -6170,14 +7256,42 @@ snapshots: lines-and-columns@1.2.4: {} + listenercount@1.0.1: {} + lodash-es@4.17.21: {} lodash-es@4.18.1: {} lodash.debounce@4.0.8: {} + lodash.defaults@4.2.0: {} + + lodash.difference@4.5.0: {} + + lodash.escaperegexp@4.1.2: {} + + lodash.flatten@4.4.0: {} + + lodash.groupby@4.6.0: {} + + lodash.isboolean@3.0.3: {} + + lodash.isequal@4.5.0: {} + + lodash.isfunction@3.0.9: {} + + lodash.isnil@4.0.0: {} + + lodash.isplainobject@4.0.6: {} + + lodash.isundefined@3.0.1: {} + lodash.throttle@4.1.1: {} + lodash.union@4.6.0: {} + + lodash.uniq@4.5.0: {} + magic-string@0.30.21: dependencies: '@jridgewell/sourcemap-codec': 1.5.5 @@ -6224,6 +7338,20 @@ snapshots: dependencies: mime-db: 1.54.0 + minimatch@3.1.5: + dependencies: + brace-expansion: 1.1.22 + + minimatch@5.1.9: + dependencies: + brace-expansion: 2.1.8 + + minimist@1.2.8: {} + + mkdirp@0.5.6: + dependencies: + minimist: 1.2.8 + mlly@1.8.2: dependencies: acorn: 8.16.0 @@ -6293,6 +7421,17 @@ snapshots: object-inspect@1.13.4: {} + object-keys@1.1.1: {} + + object.assign@4.1.7: + dependencies: + call-bind: 1.0.9 + call-bound: 1.0.4 + define-properties: 1.2.1 + es-object-atoms: 1.1.1 + has-symbols: 1.1.0 + object-keys: 1.1.1 + obug@2.2.1: {} ofetch@1.5.1: @@ -6318,6 +7457,13 @@ snapshots: outvariant@1.4.3: optional: true + own-keys@1.0.2: + dependencies: + call-bound: 1.0.4 + get-intrinsic: 1.3.0 + object-keys: 1.1.1 + safe-push-apply: 1.0.0 + oxfmt@0.41.0: dependencies: tinypool: 2.1.0 @@ -6366,6 +7512,8 @@ snapshots: package-manager-detector@1.6.0: {} + pako@0.2.9: {} + pako@1.0.11: {} pako@2.0.3: {} @@ -6376,6 +7524,8 @@ snapshots: path-data-parser@0.1.0: {} + path-is-absolute@1.0.1: {} + path-key@3.1.1: {} path-to-regexp@6.3.0: @@ -6385,6 +7535,13 @@ snapshots: pathe@2.0.3: {} + pdf-lib@1.17.1: + dependencies: + '@pdf-lib/standard-fonts': 1.0.0 + '@pdf-lib/upng': 1.0.1 + pako: 1.0.11 + tslib: 1.14.1 + pdfjs-dist@6.3.289: optionalDependencies: '@napi-rs/canvas': 1.0.11 @@ -6406,8 +7563,6 @@ snapshots: picomatch@2.3.2: {} - picomatch@4.0.4: {} - picomatch@4.0.7: {} pirates@4.0.7: {} @@ -6442,6 +7597,8 @@ snapshots: path-data-parser: 0.1.0 points-on-curve: 0.2.0 + possible-typed-array-names@1.1.0: {} + postcss@8.5.28: dependencies: nanoid: 3.3.19 @@ -6534,13 +7691,43 @@ snapshots: string_decoder: 1.1.1 util-deprecate: 1.0.2 + readable-stream@3.6.2: + dependencies: + inherits: 2.0.4 + string_decoder: 1.1.1 + util-deprecate: 1.0.2 + + readdir-glob@1.1.3: + dependencies: + minimatch: 5.1.9 + readdirp@3.6.0: dependencies: picomatch: 2.3.2 + reflect.getprototypeof@1.0.10: + dependencies: + call-bind: 1.0.9 + define-properties: 1.2.1 + es-abstract: 1.24.2 + es-errors: 1.3.0 + es-object-atoms: 1.1.1 + get-intrinsic: 1.3.0 + get-proto: 1.0.1 + which-builtin-type: 1.2.1 + regenerator-runtime@0.13.11: optional: true + regexp.prototype.flags@1.5.4: + dependencies: + call-bind: 1.0.9 + define-properties: 1.2.1 + es-errors: 1.3.0 + get-proto: 1.0.1 + gopd: 1.2.0 + set-function-name: 2.0.2 + reka-ui@2.10.4(vue@3.5.42(typescript@6.0.2)): dependencies: '@floating-ui/dom': 1.7.6 @@ -6565,12 +7752,18 @@ snapshots: resolve-pkg-maps@1.0.0: optional: true + restructure@3.0.2: {} + rettime@0.11.7: optional: true rgbcolor@1.0.1: optional: true + rimraf@2.7.1: + dependencies: + glob: 7.2.3 + robust-predicates@3.0.3: {} rolldown@1.2.11: @@ -6620,8 +7813,27 @@ snapshots: rw@1.3.3: {} + safe-array-concat@1.1.4: + dependencies: + call-bind: 1.0.9 + call-bound: 1.0.4 + get-intrinsic: 1.3.0 + has-symbols: 1.1.0 + isarray: 2.0.5 + safe-buffer@5.1.2: {} + safe-push-apply@1.0.0: + dependencies: + es-errors: 1.3.0 + isarray: 2.0.5 + + safe-regex-test@1.1.0: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + is-regex: 1.2.1 + safer-buffer@2.1.2: {} sass@1.51.0: @@ -6630,6 +7842,10 @@ snapshots: immutable: 4.3.9 source-map-js: 1.2.1 + saxes@5.0.1: + dependencies: + xmlchars: 2.2.0 + scheduler@0.27.0: {} send@1.2.1: @@ -6657,6 +7873,28 @@ snapshots: transitivePeerDependencies: - supports-color + set-function-length@1.2.2: + dependencies: + define-data-property: 1.1.4 + es-errors: 1.3.0 + function-bind: 1.1.2 + get-intrinsic: 1.3.0 + gopd: 1.2.0 + has-property-descriptors: 1.0.2 + + set-function-name@2.0.2: + dependencies: + define-data-property: 1.1.4 + es-errors: 1.3.0 + functions-have-names: 1.2.3 + has-property-descriptors: 1.0.2 + + set-proto@1.0.0: + dependencies: + dunder-proto: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.1 + setimmediate@1.0.5: {} setprototypeof@1.2.0: {} @@ -6715,6 +7953,11 @@ snapshots: std-env@4.2.0: {} + stop-iteration-iterator@1.1.0: + dependencies: + es-errors: 1.3.0 + internal-slot: 1.1.0 + strict-event-emitter@0.5.1: optional: true @@ -6725,6 +7968,30 @@ snapshots: strip-ansi: 6.0.1 optional: true + string.prototype.trim@1.2.11: + dependencies: + call-bind: 1.0.9 + call-bound: 1.0.4 + define-data-property: 1.1.4 + define-properties: 1.2.1 + es-abstract: 1.24.2 + es-object-atoms: 1.1.2 + has-property-descriptors: 1.0.2 + safe-regex-test: 1.1.0 + + string.prototype.trimend@1.0.10: + dependencies: + call-bind: 1.0.9 + call-bound: 1.0.4 + define-properties: 1.2.1 + es-object-atoms: 1.1.2 + + string.prototype.trimstart@1.0.8: + dependencies: + call-bind: 1.0.9 + define-properties: 1.2.1 + es-object-atoms: 1.1.1 + string_decoder@1.1.1: dependencies: safe-buffer: 5.1.2 @@ -6745,7 +8012,7 @@ snapshots: lines-and-columns: 1.2.4 mz: 2.7.0 pirates: 4.0.7 - tinyglobby: 0.2.16 + tinyglobby: 0.2.17 ts-interface-checker: 0.1.13 svg-pathdata@6.0.3: @@ -6764,6 +8031,14 @@ snapshots: tagged-tag@1.0.0: optional: true + tar-stream@2.2.0: + dependencies: + bl: 4.1.0 + end-of-stream: 1.4.5 + fs-constants: 1.0.0 + inherits: 2.0.4 + readable-stream: 3.6.2 + text-segmentation@1.0.3: dependencies: utrie: 1.0.2 @@ -6777,17 +8052,12 @@ snapshots: dependencies: any-promise: 1.3.0 - tinybench@2.9.0: {} + tiny-inflate@1.0.3: {} - tinyexec@1.1.1: {} + tinybench@2.9.0: {} tinyexec@1.3.1: {} - tinyglobby@0.2.16: - dependencies: - fdir: 6.5.0(picomatch@4.0.4) - picomatch: 4.0.4 - tinyglobby@0.2.17: dependencies: fdir: 6.5.0(picomatch@4.0.7) @@ -6805,6 +8075,8 @@ snapshots: tldts-core: 7.0.28 optional: true + tmp@0.2.7: {} + to-regex-range@5.0.1: dependencies: is-number: 7.0.0 @@ -6816,10 +8088,20 @@ snapshots: tldts: 7.0.28 optional: true + traverse@0.3.10: + dependencies: + define-data-property: 1.1.4 + es-to-primitive: 1.3.4 + gopd: 1.2.0 + typedarray.prototype.slice: 1.0.6 + which-typed-array: 1.1.24 + ts-dedent@2.2.0: {} ts-interface-checker@0.1.13: {} + tslib@1.14.1: {} + tslib@2.8.1: {} tsx@4.21.0: @@ -6851,16 +8133,76 @@ snapshots: media-typer: 1.1.0 mime-types: 3.0.2 + typed-array-buffer@1.0.3: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + is-typed-array: 1.1.15 + + typed-array-byte-length@1.0.3: + dependencies: + call-bind: 1.0.9 + for-each: 0.3.5 + gopd: 1.2.0 + has-proto: 1.2.0 + is-typed-array: 1.1.15 + + typed-array-byte-offset@1.0.5: + dependencies: + available-typed-arrays: 1.0.7 + call-bind: 1.0.9 + for-each: 0.3.5 + gopd: 1.2.0 + is-typed-array: 1.1.15 + reflect.getprototypeof: 1.0.10 + + typed-array-length@1.0.8: + dependencies: + call-bind: 1.0.9 + for-each: 0.3.5 + gopd: 1.2.0 + is-typed-array: 1.1.15 + possible-typed-array-names: 1.1.0 + reflect.getprototypeof: 1.0.10 + + typedarray.prototype.slice@1.0.6: + dependencies: + call-bind: 1.0.9 + define-properties: 1.2.1 + es-abstract: 1.24.2 + es-errors: 1.3.0 + get-proto: 1.0.1 + math-intrinsics: 1.1.0 + typed-array-buffer: 1.0.3 + typed-array-byte-offset: 1.0.5 + typescript@6.0.2: {} ufo@1.6.3: {} + unbox-primitive@1.1.0: + dependencies: + call-bound: 1.0.4 + has-bigints: 1.1.0 + has-symbols: 1.1.0 + which-boxed-primitive: 1.1.1 + undici-types@6.21.0: {} undici-types@7.18.2: {} undici@8.10.2: {} + unicode-properties@1.4.1: + dependencies: + base64-js: 1.5.1 + unicode-trie: 2.0.0 + + unicode-trie@2.0.0: + dependencies: + pako: 0.2.9 + tiny-inflate: 1.0.3 + unifont@0.7.5: dependencies: css-tree: 3.2.1 @@ -6872,6 +8214,19 @@ snapshots: until-async@3.0.2: optional: true + unzipper@0.10.14: + dependencies: + big-integer: 1.6.52 + binary: 0.3.0 + bluebird: 3.4.7 + buffer-indexof-polyfill: 1.0.2 + duplexer2: 0.1.4 + fstream: 1.0.12 + graceful-fs: 4.2.12 + listenercount: 1.0.1 + readable-stream: 2.3.8 + setimmediate: 1.0.5 + use-callback-ref@1.3.3(@types/react@19.2.14)(react@19.2.7): dependencies: react: 19.2.7 @@ -6900,6 +8255,8 @@ snapshots: uuid@11.1.0: {} + uuid@8.3.2: {} + vary@1.1.2: {} vite@8.3.1(@types/node@25.5.0)(esbuild@0.25.12)(jiti@2.6.1)(tsx@4.21.0)(yaml@2.9.0): @@ -6982,6 +8339,47 @@ snapshots: webworkify@1.5.0: {} + which-boxed-primitive@1.1.1: + dependencies: + is-bigint: 1.1.0 + is-boolean-object: 1.2.2 + is-number-object: 1.1.1 + is-string: 1.1.1 + is-symbol: 1.1.1 + + which-builtin-type@1.2.1: + dependencies: + call-bound: 1.0.4 + function.prototype.name: 1.2.0 + has-tostringtag: 1.0.2 + is-async-function: 2.1.1 + is-date-object: 1.1.0 + is-finalizationregistry: 1.1.1 + is-generator-function: 1.1.2 + is-regex: 1.2.1 + is-weakref: 1.1.1 + isarray: 2.0.5 + which-boxed-primitive: 1.1.1 + which-collection: 1.0.2 + which-typed-array: 1.1.24 + + which-collection@1.0.2: + dependencies: + is-map: 2.0.3 + is-set: 2.0.3 + is-weakmap: 2.0.2 + is-weakset: 2.0.4 + + which-typed-array@1.1.24: + dependencies: + available-typed-arrays: 1.0.7 + call-bind: 1.0.9 + call-bound: 1.0.4 + for-each: 0.3.5 + get-proto: 1.0.1 + gopd: 1.2.0 + has-tostringtag: 1.0.2 + which@2.0.2: dependencies: isexe: 2.0.0 @@ -7011,6 +8409,8 @@ snapshots: ws@8.20.0: {} + xmlchars@2.2.0: {} + xspattern@3.1.0: dependencies: whynot: 5.0.0 @@ -7038,6 +8438,12 @@ snapshots: yoctocolors-cjs@2.1.3: optional: true + zip-stream@4.1.1: + dependencies: + archiver-utils: 3.0.4 + compress-commons: 4.1.2 + readable-stream: 3.6.2 + zod-to-json-schema@3.25.2(zod@4.6.5): dependencies: zod: 4.6.5 From abb5a9d4f716c1cabc151a75dc5a3c5c01c1d3a3 Mon Sep 17 00:00:00 2001 From: ppppp2005-p <360128433+ppppp2005-p@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:47:57 -0400 Subject: [PATCH 02/11] feat(ui-plugins): add Printable Calendar (printable-calendar) --- external_plugins/printable-calendar/LICENSE | 21 ++++++++ external_plugins/printable-calendar/README.md | 51 +++++++++++++++++++ .../printable-calendar/README_CN.md | 51 +++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 external_plugins/printable-calendar/LICENSE create mode 100644 external_plugins/printable-calendar/README.md create mode 100644 external_plugins/printable-calendar/README_CN.md diff --git a/external_plugins/printable-calendar/LICENSE b/external_plugins/printable-calendar/LICENSE new file mode 100644 index 00000000..67e98093 --- /dev/null +++ b/external_plugins/printable-calendar/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Penova + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/external_plugins/printable-calendar/README.md b/external_plugins/printable-calendar/README.md new file mode 100644 index 00000000..0a2986ea --- /dev/null +++ b/external_plugins/printable-calendar/README.md @@ -0,0 +1,51 @@ +# Printable Calendar + +Print a calendar for the year with your holidays and events already written in. Get a monthly calendar with a page per month and big boxes to write in, and a year-at-a-glance page. Optionally pick a list of dates — holidays, make-up working days, birthdays, trips, deadlines — or type holidays straight into the settings. Choose the year and months, Monday or Sunday start, A4 or Letter, Chinese and English labels, week numbers and your colour. Runs locally; no design service or API keys. + +## Features + +- **Monthly pages**: big boxes with your events written in, weekends and holidays shaded, 休/班 tags, overflow marked. +- **Year at a glance**: all months on one page with holidays highlighted, event days marked and a list of dates below. +- **Your dates**: pick a CSV/Excel of 日期, 结束日期, 事项, 类型 (活动/假期/补班), 颜色 — or type holidays in the settings. +- **Any span**: choose the year, start month and up to 24 months. +- **Print options**: A4 or Letter, portrait or landscape, Monday or Sunday start, ISO week numbers, Chinese/English labels, accent colour. +- **Panel**: pick input files, adjust settings, see problems, edit any cell in the table, preview the result and export — all in the ZCode side panel. Edits are saved in `printable-calendar/.project.json` and kept until you re-open the inputs. + +## Usage + +Ask the agent in ZCode Desktop: + +- "Make a 2027 calendar with events.csv titled 青禾 2027" +- "Start weeks on Sunday, English labels, Letter paper" +- "Add 2027-06-09 Dragon Boat holiday and show week numbers" + +## Tools + +| Tool | Purpose | +|---|---| +| `cal_open` | Read the event list (optional) and preview the year. Opens the panel | +| `cal_edit` | Change settings, edit cells by row, add or remove rows | +| `cal_status` | Show the current rows, issues and summary | +| `cal_export` | Write calendar--monthly.pdf and calendar--year.pdf | + +Output goes to `printable-calendar//` in the workspace. + +## Scope (v0.1) + +- Public holidays aren't built in — enter them from your official holiday notice (examples are marked in the sample). +- No lunar calendar dates in v0.1. + +## Privacy, network and files + +- **Everything runs locally.** No network, no uploads, no API keys or accounts. +- Reads only the files you choose. Writes only the `printable-calendar/` folder in the workspace. No hooks. + +## Build and test (developers) + +- Source: `ui-plugins/printable-calendar/`. +- Build: `pnpm install --frozen-lockfile && pnpm build`, then add `dist/local-marketplace` as a local source. +- Tests: `pnpm --filter @penova/plugin-printable-calendar test` and `test:e2e` (needs Chrome; sample files in `test/samples/`). + +## Third-party components and licenses + +MIT licensed (author: Penova). Bundled: ExcelJS (MIT), pdf-lib (MIT), fontkit (MIT), MCP SDK and ext-apps (MIT), zod (MIT); the full list is in `dist/THIRD_PARTY_NOTICES.txt`. diff --git a/external_plugins/printable-calendar/README_CN.md b/external_plugins/printable-calendar/README_CN.md new file mode 100644 index 00000000..72431ba0 --- /dev/null +++ b/external_plugins/printable-calendar/README_CN.md @@ -0,0 +1,51 @@ +# 可打印日历 + +打印一份已经写好节假日和你自己安排的日历。生成每月一页、格子够大可以手写的月历,以及一页看全年的年历。可以选一份日期清单——节假日、调休补班、生日、出差、截止日——也可以直接在设置里输入节假日。年份和月份、每周从周一还是周日开始、A4 或 Letter、中英文、周数和主题色都能选。在本地运行,不用设计服务,无需 API 密钥。 + +## 功能 + +- **月历**:格子大,写好你的安排,周末和假期加底色,带“休/班”标记,放不下会提示。 +- **全年一页**:12 个月在一页,假期高亮、有安排的日子加标记,下方列出日期清单。 +- **你的日期**:选一份含 日期、结束日期、事项、类型(活动/假期/补班)、颜色 的表格,或直接在设置里输入节假日。 +- **任意时段**:选年份、起始月份,最多 24 个月。 +- **打印选项**:A4 或 Letter,横向或纵向,周一或周日开始,ISO 周数,中英文,主题色。 +- **面板**:在 ZCode 侧栏里选择输入文件、调整设置、查看问题、直接修改表格里的任意单元格、预览成品并导出。修改保存在 `printable-calendar/<项目>.project.json`,重新打开输入文件前一直保留。 + +## 使用方法 + +在 ZCode 桌面端对助手说: + +- “用 events.csv 做 2027 年日历,标题 青禾 2027” +- “每周从周日开始,英文,Letter 纸” +- “加上 2027-06-09 端午假期,显示周数” + +## 工具 + +| 工具 | 作用 | +|---|---| +| `cal_open` | 读取事件表(可选)并预览全年,并打开面板 | +| `cal_edit` | 修改设置、按行修改单元格、新增或删除行 | +| `cal_status` | 查看当前数据、问题和汇总 | +| `cal_export` | 导出 calendar-<年份>-monthly.pdf 和 calendar-<年份>-year.pdf | + +导出文件写到工作区的 `printable-calendar/<项目>/` 文件夹。 + +## 范围(v0.1) + +- 不内置法定节假日——请按官方通知填写(样例里的是示例)。 +- v0.1 不显示农历。 + +## 隐私、网络与文件 + +- **全部在本地运行。** 不联网、不上传,不需要 API 密钥或账号。 +- 只读取你选择的文件,只写入工作区的 `printable-calendar/` 文件夹。没有 Hook。 + +## 构建与测试(开发者) + +- 源码:`ui-plugins/printable-calendar/`。 +- 构建:`pnpm install --frozen-lockfile && pnpm build`,然后把 `dist/local-marketplace` 添加为本地来源。 +- 测试:`pnpm --filter @penova/plugin-printable-calendar test` 和 `test:e2e`(需要 Chrome;样例文件在 `test/samples/`)。 + +## 第三方组件与许可证 + +MIT 许可(作者:Penova)。打包的组件:ExcelJS (MIT), pdf-lib (MIT), fontkit (MIT)、MCP SDK 与 ext-apps(MIT)、zod(MIT);完整列表见 `dist/THIRD_PARTY_NOTICES.txt`。 From 6a42082c8d738a484c852d54609b4ac8581448d9 Mon Sep 17 00:00:00 2001 From: ppppp2005-p <360128433+ppppp2005-p@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:48:31 -0400 Subject: [PATCH 03/11] feat(ui-plugins): add Printable Calendar (printable-calendar) --- ui-plugins/printable-calendar/package.json | 38 +++++++++++++++++++ ui-plugins/printable-calendar/tsconfig.json | 14 +++++++ .../printable-calendar/vitest.config.ts | 2 + 3 files changed, 54 insertions(+) create mode 100644 ui-plugins/printable-calendar/package.json create mode 100644 ui-plugins/printable-calendar/tsconfig.json create mode 100644 ui-plugins/printable-calendar/vitest.config.ts diff --git a/ui-plugins/printable-calendar/package.json b/ui-plugins/printable-calendar/package.json new file mode 100644 index 00000000..d886a6b3 --- /dev/null +++ b/ui-plugins/printable-calendar/package.json @@ -0,0 +1,38 @@ +{ + "name": "@penova/plugin-printable-calendar", + "version": "0.1.0", + "private": true, + "license": "MIT", + "type": "module", + "scripts": { + "build": "node scripts/build.mjs", + "typecheck": "tsc -p tsconfig.json --noEmit", + "test": "vitest run", + "test:e2e": "node --experimental-strip-types scripts/e2e.mts" + }, + "zcode": { + "title": "Printable Calendar", + "stub": [ + "unzipper" + ] + }, + "engines": { + "node": ">=22.0.0" + }, + "dependencies": { + "@modelcontextprotocol/sdk": "1.29.0", + "zod": "^4.6.5", + "exceljs": "4.4.0", + "pdf-lib": "1.17.1", + "fontkit": "2.0.4" + }, + "devDependencies": { + "@modelcontextprotocol/core": "2.0.0", + "@modelcontextprotocol/ext-apps": "2.0.0", + "@types/node": "25.5.0", + "esbuild": "^0.25.12", + "playwright-core": "1.59.1", + "typescript": "6.0.2", + "vitest": "4.1.4" + } +} diff --git a/ui-plugins/printable-calendar/tsconfig.json b/ui-plugins/printable-calendar/tsconfig.json new file mode 100644 index 00000000..39f7ab60 --- /dev/null +++ b/ui-plugins/printable-calendar/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "lib": ["ES2023", "DOM", "DOM.Iterable"], + "strict": true, + "skipLibCheck": true, + "noEmit": true, + "allowImportingTsExtensions": true, + "types": ["node"] + }, + "include": ["src/**/*.ts", "ui/**/*.ts", "test/**/*.ts"] +} diff --git a/ui-plugins/printable-calendar/vitest.config.ts b/ui-plugins/printable-calendar/vitest.config.ts new file mode 100644 index 00000000..27153a26 --- /dev/null +++ b/ui-plugins/printable-calendar/vitest.config.ts @@ -0,0 +1,2 @@ +import { defineConfig } from "vitest/config"; +export default defineConfig({ test: { include: ["src/**/*.test.ts", "test/**/*.test.ts"], testTimeout: 120000, hookTimeout: 120000 } }); From 1698951292a72efab66836ef6d92ea92aafe4581 Mon Sep 17 00:00:00 2001 From: ppppp2005-p <360128433+ppppp2005-p@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:49:02 -0400 Subject: [PATCH 04/11] feat(ui-plugins): add Printable Calendar (printable-calendar) --- .../.zcode-plugin/plugin.json | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 external_plugins/printable-calendar/.zcode-plugin/plugin.json diff --git a/external_plugins/printable-calendar/.zcode-plugin/plugin.json b/external_plugins/printable-calendar/.zcode-plugin/plugin.json new file mode 100644 index 00000000..cb8bcd6f --- /dev/null +++ b/external_plugins/printable-calendar/.zcode-plugin/plugin.json @@ -0,0 +1,59 @@ +{ + "name": "printable-calendar", + "version": "0.1.0", + "description": "Print a calendar for the year with your holidays and events already written in. Get a monthly calendar with a page per month and big boxes to write in, and a year-at-a-glance page. Optionally pick a list of dates — holidays, make-up working days, birthdays, trips, deadlines — or type holidays straight into the settings. Choose the year and months, Monday or Sunday start, A4 or Letter, Chinese and English labels, week numbers and your colour. Runs locally; no design service or API keys.", + "description_i18n": { + "en": "Print a calendar for the year with your holidays and events already written in. Get a monthly calendar with a page per month and big boxes to write in, and a year-at-a-glance page. Optionally pick a list of dates — holidays, make-up working days, birthdays, trips, deadlines — or type holidays straight into the settings. Choose the year and months, Monday or Sunday start, A4 or Letter, Chinese and English labels, week numbers and your colour. Runs locally; no design service or API keys.", + "zh-CN": "打印一份已经写好节假日和你自己安排的日历。生成每月一页、格子够大可以手写的月历,以及一页看全年的年历。可以选一份日期清单——节假日、调休补班、生日、出差、截止日——也可以直接在设置里输入节假日。年份和月份、每周从周一还是周日开始、A4 或 Letter、中英文、周数和主题色都能选。在本地运行,不用设计服务,无需 API 密钥。" + }, + "author": { + "name": "Penova", + "url": "https://github.com/ppppp2005-p" + }, + "license": "MIT", + "keywords": [ + "calendar", + "printable calendar", + "monthly calendar", + "year calendar", + "planner", + "holidays", + "pdf", + "日历", + "月历", + "年历", + "台历", + "可打印", + "节假日" + ], + "skills": "skills", + "mcpServers": { + "printable-calendar": { + "type": "stdio", + "command": "node", + "args": [ + "${ZCODE_PLUGIN_ROOT}/dist/server.mjs" + ], + "cwd": "${ZCODE_PROJECT_DIR}", + "timeoutMs": 900000, + "env": { + "ZCODE_WORKSPACE_ROOT": "${ZCODE_PROJECT_DIR}" + } + } + }, + "ui": { + "surfaces": [ + { + "id": "editor", + "title": { + "zh-CN": "可打印日历", + "en-US": "Printable Calendar" + }, + "icon": "calendar-days", + "server": "printable-calendar", + "resourceUri": "ui://printable-calendar/panel.html", + "availability": "session" + } + ] + } +} From b9bd6580d0abb5b181a0b67437545ec6170e40e3 Mon Sep 17 00:00:00 2001 From: ppppp2005-p <360128433+ppppp2005-p@users.noreply.github.com> Date: Thu, 26 Nov 2026 05:04:59 -0400 Subject: [PATCH 05/11] feat(ui-plugins): add Printable Calendar (printable-calendar) --- .../printable-calendar/scripts/build.mjs | 74 ++++++++ ui-plugins/printable-calendar/scripts/e2e.mts | 87 ++++++++++ .../printable-calendar/scripts/harness.mjs | 162 ++++++++++++++++++ .../printable-calendar/scripts/licenses.mjs | 43 +++++ 4 files changed, 366 insertions(+) create mode 100644 ui-plugins/printable-calendar/scripts/build.mjs create mode 100644 ui-plugins/printable-calendar/scripts/e2e.mts create mode 100644 ui-plugins/printable-calendar/scripts/harness.mjs create mode 100644 ui-plugins/printable-calendar/scripts/licenses.mjs diff --git a/ui-plugins/printable-calendar/scripts/build.mjs b/ui-plugins/printable-calendar/scripts/build.mjs new file mode 100644 index 00000000..02ff90d4 --- /dev/null +++ b/ui-plugins/printable-calendar/scripts/build.mjs @@ -0,0 +1,74 @@ +import { build } from "esbuild"; +import { copyFile, cp, mkdir, readFile, rm, writeFile } from "node:fs/promises"; +import { createRequire } from "node:module"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; +import { writeNotices } from "./licenses.mjs"; + +const root = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const dist = join(root, "dist"); +const pkg = JSON.parse(await readFile(join(root, "package.json"), "utf8")); +await rm(dist, { recursive: true, force: true }); +await mkdir(join(dist, "ui"), { recursive: true }); + +// 宿主只提供 HTML 本身,JS 与 CSS 全部内联到一个页面里。 +const ui = await build({ + metafile: true, + entryPoints: [join(root, "ui/main.ts")], + bundle: true, + format: "iife", + platform: "browser", + target: "es2022", + minify: true, + write: false, + outdir: join(dist, "ui"), + legalComments: "none", + loader: { ".css": "text" }, +}); +const js = ui.outputFiles.find((file) => file.path.endsWith(".js")).text; +const escape = (text) => text.replace(/<\/script/gi, "<\\/script"); +const html = `${pkg.zcode?.title ?? pkg.name}
`; +const htmlBytes = Buffer.byteLength(html); +if (htmlBytes > 4 * 1024 * 1024 - 64 * 1024) throw new Error(`panel.html is ${Math.round(htmlBytes / 1024)} KiB; keep it below 4 MiB`); +await writeFile(join(dist, "ui/panel.html"), html); + +// 用不到、且许可证不明的可选依赖(package.json 的 zcode.stub)替换为空模块。 +const stubs = pkg.zcode?.stub ?? []; +const stubPlugin = { + name: "stub", + setup(b) { + if (!stubs.length) return; + const filter = new RegExp(`^(${stubs.map((s) => s.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&")).join("|")})$`); + b.onResolve({ filter }, (args) => ({ path: args.path, namespace: "stub" })); + b.onLoad({ filter: /.*/, namespace: "stub" }, () => ({ contents: "module.exports = {};", loader: "js" })); + }, +}; + +const server = await build({ + plugins: [stubPlugin], + metafile: true, + entryPoints: [join(root, "src/main.ts")], + outfile: join(dist, "server.mjs"), + bundle: true, + platform: "node", + format: "esm", + target: "node22", + legalComments: "none", + banner: { + js: 'import { createRequire as __createRequire } from "node:module"; const require=__createRequire(import.meta.url);', + }, +}); + +// 运行时需要的 wasm 等文件(package.json 的 zcode.assets:{ 包内路径: 输出文件名 })。 +const require = createRequire(join(root, "package.json")); +for (const [from, to] of Object.entries(pkg.zcode?.assets ?? {})) await copyFile(require.resolve(from), join(dist, to)); + +// 整个目录(package.json 的 zcode.dirs:{ "包名:子目录": 输出目录 }),例如 pdf.js 的 CMap。 +for (const [spec, to] of Object.entries(pkg.zcode?.dirs ?? {})) { + const [name, sub] = spec.split(":"); + const base = dirname(require.resolve(`${name}/package.json`)); + await cp(join(base, sub), join(dist, to), { recursive: true, filter: (path) => !/(_nowasm_fallback\.js|quickjs-eval\.(js|wasm))$/.test(path) }); +} + +await writeNotices([ui.metafile, server.metafile], join(dist, "THIRD_PARTY_NOTICES.txt"), Object.keys(pkg.zcode?.assets ?? {})); +process.stdout.write(`${pkg.name}: panel ${Math.round(htmlBytes / 1024)} KiB, server ${Math.round((await readFile(join(dist, "server.mjs"))).length / 1024)} KiB\n`); diff --git a/ui-plugins/printable-calendar/scripts/e2e.mts b/ui-plugins/printable-calendar/scripts/e2e.mts new file mode 100644 index 00000000..97575965 --- /dev/null +++ b/ui-plugins/printable-calendar/scripts/e2e.mts @@ -0,0 +1,87 @@ +// 浏览器端到端测试:真实打包的 server + 官方 AppBridge 宿主 + 隔离 iframe 中的面板。需要 Chrome。 +// 场景写在 test/e2e.json:用户在面板里选文件打开 → Agent 修改 → 用户在表格里改一格 → 导出。 +import assert from "node:assert/strict"; +import { cp, mkdir, mkdtemp, readFile, stat } from "node:fs/promises"; +import { existsSync } from "node:fs"; +import { execFileSync } from "node:child_process"; +import { tmpdir } from "node:os"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; +import { startHarness } from "./harness.mjs"; + +const root = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const pkg = JSON.parse(await readFile(join(root, "package.json"), "utf8")); +const name = pkg.name.replace("@penova/plugin-", ""); +const spec = JSON.parse(await readFile(join(root, "test/e2e.json"), "utf8")); +const shots = process.env.E2E_SHOTS ?? join(tmpdir(), `${name}-shots`); +await mkdir(shots, { recursive: true }); +const workspace = await mkdtemp(join(tmpdir(), `${name}-e2e-`)); +const samples = process.env.SAMPLES ?? join(root, "test/samples"); +if (existsSync(samples)) await cp(samples, join(workspace, spec.folder ?? "samples"), { recursive: true }); +// 可选:样例需要现场生成(例如 git 仓库)时,运行 test/ 下的脚本,参数是样例文件夹。 +if (spec.setup) execFileSync(process.execPath, [join(root, spec.setup), join(workspace, spec.folder ?? "samples")], { stdio: "inherit" }); + +const harness = await startHarness({ workspace }); +const step = (text: string) => process.stdout.write(`• ${text}\n`); +let failShot: (() => Promise) | undefined; +try { + const { outer, frame } = await harness.open("?locale=zh-CN", { width: 1400, height: 950 }); + failShot = () => outer.screenshot({ path: join(shots, "failed.png") }); + step("user picks the sample in the panel and opens it"); + await frame.locator(".start").waitFor(); + for (const pick of spec.pick ?? []) await frame.locator("label.file", { hasText: pick }).first().click(); + for (const [key, value] of Object.entries(spec.startSettings ?? {})) { + const el = frame.locator(`.settings [data-key="${key}"]`); + if (typeof value === "boolean") await el.setChecked(value); + else if ((await el.evaluate((e) => e.tagName)) === "SELECT") await el.selectOption(String(value)); + else await el.fill(String(value)); + } + await frame.locator("button.open").click(); + await frame.locator(".project .summary").waitFor(); + const project = (await frame.locator(".pname").textContent())!.trim(); + if (spec.edit) { + step("agent edits the project"); + await harness.agent(outer, `${spec.prefix}_edit`, { project, ...spec.edit }); + } + if (spec.uiEdit) { + step("user edits a cell in the table"); + const cell = frame.locator(`tr[data-row="${spec.uiEdit.row}"] td[data-key="${spec.uiEdit.key}"]`); + if (typeof spec.uiEdit.value === "boolean") await cell.locator("input").setChecked(spec.uiEdit.value); + else if (await cell.locator("select").count()) await cell.locator("select").selectOption(String(spec.uiEdit.value)); + else { + const input = cell.locator("input"); + await input.fill(String(spec.uiEdit.value)); + await input.press("Enter"); + await input.blur(); + } + await frame.waitForTimeout(800); + } + if (spec.expectText) await frame.locator("#root", { hasText: spec.expectText }).waitFor(); + await frame.waitForTimeout(400); + await outer.screenshot({ path: join(shots, "01-panel.png") }); + step("user exports"); + const all = frame.locator("button.expall"); + if (await all.count()) await all.click(); + else await frame.locator("button.exp").first().click(); + await frame.locator(".exported li").first().waitFor({ timeout: 300_000 }); + await frame.waitForTimeout(300); + await outer.screenshot({ path: join(shots, "02-exported.png") }); + const files = await frame.locator(".exported li").allTextContents(); + for (const f of files) assert.ok((await stat(join(workspace, f.trim()))).size > 0, `${f} is empty`); + for (const pattern of spec.expectFiles ?? []) assert.ok(files.some((f) => new RegExp(pattern).test(f)), `expected an exported file matching ${pattern}; got ${files.join(", ")}`); + + step("English panel"); + const en = await harness.open("?locale=en-US&theme=dark", { width: 1400, height: 950 }); + await harness.agent(en.outer, `${spec.prefix}_status`, { project }); + await en.frame.locator(".project .summary").waitFor(); + await en.frame.waitForTimeout(400); + await en.outer.screenshot({ path: join(shots, "03-en-dark.png") }); + assert.deepEqual(harness.errors, []); + step(`ok — ${files.length} file(s) exported; screenshots in ${shots}`); +} catch (error) { + await failShot?.().catch(() => undefined); + console.error("page errors:", harness.errors, harness.stderr.join("")); + throw error; +} finally { + await harness.close(); +} diff --git a/ui-plugins/printable-calendar/scripts/harness.mjs b/ui-plugins/printable-calendar/scripts/harness.mjs new file mode 100644 index 00000000..a45e6e41 --- /dev/null +++ b/ui-plugins/printable-calendar/scripts/harness.mjs @@ -0,0 +1,162 @@ +import assert from "node:assert/strict"; +import { createServer } from "node:http"; +import { readFile } from "node:fs/promises"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; +import { build } from "esbuild"; +import { chromium } from "playwright-core"; +import { Client } from "@modelcontextprotocol/sdk/client/index.js"; +import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; +import { ResourceUpdatedNotificationSchema } from "@modelcontextprotocol/sdk/types.js"; + +/** + * 浏览器测试宿主:真实打包的 server(stdio)+ 官方 AppBridge 宿主页 + 隔离 iframe 中的面板。 + * 宿主页用与 ZCode 相同的 CSP 约束面板。测试脚本同时扮演 Agent:经同一个 MCP 连接调用工具, + * 并像宿主一样把结果推给页面。 + */ +const root = resolve(dirname(fileURLToPath(import.meta.url)), ".."); + +// 与 ZCode 给 MCP App 页面的限制一致:没有网络,允许 wasm(声明了 zcode/csp.wasmUnsafeEval)。 +export const PANEL_CSP = + "default-src 'none'; script-src 'self' 'unsafe-inline' blob: data: 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; media-src 'self' data: blob:; worker-src 'self' blob:; connect-src 'none'; frame-src 'none'; base-uri 'self'; form-action 'none'"; + +/** server:要运行的 server 入口(默认真实打包的 dist/server.mjs)。 */ +export async function startHarness({ env = {}, workspace, server = join(root, "dist/server.mjs") }) { + const client = new Client({ name: "kit-harness", version: "1" }); + const sseClients = new Set(); + client.setNotificationHandler(ResourceUpdatedNotificationSchema, (notification) => { + for (const response of sseClients) response.write(`data: ${JSON.stringify(notification.params)}\n\n`); + }); + const stderr = []; + const transport = new StdioClientTransport({ + command: process.execPath, + args: [server], + cwd: workspace, + env: { ...process.env, ZCODE_WORKSPACE_ROOT: workspace, ...env }, + stderr: "pipe", + }); + transport.stderr?.on("data", (chunk) => stderr.push(String(chunk))); + await client.connect(transport); + const html = await readFile(join(root, "dist/ui/panel.html"), "utf8"); + const hostJs = await build({ + stdin: { + contents: ` +import { AppBridge, PostMessageTransport } from "@modelcontextprotocol/ext-apps/app-bridge"; +import { z } from "zod"; +const WidgetState = z.object({ method: z.literal('ui/set-widget-state'), params: z.object({ widgetState: z.unknown() }) }); +const rpc = async (method, args) => { + const response = await fetch('/rpc', {method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({method,args})}); + const result = await response.json(); if (!response.ok) throw Error(result.error); return result; +}; +const params = new URLSearchParams(location.search); +const context = { theme: params.get('theme') || 'light', locale: params.get('locale') || 'en-US', displayMode: params.get('mode') || 'fullscreen' }; +const bridge = new AppBridge(null, {name:"kit-harness",version:"1"}, { + serverTools:{}, serverResources:{ listChanged: true }, message:{text:{}}, updateModelContext:{text:{}, structuredContent:{}}, openLinks:{}, + experimental: params.get('nosub') ? { "zcode/widgetState": {} } : { "zcode/resourceSubscribe": {}, "zcode/widgetState": {} }, +}, {hostContext:{...context, "zcode/widgetState": JSON.parse(sessionStorage.getItem('widgetState') || 'null')}}); +window.__messages = []; +window.__context = []; +window.__links = []; +window.__calls = []; +window.__initializations = 0; +bridge.oncalltool = (args) => { window.__calls.push(args.name); return rpc('callTool', args); }; +bridge.onreadresource = (args) => rpc('readResource', args); +bridge.onmessage = async (params) => { window.__messages.push(params.content[0].text); return {}; }; +bridge.onupdatemodelcontext = async (params) => { window.__context.push(params); return {}; }; +bridge.onopenlink = async (params) => { window.__links.push(params.url); return {}; }; +bridge.setRequestHandler('resources/subscribe', async (request) => { await rpc('subscribe', { uri: request.params.uri }); return {}; }); +bridge.setRequestHandler('resources/unsubscribe', async (request) => { await rpc('unsubscribe', { uri: request.params.uri }); return {}; }); +bridge.setRequestHandler(WidgetState, async (request) => { sessionStorage.setItem('widgetState', JSON.stringify(request.params.widgetState)); return {}; }); +bridge.oninitialized = () => { window.__initializations++; }; +window.__sendToolResult = (result) => bridge.sendToolResult(result); +window.__setContext = (patch) => bridge.setHostContext({ ...context, ...patch }); +new EventSource('/events').onmessage = (event) => { + bridge.notification({ method: 'notifications/resources/updated', params: JSON.parse(event.data) }); +}; +const frame = document.querySelector('iframe'); +await bridge.connect(new PostMessageTransport(frame.contentWindow, frame.contentWindow)); +frame.src = '/panel'; +`, + resolveDir: root, + sourcefile: "browser-host.mjs", + }, + bundle: true, + format: "esm", + platform: "browser", + write: false, + }); + const http = createServer(async (request, response) => { + try { + const url = new URL(request.url, "http://localhost"); + if (url.pathname === "/") { + response.setHeader("Content-Type", "text/html; charset=utf-8"); + response.end( + '', + ); + } else if (url.pathname === "/host.js") { + response.setHeader("Content-Type", "text/javascript"); + response.end(hostJs.outputFiles[0].text); + } else if (url.pathname === "/panel") { + response.setHeader("Content-Type", "text/html; charset=utf-8"); + response.setHeader("Content-Security-Policy", PANEL_CSP); + response.end(html); + } else if (url.pathname === "/events") { + response.writeHead(200, { "Content-Type": "text/event-stream", "Cache-Control": "no-cache" }); + response.write(": connected\n\n"); + sseClients.add(response); + request.on("close", () => sseClients.delete(response)); + } else if (request.method === "POST" && url.pathname === "/rpc") { + let body = ""; + for await (const chunk of request) body += chunk; + const { method, args } = JSON.parse(body); + const result = + method === "readResource" + ? await client.readResource(args) + : method === "subscribe" + ? await client.subscribeResource(args) + : method === "unsubscribe" + ? await client.unsubscribeResource(args) + : await client.callTool(args, undefined, { timeout: 300_000 }); + response.setHeader("Content-Type", "application/json"); + response.end(JSON.stringify(result ?? {})); + } else if (url.pathname === "/favicon.ico") response.writeHead(204).end(); + else response.writeHead(404).end(); + } catch (error) { + response.writeHead(500, { "Content-Type": "application/json" }).end(JSON.stringify({ error: String(error) })); + } + }); + await new Promise((done) => http.listen(0, "127.0.0.1", done)); + const base = `http://127.0.0.1:${http.address().port}`; + const browser = await chromium.launch(process.env.CHROME_PATH ? { executablePath: process.env.CHROME_PATH } : { channel: "chrome" }); + const errors = []; + const contexts = []; + + const open = async (query = "", viewport = { width: 720, height: 900 }) => { + const context = await browser.newContext({ viewport, deviceScaleFactor: 2 }); + contexts.push(context); + const outer = await context.newPage(); + outer.on("pageerror", (error) => errors.push(String(error))); + outer.on("console", (message) => { + if (message.type() === "error" && !/favicon/.test(message.text())) errors.push(message.text()); + }); + await outer.goto(`${base}/${query}`); + await outer.waitForFunction(() => window.__initializations === 1); + const frame = outer.frames().find((item) => item !== outer.mainFrame()); + assert.ok(frame, "official App iframe exists"); + return { outer, frame, context }; + }; + /** 扮演 Agent:调用工具,再像宿主一样把结果推给页面。 */ + const agent = async (outer, name, args, { expectError = false } = {}) => { + const result = await client.callTool({ name, arguments: args }, undefined, { timeout: 300_000 }); + if (expectError) assert.ok(result.isError, `${name} should fail`); + else assert.ok(!result.isError, `${name}: ${JSON.stringify(result.content)}`); + if (outer) await outer.evaluate((value) => window.__sendToolResult(value), result); + return result; + }; + const close = async () => { + await browser.close().catch(() => undefined); + await client.close().catch(() => undefined); + http.close(); + }; + return { client, open, agent, close, errors, stderr, base, contexts: () => contexts.filter((context) => context.pages().length) }; +} diff --git a/ui-plugins/printable-calendar/scripts/licenses.mjs b/ui-plugins/printable-calendar/scripts/licenses.mjs new file mode 100644 index 00000000..5107fe7c --- /dev/null +++ b/ui-plugins/printable-calendar/scripts/licenses.mjs @@ -0,0 +1,43 @@ +import { readFile, readdir, writeFile } from "node:fs/promises"; +import { dirname, join, resolve } from "node:path"; + +// 从实际参与打包的模块收集许可证,避免只列直接依赖而漏掉 Canvas/SDK 的传递依赖。 +export async function writeNotices(metafiles, destination, extra = []) { + const packages = new Map(); + const { createRequire } = await import("node:module"); + const require = createRequire(resolve("package.json")); + const extraInputs = extra.map((spec) => require.resolve(spec)); + for (const input of [...metafiles.flatMap((meta) => Object.keys(meta.inputs)), ...extraInputs]) { + if (!input.includes("node_modules/")) continue; + let directory = dirname(resolve(input)); + while (directory.includes("node_modules")) { + try { + const pkg = JSON.parse(await readFile(join(directory, "package.json"), "utf8")); + if (pkg.name && pkg.version) { + packages.set(directory, pkg); + break; + } + } catch (error) { + if (error.code !== "ENOENT") throw error; + } + directory = dirname(directory); + } + } + const notices = []; + const seen = new Set(); + for (const [directory, pkg] of [...packages].sort((a, b) => a[1].name.localeCompare(b[1].name))) { + const key = `${pkg.name}@${pkg.version}`; + if (seen.has(key)) continue; + seen.add(key); + const files = (await readdir(directory)).filter((name) => + /^(license|copying|notice)([.-]|$)/i.test(name), + ); + const texts = await Promise.all(files.map((file) => readFile(join(directory, file), "utf8"))); + if (!texts.length && !pkg.license) throw new Error(`Missing license for bundled dependency ${key}`); + if (!texts.length) texts.push(`(No license file is shipped in this package; its package.json declares the ${pkg.license} license.)`); + notices.push( + `${key} — ${typeof pkg.license === "string" ? pkg.license : JSON.stringify(pkg.license)}\n${texts.join("\n\n")}`, + ); + } + await writeFile(destination, notices.join("\n\n----------------------------------------\n\n")); +} From 89af2f85a3910f3ea9dd75440b3febf31d3badf5 Mon Sep 17 00:00:00 2001 From: ppppp2005-p <360128433+ppppp2005-p@users.noreply.github.com> Date: Thu, 26 Nov 2026 05:05:35 -0400 Subject: [PATCH 06/11] feat(ui-plugins): add Printable Calendar (printable-calendar) --- ui-plugins/printable-calendar/src/cal.ts | 165 ++++++++++++++++++++ ui-plugins/printable-calendar/src/main.ts | 14 ++ ui-plugins/printable-calendar/src/server.ts | 117 ++++++++++++++ 3 files changed, 296 insertions(+) create mode 100644 ui-plugins/printable-calendar/src/cal.ts create mode 100644 ui-plugins/printable-calendar/src/main.ts create mode 100644 ui-plugins/printable-calendar/src/server.ts diff --git a/ui-plugins/printable-calendar/src/cal.ts b/ui-plugins/printable-calendar/src/cal.ts new file mode 100644 index 00000000..e7564d86 --- /dev/null +++ b/ui-plugins/printable-calendar/src/cal.ts @@ -0,0 +1,165 @@ +import { rgb, type PDFPage } from "pdf-lib"; +import { hexRgb, MM, newPdf, PAGE, type PdfKit } from "./kit/pdf.ts"; + +export interface CalEvent { date: string; endDate: string; title: string; kind: "event" | "holiday" | "workday"; color: string } +export interface CalOpts { year: number; startMonth: number; months: number; layout: "month" | "year"; weekStart: 0 | 1; page: "A4" | "Letter"; landscape: boolean; title: string; accent: string; weekNumbers: boolean; lang: "zh" | "en" | "both" } + +const pad = (n: number) => String(n).padStart(2, "0"); +export const iso = (y: number, m: number, d: number) => `${y}-${pad(m)}-${pad(d)}`; +export const daysIn = (y: number, m: number) => new Date(Date.UTC(y, m, 0)).getUTCDate(); +export const dow = (y: number, m: number, d: number) => new Date(Date.UTC(y, m - 1, d)).getUTCDay(); +export function isoWeek(y: number, m: number, d: number) { + const t = new Date(Date.UTC(y, m - 1, d)); + const day = (t.getUTCDay() + 6) % 7; + t.setUTCDate(t.getUTCDate() - day + 3); + const first = new Date(Date.UTC(t.getUTCFullYear(), 0, 4)); + return 1 + Math.round(((+t - +first) / 86400000 - 3 + ((first.getUTCDay() + 6) % 7)) / 7); +} +const MONTH_EN = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; +const WD_ZH = ["日", "一", "二", "三", "四", "五", "六"]; +const WD_EN = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; + +/** 把多天事件展开到每一天。 */ +export function byDay(events: CalEvent[]) { + const map = new Map(); + for (const e of events) { + const end = e.endDate && e.endDate >= e.date ? e.endDate : e.date; + for (let d = new Date(`${e.date}T00:00:00Z`); d <= new Date(`${end}T00:00:00Z`); d.setUTCDate(d.getUTCDate() + 1)) { + const k = d.toISOString().slice(0, 10); + map.set(k, [...(map.get(k) ?? []), e]); + } + } + return map; +} + +export function monthsOf(o: CalOpts) { + return Array.from({ length: o.months }, (_, i) => { const n = o.startMonth - 1 + i; return { y: o.year + Math.floor(n / 12), m: (n % 12) + 1 }; }); +} +/** 一个月的格子:每行 7 天,null 为空格。 */ +export function grid(y: number, m: number, weekStart: 0 | 1) { + const first = (dow(y, m, 1) - weekStart + 7) % 7; + const cells: (number | null)[] = Array(first).fill(null); + for (let d = 1; d <= daysIn(y, m); d++) cells.push(d); + while (cells.length % 7) cells.push(null); + const rows: (number | null)[][] = []; + for (let i = 0; i < cells.length; i += 7) rows.push(cells.slice(i, i + 7)); + return rows; +} + +const RED = "#dc2626", GREY = "#9ca3af"; +function monthTitle(y: number, m: number, lang: CalOpts["lang"]) { + return lang === "en" ? `${MONTH_EN[m - 1]} ${y}` : lang === "zh" ? `${y} 年 ${m} 月` : `${y} 年 ${m} 月 ${MONTH_EN[m - 1]}`; +} +const wdLabel = (i: number, lang: CalOpts["lang"]) => (lang === "en" ? WD_EN[i] : lang === "zh" ? WD_ZH[i] : `${WD_ZH[i]} ${WD_EN[i]}`); + +function monthPage(k: PdfKit, page: PDFPage, W: number, H: number, y: number, m: number, days: Map, o: CalOpts) { + const mg = 12 * MM; + const ac = o.accent; + k.text(page, monthTitle(y, m, o.lang), mg, H - mg - 18, { size: 24, bold: true, color: ac }); + if (o.title) k.text(page, o.title, W - mg, H - mg - 14, { size: 11, color: "#6b7280", align: "right", maxWidth: W / 2 }); + const rows = grid(y, m, o.weekStart); + const top = H - mg - 34, bottom = mg; + const wn = o.weekNumbers ? 8 * MM : 0; + const cw = (W - 2 * mg - wn) / 7; + const headH = 16; + const rh = (top - headH - bottom) / rows.length; + for (let i = 0; i < 7; i++) { + const wd = (i + o.weekStart) % 7; + page.drawRectangle({ x: mg + wn + i * cw, y: top - headH, width: cw, height: headH, color: hexRgb(ac), borderWidth: 0, opacity: wd === 0 || wd === 6 ? 0.75 : 1 }); + k.text(page, wdLabel(wd, o.lang), mg + wn + i * cw + cw / 2, top - headH + 4.5, { size: 8.5, bold: true, color: "#ffffff", align: "center" }); + } + rows.forEach((row, r) => { + const yy = top - headH - (r + 1) * rh; + if (o.weekNumbers) { + const d = row.find((x) => x !== null)!; + k.text(page, `W${isoWeek(y, m, d)}`, mg + wn / 2, yy + rh - 12, { size: 7, color: GREY, align: "center" }); + } + row.forEach((d, c) => { + const x = mg + wn + c * cw; + const wd = (c + o.weekStart) % 7; + const key = d ? iso(y, m, d) : ""; + const evs = d ? days.get(key) ?? [] : []; + const hol = evs.find((e) => e.kind === "holiday"); + const work = evs.find((e) => e.kind === "workday"); + const weekend = wd === 0 || wd === 6; + page.drawRectangle({ x, y: yy, width: cw, height: rh, color: !d ? rgb(0.97, 0.97, 0.97) : hol ? rgb(1, 0.95, 0.95) : weekend && !work ? rgb(0.985, 0.985, 0.99) : rgb(1, 1, 1), borderColor: rgb(0.85, 0.86, 0.88), borderWidth: 0.5 }); + if (!d) return; + const numColor = hol || (weekend && !work) ? RED : "#111827"; + k.text(page, String(d), x + 5, yy + rh - 15, { size: 13, bold: true, color: numColor }); + if (hol || work) { + const tag = hol ? (o.lang === "en" ? "Off" : "休") : o.lang === "en" ? "Work" : "班"; + const tw = k.width(tag, 7) + 6; + page.drawRectangle({ x: x + cw - tw - 4, y: yy + rh - 14, width: tw, height: 10, color: hexRgb(hol ? RED : "#4b5563"), borderWidth: 0 }); + k.text(page, tag, x + cw - tw - 1, yy + rh - 11.5, { size: 7, color: "#ffffff" }); + } + let ly = yy + rh - 27; + const lineH = 9.5; + const max = Math.max(0, Math.floor((rh - 30) / lineH)); + const shown = evs.filter((e) => e.kind !== "workday" || e.title); + shown.slice(0, shown.length > max ? max - 1 : max).forEach((e) => { + const col = e.kind === "holiday" ? RED : e.kind === "workday" ? "#4b5563" : e.color || ac; + page.drawCircle({ x: x + 6, y: ly + 2.6, size: 1.8, color: hexRgb(col) }); + k.text(page, e.title, x + 10, ly, { size: 7, color: e.kind === "holiday" ? RED : "#1f2937", maxWidth: cw - 14 }); + ly -= lineH; + }); + if (shown.length > max && max > 0) k.text(page, `+${shown.length - max + 1}`, x + 10, ly, { size: 7, color: GREY }); + }); + }); +} + +function yearPage(k: PdfKit, page: PDFPage, W: number, H: number, list: { y: number; m: number }[], days: Map, o: CalOpts, events: CalEvent[]) { + const mg = 10 * MM; + const ac = o.accent; + const head = o.title || (list[0].y === list[list.length - 1].y ? String(list[0].y) : `${list[0].y}–${list[list.length - 1].y}`); + k.text(page, head, W / 2, H - mg - 22, { size: 26, bold: true, color: ac, align: "center" }); + const cols = o.landscape ? 4 : 3, rowsN = Math.ceil(list.length / cols); + const listH = 26 * MM; + const top = H - mg - 34, bottom = mg + listH; + const gw = (W - 2 * mg) / cols, gh = (top - bottom) / rowsN; + list.forEach(({ y, m }, i) => { + const gx = mg + (i % cols) * gw, gy = top - Math.floor(i / cols) * gh; + const pw = gw - 6 * MM, cw = pw / 7; + const x0 = gx + 3 * MM; + k.text(page, o.lang === "en" ? MONTH_EN[m - 1] : `${m} 月${o.lang === "both" ? ` ${MONTH_EN[m - 1]}` : ""}`, x0, gy - 12, { size: 11, bold: true, color: ac }); + for (let c = 0; c < 7; c++) { const wd = (c + o.weekStart) % 7; k.text(page, o.lang === "en" ? WD_EN[wd][0] : WD_ZH[wd], x0 + c * cw + cw / 2, gy - 25, { size: 6.5, color: wd === 0 || wd === 6 ? RED : "#6b7280", align: "center" }); } + const rows = grid(y, m, o.weekStart); + const rh = Math.min(18, (gh - 36) / 6); + rows.forEach((row, r) => row.forEach((d, c) => { + if (!d) return; + const wd = (c + o.weekStart) % 7; + const evs = days.get(iso(y, m, d)) ?? []; + const hol = evs.some((e) => e.kind === "holiday"), work = evs.some((e) => e.kind === "workday"), ev = evs.find((e) => e.kind === "event"); + const cx = x0 + c * cw + cw / 2, cy = gy - 36 - r * rh; + if (hol) page.drawRectangle({ x: cx - cw / 2 + 0.6, y: cy - 2.5, width: cw - 1.2, height: rh - 2, color: rgb(1, 0.9, 0.9), borderWidth: 0 }); + k.text(page, String(d), cx, cy, { size: Math.min(9, rh * 0.62), color: hol || (wd % 6 === 0 && !work) ? RED : "#111827", align: "center", bold: !!ev || hol }); + if (ev) page.drawCircle({ x: cx, y: cy - 2.6, size: 0.9, color: hexRgb(ev.color || ac) }); + })); + }); + // 底部列表 + const items = [...events].filter((e) => e.kind !== "workday").sort((a, b) => a.date.localeCompare(b.date)); + const colsL = 3, per = Math.max(1, Math.floor((listH - 6) / 9)); + const lw = (W - 2 * mg) / colsL; + page.drawLine({ start: { x: mg, y: bottom - 2 }, end: { x: W - mg, y: bottom - 2 }, thickness: 0.5, color: rgb(0.85, 0.85, 0.85) }); + items.slice(0, per * colsL).forEach((e, i) => { + const x = mg + Math.floor(i / per) * lw, yy = bottom - 12 - (i % per) * 9; + const d = `${Number(e.date.slice(5, 7))}/${Number(e.date.slice(8))}${e.endDate && e.endDate > e.date ? `–${Number(e.endDate.slice(5, 7))}/${Number(e.endDate.slice(8))}` : ""}`; + page.drawCircle({ x: x + 2, y: yy + 2.5, size: 1.6, color: hexRgb(e.kind === "holiday" ? RED : e.color || ac) }); + k.text(page, d, x + 6, yy, { size: 7, bold: true, color: "#374151" }); + const dx = Math.max(34, k.width(d, 7, true) + 10); + k.text(page, e.title, x + 6 + dx, yy, { size: 7, color: e.kind === "holiday" ? RED : "#374151", maxWidth: lw - 10 - dx }); + }); + if (items.length > per * colsL) k.text(page, `+${items.length - per * colsL}`, W - mg, mg - 2, { size: 7, color: GREY, align: "right" }); +} + +export async function calendarPdf(events: CalEvent[], o: CalOpts, fontPath?: string): Promise { + const k = await newPdf(fontPath); + const [pw, ph] = PAGE[o.page]; + const [W, H] = o.landscape ? [ph, pw] : [pw, ph]; + const days = byDay(events); + const list = monthsOf(o); + k.doc.setTitle(o.title || `${o.year} calendar`); + if (o.layout === "year") { + for (let i = 0; i < list.length; i += 12) yearPage(k, k.doc.addPage([W, H]), W, H, list.slice(i, i + 12), days, o, events.filter((e) => list.slice(i, i + 12).some(({ y, m }) => e.date.startsWith(`${y}-${pad(m)}`) || (e.endDate && e.endDate.startsWith(`${y}-${pad(m)}`))))); + } else for (const { y, m } of list) monthPage(k, k.doc.addPage([W, H]), W, H, y, m, days, o); + return k.doc.save(); +} diff --git a/ui-plugins/printable-calendar/src/main.ts b/ui-plugins/printable-calendar/src/main.ts new file mode 100644 index 00000000..1d089db5 --- /dev/null +++ b/ui-plugins/printable-calendar/src/main.ts @@ -0,0 +1,14 @@ +import "./kit/console.ts"; +import { dirname, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; +import { createServer } from "./server.ts"; + +const here = dirname(fileURLToPath(import.meta.url)); +const server = createServer({ + workspaceRoot: resolve(process.env.ZCODE_WORKSPACE_ROOT || process.cwd()), + assetRoot: here, + log: (line) => process.stderr.write(`[printable-calendar] ${line}\n`), +}); +process.stdin.once("end", () => process.exit(0)); +await server.connect(new StdioServerTransport()); diff --git a/ui-plugins/printable-calendar/src/server.ts b/ui-plugins/printable-calendar/src/server.ts new file mode 100644 index 00000000..59486935 --- /dev/null +++ b/ui-plugins/printable-calendar/src/server.ts @@ -0,0 +1,117 @@ +import { createApp, esc, type AppDef, type ExportCtx, type Issue, type Project, type Row } from "./kit/app.ts"; +import { mapHeaders, parseDate } from "./kit/columns.ts"; +import { readTable } from "./kit/table.ts"; +import { KitError } from "./kit/workspace.ts"; +import { byDay, calendarPdf, grid, iso, monthsOf, type CalEvent, type CalOpts } from "./cal.ts"; + +export const NAME = "printable-calendar"; +export const VERSION = "0.1.0"; + +const s = (v: unknown) => String(v ?? "").trim(); +const kindOf = (v: unknown): CalEvent["kind"] => (/假|休|holiday|off|节/i.test(s(v)) ? "holiday" : /补班|调休上班|上班|workday|make-?up/i.test(s(v)) ? "workday" : "event"); +const KIND_LABEL: Record = { event: "活动", holiday: "假期", workday: "补班" }; + +/** “2027-01-01 元旦, 2027-02-06..2027-02-12 春节” → 假期列表。 */ +export function parseHolidayText(text: string): CalEvent[] { + const out: CalEvent[] = []; + for (const part of String(text ?? "").split(/[\n,,;;]+/).map((x) => x.trim()).filter(Boolean)) { + const m = /^(\d{4}-\d{1,2}-\d{1,2})(?:\s*(?:\.\.|~|~|至|-{2})\s*(\d{4}-\d{1,2}-\d{1,2}))?\s*(.*)$/.exec(part); + if (!m) continue; + const kind: CalEvent["kind"] = /补班|上班/.test(m[3]) ? "workday" : "holiday"; + out.push({ date: parseDate(m[1]), endDate: m[2] ? parseDate(m[2]) : "", title: m[3].trim() || (kind === "workday" ? "补班" : "假期"), kind, color: "" }); + } + return out; +} +function eventsOf(p: Project): CalEvent[] { + const rows = p.rows.filter((r) => r.include !== false && parseDate(r.date)).map((r) => ({ date: parseDate(r.date), endDate: parseDate(r.endDate), title: s(r.title), kind: kindOf(r.kind), color: /^#[0-9a-f]{6}$/i.test(s(r.color)) ? s(r.color) : "" })); + return [...rows, ...parseHolidayText(s(p.settings.holidays))]; +} +function optsOf(p: Project, layout: CalOpts["layout"]): CalOpts { + const st = p.settings; + return { year: Number(st.year) || new Date().getFullYear() + 1, startMonth: Math.min(12, Math.max(1, Number(st.startMonth) || 1)), months: Math.min(24, Math.max(1, Number(st.months) || 12)), layout, weekStart: s(st.weekStart) === "sun" ? 0 : 1, page: s(st.page) === "Letter" ? "Letter" : "A4", landscape: layout === "month" ? s(st.orientation) !== "portrait" : s(st.orientation) === "landscape", title: s(st.title), accent: s(st.accent) || "#0f766e", weekNumbers: st.weekNumbers === true, lang: (["zh", "en", "both"].includes(s(st.lang)) ? s(st.lang) : "both") as CalOpts["lang"] }; +} + +const def: AppDef = { + name: NAME, + version: VERSION, + prefix: "cal", + title: ["可打印日历", "Printable Calendar"], + openDescription: + "Make printable calendar PDFs: a monthly calendar (one month per page, big boxes with your events written in) and a year-at-a-glance page. Optionally pick an event list (CSV/XLSX with 日期/date, 结束日期/end date, 事项/title, 类型/type such as 活动, 假期 or 补班, 颜色/colour) and/or type holidays in settings (e.g. “2027-01-01 元旦, 2027-02-06..2027-02-12 春节”). Choose the year, starting month and number of months, Monday or Sunday week start, A4 or Letter, portrait or landscape, Chinese/English labels, ISO week numbers and a colour. Holidays are shaded and marked 休, make-up working days 班.", + inputs: { exts: [".csv", ".xlsx", ".tsv"], min: 0, max: 1, label: ["选择事件表(可选)", "Pick an event list (optional)"] }, + settings: [ + { key: "year", label: ["年份", "Year"], type: "number", default: new Date().getFullYear() + 1 }, + { key: "startMonth", label: ["从几月开始", "Start month"], type: "number", default: 1 }, + { key: "months", label: ["月数", "Number of months"], type: "number", default: 12 }, + { key: "weekStart", label: ["每周从", "Week starts on"], type: "select", default: "mon", options: [{ value: "mon", label: ["周一", "Monday"] }, { value: "sun", label: ["周日", "Sunday"] }] }, + { key: "page", label: ["纸张", "Paper"], type: "select", default: "A4", options: [{ value: "A4", label: ["A4", "A4"] }, { value: "Letter", label: ["Letter", "Letter"] }] }, + { key: "orientation", label: ["方向", "Orientation"], type: "select", default: "auto", options: [{ value: "auto", label: ["自动(月历横向、年历纵向)", "Auto (monthly landscape, year portrait)"] }, { value: "landscape", label: ["横向", "Landscape"] }, { value: "portrait", label: ["纵向", "Portrait"] }] }, + { key: "lang", label: ["文字", "Labels"], type: "select", default: "both", options: [{ value: "both", label: ["中英", "Chinese + English"] }, { value: "zh", label: ["中文", "Chinese"] }, { value: "en", label: ["英文", "English"] }] }, + { key: "title", label: ["标题(可选)", "Title (optional)"], type: "text", default: "" }, + { key: "accent", label: ["主题色", "Accent colour"], type: "color", default: "#0f766e" }, + { key: "weekNumbers", label: ["显示周数", "Show week numbers"], type: "bool", default: false }, + { key: "holidays", label: ["节假日(如 2027-01-01 元旦, 2027-02-06..2027-02-12 春节)", "Holidays (e.g. 2027-01-01 New Year)"], type: "textarea", default: "" }, + ], + columns: () => [ + { key: "include", label: ["显示", "Show"], type: "bool" }, + { key: "date", label: ["日期", "Date"] }, + { key: "endDate", label: ["结束日期", "End date"] }, + { key: "title", label: ["事项", "Title"], wide: true }, + { key: "kind", label: ["类型", "Type"], type: "select", options: ["活动", "假期", "补班"] }, + { key: "color", label: ["颜色", "Colour"] }, + ], + newRow: () => ({ include: true, date: "", endDate: "", title: "", kind: "活动", color: "" }), + async load({ ws, files, settings }) { + if (!files.length) return { rows: [] }; + const t = await readTable(ws, files[0]); + const m = mapHeaders(t.columns, { date: ["日期", "开始日期", "date", "start date", "day"], endDate: ["结束日期", "end date", "截止日期", "to"], title: ["事项", "标题", "名称", "活动", "title", "event", "name", "summary"], kind: ["类型", "分类", "type", "kind", "category"], color: ["颜色", "color", "colour"] }); + if (!m.date || !m.title) throw new KitError("no_columns", `Need a date (日期/date) and a title (事项/title) column. Columns: ${t.columns.join(", ")}`); + const rows: Row[] = t.rows.filter((r) => s(r[m.date!])).map((r) => ({ include: true, date: parseDate(r[m.date!]) || s(r[m.date!]), endDate: m.endDate ? parseDate(r[m.endDate]) : "", title: s(r[m.title!]), kind: KIND_LABEL[kindOf(m.kind ? r[m.kind] : "")], color: m.color ? s(r[m.color]) : "" })); + const years = new Map(); + for (const r of rows) { const y = Number(String(r.date).slice(0, 4)); if (y) years.set(y, (years.get(y) ?? 0) + 1); } + if (years.size && Number(settings.year) === new Date().getFullYear() + 1) settings.year = [...years].sort((a, b) => b[1] - a[1])[0][0]; + return { rows }; + }, + compute(p) { + const issues: Issue[] = []; + p.rows.forEach((r, i) => { + if (r.include === false) return; + if (!parseDate(r.date)) issues.push({ level: "error", row: i, key: "date", message: `Row ${i + 1}: “${r.date}” isn't a date.` }); + if (s(r.endDate) && parseDate(r.endDate) < parseDate(r.date)) issues.push({ level: "warn", row: i, key: "endDate", message: `${r.title}: ends before it starts.` }); + if (s(r.color) && !/^#[0-9a-f]{6}$/i.test(s(r.color))) issues.push({ level: "info", row: i, key: "color", message: `${r.title}: colour should look like #2563eb.` }); + }); + const o = optsOf(p, "year"); + const events = eventsOf(p); + const list = monthsOf(o); + const firstKey = iso(list[0].y, list[0].m, 1), lastKey = iso(list[list.length - 1].y, list[list.length - 1].m, 31); + const inRange = events.filter((e) => (e.endDate || e.date) >= firstKey && e.date <= lastKey); + if (events.length && !inRange.length) issues.push({ level: "warn", key: "year", message: `None of the events fall in ${firstKey.slice(0, 7)} – ${lastKey.slice(0, 7)} — check the year.` }); + const days = byDay(events); + const WD = ["日", "一", "二", "三", "四", "五", "六"]; + const mini = list.map(({ y, m }) => `
${y === list[0].y ? "" : `${y} `}${m} 月
${[0, 1, 2, 3, 4, 5, 6].map((c) => { const wd = (c + o.weekStart) % 7; return ``; }).join("")}${grid(y, m, o.weekStart).map((row) => `${row.map((d, c) => { if (!d) return ""; const ev = days.get(iso(y, m, d)) ?? []; const hol = ev.some((e) => e.kind === "holiday"); const work = ev.some((e) => e.kind === "workday"); const wd = (c + o.weekStart) % 7; const has = ev.find((e) => e.kind === "event"); return ``; }).join("")}`).join("")}
${WD[wd]}
${d}
`).join(""); + const preview = `
${mini}
`; + const hol = inRange.filter((e) => e.kind === "holiday").length, ev = inRange.filter((e) => e.kind === "event").length; + return { rows: p.rows, issues, preview, summary: `${list.length} months from ${firstKey.slice(0, 7)} · ${ev} events · ${hol} holidays`, stats: { months: list.length, events: ev, holidays: hol } }; + }, + exports: [ + { + id: "monthly", label: ["月历 PDF(每月一页)", "Monthly PDF (a page per month)"], description: "calendar--monthly.pdf", + async run({ project, write, computed }: ExportCtx) { + if ((computed.issues ?? []).some((i) => i.level === "error")) throw new KitError("has_errors", "Fix the errors first."); + const o = optsOf(project, "month"); + return [await write(`calendar-${o.year}-monthly.pdf`, await calendarPdf(eventsOf(project), o))]; + }, + }, + { + id: "year", label: ["年历 PDF(一页全年)", "Year-at-a-glance PDF"], description: "calendar--year.pdf", + async run({ project, write }: ExportCtx) { + const o = optsOf(project, "year"); + return [await write(`calendar-${o.year}-year.pdf`, await calendarPdf(eventsOf(project), o))]; + }, + }, + ], +}; + +export function createServer(options: { workspaceRoot: string; assetRoot: string; log?: (line: string) => void }) { + return createApp(def, options).server; +} From 574d9d5bb0dc48a400f55d4041d1537be68c38a7 Mon Sep 17 00:00:00 2001 From: ppppp2005-p <360128433+ppppp2005-p@users.noreply.github.com> Date: Thu, 26 Nov 2026 05:06:12 -0400 Subject: [PATCH 07/11] feat(ui-plugins): add Printable Calendar (printable-calendar) --- .../printable-calendar/test/app-edit.test.ts | 50 +++++++++++++ .../printable-calendar/test/cal.test.ts | 74 +++++++++++++++++++ ui-plugins/printable-calendar/test/e2e.json | 1 + .../test/workspace-links.test.ts | 43 +++++++++++ 4 files changed, 168 insertions(+) create mode 100644 ui-plugins/printable-calendar/test/app-edit.test.ts create mode 100644 ui-plugins/printable-calendar/test/cal.test.ts create mode 100644 ui-plugins/printable-calendar/test/e2e.json create mode 100644 ui-plugins/printable-calendar/test/workspace-links.test.ts diff --git a/ui-plugins/printable-calendar/test/app-edit.test.ts b/ui-plugins/printable-calendar/test/app-edit.test.ts new file mode 100644 index 00000000..f9fe0f53 --- /dev/null +++ b/ui-plugins/printable-calendar/test/app-edit.test.ts @@ -0,0 +1,50 @@ +import { mkdtempSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { describe, expect, it } from "vitest"; +import { createApp, resolveColumnKey, type AppDef } from "../src/kit/app.ts"; +import { connect } from "../src/kit/testing.ts"; + +// 回归测试:_edit 的 set.values 用列标题(如“月薪”)也要能改到对应的列;认不出的列名要明确警告,不能悄悄忽略。 +const cols = [ + { key: "c0", label: ["姓名", "Name"] as [string, string] }, + { key: "c1", label: ["月薪", "Monthly Salary"] as [string, string], type: "number" as const }, + { key: "c2", label: ["合计", "Total"] as [string, string], readOnly: true }, +]; +const def: AppDef = { + name: "edit-test", version: "0.0.1", prefix: "et", title: ["测试", "Test"], openDescription: "test", + inputs: { exts: [".csv"], min: 0, max: 1, label: ["", ""] }, + settings: [], + columns: () => cols, + newRow: () => ({ c0: "", c1: 0, c2: 0 }), + load: async () => ({ rows: [{ c0: "张三", c1: 8000, c2: 0 }, { c0: "李四", c1: 9000, c2: 0 }] }), + compute: (p) => ({ rows: p.rows, issues: [], summary: `${p.rows.length} rows`, stats: {} }), + exports: [{ id: "none", label: ["无", "None"], description: "nothing", run: async () => [] }], +}; + +describe("edit by column label", () => { + it("resolves keys, labels and loose labels", () => { + expect(resolveColumnKey(cols, "c1")).toBe("c1"); + expect(resolveColumnKey(cols, "月薪")).toBe("c1"); + expect(resolveColumnKey(cols, " 月 薪 ")).toBe("c1"); + expect(resolveColumnKey(cols, "monthly salary")).toBe("c1"); + expect(resolveColumnKey(cols, "Name")).toBe("c0"); + expect(resolveColumnKey(cols, "奖金")).toBeUndefined(); + expect(resolveColumnKey(cols, "hidden", { hidden: 1 })).toBe("hidden"); + }); + it("edits through the tool and warns about unknown keys", async () => { + const root = mkdtempSync(join(tmpdir(), "edit-")); + const c = await connect(createApp(def, { workspaceRoot: root, assetRoot: root }).server); + await c.call("et_open", { inputs: [], project: "p" }); + const e = await c.call("et_edit", { project: "p", set: [{ row: 0, values: { 月薪: "12000", " monthly salary ": 1 } }, { row: 1, values: { 姓名: "王五", 奖金: 500, Total: 1 } }], add: [{ Name: "赵六", 月薪: 7000, foo: 1 }] }); + const rows = e.data.rows as Record[]; + expect(rows[0].c1).toBe(1); + expect(rows[1]).toMatchObject({ c0: "王五", c1: 9000, c2: 0 }); + expect(rows[1]).not.toHaveProperty("奖金"); + expect(rows[2]).toMatchObject({ c0: "赵六", c1: 7000 }); + expect(rows[2]).not.toHaveProperty("foo"); + expect(e.text).toContain("Warning: ignored unknown column(s) “奖金”, “foo”"); + expect(e.text).toContain("c1 (月薪 / Monthly Salary)"); + expect(e.text).toContain("c2 is calculated and cannot be edited."); + }); +}); diff --git a/ui-plugins/printable-calendar/test/cal.test.ts b/ui-plugins/printable-calendar/test/cal.test.ts new file mode 100644 index 00000000..990addbe --- /dev/null +++ b/ui-plugins/printable-calendar/test/cal.test.ts @@ -0,0 +1,74 @@ +import { execFileSync } from "node:child_process"; +import { cp, mkdtemp, readFile } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; +import { PDFDocument } from "pdf-lib"; +import { describe, expect, it } from "vitest"; +import { byDay, grid, isoWeek } from "../src/cal.ts"; +import { connect } from "../src/kit/testing.ts"; +import { createServer, parseHolidayText } from "../src/server.ts"; + +const HERE = dirname(fileURLToPath(import.meta.url)); + +describe("calendar maths", () => { + it("lays out a month", () => { + const g = grid(2027, 2, 1); // 2027-02-01 是周一 + expect(g[0][0]).toBe(1); + expect(g).toHaveLength(4); + const s = grid(2027, 2, 0); + expect(s[0][1]).toBe(1); + expect(grid(2026, 8, 1)).toHaveLength(6); // 2026-08-01 周六 + }); + it("counts ISO weeks", () => { + expect(isoWeek(2027, 1, 1)).toBe(53); + expect(isoWeek(2027, 1, 4)).toBe(1); + expect(isoWeek(2026, 12, 31)).toBe(53); + }); + it("expands multi-day events and parses holidays", () => { + const d = byDay([{ date: "2027-01-30", endDate: "2027-02-02", title: "x", kind: "holiday", color: "" }]); + expect([...d.keys()]).toEqual(["2027-01-30", "2027-01-31", "2027-02-01", "2027-02-02"]); + expect(parseHolidayText("2027-01-01 元旦, 2027-02-06..2027-02-12 春节\n2027-02-20 补班")).toEqual([ + { date: "2027-01-01", endDate: "", title: "元旦", kind: "holiday", color: "" }, + { date: "2027-02-06", endDate: "2027-02-12", title: "春节", kind: "holiday", color: "" }, + { date: "2027-02-20", endDate: "", title: "补班", kind: "workday", color: "" }, + ]); + }); +}); + +describe("calendar tools", () => { + it("makes monthly and yearly PDFs", async () => { + const root = await mkdtemp(join(tmpdir(), "cal-")); + await cp(join(HERE, "samples"), root, { recursive: true }); + const c = await connect(createServer({ workspaceRoot: root, assetRoot: root })); + const o = await c.call("cal_open", { inputs: ["events.csv"], project: "y", settings: { title: "青禾 2027" } }); + expect(o.data.stats).toMatchObject({ months: 12, events: 7, holidays: 5 }); + expect(o.text).toContain("12 months from 2027-01"); + const rows = o.data.rows as Record[]; + expect(rows[1]).toMatchObject({ date: "2027-02-06", endDate: "2027-02-12", kind: "假期" }); + expect(rows[9]).toMatchObject({ kind: "补班" }); + await c.call("cal_edit", { project: "y", settings: { weekNumbers: true, holidays: "2027-06-09 端午(示例)" } }); + await c.call("cal_export", { project: "y" }); + const mp = join(root, "printable-calendar/y/calendar-2027-monthly.pdf"); + const doc = await PDFDocument.load(await readFile(mp)); + expect(doc.getPageCount()).toBe(12); + const { width, height } = doc.getPage(0).getSize(); + expect(width).toBeGreaterThan(height); + const t1 = execFileSync("pdftotext", ["-f", "1", "-l", "1", "-layout", mp, "-"]).toString(); + expect(t1).toContain("2027 年 1 月"); + expect(t1).toContain("项目启动会"); + expect(t1).toContain("W53"); + const t6 = execFileSync("pdftotext", ["-f", "6", "-l", "6", mp, "-"]).toString(); + expect(t6).toContain("端午(示例)"); + const yp = join(root, "printable-calendar/y/calendar-2027-year.pdf"); + const ydoc = await PDFDocument.load(await readFile(yp)); + expect(ydoc.getPageCount()).toBe(1); + expect(execFileSync("pdftotext", [yp, "-"]).toString()).toContain("年会"); + // 不选文件也能出日历 + const blank = await c.call("cal_open", { inputs: [], project: "b", settings: { year: 2028, startMonth: 9, months: 6, lang: "en", weekStart: "sun" } }); + expect(blank.text).toContain("6 months from 2028-09"); + await c.call("cal_export", { project: "b", formats: ["monthly"] }); + const bt = execFileSync("pdftotext", ["-f", "5", "-l", "5", join(root, "printable-calendar/b/calendar-2028-monthly.pdf"), "-"]).toString(); + expect(bt).toContain("January 2029"); + }); +}); diff --git a/ui-plugins/printable-calendar/test/e2e.json b/ui-plugins/printable-calendar/test/e2e.json new file mode 100644 index 00000000..18e08618 --- /dev/null +++ b/ui-plugins/printable-calendar/test/e2e.json @@ -0,0 +1 @@ +{ "prefix": "cal", "folder": "日历", "pick": ["events.csv"], "startSettings": { "title": "青禾 2027" }, "uiEdit": { "row": 2, "key": "title", "value": "项目启动会(上午)" }, "expectText": "12 months from 2027-01", "expectFiles": ["calendar-2027-monthly\\.pdf$", "calendar-2027-year\\.pdf$"] } diff --git a/ui-plugins/printable-calendar/test/workspace-links.test.ts b/ui-plugins/printable-calendar/test/workspace-links.test.ts new file mode 100644 index 00000000..f3dae538 --- /dev/null +++ b/ui-plugins/printable-calendar/test/workspace-links.test.ts @@ -0,0 +1,43 @@ +import { existsSync, mkdirSync, mkdtempSync, symlinkSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { describe, expect, it } from "vitest"; +import { Workspace } from "../src/kit/workspace.ts"; + +// 回归测试:工作区里的符号链接不能把读写带到工作区之外(TEST-FINDINGS #2) +describe("workspace symlink containment", () => { + const base = mkdtempSync(join(tmpdir(), "wslinks-")); + const root = join(base, "项目 ws"), outside = join(base, "outside"); + mkdirSync(join(root, "inner"), { recursive: true }); + mkdirSync(outside, { recursive: true }); + writeFileSync(join(outside, "secret.txt"), "SECRET"); + writeFileSync(join(root, "inner", "ok.txt"), "ok"); + symlinkSync(outside, join(root, "out-link")); + symlinkSync(join(outside, "secret.txt"), join(root, "secret-link.txt")); + symlinkSync(join(outside, "new-file.txt"), join(root, "dangling.txt")); + symlinkSync(join(root, "inner"), join(root, "inner-link")); + symlinkSync(root, join(base, "root-link")); + const ws = new Workspace(root); + + it("refuses to read through a link to outside (directory and file links)", async () => { + await expect(ws.read("out-link/secret.txt")).rejects.toMatchObject({ code: "outside_workspace" }); + await expect(ws.read("secret-link.txt")).rejects.toMatchObject({ code: "outside_workspace" }); + expect(await ws.exists("out-link/secret.txt")).toBe(false); + }); + it("refuses to write through a link, including to targets that do not exist yet", async () => { + await expect(ws.write("out-link/a/b/new.txt", "x")).rejects.toMatchObject({ code: "outside_workspace" }); + await expect(ws.write("dangling.txt", "x")).rejects.toMatchObject({ code: "outside_workspace" }); + expect(existsSync(join(outside, "a"))).toBe(false); + expect(existsSync(join(outside, "new-file.txt"))).toBe(false); + }); + it("still allows normal paths, new nested files and links that stay inside", async () => { + expect(await ws.write("新 目录/子/文件.txt", "中文")).toBe("新 目录/子/文件.txt"); + expect((await ws.read("inner-link/ok.txt")).toString()).toBe("ok"); + await expect(ws.read("../outside/secret.txt")).rejects.toMatchObject({ code: "outside_workspace" }); + }); + it("works when the workspace root itself is reached through a link", async () => { + const viaLink = new Workspace(join(base, "root-link")); + expect((await viaLink.read("inner/ok.txt")).toString()).toBe("ok"); + await expect(viaLink.read("out-link/secret.txt")).rejects.toMatchObject({ code: "outside_workspace" }); + }); +}); From 6e4072caccce517c5687d644b279eb1236a713a4 Mon Sep 17 00:00:00 2001 From: ppppp2005-p <360128433+ppppp2005-p@users.noreply.github.com> Date: Thu, 26 Nov 2026 05:06:57 -0400 Subject: [PATCH 08/11] feat(ui-plugins): add Printable Calendar (printable-calendar) --- ui-plugins/printable-calendar/ui/app.css | 39 ++++ ui-plugins/printable-calendar/ui/app.ts | 236 ++++++++++++++++++++++ ui-plugins/printable-calendar/ui/env.d.ts | 4 + ui-plugins/printable-calendar/ui/kit.css | 34 ++++ ui-plugins/printable-calendar/ui/kit.ts | 133 ++++++++++++ ui-plugins/printable-calendar/ui/main.ts | 3 + 6 files changed, 449 insertions(+) create mode 100644 ui-plugins/printable-calendar/ui/app.css create mode 100644 ui-plugins/printable-calendar/ui/app.ts create mode 100644 ui-plugins/printable-calendar/ui/env.d.ts create mode 100644 ui-plugins/printable-calendar/ui/kit.css create mode 100644 ui-plugins/printable-calendar/ui/kit.ts create mode 100644 ui-plugins/printable-calendar/ui/main.ts diff --git a/ui-plugins/printable-calendar/ui/app.css b/ui-plugins/printable-calendar/ui/app.css new file mode 100644 index 00000000..19894635 --- /dev/null +++ b/ui-plugins/printable-calendar/ui/app.css @@ -0,0 +1,39 @@ +.top { display:flex; align-items:baseline; gap:10px; } +.files { max-height: 260px; overflow:auto; border:1px solid var(--line); border-radius:6px; padding:4px; background:var(--bg); } +.file { padding:2px 4px; font-size:12px; word-break: break-all; } +.filter { width:100%; margin-bottom:6px; } +.settings { display:grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap:6px 12px; } +.set { justify-content: space-between; } +.set span { color: var(--muted); } +.set input[type=text], .set input[type=number], .set select, .set textarea, .set input[type=date] { width: 60%; } +.set-textarea { grid-column: 1 / -1; align-items: flex-start; } +.set-textarea textarea { width: 80%; } +.head .pname { font-weight:600; } +.summary { margin:8px 0 4px; } +.chips { display:flex; flex-wrap:wrap; gap:6px; margin:4px 0 8px; } +.chip { background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:1px 8px; font-size:12px; } +.issues { margin:6px 0; } +.issues ul { margin:4px 0; padding-left:18px; max-height:180px; overflow:auto; } +.issues li { cursor:pointer; } +.lvl-error { color: var(--bad); } .lvl-warn { color: var(--warn); } +.split2 { display:grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap:10px; align-items:start; } +.split2 .previewcol:empty { display:none; } +.split2:has(.previewcol:empty) { grid-template-columns: 1fr; } +@media (max-width: 900px) { .split2 { grid-template-columns: 1fr; } } +.tablewrap { overflow:auto; max-height: 60vh; border:1px solid var(--line); border-radius:6px; } +table.edit { font-size:12px; } +table.edit td { padding:1px 2px; } +table.edit th { position: sticky; top: 0; z-index: 1; white-space: nowrap; } +table.edit td input[type=text], table.edit td select { width:100%; min-width:70px; border-color: transparent; background: transparent; padding:2px 4px; } +table.edit td input:focus, table.edit td select:focus { border-color: var(--accent); background: var(--bg); } +table.edit td.wide input { min-width: 200px; } +table.edit td.ro { color: var(--muted); padding: 2px 6px; white-space: nowrap; } +table.edit .num { text-align: right; } +table.edit td.idx { color: var(--muted); text-align: right; padding: 2px 4px; } +table.edit tr.warn td.idx { background: var(--warnbg); } +table.edit tr.err td.idx { background: var(--badbg); color: var(--bad); } +table.edit tr.focus td { outline: 1px solid var(--accent); } +button.del { padding: 0 6px; } +.preview { border:1px solid var(--line); border-radius:6px; padding:8px; background: var(--bg); overflow:auto; max-height: 75vh; } +.preview img, .preview svg { max-width: 100%; height: auto; } +.exported ul { margin: 4px 0; padding-left: 18px; font-size: 12px; } diff --git a/ui-plugins/printable-calendar/ui/app.ts b/ui-plugins/printable-calendar/ui/app.ts new file mode 100644 index 00000000..dba63195 --- /dev/null +++ b/ui-plugins/printable-calendar/ui/app.ts @@ -0,0 +1,236 @@ +import css from "./kit.css"; +import appCss from "./app.css"; +import { applyTheme, call, h, initHost, locale, onHostContext, onToolResult, put, toast, updateContext } from "./kit.ts"; + +type L = [string, string]; +interface Field { key: string; label: L; type: string; options?: { value: string; label: L }[]; default?: unknown; help?: L; min?: number; max?: number } +interface Column { key: string; label: L; type?: string; options?: string[]; readOnly?: boolean; wide?: boolean } +interface Issue { level: string; message: string; row?: number; key?: string } +interface Info { app: string; prefix: string; title: L; inputs: { exts: string[]; min: number; max: number; label: L; folders?: boolean }; settings: Field[]; exports: { id: string; label: L; description: string }[]; files: string[]; folders: string[]; projects: string[] } +interface View { project: string; inputs: string[]; settings: Record; columns: Column[]; rows: Record[]; totalRows: number; canAdd: boolean; issues: Issue[]; summary: string; stats: Record; preview: string; exported: string[]; justExported?: string[] } + +const T = (l: L | undefined) => (l ? (locale() === "zh" ? l[0] : l[1]) : ""); +const t = (zh: string, en: string) => (locale() === "zh" ? zh : en); +const PAGE = 100; + +export function startApp(name: string, version: string) { + const style = document.createElement("style"); + style.textContent = css + appCss; + document.head.append(style); + const root = document.getElementById("root")!; + const state: { info?: Info; view?: View; picked: Set; filter: string; page: number; startSettings: Record; focusRow?: number; mode: "start" | "project" } = { picked: new Set(), filter: "", page: 0, startSettings: {}, mode: "start" }; + + async function busy(work: () => Promise, label: string): Promise { + root.classList.add("busy"); + const st = document.getElementById("status"); + if (st) st.textContent = label; + try { + return await work(); + } catch (error) { + toast(error instanceof Error ? error.message : String(error), "error"); + return undefined; + } finally { + root.classList.remove("busy"); + const s2 = document.getElementById("status"); + if (s2) s2.textContent = ""; + } + } + const P = () => state.info?.prefix ?? name; + function show(v: Record) { + const prev = state.view?.project; + state.view = v as unknown as View; + state.mode = "project"; + if (prev !== state.view.project) state.page = 0; + render(); + } + onToolResult((v) => { + if (v?.kind === "project" && v.app === name) show(v); + }); + + async function refreshInfo() { + const info = await call("app_info", {}); + state.info = info; + render(); + } + + function fieldInput(f: Field, value: unknown, onChange: (v: unknown) => void) { + const v = value ?? f.default ?? ""; + if (f.type === "bool") return h("input", { type: "checkbox", checked: !!v, "data-key": f.key, onchange: (e: Event) => onChange((e.target as HTMLInputElement).checked) }); + if (f.type === "select") + return h("select", { "data-key": f.key, onchange: (e: Event) => onChange((e.target as HTMLSelectElement).value) }, ...(f.options ?? []).map((o) => h("option", { value: o.value, selected: String(v) === o.value }, T(o.label)))); + if (f.type === "textarea") return h("textarea", { rows: 3, "data-key": f.key, value: String(v), onchange: (e: Event) => onChange((e.target as HTMLTextAreaElement).value) }); + return h("input", { + type: f.type === "number" ? "number" : f.type === "color" ? "color" : f.type === "date" ? "date" : "text", + "data-key": f.key, + value: String(v), + min: f.min, + max: f.max, + step: f.type === "number" ? "any" : undefined, + onchange: (e: Event) => onChange(f.type === "number" ? Number((e.target as HTMLInputElement).value) : (e.target as HTMLInputElement).value), + }); + } + function settingsForm(values: Record, onChange: (key: string, v: unknown) => void) { + const fields = state.info?.settings ?? []; + if (!fields.length) return null; + return h("div", { class: "settings" }, ...fields.map((f) => h("label", { class: `set set-${f.type}`, title: T(f.help) }, h("span", {}, T(f.label)), fieldInput(f, values[f.key], (v) => onChange(f.key, v))))); + } + + function renderStart() { + const info = state.info; + if (!info) return h("div", { class: "empty" }, t("正在连接…", "Connecting…")); + const list = info.inputs.folders ? info.folders : info.files; + const shown = list.filter((f) => !state.filter || f.toLowerCase().includes(state.filter.toLowerCase())).slice(0, 400); + const needs = info.inputs.min; + const open = () => + busy(async () => { + const r = await call(`${P()}_open`, { inputs: [...state.picked], settings: state.startSettings }); + show(r); + }, t("正在读取…", "Reading…")); + return h( + "div", + { class: "start" }, + h("div", { class: "card" }, + h("h2", {}, T(info.inputs.label)), + needs === 0 && !list.length ? h("p", { class: "muted" }, t("这个工具不需要输入文件,直接点“开始”。", "No input file needed — just press Start.")) : null, + list.length > 8 ? h("input", { class: "filter", placeholder: t("筛选文件…", "Filter files…"), value: state.filter, oninput: (e: Event) => { state.filter = (e.target as HTMLInputElement).value; render(); } }) : null, + list.length + ? h("div", { class: "files" }, ...shown.map((f) => h("label", { class: "file" }, h("input", { type: info.inputs.max === 1 ? "radio" : "checkbox", name: "pick", checked: state.picked.has(f), onchange: (e: Event) => { if (info.inputs.max === 1) state.picked.clear(); if ((e.target as HTMLInputElement).checked) state.picked.add(f); else state.picked.delete(f); render(); } }), h("span", {}, f)))) + : needs > 0 ? h("div", { class: "empty" }, t(`工作区里没有 ${info.inputs.exts.join(" / ")} 文件。把文件放进项目文件夹,或让助手帮你处理。`, `No ${info.inputs.exts.join(" / ")} files in the workspace yet. Add some to the project folder or ask the assistant.`)) : null, + ), + info.settings.length ? h("div", { class: "card" }, h("h2", {}, t("设置", "Settings")), settingsForm(state.startSettings, (k, v) => { state.startSettings[k] = v; })) : null, + h("div", { class: "row" }, + h("button", { class: "primary open", disabled: state.picked.size < needs || state.picked.size > info.inputs.max, onclick: open }, needs === 0 && !state.picked.size ? t("开始", "Start") : t(`打开(${state.picked.size})`, `Open (${state.picked.size})`)), + h("button", { onclick: () => busy(refreshInfo, "") }, t("刷新文件列表", "Refresh files")), + ), + info.projects.length + ? h("div", { class: "card" }, h("h2", {}, t("已保存的项目", "Saved projects")), h("div", { class: "row" }, ...info.projects.map((p) => h("button", { class: "proj", onclick: () => busy(async () => show(await call(`${P()}_status`, { project: p })), "") }, p)))) + : null, + ); + } + + let editQueue: Promise = Promise.resolve(); + function edit(args: Record) { + const v = state.view!; + editQueue = editQueue + .then(async () => { + const r = await call(`${P()}_edit`, { project: v.project, ...args }); + state.view = r as unknown as View; + renderProjectParts(); + }) + .catch((e) => toast(String((e as Error)?.message ?? e), "error")); + return editQueue; + } + + function cell(c: Column, row: Record, index: number) { + const value = row[c.key]; + if (c.readOnly) return h("td", { "data-key": c.key, class: `ro ${c.type === "number" ? "num" : ""}` }, typeof value === "number" ? fmtNum(value) : String(value ?? "")); + const onChange = (v: unknown) => edit({ set: [{ row: index, values: { [c.key]: v } }] }); + let input: HTMLElement; + if (c.type === "bool") input = h("input", { type: "checkbox", checked: !!value, onchange: (e: Event) => onChange((e.target as HTMLInputElement).checked) }); + else if (c.type === "select") input = h("select", { onchange: (e: Event) => onChange((e.target as HTMLSelectElement).value) }, ...[...new Set([String(value ?? ""), ...(c.options ?? [])])].map((o) => h("option", { value: o, selected: o === String(value ?? "") }, o))); + else input = h("input", { type: "text", class: c.type === "number" ? "num" : "", value: String(value ?? ""), onchange: (e: Event) => onChange((e.target as HTMLInputElement).value) }); + return h("td", { "data-key": c.key, class: c.wide ? "wide" : "" }, input); + } + const fmtNum = (n: number) => (Number.isInteger(n) ? String(n) : n.toFixed(2)); + + function tableEl() { + const v = state.view!; + const issuesByRow = new Map(); + for (const i of v.issues) if (i.row !== undefined) issuesByRow.set(i.row, [...(issuesByRow.get(i.row) ?? []), i]); + const pages = Math.max(1, Math.ceil(v.rows.length / PAGE)); + state.page = Math.min(state.page, pages - 1); + const start = state.page * PAGE; + const slice = v.rows.slice(start, start + PAGE); + if (!v.rows.length) return h("div", { class: "empty" }, t("没有数据行。", "No rows.")); + return h("div", {}, + h("div", { class: "tablewrap" }, + h("table", { class: "data edit" }, + h("thead", {}, h("tr", {}, h("th", {}, "#"), ...v.columns.map((c) => h("th", { class: c.readOnly ? "ro" : "" }, T(c.label))), v.canAdd ? h("th", {}, "") : null)), + h("tbody", {}, ...slice.map((row, k) => { + const index = start + k; + const iss = issuesByRow.get(index); + return h("tr", { class: `${iss?.some((i) => i.level === "error") ? "err" : iss ? "warn" : ""} ${state.focusRow === index ? "focus" : ""}`, "data-row": index, title: iss?.map((i) => i.message).join("\n") }, + h("td", { class: "idx" }, String(index)), ...v.columns.map((c) => cell(c, row, index)), + v.canAdd ? h("td", {}, h("button", { class: "del", title: t("删除这一行", "Delete row"), onclick: () => edit({ remove: [index] }) }, "×")) : null); + })), + ), + ), + h("div", { class: "row" }, + pages > 1 ? h("span", { class: "pager" }, h("button", { disabled: state.page === 0, onclick: () => { state.page--; renderProjectParts(); } }, "‹"), ` ${state.page + 1} / ${pages} `, h("button", { disabled: state.page >= pages - 1, onclick: () => { state.page++; renderProjectParts(); } }, "›")) : null, + v.totalRows > v.rows.length ? h("span", { class: "muted" }, t(`面板显示前 ${v.rows.length} 行,共 ${v.totalRows} 行`, `Showing ${v.rows.length} of ${v.totalRows} rows`)) : null, + v.canAdd ? h("button", { class: "add", onclick: () => edit({ add: [{}] }) }, t("+ 新增一行", "+ Add row")) : null, + ), + ); + } + + function issuesEl() { + const v = state.view!; + if (!v.issues.length) return h("div", { class: "issues ok" }, h("span", { class: "badge ok" }, t("没有发现问题", "No issues"))); + const counts = { error: 0, warn: 0, info: 0 } as Record; + for (const i of v.issues) counts[i.level] = (counts[i.level] ?? 0) + 1; + return h("details", { class: "issues", open: v.issues.length <= 12 }, + h("summary", {}, counts.error ? h("span", { class: "badge bad" }, t(`${counts.error} 个错误`, `${counts.error} error(s)`)) : null, " ", counts.warn ? h("span", { class: "badge" }, t(`${counts.warn} 个提醒`, `${counts.warn} warning(s)`)) : null, " ", counts.info ? h("span", { class: "badge ok" }, t(`${counts.info} 条说明`, `${counts.info} note(s)`)) : null), + h("ul", {}, ...v.issues.slice(0, 200).map((i) => h("li", { class: `lvl-${i.level}`, onclick: () => { if (i.row !== undefined) { state.focusRow = i.row; state.page = Math.floor(i.row / PAGE); renderProjectParts(); document.querySelector(`tr[data-row="${i.row}"]`)?.scrollIntoView({ block: "center" }); } } }, i.row !== undefined ? h("b", {}, `#${i.row} `) : null, i.key ? h("code", {}, i.key) : null, " ", i.message))), + ); + } + + function exportsEl() { + const v = state.view!; + const info = state.info; + const run = (formats?: string[]) => + busy(async () => { + const r = await call(`${P()}_export`, { project: v.project, ...(formats ? { formats } : {}) }, 900_000); + state.view = r as unknown as View; + renderProjectParts(); + toast(t(`已导出 ${state.view.exported.length} 个文件`, `Exported ${state.view.exported.length} file(s)`)); + updateContext(`User exported ${v.project}: ${state.view.exported.join(", ")}`).catch(() => undefined); + }, t("正在导出…", "Exporting…")); + return h("div", { class: "card exports" }, + h("h2", {}, t("导出", "Export")), + h("div", { class: "row" }, ...(info?.exports ?? []).map((e) => h("button", { class: "exp", title: e.description, "data-id": e.id, onclick: () => run([e.id]) }, T(e.label))), (info?.exports.length ?? 0) > 1 ? h("button", { class: "primary expall", onclick: () => run() }, t("全部导出", "Export all")) : null), + v.exported.length ? h("div", { class: "exported" }, h("div", { class: "muted" }, t("已导出:", "Exported:")), h("ul", {}, ...v.exported.map((f) => h("li", {}, h("code", {}, f))))) : null, + ); + } + + function renderProjectParts() { + const v = state.view; + if (!v) return; + const parts: Record Node | null> = { + summary: () => h("div", {}, h("div", { class: "summary" }, v.summary), Object.keys(v.stats).length ? h("div", { class: "chips" }, ...Object.entries(v.stats).map(([k, s]) => h("span", { class: "chip" }, h("b", {}, String(s)), " ", k))) : null), + issues: issuesEl, + table: tableEl, + preview: () => (v.preview ? (() => { const d = h("div", { class: "preview" }); d.innerHTML = v.preview; return d; })() : null), + exports: exportsEl, + }; + for (const [id, make] of Object.entries(parts)) { + const el = document.getElementById(`part-${id}`); + if (el) put(el, make()); + } + } + + function renderProject() { + const v = state.view!; + return h("div", { class: "project" }, + h("div", { class: "row head" }, + h("span", { class: "pname" }, v.project), + v.inputs.length ? h("span", { class: "muted" }, v.inputs.length > 3 ? t(`${v.inputs.length} 个输入`, `${v.inputs.length} inputs`) : v.inputs.join(" · ")) : null, + h("button", { class: "back", onclick: () => { state.mode = "start"; busy(refreshInfo, ""); } }, t("← 换文件", "← Other files")), + ), + state.info?.settings.length ? h("details", { class: "card", open: true }, h("summary", {}, t("设置", "Settings")), settingsForm(v.settings, (k, val) => edit({ settings: { [k]: val } }))) : null, + h("div", { id: "part-summary" }), + h("div", { id: "part-issues" }), + h("div", { class: "split2" }, h("div", { id: "part-table", class: "tablecol" }), h("div", { id: "part-preview", class: "previewcol" })), + h("div", { id: "part-exports" }), + ); + } + + function render() { + const title = state.info ? T(state.info.title) : name; + put(root, h("div", { class: "top" }, h("h1", {}, title), h("span", { id: "status", class: "muted" })), state.mode === "project" && state.view ? renderProject() : renderStart()); + if (state.mode === "project") renderProjectParts(); + } + + onHostContext(() => { applyTheme(); render(); }); + render(); + initHost(name, version).then(() => { applyTheme(); refreshInfo().catch((e) => toast(String(e?.message ?? e), "error")); }); +} diff --git a/ui-plugins/printable-calendar/ui/env.d.ts b/ui-plugins/printable-calendar/ui/env.d.ts new file mode 100644 index 00000000..4210a464 --- /dev/null +++ b/ui-plugins/printable-calendar/ui/env.d.ts @@ -0,0 +1,4 @@ +declare module "*.css" { + const text: string; + export default text; +} diff --git a/ui-plugins/printable-calendar/ui/kit.css b/ui-plugins/printable-calendar/ui/kit.css new file mode 100644 index 00000000..398bc83a --- /dev/null +++ b/ui-plugins/printable-calendar/ui/kit.css @@ -0,0 +1,34 @@ +:root { --bg:#fff; --fg:#1d1f23; --muted:#6b7280; --line:#e5e7eb; --panel:#f7f7f8; --accent:#2563eb; --warn:#b45309; --warnbg:#fef3c7; --bad:#b91c1c; --badbg:#fee2e2; --okbg:#dcfce7; --ok:#15803d; } +[data-theme="dark"] { --bg:#18191b; --fg:#e8e8ea; --muted:#9ca3af; --line:#2e3035; --panel:#222327; --accent:#60a5fa; --warn:#fbbf24; --warnbg:#3b2f10; --bad:#f87171; --badbg:#3b1717; --okbg:#12301d; --ok:#4ade80; } +* { box-sizing: border-box; } +html, body { margin:0; background:var(--bg); color:var(--fg); font:13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; } +#root { padding: 12px; } +h1 { font-size: 15px; margin: 0 0 8px; } +h2 { font-size: 13px; margin: 14px 0 6px; color: var(--muted); font-weight: 600; text-transform: none; } +button { font: inherit; border:1px solid var(--line); background:var(--panel); color:var(--fg); border-radius:6px; padding:5px 10px; cursor:pointer; } +button.primary { background:var(--accent); border-color:var(--accent); color:#fff; } +button:disabled { opacity:.5; cursor:default; } +input, select, textarea { font: inherit; color: var(--fg); background: var(--bg); border:1px solid var(--line); border-radius:5px; padding:4px 6px; } +input[type="color"] { padding: 0; width: 32px; height: 26px; } +input[type="range"] { padding: 0; } +label { display:flex; gap:6px; align-items:center; } +.row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin: 6px 0; } +.muted { color: var(--muted); } +.card { border:1px solid var(--line); border-radius:8px; padding:10px; background:var(--panel); margin: 8px 0; } +.grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:8px; } +.thumb { border:1px solid var(--line); border-radius:6px; overflow:hidden; background: var(--bg); cursor:pointer; position:relative; } +.thumb img { width:100%; display:block; aspect-ratio:1; object-fit:contain; background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 50% / 16px 16px; } +.thumb .cap { padding:4px 6px; font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } +.thumb.selected { outline: 2px solid var(--accent); } +.badge { display:inline-block; font-size:11px; padding:1px 6px; border-radius:10px; background:var(--warnbg); color:var(--warn); } +.badge.bad { background: var(--badbg); color: var(--bad); } +.badge.ok { background: var(--okbg); color: var(--ok); } +table.data { border-collapse: collapse; width: 100%; } +table.data td, table.data th { border:1px solid var(--line); padding:3px 6px; text-align:left; vertical-align:top; } +table.data th { background: var(--panel); } +.toast { position: fixed; right: 12px; bottom: 12px; padding: 8px 12px; border-radius: 6px; background: var(--okbg); color: var(--ok); z-index: 10; max-width: 80%; } +.toast.error { background: var(--badbg); color: var(--bad); } +.empty { padding: 24px; text-align:center; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; } +.busy { opacity:.6; pointer-events:none; } +.split { display:grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; } +@media (max-width: 640px) { .split { grid-template-columns: 1fr; } } diff --git a/ui-plugins/printable-calendar/ui/kit.ts b/ui-plugins/printable-calendar/ui/kit.ts new file mode 100644 index 00000000..b0646f25 --- /dev/null +++ b/ui-plugins/printable-calendar/ui/kit.ts @@ -0,0 +1,133 @@ +import { App } from "@modelcontextprotocol/ext-apps"; + +export class ToolError extends Error { + readonly code: string; + constructor(code: string, message: string) { + super(message); + this.code = code; + } +} + +let app: App | undefined; +let connection: Promise | undefined; +let created!: () => void; +const appCreated = new Promise((resolve) => (created = resolve)); +const resultListeners = new Set<(value: Record | undefined, tool?: string) => void>(); +const contextListeners = new Set<() => void>(); + +export function initHost(name: string, version: string) { + app = new App({ name, version }, { availableDisplayModes: ["inline", "fullscreen"] }); + app.ontoolresult = (result) => { + const content = result.structuredContent as Record | undefined; + resultListeners.forEach((listener) => listener(content)); + }; + app.onhostcontextchanged = () => contextListeners.forEach((listener) => listener()); + created(); + return ready(); +} + +export function ready(): Promise { + if (!app) return appCreated.then(() => ready()); + return (connection ??= app.connect().then(() => contextListeners.forEach((listener) => listener()))); +} + +export function onToolResult(listener: (value: Record | undefined) => void) { + resultListeners.add(listener); +} + +export function onHostContext(listener: () => void) { + contextListeners.add(listener); +} + +export function hostContext() { + return app?.getHostContext(); +} + +export function locale(): "zh" | "en" { + const fromHost = (app?.getHostContext()?.locale as string | undefined) ?? navigator.language ?? "en"; + return /^zh/i.test(fromHost) ? "zh" : "en"; +} + +export async function call>(name: string, args: Record = {}, timeout = 300_000): Promise { + await ready(); + let result; + try { + result = await app!.callServerTool({ name, arguments: args }, { timeout }); + } catch (error) { + throw new ToolError("host_error", error instanceof Error ? error.message : String(error)); + } + const content = result.structuredContent as Record | undefined; + const error = content?.error as { code?: string; message?: string } | undefined; + if (result.isError || error) { + const text = (result.content?.[0] as { text?: string } | undefined)?.text; + throw new ToolError(error?.code ?? "tool_error", error?.message ?? text ?? "The tool failed."); + } + return (content ?? {}) as T; +} + +/** 读取插件资源(二进制)。 */ +export async function readBlob(uri: string): Promise { + await ready(); + const result = await app!.readServerResource({ uri }); + const first = result.contents[0] as { blob?: string; text?: string } | undefined; + if (typeof first?.blob !== "string") throw new ToolError("host_error", first?.text?.slice(0, 300) ?? `Empty resource ${uri}`); + return base64ToBytes(first.blob); +} + +export function base64ToBytes(base64: string): Uint8Array { + const binary = atob(base64); + const bytes = new Uint8Array(binary.length); + for (let index = 0; index < binary.length; index++) bytes[index] = binary.charCodeAt(index); + return bytes; +} + +/** 由用户点击触发:把一句话发到对话里交给 Agent。 */ +export async function sendMessage(text: string) { + await ready(); + return app!.sendMessage({ role: "user", content: [{ type: "text", text }] }); +} + +export async function updateContext(text: string) { + await ready(); + return app!.updateModelContext({ content: [{ type: "text", text }] }); +} + +type Child = Node | string | number | null | undefined | false; +/** 极简 DOM 构建器。 */ +export function h( + tag: K, + props: Record = {}, + ...children: (Child | Child[])[] +): HTMLElementTagNameMap[K] { + const element = document.createElement(tag); + for (const [key, value] of Object.entries(props)) { + if (value === undefined || value === null || value === false) continue; + if (key.startsWith("on") && typeof value === "function") element.addEventListener(key.slice(2).toLowerCase(), value as EventListener); + else if (key === "class") element.className = String(value); + else if (key === "style" && typeof value === "object") Object.assign(element.style, value); + else if (key === "value" || (key in element && typeof value !== "string")) (element as any)[key] = value; + else element.setAttribute(key, value === true ? "" : String(value)); + } + for (const child of children.flat()) { + if (child === null || child === undefined || child === false) continue; + element.append(child instanceof Node ? child : String(child)); + } + return element; +} + +export function toast(message: string, kind: "ok" | "error" = "ok") { + const node = h("div", { class: `toast ${kind}`, role: "status" }, message); + document.body.append(node); + setTimeout(() => node.remove(), kind === "error" ? 6000 : 3000); +} + +/** 主题:跟随宿主的浅色 / 深色。 */ +export function applyTheme() { + const theme = (app?.getHostContext()?.theme as string | undefined) ?? "light"; + document.documentElement.dataset.theme = theme === "dark" ? "dark" : "light"; +} + +/** replaceChildren,跳过 null / false。 */ +export function put(element: Element, ...children: (Node | string | null | undefined | false)[]) { + element.replaceChildren(...(children.filter((c) => c !== null && c !== undefined && c !== false) as (Node | string)[])); +} diff --git a/ui-plugins/printable-calendar/ui/main.ts b/ui-plugins/printable-calendar/ui/main.ts new file mode 100644 index 00000000..30755d28 --- /dev/null +++ b/ui-plugins/printable-calendar/ui/main.ts @@ -0,0 +1,3 @@ +import { startApp } from "./app.ts"; + +startApp("printable-calendar", "0.1.0"); From e8e0604e3cbba30e768dc0ddcf189e1ffd1a7d4f Mon Sep 17 00:00:00 2001 From: ppppp2005-p <360128433+ppppp2005-p@users.noreply.github.com> Date: Thu, 26 Nov 2026 05:07:30 -0400 Subject: [PATCH 09/11] feat(ui-plugins): add Printable Calendar (printable-calendar) --- .../skills/printable-calendar/SKILL.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 external_plugins/printable-calendar/skills/printable-calendar/SKILL.md diff --git a/external_plugins/printable-calendar/skills/printable-calendar/SKILL.md b/external_plugins/printable-calendar/skills/printable-calendar/SKILL.md new file mode 100644 index 00000000..e95812c5 --- /dev/null +++ b/external_plugins/printable-calendar/skills/printable-calendar/SKILL.md @@ -0,0 +1,15 @@ +--- +name: printable-calendar +description: 打印一份已经写好节假日和你自己安排的日历。生成每月一页、格子够大可以手写的月历,以及一页看全年的年历。可以选一份日期清单——节假日、调休补班、生日、出差、截止日——也可以直接在设置里输入节假日。年份和月份、每周从周一还是周日开始、A4 或 Letter、中英文、周数和主题色都能选。在本地运行,不用设计服务,无需 API 密钥。 用户提到“打印日历 / 月历 / 年历 / 台历 / 日历 PDF”时使用。 +--- + +# 可打印日历 + +1. `cal_open(inputs, settings?, project?)`:读取事件表(可选)并预览全年。inputs 是工作区相对路径。 + - 结果里有汇总、问题列表(错误 / 提醒)和前几行数据,每行有编号 `#n`。 + - 可以不选文件:`inputs: []`。settings: {year, startMonth: 1, months: 12, weekStart: "mon", page: "A4", orientation: "auto", lang: "both", title, weekNumbers, holidays};holidays 写“2027-01-01 元旦, 2027-02-06..2027-02-12 春节”。 +2. 向用户简要说明结果,先说错误和需要确认的地方,不要逐行念。 +3. 用户要改时调用 `cal_edit(project, settings?, set?: [{row, values}], add?, remove?)`。 + - 每行是一个日期事项:`set: [{row, values: {include, date, endDate, title, kind: "活动"|"假期"|"补班", color}}]`。 +4. `cal_export(project, formats?)`:导出 calendar-<年份>-monthly.pdf 和 calendar-<年份>-year.pdf。把文件路径告诉用户。 +5. 不要凭记忆填法定节假日;让用户提供或确认官方安排。 From 82d5151566e91742d67ecb9e4c1fe706f2b418c1 Mon Sep 17 00:00:00 2001 From: ppppp2005-p <360128433+ppppp2005-p@users.noreply.github.com> Date: Thu, 26 Nov 2026 05:08:17 -0400 Subject: [PATCH 10/11] feat(ui-plugins): add Printable Calendar (printable-calendar) --- ui-plugins/printable-calendar/src/kit/app.ts | 422 ++++++++++++++++++ .../printable-calendar/src/kit/columns.ts | 53 +++ .../printable-calendar/src/kit/console.ts | 5 + .../printable-calendar/src/kit/fontkit.d.ts | 1 + .../printable-calendar/src/kit/fonts.ts | 90 ++++ .../printable-calendar/src/kit/pdf-fontkit.ts | 48 ++ .../printable-calendar/src/kit/pdf-fonts.ts | 58 +++ ui-plugins/printable-calendar/src/kit/pdf.ts | 69 +++ .../printable-calendar/src/kit/server-kit.ts | 84 ++++ .../printable-calendar/src/kit/sheet.ts | 35 ++ .../printable-calendar/src/kit/table.ts | 127 ++++++ .../printable-calendar/src/kit/testing.ts | 16 + .../printable-calendar/src/kit/workspace.ts | 170 +++++++ 13 files changed, 1178 insertions(+) create mode 100644 ui-plugins/printable-calendar/src/kit/app.ts create mode 100644 ui-plugins/printable-calendar/src/kit/columns.ts create mode 100644 ui-plugins/printable-calendar/src/kit/console.ts create mode 100644 ui-plugins/printable-calendar/src/kit/fontkit.d.ts create mode 100644 ui-plugins/printable-calendar/src/kit/fonts.ts create mode 100644 ui-plugins/printable-calendar/src/kit/pdf-fontkit.ts create mode 100644 ui-plugins/printable-calendar/src/kit/pdf-fonts.ts create mode 100644 ui-plugins/printable-calendar/src/kit/pdf.ts create mode 100644 ui-plugins/printable-calendar/src/kit/server-kit.ts create mode 100644 ui-plugins/printable-calendar/src/kit/sheet.ts create mode 100644 ui-plugins/printable-calendar/src/kit/table.ts create mode 100644 ui-plugins/printable-calendar/src/kit/testing.ts create mode 100644 ui-plugins/printable-calendar/src/kit/workspace.ts diff --git a/ui-plugins/printable-calendar/src/kit/app.ts b/ui-plugins/printable-calendar/src/kit/app.ts new file mode 100644 index 00000000..b3c0fc21 --- /dev/null +++ b/ui-plugins/printable-calendar/src/kit/app.ts @@ -0,0 +1,422 @@ +import { readFile } from "node:fs/promises"; +import { join } from "node:path"; +import { z } from "zod"; +import { createKitServer } from "./server-kit.ts"; +import { KitError, safeFileName, Workspace } from "./workspace.ts"; + +/** 双语文案:[中文, English]。 */ +export type L = [string, string]; +export type Row = Record; + +export interface Field { + key: string; + label: L; + type: "text" | "number" | "bool" | "select" | "color" | "textarea" | "date"; + options?: { value: string; label: L }[]; + default?: unknown; + help?: L; + min?: number; + max?: number; + /** 改了需要重新读取输入文件。 */ + reload?: boolean; +} + +export interface Column { + key: string; + label: L; + type?: "text" | "number" | "bool" | "select" | "date"; + options?: string[]; + readOnly?: boolean; + wide?: boolean; +} + +export interface Issue { + level: "error" | "warn" | "info"; + message: string; + row?: number; + key?: string; +} + +export interface Project { + name: string; + inputs: string[]; + settings: Record; + rows: Row[]; + meta: Record; + exported?: string[]; + created: string; + updated: string; +} + +export interface Computed { + /** 与 project.rows 一一对应(同顺序),可附加只读的计算列。 */ + rows?: Row[]; + issues?: Issue[]; + summary: string; + /** 面板预览:由插件生成、已转义的 HTML(可含 data: 图片)。 */ + preview?: string; + stats?: Record; +} + +export interface AppCtx { + ws: Workspace; + assetRoot: string; + log: (line: string) => void; +} + +export interface ExportCtx extends AppCtx { + project: Project; + computed: Computed; + outDir: string; + /** 写入导出目录下的文件,返回工作区相对路径。 */ + write: (name: string, data: Uint8Array | string) => Promise; +} + +export interface ExportDef { + id: string; + label: L; + description: string; + run: (ctx: ExportCtx) => Promise; + /** 不包含在“全部导出”里,只有点名时才运行(例如撤销)。 */ + manual?: boolean; +} + +export interface AppDef { + name: string; + version: string; + /** 工具名前缀,例如 "invoice" → invoice_open。 */ + prefix: string; + title: L; + /** invoice_open 的说明(给 Agent 看)。 */ + openDescription: string; + inputs: { exts: string[]; min: number; max: number; label: L; folders?: boolean }; + settings: Field[]; + columns: (project: Project) => Column[]; + load: (ctx: AppCtx & { files: string[]; settings: Record; previous?: Row[] }) => Promise<{ rows: Row[]; meta?: Record }>; + compute: (project: Project, ctx: AppCtx) => Promise | Computed; + exports: ExportDef[]; + /** 允许在面板 / 工具里新增行时的空白行。 */ + newRow?: (project: Project) => Row; + /** 行描述(给 Agent 的文字列表),默认取前几列。 */ + describeRow?: (row: Row, index: number) => string; + /** 单元格被用户/助手改过之后调用(例如把来源标成“手动”)。 */ + onCellEdit?: (row: Row, key: string) => void; +} + +const MAX_ROWS_PANEL = 3000; + +export function coerceSettings(fields: Field[], input: Record | undefined, base: Record = {}) { + const out: Record = {}; + for (const field of fields) { + let value = input && field.key in input ? input[field.key] : field.key in base ? base[field.key] : field.default; + if (value === undefined || value === null) { + if (field.default !== undefined) out[field.key] = field.default; + continue; + } + if (field.type === "number") { + const n = typeof value === "number" ? value : Number(String(value).trim()); + if (!Number.isFinite(n)) throw new KitError("bad_setting", `${field.key} must be a number (got ${JSON.stringify(value)}).`); + value = Math.min(field.max ?? Infinity, Math.max(field.min ?? -Infinity, n)); + } else if (field.type === "bool") value = value === true || value === "true" || value === 1 || value === "1" || value === "yes"; + else if (field.type === "select") { + value = String(value); + if (field.options && !field.options.some((o) => o.value === value)) throw new KitError("bad_setting", `${field.key} must be one of ${field.options.map((o) => o.value).join(", ")} (got ${value}).`); + } else value = String(value); + out[field.key] = value; + } + return out; +} + +/** + * 把 _edit 里的列名解析成列 key:先精确匹配 key,再精确匹配中/英文标题, + * 最后忽略大小写和空白再比一次;行里已有的字段名也算。找不到返回 undefined。 + */ +export function resolveColumnKey(cols: Column[], name: string, row?: Row): string | undefined { + if (cols.some((c) => c.key === name)) return name; + const exact = cols.find((c) => c.label[0] === name || c.label[1] === name); + if (exact) return exact.key; + const norm = (x: string) => x.normalize("NFKC").replace(/\s+/g, "").toLowerCase(); + const n = norm(name); + const loose = cols.find((c) => norm(c.key) === n || norm(c.label[0]) === n || norm(c.label[1]) === n); + if (loose) return loose.key; + if (row && Object.prototype.hasOwnProperty.call(row, name)) return name; + return undefined; +} + +export function coerceCell(column: Column | undefined, value: unknown): unknown { + if (!column) return value; + if (column.type === "number") { + if (value === "" || value === null || value === undefined) return ""; + const n = typeof value === "number" ? value : Number(String(value).replace(/[,,\s]/g, "")); + return Number.isFinite(n) ? n : String(value); + } + if (column.type === "bool") return value === true || value === "true" || value === 1 || value === "1" || value === "yes"; + return value === null || value === undefined ? "" : String(value); +} + +const stem = (path: string) => (path.split("/").pop() ?? path).replace(/\.[^.]+$/, ""); + +export function createApp(def: AppDef, options: { workspaceRoot: string; assetRoot: string; log?: (line: string) => void }) { + const ws = new Workspace(options.workspaceRoot); + const log = options.log ?? (() => undefined); + const ctx: AppCtx = { ws, assetRoot: options.assetRoot, log }; + const PANEL_URI = `ui://${def.name}/panel.html`; + const { server, tool } = createKitServer({ + name: def.name, + version: def.version, + panelUri: PANEL_URI, + surface: "editor", + panelHtml: () => readFile(join(options.assetRoot, "ui/panel.html"), "utf8"), + log, + }); + const P = def.prefix; + const projectPath = (name: string) => `${def.name}/${safeFileName(name, "project")}.project.json`; + let queue: Promise = Promise.resolve(); + const serial = (work: () => Promise): Promise => { + const job = queue.catch(() => undefined).then(work); + queue = job; + return job; + }; + + async function loadProject(name: string): Promise { + if (!name) throw new KitError("missing_project", "Pass `project` (from the open result)."); + const path = projectPath(name); + if (!(await ws.exists(path))) throw new KitError("no_project", `No project named "${name}". Open input files first with ${P}_open.`); + return JSON.parse(await ws.readText(path)) as Project; + } + async function saveProject(project: Project) { + project.updated = new Date().toISOString(); + await ws.write(projectPath(project.name), JSON.stringify(project, null, 1) + "\n"); + } + async function listProjects() { + const files = await ws.list({ dir: def.name, exts: [".json"], recursive: false, limit: 500 }).catch(() => []); + return files.map((f) => f.path).filter((p) => p.endsWith(".project.json")).map((p) => p.split("/").pop()!.replace(/\.project\.json$/, "")); + } + + async function view(project: Project, extra: Record = {}) { + const computed = await def.compute(project, ctx); + const columns = def.columns(project); + const rows = computed.rows ?? project.rows; + return { + computed, + structured: { + kind: "project", + app: def.name, + project: project.name, + inputs: project.inputs, + settings: project.settings, + columns, + rows: rows.slice(0, MAX_ROWS_PANEL), + totalRows: rows.length, + canAdd: !!def.newRow, + issues: (computed.issues ?? []).slice(0, 500), + summary: computed.summary, + stats: computed.stats ?? {}, + preview: computed.preview ?? "", + exported: project.exported ?? [], + ...extra, + }, + }; + } + function describe(project: Project, computed: Computed, limit = 25) { + const rows = computed.rows ?? project.rows; + const cols = def.columns(project); + const line = def.describeRow ?? ((row: Row, i: number) => `#${i} ` + cols.slice(0, 5).map((c) => `${c.key}=${String(row[c.key] ?? "").slice(0, 40)}`).join(" · ")); + const issues = computed.issues ?? []; + return [ + `Project "${project.name}" (${project.inputs.join(", ") || "no input files"}): ${computed.summary}`, + issues.length ? `Issues (${issues.length}):\n` + issues.slice(0, 30).map((x) => `- [${x.level}]${x.row !== undefined ? ` row #${x.row}` : ""}${x.key ? ` ${x.key}` : ""}: ${x.message}`).join("\n") + (issues.length > 30 ? `\n… ${issues.length - 30} more in the panel.` : "") : "No issues found.", + rows.length ? `Rows (${rows.length}):\n` + rows.slice(0, limit).map((r, i) => line(r, i)).join("\n") + (rows.length > limit ? `\n… ${rows.length - limit} more rows in the panel.` : "") : "", + `Exports: ${def.exports.map((e) => `${e.id} (${e.description})`).join("; ")}. Edit with ${P}_edit, export with ${P}_export.`, + ].filter(Boolean).join("\n\n"); + } + + const settingsDoc = def.settings.map((f) => `${f.key} (${f.type}${f.options ? `: ${f.options.map((o) => o.value).join("|")}` : ""}${f.default !== undefined ? `, default ${JSON.stringify(f.default)}` : ""})${f.help ? ` — ${f.help[1]}` : ""}`).join("; "); + + tool( + `${P}_open`, + { + description: `${def.openDescription} Opens the editing panel. Settings: ${settingsDoc || "none"}. Re-opening the same project name replaces its rows with a fresh read of the inputs.`, + input: { + inputs: z.array(z.string()).describe(`Workspace-relative input paths (${def.inputs.exts.join(", ")}${def.inputs.folders ? " or folders" : ""}); ${def.inputs.min}–${def.inputs.max} item(s).`), + settings: z.record(z.string(), z.unknown()).optional(), + project: z.string().optional().describe("Project name (default: first input's file name)."), + }, + openPanel: true, + timeoutMs: 600_000, + }, + (args) => + serial(async () => { + const inputs: string[] = args.inputs ?? []; + if (inputs.length < def.inputs.min) throw new KitError("missing_input", `Pass at least ${def.inputs.min} input file(s) (${def.inputs.exts.join(", ")}).`); + if (inputs.length > def.inputs.max) throw new KitError("too_many_inputs", `At most ${def.inputs.max} input(s).`); + for (const i of inputs) ws.resolve(i); + const name = safeFileName(args.project || (inputs[0] ? stem(inputs[0]) : def.name), "project"); + const settings = coerceSettings(def.settings, args.settings); + const loaded = await def.load({ ...ctx, files: inputs, settings }); + const now = new Date().toISOString(); + const project: Project = { name, inputs, settings, rows: loaded.rows, meta: loaded.meta ?? {}, created: now, updated: now }; + await saveProject(project); + const v = await view(project); + return { text: describe(project, v.computed), structured: v.structured }; + }), + ); + + tool( + `${P}_edit`, + { + description: `Change a ${def.name} project: update settings, set cell values by row index (from ${P}_open / ${P}_status), add rows${def.newRow ? "" : " (not supported here)"} or remove rows. Changes are saved; returns the updated summary and issues.`, + input: { + project: z.string(), + settings: z.record(z.string(), z.unknown()).optional(), + set: z.array(z.object({ row: z.number().int().min(0), values: z.record(z.string(), z.unknown()) })).optional(), + add: z.array(z.record(z.string(), z.unknown())).optional(), + remove: z.array(z.number().int().min(0)).optional(), + }, + timeoutMs: 600_000, + }, + (args) => + serial(async () => { + const project = await loadProject(args.project); + const notes: string[] = []; + if (args.settings) { + const next = coerceSettings(def.settings, args.settings, project.settings); + const reload = def.settings.some((f) => f.reload && JSON.stringify(next[f.key]) !== JSON.stringify(project.settings[f.key])); + project.settings = next; + if (reload) { + const loaded = await def.load({ ...ctx, files: project.inputs, settings: next, previous: project.rows }); + project.rows = loaded.rows; + project.meta = loaded.meta ?? project.meta; + notes.push("Inputs re-read with the new settings (row edits were reset)."); + } + } + const cols = def.columns(project); + const byKey = new Map(cols.map((c) => [c.key, c])); + const unknown = new Set(); + for (const s of args.set ?? []) { + const row = project.rows[s.row]; + if (!row) { notes.push(`Row #${s.row} does not exist.`); continue; } + for (const [name, v] of Object.entries(s.values)) { + const k = resolveColumnKey(cols, name, row); + if (k === undefined) { unknown.add(name); continue; } + const c = byKey.get(k); + if (c?.readOnly) { notes.push(`${k} is calculated and cannot be edited.`); continue; } + row[k] = coerceCell(c, v); + def.onCellEdit?.(row, k); + } + } + if (args.add?.length) { + if (!def.newRow) throw new KitError("no_add", "This tool does not support adding rows."); + for (const a of args.add) { + const row = def.newRow(project); + for (const [name, v] of Object.entries(a)) { + const k = resolveColumnKey(cols, name, row); + if (k === undefined) { unknown.add(name); continue; } + row[k] = coerceCell(byKey.get(k), v); + } + project.rows.push(row); + } + } + if (unknown.size) notes.push(`Warning: ignored unknown column(s) ${[...unknown].map((u) => `“${u}”`).join(", ")}. Use a column key or its label: ${cols.map((c) => `${c.key} (${c.label[0]} / ${c.label[1]})`).join(", ")}.`); + if (args.remove?.length) { + const drop = new Set(args.remove); + project.rows = project.rows.filter((_, i) => !drop.has(i)); + } + await saveProject(project); + const v = await view(project); + return { text: [notes.join(" "), describe(project, v.computed, 10)].filter(Boolean).join("\n\n"), structured: v.structured }; + }), + ); + + tool( + `${P}_status`, + { description: `Show a ${def.name} project's rows, issues and summary (no changes).`, input: { project: z.string(), limit: z.number().int().min(1).max(500).optional() }, readOnly: true }, + async (args) => { + const project = await loadProject(args.project); + const v = await view(project); + return { text: describe(project, v.computed, args.limit ?? 50), structured: v.structured }; + }, + ); + + tool( + `${P}_export`, + { + description: `Write the finished files for a ${def.name} project into ${def.name}// in the workspace. Formats: ${def.exports.map((e) => `"${e.id}" — ${e.description}`).join("; ")}.`, + input: { project: z.string(), formats: z.array(z.enum(def.exports.map((e) => e.id) as [string, ...string[]])).optional().describe("Default: all formats except manual ones (e.g. undo).") }, + timeoutMs: 900_000, + }, + (args) => + serial(async () => { + const project = await loadProject(args.project); + const computed = await def.compute(project, ctx); + if ((computed.issues ?? []).some((i) => i.level === "error") && !def.exports.length) throw new KitError("has_errors", "Fix the errors first."); + const outDir = `${def.name}/${safeFileName(project.name, "project")}`; + const ids = args.formats?.length ? args.formats : def.exports.filter((e) => !e.manual).map((e) => e.id); + const files: string[] = []; + const notes: string[] = []; + for (const id of ids) { + const ex = def.exports.find((e) => e.id === id)!; + const result = await ex.run({ ...ctx, project, computed, outDir, write: (n, d) => ws.write(`${outDir}/${n}`, d) }); + if (Array.isArray(result)) files.push(...result); + else { files.push(...result.files); if (result.note) notes.push(result.note); } + } + project.exported = files; + await saveProject(project); + const v = await view(project, { justExported: files }); + const errors = (computed.issues ?? []).filter((i) => i.level === "error").length; + return { + text: `Exported ${files.length} file(s):\n${files.map((f) => `- ${f}`).join("\n")}${notes.length ? `\n${notes.join("\n")}` : ""}${errors ? `\nNote: ${errors} error(s) are still open in the project.` : ""}`, + structured: v.structured, + }; + }), + ); + + tool( + "app_info", + { description: "Panel bootstrap: tool definition, workspace files and saved projects.", input: {}, visibility: ["app"], readOnly: true }, + async () => { + const files = (await ws.list({ exts: def.inputs.exts, limit: 3000 })).map((f) => f.path).filter((p) => !p.startsWith(`${def.name}/`)); + const folders = def.inputs.folders ? [...new Set(files.map((f) => f.split("/").slice(0, -1).join("/") || "."))].sort() : []; + return { + text: "", + structured: { + kind: "info", + app: def.name, + prefix: P, + title: def.title, + inputs: def.inputs, + settings: def.settings, + exports: def.exports.map((e) => ({ id: e.id, label: e.label, description: e.description })), + files, + folders, + projects: await listProjects(), + }, + }; + }, + ); + + return { server, ws, PANEL_URI }; +} + +/** HTML 转义。 */ +export const esc = (value: unknown) => + String(value ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]!); + +/** 简单 HTML 表格(用于预览与报告)。 */ +export function htmlTable(headers: string[], rows: unknown[][], cls = "data") { + return `${headers.map((h) => ``).join("")}${rows.map((r) => `${r.map((c) => ``).join("")}`).join("")}
${esc(h)}
${esc(c)}
`; +} + +/** 独立 HTML 报告页。 */ +export function htmlPage(title: string, body: string, extraCss = "") { + return `${esc(title)}${body}`; +} + +/** CSV(带 BOM,Excel 打开中文不乱码)。 */ +export function toCsv(headers: string[], rows: unknown[][]) { + const cell = (v: unknown) => { + const s = String(v ?? ""); + return /[",\n\r]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s; + }; + return "\uFEFF" + [headers, ...rows].map((r) => r.map(cell).join(",")).join("\r\n") + "\r\n"; +} diff --git a/ui-plugins/printable-calendar/src/kit/columns.ts b/ui-plugins/printable-calendar/src/kit/columns.ts new file mode 100644 index 00000000..4cb79023 --- /dev/null +++ b/ui-plugins/printable-calendar/src/kit/columns.ts @@ -0,0 +1,53 @@ +/** 表头别名匹配:把用户表格里的中英文列名对应到插件字段。 */ +const norm = (s: string) => s.toLowerCase().replace(/[\s_\-::()().#]/g, ""); + +export function mapHeaders(headers: string[], aliases: Record): Record { + const out: Record = {}; + const used = new Set(); + const nh = headers.map((h) => [h, norm(h)] as const); + for (const [key, names] of Object.entries(aliases)) { + const wanted = [key, ...names].map(norm); + let hit = nh.find(([h, n]) => !used.has(h) && wanted.includes(n)); + hit ??= nh.find(([h, n]) => !used.has(h) && wanted.some((w) => w.length >= 2 && n.includes(w))); + if (hit) { out[key] = hit[0]; used.add(hit[0]); } + } + return out; +} + +/** 解析金额 / 数字:"¥1,234.50"、"12%"、"(3)"、全角数字。失败返回 NaN。 */ +export function num(value: unknown): number { + if (typeof value === "number") return value; + let s = String(value ?? "").trim().replace(/[0-9.-]/g, (c) => String.fromCharCode(c.charCodeAt(0) - 0xfee0)); + if (!s) return NaN; + let neg = false; + if (/^\(.*\)$|^(.*)$/.test(s)) { neg = true; s = s.slice(1, -1); } + s = s.replace(/[¥¥$€£,,\s元]|RMB|CNY|USD|EUR/gi, ""); + if (s.endsWith("%")) s = s.slice(0, -1); + const n = Number(s); + return neg ? -n : n; +} + +export const round2 = (n: number) => Math.round((n + Number.EPSILON) * 100) / 100; + +/** 解析日期:2026-11-25、2026/11/25、2026年11月25日、11/25/2026、Excel 序号。返回 YYYY-MM-DD 或 ""。 */ +export function parseDate(value: unknown): string { + if (value instanceof Date && !isNaN(+value)) return value.toISOString().slice(0, 10); + const s = String(value ?? "").trim(); + if (!s) return ""; + let m = /^(\d{4})[-/.年](\d{1,2})[-/.月](\d{1,2})日?/.exec(s); + if (m) return `${m[1]}-${m[2].padStart(2, "0")}-${m[3].padStart(2, "0")}`; + m = /^(\d{1,2})\/(\d{1,2})\/(\d{4})/.exec(s); + if (m) return `${m[3]}-${m[1].padStart(2, "0")}-${m[2].padStart(2, "0")}`; + if (/^\d{5}(\.\d+)?$/.test(s)) { + const d = new Date(Date.UTC(1899, 11, 30) + Number(s) * 86400000); + return d.toISOString().slice(0, 10); + } + const d = new Date(s); + return isNaN(+d) ? "" : d.toISOString().slice(0, 10); +} + +export function addDays(date: string, days: number) { + const d = new Date(`${date}T00:00:00Z`); + d.setUTCDate(d.getUTCDate() + days); + return d.toISOString().slice(0, 10); +} diff --git a/ui-plugins/printable-calendar/src/kit/console.ts b/ui-plugins/printable-calendar/src/kit/console.ts new file mode 100644 index 00000000..f6817656 --- /dev/null +++ b/ui-plugins/printable-calendar/src/kit/console.ts @@ -0,0 +1,5 @@ +// stdout 只留给 MCP 协议;依赖库的日志改写到 stderr。 +console.log = (...args: unknown[]) => process.stderr.write(`${args.map(String).join(" ")}\n`); +console.info = console.log; +console.warn = console.log; +console.debug = console.log; diff --git a/ui-plugins/printable-calendar/src/kit/fontkit.d.ts b/ui-plugins/printable-calendar/src/kit/fontkit.d.ts new file mode 100644 index 00000000..c3ad5cd3 --- /dev/null +++ b/ui-plugins/printable-calendar/src/kit/fontkit.d.ts @@ -0,0 +1 @@ +declare module "fontkit"; diff --git a/ui-plugins/printable-calendar/src/kit/fonts.ts b/ui-plugins/printable-calendar/src/kit/fonts.ts new file mode 100644 index 00000000..84e65845 --- /dev/null +++ b/ui-plugins/printable-calendar/src/kit/fonts.ts @@ -0,0 +1,90 @@ +import { readFile, stat } from "node:fs/promises"; +import { KitError } from "./workspace.ts"; + +/** 常见系统中文字体。TrueType 优先(PDF 子集嵌入最稳定),然后是集合字体。 */ +export const CJK_FONT_CANDIDATES = [ + // macOS + "/System/Library/Fonts/Supplemental/Arial Unicode.ttf", + "/Library/Fonts/Arial Unicode.ttf", + "/System/Library/Fonts/Hiragino Sans GB.ttc", + "/System/Library/Fonts/STHeiti Medium.ttc", + "/System/Library/Fonts/STHeiti Light.ttc", + "/System/Library/Fonts/PingFang.ttc", + // Windows + "C:\\Windows\\Fonts\\simhei.ttf", + "C:\\Windows\\Fonts\\msyh.ttc", + "C:\\Windows\\Fonts\\simsun.ttc", + // Linux + "/usr/share/fonts/truetype/arphic/uming.ttc", + "/usr/share/fonts/truetype/wqy/wqy-microhei.ttc", + "/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc", + "/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc", + "/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc", +]; + +export interface LoadedFont { + path: string; + /** 原始文件(可能是 .ttc 集合)。 */ + data: Buffer; +} + +const cache = new Map(); + +/** 用户指定的字体优先,否则按候选列表找第一个存在的中文字体。 */ +export async function findCjkFont(userPath?: string | null, candidates: string[] = CJK_FONT_CANDIDATES): Promise { + const configured = userPath?.trim() && !userPath.includes("${") ? userPath.trim() : undefined; + const list = configured ? [configured, ...candidates] : candidates; + for (const path of list) { + if (cache.has(path)) return cache.get(path)!; + try { + if (!(await stat(path)).isFile()) continue; + const font = { path, data: await readFile(path) }; + cache.set(path, font); + return font; + } catch { + // 继续查找 + } + } + throw new KitError( + "font_not_found", + "No Chinese-capable font was found. Set the plugin's fontPath setting to a .ttf/.otf/.ttc font file (for example Arial Unicode.ttf, Microsoft YaHei or Noto Sans CJK).", + ); +} + +/** 从 .ttc 字体集合中取出第 index 个字体,组成独立的 sfnt 文件(pdf-lib 只能嵌入单个字体)。 */ +export function extractFace(data: Uint8Array, index = 0): Uint8Array { + const view = new DataView(data.buffer, data.byteOffset, data.byteLength); + if (view.getUint32(0) !== 0x74746366) return data; // 不是 'ttcf' + const count = view.getUint32(8); + if (index >= count) throw new KitError("font_error", `Font collection has ${count} faces.`); + const offset = view.getUint32(12 + index * 4); + const numTables = view.getUint16(offset + 4); + const tables: { tag: number; checksum: number; start: number; length: number }[] = []; + for (let i = 0; i < numTables; i++) { + const record = offset + 12 + i * 16; + tables.push({ tag: view.getUint32(record), checksum: view.getUint32(record + 4), start: view.getUint32(record + 8), length: view.getUint32(record + 12) }); + } + const headerSize = 12 + numTables * 16; + let total = headerSize; + for (const table of tables) total += (table.length + 3) & ~3; + const out = new Uint8Array(total); + const outView = new DataView(out.buffer); + out.set(data.subarray(offset, offset + 12), 0); + let cursor = headerSize; + tables.forEach((table, i) => { + const record = 12 + i * 16; + outView.setUint32(record, table.tag); + outView.setUint32(record + 4, table.checksum); + outView.setUint32(record + 8, cursor); + outView.setUint32(record + 12, table.length); + out.set(data.subarray(table.start, table.start + table.length), cursor); + cursor += (table.length + 3) & ~3; + }); + return out; +} + +/** PDF 用字体:单个字体(集合取第一个),配合 fontkit 2 子集化嵌入。 */ +export async function findPdfFont(userPath?: string | null): Promise<{ path: string; face: Uint8Array; subset: boolean }> { + const font = await findCjkFont(userPath); + return { path: font.path, face: extractFace(font.data, 0), subset: true }; +} diff --git a/ui-plugins/printable-calendar/src/kit/pdf-fontkit.ts b/ui-plugins/printable-calendar/src/kit/pdf-fontkit.ts new file mode 100644 index 00000000..4ce7990b --- /dev/null +++ b/ui-plugins/printable-calendar/src/kit/pdf-fontkit.ts @@ -0,0 +1,48 @@ +import * as fontkitModule from "fontkit"; + +/** + * pdf-lib 自带示例用的 @pdf-lib/fontkit(fontkit 1.x 分支)在子集化部分中文字体时会丢字。 + * 这里改用 fontkit 2.x,并把它的 subset.encode() 适配成 pdf-lib 需要的 encodeStream() 接口。 + */ +const fontkit: any = fontkitModule; + +function wrapSubset(subset: any) { + return new Proxy(subset, { + get(target, key) { + if (key === "encodeStream") + return () => { + const handlers: Record void> = {}; + const stream = { + on(event: string, handler: (value?: unknown) => void) { + handlers[event] = handler; + return stream; + }, + }; + queueMicrotask(() => { + try { + handlers.data?.(target.encode()); + handlers.end?.(); + } catch (error) { + handlers.error?.(error); + } + }); + return stream; + }; + const value = target[key]; + return typeof value === "function" ? value.bind(target) : value; + }, + }); +} + +export const pdfFontkit = { + create(buffer: Uint8Array, postscriptName?: string) { + const font = fontkit.create(buffer, postscriptName); + return new Proxy(font, { + get(target, key) { + if (key === "createSubset") return () => wrapSubset(target.createSubset()); + const value = target[key]; + return typeof value === "function" ? value.bind(target) : value; + }, + }); + }, +}; diff --git a/ui-plugins/printable-calendar/src/kit/pdf-fonts.ts b/ui-plugins/printable-calendar/src/kit/pdf-fonts.ts new file mode 100644 index 00000000..ab199ba4 --- /dev/null +++ b/ui-plugins/printable-calendar/src/kit/pdf-fonts.ts @@ -0,0 +1,58 @@ +import { readFile } from "node:fs/promises"; +import * as fontkitModule from "fontkit"; +import { extractFace, findCjkFont } from "./fonts.ts"; + +const fontkit: any = fontkitModule; + +const faceCount = (data: Uint8Array) => { + const view = new DataView(data.buffer, data.byteOffset, data.byteLength); + return view.getUint32(0) === 0x74746366 ? view.getUint32(8) : 1; +}; + +/** 在字体集合里挑一个字体:优先简体中文,然后按字重匹配。 */ +function pickFace(data: Uint8Array, bold: boolean): Uint8Array | undefined { + const faces: { face: Uint8Array; family: string; sub: string }[] = []; + for (let i = 0; i < Math.min(faceCount(data), 16); i++) { + try { + const face = extractFace(data, i); + const font = fontkit.create(Buffer.from(face)); + faces.push({ face, family: String(font.familyName ?? ""), sub: String(font.subfamilyName ?? "") }); + } catch { + // 跳过 + } + } + const isBold = (f: { family: string; sub: string }) => /bold|semibold|w6|w7|w8|heavy|black|medium/i.test(`${f.sub} ${f.family}`); + const pool = faces.filter((f) => isBold(f) === bold); + const list = pool.length ? pool : bold ? [] : faces; + return (list.find((f) => /\bSC\b|GB|Simplified/i.test(f.family)) ?? list[0])?.face; +} + +const BOLD_CANDIDATES = [ + "/System/Library/Fonts/Hiragino Sans GB.ttc", + "/System/Library/Fonts/STHeiti Medium.ttc", + "C:\\Windows\\Fonts\\msyhbd.ttc", + "C:\\Windows\\Fonts\\simhei.ttf", + "/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc", + "/usr/share/fonts/noto-cjk/NotoSansCJK-Bold.ttc", + "/usr/share/fonts/google-noto-cjk/NotoSansCJK-Bold.ttc", +]; + +/** PDF 正文字体 + (能找到的话)粗体。用户指定字体时只用该字体。 */ +export async function findPdfFonts(userPath?: string | null): Promise<{ path: string; regular: Uint8Array; bold?: Uint8Array; boldPath?: string }> { + const font = await findCjkFont(userPath); + const regular = pickFace(font.data, false) ?? extractFace(font.data, 0); + const configured = userPath?.trim() && !userPath.includes("${"); + if (configured) return { path: font.path, regular }; + const same = pickFace(font.data, true); + if (same) return { path: font.path, regular, bold: same, boldPath: font.path }; + for (const path of BOLD_CANDIDATES) { + try { + const data = await readFile(path); + const bold = pickFace(data, true) ?? (/simhei/i.test(path) ? extractFace(data, 0) : undefined); + if (bold) return { path: font.path, regular, bold, boldPath: path }; + } catch { + // 继续 + } + } + return { path: font.path, regular }; +} diff --git a/ui-plugins/printable-calendar/src/kit/pdf.ts b/ui-plugins/printable-calendar/src/kit/pdf.ts new file mode 100644 index 00000000..e57577eb --- /dev/null +++ b/ui-plugins/printable-calendar/src/kit/pdf.ts @@ -0,0 +1,69 @@ +import { PDFDocument, rgb, StandardFonts, type PDFFont, type PDFPage } from "pdf-lib"; +import { pdfFontkit } from "./pdf-fontkit.ts"; +import { findPdfFonts } from "./pdf-fonts.ts"; + +export const MM = 72 / 25.4; +export const PAGE = { A4: [595.28, 841.89] as [number, number], Letter: [612, 792] as [number, number], A5: [419.53, 595.28] as [number, number] }; + +export interface PdfKit { + doc: PDFDocument; + font: PDFFont; + bold: PDFFont; + /** 是否有中文字体(没有时中文会被替换成 ?)。 */ + cjk: boolean; + width: (text: string, size: number, b?: boolean) => number; + text: (page: PDFPage, text: string, x: number, y: number, o?: { size?: number; bold?: boolean; color?: string; align?: "left" | "center" | "right"; maxWidth?: number }) => void; + wrap: (text: string, size: number, maxWidth: number, b?: boolean) => string[]; +} + +export function hexRgb(hex: string | undefined, fallback = "#111827") { + const m = /^#?([0-9a-f]{6})$/i.exec((hex ?? "").trim()) ?? /^#?([0-9a-f]{6})$/i.exec(fallback)!; + const n = parseInt(m[1], 16); + return rgb(((n >> 16) & 255) / 255, ((n >> 8) & 255) / 255, (n & 255) / 255); +} + +/** 新建 PDF,并嵌入本机中文字体(找不到时退回 Helvetica)。 */ +export async function newPdf(fontPath?: string | null): Promise { + const doc = await PDFDocument.create(); + doc.setCreator("Penova"); + doc.setProducer("pdf-lib"); + let font: PDFFont, bold: PDFFont, cjk = true; + try { + const f = await findPdfFonts(fontPath); + doc.registerFontkit(pdfFontkit as never); + font = await doc.embedFont(f.regular, { subset: true }); + bold = f.bold ? await doc.embedFont(f.bold, { subset: true }) : font; + } catch { + cjk = false; + font = await doc.embedFont(StandardFonts.Helvetica); + bold = await doc.embedFont(StandardFonts.HelveticaBold); + } + const safe = (t: string) => (cjk ? t : t.replace(/[^\x20-\x7e\u00a0-\u00ff]/g, "?")); + const width = (t: string, size: number, b = false) => (b ? bold : font).widthOfTextAtSize(safe(t), size); + const wrap = (t: string, size: number, maxWidth: number, b = false) => { + const out: string[] = []; + for (const para of String(t ?? "").split(/\r?\n/)) { + let line = ""; + const tokens = para.match(/[\u2E80-\u9FFF\uF900-\uFAFF\uFF00-\uFFEF]|[^\s\u2E80-\u9FFF\uF900-\uFAFF\uFF00-\uFFEF]+|\s+/g) ?? [""]; + for (const tok of tokens) { + const next = line + tok; + if (width(next, size, b) > maxWidth && line.trim()) { + out.push(line.trimEnd()); + line = tok.trimStart(); + } else line = next; + } + out.push(line.trimEnd()); + } + return out; + }; + const text: PdfKit["text"] = (page, t, x, y, o = {}) => { + const size = o.size ?? 10; + const f = o.bold ? bold : font; + let s = safe(String(t ?? "")); + if (o.maxWidth) while (s.length > 1 && f.widthOfTextAtSize(s, size) > o.maxWidth) s = s.slice(0, -2) + "…"; + const w = f.widthOfTextAtSize(s, size); + const dx = o.align === "center" ? -w / 2 : o.align === "right" ? -w : 0; + page.drawText(s, { x: x + dx, y, size, font: f, color: hexRgb(o.color) }); + }; + return { doc, font, bold, cjk, width, text, wrap }; +} diff --git a/ui-plugins/printable-calendar/src/kit/server-kit.ts b/ui-plugins/printable-calendar/src/kit/server-kit.ts new file mode 100644 index 00000000..6bc31594 --- /dev/null +++ b/ui-plugins/printable-calendar/src/kit/server-kit.ts @@ -0,0 +1,84 @@ +import { readFile } from "node:fs/promises"; +import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import type { z } from "zod"; +import { KitError } from "./workspace.ts"; + +export const HTML_MIME = "text/html;profile=mcp-app"; +type Visibility = ("model" | "app")[]; +type Content = { type: "text"; text: string } | { type: "image"; data: string; mimeType: string }; + +export interface ToolOutput { + text: string; + structured?: Record; + images?: { data: string; mimeType: string }[]; +} + +export interface KitServerOptions { + name: string; + version: string; + panelUri: string; + surface: string; + panelHtml: () => Promise; + log?: (line: string) => void; + /** 页面资源的额外 _meta,例如 { "zcode/csp": { wasmUnsafeEval: true } }。 */ + panelMeta?: Record; +} + +/** 统一的工具注册:所有工具都关联同一个侧栏面板,错误带 code 返回给 Agent 与页面。 */ +export function createKitServer(options: KitServerOptions) { + const log = options.log ?? (() => undefined); + const server = new McpServer({ name: options.name, version: options.version }, { capabilities: { logging: {} } }); + const panelMeta = { ui: { prefersBorder: false }, ...options.panelMeta }; + server.registerResource("panel", options.panelUri, { mimeType: HTML_MIME, _meta: panelMeta }, async () => ({ + contents: [{ uri: options.panelUri, mimeType: HTML_MIME, _meta: panelMeta, text: await options.panelHtml() }], + })); + + const tool = ( + name: string, + config: { + description: string; + input: Record; + visibility?: Visibility; + openPanel?: boolean; + readOnly?: boolean; + timeoutMs?: number; + }, + run: (input: any) => Promise, + ) => { + server.registerTool( + name, + { + description: config.description, + inputSchema: config.input, + annotations: { readOnlyHint: !!config.readOnly, ...(config.readOnly ? {} : { destructiveHint: false }), openWorldHint: false }, + _meta: { + ui: { resourceUri: options.panelUri, surface: options.surface, visibility: config.visibility ?? ["model", "app"] }, + ...(config.timeoutMs ? { timeoutMs: config.timeoutMs } : {}), + ...(config.openPanel ? { "openai/ui": { preferredModelDisplayMode: "fullscreen" } } : {}), + }, + }, + async (input: unknown) => { + try { + const output = await run(input); + const content: Content[] = [{ type: "text", text: output.text }]; + for (const image of output.images ?? []) content.push({ type: "image", ...image }); + return { content, ...(output.structured ? { structuredContent: output.structured } : {}) }; + } catch (error) { + const code = error instanceof KitError ? error.code : "internal_error"; + const message = error instanceof Error ? error.message : String(error); + if (!(error instanceof KitError)) log(`${name} failed: ${error instanceof Error ? error.stack : message}`); + return { + isError: true, + content: [{ type: "text" as const, text: `[${code}] ${message}` }], + structuredContent: { error: { code, message } }, + }; + } + }, + ); + }; + return { server, tool }; +} + +export async function readPanel(path: string) { + return readFile(path, "utf8"); +} diff --git a/ui-plugins/printable-calendar/src/kit/sheet.ts b/ui-plugins/printable-calendar/src/kit/sheet.ts new file mode 100644 index 00000000..5956d9a6 --- /dev/null +++ b/ui-plugins/printable-calendar/src/kit/sheet.ts @@ -0,0 +1,35 @@ +import ExcelJS from "exceljs"; + +export interface SheetSpec { + name: string; + headers: string[]; + rows: unknown[][]; + /** 需要标色的单元格:row/col 从 0 开始(不含表头)。 */ + marks?: { row: number; col: number; color?: string; note?: string }[]; + widths?: number[]; + numberFormat?: Record; +} + +/** 写出 .xlsx:表头加粗冻结、数字保持数字、可选标色与批注。 */ +export async function writeXlsx(sheets: SheetSpec[]): Promise { + const book = new ExcelJS.Workbook(); + book.creator = "Penova"; + for (const spec of sheets) { + const sheet = book.addWorksheet(spec.name.replace(/[\\/?*[\]:]/g, "_").slice(0, 31) || "Sheet1"); + sheet.addRow(spec.headers); + sheet.getRow(1).font = { bold: true }; + sheet.views = [{ state: "frozen", ySplit: 1 }]; + for (const row of spec.rows) sheet.addRow(row.map((v) => (v === undefined || v === null ? "" : v instanceof Date ? v : typeof v === "number" || typeof v === "boolean" ? v : String(v)))); + spec.headers.forEach((h, i) => { + const width = spec.widths?.[i] ?? Math.min(50, Math.max(8, String(h).length * 2, ...spec.rows.slice(0, 200).map((r) => String(r[i] ?? "").length * 1.2))); + sheet.getColumn(i + 1).width = width; + if (spec.numberFormat?.[i]) sheet.getColumn(i + 1).numFmt = spec.numberFormat[i]; + }); + for (const m of spec.marks ?? []) { + const cell = sheet.getCell(m.row + 2, m.col + 1); + cell.fill = { type: "pattern", pattern: "solid", fgColor: { argb: (m.color ?? "FFFDE68A").replace("#", "FF") } }; + if (m.note) cell.note = m.note; + } + } + return Buffer.from(await book.xlsx.writeBuffer()); +} diff --git a/ui-plugins/printable-calendar/src/kit/table.ts b/ui-plugins/printable-calendar/src/kit/table.ts new file mode 100644 index 00000000..c047813a --- /dev/null +++ b/ui-plugins/printable-calendar/src/kit/table.ts @@ -0,0 +1,127 @@ +import { extname } from "node:path"; +import ExcelJS from "exceljs"; +import { KitError, type Workspace } from "./workspace.ts"; + +export interface TableData { + columns: string[]; + rows: Record[]; + sheets: string[]; + sheet?: string; +} + +/** UTF-8 解码失败(出现替换字符)时按 GB18030 解码:中文版 Excel 导出的 CSV 常是 GBK。 */ +export function decodeText(bytes: Uint8Array): string { + const utf8 = new TextDecoder("utf-8").decode(bytes); + if (!utf8.includes("\uFFFD")) return utf8.replace(/^\uFEFF/, ""); + try { + return new TextDecoder("gb18030").decode(bytes); + } catch { + return utf8; + } +} + +export function parseCsv(text: string): string[][] { + const first = text.split(/\r?\n/, 1)[0] ?? ""; + const delimiter = [",", "\t", ";"].map((d) => [d, first.split(d).length] as const).sort((a, b) => b[1] - a[1])[0][0]; + const rows: string[][] = []; + let row: string[] = []; + let cell = ""; + let quoted = false; + for (let i = 0; i < text.length; i++) { + const ch = text[i]; + if (quoted) { + if (ch === '"') { + if (text[i + 1] === '"') { + cell += '"'; + i++; + } else quoted = false; + } else cell += ch; + } else if (ch === '"' && cell === "") quoted = true; + else if (ch === delimiter) { + row.push(cell); + cell = ""; + } else if (ch === "\n" || ch === "\r") { + if (ch === "\r" && text[i + 1] === "\n") i++; + row.push(cell); + rows.push(row); + row = []; + cell = ""; + } else cell += ch; + } + if (cell !== "" || row.length) { + row.push(cell); + rows.push(row); + } + return rows.filter((r) => r.some((c) => c.trim() !== "")); +} + +function cellText(value: ExcelJS.CellValue): string { + if (value === null || value === undefined) return ""; + if (value instanceof Date) { + const pad = (n: number) => String(n).padStart(2, "0"); + return `${value.getUTCFullYear()}-${pad(value.getUTCMonth() + 1)}-${pad(value.getUTCDate())}`; + } + if (typeof value === "object") { + if ("richText" in value) return value.richText.map((part) => part.text).join(""); + if ("text" in value) return String(value.text); + if ("result" in value) return cellText(value.result as ExcelJS.CellValue); + if ("error" in value) return ""; + } + return String(value); +} + +function toTable(matrix: string[][], sheets: string[], sheet?: string): TableData { + if (!matrix.length) throw new KitError("empty_table", "The table has no rows."); + const seen = new Map(); + const columns = matrix[0].map((raw, index) => { + let name = raw.trim() || `列${index + 1}`; + const count = seen.get(name) ?? 0; + seen.set(name, count + 1); + if (count) name = `${name}_${count + 1}`; + return name; + }); + const rows = matrix.slice(1).map((cells) => Object.fromEntries(columns.map((column, index) => [column, (cells[index] ?? "").trim()]))); + return { columns, rows, sheets, sheet }; +} + +/** 读取 CSV / TSV / XLSX:第一行是表头。 */ +export interface ReadOptions { + /** 表头不在第一行时(例如银行导出前面有说明文字),用它在前 40 行里找表头行。 */ + findHeader?: (cells: string[]) => boolean; +} + +function headerFirst(matrix: string[][], options?: ReadOptions) { + if (!options?.findHeader) return matrix; + const index = matrix.slice(0, 40).findIndex((cells) => options.findHeader!(cells.map((c) => c.trim()))); + return index > 0 ? matrix.slice(index) : matrix; +} + +export async function readTable(ws: Workspace, path: string, sheet?: string, options?: ReadOptions): Promise { + const ext = extname(path).toLowerCase(); + const bytes = await ws.read(path, 50 * 1024 * 1024); + if (ext === ".csv" || ext === ".tsv" || ext === ".txt") return toTable(headerFirst(parseCsv(decodeText(bytes)), options), []); + if (ext === ".xlsx") { + const book = new ExcelJS.Workbook(); + await book.xlsx.load(bytes as unknown as ArrayBuffer); + const sheets = book.worksheets.map((item) => item.name); + const target = sheet ? book.getWorksheet(sheet) : book.worksheets.find((item) => item.actualRowCount > 0) ?? book.worksheets[0]; + if (!target) throw new KitError("sheet_not_found", `Sheet not found: ${sheet}. Sheets: ${sheets.join(", ")}`); + const matrix: string[][] = []; + target.eachRow({ includeEmpty: false }, (row) => { + const cells: string[] = []; + for (let col = 1; col <= target.columnCount; col++) cells.push(cellText(row.getCell(col).value).trim()); + if (cells.some((cell) => cell)) matrix.push(cells); + }); + return toTable(headerFirst(matrix, options), sheets, target.name); + } + throw new KitError("unsupported_table", `Use a .csv, .tsv or .xlsx file (got ${ext || "no extension"}). Save .xls files as .xlsx first.`); +} + +/** 把 "{列名}" 占位符替换成该行的值。 */ +export function renderPattern(pattern: string, row: Record): string { + return pattern.replace(/\{([^{}]+)\}/g, (_, key: string) => row[key.trim()] ?? ""); +} + +export function patternColumns(pattern: string): string[] { + return [...pattern.matchAll(/\{([^{}=]+)\}/g)].map((match) => match[1].trim()); +} diff --git a/ui-plugins/printable-calendar/src/kit/testing.ts b/ui-plugins/printable-calendar/src/kit/testing.ts new file mode 100644 index 00000000..0d8dc72e --- /dev/null +++ b/ui-plugins/printable-calendar/src/kit/testing.ts @@ -0,0 +1,16 @@ +// 仅测试使用:通过内存传输连接 server,像 Agent 一样调用工具。 +import { Client } from "@modelcontextprotocol/sdk/client/index.js"; +import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js"; +import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; + +export async function connect(server: McpServer) { + const [a, b] = InMemoryTransport.createLinkedPair(); + const client = new Client({ name: "test", version: "1" }); + await Promise.all([server.connect(a), client.connect(b)]); + const call = async (name: string, args: Record = {}) => { + const r = (await client.callTool({ name, arguments: args }, undefined, { timeout: 300_000 })) as any; + if (r.isError) throw Object.assign(new Error(r.content?.[0]?.text ?? "tool error"), { code: r.structuredContent?.error?.code }); + return { text: r.content?.[0]?.text as string, data: r.structuredContent as any }; + }; + return { client, call }; +} diff --git a/ui-plugins/printable-calendar/src/kit/workspace.ts b/ui-plugins/printable-calendar/src/kit/workspace.ts new file mode 100644 index 00000000..7326158b --- /dev/null +++ b/ui-plugins/printable-calendar/src/kit/workspace.ts @@ -0,0 +1,170 @@ +import { lstatSync, readlinkSync, realpathSync } from "node:fs"; +import { mkdir, readFile, readdir, rename, stat, writeFile } from "node:fs/promises"; +import { dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path"; + +export class KitError extends Error { + readonly code: string; + constructor(code: string, message: string) { + super(message); + this.code = code; + this.name = "KitError"; + } +} + +const SKIP = new Set(["node_modules", ".git", "dist", "build", ".next", ".cache", "__pycache__"]); + +/** 只允许读写当前工作区内的文件;所有路径都相对工作区根目录。 */ +export class Workspace { + readonly root: string; + constructor(root: string) { + this.root = resolve(root); + } + + resolve(path: string): string { + if (typeof path !== "string" || !path.trim()) throw new KitError("bad_path", "Path is empty."); + const absolute = resolve(this.root, path); + const rel = relative(this.root, absolute); + if (rel === ".." || rel.startsWith(`..${sep}`) || isAbsolute(rel)) + throw new KitError("outside_workspace", `Path is outside the workspace: ${path}`); + this.assertRealInside(absolute, path); + return absolute; + } + + private realRoot?: string; + + /** + * 符号链接不能把读写带出工作区:从目标往上找到第一个已存在的路径,取它的真实路径, + * 必须仍在工作区根目录的真实路径之下。还不存在的写入目标按其已存在的上级目录判断; + * 指向不存在位置的悬空链接一律拒绝(否则 writeFile 会顺着它在外部建文件)。 + */ + private assertRealInside(absolute: string, path: string) { + let realRoot: string; + try { + realRoot = this.realRoot ??= realpathSync(this.root); + } catch { + return; // 根目录本身不存在时,没有可逃出的链接 + } + const outside = (real: string) => { + const rel = relative(realRoot, real); + return rel === ".." || rel.startsWith(`..${sep}`) || isAbsolute(rel); + }; + let probe = absolute; + for (;;) { + let real: string | undefined; + try { + real = realpathSync(probe); + } catch { + let link = false; + try { + link = lstatSync(probe).isSymbolicLink(); + } catch {} + if (link) { + const target = resolve(dirname(probe), readlinkSync(probe)); + throw new KitError("outside_workspace", outside(target) ? `Path leaves the workspace through a link: ${path}` : `Path goes through a broken link: ${path}`); + } + } + if (real !== undefined) { + if (outside(real)) throw new KitError("outside_workspace", `Path leaves the workspace through a link: ${path}`); + return; + } + const parent = dirname(probe); + if (parent === probe) return; + probe = parent; + } + } + + rel(absolute: string): string { + return relative(this.root, absolute).split(sep).join("/") || "."; + } + + async exists(path: string): Promise { + try { + await stat(this.resolve(path)); + return true; + } catch { + return false; + } + } + + async read(path: string, maxBytes = 200 * 1024 * 1024): Promise { + const absolute = this.resolve(path); + let info; + try { + info = await stat(absolute); + } catch { + throw new KitError("not_found", `File not found: ${path}`); + } + if (!info.isFile()) throw new KitError("not_a_file", `Not a file: ${path}`); + if (info.size > maxBytes) throw new KitError("too_large", `File is larger than ${Math.round(maxBytes / 1048576)} MB: ${path}`); + return readFile(absolute); + } + + async readText(path: string): Promise { + return (await this.read(path, 20 * 1024 * 1024)).toString("utf8"); + } + + async write(path: string, data: Uint8Array | string): Promise { + const absolute = this.resolve(path); + await mkdir(dirname(absolute), { recursive: true }); + await writeFile(absolute, data); + return this.rel(absolute); + } + + /** 在工作区内移动 / 重命名文件;目标已存在时拒绝,不覆盖。 */ + async move(from: string, to: string): Promise { + const source = this.resolve(from); + const target = this.resolve(to); + if (!(await this.exists(from))) throw new KitError("not_found", `File not found: ${from}`); + if (await this.exists(to)) throw new KitError("exists", `Target already exists: ${to}`); + await mkdir(dirname(target), { recursive: true }); + await rename(source, target); + return this.rel(target); + } + + async size(path: string): Promise { + return (await stat(this.resolve(path))).size; + } + + async mtime(path: string): Promise { + return (await stat(this.resolve(path))).mtime; + } + + /** 列出文件(默认递归、跳过依赖与构建目录),按路径排序。 */ + async list({ dir = ".", exts, recursive = true, limit = 2000 }: { dir?: string; exts?: string[]; recursive?: boolean; limit?: number } = {}) { + const wanted = exts?.map((ext) => ext.toLowerCase()); + const out: { path: string; size: number }[] = []; + const walk = async (absolute: string, depth: number) => { + if (out.length >= limit || depth > 8) return; + let entries; + try { + entries = await readdir(absolute, { withFileTypes: true }); + } catch { + return; + } + entries.sort((a, b) => a.name.localeCompare(b.name, "en", { numeric: true })); + for (const entry of entries) { + if (out.length >= limit) return; + if (entry.name.startsWith(".") && entry.name !== ".") continue; + const child = join(absolute, entry.name); + if (entry.isDirectory()) { + if (recursive && !SKIP.has(entry.name)) await walk(child, depth + 1); + } else if (entry.isFile() && (!wanted?.length || wanted.includes(extname(entry.name).toLowerCase()))) { + out.push({ path: this.rel(child), size: (await stat(child)).size }); + } + } + }; + await walk(this.resolve(dir), 0); + return out; + } +} + +/** 把文件名中不适合的字符替换掉,保留中文。 */ +export function safeFileName(name: string, fallback = "file"): string { + const cleaned = name + .replace(/[\\/:*?"<>|]+/g, "_") + .replace(/\p{Cc}+/gu, "_") + .replace(/\s+/g, " ") + .trim() + .replace(/^\.+/, ""); + return (cleaned || fallback).slice(0, 120); +} From af521512d60b90f4810e47d14c8aa4708d522825 Mon Sep 17 00:00:00 2001 From: ppppp2005-p <360128433+ppppp2005-p@users.noreply.github.com> Date: Thu, 26 Nov 2026 05:08:50 -0400 Subject: [PATCH 11/11] feat(ui-plugins): add Printable Calendar (printable-calendar) --- .../printable-calendar/test/samples/events.csv | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 ui-plugins/printable-calendar/test/samples/events.csv diff --git a/ui-plugins/printable-calendar/test/samples/events.csv b/ui-plugins/printable-calendar/test/samples/events.csv new file mode 100644 index 00000000..7700611d --- /dev/null +++ b/ui-plugins/printable-calendar/test/samples/events.csv @@ -0,0 +1,14 @@ +日期,结束日期,事项,类型,颜色 +2027-01-01,2027-01-01,元旦,假期, +2027-02-06,2027-02-12,春节假期(示例),假期, +2027-01-15,,项目启动会,活动,#2563eb +2027-01-20,2027-01-22,深圳出差,活动,#7c3aed +2027-02-14,,情人节,活动,#db2777 +2027-03-08,,妇女节下午半天假,活动,#db2777 +2027-03-21,,马拉松报名截止,活动,#ea580c +2027-04-05,,清明(示例),假期, +2027-05-01,2027-05-05,劳动节假期(示例),假期, +2027-05-09,,调休上班,补班, +2027-06-18,,年中复盘,活动,#2563eb +2027-10-01,2027-10-07,国庆假期(示例),假期, +2027-12-24,,年会,活动,#16a34a