finch-markdown-editor 0.2.14 → 0.2.15
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/index.js +3 -0
- package/dist/panel.css +21 -3
- package/dist/panel.html +1 -0
- package/dist/panel.js +27 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1378,6 +1378,9 @@ function activate(ctx) {
|
|
|
1378
1378
|
type: {
|
|
1379
1379
|
svg: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-type-icon lucide-type"><path d="M12 4v16"/><path d="M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"/><path d="M9 20h6"/></svg>'
|
|
1380
1380
|
},
|
|
1381
|
+
"whole-word": {
|
|
1382
|
+
svg: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-whole-word"><circle cx="7" cy="12" r="3"/><path d="M10 9v6"/><circle cx="17" cy="12" r="3"/><path d="M14 7v8"/><path d="M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1"/></svg>'
|
|
1383
|
+
},
|
|
1381
1384
|
"wechat-copy": {
|
|
1382
1385
|
svg: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"><path stroke-linecap="round" stroke-width="2" d="M7 7h.009m5.982 0H13m4.991 7.5H18m-4 0h.009"></path><path stroke-width="2" d="M10 16c0 2.761 2.686 5 6 5c.907 0 1.767-.168 2.538-.468c.189-.073.393-.1.592-.063L22 21l-.652-2.03a1.13 1.13 0 0 1 .11-.89A4.3 4.3 0 0 0 22 16c0-2.761-2.686-5-6-5s-6 2.239-6 5Z"></path><path stroke-width="2" d="M17.873 11.249Q18 10.639 18 10c0-3.866-3.582-7-8-7s-8 3.134-8 7c0 1.112.297 2.164.824 3.098c.147.26.196.567.108.853L2 17l3.914-.76c.208-.041.422-.013.617.07a9 9 0 0 0 3.589.69"></path></svg>'
|
|
1383
1386
|
},
|
package/dist/panel.css
CHANGED
|
@@ -206,7 +206,7 @@ body.app-view .app-toolbar{display:flex!important}
|
|
|
206
206
|
align-items:center flex boxes. */
|
|
207
207
|
.app-tool svg{display:block;width:17px;height:17px;stroke-width:1.8}.app-tool:hover:not(:disabled){background:var(--finch-bg-hover,var(--bg))}
|
|
208
208
|
.app-tool:disabled{opacity:.4;cursor:default}.app-tool.checked{color:var(--text);background:var(--finch-bg-active,color-mix(in srgb,var(--text) 10%,transparent))}.app-tool.dirty{background:transparent}
|
|
209
|
-
.app-tool-label{min-width:auto;padding:0 9px}.ic-save,.ic-save-check{display:inline-flex;align-items:center}.ic-save[hidden],.ic-save-check[hidden]{display:none}.app-menu-wrap{position:relative}.app-menu{position:absolute;z-index:32;top:calc(100% + 7px);right:0;min-width:174px;padding:5px;border:1px solid var(--border);border-radius:9px;background:var(--card);box-shadow:0 2px 8px rgba(0,0,0,.12)}
|
|
209
|
+
.app-tool-label{min-width:auto;padding:0 9px}.app-word-count{min-width:0;padding-inline:8px;color:var(--muted);font-size:12px;font-variant-numeric:tabular-nums;cursor:pointer}.app-word-count svg{width:14px;height:14px;flex:none}.app-word-count svg[hidden]{display:none!important}.app-word-count:hover{color:var(--text)}.ic-save,.ic-save-check{display:inline-flex;align-items:center}.ic-save[hidden],.ic-save-check[hidden]{display:none}.app-menu-wrap{position:relative}.app-menu{position:absolute;z-index:32;top:calc(100% + 7px);right:0;min-width:174px;padding:5px;border:1px solid var(--border);border-radius:9px;background:var(--card);box-shadow:0 2px 8px rgba(0,0,0,.12)}
|
|
210
210
|
.app-menu button{display:flex;width:100%;align-items:center;justify-content:space-between;gap:12px;padding:7px 9px;border:0;border-radius:6px;background:transparent;color:var(--text);font:12px var(--finch-font-body,system-ui);text-align:left;cursor:pointer}.app-menu button:hover{background:var(--finch-bg-hover,var(--bg))}.app-menu button.checked{color:var(--text);background:var(--finch-bg-active,color-mix(in srgb,var(--text) 10%,transparent));font-weight:600}.app-menu button:disabled{color:var(--muted);cursor:default;opacity:.5}.app-menu button:disabled:hover{background:transparent}.app-menu hr{margin:5px 3px;border:0;border-top:1px solid var(--border)}
|
|
211
211
|
.app-document-meta{min-width:0;display:flex;flex-direction:column;gap:1px}.app-document-meta strong,.app-document-meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.app-document-meta strong{font-size:13px}.app-document-meta span{max-width:34vw;color:var(--muted);font-size:11px}
|
|
212
212
|
/* Focus mode ("专注") in App View: instead of just dimming inactive editor
|
|
@@ -222,9 +222,10 @@ body.app-view.has-document.focus-mode .app-toolbar{
|
|
|
222
222
|
padding:0;gap:0;border:0;background:transparent;z-index:20;
|
|
223
223
|
}
|
|
224
224
|
body.app-view.has-document.focus-mode .app-toolbar-group:not(.app-toolbar-end){display:none!important}
|
|
225
|
-
body.app-view.has-document.focus-mode .app-toolbar-end{margin-left:0}
|
|
226
|
-
body.app-view.has-document.focus-mode .app-toolbar-end>*:not(#appFocus){display:none!important}
|
|
225
|
+
body.app-view.has-document.focus-mode .app-toolbar-end{margin-left:0;flex-direction:column;align-items:flex-end;gap:6px}
|
|
226
|
+
body.app-view.has-document.focus-mode .app-toolbar-end>*:not(#appFocus):not(#appWordCountWrap){display:none!important}
|
|
227
227
|
body.app-view.has-document.focus-mode #appFocus{
|
|
228
|
+
order:0;
|
|
228
229
|
width:36px;height:36px;padding:0;border-color:var(--border);border-radius:999px;
|
|
229
230
|
background:var(--card);box-shadow:0 6px 18px rgba(0,0,0,.16);
|
|
230
231
|
opacity:.62;transition:opacity .15s ease;
|
|
@@ -232,6 +233,13 @@ body.app-view.has-document.focus-mode #appFocus{
|
|
|
232
233
|
}
|
|
233
234
|
body.app-view.has-document.focus-mode #appFocus:hover,
|
|
234
235
|
body.app-view.has-document.focus-mode #appFocus:focus-visible{opacity:1}
|
|
236
|
+
body.app-view.has-document.focus-mode #appWordCountWrap{order:1}
|
|
237
|
+
body.app-view.has-document.focus-mode #appWordCount{
|
|
238
|
+
height:24px;min-width:0;padding:0 10px;border:1px solid var(--border);border-radius:999px;
|
|
239
|
+
background:var(--card);box-shadow:0 4px 12px rgba(0,0,0,.12);opacity:.78;
|
|
240
|
+
}
|
|
241
|
+
body.app-view.has-document.focus-mode #appWordCount:hover{opacity:1}
|
|
242
|
+
body.app-view.has-document.focus-mode #appWordCount svg{width:12px;height:12px}
|
|
235
243
|
/* Rises up into its resting corner rather than just fading in place. */
|
|
236
244
|
@keyframes mdFocusPillIn{from{opacity:0;transform:translateY(14px)}to{opacity:.62;transform:translateY(0)}}
|
|
237
245
|
/* The button sits flush against the right edge here (unlike its normal
|
|
@@ -246,6 +254,16 @@ body.app-view.has-document.focus-mode #appFocus[data-tooltip]::after{
|
|
|
246
254
|
body.app-view.has-document.focus-mode #appFocus[data-tooltip]:hover::after{
|
|
247
255
|
transform:translateY(0);
|
|
248
256
|
}
|
|
257
|
+
/* The count pill sits against the right edge in focus mode too. Its detail
|
|
258
|
+
tooltip has two lines, so anchor its right edge instead of centering it
|
|
259
|
+
beyond the window boundary. */
|
|
260
|
+
body.app-view #appWordCount[data-tooltip]::after{white-space:pre;line-height:1.45;text-align:left}
|
|
261
|
+
body.app-view.has-document.focus-mode #appWordCount[data-tooltip]::after{
|
|
262
|
+
left:auto;right:0;transform:translateY(-3px);
|
|
263
|
+
}
|
|
264
|
+
body.app-view.has-document.focus-mode #appWordCount[data-tooltip]:hover::after{
|
|
265
|
+
transform:translateY(0);
|
|
266
|
+
}
|
|
249
267
|
body.app-view .stage{display:grid;grid-template-columns:minmax(0,1fr) 6px var(--preview-width,480px);background:var(--bg)}
|
|
250
268
|
body.app-view .pane{position:relative;inset:auto;min-width:0;min-height:0}
|
|
251
269
|
body.app-view .pane.active{display:block}
|
package/dist/panel.html
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
<button id="appPreview" class="app-tool app-tool-label checked" type="button" data-i18n-tooltip="toolbar.mode.label"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z"/><path d="M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7"/><path d="M 7 17h.01"/><path d="m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8"/></svg><span data-i18n="toolbar.mode.label">Preview</span></button>
|
|
22
22
|
<div class="app-menu-wrap"><button id="appStyle" class="app-tool" type="button" data-i18n-tooltip="toolbar.style.tooltip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z"/><circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/></svg></button><div id="appStyleMenu" class="app-menu" hidden></div></div>
|
|
23
23
|
<span class="app-toolbar-sep" aria-hidden="true"></span>
|
|
24
|
+
<div id="appWordCountWrap" class="app-menu-wrap"><button id="appWordCount" class="app-tool app-word-count" type="button" data-i18n-tooltip="wordCount.tooltip.character" aria-live="polite"><span id="appWordCountIcon" data-mode="character"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 9h16M4 15h16M10 3 8 21M16 3l-2 18"/></svg></span><span id="appWordCountValue">0</span></button><div id="appWordCountMenu" class="app-menu" hidden></div></div>
|
|
24
25
|
<button id="appFocus" class="app-tool" type="button" data-i18n-tooltip="appview.focus"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.086 18.412A2 2 0 0 1 12.67 19H5v-7.672a2 2 0 0 1 .586-1.414L11.75 3.75a6 6 0 1 1 8.49 8.49z"/><path d="M16 8 2 22"/><path d="M17.488 15H9"/></svg></button>
|
|
25
26
|
<div class="app-menu-wrap"><button id="appFont" class="app-tool" type="button" data-i18n-tooltip="toolbar.fontSize.tooltipEdit"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4v16"/><path d="M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"/><path d="M9 20h6"/></svg></button><div id="appFontMenu" class="app-menu" hidden></div></div>
|
|
26
27
|
<div class="app-menu-wrap"><button id="appMore" class="app-tool" type="button" data-i18n-tooltip="toolbar.more.tooltip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg></button><div id="appMoreMenu" class="app-menu" hidden></div></div>
|
package/dist/panel.js
CHANGED
|
@@ -1,46 +1,52 @@
|
|
|
1
|
-
"use strict";(()=>{(function(){"use strict";var i=window.finch;function
|
|
2
|
-
`+String(o.stack):""))},window.addEventListener("unhandledrejection",function(e){var t=e.reason,a=t&&(t.stack||t.message||String(t))||"unknown";
|
|
1
|
+
"use strict";(()=>{(function(){"use strict";var i=window.finch;function wa(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){wa("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";wa("unhandledrejection",a)}),window.__mdLog=function(e){if(i&&i.postMessage)try{i.postMessage({type:"clientLog",message:String(e)})}catch{}};var st=/^zh/i.test(navigator.language||""),lt={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.focusExit":"\u9000\u51FA\u4E13\u6CE8\u6A21\u5F0F","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","wordCount.home.label":"\u5B57\u6570","wordCount.home.tooltip.character":"\u6309\u5B57\u7B26\u7EDF\u8BA1","wordCount.home.tooltip.word":"\u6309\u8BCD\u7EC4\u7EDF\u8BA1","wordCount.label.character":"{total}","wordCount.label.word":"{total}","wordCount.tooltip.character":`\u6309\u5B57\u7B26\u7EDF\u8BA1 {total}
|
|
3
|
+
\u975E\u82F1\u6587 {nonEnglish} \xB7 \u82F1\u6587 {english}`,"wordCount.tooltip.word":`\u6309\u8BCD\u7EC4\u7EDF\u8BA1 {total}
|
|
4
|
+
\u975E\u82F1\u6587 {nonEnglish} \xB7 \u82F1\u6587 {english}`,"wordCount.mode.character":"\u6309\u5B57\u7B26","wordCount.mode.word":"\u6309\u8BCD\u7EC4","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
5
|
|
|
4
6
|
{text}
|
|
5
7
|
|
|
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.focusExit":"Exit focus mode","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}:
|
|
8
|
+
\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.focusExit":"Exit focus mode","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","wordCount.home.label":"Word count","wordCount.home.tooltip.character":"Character count","wordCount.home.tooltip.word":"Word count","wordCount.label.character":"{total}","wordCount.label.word":"{total}","wordCount.tooltip.character":`Character count {total}
|
|
9
|
+
Non-English {nonEnglish} \xB7 English {english}`,"wordCount.tooltip.word":`Word count {total}
|
|
10
|
+
Non-English {nonEnglish} \xB7 English {english}`,"wordCount.mode.character":"Character","wordCount.mode.word":"Word","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
11
|
|
|
8
12
|
{text}
|
|
9
13
|
|
|
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 Ft(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 Tt=document.getElementById("empty"),ha=document.getElementById("emptyNew"),ya=document.getElementById("emptyOpen"),Pt=document.getElementById("homeRecent"),le=document.getElementById("homeGrid"),lt=document.getElementById("homeHint"),Ot=[],ba=document.getElementById("homeTagline"),Ir=document.getElementById("editPane"),Rt=document.getElementById("previewPane"),ce=document.getElementById("previewResizer"),ke=document.getElementById("editor"),y=document.getElementById("article"),M=document.getElementById("status"),L=document.getElementById("popup"),_=document.getElementById("popupInput"),wa=document.getElementById("popupSend"),Sa=document.getElementById("popupShortcut"),Re=document.getElementById("actions"),Ar=document.getElementById("actCopyWx"),Cr=document.getElementById("actCopyImg"),Dr=document.getElementById("actSaveImg"),Fr=document.getElementById("actSavePdf"),xe=document.getElementById("actAiStyle"),ka=document.getElementById("actToggle"),ue=document.getElementById("confirmOverlay"),xa=document.getElementById("confirmMessage"),Bt=document.getElementById("confirmCancel"),Nt=document.getElementById("confirmDiscard"),Be=document.getElementById("confirmSave"),Ea=document.getElementById("appToolbar"),Ma=document.getElementById("appHome"),La=document.getElementById("appLibrary"),ct=document.getElementById("appOpen"),re=document.getElementById("appSave"),Ne=document.getElementById("appPreview"),ut=document.getElementById("appStyle"),dt=document.getElementById("appStyleMenu"),de=document.getElementById("appFocus"),qt=document.getElementById("appFont"),pt=document.getElementById("appFontMenu"),Tr=document.getElementById("appMore"),ft=document.getElementById("appMoreMenu"),Ht=document.getElementById("libraryDrawer"),mt=document.getElementById("libraryBackdrop"),Ia=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",pe=[],Ee={},fe=null,qe=null,ne=!1,He=[],j=null,Wt=!1,g=!1,Fa=!1,Ta=!1,H=null,me=null,G=!0,Pr=!1,gt=0,We=!1,te=!0,x="edit",I="kami",R="",Me="",W=[null,null,null],Le={songti:"Songti SC, STSong, SimSun, Noto Serif CJK SC, serif",rounded:"PingFang SC, Microsoft YaHei, Noto Sans CJK SC, sans-serif"},z=14,J="rounded",B=!1,D=!1;try{var ht=Number(localStorage.getItem("md-editor-font-size"));(ht===14||ht===16||ht===18)&&(z=ht);var zt=localStorage.getItem("md-editor-font-family");Le[zt]?J=zt:zt&&localStorage.removeItem("md-editor-font-family"),B=localStorage.getItem("md-editor-comfort-writing")==="1",D=localStorage.getItem("md-editor-focus-mode")==="1";var ze=JSON.parse(localStorage.getItem(Da)||"{}");Array.isArray(ze.order)&&(pe=ze.order.filter(function(e){return typeof e=="string"})),ze.collapsed&&typeof ze.collapsed=="object"&&(Ee=ze.collapsed)}catch{}te=!D;var h="",Ue="",U="",m="",P=null,N="",Ie=!1,Pa=0,Ve=!1,Oa=0,Ut={},Ae={},Or=0,ve={},Rr=0,ge={},_e=0,$=null,yt=0,Ce=0,Vt=!1,w={text:"",mode:"replace"},E=0;function c(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 he(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 Br(){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!!h||!!m}ha&&ha.addEventListener("click",async function(){if(!i||!i.composer){c(n("newdoc.needChat"),!0);return}try{await i.composer.addContexts([{type:"annotation",label:n("newdoc.label"),promptText:n("newdoc.promptText"),reminder:n("newdoc.reminder")}]),c(n("newdoc.added"))}catch(e){c(String(e),!0)}}),ya&&ya.addEventListener("click",function(){ia()});var je="",_t="",jt="",bt=!1,Ra=!1,Ge="",ye="";function S(e){return String(e).replace(/[&<>"]/g,function(t){return t==="&"?"&":t==="<"?"<":t===">"?">":"""})}function Ba(){ba&&(ba.textContent=Ge?n("home.tagline.withAssistant",{name:Ge}):n("home.tagline.default"))}function wt(){_&&(_.placeholder=w.mode==="continue"?n("popup.placeholderContinue",{name:Ge||"Finch"}):n("popup.placeholder",{name:Ge||"Finch"}))}function Nr(e){return e?ye&&e===ye?"~":ye&&(e.indexOf(ye+"/")===0||e.indexOf(ye+"\\")===0)?"~"+e.slice(ye.length):e:""}function qr(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 Hr(){kt(Ot)}function Na(e){var t=new Date(e);if(!e||isNaN(t.getTime()))return"";var a=new Date,r=function(u){return u<10?"0"+u:String(u)},o=r(t.getHours())+":"+r(t.getMinutes()),s=t.toDateString()===a.toDateString();if(s)return n("home.today",{clock:o});var l=new Date(a.getTime()-864e5);return t.toDateString()===l.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:je,sessionId:_t,spaceId:jt}))}function Wr(e){e=e||{};var t=e.relativePath||e.fileName||"";return'<button class="doc-card" type="button" data-path="'+S(e.path||"")+'" title="'+S(e.path||"")+'"><span class="doc-reveal" data-reveal-path="'+S(e.path||"")+'" role="button" tabindex="0" title="'+S(n("home.revealInFileManager"))+'" aria-label="'+S(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">'+S(e.preview||n("home.emptyDoc"))+'</div><div class="doc-foot"><div class="doc-title">'+S(e.title||e.fileName||n("home.untitled"))+'</div><div class="doc-sub"><span class="doc-path" data-full-path="'+S(t)+'">'+S(t)+'</span><span class="doc-time">'+S(Na(e.modifiedAt))+"</span></div></div></button>"}function kt(e){if(!(!le||!Pt||!lt)){var t=Array.isArray(e)?e:[];if(Ot=t,t.length===0){Pt.hidden=!0,lt.hidden=!1,lt.textContent=n(je?"home.hintScoped":"home.hintDefault");return}var a=qa(t);le.innerHTML=a.map(function(r){var o=r.documents.map(Wr).join(""),s=r.scopePath?'<button type="button" class="home-group-cwd" data-cwd-path="'+S(r.scopePath)+'" title="'+S(n("home.cwdTitle",{path:r.scopePath}))+'">'+S(qr(Nr(r.scopePath)))+"</button>":"",l='<div class="home-group-title"><span class="home-group-label">'+S(r.label)+'<span class="home-group-count">'+r.documents.length+"</span></span>"+s+"</div>";return'<div class="home-group">'+l+'<div class="home-grid">'+o+"</div></div>"}).join(""),Pt.hidden=!1,lt.hidden=!0,requestAnimationFrame(function(){zr(le)})}}function zr(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 l=0,u=s.length,d=0;l<=u;){var f=l+u>>1;o.textContent=f>0?t+s.slice(s.length-f):t,o.scrollWidth<=o.clientWidth+1?(d=f,l=f+1):u=f-1}o.textContent=d>0?t+s.slice(s.length-d):t}}}function Gt(){var e={order:pe,collapsed:Ee};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=pe.indexOf(a.id),s=pe.indexOf(r.id);if(o>=0||s>=0)return(o<0?9999:o)-(s<0?9999:s);var l={space:0,workspace:1},u=l[a.kind]-l[r.kind];return u||a.label.localeCompare(r.label)})}function Xt(e){if(C){He=Array.isArray(e)?e:[];var t=qa(He);if(ne){Ur(t);return}C.innerHTML=t.map(function(a){var r=a.documents.map(function(l){var u=l.relativePath||l.fileName||"";return'<button class="library-row" type="button" data-path="'+S(l.path||"")+'"><span class="library-row-main"><strong>'+S(l.title||l.fileName||n("home.untitled"))+'</strong><span class="library-row-meta"><span class="library-row-path" title="'+S(u)+'">'+S(u)+"</span><time>"+S(Na(l.modifiedAt))+"</time></span></span></button>"}).join(""),o=a.kind!=="external",s=!Ee[a.id];return'<details class="library-group" data-library-group-id="'+S(a.id)+'"'+(o?' data-draggable="true"':"")+(s?" open":"")+'><summary><span class="library-group-title">'+S(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">'+S(n("home.hintDefault"))+"</p>"}}function Ur(e){C.innerHTML=e.map(function(t){var a=t.kind!=="external";return'<div class="library-group library-group-reorder" data-library-group-id="'+S(t.id)+'"'+(a?' data-draggable="true"':"")+'><span class="library-reorder-handle" aria-hidden="true">'+(a?"\u22EE\u22EE":"")+'</span><span class="library-group-title">'+S(t.label)+'</span><span class="library-group-count">'+t.documents.length+"</span></div>"}).join("")||'<p class="home-hint">'+S(n("home.hintDefault"))+"</p>"}function Yt(e){ne=!!e,vt&&vt.classList.toggle("active",ne),Aa&&(Aa.hidden=!ne),Xt(He)}function xt(e){!Ht||!mt||(Ht.classList.toggle("open",!!e),Ht.setAttribute("aria-hidden",e?"false":"true"),mt.hidden=!e,e?St():ne&&Yt(!1))}function Vr(){if(!(!fe||!C)){fe.classList.remove("dragging"),Array.prototype.forEach.call(C.querySelectorAll(".library-group.drag-over"),function(t){t.classList.remove("drag-over")}),pe=Array.prototype.map.call(C.querySelectorAll('.library-group[data-draggable="true"]'),function(t){return t.getAttribute("data-library-group-id")}).filter(Boolean),kt(Ot);var e=qe||{};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])}),fe=null,setTimeout(function(){qe=null,Gt()},0)}}function _r(){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 jr(e){var t=j;if(!(!t||t.active)){t.active=!0,fe=e,qe={},ne||Array.prototype.forEach.call(C.querySelectorAll(".library-group"),function(o){var s=o.getAttribute("data-library-group-id");s&&(qe[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 Gr(e,t){if(fe){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===fe)){r.classList.add("drag-over");var o=t>r.getBoundingClientRect().top+r.offsetHeight/2;C.insertBefore(fe,o?r.nextSibling:r)}}}function Wa(){var e=j;e&&(e.active&&(_r(),Vr(),Wt=!0,setTimeout(function(){Wt=!1},0)),j=null)}La&&La.addEventListener("click",function(){xt(!0)}),Ia&&Ia.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),Xe=!0,c(n("status.opening")),Kt(a))}),C&&(C.addEventListener("toggle",function(e){var t=e.target;if(!(!t||!t.matches||!t.matches(".library-group"))&&!qe){var a=t.getAttribute("data-library-group-id");a&&(Ee[a]=!t.open,Gt())}},!0),C.addEventListener("click",function(e){if(Wt){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;jr(t.group)}e.preventDefault(),Ha(e.clientX,e.clientY),Gr(e.clientX,e.clientY)}}),window.addEventListener("pointerup",function(){Wa()}),window.addEventListener("pointercancel",function(){Wa()}));var Xe=!1,Et="";function Kt(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 l=s.getAttribute("data-path")||"";l&&(Xe=!0,c(n("status.opening")),Kt(l))}}}),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 Ye(){Tt.hidden=A(),document.body.classList.toggle("has-document",A()),Re&&(Re.hidden=!N),!Tt.hidden&&bt&&St()}function De(){Ir.classList.toggle("active",g?A():x==="edit"),Rt.classList.toggle("active",g?A():x==="preview"),(g||x==="edit")&&p&&requestAnimationFrame(function(){p.layout()})}function za(e){g||!i||!i.panel||!i.panel.setTitle||i.panel.setTitle(e||n("home.title")).catch(function(){})}function Xr(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 Fe="";function Va(e){!e||e===m||!i||!i.postMessage||(Fe=e,Kt(e))}function be(){if(!(!g||!i||!i.appView||!i.appView.breadcrumb)){var e=A()&&m?[{id:Xr(m),title:U||n("common.markdownDocDefault"),icon:"file-text"}]:[];i.appView.breadcrumb.set(e).catch(function(){})}}function Yr(){Ta||!i||!i.appView||!i.appView.breadcrumb||(Ta=!0,i.appView.breadcrumb.onNavigate(function(e){if(!e.id){A()&&nt().then(be);return}var t=Ua(e.id);t?Va(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(be);return}var a=t.length===1&&Ua(t[0].id);if(!a){i.appView.breadcrumb.set([]).catch(function(){}),A()&&nt().then(be);return}Va(a)}))}function Kr(){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=I==="custom"&&!!R&&!W.some(function(s){return s&&s.css===R});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=W[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 Jr(){var e="ext:markdown-editor-icons/save",t=n("toolbar.save.label"),a=n("toolbar.save.tooltipDefault");O?(t=n("toolbar.save.label"),a=n("toolbar.save.tooltipDirty")):Pe&&(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:m||U||n("toolbar.open.tooltipDefault"),disabled:Y},{id:"save",icon:e,label:t,tooltip:a,disabled:!O},{type:"separator"},{id:"mode",icon:Ve?"ext:markdown-editor-icons/hourglass":"ext:markdown-editor-icons/swatch-book",label:n("toolbar.mode.label"),tooltip:n(r?Ve?"toolbar.mode.tooltipRendering":x==="edit"?"toolbar.mode.tooltipToPreview":"toolbar.mode.tooltipToEdit":"toolbar.needDoc"),checked:x==="preview",disabled:!r},{type:"menu",id:"style",icon:"palette",tooltip:n(x==="preview"?"toolbar.style.tooltip":"toolbar.style.tooltipNeedsPreview"),disabled:x!=="preview",items:Kr()},{type:"spacer"},{id:"focus",icon:"ext:markdown-editor-icons/feather",tooltip:n(r?D?"toolbar.focus.tooltipOn":"toolbar.focus.tooltipOff":"toolbar.needDoc"),checked:D,disabled:!r||x==="preview"},{type:"menu",id:"font-size",icon:"ext:markdown-editor-icons/type",tooltip:n(r?x==="preview"?"toolbar.fontSize.tooltipPreview":"toolbar.fontSize.tooltipEdit":"toolbar.needDoc"),disabled:!r||x==="preview",items:[{id:"comfort:read",label:n("toolbar.comfort.read"),checked:!B},{id:"comfort:write",label:n("toolbar.comfort.write"),checked:B},{id:"font-comfort-sep",label:"",separator:!0},{id:"font-size:14",label:n("toolbar.fontSize.small"),checked:z===14},{id:"font-size:16",label:n("toolbar.fontSize.medium"),checked:z===16},{id:"font-size:18",label:n("toolbar.fontSize.large"),checked:z===18},{id:"font-sep",label:"",separator:!0},{id:"font-family:rounded",label:n("toolbar.fontFamily.default"),checked:J==="rounded"},{id:"font-family:songti",label:n("toolbar.fontFamily.serif"),checked:J==="songti"}]},{type:"menu",id:"more",icon:"settings",items:[{id:"reload",label:n("toolbar.more.reload"),disabled:x!=="preview"},{id:"reveal",label:n("toolbar.more.reveal"),disabled:!r},{id:"recentSession",label:n("toolbar.more.recentSession"),disabled:!me},{id:"more-sep",label:"",separator:!0},{id:"about",label:n("toolbar.more.about")}]}]}function F(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 _a(){if(dt){var e=["kami","bauhaus","blueprint","botanical","newsprint","retro","sketch","terminal"],t=e.map(function(s){return F("style:"+s,s[0].toUpperCase()+s.slice(1),I===s)}).join("")+"<hr>",a=I==="custom"&&!!R&&!W.some(function(s){return s&&s.css===R});a&&(t+=[0,1,2].map(function(s){return F("style:slot-save:"+s,n("aiStyle.saveToSlot",{n:s+1}),!1)}).join("")+"<hr>");for(var r=0;r<3;r++){var o=W[r];t+=o?F("style:slot-use:"+r,n("toolbar.style.customSlot",{n:r+1,label:o.label}),I==="custom"&&R===o.css):F("style:slot-use:"+r,n("toolbar.style.customSlotEmpty",{n:r+1}),!1)}dt.innerHTML=t}pt&&(pt.innerHTML=F("comfort:read",n("toolbar.comfort.read"),!B)+F("comfort:write",n("toolbar.comfort.write"),B)+"<hr>"+F("font-size:14",n("toolbar.fontSize.small"),z===14)+F("font-size:16",n("toolbar.fontSize.medium"),z===16)+F("font-size:18",n("toolbar.fontSize.large"),z===18)+"<hr>"+F("font-family:rounded",n("toolbar.fontFamily.default"),J==="rounded")+F("font-family:songti",n("toolbar.fontFamily.serif"),J==="songti")),ft&&(ft.innerHTML=F("reload",n("toolbar.more.reload"),!1)+F("reveal",n("toolbar.more.reveal"),!1)+F("recentSession",n("toolbar.more.recentSession"),!1,!me)+"<hr>"+F("about",n("toolbar.more.about"),!1))}function $r(){if(g){var e=A();if(re){re.disabled=!O,re.classList.toggle("dirty",O);var t=Pe?"toolbar.save.tooltipSaved":O?"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=Pe),r&&(r.hidden=!Pe)}if(de){de.disabled=!e,de.classList.toggle("checked",D);var o=n(D?"appview.focusExit":"appview.focus");de.setAttribute("data-tooltip",o),de.setAttribute("aria-label",o)}Ne&&(Ne.disabled=!e,Ne.classList.toggle("checked",G)),ct&&(ct.disabled=Y),ut&&(ut.disabled=!e||!G,ut.setAttribute("data-tooltip",n(G?"toolbar.style.tooltip":"toolbar.style.tooltipNeedsPreview"))),qt&&(qt.disabled=!e),_a()}}function k(){g?$r():i&&i.postMessage({type:"setToolbar",toolbar:Jr()})}function Ke(e){if(T(),g){x="edit",De(),X(),k();return}x=e,De(),k(),x==="preview"&&X()}function Zr(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(","),l=s>=0?o.slice(s+1):"";if(!l){a(new Error("Could not read pasted image."));return}var u=++Or;ve[u]={resolve:t,reject:a},setTimeout(function(){ve[u]&&(delete ve[u],a(new Error(n("status.pasteImageTimeout"))))},15e3),i.postMessage({type:"pasteImage",data:l,mimeType:e.type,requestId:u})},r.onerror=function(){a(new Error("Could not read pasted image."))},r.readAsDataURL(e)})}var p=window.MarkdownCodeMirror.create({parent:ke,value:h,onChange:function(e){h=e,T(),Ye(),Oe(!0),cr(),ln()},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:Zr,onAiHintTrigger:Mn,onAiWorkingCancel:function(){!g||!H||!m||!i||!i.postMessage||i.postMessage({type:"cancelRewrite",path:m,sessionId:H.sessionId,turnId:H.turnId})}});p.setFontSize(z),p.setFontFamily(Le[J]),p.setComfortWriting(B),p.setFocusMode(D),document.body.classList.toggle("focus-mode",D);var ja=0;p.scrollDOM.addEventListener("scroll",function(){T(),p.scrollDOM.classList.add("cm-scrollbar-active"),window.clearTimeout(ja),ja=window.setTimeout(function(){p.scrollDOM.classList.remove("cm-scrollbar-active")},800)});function Qr(){return I==="custom"?R:""}var Ga="user-content-mdl-",Jt=0,$t={side:"",value:-1,at:0},Je={editor:!1,preview:!1},Te=[];function en(e){if(!g)return e;for(var t=e.split(`
|
|
11
|
-
`)
|
|
12
|
-
`)
|
|
14
|
+
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=st?lt.zh:lt.en,r=Object.prototype.hasOwnProperty.call(a,e)?a[e]:Object.prototype.hasOwnProperty.call(lt.en,e)?lt.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 Bt(e){var t=e||document;document.documentElement.lang=st?"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 Nt=document.getElementById("empty"),Sa=document.getElementById("emptyNew"),ka=document.getElementById("emptyOpen"),Wt=document.getElementById("homeRecent"),ce=document.getElementById("homeGrid"),ct=document.getElementById("homeHint"),qt=[],Ca=document.getElementById("homeTagline"),Rr=document.getElementById("editPane"),Ht=document.getElementById("previewPane"),ue=document.getElementById("previewResizer"),Ce=document.getElementById("editor"),y=document.getElementById("article"),x=document.getElementById("status"),M=document.getElementById("popup"),j=document.getElementById("popupInput"),Ea=document.getElementById("popupSend"),xa=document.getElementById("popupShortcut"),Be=document.getElementById("actions"),Br=document.getElementById("actCopyWx"),Nr=document.getElementById("actCopyImg"),Wr=document.getElementById("actSaveImg"),qr=document.getElementById("actSavePdf"),Ee=document.getElementById("actAiStyle"),Ma=document.getElementById("actToggle"),de=document.getElementById("confirmOverlay"),Ia=document.getElementById("confirmMessage"),zt=document.getElementById("confirmCancel"),Ut=document.getElementById("confirmDiscard"),Ne=document.getElementById("confirmSave"),La=document.getElementById("appToolbar"),Aa=document.getElementById("appHome"),Da=document.getElementById("appLibrary"),ut=document.getElementById("appOpen"),ne=document.getElementById("appSave"),We=document.getElementById("appPreview"),dt=document.getElementById("appStyle"),pt=document.getElementById("appStyleMenu"),Fa=document.getElementById("appWordCountWrap"),ft=document.getElementById("appWordCount"),Ta=document.getElementById("appWordCountValue"),mt=document.getElementById("appWordCountIcon"),gt=document.getElementById("appWordCountMenu"),pe=document.getElementById("appFocus"),Vt=document.getElementById("appFont"),vt=document.getElementById("appFontMenu"),Hr=document.getElementById("appMore"),ht=document.getElementById("appMoreMenu"),_t=document.getElementById("libraryDrawer"),yt=document.getElementById("libraryBackdrop"),Pa=document.getElementById("libraryClose"),bt=document.getElementById("libraryReorder"),Oa=document.getElementById("libraryReorderFooter"),Ra=document.getElementById("libraryReorderDone"),D=document.getElementById("libraryGroups"),Ba="md-editor-library-groups-v1",fe=[],xe={},me=null,qe=null,oe=!1,He=[],G=null,jt=!1,v=!1,Na=!1,Wa=!1,q=null,ge=null,X=!0,zr=!1,wt=0,ze=!1,ae=!0,C="edit",I="kami",R="",Me="",H=[null,null,null],Ie={songti:"Songti SC, STSong, SimSun, Noto Serif CJK SC, serif",rounded:"PingFang SC, Microsoft YaHei, Noto Sans CJK SC, sans-serif"},z=14,$="rounded",B=!1,U="character",F=!1;try{var St=Number(localStorage.getItem("md-editor-font-size"));(St===14||St===16||St===18)&&(z=St);var Gt=localStorage.getItem("md-editor-font-family");Ie[Gt]?$=Gt:Gt&&localStorage.removeItem("md-editor-font-family"),B=localStorage.getItem("md-editor-comfort-writing")==="1",localStorage.getItem("md-editor-word-count-mode")==="word"&&(U="word"),F=localStorage.getItem("md-editor-focus-mode")==="1";var Ue=JSON.parse(localStorage.getItem(Ba)||"{}");Array.isArray(Ue.order)&&(fe=Ue.order.filter(function(e){return typeof e=="string"})),Ue.collapsed&&typeof Ue.collapsed=="object"&&(xe=Ue.collapsed)}catch{}ae=!F;var h="",Ve="",V="",m="",P=null,N="",Le=!1,qa=0,_e=!1,Ha=0,Xt={},Ae={},Ur=0,ve={},Vr=0,he={},je=0,J=null,kt=0,De=0,Yt=!1,w={text:"",mode:"replace"},E=0;function c(e,t){E&&(clearTimeout(E),E=0),x.textContent=e||"",x.className="status"+(t?" error":""),e&&(E=setTimeout(function(){E=0,x.textContent="",x.className="status"},5e3))}function ye(e,t,a,r){if(E&&(clearTimeout(E),E=0),x.replaceChildren(document.createTextNode(e||"")),x.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)}),x.appendChild(o)}r&&(E=setTimeout(function(){E=0,x.replaceChildren(),x.className="status"},r))}function _r(){E&&(clearTimeout(E),E=0),x.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/"})}),x.append(e,document.createTextNode(n("status.rendererAboutSuffix"))),x.className="status",E=setTimeout(function(){E=0,x.textContent="",x.className="status"},5e3)}function L(){return!!h||!!m}Sa&&Sa.addEventListener("click",async function(){if(!i||!i.composer){c(n("newdoc.needChat"),!0);return}try{await i.composer.addContexts([{type:"annotation",label:n("newdoc.label"),promptText:n("newdoc.promptText"),reminder:n("newdoc.reminder")}]),c(n("newdoc.added"))}catch(e){c(String(e),!0)}}),ka&&ka.addEventListener("click",function(){da()});var Ge="",Kt="",Zt="",Ct=!1,za=!1,Xe="",be="";function k(e){return String(e).replace(/[&<>"]/g,function(t){return t==="&"?"&":t==="<"?"<":t===">"?">":"""})}function Ua(){Ca&&(Ca.textContent=Xe?n("home.tagline.withAssistant",{name:Xe}):n("home.tagline.default"))}function Et(){j&&(j.placeholder=w.mode==="continue"?n("popup.placeholderContinue",{name:Xe||"Finch"}):n("popup.placeholder",{name:Xe||"Finch"}))}function jr(e){return e?be&&e===be?"~":be&&(e.indexOf(be+"/")===0||e.indexOf(be+"\\")===0)?"~"+e.slice(be.length):e:""}function Gr(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 Xr(){Mt(qt)}function Va(e){var t=new Date(e);if(!e||isNaN(t.getTime()))return"";var a=new Date,r=function(u){return u<10?"0"+u:String(u)},o=r(t.getHours())+":"+r(t.getMinutes()),s=t.toDateString()===a.toDateString();if(s)return n("home.today",{clock:o});var l=new Date(a.getTime()-864e5);return t.toDateString()===l.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 xt(){!i||!i.postMessage||!Ct||(za=!0,i.postMessage({type:"requestRecentDocuments",cwd:Ge,sessionId:Kt,spaceId:Zt}))}function Yr(e){e=e||{};var t=e.relativePath||e.fileName||"";return'<button class="doc-card" type="button" data-path="'+k(e.path||"")+'" title="'+k(e.path||"")+'"><span class="doc-reveal" data-reveal-path="'+k(e.path||"")+'" role="button" tabindex="0" title="'+k(n("home.revealInFileManager"))+'" aria-label="'+k(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">'+k(e.preview||n("home.emptyDoc"))+'</div><div class="doc-foot"><div class="doc-title">'+k(e.title||e.fileName||n("home.untitled"))+'</div><div class="doc-sub"><span class="doc-path" data-full-path="'+k(t)+'">'+k(t)+'</span><span class="doc-time">'+k(Va(e.modifiedAt))+"</span></div></div></button>"}function Mt(e){if(!(!ce||!Wt||!ct)){var t=Array.isArray(e)?e:[];if(qt=t,t.length===0){Wt.hidden=!0,ct.hidden=!1,ct.textContent=n(Ge?"home.hintScoped":"home.hintDefault");return}var a=_a(t);ce.innerHTML=a.map(function(r){var o=r.documents.map(Yr).join(""),s=r.scopePath?'<button type="button" class="home-group-cwd" data-cwd-path="'+k(r.scopePath)+'" title="'+k(n("home.cwdTitle",{path:r.scopePath}))+'">'+k(Gr(jr(r.scopePath)))+"</button>":"",l='<div class="home-group-title"><span class="home-group-label">'+k(r.label)+'<span class="home-group-count">'+r.documents.length+"</span></span>"+s+"</div>";return'<div class="home-group">'+l+'<div class="home-grid">'+o+"</div></div>"}).join(""),Wt.hidden=!1,ct.hidden=!0,requestAnimationFrame(function(){Kr(ce)})}}function Kr(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 l=0,u=s.length,d=0;l<=u;){var f=l+u>>1;o.textContent=f>0?t+s.slice(s.length-f):t,o.scrollWidth<=o.clientWidth+1?(d=f,l=f+1):u=f-1}o.textContent=d>0?t+s.slice(s.length-d):t}}}function $t(){var e={order:fe,collapsed:xe};try{localStorage.setItem(Ba,JSON.stringify(e))}catch{}i&&i.postMessage&&i.postMessage({type:"saveLibraryGroups",libraryGroups:e})}function _a(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=fe.indexOf(a.id),s=fe.indexOf(r.id);if(o>=0||s>=0)return(o<0?9999:o)-(s<0?9999:s);var l={space:0,workspace:1},u=l[a.kind]-l[r.kind];return u||a.label.localeCompare(r.label)})}function Jt(e){if(D){He=Array.isArray(e)?e:[];var t=_a(He);if(oe){Zr(t);return}D.innerHTML=t.map(function(a){var r=a.documents.map(function(l){var u=l.relativePath||l.fileName||"";return'<button class="library-row" type="button" data-path="'+k(l.path||"")+'"><span class="library-row-main"><strong>'+k(l.title||l.fileName||n("home.untitled"))+'</strong><span class="library-row-meta"><span class="library-row-path" title="'+k(u)+'">'+k(u)+"</span><time>"+k(Va(l.modifiedAt))+"</time></span></span></button>"}).join(""),o=a.kind!=="external",s=!xe[a.id];return'<details class="library-group" data-library-group-id="'+k(a.id)+'"'+(o?' data-draggable="true"':"")+(s?" open":"")+'><summary><span class="library-group-title">'+k(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">'+k(n("home.hintDefault"))+"</p>"}}function Zr(e){D.innerHTML=e.map(function(t){var a=t.kind!=="external";return'<div class="library-group library-group-reorder" data-library-group-id="'+k(t.id)+'"'+(a?' data-draggable="true"':"")+'><span class="library-reorder-handle" aria-hidden="true">'+(a?"\u22EE\u22EE":"")+'</span><span class="library-group-title">'+k(t.label)+'</span><span class="library-group-count">'+t.documents.length+"</span></div>"}).join("")||'<p class="home-hint">'+k(n("home.hintDefault"))+"</p>"}function Qt(e){oe=!!e,bt&&bt.classList.toggle("active",oe),Oa&&(Oa.hidden=!oe),Jt(He)}function It(e){!_t||!yt||(_t.classList.toggle("open",!!e),_t.setAttribute("aria-hidden",e?"false":"true"),yt.hidden=!e,e?xt():oe&&Qt(!1))}function $r(){if(!(!me||!D)){me.classList.remove("dragging"),Array.prototype.forEach.call(D.querySelectorAll(".library-group.drag-over"),function(t){t.classList.remove("drag-over")}),fe=Array.prototype.map.call(D.querySelectorAll('.library-group[data-draggable="true"]'),function(t){return t.getAttribute("data-library-group-id")}).filter(Boolean),Mt(qt);var e=qe||{};Array.prototype.forEach.call(D.querySelectorAll(".library-group"),function(t){var a=t.getAttribute("data-library-group-id");a in e&&(t.open=!!e[a])}),me=null,setTimeout(function(){qe=null,$t()},0)}}function Jr(){G&&G.ghost&&G.ghost.parentNode&&G.ghost.parentNode.removeChild(G.ghost)}function ja(e,t){var a=G;!a||!a.ghost||(a.ghost.style.left=e-a.offsetX+"px",a.ghost.style.top=t-a.offsetY+"px")}function Qr(e){var t=G;if(!(!t||t.active)){t.active=!0,me=e,qe={},oe||Array.prototype.forEach.call(D.querySelectorAll(".library-group"),function(o){var s=o.getAttribute("data-library-group-id");s&&(qe[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),ja(t.startX,t.startY)}}function en(e,t){if(me){var a=document.elementFromPoint(e,t),r=a&&a.closest?a.closest('.library-group[data-draggable="true"]'):null;if(Array.prototype.forEach.call(D.querySelectorAll(".library-group.drag-over"),function(s){s.classList.remove("drag-over")}),!(!r||r===me)){r.classList.add("drag-over");var o=t>r.getBoundingClientRect().top+r.offsetHeight/2;D.insertBefore(me,o?r.nextSibling:r)}}}function Ga(){var e=G;e&&(e.active&&(Jr(),$r(),jt=!0,setTimeout(function(){jt=!1},0)),G=null)}Da&&Da.addEventListener("click",function(){It(!0)}),Pa&&Pa.addEventListener("click",function(){It(!1)}),yt&&yt.addEventListener("click",function(){It(!1)}),bt&&bt.addEventListener("click",function(){Qt(!oe)}),Ra&&Ra.addEventListener("click",function(){Qt(!1)}),D&&D.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||(It(!1),Ye=!0,c(n("status.opening")),ea(a))}),D&&(D.addEventListener("toggle",function(e){var t=e.target;if(!(!t||!t.matches||!t.matches(".library-group"))&&!qe){var a=t.getAttribute("data-library-group-id");a&&(xe[a]=!t.open,$t())}},!0),D.addEventListener("click",function(e){if(jt){var t=e.target&&e.target.closest?e.target.closest(".library-group summary"):null;t&&(e.preventDefault(),e.stopPropagation())}},!0),D.addEventListener("pointerdown",function(e){if(e.button===0&&oe){var t=e.target&&e.target.closest?e.target.closest('.library-group[data-draggable="true"]'):null;t&&(G={group:t,startX:e.clientX,startY:e.clientY,active:!1,ghost:null,offsetX:0,offsetY:0})}}),window.addEventListener("pointermove",function(e){var t=G;if(t){if(!t.active){if(Math.abs(e.clientX-t.startX)<4&&Math.abs(e.clientY-t.startY)<4)return;Qr(t.group)}e.preventDefault(),ja(e.clientX,e.clientY),en(e.clientX,e.clientY)}}),window.addEventListener("pointerup",function(){Ga()}),window.addEventListener("pointercancel",function(){Ga()}));var Ye=!1,Lt="";function ea(e){!e||!i||!i.postMessage||(Lt=e,i.postMessage({type:"loadPath",path:e}))}ce&&ce.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 l=s.getAttribute("data-path")||"";l&&(Ye=!0,c(n("status.opening")),ea(l))}}}),ce&&ce.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 Ke(){Nt.hidden=L(),document.body.classList.toggle("has-document",L()),Be&&(Be.hidden=!N),!Nt.hidden&&Ct&&xt()}function Fe(){Rr.classList.toggle("active",v?L():C==="edit"),Ht.classList.toggle("active",v?L():C==="preview"),(v||C==="edit")&&p&&requestAnimationFrame(function(){p.layout()})}function Xa(e){v||!i||!i.panel||!i.panel.setTitle||i.panel.setTitle(e||n("home.title")).catch(function(){})}function tn(e){return e?"document:"+encodeURIComponent(e):""}function Ya(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 Te="";function Ka(e){!e||e===m||!i||!i.postMessage||(Te=e,ea(e))}function we(){if(!(!v||!i||!i.appView||!i.appView.breadcrumb)){var e=L()&&m?[{id:tn(m),title:V||n("common.markdownDocDefault"),icon:"file-text"}]:[];i.appView.breadcrumb.set(e).catch(function(){})}}function an(){Wa||!i||!i.appView||!i.appView.breadcrumb||(Wa=!0,i.appView.breadcrumb.onNavigate(function(e){if(!e.id){L()&&ot().then(we);return}var t=Ya(e.id);t?Ka(t):i.appView.breadcrumb.set([]).catch(function(){})}),i.appView.breadcrumb.onRestore(function(e){var t=Array.isArray(e.levels)?e.levels:[];if(!t.length){L()&&ot().then(we);return}var a=t.length===1&&Ya(t[0].id);if(!a){i.appView.breadcrumb.set([]).catch(function(){}),L()&&ot().then(we);return}Ka(a)}))}function rn(){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=I==="custom"&&!!R&&!H.some(function(s){return s&&s.css===R});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=H[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 nn(){var e="ext:markdown-editor-icons/save",t=n("toolbar.save.label"),a=n("toolbar.save.tooltipDefault");O?(t=n("toolbar.save.label"),a=n("toolbar.save.tooltipDirty")):Oe&&(e="ext:markdown-editor-icons/save-check",t=n("toolbar.save.labelSaved"),a=n("toolbar.save.tooltipSaved"));var r=L(),o=$a(h,r),s=[{id:"home",icon:"house",tooltip:n("toolbar.home.tooltip")},{id:"open",icon:"ext:markdown-editor-icons/folder-open",tooltip:m||V||n("toolbar.open.tooltipDefault"),disabled:K},{id:"save",icon:e,label:t,tooltip:a,disabled:!O},{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":C==="edit"?"toolbar.mode.tooltipToPreview":"toolbar.mode.tooltipToEdit":"toolbar.needDoc"),checked:C==="preview",disabled:!r},{type:"menu",id:"style",icon:"palette",tooltip:n(C==="preview"?"toolbar.style.tooltip":"toolbar.style.tooltipNeedsPreview"),disabled:C!=="preview",items:rn()},{type:"spacer"},{type:"menu",id:"wordCount",icon:o.icon,label:o.label,tooltip:o.tooltip,disabled:!r,items:[{id:"word-count:character",label:n("wordCount.mode.character"),icon:"hash",checked:U==="character"},{id:"word-count:word",label:n("wordCount.mode.word"),icon:"ext:markdown-editor-icons/whole-word",checked:U==="word"}]},{id:"focus",icon:"ext:markdown-editor-icons/feather",tooltip:n(r?F?"toolbar.focus.tooltipOn":"toolbar.focus.tooltipOff":"toolbar.needDoc"),checked:F,disabled:!r||C==="preview"},{type:"menu",id:"font-size",icon:"ext:markdown-editor-icons/type",tooltip:n(r?C==="preview"?"toolbar.fontSize.tooltipPreview":"toolbar.fontSize.tooltipEdit":"toolbar.needDoc"),disabled:!r||C==="preview",items:[{id:"comfort:read",label:n("toolbar.comfort.read"),checked:!B},{id:"comfort:write",label:n("toolbar.comfort.write"),checked:B},{id:"font-comfort-sep",label:"",separator:!0},{id:"font-size:14",label:n("toolbar.fontSize.small"),checked:z===14},{id:"font-size:16",label:n("toolbar.fontSize.medium"),checked:z===16},{id:"font-size:18",label:n("toolbar.fontSize.large"),checked:z===18},{id:"font-sep",label:"",separator:!0},{id:"font-family:rounded",label:n("toolbar.fontFamily.default"),checked:$==="rounded"},{id:"font-family:songti",label:n("toolbar.fontFamily.serif"),checked:$==="songti"}]},{type:"menu",id:"more",icon:"settings",items:[{id:"reload",label:n("toolbar.more.reload"),disabled:C!=="preview"},{id:"reveal",label:n("toolbar.more.reveal"),disabled:!r},{id:"recentSession",label:n("toolbar.more.recentSession"),disabled:!ge},{id:"more-sep",label:"",separator:!0},{id:"about",label:n("toolbar.more.about")}]}];return r?s:s.filter(function(l){return!("id"in l)||l.id!=="wordCount"})}function A(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 Za(){if(pt){var e=["kami","bauhaus","blueprint","botanical","newsprint","retro","sketch","terminal"],t=e.map(function(s){return A("style:"+s,s[0].toUpperCase()+s.slice(1),I===s)}).join("")+"<hr>",a=I==="custom"&&!!R&&!H.some(function(s){return s&&s.css===R});a&&(t+=[0,1,2].map(function(s){return A("style:slot-save:"+s,n("aiStyle.saveToSlot",{n:s+1}),!1)}).join("")+"<hr>");for(var r=0;r<3;r++){var o=H[r];t+=o?A("style:slot-use:"+r,n("toolbar.style.customSlot",{n:r+1,label:o.label}),I==="custom"&&R===o.css):A("style:slot-use:"+r,n("toolbar.style.customSlotEmpty",{n:r+1}),!1)}pt.innerHTML=t}gt&&(gt.innerHTML=A("word-count:character",n("wordCount.mode.character"),U==="character")+A("word-count:word",n("wordCount.mode.word"),U==="word")),vt&&(vt.innerHTML=A("comfort:read",n("toolbar.comfort.read"),!B)+A("comfort:write",n("toolbar.comfort.write"),B)+"<hr>"+A("font-size:14",n("toolbar.fontSize.small"),z===14)+A("font-size:16",n("toolbar.fontSize.medium"),z===16)+A("font-size:18",n("toolbar.fontSize.large"),z===18)+"<hr>"+A("font-family:rounded",n("toolbar.fontFamily.default"),$==="rounded")+A("font-family:songti",n("toolbar.fontFamily.serif"),$==="songti")),ht&&(ht.innerHTML=A("reload",n("toolbar.more.reload"),!1)+A("reveal",n("toolbar.more.reveal"),!1)+A("recentSession",n("toolbar.more.recentSession"),!1,!ge)+"<hr>"+A("about",n("toolbar.more.about"),!1))}function on(e){var t=String(e||"").replace(/\r\n?/g,`
|
|
15
|
+
`).replace(/^(?:\uFEFF)?---\s*\n[\s\S]*?\n(?:---|\.\.\.)\s*(?=\n|$)/,`
|
|
16
|
+
`).replace(/```[\s\S]*?```|~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ").replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/https?:\/\/\S+/g," ").replace(/<[^>]+>/g," ").replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-+*]\s+|\d+[.)]\s+)/gm,"").replace(/[*_~]/g," "),a=/[A-Za-z]+(?:['’][A-Za-z]+)*(?:-[A-Za-z]+(?:['’][A-Za-z]+)*)*/g,r=(t.match(a)||[]).length,o=Array.from(t).filter(function(l){return/[A-Za-z]/.test(l)}).length,s=Array.from(t.replace(a," ")).filter(function(l){return/[\p{L}\p{N}]/u.test(l)}).length;return{englishWords:r,englishCharacters:o,nonEnglish:s}}function $a(e,t){var a=U==="character",r=a?"hash":"ext:markdown-editor-icons/whole-word";if(!t)return{icon:r,label:n("wordCount.home.label"),tooltip:n(a?"wordCount.home.tooltip.character":"wordCount.home.tooltip.word")};var o=on(e),s=a?o.englishCharacters:o.englishWords,l={total:o.nonEnglish+s,nonEnglish:o.nonEnglish,english:s};return{icon:r,label:n(a?"wordCount.label.character":"wordCount.label.word",l),tooltip:n(a?"wordCount.tooltip.character":"wordCount.tooltip.word",l)}}function sn(){return U==="character"?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 9h16M4 15h16M10 3 8 21M16 3l-2 18"/></svg>':'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-whole-word" aria-hidden="true"><circle cx="7" cy="12" r="3"/><path d="M10 9v6"/><circle cx="17" cy="12" r="3"/><path d="M14 7v8"/><path d="M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1"/></svg>'}function ln(){if(ft){var e=$a(h,L());Ta&&(Ta.textContent=e.label),mt&&mt.getAttribute("data-mode")!==U&&(mt.innerHTML=sn(),mt.setAttribute("data-mode",U)),ft.setAttribute("data-tooltip",e.tooltip),ft.setAttribute("aria-label",e.tooltip)}}function cn(){if(v){var e=L();if(Fa&&(Fa.hidden=!e),ln(),ne){ne.disabled=!O,ne.classList.toggle("dirty",O);var t=Oe?"toolbar.save.tooltipSaved":O?"toolbar.save.tooltipDirty":"toolbar.save.tooltipDefault";ne.setAttribute("data-tooltip",n(t));var a=ne.querySelector(".ic-save"),r=ne.querySelector(".ic-save-check");a&&(a.hidden=Oe),r&&(r.hidden=!Oe)}if(pe){pe.disabled=!e,pe.classList.toggle("checked",F);var o=n(F?"appview.focusExit":"appview.focus");pe.setAttribute("data-tooltip",o),pe.setAttribute("aria-label",o)}We&&(We.disabled=!e,We.classList.toggle("checked",X)),ut&&(ut.disabled=K),dt&&(dt.disabled=!e||!X,dt.setAttribute("data-tooltip",n(X?"toolbar.style.tooltip":"toolbar.style.tooltipNeedsPreview"))),Vt&&(Vt.disabled=!e),Za()}}function S(){v?cn():i&&i.postMessage({type:"setToolbar",toolbar:nn()})}function Ze(e){if(T(),v){C="edit",Fe(),Y(),S();return}C=e,Fe(),S(),C==="preview"&&Y()}function un(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(","),l=s>=0?o.slice(s+1):"";if(!l){a(new Error("Could not read pasted image."));return}var u=++Ur;ve[u]={resolve:t,reject:a},setTimeout(function(){ve[u]&&(delete ve[u],a(new Error(n("status.pasteImageTimeout"))))},15e3),i.postMessage({type:"pasteImage",data:l,mimeType:e.type,requestId:u})},r.onerror=function(){a(new Error("Could not read pasted image."))},r.readAsDataURL(e)})}var p=window.MarkdownCodeMirror.create({parent:Ce,value:h,onChange:function(e){h=e,T(),Ke(),Re(!0),vr(),bn()},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:un,onAiHintTrigger:Bn,onAiWorkingCancel:function(){!v||!q||!m||!i||!i.postMessage||i.postMessage({type:"cancelRewrite",path:m,sessionId:q.sessionId,turnId:q.turnId})}});p.setFontSize(z),p.setFontFamily(Ie[$]),p.setComfortWriting(B),p.setFocusMode(F),document.body.classList.toggle("focus-mode",F);var Ja=0;p.scrollDOM.addEventListener("scroll",function(){T(),p.scrollDOM.classList.add("cm-scrollbar-active"),window.clearTimeout(Ja),Ja=window.setTimeout(function(){p.scrollDOM.classList.remove("cm-scrollbar-active")},800)});function dn(){return I==="custom"?R:""}var Qa="user-content-mdl-",ta=0,aa={side:"",value:-1,at:0},$e={editor:!1,preview:!1},Pe=[];function pn(e){if(!v)return e;for(var t=e.split(`
|
|
17
|
+
`),a=[],r=!1,o=0;o<t.length;o++){var s=t[o],l=/^[ \t]*(?:```|~~~)/.test(s),u=o+1;if(l){r=!r,a.push(s);continue}var d=s.trim(),f=r||d===""||/\\\s*$/.test(s)||/^<[a-zA-Z!]/.test(d)||/^!\[[^\]]*\]\([^)]*\)\s*$/.test(d)||/^\s*\|/.test(s)&&/[|]\s*$/.test(s),b=!f&&/[|]/.test(s)&&o+1<t.length&&/^[ \t]*\|?[\s:|-]+\|?[ \t]*$/.test(t[o+1])&&/-/.test(t[o+1]);if(b){a.push(s);for(var g=o+1;g<t.length&&/[|]/.test(t[g]);)a.push(t[g]),g++;o=g-1;continue}a.push(f?s:s+'<a id="mdl-'+u+'"></a>')}return a.join(`
|
|
18
|
+
`)}function ra(){if(Pe=[],Q=null,!(!v||!Le)){var e=y.contentDocument;if(e){var t=e.querySelector("#bm-md");if(t){for(var a=e.querySelectorAll('a[id^="'+Qa+'"]'),r=0;r<a.length;r++){var o=a[r].id,s=Number(o.slice(Qa.length));!Number.isFinite(s)||s<1||t.contains(a[r])&&Pe.push({line:s,el:a[r]})}Pe.sort(function(l,u){return l.line-u.line}),Q=null}}}}function er(){var e=y.contentDocument;return e&&e.scrollingElement?e.scrollingElement.scrollTop:0}function fn(e){var t=y.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||(aa={side:"preview",value:r,at:Date.now()},a.scrollTop=r)}}function mn(e){if(!e)return 0;var t=y.contentDocument,a=t&&t.scrollingElement;return e.getBoundingClientRect().bottom+(a?a.scrollTop:0)}var Q=null;function gn(){if(Q=null,!Pe.length||!p||!p.scrollDOM)return null;var e=y.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],l=0;l<Pe.length;l++){var u=Pe[l],d=p.lineBottom(u.line);if(d!=null){var f=mn(u.el);if(!(!(d>o[o.length-1]+1)||!(f>s[s.length-1]+1))){if(d>=a||f>=r)break;o.push(d),s.push(f)}}}return o.push(a),s.push(r),Q={e:o,p:s,eMax:a,pMax:r,pHeight:t.scrollHeight,eHeight:p.scrollDOM.scrollHeight},Q}function vn(){var e=y.contentDocument,t=e&&e.scrollingElement;return!t||!p||!p.scrollDOM?null:!Q||Q.pHeight!==t.scrollHeight||Q.eHeight!==p.scrollDOM.scrollHeight?gn():Q}function tr(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 l=o+s>>1;e[l]<=a?o=l:s=l}var u=e[s]-e[o]||1;return t[o]+(a-e[o])/u*(t[s]-t[o])}function ar(e){$e[e]=!0,!ta&&(ta=requestAnimationFrame(function(){ta=0,hn()}))}function rr(e){var t=aa;if(t.side!==e||Date.now()-t.at>300)return!1;var a=e==="editor"?p.scrollDOM.scrollTop:er();return!(Math.abs(t.value-a)>2)}function hn(){var e=$e.editor,t=$e.preview;if($e.editor=!1,$e.preview=!1,!(!v||!L()||!X)){var a=vn();if(a){if(e)fn(tr(a.e,a.p,p.scrollDOM.scrollTop));else if(t){var r=tr(a.p,a.e,er());aa={side:"editor",value:r,at:Date.now()},Math.abs(p.scrollDOM.scrollTop-r)>=1&&(p.scrollDOM.scrollTop=r)}}}}function yn(){rr("editor")||!v||!L()||!X||ar("editor")}function nr(){rr("preview")||!v||!L()||!X||ar("preview")}function bn(){v&&(wt&&clearTimeout(wt),wt=setTimeout(function(){wt=0,Y()},420))}function Y(){if(!(!h||!i)){var e=++qa;_e=!0,S(),i.postMessage({type:"renderBm",markdown:pn(h),markdownStyle:I==="custom"?"kami":I,customCss:dn(),requestId:e})}}function wn(){var e=y.contentDocument,t=e&&e.scrollingElement;return t?{top:t.scrollTop}:null}function Sn(e){var t=y.contentDocument,a=t&&t.scrollingElement;!e||!a||(a.scrollTop=Math.min(e.top,Math.max(0,a.scrollHeight-a.clientHeight)))}function kn(){try{return getComputedStyle(y).backgroundColor||""}catch{return""}}function Cn(e,t,a){var r=Math.min(3,Math.max(2,(window.devicePixelRatio||1)*2)),o;try{o=new XMLSerializer().serializeToString(e)}catch(l){return Promise.reject(l)}var s="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(o);return new Promise(function(l,u){var d=new Image;d.decoding="sync",d.onload=function(){try{var f=document.createElement("canvas");f.width=Math.max(1,Math.round(t*r)),f.height=Math.max(1,Math.round(a*r));var b=f.getContext("2d");b.scale(r,r);var g="";try{g=getComputedStyle(e).backgroundColor}catch{g=""}g&&g!=="rgba(0, 0, 0, 0)"&&g!=="transparent"&&(b.fillStyle=g,b.fillRect(0,0,t,a)),b.drawImage(d,0,0,t,a),l(f.toDataURL("image/png"))}catch(W){u(W)}},d.onerror=function(){u(new Error("svg rasterize failed"))},d.src=s})}function or(){if(!(!Le||!y.contentDocument||!y.contentDocument.body)){var e=y.contentDocument,t=Array.prototype.slice.call(e.querySelectorAll("figure.figure-mermaid > svg, figure.figure-infographic > svg"));t.length&&Promise.all(t.map(function(a){var r=a.closest("figure"),o=a.getBoundingClientRect(),s=Math.ceil(o.width)||a.viewBox&&a.viewBox.baseVal&&a.viewBox.baseVal.width||600,l=Math.ceil(o.height)||a.viewBox&&a.viewBox.baseVal&&a.viewBox.baseVal.height||400;return Cn(a,s,l).then(function(u){var d=e.createElement("img");d.src=u,d.alt=r&&r.classList.contains("figure-infographic")?"Infographic":"Mermaid diagram",d.style.display="block",d.style.width="100%",d.style.height="auto",a.replaceWith(d)}).catch(function(){})})).then(function(){e.body&&(N=e.body.innerHTML)})}}function ir(e){var t=wn(),a=y.contentDocument;N=e;var r=kn();if(Le&&a&&a.body){a.body.innerHTML=N,r&&(a.body.style.background=r),Sn(t),lr(),ra(),or();return}y.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>"+N}function sr(e,t,a){return{start:e.slice(0,t).split(`
|
|
13
19
|
`).length,end:e.slice(0,a).split(`
|
|
14
|
-
`).length}}function
|
|
15
|
-
`;if(s){var l=/^[ \t]*(?:```|~~~)[^\n]*/.exec(e.slice(o));if(l){o+=l[0].length;continue}var u=/^[ \t]*(?:#{1,6}|>+|[-+*]|\d+[.)])[ \t]+/.exec(e.slice(o));if(u){o+=u[0].length;continue}}var d=/^!?\[([^\]]*)\]\((?:\\.|[^)])*\)/.exec(e.slice(o));if(d){for(var f=o+d[0].indexOf("[")+1,b=0;b<d[1].length;b++)/[*_~`]/.test(d[1][b])||r(d[1][b],f+b);o+=d[0].length;continue}var v=/^<[^>]+>/.exec(e.slice(o));if(v){o+=v[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 fn(t,a)}function vn(e,t){var a=e.indexOf(t);if(a>=0)return{start:a,end:a+t.length};var r=mn(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 l=o.slice(0,6),u=o.slice(-6),d=r.text.indexOf(l),f=r.text.indexOf(u,Math.max(0,d+l.length));if(d>=0&&f>=d)return{start:r.map[d],end:r.map[f+u.length-1]+1}}return null}function gn(e){return String(e||"").split(/[\\/]/).pop()||""}function tr(){var e=y.contentDocument;if(!e||e.__bound)return;e.__bound=!0;function t(){if(te){var a=y.contentWindow,r=a.getSelection(),o=r.toString().trim();if(!(!o||!r.rangeCount)){var s=r.getRangeAt(0),l=Array.from(s.getClientRects()),u=y.getBoundingClientRect(),d=l.map(function(V){return{top:u.top+V.top,left:u.left+V.left,width:V.width,height:V.height}}),f=l[0]||s.getBoundingClientRect(),b=l[l.length-1]||f,v=vn(h,o),q=v?er(h,v.start,v.end):null;rr(o,{startTop:u.top+f.top,startLeft:u.left+f.left,endBottom:u.top+b.bottom,endLeft:u.left+b.left},d,q,"preview")}}}e.addEventListener("mouseup",t),e.addEventListener("mousedown",function(){we(),T()}),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(){we(),T()},!0),y.contentWindow.addEventListener("scroll",function(){we(),T()})}y.onload=function(){Ie=!0,tr(),Zt()};function ar(){p&&p.scrollDOM&&!p.scrollDOM.__scrollSyncBound&&(p.scrollDOM.__scrollSyncBound=!0,p.scrollDOM.addEventListener("scroll",sn,{passive:!0}));var e=y.contentDocument;if(e&&!e.__scrollSyncBound){e.__scrollSyncBound=!0;var t=e.scrollingElement||e.documentElement;t&&t.addEventListener("scroll",$a,{passive:!0}),e.defaultView&&e.defaultView.addEventListener("scroll",$a,{passive:!0})}}ar(),window.addEventListener("resize",function(){Z=null}),y.addEventListener("load",function(){requestAnimationFrame(function(){Ie=!0,Zt(),ar(),Za()})});var Mt=0,Qt=[];function rr(e,t,a,r,o){we(),Mt=setTimeout(function(){nr(e,t,a,r,o)},300)}function we(){Mt&&(clearTimeout(Mt),Mt=0)}function nr(e,t,a,r,o,s){w.text=e,w.lines=r||null,w.origin=o||"",w.mode=s||"replace",wt(),L.classList.remove("hidden"),L.classList.toggle("popup-bar",!!(t&&t.width)),_.value="",yn(a),requestAnimationFrame(function(){hn(t),t&&t.focus&&_.focus()})}function hn(e){var t=8,a=10,r=e||{},o=g?t+48:t;if(L.style.width=r.width?r.width+"px":"",r.width){L.style.left=Math.max(t,r.startLeft||0)+"px",L.style.top=Math.max(o,Math.min(r.startTop||0,window.innerHeight-(L.offsetHeight||44)-t))+"px";return}var s=L.offsetWidth||300,l=L.offsetHeight||44,u=(r.startTop||0)-a-l,d=u>=o,f=d?u:(r.endBottom||0)+a,b=d?r.startLeft||0:r.endLeft!=null?r.endLeft:r.startLeft||0;L.style.left=Math.max(t,Math.min(b,window.innerWidth-s-t))+"px",L.style.top=Math.max(o,Math.min(f,window.innerHeight-l-t))+"px"}function yn(e){or(),(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),Qt.push(a)})}function or(){Qt.forEach(function(e){e.remove()}),Qt=[]}var bn=navigator.platform||navigator.userAgent||"",Lt=/Mac|iPhone|iPod|iPad/.test(bn);document.body.classList.toggle("non-mac-platform",!Lt);function wn(e){return String(e.key).toLowerCase()!=="e"||e.shiftKey?!1:Lt?e.metaKey&&e.ctrlKey&&!e.altKey:e.ctrlKey&&e.altKey&&!e.metaKey}(function(){if(Sa){var t=Lt?["\u2318","\u2303","E"]:["Ctrl","Alt","E"],a=Lt?"":"+";Sa.innerHTML=t.map(function(r){return"<kbd>"+r+"</kbd>"}).join(a?'<span class="popup-shortcut-sep">'+a+"</span>":"")}})();function T(e){var t=e===!0&&w.origin==="editor"&&x==="edit";we(),L.classList.add("hidden"),L.classList.remove("popup-bar"),L.classList.remove("focused"),L.style.width="",w.text="",w.lines=null,w.origin="",w.mode="replace",or(),t&&requestAnimationFrame(function(){p.focus()})}wa.onclick=sr;var ir=0;_.addEventListener("compositionend",function(){ir=Date.now()});function Sn(e){return e.isComposing||e.keyCode===229?!0:Date.now()-ir<100}_.addEventListener("keydown",function(e){if(e.key==="Enter"){if(Sn(e))return;sr()}e.key==="Escape"&&T(!0)}),_.addEventListener("focus",function(){L.classList.add("focused")}),_.addEventListener("blur",function(){requestAnimationFrame(function(){document.activeElement!==wa&&L.classList.remove("focused")})}),document.addEventListener("keydown",function(e){e.key==="Escape"&&!L.classList.contains("hidden")&&T(!0)}),document.addEventListener("keydown",function(e){wn(e)&&(L.classList.contains("hidden")||(e.preventDefault(),_.focus(),_.select()))}),document.addEventListener("mousedown",function(e){L.contains(e.target)||(we(),T())}),window.addEventListener("resize",T);function kn(){if(!w.lines)return n("annotate.lineUnknown");var e=w.lines.start,t=w.lines.end;return e===t?n("annotate.lineSingle",{a:e}):n("annotate.lineRange",{a:e,b:t})}function xn(){return w.lines?w.lines.start+"-"+w.lines.end:n("annotate.lineCompactUnknown")}async function sr(){var e=_.value.trim(),t=w.mode==="continue",a=w.mode==="annotate-line";if(!(!w.text&&!t&&!a||!i)){if(O&&m){var r=await da();if(!r){c(n("status.saveFailedNoReturn"),!0);return}}if(g){if(!m||!i.postMessage){c(n("status.noSourceFile"),!0);return}i.postMessage({type:"requestRewrite",path:m,selectedText:w.text,requirement:e,startLine:w.lines&&w.lines.start,endLine:w.lines&&w.lines.end,rewriteMode:t?"continue":"replace"}),T(!0),c(n(t?"appview.continuing":"appview.rewriting"));return}if(!i.composer||!w.text&&!a){T(!0);return}try{await i.composer.addContexts([{type:"annotation",label:(U||"Markdown")+":"+xn(),note:e||void 0,promptText:n("annotate.promptText",{lineLabel:kn(),requirement:e?n("annotate.requirementWith",{comment:e}):n("annotate.requirementDefault"),text:w.text||n("annotate.emptyLine"),path:m||n("annotate.pathMissing")}),reminder:n("annotate.reminder")}]),T(!0),c(n("annotate.added"))}catch(o){c(String(o),!0)}}}function En(){var e=p.getSelection();if(!e)return!1;var t=e.text.trim();if(!t)return!1;var a=er(p.getValue(),e.start,e.end);return rr(t,{startTop:e.startRect.top,startLeft:e.startRect.left,endBottom:e.rect.bottom,endLeft:e.rect.left},null,a,"editor"),!0}function lr(){te&&En()}function Mn(e){if(!A()||!e)return!1;we();var t=ke.querySelector(".cm-line")||ke.querySelector(".cm-content"),a=(t||ke).getBoundingClientRect();return nr("",{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}ke.addEventListener("mouseup",lr),ke.addEventListener("keyup",function(e){e.shiftKey&&lr()});var O=!1,$e=0,oe=null,ea=!1,Pe=!1,ta="",aa=null;function Ln(e){ta=e,aa=h,i.postMessage({type:"saveDraft",path:e,markdown:h,base:P})}function cr(){!m||!i||!i.postMessage||ta===m&&aa===h||Ln(m)}function ra(){ta="",aa=null}function na(e){ra(),e&&i&&i.postMessage&&i.postMessage({type:"discardDraft",path:e})}function Oe(e,t){O=e,_e&&(clearTimeout(_e),_e=0),Pe=!O&&!!t,k(),!O&&t&&(_e=setTimeout(function(){_e=0,O||(Pe=!1,k())},3e3))}async function ur(e){if(oe)return pr(),c("\u8BF7\u5148\u5904\u7406 AI \u5199\u56DE\u4E0E\u672C\u5730\u7F16\u8F91\u7684\u51B2\u7A81\u3002",!0),!1;if($&&$.createWritable)try{var t=await $.createWritable();return await t.write(e),await t.close(),yt=(await $.getFile()).lastModified,P=e,Oe(h!==e,h===e),c(n(h===e?"status.saved":"status.savedWithNewChanges")),ra(),!0}catch(r){return c(n("status.saveFailed",{err:String(r)}),!0),!1}if(m){var a=++Oa;return c(n("status.saving")),Ut[a]=e,i.postMessage({type:"saveMarkdown",path:m,markdown:e,requestId:a}),new Promise(function(r){Ae[a]=r})}return c(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(),ua();return}t&&(e.key==="p"||e.key==="P")&&(e.preventDefault(),Ke(x==="edit"?"preview":"edit"))});function dr(){Ce&&(clearInterval(Ce),Ce=0),$=null}var oa=null;function Ze(e,t,a,r,o,s){if(!r&&O&&P!==null&&e!==P)return oe={markdown:e,name:t,path:a,diskBaseline:o},c(n("status.externalUpdateSkipped"),!0),pr(),!1;var l=P!==null&&(!a||!m||a===m);return l||(te=!0),h=e,Ue=t,a&&(m=a),U=gn(a||m)||t||"Markdown",P=typeof o=="string"?o:h,oa=l?p.applyExternalValue(h):null,oa||p.setValue(h),Oe(!1),za(U),s||be(),Ye(),De(),(g||x==="preview")&&X(),!0}async function pr(){if(!(ea||!oe||!O)){var e=oe,t=P;if(h===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 Xn();if(ea=!1,oe===e){if(a==="later"){c("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(m),Ze(e.markdown,e.name,e.path,!0,e.diskBaseline);return}a==="local"&&(P=typeof e.diskBaseline=="string"?e.diskBaseline:e.markdown,cr(),c("\u5DF2\u4FDD\u7559\u672C\u5730\u7F16\u8F91\uFF1BAI \u5199\u56DE\u7248\u672C\u4ECD\u5728\u78C1\u76D8\u4E0A\u3002"))}}}async function fr(e){Ue=e.name,yt=e.lastModified,typeof e.path=="string"&&e.path?(m=e.path,i&&i.postMessage({type:"watchPath",path:m})):m="",Ze(await e.text(),Ue,m,!0)}function In(){$&&(Ce&&clearInterval(Ce),Ce=setInterval(async function(){if(!(Vt||!$)){Vt=!0;try{var e=await $.getFile();if(e.lastModified!==yt){yt=e.lastModified;var t=await e.text();t!==P&&Ze(t,Ue,m)&&c(n("status.externalUpdateApplied"))}}catch{}Vt=!1}},800))}var Y=!1,Qe=0;function et(){Qe&&(clearTimeout(Qe),Qe=0)}function An(){et(),Qe=setTimeout(function(){Qe=0,Y&&(Y=!1,We=!1,k(),c(n("status.pickerTimeout"),!0))},2e4)}async function ia(){if(O){var e=await kr(n("confirm.message",{file:U||n("common.markdownDocDefault")}));if(e==="cancel")return;if(e==="save"){var t=await da();if(!t){c(n("status.saveFailedNoReturn"),!0);return}}else e==="discard"&&na(m)}if(dr(),We&&i&&i.postMessage){if(Y){et(),We=!1,Y=!1,k(),await mr();return}Y=!0,An(),k(),c(n("status.openingPicker")),i.postMessage({type:"requestOpen"});return}await mr()}async function mr(){if("showOpenFilePicker"in window)try{var e=await window.showOpenFilePicker({types:[{description:"Markdown",accept:{"text/markdown":[".md",".markdown"]}}],multiple:!1});$=e[0],await fr(await $.getFile()),In();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&&fr(a).catch(function(r){c(String(r),!0)})},t.click()}function Cn(){window.focus(),document.body.tabIndex=-1;try{document.body.focus({preventScroll:!0})}catch{document.body.focus()}}async function Dn(e){for(var t=0;t<e;t++){if(Cn(),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 vr(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=++Rr;ge[o]={resolve:a,reject:r,sourceHtml:e},setTimeout(function(){ge[o]&&(delete ge[o],r(new Error(n("status.clipboardPrepareTimeout"))))},15e3),i.postMessage({type:"readClipboardImages",urls:t,requestId:o})})}function Fn(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 gr(e,t){if(document.hasFocus()||await Dn(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 Tn(a)?"rich":Pn(t)?"plain":"none"}function Tn(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 Pn(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 On(){if(!N){c(n("status.pleaseOpenArticle"),!0);return}try{var e=y.contentDocument&&y.contentDocument.body?y.contentDocument.body.innerText:N.replace(/<[^>]+>/g,""),t=await gr(vr(N),e);t==="none"&&(await new Promise(function(a){setTimeout(a,200)}),t=await gr(vr(N),e)),t==="rich"?c(n("status.copiedRich")):c(n(t==="plain"?"status.copiedPlainOnly":"status.copyFailed"),!0)}catch(a){c(n("status.richCopyFailed",{err:String(a)}),!0)}finally{x==="edit"&&requestAnimationFrame(function(){p.focus()})}}function Rn(){if(!Ie||!y.contentDocument)return null;var e=y.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=Rn();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(l){return Promise.reject(new Error(n("status.serializeFailed",{err:String(l)})))}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(l,u){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 b=f.getContext("2d");b.scale(t,t);var v="";try{v=y.contentWindow.getComputedStyle(e.root).backgroundColor}catch{v=""}v&&v!=="rgba(0, 0, 0, 0)"&&v!=="transparent"&&(b.fillStyle=v,b.fillRect(0,0,e.width,e.height)),b.drawImage(d,0,0,e.width,e.height),l({canvas:f,cssWidth:e.width,cssHeight:e.height})}catch(q){u(q)}},d.onerror=function(){u(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 hr(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 Bn(){if(!N){c(n("status.pleaseOpenArticle"),!0);return}if(!window.ClipboardItem||!navigator.clipboard||!navigator.clipboard.write){c(n("status.clipboardUnsupported"),!0);return}c(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})]),c(n("status.imageCopied"));return}catch{try{var t=await e;await navigator.clipboard.write([new ClipboardItem({"image/png":t})]),c(n("status.imageCopied"));return}catch(r){c(n("status.copyImageFailed",{err:r&&r.message?r.message:String(r)}),!0)}}}async function Nn(){if(!N){c(n("status.pleaseOpenArticle"),!0);return}try{c(n("status.generatingImage"));var e=await sa();if(!e){c(n("status.exportImageFailedGeneric"),!0);return}var t=await la(e.canvas,"image/png"),a=await t.arrayBuffer(),r=hr(new Uint8Array(a));i&&i.postMessage&&i.postMessage({type:"exportFile",data:r,ext:"png",path:m,fileName:U,markdown:h})}catch(o){c(n("status.exportImageFailed",{err:String(o)}),!0)}}function qn(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 ca(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 Hn(e,t,a,r,o){var s=Q(`%PDF-1.4
|
|
20
|
+
`).length}}function En(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 xn(e){var t="",a=[];function r(W,_){t+=W,a.push(_)}for(var o=0;o<e.length;){var s=o===0||e[o-1]===`
|
|
21
|
+
`;if(s){var l=/^[ \t]*(?:```|~~~)[^\n]*/.exec(e.slice(o));if(l){o+=l[0].length;continue}var u=/^[ \t]*(?:#{1,6}|>+|[-+*]|\d+[.)])[ \t]+/.exec(e.slice(o));if(u){o+=u[0].length;continue}}var d=/^!?\[([^\]]*)\]\((?:\\.|[^)])*\)/.exec(e.slice(o));if(d){for(var f=o+d[0].indexOf("[")+1,b=0;b<d[1].length;b++)/[*_~`]/.test(d[1][b])||r(d[1][b],f+b);o+=d[0].length;continue}var g=/^<[^>]+>/.exec(e.slice(o));if(g){o+=g[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 En(t,a)}function Mn(e,t){var a=e.indexOf(t);if(a>=0)return{start:a,end:a+t.length};var r=xn(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 l=o.slice(0,6),u=o.slice(-6),d=r.text.indexOf(l),f=r.text.indexOf(u,Math.max(0,d+l.length));if(d>=0&&f>=d)return{start:r.map[d],end:r.map[f+u.length-1]+1}}return null}function In(e){return String(e||"").split(/[\\/]/).pop()||""}function lr(){var e=y.contentDocument;if(!e||e.__bound)return;e.__bound=!0;function t(){if(ae){var a=y.contentWindow,r=a.getSelection(),o=r.toString().trim();if(!(!o||!r.rangeCount)){var s=r.getRangeAt(0),l=Array.from(s.getClientRects()),u=y.getBoundingClientRect(),d=l.map(function(_){return{top:u.top+_.top,left:u.left+_.left,width:_.width,height:_.height}}),f=l[0]||s.getBoundingClientRect(),b=l[l.length-1]||f,g=Mn(h,o),W=g?sr(h,g.start,g.end):null;ur(o,{startTop:u.top+f.top,startLeft:u.left+f.left,endBottom:u.top+b.bottom,endLeft:u.left+b.left},d,W,"preview")}}}e.addEventListener("mouseup",t),e.addEventListener("mousedown",function(){Se(),T()}),e.addEventListener("keyup",t),e.addEventListener("keydown",function(a){(a.metaKey||a.ctrlKey)&&(a.key==="p"||a.key==="P")&&(a.preventDefault(),Ze("edit"))}),e.addEventListener("scroll",function(){Se(),T()},!0),y.contentWindow.addEventListener("scroll",function(){Se(),T()})}y.onload=function(){Le=!0,lr(),ra()};function cr(){p&&p.scrollDOM&&!p.scrollDOM.__scrollSyncBound&&(p.scrollDOM.__scrollSyncBound=!0,p.scrollDOM.addEventListener("scroll",yn,{passive:!0}));var e=y.contentDocument;if(e&&!e.__scrollSyncBound){e.__scrollSyncBound=!0;var t=e.scrollingElement||e.documentElement;t&&t.addEventListener("scroll",nr,{passive:!0}),e.defaultView&&e.defaultView.addEventListener("scroll",nr,{passive:!0})}}cr(),window.addEventListener("resize",function(){Q=null}),y.addEventListener("load",function(){requestAnimationFrame(function(){Le=!0,ra(),cr(),or()})});var At=0,na=[];function ur(e,t,a,r,o){Se(),At=setTimeout(function(){dr(e,t,a,r,o)},300)}function Se(){At&&(clearTimeout(At),At=0)}function dr(e,t,a,r,o,s){w.text=e,w.lines=r||null,w.origin=o||"",w.mode=s||"replace",Et(),M.classList.remove("hidden"),M.classList.toggle("popup-bar",!!(t&&t.width)),j.value="",An(a),requestAnimationFrame(function(){Ln(t),t&&t.focus&&j.focus()})}function Ln(e){var t=8,a=10,r=e||{},o=v?t+48:t;if(M.style.width=r.width?r.width+"px":"",r.width){M.style.left=Math.max(t,r.startLeft||0)+"px",M.style.top=Math.max(o,Math.min(r.startTop||0,window.innerHeight-(M.offsetHeight||44)-t))+"px";return}var s=M.offsetWidth||300,l=M.offsetHeight||44,u=(r.startTop||0)-a-l,d=u>=o,f=d?u:(r.endBottom||0)+a,b=d?r.startLeft||0:r.endLeft!=null?r.endLeft:r.startLeft||0;M.style.left=Math.max(t,Math.min(b,window.innerWidth-s-t))+"px",M.style.top=Math.max(o,Math.min(f,window.innerHeight-l-t))+"px"}function An(e){pr(),(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),na.push(a)})}function pr(){na.forEach(function(e){e.remove()}),na=[]}var Dn=navigator.platform||navigator.userAgent||"",Dt=/Mac|iPhone|iPod|iPad/.test(Dn);document.body.classList.toggle("non-mac-platform",!Dt);function Fn(e){return String(e.key).toLowerCase()!=="e"||e.shiftKey?!1:Dt?e.metaKey&&e.ctrlKey&&!e.altKey:e.ctrlKey&&e.altKey&&!e.metaKey}(function(){if(xa){var t=Dt?["\u2318","\u2303","E"]:["Ctrl","Alt","E"],a=Dt?"":"+";xa.innerHTML=t.map(function(r){return"<kbd>"+r+"</kbd>"}).join(a?'<span class="popup-shortcut-sep">'+a+"</span>":"")}})();function T(e){var t=e===!0&&w.origin==="editor"&&C==="edit";Se(),M.classList.add("hidden"),M.classList.remove("popup-bar"),M.classList.remove("focused"),M.style.width="",w.text="",w.lines=null,w.origin="",w.mode="replace",pr(),t&&requestAnimationFrame(function(){p.focus()})}Ea.onclick=mr;var fr=0;j.addEventListener("compositionend",function(){fr=Date.now()});function Tn(e){return e.isComposing||e.keyCode===229?!0:Date.now()-fr<100}j.addEventListener("keydown",function(e){if(e.key==="Enter"){if(Tn(e))return;mr()}e.key==="Escape"&&T(!0)}),j.addEventListener("focus",function(){M.classList.add("focused")}),j.addEventListener("blur",function(){requestAnimationFrame(function(){document.activeElement!==Ea&&M.classList.remove("focused")})}),document.addEventListener("keydown",function(e){e.key==="Escape"&&!M.classList.contains("hidden")&&T(!0)}),document.addEventListener("keydown",function(e){Fn(e)&&(M.classList.contains("hidden")||(e.preventDefault(),j.focus(),j.select()))}),document.addEventListener("mousedown",function(e){M.contains(e.target)||(Se(),T())}),window.addEventListener("resize",T);function Pn(){if(!w.lines)return n("annotate.lineUnknown");var e=w.lines.start,t=w.lines.end;return e===t?n("annotate.lineSingle",{a:e}):n("annotate.lineRange",{a:e,b:t})}function On(){return w.lines?w.lines.start+"-"+w.lines.end:n("annotate.lineCompactUnknown")}async function mr(){var e=j.value.trim(),t=w.mode==="continue",a=w.mode==="annotate-line";if(!(!w.text&&!t&&!a||!i)){if(O&&m){var r=await va();if(!r){c(n("status.saveFailedNoReturn"),!0);return}}if(v){if(!m||!i.postMessage){c(n("status.noSourceFile"),!0);return}i.postMessage({type:"requestRewrite",path:m,selectedText:w.text,requirement:e,startLine:w.lines&&w.lines.start,endLine:w.lines&&w.lines.end,rewriteMode:t?"continue":"replace"}),T(!0),c(n(t?"appview.continuing":"appview.rewriting"));return}if(!i.composer||!w.text&&!a){T(!0);return}try{await i.composer.addContexts([{type:"annotation",label:(V||"Markdown")+":"+On(),note:e||void 0,promptText:n("annotate.promptText",{lineLabel:Pn(),requirement:e?n("annotate.requirementWith",{comment:e}):n("annotate.requirementDefault"),text:w.text||n("annotate.emptyLine"),path:m||n("annotate.pathMissing")}),reminder:n("annotate.reminder")}]),T(!0),c(n("annotate.added"))}catch(o){c(String(o),!0)}}}function Rn(){var e=p.getSelection();if(!e)return!1;var t=e.text.trim();if(!t)return!1;var a=sr(p.getValue(),e.start,e.end);return ur(t,{startTop:e.startRect.top,startLeft:e.startRect.left,endBottom:e.rect.bottom,endLeft:e.rect.left},null,a,"editor"),!0}function gr(){ae&&Rn()}function Bn(e){if(!L()||!e)return!1;Se();var t=Ce.querySelector(".cm-line")||Ce.querySelector(".cm-content"),a=(t||Ce).getBoundingClientRect();return dr("",{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}Ce.addEventListener("mouseup",gr),Ce.addEventListener("keyup",function(e){e.shiftKey&&gr()});var O=!1,Je=0,ie=null,oa=!1,Oe=!1,ia="",sa=null;function Nn(e){ia=e,sa=h,i.postMessage({type:"saveDraft",path:e,markdown:h,base:P})}function vr(){!m||!i||!i.postMessage||ia===m&&sa===h||Nn(m)}function la(){ia="",sa=null}function ca(e){la(),e&&i&&i.postMessage&&i.postMessage({type:"discardDraft",path:e})}function Re(e,t){O=e,je&&(clearTimeout(je),je=0),Oe=!O&&!!t,S(),!O&&t&&(je=setTimeout(function(){je=0,O||(Oe=!1,S())},3e3))}async function hr(e){if(ie)return br(),c("\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(),kt=(await J.getFile()).lastModified,P=e,Re(h!==e,h===e),c(n(h===e?"status.saved":"status.savedWithNewChanges")),la(),!0}catch(r){return c(n("status.saveFailed",{err:String(r)}),!0),!1}if(m){var a=++Ha;return c(n("status.saving")),Xt[a]=e,i.postMessage({type:"saveMarkdown",path:m,markdown:e,requestId:a}),new Promise(function(r){Ae[a]=r})}return c(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(),ga();return}t&&(e.key==="p"||e.key==="P")&&(e.preventDefault(),Ze(C==="edit"?"preview":"edit"))});function yr(){De&&(clearInterval(De),De=0),J=null}var ua=null;function Qe(e,t,a,r,o,s){if(!r&&O&&P!==null&&e!==P)return ie={markdown:e,name:t,path:a,diskBaseline:o},c(n("status.externalUpdateSkipped"),!0),br(),!1;var l=P!==null&&(!a||!m||a===m);return l||(ae=!0),h=e,Ve=t,a&&(m=a),V=In(a||m)||t||"Markdown",P=typeof o=="string"?o:h,ua=l?p.applyExternalValue(h):null,ua||p.setValue(h),Re(!1),Xa(V),s||we(),Ke(),Fe(),(v||C==="preview")&&Y(),!0}async function br(){if(!(oa||!ie||!O)){var e=ie,t=P;if(h===t){ie=null,Qe(e.markdown,e.name,e.path,!0,e.diskBaseline);return}if(e.markdown===t){ie=null;return}oa=!0;var a=await no();if(oa=!1,ie===e){if(a==="later"){c("AI \u5199\u56DE\u5DF2\u4FDD\u7559\u5728\u78C1\u76D8\uFF1B\u53EF\u7EE7\u7EED\u7F16\u8F91\u540E\u518D\u5904\u7406\u3002");return}if(ie=null,a==="remote"){ca(m),Qe(e.markdown,e.name,e.path,!0,e.diskBaseline);return}a==="local"&&(P=typeof e.diskBaseline=="string"?e.diskBaseline:e.markdown,vr(),c("\u5DF2\u4FDD\u7559\u672C\u5730\u7F16\u8F91\uFF1BAI \u5199\u56DE\u7248\u672C\u4ECD\u5728\u78C1\u76D8\u4E0A\u3002"))}}}async function wr(e){Ve=e.name,kt=e.lastModified,typeof e.path=="string"&&e.path?(m=e.path,i&&i.postMessage({type:"watchPath",path:m})):m="",Qe(await e.text(),Ve,m,!0)}function Wn(){J&&(De&&clearInterval(De),De=setInterval(async function(){if(!(Yt||!J)){Yt=!0;try{var e=await J.getFile();if(e.lastModified!==kt){kt=e.lastModified;var t=await e.text();t!==P&&Qe(t,Ve,m)&&c(n("status.externalUpdateApplied"))}}catch{}Yt=!1}},800))}var K=!1,et=0;function tt(){et&&(clearTimeout(et),et=0)}function qn(){tt(),et=setTimeout(function(){et=0,K&&(K=!1,ze=!1,S(),c(n("status.pickerTimeout"),!0))},2e4)}async function da(){if(O){var e=await Dr(n("confirm.message",{file:V||n("common.markdownDocDefault")}));if(e==="cancel")return;if(e==="save"){var t=await va();if(!t){c(n("status.saveFailedNoReturn"),!0);return}}else e==="discard"&&ca(m)}if(yr(),ze&&i&&i.postMessage){if(K){tt(),ze=!1,K=!1,S(),await Sr();return}K=!0,qn(),S(),c(n("status.openingPicker")),i.postMessage({type:"requestOpen"});return}await Sr()}async function Sr(){if("showOpenFilePicker"in window)try{var e=await window.showOpenFilePicker({types:[{description:"Markdown",accept:{"text/markdown":[".md",".markdown"]}}],multiple:!1});J=e[0],await wr(await J.getFile()),Wn();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&&wr(a).catch(function(r){c(String(r),!0)})},t.click()}function Hn(){window.focus(),document.body.tabIndex=-1;try{document.body.focus({preventScroll:!0})}catch{document.body.focus()}}async function zn(e){for(var t=0;t<e;t++){if(Hn(),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 kr(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=++Vr;he[o]={resolve:a,reject:r,sourceHtml:e},setTimeout(function(){he[o]&&(delete he[o],r(new Error(n("status.clipboardPrepareTimeout"))))},15e3),i.postMessage({type:"readClipboardImages",urls:t,requestId:o})})}function Un(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 Cr(e,t){if(document.hasFocus()||await zn(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 Vn(a)?"rich":_n(t)?"plain":"none"}function Vn(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 _n(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 jn(){if(!N){c(n("status.pleaseOpenArticle"),!0);return}try{var e=y.contentDocument&&y.contentDocument.body?y.contentDocument.body.innerText:N.replace(/<[^>]+>/g,""),t=await Cr(kr(N),e);t==="none"&&(await new Promise(function(a){setTimeout(a,200)}),t=await Cr(kr(N),e)),t==="rich"?c(n("status.copiedRich")):c(n(t==="plain"?"status.copiedPlainOnly":"status.copyFailed"),!0)}catch(a){c(n("status.richCopyFailed",{err:String(a)}),!0)}finally{C==="edit"&&requestAnimationFrame(function(){p.focus()})}}function Gn(){if(!Le||!y.contentDocument)return null;var e=y.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 pa(){var e=Gn();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(l){return Promise.reject(new Error(n("status.serializeFailed",{err:String(l)})))}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(l,u){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 b=f.getContext("2d");b.scale(t,t);var g="";try{g=y.contentWindow.getComputedStyle(e.root).backgroundColor}catch{g=""}g&&g!=="rgba(0, 0, 0, 0)"&&g!=="transparent"&&(b.fillStyle=g,b.fillRect(0,0,e.width,e.height)),b.drawImage(d,0,0,e.width,e.height),l({canvas:f,cssWidth:e.width,cssHeight:e.height})}catch(W){u(W)}},d.onerror=function(){u(new Error(n("status.imageConversionFailed")))},d.src=s})}function fa(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 Er(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 Xn(){if(!N){c(n("status.pleaseOpenArticle"),!0);return}if(!window.ClipboardItem||!navigator.clipboard||!navigator.clipboard.write){c(n("status.clipboardUnsupported"),!0);return}c(n("status.generatingImage"));var e=pa().then(function(a){if(!a)throw new Error(n("status.previewNotReady"));return fa(a.canvas,"image/png")});try{await navigator.clipboard.write([new ClipboardItem({"image/png":e})]),c(n("status.imageCopied"));return}catch{try{var t=await e;await navigator.clipboard.write([new ClipboardItem({"image/png":t})]),c(n("status.imageCopied"));return}catch(r){c(n("status.copyImageFailed",{err:r&&r.message?r.message:String(r)}),!0)}}}async function Yn(){if(!N){c(n("status.pleaseOpenArticle"),!0);return}try{c(n("status.generatingImage"));var e=await pa();if(!e){c(n("status.exportImageFailedGeneric"),!0);return}var t=await fa(e.canvas,"image/png"),a=await t.arrayBuffer(),r=Er(new Uint8Array(a));i&&i.postMessage&&i.postMessage({type:"exportFile",data:r,ext:"png",path:m,fileName:V,markdown:h})}catch(o){c(n("status.exportImageFailed",{err:String(o)}),!0)}}function Kn(e){for(var t=String(e);t.length<10;)t="0"+t;return t}function ee(e){for(var t=new Uint8Array(e.length),a=0;a<e.length;a++)t[a]=e.charCodeAt(a)&255;return t}function ma(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 Zn(e,t,a,r,o){var s=ee(`%PDF-1.4
|
|
16
22
|
%\xE2\xE3\xCF\xD3
|
|
17
|
-
`),l=[s],u=[0],d=s.length;function f(
|
|
23
|
+
`),l=[s],u=[0],d=s.length;function f(Ot){u.push(d),l.push(Ot),d+=Ot.length}f(ee(`1 0 obj
|
|
18
24
|
<< /Type /Catalog /Pages 2 0 R >>
|
|
19
25
|
endobj
|
|
20
|
-
`)),f(
|
|
26
|
+
`)),f(ee(`2 0 obj
|
|
21
27
|
<< /Type /Pages /Kids [3 0 R] /Count 1 >>
|
|
22
28
|
endobj
|
|
23
|
-
`)),f(
|
|
29
|
+
`)),f(ee(`3 0 obj
|
|
24
30
|
<< /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
31
|
endobj
|
|
26
|
-
`));var b=
|
|
32
|
+
`));var b=ee(`4 0 obj
|
|
27
33
|
<< /Type /XObject /Subtype /Image /Width `+t+" /Height "+a+" /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length "+e.length+` >>
|
|
28
34
|
stream
|
|
29
|
-
`),
|
|
35
|
+
`),g=ee(`
|
|
30
36
|
endstream
|
|
31
37
|
endobj
|
|
32
|
-
`);f(
|
|
33
|
-
<< /Length `+
|
|
38
|
+
`);f(ma([b,e,g]));var W="q "+r.toFixed(2)+" 0 0 "+o.toFixed(2)+" 0 0 cm /Im0 Do Q",_=ee(W);f(ma([ee(`5 0 obj
|
|
39
|
+
<< /Length `+_.length+` >>
|
|
34
40
|
stream
|
|
35
|
-
`),
|
|
41
|
+
`),_,ee(`
|
|
36
42
|
endstream
|
|
37
43
|
endobj
|
|
38
|
-
`)]));for(var
|
|
44
|
+
`)]));for(var te=d,se=[`xref
|
|
39
45
|
0 6
|
|
40
46
|
0000000000 65535 f
|
|
41
|
-
`],
|
|
42
|
-
`);var
|
|
47
|
+
`],re=1;re<=5;re++)se.push(Kn(u[re])+` 00000 n
|
|
48
|
+
`);var Pt=`trailer
|
|
43
49
|
<< /Size 6 /Root 1 0 R >>
|
|
44
50
|
startxref
|
|
45
|
-
`+
|
|
46
|
-
%%EOF`;return l.push(Q(ie.join("")+At)),ca(l)}async function Wn(){if(!N){c(n("status.pleaseOpenArticle"),!0);return}try{c(n("status.generatingPdf"));var e=await sa();if(!e){c(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,l=Hn(r,e.canvas.width,e.canvas.height,o,s),u=hr(l);i&&i.postMessage&&i.postMessage({type:"exportFile",data:u,ext:"pdf",path:m,fileName:U,markdown:h})}catch(d){c(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){c(String(r),!0)}).then(function(){e.disabled=!1}))})}tt(Ar,On),tt(Cr,Bn),tt(Dr,Nn),tt(Fr,Wn),tt(xe,zn);var yr="md-editor-actions-collapsed";(function(){var t=!1;try{t=localStorage.getItem(yr)==="1"}catch{}Re&&Re.classList.toggle("collapsed",t)})(),ka&&ka.addEventListener("click",function(e){e.preventDefault();var t=Re.classList.toggle("collapsed");try{localStorage.setItem(yr,t?"1":"0")}catch{}});function ua(){ur(h)}function It(e){if(Pr=e,!!xe){xe.classList.toggle("loading",e),xe.disabled=e;var t=xe.querySelector(".ic-ai-style"),a=xe.querySelector(".ic-ai-style-loading");t&&(t.hidden=e),a&&(a.hidden=!e)}}function br(){if(!h||!m||!i||!i.postMessage){c(n("status.pleaseOpenArticle"),!0);return}i.postMessage({type:"requestStyleSession",path:m,baseStyle:I}),It(!0),c(n("aiStyle.appViewDesigning"))}async function zn(){if(!h){c(n("status.pleaseOpenArticle"),!0);return}if(g||!i||!i.composer){br();return}var e=I==="custom"?n("aiStyle.baseNoteCustom"):n("aiStyle.baseNoteOther",{style:I});try{await i.composer.addContexts([{type:"annotation",label:n("aiStyle.label",{file:U||n("common.markdownDocDefault")}),note:n("aiStyle.note"),promptText:n("aiStyle.promptText",{baseNote:e,path:m||n("aiStyle.pathMissing")}),reminder:n("aiStyle.reminder")}]),c(n("aiStyle.requested"))}catch{br()}}function Un(){return{fontSize:z,fontFamily:J,comfortWriting:B,style:I,customCss:I==="custom"?R:"",customStyleLabel:I==="custom"?Me:""}}function Se(){i&&i.postMessage&&i.postMessage({type:"saveWritingPreferences",preferences:Un()})}function Vn(e){return!e||typeof e!="object"?!1:((e.fontSize===14||e.fontSize===16||e.fontSize===18)&&(z=e.fontSize),Le[e.fontFamily]&&(J=e.fontFamily),B=e.comfortWriting===!0,e.style==="custom"&&typeof e.customCss=="string"&&e.customCss?(I="custom",R=e.customCss,Me=typeof e.customStyleLabel=="string"?e.customStyleLabel:""):["kami","bauhaus","blueprint","botanical","newsprint","retro","sketch","terminal"].indexOf(e.style)!==-1&&(I=e.style,R="",Me=""),p.setFontSize(z),p.setFontFamily(Le[J]),p.setComfortWriting(B),!0)}function _n(e){I=e,Se(),(g||x==="preview")&&X(),k()}function jn(e){if(!(e!==14&&e!==16&&e!==18)){z=e,p.setFontSize(e);try{localStorage.setItem("md-editor-font-size",String(e))}catch{}Se(),k()}}function Gn(e){if(Le[e]){J=e,p.setFontFamily(Le[e]);try{localStorage.setItem("md-editor-font-family",e)}catch{}Se(),k()}}function wr(e){B=!!e,p.setComfortWriting(B);try{localStorage.setItem("md-editor-comfort-writing",B?"1":"0")}catch{}Se(),k(),c(n(B?"status.comfortWrite":"status.comfortRead"))}function Sr(){D=!D,D&&te?(te=!1,T()):!D&&!te&&(te=!0),p.setFocusMode(D),document.body.classList.toggle("focus-mode",D);try{localStorage.setItem("md-editor-focus-mode",D?"1":"0")}catch{}k(),c(n(D?"status.focusOn":"status.focusOff"))}var at=null;function rt(e){ue.hidden=!0;var t=at;at=null,t&&t(e)}function kr(e){return new Promise(function(t){at=t,xa.textContent=e,ue.hidden=!1,Be.focus()})}async function Xn(){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",Bt.textContent="\u7A0D\u540E\u5904\u7406",Nt.textContent="\u4FDD\u7559\u672C\u5730",Be.textContent="\u91C7\u7528 AI \u7248\u672C";var e=await new Promise(function(t){at=t,ue.hidden=!1,Be.focus()});return Ft(ue),e==="save"?"remote":e==="discard"?"local":"later"}Bt&&Bt.addEventListener("click",function(){rt("cancel")}),Nt&&Nt.addEventListener("click",function(){rt("discard")}),Be&&Be.addEventListener("click",function(){rt("save")}),ue&&ue.addEventListener("click",function(e){e.target===ue&&rt("cancel")}),document.addEventListener("keydown",function(e){e.key==="Escape"&&at&&rt("cancel")});async function da(){return await ur(h)}function Yn(){dr(),ra(),T(),h="",Ue="",U="",m="",P=null,me=null,N="",te=!1,x="edit",p&&p.setValue(""),za(n("home.title")),be(),Qa(""),i&&i.postMessage&&i.postMessage({type:"goHome"}),Ye(),De(),Oe(!1),c("")}async function nt(){if(O){var e=await kr(n("confirm.message",{file:U||n("common.markdownDocDefault")}));if(e==="cancel")return;if(i&&i.postMessage&&i.postMessage({type:"goHome"}),e==="save"){var t=await da();if(!t){c(n("status.saveFailedNoReturn"),!0);return}}else e==="discard"&&na(m)}Yn()}function xr(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(x==="edit"?"preview":"edit");return}if(e==="save"){ua();return}if(e==="reload"){X();return}if(e==="reveal"){m&&i&&i.postMessage&&i.postMessage({type:"openPath",path:m});return}if(e==="recentSession"){me&&i&&i.navigation&&i.navigation.openSession&&i.navigation.openSession(me);return}if(e&&e.indexOf("font-size:")===0){jn(Number(e.slice(10)));return}if(e&&e.indexOf("font-family:")===0){Gn(e.slice(12));return}if(e==="comfort:read"){wr(!1);return}if(e==="comfort:write"){wr(!0);return}if(e==="focus"){Sr();return}if(e==="about"){Br();return}if(e&&e.indexOf("style:slot-use:")===0){Jn(+e.slice(15));return}if(e&&e.indexOf("style:slot-save:")===0){Mr(+e.slice(16));return}if(e&&e.indexOf("style:")===0){_n(e.slice(6));return}}function pa(){[dt,pt,ft].forEach(function(e){e&&(e.hidden=!0)})}function Kn(e){if(e){var t=e.hidden;pa(),e.hidden=!t}}function fa(e,t){e&&e.addEventListener("click",function(a){a.stopPropagation(),Kn(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&&(xr(o),pa())}})}Ma&&Ma.addEventListener("click",nt),ct&&ct.addEventListener("click",ia),re&&re.addEventListener("click",ua),de&&de.addEventListener("click",Sr),Ne&&Ne.addEventListener("click",function(){G=!G,document.body.classList.toggle("preview-hidden",!G),k(),G&&requestAnimationFrame(function(){p.layout(),X()})}),fa(ut,dt),fa(qt,pt),fa(Tr,ft),document.addEventListener("click",pa);var ma=370,va=560,Er=480;ce&&ce.addEventListener("mousedown",function(e){e.preventDefault();var t=ce.parentElement;if(!t)return;var a=e.clientX,r=Rt?Rt.getBoundingClientRect().width:Er;ce.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 l(d){var f=d.clientX-a;t.style.setProperty("--preview-width",s(r-f)+"px")}function u(){ce.classList.remove("active"),o.remove(),window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",u)}window.addEventListener("mousemove",l),window.addEventListener("mouseup",u)}),window.addEventListener("resize",function(){if(g){var e=ce&&ce.parentElement;if(e){var t=parseFloat(getComputedStyle(e).getPropertyValue("--preview-width"))||Er;(t>va||t<ma)&&e.style.setProperty("--preview-width",Math.max(ma,Math.min(va,t))+"px")}}});function Jn(e){var t=W[e];t&&(R=t.css,Me=t.label,I="custom",Se(),c(n("status.appliedStyleSlot",{label:t.label})),x==="preview"?X():Ke("preview"),k())}function Mr(e){if(I!=="custom"||!R){c(n("status.needCustomStyleFirst"),!0);return}var t=Me||n("common.customStyleDefault");i&&i.postMessage&&i.postMessage({type:"saveStyleSlot",slot:e,css:R,label:t,path:m})}function $n(){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=W[t];r&&(a.title=r.label),a.addEventListener("click",function(){Mr(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(We=!!e.pickFileSupported,W=Array.isArray(e.styleSlots)?e.styleSlots:[null,null,null],Vn(e.writingPreferences)?g&&A()&&X():Se(),e.libraryGroups&&typeof e.libraryGroups=="object"?(pe=Array.isArray(e.libraryGroups.order)?e.libraryGroups.order.filter(function(se){return typeof se=="string"}):[],Ee=e.libraryGroups.collapsed&&typeof e.libraryGroups.collapsed=="object"?e.libraryGroups.collapsed:{},He.length&&Xt(He)):(pe.length||Object.keys(Ee).length)&&Gt(),typeof e.locale=="string"&&e.locale){var t=/^zh/i.test(e.locale);t!==it&&(it=t,Ft(),wt())}e.assistantName&&(Ge=e.assistantName,wt()),Ba(),e.homeDir&&(ye=e.homeDir,Hr()),k();return}if(e.type==="styleSlots"){W=Array.isArray(e.styleSlots)?e.styleSlots:[null,null,null],typeof e.savedSlot=="number"&&W[e.savedSlot]&&c(n("status.savedToSlot",{slot:e.savedSlot+1,label:W[e.savedSlot].label})),k();return}if(e.type==="clipboardImages"){var a=ge[e.requestId];if(a){delete ge[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(Fn(r))}return}if(e.type==="clipboardImagesError"){var s=ge[e.requestId];s&&(delete ge[e.requestId],s.reject(new Error(e.message||n("status.clipboardPrepareFailedDefault"))));return}if(e.type==="pastedImage"){var l=ve[e.requestId];l&&(delete ve[e.requestId],l.resolve(e.url));return}if(e.type==="pasteImageError"){var u=ve[e.requestId];u&&(delete ve[e.requestId],u.reject(new Error(e.message||n("status.pasteImageFailedDefault")))),c(n("status.pasteImageFailed",{msg:e.message||""}));return}if(e.type==="finch:env"){g=e.view==="appView",g&&(i&&i.panel&&i.panel.setTitle&&i.panel.setTitle(n("home.title")).catch(function(){}),be(),Yr()),g&&!Fa&&(Fa=!0,G=!1,document.body.classList.add("preview-hidden")),document.body.classList.toggle("app-view",g),Ea&&(Ea.hidden=!g),p.setAiHint(n("appview.hintSpace"),n("appview.hintSpaceCode"));var d=e.cwd||"",f=e.sessionId||"",b=e.spaceId||"";(d!==je||f!==_t||b!==jt||!bt)&&(je=d,_t=f,jt=b,bt=!0,kt([])),De(),be(),k(),g&&A()&&X(),(!Tt.hidden||g)&&St();return}if(e.type==="recentDocuments"){if(!e.library&&(e.cwd||"")!==je)return;kt(e.documents),e.library&&Xt(e.documents);return}if(e.type==="status"){c(e.message);return}if(e.type==="rewriteSessionStarted"){H=e.sessionId&&e.turnId?{sessionId:e.sessionId,turnId:e.turnId}:null,p.setAiWorkingLines(Number(e.startLine)||0,Number(e.endLine)||0),he(e.rewriteMode==="continue"?n("appview.continuing"):n("appview.rewriting"),!1,e.sessionId,0);return}if(e.type==="rewriteCancellationRequested"){H&&H.turnId===e.turnId&&(H.cancelling=!0),he(n("appview.cancelling"),!1,e.sessionId,0);return}if(e.type==="rewriteSessionFinished"){H=null,p.setAiWorkingLines(0,0),he(n("appview.rewriteDone"),!1,e.sessionId,5e3);return}if(e.type==="rewriteSessionFailed"){var v=H&&H.turnId===e.turnId&&H.cancelling;H=null,p.setAiWorkingLines(0,0),he(v?n("appview.cancelled"):e.message||"Rewrite failed.",!v,e.sessionId,5e3);return}if(e.type==="styleSessionStarted"){It(!0),he(n("aiStyle.appViewDesigning"),!1,e.sessionId,0);return}if(e.type==="styleSessionFinished"){It(!1),he(e.message||n("aiStyle.appViewDone"),!1,e.sessionId,5e3);return}if(e.type==="styleSessionFailed"){It(!1),he(e.message||n("aiStyle.appViewFailed"),!0,e.sessionId,5e3);return}if(e.type!=="lastFileUnavailable"){if(e.type==="lastSessionInfo"){me=e.sessionId||null,k(),_a();return}if(e.type==="finch:menu"){xr(e.itemId);return}if(e.type==="document"){var q=Y;Y=!1,et();var V=e.markdown||"",ee=e.path||"",ie=Number(e.revision)||0;if(ee&&ee===m&&ie&&ie<=$e)return;var ae=!!ee&&!!m&&ee!==m;if((ae||P===null)&&(me=null),ae&&Et&&ee!==Et){Fe===ee&&(Fe="");return}if(!ae&&V===P){ie&&($e=Math.max($e,ie)),k();return}var At=P===null,Ct=Xe;Xe=!1;var Zn=!!ee&&Fe===ee;Fe="";var Qn=Ze(V,e.title||n("common.markdownDocDefault"),e.path||m,q||At||ae,e.diskMarkdown,Zn);if(!Qn){k();return}if($e=ie||(ae?0:$e),e.draftRestored)Oe(!0),c(n("status.draftRestored"));else if(e.draftConflict)c(n("status.draftConflict"),!0);else if(Ct)c(n("status.opened",{file:U}));else if(!At){var K=oa;K&&K.hunks>1?c(n("status.contentUpdatedSpots",{count:K.hunks,lines:K.changedLines})):K&&K.fromLine===K.toLine?c(n("status.contentUpdatedLine",{line:K.fromLine})):c(K?n("status.contentUpdatedLines",{from:K.fromLine,to:K.toLine}):n("status.contentUpdated"))}return}if(e.type==="sourceMissing"){e.path&&e.path===m&&c(n("status.sourceMissing"),!0);return}if(e.type==="bmRendered"){if(e.requestId!==Pa)return;Qa(e.html||""),Ye(),Ve=!1,k(),c("");return}if(e.type==="savedMarkdown"){var ot=Ut[e.requestId];delete Ut[e.requestId];var Dt=Ae[e.requestId];if(delete Ae[e.requestId],e.requestId!==Oa||typeof ot!="string"){Dt&&Dt(!1);return}P=ot,Oe(h!==ot,h===ot),c(n(h===ot?"status.saved":"status.savedWithNewChanges")),Dt&&Dt(!0);return}if(e.type==="customStyleSet"){R=e.css||"",Me=e.label||n("common.customStyleDefault"),I="custom",Se(),typeof e.savedSlot=="number"?(W=Array.isArray(e.styleSlots)?e.styleSlots:W,c(n("status.savedAppliedToSlot",{labelPrefix:e.label?e.label+" \xB7 ":"",slot:e.savedSlot+1}))):$n(),x==="preview"?X():Ke("preview"),k();return}if(e.type==="exported"){c(n("status.exported",{path:e.path}));return}if(e.type!=="watchStarted"){if(e.type==="pickCancelled"){Y=!1,et(),k(),c("");return}if(e.type==="error"){Xe=!1,Et="",Fe="",Object.keys(Ae).forEach(function(se){var Lr=Ae[se];delete Ae[se],Lr&&Lr(!1)}),Y=!1,et(),e.fallback&&(We=!1),Ve=!1,k(),c(e.message,!0);return}}}}}),i&&i.postMessage&&i.postMessage({type:"panelReady"}),setTimeout(function(){!A()&&i&&i.postMessage&&i.postMessage({type:"requestLastFile"}),Ra||St()},400),Ft(),Ba(),wt(),Ye(),De()})();})();
|
|
51
|
+
`+te+`
|
|
52
|
+
%%EOF`;return l.push(ee(se.join("")+Pt)),ma(l)}async function $n(){if(!N){c(n("status.pleaseOpenArticle"),!0);return}try{c(n("status.generatingPdf"));var e=await pa();if(!e){c(n("status.exportPdfFailedGeneric"),!0);return}var t=await fa(e.canvas,"image/jpeg",.92),a=await t.arrayBuffer(),r=new Uint8Array(a),o=e.cssWidth*.75,s=e.cssHeight*.75,l=Zn(r,e.canvas.width,e.canvas.height,o,s),u=Er(l);i&&i.postMessage&&i.postMessage({type:"exportFile",data:u,ext:"pdf",path:m,fileName:V,markdown:h})}catch(d){c(n("status.exportPdfFailed",{err:String(d)}),!0)}}function at(e,t){e&&e.addEventListener("click",function(a){a.preventDefault(),!e.disabled&&(e.disabled=!0,Promise.resolve().then(t).catch(function(r){c(String(r),!0)}).then(function(){e.disabled=!1}))})}at(Br,jn),at(Nr,Xn),at(Wr,Yn),at(qr,$n),at(Ee,Jn);var xr="md-editor-actions-collapsed";(function(){var t=!1;try{t=localStorage.getItem(xr)==="1"}catch{}Be&&Be.classList.toggle("collapsed",t)})(),Ma&&Ma.addEventListener("click",function(e){e.preventDefault();var t=Be.classList.toggle("collapsed");try{localStorage.setItem(xr,t?"1":"0")}catch{}});function ga(){hr(h)}function Ft(e){if(zr=e,!!Ee){Ee.classList.toggle("loading",e),Ee.disabled=e;var t=Ee.querySelector(".ic-ai-style"),a=Ee.querySelector(".ic-ai-style-loading");t&&(t.hidden=e),a&&(a.hidden=!e)}}function Mr(){if(!h||!m||!i||!i.postMessage){c(n("status.pleaseOpenArticle"),!0);return}i.postMessage({type:"requestStyleSession",path:m,baseStyle:I}),Ft(!0),c(n("aiStyle.appViewDesigning"))}async function Jn(){if(!h){c(n("status.pleaseOpenArticle"),!0);return}if(v||!i||!i.composer){Mr();return}var e=I==="custom"?n("aiStyle.baseNoteCustom"):n("aiStyle.baseNoteOther",{style:I});try{await i.composer.addContexts([{type:"annotation",label:n("aiStyle.label",{file:V||n("common.markdownDocDefault")}),note:n("aiStyle.note"),promptText:n("aiStyle.promptText",{baseNote:e,path:m||n("aiStyle.pathMissing")}),reminder:n("aiStyle.reminder")}]),c(n("aiStyle.requested"))}catch{Mr()}}function Qn(){return{fontSize:z,fontFamily:$,comfortWriting:B,style:I,customCss:I==="custom"?R:"",customStyleLabel:I==="custom"?Me:""}}function ke(){i&&i.postMessage&&i.postMessage({type:"saveWritingPreferences",preferences:Qn()})}function eo(e){return!e||typeof e!="object"?!1:((e.fontSize===14||e.fontSize===16||e.fontSize===18)&&(z=e.fontSize),Ie[e.fontFamily]&&($=e.fontFamily),B=e.comfortWriting===!0,e.style==="custom"&&typeof e.customCss=="string"&&e.customCss?(I="custom",R=e.customCss,Me=typeof e.customStyleLabel=="string"?e.customStyleLabel:""):["kami","bauhaus","blueprint","botanical","newsprint","retro","sketch","terminal"].indexOf(e.style)!==-1&&(I=e.style,R="",Me=""),p.setFontSize(z),p.setFontFamily(Ie[$]),p.setComfortWriting(B),!0)}function to(e){I=e,ke(),(v||C==="preview")&&Y(),S()}function ao(e){if(!(e!==14&&e!==16&&e!==18)){z=e,p.setFontSize(e);try{localStorage.setItem("md-editor-font-size",String(e))}catch{}ke(),S()}}function ro(e){if(Ie[e]){$=e,p.setFontFamily(Ie[e]);try{localStorage.setItem("md-editor-font-family",e)}catch{}ke(),S()}}function Ir(e){B=!!e,p.setComfortWriting(B);try{localStorage.setItem("md-editor-comfort-writing",B?"1":"0")}catch{}ke(),S(),c(n(B?"status.comfortWrite":"status.comfortRead"))}function Lr(e){if(!(e!=="character"&&e!=="word"||U===e)){U=e;try{localStorage.setItem("md-editor-word-count-mode",U)}catch{}S()}}function Ar(){F=!F,F&&ae?(ae=!1,T()):!F&&!ae&&(ae=!0),p.setFocusMode(F),document.body.classList.toggle("focus-mode",F);try{localStorage.setItem("md-editor-focus-mode",F?"1":"0")}catch{}S(),c(n(F?"status.focusOn":"status.focusOff"))}var rt=null;function nt(e){de.hidden=!0;var t=rt;rt=null,t&&t(e)}function Dr(e){return new Promise(function(t){rt=t,Ia.textContent=e,de.hidden=!1,Ne.focus()})}async function no(){Ia.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",zt.textContent="\u7A0D\u540E\u5904\u7406",Ut.textContent="\u4FDD\u7559\u672C\u5730",Ne.textContent="\u91C7\u7528 AI \u7248\u672C";var e=await new Promise(function(t){rt=t,de.hidden=!1,Ne.focus()});return Bt(de),e==="save"?"remote":e==="discard"?"local":"later"}zt&&zt.addEventListener("click",function(){nt("cancel")}),Ut&&Ut.addEventListener("click",function(){nt("discard")}),Ne&&Ne.addEventListener("click",function(){nt("save")}),de&&de.addEventListener("click",function(e){e.target===de&&nt("cancel")}),document.addEventListener("keydown",function(e){e.key==="Escape"&&rt&&nt("cancel")});async function va(){return await hr(h)}function oo(){yr(),la(),T(),h="",Ve="",V="",m="",P=null,ge=null,N="",ae=!1,C="edit",p&&p.setValue(""),Xa(n("home.title")),we(),ir(""),i&&i.postMessage&&i.postMessage({type:"goHome"}),Ke(),Fe(),Re(!1),c("")}async function ot(){if(O){var e=await Dr(n("confirm.message",{file:V||n("common.markdownDocDefault")}));if(e==="cancel")return;if(i&&i.postMessage&&i.postMessage({type:"goHome"}),e==="save"){var t=await va();if(!t){c(n("status.saveFailedNoReturn"),!0);return}}else e==="discard"&&ca(m)}oo()}function Fr(e){if(i&&i.postMessage&&i.postMessage({type:"clientLog",message:"finch:menu received, itemId="+e}),e==="home"){ot();return}if(e==="open"){da();return}if(e==="mode"){Ze(C==="edit"?"preview":"edit");return}if(e==="save"){ga();return}if(e==="reload"){Y();return}if(e==="reveal"){m&&i&&i.postMessage&&i.postMessage({type:"openPath",path:m});return}if(e==="recentSession"){ge&&i&&i.navigation&&i.navigation.openSession&&i.navigation.openSession(ge);return}if(e&&e.indexOf("font-size:")===0){ao(Number(e.slice(10)));return}if(e&&e.indexOf("font-family:")===0){ro(e.slice(12));return}if(e==="comfort:read"){Ir(!1);return}if(e==="comfort:write"){Ir(!0);return}if(e==="word-count:character"){Lr("character");return}if(e==="word-count:word"){Lr("word");return}if(e==="focus"){Ar();return}if(e==="about"){_r();return}if(e&&e.indexOf("style:slot-use:")===0){so(+e.slice(15));return}if(e&&e.indexOf("style:slot-save:")===0){Pr(+e.slice(16));return}if(e&&e.indexOf("style:")===0){to(e.slice(6));return}}function ha(){[pt,gt,vt,ht].forEach(function(e){e&&(e.hidden=!0)})}function io(e){if(e){var t=e.hidden;ha(),e.hidden=!t}}function Tt(e,t){e&&e.addEventListener("click",function(a){a.stopPropagation(),io(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&&(Fr(o),ha())}})}Aa&&Aa.addEventListener("click",ot),ut&&ut.addEventListener("click",da),ne&&ne.addEventListener("click",ga),pe&&pe.addEventListener("click",Ar),We&&We.addEventListener("click",function(){X=!X,document.body.classList.toggle("preview-hidden",!X),S(),X&&requestAnimationFrame(function(){p.layout(),Y()})}),Tt(dt,pt),Tt(ft,gt),Tt(Vt,vt),Tt(Hr,ht),document.addEventListener("click",ha);var ya=370,ba=560,Tr=480;ue&&ue.addEventListener("mousedown",function(e){e.preventDefault();var t=ue.parentElement;if(!t)return;var a=e.clientX,r=Ht?Ht.getBoundingClientRect().width:Tr;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(ya,Math.min(ba,d))}function l(d){var f=d.clientX-a;t.style.setProperty("--preview-width",s(r-f)+"px")}function u(){ue.classList.remove("active"),o.remove(),window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",u)}window.addEventListener("mousemove",l),window.addEventListener("mouseup",u)}),window.addEventListener("resize",function(){if(v){var e=ue&&ue.parentElement;if(e){var t=parseFloat(getComputedStyle(e).getPropertyValue("--preview-width"))||Tr;(t>ba||t<ya)&&e.style.setProperty("--preview-width",Math.max(ya,Math.min(ba,t))+"px")}}});function so(e){var t=H[e];t&&(R=t.css,Me=t.label,I="custom",ke(),c(n("status.appliedStyleSlot",{label:t.label})),C==="preview"?Y():Ze("preview"),S())}function Pr(e){if(I!=="custom"||!R){c(n("status.needCustomStyleFirst"),!0);return}var t=Me||n("common.customStyleDefault");i&&i.postMessage&&i.postMessage({type:"saveStyleSlot",slot:e,css:R,label:t,path:m})}function lo(){E&&(clearTimeout(E),E=0),x.replaceChildren(document.createTextNode(n("aiStyle.applied")+" ")),x.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=H[t];r&&(a.title=r.label),a.addEventListener("click",function(){Pr(t)}),x.appendChild(a)})(e);E=setTimeout(function(){E=0,x.replaceChildren(),x.className="status"},12e3)}i&&i.onMessage&&i.onMessage(function(e){if(!(!e||typeof e!="object")){if(e.type==="ready"){if(ze=!!e.pickFileSupported,H=Array.isArray(e.styleSlots)?e.styleSlots:[null,null,null],eo(e.writingPreferences)?v&&L()&&Y():ke(),e.libraryGroups&&typeof e.libraryGroups=="object"?(fe=Array.isArray(e.libraryGroups.order)?e.libraryGroups.order.filter(function(le){return typeof le=="string"}):[],xe=e.libraryGroups.collapsed&&typeof e.libraryGroups.collapsed=="object"?e.libraryGroups.collapsed:{},He.length&&Jt(He)):(fe.length||Object.keys(xe).length)&&$t(),typeof e.locale=="string"&&e.locale){var t=/^zh/i.test(e.locale);t!==st&&(st=t,Bt(),Et())}e.assistantName&&(Xe=e.assistantName,Et()),Ua(),e.homeDir&&(be=e.homeDir,Xr()),S();return}if(e.type==="styleSlots"){H=Array.isArray(e.styleSlots)?e.styleSlots:[null,null,null],typeof e.savedSlot=="number"&&H[e.savedSlot]&&c(n("status.savedToSlot",{slot:e.savedSlot+1,label:H[e.savedSlot].label})),S();return}if(e.type==="clipboardImages"){var a=he[e.requestId];if(a){delete he[e.requestId];var r=a.sourceHtml,o=e.images&&typeof e.images=="object"?e.images:{};Object.keys(o).forEach(function(le){typeof o[le]=="string"&&(r=r.split(le).join(o[le]))}),a.resolve(Un(r))}return}if(e.type==="clipboardImagesError"){var s=he[e.requestId];s&&(delete he[e.requestId],s.reject(new Error(e.message||n("status.clipboardPrepareFailedDefault"))));return}if(e.type==="pastedImage"){var l=ve[e.requestId];l&&(delete ve[e.requestId],l.resolve(e.url));return}if(e.type==="pasteImageError"){var u=ve[e.requestId];u&&(delete ve[e.requestId],u.reject(new Error(e.message||n("status.pasteImageFailedDefault")))),c(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(){}),we(),an()),v&&!Na&&(Na=!0,X=!1,document.body.classList.add("preview-hidden")),document.body.classList.toggle("app-view",v),La&&(La.hidden=!v),p.setAiHint(n("appview.hintSpace"),n("appview.hintSpaceCode"));var d=e.cwd||"",f=e.sessionId||"",b=e.spaceId||"";(d!==Ge||f!==Kt||b!==Zt||!Ct)&&(Ge=d,Kt=f,Zt=b,Ct=!0,Mt([])),Fe(),we(),S(),v&&L()&&Y(),(!Nt.hidden||v)&&xt();return}if(e.type==="recentDocuments"){if(!e.library&&(e.cwd||"")!==Ge)return;Mt(e.documents),e.library&&Jt(e.documents);return}if(e.type==="status"){c(e.message);return}if(e.type==="rewriteSessionStarted"){q=e.sessionId&&e.turnId?{sessionId:e.sessionId,turnId:e.turnId}:null,p.setAiWorkingLines(Number(e.startLine)||0,Number(e.endLine)||0),ye(e.rewriteMode==="continue"?n("appview.continuing"):n("appview.rewriting"),!1,e.sessionId,0);return}if(e.type==="rewriteCancellationRequested"){q&&q.turnId===e.turnId&&(q.cancelling=!0),ye(n("appview.cancelling"),!1,e.sessionId,0);return}if(e.type==="rewriteSessionFinished"){q=null,p.setAiWorkingLines(0,0),ye(n("appview.rewriteDone"),!1,e.sessionId,5e3);return}if(e.type==="rewriteSessionFailed"){var g=q&&q.turnId===e.turnId&&q.cancelling;q=null,p.setAiWorkingLines(0,0),ye(g?n("appview.cancelled"):e.message||"Rewrite failed.",!g,e.sessionId,5e3);return}if(e.type==="styleSessionStarted"){Ft(!0),ye(n("aiStyle.appViewDesigning"),!1,e.sessionId,0);return}if(e.type==="styleSessionFinished"){Ft(!1),ye(e.message||n("aiStyle.appViewDone"),!1,e.sessionId,5e3);return}if(e.type==="styleSessionFailed"){Ft(!1),ye(e.message||n("aiStyle.appViewFailed"),!0,e.sessionId,5e3);return}if(e.type!=="lastFileUnavailable"){if(e.type==="lastSessionInfo"){ge=e.sessionId||null,S(),Za();return}if(e.type==="finch:menu"){Fr(e.itemId);return}if(e.type==="document"){var W=K;K=!1,tt();var _=e.markdown||"",te=e.path||"",se=Number(e.revision)||0;if(te&&te===m&&se&&se<=Je)return;var re=!!te&&!!m&&te!==m;if((re||P===null)&&(ge=null),re&&Lt&&te!==Lt){Te===te&&(Te="");return}if(!re&&_===P){se&&(Je=Math.max(Je,se)),S();return}var Pt=P===null,Ot=Ye;Ye=!1;var co=!!te&&Te===te;Te="";var uo=Qe(_,e.title||n("common.markdownDocDefault"),e.path||m,W||Pt||re,e.diskMarkdown,co);if(!uo){S();return}if(Je=se||(re?0:Je),e.draftRestored)Re(!0),c(n("status.draftRestored"));else if(e.draftConflict)c(n("status.draftConflict"),!0);else if(Ot)c(n("status.opened",{file:V}));else if(!Pt){var Z=ua;Z&&Z.hunks>1?c(n("status.contentUpdatedSpots",{count:Z.hunks,lines:Z.changedLines})):Z&&Z.fromLine===Z.toLine?c(n("status.contentUpdatedLine",{line:Z.fromLine})):c(Z?n("status.contentUpdatedLines",{from:Z.fromLine,to:Z.toLine}):n("status.contentUpdated"))}return}if(e.type==="sourceMissing"){e.path&&e.path===m&&c(n("status.sourceMissing"),!0);return}if(e.type==="bmRendered"){if(e.requestId!==qa)return;ir(e.html||""),Ke(),_e=!1,S(),c("");return}if(e.type==="savedMarkdown"){var it=Xt[e.requestId];delete Xt[e.requestId];var Rt=Ae[e.requestId];if(delete Ae[e.requestId],e.requestId!==Ha||typeof it!="string"){Rt&&Rt(!1);return}P=it,Re(h!==it,h===it),c(n(h===it?"status.saved":"status.savedWithNewChanges")),Rt&&Rt(!0);return}if(e.type==="customStyleSet"){R=e.css||"",Me=e.label||n("common.customStyleDefault"),I="custom",ke(),typeof e.savedSlot=="number"?(H=Array.isArray(e.styleSlots)?e.styleSlots:H,c(n("status.savedAppliedToSlot",{labelPrefix:e.label?e.label+" \xB7 ":"",slot:e.savedSlot+1}))):lo(),C==="preview"?Y():Ze("preview"),S();return}if(e.type==="exported"){c(n("status.exported",{path:e.path}));return}if(e.type!=="watchStarted"){if(e.type==="pickCancelled"){K=!1,tt(),S(),c("");return}if(e.type==="error"){Ye=!1,Lt="",Te="",Object.keys(Ae).forEach(function(le){var Or=Ae[le];delete Ae[le],Or&&Or(!1)}),K=!1,tt(),e.fallback&&(ze=!1),_e=!1,S(),c(e.message,!0);return}}}}}),i&&i.postMessage&&i.postMessage({type:"panelReady"}),setTimeout(function(){!L()&&i&&i.postMessage&&i.postMessage({type:"requestLastFile"}),za||xt()},400),Bt(),Ua(),Et(),Ke(),Fe()})();})();
|
package/package.json
CHANGED