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
107 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
*/
var en=Object.create;var ct=Object.defineProperty;var tn=Object.getOwnPropertyDescriptor;var rn=Object.getOwnPropertyNames;var nn=Object.getPrototypeOf,an=Object.prototype.hasOwnProperty;var Oe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),sn=(e,t)=>{for(var r in t)ct(e,r,{get:t[r],enumerable:!0})},Fr=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of rn(t))!an.call(e,l)&&l!==r&&ct(e,l,{get:()=>t[l],enumerable:!(i=tn(t,l))||i.enumerable});return e};var Xe=(e,t,r)=>(r=e!=null?en(nn(e)):{},Fr(t||!e||!e.__esModule?ct(r,"default",{value:e,enumerable:!0}):r,e)),on=e=>Fr(ct({},"__esModule",{value:!0}),e);var Vr=Oe((Hr,Gr)=>{(function(e){if(typeof Hr=="object")Gr.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(p,g){return p+g&4294967295},r=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function i(p,g,s,n,f,c){return g=t(t(g,p),t(n,c)),t(g<<f|g>>>32-f,s)}function l(p,g){var s=p[0],n=p[1],f=p[2],c=p[3];s+=(n&f|~n&c)+g[0]-680876936|0,s=(s<<7|s>>>25)+n|0,c+=(s&n|~s&f)+g[1]-389564586|0,c=(c<<12|c>>>20)+s|0,f+=(c&s|~c&n)+g[2]+606105819|0,f=(f<<17|f>>>15)+c|0,n+=(f&c|~f&s)+g[3]-1044525330|0,n=(n<<22|n>>>10)+f|0,s+=(n&f|~n&c)+g[4]-176418897|0,s=(s<<7|s>>>25)+n|0,c+=(s&n|~s&f)+g[5]+1200080426|0,c=(c<<12|c>>>20)+s|0,f+=(c&s|~c&n)+g[6]-1473231341|0,f=(f<<17|f>>>15)+c|0,n+=(f&c|~f&s)+g[7]-45705983|0,n=(n<<22|n>>>10)+f|0,s+=(n&f|~n&c)+g[8]+1770035416|0,s=(s<<7|s>>>25)+n|0,c+=(s&n|~s&f)+g[9]-1958414417|0,c=(c<<12|c>>>20)+s|0,f+=(c&s|~c&n)+g[10]-42063|0,f=(f<<17|f>>>15)+c|0,n+=(f&c|~f&s)+g[11]-1990404162|0,n=(n<<22|n>>>10)+f|0,s+=(n&f|~n&c)+g[12]+1804603682|0,s=(s<<7|s>>>25)+n|0,c+=(s&n|~s&f)+g[13]-40341101|0,c=(c<<12|c>>>20)+s|0,f+=(c&s|~c&n)+g[14]-1502002290|0,f=(f<<17|f>>>15)+c|0,n+=(f&c|~f&s)+g[15]+1236535329|0,n=(n<<22|n>>>10)+f|0,s+=(n&c|f&~c)+g[1]-165796510|0,s=(s<<5|s>>>27)+n|0,c+=(s&f|n&~f)+g[6]-1069501632|0,c=(c<<9|c>>>23)+s|0,f+=(c&n|s&~n)+g[11]+643717713|0,f=(f<<14|f>>>18)+c|0,n+=(f&s|c&~s)+g[0]-373897302|0,n=(n<<20|n>>>12)+f|0,s+=(n&c|f&~c)+g[5]-701558691|0,s=(s<<5|s>>>27)+n|0,c+=(s&f|n&~f)+g[10]+38016083|0,c=(c<<9|c>>>23)+s|0,f+=(c&n|s&~n)+g[15]-660478335|0,f=(f<<14|f>>>18)+c|0,n+=(f&s|c&~s)+g[4]-405537848|0,n=(n<<20|n>>>12)+f|0,s+=(n&c|f&~c)+g[9]+568446438|0,s=(s<<5|s>>>27)+n|0,c+=(s&f|n&~f)+g[14]-1019803690|0,c=(c<<9|c>>>23)+s|0,f+=(c&n|s&~n)+g[3]-187363961|0,f=(f<<14|f>>>18)+c|0,n+=(f&s|c&~s)+g[8]+1163531501|0,n=(n<<20|n>>>12)+f|0,s+=(n&c|f&~c)+g[13]-1444681467|0,s=(s<<5|s>>>27)+n|0,c+=(s&f|n&~f)+g[2]-51403784|0,c=(c<<9|c>>>23)+s|0,f+=(c&n|s&~n)+g[7]+1735328473|0,f=(f<<14|f>>>18)+c|0,n+=(f&s|c&~s)+g[12]-1926607734|0,n=(n<<20|n>>>12)+f|0,s+=(n^f^c)+g[5]-378558|0,s=(s<<4|s>>>28)+n|0,c+=(s^n^f)+g[8]-2022574463|0,c=(c<<11|c>>>21)+s|0,f+=(c^s^n)+g[11]+1839030562|0,f=(f<<16|f>>>16)+c|0,n+=(f^c^s)+g[14]-35309556|0,n=(n<<23|n>>>9)+f|0,s+=(n^f^c)+g[1]-1530992060|0,s=(s<<4|s>>>28)+n|0,c+=(s^n^f)+g[4]+1272893353|0,c=(c<<11|c>>>21)+s|0,f+=(c^s^n)+g[7]-155497632|0,f=(f<<16|f>>>16)+c|0,n+=(f^c^s)+g[10]-1094730640|0,n=(n<<23|n>>>9)+f|0,s+=(n^f^c)+g[13]+681279174|0,s=(s<<4|s>>>28)+n|0,c+=(s^n^f)+g[0]-358537222|0,c=(c<<11|c>>>21)+s|0,f+=(c^s^n)+g[3]-722521979|0,f=(f<<16|f>>>16)+c|0,n+=(f^c^s)+g[6]+76029189|0,n=(n<<23|n>>>9)+f|0,s+=(n^f^c)+g[9]-640364487|0,s=(s<<4|s>>>28)+n|0,c+=(s^n^f)+g[12]-421815835|0,c=(c<<11|c>>>21)+s|0,f+=(c^s^n)+g[15]+530742520|0,f=(f<<16|f>>>16)+c|0,n+=(f^c^s)+g[2]-995338651|0,n=(n<<23|n>>>9)+f|0,s+=(f^(n|~c))+g[0]-198630844|0,s=(s<<6|s>>>26)+n|0,c+=(n^(s|~f))+g[7]+1126891415|0,c=(c<<10|c>>>22)+s|0,f+=(s^(c|~n))+g[14]-1416354905|0,f=(f<<15|f>>>17)+c|0,n+=(c^(f|~s))+g[5]-57434055|0,n=(n<<21|n>>>11)+f|0,s+=(f^(n|~c))+g[12]+1700485571|0,s=(s<<6|s>>>26)+n|0,c+=(n^(s|~f))+g[3]-1894986606|0,c=(c<<10|c>>>22)+s|0,f+=(s^(c|~n))+g[10]-1051523|0,f=(f<<15|f>>>17)+c|0,n+=(c^(f|~s))+g[1]-2054922799|0,n=(n<<21|n>>>11)+f|0,s+=(f^(n|~c))+g[8]+1873313359|0,s=(s<<6|s>>>26)+n|0,c+=(n^(s|~f))+g[15]-30611744|0,c=(c<<10|c>>>22)+s|0,f+=(s^(c|~n))+g[6]-1560198380|0,f=(f<<15|f>>
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var N=Object.hasOwnProperty,S=Object.setPrototypeOf,P=Object.isFrozen,M=Object.getPrototypeOf,F=Object.getOwnPropertyDescriptor,x=Object.freeze,b=Object.seal,p=Object.create,g=typeof Reflect!="undefined"&&Reflect,s=g.apply,n=g.construct;s||(s=function(T,E,R){return T.apply(E,R)}),x||(x=function(T){return T}),b||(b=function(T){return T}),n||(n=function(T,E){return i(T,l(E))});var f=Q(Array.prototype.forEach),c=Q(Array.prototype.pop),I=Q(Array.prototype.push),H=Q(String.prototype.toLowerCase),X=Q(String.prototype.toString),de=Q(String.prototype.match),Z=Q(String.prototype.replace),Ue=Q(String.prototype.indexOf),At=Q(String.prototype.trim),V=Q(RegExp.prototype.test),U=Be(TypeError);function Q(A){return function(T){for(var E=arguments.length,R=new Array(E>1?E-1:0),k=1;k<E;k++)R[k-1]=arguments[k];return s(A,T,R)}}function Be(A){return function(){for(var T=arguments.length,E=new Array(T),R=0;R<T;R++)E[R]=arguments[R];return n(A,E)}}function w(A,T,E){E=E||H,S&&S(A,null);for(var R=T.length;R--;){var k=T[R];if(typeof k=="string"){var se=E(k);se!==k&&(P(T)||(T[R]=se),k=se)}A[k]=!0}return A}function ne(A){var T=p(null),E;for(E in A)s(N,A,[E])===!0&&(T[E]=A[E]);return T}function O(A,T){for(;A!==null;){var E=F(A,T);if(E){if(E.get)return Q(E.get);if(typeof E.value=="function")return Q(E.value)}A=M(A)}function R(k){return console.warn("fallback value for",k),null}return R}var ve=x(["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"]),Ee=x(["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"]),we=x(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ze=x(["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"]),Ae=x(["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"]),Se=x(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Re=x(["#text"]),Ne=x(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","contr
`+z),Le&&(z=Z(z,Et," "),z=Z(z,wt," "),z=Z(z,St," ")),re&&nt?re.createHTML(z):z},T.setConfig=function(_){Ft(_),xt=!0},T.clearConfig=function(){Me=null,xt=!1},T.isValidAttribute=function(_,h,v){Me||Ft({});var y=$(_),C=$(h);return Cr(y,C,v)},T.addHook=function(_,h){typeof h=="function"&&(le[_]=le[_]||[],I(le[_],h))},T.removeHook=function(_){if(le[_])return c(le[_])},T.removeHooks=function(_){le[_]&&(le[_]=[])},T.removeAllHooks=function(){le={}},T}var Ii=gr();return Ii})});var nr=Oe((Wa,pi)=>{pi.exports=window.DOMPurify||(window.DOMPurify=ir().default||ir())});var vi=Oe((Ka,or)=>{function di(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 l=Array.from(i.attributes||[],function(o){return`${o.name}="${o.value}"`}).join(" ");return`<${i.localName} ${l}>`};this.log=function(){if(typeof dump!="undefined"){var i=Array.prototype.map.call(arguments,function(l){return l&&l.nodeName?r(l):l}).join(" ");dump("Reader: (Readability) "+i+`
`)}else if(typeof console!="undefined"){let l=Array.from(arguments,o=>o&&o.nodeType==this.ELEMENT_NODE?r(o):o);l.unshift("Reader: (Readability)"),console.log.apply(console,l)}}}else this.log=function(){}}di.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],l=i.parentNode;l&&(!t||t.call(this,i,r,e))&&l.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
%answerContent%`,downloadStackExchangeAssets:!0,downloadStackExchangeAssetsInDir:!1};var L=require("obsidian");var gt=class extends L.PluginSettingTab{constructor(r,i){super(r,i);this.plugin=i}display(){let{containerEl:r}=this;r.empty(),r.createEl("h2",{text:"General"}),new L.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(a=>a.setPlaceholder("Defaults to root").setValue(this.plugin.settings.inboxDir||D.inboxDir).onChange(async u=>{this.plugin.settings.inboxDir=u,await this.plugin.saveSettings()})),new L.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(a=>a.setPlaceholder("Defaults to root").setValue(this.plugin.settings.assetsDir||D.inboxDir+"/assets").onChange(async u=>{this.plugin.settings.assetsDir=u,await this.plugin.saveSettings()})),new L.Setting(r).setName("Open new note").setDesc("If enabled, new note will open in current workspace").addToggle(a=>a.setValue(this.plugin.settings.openNewNote||D.openNewNote).onChange(async u=>{this.plugin.settings.openNewNote=u,await this.plugin.saveSettings()})),new L.Setting(r).setName("Date format string").setDesc("Format of the %date% variable. NOTE: do not use symbols forbidden in file names.").addText(a=>a.setPlaceholder("Defaults to YYYY-MM-DD HH-mm-ss").setValue(this.plugin.settings.dateTitleFmt||D.dateTitleFmt).onChange(async u=>{this.plugin.settings.dateTitleFmt=u,await this.plugin.saveSettings()})),new L.Setting(r).setName("Date format string in contents").setDesc("Format of the %date% variable for contents").addText(a=>a.setPlaceholder("Defaults to YYYY-MM-DD").setValue(this.plugin.settings.dateContentFmt||D.dateContentFmt).onChange(async u=>{this.plugin.settings.dateContentFmt=u,await this.plugin.saveSettings()})),r.createEl("h2",{text:"YouTube"}),new L.Setting(r).setName("Youtube note template title").setDesc("Available variables: %title%, %date%").addText(a=>a.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.youtubeNoteTitle||D.youtubeNoteTitle).onChange(async u=>{this.plugin.settings.youtubeNoteTitle=u,await this.plugin.saveSettings()})),new L.Setting(r).setName("Youtube note template").setDesc("Available variables: %date%, %videoTitle%, %videoURL%, %videoId%, %videoPlayer%, %channelId%, %channelName%, %channelURL%").addTextArea(a=>{a.setValue(this.plugin.settings.youtubeNote||D.youtubeNote).onChange(async u=>{this.plugin.settings.youtubeNote=u,await this.plugin.saveSettings()}),a.inputEl.rows=10,a.inputEl.cols=25}),r.createEl("h2",{text:"Vimeo"}),new L.Setting(r).setName("Vimeo note title template").setDesc("Available variables: %title%, %date%").addText(a=>a.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.vimeoNoteTitle||D.vimeoNoteTitle).onChange(async u=>{this.plugin.settings.vimeoNoteTitle=u,await this.plugin.saveSettings()})),new L.Setting(r).setName("Vimeo note template").setDesc("Available variables: %date%, %videoTitle%, %videoURL%, %videoId%, %videoPlayer%, %channelName%, %channelURL%").addTextArea(a=>{a.setValue(this.plugin.settings.vimeoNote||D.vimeoNote).onChange(async u=>{this.plugin.settings.vimeoNote=u,await this.plugin.saveSettings()}),a.inputEl.rows=10,a.inputEl.cols=25}),r.createEl("h2",{text:"Bilibili"}),new L.Setting(r).setName("Bilibili note template title").setDesc("Available variables: %title%").addText(a=>a.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.bilibiliNoteTitle||D.bilibiliNoteTitle).onChange(async u=>{this.plugin.settings.bilibiliNoteTitle=u,await this.plugin.saveSettings()})),new L.Setting(r).setName("Bilibili note template").setDesc("Available variables: %videoTitle%, %videoURL%, %videoId%, %videoPlayer%").addTextArea(a=>{a.setValue(this.plugin.settings.bilibiliNote||D.bilibiliNote).onChange(async u=>{this.plugin.settings.bilibiliNote=u,await this.plugin.saveSettings()}),a.inputE
`;)t--;return e.substring(0,t)}var Nn=["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 Zt(e){return Qt(e,Nn)}var Zr=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Qr(e){return Qt(e,Zr)}function An(e){return ti(e,Zr)}var ei=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function yn(e){return Qt(e,ei)}function Tn(e){return ti(e,ei)}function Qt(e,t){return t.indexOf(e.nodeName)>=0}function ti(e,t){return e.getElementsByTagName&&t.some(function(r){return e.getElementsByTagName(r).length})}var J={};J.paragraph={filter:"p",replacement:function(e){return`
2 years ago
`+e+`
2 years ago
`}};J.lineBreak={filter:"br",replacement:function(e,t,r){return r.br+`
`}};J.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 l=Jt(i===1?"=":"-",e.length);return`
2 years ago
`+e+`
`+l+`
2 years ago
`}else return`
2 years ago
`+Jt("#",i)+" "+e+`
2 years ago
`}};J.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
2 years ago
`+e+`
2 years ago
`}};J.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
`}};J.listItem={filter:"li",replacement:function(e,t,r){e=e.replace(/^\n+/,"").replace(/\n+$/,`
`).replace(/\n/gm,`
`);var i=r.bulletListMarker+" ",l=t.parentNode;if(l.nodeName==="OL"){var o=l.getAttribute("start"),a=Array.prototype.indexOf.call(l.children,t);i=(o?Number(o)+a:a+1)+". "}return i+e+(t.nextSibling&&!/\n$/.test(e)?`
`:"")}};J.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
`}};J.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")||"",l=(i.match(/language-(\S+)/)||[null,""])[1],o=t.firstChild.textContent,a=r.fence.charAt(0),u=3,d=new RegExp("^"+a+"{3,}","gm"),m;m=d.exec(o);)m[0].length>=u&&(u=m[0].length+1);var N=Jt(a,u);return`
2 years ago
`+N+l+`
`+o.replace(/\n$/,"")+`
`+N+`
2 years ago
`}};J.horizontalRule={filter:"hr",replacement:function(e,t,r){return`
2 years ago
`+r.hr+`
2 years ago
`}};J.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=pt(t.getAttribute("title"));return i&&(i=' "'+i+'"'),"["+e+"]("+r+i+")"}};J.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"),l=pt(t.getAttribute("title"));l&&(l=' "'+l+'"');var o,a;switch(r.linkReferenceStyle){case"collapsed":o="["+e+"][]",a="["+e+"]: "+i+l;break;case"shortcut":o="["+e+"]",a="["+e+"]: "+i+l;break;default:var u=this.references.length+1;o="["+e+"]["+u+"]",a="["+u+"]: "+i+l}return this.references.push(a),o},references:[],append:function(e){var t="";return this.references.length&&(t=`
2 years ago
`+this.references.join(`
`)+`
2 years ago
`,this.references=[]),t}};J.emphasis={filter:["em","i"],replacement:function(e,t,r){return e.trim()?r.emDelimiter+e+r.emDelimiter:""}};J.strong={filter:["strong","b"],replacement:function(e,t,r){return e.trim()?r.strongDelimiter+e+r.strongDelimiter:""}};J.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}};J.image={filter:"img",replacement:function(e,t){var r=pt(t.getAttribute("alt")),i=t.getAttribute("src")||"",l=pt(t.getAttribute("title")),o=l?' "'+l+'"':"";return i?"!["+r+"]("+i+o+")":""}};function pt(e){return e?e.replace(/(\n+\s*)+/g,`
`):""}function ri(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])}ri.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=Yt(this.array,e,this.options))||(t=Yt(this._keep,e,this.options))||(t=Yt(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 Yt(e,t,r){for(var i=0;i<e.length;i++){var l=e[i];if(bn(l,t,r))return l}}function bn(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 _n(e){var t=e.element,r=e.isBlock,i=e.isVoid,l=e.isPre||function(S){return S.nodeName==="PRE"};if(!(!t.firstChild||l(t))){for(var o=null,a=!1,u=null,d=Kr(u,t,l);d!==t;){if(d.nodeType===3||d.nodeType===4){var m=d.data.replace(/[ \r\n\t]+/g," ");if((!o||/ $/.test(o.data))&&!a&&m[0]===" "&&(m=m.substr(1)),!m){d=Xt(d);continue}d.data=m,o=d}else if(d.nodeType===1)r(d)||d.nodeName==="BR"?(o&&(o.data=o.data.replace(/ $/,"")),o=null,a=!1):i(d)||l(d)?(o=null,a=!0):o&&(a=!1);else{d=Xt(d);continue}var N=Kr(u,d,l);u=d,d=N}o&&(o.data=o.data.replace(/ $/,""),o.data||Xt(o))}}function Xt(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Kr(e,t,r){return e&&e.parentNode===t||r(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var ii=typeof window!="undefined"?window:{};function En(){var e=ii.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch(r){}return t}function wn(){var e=function(){};return Sn()?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 Sn(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch(t){window.ActiveXObject&&(e=!0)}return e}var Rn=En()?ii.DOMParser:wn();function Dn(e,t){var r;if(typeof e=="string"){var i=Ln().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");r=i.getElementById("turndown-root")}else r=e.cloneNode(!0);return _n({element:r,isBlock:Zt,isVoid:Qr,isPre:t.preformattedCode?xn:null}),r}var Kt;function Ln(){return Kt=Kt||new Rn,Kt}function xn(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function In(e,t){return e.isBlock=Zt(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=Cn(e),e.flankingWhitespace=Pn(e,t),e}function Cn(e){return!Qr(e)&&!yn(e)&&/^\s*$/i.test(e.textContent)&&!An(e)&&!Tn(e)}function Pn(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var r=Mn(e.textContent);return r.leadingAscii&&Jr("left",e,t)&&(r.leading=r.leadingNonAscii),r.trailingAscii&&Jr("right",e,t)&&(r.trailing=r.trailingNonAscii),{leading:r.leading,trailing:r.trailing}}function Mn(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 Jr(e,t,r){var i,l,o;return e==="left"?(i=t.previousSibling,l=/ $/):(i=t.nextSibling,l=/^ /),i&&(i.nodeType===3?o=l.test(i.nodeValue):r.preformattedCode&&i.nodeName==="CODE"?o=!1:i.nodeType===1&&!Zt(i)&&(o=l.test(i.textContent))),o}var On=Array.prototype.reduce,Fn=[[/\\/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
`:r}};this.options=mn({},t,e),this.rules=new ri(this.options)}mt.prototype={turndown:function(e){if(!Bn(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=ni.call(this,new Dn(e,this.options));return kn.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 Fn.reduce(function(t,r){return t.replace(r[0],r[1])},e)}};function ni(e){var t=this;return On.call(e.childNodes,function(r,i){i=new In(i,t.options);var l="";return i.nodeType===3?l=i.isCode?i.nodeValue:t.escape(i.nodeValue):i.nodeType===1&&(l=Un.call(t,i)),ai(r,l)},"")}function kn(e){var t=this;return this.rules.forEach(function(r){typeof r.append=="function"&&(e=ai(e,r.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function Un(e){var t=this.rules.forNode(e),r=ni.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 ai(e,t){var r=vn(e),i=dn(t),l=Math.max(e.length-r.length,t.length-i.length),o=`
2 years ago
`.substring(0,l);return r+o+i}function Bn(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var si=mt;var oi=/highlight-(?:text|source)-([a-z0-9]+)/;function Hn(e){e.addRule("highlightedCodeBlock",{filter:function(t){var r=t.firstChild;return t.nodeName==="DIV"&&oi.test(t.className)&&r&&r.nodeName==="PRE"},replacement:function(t,r,i){var l=r.className||"",o=(l.match(oi)||[null,""])[1];return`
2 years ago
`+i.fence+o+`
`+r.firstChild.textContent+`
`+i.fence+`
2 years ago
`}})}function Gn(e){e.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(t){return"~"+t+"~"}})}var Vn=Array.prototype.indexOf,_e={};_e.tableCell={filter:["th","td"],replacement:function(e,t){return li(e,t)+ci(t,"")}};_e.tableRow={filter:"tr",replacement:function(e,t){var r="",i={left:":--",right:"--:",center:":-:"};if(Wn(t))for(var l=0;l<t.childNodes.length;l++){var o="---",a=(t.childNodes[l].getAttribute("align")||"").toLowerCase();a&&(o=i[a]||o),r+=li(o,t.childNodes[l])+ci(t.childNodes[l],o)}return`
`+e+(r?`
`+r:"")}};_e.table={filter:function(e){return e.nodeName==="TABLE"&&!ui(e)},replacement:function(e){return e=e.replace(`
2 years ago
`,`
`),`
2 years ago
`+e+`
2 years ago
`}};_e.tableSection={filter:["thead","tbody","tfoot"],replacement:function(e){return e}};_e.captionSection={filter:"caption",replacement:function(e,t){return t.parentNode.nodeName==="TABLE"&&t.parentNode.childNodes[0]===t?e:""}};function Wn(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 li(e,t){var r=Vn.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 ci(e,t){var r=e.getAttribute("colspan")||1;return r<=1?"":(" "+t+" |").repeat(r-1)}function ui(e){for(var t=e.parentNode;t;){if(t.nodeName==="TABLE")return!0;t=t.parentNode}return!1}function $n(e){e.keep(function(r){return r.nodeName==="TABLE"&&ui(r)});for(var t in _e)e.addRule(t,_e[t])}function zn(e){e.addRule("taskListItems",{filter:function(t){return t.type==="checkbox"&&t.parentNode.nodeName==="LI"},replacement:function(t,r){return(r.checked?"[x]":"[ ]")+" "}})}function hi(e){e.use([Hn,Gn,$n,zn])}async function me(e){let t=hi,r=new si({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",emDelimiter:"*"});return r.use(t),r.turndown(e)}var er=class extends q{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,fi.request)({method:"GET",contentType:"application/json",url:`https://publish.twitter.com/oembed?url=${r}`})),l=i.author_name,o=await me(i.html),a=this.settings.twitterNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%tweetAuthorName%/g,l).replace(/%tweetURL%/g,i.url).replace(/%tweetContent%/g,o),d=`${this.settings.twitterNoteTitle.replace(/%tweetAuthorName%/g,l).replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new G(d,a)}},gi=er;var dt=require("obsidian"),ar=Xe(nr());var sr=class extends q{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,dt.request)({method:"GET",url:r}),l=new DOMParser().parseFromString(i,"text/html"),o=await this.parseDocument(l),a=this.settings.stackExchangeNoteTitle.replace(/%title%/g,o.title).replace(/%date%/g,this.getFormattedDateForFilename()),u=o.topAnswer?this.settings.stackExchangeAnswer.replace(/%answerContent%/g,o.topAnswer.content).replace(/%authorName%/g,o.topAnswer.author.name).replace(/%authorProfileURL%/g,o.topAnswer.author.profile):"",d="";for(let P=0;P<o.answers.length;P++){let M=this.settings.stackExchangeAnswer.replace(/%answerContent%/g,o.answers[P].content).replace(/%authorName%/g,o.answers[P].author.name).replace(/%authorProfileURL%/g,o.answers[P].author.profile);d=d.concat(`
2 years ago
***
3 years ago
`,M)}let m=this.settings.stackExchangeNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%questionTitle%/g,o.title).replace(/%questionURL%/g,o.url).replace(/%questionContent%/g,o.content).replace(/%authorName%/g,o.author.name).replace(/%authorProfileURL%/g,o.author.profile).replace(/%topAnswer%/g,u).replace(/%answers%/g,d.trim()),N=this.settings.downloadStackExchangeAssetsInDir?`${this.settings.assetsDir}/${ie(a)}/`:this.settings.assetsDir;this.settings.downloadStackExchangeAssets&&dt.Platform.isDesktop&&(m=await be(app,m,N));let S=`${a}.md`;return new G(S,m)}async parseDocument(r){var a,u,d,m,N,S,P,M,F,x,b,p,g,s,n,f;let i;try{i=new URL((d=(a=r.querySelector('link[rel="canonical"]'))==null?void 0:a.getAttribute("href"))!=null?d:(u=r.querySelector('meta[property="og:url"]'))==null?void 0:u.getAttribute("content"))}catch(c){i=null}let l=r.querySelector('#question [itemprop="author"]'),o=[];for(let c of r.querySelectorAll(".answer")){let I=c.querySelector('[itemprop="author"]');o.push({content:await me(ar.sanitize((m=c.querySelector('[itemprop="text"]'))!=null?m:"")),author:{name:(S=(N=I==null?void 0:I.querySelector('[itemprop="name"]'))==null?void 0:N.textContent)!=null?S:"",profile:I instanceof Element&&i instanceof URL?String.prototype.concat(i.origin,(M=(P=I.querySelector("a"))==null?void 0:P.getAttribute("href"))!=null?M:""):""}})}return{title:(x=(F=r.querySelector('#question-header [itemprop="name"]'))==null?void 0:F.textContent)!=null?x:"",content:await me(ar.sanitize((b=r.querySelector('#question [itemprop="text"]'))!=null?b:"")),url:(p=i==null?void 0:i.href)!=null?p:"",topAnswer:o.slice(0,1).shift(),answers:o.slice(1),author:{name:(s=(g=l==null?void 0:l.querySelector('[itemprop="name"]'))==null?void 0:g.textContent)!=null?s:"",profile:l instanceof Element&&i instanceof URL?String.prototype.concat(i.origin,(f=(n=l.querySelector("a"))==null?void 0:n.getAttribute("href"))!=null?f:""):""}}}},mi=sr;var Fe=require("obsidian"),vt=Xe(Ti()),bi=Xe(nr());var cr=class extends q{constructor(t,r){super(t,r)}test(t){return this.isValidUrl(t)}async prepareNote(t){let r=new URL(t),i=await(0,Fe.request)({method:"GET",url:r.href}),l=new DOMParser().parseFromString(i,"text/html"),o=l.getElementsByTagName("base"),a=null;o.length>0&&(a=o.item(0).getAttribute("href"),Array.from(o).forEach(N=>{N.remove()}));let u=l.createElement("base");u.setAttribute("href",Gt(a!=null?a:r.href,r.origin)),l.head.append(u);let d=bi.sanitize(l.body.innerHTML);l.body.innerHTML=d,(0,vt.isProbablyReaderable)(l)||new Fe.Notice("@mozilla/readability considers this document to unlikely be readerable.");let m=new vt.Readability(l).parse();return m!=null&&m.content?await this.parsableArticle(this.app,m,r.href):this.notParsableArticle(r.href)}async parsableArticle(t,r,i){let l=r.title||"No title",o=r.siteName||"",a=r.byline||"",u=await me(r.content),d=this.settings.parseableArticleNoteTitle.replace(/%title%/g,l).replace(/%date%/g,this.getFormattedDateForFilename()),m=this.settings.downloadImagesInArticleDir?`${this.settings.assetsDir}/${ie(d)}/`:this.settings.assetsDir;this.settings.downloadImages&&Fe.Platform.isDesktop&&(u=await be(t,u,m));let N=this.settings.parsableArticleNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%articleTitle%/g,l).replace(/%articleURL%/g,i).replace(/%articleReadingTime%/g,`${this.getEstimatedReadingTime(r)}`).replace(/%articleContent%/g,u).replace(/%siteName%/g,o).replace(/%author%/g,a),S=`${d}.md`;return new G(S,N)}notParsableArticle(t){console.error("Website not parseable");let r=this.settings.notParsableArticleNote.replace("%articleURL%",t),l=`${this.settings.notParseableArticleNoteTitle.replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new G(l,r)}getEstimatedReadingTime(t){let r=t.lang||"en",i=this.getReadingSpeed(r),l=t.textContent.trim().split(/\s+/).length;return Math.ceil(l/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
***
`,M)}}let d=this.settings.mastodonNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%tootAuthorName%/g,l.account.display_name).replace(/%tootURL%/g,l.url).replace(/%tootContent%/g,u),m=`${o}.md`;return new G(m,d)}async loadStatus(t,r){return JSON.parse(await(0,ke.request)({method:"GET",contentType:"application/json",url:`https://${t}${hr.STATUS}/${r}`}))}async loadReplies(t,r){let i=String.prototype.concat.call("https://",t,String.prototype.replace.call(hr.CONTEXT,"%id%",r));return JSON.parse(await(0,ke.request)({method:"GET",contentType:"application/json",url:i})).descendants}async parseStatus(t,r){let i=await me(t.content),l=this.settings.downloadMastodonMediaAttachments&&ke.Platform.isDesktop?await be(app,this.prepareMedia(t.media_attachments),r):this.prepareMedia(t.media_attachments);return i.concat(l)}prepareMedia(t){return t.reduce((r,{url:i,description:l})=>{let o=l?`
> *${l}*`:"";return`${r}
![](${i})${o}`},"")}async testIsMastodon(t){if(!t)return!1;let r=new URL(t).hostname;try{let i=JSON.parse(await(0,ke.request)({method:"GET",contentType:"application/json",url:`https://${r}${hr.INSTANCE}`}));return(i==null?void 0:i.domain)===r}catch(i){return!1}}},wi=fr;var Nt=class extends ce.Plugin{async onload(){await this.loadSettings(),this.parsers=[new zr(this.app,this.settings),new jr(this.app,this.settings),new Xr(this.app,this.settings),new gi(this.app,this.settings),new mi(this.app,this.settings),new wi(this.app,this.settings),new _i(this.app,this.settings),new Ei(this.app,this.settings)],(0,ce.addIcon)("read-it-later",Jn),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 gt(this.app,this))}async loadSettings(){this.settings=Object.assign({},D,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 l=await i.prepareNote(r);await this.writeFile(l.fileName,l.content);break}}async writeFile(r,i){let l;if(r=ie(r),await Ke(this.app.vault,this.settings.inboxDir),this.settings.inboxDir?l=(0,ce.normalizePath)(`${this.settings.inboxDir}/${r}`):l=(0,ce.normalizePath)(`/${r}`),await this.app.vault.adapter.exists(l))new ce.Notice(`${r} already exists!`);else{let o=await this.app.vault.create(l,i);this.settings.openNewNote&&this.app.workspace.getLeaf(!1).openFile(o),new ce.Notice(`${r} created successful`)}}},Jn=`
<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 *)
*/