@qingwu-ui/ai-editor 1.1.7 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/README.md +1 -0
  2. package/dist/components/ai-settings-dialog.d.ts.map +1 -1
  3. package/dist/editor/ai/components/ai-selector.d.ts.map +1 -1
  4. package/dist/editor/ai/index.d.ts +11 -0
  5. package/dist/editor/ai/index.d.ts.map +1 -1
  6. package/dist/editor/ai/providers/deepseek.d.ts.map +1 -1
  7. package/dist/editor/ai/providers/openai-compat.d.ts.map +1 -1
  8. package/dist/editor/ai/providers/openai.d.ts.map +1 -1
  9. package/dist/editor/ai/providers/qwen.d.ts.map +1 -1
  10. package/dist/editor/ai-editor.d.ts +2 -0
  11. package/dist/editor/ai-editor.d.ts.map +1 -1
  12. package/dist/editor/extensions/chinese-emphasis.d.ts +29 -0
  13. package/dist/editor/extensions/chinese-emphasis.d.ts.map +1 -0
  14. package/dist/editor/extensions/index.d.ts.map +1 -1
  15. package/dist/editor/i18n/en-US.d.ts +10 -0
  16. package/dist/editor/i18n/en-US.d.ts.map +1 -1
  17. package/dist/editor/i18n/zh-CN.d.ts +10 -0
  18. package/dist/editor/i18n/zh-CN.d.ts.map +1 -1
  19. package/dist/{export-dialog-Co3pPwTl.cjs → export-dialog-Bbcjve99.cjs} +1 -1
  20. package/dist/{export-dialog-Bnbjhxoc.js → export-dialog-BtkB6LbG.js} +1 -1
  21. package/dist/index.cjs +20 -16
  22. package/dist/index.js +1401 -1296
  23. package/dist/{sanitize-ths-sP-x.js → sanitize-DFL2uU6q.js} +20 -0
  24. package/dist/{sanitize-BebkUITX.cjs → sanitize-DgZP4RYI.cjs} +1 -1
  25. package/dist/{signed-fetch-BuPD4Q0V.cjs → signed-fetch-BEr-TrwK.cjs} +1 -1
  26. package/dist/{storage-settings-dialog-BPlrjhQc.cjs → storage-settings-dialog-aE92oAQF.cjs} +1 -1
  27. package/dist/styles.css +1 -1
  28. package/package.json +1 -1
