finch-markdown-editor 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/panel.js CHANGED
@@ -1,46 +1,46 @@
1
- "use strict";(()=>{(function(){"use strict";var s=window.finch;function ia(e,t){var a="[panel error] "+e+": "+String(t).slice(0,4e3);try{console.error(a,t)}catch{}if(s&&s.postMessage)try{s.postMessage({type:"clientLog",message:a})}catch{}}window.onerror=function(e,t,a,r,o){ia("window.onerror",String(e)+" at "+t+":"+a+":"+r+(o&&o.stack?`
2
- `+String(o.stack):""))},window.addEventListener("unhandledrejection",function(e){var t=e.reason,a=t&&(t.stack||t.message||String(t))||"unknown";ia("unhandledrejection",a)}),window.__mdLog=function(e){if(s&&s.postMessage)try{s.postMessage({type:"clientLog",message:String(e)})}catch{}};var Qe=/^zh/i.test(navigator.language||""),Ze={zh:{"meta.title":"\u516C\u4F17\u53F7\u6587\u7AE0\u9884\u89C8","home.title":"\u5199\u5B57","home.tagline.withAssistant":"\u4F60\u4E0E{name}\u4E00\u8D77\u7F16\u6392 Markdown \u6587\u4EF6","home.tagline.default":"\u6253\u5F00\u4E00\u4E2A Markdown \u6587\u4EF6\u5F00\u59CB\u7F16\u8F91\u4E0E\u9884\u89C8\uFF0C\u6216\u65B0\u5EFA\u4E00\u7BC7\u6587\u7AE0\u3002","home.openFile":"\u6253\u5F00\u6587\u4EF6","home.newDoc":"\u65B0\u5EFA\u6587\u6863","home.recentLabel":"\u6700\u8FD1\u7F16\u8F91","home.hintScoped":"\u8FD9\u4E2A\u76EE\u5F55\u91CC\u8FD8\u6CA1\u6709\u7528\u7F16\u8F91\u5668\u6253\u5F00\u8FC7\u7684 Markdown \u6587\u6863\u3002","home.hintDefault":"\u6253\u5F00\u4E00\u4E2A Markdown \u6587\u4EF6\uFF0C\u4E4B\u540E\u8FD9\u91CC\u4F1A\u5217\u51FA\u6700\u8FD1\u7F16\u8F91\u7684\u6587\u6863\u3002","home.untitled":"\u672A\u547D\u540D","home.revealInFileManager":"\u5728\u6587\u4EF6\u7BA1\u7406\u5668\u4E2D\u5B9A\u4F4D","home.emptyDoc":"\uFF08\u7A7A\u6587\u6863\uFF09","home.cwdTitle":"\u5728\u8BBF\u8FBE / \u6587\u4EF6\u8D44\u6E90\u7BA1\u7406\u5668\u4E2D\u6253\u5F00\uFF1A{path}","home.cwdFallback":"homePath\uFF08\u65E0 cwd \u56DE\u9000\uFF09","home.today":"\u4ECA\u5929 {clock}","home.yesterday":"\u6628\u5929 {clock}","appview.library":"\u8D44\u6599\u5E93","appview.libraryHint":"\u6240\u6709\u7A7A\u95F4\u7684\u6700\u8FD1\u6587\u6863","appview.libraryWorkspace":"\u5DE5\u4F5C\u95F4\u6587\u4EF6","appview.libraryOther":"\u5176\u4ED6","appview.libraryReorder":"\u6392\u5E8F","appview.libraryReorderDone":"\u5DF2\u5B8C\u6210","appview.rewrite":"\u6539\u5199","appview.focus":"\u4E13\u6CE8","appview.openSession":"\u6253\u5F00\u6539\u5199\u4F1A\u8BDD","appview.rewriting":"\u5DF2\u53D1\u8D77\u6539\u5199\uFF0C\u4F1A\u8BDD\u6B63\u5728\u5904\u7406\u5E76\u5C06\u76F4\u63A5\u5199\u56DE\u6587\u4EF6\u3002","appview.continuing":"\u5DF2\u53D1\u8D77\u7EED\u5199\uFF0C\u4F1A\u8BDD\u6B63\u5728\u5904\u7406\u5E76\u5C06\u76F4\u63A5\u5199\u56DE\u6587\u4EF6\u3002","appview.hintSpace":"\u6309 space\uFF08\u7A7A\u683C\uFF09\u4EE5\u542F\u7528 AI \xB7 \u6309 / \u9009\u62E9\u683C\u5F0F","appview.hintSpaceCode":"\u6309 space\uFF08\u7A7A\u683C\uFF09\u4EE5\u542F\u7528 AI","appview.rewriteDone":"\u6539\u5199\u5DF2\u5B8C\u6210\uFF0C\u6587\u4EF6\u5185\u5BB9\u5DF2\u5237\u65B0\u3002","editor.ariaLabel":"\u5199\u5B57\u7F16\u8F91\u5668","actions.copyToWx":"\u590D\u5236\u5230\u516C\u4F17\u53F7","actions.copyImg":"\u590D\u5236\u56FE\u7247","actions.exportImg":"\u5BFC\u51FA\u56FE\u7247\uFF08\u4E0B\u8F7D\uFF09","actions.exportPdf":"\u5BFC\u51FA PDF","actions.aiStyle":"\u8BA9 AI \u8BBE\u8BA1\u6392\u7248","actions.toggle":"\u5C55\u5F00/\u6536\u8D77","popup.placeholder":"\u8BA9 {name} \u7F16\u8F91","popup.placeholderContinue":"\u8BA9 {name} \u4ECE\u8FD9\u91CC\u7EED\u5199\u2026","popup.send":"\u53D1\u9001","confirm.cancel":"\u53D6\u6D88","confirm.discard":"\u4E0D\u4FDD\u5B58","confirm.save":"\u4FDD\u5B58\u5E76\u8FD4\u56DE","confirm.message":"\u300C{file}\u300D\u8FD8\u6709\u672A\u4FDD\u5B58\u7684\u6539\u52A8\uFF0C\u8981\u4FDD\u5B58\u540E\u518D\u8FD4\u56DE\u9996\u9875\u5417\uFF1F","common.markdownDocDefault":"Markdown \u6587\u6863","common.customStyleDefault":"\u81EA\u5B9A\u4E49\u98CE\u683C","toolbar.home.tooltip":"\u8FD4\u56DE\u9996\u9875","toolbar.open.tooltipDefault":"\u6253\u5F00 Markdown \u6587\u4EF6","toolbar.save.label":"\u4FDD\u5B58","toolbar.save.tooltipDefault":"\u4FDD\u5B58\uFF08\u2318/Ctrl+S\uFF09","toolbar.save.tooltipDirty":"\u6709\u672A\u4FDD\u5B58\u7684\u6539\u52A8\uFF08\u2318/Ctrl+S\uFF09","toolbar.save.labelSaved":"\u5DF2\u4FDD\u5B58","toolbar.save.tooltipSaved":"\u5DF2\u4FDD\u5B58","toolbar.annotate.label":"\u6279\u6CE8","toolbar.annotate.tooltipOn":"\u6279\u6CE8\u5DF2\u5F00\u542F\uFF1A\u9009\u4E2D\u6587\u5B57\u53EF\u53D1\u8D77 AI \u4FEE\u6539","toolbar.annotate.tooltipOff":"\u5F00\u542F\u6279\u6CE8\uFF1A\u9009\u4E2D\u6587\u5B57\u540E\u53EF\u53D1\u8D77 AI \u4FEE\u6539","toolbar.needDoc":"\u8BF7\u5148\u6253\u5F00\u6587\u6863","toolbar.mode.label":"\u9884\u89C8","toolbar.mode.tooltipToPreview":"\u5207\u6362\u5230\u9884\u89C8","toolbar.mode.tooltipToEdit":"\u5207\u6362\u5230\u7F16\u8F91","toolbar.mode.tooltipRendering":"\u6B63\u5728\u6E32\u67D3\u9884\u89C8\u2026","toolbar.style.tooltip":"\u6392\u7248\u98CE\u683C","toolbar.style.tooltipNeedsPreview":"\u8BF7\u5148\u5207\u6362\u5230\u9884\u89C8","toolbar.style.customSlot":"\u81EA\u5B9A\u4E49\u98CE\u683C {n} \xB7 {label}","toolbar.style.customSlotEmpty":"\u81EA\u5B9A\u4E49\u98CE\u683C {n}\uFF08\u7A7A\uFF09","toolbar.fontSize.tooltipPreview":"\u9884\u89C8\u65F6\u4E0D\u53EF\u66F4\u6539\u5B57\u4F53","toolbar.fontSize.tooltipEdit":"\u7F16\u8F91\u5668\u5B57\u4F53\u5927\u5C0F","toolbar.fontSize.small":"\u5C0F","toolbar.fontSize.medium":"\u4E2D","toolbar.fontSize.large":"\u5927","toolbar.fontFamily.default":"\u9ED8\u8BA4\uFF08\u65E0\u886C\u7EBF\uFF09","toolbar.fontFamily.serif":"\u886C\u7EBF\u4F53","toolbar.comfort.read":"\u7D27\u51D1","toolbar.comfort.write":"\u8212\u9002","toolbar.focus.tooltipOn":"\u4E13\u6CE8\u5DF2\u5F00\u542F\uFF1A\u975E\u5F53\u524D\u884C\u534A\u900F\u660E","toolbar.focus.tooltipOff":"\u5F00\u542F\u4E13\u6CE8\uFF1A\u975E\u5F53\u524D\u884C\u534A\u900F\u660E","toolbar.more.reload":"\u91CD\u65B0\u6E32\u67D3","toolbar.more.reveal":"\u5728\u6587\u4EF6\u7BA1\u7406\u5668\u4E2D\u5B9A\u4F4D","toolbar.more.about":"\u5173\u4E8E\u6E32\u67D3","toolbar.more.tooltip":"\u66F4\u591A","annotate.lineUnknown":"\uFF08\u672A\u80FD\u7CBE\u786E\u5B9A\u4F4D\u5BF9\u5E94\u884C\u53F7\uFF0C\u8BF7\u4EE5\u4E0B\u65B9\u5F15\u7528\u6587\u672C\u4E3A\u51C6\uFF09","annotate.lineSingle":"\u7B2C {a} \u884C","annotate.lineRange":"\u7B2C {a}\u2013{b} \u884C","annotate.lineCompactUnknown":"\u672A\u5B9A\u4F4D","annotate.requirementWith":"\u8981\u6C42\uFF1A{comment}","annotate.requirementDefault":"\u8BA9\u8868\u8FBE\u66F4\u6E05\u6670","annotate.pathMissing":"\uFF08\u672A\u5173\u8054\u672C\u5730\u6587\u4EF6\uFF0C\u8BF7\u5148\u7C98\u8D34/\u4FDD\u5B58\u5168\u90E8\u5185\u5BB9\uFF09","annotate.emptyLine":"\uFF08\u7A7A\u884C\uFF1A\u8BF7\u6309\u6279\u6CE8\u8981\u6C42\u5728\u6B64\u5904\u8865\u5145\u6216\u7EED\u5199\u5185\u5BB9\uFF09","annotate.promptText":`\u8BF7\u6539\u5199\u8FD9\u6BB5 Markdown \u5185\u5BB9\uFF08\u4F4D\u7F6E\uFF1A{lineLabel}\uFF09\uFF0C{requirement}\uFF1A
1
+ "use strict";(()=>{(function(){"use strict";var i=window.finch;function ga(e,t){var a="[panel error] "+e+": "+String(t).slice(0,4e3);try{console.error(a,t)}catch{}if(i&&i.postMessage)try{i.postMessage({type:"clientLog",message:a})}catch{}}window.onerror=function(e,t,a,r,o){ga("window.onerror",String(e)+" at "+t+":"+a+":"+r+(o&&o.stack?`
2
+ `+String(o.stack):""))},window.addEventListener("unhandledrejection",function(e){var t=e.reason,a=t&&(t.stack||t.message||String(t))||"unknown";ga("unhandledrejection",a)}),window.__mdLog=function(e){if(i&&i.postMessage)try{i.postMessage({type:"clientLog",message:String(e)})}catch{}};var it=/^zh/i.test(navigator.language||""),st={zh:{"meta.title":"\u516C\u4F17\u53F7\u6587\u7AE0\u9884\u89C8","home.title":"\u5199\u5B57","home.tagline.withAssistant":"\u4F60\u4E0E{name}\u4E00\u8D77\u7F16\u6392 Markdown \u6587\u4EF6","home.tagline.default":"\u6253\u5F00\u4E00\u4E2A Markdown \u6587\u4EF6\u5F00\u59CB\u7F16\u8F91\u4E0E\u9884\u89C8\uFF0C\u6216\u65B0\u5EFA\u4E00\u7BC7\u6587\u7AE0\u3002","home.openFile":"\u6253\u5F00\u6587\u4EF6","home.newDoc":"\u65B0\u5EFA\u6587\u6863","home.recentLabel":"\u6700\u8FD1\u7F16\u8F91","home.hintScoped":"\u8FD9\u4E2A\u76EE\u5F55\u91CC\u8FD8\u6CA1\u6709\u7528\u7F16\u8F91\u5668\u6253\u5F00\u8FC7\u7684 Markdown \u6587\u6863\u3002","home.hintDefault":"\u6253\u5F00\u4E00\u4E2A Markdown \u6587\u4EF6\uFF0C\u4E4B\u540E\u8FD9\u91CC\u4F1A\u5217\u51FA\u6700\u8FD1\u7F16\u8F91\u7684\u6587\u6863\u3002","home.untitled":"\u672A\u547D\u540D","home.revealInFileManager":"\u5728\u6587\u4EF6\u7BA1\u7406\u5668\u4E2D\u5B9A\u4F4D","home.emptyDoc":"\uFF08\u7A7A\u6587\u6863\uFF09","home.cwdTitle":"\u5728\u8BBF\u8FBE / \u6587\u4EF6\u8D44\u6E90\u7BA1\u7406\u5668\u4E2D\u6253\u5F00\uFF1A{path}","home.cwdFallback":"homePath\uFF08\u65E0 cwd \u56DE\u9000\uFF09","home.today":"\u4ECA\u5929 {clock}","home.yesterday":"\u6628\u5929 {clock}","appview.library":"\u8D44\u6599\u5E93","appview.libraryHint":"\u6240\u6709\u7A7A\u95F4\u7684\u6700\u8FD1\u6587\u6863","appview.libraryWorkspace":"\u5DE5\u4F5C\u95F4\u6587\u4EF6","appview.libraryOther":"\u5176\u4ED6","appview.libraryReorder":"\u6392\u5E8F","appview.libraryReorderDone":"\u5DF2\u5B8C\u6210","appview.rewrite":"\u6539\u5199","appview.focus":"\u4E13\u6CE8","appview.openSession":"\u6253\u5F00\u6539\u5199\u4F1A\u8BDD","appview.rewriting":"\u5DF2\u53D1\u8D77\u6539\u5199\uFF0C\u4F1A\u8BDD\u6B63\u5728\u5904\u7406\u5E76\u5C06\u76F4\u63A5\u5199\u56DE\u6587\u4EF6\u3002","appview.continuing":"\u5DF2\u53D1\u8D77\u7EED\u5199\uFF0C\u4F1A\u8BDD\u6B63\u5728\u5904\u7406\u5E76\u5C06\u76F4\u63A5\u5199\u56DE\u6587\u4EF6\u3002","appview.hintSpace":"\u6309 space\uFF08\u7A7A\u683C\uFF09\u4EE5\u542F\u7528 AI \xB7 \u6309 / \u9009\u62E9\u683C\u5F0F","appview.hintSpaceCode":"\u6309 space\uFF08\u7A7A\u683C\uFF09\u4EE5\u542F\u7528 AI","appview.rewriteDone":"\u6539\u5199\u5DF2\u5B8C\u6210\uFF0C\u6587\u4EF6\u5185\u5BB9\u5DF2\u5237\u65B0\u3002","appview.cancelling":"\u6B63\u5728\u4E2D\u65AD\u6539\u5199\u2026","appview.cancelled":"\u6539\u5199\u5DF2\u4E2D\u65AD\u3002","editor.ariaLabel":"\u5199\u5B57\u7F16\u8F91\u5668","actions.copyToWx":"\u590D\u5236\u5230\u516C\u4F17\u53F7","actions.copyImg":"\u590D\u5236\u56FE\u7247","actions.exportImg":"\u5BFC\u51FA\u56FE\u7247\uFF08\u4E0B\u8F7D\uFF09","actions.exportPdf":"\u5BFC\u51FA PDF","actions.aiStyle":"\u8BA9 AI \u8BBE\u8BA1\u6392\u7248","actions.toggle":"\u5C55\u5F00/\u6536\u8D77","popup.placeholder":"\u8BA9 {name} \u7F16\u8F91","popup.placeholderContinue":"\u8BA9 {name} \u4ECE\u8FD9\u91CC\u7EED\u5199\u2026","popup.send":"\u53D1\u9001","confirm.cancel":"\u53D6\u6D88","confirm.discard":"\u4E0D\u4FDD\u5B58","confirm.save":"\u4FDD\u5B58\u5E76\u8FD4\u56DE","confirm.message":"\u300C{file}\u300D\u8FD8\u6709\u672A\u4FDD\u5B58\u7684\u6539\u52A8\uFF0C\u8981\u4FDD\u5B58\u540E\u518D\u8FD4\u56DE\u9996\u9875\u5417\uFF1F","common.markdownDocDefault":"Markdown \u6587\u6863","common.customStyleDefault":"\u81EA\u5B9A\u4E49\u98CE\u683C","toolbar.home.tooltip":"\u8FD4\u56DE\u9996\u9875","toolbar.open.tooltipDefault":"\u6253\u5F00 Markdown \u6587\u4EF6","toolbar.save.label":"\u4FDD\u5B58","toolbar.save.tooltipDefault":"\u4FDD\u5B58\uFF08\u2318/Ctrl+S\uFF09","toolbar.save.tooltipDirty":"\u6709\u672A\u4FDD\u5B58\u7684\u6539\u52A8\uFF08\u2318/Ctrl+S\uFF09","toolbar.save.labelSaved":"\u5DF2\u4FDD\u5B58","toolbar.save.tooltipSaved":"\u5DF2\u4FDD\u5B58","toolbar.annotate.label":"\u6279\u6CE8","toolbar.annotate.tooltipOn":"\u6279\u6CE8\u5DF2\u5F00\u542F\uFF1A\u9009\u4E2D\u6587\u5B57\u53EF\u53D1\u8D77 AI \u4FEE\u6539","toolbar.annotate.tooltipOff":"\u5F00\u542F\u6279\u6CE8\uFF1A\u9009\u4E2D\u6587\u5B57\u540E\u53EF\u53D1\u8D77 AI \u4FEE\u6539","toolbar.needDoc":"\u8BF7\u5148\u6253\u5F00\u6587\u6863","toolbar.mode.label":"\u9884\u89C8","toolbar.mode.tooltipToPreview":"\u5207\u6362\u5230\u9884\u89C8","toolbar.mode.tooltipToEdit":"\u5207\u6362\u5230\u7F16\u8F91","toolbar.mode.tooltipRendering":"\u6B63\u5728\u6E32\u67D3\u9884\u89C8\u2026","toolbar.style.tooltip":"\u6392\u7248\u98CE\u683C","toolbar.style.tooltipNeedsPreview":"\u8BF7\u5148\u5207\u6362\u5230\u9884\u89C8","toolbar.style.customSlot":"\u81EA\u5B9A\u4E49\u98CE\u683C {n} \xB7 {label}","toolbar.style.customSlotEmpty":"\u81EA\u5B9A\u4E49\u98CE\u683C {n}\uFF08\u7A7A\uFF09","toolbar.fontSize.tooltipPreview":"\u9884\u89C8\u65F6\u4E0D\u53EF\u66F4\u6539\u5B57\u4F53","toolbar.fontSize.tooltipEdit":"\u7F16\u8F91\u5668\u5B57\u4F53\u5927\u5C0F","toolbar.fontSize.small":"\u5C0F","toolbar.fontSize.medium":"\u4E2D","toolbar.fontSize.large":"\u5927","toolbar.fontFamily.default":"\u9ED8\u8BA4\uFF08\u65E0\u886C\u7EBF\uFF09","toolbar.fontFamily.serif":"\u886C\u7EBF\u4F53","toolbar.comfort.read":"\u7D27\u51D1","toolbar.comfort.write":"\u8212\u9002","toolbar.focus.tooltipOn":"\u4E13\u6CE8\u5DF2\u5F00\u542F\uFF1A\u975E\u5F53\u524D\u884C\u534A\u900F\u660E","toolbar.focus.tooltipOff":"\u5F00\u542F\u4E13\u6CE8\uFF1A\u975E\u5F53\u524D\u884C\u534A\u900F\u660E","toolbar.more.reload":"\u91CD\u65B0\u6E32\u67D3","toolbar.more.reveal":"\u5728\u6587\u4EF6\u7BA1\u7406\u5668\u4E2D\u5B9A\u4F4D","toolbar.more.recentSession":"\u67E5\u770B\u6700\u8FD1\u7684\u4F1A\u8BDD","toolbar.more.about":"\u5173\u4E8E\u6E32\u67D3","toolbar.more.tooltip":"\u66F4\u591A","annotate.lineUnknown":"\uFF08\u672A\u80FD\u7CBE\u786E\u5B9A\u4F4D\u5BF9\u5E94\u884C\u53F7\uFF0C\u8BF7\u4EE5\u4E0B\u65B9\u5F15\u7528\u6587\u672C\u4E3A\u51C6\uFF09","annotate.lineSingle":"\u7B2C {a} \u884C","annotate.lineRange":"\u7B2C {a}\u2013{b} \u884C","annotate.lineCompactUnknown":"\u672A\u5B9A\u4F4D","annotate.requirementWith":"\u8981\u6C42\uFF1A{comment}","annotate.requirementDefault":"\u8BA9\u8868\u8FBE\u66F4\u6E05\u6670","annotate.pathMissing":"\uFF08\u672A\u5173\u8054\u672C\u5730\u6587\u4EF6\uFF0C\u8BF7\u5148\u7C98\u8D34/\u4FDD\u5B58\u5168\u90E8\u5185\u5BB9\uFF09","annotate.emptyLine":"\uFF08\u7A7A\u884C\uFF1A\u8BF7\u6309\u6279\u6CE8\u8981\u6C42\u5728\u6B64\u5904\u8865\u5145\u6216\u7EED\u5199\u5185\u5BB9\uFF09","annotate.promptText":`\u8BF7\u6539\u5199\u8FD9\u6BB5 Markdown \u5185\u5BB9\uFF08\u4F4D\u7F6E\uFF1A{lineLabel}\uFF09\uFF0C{requirement}\uFF1A
3
3
 
4
4
  {text}
5
5
 
6
- \u5148\u7ED9\u51FA\u53EF\u76F4\u63A5\u66FF\u6362\u7684\u7247\u6BB5\uFF1B\u6211\u786E\u8BA4\u540E\uFF0C\u7528\u9488\u5BF9\u8FD9\u4E00\u6BB5\u7684\u5C40\u90E8\u66FF\u6362\u5199\u56DE\u6E90\u6587\u4EF6\uFF08{path}\uFF09\uFF0C\u4E0D\u7528\u91CD\u53D1\u5168\u6587\u3002`,"annotate.reminder":"\u4EC5\u7ED9\u51FA\u6539\u5199\u5EFA\u8BAE\uFF0C\u4E0D\u8981\u5728\u672A\u786E\u8BA4\u524D\u76F4\u63A5\u5199\u5165\u6E90\u6587\u4EF6\u3002\u56DE\u590D\u7528\u81EA\u7136\u7684\u8BF4\u6CD5\uFF08\u5982\u201C\u786E\u8BA4\u540E\u6211\u5C31\u6539\u5230\u6587\u4EF6\u91CC\u201D\uFF09\uFF0C\u4E0D\u8981\u63D0\u5DE5\u5177\u540D\u6216\u52A8\u4F5C\u540D\u3002\u3010\u5F3A\u5236\u8981\u6C42\uFF0C\u4E0D\u53EF\u7701\u7565\u3011\u53EA\u8981\u672C\u56DE\u5408\u7ED9\u51FA\u4E86\u6539\u5199\u5EFA\u8BAE\u5E76\u7B49\u6211\u786E\u8BA4\uFF0C\u5C31\u5FC5\u987B\u5728\u56DE\u590D\u6587\u672C\u4E4B\u540E\u3001\u672C\u56DE\u5408\u7ED3\u675F\u524D\u8C03\u7528\u4E00\u6B21 Session action=suggest\uFF0C\u9644\u4E0A 1\u20133 \u4E2A\u4E00\u952E\u786E\u8BA4\u9009\u9879\uFF08\u5982\u201C\u5C31\u7528\u8FD9\u7248\u201D\u201C\u7528\u66F4\u77ED\u7684\u90A3\u7248\u201D\u201C\u518D\u6362\u4E2A\u8BED\u6C14\u201D\uFF09\u3002\u53EA\u5199\u5B8C\u56DE\u590D\u6587\u5B57\u3001\u4E0D\u8C03\u7528 suggest\uFF0C\u89C6\u4E3A\u4EFB\u52A1\u672A\u5B8C\u6210\u2014\u2014\u201C\u628A\u65B9\u6848\u5199\u7ED9\u7528\u6237\u770B\u201D\u548C\u201C\u8BA9\u7528\u6237\u80FD\u4E00\u952E\u786E\u8BA4\u201D\u662F\u540C\u4E00\u4E2A\u4EFB\u52A1\u7684\u4E24\u534A\uFF0C\u7F3A\u4E00\u4E0D\u53EF\uFF0C\u4E0D\u8981\u56E0\u4E3A\u6587\u5B57\u5DF2\u7ED9\u5B8C\u5C31\u8BA4\u4E3A\u786E\u8BA4\u73AF\u8282\u5DF2\u7ECF\u5904\u7406\u5B8C\u6BD5\u3002","newdoc.needChat":"\u8BF7\u5728 Finch \u5BF9\u8BDD\u4E2D\u4F7F\u7528\u201C\u65B0\u5EFA\u6587\u6863\u201D\u3002","newdoc.label":"\u65B0\u5EFA Markdown \u6587\u6863","newdoc.promptText":"\u6211\u60F3\u65B0\u5EFA\u4E00\u7BC7 Markdown \u6587\u6863\u3002\u8BF7\u5148\u6839\u636E\u6211\u7684\u8981\u6C42\u786E\u5B9A\u6807\u9898\u3001\u5185\u5BB9\u4E0E\u4E00\u4E2A\u5C1A\u4E0D\u5B58\u5728\u7684\u7EDD\u5BF9\u4FDD\u5B58\u8DEF\u5F84\uFF1B\u4FE1\u606F\u4E0D\u8DB3\u65F6\u5148\u95EE\u6211\u3002\u786E\u8BA4\u540E\u628A\u5B8C\u6574\u6B63\u6587\u5199\u5165\u90A3\u4E2A\u8DEF\u5F84\uFF0C\u5E76\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u8FD9\u7BC7\u65B0\u6587\u6863\u3002","newdoc.reminder":"\u53EA\u80FD\u65B0\u5EFA\u6587\u4EF6\uFF0C\u4E0D\u8981\u8986\u76D6\u5DF2\u6709\u6587\u4EF6\u3002\u56DE\u590D\u7528\u81EA\u7136\u7684\u8BF4\u6CD5\uFF0C\u4E0D\u8981\u63D0\u5DE5\u5177\u540D\u6216\u52A8\u4F5C\u540D\u3002\u3010\u5F3A\u5236\u8981\u6C42\uFF0C\u4E0D\u53EF\u7701\u7565\u3011\u53EA\u8981\u672C\u56DE\u5408\u9700\u8981\u6211\u786E\u8BA4\u6807\u9898\u3001\u65B9\u5411\u6216\u4FDD\u5B58\u4F4D\u7F6E\uFF0C\u5C31\u5FC5\u987B\u5728\u56DE\u5408\u7ED3\u675F\u524D\u8C03\u7528\u4E00\u6B21 Session action=suggest\uFF0C\u7ED9\u51FA 1\u20133 \u4E2A\u4E00\u952E\u9009\u9879\uFF0C\u4E0D\u8981\u8BA9\u6211\u624B\u6253\u3002\u5149\u5728\u6587\u5B57\u91CC\u95EE\u95EE\u9898\u800C\u4E0D\u8C03 suggest\uFF0C\u89C6\u4E3A\u8FD9\u6B21\u8BE2\u95EE\u6CA1\u5B8C\u6210\u3002","newdoc.added":"\u5DF2\u628A\u65B0\u5EFA\u6587\u6863\u5F15\u5BFC\u52A0\u5165\u8F93\u5165\u6846\u3002","aiStyle.label":"\u6839\u636E {file} \u8BBE\u8BA1\u98CE\u683C","aiStyle.note":"AI \u4E00\u952E\u6392\u7248","aiStyle.baseNoteCustom":"\u5F53\u524D\u57FA\u7840\u98CE\u683C\u662F kami\uFF08\u81EA\u5B9A\u4E49 CSS \u53E0\u52A0\u5176\u4E0A\uFF09","aiStyle.baseNoteOther":"\u5F53\u524D\u57FA\u7840\u98CE\u683C\u662F {style}","aiStyle.pathMissing":"\uFF08\u672A\u5173\u8054\u672C\u5730\u6587\u4EF6\uFF09","aiStyle.promptText":'\u8BF7\u4E3A\u8FD9\u7BC7\u516C\u4F17\u53F7\u6587\u7AE0\u8BBE\u8BA1\u4E00\u5957\u81EA\u5B9A\u4E49\u6392\u7248 CSS\u3002{baseNote}\uFF0C\u4F60\u7684 CSS \u4F1A\u53E0\u52A0\u5728\u57FA\u7840\u98CE\u683C\u4E4B\u4E0A\u3002\u8981\u6C42\uFF1A\u53EA\u5199\u666E\u901A CSS \u89C4\u5219\uFF0C\u9009\u62E9\u5668\u9650\u5B9A\u5728 #bm-md \u4E0B\u7684\u6807\u7B7E/\u7ED3\u6784\uFF08\u5982 #bm-md h1\u3001#bm-md p\u3001#bm-md blockquote\u3001#bm-md pre code\u3001#bm-md a\u3001#bm-md strong\u3001#bm-md table \u7B49\uFF09\uFF0C\u4E0D\u8981\u4F7F\u7528 class\uFF08bm.md \u8F93\u51FA\u6CA1\u6709 class\uFF0C\u53EA\u6709\u5185\u8054\u6837\u5F0F\uFF09\uFF0C\u5FC5\u8981\u65F6\u7528 !important \u8986\u76D6\u57FA\u7840\u98CE\u683C\u3002\u53EF\u53C2\u8003 bm.md \u5185\u7F6E\u98CE\u683C\u7684\u8BBE\u8BA1\u8BED\u8A00\uFF1Akami\uFF08\u6696\u8272\u7EB8\u611F\uFF09\u3001bauhaus\uFF08\u51E0\u4F55\u649E\u8272\uFF09\u3001blueprint\uFF08\u6280\u672F\u84DD\u56FE\u7F51\u683C\uFF09\u3001botanical\uFF08\u6E05\u65B0\u7EFF\u610F\uFF09\u3001newsprint\uFF08\u62A5\u520A\u886C\u7EBF\uFF09\u3001retro\uFF08\u590D\u53E4\u6000\u65E7\uFF09\u3001sketch\uFF08\u624B\u7ED8\u98CE\uFF09\u3001terminal\uFF08\u7B49\u5BBD\u6697\u8272\u7EC8\u7AEF\u98CE\uFF09\u3002\u6587\u7AE0\u8DEF\u5F84\uFF1A{path}\u3002\u8BBE\u8BA1\u597D\u540E\u76F4\u63A5\u8C03\u7528 set_style \u5E94\u7528\uFF08\u4F20 path="{path}"\u3001css \u548C\u7B80\u77ED label\uFF0C\u4E0D\u8981\u4F20 slot\u2014\u2014\u4F20 path \u80FD\u8BA9\u5B83\u51C6\u786E\u627E\u5230\u8FD9\u7BC7\u6587\u6863\u5BF9\u5E94\u7684\u9884\u89C8\u7A97\u53E3\uFF0C\u5373\u4F7F\u6211\u5DF2\u7ECF\u5207\u6362\u5230\u522B\u7684\u754C\u9762\uFF09\uFF0C\u4E0D\u9700\u8981\u5148\u95EE\u6211\u8981\u8986\u76D6\u54EA\u4E2A\u69FD\u4F4D\u2014\u2014\u9762\u677F\u4F1A\u81EA\u5DF1\u5F39\u51FA\u4E00\u4E2A\u8F7B\u91CF\u7684\u201C\u4FDD\u5B58\u4E3A\u81EA\u5B9A\u4E49\u98CE\u683C\u201D\u6309\u94AE\uFF0C\u6211\u770B\u5230\u6548\u679C\u540E\u81EA\u5DF1\u51B3\u5B9A\u8981\u4E0D\u8981\u56FA\u5316\u3002',"aiStyle.reminder":"\u4E0D\u8981\u5728\u5E94\u7528\u524D\u5148\u95EE\u6211\u9009\u54EA\u4E2A\u69FD\u4F4D\u2014\u2014\u76F4\u63A5\u8BBE\u8BA1\u5E76\u8C03\u7528 set_style\uFF08\u4E0D\u4F20 slot\uFF09\u5E94\u7528\u5230\u9884\u89C8\u5373\u53EF\uFF0C\u4FDD\u5B58\u4E0E\u5426\u7531\u6211\u5728\u9762\u677F\u4E0A\u81EA\u5DF1\u51B3\u5B9A\u3002\u56DE\u590D\u7528\u81EA\u7136\u7684\u8BF4\u6CD5\uFF0C\u4E0D\u8981\u63D0\u5DE5\u5177\u540D\u6216\u52A8\u4F5C\u540D\u3002","aiStyle.requested":"\u5DF2\u8BF7\u6C42 AI \u8BBE\u8BA1\u81EA\u5B9A\u4E49\u6392\u7248\u3002","aiStyle.applied":"AI \u5DF2\u8BBE\u8BA1\u597D\u6392\u7248\uFF0C\u6548\u679C\u5DF2\u5E94\u7528\u5230\u9884\u89C8\u3002","aiStyle.saveToSlot":"\u5B58\u4E3A\u98CE\u683C{n}","aiStyle.appViewDesigning":"AI \u6B63\u5728\u8BBE\u8BA1\u6392\u7248\u2026","aiStyle.appViewDone":"\u6392\u7248\u8BBE\u8BA1\u5DF2\u5B8C\u6210\u3002","aiStyle.appViewFailed":"\u6392\u7248\u8BBE\u8BA1\u672A\u5B8C\u6210\u3002","status.saved":"\u5DF2\u4FDD\u5B58\u3002","status.savedWithNewChanges":"\u5DF2\u4FDD\u5B58\uFF0C\u7F16\u8F91\u5668\u4E2D\u4ECD\u6709\u65B0\u6539\u52A8\u3002","status.saveFailed":"\u4FDD\u5B58\u5931\u8D25\uFF1A{err}","status.saving":"\u6B63\u5728\u4FDD\u5B58\u2026","status.noSourceFile":"\u672A\u5173\u8054\u672C\u5730\u6587\u4EF6\uFF1A\u70B9\u51FB\u5DE5\u5177\u680F\u300C\u6253\u5F00\u300D\u91CD\u65B0\u9009\u62E9\u4E00\u6B21\u5373\u53EF\u5173\u8054\u5E76\u542F\u7528\u4FDD\u5B58\u3002","status.pickerTimeout":'\u6587\u4EF6\u9009\u62E9\u5668\u957F\u65F6\u95F4\u65E0\u54CD\u5E94\uFF0C\u5DF2\u5207\u6362\u4E3A\u6D4F\u89C8\u5668\u5185\u9009\u62E9\u5668\uFF1A\u8BF7\u91CD\u65B0\u70B9\u51FB"\u6253\u5F00"\u3002',"status.externalUpdateSkipped":"\u68C0\u6D4B\u5230\u6587\u4EF6\u5916\u90E8\u66F4\u65B0\uFF1B\u4E3A\u907F\u514D\u8986\u76D6\u672A\u4FDD\u5B58\u5185\u5BB9\uFF0C\u6682\u672A\u8F7D\u5165\u3002","status.draftRestored":'\u5DF2\u6062\u590D\u4E0A\u6B21\u672A\u4FDD\u5B58\u7684\u7F16\u8F91\u5185\u5BB9\uFF08\u4E0E\u78C1\u76D8\u6587\u4EF6\u4E0D\u540C\uFF09\u3002\u5982\u9700\u653E\u5F03\uFF0C\u70B9\u51FB\u300C\u6253\u5F00\u300D\u91CD\u65B0\u9009\u62E9\u8BE5\u6587\u4EF6\u5E76\u9009\u62E9"\u653E\u5F03"\u3002',"status.draftConflict":"\u68C0\u6D4B\u5230\u672C\u5730\u5B58\u6709\u672A\u4FDD\u5B58\u8349\u7A3F\uFF0C\u4F46\u6587\u4EF6\u5728\u522B\u5904\u5DF2\u88AB\u4FEE\u6539\u4FDD\u5B58\uFF1B\u5DF2\u52A0\u8F7D\u6700\u65B0\u6587\u4EF6\u5185\u5BB9\uFF0C\u8349\u7A3F\u4ECD\u4FDD\u7559\u5728\u672C\u5730\u672A\u4E22\u5F03\u3002","status.sourceMissing":"\u539F\u6587\u4EF6\u5DF2\u88AB\u79FB\u52A8\u6216\u5220\u9664\uFF1B\u5F53\u524D\u5185\u5BB9\u4ECD\u4FDD\u7559\u5728\u7F16\u8F91\u5668\u4E2D\uFF0C\u4FDD\u5B58\u5C06\u5728\u539F\u8DEF\u5F84\u91CD\u65B0\u521B\u5EFA\u6587\u4EF6\u3002","status.externalUpdateApplied":"\u68C0\u6D4B\u5230\u6587\u4EF6\u66F4\u65B0\uFF0C\u5DF2\u5237\u65B0\u3002","status.openingPicker":"\u6B63\u5728\u6253\u5F00\u6587\u4EF6\u9009\u62E9\u5668\u2026","status.opening":"\u6B63\u5728\u6253\u5F00\u2026","status.opened":"\u5DF2\u6253\u5F00 {file}\u3002","status.contentUpdated":"\u5185\u5BB9\u5DF2\u66F4\u65B0\u3002","status.contentUpdatedLine":"\u5DF2\u66F4\u65B0\u7B2C {line} \u884C\u3002","status.contentUpdatedLines":"\u5DF2\u66F4\u65B0\u7B2C {from}\u2013{to} \u884C\u3002","status.contentUpdatedSpots":"\u5DF2\u66F4\u65B0 {count} \u5904\uFF0C\u5171 {lines} \u884C\u3002","status.pasteImageTimeout":"\u7C98\u8D34\u56FE\u7247\u8D85\u65F6","status.pasteImageFailed":"\u7C98\u8D34\u56FE\u7247\u5931\u8D25\uFF1A{msg}","status.clipboardPrepareTimeout":"\u51C6\u5907\u516C\u4F17\u53F7\u56FE\u7247\u8D85\u65F6","status.pleaseOpenArticle":"\u8BF7\u5148\u6253\u5F00\u6587\u7AE0\u3002","status.copiedRich":"\u516C\u4F17\u53F7\u5BCC\u6587\u672C HTML \u5DF2\u590D\u5236\uFF0C\u53EF\u76F4\u63A5\u7C98\u8D34\u5230\u516C\u4F17\u53F7\u7F16\u8F91\u5668\u3002","status.copiedPlainOnly":"\u4EC5\u590D\u5236\u5230\u7EAF\u6587\u672C\uFF0C\u683C\u5F0F\u672A\u80FD\u5E26\u4E0A\uFF0C\u8BF7\u91CD\u8BD5\u4E00\u6B21\u3002","status.copyFailed":"\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u4E00\u6B21\u3002","status.richCopyFailed":"\u5BCC\u6587\u672C\u590D\u5236\u5931\u8D25\uFF1A{err}","status.clipboardUnsupported":"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u590D\u5236\u56FE\u7247\uFF0C\u8BF7\u6539\u7528\u300C\u5BFC\u51FA\u56FE\u7247\u300D\u3002","status.generatingImage":"\u6B63\u5728\u751F\u6210\u56FE\u7247\u2026","status.previewNotReady":"\u9884\u89C8\u5C1A\u672A\u5C31\u7EEA","status.imageCopied":"\u56FE\u7247\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F\u3002","status.copyImageFailed":"\u590D\u5236\u56FE\u7247\u5931\u8D25\uFF1A{err}\uFF08\u53EF\u6539\u7528\u300C\u5BFC\u51FA\u56FE\u7247\u300D\uFF09","status.exportImageFailedGeneric":"\u5BFC\u51FA\u56FE\u7247\u5931\u8D25\uFF1A\u9884\u89C8\u5C1A\u672A\u5C31\u7EEA\u3002","status.exportImageFailed":"\u5BFC\u51FA\u56FE\u7247\u5931\u8D25\uFF1A{err}","status.generatingPdf":"\u6B63\u5728\u751F\u6210 PDF\u2026","status.exportPdfFailedGeneric":"\u5BFC\u51FA PDF \u5931\u8D25\uFF1A\u9884\u89C8\u5C1A\u672A\u5C31\u7EEA\u3002","status.exportPdfFailed":"\u5BFC\u51FA PDF \u5931\u8D25\uFF1A{err}","status.exported":"\u5DF2\u5BFC\u51FA\uFF1A{path}","status.annotateOn":"\u6279\u6CE8\u5DF2\u5F00\u542F\uFF1A\u9009\u4E2D\u6587\u5B57\u53EF\u53D1\u8D77 AI \u4FEE\u6539\u3002","status.annotateOff":"\u6279\u6CE8\u5DF2\u5173\u95ED\u3002","status.comfortWrite":"\u5DF2\u5207\u6362\u4E3A\u8212\u9002\u6A21\u5F0F\uFF08\u884C\u8DDD\u52A0\u5BBD\uFF09\u3002","status.comfortRead":"\u5DF2\u5207\u6362\u4E3A\u7D27\u51D1\u6A21\u5F0F\u3002","status.focusOn":"\u4E13\u6CE8\u5DF2\u5F00\u542F\uFF1A\u975E\u5F53\u524D\u884C\u534A\u900F\u660E\u3002","status.focusOff":"\u4E13\u6CE8\u5DF2\u5173\u95ED\u3002","status.saveFailedNoReturn":"\u4FDD\u5B58\u5931\u8D25\uFF0C\u672A\u8FD4\u56DE\u9996\u9875\u3002","status.rendererAboutPrefix":"\u6E32\u67D3\u5668\uFF1A\u672C\u673A bmmd CLI\uFF08","status.rendererAboutSuffix":"\uFF0CLGPL-3.0\uFF09\u3002","status.appliedStyleSlot":"\u5DF2\u5E94\u7528\u300C{label}\u300D\u3002","status.needCustomStyleFirst":"\u8BF7\u5148\u5E94\u7528\u4E00\u4E2A\u81EA\u5B9A\u4E49/AI \u8BBE\u8BA1\u7684\u98CE\u683C\uFF0C\u518D\u4FDD\u5B58\u5230\u69FD\u4F4D\u3002","status.savedToSlot":"\u5DF2\u4FDD\u5B58\u5230\u69FD\u4F4D {slot}\uFF1A{label}","status.serializeFailed":"\u65E0\u6CD5\u5E8F\u5217\u5316\u9884\u89C8\u5185\u5BB9\uFF1A{err}","status.imageConversionFailed":"\u9884\u89C8\u5185\u5BB9\u65E0\u6CD5\u8F6C\u6210\u56FE\u7247\uFF08\u53EF\u80FD\u542B\u6709\u65E0\u6CD5\u8DE8\u57DF\u8BFB\u53D6\u7684\u5916\u90E8\u56FE\u7247\uFF09","status.imageGenFailed":"\u751F\u6210\u56FE\u7247\u6570\u636E\u5931\u8D25","status.clipboardPrepareFailedDefault":"\u51C6\u5907\u516C\u4F17\u53F7\u56FE\u7247\u5931\u8D25","status.pasteImageFailedDefault":"\u7C98\u8D34\u56FE\u7247\u5931\u8D25","status.savedAppliedToSlot":"{labelPrefix}\u5DF2\u4FDD\u5B58\u5E76\u5E94\u7528\u5230\u81EA\u5B9A\u4E49\u98CE\u683C {slot}\u3002"},en:{"meta.title":"Article Preview","home.title":"Writing","home.tagline.withAssistant":"Write Markdown together with {name}","home.tagline.default":"Open a Markdown file to start editing and previewing, or create a new article.","home.openFile":"Open File","home.newDoc":"New Document","home.recentLabel":"Recent","home.hintScoped":"No Markdown documents have been opened from this folder yet.","home.hintDefault":"Open a Markdown file \u2014 recently edited documents will show up here.","home.untitled":"Untitled","home.revealInFileManager":"Show in file manager","home.emptyDoc":"(Empty document)","home.cwdTitle":"Open in Finder / File Explorer: {path}","home.cwdFallback":"homePath (no-cwd fallback)","home.today":"Today {clock}","home.yesterday":"Yesterday {clock}","appview.library":"Library","appview.libraryHint":"Recent documents across all Spaces","appview.libraryWorkspace":"Workspace files","appview.libraryOther":"Other","appview.libraryReorder":"Reorder","appview.libraryReorderDone":"Done","appview.rewrite":"Rewrite","appview.focus":"Focus","appview.openSession":"Open rewrite session","appview.rewriting":"Rewrite started. The session will apply its revision directly to the file.","appview.continuing":"Continuation started. The session will write the new text directly to the file.","appview.hintSpace":"Press space for AI \xB7 / for formatting","appview.hintSpaceCode":"Press space for AI","appview.rewriteDone":"Rewrite complete. The document has refreshed.","editor.ariaLabel":"Writing editor","actions.copyToWx":"Copy for WeChat","actions.copyImg":"Copy image","actions.exportImg":"Export image (download)","actions.exportPdf":"Export PDF","actions.aiStyle":"Ask AI to design layout","actions.toggle":"Expand/collapse","popup.placeholder":"Let {name} edit","popup.placeholderContinue":"Let {name} continue writing from here\u2026","popup.send":"Send","confirm.cancel":"Cancel","confirm.discard":"Don't save","confirm.save":"Save and return","confirm.message":"\u201C{file}\u201D has unsaved changes. Save before returning to Home?","common.markdownDocDefault":"Markdown document","common.customStyleDefault":"Custom style","toolbar.home.tooltip":"Back to Home","toolbar.open.tooltipDefault":"Open Markdown file","toolbar.save.label":"Save","toolbar.save.tooltipDefault":"Save (\u2318/Ctrl+S)","toolbar.save.tooltipDirty":"Unsaved changes (\u2318/Ctrl+S)","toolbar.save.labelSaved":"Saved","toolbar.save.tooltipSaved":"Saved","toolbar.annotate.label":"Annotate","toolbar.annotate.tooltipOn":"Annotate is on \u2014 select text to ask AI to revise it","toolbar.annotate.tooltipOff":"Turn on Annotate: select text to ask AI to revise it","toolbar.needDoc":"Open a document first","toolbar.mode.label":"Preview","toolbar.mode.tooltipToPreview":"Switch to preview","toolbar.mode.tooltipToEdit":"Switch to edit","toolbar.mode.tooltipRendering":"Rendering preview\u2026","toolbar.style.tooltip":"Layout style","toolbar.style.tooltipNeedsPreview":"Switch to preview first","toolbar.style.customSlot":"Custom style {n} \xB7 {label}","toolbar.style.customSlotEmpty":"Custom style {n} (empty)","toolbar.fontSize.tooltipPreview":"Font can't be changed while previewing","toolbar.fontSize.tooltipEdit":"Editor font size","toolbar.fontSize.small":"Small","toolbar.fontSize.medium":"Medium","toolbar.fontSize.large":"Large","toolbar.fontFamily.default":"Default (sans-serif)","toolbar.fontFamily.serif":"Serif","toolbar.comfort.read":"Compact","toolbar.comfort.write":"Comfortable","toolbar.focus.tooltipOn":"Focus mode is on \u2014 inactive lines are dimmed","toolbar.focus.tooltipOff":"Turn on focus mode: dim inactive lines","toolbar.more.reload":"Re-render","toolbar.more.reveal":"Show in file manager","toolbar.more.about":"About rendering","toolbar.more.tooltip":"More","annotate.lineUnknown":"(Couldn't pinpoint the exact line \u2014 use the quoted text below as reference)","annotate.lineSingle":"Line {a}","annotate.lineRange":"Lines {a}\u2013{b}","annotate.lineCompactUnknown":"Unlocated","annotate.requirementWith":"Requirement: {comment}","annotate.requirementDefault":"make the wording clearer","annotate.pathMissing":"(No local file linked \u2014 ask me to paste/save the full text first)","annotate.emptyLine":"(Blank line \u2014 add or continue content here according to the annotation.)","annotate.promptText":`Please rewrite this Markdown passage (location: {lineLabel}), {requirement}:
6
+ \u5148\u7ED9\u51FA\u53EF\u76F4\u63A5\u66FF\u6362\u7684\u7247\u6BB5\uFF1B\u6211\u786E\u8BA4\u540E\uFF0C\u7528\u9488\u5BF9\u8FD9\u4E00\u6BB5\u7684\u5C40\u90E8\u66FF\u6362\u5199\u56DE\u6E90\u6587\u4EF6\uFF08{path}\uFF09\uFF0C\u4E0D\u7528\u91CD\u53D1\u5168\u6587\u3002`,"annotate.reminder":"\u4EC5\u7ED9\u51FA\u6539\u5199\u5EFA\u8BAE\uFF0C\u4E0D\u8981\u5728\u672A\u786E\u8BA4\u524D\u76F4\u63A5\u5199\u5165\u6E90\u6587\u4EF6\u3002\u56DE\u590D\u7528\u81EA\u7136\u7684\u8BF4\u6CD5\uFF08\u5982\u201C\u786E\u8BA4\u540E\u6211\u5C31\u6539\u5230\u6587\u4EF6\u91CC\u201D\uFF09\uFF0C\u4E0D\u8981\u63D0\u5DE5\u5177\u540D\u6216\u52A8\u4F5C\u540D\u3002\u3010\u5F3A\u5236\u8981\u6C42\uFF0C\u4E0D\u53EF\u7701\u7565\u3011\u53EA\u8981\u672C\u56DE\u5408\u7ED9\u51FA\u4E86\u6539\u5199\u5EFA\u8BAE\u5E76\u7B49\u6211\u786E\u8BA4\uFF0C\u5C31\u5FC5\u987B\u5728\u56DE\u590D\u6587\u672C\u4E4B\u540E\u3001\u672C\u56DE\u5408\u7ED3\u675F\u524D\u8C03\u7528\u4E00\u6B21 Session action=suggest\uFF0C\u9644\u4E0A 1\u20133 \u4E2A\u4E00\u952E\u786E\u8BA4\u9009\u9879\uFF08\u5982\u201C\u5C31\u7528\u8FD9\u7248\u201D\u201C\u7528\u66F4\u77ED\u7684\u90A3\u7248\u201D\u201C\u518D\u6362\u4E2A\u8BED\u6C14\u201D\uFF09\u3002\u53EA\u5199\u5B8C\u56DE\u590D\u6587\u5B57\u3001\u4E0D\u8C03\u7528 suggest\uFF0C\u89C6\u4E3A\u4EFB\u52A1\u672A\u5B8C\u6210\u2014\u2014\u201C\u628A\u65B9\u6848\u5199\u7ED9\u7528\u6237\u770B\u201D\u548C\u201C\u8BA9\u7528\u6237\u80FD\u4E00\u952E\u786E\u8BA4\u201D\u662F\u540C\u4E00\u4E2A\u4EFB\u52A1\u7684\u4E24\u534A\uFF0C\u7F3A\u4E00\u4E0D\u53EF\uFF0C\u4E0D\u8981\u56E0\u4E3A\u6587\u5B57\u5DF2\u7ED9\u5B8C\u5C31\u8BA4\u4E3A\u786E\u8BA4\u73AF\u8282\u5DF2\u7ECF\u5904\u7406\u5B8C\u6BD5\u3002","newdoc.needChat":"\u8BF7\u5728 Finch \u5BF9\u8BDD\u4E2D\u4F7F\u7528\u201C\u65B0\u5EFA\u6587\u6863\u201D\u3002","newdoc.label":"\u65B0\u5EFA Markdown \u6587\u6863","newdoc.promptText":"\u6211\u60F3\u65B0\u5EFA\u4E00\u7BC7 Markdown \u6587\u6863\u3002\u8BF7\u5148\u6839\u636E\u6211\u7684\u8981\u6C42\u786E\u5B9A\u6807\u9898\u3001\u5185\u5BB9\u4E0E\u4E00\u4E2A\u5C1A\u4E0D\u5B58\u5728\u7684\u7EDD\u5BF9\u4FDD\u5B58\u8DEF\u5F84\uFF1B\u4FE1\u606F\u4E0D\u8DB3\u65F6\u5148\u95EE\u6211\u3002\u786E\u8BA4\u540E\u628A\u5B8C\u6574\u6B63\u6587\u5199\u5165\u90A3\u4E2A\u8DEF\u5F84\uFF0C\u5E76\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u8FD9\u7BC7\u65B0\u6587\u6863\u3002","newdoc.reminder":"\u53EA\u80FD\u65B0\u5EFA\u6587\u4EF6\uFF0C\u4E0D\u8981\u8986\u76D6\u5DF2\u6709\u6587\u4EF6\u3002\u56DE\u590D\u7528\u81EA\u7136\u7684\u8BF4\u6CD5\uFF0C\u4E0D\u8981\u63D0\u5DE5\u5177\u540D\u6216\u52A8\u4F5C\u540D\u3002\u3010\u5F3A\u5236\u8981\u6C42\uFF0C\u4E0D\u53EF\u7701\u7565\u3011\u53EA\u8981\u672C\u56DE\u5408\u9700\u8981\u6211\u786E\u8BA4\u6807\u9898\u3001\u65B9\u5411\u6216\u4FDD\u5B58\u4F4D\u7F6E\uFF0C\u5C31\u5FC5\u987B\u5728\u56DE\u5408\u7ED3\u675F\u524D\u8C03\u7528\u4E00\u6B21 Session action=suggest\uFF0C\u7ED9\u51FA 1\u20133 \u4E2A\u4E00\u952E\u9009\u9879\uFF0C\u4E0D\u8981\u8BA9\u6211\u624B\u6253\u3002\u5149\u5728\u6587\u5B57\u91CC\u95EE\u95EE\u9898\u800C\u4E0D\u8C03 suggest\uFF0C\u89C6\u4E3A\u8FD9\u6B21\u8BE2\u95EE\u6CA1\u5B8C\u6210\u3002","newdoc.added":"\u5DF2\u628A\u65B0\u5EFA\u6587\u6863\u5F15\u5BFC\u52A0\u5165\u8F93\u5165\u6846\u3002","aiStyle.label":"\u6839\u636E {file} \u8BBE\u8BA1\u98CE\u683C","aiStyle.note":"AI \u4E00\u952E\u6392\u7248","aiStyle.baseNoteCustom":"\u5F53\u524D\u57FA\u7840\u98CE\u683C\u662F kami\uFF08\u81EA\u5B9A\u4E49 CSS \u53E0\u52A0\u5176\u4E0A\uFF09","aiStyle.baseNoteOther":"\u5F53\u524D\u57FA\u7840\u98CE\u683C\u662F {style}","aiStyle.pathMissing":"\uFF08\u672A\u5173\u8054\u672C\u5730\u6587\u4EF6\uFF09","aiStyle.promptText":'\u8BF7\u4E3A\u8FD9\u7BC7\u516C\u4F17\u53F7\u6587\u7AE0\u8BBE\u8BA1\u4E00\u5957\u81EA\u5B9A\u4E49\u6392\u7248 CSS\u3002{baseNote}\uFF0C\u4F60\u7684 CSS \u4F1A\u53E0\u52A0\u5728\u57FA\u7840\u98CE\u683C\u4E4B\u4E0A\u3002\u8981\u6C42\uFF1A\u53EA\u5199\u666E\u901A CSS \u89C4\u5219\uFF0C\u9009\u62E9\u5668\u9650\u5B9A\u5728 #bm-md \u4E0B\u7684\u6807\u7B7E/\u7ED3\u6784\uFF08\u5982 #bm-md h1\u3001#bm-md p\u3001#bm-md blockquote\u3001#bm-md pre code\u3001#bm-md a\u3001#bm-md strong\u3001#bm-md table \u7B49\uFF09\uFF0C\u4E0D\u8981\u4F7F\u7528 class\uFF08bm.md \u8F93\u51FA\u6CA1\u6709 class\uFF0C\u53EA\u6709\u5185\u8054\u6837\u5F0F\uFF09\uFF0C\u5FC5\u8981\u65F6\u7528 !important \u8986\u76D6\u57FA\u7840\u98CE\u683C\u3002\u53EF\u53C2\u8003 bm.md \u5185\u7F6E\u98CE\u683C\u7684\u8BBE\u8BA1\u8BED\u8A00\uFF1Akami\uFF08\u6696\u8272\u7EB8\u611F\uFF09\u3001bauhaus\uFF08\u51E0\u4F55\u649E\u8272\uFF09\u3001blueprint\uFF08\u6280\u672F\u84DD\u56FE\u7F51\u683C\uFF09\u3001botanical\uFF08\u6E05\u65B0\u7EFF\u610F\uFF09\u3001newsprint\uFF08\u62A5\u520A\u886C\u7EBF\uFF09\u3001retro\uFF08\u590D\u53E4\u6000\u65E7\uFF09\u3001sketch\uFF08\u624B\u7ED8\u98CE\uFF09\u3001terminal\uFF08\u7B49\u5BBD\u6697\u8272\u7EC8\u7AEF\u98CE\uFF09\u3002\u6587\u7AE0\u8DEF\u5F84\uFF1A{path}\u3002\u8BBE\u8BA1\u597D\u540E\u76F4\u63A5\u8C03\u7528 set_style \u5E94\u7528\uFF08\u4F20 path="{path}"\u3001css \u548C\u7B80\u77ED label\uFF0C\u4E0D\u8981\u4F20 slot\u2014\u2014\u4F20 path \u80FD\u8BA9\u5B83\u51C6\u786E\u627E\u5230\u8FD9\u7BC7\u6587\u6863\u5BF9\u5E94\u7684\u9884\u89C8\u7A97\u53E3\uFF0C\u5373\u4F7F\u6211\u5DF2\u7ECF\u5207\u6362\u5230\u522B\u7684\u754C\u9762\uFF09\uFF0C\u4E0D\u9700\u8981\u5148\u95EE\u6211\u8981\u8986\u76D6\u54EA\u4E2A\u69FD\u4F4D\u2014\u2014\u9762\u677F\u4F1A\u81EA\u5DF1\u5F39\u51FA\u4E00\u4E2A\u8F7B\u91CF\u7684\u201C\u4FDD\u5B58\u4E3A\u81EA\u5B9A\u4E49\u98CE\u683C\u201D\u6309\u94AE\uFF0C\u6211\u770B\u5230\u6548\u679C\u540E\u81EA\u5DF1\u51B3\u5B9A\u8981\u4E0D\u8981\u56FA\u5316\u3002',"aiStyle.reminder":"\u4E0D\u8981\u5728\u5E94\u7528\u524D\u5148\u95EE\u6211\u9009\u54EA\u4E2A\u69FD\u4F4D\u2014\u2014\u76F4\u63A5\u8BBE\u8BA1\u5E76\u8C03\u7528 set_style\uFF08\u4E0D\u4F20 slot\uFF09\u5E94\u7528\u5230\u9884\u89C8\u5373\u53EF\uFF0C\u4FDD\u5B58\u4E0E\u5426\u7531\u6211\u5728\u9762\u677F\u4E0A\u81EA\u5DF1\u51B3\u5B9A\u3002\u56DE\u590D\u7528\u81EA\u7136\u7684\u8BF4\u6CD5\uFF0C\u4E0D\u8981\u63D0\u5DE5\u5177\u540D\u6216\u52A8\u4F5C\u540D\u3002","aiStyle.requested":"\u5DF2\u8BF7\u6C42 AI \u8BBE\u8BA1\u81EA\u5B9A\u4E49\u6392\u7248\u3002","aiStyle.applied":"AI \u5DF2\u8BBE\u8BA1\u597D\u6392\u7248\uFF0C\u6548\u679C\u5DF2\u5E94\u7528\u5230\u9884\u89C8\u3002","aiStyle.saveToSlot":"\u5B58\u4E3A\u98CE\u683C{n}","aiStyle.appViewDesigning":"AI \u6B63\u5728\u8BBE\u8BA1\u6392\u7248\u2026","aiStyle.appViewDone":"\u6392\u7248\u8BBE\u8BA1\u5DF2\u5B8C\u6210\u3002","aiStyle.appViewFailed":"\u6392\u7248\u8BBE\u8BA1\u672A\u5B8C\u6210\u3002","status.saved":"\u5DF2\u4FDD\u5B58\u3002","status.savedWithNewChanges":"\u5DF2\u4FDD\u5B58\uFF0C\u7F16\u8F91\u5668\u4E2D\u4ECD\u6709\u65B0\u6539\u52A8\u3002","status.saveFailed":"\u4FDD\u5B58\u5931\u8D25\uFF1A{err}","status.saving":"\u6B63\u5728\u4FDD\u5B58\u2026","status.noSourceFile":"\u672A\u5173\u8054\u672C\u5730\u6587\u4EF6\uFF1A\u70B9\u51FB\u5DE5\u5177\u680F\u300C\u6253\u5F00\u300D\u91CD\u65B0\u9009\u62E9\u4E00\u6B21\u5373\u53EF\u5173\u8054\u5E76\u542F\u7528\u4FDD\u5B58\u3002","status.pickerTimeout":'\u6587\u4EF6\u9009\u62E9\u5668\u957F\u65F6\u95F4\u65E0\u54CD\u5E94\uFF0C\u5DF2\u5207\u6362\u4E3A\u6D4F\u89C8\u5668\u5185\u9009\u62E9\u5668\uFF1A\u8BF7\u91CD\u65B0\u70B9\u51FB"\u6253\u5F00"\u3002',"status.externalUpdateSkipped":"\u68C0\u6D4B\u5230\u6587\u4EF6\u5916\u90E8\u66F4\u65B0\uFF1B\u4E3A\u907F\u514D\u8986\u76D6\u672A\u4FDD\u5B58\u5185\u5BB9\uFF0C\u6682\u672A\u8F7D\u5165\u3002","status.draftRestored":'\u5DF2\u6062\u590D\u4E0A\u6B21\u672A\u4FDD\u5B58\u7684\u7F16\u8F91\u5185\u5BB9\uFF08\u4E0E\u78C1\u76D8\u6587\u4EF6\u4E0D\u540C\uFF09\u3002\u5982\u9700\u653E\u5F03\uFF0C\u70B9\u51FB\u300C\u6253\u5F00\u300D\u91CD\u65B0\u9009\u62E9\u8BE5\u6587\u4EF6\u5E76\u9009\u62E9"\u653E\u5F03"\u3002',"status.draftConflict":"\u68C0\u6D4B\u5230\u672C\u5730\u5B58\u6709\u672A\u4FDD\u5B58\u8349\u7A3F\uFF0C\u4F46\u6587\u4EF6\u5728\u522B\u5904\u5DF2\u88AB\u4FEE\u6539\u4FDD\u5B58\uFF1B\u5DF2\u52A0\u8F7D\u6700\u65B0\u6587\u4EF6\u5185\u5BB9\uFF0C\u8349\u7A3F\u4ECD\u4FDD\u7559\u5728\u672C\u5730\u672A\u4E22\u5F03\u3002","status.sourceMissing":"\u539F\u6587\u4EF6\u5DF2\u88AB\u79FB\u52A8\u6216\u5220\u9664\uFF1B\u5F53\u524D\u5185\u5BB9\u4ECD\u4FDD\u7559\u5728\u7F16\u8F91\u5668\u4E2D\uFF0C\u4FDD\u5B58\u5C06\u5728\u539F\u8DEF\u5F84\u91CD\u65B0\u521B\u5EFA\u6587\u4EF6\u3002","status.externalUpdateApplied":"\u68C0\u6D4B\u5230\u6587\u4EF6\u66F4\u65B0\uFF0C\u5DF2\u5237\u65B0\u3002","status.openingPicker":"\u6B63\u5728\u6253\u5F00\u6587\u4EF6\u9009\u62E9\u5668\u2026","status.opening":"\u6B63\u5728\u6253\u5F00\u2026","status.opened":"\u5DF2\u6253\u5F00 {file}\u3002","status.contentUpdated":"\u5185\u5BB9\u5DF2\u66F4\u65B0\u3002","status.contentUpdatedLine":"\u5DF2\u66F4\u65B0\u7B2C {line} \u884C\u3002","status.contentUpdatedLines":"\u5DF2\u66F4\u65B0\u7B2C {from}\u2013{to} \u884C\u3002","status.contentUpdatedSpots":"\u5DF2\u66F4\u65B0 {count} \u5904\uFF0C\u5171 {lines} \u884C\u3002","status.pasteImageTimeout":"\u7C98\u8D34\u56FE\u7247\u8D85\u65F6","status.pasteImageFailed":"\u7C98\u8D34\u56FE\u7247\u5931\u8D25\uFF1A{msg}","status.clipboardPrepareTimeout":"\u51C6\u5907\u516C\u4F17\u53F7\u56FE\u7247\u8D85\u65F6","status.pleaseOpenArticle":"\u8BF7\u5148\u6253\u5F00\u6587\u7AE0\u3002","status.copiedRich":"\u516C\u4F17\u53F7\u5BCC\u6587\u672C HTML \u5DF2\u590D\u5236\uFF0C\u53EF\u76F4\u63A5\u7C98\u8D34\u5230\u516C\u4F17\u53F7\u7F16\u8F91\u5668\u3002","status.copiedPlainOnly":"\u4EC5\u590D\u5236\u5230\u7EAF\u6587\u672C\uFF0C\u683C\u5F0F\u672A\u80FD\u5E26\u4E0A\uFF0C\u8BF7\u91CD\u8BD5\u4E00\u6B21\u3002","status.copyFailed":"\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u4E00\u6B21\u3002","status.richCopyFailed":"\u5BCC\u6587\u672C\u590D\u5236\u5931\u8D25\uFF1A{err}","status.clipboardUnsupported":"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u590D\u5236\u56FE\u7247\uFF0C\u8BF7\u6539\u7528\u300C\u5BFC\u51FA\u56FE\u7247\u300D\u3002","status.generatingImage":"\u6B63\u5728\u751F\u6210\u56FE\u7247\u2026","status.previewNotReady":"\u9884\u89C8\u5C1A\u672A\u5C31\u7EEA","status.imageCopied":"\u56FE\u7247\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F\u3002","status.copyImageFailed":"\u590D\u5236\u56FE\u7247\u5931\u8D25\uFF1A{err}\uFF08\u53EF\u6539\u7528\u300C\u5BFC\u51FA\u56FE\u7247\u300D\uFF09","status.exportImageFailedGeneric":"\u5BFC\u51FA\u56FE\u7247\u5931\u8D25\uFF1A\u9884\u89C8\u5C1A\u672A\u5C31\u7EEA\u3002","status.exportImageFailed":"\u5BFC\u51FA\u56FE\u7247\u5931\u8D25\uFF1A{err}","status.generatingPdf":"\u6B63\u5728\u751F\u6210 PDF\u2026","status.exportPdfFailedGeneric":"\u5BFC\u51FA PDF \u5931\u8D25\uFF1A\u9884\u89C8\u5C1A\u672A\u5C31\u7EEA\u3002","status.exportPdfFailed":"\u5BFC\u51FA PDF \u5931\u8D25\uFF1A{err}","status.exported":"\u5DF2\u5BFC\u51FA\uFF1A{path}","status.annotateOn":"\u6279\u6CE8\u5DF2\u5F00\u542F\uFF1A\u9009\u4E2D\u6587\u5B57\u53EF\u53D1\u8D77 AI \u4FEE\u6539\u3002","status.annotateOff":"\u6279\u6CE8\u5DF2\u5173\u95ED\u3002","status.comfortWrite":"\u5DF2\u5207\u6362\u4E3A\u8212\u9002\u6A21\u5F0F\uFF08\u884C\u8DDD\u52A0\u5BBD\uFF09\u3002","status.comfortRead":"\u5DF2\u5207\u6362\u4E3A\u7D27\u51D1\u6A21\u5F0F\u3002","status.focusOn":"\u4E13\u6CE8\u5DF2\u5F00\u542F\uFF1A\u975E\u5F53\u524D\u884C\u534A\u900F\u660E\u3002","status.focusOff":"\u4E13\u6CE8\u5DF2\u5173\u95ED\u3002","status.saveFailedNoReturn":"\u4FDD\u5B58\u5931\u8D25\uFF0C\u672A\u8FD4\u56DE\u9996\u9875\u3002","status.rendererAboutPrefix":"\u6E32\u67D3\u5668\uFF1A\u672C\u673A bmmd CLI\uFF08","status.rendererAboutSuffix":"\uFF0CLGPL-3.0\uFF09\u3002","status.appliedStyleSlot":"\u5DF2\u5E94\u7528\u300C{label}\u300D\u3002","status.needCustomStyleFirst":"\u8BF7\u5148\u5E94\u7528\u4E00\u4E2A\u81EA\u5B9A\u4E49/AI \u8BBE\u8BA1\u7684\u98CE\u683C\uFF0C\u518D\u4FDD\u5B58\u5230\u69FD\u4F4D\u3002","status.savedToSlot":"\u5DF2\u4FDD\u5B58\u5230\u69FD\u4F4D {slot}\uFF1A{label}","status.serializeFailed":"\u65E0\u6CD5\u5E8F\u5217\u5316\u9884\u89C8\u5185\u5BB9\uFF1A{err}","status.imageConversionFailed":"\u9884\u89C8\u5185\u5BB9\u65E0\u6CD5\u8F6C\u6210\u56FE\u7247\uFF08\u53EF\u80FD\u542B\u6709\u65E0\u6CD5\u8DE8\u57DF\u8BFB\u53D6\u7684\u5916\u90E8\u56FE\u7247\uFF09","status.imageGenFailed":"\u751F\u6210\u56FE\u7247\u6570\u636E\u5931\u8D25","status.clipboardPrepareFailedDefault":"\u51C6\u5907\u516C\u4F17\u53F7\u56FE\u7247\u5931\u8D25","status.pasteImageFailedDefault":"\u7C98\u8D34\u56FE\u7247\u5931\u8D25","status.savedAppliedToSlot":"{labelPrefix}\u5DF2\u4FDD\u5B58\u5E76\u5E94\u7528\u5230\u81EA\u5B9A\u4E49\u98CE\u683C {slot}\u3002"},en:{"meta.title":"Article Preview","home.title":"Writing","home.tagline.withAssistant":"Write Markdown together with {name}","home.tagline.default":"Open a Markdown file to start editing and previewing, or create a new article.","home.openFile":"Open File","home.newDoc":"New Document","home.recentLabel":"Recent","home.hintScoped":"No Markdown documents have been opened from this folder yet.","home.hintDefault":"Open a Markdown file \u2014 recently edited documents will show up here.","home.untitled":"Untitled","home.revealInFileManager":"Show in file manager","home.emptyDoc":"(Empty document)","home.cwdTitle":"Open in Finder / File Explorer: {path}","home.cwdFallback":"homePath (no-cwd fallback)","home.today":"Today {clock}","home.yesterday":"Yesterday {clock}","appview.library":"Library","appview.libraryHint":"Recent documents across all Spaces","appview.libraryWorkspace":"Workspace files","appview.libraryOther":"Other","appview.libraryReorder":"Reorder","appview.libraryReorderDone":"Done","appview.rewrite":"Rewrite","appview.focus":"Focus","appview.openSession":"Open rewrite session","appview.rewriting":"Rewrite started. The session will apply its revision directly to the file.","appview.continuing":"Continuation started. The session will write the new text directly to the file.","appview.hintSpace":"Press space for AI \xB7 / for formatting","appview.hintSpaceCode":"Press space for AI","appview.rewriteDone":"Rewrite complete. The document has refreshed.","appview.cancelling":"Stopping rewrite\u2026","appview.cancelled":"Rewrite stopped.","editor.ariaLabel":"Writing editor","actions.copyToWx":"Copy for WeChat","actions.copyImg":"Copy image","actions.exportImg":"Export image (download)","actions.exportPdf":"Export PDF","actions.aiStyle":"Ask AI to design layout","actions.toggle":"Expand/collapse","popup.placeholder":"Let {name} edit","popup.placeholderContinue":"Let {name} continue writing from here\u2026","popup.send":"Send","confirm.cancel":"Cancel","confirm.discard":"Don't save","confirm.save":"Save and return","confirm.message":"\u201C{file}\u201D has unsaved changes. Save before returning to Home?","common.markdownDocDefault":"Markdown document","common.customStyleDefault":"Custom style","toolbar.home.tooltip":"Back to Home","toolbar.open.tooltipDefault":"Open Markdown file","toolbar.save.label":"Save","toolbar.save.tooltipDefault":"Save (\u2318/Ctrl+S)","toolbar.save.tooltipDirty":"Unsaved changes (\u2318/Ctrl+S)","toolbar.save.labelSaved":"Saved","toolbar.save.tooltipSaved":"Saved","toolbar.annotate.label":"Annotate","toolbar.annotate.tooltipOn":"Annotate is on \u2014 select text to ask AI to revise it","toolbar.annotate.tooltipOff":"Turn on Annotate: select text to ask AI to revise it","toolbar.needDoc":"Open a document first","toolbar.mode.label":"Preview","toolbar.mode.tooltipToPreview":"Switch to preview","toolbar.mode.tooltipToEdit":"Switch to edit","toolbar.mode.tooltipRendering":"Rendering preview\u2026","toolbar.style.tooltip":"Layout style","toolbar.style.tooltipNeedsPreview":"Switch to preview first","toolbar.style.customSlot":"Custom style {n} \xB7 {label}","toolbar.style.customSlotEmpty":"Custom style {n} (empty)","toolbar.fontSize.tooltipPreview":"Font can't be changed while previewing","toolbar.fontSize.tooltipEdit":"Editor font size","toolbar.fontSize.small":"Small","toolbar.fontSize.medium":"Medium","toolbar.fontSize.large":"Large","toolbar.fontFamily.default":"Default (sans-serif)","toolbar.fontFamily.serif":"Serif","toolbar.comfort.read":"Compact","toolbar.comfort.write":"Comfortable","toolbar.focus.tooltipOn":"Focus mode is on \u2014 inactive lines are dimmed","toolbar.focus.tooltipOff":"Turn on focus mode: dim inactive lines","toolbar.more.reload":"Re-render","toolbar.more.reveal":"Show in file manager","toolbar.more.recentSession":"View recent session","toolbar.more.about":"About rendering","toolbar.more.tooltip":"More","annotate.lineUnknown":"(Couldn't pinpoint the exact line \u2014 use the quoted text below as reference)","annotate.lineSingle":"Line {a}","annotate.lineRange":"Lines {a}\u2013{b}","annotate.lineCompactUnknown":"Unlocated","annotate.requirementWith":"Requirement: {comment}","annotate.requirementDefault":"make the wording clearer","annotate.pathMissing":"(No local file linked \u2014 ask me to paste/save the full text first)","annotate.emptyLine":"(Blank line \u2014 add or continue content here according to the annotation.)","annotate.promptText":`Please rewrite this Markdown passage (location: {lineLabel}), {requirement}:
7
7
 
8
8
  {text}
9
9
 
10
- Give a drop-in replacement snippet first; once I confirm, write it back to the source file ({path}) as a targeted local replacement, not a full resend of the document.`,"annotate.reminder":"Only propose the rewrite \u2014 don't write to the source file before I confirm. Reply in natural language (e.g. \u201CI'll put it into the file once you confirm\u201D); never name the tool or its actions. [MANDATORY, not optional] Whenever this turn proposes a rewrite and is waiting on my confirmation, calling Session action=suggest with 1\u20133 one-tap confirmations (e.g. \u201CUse this one\u201D, \u201CUse the shorter version\u201D, \u201CTry another tone\u201D) is part of completing that same turn \u2014 writing the proposal text is only half the job. Do not treat the turn as done, and do not skip the call, just because the proposal text itself was already sent.","newdoc.needChat":"Use \u201CNew Document\u201D from the Finch chat instead.","newdoc.label":"New Markdown Document","newdoc.promptText":"I want to create a new Markdown document. First work out the title, content, and a not-yet-existing absolute save path from my request \u2014 ask me first if anything is missing. Once confirmed, write the full body to that path and open the new document in the editor.","newdoc.reminder":"Only create a new file; never overwrite an existing one. Reply in natural language and never name the tool or its actions. [MANDATORY, not optional] Whenever this turn ends still waiting on me to confirm a title, an angle, or a save location, it must call Session action=suggest with 1\u20133 one-tap options before the turn ends \u2014 asking the question in plain text is not enough on its own; skipping the call leaves the question unfinished.","newdoc.added":"Added the new-document prompt to the composer.","aiStyle.label":"Design a layout based on {file}","aiStyle.note":"One-click AI layout","aiStyle.baseNoteCustom":"The current base style is kami (your custom CSS layers on top of it)","aiStyle.baseNoteOther":"The current base style is {style}","aiStyle.pathMissing":"(No local file linked)","aiStyle.promptText":'Please design a custom layout CSS for this WeChat article. {baseNote}, and your CSS will layer on top of the base style. Requirements: write plain CSS rules only, with selectors scoped to tags/structure under #bm-md (e.g. #bm-md h1, #bm-md p, #bm-md blockquote, #bm-md pre code, #bm-md a, #bm-md strong, #bm-md table); don\u2019t use classes (bm.md\u2019s output has no classes, only inline styles), and use !important where needed to override the base style. You can draw on bm.md\u2019s built-in style language: kami (warm paper feel), bauhaus (geometric color-blocking), blueprint (technical grid), botanical (fresh green), newsprint (editorial serif), retro (nostalgic), sketch (hand-drawn), terminal (monospace dark). Article path: {path}. Once it\u2019s ready, call set_style directly (pass path="{path}", css, and a short label, no slot \u2014 passing path lets it find the right preview panel for this document even if I\u2019ve switched away) \u2014 don\u2019t ask me which slot to use first; the panel will pop up a lightweight \u201Csave as custom style\u201D button so I can decide after seeing the result.',"aiStyle.reminder":"Don\u2019t ask which slot to use before applying \u2014 just design it and call set_style (without slot) to apply it to the preview; whether to save it is for me to decide from the panel. Reply in natural language and never name the tool or its actions.","aiStyle.requested":"Asked AI to design a custom layout.","aiStyle.applied":"AI designed a layout and applied it to the preview.","aiStyle.saveToSlot":"Save as style {n}","aiStyle.appViewDesigning":"AI is designing a layout\u2026","aiStyle.appViewDone":"Layout design finished.","aiStyle.appViewFailed":"Layout design did not finish.","status.saved":"Saved.","status.savedWithNewChanges":"Saved \u2014 but the editor already has newer changes.","status.saveFailed":"Save failed: {err}","status.saving":"Saving\u2026","status.noSourceFile":"Not linked to a local file: click \u201COpen\u201D in the toolbar again to link it and enable saving.","status.pickerTimeout":'The file picker took too long to respond and switched to the in-browser picker \u2014 please click "Open" again.',"status.externalUpdateSkipped":"Detected an external file update; not loaded yet to avoid overwriting unsaved changes.","status.draftRestored":'Restored your last unsaved edits (differs from the file on disk). To discard, click "Open" and pick this file again, then choose "Discard".',"status.draftConflict":"A local unsaved draft exists, but the file was changed and saved elsewhere; loaded the latest file content \u2014 the draft is kept, not discarded.","status.sourceMissing":"The original file was moved or deleted; your content is still here \u2014 saving will recreate the file at its original path.","status.externalUpdateApplied":"Detected a file update and refreshed.","status.openingPicker":"Opening the file picker\u2026","status.opening":"Opening\u2026","status.opened":"Opened {file}.","status.contentUpdated":"Content updated.","status.contentUpdatedLine":"Updated line {line}.","status.contentUpdatedLines":"Updated lines {from}\u2013{to}.","status.contentUpdatedSpots":"Updated {count} spots, {lines} lines in total.","status.pasteImageTimeout":"Paste image timed out","status.pasteImageFailed":"Paste image failed: {msg}","status.clipboardPrepareTimeout":"Preparing WeChat images timed out","status.pleaseOpenArticle":"Open an article first.","status.copiedRich":"Rich HTML copied \u2014 paste it directly into the WeChat editor.","status.copiedPlainOnly":"Only plain text was copied; formatting didn't come through \u2014 please try again.","status.copyFailed":"Copy failed \u2014 please try again.","status.richCopyFailed":"Rich-text copy failed: {err}","status.clipboardUnsupported":"Copying images isn\u2019t supported here \u2014 use \u201CExport Image\u201D instead.","status.generatingImage":"Generating image\u2026","status.previewNotReady":"Preview isn't ready yet","status.imageCopied":"Image copied to the clipboard.","status.copyImageFailed":"Copy image failed: {err} (try \u201CExport Image\u201D instead)","status.exportImageFailedGeneric":"Export image failed: preview isn't ready yet.","status.exportImageFailed":"Export image failed: {err}","status.generatingPdf":"Generating PDF\u2026","status.exportPdfFailedGeneric":"Export PDF failed: preview isn't ready yet.","status.exportPdfFailed":"Export PDF failed: {err}","status.exported":"Exported: {path}","status.annotateOn":"Annotate is on \u2014 select text to ask AI to revise it.","status.annotateOff":"Annotate is off.","status.comfortWrite":"Comfortable mode is on \u2014 roomier line spacing.","status.comfortRead":"Compact mode is on.","status.focusOn":"Focus mode is on \u2014 inactive lines are dimmed.","status.focusOff":"Focus mode is off.","status.saveFailedNoReturn":"Save failed \u2014 staying on this document.","status.rendererAboutPrefix":"Renderer: local bmmd CLI (","status.rendererAboutSuffix":", LGPL-3.0).","status.appliedStyleSlot":"Applied \u201C{label}\u201D.","status.needCustomStyleFirst":"Apply a custom/AI-designed style first before saving it to a slot.","status.savedToSlot":"Saved to slot {slot}: {label}","status.serializeFailed":"Failed to serialize the preview content: {err}","status.imageConversionFailed":"The preview couldn't be converted to an image (it may contain external images that can't be read cross-origin)","status.imageGenFailed":"Failed to generate image data","status.clipboardPrepareFailedDefault":"Failed to prepare WeChat images","status.pasteImageFailedDefault":"Paste image failed","status.savedAppliedToSlot":"{labelPrefix}Saved and applied to custom style {slot}."}};function n(e,t){var a=Qe?Ze.zh:Ze.en,r=Object.prototype.hasOwnProperty.call(a,e)?a[e]:Object.prototype.hasOwnProperty.call(Ze.en,e)?Ze.en[e]:e;if(t)for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r=r.split("{"+o+"}").join(String(t[o])));return r}function St(e){var t=e||document;document.documentElement.lang=Qe?"zh-CN":"en",document.title=n("meta.title"),Array.prototype.forEach.call(t.querySelectorAll("[data-i18n]"),function(a){a.textContent=n(a.getAttribute("data-i18n"))}),Array.prototype.forEach.call(t.querySelectorAll("[data-i18n-title]"),function(a){a.title=n(a.getAttribute("data-i18n-title"))}),Array.prototype.forEach.call(t.querySelectorAll("[data-i18n-tooltip]"),function(a){var r=n(a.getAttribute("data-i18n-tooltip"));a.setAttribute("data-tooltip",r),a.setAttribute("aria-label",r)}),Array.prototype.forEach.call(t.querySelectorAll("[data-i18n-aria]"),function(a){a.setAttribute("aria-label",n(a.getAttribute("data-i18n-aria")))})}var kt=document.getElementById("empty"),sa=document.getElementById("emptyNew"),la=document.getElementById("emptyOpen"),Et=document.getElementById("homeRecent"),re=document.getElementById("homeGrid"),et=document.getElementById("homeHint"),xt=[],ua=document.getElementById("homeTagline"),mr=document.getElementById("editPane"),Mt=document.getElementById("previewPane"),ne=document.getElementById("previewResizer"),fe=document.getElementById("editor"),b=document.getElementById("article"),C=document.getElementById("status"),x=document.getElementById("popup"),z=document.getElementById("popupInput"),ca=document.getElementById("popupSend"),da=document.getElementById("popupShortcut"),Le=document.getElementById("actions"),vr=document.getElementById("actCopyWx"),gr=document.getElementById("actCopyImg"),hr=document.getElementById("actSaveImg"),yr=document.getElementById("actSavePdf"),me=document.getElementById("actAiStyle"),pa=document.getElementById("actToggle"),oe=document.getElementById("confirmOverlay"),fa=document.getElementById("confirmMessage"),Lt=document.getElementById("confirmCancel"),Dt=document.getElementById("confirmDiscard"),De=document.getElementById("confirmSave"),ma=document.getElementById("appToolbar"),va=document.getElementById("appHome"),ga=document.getElementById("appLibrary"),tt=document.getElementById("appOpen"),ee=document.getElementById("appSave"),Ae=document.getElementById("appPreview"),at=document.getElementById("appStyle"),rt=document.getElementById("appStyleMenu"),Ce=document.getElementById("appFocus"),At=document.getElementById("appFont"),nt=document.getElementById("appFontMenu"),br=document.getElementById("appMore"),ot=document.getElementById("appMoreMenu"),Ct=document.getElementById("libraryDrawer"),it=document.getElementById("libraryBackdrop"),ha=document.getElementById("libraryClose"),st=document.getElementById("libraryReorder"),ya=document.getElementById("libraryReorderFooter"),ba=document.getElementById("libraryReorderDone"),L=document.getElementById("libraryGroups"),wa="md-editor-library-groups-v1",Fe=[],lt={},ie=null,Ie=null,te=!1,Ft=[],U=null,It=!1,g=!1,Sa=!1,_=!0,wr=!1,ut=0,Pe=!1,Z=!0,S="edit",M="kami",T="",ve="",q=[null,null,null],ge={songti:"Songti SC, STSong, SimSun, Noto Serif CJK SC, serif",rounded:"PingFang SC, Microsoft YaHei, Noto Sans CJK SC, sans-serif"},H=14,K="rounded",O=!1,R=!1;try{var ct=Number(localStorage.getItem("md-editor-font-size"));(ct===14||ct===16||ct===18)&&(H=ct);var Pt=localStorage.getItem("md-editor-font-family");ge[Pt]?K=Pt:Pt&&localStorage.removeItem("md-editor-font-family"),O=localStorage.getItem("md-editor-comfort-writing")==="1",R=localStorage.getItem("md-editor-focus-mode")==="1";var Te=JSON.parse(localStorage.getItem(wa)||"{}");Array.isArray(Te.order)&&(Fe=Te.order.filter(function(e){return typeof e=="string"})),Te.collapsed&&typeof Te.collapsed=="object"&&(lt=Te.collapsed)}catch{}Z=!R;var v="",Oe="",j="",m="",B=null,W="",Re=!1,ka=0,Be=!1,Ea=0,Tt={},he={},Sr=0,se={},kr=0,le={},Ne=0,J=null,dt=0,ye=0,Ot=!1,h={text:"",mode:"replace"},D=0;function l(e,t){D&&(clearTimeout(D),D=0),C.textContent=e||"",C.className="status"+(t?" error":""),e&&(D=setTimeout(function(){D=0,C.textContent="",C.className="status"},5e3))}function Er(){D&&(clearTimeout(D),D=0),C.replaceChildren(document.createTextNode(n("status.rendererAboutPrefix")));var e=document.createElement("a");e.href="https://bm.md/",e.textContent="bm.md",e.title="https://bm.md/",e.addEventListener("click",function(t){t.preventDefault(),s&&s.postMessage&&s.postMessage({type:"openLink",url:"https://bm.md/"})}),C.append(e,document.createTextNode(n("status.rendererAboutSuffix"))),C.className="status",D=setTimeout(function(){D=0,C.textContent="",C.className="status"},5e3)}function N(){return!!v||!!m}sa&&sa.addEventListener("click",async function(){if(!s||!s.composer){l(n("newdoc.needChat"),!0);return}try{await s.composer.addContexts([{type:"annotation",label:n("newdoc.label"),promptText:n("newdoc.promptText"),reminder:n("newdoc.reminder")}]),l(n("newdoc.added"))}catch(e){l(String(e),!0)}}),la&&la.addEventListener("click",function(){Kt()});var qe="",Rt="",Bt="",pt=!1,xa=!1,He="",ue="";function y(e){return String(e).replace(/[&<>"]/g,function(t){return t==="&"?"&amp;":t==="<"?"&lt;":t===">"?"&gt;":"&quot;"})}function Ma(){ua&&(ua.textContent=He?n("home.tagline.withAssistant",{name:He}):n("home.tagline.default"))}function ft(){z&&(z.placeholder=h.mode==="continue"?n("popup.placeholderContinue",{name:He||"Finch"}):n("popup.placeholder",{name:He||"Finch"}))}function xr(e){return e?ue&&e===ue?"~":ue&&(e.indexOf(ue+"/")===0||e.indexOf(ue+"\\")===0)?"~"+e.slice(ue.length):e:""}function Mr(e){var t=46;if(!e||e.length<=t)return e;var a=e.indexOf("/")===-1&&e.indexOf("\\")!==-1?"\\":"/",r=e.slice(-(t-1)),o=r.indexOf(a);return o>0&&o<10&&(r=r.slice(o)),"\u2026"+r}function Lr(){vt(xt)}function La(e){var t=new Date(e);if(!e||isNaN(t.getTime()))return"";var a=new Date,r=function(c){return c<10?"0"+c:String(c)},o=r(t.getHours())+":"+r(t.getMinutes()),i=t.toDateString()===a.toDateString();if(i)return n("home.today",{clock:o});var u=new Date(a.getTime()-864e5);return t.toDateString()===u.toDateString()?n("home.yesterday",{clock:o}):t.getFullYear()===a.getFullYear()?r(t.getMonth()+1)+"-"+r(t.getDate()):t.getFullYear()+"-"+r(t.getMonth()+1)+"-"+r(t.getDate())}function mt(){!s||!s.postMessage||!pt||(xa=!0,s.postMessage({type:"requestRecentDocuments",cwd:qe,sessionId:Rt,spaceId:Bt}))}function Dr(e){e=e||{};var t=e.relativePath||e.fileName||"";return'<button class="doc-card" type="button" data-path="'+y(e.path||"")+'" title="'+y(e.path||"")+'"><span class="doc-reveal" data-reveal-path="'+y(e.path||"")+'" role="button" tabindex="0" title="'+y(n("home.revealInFileManager"))+'" aria-label="'+y(n("home.revealInFileManager"))+'"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"/></svg></span><div class="doc-preview">'+y(e.preview||n("home.emptyDoc"))+'</div><div class="doc-foot"><div class="doc-title">'+y(e.title||e.fileName||n("home.untitled"))+'</div><div class="doc-sub"><span class="doc-path" data-full-path="'+y(t)+'">'+y(t)+'</span><span class="doc-time">'+y(La(e.modifiedAt))+"</span></div></div></button>"}function vt(e){if(!(!re||!Et||!et)){var t=Array.isArray(e)?e:[];if(xt=t,t.length===0){Et.hidden=!0,et.hidden=!1,et.textContent=n(qe?"home.hintScoped":"home.hintDefault");return}var a=Aa(t);re.innerHTML=a.map(function(r){var o=r.documents.map(Dr).join(""),i=r.scopePath?'<button type="button" class="home-group-cwd" data-cwd-path="'+y(r.scopePath)+'" title="'+y(n("home.cwdTitle",{path:r.scopePath}))+'">'+y(Mr(xr(r.scopePath)))+"</button>":"",u='<div class="home-group-title"><span class="home-group-label">'+y(r.label)+'<span class="home-group-count">'+r.documents.length+"</span></span>"+i+"</div>";return'<div class="home-group">'+u+'<div class="home-grid">'+o+"</div></div>"}).join(""),Et.hidden=!1,et.hidden=!0,requestAnimationFrame(function(){Ar(re)})}}function Ar(e){for(var t="\u2026",a=e.querySelectorAll("[data-full-path]"),r=0;r<a.length;r++){var o=a[r],i=o.getAttribute("data-full-path")||"";if(o.textContent=i,!(!i||o.scrollWidth<=o.clientWidth+1)){for(var u=0,c=i.length,d=0;u<=c;){var f=u+c>>1;o.textContent=f>0?t+i.slice(i.length-f):t,o.scrollWidth<=o.clientWidth+1?(d=f,u=f+1):c=f-1}o.textContent=d>0?t+i.slice(i.length-d):t}}}function Da(){try{localStorage.setItem(wa,JSON.stringify({order:Fe,collapsed:lt}))}catch{}}function Aa(e){var t={};return(Array.isArray(e)?e:[]).forEach(function(a){var r=a.scopeKind||"external",o=r==="workspace"?n("appview.libraryWorkspace"):r==="external"?n("appview.libraryOther"):a.scopeLabel||a.spaceName||n("appview.libraryOther"),i=r==="space"?"space:"+(a.spaceId||o):r==="workspace"?"workspace":"external";t[i]||(t[i]={id:i,kind:r,label:o,scopePath:"",documents:[]}),r!=="external"&&!t[i].scopePath&&a.scopePath&&(t[i].scopePath=a.scopePath),t[i].documents.push(a)}),Object.keys(t).map(function(a){return t[a]}).sort(function(a,r){if(a.kind==="external"||r.kind==="external")return a.kind===r.kind?0:a.kind==="external"?1:-1;var o=Fe.indexOf(a.id),i=Fe.indexOf(r.id);if(o>=0||i>=0)return(o<0?9999:o)-(i<0?9999:i);var u={space:0,workspace:1},c=u[a.kind]-u[r.kind];return c||a.label.localeCompare(r.label)})}function Ca(e){if(L){Ft=Array.isArray(e)?e:[];var t=Aa(Ft);if(te){Cr(t);return}L.innerHTML=t.map(function(a){var r=a.documents.map(function(u){var c=u.relativePath||u.fileName||"";return'<button class="library-row" type="button" data-path="'+y(u.path||"")+'"><span class="library-row-main"><strong>'+y(u.title||u.fileName||n("home.untitled"))+'</strong><span class="library-row-meta"><span class="library-row-path" title="'+y(c)+'">'+y(c)+"</span><time>"+y(La(u.modifiedAt))+"</time></span></span></button>"}).join(""),o=a.kind!=="external",i=!lt[a.id];return'<details class="library-group" data-library-group-id="'+y(a.id)+'"'+(o?' data-draggable="true"':"")+(i?" open":"")+'><summary><span class="library-group-title">'+y(a.label)+'</span><span class="library-group-count">'+a.documents.length+'</span></summary><div class="library-items">'+r+"</div></details>"}).join("")||'<p class="home-hint">'+y(n("home.hintDefault"))+"</p>"}}function Cr(e){L.innerHTML=e.map(function(t){var a=t.kind!=="external";return'<div class="library-group library-group-reorder" data-library-group-id="'+y(t.id)+'"'+(a?' data-draggable="true"':"")+'><span class="library-reorder-handle" aria-hidden="true">'+(a?"\u22EE\u22EE":"")+'</span><span class="library-group-title">'+y(t.label)+'</span><span class="library-group-count">'+t.documents.length+"</span></div>"}).join("")||'<p class="home-hint">'+y(n("home.hintDefault"))+"</p>"}function Nt(e){te=!!e,st&&st.classList.toggle("active",te),ya&&(ya.hidden=!te),Ca(Ft)}function gt(e){!Ct||!it||(Ct.classList.toggle("open",!!e),Ct.setAttribute("aria-hidden",e?"false":"true"),it.hidden=!e,e?mt():te&&Nt(!1))}function Fr(){if(!(!ie||!L)){ie.classList.remove("dragging"),Array.prototype.forEach.call(L.querySelectorAll(".library-group.drag-over"),function(t){t.classList.remove("drag-over")}),Fe=Array.prototype.map.call(L.querySelectorAll('.library-group[data-draggable="true"]'),function(t){return t.getAttribute("data-library-group-id")}).filter(Boolean),vt(xt);var e=Ie||{};Array.prototype.forEach.call(L.querySelectorAll(".library-group"),function(t){var a=t.getAttribute("data-library-group-id");a in e&&(t.open=!!e[a])}),ie=null,setTimeout(function(){Ie=null,Da()},0)}}function Ir(){U&&U.ghost&&U.ghost.parentNode&&U.ghost.parentNode.removeChild(U.ghost)}function Fa(e,t){var a=U;!a||!a.ghost||(a.ghost.style.left=e-a.offsetX+"px",a.ghost.style.top=t-a.offsetY+"px")}function Pr(e){var t=U;if(!(!t||t.active)){t.active=!0,ie=e,Ie={},te||Array.prototype.forEach.call(L.querySelectorAll(".library-group"),function(o){var i=o.getAttribute("data-library-group-id");i&&(Ie[i]=!!o.open),o.open=!1}),e.classList.add("dragging");var a=e.getBoundingClientRect(),r=e.cloneNode(!0);r.classList.add("library-drag-ghost"),r.classList.remove("dragging"),r.style.width=a.width+"px",t.ghost=r,t.offsetX=t.startX-a.left,t.offsetY=t.startY-a.top,document.body.appendChild(r),Fa(t.startX,t.startY)}}function Tr(e,t){if(ie){var a=document.elementFromPoint(e,t),r=a&&a.closest?a.closest('.library-group[data-draggable="true"]'):null;if(Array.prototype.forEach.call(L.querySelectorAll(".library-group.drag-over"),function(i){i.classList.remove("drag-over")}),!(!r||r===ie)){r.classList.add("drag-over");var o=t>r.getBoundingClientRect().top+r.offsetHeight/2;L.insertBefore(ie,o?r.nextSibling:r)}}}function Ia(){var e=U;e&&(e.active&&(Ir(),Fr(),It=!0,setTimeout(function(){It=!1},0)),U=null)}ga&&ga.addEventListener("click",function(){gt(!0)}),ha&&ha.addEventListener("click",function(){gt(!1)}),it&&it.addEventListener("click",function(){gt(!1)}),st&&st.addEventListener("click",function(){Nt(!te)}),ba&&ba.addEventListener("click",function(){Nt(!1)}),L&&L.addEventListener("click",function(e){var t=e.target&&e.target.closest?e.target.closest(".library-row"):null,a=t&&t.getAttribute("data-path");!a||!s||!s.postMessage||(gt(!1),We=!0,l(n("status.opening")),s.postMessage({type:"loadPath",path:a}))}),L&&(L.addEventListener("toggle",function(e){var t=e.target;if(!(!t||!t.matches||!t.matches(".library-group"))&&!Ie){var a=t.getAttribute("data-library-group-id");a&&(lt[a]=!t.open,Da())}},!0),L.addEventListener("click",function(e){if(It){var t=e.target&&e.target.closest?e.target.closest(".library-group summary"):null;t&&(e.preventDefault(),e.stopPropagation())}},!0),L.addEventListener("pointerdown",function(e){if(e.button===0&&te){var t=e.target&&e.target.closest?e.target.closest('.library-group[data-draggable="true"]'):null;t&&(U={group:t,startX:e.clientX,startY:e.clientY,active:!1,ghost:null,offsetX:0,offsetY:0})}}),window.addEventListener("pointermove",function(e){var t=U;if(t){if(!t.active){if(Math.abs(e.clientX-t.startX)<4&&Math.abs(e.clientY-t.startY)<4)return;Pr(t.group)}e.preventDefault(),Fa(e.clientX,e.clientY),Tr(e.clientX,e.clientY)}}),window.addEventListener("pointerup",function(){Ia()}),window.addEventListener("pointercancel",function(){Ia()}));var We=!1;re&&re.addEventListener("click",function(e){if(!(!s||!s.postMessage)){var t=e.target&&e.target.closest?e.target.closest(".home-group-cwd"):null;if(t){var a=t.getAttribute("data-cwd-path")||"";a&&s.postMessage({type:"openPath",path:a});return}var r=e.target&&e.target.closest?e.target.closest(".doc-reveal"):null;if(r){e.preventDefault(),e.stopPropagation();var o=r.getAttribute("data-reveal-path")||"";o&&s.postMessage({type:"openPath",path:o});return}var i=e.target&&e.target.closest?e.target.closest(".doc-card"):null;if(i){var u=i.getAttribute("data-path")||"";u&&(We=!0,l(n("status.opening")),s.postMessage({type:"loadPath",path:u}))}}}),re&&re.addEventListener("keydown",function(e){if(!(e.key!=="Enter"&&e.key!==" ")){var t=e.target&&e.target.closest?e.target.closest(".doc-reveal"):null;if(!(!t||!s||!s.postMessage)){e.preventDefault(),e.stopPropagation();var a=t.getAttribute("data-reveal-path")||"";a&&s.postMessage({type:"openPath",path:a})}}});function ze(){kt.hidden=N(),document.body.classList.toggle("has-document",N()),Le&&(Le.hidden=!W),!kt.hidden&&pt&&mt()}function be(){mr.classList.toggle("active",g?N():S==="edit"),Mt.classList.toggle("active",g?N():S==="preview"),(g||S==="edit")&&p&&requestAnimationFrame(function(){p.layout()})}function Pa(e){!s||!s.panel||!s.panel.setTitle||s.panel.setTitle(e||n("home.title")).catch(function(){})}function Or(){var e=[{id:"style:kami",label:"Kami"},{id:"style:bauhaus",label:"Bauhaus"},{id:"style:blueprint",label:"Blueprint"},{id:"style:botanical",label:"Botanical"},{id:"style:newsprint",label:"Newsprint"},{id:"style:retro",label:"Retro"},{id:"style:sketch",label:"Sketch"},{id:"style:terminal",label:"Terminal"},{id:"style-sep",label:"",separator:!0}],t=M==="custom"&&!!T&&!q.some(function(i){return i&&i.css===T});if(t){for(var a=0;a<3;a++)e.push({id:"style:slot-save:"+a,label:n("aiStyle.saveToSlot",{n:a+1})});e.push({id:"style-save-sep",label:"",separator:!0})}for(var r=0;r<3;r++){var o=q[r];e.push(o?{id:"style:slot-use:"+r,label:n("toolbar.style.customSlot",{n:r+1,label:o.label})}:{id:"style:slot-use:"+r,label:n("toolbar.style.customSlotEmpty",{n:r+1}),disabled:!0})}return e}function Rr(){var e="ext:markdown-editor-icons/save",t=n("toolbar.save.label"),a=n("toolbar.save.tooltipDefault");I?(t=n("toolbar.save.label"),a=n("toolbar.save.tooltipDirty")):Se&&(e="ext:markdown-editor-icons/save-check",t=n("toolbar.save.labelSaved"),a=n("toolbar.save.tooltipSaved"));var r=N();return[{id:"home",icon:"house",tooltip:n("toolbar.home.tooltip")},{id:"open",icon:"ext:markdown-editor-icons/folder-open",tooltip:m||j||n("toolbar.open.tooltipDefault"),disabled:G},{id:"save",icon:e,label:t,tooltip:a,disabled:!I},{type:"separator"},{id:"mode",icon:Be?"ext:markdown-editor-icons/hourglass":"ext:markdown-editor-icons/swatch-book",label:n("toolbar.mode.label"),tooltip:n(r?Be?"toolbar.mode.tooltipRendering":S==="edit"?"toolbar.mode.tooltipToPreview":"toolbar.mode.tooltipToEdit":"toolbar.needDoc"),checked:S==="preview",disabled:!r},{type:"menu",id:"style",icon:"palette",tooltip:n(S==="preview"?"toolbar.style.tooltip":"toolbar.style.tooltipNeedsPreview"),disabled:S!=="preview",items:Or()},{type:"spacer"},{id:"focus",icon:"ext:markdown-editor-icons/feather",tooltip:n(r?R?"toolbar.focus.tooltipOn":"toolbar.focus.tooltipOff":"toolbar.needDoc"),checked:R,disabled:!r||S==="preview"},{type:"menu",id:"font-size",icon:"ext:markdown-editor-icons/type",tooltip:n(r?S==="preview"?"toolbar.fontSize.tooltipPreview":"toolbar.fontSize.tooltipEdit":"toolbar.needDoc"),disabled:!r||S==="preview",items:[{id:"comfort:read",label:n("toolbar.comfort.read"),checked:!O},{id:"comfort:write",label:n("toolbar.comfort.write"),checked:O},{id:"font-comfort-sep",label:"",separator:!0},{id:"font-size:14",label:n("toolbar.fontSize.small"),checked:H===14},{id:"font-size:16",label:n("toolbar.fontSize.medium"),checked:H===16},{id:"font-size:18",label:n("toolbar.fontSize.large"),checked:H===18},{id:"font-sep",label:"",separator:!0},{id:"font-family:rounded",label:n("toolbar.fontFamily.default"),checked:K==="rounded"},{id:"font-family:songti",label:n("toolbar.fontFamily.serif"),checked:K==="songti"}]},{type:"menu",id:"more",icon:"settings",items:[{id:"reload",label:n("toolbar.more.reload"),disabled:S!=="preview"},{id:"reveal",label:n("toolbar.more.reveal"),disabled:!r},{id:"more-sep",label:"",separator:!0},{id:"about",label:n("toolbar.more.about")}]}]}function F(e,t,a){return'<button type="button" data-app-action="'+e+'"'+(a?' class="checked"':"")+"><span>"+t+"</span>"+(a?"<span>\u2713</span>":"")+"</button>"}function Br(){if(rt){var e=["kami","bauhaus","blueprint","botanical","newsprint","retro","sketch","terminal"],t=e.map(function(i){return F("style:"+i,i[0].toUpperCase()+i.slice(1),M===i)}).join("")+"<hr>",a=M==="custom"&&!!T&&!q.some(function(i){return i&&i.css===T});a&&(t+=[0,1,2].map(function(i){return F("style:slot-save:"+i,n("aiStyle.saveToSlot",{n:i+1}),!1)}).join("")+"<hr>");for(var r=0;r<3;r++){var o=q[r];t+=o?F("style:slot-use:"+r,n("toolbar.style.customSlot",{n:r+1,label:o.label}),M==="custom"&&T===o.css):F("style:slot-use:"+r,n("toolbar.style.customSlotEmpty",{n:r+1}),!1)}rt.innerHTML=t}nt&&(nt.innerHTML=F("comfort:read",n("toolbar.comfort.read"),!O)+F("comfort:write",n("toolbar.comfort.write"),O)+"<hr>"+F("font-size:14",n("toolbar.fontSize.small"),H===14)+F("font-size:16",n("toolbar.fontSize.medium"),H===16)+F("font-size:18",n("toolbar.fontSize.large"),H===18)+"<hr>"+F("font-family:rounded",n("toolbar.fontFamily.default"),K==="rounded")+F("font-family:songti",n("toolbar.fontFamily.serif"),K==="songti")),ot&&(ot.innerHTML=F("reload",n("toolbar.more.reload"),!1)+F("reveal",n("toolbar.more.reveal"),!1)+"<hr>"+F("about",n("toolbar.more.about"),!1))}function Nr(){if(g){var e=N();if(ee){ee.disabled=!I,ee.classList.toggle("dirty",I);var t=Se?"toolbar.save.tooltipSaved":I?"toolbar.save.tooltipDirty":"toolbar.save.tooltipDefault";ee.setAttribute("data-tooltip",n(t));var a=ee.querySelector(".ic-save"),r=ee.querySelector(".ic-save-check");a&&(a.hidden=Se),r&&(r.hidden=!Se)}Ce&&(Ce.disabled=!e,Ce.classList.toggle("checked",R)),Ae&&(Ae.disabled=!e,Ae.classList.toggle("checked",_)),tt&&(tt.disabled=G),at&&(at.disabled=!e||!_,at.setAttribute("data-tooltip",n(_?"toolbar.style.tooltip":"toolbar.style.tooltipNeedsPreview"))),At&&(At.disabled=!e),Br()}}function w(){g?Nr():s&&s.postMessage({type:"setToolbar",toolbar:Rr()})}function Ue(e){if(A(),g){S="edit",be(),V(),w();return}S=e,be(),w(),S==="preview"&&V()}function qr(e){return!s||!s.postMessage?Promise.reject(new Error("No host bridge.")):new Promise(function(t,a){var r=new FileReader;r.onload=function(){var o=typeof r.result=="string"?r.result:"",i=o.indexOf(","),u=i>=0?o.slice(i+1):"";if(!u){a(new Error("Could not read pasted image."));return}var c=++Sr;se[c]={resolve:t,reject:a},setTimeout(function(){se[c]&&(delete se[c],a(new Error(n("status.pasteImageTimeout"))))},15e3),s.postMessage({type:"pasteImage",data:u,mimeType:e.type,requestId:c})},r.onerror=function(){a(new Error("Could not read pasted image."))},r.readAsDataURL(e)})}var p=window.MarkdownCodeMirror.create({parent:fe,value:v,onChange:function(e){v=e,A(),ze(),ke(!0),Ka(),Yr()},onOpenLink:function(e){s&&s.postMessage&&s.postMessage({type:"openLink",url:e})},onOpenImage:function(e){if(!(!s||!s.postMessage)){try{var t=new URL(e);if(t.protocol==="finch-file:"&&t.hostname==="local"){var a=t.searchParams.get("path");if(a){s.postMessage({type:"openImage",path:a});return}}}catch{}s.postMessage({type:"openImage",url:e})}},onPasteImage:qr,onAiHintTrigger:cn});p.setFontSize(H),p.setFontFamily(ge[K]),p.setComfortWriting(O),p.setFocusMode(R),p.scrollDOM.addEventListener("scroll",A);function Hr(){return M==="custom"?T:""}var Ta="user-content-mdl-",qt=0,Ht={side:"",value:-1,at:0},_e={editor:!1,preview:!1},we=[];function Wr(e){if(!g)return e;for(var t=e.split(`
11
- `),a=[],r=!1,o=0;o<t.length;o++){var i=t[o],u=/^[ \t]*(?:```|~~~)/.test(i),c=o+1;if(u){r=!r,a.push(i);continue}var d=i.trim(),f=r||d===""||/\\\s*$/.test(i)||/^<[a-zA-Z!]/.test(d)||/^!\[[^\]]*\]\([^)]*\)\s*$/.test(d)||/^\s*\|/.test(i)&&/[|]\s*$/.test(i),E=!f&&/[|]/.test(i)&&o+1<t.length&&/^[ \t]*\|?[\s:|-]+\|?[ \t]*$/.test(t[o+1])&&/-/.test(t[o+1]);if(E){a.push(i);for(var k=o+1;k<t.length&&/[|]/.test(t[k]);)a.push(t[k]),k++;o=k-1;continue}a.push(f?i:i+'<a id="mdl-'+c+'"></a>')}return a.join(`
12
- `)}function Wt(){if(we=[],$=null,!(!g||!Re)){var e=b.contentDocument;if(e){var t=e.querySelector("#bm-md");if(t){for(var a=e.querySelectorAll('a[id^="'+Ta+'"]'),r=0;r<a.length;r++){var o=a[r].id,i=Number(o.slice(Ta.length));!Number.isFinite(i)||i<1||t.contains(a[r])&&we.push({line:i,el:a[r]})}we.sort(function(u,c){return u.line-c.line}),$=null}}}}function Oa(){var e=b.contentDocument;return e&&e.scrollingElement?e.scrollingElement.scrollTop:0}function zr(e){var t=b.contentDocument;if(!(!t||!t.scrollingElement)){var a=t.scrollingElement,r=Math.max(0,Math.min(e,a.scrollHeight-a.clientHeight));Math.abs(a.scrollTop-r)<1||(Ht={side:"preview",value:r,at:Date.now()},a.scrollTop=r)}}function Ur(e){if(!e)return 0;var t=b.contentDocument,a=t&&t.scrollingElement;return e.getBoundingClientRect().bottom+(a?a.scrollTop:0)}var $=null;function _r(){if($=null,!we.length||!p||!p.scrollDOM)return null;var e=b.contentDocument,t=e&&e.scrollingElement;if(!t)return null;var a=Math.max(0,p.scrollDOM.scrollHeight-p.scrollDOM.clientHeight),r=Math.max(0,t.scrollHeight-t.clientHeight);if(a<=0||r<=0)return null;for(var o=[0],i=[0],u=0;u<we.length;u++){var c=we[u],d=p.lineBottom(c.line);if(d!=null){var f=Ur(c.el);if(!(!(d>o[o.length-1]+1)||!(f>i[i.length-1]+1))){if(d>=a||f>=r)break;o.push(d),i.push(f)}}}return o.push(a),i.push(r),$={e:o,p:i,eMax:a,pMax:r,pHeight:t.scrollHeight,eHeight:p.scrollDOM.scrollHeight},$}function jr(){var e=b.contentDocument,t=e&&e.scrollingElement;return!t||!p||!p.scrollDOM?null:!$||$.pHeight!==t.scrollHeight||$.eHeight!==p.scrollDOM.scrollHeight?_r():$}function Ra(e,t,a){var r=e.length;if(!r)return a;if(a<=e[0])return t[0];if(a>=e[r-1])return t[r-1];for(var o=0,i=r-1;o<i-1;){var u=o+i>>1;e[u]<=a?o=u:i=u}var c=e[i]-e[o]||1;return t[o]+(a-e[o])/c*(t[i]-t[o])}function Ba(e){_e[e]=!0,!qt&&(qt=requestAnimationFrame(function(){qt=0,Vr()}))}function Na(e){var t=Ht;if(t.side!==e||Date.now()-t.at>300)return!1;var a=e==="editor"?p.scrollDOM.scrollTop:Oa();return!(Math.abs(t.value-a)>2)}function Vr(){var e=_e.editor,t=_e.preview;if(_e.editor=!1,_e.preview=!1,!(!g||!N()||!_)){var a=jr();if(a){if(e)zr(Ra(a.e,a.p,p.scrollDOM.scrollTop));else if(t){var r=Ra(a.p,a.e,Oa());Ht={side:"editor",value:r,at:Date.now()},Math.abs(p.scrollDOM.scrollTop-r)>=1&&(p.scrollDOM.scrollTop=r)}}}}function Gr(){Na("editor")||!g||!N()||!_||Ba("editor")}function qa(){Na("preview")||!g||!N()||!_||Ba("preview")}function Yr(){g&&(ut&&clearTimeout(ut),ut=setTimeout(function(){ut=0,V()},420))}function V(){if(!(!v||!s)){var e=++ka;Be=!0,w(),s.postMessage({type:"renderBm",markdown:Wr(v),markdownStyle:M==="custom"?"kami":M,customCss:Hr(),requestId:e})}}function Xr(){var e=b.contentDocument,t=e&&e.scrollingElement;return t?{top:t.scrollTop}:null}function Kr(e){var t=b.contentDocument,a=t&&t.scrollingElement;!e||!a||(a.scrollTop=Math.min(e.top,Math.max(0,a.scrollHeight-a.clientHeight)))}function Jr(){try{return getComputedStyle(b).backgroundColor||""}catch{return""}}function Ha(e){var t=Xr(),a=b.contentDocument;W=e;var r=Jr();if(Re&&a&&a.body){a.body.innerHTML=W,r&&(a.body.style.background=r),Kr(t),za(),Wt();return}b.srcdoc='<!doctype html><meta charset="utf-8"><base target="_blank"><style>html,body{margin:0!important;padding:0!important;min-height:100%}body{background:'+(r||"transparent")+"}#bm-md{min-height:100dvh}</style><body>"+W}function Wa(e,t,a){return{start:e.slice(0,t).split(`
10
+ Give a drop-in replacement snippet first; once I confirm, write it back to the source file ({path}) as a targeted local replacement, not a full resend of the document.`,"annotate.reminder":"Only propose the rewrite \u2014 don't write to the source file before I confirm. Reply in natural language (e.g. \u201CI'll put it into the file once you confirm\u201D); never name the tool or its actions. [MANDATORY, not optional] Whenever this turn proposes a rewrite and is waiting on my confirmation, calling Session action=suggest with 1\u20133 one-tap confirmations (e.g. \u201CUse this one\u201D, \u201CUse the shorter version\u201D, \u201CTry another tone\u201D) is part of completing that same turn \u2014 writing the proposal text is only half the job. Do not treat the turn as done, and do not skip the call, just because the proposal text itself was already sent.","newdoc.needChat":"Use \u201CNew Document\u201D from the Finch chat instead.","newdoc.label":"New Markdown Document","newdoc.promptText":"I want to create a new Markdown document. First work out the title, content, and a not-yet-existing absolute save path from my request \u2014 ask me first if anything is missing. Once confirmed, write the full body to that path and open the new document in the editor.","newdoc.reminder":"Only create a new file; never overwrite an existing one. Reply in natural language and never name the tool or its actions. [MANDATORY, not optional] Whenever this turn ends still waiting on me to confirm a title, an angle, or a save location, it must call Session action=suggest with 1\u20133 one-tap options before the turn ends \u2014 asking the question in plain text is not enough on its own; skipping the call leaves the question unfinished.","newdoc.added":"Added the new-document prompt to the composer.","aiStyle.label":"Design a layout based on {file}","aiStyle.note":"One-click AI layout","aiStyle.baseNoteCustom":"The current base style is kami (your custom CSS layers on top of it)","aiStyle.baseNoteOther":"The current base style is {style}","aiStyle.pathMissing":"(No local file linked)","aiStyle.promptText":'Please design a custom layout CSS for this WeChat article. {baseNote}, and your CSS will layer on top of the base style. Requirements: write plain CSS rules only, with selectors scoped to tags/structure under #bm-md (e.g. #bm-md h1, #bm-md p, #bm-md blockquote, #bm-md pre code, #bm-md a, #bm-md strong, #bm-md table); don\u2019t use classes (bm.md\u2019s output has no classes, only inline styles), and use !important where needed to override the base style. You can draw on bm.md\u2019s built-in style language: kami (warm paper feel), bauhaus (geometric color-blocking), blueprint (technical grid), botanical (fresh green), newsprint (editorial serif), retro (nostalgic), sketch (hand-drawn), terminal (monospace dark). Article path: {path}. Once it\u2019s ready, call set_style directly (pass path="{path}", css, and a short label, no slot \u2014 passing path lets it find the right preview panel for this document even if I\u2019ve switched away) \u2014 don\u2019t ask me which slot to use first; the panel will pop up a lightweight \u201Csave as custom style\u201D button so I can decide after seeing the result.',"aiStyle.reminder":"Don\u2019t ask which slot to use before applying \u2014 just design it and call set_style (without slot) to apply it to the preview; whether to save it is for me to decide from the panel. Reply in natural language and never name the tool or its actions.","aiStyle.requested":"Asked AI to design a custom layout.","aiStyle.applied":"AI designed a layout and applied it to the preview.","aiStyle.saveToSlot":"Save as style {n}","aiStyle.appViewDesigning":"AI is designing a layout\u2026","aiStyle.appViewDone":"Layout design finished.","aiStyle.appViewFailed":"Layout design did not finish.","status.saved":"Saved.","status.savedWithNewChanges":"Saved \u2014 but the editor already has newer changes.","status.saveFailed":"Save failed: {err}","status.saving":"Saving\u2026","status.noSourceFile":"Not linked to a local file: click \u201COpen\u201D in the toolbar again to link it and enable saving.","status.pickerTimeout":'The file picker took too long to respond and switched to the in-browser picker \u2014 please click "Open" again.',"status.externalUpdateSkipped":"Detected an external file update; not loaded yet to avoid overwriting unsaved changes.","status.draftRestored":'Restored your last unsaved edits (differs from the file on disk). To discard, click "Open" and pick this file again, then choose "Discard".',"status.draftConflict":"A local unsaved draft exists, but the file was changed and saved elsewhere; loaded the latest file content \u2014 the draft is kept, not discarded.","status.sourceMissing":"The original file was moved or deleted; your content is still here \u2014 saving will recreate the file at its original path.","status.externalUpdateApplied":"Detected a file update and refreshed.","status.openingPicker":"Opening the file picker\u2026","status.opening":"Opening\u2026","status.opened":"Opened {file}.","status.contentUpdated":"Content updated.","status.contentUpdatedLine":"Updated line {line}.","status.contentUpdatedLines":"Updated lines {from}\u2013{to}.","status.contentUpdatedSpots":"Updated {count} spots, {lines} lines in total.","status.pasteImageTimeout":"Paste image timed out","status.pasteImageFailed":"Paste image failed: {msg}","status.clipboardPrepareTimeout":"Preparing WeChat images timed out","status.pleaseOpenArticle":"Open an article first.","status.copiedRich":"Rich HTML copied \u2014 paste it directly into the WeChat editor.","status.copiedPlainOnly":"Only plain text was copied; formatting didn't come through \u2014 please try again.","status.copyFailed":"Copy failed \u2014 please try again.","status.richCopyFailed":"Rich-text copy failed: {err}","status.clipboardUnsupported":"Copying images isn\u2019t supported here \u2014 use \u201CExport Image\u201D instead.","status.generatingImage":"Generating image\u2026","status.previewNotReady":"Preview isn't ready yet","status.imageCopied":"Image copied to the clipboard.","status.copyImageFailed":"Copy image failed: {err} (try \u201CExport Image\u201D instead)","status.exportImageFailedGeneric":"Export image failed: preview isn't ready yet.","status.exportImageFailed":"Export image failed: {err}","status.generatingPdf":"Generating PDF\u2026","status.exportPdfFailedGeneric":"Export PDF failed: preview isn't ready yet.","status.exportPdfFailed":"Export PDF failed: {err}","status.exported":"Exported: {path}","status.annotateOn":"Annotate is on \u2014 select text to ask AI to revise it.","status.annotateOff":"Annotate is off.","status.comfortWrite":"Comfortable mode is on \u2014 roomier line spacing.","status.comfortRead":"Compact mode is on.","status.focusOn":"Focus mode is on \u2014 inactive lines are dimmed.","status.focusOff":"Focus mode is off.","status.saveFailedNoReturn":"Save failed \u2014 staying on this document.","status.rendererAboutPrefix":"Renderer: local bmmd CLI (","status.rendererAboutSuffix":", LGPL-3.0).","status.appliedStyleSlot":"Applied \u201C{label}\u201D.","status.needCustomStyleFirst":"Apply a custom/AI-designed style first before saving it to a slot.","status.savedToSlot":"Saved to slot {slot}: {label}","status.serializeFailed":"Failed to serialize the preview content: {err}","status.imageConversionFailed":"The preview couldn't be converted to an image (it may contain external images that can't be read cross-origin)","status.imageGenFailed":"Failed to generate image data","status.clipboardPrepareFailedDefault":"Failed to prepare WeChat images","status.pasteImageFailedDefault":"Paste image failed","status.savedAppliedToSlot":"{labelPrefix}Saved and applied to custom style {slot}."}};function n(e,t){var a=it?st.zh:st.en,r=Object.prototype.hasOwnProperty.call(a,e)?a[e]:Object.prototype.hasOwnProperty.call(st.en,e)?st.en[e]:e;if(t)for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r=r.split("{"+o+"}").join(String(t[o])));return r}function Dt(e){var t=e||document;document.documentElement.lang=it?"zh-CN":"en",document.title=n("meta.title"),Array.prototype.forEach.call(t.querySelectorAll("[data-i18n]"),function(a){a.textContent=n(a.getAttribute("data-i18n"))}),Array.prototype.forEach.call(t.querySelectorAll("[data-i18n-title]"),function(a){a.title=n(a.getAttribute("data-i18n-title"))}),Array.prototype.forEach.call(t.querySelectorAll("[data-i18n-tooltip]"),function(a){var r=n(a.getAttribute("data-i18n-tooltip"));a.setAttribute("data-tooltip",r),a.setAttribute("aria-label",r)}),Array.prototype.forEach.call(t.querySelectorAll("[data-i18n-aria]"),function(a){a.setAttribute("aria-label",n(a.getAttribute("data-i18n-aria")))})}var Ft=document.getElementById("empty"),ha=document.getElementById("emptyNew"),ya=document.getElementById("emptyOpen"),Tt=document.getElementById("homeRecent"),le=document.getElementById("homeGrid"),lt=document.getElementById("homeHint"),Pt=[],ba=document.getElementById("homeTagline"),Mr=document.getElementById("editPane"),Ot=document.getElementById("previewPane"),ue=document.getElementById("previewResizer"),Se=document.getElementById("editor"),w=document.getElementById("article"),M=document.getElementById("status"),I=document.getElementById("popup"),_=document.getElementById("popupInput"),wa=document.getElementById("popupSend"),Sa=document.getElementById("popupShortcut"),Pe=document.getElementById("actions"),Ir=document.getElementById("actCopyWx"),Lr=document.getElementById("actCopyImg"),Ar=document.getElementById("actSaveImg"),Cr=document.getElementById("actSavePdf"),ke=document.getElementById("actAiStyle"),ka=document.getElementById("actToggle"),ce=document.getElementById("confirmOverlay"),xa=document.getElementById("confirmMessage"),Rt=document.getElementById("confirmCancel"),Bt=document.getElementById("confirmDiscard"),Oe=document.getElementById("confirmSave"),Ea=document.getElementById("appToolbar"),Ma=document.getElementById("appHome"),Ia=document.getElementById("appLibrary"),ut=document.getElementById("appOpen"),re=document.getElementById("appSave"),Re=document.getElementById("appPreview"),ct=document.getElementById("appStyle"),dt=document.getElementById("appStyleMenu"),Be=document.getElementById("appFocus"),Nt=document.getElementById("appFont"),pt=document.getElementById("appFontMenu"),Dr=document.getElementById("appMore"),ft=document.getElementById("appMoreMenu"),qt=document.getElementById("libraryDrawer"),mt=document.getElementById("libraryBackdrop"),La=document.getElementById("libraryClose"),vt=document.getElementById("libraryReorder"),Aa=document.getElementById("libraryReorderFooter"),Ca=document.getElementById("libraryReorderDone"),C=document.getElementById("libraryGroups"),Da="md-editor-library-groups-v1",de=[],xe={},pe=null,Ne=null,ne=!1,qe=[],j=null,Ht=!1,v=!1,Fa=!1,Ta=!1,N=null,fe=null,V=!0,Fr=!1,gt=0,He=!1,te=!0,k="edit",L="kami",O="",Ee="",q=[null,null,null],Me={songti:"Songti SC, STSong, SimSun, Noto Serif CJK SC, serif",rounded:"PingFang SC, Microsoft YaHei, Noto Sans CJK SC, sans-serif"},H=14,K="rounded",R=!1,B=!1;try{var ht=Number(localStorage.getItem("md-editor-font-size"));(ht===14||ht===16||ht===18)&&(H=ht);var Wt=localStorage.getItem("md-editor-font-family");Me[Wt]?K=Wt:Wt&&localStorage.removeItem("md-editor-font-family"),R=localStorage.getItem("md-editor-comfort-writing")==="1",B=localStorage.getItem("md-editor-focus-mode")==="1";var We=JSON.parse(localStorage.getItem(Da)||"{}");Array.isArray(We.order)&&(de=We.order.filter(function(e){return typeof e=="string"})),We.collapsed&&typeof We.collapsed=="object"&&(xe=We.collapsed)}catch{}te=!B;var g="",ze="",W="",f="",T=null,z="",Ue=!1,Pa=0,_e=!1,Oa=0,zt={},Ie={},Tr=0,me={},Pr=0,ve={},je=0,J=null,yt=0,Le=0,Ut=!1,h={text:"",mode:"replace"},E=0;function l(e,t){E&&(clearTimeout(E),E=0),M.textContent=e||"",M.className="status"+(t?" error":""),e&&(E=setTimeout(function(){E=0,M.textContent="",M.className="status"},5e3))}function ge(e,t,a,r){if(E&&(clearTimeout(E),E=0),M.replaceChildren(document.createTextNode(e||"")),M.className="status"+(t?" error":""),a){var o=document.createElement("button");o.type="button",o.className="status-inline-btn",o.textContent=n("appview.openSession"),o.addEventListener("click",function(){i&&i.navigation&&i.navigation.openSession&&i.navigation.openSession(a)}),M.appendChild(o)}r&&(E=setTimeout(function(){E=0,M.replaceChildren(),M.className="status"},r))}function Or(){E&&(clearTimeout(E),E=0),M.replaceChildren(document.createTextNode(n("status.rendererAboutPrefix")));var e=document.createElement("a");e.href="https://bm.md/",e.textContent="bm.md",e.title="https://bm.md/",e.addEventListener("click",function(t){t.preventDefault(),i&&i.postMessage&&i.postMessage({type:"openLink",url:"https://bm.md/"})}),M.append(e,document.createTextNode(n("status.rendererAboutSuffix"))),M.className="status",E=setTimeout(function(){E=0,M.textContent="",M.className="status"},5e3)}function A(){return!!g||!!f}ha&&ha.addEventListener("click",async function(){if(!i||!i.composer){l(n("newdoc.needChat"),!0);return}try{await i.composer.addContexts([{type:"annotation",label:n("newdoc.label"),promptText:n("newdoc.promptText"),reminder:n("newdoc.reminder")}]),l(n("newdoc.added"))}catch(e){l(String(e),!0)}}),ya&&ya.addEventListener("click",function(){ia()});var Ve="",_t="",jt="",bt=!1,Ra=!1,Ge="",he="";function y(e){return String(e).replace(/[&<>"]/g,function(t){return t==="&"?"&amp;":t==="<"?"&lt;":t===">"?"&gt;":"&quot;"})}function Ba(){ba&&(ba.textContent=Ge?n("home.tagline.withAssistant",{name:Ge}):n("home.tagline.default"))}function wt(){_&&(_.placeholder=h.mode==="continue"?n("popup.placeholderContinue",{name:Ge||"Finch"}):n("popup.placeholder",{name:Ge||"Finch"}))}function Rr(e){return e?he&&e===he?"~":he&&(e.indexOf(he+"/")===0||e.indexOf(he+"\\")===0)?"~"+e.slice(he.length):e:""}function Br(e){var t=46;if(!e||e.length<=t)return e;var a=e.indexOf("/")===-1&&e.indexOf("\\")!==-1?"\\":"/",r=e.slice(-(t-1)),o=r.indexOf(a);return o>0&&o<10&&(r=r.slice(o)),"\u2026"+r}function Nr(){kt(Pt)}function Na(e){var t=new Date(e);if(!e||isNaN(t.getTime()))return"";var a=new Date,r=function(c){return c<10?"0"+c:String(c)},o=r(t.getHours())+":"+r(t.getMinutes()),s=t.toDateString()===a.toDateString();if(s)return n("home.today",{clock:o});var u=new Date(a.getTime()-864e5);return t.toDateString()===u.toDateString()?n("home.yesterday",{clock:o}):t.getFullYear()===a.getFullYear()?r(t.getMonth()+1)+"-"+r(t.getDate()):t.getFullYear()+"-"+r(t.getMonth()+1)+"-"+r(t.getDate())}function St(){!i||!i.postMessage||!bt||(Ra=!0,i.postMessage({type:"requestRecentDocuments",cwd:Ve,sessionId:_t,spaceId:jt}))}function qr(e){e=e||{};var t=e.relativePath||e.fileName||"";return'<button class="doc-card" type="button" data-path="'+y(e.path||"")+'" title="'+y(e.path||"")+'"><span class="doc-reveal" data-reveal-path="'+y(e.path||"")+'" role="button" tabindex="0" title="'+y(n("home.revealInFileManager"))+'" aria-label="'+y(n("home.revealInFileManager"))+'"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"/></svg></span><div class="doc-preview">'+y(e.preview||n("home.emptyDoc"))+'</div><div class="doc-foot"><div class="doc-title">'+y(e.title||e.fileName||n("home.untitled"))+'</div><div class="doc-sub"><span class="doc-path" data-full-path="'+y(t)+'">'+y(t)+'</span><span class="doc-time">'+y(Na(e.modifiedAt))+"</span></div></div></button>"}function kt(e){if(!(!le||!Tt||!lt)){var t=Array.isArray(e)?e:[];if(Pt=t,t.length===0){Tt.hidden=!0,lt.hidden=!1,lt.textContent=n(Ve?"home.hintScoped":"home.hintDefault");return}var a=qa(t);le.innerHTML=a.map(function(r){var o=r.documents.map(qr).join(""),s=r.scopePath?'<button type="button" class="home-group-cwd" data-cwd-path="'+y(r.scopePath)+'" title="'+y(n("home.cwdTitle",{path:r.scopePath}))+'">'+y(Br(Rr(r.scopePath)))+"</button>":"",u='<div class="home-group-title"><span class="home-group-label">'+y(r.label)+'<span class="home-group-count">'+r.documents.length+"</span></span>"+s+"</div>";return'<div class="home-group">'+u+'<div class="home-grid">'+o+"</div></div>"}).join(""),Tt.hidden=!1,lt.hidden=!0,requestAnimationFrame(function(){Hr(le)})}}function Hr(e){for(var t="\u2026",a=e.querySelectorAll("[data-full-path]"),r=0;r<a.length;r++){var o=a[r],s=o.getAttribute("data-full-path")||"";if(o.textContent=s,!(!s||o.scrollWidth<=o.clientWidth+1)){for(var u=0,c=s.length,d=0;u<=c;){var m=u+c>>1;o.textContent=m>0?t+s.slice(s.length-m):t,o.scrollWidth<=o.clientWidth+1?(d=m,u=m+1):c=m-1}o.textContent=d>0?t+s.slice(s.length-d):t}}}function Vt(){var e={order:de,collapsed:xe};try{localStorage.setItem(Da,JSON.stringify(e))}catch{}i&&i.postMessage&&i.postMessage({type:"saveLibraryGroups",libraryGroups:e})}function qa(e){var t={};return(Array.isArray(e)?e:[]).forEach(function(a){var r=a.scopeKind||"external",o=r==="workspace"?n("appview.libraryWorkspace"):r==="external"?n("appview.libraryOther"):a.scopeLabel||a.spaceName||n("appview.libraryOther"),s=r==="space"?"space:"+(a.spaceId||o):r==="workspace"?"workspace":"external";t[s]||(t[s]={id:s,kind:r,label:o,scopePath:"",documents:[]}),r!=="external"&&!t[s].scopePath&&a.scopePath&&(t[s].scopePath=a.scopePath),t[s].documents.push(a)}),Object.keys(t).map(function(a){return t[a]}).sort(function(a,r){if(a.kind==="external"||r.kind==="external")return a.kind===r.kind?0:a.kind==="external"?1:-1;var o=de.indexOf(a.id),s=de.indexOf(r.id);if(o>=0||s>=0)return(o<0?9999:o)-(s<0?9999:s);var u={space:0,workspace:1},c=u[a.kind]-u[r.kind];return c||a.label.localeCompare(r.label)})}function Gt(e){if(C){qe=Array.isArray(e)?e:[];var t=qa(qe);if(ne){Wr(t);return}C.innerHTML=t.map(function(a){var r=a.documents.map(function(u){var c=u.relativePath||u.fileName||"";return'<button class="library-row" type="button" data-path="'+y(u.path||"")+'"><span class="library-row-main"><strong>'+y(u.title||u.fileName||n("home.untitled"))+'</strong><span class="library-row-meta"><span class="library-row-path" title="'+y(c)+'">'+y(c)+"</span><time>"+y(Na(u.modifiedAt))+"</time></span></span></button>"}).join(""),o=a.kind!=="external",s=!xe[a.id];return'<details class="library-group" data-library-group-id="'+y(a.id)+'"'+(o?' data-draggable="true"':"")+(s?" open":"")+'><summary><span class="library-group-title">'+y(a.label)+'</span><span class="library-group-count">'+a.documents.length+'</span></summary><div class="library-items">'+r+"</div></details>"}).join("")||'<p class="home-hint">'+y(n("home.hintDefault"))+"</p>"}}function Wr(e){C.innerHTML=e.map(function(t){var a=t.kind!=="external";return'<div class="library-group library-group-reorder" data-library-group-id="'+y(t.id)+'"'+(a?' data-draggable="true"':"")+'><span class="library-reorder-handle" aria-hidden="true">'+(a?"\u22EE\u22EE":"")+'</span><span class="library-group-title">'+y(t.label)+'</span><span class="library-group-count">'+t.documents.length+"</span></div>"}).join("")||'<p class="home-hint">'+y(n("home.hintDefault"))+"</p>"}function Yt(e){ne=!!e,vt&&vt.classList.toggle("active",ne),Aa&&(Aa.hidden=!ne),Gt(qe)}function xt(e){!qt||!mt||(qt.classList.toggle("open",!!e),qt.setAttribute("aria-hidden",e?"false":"true"),mt.hidden=!e,e?St():ne&&Yt(!1))}function zr(){if(!(!pe||!C)){pe.classList.remove("dragging"),Array.prototype.forEach.call(C.querySelectorAll(".library-group.drag-over"),function(t){t.classList.remove("drag-over")}),de=Array.prototype.map.call(C.querySelectorAll('.library-group[data-draggable="true"]'),function(t){return t.getAttribute("data-library-group-id")}).filter(Boolean),kt(Pt);var e=Ne||{};Array.prototype.forEach.call(C.querySelectorAll(".library-group"),function(t){var a=t.getAttribute("data-library-group-id");a in e&&(t.open=!!e[a])}),pe=null,setTimeout(function(){Ne=null,Vt()},0)}}function Ur(){j&&j.ghost&&j.ghost.parentNode&&j.ghost.parentNode.removeChild(j.ghost)}function Ha(e,t){var a=j;!a||!a.ghost||(a.ghost.style.left=e-a.offsetX+"px",a.ghost.style.top=t-a.offsetY+"px")}function _r(e){var t=j;if(!(!t||t.active)){t.active=!0,pe=e,Ne={},ne||Array.prototype.forEach.call(C.querySelectorAll(".library-group"),function(o){var s=o.getAttribute("data-library-group-id");s&&(Ne[s]=!!o.open),o.open=!1}),e.classList.add("dragging");var a=e.getBoundingClientRect(),r=e.cloneNode(!0);r.classList.add("library-drag-ghost"),r.classList.remove("dragging"),r.style.width=a.width+"px",t.ghost=r,t.offsetX=t.startX-a.left,t.offsetY=t.startY-a.top,document.body.appendChild(r),Ha(t.startX,t.startY)}}function jr(e,t){if(pe){var a=document.elementFromPoint(e,t),r=a&&a.closest?a.closest('.library-group[data-draggable="true"]'):null;if(Array.prototype.forEach.call(C.querySelectorAll(".library-group.drag-over"),function(s){s.classList.remove("drag-over")}),!(!r||r===pe)){r.classList.add("drag-over");var o=t>r.getBoundingClientRect().top+r.offsetHeight/2;C.insertBefore(pe,o?r.nextSibling:r)}}}function Wa(){var e=j;e&&(e.active&&(Ur(),zr(),Ht=!0,setTimeout(function(){Ht=!1},0)),j=null)}Ia&&Ia.addEventListener("click",function(){xt(!0)}),La&&La.addEventListener("click",function(){xt(!1)}),mt&&mt.addEventListener("click",function(){xt(!1)}),vt&&vt.addEventListener("click",function(){Yt(!ne)}),Ca&&Ca.addEventListener("click",function(){Yt(!1)}),C&&C.addEventListener("click",function(e){var t=e.target&&e.target.closest?e.target.closest(".library-row"):null,a=t&&t.getAttribute("data-path");!a||!i||!i.postMessage||(xt(!1),Ye=!0,l(n("status.opening")),Xt(a))}),C&&(C.addEventListener("toggle",function(e){var t=e.target;if(!(!t||!t.matches||!t.matches(".library-group"))&&!Ne){var a=t.getAttribute("data-library-group-id");a&&(xe[a]=!t.open,Vt())}},!0),C.addEventListener("click",function(e){if(Ht){var t=e.target&&e.target.closest?e.target.closest(".library-group summary"):null;t&&(e.preventDefault(),e.stopPropagation())}},!0),C.addEventListener("pointerdown",function(e){if(e.button===0&&ne){var t=e.target&&e.target.closest?e.target.closest('.library-group[data-draggable="true"]'):null;t&&(j={group:t,startX:e.clientX,startY:e.clientY,active:!1,ghost:null,offsetX:0,offsetY:0})}}),window.addEventListener("pointermove",function(e){var t=j;if(t){if(!t.active){if(Math.abs(e.clientX-t.startX)<4&&Math.abs(e.clientY-t.startY)<4)return;_r(t.group)}e.preventDefault(),Ha(e.clientX,e.clientY),jr(e.clientX,e.clientY)}}),window.addEventListener("pointerup",function(){Wa()}),window.addEventListener("pointercancel",function(){Wa()}));var Ye=!1,Et="";function Xt(e){!e||!i||!i.postMessage||(Et=e,i.postMessage({type:"loadPath",path:e}))}le&&le.addEventListener("click",function(e){if(!(!i||!i.postMessage)){var t=e.target&&e.target.closest?e.target.closest(".home-group-cwd"):null;if(t){var a=t.getAttribute("data-cwd-path")||"";a&&i.postMessage({type:"openPath",path:a});return}var r=e.target&&e.target.closest?e.target.closest(".doc-reveal"):null;if(r){e.preventDefault(),e.stopPropagation();var o=r.getAttribute("data-reveal-path")||"";o&&i.postMessage({type:"openPath",path:o});return}var s=e.target&&e.target.closest?e.target.closest(".doc-card"):null;if(s){var u=s.getAttribute("data-path")||"";u&&(Ye=!0,l(n("status.opening")),Xt(u))}}}),le&&le.addEventListener("keydown",function(e){if(!(e.key!=="Enter"&&e.key!==" ")){var t=e.target&&e.target.closest?e.target.closest(".doc-reveal"):null;if(!(!t||!i||!i.postMessage)){e.preventDefault(),e.stopPropagation();var a=t.getAttribute("data-reveal-path")||"";a&&i.postMessage({type:"openPath",path:a})}}});function Xe(){Ft.hidden=A(),document.body.classList.toggle("has-document",A()),Pe&&(Pe.hidden=!z),!Ft.hidden&&bt&&St()}function Ae(){Mr.classList.toggle("active",v?A():k==="edit"),Ot.classList.toggle("active",v?A():k==="preview"),(v||k==="edit")&&p&&requestAnimationFrame(function(){p.layout()})}function za(e){v||!i||!i.panel||!i.panel.setTitle||i.panel.setTitle(e||n("home.title")).catch(function(){})}function Vr(e){return e?"document:"+encodeURIComponent(e):""}function Ua(e){if(!e||e.indexOf("document:")!==0)return"";try{var t=decodeURIComponent(e.slice(9));return/^(?:\/|[A-Za-z]:[\\/])/.test(t)?t:""}catch{return""}}var Ce="";function _a(e){!e||e===f||!i||!i.postMessage||(Ce=e,Xt(e))}function ye(){if(!(!v||!i||!i.appView||!i.appView.breadcrumb)){var e=A()&&f?[{id:Vr(f),title:W||n("common.markdownDocDefault"),icon:"file-text"}]:[];i.appView.breadcrumb.set(e).catch(function(){})}}function Gr(){Ta||!i||!i.appView||!i.appView.breadcrumb||(Ta=!0,i.appView.breadcrumb.onNavigate(function(e){if(!e.id){A()&&nt().then(ye);return}var t=Ua(e.id);t?_a(t):i.appView.breadcrumb.set([]).catch(function(){})}),i.appView.breadcrumb.onRestore(function(e){var t=Array.isArray(e.levels)?e.levels:[];if(!t.length){A()&&nt().then(ye);return}var a=t.length===1&&Ua(t[0].id);if(!a){i.appView.breadcrumb.set([]).catch(function(){}),A()&&nt().then(ye);return}_a(a)}))}function Yr(){var e=[{id:"style:kami",label:"Kami"},{id:"style:bauhaus",label:"Bauhaus"},{id:"style:blueprint",label:"Blueprint"},{id:"style:botanical",label:"Botanical"},{id:"style:newsprint",label:"Newsprint"},{id:"style:retro",label:"Retro"},{id:"style:sketch",label:"Sketch"},{id:"style:terminal",label:"Terminal"},{id:"style-sep",label:"",separator:!0}],t=L==="custom"&&!!O&&!q.some(function(s){return s&&s.css===O});if(t){for(var a=0;a<3;a++)e.push({id:"style:slot-save:"+a,label:n("aiStyle.saveToSlot",{n:a+1})});e.push({id:"style-save-sep",label:"",separator:!0})}for(var r=0;r<3;r++){var o=q[r];e.push(o?{id:"style:slot-use:"+r,label:n("toolbar.style.customSlot",{n:r+1,label:o.label})}:{id:"style:slot-use:"+r,label:n("toolbar.style.customSlotEmpty",{n:r+1}),disabled:!0})}return e}function Xr(){var e="ext:markdown-editor-icons/save",t=n("toolbar.save.label"),a=n("toolbar.save.tooltipDefault");P?(t=n("toolbar.save.label"),a=n("toolbar.save.tooltipDirty")):Fe&&(e="ext:markdown-editor-icons/save-check",t=n("toolbar.save.labelSaved"),a=n("toolbar.save.tooltipSaved"));var r=A();return[{id:"home",icon:"house",tooltip:n("toolbar.home.tooltip")},{id:"open",icon:"ext:markdown-editor-icons/folder-open",tooltip:f||W||n("toolbar.open.tooltipDefault"),disabled:Y},{id:"save",icon:e,label:t,tooltip:a,disabled:!P},{type:"separator"},{id:"mode",icon:_e?"ext:markdown-editor-icons/hourglass":"ext:markdown-editor-icons/swatch-book",label:n("toolbar.mode.label"),tooltip:n(r?_e?"toolbar.mode.tooltipRendering":k==="edit"?"toolbar.mode.tooltipToPreview":"toolbar.mode.tooltipToEdit":"toolbar.needDoc"),checked:k==="preview",disabled:!r},{type:"menu",id:"style",icon:"palette",tooltip:n(k==="preview"?"toolbar.style.tooltip":"toolbar.style.tooltipNeedsPreview"),disabled:k!=="preview",items:Yr()},{type:"spacer"},{id:"focus",icon:"ext:markdown-editor-icons/feather",tooltip:n(r?B?"toolbar.focus.tooltipOn":"toolbar.focus.tooltipOff":"toolbar.needDoc"),checked:B,disabled:!r||k==="preview"},{type:"menu",id:"font-size",icon:"ext:markdown-editor-icons/type",tooltip:n(r?k==="preview"?"toolbar.fontSize.tooltipPreview":"toolbar.fontSize.tooltipEdit":"toolbar.needDoc"),disabled:!r||k==="preview",items:[{id:"comfort:read",label:n("toolbar.comfort.read"),checked:!R},{id:"comfort:write",label:n("toolbar.comfort.write"),checked:R},{id:"font-comfort-sep",label:"",separator:!0},{id:"font-size:14",label:n("toolbar.fontSize.small"),checked:H===14},{id:"font-size:16",label:n("toolbar.fontSize.medium"),checked:H===16},{id:"font-size:18",label:n("toolbar.fontSize.large"),checked:H===18},{id:"font-sep",label:"",separator:!0},{id:"font-family:rounded",label:n("toolbar.fontFamily.default"),checked:K==="rounded"},{id:"font-family:songti",label:n("toolbar.fontFamily.serif"),checked:K==="songti"}]},{type:"menu",id:"more",icon:"settings",items:[{id:"reload",label:n("toolbar.more.reload"),disabled:k!=="preview"},{id:"reveal",label:n("toolbar.more.reveal"),disabled:!r},{id:"recentSession",label:n("toolbar.more.recentSession"),disabled:!fe},{id:"more-sep",label:"",separator:!0},{id:"about",label:n("toolbar.more.about")}]}]}function D(e,t,a,r){return'<button type="button" data-app-action="'+e+'"'+(a?' class="checked"':"")+(r?" disabled":"")+"><span>"+t+"</span>"+(a?"<span>\u2713</span>":"")+"</button>"}function ja(){if(dt){var e=["kami","bauhaus","blueprint","botanical","newsprint","retro","sketch","terminal"],t=e.map(function(s){return D("style:"+s,s[0].toUpperCase()+s.slice(1),L===s)}).join("")+"<hr>",a=L==="custom"&&!!O&&!q.some(function(s){return s&&s.css===O});a&&(t+=[0,1,2].map(function(s){return D("style:slot-save:"+s,n("aiStyle.saveToSlot",{n:s+1}),!1)}).join("")+"<hr>");for(var r=0;r<3;r++){var o=q[r];t+=o?D("style:slot-use:"+r,n("toolbar.style.customSlot",{n:r+1,label:o.label}),L==="custom"&&O===o.css):D("style:slot-use:"+r,n("toolbar.style.customSlotEmpty",{n:r+1}),!1)}dt.innerHTML=t}pt&&(pt.innerHTML=D("comfort:read",n("toolbar.comfort.read"),!R)+D("comfort:write",n("toolbar.comfort.write"),R)+"<hr>"+D("font-size:14",n("toolbar.fontSize.small"),H===14)+D("font-size:16",n("toolbar.fontSize.medium"),H===16)+D("font-size:18",n("toolbar.fontSize.large"),H===18)+"<hr>"+D("font-family:rounded",n("toolbar.fontFamily.default"),K==="rounded")+D("font-family:songti",n("toolbar.fontFamily.serif"),K==="songti")),ft&&(ft.innerHTML=D("reload",n("toolbar.more.reload"),!1)+D("reveal",n("toolbar.more.reveal"),!1)+D("recentSession",n("toolbar.more.recentSession"),!1,!fe)+"<hr>"+D("about",n("toolbar.more.about"),!1))}function Kr(){if(v){var e=A();if(re){re.disabled=!P,re.classList.toggle("dirty",P);var t=Fe?"toolbar.save.tooltipSaved":P?"toolbar.save.tooltipDirty":"toolbar.save.tooltipDefault";re.setAttribute("data-tooltip",n(t));var a=re.querySelector(".ic-save"),r=re.querySelector(".ic-save-check");a&&(a.hidden=Fe),r&&(r.hidden=!Fe)}Be&&(Be.disabled=!e,Be.classList.toggle("checked",B)),Re&&(Re.disabled=!e,Re.classList.toggle("checked",V)),ut&&(ut.disabled=Y),ct&&(ct.disabled=!e||!V,ct.setAttribute("data-tooltip",n(V?"toolbar.style.tooltip":"toolbar.style.tooltipNeedsPreview"))),Nt&&(Nt.disabled=!e),ja()}}function b(){v?Kr():i&&i.postMessage({type:"setToolbar",toolbar:Xr()})}function Ke(e){if(F(),v){k="edit",Ae(),G(),b();return}k=e,Ae(),b(),k==="preview"&&G()}function Jr(e){return!i||!i.postMessage?Promise.reject(new Error("No host bridge.")):new Promise(function(t,a){var r=new FileReader;r.onload=function(){var o=typeof r.result=="string"?r.result:"",s=o.indexOf(","),u=s>=0?o.slice(s+1):"";if(!u){a(new Error("Could not read pasted image."));return}var c=++Tr;me[c]={resolve:t,reject:a},setTimeout(function(){me[c]&&(delete me[c],a(new Error(n("status.pasteImageTimeout"))))},15e3),i.postMessage({type:"pasteImage",data:u,mimeType:e.type,requestId:c})},r.onerror=function(){a(new Error("Could not read pasted image."))},r.readAsDataURL(e)})}var p=window.MarkdownCodeMirror.create({parent:Se,value:g,onChange:function(e){g=e,F(),Xe(),Te(!0),sr(),on()},onOpenLink:function(e){i&&i.postMessage&&i.postMessage({type:"openLink",url:e})},onOpenImage:function(e){if(!(!i||!i.postMessage)){try{var t=new URL(e);if(t.protocol==="finch-file:"&&t.hostname==="local"){var a=t.searchParams.get("path");if(a){i.postMessage({type:"openImage",path:a});return}}}catch{}i.postMessage({type:"openImage",url:e})}},onPasteImage:Jr,onAiHintTrigger:kn,onAiWorkingCancel:function(){!v||!N||!f||!i||!i.postMessage||i.postMessage({type:"cancelRewrite",path:f,sessionId:N.sessionId,turnId:N.turnId})}});p.setFontSize(H),p.setFontFamily(Me[K]),p.setComfortWriting(R),p.setFocusMode(B),p.scrollDOM.addEventListener("scroll",F);function $r(){return L==="custom"?O:""}var Va="user-content-mdl-",Kt=0,Jt={side:"",value:-1,at:0},Je={editor:!1,preview:!1},De=[];function Zr(e){if(!v)return e;for(var t=e.split(`
11
+ `),a=[],r=!1,o=0;o<t.length;o++){var s=t[o],u=/^[ \t]*(?:```|~~~)/.test(s),c=o+1;if(u){r=!r,a.push(s);continue}var d=s.trim(),m=r||d===""||/\\\s*$/.test(s)||/^<[a-zA-Z!]/.test(d)||/^!\[[^\]]*\]\([^)]*\)\s*$/.test(d)||/^\s*\|/.test(s)&&/[|]\s*$/.test(s),x=!m&&/[|]/.test(s)&&o+1<t.length&&/^[ \t]*\|?[\s:|-]+\|?[ \t]*$/.test(t[o+1])&&/-/.test(t[o+1]);if(x){a.push(s);for(var S=o+1;S<t.length&&/[|]/.test(t[S]);)a.push(t[S]),S++;o=S-1;continue}a.push(m?s:s+'<a id="mdl-'+c+'"></a>')}return a.join(`
12
+ `)}function $t(){if(De=[],$=null,!(!v||!Ue)){var e=w.contentDocument;if(e){var t=e.querySelector("#bm-md");if(t){for(var a=e.querySelectorAll('a[id^="'+Va+'"]'),r=0;r<a.length;r++){var o=a[r].id,s=Number(o.slice(Va.length));!Number.isFinite(s)||s<1||t.contains(a[r])&&De.push({line:s,el:a[r]})}De.sort(function(u,c){return u.line-c.line}),$=null}}}}function Ga(){var e=w.contentDocument;return e&&e.scrollingElement?e.scrollingElement.scrollTop:0}function Qr(e){var t=w.contentDocument;if(!(!t||!t.scrollingElement)){var a=t.scrollingElement,r=Math.max(0,Math.min(e,a.scrollHeight-a.clientHeight));Math.abs(a.scrollTop-r)<1||(Jt={side:"preview",value:r,at:Date.now()},a.scrollTop=r)}}function en(e){if(!e)return 0;var t=w.contentDocument,a=t&&t.scrollingElement;return e.getBoundingClientRect().bottom+(a?a.scrollTop:0)}var $=null;function tn(){if($=null,!De.length||!p||!p.scrollDOM)return null;var e=w.contentDocument,t=e&&e.scrollingElement;if(!t)return null;var a=Math.max(0,p.scrollDOM.scrollHeight-p.scrollDOM.clientHeight),r=Math.max(0,t.scrollHeight-t.clientHeight);if(a<=0||r<=0)return null;for(var o=[0],s=[0],u=0;u<De.length;u++){var c=De[u],d=p.lineBottom(c.line);if(d!=null){var m=en(c.el);if(!(!(d>o[o.length-1]+1)||!(m>s[s.length-1]+1))){if(d>=a||m>=r)break;o.push(d),s.push(m)}}}return o.push(a),s.push(r),$={e:o,p:s,eMax:a,pMax:r,pHeight:t.scrollHeight,eHeight:p.scrollDOM.scrollHeight},$}function an(){var e=w.contentDocument,t=e&&e.scrollingElement;return!t||!p||!p.scrollDOM?null:!$||$.pHeight!==t.scrollHeight||$.eHeight!==p.scrollDOM.scrollHeight?tn():$}function Ya(e,t,a){var r=e.length;if(!r)return a;if(a<=e[0])return t[0];if(a>=e[r-1])return t[r-1];for(var o=0,s=r-1;o<s-1;){var u=o+s>>1;e[u]<=a?o=u:s=u}var c=e[s]-e[o]||1;return t[o]+(a-e[o])/c*(t[s]-t[o])}function Xa(e){Je[e]=!0,!Kt&&(Kt=requestAnimationFrame(function(){Kt=0,rn()}))}function Ka(e){var t=Jt;if(t.side!==e||Date.now()-t.at>300)return!1;var a=e==="editor"?p.scrollDOM.scrollTop:Ga();return!(Math.abs(t.value-a)>2)}function rn(){var e=Je.editor,t=Je.preview;if(Je.editor=!1,Je.preview=!1,!(!v||!A()||!V)){var a=an();if(a){if(e)Qr(Ya(a.e,a.p,p.scrollDOM.scrollTop));else if(t){var r=Ya(a.p,a.e,Ga());Jt={side:"editor",value:r,at:Date.now()},Math.abs(p.scrollDOM.scrollTop-r)>=1&&(p.scrollDOM.scrollTop=r)}}}}function nn(){Ka("editor")||!v||!A()||!V||Xa("editor")}function Ja(){Ka("preview")||!v||!A()||!V||Xa("preview")}function on(){v&&(gt&&clearTimeout(gt),gt=setTimeout(function(){gt=0,G()},420))}function G(){if(!(!g||!i)){var e=++Pa;_e=!0,b(),i.postMessage({type:"renderBm",markdown:Zr(g),markdownStyle:L==="custom"?"kami":L,customCss:$r(),requestId:e})}}function sn(){var e=w.contentDocument,t=e&&e.scrollingElement;return t?{top:t.scrollTop}:null}function ln(e){var t=w.contentDocument,a=t&&t.scrollingElement;!e||!a||(a.scrollTop=Math.min(e.top,Math.max(0,a.scrollHeight-a.clientHeight)))}function un(){try{return getComputedStyle(w).backgroundColor||""}catch{return""}}function $a(e){var t=sn(),a=w.contentDocument;z=e;var r=un();if(Ue&&a&&a.body){a.body.innerHTML=z,r&&(a.body.style.background=r),ln(t),Qa(),$t();return}w.srcdoc='<!doctype html><meta charset="utf-8"><base target="_blank"><style>html,body{margin:0!important;padding:0!important;min-height:100%}body{background:'+(r||"transparent")+"}#bm-md{min-height:100dvh}</style><body>"+z}function Za(e,t,a){return{start:e.slice(0,t).split(`
13
13
  `).length,end:e.slice(0,a).split(`
14
- `).length}}function $r(e,t){for(var a="",r=[],o=0;o<e.length;o++)/\s/.test(e[o])?a&&a[a.length-1]!==" "&&(a+=" ",r.push(t[o])):(a+=e[o],r.push(t[o]));return a.endsWith(" ")&&(a=a.slice(0,-1),r.pop()),{text:a,map:r}}function Qr(e){var t="",a=[];function r(Y,P){t+=Y,a.push(P)}for(var o=0;o<e.length;){var i=o===0||e[o-1]===`
15
- `;if(i){var u=/^[ \t]*(?:```|~~~)[^\n]*/.exec(e.slice(o));if(u){o+=u[0].length;continue}var c=/^[ \t]*(?:#{1,6}|>+|[-+*]|\d+[.)])[ \t]+/.exec(e.slice(o));if(c){o+=c[0].length;continue}}var d=/^!?\[([^\]]*)\]\((?:\\.|[^)])*\)/.exec(e.slice(o));if(d){for(var f=o+d[0].indexOf("[")+1,E=0;E<d[1].length;E++)/[*_~`]/.test(d[1][E])||r(d[1][E],f+E);o+=d[0].length;continue}var k=/^<[^>]+>/.exec(e.slice(o));if(k){o+=k[0].length;continue}if(e[o]==="\\"&&o+1<e.length){r(e[o+1],o+1),o+=2;continue}if(/[*_~`]/.test(e[o])){o++;continue}r(e[o],o),o++}return $r(t,a)}function Zr(e,t){var a=e.indexOf(t);if(a>=0)return{start:a,end:a+t.length};var r=Qr(e),o=t.replace(/\s+/g," ").trim(),i=r.text.indexOf(o);if(i>=0)return{start:r.map[i],end:r.map[i+o.length-1]+1};if(o.length>=12){var u=o.slice(0,6),c=o.slice(-6),d=r.text.indexOf(u),f=r.text.indexOf(c,Math.max(0,d+u.length));if(d>=0&&f>=d)return{start:r.map[d],end:r.map[f+c.length-1]+1}}return null}function en(e){return String(e||"").split(/[\\/]/).pop()||""}function za(){var e=b.contentDocument;if(!e||e.__bound)return;e.__bound=!0;function t(){if(Z){var a=b.contentWindow,r=a.getSelection(),o=r.toString().trim();if(!(!o||!r.rangeCount)){var i=r.getRangeAt(0),u=Array.from(i.getClientRects()),c=b.getBoundingClientRect(),d=u.map(function(P){return{top:c.top+P.top,left:c.left+P.left,width:P.width,height:P.height}}),f=u[0]||i.getBoundingClientRect(),E=u[u.length-1]||f,k=Zr(v,o),Y=k?Wa(v,k.start,k.end):null;_a(o,{startTop:c.top+f.top,startLeft:c.left+f.left,endBottom:c.top+E.bottom,endLeft:c.left+E.left},d,Y,"preview")}}}e.addEventListener("mouseup",t),e.addEventListener("mousedown",function(){ce(),A()}),e.addEventListener("keyup",t),e.addEventListener("keydown",function(a){(a.metaKey||a.ctrlKey)&&(a.key==="p"||a.key==="P")&&(a.preventDefault(),Ue("edit"))}),e.addEventListener("scroll",function(){ce(),A()},!0),b.contentWindow.addEventListener("scroll",function(){ce(),A()})}b.onload=function(){Re=!0,za(),Wt()};function Ua(){p&&p.scrollDOM&&!p.scrollDOM.__scrollSyncBound&&(p.scrollDOM.__scrollSyncBound=!0,p.scrollDOM.addEventListener("scroll",Gr,{passive:!0}));var e=b.contentDocument;if(e&&!e.__scrollSyncBound){e.__scrollSyncBound=!0;var t=e.scrollingElement||e.documentElement;t&&t.addEventListener("scroll",qa,{passive:!0}),e.defaultView&&e.defaultView.addEventListener("scroll",qa,{passive:!0})}}Ua(),window.addEventListener("resize",function(){$=null}),b.addEventListener("load",function(){requestAnimationFrame(function(){Re=!0,Wt(),Ua()})});var ht=0,zt=[];function _a(e,t,a,r,o){ce(),ht=setTimeout(function(){ja(e,t,a,r,o)},300)}function ce(){ht&&(clearTimeout(ht),ht=0)}function ja(e,t,a,r,o,i){h.text=e,h.lines=r||null,h.origin=o||"",h.mode=i||"replace",ft(),x.classList.remove("hidden"),x.classList.toggle("popup-bar",!!(t&&t.width)),z.value="",an(a),requestAnimationFrame(function(){tn(t),t&&t.focus&&z.focus()})}function tn(e){var t=8,a=10,r=e||{},o=g?t+48:t;if(x.style.width=r.width?r.width+"px":"",r.width){x.style.left=Math.max(t,r.startLeft||0)+"px",x.style.top=Math.max(o,Math.min(r.startTop||0,window.innerHeight-(x.offsetHeight||44)-t))+"px";return}var i=x.offsetWidth||300,u=x.offsetHeight||44,c=(r.startTop||0)-a-u,d=c>=o,f=d?c:(r.endBottom||0)+a,E=d?r.startLeft||0:r.endLeft!=null?r.endLeft:r.startLeft||0;x.style.left=Math.max(t,Math.min(E,window.innerWidth-i-t))+"px",x.style.top=Math.max(o,Math.min(f,window.innerHeight-u-t))+"px"}function an(e){Va(),(e||[]).forEach(function(t){var a=document.createElement("div");a.className="fake-sel",a.style.top=t.top+"px",a.style.left=t.left+"px",a.style.width=t.width+"px",a.style.height=t.height+"px",document.body.appendChild(a),zt.push(a)})}function Va(){zt.forEach(function(e){e.remove()}),zt=[]}var rn=navigator.platform||navigator.userAgent||"",Ut=/Mac|iPhone|iPod|iPad/.test(rn);function nn(e){return String(e.key).toLowerCase()!=="e"||e.shiftKey?!1:Ut?e.metaKey&&e.ctrlKey&&!e.altKey:e.ctrlKey&&e.altKey&&!e.metaKey}(function(){if(da){var t=Ut?["\u2318","\u2303","E"]:["Ctrl","Alt","E"],a=Ut?"":"+";da.innerHTML=t.map(function(r){return"<kbd>"+r+"</kbd>"}).join(a?'<span class="popup-shortcut-sep">'+a+"</span>":"")}})();function A(e){var t=e===!0&&h.origin==="editor"&&S==="edit";ce(),x.classList.add("hidden"),x.classList.remove("popup-bar"),x.classList.remove("focused"),x.style.width="",h.text="",h.lines=null,h.origin="",h.mode="replace",Va(),t&&requestAnimationFrame(function(){p.focus()})}ca.onclick=Ya;var Ga=0;z.addEventListener("compositionend",function(){Ga=Date.now()});function on(e){return e.isComposing||e.keyCode===229?!0:Date.now()-Ga<100}z.addEventListener("keydown",function(e){if(e.key==="Enter"){if(on(e))return;Ya()}e.key==="Escape"&&A(!0)}),z.addEventListener("focus",function(){x.classList.add("focused")}),z.addEventListener("blur",function(){requestAnimationFrame(function(){document.activeElement!==ca&&x.classList.remove("focused")})}),document.addEventListener("keydown",function(e){e.key==="Escape"&&!x.classList.contains("hidden")&&A(!0)}),document.addEventListener("keydown",function(e){nn(e)&&(x.classList.contains("hidden")||(e.preventDefault(),z.focus(),z.select()))}),document.addEventListener("mousedown",function(e){x.contains(e.target)||(ce(),A())}),window.addEventListener("resize",A);function sn(){if(!h.lines)return n("annotate.lineUnknown");var e=h.lines.start,t=h.lines.end;return e===t?n("annotate.lineSingle",{a:e}):n("annotate.lineRange",{a:e,b:t})}function ln(){return h.lines?h.lines.start+"-"+h.lines.end:n("annotate.lineCompactUnknown")}async function Ya(){var e=z.value.trim(),t=h.mode==="continue",a=h.mode==="annotate-line";if(!(!h.text&&!t&&!a||!s)){if(I&&m){var r=await ea();if(!r){l(n("status.saveFailedNoReturn"),!0);return}}if(g){if(!m||!s.postMessage){l(n("status.noSourceFile"),!0);return}s.postMessage({type:"requestRewrite",path:m,selectedText:h.text,requirement:e,startLine:h.lines&&h.lines.start,endLine:h.lines&&h.lines.end,rewriteMode:t?"continue":"replace"}),A(!0),l(n(t?"appview.continuing":"appview.rewriting"));return}if(!s.composer||!h.text&&!a){A(!0);return}try{await s.composer.addContexts([{type:"annotation",label:(j||"Markdown")+":"+ln(),note:e||void 0,promptText:n("annotate.promptText",{lineLabel:sn(),requirement:e?n("annotate.requirementWith",{comment:e}):n("annotate.requirementDefault"),text:h.text||n("annotate.emptyLine"),path:m||n("annotate.pathMissing")}),reminder:n("annotate.reminder")}]),A(!0),l(n("annotate.added"))}catch(o){l(String(o),!0)}}}function un(){var e=p.getSelection();if(!e)return!1;var t=e.text.trim();if(!t)return!1;var a=Wa(p.getValue(),e.start,e.end);return _a(t,{startTop:e.startRect.top,startLeft:e.startRect.left,endBottom:e.rect.bottom,endLeft:e.rect.left},null,a,"editor"),!0}function Xa(){Z&&un()}function cn(e){if(!N()||!e)return!1;ce();var t=fe.querySelector(".cm-line")||fe.querySelector(".cm-content"),a=(t||fe).getBoundingClientRect();return ja("",{startTop:e.rect.top,startLeft:a.left,width:Math.max(240,a.width),focus:!0},null,{start:e.line,end:e.line},"editor",g?"continue":"annotate-line"),!0}fe.addEventListener("mouseup",Xa),fe.addEventListener("keyup",function(e){e.shiftKey&&Xa()});var I=!1,je=0,ae=null,_t=!1,Se=!1,jt="",Vt=null;function dn(e){jt=e,Vt=v,s.postMessage({type:"saveDraft",path:e,markdown:v,base:B})}function Ka(){!m||!s||!s.postMessage||jt===m&&Vt===v||dn(m)}function Gt(){jt="",Vt=null}function Yt(e){Gt(),e&&s&&s.postMessage&&s.postMessage({type:"discardDraft",path:e})}function ke(e,t){I=e,Ne&&(clearTimeout(Ne),Ne=0),Se=!I&&!!t,w(),!I&&t&&(Ne=setTimeout(function(){Ne=0,I||(Se=!1,w())},3e3))}async function Ja(e){if(ae)return Qa(),l("\u8BF7\u5148\u5904\u7406 AI \u5199\u56DE\u4E0E\u672C\u5730\u7F16\u8F91\u7684\u51B2\u7A81\u3002",!0),!1;if(J&&J.createWritable)try{var t=await J.createWritable();return await t.write(e),await t.close(),dt=(await J.getFile()).lastModified,B=e,ke(v!==e,v===e),l(n(v===e?"status.saved":"status.savedWithNewChanges")),Gt(),!0}catch(r){return l(n("status.saveFailed",{err:String(r)}),!0),!1}if(m){var a=++Ea;return l(n("status.saving")),Tt[a]=e,s.postMessage({type:"saveMarkdown",path:m,markdown:e,requestId:a}),new Promise(function(r){he[a]=r})}return l(n("status.noSourceFile"),!0),!1}document.addEventListener("keydown",function(e){var t=e.metaKey||e.ctrlKey;if(t&&(e.key==="s"||e.key==="S")){e.preventDefault(),Zt();return}t&&(e.key==="p"||e.key==="P")&&(e.preventDefault(),Ue(S==="edit"?"preview":"edit"))});function $a(){ye&&(clearInterval(ye),ye=0),J=null}var Xt=null;function Ve(e,t,a,r,o){if(!r&&I&&B!==null&&e!==B)return ae={markdown:e,name:t,path:a,diskBaseline:o},l(n("status.externalUpdateSkipped"),!0),Qa(),!1;var i=B!==null&&(!a||!m||a===m);return i||(Z=!0),v=e,Oe=t,a&&(m=a),j=en(a||m)||t||"Markdown",B=typeof o=="string"?o:v,Xt=i?p.applyExternalValue(v):null,Xt||p.setValue(v),ke(!1),Pa(j),ze(),be(),(g||S==="preview")&&V(),!0}async function Qa(){if(!(_t||!ae||!I)){var e=ae,t=B;if(v===t){ae=null,Ve(e.markdown,e.name,e.path,!0,e.diskBaseline);return}if(e.markdown===t){ae=null;return}_t=!0;var a=await Pn();if(_t=!1,ae===e){if(a==="later"){l("AI \u5199\u56DE\u5DF2\u4FDD\u7559\u5728\u78C1\u76D8\uFF1B\u53EF\u7EE7\u7EED\u7F16\u8F91\u540E\u518D\u5904\u7406\u3002");return}if(ae=null,a==="remote"){Yt(m),Ve(e.markdown,e.name,e.path,!0,e.diskBaseline);return}a==="local"&&(B=typeof e.diskBaseline=="string"?e.diskBaseline:e.markdown,Ka(),l("\u5DF2\u4FDD\u7559\u672C\u5730\u7F16\u8F91\uFF1BAI \u5199\u56DE\u7248\u672C\u4ECD\u5728\u78C1\u76D8\u4E0A\u3002"))}}}async function Za(e){Oe=e.name,dt=e.lastModified,typeof e.path=="string"&&e.path?(m=e.path,s&&s.postMessage({type:"watchPath",path:m})):m="",Ve(await e.text(),Oe,m,!0)}function pn(){J&&(ye&&clearInterval(ye),ye=setInterval(async function(){if(!(Ot||!J)){Ot=!0;try{var e=await J.getFile();if(e.lastModified!==dt){dt=e.lastModified;var t=await e.text();t!==B&&Ve(t,Oe,m)&&l(n("status.externalUpdateApplied"))}}catch{}Ot=!1}},800))}var G=!1,Ge=0;function Ye(){Ge&&(clearTimeout(Ge),Ge=0)}function fn(){Ye(),Ge=setTimeout(function(){Ge=0,G&&(G=!1,Pe=!1,w(),l(n("status.pickerTimeout"),!0))},2e4)}async function Kt(){if(I){var e=await lr(n("confirm.message",{file:j||n("common.markdownDocDefault")}));if(e==="cancel")return;if(e==="save"){var t=await ea();if(!t){l(n("status.saveFailedNoReturn"),!0);return}}else e==="discard"&&Yt(m)}if($a(),Pe&&s&&s.postMessage){if(G){Ye(),Pe=!1,G=!1,w(),await er();return}G=!0,fn(),w(),l(n("status.openingPicker")),s.postMessage({type:"requestOpen"});return}await er()}async function er(){if("showOpenFilePicker"in window)try{var e=await window.showOpenFilePicker({types:[{description:"Markdown",accept:{"text/markdown":[".md",".markdown"]}}],multiple:!1});J=e[0],await Za(await J.getFile()),pn();return}catch(a){if(a&&a.name==="AbortError")return}var t=document.createElement("input");t.type="file",t.accept=".md,.markdown,text/markdown",t.onchange=function(){var a=t.files&&t.files[0];a&&Za(a).catch(function(r){l(String(r),!0)})},t.click()}function mn(){window.focus(),document.body.tabIndex=-1;try{document.body.focus({preventScroll:!0})}catch{document.body.focus()}}async function vn(e){for(var t=0;t<e;t++){if(mn(),await new Promise(function(a){requestAnimationFrame(function(){requestAnimationFrame(a)})}),document.hasFocus())return!0;await new Promise(function(a){setTimeout(a,40)})}return document.hasFocus()}function tr(e){var t=Array.from(new Set(e.match(/finch-file:\/\/local\?path=[^\s)"']+/g)||[]));return!t.length||!s||!s.postMessage?Promise.resolve(e):new Promise(function(a,r){var o=++kr;le[o]={resolve:a,reject:r,sourceHtml:e},setTimeout(function(){le[o]&&(delete le[o],r(new Error(n("status.clipboardPrepareTimeout"))))},15e3),s.postMessage({type:"readClipboardImages",urls:t,requestId:o})})}function gn(e){var t=new DOMParser().parseFromString(e,"text/html");function a(r){return r&&r.tagName==="P"&&!r.textContent.trim()&&!r.querySelector("img,video,iframe,table")}return Array.from(t.querySelectorAll("figure.figure-image")).forEach(function(r){var o=r.previousElementSibling,i=r.nextElementSibling;a(o)&&o.remove(),a(i)&&i.remove()}),t.body.innerHTML}async function ar(e,t){if(document.hasFocus()||await vn(5),window.ClipboardItem&&navigator.clipboard&&navigator.clipboard.write)try{return await navigator.clipboard.write([new ClipboardItem({"text/html":Promise.resolve(e).then(function(r){return new Blob([r],{type:"text/html"})}),"text/plain":new Blob([t],{type:"text/plain"})})]),"rich"}catch{}var a=await Promise.resolve(e);return hn(a)?"rich":yn(t)?"plain":"none"}function hn(e){var t=document.createElement("div");t.contentEditable="true",t.style.position="fixed",t.style.left="-9999px",t.style.top="0",t.innerHTML=e,document.body.appendChild(t);var a=document.createRange();a.selectNodeContents(t);var r=window.getSelection();r.removeAllRanges(),r.addRange(a);var o=!1;try{o=document.execCommand("copy")}catch{o=!1}return r.removeAllRanges(),t.remove(),o}function yn(e){var t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-9999px",t.style.top="0",document.body.appendChild(t),t.focus(),t.select();var a=!1;try{a=document.execCommand("copy")}catch{a=!1}return t.remove(),a}async function bn(){if(!W){l(n("status.pleaseOpenArticle"),!0);return}try{var e=b.contentDocument&&b.contentDocument.body?b.contentDocument.body.innerText:W.replace(/<[^>]+>/g,""),t=await ar(tr(W),e);t==="none"&&(await new Promise(function(a){setTimeout(a,200)}),t=await ar(tr(W),e)),t==="rich"?l(n("status.copiedRich")):l(n(t==="plain"?"status.copiedPlainOnly":"status.copyFailed"),!0)}catch(a){l(n("status.richCopyFailed",{err:String(a)}),!0)}finally{S==="edit"&&requestAnimationFrame(function(){p.focus()})}}function wn(){if(!Re||!b.contentDocument)return null;var e=b.contentDocument.querySelector("#bm-md");if(!e)return null;var t=e.getBoundingClientRect();return{root:e,width:Math.ceil(t.width||e.scrollWidth),height:Math.ceil(t.height||e.scrollHeight)}}function Jt(){var e=wn();if(!e||!e.width||!e.height)return Promise.resolve(null);var t=2,a=e.root.cloneNode(!0);a.style.minHeight=e.height+"px",a.style.margin="0",a.style.boxSizing="border-box";var r;try{r=new XMLSerializer().serializeToString(a)}catch(u){return Promise.reject(new Error(n("status.serializeFailed",{err:String(u)})))}var o='<svg xmlns="http://www.w3.org/2000/svg" width="'+e.width+'" height="'+e.height+'"><foreignObject x="0" y="0" width="'+e.width+'" height="'+e.height+'">'+r+"</foreignObject></svg>",i="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(o);return new Promise(function(u,c){var d=new Image;d.decoding="sync",d.onload=function(){try{var f=document.createElement("canvas");f.width=Math.round(e.width*t),f.height=Math.round(e.height*t);var E=f.getContext("2d");E.scale(t,t);var k="";try{k=b.contentWindow.getComputedStyle(e.root).backgroundColor}catch{k=""}k&&k!=="rgba(0, 0, 0, 0)"&&k!=="transparent"&&(E.fillStyle=k,E.fillRect(0,0,e.width,e.height)),E.drawImage(d,0,0,e.width,e.height),u({canvas:f,cssWidth:e.width,cssHeight:e.height})}catch(Y){c(Y)}},d.onerror=function(){c(new Error(n("status.imageConversionFailed")))},d.src=i})}function $t(e,t,a){return new Promise(function(r,o){e.toBlob(function(i){i?r(i):o(new Error(n("status.imageGenFailed")))},t,a)})}function rr(e){for(var t="",a=32768,r=0;r<e.length;r+=a)t+=String.fromCharCode.apply(null,e.subarray(r,r+a));return btoa(t)}async function Sn(){if(!W){l(n("status.pleaseOpenArticle"),!0);return}if(!window.ClipboardItem||!navigator.clipboard||!navigator.clipboard.write){l(n("status.clipboardUnsupported"),!0);return}l(n("status.generatingImage"));var e=Jt().then(function(a){if(!a)throw new Error(n("status.previewNotReady"));return $t(a.canvas,"image/png")});try{await navigator.clipboard.write([new ClipboardItem({"image/png":e})]),l(n("status.imageCopied"));return}catch{try{var t=await e;await navigator.clipboard.write([new ClipboardItem({"image/png":t})]),l(n("status.imageCopied"));return}catch(r){l(n("status.copyImageFailed",{err:r&&r.message?r.message:String(r)}),!0)}}}async function kn(){if(!W){l(n("status.pleaseOpenArticle"),!0);return}try{l(n("status.generatingImage"));var e=await Jt();if(!e){l(n("status.exportImageFailedGeneric"),!0);return}var t=await $t(e.canvas,"image/png"),a=await t.arrayBuffer(),r=rr(new Uint8Array(a));s&&s.postMessage&&s.postMessage({type:"exportFile",data:r,ext:"png",path:m,fileName:j,markdown:v})}catch(o){l(n("status.exportImageFailed",{err:String(o)}),!0)}}function En(e){for(var t=String(e);t.length<10;)t="0"+t;return t}function Q(e){for(var t=new Uint8Array(e.length),a=0;a<e.length;a++)t[a]=e.charCodeAt(a)&255;return t}function Qt(e){for(var t=0,a=0;a<e.length;a++)t+=e[a].length;for(var r=new Uint8Array(t),o=0,a=0;a<e.length;a++)r.set(e[a],o),o+=e[a].length;return r}function xn(e,t,a,r,o){var i=Q(`%PDF-1.4
14
+ `).length}}function cn(e,t){for(var a="",r=[],o=0;o<e.length;o++)/\s/.test(e[o])?a&&a[a.length-1]!==" "&&(a+=" ",r.push(t[o])):(a+=e[o],r.push(t[o]));return a.endsWith(" ")&&(a=a.slice(0,-1),r.pop()),{text:a,map:r}}function dn(e){var t="",a=[];function r(Q,U){t+=Q,a.push(U)}for(var o=0;o<e.length;){var s=o===0||e[o-1]===`
15
+ `;if(s){var u=/^[ \t]*(?:```|~~~)[^\n]*/.exec(e.slice(o));if(u){o+=u[0].length;continue}var c=/^[ \t]*(?:#{1,6}|>+|[-+*]|\d+[.)])[ \t]+/.exec(e.slice(o));if(c){o+=c[0].length;continue}}var d=/^!?\[([^\]]*)\]\((?:\\.|[^)])*\)/.exec(e.slice(o));if(d){for(var m=o+d[0].indexOf("[")+1,x=0;x<d[1].length;x++)/[*_~`]/.test(d[1][x])||r(d[1][x],m+x);o+=d[0].length;continue}var S=/^<[^>]+>/.exec(e.slice(o));if(S){o+=S[0].length;continue}if(e[o]==="\\"&&o+1<e.length){r(e[o+1],o+1),o+=2;continue}if(/[*_~`]/.test(e[o])){o++;continue}r(e[o],o),o++}return cn(t,a)}function pn(e,t){var a=e.indexOf(t);if(a>=0)return{start:a,end:a+t.length};var r=dn(e),o=t.replace(/\s+/g," ").trim(),s=r.text.indexOf(o);if(s>=0)return{start:r.map[s],end:r.map[s+o.length-1]+1};if(o.length>=12){var u=o.slice(0,6),c=o.slice(-6),d=r.text.indexOf(u),m=r.text.indexOf(c,Math.max(0,d+u.length));if(d>=0&&m>=d)return{start:r.map[d],end:r.map[m+c.length-1]+1}}return null}function fn(e){return String(e||"").split(/[\\/]/).pop()||""}function Qa(){var e=w.contentDocument;if(!e||e.__bound)return;e.__bound=!0;function t(){if(te){var a=w.contentWindow,r=a.getSelection(),o=r.toString().trim();if(!(!o||!r.rangeCount)){var s=r.getRangeAt(0),u=Array.from(s.getClientRects()),c=w.getBoundingClientRect(),d=u.map(function(U){return{top:c.top+U.top,left:c.left+U.left,width:U.width,height:U.height}}),m=u[0]||s.getBoundingClientRect(),x=u[u.length-1]||m,S=pn(g,o),Q=S?Za(g,S.start,S.end):null;tr(o,{startTop:c.top+m.top,startLeft:c.left+m.left,endBottom:c.top+x.bottom,endLeft:c.left+x.left},d,Q,"preview")}}}e.addEventListener("mouseup",t),e.addEventListener("mousedown",function(){be(),F()}),e.addEventListener("keyup",t),e.addEventListener("keydown",function(a){(a.metaKey||a.ctrlKey)&&(a.key==="p"||a.key==="P")&&(a.preventDefault(),Ke("edit"))}),e.addEventListener("scroll",function(){be(),F()},!0),w.contentWindow.addEventListener("scroll",function(){be(),F()})}w.onload=function(){Ue=!0,Qa(),$t()};function er(){p&&p.scrollDOM&&!p.scrollDOM.__scrollSyncBound&&(p.scrollDOM.__scrollSyncBound=!0,p.scrollDOM.addEventListener("scroll",nn,{passive:!0}));var e=w.contentDocument;if(e&&!e.__scrollSyncBound){e.__scrollSyncBound=!0;var t=e.scrollingElement||e.documentElement;t&&t.addEventListener("scroll",Ja,{passive:!0}),e.defaultView&&e.defaultView.addEventListener("scroll",Ja,{passive:!0})}}er(),window.addEventListener("resize",function(){$=null}),w.addEventListener("load",function(){requestAnimationFrame(function(){Ue=!0,$t(),er()})});var Mt=0,Zt=[];function tr(e,t,a,r,o){be(),Mt=setTimeout(function(){ar(e,t,a,r,o)},300)}function be(){Mt&&(clearTimeout(Mt),Mt=0)}function ar(e,t,a,r,o,s){h.text=e,h.lines=r||null,h.origin=o||"",h.mode=s||"replace",wt(),I.classList.remove("hidden"),I.classList.toggle("popup-bar",!!(t&&t.width)),_.value="",vn(a),requestAnimationFrame(function(){mn(t),t&&t.focus&&_.focus()})}function mn(e){var t=8,a=10,r=e||{},o=v?t+48:t;if(I.style.width=r.width?r.width+"px":"",r.width){I.style.left=Math.max(t,r.startLeft||0)+"px",I.style.top=Math.max(o,Math.min(r.startTop||0,window.innerHeight-(I.offsetHeight||44)-t))+"px";return}var s=I.offsetWidth||300,u=I.offsetHeight||44,c=(r.startTop||0)-a-u,d=c>=o,m=d?c:(r.endBottom||0)+a,x=d?r.startLeft||0:r.endLeft!=null?r.endLeft:r.startLeft||0;I.style.left=Math.max(t,Math.min(x,window.innerWidth-s-t))+"px",I.style.top=Math.max(o,Math.min(m,window.innerHeight-u-t))+"px"}function vn(e){rr(),(e||[]).forEach(function(t){var a=document.createElement("div");a.className="fake-sel",a.style.top=t.top+"px",a.style.left=t.left+"px",a.style.width=t.width+"px",a.style.height=t.height+"px",document.body.appendChild(a),Zt.push(a)})}function rr(){Zt.forEach(function(e){e.remove()}),Zt=[]}var gn=navigator.platform||navigator.userAgent||"",Qt=/Mac|iPhone|iPod|iPad/.test(gn);function hn(e){return String(e.key).toLowerCase()!=="e"||e.shiftKey?!1:Qt?e.metaKey&&e.ctrlKey&&!e.altKey:e.ctrlKey&&e.altKey&&!e.metaKey}(function(){if(Sa){var t=Qt?["\u2318","\u2303","E"]:["Ctrl","Alt","E"],a=Qt?"":"+";Sa.innerHTML=t.map(function(r){return"<kbd>"+r+"</kbd>"}).join(a?'<span class="popup-shortcut-sep">'+a+"</span>":"")}})();function F(e){var t=e===!0&&h.origin==="editor"&&k==="edit";be(),I.classList.add("hidden"),I.classList.remove("popup-bar"),I.classList.remove("focused"),I.style.width="",h.text="",h.lines=null,h.origin="",h.mode="replace",rr(),t&&requestAnimationFrame(function(){p.focus()})}wa.onclick=or;var nr=0;_.addEventListener("compositionend",function(){nr=Date.now()});function yn(e){return e.isComposing||e.keyCode===229?!0:Date.now()-nr<100}_.addEventListener("keydown",function(e){if(e.key==="Enter"){if(yn(e))return;or()}e.key==="Escape"&&F(!0)}),_.addEventListener("focus",function(){I.classList.add("focused")}),_.addEventListener("blur",function(){requestAnimationFrame(function(){document.activeElement!==wa&&I.classList.remove("focused")})}),document.addEventListener("keydown",function(e){e.key==="Escape"&&!I.classList.contains("hidden")&&F(!0)}),document.addEventListener("keydown",function(e){hn(e)&&(I.classList.contains("hidden")||(e.preventDefault(),_.focus(),_.select()))}),document.addEventListener("mousedown",function(e){I.contains(e.target)||(be(),F())}),window.addEventListener("resize",F);function bn(){if(!h.lines)return n("annotate.lineUnknown");var e=h.lines.start,t=h.lines.end;return e===t?n("annotate.lineSingle",{a:e}):n("annotate.lineRange",{a:e,b:t})}function wn(){return h.lines?h.lines.start+"-"+h.lines.end:n("annotate.lineCompactUnknown")}async function or(){var e=_.value.trim(),t=h.mode==="continue",a=h.mode==="annotate-line";if(!(!h.text&&!t&&!a||!i)){if(P&&f){var r=await da();if(!r){l(n("status.saveFailedNoReturn"),!0);return}}if(v){if(!f||!i.postMessage){l(n("status.noSourceFile"),!0);return}i.postMessage({type:"requestRewrite",path:f,selectedText:h.text,requirement:e,startLine:h.lines&&h.lines.start,endLine:h.lines&&h.lines.end,rewriteMode:t?"continue":"replace"}),F(!0),l(n(t?"appview.continuing":"appview.rewriting"));return}if(!i.composer||!h.text&&!a){F(!0);return}try{await i.composer.addContexts([{type:"annotation",label:(W||"Markdown")+":"+wn(),note:e||void 0,promptText:n("annotate.promptText",{lineLabel:bn(),requirement:e?n("annotate.requirementWith",{comment:e}):n("annotate.requirementDefault"),text:h.text||n("annotate.emptyLine"),path:f||n("annotate.pathMissing")}),reminder:n("annotate.reminder")}]),F(!0),l(n("annotate.added"))}catch(o){l(String(o),!0)}}}function Sn(){var e=p.getSelection();if(!e)return!1;var t=e.text.trim();if(!t)return!1;var a=Za(p.getValue(),e.start,e.end);return tr(t,{startTop:e.startRect.top,startLeft:e.startRect.left,endBottom:e.rect.bottom,endLeft:e.rect.left},null,a,"editor"),!0}function ir(){te&&Sn()}function kn(e){if(!A()||!e)return!1;be();var t=Se.querySelector(".cm-line")||Se.querySelector(".cm-content"),a=(t||Se).getBoundingClientRect();return ar("",{startTop:e.rect.top,startLeft:a.left,width:Math.max(240,a.width),focus:!0},null,{start:e.line,end:e.line},"editor",v?"continue":"annotate-line"),!0}Se.addEventListener("mouseup",ir),Se.addEventListener("keyup",function(e){e.shiftKey&&ir()});var P=!1,$e=0,oe=null,ea=!1,Fe=!1,ta="",aa=null;function xn(e){ta=e,aa=g,i.postMessage({type:"saveDraft",path:e,markdown:g,base:T})}function sr(){!f||!i||!i.postMessage||ta===f&&aa===g||xn(f)}function ra(){ta="",aa=null}function na(e){ra(),e&&i&&i.postMessage&&i.postMessage({type:"discardDraft",path:e})}function Te(e,t){P=e,je&&(clearTimeout(je),je=0),Fe=!P&&!!t,b(),!P&&t&&(je=setTimeout(function(){je=0,P||(Fe=!1,b())},3e3))}async function lr(e){if(oe)return cr(),l("\u8BF7\u5148\u5904\u7406 AI \u5199\u56DE\u4E0E\u672C\u5730\u7F16\u8F91\u7684\u51B2\u7A81\u3002",!0),!1;if(J&&J.createWritable)try{var t=await J.createWritable();return await t.write(e),await t.close(),yt=(await J.getFile()).lastModified,T=e,Te(g!==e,g===e),l(n(g===e?"status.saved":"status.savedWithNewChanges")),ra(),!0}catch(r){return l(n("status.saveFailed",{err:String(r)}),!0),!1}if(f){var a=++Oa;return l(n("status.saving")),zt[a]=e,i.postMessage({type:"saveMarkdown",path:f,markdown:e,requestId:a}),new Promise(function(r){Ie[a]=r})}return l(n("status.noSourceFile"),!0),!1}document.addEventListener("keydown",function(e){var t=e.metaKey||e.ctrlKey;if(t&&(e.key==="s"||e.key==="S")){e.preventDefault(),ca();return}t&&(e.key==="p"||e.key==="P")&&(e.preventDefault(),Ke(k==="edit"?"preview":"edit"))});function ur(){Le&&(clearInterval(Le),Le=0),J=null}var oa=null;function Ze(e,t,a,r,o,s){if(!r&&P&&T!==null&&e!==T)return oe={markdown:e,name:t,path:a,diskBaseline:o},l(n("status.externalUpdateSkipped"),!0),cr(),!1;var u=T!==null&&(!a||!f||a===f);return u||(te=!0),g=e,ze=t,a&&(f=a),W=fn(a||f)||t||"Markdown",T=typeof o=="string"?o:g,oa=u?p.applyExternalValue(g):null,oa||p.setValue(g),Te(!1),za(W),s||ye(),Xe(),Ae(),(v||k==="preview")&&G(),!0}async function cr(){if(!(ea||!oe||!P)){var e=oe,t=T;if(g===t){oe=null,Ze(e.markdown,e.name,e.path,!0,e.diskBaseline);return}if(e.markdown===t){oe=null;return}ea=!0;var a=await jn();if(ea=!1,oe===e){if(a==="later"){l("AI \u5199\u56DE\u5DF2\u4FDD\u7559\u5728\u78C1\u76D8\uFF1B\u53EF\u7EE7\u7EED\u7F16\u8F91\u540E\u518D\u5904\u7406\u3002");return}if(oe=null,a==="remote"){na(f),Ze(e.markdown,e.name,e.path,!0,e.diskBaseline);return}a==="local"&&(T=typeof e.diskBaseline=="string"?e.diskBaseline:e.markdown,sr(),l("\u5DF2\u4FDD\u7559\u672C\u5730\u7F16\u8F91\uFF1BAI \u5199\u56DE\u7248\u672C\u4ECD\u5728\u78C1\u76D8\u4E0A\u3002"))}}}async function dr(e){ze=e.name,yt=e.lastModified,typeof e.path=="string"&&e.path?(f=e.path,i&&i.postMessage({type:"watchPath",path:f})):f="",Ze(await e.text(),ze,f,!0)}function En(){J&&(Le&&clearInterval(Le),Le=setInterval(async function(){if(!(Ut||!J)){Ut=!0;try{var e=await J.getFile();if(e.lastModified!==yt){yt=e.lastModified;var t=await e.text();t!==T&&Ze(t,ze,f)&&l(n("status.externalUpdateApplied"))}}catch{}Ut=!1}},800))}var Y=!1,Qe=0;function et(){Qe&&(clearTimeout(Qe),Qe=0)}function Mn(){et(),Qe=setTimeout(function(){Qe=0,Y&&(Y=!1,He=!1,b(),l(n("status.pickerTimeout"),!0))},2e4)}async function ia(){if(P){var e=await wr(n("confirm.message",{file:W||n("common.markdownDocDefault")}));if(e==="cancel")return;if(e==="save"){var t=await da();if(!t){l(n("status.saveFailedNoReturn"),!0);return}}else e==="discard"&&na(f)}if(ur(),He&&i&&i.postMessage){if(Y){et(),He=!1,Y=!1,b(),await pr();return}Y=!0,Mn(),b(),l(n("status.openingPicker")),i.postMessage({type:"requestOpen"});return}await pr()}async function pr(){if("showOpenFilePicker"in window)try{var e=await window.showOpenFilePicker({types:[{description:"Markdown",accept:{"text/markdown":[".md",".markdown"]}}],multiple:!1});J=e[0],await dr(await J.getFile()),En();return}catch(a){if(a&&a.name==="AbortError")return}var t=document.createElement("input");t.type="file",t.accept=".md,.markdown,text/markdown",t.onchange=function(){var a=t.files&&t.files[0];a&&dr(a).catch(function(r){l(String(r),!0)})},t.click()}function In(){window.focus(),document.body.tabIndex=-1;try{document.body.focus({preventScroll:!0})}catch{document.body.focus()}}async function Ln(e){for(var t=0;t<e;t++){if(In(),await new Promise(function(a){requestAnimationFrame(function(){requestAnimationFrame(a)})}),document.hasFocus())return!0;await new Promise(function(a){setTimeout(a,40)})}return document.hasFocus()}function fr(e){var t=Array.from(new Set(e.match(/finch-file:\/\/local\?path=[^\s)"']+/g)||[]));return!t.length||!i||!i.postMessage?Promise.resolve(e):new Promise(function(a,r){var o=++Pr;ve[o]={resolve:a,reject:r,sourceHtml:e},setTimeout(function(){ve[o]&&(delete ve[o],r(new Error(n("status.clipboardPrepareTimeout"))))},15e3),i.postMessage({type:"readClipboardImages",urls:t,requestId:o})})}function An(e){var t=new DOMParser().parseFromString(e,"text/html");function a(r){return r&&r.tagName==="P"&&!r.textContent.trim()&&!r.querySelector("img,video,iframe,table")}return Array.from(t.querySelectorAll("figure.figure-image")).forEach(function(r){var o=r.previousElementSibling,s=r.nextElementSibling;a(o)&&o.remove(),a(s)&&s.remove()}),t.body.innerHTML}async function mr(e,t){if(document.hasFocus()||await Ln(5),window.ClipboardItem&&navigator.clipboard&&navigator.clipboard.write)try{return await navigator.clipboard.write([new ClipboardItem({"text/html":Promise.resolve(e).then(function(r){return new Blob([r],{type:"text/html"})}),"text/plain":new Blob([t],{type:"text/plain"})})]),"rich"}catch{}var a=await Promise.resolve(e);return Cn(a)?"rich":Dn(t)?"plain":"none"}function Cn(e){var t=document.createElement("div");t.contentEditable="true",t.style.position="fixed",t.style.left="-9999px",t.style.top="0",t.innerHTML=e,document.body.appendChild(t);var a=document.createRange();a.selectNodeContents(t);var r=window.getSelection();r.removeAllRanges(),r.addRange(a);var o=!1;try{o=document.execCommand("copy")}catch{o=!1}return r.removeAllRanges(),t.remove(),o}function Dn(e){var t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-9999px",t.style.top="0",document.body.appendChild(t),t.focus(),t.select();var a=!1;try{a=document.execCommand("copy")}catch{a=!1}return t.remove(),a}async function Fn(){if(!z){l(n("status.pleaseOpenArticle"),!0);return}try{var e=w.contentDocument&&w.contentDocument.body?w.contentDocument.body.innerText:z.replace(/<[^>]+>/g,""),t=await mr(fr(z),e);t==="none"&&(await new Promise(function(a){setTimeout(a,200)}),t=await mr(fr(z),e)),t==="rich"?l(n("status.copiedRich")):l(n(t==="plain"?"status.copiedPlainOnly":"status.copyFailed"),!0)}catch(a){l(n("status.richCopyFailed",{err:String(a)}),!0)}finally{k==="edit"&&requestAnimationFrame(function(){p.focus()})}}function Tn(){if(!Ue||!w.contentDocument)return null;var e=w.contentDocument.querySelector("#bm-md");if(!e)return null;var t=e.getBoundingClientRect();return{root:e,width:Math.ceil(t.width||e.scrollWidth),height:Math.ceil(t.height||e.scrollHeight)}}function sa(){var e=Tn();if(!e||!e.width||!e.height)return Promise.resolve(null);var t=2,a=e.root.cloneNode(!0);a.style.minHeight=e.height+"px",a.style.margin="0",a.style.boxSizing="border-box";var r;try{r=new XMLSerializer().serializeToString(a)}catch(u){return Promise.reject(new Error(n("status.serializeFailed",{err:String(u)})))}var o='<svg xmlns="http://www.w3.org/2000/svg" width="'+e.width+'" height="'+e.height+'"><foreignObject x="0" y="0" width="'+e.width+'" height="'+e.height+'">'+r+"</foreignObject></svg>",s="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(o);return new Promise(function(u,c){var d=new Image;d.decoding="sync",d.onload=function(){try{var m=document.createElement("canvas");m.width=Math.round(e.width*t),m.height=Math.round(e.height*t);var x=m.getContext("2d");x.scale(t,t);var S="";try{S=w.contentWindow.getComputedStyle(e.root).backgroundColor}catch{S=""}S&&S!=="rgba(0, 0, 0, 0)"&&S!=="transparent"&&(x.fillStyle=S,x.fillRect(0,0,e.width,e.height)),x.drawImage(d,0,0,e.width,e.height),u({canvas:m,cssWidth:e.width,cssHeight:e.height})}catch(Q){c(Q)}},d.onerror=function(){c(new Error(n("status.imageConversionFailed")))},d.src=s})}function la(e,t,a){return new Promise(function(r,o){e.toBlob(function(s){s?r(s):o(new Error(n("status.imageGenFailed")))},t,a)})}function vr(e){for(var t="",a=32768,r=0;r<e.length;r+=a)t+=String.fromCharCode.apply(null,e.subarray(r,r+a));return btoa(t)}async function Pn(){if(!z){l(n("status.pleaseOpenArticle"),!0);return}if(!window.ClipboardItem||!navigator.clipboard||!navigator.clipboard.write){l(n("status.clipboardUnsupported"),!0);return}l(n("status.generatingImage"));var e=sa().then(function(a){if(!a)throw new Error(n("status.previewNotReady"));return la(a.canvas,"image/png")});try{await navigator.clipboard.write([new ClipboardItem({"image/png":e})]),l(n("status.imageCopied"));return}catch{try{var t=await e;await navigator.clipboard.write([new ClipboardItem({"image/png":t})]),l(n("status.imageCopied"));return}catch(r){l(n("status.copyImageFailed",{err:r&&r.message?r.message:String(r)}),!0)}}}async function On(){if(!z){l(n("status.pleaseOpenArticle"),!0);return}try{l(n("status.generatingImage"));var e=await sa();if(!e){l(n("status.exportImageFailedGeneric"),!0);return}var t=await la(e.canvas,"image/png"),a=await t.arrayBuffer(),r=vr(new Uint8Array(a));i&&i.postMessage&&i.postMessage({type:"exportFile",data:r,ext:"png",path:f,fileName:W,markdown:g})}catch(o){l(n("status.exportImageFailed",{err:String(o)}),!0)}}function Rn(e){for(var t=String(e);t.length<10;)t="0"+t;return t}function Z(e){for(var t=new Uint8Array(e.length),a=0;a<e.length;a++)t[a]=e.charCodeAt(a)&255;return t}function ua(e){for(var t=0,a=0;a<e.length;a++)t+=e[a].length;for(var r=new Uint8Array(t),o=0,a=0;a<e.length;a++)r.set(e[a],o),o+=e[a].length;return r}function Bn(e,t,a,r,o){var s=Z(`%PDF-1.4
16
16
  %\xE2\xE3\xCF\xD3
17
- `),u=[i],c=[0],d=i.length;function f(bt){c.push(d),u.push(bt),d+=bt.length}f(Q(`1 0 obj
17
+ `),u=[s],c=[0],d=s.length;function m(At){c.push(d),u.push(At),d+=At.length}m(Z(`1 0 obj
18
18
  << /Type /Catalog /Pages 2 0 R >>
19
19
  endobj
20
- `)),f(Q(`2 0 obj
20
+ `)),m(Z(`2 0 obj
21
21
  << /Type /Pages /Kids [3 0 R] /Count 1 >>
22
22
  endobj
23
- `)),f(Q(`3 0 obj
23
+ `)),m(Z(`3 0 obj
24
24
  << /Type /Page /Parent 2 0 R /MediaBox [0 0 `+r.toFixed(2)+" "+o.toFixed(2)+`] /Resources << /XObject << /Im0 4 0 R >> >> /Contents 5 0 R >>
25
25
  endobj
26
- `));var E=Q(`4 0 obj
26
+ `));var x=Z(`4 0 obj
27
27
  << /Type /XObject /Subtype /Image /Width `+t+" /Height "+a+" /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length "+e.length+` >>
28
28
  stream
29
- `),k=Q(`
29
+ `),S=Z(`
30
30
  endstream
31
31
  endobj
32
- `);f(Qt([E,e,k]));var Y="q "+r.toFixed(2)+" 0 0 "+o.toFixed(2)+" 0 0 cm /Im0 Do Q",P=Q(Y);f(Qt([Q(`5 0 obj
33
- << /Length `+P.length+` >>
32
+ `);m(ua([x,e,S]));var Q="q "+r.toFixed(2)+" 0 0 "+o.toFixed(2)+" 0 0 cm /Im0 Do Q",U=Z(Q);m(ua([Z(`5 0 obj
33
+ << /Length `+U.length+` >>
34
34
  stream
35
- `),P,Q(`
35
+ `),U,Z(`
36
36
  endstream
37
37
  endobj
38
- `)]));for(var pe=d,Ee=[`xref
38
+ `)]));for(var ee=d,ie=[`xref
39
39
  0 6
40
40
  0000000000 65535 f
41
- `],xe=1;xe<=5;xe++)Ee.push(En(c[xe])+` 00000 n
42
- `);var oa=`trailer
41
+ `],ae=1;ae<=5;ae++)ie.push(Rn(c[ae])+` 00000 n
42
+ `);var Lt=`trailer
43
43
  << /Size 6 /Root 1 0 R >>
44
44
  startxref
45
- `+pe+`
46
- %%EOF`;return u.push(Q(Ee.join("")+oa)),Qt(u)}async function Mn(){if(!W){l(n("status.pleaseOpenArticle"),!0);return}try{l(n("status.generatingPdf"));var e=await Jt();if(!e){l(n("status.exportPdfFailedGeneric"),!0);return}var t=await $t(e.canvas,"image/jpeg",.92),a=await t.arrayBuffer(),r=new Uint8Array(a),o=e.cssWidth*.75,i=e.cssHeight*.75,u=xn(r,e.canvas.width,e.canvas.height,o,i),c=rr(u);s&&s.postMessage&&s.postMessage({type:"exportFile",data:c,ext:"pdf",path:m,fileName:j,markdown:v})}catch(d){l(n("status.exportPdfFailed",{err:String(d)}),!0)}}function Xe(e,t){e&&e.addEventListener("click",function(a){a.preventDefault(),!e.disabled&&(e.disabled=!0,Promise.resolve().then(t).catch(function(r){l(String(r),!0)}).then(function(){e.disabled=!1}))})}Xe(vr,bn),Xe(gr,Sn),Xe(hr,kn),Xe(yr,Mn),Xe(me,Ln);var nr="md-editor-actions-collapsed";(function(){var t=!1;try{t=localStorage.getItem(nr)==="1"}catch{}Le&&Le.classList.toggle("collapsed",t)})(),pa&&pa.addEventListener("click",function(e){e.preventDefault();var t=Le.classList.toggle("collapsed");try{localStorage.setItem(nr,t?"1":"0")}catch{}});function Zt(){Ja(v)}function yt(e){if(wr=e,!!me){me.classList.toggle("loading",e),me.disabled=e;var t=me.querySelector(".ic-ai-style"),a=me.querySelector(".ic-ai-style-loading");t&&(t.hidden=e),a&&(a.hidden=!e)}}function or(){if(!v||!m||!s||!s.postMessage){l(n("status.pleaseOpenArticle"),!0);return}s.postMessage({type:"requestStyleSession",path:m,baseStyle:M}),yt(!0),l(n("aiStyle.appViewDesigning"))}async function Ln(){if(!v){l(n("status.pleaseOpenArticle"),!0);return}if(g||!s||!s.composer){or();return}var e=M==="custom"?n("aiStyle.baseNoteCustom"):n("aiStyle.baseNoteOther",{style:M});try{await s.composer.addContexts([{type:"annotation",label:n("aiStyle.label",{file:j||n("common.markdownDocDefault")}),note:n("aiStyle.note"),promptText:n("aiStyle.promptText",{baseNote:e,path:m||n("aiStyle.pathMissing")}),reminder:n("aiStyle.reminder")}]),l(n("aiStyle.requested"))}catch{or()}}function Dn(){return{fontSize:H,fontFamily:K,comfortWriting:O,style:M,customCss:M==="custom"?T:"",customStyleLabel:M==="custom"?ve:""}}function de(){s&&s.postMessage&&s.postMessage({type:"saveWritingPreferences",preferences:Dn()})}function An(e){return!e||typeof e!="object"?!1:((e.fontSize===14||e.fontSize===16||e.fontSize===18)&&(H=e.fontSize),ge[e.fontFamily]&&(K=e.fontFamily),O=e.comfortWriting===!0,e.style==="custom"&&typeof e.customCss=="string"&&e.customCss?(M="custom",T=e.customCss,ve=typeof e.customStyleLabel=="string"?e.customStyleLabel:""):["kami","bauhaus","blueprint","botanical","newsprint","retro","sketch","terminal"].indexOf(e.style)!==-1&&(M=e.style,T="",ve=""),p.setFontSize(H),p.setFontFamily(ge[K]),p.setComfortWriting(O),!0)}function Cn(e){M=e,de(),(g||S==="preview")&&V(),w()}function Fn(e){if(!(e!==14&&e!==16&&e!==18)){H=e,p.setFontSize(e);try{localStorage.setItem("md-editor-font-size",String(e))}catch{}de(),w()}}function In(e){if(ge[e]){K=e,p.setFontFamily(ge[e]);try{localStorage.setItem("md-editor-font-family",e)}catch{}de(),w()}}function ir(e){O=!!e,p.setComfortWriting(O);try{localStorage.setItem("md-editor-comfort-writing",O?"1":"0")}catch{}de(),w(),l(n(O?"status.comfortWrite":"status.comfortRead"))}function sr(){R=!R,R&&Z?(Z=!1,A()):!R&&!Z&&(Z=!0),p.setFocusMode(R);try{localStorage.setItem("md-editor-focus-mode",R?"1":"0")}catch{}w(),l(n(R?"status.focusOn":"status.focusOff"))}var Ke=null;function Je(e){oe.hidden=!0;var t=Ke;Ke=null,t&&t(e)}function lr(e){return new Promise(function(t){Ke=t,fa.textContent=e,oe.hidden=!1,De.focus()})}async function Pn(){fa.textContent="AI \u5DF2\u5199\u56DE\u6587\u4EF6\uFF0C\u4F46\u4F60\u4E5F\u6709\u672A\u4FDD\u5B58\u7F16\u8F91\u3002\u8BF7\u9009\u62E9\u4FDD\u7559\u672C\u5730\u5185\u5BB9\u6216\u91C7\u7528 AI \u7248\u672C\u3002",Lt.textContent="\u7A0D\u540E\u5904\u7406",Dt.textContent="\u4FDD\u7559\u672C\u5730",De.textContent="\u91C7\u7528 AI \u7248\u672C";var e=await new Promise(function(t){Ke=t,oe.hidden=!1,De.focus()});return St(oe),e==="save"?"remote":e==="discard"?"local":"later"}Lt&&Lt.addEventListener("click",function(){Je("cancel")}),Dt&&Dt.addEventListener("click",function(){Je("discard")}),De&&De.addEventListener("click",function(){Je("save")}),oe&&oe.addEventListener("click",function(e){e.target===oe&&Je("cancel")}),document.addEventListener("keydown",function(e){e.key==="Escape"&&Ke&&Je("cancel")});async function ea(){return await Ja(v)}function Tn(){$a(),Gt(),A(),v="",Oe="",j="",m="",B=null,W="",Z=!1,S="edit",p&&p.setValue(""),Pa(n("home.title")),Ha(""),s&&s.postMessage&&s.postMessage({type:"goHome"}),ze(),be(),ke(!1),l("")}async function ur(){if(I){var e=await lr(n("confirm.message",{file:j||n("common.markdownDocDefault")}));if(e==="cancel")return;if(s&&s.postMessage&&s.postMessage({type:"goHome"}),e==="save"){var t=await ea();if(!t){l(n("status.saveFailedNoReturn"),!0);return}}else e==="discard"&&Yt(m)}Tn()}function cr(e){if(s&&s.postMessage&&s.postMessage({type:"clientLog",message:"finch:menu received, itemId="+e}),e==="home"){ur();return}if(e==="open"){Kt();return}if(e==="mode"){Ue(S==="edit"?"preview":"edit");return}if(e==="save"){Zt();return}if(e==="reload"){V();return}if(e==="reveal"){m&&s&&s.postMessage&&s.postMessage({type:"openPath",path:m});return}if(e&&e.indexOf("font-size:")===0){Fn(Number(e.slice(10)));return}if(e&&e.indexOf("font-family:")===0){In(e.slice(12));return}if(e==="comfort:read"){ir(!1);return}if(e==="comfort:write"){ir(!0);return}if(e==="focus"){sr();return}if(e==="about"){Er();return}if(e&&e.indexOf("style:slot-use:")===0){Rn(+e.slice(15));return}if(e&&e.indexOf("style:slot-save:")===0){pr(+e.slice(16));return}if(e&&e.indexOf("style:")===0){Cn(e.slice(6));return}}function ta(){[rt,nt,ot].forEach(function(e){e&&(e.hidden=!0)})}function On(e){if(e){var t=e.hidden;ta(),e.hidden=!t}}function aa(e,t){e&&e.addEventListener("click",function(a){a.stopPropagation(),On(t)}),t&&t.addEventListener("click",function(a){var r=a.target&&a.target.closest?a.target.closest("[data-app-action]"):null,o=r&&r.getAttribute("data-app-action");o&&(cr(o),ta())})}va&&va.addEventListener("click",ur),tt&&tt.addEventListener("click",Kt),ee&&ee.addEventListener("click",Zt),Ce&&Ce.addEventListener("click",sr),Ae&&Ae.addEventListener("click",function(){_=!_,document.body.classList.toggle("preview-hidden",!_),w(),_&&requestAnimationFrame(function(){p.layout(),V()})}),aa(at,rt),aa(At,nt),aa(br,ot),document.addEventListener("click",ta);var ra=370,na=560,dr=480;ne&&ne.addEventListener("mousedown",function(e){e.preventDefault();var t=ne.parentElement;if(!t)return;var a=e.clientX,r=Mt?Mt.getBoundingClientRect().width:dr;ne.classList.add("active");var o=document.createElement("div");o.style.cssText="position:fixed;inset:0;z-index:9999;cursor:col-resize;",document.body.appendChild(o);function i(d){return Math.max(ra,Math.min(na,d))}function u(d){var f=d.clientX-a;t.style.setProperty("--preview-width",i(r-f)+"px")}function c(){ne.classList.remove("active"),o.remove(),window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",c)}window.addEventListener("mousemove",u),window.addEventListener("mouseup",c)}),window.addEventListener("resize",function(){if(g){var e=ne&&ne.parentElement;if(e){var t=parseFloat(getComputedStyle(e).getPropertyValue("--preview-width"))||dr;(t>na||t<ra)&&e.style.setProperty("--preview-width",Math.max(ra,Math.min(na,t))+"px")}}});function Rn(e){var t=q[e];t&&(T=t.css,ve=t.label,M="custom",de(),l(n("status.appliedStyleSlot",{label:t.label})),S==="preview"?V():Ue("preview"),w())}function pr(e){if(M!=="custom"||!T){l(n("status.needCustomStyleFirst"),!0);return}var t=ve||n("common.customStyleDefault");s&&s.postMessage&&s.postMessage({type:"saveStyleSlot",slot:e,css:T,label:t,path:m})}function Bn(){D&&(clearTimeout(D),D=0),C.replaceChildren(document.createTextNode(n("aiStyle.applied")+" ")),C.className="status status-style-prompt";for(var e=0;e<3;e++)(function(t){var a=document.createElement("button");a.type="button",a.className="status-inline-btn",a.textContent=n("aiStyle.saveToSlot",{n:t+1});var r=q[t];r&&(a.title=r.label),a.addEventListener("click",function(){pr(t)}),C.appendChild(a)})(e);D=setTimeout(function(){D=0,C.replaceChildren(),C.className="status"},12e3)}s&&s.onMessage&&s.onMessage(function(e){if(!(!e||typeof e!="object")){if(e.type==="ready"){if(Pe=!!e.pickFileSupported,q=Array.isArray(e.styleSlots)?e.styleSlots:[null,null,null],An(e.writingPreferences)?g&&N()&&V():de(),typeof e.locale=="string"&&e.locale){var t=/^zh/i.test(e.locale);t!==Qe&&(Qe=t,St(),ft())}e.assistantName&&(He=e.assistantName,ft()),Ma(),e.homeDir&&(ue=e.homeDir,Lr()),w();return}if(e.type==="styleSlots"){q=Array.isArray(e.styleSlots)?e.styleSlots:[null,null,null],typeof e.savedSlot=="number"&&q[e.savedSlot]&&l(n("status.savedToSlot",{slot:e.savedSlot+1,label:q[e.savedSlot].label})),w();return}if(e.type==="clipboardImages"){var a=le[e.requestId];if(a){delete le[e.requestId];var r=a.sourceHtml,o=e.images&&typeof e.images=="object"?e.images:{};Object.keys(o).forEach(function(Me){typeof o[Me]=="string"&&(r=r.split(Me).join(o[Me]))}),a.resolve(gn(r))}return}if(e.type==="clipboardImagesError"){var i=le[e.requestId];i&&(delete le[e.requestId],i.reject(new Error(e.message||n("status.clipboardPrepareFailedDefault"))));return}if(e.type==="pastedImage"){var u=se[e.requestId];u&&(delete se[e.requestId],u.resolve(e.url));return}if(e.type==="pasteImageError"){var c=se[e.requestId];c&&(delete se[e.requestId],c.reject(new Error(e.message||n("status.pasteImageFailedDefault")))),l(n("status.pasteImageFailed",{msg:e.message||""}));return}if(e.type==="finch:env"){g=e.view==="appView",g&&!Sa&&(Sa=!0,_=!1,document.body.classList.add("preview-hidden")),document.body.classList.toggle("app-view",g),ma&&(ma.hidden=!g),p.setAiHint(n("appview.hintSpace"),n("appview.hintSpaceCode"));var d=e.cwd||"",f=e.sessionId||"",E=e.spaceId||"";(d!==qe||f!==Rt||E!==Bt||!pt)&&(qe=d,Rt=f,Bt=E,pt=!0,vt([])),be(),w(),g&&N()&&V(),(!kt.hidden||g)&&mt();return}if(e.type==="recentDocuments"){if(!e.library&&(e.cwd||"")!==qe)return;vt(e.documents),e.library&&Ca(e.documents);return}if(e.type==="status"){l(e.message);return}if(e.type==="rewriteSessionStarted"){p.setAiWorkingLines(Number(e.startLine)||0,Number(e.endLine)||0),l(e.rewriteMode==="continue"?n("appview.continuing"):n("appview.rewriting"));return}if(e.type==="rewriteSessionFinished"){p.setAiWorkingLines(0,0),l(n("appview.rewriteDone"));return}if(e.type==="rewriteSessionFailed"){p.setAiWorkingLines(0,0),l(e.message||"Rewrite failed.",!0);return}if(e.type==="styleSessionStarted"){yt(!0),l(n("aiStyle.appViewDesigning"));return}if(e.type==="styleSessionFinished"){yt(!1),l(e.message||n("aiStyle.appViewDone"));return}if(e.type==="styleSessionFailed"){yt(!1),l(e.message||n("aiStyle.appViewFailed"),!0);return}if(e.type!=="lastFileUnavailable"){if(e.type==="finch:menu"){cr(e.itemId);return}if(e.type==="document"){var k=G;G=!1,Ye();var Y=e.markdown||"",P=e.path||"",pe=Number(e.revision)||0;if(P&&P===m&&pe&&pe<=je)return;var Ee=!!P&&!!m&&P!==m;if(!Ee&&Y===B){pe&&(je=Math.max(je,pe)),w();return}var xe=B===null,oa=We;We=!1;var bt=Ve(Y,e.title||n("common.markdownDocDefault"),e.path||m,k||xe||Ee,e.diskMarkdown);if(!bt){w();return}if(je=pe||(Ee?0:je),e.draftRestored)ke(!0),l(n("status.draftRestored"));else if(e.draftConflict)l(n("status.draftConflict"),!0);else if(oa)l(n("status.opened",{file:j}));else if(!xe){var X=Xt;X&&X.hunks>1?l(n("status.contentUpdatedSpots",{count:X.hunks,lines:X.changedLines})):X&&X.fromLine===X.toLine?l(n("status.contentUpdatedLine",{line:X.fromLine})):l(X?n("status.contentUpdatedLines",{from:X.fromLine,to:X.toLine}):n("status.contentUpdated"))}return}if(e.type==="sourceMissing"){e.path&&e.path===m&&l(n("status.sourceMissing"),!0);return}if(e.type==="bmRendered"){if(e.requestId!==ka)return;Ha(e.html||""),ze(),Be=!1,w(),l("");return}if(e.type==="savedMarkdown"){var $e=Tt[e.requestId];delete Tt[e.requestId];var wt=he[e.requestId];if(delete he[e.requestId],e.requestId!==Ea||typeof $e!="string"){wt&&wt(!1);return}B=$e,ke(v!==$e,v===$e),l(n(v===$e?"status.saved":"status.savedWithNewChanges")),wt&&wt(!0);return}if(e.type==="customStyleSet"){T=e.css||"",ve=e.label||n("common.customStyleDefault"),M="custom",de(),typeof e.savedSlot=="number"?(q=Array.isArray(e.styleSlots)?e.styleSlots:q,l(n("status.savedAppliedToSlot",{labelPrefix:e.label?e.label+" \xB7 ":"",slot:e.savedSlot+1}))):Bn(),S==="preview"?V():Ue("preview"),w();return}if(e.type==="exported"){l(n("status.exported",{path:e.path}));return}if(e.type!=="watchStarted"){if(e.type==="pickCancelled"){G=!1,Ye(),w(),l("");return}if(e.type==="error"){We=!1,Object.keys(he).forEach(function(Me){var fr=he[Me];delete he[Me],fr&&fr(!1)}),G=!1,Ye(),e.fallback&&(Pe=!1),Be=!1,w(),l(e.message,!0);return}}}}}),s&&s.postMessage&&s.postMessage({type:"panelReady"}),setTimeout(function(){!N()&&s&&s.postMessage&&s.postMessage({type:"requestLastFile"}),xa||mt()},400),St(),Ma(),ft(),ze(),be()})();})();
45
+ `+ee+`
46
+ %%EOF`;return u.push(Z(ie.join("")+Lt)),ua(u)}async function Nn(){if(!z){l(n("status.pleaseOpenArticle"),!0);return}try{l(n("status.generatingPdf"));var e=await sa();if(!e){l(n("status.exportPdfFailedGeneric"),!0);return}var t=await la(e.canvas,"image/jpeg",.92),a=await t.arrayBuffer(),r=new Uint8Array(a),o=e.cssWidth*.75,s=e.cssHeight*.75,u=Bn(r,e.canvas.width,e.canvas.height,o,s),c=vr(u);i&&i.postMessage&&i.postMessage({type:"exportFile",data:c,ext:"pdf",path:f,fileName:W,markdown:g})}catch(d){l(n("status.exportPdfFailed",{err:String(d)}),!0)}}function tt(e,t){e&&e.addEventListener("click",function(a){a.preventDefault(),!e.disabled&&(e.disabled=!0,Promise.resolve().then(t).catch(function(r){l(String(r),!0)}).then(function(){e.disabled=!1}))})}tt(Ir,Fn),tt(Lr,Pn),tt(Ar,On),tt(Cr,Nn),tt(ke,qn);var gr="md-editor-actions-collapsed";(function(){var t=!1;try{t=localStorage.getItem(gr)==="1"}catch{}Pe&&Pe.classList.toggle("collapsed",t)})(),ka&&ka.addEventListener("click",function(e){e.preventDefault();var t=Pe.classList.toggle("collapsed");try{localStorage.setItem(gr,t?"1":"0")}catch{}});function ca(){lr(g)}function It(e){if(Fr=e,!!ke){ke.classList.toggle("loading",e),ke.disabled=e;var t=ke.querySelector(".ic-ai-style"),a=ke.querySelector(".ic-ai-style-loading");t&&(t.hidden=e),a&&(a.hidden=!e)}}function hr(){if(!g||!f||!i||!i.postMessage){l(n("status.pleaseOpenArticle"),!0);return}i.postMessage({type:"requestStyleSession",path:f,baseStyle:L}),It(!0),l(n("aiStyle.appViewDesigning"))}async function qn(){if(!g){l(n("status.pleaseOpenArticle"),!0);return}if(v||!i||!i.composer){hr();return}var e=L==="custom"?n("aiStyle.baseNoteCustom"):n("aiStyle.baseNoteOther",{style:L});try{await i.composer.addContexts([{type:"annotation",label:n("aiStyle.label",{file:W||n("common.markdownDocDefault")}),note:n("aiStyle.note"),promptText:n("aiStyle.promptText",{baseNote:e,path:f||n("aiStyle.pathMissing")}),reminder:n("aiStyle.reminder")}]),l(n("aiStyle.requested"))}catch{hr()}}function Hn(){return{fontSize:H,fontFamily:K,comfortWriting:R,style:L,customCss:L==="custom"?O:"",customStyleLabel:L==="custom"?Ee:""}}function we(){i&&i.postMessage&&i.postMessage({type:"saveWritingPreferences",preferences:Hn()})}function Wn(e){return!e||typeof e!="object"?!1:((e.fontSize===14||e.fontSize===16||e.fontSize===18)&&(H=e.fontSize),Me[e.fontFamily]&&(K=e.fontFamily),R=e.comfortWriting===!0,e.style==="custom"&&typeof e.customCss=="string"&&e.customCss?(L="custom",O=e.customCss,Ee=typeof e.customStyleLabel=="string"?e.customStyleLabel:""):["kami","bauhaus","blueprint","botanical","newsprint","retro","sketch","terminal"].indexOf(e.style)!==-1&&(L=e.style,O="",Ee=""),p.setFontSize(H),p.setFontFamily(Me[K]),p.setComfortWriting(R),!0)}function zn(e){L=e,we(),(v||k==="preview")&&G(),b()}function Un(e){if(!(e!==14&&e!==16&&e!==18)){H=e,p.setFontSize(e);try{localStorage.setItem("md-editor-font-size",String(e))}catch{}we(),b()}}function _n(e){if(Me[e]){K=e,p.setFontFamily(Me[e]);try{localStorage.setItem("md-editor-font-family",e)}catch{}we(),b()}}function yr(e){R=!!e,p.setComfortWriting(R);try{localStorage.setItem("md-editor-comfort-writing",R?"1":"0")}catch{}we(),b(),l(n(R?"status.comfortWrite":"status.comfortRead"))}function br(){B=!B,B&&te?(te=!1,F()):!B&&!te&&(te=!0),p.setFocusMode(B);try{localStorage.setItem("md-editor-focus-mode",B?"1":"0")}catch{}b(),l(n(B?"status.focusOn":"status.focusOff"))}var at=null;function rt(e){ce.hidden=!0;var t=at;at=null,t&&t(e)}function wr(e){return new Promise(function(t){at=t,xa.textContent=e,ce.hidden=!1,Oe.focus()})}async function jn(){xa.textContent="AI \u5DF2\u5199\u56DE\u6587\u4EF6\uFF0C\u4F46\u4F60\u4E5F\u6709\u672A\u4FDD\u5B58\u7F16\u8F91\u3002\u8BF7\u9009\u62E9\u4FDD\u7559\u672C\u5730\u5185\u5BB9\u6216\u91C7\u7528 AI \u7248\u672C\u3002",Rt.textContent="\u7A0D\u540E\u5904\u7406",Bt.textContent="\u4FDD\u7559\u672C\u5730",Oe.textContent="\u91C7\u7528 AI \u7248\u672C";var e=await new Promise(function(t){at=t,ce.hidden=!1,Oe.focus()});return Dt(ce),e==="save"?"remote":e==="discard"?"local":"later"}Rt&&Rt.addEventListener("click",function(){rt("cancel")}),Bt&&Bt.addEventListener("click",function(){rt("discard")}),Oe&&Oe.addEventListener("click",function(){rt("save")}),ce&&ce.addEventListener("click",function(e){e.target===ce&&rt("cancel")}),document.addEventListener("keydown",function(e){e.key==="Escape"&&at&&rt("cancel")});async function da(){return await lr(g)}function Vn(){ur(),ra(),F(),g="",ze="",W="",f="",T=null,fe=null,z="",te=!1,k="edit",p&&p.setValue(""),za(n("home.title")),ye(),$a(""),i&&i.postMessage&&i.postMessage({type:"goHome"}),Xe(),Ae(),Te(!1),l("")}async function nt(){if(P){var e=await wr(n("confirm.message",{file:W||n("common.markdownDocDefault")}));if(e==="cancel")return;if(i&&i.postMessage&&i.postMessage({type:"goHome"}),e==="save"){var t=await da();if(!t){l(n("status.saveFailedNoReturn"),!0);return}}else e==="discard"&&na(f)}Vn()}function Sr(e){if(i&&i.postMessage&&i.postMessage({type:"clientLog",message:"finch:menu received, itemId="+e}),e==="home"){nt();return}if(e==="open"){ia();return}if(e==="mode"){Ke(k==="edit"?"preview":"edit");return}if(e==="save"){ca();return}if(e==="reload"){G();return}if(e==="reveal"){f&&i&&i.postMessage&&i.postMessage({type:"openPath",path:f});return}if(e==="recentSession"){fe&&i&&i.navigation&&i.navigation.openSession&&i.navigation.openSession(fe);return}if(e&&e.indexOf("font-size:")===0){Un(Number(e.slice(10)));return}if(e&&e.indexOf("font-family:")===0){_n(e.slice(12));return}if(e==="comfort:read"){yr(!1);return}if(e==="comfort:write"){yr(!0);return}if(e==="focus"){br();return}if(e==="about"){Or();return}if(e&&e.indexOf("style:slot-use:")===0){Yn(+e.slice(15));return}if(e&&e.indexOf("style:slot-save:")===0){xr(+e.slice(16));return}if(e&&e.indexOf("style:")===0){zn(e.slice(6));return}}function pa(){[dt,pt,ft].forEach(function(e){e&&(e.hidden=!0)})}function Gn(e){if(e){var t=e.hidden;pa(),e.hidden=!t}}function fa(e,t){e&&e.addEventListener("click",function(a){a.stopPropagation(),Gn(t)}),t&&t.addEventListener("click",function(a){var r=a.target&&a.target.closest?a.target.closest("[data-app-action]"):null;if(!(r&&r.disabled)){var o=r&&r.getAttribute("data-app-action");o&&(Sr(o),pa())}})}Ma&&Ma.addEventListener("click",nt),ut&&ut.addEventListener("click",ia),re&&re.addEventListener("click",ca),Be&&Be.addEventListener("click",br),Re&&Re.addEventListener("click",function(){V=!V,document.body.classList.toggle("preview-hidden",!V),b(),V&&requestAnimationFrame(function(){p.layout(),G()})}),fa(ct,dt),fa(Nt,pt),fa(Dr,ft),document.addEventListener("click",pa);var ma=370,va=560,kr=480;ue&&ue.addEventListener("mousedown",function(e){e.preventDefault();var t=ue.parentElement;if(!t)return;var a=e.clientX,r=Ot?Ot.getBoundingClientRect().width:kr;ue.classList.add("active");var o=document.createElement("div");o.style.cssText="position:fixed;inset:0;z-index:9999;cursor:col-resize;",document.body.appendChild(o);function s(d){return Math.max(ma,Math.min(va,d))}function u(d){var m=d.clientX-a;t.style.setProperty("--preview-width",s(r-m)+"px")}function c(){ue.classList.remove("active"),o.remove(),window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",c)}window.addEventListener("mousemove",u),window.addEventListener("mouseup",c)}),window.addEventListener("resize",function(){if(v){var e=ue&&ue.parentElement;if(e){var t=parseFloat(getComputedStyle(e).getPropertyValue("--preview-width"))||kr;(t>va||t<ma)&&e.style.setProperty("--preview-width",Math.max(ma,Math.min(va,t))+"px")}}});function Yn(e){var t=q[e];t&&(O=t.css,Ee=t.label,L="custom",we(),l(n("status.appliedStyleSlot",{label:t.label})),k==="preview"?G():Ke("preview"),b())}function xr(e){if(L!=="custom"||!O){l(n("status.needCustomStyleFirst"),!0);return}var t=Ee||n("common.customStyleDefault");i&&i.postMessage&&i.postMessage({type:"saveStyleSlot",slot:e,css:O,label:t,path:f})}function Xn(){E&&(clearTimeout(E),E=0),M.replaceChildren(document.createTextNode(n("aiStyle.applied")+" ")),M.className="status status-style-prompt";for(var e=0;e<3;e++)(function(t){var a=document.createElement("button");a.type="button",a.className="status-inline-btn",a.textContent=n("aiStyle.saveToSlot",{n:t+1});var r=q[t];r&&(a.title=r.label),a.addEventListener("click",function(){xr(t)}),M.appendChild(a)})(e);E=setTimeout(function(){E=0,M.replaceChildren(),M.className="status"},12e3)}i&&i.onMessage&&i.onMessage(function(e){if(!(!e||typeof e!="object")){if(e.type==="ready"){if(He=!!e.pickFileSupported,q=Array.isArray(e.styleSlots)?e.styleSlots:[null,null,null],Wn(e.writingPreferences)?v&&A()&&G():we(),e.libraryGroups&&typeof e.libraryGroups=="object"?(de=Array.isArray(e.libraryGroups.order)?e.libraryGroups.order.filter(function(se){return typeof se=="string"}):[],xe=e.libraryGroups.collapsed&&typeof e.libraryGroups.collapsed=="object"?e.libraryGroups.collapsed:{},qe.length&&Gt(qe)):(de.length||Object.keys(xe).length)&&Vt(),typeof e.locale=="string"&&e.locale){var t=/^zh/i.test(e.locale);t!==it&&(it=t,Dt(),wt())}e.assistantName&&(Ge=e.assistantName,wt()),Ba(),e.homeDir&&(he=e.homeDir,Nr()),b();return}if(e.type==="styleSlots"){q=Array.isArray(e.styleSlots)?e.styleSlots:[null,null,null],typeof e.savedSlot=="number"&&q[e.savedSlot]&&l(n("status.savedToSlot",{slot:e.savedSlot+1,label:q[e.savedSlot].label})),b();return}if(e.type==="clipboardImages"){var a=ve[e.requestId];if(a){delete ve[e.requestId];var r=a.sourceHtml,o=e.images&&typeof e.images=="object"?e.images:{};Object.keys(o).forEach(function(se){typeof o[se]=="string"&&(r=r.split(se).join(o[se]))}),a.resolve(An(r))}return}if(e.type==="clipboardImagesError"){var s=ve[e.requestId];s&&(delete ve[e.requestId],s.reject(new Error(e.message||n("status.clipboardPrepareFailedDefault"))));return}if(e.type==="pastedImage"){var u=me[e.requestId];u&&(delete me[e.requestId],u.resolve(e.url));return}if(e.type==="pasteImageError"){var c=me[e.requestId];c&&(delete me[e.requestId],c.reject(new Error(e.message||n("status.pasteImageFailedDefault")))),l(n("status.pasteImageFailed",{msg:e.message||""}));return}if(e.type==="finch:env"){v=e.view==="appView",v&&(i&&i.panel&&i.panel.setTitle&&i.panel.setTitle(n("home.title")).catch(function(){}),ye(),Gr()),v&&!Fa&&(Fa=!0,V=!1,document.body.classList.add("preview-hidden")),document.body.classList.toggle("app-view",v),Ea&&(Ea.hidden=!v),p.setAiHint(n("appview.hintSpace"),n("appview.hintSpaceCode"));var d=e.cwd||"",m=e.sessionId||"",x=e.spaceId||"";(d!==Ve||m!==_t||x!==jt||!bt)&&(Ve=d,_t=m,jt=x,bt=!0,kt([])),Ae(),ye(),b(),v&&A()&&G(),(!Ft.hidden||v)&&St();return}if(e.type==="recentDocuments"){if(!e.library&&(e.cwd||"")!==Ve)return;kt(e.documents),e.library&&Gt(e.documents);return}if(e.type==="status"){l(e.message);return}if(e.type==="rewriteSessionStarted"){N=e.sessionId&&e.turnId?{sessionId:e.sessionId,turnId:e.turnId}:null,p.setAiWorkingLines(Number(e.startLine)||0,Number(e.endLine)||0),ge(e.rewriteMode==="continue"?n("appview.continuing"):n("appview.rewriting"),!1,e.sessionId,0);return}if(e.type==="rewriteCancellationRequested"){N&&N.turnId===e.turnId&&(N.cancelling=!0),ge(n("appview.cancelling"),!1,e.sessionId,0);return}if(e.type==="rewriteSessionFinished"){N=null,p.setAiWorkingLines(0,0),ge(n("appview.rewriteDone"),!1,e.sessionId,5e3);return}if(e.type==="rewriteSessionFailed"){var S=N&&N.turnId===e.turnId&&N.cancelling;N=null,p.setAiWorkingLines(0,0),ge(S?n("appview.cancelled"):e.message||"Rewrite failed.",!S,e.sessionId,5e3);return}if(e.type==="styleSessionStarted"){It(!0),ge(n("aiStyle.appViewDesigning"),!1,e.sessionId,0);return}if(e.type==="styleSessionFinished"){It(!1),ge(e.message||n("aiStyle.appViewDone"),!1,e.sessionId,5e3);return}if(e.type==="styleSessionFailed"){It(!1),ge(e.message||n("aiStyle.appViewFailed"),!0,e.sessionId,5e3);return}if(e.type!=="lastFileUnavailable"){if(e.type==="lastSessionInfo"){fe=e.sessionId||null,b(),ja();return}if(e.type==="finch:menu"){Sr(e.itemId);return}if(e.type==="document"){var Q=Y;Y=!1,et();var U=e.markdown||"",ee=e.path||"",ie=Number(e.revision)||0;if(ee&&ee===f&&ie&&ie<=$e)return;var ae=!!ee&&!!f&&ee!==f;if((ae||T===null)&&(fe=null),ae&&Et&&ee!==Et){Ce===ee&&(Ce="");return}if(!ae&&U===T){ie&&($e=Math.max($e,ie)),b();return}var Lt=T===null,At=Ye;Ye=!1;var Kn=!!ee&&Ce===ee;Ce="";var Jn=Ze(U,e.title||n("common.markdownDocDefault"),e.path||f,Q||Lt||ae,e.diskMarkdown,Kn);if(!Jn){b();return}if($e=ie||(ae?0:$e),e.draftRestored)Te(!0),l(n("status.draftRestored"));else if(e.draftConflict)l(n("status.draftConflict"),!0);else if(At)l(n("status.opened",{file:W}));else if(!Lt){var X=oa;X&&X.hunks>1?l(n("status.contentUpdatedSpots",{count:X.hunks,lines:X.changedLines})):X&&X.fromLine===X.toLine?l(n("status.contentUpdatedLine",{line:X.fromLine})):l(X?n("status.contentUpdatedLines",{from:X.fromLine,to:X.toLine}):n("status.contentUpdated"))}return}if(e.type==="sourceMissing"){e.path&&e.path===f&&l(n("status.sourceMissing"),!0);return}if(e.type==="bmRendered"){if(e.requestId!==Pa)return;$a(e.html||""),Xe(),_e=!1,b(),l("");return}if(e.type==="savedMarkdown"){var ot=zt[e.requestId];delete zt[e.requestId];var Ct=Ie[e.requestId];if(delete Ie[e.requestId],e.requestId!==Oa||typeof ot!="string"){Ct&&Ct(!1);return}T=ot,Te(g!==ot,g===ot),l(n(g===ot?"status.saved":"status.savedWithNewChanges")),Ct&&Ct(!0);return}if(e.type==="customStyleSet"){O=e.css||"",Ee=e.label||n("common.customStyleDefault"),L="custom",we(),typeof e.savedSlot=="number"?(q=Array.isArray(e.styleSlots)?e.styleSlots:q,l(n("status.savedAppliedToSlot",{labelPrefix:e.label?e.label+" \xB7 ":"",slot:e.savedSlot+1}))):Xn(),k==="preview"?G():Ke("preview"),b();return}if(e.type==="exported"){l(n("status.exported",{path:e.path}));return}if(e.type!=="watchStarted"){if(e.type==="pickCancelled"){Y=!1,et(),b(),l("");return}if(e.type==="error"){Ye=!1,Et="",Ce="",Object.keys(Ie).forEach(function(se){var Er=Ie[se];delete Ie[se],Er&&Er(!1)}),Y=!1,et(),e.fallback&&(He=!1),_e=!1,b(),l(e.message,!0);return}}}}}),i&&i.postMessage&&i.postMessage({type:"panelReady"}),setTimeout(function(){!A()&&i&&i.postMessage&&i.postMessage({type:"requestLastFile"}),Ra||St()},400),Dt(),Ba(),wt(),Xe(),Ae()})();})();