You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

154 lines
112 KiB

3 years ago
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
2 years ago
var cn=Object.create;var ht=Object.defineProperty;var un=Object.getOwnPropertyDescriptor;var hn=Object.getOwnPropertyNames;var fn=Object.getPrototypeOf,pn=Object.prototype.hasOwnProperty;var Ee=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),gn=(e,t)=>{for(var r in t)ht(e,r,{get:t[r],enumerable:!0})},Vr=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of hn(t))!pn.call(e,s)&&s!==r&&ht(e,s,{get:()=>t[s],enumerable:!(i=un(t,s))||i.enumerable});return e};var ke=(e,t,r)=>(r=e!=null?cn(fn(e)):{},Vr(t||!e||!e.__esModule?ht(r,"default",{value:e,enumerable:!0}):r,e)),mn=e=>Vr(ht({},"__esModule",{value:!0}),e);var qr=Ee((jr,Yr)=>{(function(e){if(typeof jr=="object")Yr.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t;try{t=window}catch(r){t=self}t.SparkMD5=e()}})(function(e){"use strict";var t=function(g,p){return g+p&4294967295},r=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function i(g,p,o,a,f,c){return p=t(t(p,g),t(a,c)),t(p<<f|p>>>32-f,o)}function s(g,p){var o=g[0],a=g[1],f=g[2],c=g[3];o+=(a&f|~a&c)+p[0]-680876936|0,o=(o<<7|o>>>25)+a|0,c+=(o&a|~o&f)+p[1]-389564586|0,c=(c<<12|c>>>20)+o|0,f+=(c&o|~c&a)+p[2]+606105819|0,f=(f<<17|f>>>15)+c|0,a+=(f&c|~f&o)+p[3]-1044525330|0,a=(a<<22|a>>>10)+f|0,o+=(a&f|~a&c)+p[4]-176418897|0,o=(o<<7|o>>>25)+a|0,c+=(o&a|~o&f)+p[5]+1200080426|0,c=(c<<12|c>>>20)+o|0,f+=(c&o|~c&a)+p[6]-1473231341|0,f=(f<<17|f>>>15)+c|0,a+=(f&c|~f&o)+p[7]-45705983|0,a=(a<<22|a>>>10)+f|0,o+=(a&f|~a&c)+p[8]+1770035416|0,o=(o<<7|o>>>25)+a|0,c+=(o&a|~o&f)+p[9]-1958414417|0,c=(c<<12|c>>>20)+o|0,f+=(c&o|~c&a)+p[10]-42063|0,f=(f<<17|f>>>15)+c|0,a+=(f&c|~f&o)+p[11]-1990404162|0,a=(a<<22|a>>>10)+f|0,o+=(a&f|~a&c)+p[12]+1804603682|0,o=(o<<7|o>>>25)+a|0,c+=(o&a|~o&f)+p[13]-40341101|0,c=(c<<12|c>>>20)+o|0,f+=(c&o|~c&a)+p[14]-1502002290|0,f=(f<<17|f>>>15)+c|0,a+=(f&c|~f&o)+p[15]+1236535329|0,a=(a<<22|a>>>10)+f|0,o+=(a&c|f&~c)+p[1]-165796510|0,o=(o<<5|o>>>27)+a|0,c+=(o&f|a&~f)+p[6]-1069501632|0,c=(c<<9|c>>>23)+o|0,f+=(c&a|o&~a)+p[11]+643717713|0,f=(f<<14|f>>>18)+c|0,a+=(f&o|c&~o)+p[0]-373897302|0,a=(a<<20|a>>>12)+f|0,o+=(a&c|f&~c)+p[5]-701558691|0,o=(o<<5|o>>>27)+a|0,c+=(o&f|a&~f)+p[10]+38016083|0,c=(c<<9|c>>>23)+o|0,f+=(c&a|o&~a)+p[15]-660478335|0,f=(f<<14|f>>>18)+c|0,a+=(f&o|c&~o)+p[4]-405537848|0,a=(a<<20|a>>>12)+f|0,o+=(a&c|f&~c)+p[9]+568446438|0,o=(o<<5|o>>>27)+a|0,c+=(o&f|a&~f)+p[14]-1019803690|0,c=(c<<9|c>>>23)+o|0,f+=(c&a|o&~a)+p[3]-187363961|0,f=(f<<14|f>>>18)+c|0,a+=(f&o|c&~o)+p[8]+1163531501|0,a=(a<<20|a>>>12)+f|0,o+=(a&c|f&~c)+p[13]-1444681467|0,o=(o<<5|o>>>27)+a|0,c+=(o&f|a&~f)+p[2]-51403784|0,c=(c<<9|c>>>23)+o|0,f+=(c&a|o&~a)+p[7]+1735328473|0,f=(f<<14|f>>>18)+c|0,a+=(f&o|c&~o)+p[12]-1926607734|0,a=(a<<20|a>>>12)+f|0,o+=(a^f^c)+p[5]-378558|0,o=(o<<4|o>>>28)+a|0,c+=(o^a^f)+p[8]-2022574463|0,c=(c<<11|c>>>21)+o|0,f+=(c^o^a)+p[11]+1839030562|0,f=(f<<16|f>>>16)+c|0,a+=(f^c^o)+p[14]-35309556|0,a=(a<<23|a>>>9)+f|0,o+=(a^f^c)+p[1]-1530992060|0,o=(o<<4|o>>>28)+a|0,c+=(o^a^f)+p[4]+1272893353|0,c=(c<<11|c>>>21)+o|0,f+=(c^o^a)+p[7]-155497632|0,f=(f<<16|f>>>16)+c|0,a+=(f^c^o)+p[10]-1094730640|0,a=(a<<23|a>>>9)+f|0,o+=(a^f^c)+p[13]+681279174|0,o=(o<<4|o>>>28)+a|0,c+=(o^a^f)+p[0]-358537222|0,c=(c<<11|c>>>21)+o|0,f+=(c^o^a)+p[3]-722521979|0,f=(f<<16|f>>>16)+c|0,a+=(f^c^o)+p[6]+76029189|0,a=(a<<23|a>>>9)+f|0,o+=(a^f^c)+p[9]-640364487|0,o=(o<<4|o>>>28)+a|0,c+=(o^a^f)+p[12]-421815835|0,c=(c<<11|c>>>21)+o|0,f+=(c^o^a)+p[15]+530742520|0,f=(f<<16|f>>>16)+c|0,a+=(f^c^o)+p[2]-995338651|0,a=(a<<23|a>>>9)+f|0,o+=(f^(a|~c))+p[0]-198630844|0,o=(o<<6|o>>>26)+a|0,c+=(a^(o|~f))+p[7]+1126891415|0,c=(c<<10|c>>>22)+o|0,f+=(o^(c|~a))+p[14]-1416354905|0,f=(f<<15|f>>>17)+c|0,a+=(c^(f|~o))+p[5]-57434055|0,a=(a<<21|a>>>11)+f|0,o+=(f^(a|~c))+p[12]+1700485571|0,o=(o<<6|o>>>26)+a|0,c+=(a^(o|~f))+p[3]-1894986606|0,c=(c<<10|c>>>22)+o|0,f+=(o^(c|~a))+p[10]-1051523|0,f=(f<<15|f>>>17)+c|0,a+=(c^(f|~o))+p[1]-2054922799|0,a=(a<<21|a>>>11)+f|0,o+=(f^(a|~c))+p[8]+1873313359|0,o=(o<<6|o>>>26)+a|0,c+=(a^(o|~f))+p[15]-30611744|0,c=(c<<10|c>>>22)+o|0,f+=(o^(c|~a))+p[6]-1560198380|0,f=(f<<15|f>>
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var A=Object.hasOwnProperty,w=Object.setPrototypeOf,I=Object.isFrozen,C=Object.getPrototypeOf,k=Object.getOwnPropertyDescriptor,D=Object.freeze,T=Object.seal,g=Object.create,p=typeof Reflect!="undefined"&&Reflect,o=p.apply,a=p.construct;o||(o=function(b,_,L){return b.apply(_,L)}),D||(D=function(b){return b}),T||(T=function(b){return b}),a||(a=function(b,_){return i(b,s(_))});var f=ee(Array.prototype.forEach),c=ee(Array.prototype.pop),P=ee(Array.prototype.push),H=ee(String.prototype.toLowerCase),K=ee(String.prototype.toString),ve=ee(String.prototype.match),Q=ee(String.prototype.replace),Ge=ee(String.prototype.indexOf),_t=ee(String.prototype.trim),V=ee(RegExp.prototype.test),U=Ve(TypeError);function ee(y){return function(b){for(var _=arguments.length,L=new Array(_>1?_-1:0),F=1;F<_;F++)L[F-1]=arguments[F];return o(y,b,L)}}function Ve(y){return function(){for(var b=arguments.length,_=new Array(b),L=0;L<b;L++)_[L]=arguments[L];return a(y,_)}}function S(y,b,_){_=_||H,w&&w(y,null);for(var L=b.length;L--;){var F=b[L];if(typeof F=="string"){var oe=_(F);oe!==F&&(I(b)||(b[L]=oe),F=oe)}y[F]=!0}return y}function ae(y){var b=g(null),_;for(_ in y)o(A,y,[_])===!0&&(b[_]=y[_]);return b}function O(y,b){for(;y!==null;){var _=k(y,b);if(_){if(_.get)return ee(_.get);if(typeof _.value=="function")return ee(_.value)}y=C(y)}function L(F){return console.warn("fallback value for",F),null}return L}var Ae=D(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Se=D(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),De=D(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),et=D(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ne=D(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),Re=D(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),xe=D(["#text"]),ye=D(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","con
`+z),Ie&&(z=Q(z,xt," "),z=Q(z,Lt," "),z=Q(z,It," ")),ie&&st?ie.createHTML(z):z},b.setConfig=function(E){Gt(E),Ot=!0},b.clearConfig=function(){Fe=null,Ot=!1},b.isValidAttribute=function(E,h,v){Fe||Gt({});var N=W(E),M=W(h);return Ur(N,M,v)},b.addHook=function(E,h){typeof h=="function"&&(ce[E]=ce[E]||[],P(ce[E],h))},b.removeHook=function(E){if(ce[E])return c(ce[E])},b.removeHooks=function(E){ce[E]&&(ce[E]=[])},b.removeAllHooks=function(){ce={}},b}var Bi=yr();return Bi})});var ur=Ee((cs,Ti)=>{Ti.exports=window.DOMPurify||(window.DOMPurify=cr().default||cr())});var wi=Ee((ds,pr)=>{function _i(e,t){if(t&&t.documentElement)e=t,t=arguments[2];else if(!e||!e.documentElement)throw new Error("First argument to Readability constructor should be a document object.");if(t=t||{},this._doc=e,this._docJSDOMParser=this._doc.firstChild.__JSDOMParser__,this._articleTitle=null,this._articleByline=null,this._articleDir=null,this._articleSiteName=null,this._attempts=[],this._debug=!!t.debug,this._maxElemsToParse=t.maxElemsToParse||this.DEFAULT_MAX_ELEMS_TO_PARSE,this._nbTopCandidates=t.nbTopCandidates||this.DEFAULT_N_TOP_CANDIDATES,this._charThreshold=t.charThreshold||this.DEFAULT_CHAR_THRESHOLD,this._classesToPreserve=this.CLASSES_TO_PRESERVE.concat(t.classesToPreserve||[]),this._keepClasses=!!t.keepClasses,this._serializer=t.serializer||function(r){return r.innerHTML},this._disableJSONLD=!!t.disableJSONLD,this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY,this._debug){let r=function(i){if(i.nodeType==i.TEXT_NODE)return`${i.nodeName} ("${i.textContent}")`;let s=Array.from(i.attributes||[],function(l){return`${l.name}="${l.value}"`}).join(" ");return`<${i.localName} ${s}>`};this.log=function(){if(typeof dump!="undefined"){var i=Array.prototype.map.call(arguments,function(s){return s&&s.nodeName?r(s):s}).join(" ");dump("Reader: (Readability) "+i+`
`)}else if(typeof console!="undefined"){let s=Array.from(arguments,l=>l&&l.nodeType==this.ELEMENT_NODE?r(l):l);s.unshift("Reader: (Readability)"),console.log.apply(console,s)}}}else this.log=function(){}}_i.prototype={FLAG_STRIP_UNLIKELYS:1,FLAG_WEIGHT_CLASSES:2,FLAG_CLEAN_CONDITIONALLY:4,ELEMENT_NODE:1,TEXT_NODE:3,DEFAULT_MAX_ELEMS_TO_PARSE:0,DEFAULT_N_TOP_CANDIDATES:5,DEFAULT_TAGS_TO_SCORE:"section,h2,h3,h4,h5,h6,p,td,pre".toUpperCase().split(","),DEFAULT_CHAR_THRESHOLD:500,REGEXPS:{unlikelyCandidates:/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,okMaybeItsACandidate:/and|article|body|column|content|main|shadow/i,positive:/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,negative:/-ad-|hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i,extraneous:/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,byline:/byline|author|dateline|writtenby|p-author/i,replaceFonts:/<(\/?)font[^>]*>/gi,normalize:/\s{2,}/g,videos:/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i,shareElements:/(\b|_)(share|sharedaddy)(\b|_)/i,nextLink:/(next|weiter|continue|>([^\|]|$)|»([^\|]|$))/i,prevLink:/(prev|earl|old|new|<|«)/i,tokenize:/\W+/g,whitespace:/^\s*$/,hasContent:/\S$/,hashUrl:/^#.+/,srcsetUrl:/(\S+)(\s+[\d.]+[xw])?(\s*(?:,|$))/g,b64DataUrl:/^data:\s*([^\s;,]+)\s*;\s*base64\s*,/i,jsonLdArticleTypes:/^Article|AdvertiserContentArticle|NewsArticle|AnalysisNewsArticle|AskPublicNewsArticle|BackgroundNewsArticle|OpinionNewsArticle|ReportageNewsArticle|ReviewNewsArticle|Report|SatiricalArticle|ScholarlyArticle|MedicalScholarlyArticle|SocialMediaPosting|BlogPosting|LiveBlogPosting|DiscussionForumPosting|TechArticle|APIReference$/},UNLIKELY_ROLES:["menu","menubar","complementary","navigation","alert","alertdialog","dialog"],DIV_TO_P_ELEMS:new Set(["BLOCKQUOTE","DL","DIV","IMG","OL","P","PRE","TABLE","UL"]),ALTER_TO_DIV_EXCEPTIONS:["DIV","ARTICLE","SECTION","P"],PRESENTATIONAL_ATTRIBUTES:["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","style","valign","vspace"],DEPRECATED_SIZE_ATTRIBUTE_ELEMS:["TABLE","TH","TD","HR","PRE"],PHRASING_ELEMS:["ABBR","AUDIO","B","BDO","BR","BUTTON","CITE","CODE","DATA","DATALIST","DFN","EM","EMBED","I","IMG","INPUT","KBD","LABEL","MARK","MATH","METER","NOSCRIPT","OBJECT","OUTPUT","PROGRESS","Q","RUBY","SAMP","SCRIPT","SELECT","SMALL","SPAN","STRONG","SUB","SUP","TEXTAREA","TIME","VAR","WBR"],CLASSES_TO_PRESERVE:["page"],HTML_ESCAPE_MAP:{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"},_postProcessContent:function(e){this._fixRelativeUris(e),this._simplifyNestedElements(e),this._keepClasses||this._cleanClasses(e)},_removeNodes:function(e,t){if(this._docJSDOMParser&&e._isLiveNodeList)throw new Error("Do not pass live node lists to _removeNodes");for(var r=e.length-1;r>=0;r--){var i=e[r],s=i.parentNode;s&&(!t||t.call(this,i,r,e))&&s.removeChild(i)}},_replaceNodeTags:function(e,t){if(this._docJSDOMParser&&e._isLiveNodeList)throw new Error("Do not pass live node lists to _replaceNodeTags");for(let r of e)this._setNodeTag(r,t)},_forEachNode:function(e,t){Array.prototype.forEach.call(e,t,this)},_findNode:function(e,t){return Array.prototype.find.call(e,t,this)},_someNode:function(e,t){return Array.prototype.some.call(e,t,this)},_everyNode:function(e,t){return Array.prototype.every.call(e,t,this)},_concatNodeLists:function(){var e=Array.prototype.slice,t=e.call(arguments),r=t.map(function(i){return e.call(i)});return Array.prototype.concat.apply([],r)},_getAllNodesWithTag:function(e,t){return e.querySelectorAll?e.querySelectorAll(t.join(",")):[].concat.apply([],t.map(function(r){var
# [%videoTitle%](%videoURL%)
2 years ago
%videoPlayer%`,vimeoNoteTitle:"Vimeo - %title%",vimeoNote:`[[ReadItLater]] [[Vimeo]]
2 years ago
# [%videoTitle%](%videoURL%)
2 years ago
%videoPlayer%`,bilibiliNoteTitle:"Bilibili - %title%",bilibiliNote:`[[ReadItLater]] [[Bilibili]]
2 years ago
# [%videoTitle%](%videoURL%)
2 years ago
%videoPlayer%`,twitterNoteTitle:"Tweet from %tweetAuthorName% (%date%)",twitterNote:`[[ReadItLater]] [[Tweet]]
2 years ago
# [%tweetAuthorName%](%tweetURL%)
2 years ago
%tweetContent%`,parseableArticleNoteTitle:"%title%",parsableArticleNote:`[[ReadItLater]] [[Article]]
2 years ago
# [%articleTitle%](%articleURL%)
2 years ago
%articleContent%`,notParseableArticleNoteTitle:"Article %date%",notParsableArticleNote:`[[ReadItLater]] [[Article]]
2 years ago
[%articleURL%](%articleURL%)`,textSnippetNoteTitle:"Note %date%",textSnippetNote:`[[ReadItLater]] [[Textsnippet]]
2 years ago
%content%`,mastodonNoteTitle:"Toot from %tootAuthorName% (%date%)",mastodonNote:`[[ReadItLater]] [[Toot]]
2 years ago
# [%tootAuthorName%](%tootURL%)
2 years ago
> %tootContent%`,downloadImages:!0,downloadImagesInArticleDir:!1,dateTitleFmt:"YYYY-MM-DD HH-mm-ss",dateContentFmt:"YYYY-MM-DD",downloadMastodonMediaAttachments:!0,downloadMastodonMediaAttachmentsInDir:!1,saveMastodonReplies:!1,mastodonReply:`[%tootAuthorName%](%tootURL%)
2 years ago
> %tootContent%`,stackExchangeNoteTitle:"%title%",stackExchangeNote:`[[ReadItLater]] [[StackExchange]]
2 years ago
# [%questionTitle%](%questionURL%)
2 years ago
Author: [%authorName%](%authorProfileURL%)
2 years ago
%questionContent%
2 years ago
***
2 years ago
%topAnswer%
2 years ago
%answers%`,stackExchangeAnswer:`Answered by: [%authorName%](%authorProfileURL%)
2 years ago
2 years ago
%answerContent%`,downloadStackExchangeAssets:!0,downloadStackExchangeAssetsInDir:!1,youtubeApiKey:""};var x=require("obsidian");var dt=class extends x.PluginSettingTab{constructor(r,i){super(r,i);this.plugin=i}display(){let{containerEl:r}=this;r.empty(),r.createEl("h2",{text:"General"}),new x.Setting(r).setName("Inbox dir").setDesc("Enter valid folder name. For nested folders use this format: Folder A/Folder B. If no folder is enetred, new note will be created in vault root.").addText(n=>n.setPlaceholder("Defaults to root").setValue(this.plugin.settings.inboxDir||R.inboxDir).onChange(async u=>{this.plugin.settings.inboxDir=u,await this.plugin.saveSettings()})),new x.Setting(r).setName("Assets dir").setDesc("Enter valid folder name. For nested folders use this format: Folder A/Folder B. If no folder is enetred, new note will be created in vault root.").addText(n=>n.setPlaceholder("Defaults to root").setValue(this.plugin.settings.assetsDir||R.inboxDir+"/assets").onChange(async u=>{this.plugin.settings.assetsDir=u,await this.plugin.saveSettings()})),new x.Setting(r).setName("Open new note").setDesc("If enabled, new note will open in current workspace").addToggle(n=>n.setValue(this.plugin.settings.openNewNote||R.openNewNote).onChange(async u=>{this.plugin.settings.openNewNote=u,await this.plugin.saveSettings()})),new x.Setting(r).setName("Date format string").setDesc("Format of the %date% variable. NOTE: do not use symbols forbidden in file names.").addText(n=>n.setPlaceholder("Defaults to YYYY-MM-DD HH-mm-ss").setValue(this.plugin.settings.dateTitleFmt||R.dateTitleFmt).onChange(async u=>{this.plugin.settings.dateTitleFmt=u,await this.plugin.saveSettings()})),new x.Setting(r).setName("Date format string in contents").setDesc("Format of the %date% variable for contents").addText(n=>n.setPlaceholder("Defaults to YYYY-MM-DD").setValue(this.plugin.settings.dateContentFmt||R.dateContentFmt).onChange(async u=>{this.plugin.settings.dateContentFmt=u,await this.plugin.saveSettings()})),r.createEl("h2",{text:"YouTube"}),new x.Setting(r).setName("Youtube note template title").setDesc("Available variables: %title%, %date%").addText(n=>n.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.youtubeNoteTitle||R.youtubeNoteTitle).onChange(async u=>{this.plugin.settings.youtubeNoteTitle=u,await this.plugin.saveSettings()})),new x.Setting(r).setName("Youtube note template").setDesc("Available variables: %date%, %videoTitle%, %videoURL%, %videoId%, %videoPlayer%, %channelId%, %channelName%, %channelURL%").addTextArea(n=>{n.setValue(this.plugin.settings.youtubeNote||R.youtubeNote).onChange(async u=>{this.plugin.settings.youtubeNote=u,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new x.Setting(r).setName("Youtube Data API v3 key").setDesc("If entered, additional template variables are available").addText(n=>n.setPlaceholder("").setValue(this.plugin.settings.youtubeApiKey||R.youtubeApiKey).onChange(async u=>{this.plugin.settings.youtubeApiKey=u,await this.plugin.saveSettings()})),r.createEl("h2",{text:"Vimeo"}),new x.Setting(r).setName("Vimeo note title template").setDesc("Available variables: %title%, %date%").addText(n=>n.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.vimeoNoteTitle||R.vimeoNoteTitle).onChange(async u=>{this.plugin.settings.vimeoNoteTitle=u,await this.plugin.saveSettings()})),new x.Setting(r).setName("Vimeo note template").setDesc("Available variables: %date%, %videoTitle%, %videoURL%, %videoId%, %videoPlayer%, %channelName%, %channelURL%").addTextArea(n=>{n.setValue(this.plugin.settings.vimeoNote||R.vimeoNote).onChange(async u=>{this.plugin.settings.vimeoNote=u,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),r.createEl("h2",{text:"Bilibili"}),new x.Setting(r).setName("Bilibili note template title").setDesc("Available variables: %title%").addText(n=>n.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.bilibiliNoteTitle||R.bilibiliNoteTitle).onChange(async u=>{this.plugin.settings.bilibiliNoteTitle=u,await this.plugin.saveSe
`;)t--;return e.substring(0,t)}var Pn=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function nr(e){return ar(e,Pn)}var si=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function oi(e){return ar(e,si)}function Mn(e){return ci(e,si)}var li=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function On(e){return ar(e,li)}function Fn(e){return ci(e,li)}function ar(e,t){return t.indexOf(e.nodeName)>=0}function ci(e,t){return e.getElementsByTagName&&t.some(function(r){return e.getElementsByTagName(r).length})}var Z={};Z.paragraph={filter:"p",replacement:function(e){return`
2 years ago
`+e+`
2 years ago
2 years ago
`}};Z.lineBreak={filter:"br",replacement:function(e,t,r){return r.br+`
`}};Z.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,r){var i=Number(t.nodeName.charAt(1));if(r.headingStyle==="setext"&&i<3){var s=ir(i===1?"=":"-",e.length);return`
2 years ago
`+e+`
2 years ago
`+s+`
2 years ago
`}else return`
2 years ago
2 years ago
`+ir("#",i)+" "+e+`
2 years ago
2 years ago
`}};Z.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
2 years ago
`+e+`
2 years ago
2 years ago
`}};Z.list={filter:["ul","ol"],replacement:function(e,t){var r=t.parentNode;return r.nodeName==="LI"&&r.lastElementChild===t?`
`+e:`
2 years ago
`+e+`
2 years ago
2 years ago
`}};Z.listItem={filter:"li",replacement:function(e,t,r){e=e.replace(/^\n+/,"").replace(/\n+$/,`
`).replace(/\n/gm,`
2 years ago
`);var i=r.bulletListMarker+" ",s=t.parentNode;if(s.nodeName==="OL"){var l=s.getAttribute("start"),n=Array.prototype.indexOf.call(s.children,t);i=(l?Number(l)+n:n+1)+". "}return i+e+(t.nextSibling&&!/\n$/.test(e)?`
`:"")}};Z.indentedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,r){return`
2 years ago
`+t.firstChild.textContent.replace(/\n/g,`
`)+`
2 years ago
2 years ago
`}};Z.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,r){for(var i=t.firstChild.getAttribute("class")||"",s=(i.match(/language-(\S+)/)||[null,""])[1],l=t.firstChild.textContent,n=r.fence.charAt(0),u=3,d=new RegExp("^"+n+"{3,}","gm"),m;m=d.exec(l);)m[0].length>=u&&(u=m[0].length+1);var A=ir(n,u);return`
2 years ago
2 years ago
`+A+s+`
`+l.replace(/\n$/,"")+`
`+A+`
2 years ago
2 years ago
`}};Z.horizontalRule={filter:"hr",replacement:function(e,t,r){return`
2 years ago
`+r.hr+`
2 years ago
2 years ago
`}};Z.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var r=t.getAttribute("href"),i=yt(t.getAttribute("title"));return i&&(i=' "'+i+'"'),"["+e+"]("+r+i+")"}};Z.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,r){var i=t.getAttribute("href"),s=yt(t.getAttribute("title"));s&&(s=' "'+s+'"');var l,n;switch(r.linkReferenceStyle){case"collapsed":l="["+e+"][]",n="["+e+"]: "+i+s;break;case"shortcut":l="["+e+"]",n="["+e+"]: "+i+s;break;default:var u=this.references.length+1;l="["+e+"]["+u+"]",n="["+u+"]: "+i+s}return this.references.push(n),l},references:[],append:function(e){var t="";return this.references.length&&(t=`
2 years ago
`+this.references.join(`
`)+`
2 years ago
2 years ago
`,this.references=[]),t}};Z.emphasis={filter:["em","i"],replacement:function(e,t,r){return e.trim()?r.emDelimiter+e+r.emDelimiter:""}};Z.strong={filter:["strong","b"],replacement:function(e,t,r){return e.trim()?r.strongDelimiter+e+r.strongDelimiter:""}};Z.code={filter:function(e){var t=e.previousSibling||e.nextSibling,r=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!r},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",r="`",i=e.match(/`+/gm)||[];i.indexOf(r)!==-1;)r=r+"`";return r+t+e+t+r}};Z.image={filter:"img",replacement:function(e,t){var r=yt(t.getAttribute("alt")),i=t.getAttribute("src")||"",s=yt(t.getAttribute("title")),l=s?' "'+s+'"':"";return i?"!["+r+"]("+i+l+")":""}};function yt(e){return e?e.replace(/(\n+\s*)+/g,`
`):""}function ui(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}ui.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=er(this.array,e,this.options))||(t=er(this._keep,e,this.options))||(t=er(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function er(e,t,r){for(var i=0;i<e.length;i++){var s=e[i];if(kn(s,t,r))return s}}function kn(e,t,r){var i=e.filter;if(typeof i=="string"){if(i===t.nodeName.toLowerCase())return!0}else if(Array.isArray(i)){if(i.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof i=="function"){if(i.call(e,t,r))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function Un(e){var t=e.element,r=e.isBlock,i=e.isVoid,s=e.isPre||function(w){return w.nodeName==="PRE"};if(!(!t.firstChild||s(t))){for(var l=null,n=!1,u=null,d=ni(u,t,s);d!==t;){if(d.nodeType===3||d.nodeType===4){var m=d.data.replace(/[ \r\n\t]+/g," ");if((!l||/ $/.test(l.data))&&!n&&m[0]===" "&&(m=m.substr(1)),!m){d=tr(d);continue}d.data=m,l=d}else if(d.nodeType===1)r(d)||d.nodeName==="BR"?(l&&(l.data=l.data.replace(/ $/,"")),l=null,n=!1):i(d)||s(d)?(l=null,n=!0):l&&(n=!1);else{d=tr(d);continue}var A=ni(u,d,s);u=d,d=A}l&&(l.data=l.data.replace(/ $/,""),l.data||tr(l))}}function tr(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function ni(e,t,r){return e&&e.parentNode===t||r(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var hi=typeof window!="undefined"?window:{};function Bn(){var e=hi.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch(r){}return t}function Hn(){var e=function(){};return Gn()?e.prototype.parseFromString=function(t){var r=new window.ActiveXObject("htmlfile");return r.designMode="on",r.open(),r.write(t),r.close(),r}:e.prototype.parseFromString=function(t){var r=document.implementation.createHTMLDocument("");return r.open(),r.write(t),r.close(),r},e}function Gn(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch(t){window.ActiveXObject&&(e=!0)}return e}var Vn=Bn()?hi.DOMParser:Hn();function $n(e,t){var r;if(typeof e=="string"){var i=Wn().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");r=i.getElementById("turndown-root")}else r=e.cloneNode(!0);return Un({element:r,isBlock:nr,isVoid:oi,isPre:t.preformattedCode?zn:null}),r}var rr;function Wn(){return rr=rr||new Vn,rr}function zn(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function jn(e,t){return e.isBlock=nr(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=Yn(e),e.flankingWhitespace=qn(e,t),e}function Yn(e){return!oi(e)&&!On(e)&&/^\s*$/i.test(e.textContent)&&!Mn(e)&&!Fn(e)}function qn(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var r=Xn(e.textContent);return r.leadingAscii&&ai("left",e,t)&&(r.leading=r.leadingNonAscii),r.trailingAscii&&ai("right",e,t)&&(r.trailing=r.trailingNonAscii),{leading:r.leading,trailing:r.trailing}}function Xn(e){var t=e.match(/^(([ \t\r\n]*)(\s*))[\s\S]*?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function ai(e,t,r){var i,s,l;return e==="left"?(i=t.previousSibling,s=/ $/):(i=t.nextSibling,s=/^ /),i&&(i.nodeType===3?l=s.test(i.nodeValue):r.preformattedCode&&i.nodeName==="CODE"?l=!1:i.nodeType===1&&!nr(i)&&(l=s.test(i.textContent))),l}var Kn=Array.prototype.reduce,Jn=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>
2 years ago
`:""},keepReplacement:function(r,i){return i.isBlock?`
2 years ago
`+i.outerHTML+`
2 years ago
`:i.outerHTML},defaultReplacement:function(r,i){return i.isBlock?`
2 years ago
`+r+`
2 years ago
2 years ago
`:r}};this.options=Ln({},t,e),this.rules=new ui(this.options)}Nt.prototype={turndown:function(e){if(!ea(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=fi.call(this,new $n(e,this.options));return Zn.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if(typeof e=="function")e(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return Jn.reduce(function(t,r){return t.replace(r[0],r[1])},e)}};function fi(e){var t=this;return Kn.call(e.childNodes,function(r,i){i=new jn(i,t.options);var s="";return i.nodeType===3?s=i.isCode?i.nodeValue:t.escape(i.nodeValue):i.nodeType===1&&(s=Qn.call(t,i)),pi(r,s)},"")}function Zn(e){var t=this;return this.rules.forEach(function(r){typeof r.append=="function"&&(e=pi(e,r.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function Qn(e){var t=this.rules.forNode(e),r=fi.call(this,e),i=e.flankingWhitespace;return(i.leading||i.trailing)&&(r=r.trim()),i.leading+t.replacement(r,e,this.options)+i.trailing}function pi(e,t){var r=Cn(e),i=In(t),s=Math.max(e.length-r.length,t.length-i.length),l=`
2 years ago
2 years ago
`.substring(0,s);return r+l+i}function ea(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var gi=Nt;var mi=/highlight-(?:text|source)-([a-z0-9]+)/;function ta(e){e.addRule("highlightedCodeBlock",{filter:function(t){var r=t.firstChild;return t.nodeName==="DIV"&&mi.test(t.className)&&r&&r.nodeName==="PRE"},replacement:function(t,r,i){var s=r.className||"",l=(s.match(mi)||[null,""])[1];return`
2 years ago
2 years ago
`+i.fence+l+`
`+r.firstChild.textContent+`
`+i.fence+`
2 years ago
2 years ago
`}})}function ra(e){e.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(t){return"~"+t+"~"}})}var ia=Array.prototype.indexOf,we={};we.tableCell={filter:["th","td"],replacement:function(e,t){return di(e,t)+vi(t,"")}};we.tableRow={filter:"tr",replacement:function(e,t){var r="",i={left:":--",right:"--:",center:":-:"};if(na(t))for(var s=0;s<t.childNodes.length;s++){var l="---",n=(t.childNodes[s].getAttribute("align")||"").toLowerCase();n&&(l=i[n]||l),r+=di(l,t.childNodes[s])+vi(t.childNodes[s],l)}return`
`+e+(r?`
2 years ago
`+r:"")}};we.table={filter:function(e){return e.nodeName==="TABLE"&&!Ai(e)},replacement:function(e){return e=e.replace(`
2 years ago
`,`
`),`
2 years ago
`+e+`
2 years ago
2 years ago
`}};we.tableSection={filter:["thead","tbody","tfoot"],replacement:function(e){return e}};we.captionSection={filter:"caption",replacement:function(e,t){return t.parentNode.nodeName==="TABLE"&&t.parentNode.childNodes[0]===t?e:""}};function na(e){var t=e.parentNode,r=t;return(t.nodeName==="THEAD"||t.nodeName==="TFOOT"||t.nodeName==="TBODY")&&(r=t.parentNode),r.nodeName==="TABLE"&&r.rows[0]===e}function di(e,t){var r=ia.call(t.parentNode.childNodes,t),i=" ";return r===0&&(i="| "),e=e.replace(/\r\n/g,`
`).replace(/\n/g," "),e=e.replace(/\|/g,"\\|"),i+e+" |"}function vi(e,t){var r=e.getAttribute("colspan")||1;return r<=1?"":(" "+t+" |").repeat(r-1)}function Ai(e){for(var t=e.parentNode;t;){if(t.nodeName==="TABLE")return!0;t=t.parentNode}return!1}function aa(e){e.keep(function(r){return r.nodeName==="TABLE"&&Ai(r)});for(var t in we)e.addRule(t,we[t])}function sa(e){e.addRule("taskListItems",{filter:function(t){return t.type==="checkbox"&&t.parentNode.nodeName==="LI"},replacement:function(t,r){return(r.checked?"[x]":"[ ]")+" "}})}function yi(e){e.use([ta,ra,aa,sa])}async function de(e){let t=yi,r=new gi({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",emDelimiter:"*"});return r.use(t),r.turndown(e)}var sr=class extends j{constructor(r,i){super(r,i);this.PATTERN=/(https:\/\/twitter.com\/([a-zA-Z0-9_]+\/)([a-zA-Z0-9_]+\/[a-zA-Z0-9_]+))/}test(r){return this.isValidUrl(r)&&this.PATTERN.test(r)}async prepareNote(r){let i=JSON.parse(await(0,Ni.request)({method:"GET",contentType:"application/json",url:`https://publish.twitter.com/oembed?url=${r}`})),s=i.author_name,l=await de(i.html),n=this.settings.twitterNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%tweetAuthorName%/g,s).replace(/%tweetURL%/g,i.url).replace(/%tweetContent%/g,l),d=`${this.settings.twitterNoteTitle.replace(/%tweetAuthorName%/g,s).replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new G(d,n)}},bi=sr;var bt=require("obsidian"),hr=ke(ur());var fr=class extends j{constructor(r,i){super(r,i);this.PATTERN=/(https:\/\/|http:\/\/)(stackoverflow\.com|serverfault\.com|superuser\.com|askubuntu\.com|stackapps\.com|.*\.stackexchange\.com)\/(q|a|questions)\/(\d+)/}test(r){return this.isValidUrl(r)&&this.PATTERN.test(r)}async prepareNote(r){let i=await(0,bt.request)({method:"GET",url:r}),s=new DOMParser().parseFromString(i,"text/html"),l=await this.parseDocument(s),n=this.settings.stackExchangeNoteTitle.replace(/%title%/g,l.title).replace(/%date%/g,this.getFormattedDateForFilename()),u=l.topAnswer?this.settings.stackExchangeAnswer.replace(/%answerContent%/g,l.topAnswer.content).replace(/%authorName%/g,l.topAnswer.author.name).replace(/%authorProfileURL%/g,l.topAnswer.author.profile):"",d="";for(let I=0;I<l.answers.length;I++){let C=this.settings.stackExchangeAnswer.replace(/%answerContent%/g,l.answers[I].content).replace(/%authorName%/g,l.answers[I].author.name).replace(/%authorProfileURL%/g,l.answers[I].author.profile);d=d.concat(`
2 years ago
***
3 years ago
2 years ago
`,C)}let m=this.settings.stackExchangeNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%questionTitle%/g,l.title).replace(/%questionURL%/g,l.url).replace(/%questionContent%/g,l.content).replace(/%authorName%/g,l.author.name).replace(/%authorProfileURL%/g,l.author.profile).replace(/%topAnswer%/g,u).replace(/%answers%/g,d.trim()),A=this.settings.downloadStackExchangeAssetsInDir?`${this.settings.assetsDir}/${ne(n)}/`:this.settings.assetsDir;this.settings.downloadStackExchangeAssets&&bt.Platform.isDesktop&&(m=await _e(app,m,A));let w=`${n}.md`;return new G(w,m)}async parseDocument(r){var n,u,d,m,A,w,I,C,k,D,T,g,p,o,a,f;let i;try{i=new URL((d=(n=r.querySelector('link[rel="canonical"]'))==null?void 0:n.getAttribute("href"))!=null?d:(u=r.querySelector('meta[property="og:url"]'))==null?void 0:u.getAttribute("content"))}catch(c){i=null}let s=r.querySelector('#question [itemprop="author"]'),l=[];for(let c of r.querySelectorAll(".answer")){let P=c.querySelector('[itemprop="author"]');l.push({content:await de(hr.sanitize((m=c.querySelector('[itemprop="text"]'))!=null?m:"")),author:{name:(w=(A=P==null?void 0:P.querySelector('[itemprop="name"]'))==null?void 0:A.textContent)!=null?w:"",profile:P instanceof Element&&i instanceof URL?String.prototype.concat(i.origin,(C=(I=P.querySelector("a"))==null?void 0:I.getAttribute("href"))!=null?C:""):""}})}return{title:(D=(k=r.querySelector('#question-header [itemprop="name"]'))==null?void 0:k.textContent)!=null?D:"",content:await de(hr.sanitize((T=r.querySelector('#question [itemprop="text"]'))!=null?T:"")),url:(g=i==null?void 0:i.href)!=null?g:"",topAnswer:l.slice(0,1).shift(),answers:l.slice(1),author:{name:(o=(p=s==null?void 0:s.querySelector('[itemprop="name"]'))==null?void 0:p.textContent)!=null?o:"",profile:s instanceof Element&&i instanceof URL?String.prototype.concat(i.origin,(f=(a=s.querySelector("a"))==null?void 0:a.getAttribute("href"))!=null?f:""):""}}}},Ei=fr;var Be=require("obsidian"),Tt=ke(xi()),Li=ke(ur());var mr=class extends j{constructor(t,r){super(t,r)}test(t){return this.isValidUrl(t)}async prepareNote(t){let r=new URL(t),i=await(0,Be.request)({method:"GET",url:r.href}),s=new DOMParser().parseFromString(i,"text/html"),l=s.getElementsByTagName("base"),n=null;l.length>0&&(n=l.item(0).getAttribute("href"),Array.from(l).forEach(A=>{A.remove()}));let u=s.createElement("base");u.setAttribute("href",jt(n!=null?n:r.href,r.origin)),s.head.append(u);let d=Li.sanitize(s.body.innerHTML);s.body.innerHTML=d,(0,Tt.isProbablyReaderable)(s)||new Be.Notice("@mozilla/readability considers this document to unlikely be readerable.");let m=new Tt.Readability(s).parse();return m!=null&&m.content?await this.parsableArticle(this.app,m,r.href):this.notParsableArticle(r.href)}async parsableArticle(t,r,i){let s=r.title||"No title",l=r.siteName||"",n=r.byline||"",u=await de(r.content),d=this.settings.parseableArticleNoteTitle.replace(/%title%/g,s).replace(/%date%/g,this.getFormattedDateForFilename()),m=this.settings.downloadImagesInArticleDir?`${this.settings.assetsDir}/${ne(d)}/`:this.settings.assetsDir;this.settings.downloadImages&&Be.Platform.isDesktop&&(u=await _e(t,u,m));let A=this.settings.parsableArticleNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%articleTitle%/g,s).replace(/%articleURL%/g,i).replace(/%articleReadingTime%/g,`${this.getEstimatedReadingTime(r)}`).replace(/%articleContent%/g,u).replace(/%siteName%/g,l).replace(/%author%/g,n),w=`${d}.md`;return new G(w,A)}notParsableArticle(t){console.error("Website not parseable");let r=this.settings.notParsableArticleNote.replace("%articleURL%",t),s=`${this.settings.notParseableArticleNoteTitle.replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new G(s,r)}getEstimatedReadingTime(t){let r=t.lang||"en",i=this.getReadingSpeed(r),s=t.textContent.trim().split(/\s+/).length;return Math.ceil(s/i)}getReadingSpeed(t){let r=new Map([["en",228],["ar",138],["de",179],["es",218],["fi",161],["fr",195],["he",187],["it",188],["ja",193],["nl",202],["pl",166],["pt",181],["ru",184],["sk",190],["sl",180],["sv",1
***
2 years ago
`,C)}}let d=this.settings.mastodonNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%tootAuthorName%/g,s.account.display_name).replace(/%tootURL%/g,s.url).replace(/%tootContent%/g,u),m=`${l}.md`;return new G(m,d)}async loadStatus(t,r){return JSON.parse(await(0,He.request)({method:"GET",contentType:"application/json",url:`https://${t}${vr.STATUS}/${r}`}))}async loadReplies(t,r){let i=String.prototype.concat.call("https://",t,String.prototype.replace.call(vr.CONTEXT,"%id%",r));return JSON.parse(await(0,He.request)({method:"GET",contentType:"application/json",url:i})).descendants}async parseStatus(t,r){let i=await de(t.content),s=this.settings.downloadMastodonMediaAttachments&&He.Platform.isDesktop?await _e(app,this.prepareMedia(t.media_attachments),r):this.prepareMedia(t.media_attachments);return i.concat(s)}prepareMedia(t){return t.reduce((r,{url:i,description:s})=>{let l=s?`
> *${s}*`:"";return`${r}
2 years ago
![](${i})${l}`},"")}async testIsMastodon(t){if(!t)return!1;let r=new URL(t).hostname;try{let i=JSON.parse(await(0,He.request)({method:"GET",contentType:"application/json",url:`https://${r}${vr.INSTANCE}`}));return(i==null?void 0:i.domain)===r}catch(i){return!1}}},Pi=Ar;var Et=class extends ue.Plugin{async onload(){await this.loadSettings(),this.parsers=[new Qr(this.app,this.settings),new ti(this.app,this.settings),new ii(this.app,this.settings),new bi(this.app,this.settings),new Ei(this.app,this.settings),new Pi(this.app,this.settings),new Ii(this.app,this.settings),new Ci(this.app,this.settings)],(0,ue.addIcon)("read-it-later",fa),this.addRibbonIcon("read-it-later","ReadItLater: Save clipboard",async()=>{await this.processClipboard()}),this.addCommand({id:"save-clipboard-to-notice",name:"Save clipboard",callback:async()=>{await this.processClipboard()}}),this.addSettingTab(new dt(this.app,this))}async loadSettings(){this.settings=Object.assign({},R,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}async processClipboard(){let r=await navigator.clipboard.readText();for(let i of this.parsers)if(await i.test(r)){let s=await i.prepareNote(r);await this.writeFile(s.fileName,s.content);break}}async writeFile(r,i){let s;if(r=ne(r),await Ze(this.app.vault,this.settings.inboxDir),this.settings.inboxDir?s=(0,ue.normalizePath)(`${this.settings.inboxDir}/${r}`):s=(0,ue.normalizePath)(`/${r}`),await this.app.vault.adapter.exists(s))new ue.Notice(`${r} already exists!`);else{let l=await this.app.vault.create(s,i);this.settings.openNewNote&&this.app.workspace.getLeaf(!1).openFile(l),new ue.Notice(`${r} created successful`)}}},fa=`
<svg fill="currentColor" stroke="currentColor" version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
<g>
<path d="m365.9,144.9c-12.3,0-24.2,1.8-35.4,5.2v-114.7h-96.9l7.3-35.4h-150.2l6.8,35.4h-97.5v454.6h330.5v-102.1c11.2,3.4 23.1,5.2 35.4,5.2 68.8-0.1 124.1-56.4 124.1-124.1 0-67.8-55.3-124.1-124.1-124.1zm-150.1-124l-10.4,50h-79.2l-9.4-50h99zm93.8,448.2h-288.7v-412.8h80.7l6.8,35.4h113.6l7.3-35.4h80.3v102.2c-27.3,14-48.8,37.9-59.7,66.7h-200.9v20.8h195c-1.4,7.4-2.2,15.1-2.2,22.9 0,13.4 2.2,26.4 6.2,38.6h-199v20.9h208.1c12,21.8 30.3,39.7 52.5,51.1v89.6zm56.3-98c-57.3,0-103.2-46.9-103.2-103.2s46.9-103.2 103.2-103.2c57.3,0 103.2,46.9 103.2,103.2s-45.8,103.2-103.2,103.2z"/>
<polygon points="426.4,223.1 346.1,303.4 313.8,271.1 299.2,285.7 346.1,332.6 441,237.7 "/>
<rect width="233.5" x="49" y="143.9" height="20.9"/>
<rect width="233.5" x="49" y="388.9" height="20.9"/>
</g>
</svg>`;
/*! Bundled license information:
dompurify/dist/purify.js:
(*! @license DOMPurify 2.4.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.3/LICENSE *)
*/