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.

170 lines
168 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 months ago
var In=Object.create;var lt=Object.defineProperty;var Mn=Object.getOwnPropertyDescriptor;var On=Object.getOwnPropertyNames;var Fn=Object.getPrototypeOf,Un=Object.prototype.hasOwnProperty;var jn=(i,t,e)=>t in i?lt(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var We=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Hn=(i,t)=>{for(var e in t)lt(i,e,{get:t[e],enumerable:!0})},pa=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of On(t))!Un.call(i,n)&&n!==e&&lt(i,n,{get:()=>t[n],enumerable:!(a=Mn(t,n))||a.enumerable});return i};var St=(i,t,e)=>(e=i!=null?In(Fn(i)):{},pa(t||!i||!i.__esModule?lt(e,"default",{value:i,enumerable:!0}):e,i)),zn=i=>pa(lt({},"__esModule",{value:!0}),i);var L=(i,t,e)=>jn(i,typeof t!="symbol"?t+"":t,e);var Na=We(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.toSeconds=K.end=K.parse=K.pattern=void 0;var Ye="\\d+",ui="".concat(Ye,"(?:[\\.,]").concat(Ye,")?"),Kn="(".concat(Ye,"Y)?(").concat(Ye,"M)?(").concat(Ye,"W)?(").concat(Ye,"D)?"),Jn="T(".concat(ui,"H)?(").concat(ui,"M)?(").concat(ui,"S)?"),Zn="P(?:".concat(Kn,"(?:").concat(Jn,")?)"),Qn=["years","months","weeks","days","hours","minutes","seconds"],wa=Object.freeze({years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0});K.pattern=new RegExp(Zn);var er=function(i){var t=i.replace(/,/g,".").match(K.pattern);if(!t)throw new RangeError("invalid duration: ".concat(i));var e=t.slice(1);if(e.filter(function(a){return a!=null}).length===0)throw new RangeError("invalid duration: ".concat(i));if(e.filter(function(a){return/\./.test(a||"")}).length>1)throw new RangeError("only the smallest unit can be fractional");return e.reduce(function(a,n,r){return a[Qn[r]]=parseFloat(n||"0")||0,a},{})};K.parse=er;var tr=function(i,t){t===void 0&&(t=new Date);var e=Object.assign({},wa,i),a=t.getTime(),n=new Date(a);n.setFullYear(n.getFullYear()+e.years),n.setMonth(n.getMonth()+e.months),n.setDate(n.getDate()+e.days);var r=e.hours*3600*1e3,s=e.minutes*60*1e3;return n.setMilliseconds(n.getMilliseconds()+e.seconds*1e3+r+s),n.setDate(n.getDate()+e.weeks*7),n};K.end=tr;var ir=function(i,t){t===void 0&&(t=new Date);var e=Object.assign({},wa,i),a=t.getTime(),n=new Date(a),r=(0,K.end)(e,n),s=t.getTimezoneOffset(),p=r.getTimezoneOffset(),l=(s-p)*60,c=(r.getTime()-n.getTime())/1e3;return c+l};K.toSeconds=ir;K.default={end:K.end,toSeconds:K.toSeconds,pattern:K.pattern,parse:K.parse}});var Si=We((Ai,_i)=>{(function(i,t){typeof Ai=="object"&&typeof _i!="undefined"?_i.exports=t():typeof define=="function"&&define.amd?define(t):(i=typeof globalThis!="undefined"?globalThis:i||self,i.DOMPurify=t())})(Ai,function(){"use strict";function i(h){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(f){return typeof f}:function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f},i(h)}function t(h,f){return t=Object.setPrototypeOf||function(_,U){return _.__proto__=U,_},t(h,f)}function e(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(h){return!1}}function a(h,f,N){return e()?a=Reflect.construct:a=function(U,re,ne){var me=[null];me.push.apply(me,re);var Ae=Function.bind.apply(U,me),nt=new Ae;return ne&&t(nt,ne.prototype),nt},a.apply(null,arguments)}function n(h){return r(h)||s(h)||p(h)||c()}function r(h){if(Array.isArray(h))return l(h)}function s(h){if(typeof Symbol!="undefined"&&h[Symbol.iterator]!=null||h["@@iterator"]!=null)return Array.from(h)}function p(h,f){if(h){if(typeof h=="string")return l(h,f);var N=Object.prototype.toString.call(h).slice(8,-1);if(N==="Object"&&h.constructor&&(N=h.constructor.name),N==="Map"||N==="Set")return Array.from(h);if(N==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(N))return l(h,f)}}function l(h,f){(f==null||f>h.length)&&(f=h.length);for(var N=0,_=new Array(f);N<f;N++)_[N]=h[N];return _}function c(){throw ne
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var u=Object.hasOwnProperty,x=Object.setPrototypeOf,D=Object.isFrozen,T=Object.getPrototypeOf,k=Object.getOwnPropertyDescriptor,E=Object.freeze,S=Object.seal,C=Object.create,H=typeof Reflect!="undefined"&&Reflect,z=H.apply,b=H.construct;z||(z=function(f,N,_){return f.apply(N,_)}),E||(E=function(f){return f}),S||(S=function(f){return f}),b||(b=function(f,N){return a(f,n(N))});var Y=te(Array.prototype.forEach),w=te(Array.prototype.pop),V=te(Array.prototype.push),ge=te(String.prototype.toLowerCase),Ne=te(String.prototype.toString),Pe=te(String.prototype.match),ee=te(String.prototype.replace),Ze=te(String.prototype.indexOf),Ht=te(String.prototype.trim),O=te(RegExp.prototype.test),F=Qe(TypeError);function te(h){return function(f){for(var N=arguments.length,_=new Array(N>1?N-1:0),U=1;U<N;U++)_[U-1]=arguments[U];return z(h,f,_)}}function Qe(h){return function(){for(var f=arguments.length,N=new Array(f),_=0;_<f;_++)N[_]=arguments[_];return b(h,N)}}function A(h,f,N){var _;N=(_=N)!==null&&_!==void 0?_:ge,x&&x(h,null);for(var U=f.length;U--;){var re=f[U];if(typeof re=="string"){var ne=N(re);ne!==re&&(D(f)||(f[U]=ne),re=ne)}h[re]=!0}return h}function pe(h){var f=C(null),N;for(N in h)z(u,h,[N])===!0&&(f[N]=h[N]);return f}function P(h,f){for(;h!==null;){var N=k(h,f);if(N){if(N.get)return te(N.get);if(typeof N.value=="function")return te(N.value)}h=T(h)}function _(U){return console.warn("fallback value for",U),null}return _}var xe=E(["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"]),Ie=E(["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"]),Me=E(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ft=E(["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"]),Ee=E(["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"]),Oe=E(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Fe=E(["#text"]),ye=E(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","clas
`+B),je&&(B=ee(B,Wt," "),B=ee(B,Gt," "),B=ee(B,qt," ")),le&&wt?le.createHTML(B):B},f.setConfig=function(y){ni(y),Zt=!0},f.clearConfig=function(){$e=null,Zt=!1},f.isValidAttribute=function(y,o,m){$e||ni({});var g=G(y),R=G(o);return ra(g,R,m)},f.addHook=function(y,o){typeof o=="function"&&(de[y]=de[y]||[],V(de[y],o))},f.removeHook=function(y){if(de[y])return w(de[y])},f.removeHooks=function(y){de[y]&&(de[y]=[])},f.removeAllHooks=function(){de={}},f}var mn=Ui();return mn})});var Di=We((po,Wa)=>{Wa.exports=window.DOMPurify||(window.DOMPurify=Si().default||Si())});var Ya=We((vo,Ri)=>{function qa(i,t){if(t&&t.documentElement)i=t,t=arguments[2];else if(!i||!i.documentElement)throw new Error("First argument to Readability constructor should be a document object.");if(t=t||{},this._doc=i,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(e){return e.innerHTML},this._disableJSONLD=!!t.disableJSONLD,this._allowedVideoRegex=t.allowedVideoRegex||this.REGEXPS.videos,this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY,this._debug){let e=function(a){if(a.nodeType==a.TEXT_NODE)return`${a.nodeName} ("${a.textContent}")`;let n=Array.from(a.attributes||[],function(r){return`${r.name}="${r.value}"`}).join(" ");return`<${a.localName} ${n}>`};this.log=function(){if(typeof console!="undefined"){let n=Array.from(arguments,r=>r&&r.nodeType==this.ELEMENT_NODE?e(r):r);n.unshift("Reader: (Readability)"),console.log.apply(console,n)}else if(typeof dump!="undefined"){var a=Array.prototype.map.call(arguments,function(n){return n&&n.nodeName?e(n):n}).join(" ");dump("Reader: (Readability) "+a+`
`)}}}else this.log=function(){}}qa.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,commas:/\u002C|\u060C|\uFE50|\uFE10|\uFE11|\u2E41|\u2E34|\u2E32|\uFF0C/g,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(i){this._fixRelativeUris(i),this._simplifyNestedElements(i),this._keepClasses||this._cleanClasses(i)},_removeNodes:function(i,t){if(this._docJSDOMParser&&i._isLiveNodeList)throw new Error("Do not pass live node lists to _removeNodes");for(var e=i.length-1;e>=0;e--){var a=i[e],n=a.parentNode;n&&(!t||t.call(this,a,e,i))&&n.removeChild(a)}},_replaceNodeTags:function(i,t){if(this._docJSDOMParser&&i._isLiveNodeList)throw new Error("Do not pass live node lists to _replaceNodeTags");for(let e of i)this._setNodeTag(e,t)},_forEachNode:function(i,t){Array.prototype.forEach.call(i,t,this)},_findNode:function(i,t){return Array.prototype.find.call(i,t,this)},_someNode:function(i,t){return Array.prototype.some.call(i,t,this)},_everyNode:function(i,t){return Array.prototype.every.call(i,t,this)},_concatNodeLists:function(){var i=Array.prototype.slice,t=i.call(arguments),e=t.map(function(a){return i.call(a)});return Array.prototype.concat.apply([],e)},_getAllNodesWithTag:function(i,t){return i.querySelectorAll?i.querySelectorAll(t.join(",")):[].concat.apply([],t.map(function(e){var a=i.getElementsByTagName(e);return Array.isArray(a)?a:Array.from(a)}))},_cleanClasses:function(i){v
`;case"comma":return",";case"period":return".";case"semicolon":return";"}}var d={inboxDir:"ReadItLater Inbox",assetsDir:"ReadItLater Inbox/assets",openNewNote:!1,batchProcess:!1,batchProcessDelimiter:"newLine",openNewNoteInNewTab:!1,youtubeContentTypeSlug:"youtube",youtubeNoteTitle:"Youtube - {{ title }}",youtubeNote:`[[ReadItLater]] [[Youtube]]
2 months ago
# [{{ videoTitle }}]({{ videoURL }})
3 years ago
2 months ago
{{ videoPlayer }}`,youtubeEmbedWidth:"560",youtubeEmbedHeight:"315",youtubeUsePrivacyEnhancedEmbed:!0,vimeoContentTypeSlug:"vimeo",vimeoNoteTitle:"Vimeo - {{ title }}",vimeoNote:`[[ReadItLater]] [[Vimeo]]
3 years ago
2 months ago
# [{{ videoTitle }}]({{ videoURL }})
3 years ago
2 months ago
{{ videoPlayer }}`,vimeoEmbedWidth:"560",vimeoEmbedHeight:"315",bilibiliContentTypeSlug:"bilibili",bilibiliNoteTitle:"Bilibili - {{ title }}",bilibiliNote:`[[ReadItLater]] [[Bilibili]]
3 years ago
2 months ago
# [{{ videoTitle }}]({{ videoURL }})
3 years ago
2 months ago
{{ videoPlayer }}`,bilibiliEmbedWidth:"560",bilibiliEmbedHeight:"315",twitterContentTypeSlug:"xcom",twitterNoteTitle:"Tweet from {{ tweetAuthorName }} ({{ date }})",twitterNote:`[[ReadItLater]] [[Tweet]]
3 years ago
2 months ago
# [{{ tweetAuthorName }}]({{ tweetURL }})
3 years ago
2 months ago
{{ tweetContent }}`,parseableArticleContentType:"article",parseableArticleNoteTitle:"{{ title }}",parsableArticleNote:`[[ReadItLater]] [[Article]]
3 years ago
2 months ago
# [{{ articleTitle }}]({{ articleURL }})
3 years ago
2 months ago
{{ articleContent }}`,notParseableArticleContentType:"article",notParseableArticleNoteTitle:"Article {{ date }}",notParsableArticleNote:`[[ReadItLater]] [[Article]]
3 years ago
2 months ago
[{{ articleURL }}]({{ articleURL }})`,textSnippetContentType:"textsnippet",textSnippetNoteTitle:"Note {{ date }}",textSnippetNote:`[[ReadItLater]] [[Textsnippet]]
3 years ago
2 months ago
{{ content }}`,mastodonContentTypeSlug:"mastodon",mastodonNoteTitle:"Toot from {{ tootAuthorName }} ({{ date }})",mastodonNote:`[[ReadItLater]] [[Toot]]
3 years ago
2 months ago
# [{{ tootAuthorName }}]({{ tootURL }})
3 years ago
2 months 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 }})
3 years ago
2 months ago
> {{ tootContent }}`,stackExchangeContentType:"stackexchange",stackExchangeNoteTitle:"{{ title }}",stackExchangeNote:`[[ReadItLater]] [[StackExchange]]
3 years ago
2 months ago
# [{{ questionTitle }}]({{ questionURL }})
3 years ago
2 months ago
Author: [{{ authorName }}]({{ authorProfileURL }})
3 years ago
2 months ago
{{ questionContent }}
3 years ago
***
3 years ago
2 months ago
{{ topAnswer }}
3 years ago
2 months ago
{{ answers }}`,stackExchangeAnswer:`Answered by: [{{ authorName }}]({{ authorProfileURL }})
3 years ago
2 months ago
{{ answerContent }}`,downloadStackExchangeAssets:!0,downloadStackExchangeAssetsInDir:!1,youtubeApiKey:"",tikTokContentTypeSlug:"tiktok",tikTokNoteTitle:"TikTok from {{ authorName }} ({{ date }})",tikTokNote:`[[ReadItLater]] [[TikTok]]
2 years ago
2 months ago
{{ videoDescription }}
2 years ago
2 months ago
[{{ videoURL }}]({{ videoURL }})
2 years ago
2 months ago
{{ videoPlayer }}`,tikTokEmbedWidth:"325",tikTokEmbedHeight:"760",extendShareMenu:!0,filesystemLimitPath:null,filesystemLimitFileName:null};var v=require("obsidian");var Lt=class extends v.PluginSettingTab{constructor(e,a){super(e,a);L(this,"plugin");this.plugin=a}display(){let{containerEl:e}=this;e.empty(),e.createEl("h2",{text:"General"}),new v.Setting(e).setName("Inbox directory").setDesc("Enter valid directory name. For nested directory use this format: Directory A/Directory B. If no directory is entered, new note will be created in vault root.").addText(n=>n.setPlaceholder("Defaults to vault root directory").setValue(typeof this.plugin.settings.inboxDir=="undefined"?d.inboxDir:this.plugin.settings.inboxDir).onChange(async r=>{this.plugin.settings.inboxDir=r,await this.plugin.saveSettings()})),new v.Setting(e).setName("Assets directory").setDesc("Enter valid directory name. For nested directory use this format: Directory A/Directory B. If no directory is entered, new note will be created in Vault root.").addText(n=>n.setPlaceholder("Defaults to vault root directory").setValue(typeof this.plugin.settings.assetsDir=="undefined"?d.inboxDir+"/assets":this.plugin.settings.assetsDir).onChange(async r=>{this.plugin.settings.assetsDir=r,await this.plugin.saveSettings()})),new v.Setting(e).setName("Open new note in current workspace").setDesc("If enabled, new note will open in current workspace").addToggle(n=>n.setValue(this.plugin.settings.openNewNote||d.openNewNote).onChange(async r=>{this.plugin.settings.openNewNote=r,r===!0&&(this.plugin.settings.openNewNoteInNewTab=!1),await this.plugin.saveSettings(),this.display()})),new v.Setting(e).setName("Open new note in new tab").setDesc("If enabled, new note will open in new tab").addToggle(n=>n.setValue(this.plugin.settings.openNewNoteInNewTab||d.openNewNoteInNewTab).onChange(async r=>{this.plugin.settings.openNewNoteInNewTab=r,r===!0&&(this.plugin.settings.openNewNote=!1),await this.plugin.saveSettings(),this.display()})),new v.Setting(e).setName("Batch process URLs").setDesc("If enabled, a list of URLs will processed in sequence. Delimiter can be set in setting bellow.").addToggle(n=>{var r;return n.setValue((r=this.plugin.settings.batchProcess)!=null?r:d.batchProcess).onChange(async s=>{this.plugin.settings.batchProcess=s,await this.plugin.saveSettings()})}),new v.Setting(e).setName("Batch note creation delimiter").setDesc("Delimiter for batch list of notes").addDropdown(n=>{ya().forEach(r=>n.addOption(r.option,r.label)),n.setValue(this.plugin.settings.batchProcessDelimiter||d.batchProcessDelimiter),n.onChange(async r=>{this.plugin.settings.batchProcessDelimiter=r,await this.plugin.saveSettings()})}),new v.Setting(e).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 ${d.dateTitleFmt}`).setValue(typeof this.plugin.settings.dateTitleFmt=="undefined"?d.dateTitleFmt:this.plugin.settings.dateTitleFmt).onChange(async r=>{this.plugin.settings.dateTitleFmt=r,await this.plugin.saveSettings()})),new v.Setting(e).setName("Date format string in content").setDesc("Format of the %date% variable for content").addText(n=>n.setPlaceholder(`Defaults to ${d.dateContentFmt}`).setValue(typeof this.plugin.settings.dateContentFmt=="undefined"?d.dateContentFmt:this.plugin.settings.dateContentFmt).onChange(async r=>{this.plugin.settings.dateContentFmt=r,await this.plugin.saveSettings()})),new v.Setting(e).setName("Extend share menu").setDesc("If enabled, share menu will be extended with shortcut to create note directly from it. Requires plugin reload or Obsidian restart to apply change.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"extendShareMenu")?this.plugin.settings.extendShareMenu:d.extendShareMenu).onChange(async r=>{this.plugin.settings.extendShareMenu=r,await this.plugin.saveSettings()})),e.createEl("h2",{text:"YouTube"}),new v.Setting(e).setName("Youtube content type slug").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.set
`;)t--;return i.substring(0,t)}var sr=["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 Ti(i){return wi(i,sr)}var Ra=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function La(i){return wi(i,Ra)}function or(i){return Ia(i,Ra)}var Pa=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function lr(i){return wi(i,Pa)}function pr(i){return Ia(i,Pa)}function wi(i,t){return t.indexOf(i.nodeName)>=0}function Ia(i,t){return i.getElementsByTagName&&t.some(function(e){return i.getElementsByTagName(e).length})}var Q={};Q.paragraph={filter:"p",replacement:function(i){return`
3 years ago
2 months ago
`+i+`
3 years ago
2 months ago
`}};Q.lineBreak={filter:"br",replacement:function(i,t,e){return e.br+`
`}};Q.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(i,t,e){var a=Number(t.nodeName.charAt(1));if(e.headingStyle==="setext"&&a<3){var n=yi(a===1?"=":"-",i.length);return`
3 years ago
2 months ago
`+i+`
`+n+`
3 years ago
`}else return`
3 years ago
2 months ago
`+yi("#",a)+" "+i+`
3 years ago
2 months ago
`}};Q.blockquote={filter:"blockquote",replacement:function(i){return i=i.replace(/^\n+|\n+$/g,""),i=i.replace(/^/gm,"> "),`
3 years ago
2 months ago
`+i+`
3 years ago
2 months ago
`}};Q.list={filter:["ul","ol"],replacement:function(i,t){var e=t.parentNode;return e.nodeName==="LI"&&e.lastElementChild===t?`
`+i:`
3 years ago
2 months ago
`+i+`
3 years ago
2 months ago
`}};Q.listItem={filter:"li",replacement:function(i,t,e){i=i.replace(/^\n+/,"").replace(/\n+$/,`
`).replace(/\n/gm,`
2 months ago
`);var a=e.bulletListMarker+" ",n=t.parentNode;if(n.nodeName==="OL"){var r=n.getAttribute("start"),s=Array.prototype.indexOf.call(n.children,t);a=(r?Number(r)+s:s+1)+". "}return a+i+(t.nextSibling&&!/\n$/.test(i)?`
`:"")}};Q.indentedCodeBlock={filter:function(i,t){return t.codeBlockStyle==="indented"&&i.nodeName==="PRE"&&i.firstChild&&i.firstChild.nodeName==="CODE"},replacement:function(i,t,e){return`
3 years ago
2 months ago
`+t.firstChild.textContent.replace(/\n/g,`
`)+`
3 years ago
2 months ago
`}};Q.fencedCodeBlock={filter:function(i,t){return t.codeBlockStyle==="fenced"&&i.nodeName==="PRE"&&i.firstChild&&i.firstChild.nodeName==="CODE"},replacement:function(i,t,e){for(var a=t.firstChild.getAttribute("class")||"",n=(a.match(/language-(\S+)/)||[null,""])[1],r=t.firstChild.textContent,s=e.fence.charAt(0),p=3,l=new RegExp("^"+s+"{3,}","gm"),c;c=l.exec(r);)c[0].length>=p&&(p=c[0].length+1);var u=yi(s,p);return`
3 years ago
2 months ago
`+u+n+`
`+r.replace(/\n$/,"")+`
`+u+`
3 years ago
2 months ago
`}};Q.horizontalRule={filter:"hr",replacement:function(i,t,e){return`
3 years ago
2 months ago
`+e.hr+`
3 years ago
2 months ago
`}};Q.inlineLink={filter:function(i,t){return t.linkStyle==="inlined"&&i.nodeName==="A"&&i.getAttribute("href")},replacement:function(i,t){var e=t.getAttribute("href");e&&(e=e.replace(/([()])/g,"\\$1"));var a=It(t.getAttribute("title"));return a&&(a=' "'+a.replace(/"/g,'\\"')+'"'),"["+i+"]("+e+a+")"}};Q.referenceLink={filter:function(i,t){return t.linkStyle==="referenced"&&i.nodeName==="A"&&i.getAttribute("href")},replacement:function(i,t,e){var a=t.getAttribute("href"),n=It(t.getAttribute("title"));n&&(n=' "'+n+'"');var r,s;switch(e.linkReferenceStyle){case"collapsed":r="["+i+"][]",s="["+i+"]: "+a+n;break;case"shortcut":r="["+i+"]",s="["+i+"]: "+a+n;break;default:var p=this.references.length+1;r="["+i+"]["+p+"]",s="["+p+"]: "+a+n}return this.references.push(s),r},references:[],append:function(i){var t="";return this.references.length&&(t=`
3 years ago
`+this.references.join(`
`)+`
3 years ago
2 months ago
`,this.references=[]),t}};Q.emphasis={filter:["em","i"],replacement:function(i,t,e){return i.trim()?e.emDelimiter+i+e.emDelimiter:""}};Q.strong={filter:["strong","b"],replacement:function(i,t,e){return i.trim()?e.strongDelimiter+i+e.strongDelimiter:""}};Q.code={filter:function(i){var t=i.previousSibling||i.nextSibling,e=i.parentNode.nodeName==="PRE"&&!t;return i.nodeName==="CODE"&&!e},replacement:function(i){if(!i)return"";i=i.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(i)?" ":"",e="`",a=i.match(/`+/gm)||[];a.indexOf(e)!==-1;)e=e+"`";return e+t+i+t+e}};Q.image={filter:"img",replacement:function(i,t){var e=It(t.getAttribute("alt")),a=t.getAttribute("src")||"",n=It(t.getAttribute("title")),r=n?' "'+n+'"':"";return a?"!["+e+"]("+a+r+")":""}};function It(i){return i?i.replace(/(\n+\s*)+/g,`
`):""}function Ma(i){this.options=i,this._keep=[],this._remove=[],this.blankRule={replacement:i.blankReplacement},this.keepReplacement=i.keepReplacement,this.defaultRule={replacement:i.defaultReplacement},this.array=[];for(var t in i.rules)this.array.push(i.rules[t])}Ma.prototype={add:function(i,t){this.array.unshift(t)},keep:function(i){this._keep.unshift({filter:i,replacement:this.keepReplacement})},remove:function(i){this._remove.unshift({filter:i,replacement:function(){return""}})},forNode:function(i){if(i.isBlank)return this.blankRule;var t;return(t=vi(this.array,i,this.options))||(t=vi(this._keep,i,this.options))||(t=vi(this._remove,i,this.options))?t:this.defaultRule},forEach:function(i){for(var t=0;t<this.array.length;t++)i(this.array[t],t)}};function vi(i,t,e){for(var a=0;a<i.length;a++){var n=i[a];if(cr(n,t,e))return n}}function cr(i,t,e){var a=i.filter;if(typeof a=="string"){if(a===t.nodeName.toLowerCase())return!0}else if(Array.isArray(a)){if(a.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof a=="function"){if(a.call(i,t,e))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function mr(i){var t=i.element,e=i.isBlock,a=i.isVoid,n=i.isPre||function(x){return x.nodeName==="PRE"};if(!(!t.firstChild||n(t))){for(var r=null,s=!1,p=null,l=ka(p,t,n);l!==t;){if(l.nodeType===3||l.nodeType===4){var c=l.data.replace(/[ \r\n\t]+/g," ");if((!r||/ $/.test(r.data))&&!s&&c[0]===" "&&(c=c.substr(1)),!c){l=bi(l);continue}l.data=c,r=l}else if(l.nodeType===1)e(l)||l.nodeName==="BR"?(r&&(r.data=r.data.replace(/ $/,"")),r=null,s=!1):a(l)||n(l)?(r=null,s=!0):r&&(s=!1);else{l=bi(l);continue}var u=ka(p,l,n);p=l,l=u}r&&(r.data=r.data.replace(/ $/,""),r.data||bi(r))}}function bi(i){var t=i.nextSibling||i.parentNode;return i.parentNode.removeChild(i),t}function ka(i,t,e){return i&&i.parentNode===t||e(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var Ni=typeof window!="undefined"?window:{};function dr(){var i=Ni.DOMParser,t=!1;try{new i().parseFromString("","text/html")&&(t=!0)}catch(e){}return t}function ur(){var i=function(){};return gr()?i.prototype.parseFromString=function(t){var e=new window.ActiveXObject("htmlfile");return e.designMode="on",e.open(),e.write(t),e.close(),e}:i.prototype.parseFromString=function(t){var e=document.implementation.createHTMLDocument("");return e.open(),e.write(t),e.close(),e},i}function gr(){var i=!1;try{document.implementation.createHTMLDocument("").open()}catch(t){Ni.ActiveXObject&&(i=!0)}return i}var hr=dr()?Ni.DOMParser:ur();function fr(i,t){var e;if(typeof i=="string"){var a=vr().parseFromString('<x-turndown id="turndown-root">'+i+"</x-turndown>","text/html");e=a.getElementById("turndown-root")}else e=i.cloneNode(!0);return mr({element:e,isBlock:Ti,isVoid:La,isPre:t.preformattedCode?br:null}),e}var xi;function vr(){return xi=xi||new hr,xi}function br(i){return i.nodeName==="PRE"||i.nodeName==="CODE"}function xr(i,t){return i.isBlock=Ti(i),i.isCode=i.nodeName==="CODE"||i.parentNode.isCode,i.isBlank=yr(i),i.flankingWhitespace=Tr(i,t),i}function yr(i){return!La(i)&&!lr(i)&&/^\s*$/i.test(i.textContent)&&!or(i)&&!pr(i)}function Tr(i,t){if(i.isBlock||t.preformattedCode&&i.isCode)return{leading:"",trailing:""};var e=wr(i.textContent);return e.leadingAscii&&Ca("left",i,t)&&(e.leading=e.leadingNonAscii),e.trailingAscii&&Ca("right",i,t)&&(e.trailing=e.trailingNonAscii),{leading:e.leading,trailing:e.trailing}}function wr(i){var t=i.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\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 Ca(i,t,e){var a,n,r;return i==="left"?(a=t.previousSibling,n=/ $/):(a=t.nextSibling,n=/^ /),a&&(a.nodeType===3?r=n.test(a.nodeValue):e.preformattedCode&&a.nodeName==="CODE"?r=!1:a.nodeType===1&&!Ti(a)&&(r=n.test(a.textContent))),r}var Nr=Array.prototype.reduce,Er=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\
3 years ago
2 months ago
`:""},keepReplacement:function(e,a){return a.isBlock?`
3 years ago
2 months ago
`+a.outerHTML+`
3 years ago
2 months ago
`:a.outerHTML},defaultReplacement:function(e,a){return a.isBlock?`
3 years ago
2 months ago
`+e+`
3 years ago
2 months ago
`:e}};this.options=ar({},t,i),this.rules=new Ma(this.options)}Mt.prototype={turndown:function(i){if(!Sr(i))throw new TypeError(i+" is not a string, or an element/document/fragment node.");if(i==="")return"";var t=Oa.call(this,new fr(i,this.options));return Ar.call(this,t)},use:function(i){if(Array.isArray(i))for(var t=0;t<i.length;t++)this.use(i[t]);else if(typeof i=="function")i(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(i,t){return this.rules.add(i,t),this},keep:function(i){return this.rules.keep(i),this},remove:function(i){return this.rules.remove(i),this},escape:function(i){return Er.reduce(function(t,e){return t.replace(e[0],e[1])},i)}};function Oa(i){var t=this;return Nr.call(i.childNodes,function(e,a){a=new xr(a,t.options);var n="";return a.nodeType===3?n=a.isCode?a.nodeValue:t.escape(a.nodeValue):a.nodeType===1&&(n=_r.call(t,a)),Fa(e,n)},"")}function Ar(i){var t=this;return this.rules.forEach(function(e){typeof e.append=="function"&&(i=Fa(i,e.append(t.options)))}),i.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function _r(i){var t=this.rules.forNode(i),e=Oa.call(this,i),a=i.flankingWhitespace;return(a.leading||a.trailing)&&(e=e.trim()),a.leading+t.replacement(e,i,this.options)+a.trailing}function Fa(i,t){var e=rr(i),a=nr(t),n=Math.max(i.length-e.length,t.length-a.length),r=`
3 years ago
2 months ago
`.substring(0,n);return e+r+a}function Sr(i){return i!=null&&(typeof i=="string"||i.nodeType&&(i.nodeType===1||i.nodeType===9||i.nodeType===11))}var Ua=Mt;var ja=/highlight-(?:text|source)-([a-z0-9]+)/;function Dr(i){i.addRule("highlightedCodeBlock",{filter:function(t){var e=t.firstChild;return t.nodeName==="DIV"&&ja.test(t.className)&&e&&e.nodeName==="PRE"},replacement:function(t,e,a){var n=e.className||"",r=(n.match(ja)||[null,""])[1];return`
3 years ago
2 months ago
`+a.fence+r+`
`+e.firstChild.textContent+`
`+a.fence+`
3 years ago
2 months ago
`}})}function kr(i){i.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(t){return"~"+t+"~"}})}var Cr=Array.prototype.indexOf,Re={};Re.tableCell={filter:["th","td"],replacement:function(i,t){return Ha(i,t)+za(t,"")}};Re.tableRow={filter:"tr",replacement:function(i,t){var e="",a={left:":--",right:"--:",center:":-:"};if(Rr(t))for(var n=0;n<t.childNodes.length;n++){var r="---",s=(t.childNodes[n].getAttribute("align")||"").toLowerCase();s&&(r=a[s]||r),e+=Ha(r,t.childNodes[n])+za(t.childNodes[n],r)}return`
`+i+(e?`
`+e:"")}};Re.table={filter:function(i){return i.nodeName==="TABLE"&&!Va(i)},replacement:function(i){return i=i.replace(`
3 years ago
`,`
`),`
3 years ago
2 months ago
`+i+`
3 years ago
2 months ago
`}};Re.tableSection={filter:["thead","tbody","tfoot"],replacement:function(i){return i}};Re.captionSection={filter:"caption",replacement:function(i,t){return t.parentNode.nodeName==="TABLE"&&t.parentNode.childNodes[0]===t?i:""}};function Rr(i){var t=i.parentNode,e=t;return(t.nodeName==="THEAD"||t.nodeName==="TFOOT"||t.nodeName==="TBODY")&&(e=t.parentNode),e.nodeName==="TABLE"&&e.rows[0]===i}function Ha(i,t){var e=Cr.call(t.parentNode.childNodes,t),a=" ";return e===0&&(a="| "),i=i.replace(/\r\n/g,`
`).replace(/\n/g," "),i=i.replace(/\|/g,"\\|"),a+i+" |"}function za(i,t){var e=i.getAttribute("colspan")||1;return e<=1?"":(" "+t+" |").repeat(e-1)}function Va(i){for(var t=i.parentNode;t;){if(t.nodeName==="TABLE")return!0;t=t.parentNode}return!1}function Lr(i){i.keep(function(e){return e.nodeName==="TABLE"&&Va(e)});for(var t in Re)i.addRule(t,Re[t])}function Pr(i){i.addRule("taskListItems",{filter:function(t){return t.type==="checkbox"&&t.parentNode.nodeName==="LI"},replacement:function(t,e){return(e.checked?"[x]":"[ ]")+" "}})}function Ba(i){i.use([Dr,kr,Lr,Pr])}async function be(i){let t=Ba,e=new Ua({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",emDelimiter:"*"});return e.use(t),e.addRule("fencedCodeLangBlock",{filter:n=>n.nodeName=="PRE"&&(!n.firstChild||n.firstChild.nodeName!="CODE")&&!n.querySelector("img"),replacement:function(n,r,s){var E;r.innerHTML=r.innerHTML.replaceAll("<br-keep></br-keep>","<br>");let p=(E=r.id)==null?void 0:E.match(/code-lang-(.+)/),l=(p==null?void 0:p.length)>0?p[1]:"",c=r.textContent,u=s.fence.charAt(0),x=3,D=new RegExp("^"+u+"{3,}","gm"),T;for(;T=D.exec(c);)T[0].length>=x&&(x=T[0].length+1);let k=Array(x+1).join(u);return`
2 months ago
`+k+l+`
`+c.replace(/\n$/,"")+`
`+k+`
2 months ago
`}}),e.turndown(i)}var Ei=class extends j{constructor(){super(...arguments);L(this,"PATTERN",/(https:\/\/(twitter|x).com\/([a-zA-Z0-9_]+\/)([a-zA-Z0-9_]+\/[a-zA-Z0-9_]+))/)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,n=new URL(e);n.hostname==="x.com"&&(n.hostname="twitter.com");let r=await this.getTweetNoteData(n,a),s=this.templateEngine.render(this.plugin.settings.twitterNote,r),p=this.templateEngine.render(this.plugin.settings.twitterNoteTitle,{tweetAuthorName:r.tweetAuthorName,date:this.getFormattedDateForFilename(a)});return new M(p,"md",s,this.plugin.settings.twitterContentTypeSlug,a)}async getTweetNoteData(e,a){let n=JSON.parse(await(0,Ot.request)({method:"GET",contentType:"application/json",url:`https://publish.twitter.com/oembed?url=${e.href}`})),r=await be(n.html);return{date:this.getFormattedDateForContent(a),tweetAuthorName:n.author_name,tweetURL:n.url,tweetContent:r,tweetPublishDate:this.getPublishedDateFromDOM(n.html)}}getPublishedDateFromDOM(e){let n=new DOMParser().parseFromString(e,"text/html").querySelector("blockquote > a"),r=(0,Ot.moment)(n.textContent);return r.isValid()?r.format(this.plugin.settings.dateContentFmt):""}},$a=Ei;var Ft=require("obsidian"),ki=St(Di());var Ci=class extends j{constructor(){super(...arguments);L(this,"PATTERN",/(https:\/\/|http:\/\/)(stackoverflow\.com|serverfault\.com|superuser\.com|askubuntu\.com|stackapps\.com|.*\.stackexchange\.com)\/(q|a|questions)\/(\d+)/)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,n=await(0,Ft.request)({method:"GET",url:e}),r=new DOMParser().parseFromString(n,"text/html"),s=await this.parseDocument(r),p=this.templateEngine.render(this.plugin.settings.stackExchangeNoteTitle,{title:s.title,date:this.getFormattedDateForFilename(a)}),l;this.plugin.settings.downloadStackExchangeAssetsInDir?(l=this.templateEngine.render(this.plugin.settings.assetsDir,{date:"",fileName:"",contentType:""}),l=`${l}/${Z(p)}`):l=this.templateEngine.render(this.plugin.settings.assetsDir,{date:this.getFormattedDateForFilename(a),fileName:Z(p),contentType:this.plugin.settings.stackExchangeContentType});let c=this.templateEngine.render(this.plugin.settings.stackExchangeNote,this.getNoteData(s,a));return this.plugin.settings.downloadStackExchangeAssets&&Ft.Platform.isDesktop&&(c=await we(this.app,this.plugin,Z(p),c,l)),new M(p,"md",c,this.plugin.settings.stackExchangeContentType,a)}getNoteData(e,a){let n=e.topAnswer?this.templateEngine.render(this.plugin.settings.stackExchangeAnswer,{date:this.getFormattedDateForContent(a),answerContent:e.topAnswer.content,authorName:e.topAnswer.author.name,authorProfileURL:e.topAnswer.author.profile}):"",r="";for(let s=0;s<e.answers.length;s++)r=r.concat(`
3 years ago
***
3 years ago
2 months ago
`,this.templateEngine.render(this.plugin.settings.stackExchangeAnswer,{date:this.getFormattedDateForContent(a),answerContent:e.answers[s].content,authorName:e.answers[s].author.name,authorProfileURL:e.answers[s].author.profile}));return{date:this.getFormattedDateForContent(a),questionTitle:e.title,questionURL:e.url,questionContent:e.content,authorName:e.author.name,authorProfileURL:e.author.profile,topAnswer:n,answers:r.trim(),extra:{question:e}}}async parseDocument(e){var s,p,l,c,u,x,D,T,k,E,S,C,H,z,b,Y;let a;try{a=new URL((l=(s=e.querySelector('link[rel="canonical"]'))==null?void 0:s.getAttribute("href"))!=null?l:(p=e.querySelector('meta[property="og:url"]'))==null?void 0:p.getAttribute("content"))}catch(w){a=null}let n=e.querySelector('#question [itemprop="author"]'),r=[];for(let w of e.querySelectorAll(".answer")){let V=w.querySelector('[itemprop="author"]');r.push({content:await be(ki.sanitize((c=w.querySelector('[itemprop="text"]'))!=null?c:"")),author:{name:(x=(u=V==null?void 0:V.querySelector('[itemprop="name"]'))==null?void 0:u.textContent)!=null?x:"",profile:V instanceof Element&&a instanceof URL?String.prototype.concat(a.origin,(T=(D=V.querySelector("a"))==null?void 0:D.getAttribute("href"))!=null?T:""):""}})}return{title:(E=(k=e.querySelector('#question-header [itemprop="name"]'))==null?void 0:k.textContent)!=null?E:"",content:await be(ki.sanitize((S=e.querySelector('#question [itemprop="text"]'))!=null?S:"")),url:(C=a==null?void 0:a.href)!=null?C:"",topAnswer:r.slice(0,1).shift(),answers:r.slice(1),author:{name:(z=(H=n==null?void 0:n.querySelector('[itemprop="name"]'))==null?void 0:H.textContent)!=null?z:"",profile:n instanceof Element&&a instanceof URL?String.prototype.concat(a.origin,(Y=(b=n.querySelector("a"))==null?void 0:b.getAttribute("href"))!=null?Y:""):""}}}},Ga=Ci;var Le=require("obsidian"),Ut=St(Za()),Qa=St(Di());var Pi=class extends j{test(t){return this.isValidUrl(t)}async prepareNote(t){let e=new URL(t),a=await this.getDocument(e);return this.makeNote(a,e)}async makeNote(t,e){(0,Ut.isProbablyReaderable)(t)||new Le.Notice("@mozilla/readability considers this document to unlikely be readerable.");let a=new Date,n=this.extractPreviewUrl(t),r=new Ut.Readability(t).parse();if(r===null||!Object.prototype.hasOwnProperty.call(r,"content"))return this.notParsableArticle(e.href,n,a);let s=await be(r.content);return this.parsableArticle({date:this.getFormattedDateForContent(a),articleTitle:r.title||"No title",articleURL:e.href,articleReadingTime:this.getEstimatedReadingTime(r),articleContent:s,siteName:r.siteName||"",author:r.byline||"",previewURL:n||"",publishedTime:r.publishedTime!==null?this.getFormattedDateForContent(r.publishedTime):"",readabilityArticle:r},a)}async getDocument(t){var l,c,u,x,D;let e=await(0,Le.request)({method:"GET",url:t.href,headers:{"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"}}),a=new DOMParser().parseFromString(e,"text/html"),n=a.getElementsByTagName("base"),r=null;n.length>0&&(r=n.item(0).getAttribute("href"),Array.from(n).forEach(T=>{T.remove()}));let s=a.createElement("base");s.setAttribute("href",ci(r!=null?r:t.href,t.origin)),a.head.append(s);let p=Qa.sanitize(a.body.innerHTML);return a.body.innerHTML=p,(l=a.body.querySelectorAll("pre br"))==null||l.forEach(T=>{T.outerHTML="<br-keep></br-keep>"}),(c=a.body.querySelectorAll("h1, h2, h3, h4, h5, h6"))==null||c.forEach(T=>{T.className=""}),(u=a.body.querySelectorAll("[class*=highlight-text],[class*=highlight-source]"))==null||u.forEach(T=>{var E;let k=(E=T.className.match(/highlight-(?:text|source)-([a-z0-9]+)/))==null?void 0:E[1];T.firstElementChild.nodeName=="PRE"&&(T.removeAttribute("data-snippet-clipboard-copy-content"),T.firstElementChild.id=`code-lang-${k}`)}),(x=a.body.querySelectorAll("[class*=language-]"))==null||x.forEach(T=>{var E;let k=(E=T.className.match(/language-([a-z0-9]+)/))==null?void 0:E[1];T.id=`code-lang-${k}`}),(D=a.body.querySelectorAll(".codehilite > pre"))==null||D.forEach(T=>{T.firstChild.nodeName!=="CODE"&&!T.classNa
***
2 months ago
`,c)}return{date:this.getFormattedDateForContent(r),tootAuthorName:t.account.display_name,tootURL:t.url,tootContent:s,extra:{status:t,replies:e}}}async loadStatus(t,e){return JSON.parse(await(0,Ke.request)({method:"GET",contentType:"application/json",url:`https://${t}${Mi.STATUS}/${e}`}))}async loadReplies(t,e){let a=String.prototype.concat.call("https://",t,String.prototype.replace.call(Mi.CONTEXT,"%id%",e));return JSON.parse(await(0,Ke.request)({method:"GET",contentType:"application/json",url:a})).descendants}async parseStatus(t,e,a){let n=await be(t.content),r=this.plugin.settings.downloadMastodonMediaAttachments&&Ke.Platform.isDesktop?await we(this.app,this.plugin,e,this.prepareMedia(t.media_attachments),a):this.prepareMedia(t.media_attachments);return n.concat(r)}prepareMedia(t){return t.reduce((e,{url:a,description:n})=>{let r=n?`
> *${n}*`:"";return`${e}
2 months ago
![](${a})${r}`},"")}async testIsMastodon(t){if(!t)return!1;let e=new URL(t).hostname;try{let a=JSON.parse(await(0,Ke.request)({method:"GET",contentType:"application/json",url:`https://${e}${Mi.INSTANCE}`}));return(a==null?void 0:a.domain)===e}catch(a){return!1}}},tn=Oi;var an=require("obsidian");var Fi=class extends j{constructor(){super(...arguments);L(this,"PATTERN",/(tiktok.com)\/(\S+)\/(video)\/(\d+)/)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,n=await this.parseHtml(e,a),r=this.templateEngine.render(this.plugin.settings.tikTokNote,n),s=this.templateEngine.render(this.plugin.settings.tikTokNoteTitle,{authorName:n.authorName,date:this.getFormattedDateForFilename(a)});return new M(s,"md",r,this.plugin.settings.tikTokContentTypeSlug,a)}async parseHtml(e,a){var p,l,c,u;let n=await(0,an.request)({method:"GET",url:e,headers:{"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"}}),r=new DOMParser().parseFromString(n,"text/html"),s=this.PATTERN.exec(e);return{date:this.getFormattedDateForContent(a),videoId:s[4],videoURL:(l=(p=r.querySelector('meta[property="og:url"]'))==null?void 0:p.getAttribute("content"))!=null?l:e,videoDescription:(u=(c=r.querySelector('meta[property="og:description"]'))==null?void 0:c.getAttribute("content"))!=null?u:"",videoPlayer:`<iframe width="${this.plugin.settings.tikTokEmbedWidth}" height="${this.plugin.settings.tikTokEmbedHeight}" src="https://www.tiktok.com/embed/v2/${s[4]}"></iframe>`,authorName:s[2],authorURL:`https://www.tiktok.com/${s[2]}`}}},nn=Fi;var dt=class{constructor(t){L(this,"parsers");this.parsers=t}async createParser(t){for(let e of this.parsers)if(await e.test(t))return e}};var ut=class extends Xe{constructor(){super(...arguments);L(this,"PATTERN",/^https?:\/\/(?:www\.)?github\.com\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+)\/?$/)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new URL(e),n=await this.getDocument(a),r=n.querySelector("article.markdown-body");return r.querySelectorAll('[aria-label^="Permalink:"]').forEach(s=>s.remove()),n.querySelector("body").innerHTML=r.outerHTML,this.makeNote(n,a)}};var gt=class extends Xe{constructor(){super(...arguments);L(this,"PATTERN",/^(?:https?:\/\/)?(?:[a-z]{2,3}(?:-[a-z]{2,3})?)(?:\.m)?\.wikipedia\.org\/wiki\/([^\/]+)$/i)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new URL(e),n=await this.getDocument(a);return n.querySelectorAll(".reference .cite-bracket").forEach(r=>{r.remove()}),n.querySelectorAll(".reference a").forEach(r=>{r.textContent="\xA0"+r.textContent}),n.querySelectorAll(".mw-cite-backlink").forEach(r=>{r.remove()}),n.querySelectorAll(".infobox caption").forEach(r=>{let s=n.createElement("p");s.innerHTML=r.innerHTML,r.parentElement.insertBefore(s,r),r.remove()}),n.querySelectorAll(".wikitable caption").forEach(r=>{let s=n.createElement("p");s.innerHTML=r.innerHTML,r.parentElement.insertBefore(s,r),r.remove()}),this.makeNote(n,a)}};var Je=["string","number","bigint","symbol"],jr=/{{(.*?)}}/g,ht=class{constructor(){L(this,"modifiers");this.modifiers={blockquote:t=>this.validateFilterValueType(t,"blockquote",Je)?t.split(`
`).map(e=>`> ${e}`).join(`
`):t,capitalize:t=>{if(!this.validateFilterValueType(t,"capitalize",Je))return t;let e=String(t);return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()},join:(t,e=",")=>this.validateFilterValueType(t,"join",["array"])?t.join(e):t,lower:t=>{if(!this.validateFilterValueType(t,"lower",Je))return t;String(t).toLowerCase()},map:(t,e)=>{if(!this.validateFilterValueType(t,"map",["array"]))return t;try{return t.map(e)}catch(a){return console.warn("Error in map modifier:",a),t}},replace:(t,e,a="")=>this.validateFilterValueType(t,"replace",Je)?t.replaceAll(e,a):t,striptags:(t,e="")=>{if(!this.validateFilterValueType(t,"striptags",Je))return t;let a=new RegExp(`<(?!/?(${e.replace(/[<>]/g,"").split(",").join("|")})s*/?)[^>]+>`,"gi");return t.replace(a,"")},upper:t=>{if(!this.validateFilterValueType(t,"upper",Je))return t;String(t).toUpperCase()}}}render(t,e){try{let a=this.processLoops(t,e);return a=this.processVariables(a,e),a=this.processSimplePattern(a,e),a}catch(a){return console.error("Error rendering template:",a),t}}processSimplePattern(t,e){let a=/%(\w+(?:\.\w+)*)%/g;return t.replace(a,(n,r)=>{try{let s=this.resolveValue(r,e);return s===void 0?(console.warn(`Unable to resolve ${r}`),n):String(s)}catch(s){return console.warn(`Error processing simple pattern "${n}":`,s),n}})}processVariables(t,e){return t.replace(jr,(a,n)=>{try{let[r,...s]=n.split("|").map(x=>x.trim()),l=/(['"])((?:[^\\]|\\.)*?)\1/.exec(r),c;if(l!==null?c=l[2]:c=this.resolveValue(r,e),c===void 0)return console.warn(`Unable to resolve ${r}`),a;let u=c;for(let x of s)u=this.applyModifier(u,x);return String(u)}catch(r){return console.warn(`Error processing variable "${a}":`,r),a}})}processLoops(t,e){let a=/{%\s*for\s+(\w+)\s+in\s+(\w+(?:\.\w+)*)\s*%}([\s\S]*?){%\s*endfor\s*%}/g;return t.replace(a,(n,r,s,p)=>{try{let l=this.resolveValue(s,e);return Array.isArray(l)?l.map(c=>{let u={...e,[r]:c};return this.render(p,u)}).join(""):(console.warn(`Value at "${s}" is not an array`),"")}catch(l){return console.warn(`Error processing loop "${n}":`,l),""}})}resolveValue(t,e){let a=t.trim().split("."),n=e;for(let r of a){if(n==null)return;n=n[r]}return n}addModifier(t,e){if(typeof e!="function")throw new Error("Modifier must be a function");this.modifiers[t]=e}parseModifier(t){let e=t.match(/(\w+)(?:\((.*?)\))?/);if(!e)return{name:t,args:[]};let[,a,n]=e,r=n?this.parseArguments(n):[];return{name:a,args:r}}parseArguments(t){let e=[],a="",n=!1,r="",s=!1,p=0,l=!1,c=()=>{(a.trim()||n)&&e.push(this.evaluateArgument(a.trim())),a=""};for(let u=0;u<t.length;u++){let x=t[u];if(l){a+=x,l=!1;continue}switch(x){case"\\":l=!0;break;case'"':case"'":s||(n&&x===r?n=!1:n||(n=!0,r=x)),a+=x;break;case"(":p++,a+=x;break;case")":p--,a+=x;break;case"=":t[u+1]===">"?(s=!0,a+="=>",u++):a+=x;break;case",":!n&&!s&&p===0?c():a+=x;break;default:a+=x}}return(a||n)&&c(),e}evaluateArgument(t){try{if(t.includes("=>")){let e=Function(`return ${t}`)();return typeof e=="function"?e:t}if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t==="")return"";if(!isNaN(Number(t)))return Number(t);if(t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t)}catch(e){return t}return t}catch(e){return console.warn("Error evaluating argument:",t,e),t}}applyModifier(t,e){try{let{name:a,args:n}=this.parseModifier(e);return this.modifiers[a]?this.modifiers[a](t,...n):(console.warn(`Modifier "${a}" not found`),t)}catch(a){return console.warn(`Error applying modifier "${e}":`,a),t}}validateFilterValueType(t,e,a){let n=typeof t;return a.includes(n)?!0:a.includes("array")?Array.isArray(t):(console.warn(`Filter ${e} supports following types ${a.join(", ")}, but ${n} was provided.`),!1)}};var jt=class extends q.Plugin{constructor(){super(...arguments);L(this,"settings");L(this,"parserCreator");L(this,"templateEngine");L(this,"fileSystemLimits")}getFileSystemLimits(){return this.fileSystemLimits}async onload(){await this.loadSettings(),this.fileSystemLimits=fa(q.Platform,this.settings),this.templateEngine=new ht,this.parserCreator=new dt([new Ea(this.app,this,this.templateEngine),
<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:
6 months ago
(*! @license DOMPurify 2.5.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.5.6/LICENSE *)
*/
2 months ago
/* nosourcemap */