digital-garden/.obsidian/plugins/obsidian-enhancing-export/main.js

31 lines
170 KiB
JavaScript
Raw Normal View History

2024-06-13 21:01:37 +03:00
"use strict";var dl=(e,l,t)=>{if(!l.has(e))throw TypeError("Cannot "+t)};var gl=(e,l,t)=>(dl(e,l,"read from private field"),t?t.call(e):l.get(e)),bl=(e,l,t)=>{if(l.has(e))throw TypeError("Cannot add the same private member more than once");l instanceof WeakSet?l.add(e):l.set(e,t)},Zl=(e,l,t,n)=>(dl(e,l,"write to private field"),n?n.call(e,t):l.set(e,t),t);/*!
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository https://github.com/mokeyish/obsidian-enhancing-export .
*/Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Ge=require("obsidian"),kn=require("child_process"),pt=require("process"),Ol=require("electron"),Pl=require("fs"),oe=require("path"),Sn=require("util");function Pt(e){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(l,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return l.default=e,Object.freeze(l)}const wn=Pt(Ge),ye=Pt(Ol),Jt=Pt(Pl),dt={Markdown:{name:"Markdown",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/markdown.lua" -s -o "${outputPath}" -t commonmark_x-attributes',extension:".md"},"Markdown (Hugo)":{name:"Markdown (Hugo)",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/markdown+hugo.lua" -s -o "${outputPath}" -t commonmark_x-attributes',extension:".md"},Html:{name:"Html",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/math_block.lua" --embed-resources --standalone --metadata title="${currentFileName}" -s -o "${outputPath}" -t html',customArguments:'--mathjax="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg-full.js"',extension:".html"},TextBundle:{name:"TextBundle",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/markdown.lua" -V media_dir="${outputDir}/${outputFileName}.textbundle/assets" -s -o "${outputDir}/${outputFileName}.textbundle/text.md" -t commonmark_x-attributes',extension:".md"},Typst:{name:"Typst",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/markdown.lua" -s -o "${outputPath}" -t typst',extension:".typ"},PDF:{name:"PDF",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/pdf.lua" ${ options.textemplate ? `--resource-path="${pluginDir}/textemplate" --template="${options.textemplate}"` : ` ` } -o "${outputPath}" -t pdf',customArguments:"--pdf-engine=pdflatex",optionsMeta:{textemplate:"preset:textemplate"},extension:".pdf"},"Word (.docx)":{name:"Word (.docx)",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -o "${outputPath}" -t docx',extension:".docx"},OpenOffice:{name:"OpenOffice",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -o "${outputPath}" -t odt',extension:".odt"},RTF:{name:"RTF",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -s -o "${outputPath}" -t rtf',extension:".rtf"},Epub:{name:"Epub",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -o "${outputPath}" -t epub',extension:".epub"},Latex:{name:"Latex",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" ${ options.textemplate ? `--resource-path="${pluginDir}/textemplate" --template="${options.textemplate}"` : ` ` } --extract-media="${outputDir}" -s -o "${outputPath}" -t latex',optionsMeta:{textemplate:"preset:textemplate"},extension:".tex"},"Media Wiki":{name:"Media Wiki",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -s -o "${outputPath}" -t mediawiki',extension:".mediawiki"},reStructuredText:{name:"reStructuredText",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -s -o "${outputPath}" -t rst',extension:".rst"},Textile:{name:"Textile",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resou
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*/function Te(e){if(e!==e.toLowerCase()&&e!==e.toUpperCase()||(e=e.toLowerCase()),e.indexOf("-")===-1&&e.indexOf("_")===-1)return e;{let t="",n=!1;const c=e.match(/^-+/);for(let i=c?c[0].length:0;i<e.length;i++){let s=e.charAt(i);n&&(n=!1,s=s.toUpperCase()),i!==0&&(s==="-"||s==="_")?n=!0:s!=="-"&&s!=="_"&&(t+=s)}return t}}function bn(e,l){const t=e.toLowerCase();l=l||"-";let n="";for(let c=0;c<e.length;c++){const i=t.charAt(c),s=e.charAt(c);i!==s&&c>0?n+=`${l}${t.charAt(c)}`:n+=s}return n}function Zn(e){return e==null?!1:typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^0[^.]/.test(e)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}/**
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*/function pc(e){if(Array.isArray(e))return e.map(s=>typeof s!="string"?s+"":s);e=e.trim();let l=0,t=null,n=null,c=null;const i=[];for(let s=0;s<e.length;s++){if(t=n,n=e.charAt(s),n===" "&&!c){t!==" "&&l++;continue}n===c?c=null:(n==="'"||n==='"')&&!c&&(c=n),i[l]||(i[l]=""),i[l]+=n}return i}/**
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*/var ue;(function(e){e.BOOLEAN="boolean",e.STRING="string",e.NUMBER="number",e.ARRAY="array"})(ue||(ue={}));/**
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*/let Re;class Xc{constructor(l){Re=l}parse(l,t){const n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},t),c=pc(l),i=typeof l=="string",s=fc(Object.assign(Object.create(null),n.alias)),a=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),o=Object.assign(Object.create(null),n.default),g=n.configObjects||[],b=n.envPrefix,G=a["populate--"],J=G?"--":"_",W=Object.create(null),x=Object.create(null),L=n.__||Re.format,u={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},j=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,w=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(r){const Z=typeof r=="object"?r.key:r,h=Object.keys(r).map(function(m){return{boolean:"bools",string:"strings",number:"numbers"}[m]}).filter(Boolean).pop();h&&(u[h][Z]=!0),u.arrays[Z]=!0,u.keys.push(Z)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(r){u.bools[r]=!0,u.keys.push(r)}),[].concat(n.string||[]).filter(Boolean).forEach(function(r){u.strings[r]=!0,u.keys.push(r)}),[].concat(n.number||[]).filter(Boolean).forEach(function(r){u.numbers[r]=!0,u.keys.push(r)}),[].concat(n.count||[]).filter(Boolean).forEach(function(r){u.counts[r]=!0,u.keys.push(r)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(r){u.normalize[r]=!0,u.keys.push(r)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([r,Z])=>{typeof Z=="number"&&(u.nargs[r]=Z,u.keys.push(r))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([r,Z])=>{typeof Z=="function"&&(u.coercions[r]=Z,u.keys.push(r))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(r){u.configs[r]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([r,Z])=>{(typeof Z=="boolean"||typeof Z=="function")&&(u.configs[r]=Z)})),_(n.key,s,n.default,u.arrays),Object.keys(o).forEach(function(r){(u.aliases[r]||[]).forEach(function(Z){o[Z]=o[r]})});let E=null;vn();let M=[];const K=Object.assign(Object.create(null),{_:[]}),ie={};for(let r=0;r<c.length;r++){const Z=c[r],h=Z.replace(/^-{3,}/,"---");let m,d,B,Y,F,D;if(Z!=="--"&&/^-/.test(Z)&&He(Z))ge(Z);else if(h.match(/^---+(=|$)/)){ge(Z);continue}else if(Z.match(/^--.+=/)||!a["short-option-groups"]&&Z.match(/^-.+=/))Y=Z.match(/^--?([^=]+)=([\s\S]*)$/),Y!==null&&Array.isArray(Y)&&Y.length>=3&&(A(Y[1],u.arrays)?r=X(r,Y[1],c,Y[2]):A(Y[1],u.nargs)!==!1?r=p(r,Y[1],c,Y[2]):R(Y[1],Y[2],!0));else if(Z.match(w)&&a["boolean-negation"])Y=Z.match(w),Y!==null&&Array.isArray(Y)&&Y.length>=2&&(d=Y[1],R(d,A(d,u.arrays)?[!1]:!1));else if(Z.match(/^--.+/)||!a["short-option-groups"]&&Z.match(/^-[^-]+/))Y=Z.match(/^--?(.+)/),Y!==null&&Array.isArray(Y)&&Y.length>=2&&(d=Y[1],A(d,u.arrays)?r=X(r,d,c):A(d,u.nargs)!==!1?r=p(r,d,c):(F=c[r+1],F!==void 0&&(!F.match(/^-/)||F.match(j))&&!A(d,u.bools)&&!A(d,u.counts)||/^(true|false)$/.test(F)?(R(d,F),r++):R(d,Ne(d))));else if(Z.match(/^-.\..+=/))Y=Z.match(/^-([^=]+)=([\s\S]*)$/),Y!==null&&Array.isArray(Y)&&Y.length>=3&&R(Y[1],Y[2]);else if(Z.match(/^-.\..+/)&&!Z.match(j))F=c[r+1],Y=Z.match(/^-(.\..+)/),Y!==null&&Array.isArray(Y)&&Y.length>=2&&(d=Y[1],F!==void 0&&!F.match(/^-/)&&!A(d,u.bools)&&!A(d,u.counts)?(R(d,F),r++):R(d,Ne(d)));else if(Z.match(/^-[^-]+/)&&!Z.match(j)){B=Z.slice(1,
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
* CJS and ESM environments.
*
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*/var Ft,Ht,Nt;const Xl=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,fl=(Ht=(Ft=process==null?void 0:process.versions)===null||Ft===void 0?void 0:Ft.node)!==null&&Ht!==void 0?Ht:(Nt=process==null?void 0:process.version)===null||Nt===void 0?void 0:Nt.slice(1);if(fl&&Number(fl.match(/^([^.]+)/)[1])<Xl)throw Error(`yargs parser supports a minimum Node.js version of ${Xl}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const Vc=process?process.env:{},un=new Xc({cwd:process.cwd,env:()=>Vc,format:Sn.format,normalize:oe.normalize,resolve:oe.resolve,require:e=>{if(typeof require<"u")return require(e);if(e.match(/\.json$/))return JSON.parse(Pl.readFileSync(e,"utf8"));throw Error("only .json config files are supported in ESM")}}),lt=function(l,t){return un.parse(l.slice(),t).argv};lt.detailed=function(e,l){return un.parse(e.slice(),l)};lt.camelCase=Te;lt.decamelize=bn;lt.looksLikeNumber=Zn;const Ac={exportToOo:"导出为......",exportWithPrevious:"使用上一次设置导出",exportSuccessNotice:T`导出文件 ${0} 成功!`,exportCommandOutputMessage:T`命令:${0}`,exportErrorOutputMessage:T`命令 ${0},错误:${1}`,pleaseOpenFile:"请打开一个文件先。",preparing:T`正在生成 "${0}" ......`,exportDialog:{fileName:"文件名",type:"类型",exportTo:"导出到",title:T`导出为 ${0}`,export:"导出",selectExportFolder:"请选择导出文件夹",overwriteConfirmation:"覆盖提示"},messageBox:{yes:"是",no:"否",ok:"确认",cancel:"取消"},overwriteConfirmationDialog:{replace:"替换",title:T`"${0}" 已经存在。您要替换它吗?`,message:T`"${0}" 文件夹中已有相同的文件或文件夹,若替换,则会覆盖其当前内容。`},settingTab:{title:"导出设置",general:"通用",name:"名称",customLocation:"自定义",pandocVersion:T`版本: ${0}`,pandocVersionWithWarning:T`Version: ${0}, 请升级版本到 ${1}`,pandocNotFound:"找不到 Pandoc请填写 Pandoc 文件路径,或者将其添加到系统环境变量中。",pandocPath:"Pandoc 路径",defaultFolderForExportedFile:"默认的导出文件夹",openExportedFileLocation:"打开导出文件所在目录",sameFolderWithCurrentFile:"与原文件同一目录下",openExportedFile:"打开导出文件",pandocPathPlaceholder:"(自动检测)",editCommandTemplate:"编辑命令模板",chooseCommandTemplate:"选择模板",afterExport:"导出后",command:"命令",arguments:"参数",auto:"自动",reset:"重置",add:"添加",remove:"移除",rename:"重命名",targetFileExtensions:"目标文件扩展名",targetFileExtensionsTip:"(用空格分开)",showCommandOutput:"显示命令行输出",runCommand:"运行自定义命令",extraArguments:"自定义参数",save:"保存",new:"新建",template:"模板",advanced:"高级",environmentVariables:"环境变量",environmentVariablesDesc:"定义导出的环境变量.",ShowExportProgressBar:"显示导出进度条"}},Yc={exportToOo:"Export to...",exportSuccessNotice:T`Export file ${0} success!`,exportCommandOutputMessage:T`Command: ${0}`,exportErrorOutputMessage:T`Command: ${0}Error:${1}`,exportWithPrevious:"Export with Previous",pleaseOpenFile:"Please open a file first.",preparing:T`generating "${0}"...`,exportDialog:{exportTo:"Export to",fileName:"File Name",title:T`Export to ${0}`,export:"Export",selectExportFolder:"Please select an export folder.",overwriteConfirmation:"Overwrite confirmation",type:"Type"},messageBox:{yes:"Yes",no:"No",ok:"Ok",cancel:"Cancel"},overwriteConfirmationDialog:{replace:"Replace",title:T`"${0}" already exists. Do you want to replace it?`,message:T`A file or folder with the same name already exists in the folder "${0}". Replacing it will overwrite its current contents.`},settingTab:{general:"General",name:"Name",title:"Export Settings",pandocVersion:T`Version: ${0}`,pandocVersionWithWarning:T`Version: ${0}, please upgrade version to ${1}`,pandocNotFound:"Pandoc not found, please fill in the Pandoc file path, or add it to the system environment variables.",defaultFold
`)).replace("pandoc.exe","").replace("pandoc","").trim();let n=[...t].filter(c=>c===".").length;for(;n>2;)t=t.substring(0,t.lastIndexOf(".")),n-=1;return fs.parse(t)}const Vs="3.1.7",Zt={normalizePath:fn,getVersion:Rs,requiredVersion:Vs};async function Rn(e,l,t,n,c,i,s,a,o,g){const{settings:b,lang:G,manifest:J,app:{vault:{adapter:W,config:x},loadProgress:L,metadataCache:u}}=e;if(!n){const le=Dl(c);n=`${l.basename}${le}`}i==null&&(i=b.showOverwriteConfirmation);const j=b.showExportProgressBar,w=W.getBasePath(),E=`${w}/${J.dir}`,M=`${E}/lua`,K=t,ie=`${K}/${n}`,ge=n.substring(0,n.lastIndexOf(".")),p=n,X=W.getFullPath(l.path),R=oe.dirname(X),v=l.basename,be=l.name;let C=x.attachmentFolderPath??"/";C==="/"?C=w:C.startsWith(".")?C=oe.join(R,C.substring(1)):C=oe.join(w,C);let f=null;try{f=u.getCache(l.path).frontmatter}catch(le){console.error(le)}const V={pluginDir:E,luaDir:M,outputDir:K,outputPath:ie,outputFileName:ge,outputFileFullName:p,currentDir:R,currentPath:X,currentFileName:v,currentFileFullName:be,attachmentFolderPath:C,vaultDir:w,metadata:f,options:s,fromFormat:app.vault.config.useMarkdownLinks?"markdown":"markdown+wikilinks_title_after_pipe"},H=c.type==="custom"&&c.showCommandOutput,N=c.openExportedFileLocation??b.openExportedFileLocation,y=c.openExportedFile??b.openExportedFile;if(i&&Jt.existsSync(ie)){const le=await ye.remote.dialog.showSaveDialog({title:G.overwriteConfirmationDialog.title(p),defaultPath:ie,properties:["showOverwriteConfirmation","createDirectory"]});if(le.canceled)return;V.outputPath=le.filePath,V.outputDir=oe.dirname(V.outputPath),V.outputFileFullName=oe.basename(V.outputPath),V.outputFileName=oe.basename(V.outputFileFullName,oe.extname(V.outputFileFullName))}j&&(L.setMessage(G.preparing(V.outputFileFullName)),g==null||g(),L.show());const k=V.env=_l(de(b.env)??{},V);let Q=Zt.normalizePath(de(b.pandocPath));if(pt.platform==="win32"){Q=Q.replaceAll("\\","/");const le=["pluginDir","luaDir","outputDir","outputPath","currentDir","currentPath","attachmentFolderPath","vaultDir"];for(const Xe of le){const He=V[Xe];V[Xe]=He.replaceAll("\\","/")}}const S=c.type==="pandoc"?`${Q} "\${currentPath}" ${c.arguments??""} ${c.customArguments??""}`:c.command,z=zt(S,V),_=lt(z.match(/(?:[^\s"]+|"[^"]*")+/g),{alias:{output:["o"]}}),A=oe.normalize(En(_.output)),Ze=oe.dirname(A);Jt.existsSync(Ze)||Jt.mkdirSync(Ze);try{console.log(`[${e.manifest.name}]: export command and options:`,{cmd:z,options:{cwd:V.currentDir,env:k}}),await Qt(z,{cwd:V.currentDir,env:k}),j&&L.hide();const le=async()=>{if(N&&setTimeout(()=>{ye.remote.shell.showItemInFolder(A)},1e3),y&&await ye.remote.shell.openPath(A),c.type==="pandoc"&&c.runCommand===!0&&c.command){const Xe=zt(c.command,V);await Qt(Xe,{cwd:V.currentDir,env:k})}a&&a()};if(H){const Xe=new Rl(app,G.exportCommandOutputMessage(z));Xe.onClose=le,Xe.open()}else new Ge.Notice(G.exportSuccessNotice(V.outputFileFullName),1500),await le()}catch(le){L.hide(),new Rl(app,G.exportErrorOutputMessage(z,le)).open(),o&&o()}}const Mt=e=>{const l=new Ge.Modal(e.app);let t=[],n=!1;return Ye(()=>{se(l.titleEl,()=>e.title)}),Ye(()=>{se(l.contentEl,()=>e.children)}),Ye(()=>{const c=Object.entries(e.classList??{}).filter(([,i])=>i).map(([i])=>i);t.length>0&&l.containerEl.removeClasses(t),c.length>0&&l.containerEl.addClasses(c),t=c}),Ye(()=>{l.containerEl.style.display=e.hidden?"None":""}),l.onClose=()=>{n||(n=!0,e.onClose())},tn(()=>l.open()),et(()=>{n||l.close()}),document.createTextNode("")};var As=Ie("<button>");const Ot=e=>(()=>{var l=As();return qt(l,"click",e.onClick,!0),se(l,()=>e.children),ee(()=>l.classList.toggle("mod-cta",!!e.cta)),l})();_t(["click"]);var Ys=Ie("<div><div class=setting-item-info><div class=setting-item-name></div><div class=setting-item-description></div></div><div class=setting-item-control>"),xs=Ie("<div class=checkbox-container><input type=checkbox>"),Js=Ie("<div class=setting-editor-extra-setting-button>"),Bs=Ie("<input type=text>"),ys=Ie("<textarea>"),Fs=Ie("<select class=dropdown>"),Hs=Ie("<option>");const Vn=Ln(),Ns=()=>Tn(Vn),U=e=>{const l={settingEl:null};return I(Vn.Pro
`)),o=(...p)=>{c(...p),l.saveSettings()},g=p=>{try{const X={};for(let R of p.split(`
`)){R=R.trim();const v=R.indexOf("=");if(v>0){const be=R.substring(0,v);let C=R.substring(v+1).trim();C.startsWith('"')&&C.endsWith('"')&&(C=C.substring(1,C.length-1)),X[be]=C}}o("env",Ae(n.env??{},X))}catch(X){alert(X)}},b=q(()=>n.items.find(p=>p.name===n.lastEditName)??n.items.first()),G=p=>{const X=b();return p===void 0||p===X.type?X:void 0},J=q(()=>de(n.customDefaultExportDirectory)),W=p=>{const X=n.items.findIndex(R=>R.name===n.lastEditName);o("items",X===-1?0:X,$s(R=>(p(R),R)))},x=q(()=>{const p=i();return p?app.vault.config.useMarkdownLinks&&p.compare(Zt.requiredVersion)===-1?t.settingTab.pandocVersionWithWarning(Zt.requiredVersion):t.settingTab.pandocVersion(p):t.settingTab.pandocNotFound}),[L,u]=ae(),j=()=>{const[p,X]=ae(Object.keys(dt)[0]),[R,v]=ae(),be=()=>{const C=JSON.parse(JSON.stringify(dt[p()]));C.name=R(),gt(()=>{o("items",f=>[...f,C]),o("lastEditName",C.name)}),u(void 0)};return I(Mt,{app,get title(){return t.settingTab.new},onClose:()=>u(void 0),get children(){return[I(U,{get name(){return t.settingTab.template},get children(){return I(Pe,{get options(){return Object.entries(dt).map(([C,f])=>({name:f.name,value:C}))},get selected(){return R()??p()},onChange:C=>X(C)})}}),I(U,{get name(){return t.settingTab.name},get children(){return I(re,{get value(){return R()??""},onChange:C=>v(C)})}}),(()=>{var C=Tl();return se(C,I(Ot,{cta:!0,onClick:be,get children(){return t.settingTab.save}})),C})()]}})},w=()=>{const[p,X]=ae(G().name),R=()=>{gt(()=>{W(v=>v.name=p()),o("lastEditName",p())}),u(void 0)};return I(Mt,{app,get title(){return t.settingTab.rename},onClose:()=>u(void 0),get children(){return[I(U,{get name(){return t.settingTab.name},get children(){return I(re,{get value(){return p()??""},onChange:v=>X(v)})}}),(()=>{var v=Tl();return se(v,I(Ot,{cta:!0,onClick:R,get children(){return t.settingTab.add}})),v})()]}})},E=()=>{const p=()=>G("pandoc"),X=R=>{W(v=>v.type==="pandoc"?R(v):void 0)};return[I(U,{get name(){return t.settingTab.arguments},get children(){return I(re,{style:"width: 100%",get value(){return p().arguments??""},onChange:R=>X(v=>v.arguments=R)})}}),I(U,{get name(){return t.settingTab.extraArguments},get children(){return I(re,{style:"width: 100%",get value(){return p().customArguments??""},get title(){return p().customArguments},onChange:R=>X(v=>v.customArguments=R)})}}),I(U,{get name(){return t.settingTab.afterExport},heading:!0}),I(U,{get name(){return t.settingTab.openExportedFileLocation},get children(){return I(me,{get checked(){return p().openExportedFileLocation??!1},onChange:R=>X(v=>v.openExportedFileLocation=R)})}}),I(U,{get name(){return t.settingTab.openExportedFile},get children(){return I(me,{get checked(){return p().openExportedFile??!1},onChange:R=>X(v=>v.openExportedFile=R)})}}),I(U,{get name(){return t.settingTab.runCommand},get children(){return I(me,{get checked(){return p().runCommand},onChange:R=>X(v=>v.runCommand=R)})}}),I(bt,{get when(){return p().runCommand},get children(){return I(U,{get children(){return I(re,{style:"width: 100%",get value(){return p().command??""},onChange:R=>X(v=>v.command=R)})}})}})]},M=()=>{const p=()=>G("custom"),X=R=>{W(v=>v.type==="custom"?R(v):void 0)};return[I(U,{get name(){return t.settingTab.command},get children(){return I(re,{style:"width: 100%",get value(){return p().command},onChange:R=>X(v=>v.command=R)})}}),I(U,{get name(){return t.settingTab.targetFileExtensions},get children(){return I(re,{get value(){return p().targetFileExtensions??""},onChange:R=>X(v=>v.targetFileExtensions=R)})}}),I(U,{get name(){return t.settingTab.afterExport},heading:!0}),I(U,{get name(){return t.settingTab.showCommandOutput},get children(){return I(me,{get checked(){return p().showCommandOutput??!1},onChange:R=>X(v=>v.showCommandOutput=R)})}}),I(U,{get name(){return t.settingTab.openExportedFileLocation},get children(){return I(me,{get checked(){return p().openExportedFileLocation??!1},onChange:R=>X(v=>v.openExportedFileLocation=R)})}}),I(U,{get name(){return t.settingTab.openExportedFile},get children(){return I(me,{get checked(){return p().openExportedFile