@@ -107,6 +107,14 @@ var t = {
107
107
  zap: "自定义指令",
108
108
  zapDesc: "输入自定义指令",
109
109
  thinking: "正在思考…",
110
+ reasoning: "思考过程",
111
+ reasoningDone: "思考已结束",
112
+ reasoningStopped: "思考已中止",
113
+ result: "生成结果",
114
+ generating: "正在生成正文…",
115
+ completed: "生成完成",
116
+ interrupted: "生成中断",
117
+ failed: "生成失败",
110
118
  replace: "替换选中",
111
119
  replaceAll: "全文替换",
112
120
  replaceTitle: "确认替换选中",
@@ -123,6 +131,8 @@ var t = {
123
131
  insert: "在下方插入",
124
132
  discard: "放弃",
125
133
  error: "请求失败,请重试",
134
+ emptyResult: "AI 未返回正文,请重试或切换模型。",
135
+ outputLimit: "AI 已达到输出上限,但未生成正文。请提高最大输出 token 数,或在服务支持时关闭思考后重试。",
126
136
  confirm: "确定",
127
137
  back: "返回",
128
138
  customPlaceholder: "例如:把这段内容改写成小红书风格"
@@ -323,6 +333,14 @@ var t = {
323
333
  zap: "Custom",
324
334
  zapDesc: "Enter a custom command",
325
335
  thinking: "Thinking…",
336
+ reasoning: "Thinking process",
337
+ reasoningDone: "Thinking finished",
338
+ reasoningStopped: "Thinking stopped",
339
+ result: "Generated result",
340
+ generating: "Generating text…",
341
+ completed: "Generation complete",
342
+ interrupted: "Generation interrupted",
343
+ failed: "Generation failed",
326
344
  replace: "Replace selection",
327
345
  replaceAll: "Replace all",
328
346
  replaceTitle: "Replace selection",
@@ -339,6 +357,8 @@ var t = {
339
357
  insert: "Insert below",
340
358
  discard: "Discard",
341
359
  error: "Request failed, please retry",
360
+ emptyResult: "AI returned no text. Please retry or switch models.",
361
+ outputLimit: "AI reached the output limit without generating text. Increase the maximum output tokens, or disable thinking if supported, then retry.",
342
362
  confirm: "Confirm",
343
363
  back: "Back",
344
364
  customPlaceholder: "e.g. Rewrite this in a more casual tone"
@@ -1 +1 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));let u=require("dompurify");u=l(u,1);var d={"zh-CN":{editor:{placeholder:`输入 '/' 打开命令菜单,或继续输入内容…`,wordCount:`共 {count} 字`,characterCount:`共 {count} 字符`,toolbar:{export:`导出`,exportTitle:`导出文档`,ai:`AI 编写`,aiTitle:`AI 编写助手`},loading:`加载编辑器中…`,prompt:`输入 / 打开命令菜单 · 选中文本弹出格式菜单 · 点击写作助手辅助写作`,attachment:{preview:`预览`,download:`下载`,delete:`删除`,loadingPreview:`加载预览中…`,lost:`附件已丢失`},slash:{heading1:`一级标题`,heading1Desc:`大号标题`,heading2:`二级标题`,heading2Desc:`中号标题`,heading3:`三级标题`,heading3Desc:`小号标题`,heading4:`四级标题`,heading4Desc:`更小标题`,heading5:`五级标题`,heading5Desc:`小小标题`,heading6:`六级标题`,heading6Desc:`最小标题`,searchPlaceholder:`搜索命令…`,bulletList:`无序列表`,bulletListDesc:`创建无序列表`,numberedList:`有序列表`,numberedListDesc:`创建有序列表`,taskList:`任务列表`,taskListDesc:`创建可勾选的任务`,blockquote:`引用块`,blockquoteDesc:`插入引用`,codeBlock:`代码块`,codeBlockDesc:`插入代码块`,image:`图片`,imageDesc:`上传或粘贴图片`,horizontalRule:`分隔线`,horizontalRuleDesc:`插入分隔线`,video:`导入视频`,videoDesc:`导入 B站、直链 mp4/m3u8、小红书等视频`,audio:`导入音频`,audioDesc:`从本地选择音频文件,支持 mp3/wav/flac/aac 等`,attachment:`添加附件`,attachmentDesc:`上传任意类型文件,以附件链接形式插入`,mathInline:`行内公式`,mathInlineDesc:`插入 LaTeX 行内公式,如 $E=mc^2$`,mathBlock:`块级公式`,mathBlockDesc:`插入 LaTeX 块级公式,支持多行`,xiaohongshu:`小红书`,xiaohongshuDesc:`嵌入小红书笔记`},math:{inlineTitle:`编辑行内公式`,blockTitle:`编辑块级公式`,placeholder:`输入 LaTeX,例如 \\frac{a}{b}`,empty:`点击输入公式`,emptyPreview:`输入 LaTeX 后在此预览`,hint:`支持 LaTeX 语法;Ctrl/Cmd + Enter 保存`,inlineClickHint:`单击定位光标,双击编辑公式`,cancel:`取消`,save:`保存`},bubble:{bold:`加粗`,italic:`斜体`,underline:`下划线`,strikethrough:`删除线`,code:`行内代码`,emphasis:`强调`,mathInline:`行内公式`,link:`链接`,highlight:`高亮`,copy:`复制`,search:`搜索`,table:`表格`,more:`更多`},ai:{trigger:`写作助手`,triggerDesc:`选中文字后选择 AI 操作,生成结果可替换或插入原文。`,close:`关闭`,continue:`续写`,continueDesc:`从当前位置继续写作`,improve:`润色`,improveDesc:`优化表达,提升文采`,shorter:`精简`,shorterDesc:`让文字更简洁`,longer:`扩写`,longerDesc:`丰富内容细节`,fix:`修正`,fixDesc:`修正语法和错别字`,translate:`翻译`,translateDesc:`翻译为其他语言`,zap:`自定义指令`,zapDesc:`输入自定义指令`,thinking:`正在思考…`,replace:`替换选中`,replaceAll:`全文替换`,replaceTitle:`确认替换选中`,replaceAllTitle:`确认全文替换`,replaceText:`将用 AI 生成结果替换当前选中内容。`,replaceAllText:`将用 AI 生成结果替换当前全部内容。`,removeNodes:`以下媒体节点将被移除:`,nodeImage:`图片`,nodeAttachment:`附件`,nodeVideo:`视频`,nodeAudio:`音频`,confirmReplace:`确认替换`,cancel:`取消`,insert:`在下方插入`,discard:`放弃`,error:`请求失败,请重试`,confirm:`确定`,back:`返回`,customPlaceholder:`例如:把这段内容改写成小红书风格`},export:{title:`导出文档`,html:`HTML`,htmlDesc:`图片和附件保留为资源链接`,json:`JSON (Tiptap)`,jsonDesc:`导出为 Tiptap JSON 格式`,md:`Markdown`,mdDesc:`包含资源时打包 Markdown、图片和附件`,plainText:`纯文本`,plainTextDesc:`导出为纯文本`,pdf:`PDF`,pdfDesc:`展示图片,附件显示图标和名称`,copy:`复制到剪贴板`,copied:`已复制`,download:`下载`,preparing:`准备中…`,failed:`导出失败,请重试。`,popupBlocked:`请允许打开打印窗口后重试。`,footer:`Markdown 含资源时下载 ZIP;PDF 展示图片;其他格式保留资源地址。`},image:{upload:`上传图片`,uploading:`上传中…`,error:`上传失败`,dragTip:`拖拽图片到此处或点击上传`},link:{placeholder:`输入链接地址…`,save:`确定`,remove:`移除链接`}},app:{title:`青梧`,subtitle:`智能编辑器`,settings:`设置`,theme:{label:`主题`,light:`浅色`,dark:`深色`,system:`跟随系统`},themeToggle:{toDark:`切换深色`,toLight:`切换浅色`},font:{label:`字体`,sans:`默认字体`,serif:`宋体/衬线`,mono:`等宽字体`},language:`语言`,about:`关于青梧`,footer:{line1:`青梧 QingWu · 基于 Tiptap 构建 · 支持 DeepSeek / 通义千问 / OpenAI 等大模型`,license:`Apache-2.0 License`}},tour:{welcome:{title:`欢迎使用青梧编辑器`,description:`青梧是一款面向中文用户的 AI 智能编辑器,支持 Markdown、代码高亮、Mermaid 图表等丰富功能。点击「下一步」开始了解。`},mode:{title:`编辑 / 查看模式`,description:`点击此按钮可在「编辑模式」和「查看模式」之间切换。查看模式下内容只读,操作按钮会隐藏,适合阅读和展示。`},fullscreen:{title:`全屏模式`,description:`提供「网页全屏」和「浏览器全屏」两种沉浸式写作体验,让你专注于内容创作。`},ai:{title:`AI 写作助手`,description:`配置 DeepSeek、通义千问、OpenAI 等大模型后,可使用续写、润色、精简、扩写、修正、翻译等 AI 辅助功能。`},lang:{title:`中英文切换`,description:`编辑器和界面支持中文和英文两种语言,点击即可切换。`},font:{title:`字体切换`,description:`提供默认字体、衬线字体和等宽字体三种阅读体验,满足不同场景需求。`},editor:{title:`编辑器内容区`,description:`在此区域输入内容。输入 / 打开命令菜单插入各种元素,选中文本弹出格式菜单,点击写作助手触发 AI 辅助。`}}},"en-US":{editor:{placeholder:`Type '/' for commands, or continue writing…`,wordCount:`{count} words`,characterCount:`{count} characters`,toolbar:{export:`Export`,exportTitle:`Export Document`,ai:`AI Write`,aiTitle:`AI Writing Assistant`},loading:`Loading editor…`,prompt:`Type / for commands · Select text for formatting · Click Writing Assistant for help`,attachment:{preview:`Preview`,download:`Download`,delete:`Delete`,loadingPreview:`Loading preview…`,lost:`Attachment lost`},slash:{heading1:`Heading 1`,heading1Desc:`Large heading`,heading2:`Heading 2`,heading2Desc:`Medium heading`,heading3:`Heading 3`,heading3Desc:`Small heading`,heading4:`Heading 4`,heading4Desc:`Smaller heading`,heading5:`Heading 5`,heading5Desc:`Tiny heading`,heading6:`Heading 6`,heading6Desc:`Smallest heading`,searchPlaceholder:`Search commands…`,bulletList:`Bullet List`,bulletListDesc:`Create a bullet list`,numberedList:`Numbered List`,numberedListDesc:`Create a numbered list`,taskList:`Task List`,taskListDesc:`Create a task list`,blockquote:`Blockquote`,blockquoteDesc:`Insert a blockquote`,codeBlock:`Code Block`,codeBlockDesc:`Insert code block`,image:`Image`,imageDesc:`Upload or paste an image`,horizontalRule:`Divider`,horizontalRuleDesc:`Insert a divider`,video:`Import Video`,videoDesc:`Import Bilibili, direct mp4/m3u8, RedNote videos`,audio:`Import Audio`,audioDesc:`Select audio file from local (mp3/wav/flac/aac)`,attachment:`Add Attachment`,attachmentDesc:`Upload any file type as attachment link`,mathInline:`Inline Formula`,mathInlineDesc:`Insert an inline LaTeX formula, e.g. $E=mc^2$`,mathBlock:`Block Formula`,mathBlockDesc:`Insert a block LaTeX formula with multi-line support`,xiaohongshu:`RedNote`,xiaohongshuDesc:`Embed RedNote post`},math:{inlineTitle:`Edit Inline Formula`,blockTitle:`Edit Block Formula`,placeholder:`Enter LaTeX, e.g. \\frac{a}{b}`,empty:`Click to add formula`,emptyPreview:`Preview appears here`,hint:`LaTeX supported; Ctrl/Cmd + Enter to save`,inlineClickHint:`Click to place the cursor, double-click to edit`,cancel:`Cancel`,save:`Save`},bubble:{bold:`Bold`,italic:`Italic`,underline:`Underline`,strikethrough:`Strikethrough`,code:`Inline Code`,emphasis:`Emphasis`,mathInline:`Inline Math`,link:`Link`,highlight:`Highlight`,copy:`Copy`,search:`Search`,table:`Table`,more:`More`},ai:{trigger:`Writing Assistant`,triggerDesc:`Select text and pick an AI action. The result can replace or insert into the document.`,close:`Close`,continue:`Continue`,continueDesc:`Continue writing from here`,improve:`Improve`,improveDesc:`Polish and improve text`,shorter:`Shorten`,shorterDesc:`Make it more concise`,longer:`Expand`,longerDesc:`Add more detail`,fix:`Fix`,fixDesc:`Fix grammar and typos`,translate:`Translate`,translateDesc:`Translate to another language`,zap:`Custom`,zapDesc:`Enter a custom command`,thinking:`Thinking…`,replace:`Replace selection`,replaceAll:`Replace all`,replaceTitle:`Replace selection`,replaceAllTitle:`Replace all content`,replaceText:`The AI result will replace the current selection.`,replaceAllText:`The AI result will replace the entire document.`,removeNodes:`The following media nodes will be removed:`,nodeImage:`Image`,nodeAttachment:`Attachment`,nodeVideo:`Video`,nodeAudio:`Audio`,confirmReplace:`Replace`,cancel:`Cancel`,insert:`Insert below`,discard:`Discard`,error:`Request failed, please retry`,confirm:`Confirm`,back:`Back`,customPlaceholder:`e.g. Rewrite this in a more casual tone`},export:{title:`Export Document`,html:`HTML`,htmlDesc:`Keep images and attachments as links`,json:`JSON (Tiptap)`,jsonDesc:`Export as Tiptap JSON`,md:`Markdown`,mdDesc:`Bundle Markdown and resources in a ZIP`,plainText:`Plain Text`,plainTextDesc:`Export as plain text`,pdf:`PDF`,pdfDesc:`Show images and attachment names with icons`,copy:`Copy to clipboard`,copied:`Copied`,download:`Download`,preparing:`Preparing…`,failed:`Export failed. Please try again.`,popupBlocked:`Allow the print window and try again.`,footer:`Markdown includes resources in a ZIP; PDF displays images; other formats keep resource URLs.`},image:{upload:`Upload image`,uploading:`Uploading…`,error:`Upload failed`,dragTip:`Drag image here or click to upload`},link:{placeholder:`Enter link URL…`,save:`Save`,remove:`Remove link`}},app:{title:`QingWu`,subtitle:`Smart Editor`,settings:`Settings`,theme:{label:`Theme`,light:`Light`,dark:`Dark`,system:`System`},themeToggle:{toDark:`Switch to dark`,toLight:`Switch to light`},font:{label:`Font`,sans:`Default`,serif:`Serif`,mono:`Mono`},language:`Language`,about:`About QingWu`,footer:{line1:`QingWu · Built on Tiptap · Supports DeepSeek / Qwen / OpenAI models`,license:`Apache-2.0 License`}},tour:{welcome:{title:`Welcome to QingWu Editor`,description:`QingWu is an AI-powered smart editor for Chinese users, supporting Markdown, code highlighting, Mermaid diagrams, and more. Click 'Next' to get started.`},mode:{title:`Edit / View Mode`,description:`Toggle between edit mode and view (read-only) mode. In view mode, content is read-only and action buttons are hidden — ideal for reading and presenting.`},fullscreen:{title:`Fullscreen Mode`,description:`Choose between 'page fullscreen' and 'browser fullscreen' for a focused, distraction-free writing experience.`},ai:{title:`AI Writing Assistant`,description:`After configuring DeepSeek, Qwen, OpenAI, or compatible models, access AI features like continue writing, polish, shorten, expand, fix grammar, and translate.`},lang:{title:`Language Toggle`,description:`Switch between Chinese and English for the editor interface and UI.`},font:{title:`Font Switcher`,description:`Choose between default, serif, and monospace fonts for different reading experiences.`},editor:{title:`Editor Content Area`,description:`Type your content here. Type '/' to open the command menu, select text for the formatting bubble menu, and use the AI assistant for smart writing help.`}}}},f=`zh-CN`;function p(e){f=e,typeof document<`u`&&(document.documentElement.lang=e)}function m(){return f}function h(e){let t=d[f],n=e.split(`.`),r=t;for(let t of n)if(r&&typeof r==`object`&&t in r)r=r[t];else return e;return typeof r==`string`?r:e}function g(e,...t){let n=h(e);if(t.length===0)return n;if(t.length===1&&typeof t[0]==`object`){let e=t[0];for(let[t,r]of Object.entries(e))n=n.replaceAll(`{${t}}`,String(r));return n}for(let e=0;e<t.length;e++)n=n.replaceAll(`{${e}}`,String(t[e]));return t.length===1&&/\{\w+\}/.test(n)&&(n=n.replace(/\{\w+\}/,String(t[0]))),n}function _(){return typeof window<`u`&&window.document&&u.default.isSupported?u.default:null}function v(e){let t={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`};return e.replace(/[&<>"']/g,e=>t[e]||e)}function y(e){let t=_();return t?t.sanitize(e,{ALLOW_DATA_ATTR:!0,ADD_ATTR:[`target`,`rel`],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|blob):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i}):v(e)}function b(e){let t=_();return t?t.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:[`foreignObject`,`animate`,`set`,`animateMotion`,`animateTransform`]}):v(e)}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return l}});
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));let u=require("dompurify");u=l(u,1);var d={"zh-CN":{editor:{placeholder:`输入 '/' 打开命令菜单,或继续输入内容…`,wordCount:`共 {count} 字`,characterCount:`共 {count} 字符`,toolbar:{export:`导出`,exportTitle:`导出文档`,ai:`AI 编写`,aiTitle:`AI 编写助手`},loading:`加载编辑器中…`,prompt:`输入 / 打开命令菜单 · 选中文本弹出格式菜单 · 点击写作助手辅助写作`,attachment:{preview:`预览`,download:`下载`,delete:`删除`,loadingPreview:`加载预览中…`,lost:`附件已丢失`},slash:{heading1:`一级标题`,heading1Desc:`大号标题`,heading2:`二级标题`,heading2Desc:`中号标题`,heading3:`三级标题`,heading3Desc:`小号标题`,heading4:`四级标题`,heading4Desc:`更小标题`,heading5:`五级标题`,heading5Desc:`小小标题`,heading6:`六级标题`,heading6Desc:`最小标题`,searchPlaceholder:`搜索命令…`,bulletList:`无序列表`,bulletListDesc:`创建无序列表`,numberedList:`有序列表`,numberedListDesc:`创建有序列表`,taskList:`任务列表`,taskListDesc:`创建可勾选的任务`,blockquote:`引用块`,blockquoteDesc:`插入引用`,codeBlock:`代码块`,codeBlockDesc:`插入代码块`,image:`图片`,imageDesc:`上传或粘贴图片`,horizontalRule:`分隔线`,horizontalRuleDesc:`插入分隔线`,video:`导入视频`,videoDesc:`导入 B站、直链 mp4/m3u8、小红书等视频`,audio:`导入音频`,audioDesc:`从本地选择音频文件,支持 mp3/wav/flac/aac 等`,attachment:`添加附件`,attachmentDesc:`上传任意类型文件,以附件链接形式插入`,mathInline:`行内公式`,mathInlineDesc:`插入 LaTeX 行内公式,如 $E=mc^2$`,mathBlock:`块级公式`,mathBlockDesc:`插入 LaTeX 块级公式,支持多行`,xiaohongshu:`小红书`,xiaohongshuDesc:`嵌入小红书笔记`},math:{inlineTitle:`编辑行内公式`,blockTitle:`编辑块级公式`,placeholder:`输入 LaTeX,例如 \\frac{a}{b}`,empty:`点击输入公式`,emptyPreview:`输入 LaTeX 后在此预览`,hint:`支持 LaTeX 语法;Ctrl/Cmd + Enter 保存`,inlineClickHint:`单击定位光标,双击编辑公式`,cancel:`取消`,save:`保存`},bubble:{bold:`加粗`,italic:`斜体`,underline:`下划线`,strikethrough:`删除线`,code:`行内代码`,emphasis:`强调`,mathInline:`行内公式`,link:`链接`,highlight:`高亮`,copy:`复制`,search:`搜索`,table:`表格`,more:`更多`},ai:{trigger:`写作助手`,triggerDesc:`选中文字后选择 AI 操作,生成结果可替换或插入原文。`,close:`关闭`,continue:`续写`,continueDesc:`从当前位置继续写作`,improve:`润色`,improveDesc:`优化表达,提升文采`,shorter:`精简`,shorterDesc:`让文字更简洁`,longer:`扩写`,longerDesc:`丰富内容细节`,fix:`修正`,fixDesc:`修正语法和错别字`,translate:`翻译`,translateDesc:`翻译为其他语言`,zap:`自定义指令`,zapDesc:`输入自定义指令`,thinking:`正在思考…`,reasoning:`思考过程`,reasoningDone:`思考已结束`,reasoningStopped:`思考已中止`,result:`生成结果`,generating:`正在生成正文…`,completed:`生成完成`,interrupted:`生成中断`,failed:`生成失败`,replace:`替换选中`,replaceAll:`全文替换`,replaceTitle:`确认替换选中`,replaceAllTitle:`确认全文替换`,replaceText:`将用 AI 生成结果替换当前选中内容。`,replaceAllText:`将用 AI 生成结果替换当前全部内容。`,removeNodes:`以下媒体节点将被移除:`,nodeImage:`图片`,nodeAttachment:`附件`,nodeVideo:`视频`,nodeAudio:`音频`,confirmReplace:`确认替换`,cancel:`取消`,insert:`在下方插入`,discard:`放弃`,error:`请求失败,请重试`,emptyResult:`AI 未返回正文,请重试或切换模型。`,outputLimit:`AI 已达到输出上限,但未生成正文。请提高最大输出 token 数,或在服务支持时关闭思考后重试。`,confirm:`确定`,back:`返回`,customPlaceholder:`例如:把这段内容改写成小红书风格`},export:{title:`导出文档`,html:`HTML`,htmlDesc:`图片和附件保留为资源链接`,json:`JSON (Tiptap)`,jsonDesc:`导出为 Tiptap JSON 格式`,md:`Markdown`,mdDesc:`包含资源时打包 Markdown、图片和附件`,plainText:`纯文本`,plainTextDesc:`导出为纯文本`,pdf:`PDF`,pdfDesc:`展示图片,附件显示图标和名称`,copy:`复制到剪贴板`,copied:`已复制`,download:`下载`,preparing:`准备中…`,failed:`导出失败,请重试。`,popupBlocked:`请允许打开打印窗口后重试。`,footer:`Markdown 含资源时下载 ZIP;PDF 展示图片;其他格式保留资源地址。`},image:{upload:`上传图片`,uploading:`上传中…`,error:`上传失败`,dragTip:`拖拽图片到此处或点击上传`},link:{placeholder:`输入链接地址…`,save:`确定`,remove:`移除链接`}},app:{title:`青梧`,subtitle:`智能编辑器`,settings:`设置`,theme:{label:`主题`,light:`浅色`,dark:`深色`,system:`跟随系统`},themeToggle:{toDark:`切换深色`,toLight:`切换浅色`},font:{label:`字体`,sans:`默认字体`,serif:`宋体/衬线`,mono:`等宽字体`},language:`语言`,about:`关于青梧`,footer:{line1:`青梧 QingWu · 基于 Tiptap 构建 · 支持 DeepSeek / 通义千问 / OpenAI 等大模型`,license:`Apache-2.0 License`}},tour:{welcome:{title:`欢迎使用青梧编辑器`,description:`青梧是一款面向中文用户的 AI 智能编辑器,支持 Markdown、代码高亮、Mermaid 图表等丰富功能。点击「下一步」开始了解。`},mode:{title:`编辑 / 查看模式`,description:`点击此按钮可在「编辑模式」和「查看模式」之间切换。查看模式下内容只读,操作按钮会隐藏,适合阅读和展示。`},fullscreen:{title:`全屏模式`,description:`提供「网页全屏」和「浏览器全屏」两种沉浸式写作体验,让你专注于内容创作。`},ai:{title:`AI 写作助手`,description:`配置 DeepSeek、通义千问、OpenAI 等大模型后,可使用续写、润色、精简、扩写、修正、翻译等 AI 辅助功能。`},lang:{title:`中英文切换`,description:`编辑器和界面支持中文和英文两种语言,点击即可切换。`},font:{title:`字体切换`,description:`提供默认字体、衬线字体和等宽字体三种阅读体验,满足不同场景需求。`},editor:{title:`编辑器内容区`,description:`在此区域输入内容。输入 / 打开命令菜单插入各种元素,选中文本弹出格式菜单,点击写作助手触发 AI 辅助。`}}},"en-US":{editor:{placeholder:`Type '/' for commands, or continue writing…`,wordCount:`{count} words`,characterCount:`{count} characters`,toolbar:{export:`Export`,exportTitle:`Export Document`,ai:`AI Write`,aiTitle:`AI Writing Assistant`},loading:`Loading editor…`,prompt:`Type / for commands · Select text for formatting · Click Writing Assistant for help`,attachment:{preview:`Preview`,download:`Download`,delete:`Delete`,loadingPreview:`Loading preview…`,lost:`Attachment lost`},slash:{heading1:`Heading 1`,heading1Desc:`Large heading`,heading2:`Heading 2`,heading2Desc:`Medium heading`,heading3:`Heading 3`,heading3Desc:`Small heading`,heading4:`Heading 4`,heading4Desc:`Smaller heading`,heading5:`Heading 5`,heading5Desc:`Tiny heading`,heading6:`Heading 6`,heading6Desc:`Smallest heading`,searchPlaceholder:`Search commands…`,bulletList:`Bullet List`,bulletListDesc:`Create a bullet list`,numberedList:`Numbered List`,numberedListDesc:`Create a numbered list`,taskList:`Task List`,taskListDesc:`Create a task list`,blockquote:`Blockquote`,blockquoteDesc:`Insert a blockquote`,codeBlock:`Code Block`,codeBlockDesc:`Insert code block`,image:`Image`,imageDesc:`Upload or paste an image`,horizontalRule:`Divider`,horizontalRuleDesc:`Insert a divider`,video:`Import Video`,videoDesc:`Import Bilibili, direct mp4/m3u8, RedNote videos`,audio:`Import Audio`,audioDesc:`Select audio file from local (mp3/wav/flac/aac)`,attachment:`Add Attachment`,attachmentDesc:`Upload any file type as attachment link`,mathInline:`Inline Formula`,mathInlineDesc:`Insert an inline LaTeX formula, e.g. $E=mc^2$`,mathBlock:`Block Formula`,mathBlockDesc:`Insert a block LaTeX formula with multi-line support`,xiaohongshu:`RedNote`,xiaohongshuDesc:`Embed RedNote post`},math:{inlineTitle:`Edit Inline Formula`,blockTitle:`Edit Block Formula`,placeholder:`Enter LaTeX, e.g. \\frac{a}{b}`,empty:`Click to add formula`,emptyPreview:`Preview appears here`,hint:`LaTeX supported; Ctrl/Cmd + Enter to save`,inlineClickHint:`Click to place the cursor, double-click to edit`,cancel:`Cancel`,save:`Save`},bubble:{bold:`Bold`,italic:`Italic`,underline:`Underline`,strikethrough:`Strikethrough`,code:`Inline Code`,emphasis:`Emphasis`,mathInline:`Inline Math`,link:`Link`,highlight:`Highlight`,copy:`Copy`,search:`Search`,table:`Table`,more:`More`},ai:{trigger:`Writing Assistant`,triggerDesc:`Select text and pick an AI action. The result can replace or insert into the document.`,close:`Close`,continue:`Continue`,continueDesc:`Continue writing from here`,improve:`Improve`,improveDesc:`Polish and improve text`,shorter:`Shorten`,shorterDesc:`Make it more concise`,longer:`Expand`,longerDesc:`Add more detail`,fix:`Fix`,fixDesc:`Fix grammar and typos`,translate:`Translate`,translateDesc:`Translate to another language`,zap:`Custom`,zapDesc:`Enter a custom command`,thinking:`Thinking…`,reasoning:`Thinking process`,reasoningDone:`Thinking finished`,reasoningStopped:`Thinking stopped`,result:`Generated result`,generating:`Generating text…`,completed:`Generation complete`,interrupted:`Generation interrupted`,failed:`Generation failed`,replace:`Replace selection`,replaceAll:`Replace all`,replaceTitle:`Replace selection`,replaceAllTitle:`Replace all content`,replaceText:`The AI result will replace the current selection.`,replaceAllText:`The AI result will replace the entire document.`,removeNodes:`The following media nodes will be removed:`,nodeImage:`Image`,nodeAttachment:`Attachment`,nodeVideo:`Video`,nodeAudio:`Audio`,confirmReplace:`Replace`,cancel:`Cancel`,insert:`Insert below`,discard:`Discard`,error:`Request failed, please retry`,emptyResult:`AI returned no text. Please retry or switch models.`,outputLimit:`AI reached the output limit without generating text. Increase the maximum output tokens, or disable thinking if supported, then retry.`,confirm:`Confirm`,back:`Back`,customPlaceholder:`e.g. Rewrite this in a more casual tone`},export:{title:`Export Document`,html:`HTML`,htmlDesc:`Keep images and attachments as links`,json:`JSON (Tiptap)`,jsonDesc:`Export as Tiptap JSON`,md:`Markdown`,mdDesc:`Bundle Markdown and resources in a ZIP`,plainText:`Plain Text`,plainTextDesc:`Export as plain text`,pdf:`PDF`,pdfDesc:`Show images and attachment names with icons`,copy:`Copy to clipboard`,copied:`Copied`,download:`Download`,preparing:`Preparing…`,failed:`Export failed. Please try again.`,popupBlocked:`Allow the print window and try again.`,footer:`Markdown includes resources in a ZIP; PDF displays images; other formats keep resource URLs.`},image:{upload:`Upload image`,uploading:`Uploading…`,error:`Upload failed`,dragTip:`Drag image here or click to upload`},link:{placeholder:`Enter link URL…`,save:`Save`,remove:`Remove link`}},app:{title:`QingWu`,subtitle:`Smart Editor`,settings:`Settings`,theme:{label:`Theme`,light:`Light`,dark:`Dark`,system:`System`},themeToggle:{toDark:`Switch to dark`,toLight:`Switch to light`},font:{label:`Font`,sans:`Default`,serif:`Serif`,mono:`Mono`},language:`Language`,about:`About QingWu`,footer:{line1:`QingWu · Built on Tiptap · Supports DeepSeek / Qwen / OpenAI models`,license:`Apache-2.0 License`}},tour:{welcome:{title:`Welcome to QingWu Editor`,description:`QingWu is an AI-powered smart editor for Chinese users, supporting Markdown, code highlighting, Mermaid diagrams, and more. Click 'Next' to get started.`},mode:{title:`Edit / View Mode`,description:`Toggle between edit mode and view (read-only) mode. In view mode, content is read-only and action buttons are hidden — ideal for reading and presenting.`},fullscreen:{title:`Fullscreen Mode`,description:`Choose between 'page fullscreen' and 'browser fullscreen' for a focused, distraction-free writing experience.`},ai:{title:`AI Writing Assistant`,description:`After configuring DeepSeek, Qwen, OpenAI, or compatible models, access AI features like continue writing, polish, shorten, expand, fix grammar, and translate.`},lang:{title:`Language Toggle`,description:`Switch between Chinese and English for the editor interface and UI.`},font:{title:`Font Switcher`,description:`Choose between default, serif, and monospace fonts for different reading experiences.`},editor:{title:`Editor Content Area`,description:`Type your content here. Type '/' to open the command menu, select text for the formatting bubble menu, and use the AI assistant for smart writing help.`}}}},f=`zh-CN`;function p(e){f=e,typeof document<`u`&&(document.documentElement.lang=e)}function m(){return f}function h(e){let t=d[f],n=e.split(`.`),r=t;for(let t of n)if(r&&typeof r==`object`&&t in r)r=r[t];else return e;return typeof r==`string`?r:e}function g(e,...t){let n=h(e);if(t.length===0)return n;if(t.length===1&&typeof t[0]==`object`){let e=t[0];for(let[t,r]of Object.entries(e))n=n.replaceAll(`{${t}}`,String(r));return n}for(let e=0;e<t.length;e++)n=n.replaceAll(`{${e}}`,String(t[e]));return t.length===1&&/\{\w+\}/.test(n)&&(n=n.replace(/\{\w+\}/,String(t[0]))),n}function _(){return typeof window<`u`&&window.document&&u.default.isSupported?u.default:null}function v(e){let t={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`};return e.replace(/[&<>"']/g,e=>t[e]||e)}function y(e){let t=_();return t?t.sanitize(e,{ALLOW_DATA_ATTR:!0,ADD_ATTR:[`target`,`rel`],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|blob):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i}):v(e)}function b(e){let t=_();return t?t.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:[`foreignObject`,`animate`,`set`,`animateMotion`,`animateTransform`]}):v(e)}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return l}});
@@ -1,4 +1,4 @@
1
- const e=require("./sanitize-BebkUITX.cjs");function t(e){let t=typeof e==`string`?new TextEncoder().encode(e):e;return crypto.subtle.digest(`SHA-256`,n(t)).then(e=>Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``))}function n(e){return e instanceof ArrayBuffer?e:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}async function r(e,t){let r=await crypto.subtle.importKey(`raw`,n(e),{name:`HMAC`,hash:`SHA-256`},!1,[`sign`]);return crypto.subtle.sign(`HMAC`,r,new TextEncoder().encode(t))}async function i(e,t,n,i){return r(await r(await r(await r(new TextEncoder().encode(`AWS4${e}`).buffer,t),n),i),`aws4_request`)}async function a(e,n,a,o,s,c){let l=new URL(n),u=l.host,d=l.pathname,f=l.searchParams.toString(),p=new Date().toISOString().replace(/[:-]|\.\d{3}/g,``),m=p.slice(0,8),h=`AWS4-HMAC-SHA256`,g=`${m}/${a}/s3/aws4_request`,_=c?await t(c):await t(``),v=`content-type;host;x-amz-content-sha256;x-amz-date`,y=`application/octet-stream`,b=[h,p,g,await t([e,d,f,`content-type:${y}`,`host:${u}`,`x-amz-content-sha256:${_}`,`x-amz-date:${p}`,``,v,_].join(`
1
+ const e=require("./sanitize-DgZP4RYI.cjs");function t(e){let t=typeof e==`string`?new TextEncoder().encode(e):e;return crypto.subtle.digest(`SHA-256`,n(t)).then(e=>Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``))}function n(e){return e instanceof ArrayBuffer?e:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}async function r(e,t){let r=await crypto.subtle.importKey(`raw`,n(e),{name:`HMAC`,hash:`SHA-256`},!1,[`sign`]);return crypto.subtle.sign(`HMAC`,r,new TextEncoder().encode(t))}async function i(e,t,n,i){return r(await r(await r(await r(new TextEncoder().encode(`AWS4${e}`).buffer,t),n),i),`aws4_request`)}async function a(e,n,a,o,s,c){let l=new URL(n),u=l.host,d=l.pathname,f=l.searchParams.toString(),p=new Date().toISOString().replace(/[:-]|\.\d{3}/g,``),m=p.slice(0,8),h=`AWS4-HMAC-SHA256`,g=`${m}/${a}/s3/aws4_request`,_=c?await t(c):await t(``),v=`content-type;host;x-amz-content-sha256;x-amz-date`,y=`application/octet-stream`,b=[h,p,g,await t([e,d,f,`content-type:${y}`,`host:${u}`,`x-amz-content-sha256:${_}`,`x-amz-date:${p}`,``,v,_].join(`
2
2
  `))].join(`
3
3
  `),x=await i(s,m,a,`s3`),S=Array.from(new Uint8Array(await r(x,b))).map(e=>e.toString(16).padStart(2,`0`)).join(``),C=new Headers;return C.set(`Content-Type`,y),C.set(`x-amz-content-sha256`,_),C.set(`x-amz-date`,p),C.set(`Authorization`,`${h} Credential=${o}/${g}, SignedHeaders=${v}, Signature=${S}`),C}function o(e){let t=e.endpoint.replace(/\/+$/,``),n=new URL(t),r=n.pathname.replace(/\/+$/,``),i=n.hostname===e.bucket||n.hostname.startsWith(`${e.bucket}.`)||r.split(`/`).filter(Boolean).includes(e.bucket)?t:`${t}/${e.bucket}`;return{apiBase:i,accessBase:e.customDomain?`https://${e.customDomain.replace(/^https?:\/\//,``).replace(/\/+$/,``)}`:i}}function s(e,t){try{let n=new URL(e);for(let e of Object.values(o(t))){let t=new URL(`${e}/`);if(n.origin===t.origin&&n.pathname.startsWith(t.pathname)&&!n.username&&!n.password)return n.pathname.slice(t.pathname.length)||null}}catch{}return null}function c(e){let{apiBase:t,accessBase:n}=o(e);return{name:`S3 (${e.bucket})`,type:`s3`,async upload(r,i=`editor`){let o=`.${r.name.split(`.`).pop()||`bin`}`,s=e.uploadPrefix||`qingwu`,c=e.nameTemplate||`{ts}{tz}_{src}_{name}_{rand}{ext}`,l=Date.now(),u=Math.random().toString(36).slice(2),d=r.name.replace(/\.[^.]+$/,``),f=-new Date().getTimezoneOffset(),p=f>=0?`+`:`-`,m=Math.abs(f),h=`${p}${String(Math.floor(m/60)).padStart(2,`0`)}${String(m%60).padStart(2,`0`)}`,g=`${s}/${c.replace(`{ts}`,String(l)).replace(`{tz}`,h).replace(`{src}`,i).replace(`{name}`,d).replace(`{ext}`,o).replace(`{rand}`,u)}`,_=`${t}/${g}`,v=new Uint8Array(await r.arrayBuffer()),y=await a(`PUT`,_,e.region,e.accessKeyId,e.secretAccessKey,v),b=await fetch(_,{method:`PUT`,headers:y,body:v});if(!b.ok){let e=await b.text().catch(()=>``);throw Error(`S3 上传失败: ${b.status} ${e}`)}return`${n}/${g}`},async remove(n){let r=s(n,e);if(r===null)return;let i=`${t}/${r}`,o=await a(`DELETE`,i,e.region,e.accessKeyId,e.secretAccessKey,null),c=await fetch(i,{method:`DELETE`,headers:o});if(!c.ok){let e=await c.text().catch(()=>``);throw Error(`S3 删除失败: ${c.status} ${e}`)}}}}var l=e.l({registerS3PreviewConfig:()=>d,signPreviewUrl:()=>b,signPreviewUrlHeaders:()=>y,signUrl:()=>_}),u=null;function d(e){u=e}function f(e){return e instanceof ArrayBuffer?e:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}async function p(e){let t=typeof e==`string`?new TextEncoder().encode(e):e;return crypto.subtle.digest(`SHA-256`,f(t)).then(e=>Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``))}async function m(e,t){let n=f(e),r=await crypto.subtle.importKey(`raw`,n,{name:`HMAC`,hash:`SHA-256`},!1,[`sign`]);return crypto.subtle.sign(`HMAC`,r,new TextEncoder().encode(t))}async function h(e,t,n,r){let i=new TextEncoder;return m(await m(await m(await m(new Uint8Array(i.encode(`AWS4${e}`)).buffer,t),n),r),`aws4_request`)}async function g(e,t,n,r){let i=new URL(e),a=i.host,o=i.pathname,s=i.searchParams.toString(),c=new Date().toISOString().replace(/[:-]|\.\d{3}/g,``),l=c.slice(0,8),u=`AWS4-HMAC-SHA256`,d=`${l}/${t}/s3/aws4_request`,f=await p(``),g=`host;x-amz-content-sha256;x-amz-date`,_=[u,c,d,await p([`GET`,o,s,`host:${a}`,`x-amz-content-sha256:${f}`,`x-amz-date:${c}`,``,g,f].join(`
4
4
  `))].join(`
@@ -1 +1 @@
1
- const e=require("./signed-fetch-BuPD4Q0V.cjs"),t=require("./storage-VaeLS7eM.cjs"),n=require("./local-a2ROEKrE.cjs");let r=require("react"),i=require("react/jsx-runtime");var a=[{key:`local`,label:`本地`,icon:`💻`},{key:`s3`,label:`S3 对象存储`,icon:`☁️`}],o=({open:o,onClose:s})=>{let c=t.t(),[l,u]=(0,r.useState)(c?.type===`local`?`local`:`s3`),[d,f]=(0,r.useState)(!1),[p,m]=(0,r.useState)(!1),[h,g]=(0,r.useState)(null),[_,v]=(0,r.useState)(``),[y,b]=(0,r.useState)(``),[x,S]=(0,r.useState)(`auto`),[C,w]=(0,r.useState)(``),[T,E]=(0,r.useState)(``),[D,O]=(0,r.useState)(``),[k,A]=(0,r.useState)(`qingwu`),[j,M]=(0,r.useState)(`{ts}{tz}_{src}_{name}_{rand}{ext}`);(0,r.useEffect)(()=>{let e=t.r();e?.type===`s3`?(v(e.endpoint||``),b(e.bucket||``),S(e.region||`auto`),w(e.accessKeyId||``),E(e.secretAccessKey||``),O(e.customDomain||``),A(e.uploadPrefix||`qingwu`),M(e.nameTemplate||`{ts}{tz}_{src}_{name}_{rand}{ext}`),u(`s3`)):e?.type===`oss`?(v(`https://${e.bucket}.${e.region}.aliyuncs.com`),b(e.bucket||``),S(e.region||`oss-cn-hangzhou`),w(e.accessKeyId||``),E(e.accessKeySecret||``),O(e.customDomain||``),A(e.uploadPrefix||`qingwu`),M(e.nameTemplate||`{ts}{tz}_{src}_{name}_{rand}{ext}`),u(`s3`)):e?.type===`cos`&&(v(`https://${e.bucket}.cos.${e.region}.myqcloud.com`),b(e.bucket||``),S(e.region||`ap-guangzhou`),w(e.secretId||``),E(e.secretKey||``),O(e.customDomain||``),A(e.uploadPrefix||`qingwu`),M(e.nameTemplate||`{ts}{tz}_{src}_{name}_{rand}{ext}`),u(`s3`))},[]),(0,r.useEffect)(()=>{if(!h)return;let e=window.setTimeout(()=>g(null),4e3);return()=>window.clearTimeout(e)},[h]);let N=(0,r.useCallback)(()=>{g(null);let e=n.t();t.a(e,{type:`local`,location:`浏览器内存 (Base64 编码)`}),f(!0),setTimeout(()=>{f(!1),s()},600)},[s]),P=(0,r.useCallback)(async()=>{if(!p){m(!0),g(null);try{let e=n.t(),t=new File([`qingwu storage test`],`qingwu-storage-test.txt`,{type:`text/plain`}),r=await e.upload(t,`editor`);await e.remove(r).catch(()=>{}),g({type:`success`,message:`本地存储可用`})}catch(e){g({type:`error`,message:e instanceof Error?e.message:`本地存储测试失败`})}finally{m(!1)}}},[p]),F=(0,r.useCallback)(()=>{if(!_||!y||!C)return;g(null);let n={endpoint:_,bucket:y,region:x,accessKeyId:C,secretAccessKey:T,customDomain:D||void 0,uploadPrefix:k||`qingwu`,nameTemplate:j||`{ts}{tz}_{src}_{name}_{rand}{ext}`},r=e.a(n);t.a(r,{type:`s3`,endpoint:_,bucket:y,region:x,accessKeyId:C,secretAccessKey:T,customDomain:D||void 0,uploadPrefix:k||`qingwu`,nameTemplate:j||`{ts}{tz}_{src}_{name}_{rand}{ext}`}),e.t(n),f(!0),setTimeout(()=>{f(!1),s()},600)},[_,y,x,C,T,D,k,j,s]),I=(0,r.useCallback)(async()=>{if(!_||!y||!C||p)return;m(!0),g(null);let t=``;try{let n=e.a({endpoint:_,bucket:y,region:x,accessKeyId:C,secretAccessKey:T,customDomain:D||void 0}),r=new File([`qingwu storage test`],`qingwu-storage-test.txt`,{type:`text/plain`});t=await n.upload(r,`editor`);let i=!1,a=!1;try{i=(await fetch(t,{method:`GET`})).ok}catch{i=!1}if(!i)try{let{signPreviewUrlHeaders:e}=await Promise.resolve().then(()=>require("./signed-fetch-BuPD4Q0V.cjs")).then(e=>e.i),{registerS3PreviewConfig:n}=await Promise.resolve().then(()=>require("./signed-fetch-BuPD4Q0V.cjs")).then(e=>e.i);n({endpoint:_,bucket:y,region:x,accessKeyId:C,secretAccessKey:T,customDomain:D||void 0});let r=await e(t);r&&(await fetch(t,{headers:r})).ok&&(i=!0,a=!0)}catch{}if(!i)throw Error(`上传成功,但访问失败。请确认 Bucket 读写权限配置正确。`);g({type:`success`,message:a?`存储连接成功(私有桶,通过签名访问)`:`存储连接和公开访问均成功`})}catch(e){g({type:`error`,message:e instanceof Error?e.message:`存储连接失败`})}finally{t&&await e.a({endpoint:_,bucket:y,region:x,accessKeyId:C,secretAccessKey:T,customDomain:D||void 0}).remove(t).catch(()=>{}),m(!1)}},[_,y,x,C,T,D,p]);return o?(0,i.jsxs)(`div`,{className:`fixed inset-0 z-[9999] flex items-center justify-center`,children:[h&&(0,i.jsx)(`div`,{className:`fixed right-4 top-4 z-[10001] w-[calc(100vw-2rem)] max-w-sm rounded-xl border px-4 py-3 text-sm shadow-2xl backdrop-blur-sm ${h.type===`success`?`border-green-200 bg-green-50/95 text-green-700`:`border-danger-200 bg-danger-50/95 text-danger`}`,children:(0,i.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,i.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:h.type===`success`?`✓`:`!`}),(0,i.jsx)(`span`,{className:`min-w-0 break-words`,children:h.message})]})}),(0,i.jsx)(`div`,{className:`absolute inset-0 bg-black/40 backdrop-blur-sm`,onClick:s}),(0,i.jsxs)(`div`,{className:`relative w-[calc(100vw-2rem)] max-w-[460px] max-h-[85dvh] bg-background rounded-2xl shadow-2xl border border-default-200 overflow-hidden animate-in`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4 border-b border-default-100`,children:[(0,i.jsx)(`h2`,{className:`text-base font-semibold`,children:`存储设置`}),(0,i.jsx)(`button`,{type:`button`,className:`w-7 h-7 flex items-center justify-center rounded-lg text-default-400 hover:text-default-600 hover:bg-default-100 transition-colors`,onClick:s,children:`✕`})]}),c&&(0,i.jsxs)(`div`,{className:`mx-5 mt-4 p-3 rounded-xl bg-default-50 border border-default-100`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-default-500 mb-1`,children:[(0,i.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-green-500`}),`当前存储服务`]}),(0,i.jsx)(`div`,{className:`text-sm font-medium`,children:c.name}),(0,i.jsx)(`div`,{className:`text-[11px] text-default-400 mt-0.5`,children:c.type===`local`?`位置:浏览器内存 · Base64 编码 · 关闭页面后丢失`:c.type===`s3`&&c.config?.type===`s3`?`${c.config.endpoint} · ${c.config.bucket}${c.config.customDomain?` → ${c.config.customDomain}`:``}`:``})]}),(0,i.jsx)(`div`,{className:`flex border-b border-default-100 px-5 mt-4`,children:a.map(({key:e,label:t,icon:n})=>(0,i.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 px-3 py-2.5 text-sm font-medium transition-colors border-b-2 -mb-[1px] ${l===e?`border-primary text-primary`:`border-transparent text-default-400 hover:text-default-600`}`,onClick:()=>{u(e),f(!1)},children:[(0,i.jsx)(`span`,{children:n}),t]},e))}),(0,i.jsxs)(`div`,{className:`p-5 max-h-[50dvh] overflow-y-auto`,children:[l===`local`&&(0,i.jsxs)(`div`,{className:`space-y-4`,children:[(0,i.jsxs)(`div`,{className:`p-4 rounded-xl bg-blue-50 border border-blue-100`,children:[(0,i.jsx)(`p`,{className:`text-sm font-medium text-blue-800 mb-1`,children:`💻 浏览器内存存储`}),(0,i.jsx)(`p`,{className:`text-xs text-blue-600 leading-relaxed`,children:`文件以 Base64 编码存储在浏览器内存中,页面关闭后清除。 适合演示和临时使用,不建议用于生产环境。`})]}),(0,i.jsx)(`button`,{type:`button`,className:`w-full py-2.5 rounded-xl text-sm font-medium transition-all ${d?`bg-green-500 text-white`:`bg-primary text-white hover:opacity-90`}`,onClick:N,children:d?`✓ 已保存`:`使用本地存储`}),(0,i.jsx)(`button`,{type:`button`,className:`w-full py-2.5 rounded-xl text-sm font-medium border border-default-200 hover:bg-default-100 transition-all disabled:opacity-40`,disabled:p,onClick:P,children:p?`测试中...`:`测试连接`})]}),l===`s3`&&(0,i.jsxs)(`div`,{className:`space-y-3`,children:[(0,i.jsx)(`div`,{className:`p-3 rounded-lg bg-default-50 text-xs text-default-500 leading-relaxed mb-1`,children:`兼容 AWS S3、Cloudflare R2、MinIO、阿里云 OSS、腾讯云 COS 等所有 S3 协议对象存储服务。`}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`label`,{className:`block text-xs text-default-500 mb-1`,children:`Endpoint *`}),(0,i.jsx)(`input`,{className:`w-full px-3 py-2 rounded-lg border border-default-200 bg-background text-sm focus:outline-none focus:border-primary`,placeholder:`https://<account>.r2.cloudflarestorage.com`,value:_,onChange:e=>v(e.target.value)})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`label`,{className:`block text-xs text-default-500 mb-1`,children:`Bucket 名称 *`}),(0,i.jsx)(`input`,{className:`w-full px-3 py-2 rounded-lg border border-default-200 bg-background text-sm focus:outline-none focus:border-primary`,placeholder:`my-bucket`,value:y,onChange:e=>b(e.target.value)})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`label`,{className:`block text-xs text-default-500 mb-1`,children:`Region`}),(0,i.jsx)(`input`,{className:`w-full px-3 py-2 rounded-lg border border-default-200 bg-background text-sm focus:outline-none focus:border-primary`,placeholder:`auto / us-east-1 / ap-northeast-1`,value:x,onChange:e=>S(e.target.value)}),(0,i.jsxs)(`p`,{className:`text-[11px] text-default-400 mt-0.5`,children:[`R2 / MinIO 填 `,(0,i.jsx)(`code`,{children:`auto`}),`,AWS 按实际区域填写`]})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`label`,{className:`block text-xs text-default-500 mb-1`,children:`Access Key ID *`}),(0,i.jsx)(`input`,{className:`w-full px-3 py-2 rounded-lg border border-default-200 bg-background text-sm focus:outline-none focus:border-primary`,placeholder:`AKIAIOSFODNN7EXAMPLE`,value:C,onChange:e=>w(e.target.value)})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`label`,{className:`block text-xs text-default-500 mb-1`,children:`Secret Access Key`}),(0,i.jsx)(`input`,{type:`password`,className:`w-full px-3 py-2 rounded-lg border border-default-200 bg-background text-sm focus:outline-none focus:border-primary`,placeholder:`••••••••`,value:T,onChange:e=>E(e.target.value)})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`label`,{className:`block text-xs text-default-500 mb-1`,children:`自定义访问域名(CDN,可选)`}),(0,i.jsx)(`input`,{className:`w-full px-3 py-2 rounded-lg border border-default-200 bg-background text-sm focus:outline-none focus:border-primary`,placeholder:`cdn.example.com`,value:D,onChange:e=>O(e.target.value)}),(0,i.jsx)(`p`,{className:`text-[11px] text-default-400 mt-0.5`,children:`设置后,上传返回的资源 URL 将使用此域名`})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`label`,{className:`block text-xs text-default-500 mb-1`,children:`资源目录`}),(0,i.jsx)(`input`,{className:`w-full px-3 py-2 rounded-lg border border-default-200 bg-background text-sm focus:outline-none focus:border-primary`,placeholder:`qingwu`,value:k,onChange:e=>A(e.target.value)}),(0,i.jsx)(`p`,{className:`text-[11px] text-default-400 mt-0.5`,children:`上传文件的存储目录,默认 qingwu(MinIO/S3 路径风格需填 bucket 名)`})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`label`,{className:`block text-xs text-default-500 mb-1`,children:`文件名模板`}),(0,i.jsx)(`input`,{className:`w-full px-3 py-2 rounded-lg border border-default-200 bg-background text-sm focus:outline-none focus:border-primary`,placeholder:`{ts}{tz}_{src}_{name}_{rand}{ext}`,value:j,onChange:e=>M(e.target.value)}),(0,i.jsx)(`p`,{className:`text-[11px] text-default-400 mt-0.5`,children:`占位符: {ts}=时间戳, {tz}=时区, {src}=出处(editor/cover), {name}=原名, {ext}=扩展名, {rand}=随机串`})]}),(0,i.jsxs)(`div`,{className:`p-3 rounded-lg bg-default-50 text-[11px] text-default-500 leading-relaxed`,children:[`上传路径:`,_&&y?`${_}/${y}/qingwu/...`:`请填写 Endpoint 和 Bucket`,D?`\n访问域名:https://${D}/qingwu/...`:``]}),(0,i.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,i.jsx)(`button`,{type:`button`,className:`py-2.5 rounded-xl text-sm font-medium border border-default-200 hover:bg-default-100 transition-all disabled:opacity-40`,disabled:!_||!y||!C||p,onClick:I,children:p?`测试中...`:`测试连接`}),(0,i.jsx)(`button`,{type:`button`,className:`py-2.5 rounded-xl text-sm font-medium transition-all disabled:opacity-40 ${d?`bg-green-500 text-white`:`bg-primary text-white hover:opacity-90`}`,disabled:!_||!y||!C||p,onClick:F,children:d?`✓ 已保存`:`保存并应用`})]})]})]})]})]}):null};exports.StorageSettingsDialog=o;
1
+ const e=require("./signed-fetch-BEr-TrwK.cjs"),t=require("./storage-VaeLS7eM.cjs"),n=require("./local-a2ROEKrE.cjs");let r=require("react"),i=require("react/jsx-runtime");var a=[{key:`local`,label:`本地`,icon:`💻`},{key:`s3`,label:`S3 对象存储`,icon:`☁️`}],o=({open:o,onClose:s})=>{let c=t.t(),[l,u]=(0,r.useState)(c?.type===`local`?`local`:`s3`),[d,f]=(0,r.useState)(!1),[p,m]=(0,r.useState)(!1),[h,g]=(0,r.useState)(null),[_,v]=(0,r.useState)(``),[y,b]=(0,r.useState)(``),[x,S]=(0,r.useState)(`auto`),[C,w]=(0,r.useState)(``),[T,E]=(0,r.useState)(``),[D,O]=(0,r.useState)(``),[k,A]=(0,r.useState)(`qingwu`),[j,M]=(0,r.useState)(`{ts}{tz}_{src}_{name}_{rand}{ext}`);(0,r.useEffect)(()=>{let e=t.r();e?.type===`s3`?(v(e.endpoint||``),b(e.bucket||``),S(e.region||`auto`),w(e.accessKeyId||``),E(e.secretAccessKey||``),O(e.customDomain||``),A(e.uploadPrefix||`qingwu`),M(e.nameTemplate||`{ts}{tz}_{src}_{name}_{rand}{ext}`),u(`s3`)):e?.type===`oss`?(v(`https://${e.bucket}.${e.region}.aliyuncs.com`),b(e.bucket||``),S(e.region||`oss-cn-hangzhou`),w(e.accessKeyId||``),E(e.accessKeySecret||``),O(e.customDomain||``),A(e.uploadPrefix||`qingwu`),M(e.nameTemplate||`{ts}{tz}_{src}_{name}_{rand}{ext}`),u(`s3`)):e?.type===`cos`&&(v(`https://${e.bucket}.cos.${e.region}.myqcloud.com`),b(e.bucket||``),S(e.region||`ap-guangzhou`),w(e.secretId||``),E(e.secretKey||``),O(e.customDomain||``),A(e.uploadPrefix||`qingwu`),M(e.nameTemplate||`{ts}{tz}_{src}_{name}_{rand}{ext}`),u(`s3`))},[]),(0,r.useEffect)(()=>{if(!h)return;let e=window.setTimeout(()=>g(null),4e3);return()=>window.clearTimeout(e)},[h]);let N=(0,r.useCallback)(()=>{g(null);let e=n.t();t.a(e,{type:`local`,location:`浏览器内存 (Base64 编码)`}),f(!0),setTimeout(()=>{f(!1),s()},600)},[s]),P=(0,r.useCallback)(async()=>{if(!p){m(!0),g(null);try{let e=n.t(),t=new File([`qingwu storage test`],`qingwu-storage-test.txt`,{type:`text/plain`}),r=await e.upload(t,`editor`);await e.remove(r).catch(()=>{}),g({type:`success`,message:`本地存储可用`})}catch(e){g({type:`error`,message:e instanceof Error?e.message:`本地存储测试失败`})}finally{m(!1)}}},[p]),F=(0,r.useCallback)(()=>{if(!_||!y||!C)return;g(null);let n={endpoint:_,bucket:y,region:x,accessKeyId:C,secretAccessKey:T,customDomain:D||void 0,uploadPrefix:k||`qingwu`,nameTemplate:j||`{ts}{tz}_{src}_{name}_{rand}{ext}`},r=e.a(n);t.a(r,{type:`s3`,endpoint:_,bucket:y,region:x,accessKeyId:C,secretAccessKey:T,customDomain:D||void 0,uploadPrefix:k||`qingwu`,nameTemplate:j||`{ts}{tz}_{src}_{name}_{rand}{ext}`}),e.t(n),f(!0),setTimeout(()=>{f(!1),s()},600)},[_,y,x,C,T,D,k,j,s]),I=(0,r.useCallback)(async()=>{if(!_||!y||!C||p)return;m(!0),g(null);let t=``;try{let n=e.a({endpoint:_,bucket:y,region:x,accessKeyId:C,secretAccessKey:T,customDomain:D||void 0}),r=new File([`qingwu storage test`],`qingwu-storage-test.txt`,{type:`text/plain`});t=await n.upload(r,`editor`);let i=!1,a=!1;try{i=(await fetch(t,{method:`GET`})).ok}catch{i=!1}if(!i)try{let{signPreviewUrlHeaders:e}=await Promise.resolve().then(()=>require("./signed-fetch-BEr-TrwK.cjs")).then(e=>e.i),{registerS3PreviewConfig:n}=await Promise.resolve().then(()=>require("./signed-fetch-BEr-TrwK.cjs")).then(e=>e.i);n({endpoint:_,bucket:y,region:x,accessKeyId:C,secretAccessKey:T,customDomain:D||void 0});let r=await e(t);r&&(await fetch(t,{headers:r})).ok&&(i=!0,a=!0)}catch{}if(!i)throw Error(`上传成功,但访问失败。请确认 Bucket 读写权限配置正确。`);g({type:`success`,message:a?`存储连接成功(私有桶,通过签名访问)`:`存储连接和公开访问均成功`})}catch(e){g({type:`error`,message:e instanceof Error?e.message:`存储连接失败`})}finally{t&&await e.a({endpoint:_,bucket:y,region:x,accessKeyId:C,secretAccessKey:T,customDomain:D||void 0}).remove(t).catch(()=>{}),m(!1)}},[_,y,x,C,T,D,p]);return o?(0,i.jsxs)(`div`,{className:`fixed inset-0 z-[9999] flex items-center justify-center`,children:[h&&(0,i.jsx)(`div`,{className:`fixed right-4 top-4 z-[10001] w-[calc(100vw-2rem)] max-w-sm rounded-xl border px-4 py-3 text-sm shadow-2xl backdrop-blur-sm ${h.type===`success`?`border-green-200 bg-green-50/95 text-green-700`:`border-danger-200 bg-danger-50/95 text-danger`}`,children:(0,i.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,i.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:h.type===`success`?`✓`:`!`}),(0,i.jsx)(`span`,{className:`min-w-0 break-words`,children:h.message})]})}),(0,i.jsx)(`div`,{className:`absolute inset-0 bg-black/40 backdrop-blur-sm`,onClick:s}),(0,i.jsxs)(`div`,{className:`relative w-[calc(100vw-2rem)] max-w-[460px] max-h-[85dvh] bg-background rounded-2xl shadow-2xl border border-default-200 overflow-hidden animate-in`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4 border-b border-default-100`,children:[(0,i.jsx)(`h2`,{className:`text-base font-semibold`,children:`存储设置`}),(0,i.jsx)(`button`,{type:`button`,className:`w-7 h-7 flex items-center justify-center rounded-lg text-default-400 hover:text-default-600 hover:bg-default-100 transition-colors`,onClick:s,children:`✕`})]}),c&&(0,i.jsxs)(`div`,{className:`mx-5 mt-4 p-3 rounded-xl bg-default-50 border border-default-100`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-default-500 mb-1`,children:[(0,i.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-green-500`}),`当前存储服务`]}),(0,i.jsx)(`div`,{className:`text-sm font-medium`,children:c.name}),(0,i.jsx)(`div`,{className:`text-[11px] text-default-400 mt-0.5`,children:c.type===`local`?`位置:浏览器内存 · Base64 编码 · 关闭页面后丢失`:c.type===`s3`&&c.config?.type===`s3`?`${c.config.endpoint} · ${c.config.bucket}${c.config.customDomain?` → ${c.config.customDomain}`:``}`:``})]}),(0,i.jsx)(`div`,{className:`flex border-b border-default-100 px-5 mt-4`,children:a.map(({key:e,label:t,icon:n})=>(0,i.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 px-3 py-2.5 text-sm font-medium transition-colors border-b-2 -mb-[1px] ${l===e?`border-primary text-primary`:`border-transparent text-default-400 hover:text-default-600`}`,onClick:()=>{u(e),f(!1)},children:[(0,i.jsx)(`span`,{children:n}),t]},e))}),(0,i.jsxs)(`div`,{className:`p-5 max-h-[50dvh] overflow-y-auto`,children:[l===`local`&&(0,i.jsxs)(`div`,{className:`space-y-4`,children:[(0,i.jsxs)(`div`,{className:`p-4 rounded-xl bg-blue-50 border border-blue-100`,children:[(0,i.jsx)(`p`,{className:`text-sm font-medium text-blue-800 mb-1`,children:`💻 浏览器内存存储`}),(0,i.jsx)(`p`,{className:`text-xs text-blue-600 leading-relaxed`,children:`文件以 Base64 编码存储在浏览器内存中,页面关闭后清除。 适合演示和临时使用,不建议用于生产环境。`})]}),(0,i.jsx)(`button`,{type:`button`,className:`w-full py-2.5 rounded-xl text-sm font-medium transition-all ${d?`bg-green-500 text-white`:`bg-primary text-white hover:opacity-90`}`,onClick:N,children:d?`✓ 已保存`:`使用本地存储`}),(0,i.jsx)(`button`,{type:`button`,className:`w-full py-2.5 rounded-xl text-sm font-medium border border-default-200 hover:bg-default-100 transition-all disabled:opacity-40`,disabled:p,onClick:P,children:p?`测试中...`:`测试连接`})]}),l===`s3`&&(0,i.jsxs)(`div`,{className:`space-y-3`,children:[(0,i.jsx)(`div`,{className:`p-3 rounded-lg bg-default-50 text-xs text-default-500 leading-relaxed mb-1`,children:`兼容 AWS S3、Cloudflare R2、MinIO、阿里云 OSS、腾讯云 COS 等所有 S3 协议对象存储服务。`}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`label`,{className:`block text-xs text-default-500 mb-1`,children:`Endpoint *`}),(0,i.jsx)(`input`,{className:`w-full px-3 py-2 rounded-lg border border-default-200 bg-background text-sm focus:outline-none focus:border-primary`,placeholder:`https://<account>.r2.cloudflarestorage.com`,value:_,onChange:e=>v(e.target.value)})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`label`,{className:`block text-xs text-default-500 mb-1`,children:`Bucket 名称 *`}),(0,i.jsx)(`input`,{className:`w-full px-3 py-2 rounded-lg border border-default-200 bg-background text-sm focus:outline-none focus:border-primary`,placeholder:`my-bucket`,value:y,onChange:e=>b(e.target.value)})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`label`,{className:`block text-xs text-default-500 mb-1`,children:`Region`}),(0,i.jsx)(`input`,{className:`w-full px-3 py-2 rounded-lg border border-default-200 bg-background text-sm focus:outline-none focus:border-primary`,placeholder:`auto / us-east-1 / ap-northeast-1`,value:x,onChange:e=>S(e.target.value)}),(0,i.jsxs)(`p`,{className:`text-[11px] text-default-400 mt-0.5`,children:[`R2 / MinIO 填 `,(0,i.jsx)(`code`,{children:`auto`}),`,AWS 按实际区域填写`]})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`label`,{className:`block text-xs text-default-500 mb-1`,children:`Access Key ID *`}),(0,i.jsx)(`input`,{className:`w-full px-3 py-2 rounded-lg border border-default-200 bg-background text-sm focus:outline-none focus:border-primary`,placeholder:`AKIAIOSFODNN7EXAMPLE`,value:C,onChange:e=>w(e.target.value)})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`label`,{className:`block text-xs text-default-500 mb-1`,children:`Secret Access Key`}),(0,i.jsx)(`input`,{type:`password`,className:`w-full px-3 py-2 rounded-lg border border-default-200 bg-background text-sm focus:outline-none focus:border-primary`,placeholder:`••••••••`,value:T,onChange:e=>E(e.target.value)})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`label`,{className:`block text-xs text-default-500 mb-1`,children:`自定义访问域名(CDN,可选)`}),(0,i.jsx)(`input`,{className:`w-full px-3 py-2 rounded-lg border border-default-200 bg-background text-sm focus:outline-none focus:border-primary`,placeholder:`cdn.example.com`,value:D,onChange:e=>O(e.target.value)}),(0,i.jsx)(`p`,{className:`text-[11px] text-default-400 mt-0.5`,children:`设置后,上传返回的资源 URL 将使用此域名`})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`label`,{className:`block text-xs text-default-500 mb-1`,children:`资源目录`}),(0,i.jsx)(`input`,{className:`w-full px-3 py-2 rounded-lg border border-default-200 bg-background text-sm focus:outline-none focus:border-primary`,placeholder:`qingwu`,value:k,onChange:e=>A(e.target.value)}),(0,i.jsx)(`p`,{className:`text-[11px] text-default-400 mt-0.5`,children:`上传文件的存储目录,默认 qingwu(MinIO/S3 路径风格需填 bucket 名)`})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`label`,{className:`block text-xs text-default-500 mb-1`,children:`文件名模板`}),(0,i.jsx)(`input`,{className:`w-full px-3 py-2 rounded-lg border border-default-200 bg-background text-sm focus:outline-none focus:border-primary`,placeholder:`{ts}{tz}_{src}_{name}_{rand}{ext}`,value:j,onChange:e=>M(e.target.value)}),(0,i.jsx)(`p`,{className:`text-[11px] text-default-400 mt-0.5`,children:`占位符: {ts}=时间戳, {tz}=时区, {src}=出处(editor/cover), {name}=原名, {ext}=扩展名, {rand}=随机串`})]}),(0,i.jsxs)(`div`,{className:`p-3 rounded-lg bg-default-50 text-[11px] text-default-500 leading-relaxed`,children:[`上传路径:`,_&&y?`${_}/${y}/qingwu/...`:`请填写 Endpoint 和 Bucket`,D?`\n访问域名:https://${D}/qingwu/...`:``]}),(0,i.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,i.jsx)(`button`,{type:`button`,className:`py-2.5 rounded-xl text-sm font-medium border border-default-200 hover:bg-default-100 transition-all disabled:opacity-40`,disabled:!_||!y||!C||p,onClick:I,children:p?`测试中...`:`测试连接`}),(0,i.jsx)(`button`,{type:`button`,className:`py-2.5 rounded-xl text-sm font-medium transition-all disabled:opacity-40 ${d?`bg-green-500 text-white`:`bg-primary text-white hover:opacity-90`}`,disabled:!_||!y||!C||p,onClick:F,children:d?`✓ 已保存`:`保存并应用`})]})]})]})]})]}):null};exports.StorageSettingsDialog=o;