Files

133 lines
106 KiB
JavaScript
Raw Permalink Normal View History

2026-10-09 22:06:40 +08:00
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var es=Object.defineProperty;var vn=Object.getOwnPropertyDescriptor;var Fn=Object.getOwnPropertyNames;var bn=Object.prototype.hasOwnProperty;var kn=(s,e)=>{for(var t in e)es(s,t,{get:e[t],enumerable:!0})},In=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Fn(e))!bn.call(s,n)&&n!==t&&es(s,n,{get:()=>e[n],enumerable:!(r=vn(e,n))||r.enumerable});return s};var On=s=>In(es({},"__esModule",{value:!0}),s);var Sa={};kn(Sa,{default:()=>Xt});module.exports=On(Sa);var L=require("obsidian");var Ks=require("obsidian");var we=require("obsidian"),R="all_folders",bt=class extends we.Modal{constructor(t,r,n,i){super(t);this.selectedFolders=new Set;this.folders=[];this.folders=r,n&&n.length>0&&n.forEach(a=>{a&&this.selectedFolders.add(a)}),this.onConfirm=i}async onOpen(){let{contentEl:t}=this;t.createEl("h2",{text:"Manage Cubox folders to be synced"}),t.addClass("cubox-modal"),this.listEl=t.createDiv({cls:"folder-list-container cubox-list-container"}),this.footerEl=t.createDiv({cls:"modal-footer"}),this.createFolderList(),this.footerEl.createEl("button",{text:"Cancel"}).addEventListener("click",()=>{this.close()}),this.footerEl.createEl("button",{text:"Done",cls:"mod-cta"}).addEventListener("click",()=>{if(this.selectedFolders.size===0){new we.Notice("Please select at least one option.");return}let i=this.selectedFolders.has(R)?[R]:Array.from(this.selectedFolders);this.onConfirm(i),this.close()})}createFolderList(){this.listEl.empty(),new we.Setting(this.listEl).setName("All items").addToggle(t=>{t.setValue(this.selectedFolders.has(R)),t.onChange(r=>{this.handleFolderToggle(R,r),this.redraw()})}),this.folders.forEach(t=>{let r=this.selectedFolders.has(R),n=new we.Setting(this.listEl).setName(t.nested_name).addToggle(i=>{i.setDisabled(r),i.setValue(!r&&this.selectedFolders.has(t.id)),r||i.onChange(a=>{this.handleFolderToggle(t.id,a),this.redraw()})});r&&n.settingEl.addClass("is-disabled")})}handleFolderToggle(t,r){t===R?r?(this.selectedFolders.clear(),this.selectedFolders.add(R)):this.selectedFolders.delete(R):r?(this.selectedFolders.delete(R),this.selectedFolders.add(t)):this.selectedFolders.delete(t)}redraw(){this.createFolderList()}onClose(){let{contentEl:t}=this;t.empty()}};var ce=require("obsidian"),H="all_items",qs="",kt=class extends ce.Modal{constructor(t,r,n,i){super(t);this.selectedTags=new Set;this.tags=[];this.tags=r,n&&n.length>0&&n.forEach(a=>{this.selectedTags.add(a)}),this.onConfirm=i}async onOpen(){let{contentEl:t}=this;t.createEl("h2",{text:"Manage Cubox tags to be synced"}),t.addClass("cubox-modal"),this.listEl=t.createDiv({cls:"tag-list-container cubox-list-container"}),this.footerEl=t.createDiv({cls:"modal-footer"}),this.createTagList(),this.footerEl.createEl("button",{text:"Cancel"}).addEventListener("click",()=>{this.close()}),this.footerEl.createEl("button",{text:"Done",cls:"mod-cta"}).addEventListener("click",()=>{if(this.selectedTags.size===0){new ce.Notice("Please select at least one option.");return}let i=this.selectedTags.has(H)?[H]:Array.from(this.selectedTags);this.onConfirm(i),this.close()})}createTagList(){this.listEl.empty(),new ce.Setting(this.listEl).setName("All items").addToggle(n=>{n.setValue(this.selectedTags.has(H)),n.onChange(i=>{this.handleTagToggle(H,i),this.redraw()})});let t=this.selectedTags.has(H),r=new ce.Setting(this.listEl).setName("No tags").addToggle(n=>{n.setDisabled(t),n.setValue(!t&&this.selectedTags.has(qs)),t||n.onChange(i=>{this.handleTagToggle(qs,i),this.redraw()})});t&&r.settingEl.addClass("is-disabled"),this.tags.forEach(n=>{let i=new ce.Setting(this.listEl).setName(n.nested_name).addToggle(a=>{a.setDisabled(t),a.setValue(!t&&this.selectedTags.has(n.id)),t||a.onChange(o=>{this.handleTagToggle(n.id,o),this.redraw()})});t&&i.settingEl.addClass("is-disabled")})}handleTagToggle(t,r){t===H?r?(this.selectedTags.clear(),this.selectedTags.add(H)):this.selectedTags.delete(H):r?(this.selectedTags.delete(H),this.selectedTags.add(t)):this.selectedTags.delete(t)}redraw(){this.createTagList()}onClose(){let{contentEl:t}=this;t.empty()}};var be=require("obsidian"),G="al
`&&(c(),l="",u=0,t=!1);if(!S.scan(h))break;if(a=!0,k=S.scan(pa)||"name",S.scan(fa),k==="="?(M=S.scanUntil(dn),S.scan(dn),S.scanUntil(y)):k==="{"?(M=S.scanUntil(g),S.scan(ga),S.scanUntil(y),k="&"):M=S.scanUntil(y),!S.scan(y))throw new Error("Unclosed tag at "+S.pos);if(k==">"?re=[k,M,F,S.pos,l,u,t]:re=[k,M,F,S.pos],u++,n.push(re),k==="#"||k==="^")r.push(re);else if(k==="/"){if(P=r.pop(),!P)throw new Error('Unopened section "'+M+'" at '+F);if(P[1]!==M)throw new Error('Unclosed section "'+P[1]+'" at '+F)}else k==="name"||k==="{"||k==="&"?o=!0:k==="="&&b(M)}if(c(),P=r.pop(),P)throw new Error('Unclosed section "'+P[1]+'" at '+S.pos);return wa(Ta(n))}function Ta(s){for(var e=[],t,r,n=0,i=s.length;n<i;++n)t=s[n],t&&(t[0]==="text"&&r&&r[0]==="text"?(r[1]+=t[1],r[3]=t[3]):(e.push(t),r=t));return e}function wa(s){for(var e=[],t=e,r=[],n,i,a=0,o=s.length;a<o;++a)switch(n=s[a],n[0]){case"#":case"^":t.push(n),r.push(n),t=n[4]=[];break;case"/":i=r.pop(),i[5]=n[2],t=r.length>0?r[r.length-1][4]:e;break;default:t.push(n)}return e}function Ft(s){this.string=s,this.tail=s,this.pos=0}Ft.prototype.eos=function(){return this.tail===""};Ft.prototype.scan=function(e){var t=this.tail.match(e);if(!t||t.index!==0)return"";var r=t[0];return this.tail=this.tail.substring(r.length),this.pos+=r.length,r};Ft.prototype.scanUntil=function(e){var t=this.tail.search(e),r;switch(t){case-1:r=this.tail,this.tail="";break;case 0:r="";break;default:r=this.tail.substring(0,t),this.tail=this.tail.substring(t)}return this.pos+=r.length,r};function Pe(s,e){this.view=s,this.cache={".":this.view},this.parent=e}Pe.prototype.push=function(e){return new Pe(e,this)};Pe.prototype.lookup=function(e){var t=this.cache,r;if(t.hasOwnProperty(e))r=t[e];else{for(var n=this,i,a,o,l=!1;n;){if(e.indexOf(".")>0)for(i=n.view,a=e.split("."),o=0;i!=null&&o<a.length;)o===a.length-1&&(l=cn(i,a[o])||aa(i,a[o])),i=i[a[o++]];else i=n.view[e],l=cn(n.view,e);if(l){r=i;break}n=n.parent}t[e]=r}return Us(r)&&(r=r.call(this.view)),r};function A(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}A.prototype.clearCache=function(){typeof this.templateCache!="undefined"&&this.templateCache.clear()};A.prototype.parse=function(e,t){var r=this.templateCache,n=e+":"+(t||B.tags).join(":"),i=typeof r!="undefined",a=i?r.get(n):void 0;return a==null&&(a=ya(e,t),i&&r.set(n,a)),a};A.prototype.render=function(e,t,r,n){var i=this.getConfigTags(n),a=this.parse(e,i),o=t instanceof Pe?t:new Pe(t,void 0);return this.renderTokens(a,o,r,e,n)};A.prototype.renderTokens=function(e,t,r,n,i){for(var a="",o,l,u,c=0,h=e.length;c<h;++c)u=void 0,o=e[c],l=o[0],l==="#"?u=this.renderSection(o,t,r,n,i):l==="^"?u=this.renderInverted(o,t,r,n,i):l===">"?u=this.renderPartial(o,t,r,i):l==="&"?u=this.unescapedValue(o,t):l==="name"?u=this.escapedValue(o,t,i):l==="text"&&(u=this.rawValue(o)),u!==void 0&&(a+=u);return a};A.prototype.renderSection=function(e,t,r,n,i){var a=this,o="",l=t.lookup(e[1]);function u(y){return a.render(y,t,r,i)}if(l){if(Ze(l))for(var c=0,h=l.length;c<h;++c)o+=this.renderTokens(e[4],t.push(l[c]),r,n,i);else if(typeof l=="object"||typeof l=="string"||typeof l=="number")o+=this.renderTokens(e[4],t.push(l),r,n,i);else if(Us(l)){if(typeof n!="string")throw new Error("Cannot use higher-order sections without the original template");l=l.call(t.view,n.slice(e[3],e[5]),u),l!=null&&(o+=l)}else o+=this.renderTokens(e[4],t,r,n,i);return o}};A.prototype.renderInverted=function(e,t,r,n,i){var a=t.lookup(e[1]);if(!a||Ze(a)&&a.length===0)return this.renderTokens(e[4],t,r,n,i)};A.prototype.indentPartial=function(e,t,r){for(var n=t.replace(/[^ \t]/g,""),i=e.split(`
`),a=0;a<i.length;a++)i[a].length&&(a>0||!r)&&(i[a]=n+i[a]);return i.join(`
`)};A.prototype.renderPartial=function(e,t,r,n){if(r){var i=this.getConfigTags(n),a=Us(r)?r(e[1]):r[e[1]];if(a!=null){var o=e[6],l=e[5],u=e[4],c=a;l==0&&u&&(c=this.indentPartial(a,u,o));var h=this.parse(c,i);return this.renderTokens(h,t,r,c,n)}}};A.prototype.unescapedValue=function(e,t){var r=t.lookup(e[1]);if(r!=null)return r};A.prototype.escapedValue=function(e,t,r){var n=this.getConfigEscape(r)||B.escape,i=t.lookup(e[1]);if(i!=null)return typeof i=="number"&&n===B.escape?String(i):n(i)};A.prototype.rawValue=function(e){return e[1]};A.prototype.getConfigTags=function(e){return Ze(e)?e:e&&typeof e=="object"?e.tags:void 0};A.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!Ze(e))return e.escape};var B={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(s){vt.templateCache=s},get templateCache(){return vt.templateCache}},vt=new A;B.clearCache=function(){return vt.clearCache()};B.parse=function(e,t){return vt.parse(e,t)};B.render=function(e,t,r,n){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+ia(e)+'" was given as the first argument for mustache#render(template, view, partials)');return vt.render(e,t,r,n)};B.escape=ha;B.Scanner=Ft;B.Context=Pe;B.Writer=A;var $s=B;var Ps=require("obsidian"),hn=["title","article_title","tags","create_time","update_time","domain","url","cubox_url","description","description","words_count","type","words_count","id"],Kt=class{constructor(){this.dateFormat="yyyy-MM-dd"}setDateFormat(e){this.dateFormat=e}processFilenameTemplate(e,t){if(!e)return t.title||"Untitled";let r={title:t.title||"",article_title:t.article_title||"",create_time:t.create_time?se(t.create_time,this.dateFormat):"",update_time:t.update_time?se(t.update_time,this.dateFormat):"",domain:t.domain||"",type:t.type||"",id:t.id||""},n="";try{n=$s.render(e,r)}catch(a){console.error("\u6A21\u677F\u6E32\u67D3\u5931\u8D25:",a),n=t.title||"Untitled"}let i=100;return n.length>i&&(n=n.substring(0,i)),un(n)}processFrontMatter(e,t){let r={id:t.id};if(e.length===0)return(0,Ps.stringifyYaml)(r);for(let n of e){let i=n.split("::"),a=i[0],o=i.length>1?i[1]:a;if(a==="tags"&&t.tags&&t.tags.length>0){r[o]=t.tags;continue}if(a==="create_time"&&t.create_time){r[o]=se(t.create_time,this.dateFormat);continue}if(a==="update_time"&&t.update_time){r[o]=se(t.update_time,this.dateFormat);continue}let l=this.getArticleProperty(t,a);l&&(r[o]=l)}return(0,Ps.stringifyYaml)(r)}processContentTemplate(e,t){if(!e){let n="";return t.content&&(n+=t.content+`
`),t.highlights&&t.highlights.length>0&&(n+=`## Highlights
`,t.highlights.forEach(i=>{n+=`- ${i.text}
`})),n}let r=this.createArticleView(t);return e.includes("content_highlighted")&&t.content&&t.highlights&&t.highlights.length>0&&(r.content_highlighted=this.generateHighlightedContent(t.content,t.highlights)),$s.render(e,r)}createArticleView(e){var r;let t={...e,highlights:[],tags:e.tags||[],highlights_length:((r=e.highlights)==null?void 0:r.length)||0,create_time:e.create_time?se(e.create_time,this.dateFormat):"",update_time:e.update_time?se(e.update_time,this.dateFormat):""};return e.highlights&&e.highlights.length>0&&(t.highlights=e.highlights.map(n=>this.createHighlightView(n))),t.highlights.length===0?t.highlights_length=0:t.highlights_length=t.highlights.length,t}createHighlightView(e){let t=e.text||"";!t&&e.image_url?t=`![](${e.image_url})`:t.includes(`
`)&&(t=t.split(`
`).map((o,l)=>l===0?o:o.trim()?"> "+o:">").join(`
`));let r=e.note&&e.note.trim()?e.note.trim()+`
`:"",n={...e,text:t,note:r,create_time:e.create_time?se(e.create_time,this.dateFormat):""};return n.cubox_url||(n.cubox_url=""),n}generateHighlightedContent(e,t){if(!e||!t||t.length===0)return e||"";let r=e.length,n=new Array(r).fill(!1);for(let o of t){let l=o.text;if(!l)continue;let u=0,c;for(;(c=e.indexOf(l,u))!==-1;){for(let h=0;h<l.length;h++)n[c+h]=!0;u=c+1}}let i="",a=!1;for(let o=0;o<r;o++){let l=n[o];l&&!a&&(i+="==",a=!0),!l&&a&&(i+="==",a=!1),i+=e[o]}return a&&(i+="=="),i}getArticleProperty(e,t){return e[t]}needsArticleContent(e){return e?e.includes("{{content}}")||e.includes("{{{content}}}")||e.includes("{{content_highlighted}}")||e.includes("{{{content_highlighted}}}"):!0}};var x=require("obsidian");var Zs=(s,e)=>{if(s==="cubox.pro")switch(e){case"filename":return"https://help.cubox.pro/share/obplugin/#%E6%96%87%E4%BB%B6%E5%90%8D%E6%A8%A1%E6%9D%BF";case"metadata":return"https://help.cubox.pro/share/obplugin/#%E5%85%83%E5%B1%9E%E6%80%A7";case"content":return"https://help.cubox.pro/share/obplugin/#%E5%86%85%E5%AE%B9%E6%A8%A1%E6%9D%BF";case"date":return"https://help.cubox.pro/share/obplugin/#%E6%97%A5%E6%9C%9F%E6%A0%BC%E5%BC%8F";default:return"#"}else if(s==="cubox.cc")switch(e){case"filename":return"https://help.cubox.cc/share/obplugin/#filename-template";case"metadata":return"https://help.cubox.cc/share/obplugin/#metadata";case"content":return"https://help.cubox.cc/share/obplugin/#content-template";case"date":return"https://help.cubox.cc/share/obplugin/#date-format";default:return"#"}return"#"},jt=(s,e)=>s?`<div class="cubox-reference">For more, refer to <a href="${Zs(s,e)}" class="reference-link" target="_blank">reference</a>.</div>`:'<div class="cubox-reference">For more, refer to <a href="#" class="reference-link">reference</a>.</div>',fn=s=>jt(s,"filename"),mn=s=>jt(s,"metadata"),gn=s=>jt(s,"content"),pn=s=>jt(s,"date"),yn=`
Enter template for creating synced article file name.
<div class="cubox-variables-container">
<div class="cubox-variables-title">Available variables</div>
<ul class="cubox-variables-list">
<li>{{{title}}}</li>
<li>{{{article_title}}}</li>
<li>{{{create_time}}}</li>
<li>{{{update_time}}}</li>
<li>{{{domain}}}</li>
<li>{{{type}}}</li>
</ul>
<div class="cubox-reference domain-reference-filename"></div>
</div>
`,Tn=`
Enter the metadata separated by comma. you can also use custom aliases in the format of metadata::alias. For syncing purposes, the id will always be included.
<div class="cubox-variables-container">
<div class="cubox-variables-title">Available variables</div>
<ul class="cubox-variables-list">
<li>title</li>
<li>article_title</li>
<li>tags</li>
<li>create_time</li>
<li>update_time</li>
<li>domain</li>
<li>url</li>
<li>cubox_url</li>
<li>description</li>
<li>words_count</li>
<li>type</li>
</ul>
<div class="cubox-reference domain-reference-metadata"></div>
</div>
`,wn=`
Enter template for creating synced article content.
<div class="cubox-variables-container">
<div class="cubox-variables-title">Available variables</div>
<ul class="cubox-variables-list">
<li>{{{id}}}</li>
<li>{{{title}}}</li>
<li>{{{description}}}</li>
<li>{{{article_title}}}</li>
<li>{{{content}}}</li>
<li>{{{content_highlighted}}}</li>
<li>{{{highlights}}}</li>
<li class="highlight-item">
<ul class="highlight-sublist">
<li>{{{text}}}</li>
<li>{{{image_url}}}</li>
<li>{{{cubox_url}}}</li>
<li>{{{note}}}</li>
<li>{{{color}}}</li>
<li>{{{create_time}}}</li>
</ul>
</li>
<li>{{{tags}}}</li>
<li>{{{create_time}}}</li>
<li>{{{update_time}}}</li>
<li>{{{domain}}}</li>
<li>{{{url}}}</li>
<li>{{{cubox_url}}}</li>
<li>{{{words_count}}}</li>
</ul>
<div class="cubox-reference domain-reference-content"></div>
</div>
`,En=`
If date is used on above templates, enter the format date.
<div class="cubox-variables-container">
<div class="cubox-variables-title">Example</div>
<ul class="cubox-variables-list">
<li>yyyy-MM-dd</li>
<li>MM/dd/yyyy</li>
<li>dd.MM.yyyy</li>
<li>yyyy-MM-dd HH:mm:ss</li>
</ul>
<div class="cubox-reference domain-reference-date"></div>
</div>
`;var Sn=require("obsidian"),Ea=`# {{{title}}}
{{{description}}}
[Read in Cubox]({{{cubox_url}}})
[Read Original]({{{url}}})
---
{{#highlights.length}}
## Annotations
{{#highlights}}
> {{{text}}}
{{#note}}
{{{note}}}
{{/note}}
[Link\uFE0F]({{{cubox_url}}})
{{/highlights}}
{{/highlights.length}}`,Te={domain:"",apiKey:"",folderFilter:[],typeFilter:[],statusFilter:[],isRead:!0,isStarred:!0,isAnnotated:!0,tagsFilter:[],syncFrequency:30,targetFolder:"Cubox",filenameTemplate:"{{{title}}}-{{{create_time}}}",frontMatterVariables:["id","cubox_url","url","tags"],contentTemplate:Ea,highlightInContent:!0,dateFormat:"yyyy-MM-dd",lastSyncTime:0,lastSyncCardId:null,lastCardUpdateTime:null,syncing:!1},Qt=class extends x.PluginSettingTab{constructor(t,r){super(t,r);this.plugin=r}display(){let{containerEl:t}=this;t.empty(),new x.Setting(t).setName("Cubox server domain").setDesc("Select the correct domain name of the Cubox you are using.").addDropdown(o=>o.addOption("","Choose region").addOption("cubox.cc","cubox.cc (international)").addOption("cubox.pro","cubox.pro").setValue(this.plugin.settings.domain).onChange(async l=>{this.plugin.settings.domain=l,await this.plugin.saveSettings(),this.updateApiKeySetting(),this.plugin.updateCuboxApiConfig(l,this.plugin.settings.apiKey),this.updateHelpLinks(l)})),this.apiKeySetting=new x.Setting(t).setName("Your Cubox API key").setDesc("Please select a region first").addText(o=>(o.setPlaceholder("Enter your API key").setValue(this.plugin.settings.apiKey).onChange(async l=>{let u=l.trim();if(u.includes("://"))try{let c=u.includes("://")?new URL(u):null;if(c){let h=c.pathname.split("/").filter(y=>y.length>0);h.length>0&&(u=h[h.length-1])}o.setValue(u)}catch(c){new x.Notice("Invalid API key")}this.plugin.settings.apiKey=u,await this.plugin.saveSettings(),this.plugin.updateCuboxApiConfig(this.plugin.settings.domain,u)}),this.plugin.settings.domain||(o.inputEl.disabled=!0),o)),this.updateApiKeySetting(),new x.Setting(t).setName("Filter").setHeading(),new x.Setting(t).setName("Folder filter").setDesc("Manage Cubox folders to be synced").addButton(o=>o.setButtonText(this.getFolderFilterButtonText()).setCta().onClick(async()=>{if(!this.plugin.settings.apiKey){new x.Notice("Please enter the API key first");return}o.setButtonText("Loading folders...");try{let l=await this.plugin.cuboxApi.getFolders();new bt(this.app,l,this.plugin.settings.folderFilter,async c=>{this.plugin.settings.folderFilter=c,await this.plugin.saveSettings(),o.setButtonText(this.getFolderFilterButtonText())}).open()}catch(l){console.error("\u83B7\u53D6\u6587\u4EF6\u5939\u5217\u8868\u5931\u8D25:",l),new x.Notice("Failed to get Cubox folders"),o.setButtonText(this.getFolderFilterButtonText())}o.setButtonText(this.getFolderFilterButtonText())})),new x.Setting(t).setName("Tag filter").setDesc("Manage Cubox tags to be synced").addButton(o=>o.setButtonText(this.getTagFilterButtonText()).setCta().onClick(async()=>{if(!this.plugin.settings.apiKey){new x.Notice("Please enter the API key first");return}o.setButtonText("Loading tags...");try{let l=await this.plugin.cuboxApi.getTags();new kt(this.app,l,this.plugin.settings.tagsFilter,async c=>{this.plugin.settings.tagsFilter=c,await this.plugin.saveSettings(),o.setButtonText(this.getTagFilterButtonText())}).open()}catch(l){console.error("\u83B7\u53D6\u6807\u7B7E\u5217\u8868\u5931\u8D25:",l),new x.Notice("Failed to get Cubox tags"),o.setButtonText(this.getTagFilterButtonText())}o.setButtonText(this.getTagFilterButtonText())})),new x.Setting(t).setName("Type filter").setDesc("Manage Cubox content types to be synced").addButton(o=>o.setButtonText(this.getTypeFilterButtonText()).setCta().onClick(async()=>{if(!this.plugin.settings.apiKey){new x.Notice("Please enter the API key first");return}new Ot(this.app,Ys(this.plugin.settings.typeFilter),async u=>{this.plugin.settings.typeFilter=u,await this.plugin.saveSettings(),o.setButtonText(this.getTypeFilterButtonText())},this.plugin.settings.domain).open()})),new x.Setting(t).setName("Status filter").setDesc("Manage Cubox content status to be synced").addButton(o=>o.setButtonText(this.getStatusFilterButtonText()).setCta().onClick(async()=>{if(!this.plugin.settings.apiKey){new x.Notice("Please enter the API key first");return}let l={read:this.plugin.settings.isRead,starred:this.plugin.settings.isStarred,annotated:this.plugin.sett
${re}
---
`),ne+=P,await this.app.vault.create(M,ne),o++}catch(F){l++,console.error("\u540C\u6B65 Cubox \u6570\u636E\u5931\u8D25:",F)}a=g,y.length>0&&(n=y[y.length-1].id,i=y[y.length-1].update_time,this.settings.lastSyncCardId=n,this.settings.lastCardUpdateTime=i,await this.saveSettings())}this.settings.lastSyncTime=Date.now(),this.settings.syncing=!1,await this.saveSettings();let c=`Cubox sync completed: ${o} new items${u>0?`, ${u} skipped`:""}${l>0?`, ${l} errors`:""}`;new L.Notice(c)}catch(n){if(console.error("\u540C\u6B65 Cubox \u6570\u636E\u5931\u8D25:",n),n instanceof Be){new L.Notice("Cubox API Key not found. Please set your API Key in plugin settings and try again.");return}new L.Notice("Cubox sync failed. Please check settings or network.")}finally{this.settings.syncing=!1,await this.saveSettings()}}async ensureTargetFolder(){let t=this.settings.targetFolder;this.app.vault.getAbstractFileByPath(t)instanceof L.TFolder||await this.app.vault.createFolder(t)}formatLastSyncTime(){return this.settings.lastSyncTime?se(new Date(this.settings.lastSyncTime).toISOString(),"yyyy-MM-dd HH:mm"):"never"}updateCuboxApiConfig(t,r){this.cuboxApi.updateConfig(t,r)}updateTemplateProcessorDateFormat(t){this.templateProcessor.setDateFormat(t)}};
/*! Bundled license information:
mustache/mustache.mjs:
(*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*)
*/
/* nosourcemap */