/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var gn=Object.create;var gt=Object.defineProperty;var mn=Object.getOwnPropertyDescriptor;var fn=Object.getOwnPropertyNames;var dn=Object.getPrototypeOf,vn=Object.prototype.hasOwnProperty;var Ee=(e,i)=>()=>(i||e((i={exports:{}}).exports,i),i.exports),bn=(e,i)=>{for(var t in i)gt(e,t,{get:i[t],enumerable:!0})},$i=(e,i,t,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of fn(i))!vn.call(e,s)&&s!==t&>(e,s,{get:()=>i[s],enumerable:!(r=mn(i,s))||r.enumerable});return e};var Fe=(e,i,t)=>(t=e!=null?gn(dn(e)):{},$i(i||!e||!e.__esModule?gt(t,"default",{value:e,enumerable:!0}):t,e)),yn=e=>$i(gt({},"__esModule",{value:!0}),e);var Ki=Ee((Yi,Xi)=>{(function(e){if(typeof Yi=="object")Xi.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var i;try{i=window}catch(t){i=self}i.SparkMD5=e()}})(function(e){"use strict";var i=function(m,g){return m+g&4294967295},t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function r(m,g,l,a,p,u){return g=i(i(g,m),i(a,u)),i(g<
>>32-p,l)}function s(m,g){var l=m[0],a=m[1],p=m[2],u=m[3];l+=(a&p|~a&u)+g[0]-680876936|0,l=(l<<7|l>>>25)+a|0,u+=(l&a|~l&p)+g[1]-389564586|0,u=(u<<12|u>>>20)+l|0,p+=(u&l|~u&a)+g[2]+606105819|0,p=(p<<17|p>>>15)+u|0,a+=(p&u|~p&l)+g[3]-1044525330|0,a=(a<<22|a>>>10)+p|0,l+=(a&p|~a&u)+g[4]-176418897|0,l=(l<<7|l>>>25)+a|0,u+=(l&a|~l&p)+g[5]+1200080426|0,u=(u<<12|u>>>20)+l|0,p+=(u&l|~u&a)+g[6]-1473231341|0,p=(p<<17|p>>>15)+u|0,a+=(p&u|~p&l)+g[7]-45705983|0,a=(a<<22|a>>>10)+p|0,l+=(a&p|~a&u)+g[8]+1770035416|0,l=(l<<7|l>>>25)+a|0,u+=(l&a|~l&p)+g[9]-1958414417|0,u=(u<<12|u>>>20)+l|0,p+=(u&l|~u&a)+g[10]-42063|0,p=(p<<17|p>>>15)+u|0,a+=(p&u|~p&l)+g[11]-1990404162|0,a=(a<<22|a>>>10)+p|0,l+=(a&p|~a&u)+g[12]+1804603682|0,l=(l<<7|l>>>25)+a|0,u+=(l&a|~l&p)+g[13]-40341101|0,u=(u<<12|u>>>20)+l|0,p+=(u&l|~u&a)+g[14]-1502002290|0,p=(p<<17|p>>>15)+u|0,a+=(p&u|~p&l)+g[15]+1236535329|0,a=(a<<22|a>>>10)+p|0,l+=(a&u|p&~u)+g[1]-165796510|0,l=(l<<5|l>>>27)+a|0,u+=(l&p|a&~p)+g[6]-1069501632|0,u=(u<<9|u>>>23)+l|0,p+=(u&a|l&~a)+g[11]+643717713|0,p=(p<<14|p>>>18)+u|0,a+=(p&l|u&~l)+g[0]-373897302|0,a=(a<<20|a>>>12)+p|0,l+=(a&u|p&~u)+g[5]-701558691|0,l=(l<<5|l>>>27)+a|0,u+=(l&p|a&~p)+g[10]+38016083|0,u=(u<<9|u>>>23)+l|0,p+=(u&a|l&~a)+g[15]-660478335|0,p=(p<<14|p>>>18)+u|0,a+=(p&l|u&~l)+g[4]-405537848|0,a=(a<<20|a>>>12)+p|0,l+=(a&u|p&~u)+g[9]+568446438|0,l=(l<<5|l>>>27)+a|0,u+=(l&p|a&~p)+g[14]-1019803690|0,u=(u<<9|u>>>23)+l|0,p+=(u&a|l&~a)+g[3]-187363961|0,p=(p<<14|p>>>18)+u|0,a+=(p&l|u&~l)+g[8]+1163531501|0,a=(a<<20|a>>>12)+p|0,l+=(a&u|p&~u)+g[13]-1444681467|0,l=(l<<5|l>>>27)+a|0,u+=(l&p|a&~p)+g[2]-51403784|0,u=(u<<9|u>>>23)+l|0,p+=(u&a|l&~a)+g[7]+1735328473|0,p=(p<<14|p>>>18)+u|0,a+=(p&l|u&~l)+g[12]-1926607734|0,a=(a<<20|a>>>12)+p|0,l+=(a^p^u)+g[5]-378558|0,l=(l<<4|l>>>28)+a|0,u+=(l^a^p)+g[8]-2022574463|0,u=(u<<11|u>>>21)+l|0,p+=(u^l^a)+g[11]+1839030562|0,p=(p<<16|p>>>16)+u|0,a+=(p^u^l)+g[14]-35309556|0,a=(a<<23|a>>>9)+p|0,l+=(a^p^u)+g[1]-1530992060|0,l=(l<<4|l>>>28)+a|0,u+=(l^a^p)+g[4]+1272893353|0,u=(u<<11|u>>>21)+l|0,p+=(u^l^a)+g[7]-155497632|0,p=(p<<16|p>>>16)+u|0,a+=(p^u^l)+g[10]-1094730640|0,a=(a<<23|a>>>9)+p|0,l+=(a^p^u)+g[13]+681279174|0,l=(l<<4|l>>>28)+a|0,u+=(l^a^p)+g[0]-358537222|0,u=(u<<11|u>>>21)+l|0,p+=(u^l^a)+g[3]-722521979|0,p=(p<<16|p>>>16)+u|0,a+=(p^u^l)+g[6]+76029189|0,a=(a<<23|a>>>9)+p|0,l+=(a^p^u)+g[9]-640364487|0,l=(l<<4|l>>>28)+a|0,u+=(l^a^p)+g[12]-421815835|0,u=(u<<11|u>>>21)+l|0,p+=(u^l^a)+g[15]+530742520|0,p=(p<<16|p>>>16)+u|0,a+=(p^u^l)+g[2]-995338651|0,a=(a<<23|a>>>9)+p|0,l+=(p^(a|~u))+g[0]-198630844|0,l=(l<<6|l>>>26)+a|0,u+=(a^(l|~p))+g[7]+1126891415|0,u=(u<<10|u>>>22)+l|0,p+=(l^(u|~a))+g[14]-1416354905|0,p=(p<<15|p>>>17)+u|0,a+=(u^(p|~l))+g[5]-57434055|0,a=(a<<21|a>>>11)+p|0,l+=(p^(a|~u))+g[12]+1700485571|0,l=(l<<6|l>>>26)+a|0,u+=(a^(l|~p))+g[3]-1894986606|0,u=(u<<10|u>>>22)+l|0,p+=(l^(u|~a))+g[10]-1051523|0,p=(p<<15|p>>>17)+u|0,a+=(u^(p|~l))+g[1]-2054922799|0,a=(a<<21|a>>>11)+p|0,l+=(p^(a|~u))+g[8]+1873313359|0,l=(l<<6|l>>>26)+a|0,u+=(a^(l|~p))+g[15]-30611744|0,u=(u<<10|u>>>22)+l|0,p+=(l^(u|~a))+g[6]-1560198380|0,p=(p<<15|p>>>17)+u|0,a+=(u^(p|~l))+g[13]+1309151649|0,a=(a<<21|a>>>11)+p|0,l+=(p^(a|~u))+g[4]-145523070|0,l=(l<<6|l>>>26)+a|0,u+=(a^(l|~p))+g[11]-1120210379|0,u=(u<<10|u>>>22)+l|0,p+=(l^(u|~a))+g[2]+718787259|0,p=(p<<15|p>>>17)+u|0,a+=(u^(p|~l))+g[9]-343485551|0,a=(a<<21|a>>>11)+p|0,m[0]=l+m[0]|0,m[1]=a+m[1]|0,m[2]=p+m[2]|0,m[3]=u+m[3]|0}function o(m){var g=[],l;for(l=0;l<64;l+=4)g[l>>2]=m.charCodeAt(l)+(m.charCodeAt(l+1)<<8)+(m.charCodeAt(l+2)<<16)+(m.charCodeAt(l+3)<<24);return g}function n(m){var g=[],l;for(l=0;l<64;l+=4)g[l>>2]=m[l]+(m[l+1]<<8)+(m[l+2]<<16)+(m[l+3]<<24);return g}function c(m){var g=m.length,l=[1732584193,-271733879,-1732584194,271733878],a,p,u,P,W,K;for(a=64;a<=g;a+=64)s(l,o(m.substring(a-64,a)));for(m=m.substring(a-64),p=m.length,u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],a=0;a
>2]|=m.charCodeAt(a)<<(a%4<<3);if(u[a>>2]|=128<<(a%4<<3),a>55)for(s(l,u),a=0;a<16;a+=1)u[a]=0;return P=g*8,P=P.toString(16).match(/(.*?)(.{0,8})$/),W=parseInt(P[2],16),K=parseInt(P[1],16)||0,u[14]=W,u[15]=K,s(l,u),l}function d(m){var g=m.length,l=[1732584193,-271733879,-1732584194,271733878],a,p,u,P,W,K;for(a=64;a<=g;a+=64)s(l,n(m.subarray(a-64,a)));for(m=a-64>2]|=m[a]<<(a%4<<3);if(u[a>>2]|=128<<(a%4<<3),a>55)for(s(l,u),a=0;a<16;a+=1)u[a]=0;return P=g*8,P=P.toString(16).match(/(.*?)(.{0,8})$/),W=parseInt(P[2],16),K=parseInt(P[1],16)||0,u[14]=W,u[15]=K,s(l,u),l}function f(m){var g="",l;for(l=0;l<4;l+=1)g+=t[m>>l*8+4&15]+t[m>>l*8&15];return g}function b(m){var g;for(g=0;g>16)+(g>>16)+(l>>16);return a<<16|l&65535}),typeof ArrayBuffer!="undefined"&&!ArrayBuffer.prototype.slice&&function(){function m(g,l){return g=g|0||0,g<0?Math.max(g+l,0):Math.min(g,l)}ArrayBuffer.prototype.slice=function(g,l){var a=this.byteLength,p=m(g,a),u=a,P,W,K,ve;return l!==e&&(u=m(l,a)),p>u?new ArrayBuffer(0):(P=u-p,W=new ArrayBuffer(P),K=new Uint8Array(W),ve=new Uint8Array(this,p,P),K.set(ve),W)}}();function D(m){return/[\u0080-\uFFFF]/.test(m)&&(m=unescape(encodeURIComponent(m))),m}function I(m,g){var l=m.length,a=new ArrayBuffer(l),p=new Uint8Array(a),u;for(u=0;u>2]|=g.charCodeAt(a)<<(a%4<<3);return this._finish(p,l),u=b(this._hash),m&&(u=x(u)),this.reset(),u},A.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},A.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},A.prototype.setState=function(m){return this._buff=m.buff,this._length=m.length,this._hash=m.hash,this},A.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},A.prototype._finish=function(m,g){var l=g,a,p,u;if(m[l>>2]|=128<<(l%4<<3),l>55)for(s(this._hash,m),l=0;l<16;l+=1)m[l]=0;a=this._length*8,a=a.toString(16).match(/(.*?)(.{0,8})$/),p=parseInt(a[2],16),u=parseInt(a[1],16)||0,m[14]=p,m[15]=u,s(this._hash,m)},A.hash=function(m,g){return A.hashBinary(D(m),g)},A.hashBinary=function(m,g){var l=c(m),a=b(l);return g?x(a):a},A.ArrayBuffer=function(){this.reset()},A.ArrayBuffer.prototype.append=function(m){var g=U(this._buff.buffer,m,!0),l=g.length,a;for(this._length+=m.byteLength,a=64;a<=l;a+=64)s(this._hash,n(g.subarray(a-64,a)));return this._buff=a-64>2]|=g[p]<<(p%4<<3);return this._finish(a,l),u=b(this._hash),m&&(u=x(u)),this.reset(),u},A.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},A.ArrayBuffer.prototype.getState=function(){var m=A.prototype.getState.call(this);return m.buff=C(m.buff),m},A.ArrayBuffer.prototype.setState=function(m){return m.buff=I(m.buff,!0),A.prototype.setState.call(this,m)},A.ArrayBuffer.prototype.destroy=A.prototype.destroy,A.ArrayBuffer.prototype._finish=A.prototype._finish,A.ArrayBuffer.hash=function(m,g){var l=d(new Uint8Array(m)),a=b(l);return g?x(a):a},A})});var er=Ee(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.toSeconds=X.end=X.parse=X.pattern=void 0;var Ue="\\d+",Kt="".concat(Ue,"(?:[\\.,]").concat(Ue,")?"),Dn="(".concat(Ue,"Y)?(").concat(Ue,"M)?(").concat(Ue,"W)?(").concat(Ue,"D)?"),Rn="T(".concat(Kt,"H)?(").concat(Kt,"M)?(").concat(Kt,"S)?"),xn="P(?:".concat(Dn,"(?:").concat(Rn,")?)"),Ln=["years","months","weeks","days","hours","minutes","seconds"],Qi=Object.freeze({years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0});X.pattern=new RegExp(xn);var In=function(e){var i=e.replace(/,/g,".").match(X.pattern);if(!i)throw new RangeError("invalid duration: ".concat(e));var t=i.slice(1);if(t.filter(function(r){return r!=null}).length===0)throw new RangeError("invalid duration: ".concat(e));if(t.filter(function(r){return/\./.test(r||"")}).length>1)throw new RangeError("only the smallest unit can be fractional");return t.reduce(function(r,s,o){return r[Ln[o]]=parseFloat(s||"0")||0,r},{})};X.parse=In;var Cn=function(e,i){i===void 0&&(i=new Date);var t=Object.assign({},Qi,e),r=i.getTime(),s=new Date(r);s.setFullYear(s.getFullYear()+t.years),s.setMonth(s.getMonth()+t.months),s.setDate(s.getDate()+t.days);var o=t.hours*3600*1e3,n=t.minutes*60*1e3;return s.setMilliseconds(s.getMilliseconds()+t.seconds*1e3+o+n),s.setDate(s.getDate()+t.weeks*7),s};X.end=Cn;var Pn=function(e,i){i===void 0&&(i=new Date);var t=Object.assign({},Qi,e),r=i.getTime(),s=new Date(r),o=(0,X.end)(t,s),n=(o.getTime()-s.getTime())/1e3;return n};X.toSeconds=Pn;X.default={end:X.end,toSeconds:X.toSeconds,pattern:X.pattern,parse:X.parse}});var ui=Ee((li,ci)=>{(function(e,i){typeof li=="object"&&typeof ci!="undefined"?ci.exports=i():typeof define=="function"&&define.amd?define(i):(e=typeof globalThis!="undefined"?globalThis:e||self,e.DOMPurify=i())})(li,function(){"use strict";function e(y){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(T){return typeof T}:function(T){return T&&typeof Symbol=="function"&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T},e(y)}function i(y,T){return i=Object.setPrototypeOf||function(L,O){return L.__proto__=O,L},i(y,T)}function t(){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(y){return!1}}function r(y,T,w){return t()?r=Reflect.construct:r=function(O,oe,pe){var le=[null];le.push.apply(le,oe);var Ye=Function.bind.apply(O,le),Xe=new Ye;return pe&&i(Xe,pe.prototype),Xe},r.apply(null,arguments)}function s(y){return o(y)||n(y)||c(y)||f()}function o(y){if(Array.isArray(y))return d(y)}function n(y){if(typeof Symbol!="undefined"&&y[Symbol.iterator]!=null||y["@@iterator"]!=null)return Array.from(y)}function c(y,T){if(y){if(typeof y=="string")return d(y,T);var w=Object.prototype.toString.call(y).slice(8,-1);if(w==="Object"&&y.constructor&&(w=y.constructor.name),w==="Map"||w==="Set")return Array.from(y);if(w==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(w))return d(y,T)}}function d(y,T){(T==null||T>y.length)&&(T=y.length);for(var w=0,L=new Array(T);w1?w-1:0),O=1;O/gm),Le=A(/\${[\w\W]*}/gm),he=A(/^data-[\-\w.\u00B7-\uFFFF]/),je=A(/^aria-[\-\w]+$/),qe=A(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ur=A(/^(?:\w+script|data):/i),Br=A(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Hr=A(/^html$/i),Gr=function(){return typeof window=="undefined"?null:window},Wr=function(T,w){if(e(T)!=="object"||typeof T.createPolicy!="function")return null;var L=null,O="data-tt-policy-suffix";w.currentScript&&w.currentScript.hasAttribute(O)&&(L=w.currentScript.getAttribute(O));var oe="dompurify"+(L?"#"+L:"");try{return T.createPolicy(oe,{createHTML:function(le){return le},createScriptURL:function(le){return le}})}catch(pe){return console.warn("TrustedTypes policy "+oe+" could not be created."),null}};function Ti(){var y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Gr(),T=function(h){return Ti(h)};if(T.version="2.4.3",T.removed=[],!y||!y.document||y.document.nodeType!==9)return T.isSupported=!1,T;var w=y.document,L=y.document,O=y.DocumentFragment,oe=y.HTMLTemplateElement,pe=y.Node,le=y.Element,Ye=y.NodeFilter,Xe=y.NamedNodeMap,$r=Xe===void 0?y.NamedNodeMap||y.MozNamedAttrMap:Xe,zr=y.HTMLFormElement,jr=y.DOMParser,nt=y.trustedTypes,at=le.prototype,qr=k(at,"cloneNode"),Yr=k(at,"nextSibling"),Xr=k(at,"childNodes"),St=k(at,"parentNode");if(typeof oe=="function"){var Dt=L.createElement("template");Dt.content&&Dt.content.ownerDocument&&(L=Dt.content.ownerDocument)}var re=Wr(nt,w),Rt=re?re.createHTML(""):"",st=L,xt=st.implementation,Kr=st.createNodeIterator,Jr=st.createDocumentFragment,Zr=st.getElementsByTagName,Qr=w.importNode,Ai={};try{Ai=ae(L).documentMode?L.documentMode:{}}catch(E){}var ce={};T.isSupported=typeof St=="function"&&xt&&typeof xt.createHTMLDocument!="undefined"&&Ai!==9;var Lt=se,It=rt,Ct=Le,en=he,tn=je,rn=Ur,Ei=Br,Pt=qe,$=null,_i=R({},[].concat(s(be),s(Se),s(De),s(Ne),s(xe))),q=null,wi=R({},[].concat(s(ye),s($e),s(ze),s(te))),H=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ke=null,Mt=null,Si=!0,kt=!0,Di=!1,Ie=!1,Te=!1,Ot=!1,Ft=!1,Ce=!1,ot=!1,lt=!1,Ri=!0,xi=!1,nn="user-content-",Ut=!0,Je=!1,Pe={},Me=null,Li=R({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ii=null,Ci=R({},["audio","video","img","source","image","track"]),Bt=null,Pi=R({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ct="http://www.w3.org/1998/Math/MathML",ut="http://www.w3.org/2000/svg",ge="http://www.w3.org/1999/xhtml",ke=ge,Ht=!1,Gt=null,an=R({},[ct,ut,ge],K),Ae,sn=["application/xhtml+xml","text/html"],on="text/html",z,Oe=null,ln=L.createElement("form"),Mi=function(h){return h instanceof RegExp||h instanceof Function},Wt=function(h){Oe&&Oe===h||((!h||e(h)!=="object")&&(h={}),h=ae(h),Ae=sn.indexOf(h.PARSER_MEDIA_TYPE)===-1?Ae=on:Ae=h.PARSER_MEDIA_TYPE,z=Ae==="application/xhtml+xml"?K:W,$="ALLOWED_TAGS"in h?R({},h.ALLOWED_TAGS,z):_i,q="ALLOWED_ATTR"in h?R({},h.ALLOWED_ATTR,z):wi,Gt="ALLOWED_NAMESPACES"in h?R({},h.ALLOWED_NAMESPACES,K):an,Bt="ADD_URI_SAFE_ATTR"in h?R(ae(Pi),h.ADD_URI_SAFE_ATTR,z):Pi,Ii="ADD_DATA_URI_TAGS"in h?R(ae(Ci),h.ADD_DATA_URI_TAGS,z):Ci,Me="FORBID_CONTENTS"in h?R({},h.FORBID_CONTENTS,z):Li,Ke="FORBID_TAGS"in h?R({},h.FORBID_TAGS,z):{},Mt="FORBID_ATTR"in h?R({},h.FORBID_ATTR,z):{},Pe="USE_PROFILES"in h?h.USE_PROFILES:!1,Si=h.ALLOW_ARIA_ATTR!==!1,kt=h.ALLOW_DATA_ATTR!==!1,Di=h.ALLOW_UNKNOWN_PROTOCOLS||!1,Ie=h.SAFE_FOR_TEMPLATES||!1,Te=h.WHOLE_DOCUMENT||!1,Ce=h.RETURN_DOM||!1,ot=h.RETURN_DOM_FRAGMENT||!1,lt=h.RETURN_TRUSTED_TYPE||!1,Ft=h.FORCE_BODY||!1,Ri=h.SANITIZE_DOM!==!1,xi=h.SANITIZE_NAMED_PROPS||!1,Ut=h.KEEP_CONTENT!==!1,Je=h.IN_PLACE||!1,Pt=h.ALLOWED_URI_REGEXP||Pt,ke=h.NAMESPACE||ge,h.CUSTOM_ELEMENT_HANDLING&&Mi(h.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=h.CUSTOM_ELEMENT_HANDLING.tagNameCheck),h.CUSTOM_ELEMENT_HANDLING&&Mi(h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),h.CUSTOM_ELEMENT_HANDLING&&typeof h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ie&&(kt=!1),ot&&(Ce=!0),Pe&&($=R({},s(xe)),q=[],Pe.html===!0&&(R($,be),R(q,ye)),Pe.svg===!0&&(R($,Se),R(q,$e),R(q,te)),Pe.svgFilters===!0&&(R($,De),R(q,$e),R(q,te)),Pe.mathMl===!0&&(R($,Ne),R(q,ze),R(q,te))),h.ADD_TAGS&&($===_i&&($=ae($)),R($,h.ADD_TAGS,z)),h.ADD_ATTR&&(q===wi&&(q=ae(q)),R(q,h.ADD_ATTR,z)),h.ADD_URI_SAFE_ATTR&&R(Bt,h.ADD_URI_SAFE_ATTR,z),h.FORBID_CONTENTS&&(Me===Li&&(Me=ae(Me)),R(Me,h.FORBID_CONTENTS,z)),Ut&&($["#text"]=!0),Te&&R($,["html","head","body"]),$.table&&(R($,["tbody"]),delete Ke.tbody),x&&x(h),Oe=h)},ki=R({},["mi","mo","mn","ms","mtext"]),Oi=R({},["foreignobject","desc","title","annotation-xml"]),cn=R({},["title","style","font","a","script"]),ht=R({},Se);R(ht,De),R(ht,it);var Vt=R({},Ne);R(Vt,Re);var un=function(h){var v=St(h);(!v||!v.tagName)&&(v={namespaceURI:ke,tagName:"template"});var N=W(h.tagName),M=W(v.tagName);return Gt[h.namespaceURI]?h.namespaceURI===ut?v.namespaceURI===ge?N==="svg":v.namespaceURI===ct?N==="svg"&&(M==="annotation-xml"||ki[M]):Boolean(ht[N]):h.namespaceURI===ct?v.namespaceURI===ge?N==="math":v.namespaceURI===ut?N==="math"&&Oi[M]:Boolean(Vt[N]):h.namespaceURI===ge?v.namespaceURI===ut&&!Oi[M]||v.namespaceURI===ct&&!ki[M]?!1:!Vt[N]&&(cn[N]||!ht[N]):!!(Ae==="application/xhtml+xml"&&Gt[h.namespaceURI]):!1},me=function(h){P(T.removed,{element:h});try{h.parentNode.removeChild(h)}catch(v){try{h.outerHTML=Rt}catch(N){h.remove()}}},$t=function(h,v){try{P(T.removed,{attribute:v.getAttributeNode(h),from:v})}catch(N){P(T.removed,{attribute:null,from:v})}if(v.removeAttribute(h),h==="is"&&!q[h])if(Ce||ot)try{me(v)}catch(N){}else try{v.setAttribute(h,"")}catch(N){}},Fi=function(h){var v,N;if(Ft)h=" "+h;else{var M=ve(h,/^[\r\n\t ]+/);N=M&&M[0]}Ae==="application/xhtml+xml"&&ke===ge&&(h=''+h+"");var ie=re?re.createHTML(h):h;if(ke===ge)try{v=new jr().parseFromString(ie,Ae)}catch(Y){}if(!v||!v.documentElement){v=xt.createDocument(ke,"template",null);try{v.documentElement.innerHTML=Ht?Rt:ie}catch(Y){}}var J=v.body||v.documentElement;return h&&N&&J.insertBefore(L.createTextNode(N),J.childNodes[0]||null),ke===ge?Zr.call(v,Te?"html":"body")[0]:Te?v.documentElement:J},Ui=function(h){return Kr.call(h.ownerDocument||h,h,Ye.SHOW_ELEMENT|Ye.SHOW_COMMENT|Ye.SHOW_TEXT,null,!1)},hn=function(h){return h instanceof zr&&(typeof h.nodeName!="string"||typeof h.textContent!="string"||typeof h.removeChild!="function"||!(h.attributes instanceof $r)||typeof h.removeAttribute!="function"||typeof h.setAttribute!="function"||typeof h.namespaceURI!="string"||typeof h.insertBefore!="function"||typeof h.hasChildNodes!="function")},Ze=function(h){return e(pe)==="object"?h instanceof pe:h&&e(h)==="object"&&typeof h.nodeType=="number"&&typeof h.nodeName=="string"},fe=function(h,v,N){ce[h]&&p(ce[h],function(M){M.call(T,v,N,Oe)})},Bi=function(h){var v;if(fe("beforeSanitizeElements",h,null),hn(h)||V(/[\u0080-\uFFFF]/,h.nodeName))return me(h),!0;var N=z(h.nodeName);if(fe("uponSanitizeElement",h,{tagName:N,allowedTags:$}),h.hasChildNodes()&&!Ze(h.firstElementChild)&&(!Ze(h.content)||!Ze(h.content.firstElementChild))&&V(/<[/\w]/g,h.innerHTML)&&V(/<[/\w]/g,h.textContent)||N==="select"&&V(/=0;--Y)M.insertBefore(qr(ie[Y],!0),Yr(h))}return me(h),!0}return h instanceof le&&!un(h)||(N==="noscript"||N==="noembed")&&V(/<\/no(script|embed)/i,h.innerHTML)?(me(h),!0):(Ie&&h.nodeType===3&&(v=h.textContent,v=Q(v,Lt," "),v=Q(v,It," "),v=Q(v,Ct," "),h.textContent!==v&&(P(T.removed,{element:h.cloneNode()}),h.textContent=v)),fe("afterSanitizeElements",h,null),!1)},Hi=function(h,v,N){if(Ri&&(v==="id"||v==="name")&&(N in L||N in ln))return!1;if(!(kt&&!Mt[v]&&V(en,v))){if(!(Si&&V(tn,v))){if(!q[v]||Mt[v]){if(!(Gi(h)&&(H.tagNameCheck instanceof RegExp&&V(H.tagNameCheck,h)||H.tagNameCheck instanceof Function&&H.tagNameCheck(h))&&(H.attributeNameCheck instanceof RegExp&&V(H.attributeNameCheck,v)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(v))||v==="is"&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&V(H.tagNameCheck,N)||H.tagNameCheck instanceof Function&&H.tagNameCheck(N))))return!1}else if(!Bt[v]){if(!V(Pt,Q(N,Ei,""))){if(!((v==="src"||v==="xlink:href"||v==="href")&&h!=="script"&&We(N,"data:")===0&&Ii[h])){if(!(Di&&!V(rn,Q(N,Ei,"")))){if(N)return!1}}}}}}return!0},Gi=function(h){return h.indexOf("-")>0},Wi=function(h){var v,N,M,ie;fe("beforeSanitizeAttributes",h,null);var J=h.attributes;if(J){var Y={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:q};for(ie=J.length;ie--;){v=J[ie];var pt=v,j=pt.name,zt=pt.namespaceURI;if(N=j==="value"?v.value:wt(v.value),M=z(j),Y.attrName=M,Y.attrValue=N,Y.keepAttr=!0,Y.forceKeepAttr=void 0,fe("uponSanitizeAttribute",h,Y),N=Y.attrValue,!Y.forceKeepAttr&&($t(j,h),!!Y.keepAttr)){if(V(/\/>/i,N)){$t(j,h);continue}Ie&&(N=Q(N,Lt," "),N=Q(N,It," "),N=Q(N,Ct," "));var Vi=z(h.nodeName);if(Hi(Vi,M,N)){if(xi&&(M==="id"||M==="name")&&($t(j,h),N=nn+N),re&&e(nt)==="object"&&typeof nt.getAttributeType=="function"&&!zt)switch(nt.getAttributeType(Vi,M)){case"TrustedHTML":N=re.createHTML(N);break;case"TrustedScriptURL":N=re.createScriptURL(N);break}try{zt?h.setAttributeNS(zt,j,N):h.setAttribute(j,N),u(T.removed)}catch(ba){}}}}fe("afterSanitizeAttributes",h,null)}},pn=function E(h){var v,N=Ui(h);for(fe("beforeSanitizeShadowDOM",h,null);v=N.nextNode();)fe("uponSanitizeShadowNode",v,null),!Bi(v)&&(v.content instanceof O&&E(v.content),Wi(v));fe("afterSanitizeShadowDOM",h,null)};return T.sanitize=function(E){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v,N,M,ie,J;if(Ht=!E,Ht&&(E=""),typeof E!="string"&&!Ze(E)){if(typeof E.toString!="function")throw B("toString is not a function");if(E=E.toString(),typeof E!="string")throw B("dirty is not a string, aborting")}if(!T.isSupported){if(e(y.toStaticHTML)==="object"||typeof y.toStaticHTML=="function"){if(typeof E=="string")return y.toStaticHTML(E);if(Ze(E))return y.toStaticHTML(E.outerHTML)}return E}if(Ot||Wt(h),T.removed=[],typeof E=="string"&&(Je=!1),Je){if(E.nodeName){var Y=z(E.nodeName);if(!$[Y]||Ke[Y])throw B("root node is forbidden and cannot be sanitized in-place")}}else if(E instanceof pe)v=Fi(""),N=v.ownerDocument.importNode(E,!0),N.nodeType===1&&N.nodeName==="BODY"||N.nodeName==="HTML"?v=N:v.appendChild(N);else{if(!Ce&&!Ie&&!Te&&E.indexOf("<")===-1)return re&<?re.createHTML(E):E;if(v=Fi(E),!v)return Ce?null:lt?Rt:""}v&&Ft&&me(v.firstChild);for(var pt=Ui(Je?E:v);M=pt.nextNode();)M.nodeType===3&&M===ie||Bi(M)||(M.content instanceof O&&pn(M.content),Wi(M),ie=M);if(ie=null,Je)return E;if(Ce){if(ot)for(J=Jr.call(v.ownerDocument);v.firstChild;)J.appendChild(v.firstChild);else J=v;return q.shadowroot&&(J=Qr.call(w,J,!0)),J}var j=Te?v.outerHTML:v.innerHTML;return Te&&$["!doctype"]&&v.ownerDocument&&v.ownerDocument.doctype&&v.ownerDocument.doctype.name&&V(Hr,v.ownerDocument.doctype.name)&&(j="
`+j),Ie&&(j=Q(j,Lt," "),j=Q(j,It," "),j=Q(j,Ct," ")),re&<?re.createHTML(j):j},T.setConfig=function(E){Wt(E),Ot=!0},T.clearConfig=function(){Oe=null,Ot=!1},T.isValidAttribute=function(E,h,v){Oe||Wt({});var N=z(E),M=z(h);return Hi(N,M,v)},T.addHook=function(E,h){typeof h=="function"&&(ce[E]=ce[E]||[],P(ce[E],h))},T.removeHook=function(E){if(ce[E])return u(ce[E])},T.removeHooks=function(E){ce[E]&&(ce[E]=[])},T.removeAllHooks=function(){ce={}},T}var Vr=Ti();return Vr})});var hi=Ee((gs,_r)=>{_r.exports=window.DOMPurify||(window.DOMPurify=ui().default||ui())});var Dr=Ee((Ns,mi)=>{function Sr(e,i){if(i&&i.documentElement)e=i,i=arguments[2];else if(!e||!e.documentElement)throw new Error("First argument to Readability constructor should be a document object.");if(i=i||{},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=!!i.debug,this._maxElemsToParse=i.maxElemsToParse||this.DEFAULT_MAX_ELEMS_TO_PARSE,this._nbTopCandidates=i.nbTopCandidates||this.DEFAULT_N_TOP_CANDIDATES,this._charThreshold=i.charThreshold||this.DEFAULT_CHAR_THRESHOLD,this._classesToPreserve=this.CLASSES_TO_PRESERVE.concat(i.classesToPreserve||[]),this._keepClasses=!!i.keepClasses,this._serializer=i.serializer||function(t){return t.innerHTML},this._disableJSONLD=!!i.disableJSONLD,this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY,this._debug){let t=function(r){if(r.nodeType==r.TEXT_NODE)return`${r.nodeName} ("${r.textContent}")`;let s=Array.from(r.attributes||[],function(o){return`${o.name}="${o.value}"`}).join(" ");return`<${r.localName} ${s}>`};this.log=function(){if(typeof dump!="undefined"){var r=Array.prototype.map.call(arguments,function(s){return s&&s.nodeName?t(s):s}).join(" ");dump("Reader: (Readability) "+r+`
`)}else if(typeof console!="undefined"){let s=Array.from(arguments,o=>o&&o.nodeType==this.ELEMENT_NODE?t(o):o);s.unshift("Reader: (Readability)"),console.log.apply(console,s)}}}else this.log=function(){}}Sr.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,i){if(this._docJSDOMParser&&e._isLiveNodeList)throw new Error("Do not pass live node lists to _removeNodes");for(var t=e.length-1;t>=0;t--){var r=e[t],s=r.parentNode;s&&(!i||i.call(this,r,t,e))&&s.removeChild(r)}},_replaceNodeTags:function(e,i){if(this._docJSDOMParser&&e._isLiveNodeList)throw new Error("Do not pass live node lists to _replaceNodeTags");for(let t of e)this._setNodeTag(t,i)},_forEachNode:function(e,i){Array.prototype.forEach.call(e,i,this)},_findNode:function(e,i){return Array.prototype.find.call(e,i,this)},_someNode:function(e,i){return Array.prototype.some.call(e,i,this)},_everyNode:function(e,i){return Array.prototype.every.call(e,i,this)},_concatNodeLists:function(){var e=Array.prototype.slice,i=e.call(arguments),t=i.map(function(r){return e.call(r)});return Array.prototype.concat.apply([],t)},_getAllNodesWithTag:function(e,i){return e.querySelectorAll?e.querySelectorAll(i.join(",")):[].concat.apply([],i.map(function(t){var r=e.getElementsByTagName(t);return Array.isArray(r)?r:Array.from(r)}))},_cleanClasses:function(e){var i=this._classesToPreserve,t=(e.getAttribute("class")||"").split(/\s+/).filter(function(r){return i.indexOf(r)!=-1}).join(" ");for(t?e.setAttribute("class",t):e.removeAttribute("class"),e=e.firstElementChild;e;e=e.nextElementSibling)this._cleanClasses(e)},_fixRelativeUris:function(e){var i=this._doc.baseURI,t=this._doc.documentURI;function r(n){if(i==t&&n.charAt(0)=="#")return n;try{return new URL(n,i).href}catch(c){}return n}var s=this._getAllNodesWithTag(e,["a"]);this._forEachNode(s,function(n){var c=n.getAttribute("href");if(c)if(c.indexOf("javascript:")===0)if(n.childNodes.length===1&&n.childNodes[0].nodeType===this.TEXT_NODE){var d=this._doc.createTextNode(n.textContent);n.parentNode.replaceChild(d,n)}else{for(var f=this._doc.createElement("span");n.firstChild;)f.appendChild(n.firstChild);n.parentNode.replaceChild(f,n)}else n.setAttribute("href",r(c))});var o=this._getAllNodesWithTag(e,["img","picture","figure","video","audio","source"]);this._forEachNode(o,function(n){var c=n.getAttribute("src"),d=n.getAttribute("poster"),f=n.getAttribute("srcset");if(c&&n.setAttribute("src",r(c)),d&&n.setAttribute("poster",r(d)),f){var b=f.replace(this.REGEXPS.srcsetUrl,function(D,I,C,U){return r(I)+(C||"")+U});n.setAttribute("srcset",b)}})},_simplifyNestedElements:function(e){for(var i=e;i;){if(i.parentNode&&["DIV","SECTION"].includes(i.tagName)&&!(i.id&&i.id.startsWith("readability"))){if(this._isElementWithoutContent(i)){i=this._removeAndGetNext(i);continue}else if(this._hasSingleTagInsideElement(i,"DIV")||this._hasSingleTagInsideElement(i,"SECTION")){for(var t=i.children[0],r=0;r »] /.test(i))r=/ [\\\/>»] /.test(i),i=t.replace(/(.*)[\|\-\\\/>»] .*/gi,"$1"),s(i)<3&&(i=t.replace(/[^\|\-\\\/>»]*[\|\-\\\/>»](.*)/gi,"$1"));else if(i.indexOf(": ")!==-1){var o=this._concatNodeLists(e.getElementsByTagName("h1"),e.getElementsByTagName("h2")),n=i.trim(),c=this._someNode(o,function(b){return b.textContent.trim()===n});c||(i=t.substring(t.lastIndexOf(":")+1),s(i)<3?i=t.substring(t.indexOf(":")+1):s(t.substr(0,t.indexOf(":")))>5&&(i=t))}else if(i.length>150||i.length<15){var d=e.getElementsByTagName("h1");d.length===1&&(i=this._getInnerText(d[0]))}i=i.trim().replace(this.REGEXPS.normalize," ");var f=s(i);return f<=4&&(!r||f!=s(t.replace(/[\|\-\\\/>»]+/g,""))-1)&&(i=t),i},_prepDocument:function(){var e=this._doc;this._removeNodes(this._getAllNodesWithTag(e,["style"])),e.body&&this._replaceBrs(e.body),this._replaceNodeTags(this._getAllNodesWithTag(e,["font"]),"SPAN")},_nextNode:function(e){for(var i=e;i&&i.nodeType!=this.ELEMENT_NODE&&this.REGEXPS.whitespace.test(i.textContent);)i=i.nextSibling;return i},_replaceBrs:function(e){this._forEachNode(this._getAllNodesWithTag(e,["br"]),function(i){for(var t=i.nextSibling,r=!1;(t=this._nextNode(t))&&t.tagName=="BR";){r=!0;var s=t.nextSibling;t.parentNode.removeChild(t),t=s}if(r){var o=this._doc.createElement("p");for(i.parentNode.replaceChild(o,i),t=o.nextSibling;t;){if(t.tagName=="BR"){var n=this._nextNode(t.nextSibling);if(n&&n.tagName=="BR")break}if(!this._isPhrasingContent(t))break;var c=t.nextSibling;o.appendChild(t),t=c}for(;o.lastChild&&this._isWhitespace(o.lastChild);)o.removeChild(o.lastChild);o.parentNode.tagName==="P"&&this._setNodeTag(o.parentNode,"DIV")}})},_setNodeTag:function(e,i){if(this.log("_setNodeTag",e,i),this._docJSDOMParser)return e.localName=i.toLowerCase(),e.tagName=i.toUpperCase(),e;for(var t=e.ownerDocument.createElement(i);e.firstChild;)t.appendChild(e.firstChild);e.parentNode.replaceChild(t,e),e.readability&&(t.readability=e.readability);for(var r=0;r!t.includes(n)),o=s.join(" ").length/r.join(" ").length;return 1-o},_checkByline:function(e,i){if(this._articleByline)return!1;if(e.getAttribute!==void 0)var t=e.getAttribute("rel"),r=e.getAttribute("itemprop");return(t==="author"||r&&r.indexOf("author")!==-1||this.REGEXPS.byline.test(i))&&this._isValidByline(e.textContent)?(this._articleByline=e.textContent.trim(),!0):!1},_getNodeAncestors:function(e,i){i=i||0;for(var t=0,r=[];e.parentNode&&(r.push(e.parentNode),!(i&&++t===i));)e=e.parentNode;return r},_grabArticle:function(e){this.log("**** grabArticle ****");var i=this._doc,t=e!==null;if(e=e||this._doc.body,!e)return this.log("No body found in document. Abort."),null;for(var r=e.innerHTML;;){this.log("Starting grabArticle loop");var s=this._flagIsActive(this.FLAG_STRIP_UNLIKELYS),o=[],n=this._doc.documentElement;let ze=!0;for(;n;){n.tagName==="HTML"&&(this._articleLang=n.getAttribute("lang"));var c=n.className+" "+n.id;if(!this._isProbablyVisible(n)){this.log("Removing hidden node - "+c),n=this._removeAndGetNext(n);continue}if(this._checkByline(n,c)){n=this._removeAndGetNext(n);continue}if(ze&&this._headerDuplicatesTitle(n)){this.log("Removing header: ",n.textContent.trim(),this._articleTitle.trim()),ze=!1,n=this._removeAndGetNext(n);continue}if(s){if(this.REGEXPS.unlikelyCandidates.test(c)&&!this.REGEXPS.okMaybeItsACandidate.test(c)&&!this._hasAncestorTag(n,"table")&&!this._hasAncestorTag(n,"code")&&n.tagName!=="BODY"&&n.tagName!=="A"){this.log("Removing unlikely candidate - "+c),n=this._removeAndGetNext(n);continue}if(this.UNLIKELY_ROLES.includes(n.getAttribute("role"))){this.log("Removing content with role "+n.getAttribute("role")+" - "+c),n=this._removeAndGetNext(n);continue}}if((n.tagName==="DIV"||n.tagName==="SECTION"||n.tagName==="HEADER"||n.tagName==="H1"||n.tagName==="H2"||n.tagName==="H3"||n.tagName==="H4"||n.tagName==="H5"||n.tagName==="H6")&&this._isElementWithoutContent(n)){n=this._removeAndGetNext(n);continue}if(this.DEFAULT_TAGS_TO_SCORE.indexOf(n.tagName)!==-1&&o.push(n),n.tagName==="DIV"){for(var d=null,f=n.firstChild;f;){var b=f.nextSibling;if(this._isPhrasingContent(f))d!==null?d.appendChild(f):this._isWhitespace(f)||(d=i.createElement("p"),n.replaceChild(d,f),d.appendChild(f));else if(d!==null){for(;d.lastChild&&this._isWhitespace(d.lastChild);)d.removeChild(d.lastChild);d=null}f=b}if(this._hasSingleTagInsideElement(n,"P")&&this._getLinkDensity(n)<.25){var D=n.children[0];n.parentNode.replaceChild(D,n),n=D,o.push(n)}else this._hasChildBlockElement(n)||(n=this._setNodeTag(n,"P"),o.push(n))}n=this._getNextNode(n)}var I=[];this._forEachNode(o,function(te){if(!(!te.parentNode||typeof te.parentNode.tagName=="undefined")){var se=this._getInnerText(te);if(!(se.length<25)){var rt=this._getNodeAncestors(te,5);if(rt.length!==0){var Le=0;Le+=1,Le+=se.split(",").length,Le+=Math.min(Math.floor(se.length/100),3),this._forEachNode(rt,function(he,je){if(!(!he.tagName||!he.parentNode||typeof he.parentNode.tagName=="undefined")){if(typeof he.readability=="undefined"&&(this._initializeNode(he),I.push(he)),je===0)var qe=1;else je===1?qe=2:qe=je*3;he.readability.contentScore+=Le/qe}})}}}});for(var C=[],U=0,x=I.length;Ul.readability.contentScore){C.splice(g,0,A),C.length>this._nbTopCandidates&&C.pop();break}}}var a=C[0]||null,p=!1,u;if(a===null||a.tagName==="BODY"){for(a=i.createElement("DIV"),p=!0;e.firstChild;)this.log("Moving child out:",e.firstChild),a.appendChild(e.firstChild);e.appendChild(a),this._initializeNode(a)}else if(a){for(var P=[],W=1;W=.75&&P.push(this._getNodeAncestors(C[W]));var K=3;if(P.length>=K)for(u=a.parentNode;u.tagName!=="BODY";){for(var ve=0,Q=0;Q=K){a=u;break}u=u.parentNode}a.readability||this._initializeNode(a),u=a.parentNode;for(var We=a.readability.contentScore,wt=We/3;u.tagName!=="BODY";){if(!u.readability){u=u.parentNode;continue}var V=u.readability.contentScore;if(VWe){a=u;break}We=u.readability.contentScore,u=u.parentNode}for(u=a.parentNode;u.tagName!="BODY"&&u.children.length==1;)a=u,u=a.parentNode;a.readability||this._initializeNode(a)}var B=i.createElement("DIV");t&&(B.id="readability-content");var ee=Math.max(10,a.readability.contentScore*.2);u=a.parentNode;for(var Ve=u.children,R=0,ae=Ve.length;R=ee)be=!0;else if(k.nodeName==="P"){var De=this._getLinkDensity(k),it=this._getInnerText(k),Ne=it.length;(Ne>80&&De<.25||Ne<80&&Ne>0&&De===0&&it.search(/\.( |$)/)!==-1)&&(be=!0)}}be&&(this.log("Appending node:",k),this.ALTER_TO_DIV_EXCEPTIONS.indexOf(k.nodeName)===-1&&(this.log("Altering sibling:",k,"to div."),k=this._setNodeTag(k,"DIV")),B.appendChild(k),Ve=u.children,R-=1,ae-=1)}if(this._debug&&this.log("Article content pre-prep: "+B.innerHTML),this._prepArticle(B),this._debug&&this.log("Article content post-prep: "+B.innerHTML),p)a.id="readability-page-1",a.className="page";else{var Re=i.createElement("DIV");for(Re.id="readability-page-1",Re.className="page";B.firstChild;)Re.appendChild(B.firstChild);B.appendChild(Re)}this._debug&&this.log("Article content after paging: "+B.innerHTML);var xe=!0,ye=this._getInnerText(B,!0).length;if(ye0&&e.length<100):!1},_unescapeHtmlEntities:function(e){if(!e)return e;var i=this.HTML_ESCAPE_MAP;return e.replace(/&(quot|amp|apos|lt|gt);/g,function(t,r){return i[r]}).replace(/(?:x([0-9a-z]{1,4})|([0-9]{1,4}));/gi,function(t,r,s){var o=parseInt(r||s,r?16:10);return String.fromCharCode(o)})},_getJSONLD:function(e){var i=this._getAllNodesWithTag(e,["script"]),t;return this._forEachNode(i,function(r){if(!t&&r.getAttribute("type")==="application/ld+json")try{var s=r.textContent.replace(/^\s*\s*$/g,""),o=JSON.parse(s);if(!o["@context"]||!o["@context"].match(/^https?\:\/\/schema\.org$/)||(!o["@type"]&&Array.isArray(o["@graph"])&&(o=o["@graph"].find(function(f){return(f["@type"]||"").match(this.REGEXPS.jsonLdArticleTypes)})),!o||!o["@type"]||!o["@type"].match(this.REGEXPS.jsonLdArticleTypes)))return;if(t={},typeof o.name=="string"&&typeof o.headline=="string"&&o.name!==o.headline){var n=this._getArticleTitle(),c=this._textSimilarity(o.name,n)>.75,d=this._textSimilarity(o.headline,n)>.75;d&&!c?t.title=o.headline:t.title=o.name}else typeof o.name=="string"?t.title=o.name.trim():typeof o.headline=="string"&&(t.title=o.headline.trim());o.author&&(typeof o.author.name=="string"?t.byline=o.author.name.trim():Array.isArray(o.author)&&o.author[0]&&typeof o.author[0].name=="string"&&(t.byline=o.author.filter(function(f){return f&&typeof f.name=="string"}).map(function(f){return f.name.trim()}).join(", "))),typeof o.description=="string"&&(t.excerpt=o.description.trim()),o.publisher&&typeof o.publisher.name=="string"&&(t.siteName=o.publisher.name.trim());return}catch(f){this.log(f.message)}}),t||{}},_getArticleMetadata:function(e){var i={},t={},r=this._doc.getElementsByTagName("meta"),s=/\s*(dc|dcterm|og|twitter)\s*:\s*(author|creator|description|title|site_name)\s*/gi,o=/^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|site_name)\s*$/i;return this._forEachNode(r,function(n){var c=n.getAttribute("name"),d=n.getAttribute("property"),f=n.getAttribute("content");if(f){var b=null,D=null;d&&(b=d.match(s),b&&(D=b[0].toLowerCase().replace(/\s/g,""),t[D]=f.trim())),!b&&c&&o.test(c)&&(D=c,f&&(D=D.toLowerCase().replace(/\s/g,"").replace(/\./g,":"),t[D]=f.trim()))}}),i.title=e.title||t["dc:title"]||t["dcterm:title"]||t["og:title"]||t["weibo:article:title"]||t["weibo:webpage:title"]||t.title||t["twitter:title"],i.title||(i.title=this._getArticleTitle()),i.byline=e.byline||t["dc:creator"]||t["dcterm:creator"]||t.author,i.excerpt=e.excerpt||t["dc:description"]||t["dcterm:description"]||t["og:description"]||t["weibo:article:description"]||t["weibo:webpage:description"]||t.description||t["twitter:description"],i.siteName=e.siteName||t["og:site_name"],i.title=this._unescapeHtmlEntities(i.title),i.byline=this._unescapeHtmlEntities(i.byline),i.excerpt=this._unescapeHtmlEntities(i.excerpt),i.siteName=this._unescapeHtmlEntities(i.siteName),i},_isSingleImage:function(e){return e.tagName==="IMG"?!0:e.children.length!==1||e.textContent.trim()!==""?!1:this._isSingleImage(e.children[0])},_unwrapNoscriptImages:function(e){var i=Array.from(e.getElementsByTagName("img"));this._forEachNode(i,function(r){for(var s=0;s0&&s>t)return!1;if(e.parentNode.tagName===i&&(!r||r(e.parentNode)))return!0;e=e.parentNode,s++}return!1},_getRowAndColumnCount:function(e){for(var i=0,t=0,r=e.getElementsByTagName("tr"),s=0;s0){r._readabilityDataTable=!0;continue}var d=["col","colgroup","tfoot","thead","th"],f=function(D){return!!r.getElementsByTagName(D)[0]};if(d.some(f)){this.log("Data table because found data-y descendant"),r._readabilityDataTable=!0;continue}if(r.getElementsByTagName("table")[0]){r._readabilityDataTable=!1;continue}var b=this._getRowAndColumnCount(r);if(b.rows>=10||b.columns>4){r._readabilityDataTable=!0;continue}r._readabilityDataTable=b.rows*b.columns>10}},_fixLazyImages:function(e){this._forEachNode(this._getAllNodesWithTag(e,["img","picture","figure"]),function(i){if(i.src&&this.REGEXPS.b64DataUrl.test(i.src)){var t=this.REGEXPS.b64DataUrl.exec(i.src);if(t[1]==="image/svg+xml")return;for(var r=!1,s=0;sr+=this._getInnerText(o,!0).length),r/t},_cleanConditionally:function(e,i){this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)&&this._removeNodes(this._getAllNodesWithTag(e,[i]),function(t){var r=function(p){return p._readabilityDataTable},s=i==="ul"||i==="ol";if(!s){var o=0,n=this._getAllNodesWithTag(t,["ul","ol"]);this._forEachNode(n,p=>o+=this._getInnerText(p).length),s=o/this._getInnerText(t).length>.9}if(i==="table"&&r(t)||this._hasAncestorTag(t,"table",-1,r)||this._hasAncestorTag(t,"code"))return!1;var c=this._getClassWeight(t);this.log("Cleaning Conditionally",t);var d=0;if(c+d<0)return!0;if(this._getCharCount(t,",")<10){for(var f=t.getElementsByTagName("p").length,b=t.getElementsByTagName("img").length,D=t.getElementsByTagName("li").length-100,I=t.getElementsByTagName("input").length,C=this._getTextDensity(t,["h1","h2","h3","h4","h5","h6"]),U=0,x=this._getAllNodesWithTag(t,["object","embed","iframe"]),A=0;A1&&f/b<.5&&!this._hasAncestorTag(t,"figure")||!s&&D>f||I>Math.floor(f/3)||!s&&C<.9&&l<25&&(b===0||b>2)&&!this._hasAncestorTag(t,"figure")||!s&&c<25&&g>.2||c>=25&&g>.5||U===1&&l<75||U>1;return a}return!1})},_cleanMatchedNodes:function(e,i){for(var t=this._getNextNode(e,!0),r=this._getNextNode(e);r&&r!=t;)i.call(this,r,r.className+" "+r.id)?r=this._removeAndGetNext(r):r=this._getNextNode(r)},_cleanHeaders:function(e){let i=this._getAllNodesWithTag(e,["h1","h2"]);this._removeNodes(i,function(t){let r=this._getClassWeight(t)<0;return r&&this.log("Removing header with low class weight:",t),r})},_headerDuplicatesTitle:function(e){if(e.tagName!="H1"&&e.tagName!="H2")return!1;var i=this._getInnerText(e,!1);return this.log("Evaluating similarity of header:",i,this._articleTitle),this._textSimilarity(this._articleTitle,i)>.75},_flagIsActive:function(e){return(this._flags&e)>0},_removeFlag:function(e){this._flags=this._flags&~e},_isProbablyVisible:function(e){return(!e.style||e.style.display!="none")&&!e.hasAttribute("hidden")&&(!e.hasAttribute("aria-hidden")||e.getAttribute("aria-hidden")!="true"||e.className&&e.className.indexOf&&e.className.indexOf("fallback-image")!==-1)},parse:function(){if(this._maxElemsToParse>0){var e=this._doc.getElementsByTagName("*").length;if(e>this._maxElemsToParse)throw new Error("Aborting parsing document; "+e+" elements found")}this._unwrapNoscriptImages(this._doc);var i=this._disableJSONLD?{}:this._getJSONLD(this._doc);this._removeScripts(this._doc),this._prepDocument();var t=this._getArticleMetadata(i);this._articleTitle=t.title;var r=this._grabArticle();if(!r)return null;if(this.log("Grabbed: "+r.innerHTML),this._postProcessContent(r),!t.excerpt){var s=r.getElementsByTagName("p");s.length>0&&(t.excerpt=s[0].textContent.trim())}var o=r.textContent;return{title:this._articleTitle,byline:t.byline||this._articleByline,dir:this._articleDir,lang:this._articleLang,content:this._serializer(r),textContent:o,length:o.length,excerpt:t.excerpt,siteName:t.siteName||this._articleSiteName}}};typeof mi=="object"&&(mi.exports=Sr)});var xr=Ee((Ts,fi)=>{var Rr={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};function pa(e){return(!e.style||e.style.display!="none")&&!e.hasAttribute("hidden")&&(!e.hasAttribute("aria-hidden")||e.getAttribute("aria-hidden")!="true"||e.className&&e.className.indexOf&&e.className.indexOf("fallback-image")!==-1)}function ga(e,i={}){typeof i=="function"&&(i={visibilityChecker:i});var t={minScore:20,minContentLength:140,visibilityChecker:pa};i=Object.assign(t,i);var r=e.querySelectorAll("p, pre, article"),s=e.querySelectorAll("div > br");if(s.length){var o=new Set(r);[].forEach.call(s,function(c){o.add(c.parentNode)}),r=Array.from(o)}var n=0;return[].some.call(r,function(c){if(!i.visibilityChecker(c))return!1;var d=c.className+" "+c.id;if(Rr.unlikelyCandidates.test(d)&&!Rr.okMaybeItsACandidate.test(d)||c.matches("li p"))return!1;var f=c.textContent.trim().length;return fi.minScore)})}typeof fi=="object"&&(fi.exports=ga)});var Ir=Ee((As,Lr)=>{var ma=Dr(),fa=xr();Lr.exports={Readability:ma,isProbablyReaderable:fa}});var va={};bn(va,{default:()=>_t});module.exports=yn(va);var ue=require("obsidian");var zi=require("obsidian");async function jt(e){return{fileContent:await(await(0,zi.requestUrl)({url:e.href,method:"get"})).arrayBuffer,fileExtension:e.pathname.slice(e.pathname.lastIndexOf(".")+1)}}var mt=require("obsidian");async function Qe(e,i){i=(0,mt.normalizePath)(i);let t=e.getAbstractFileByPath(i);t&&t instanceof mt.TFolder||await e.createFolder(i)}var Ji=require("path");var ji=Fe(require("path")),qi=require("obsidian");function et(e){try{new URL(e)}catch(i){return!1}return!0}function qt(e,i){return new URL(e,i).href}function ne(e){return e.replace(/[:#/\\|?*<>"]/g,"")}function ft(e,i){let t=ji.default.join(e,i);return(0,qi.normalizePath)(t.replace(/\\/g,"/"))}var Yt=Fe(Ki()),Xt=class{constructor(){this.linksInfo={}}ensureHashGenerated(i,t){this.linksInfo[i.href]||(this.linksInfo[i.href]=Yt.ArrayBuffer.hash(t))}isSame(i,t){let r=Yt.ArrayBuffer.hash(t);return this.linksInfo[i.href]==r}},dt=new Xt;var Nn=/!\[(?.*?)\]\((? .+?)\)/g;async function _e(e,i,t){return await Tn(i,Nn,En(e,t))}function Tn(e,i,t){try{if(typeof t=="function"){let r=[];return String.prototype.replace.call(e,i,function(s,o,n){return r.push(t(s,o,n)),""}),Promise.all(r).then(function(s){return String.prototype.replace.call(e,i,function(){return s.shift()})})}else return Promise.resolve(String.prototype.replace.call(e,i,t))}catch(r){return Promise.reject(r)}}var An=5;function En(e,i){return async function(r,s,o){if(!et(o))return r;let n=new URL(o);await Qe(e.vault,i);try{let{fileContent:c,fileExtension:d}=await jt(n),f=0;for(;f %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%)
> %tootContent%`,stackExchangeNoteTitle:"%title%",stackExchangeNote:`[[ReadItLater]] [[StackExchange]]
# [%questionTitle%](%questionURL%)
Author: [%authorName%](%authorProfileURL%)
%questionContent%
***
%topAnswer%
%answers%`,stackExchangeAnswer:`Answered by: [%authorName%](%authorProfileURL%)
%answerContent%`,downloadStackExchangeAssets:!0,downloadStackExchangeAssetsInDir:!1,youtubeApiKey:"",tikTokNoteTitle:"TikTok from %authorName% (%date%)",tikTokNote:`[[ReadItLater]] [[TikTok]]
%videoDescription%
[%videoURL%](%videoURL%)
%videoPlayer%`,tikTokEmbedWidth:"325",tikTokEmbedHeight:"760",extendShareMenu:!0};var S=require("obsidian");var bt=class extends S.PluginSettingTab{constructor(t,r){super(t,r);this.plugin=r}display(){let{containerEl:t}=this;t.empty(),t.createEl("h2",{text:"General"}),new S.Setting(t).setName("Inbox dir").setDesc("Enter valid folder name. For nested folders use this format: Folder A/Folder B. If no folder is entered, new note will be created in vault root.").addText(n=>n.setPlaceholder("Defaults to root").setValue(this.plugin.settings.inboxDir||_.inboxDir).onChange(async c=>{this.plugin.settings.inboxDir=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Assets dir").setDesc("Enter valid folder name. For nested folders use this format: Folder A/Folder B. If no folder is entered, new note will be created in vault root.").addText(n=>n.setPlaceholder("Defaults to root").setValue(this.plugin.settings.assetsDir||_.inboxDir+"/assets").onChange(async c=>{this.plugin.settings.assetsDir=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Open new note").setDesc("If enabled, new note will open in current workspace").addToggle(n=>n.setValue(this.plugin.settings.openNewNote||_.openNewNote).onChange(async c=>{this.plugin.settings.openNewNote=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Date format string").setDesc("Format of the %date% variable. NOTE: do not use symbols forbidden in file names.").addText(n=>n.setPlaceholder("Defaults to YYYY-MM-DD HH-mm-ss").setValue(this.plugin.settings.dateTitleFmt||_.dateTitleFmt).onChange(async c=>{this.plugin.settings.dateTitleFmt=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Date format string in contents").setDesc("Format of the %date% variable for contents").addText(n=>n.setPlaceholder("Defaults to YYYY-MM-DD").setValue(this.plugin.settings.dateContentFmt||_.dateContentFmt).onChange(async c=>{this.plugin.settings.dateContentFmt=c,await this.plugin.saveSettings()})),new S.Setting(t).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:_.extendShareMenu).onChange(async c=>{this.plugin.settings.extendShareMenu=c,await this.plugin.saveSettings()})),t.createEl("h2",{text:"YouTube"}),new S.Setting(t).setName("Youtube note template title").setDesc("Available variables: %title%, %date%").addText(n=>n.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.youtubeNoteTitle||_.youtubeNoteTitle).onChange(async c=>{this.plugin.settings.youtubeNoteTitle=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Youtube note template").setDesc("Available variables: %date%, %videoTitle%, %videoURL%, %videoId%, %videoPlayer%, %channelId%, %channelName%, %channelURL%").addTextArea(n=>{n.setValue(this.plugin.settings.youtubeNote||_.youtubeNote).onChange(async c=>{this.plugin.settings.youtubeNote=c,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new S.Setting(t).setName("Youtube Data API v3 key").setDesc("If entered, additional template variables are available").addText(n=>n.setPlaceholder("").setValue(this.plugin.settings.youtubeApiKey||_.youtubeApiKey).onChange(async c=>{this.plugin.settings.youtubeApiKey=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Youtube embed player width").addText(n=>n.setPlaceholder(_.youtubeEmbedWidth).setValue(this.plugin.settings.youtubeEmbedWidth||_.youtubeEmbedWidth).onChange(async c=>{this.plugin.settings.youtubeEmbedWidth=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Youtube embed player height").addText(n=>n.setPlaceholder(_.youtubeEmbedHeight).setValue(this.plugin.settings.youtubeEmbedHeight||_.youtubeEmbedHeight).onChange(async c=>{this.plugin.settings.youtubeEmbedHeight=c,await this.plugin.saveSettings()})),t.createEl("h2",{text:"Vimeo"}),new S.Setting(t).setName("Vimeo note title template").setDesc("Available variables: %title%, %date%").addText(n=>n.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.vimeoNoteTitle||_.vimeoNoteTitle).onChange(async c=>{this.plugin.settings.vimeoNoteTitle=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Vimeo note template").setDesc("Available variables: %date%, %videoTitle%, %videoURL%, %videoId%, %videoPlayer%, %channelName%, %channelURL%").addTextArea(n=>{n.setValue(this.plugin.settings.vimeoNote||_.vimeoNote).onChange(async c=>{this.plugin.settings.vimeoNote=c,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new S.Setting(t).setName("Vimeo embed player width").addText(n=>n.setPlaceholder(_.vimeoEmbedWidth).setValue(this.plugin.settings.vimeoEmbedWidth||_.vimeoEmbedWidth).onChange(async c=>{this.plugin.settings.vimeoEmbedWidth=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Vimeo embed player height").addText(n=>n.setPlaceholder(_.vimeoEmbedHeight).setValue(this.plugin.settings.vimeoEmbedHeight||_.vimeoEmbedHeight).onChange(async c=>{this.plugin.settings.vimeoEmbedHeight=c,await this.plugin.saveSettings()})),t.createEl("h2",{text:"Bilibili"}),new S.Setting(t).setName("Bilibili note template title").setDesc("Available variables: %title%").addText(n=>n.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.bilibiliNoteTitle||_.bilibiliNoteTitle).onChange(async c=>{this.plugin.settings.bilibiliNoteTitle=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Bilibili note template").setDesc("Available variables: %videoTitle%, %videoURL%, %videoId%, %videoPlayer%").addTextArea(n=>{n.setValue(this.plugin.settings.bilibiliNote||_.bilibiliNote).onChange(async c=>{this.plugin.settings.bilibiliNote=c,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new S.Setting(t).setName("Bilibili embed player width").addText(n=>n.setPlaceholder(_.bilibiliEmbedWidth).setValue(this.plugin.settings.bilibiliEmbedWidth||_.bilibiliEmbedWidth).onChange(async c=>{this.plugin.settings.bilibiliEmbedWidth=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Bilibili embed player height").addText(n=>n.setPlaceholder(_.bilibiliEmbedHeight).setValue(this.plugin.settings.bilibiliEmbedHeight||_.bilibiliEmbedHeight).onChange(async c=>{this.plugin.settings.bilibiliEmbedHeight=c,await this.plugin.saveSettings()})),t.createEl("h2",{text:"Twitter"}),new S.Setting(t).setName("Twitter note template title").setDesc("Available variables: %tweetAuthorName%, %date%").addText(n=>n.setPlaceholder("Defaults to %tweetAuthorName%").setValue(this.plugin.settings.twitterNoteTitle||_.twitterNoteTitle).onChange(async c=>{this.plugin.settings.twitterNoteTitle=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Twitter note template").setDesc("Available variables: %date%, %tweetAuthorName%, %tweetURL%, %tweetContent%").addTextArea(n=>{n.setValue(this.plugin.settings.twitterNote||_.twitterNote).onChange(async c=>{this.plugin.settings.twitterNote=c,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),t.createEl("h2",{text:"Stack Exchange"}),new S.Setting(t).setName("Stack Exchange note title template").setDesc("Available variables: %title%, %date%").addText(n=>n.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.stackExchangeNoteTitle||_.stackExchangeNoteTitle).onChange(async c=>{this.plugin.settings.stackExchangeNoteTitle=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Stack Exchange question note template").setDesc("Available variables: %date%, %questionTitle%, %questionURL%, %authorName%, %authorProfileURL%, %questionContent%, %topAnswer%, %answers%").addTextArea(n=>{n.setValue(this.plugin.settings.stackExchangeNote||_.stackExchangeNote).onChange(async c=>{this.plugin.settings.stackExchangeNote=c,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new S.Setting(t).setName("Stack Exchange answer template").setDesc("Available variables: %date%, %answerContent%, %authorName%, %authorProfileURL%").addTextArea(n=>{n.setValue(this.plugin.settings.stackExchangeAnswer||_.stackExchangeAnswer).onChange(async c=>{this.plugin.settings.stackExchangeAnswer=c,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new S.Setting(t).setName("Download media attachments").setDesc("If enabled, media attachments are downloaded to the assets folder (only Desktop App feature)").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadStackExchangeAssets")?this.plugin.settings.downloadStackExchangeAssets:_.downloadStackExchangeAssets).onChange(async c=>{this.plugin.settings.downloadStackExchangeAssets=c,r.setDisabled(!c),await this.plugin.saveSettings()}));let r=new S.Setting(t).setName("Download media attachments to folder").setDesc("If enabled, the media attachments are stored in their own folder.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadStackExchangeAssetsInDir")?this.plugin.settings.downloadStackExchangeAssetsInDir:_.downloadStackExchangeAssetsInDir).onChange(async c=>{this.plugin.settings.downloadStackExchangeAssetsInDir=c,await this.plugin.saveSettings()}));t.createEl("h2",{text:"Mastodon"}),new S.Setting(t).setName("Mastodon note template title").setDesc("Available variables: %tootAuthorName%, %date%").addText(n=>n.setPlaceholder("Defaults to %tootAuthorName%").setValue(this.plugin.settings.mastodonNoteTitle||_.mastodonNoteTitle).onChange(async c=>{this.plugin.settings.mastodonNoteTitle=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Mastodon note template").setDesc("Available variables: %date%, %tootAuthorName%, %tootURL%, %tootContent%").addTextArea(n=>{n.setValue(this.plugin.settings.mastodonNote||_.mastodonNote).onChange(async c=>{this.plugin.settings.mastodonNote=c,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new S.Setting(t).setName("Download media attachments").setDesc("If enabled, media attachments of toot are downloaded to the assets folder (only Desktop App feature)").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadMastodonMediaAttachments")?this.plugin.settings.downloadMastodonMediaAttachments:_.downloadMastodonMediaAttachments).onChange(async c=>{this.plugin.settings.downloadMastodonMediaAttachments=c,s.setDisabled(!c),await this.plugin.saveSettings()}));let s=new S.Setting(t).setName("Download media attachments to folder").setDesc("If enabled, the media attachments of toot are stored in their own folder.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadMastodonMediaAttachmentsInDir")?this.plugin.settings.downloadMastodonMediaAttachmentsInDir:_.downloadMastodonMediaAttachmentsInDir).onChange(async c=>{this.plugin.settings.downloadMastodonMediaAttachmentsInDir=c,await this.plugin.saveSettings()}));new S.Setting(t).setName("Save replies").setDesc("If enabled, replies of toot will be saved.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"saveMastodonReplies")?this.plugin.settings.saveMastodonReplies:_.saveMastodonReplies).onChange(async c=>{this.plugin.settings.saveMastodonReplies=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Mastodon reply template").setDesc("Available variables: %tootAuthorName%, %tootURL%, %tootContent%").addTextArea(n=>{n.setValue(this.plugin.settings.mastodonReply||_.mastodonReply).onChange(async c=>{this.plugin.settings.mastodonReply=c,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),t.createEl("h2",{text:"TikTok"}),new S.Setting(t).setName("TikTok note title template").setDesc("Available variables: %authorName%, %date%").addText(n=>n.setPlaceholder("TikTok from %authorName% (%date%)").setValue(this.plugin.settings.tikTokNoteTitle||_.tikTokNoteTitle).onChange(async c=>{this.plugin.settings.tikTokNoteTitle=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("TikTok note template").setDesc("Available variables: %date%, %videoDescription%, %videoURL%, %videoId%, %videoPlayer%, %authorName%, %authorURL%").addTextArea(n=>{n.setValue(this.plugin.settings.tikTokNote||_.tikTokNote).onChange(async c=>{this.plugin.settings.tikTokNote=c,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new S.Setting(t).setName("TikTok embed player width").addText(n=>n.setPlaceholder(_.tikTokEmbedWidth).setValue(this.plugin.settings.tikTokEmbedWidth||_.tikTokEmbedWidth).onChange(async c=>{this.plugin.settings.tikTokEmbedWidth=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("TikTok embed player height").addText(n=>n.setPlaceholder(_.tikTokEmbedHeight).setValue(this.plugin.settings.tikTokEmbedHeight||_.tikTokEmbedHeight).onChange(async c=>{this.plugin.settings.tikTokEmbedHeight=c,await this.plugin.saveSettings()})),t.createEl("h2",{text:"Readable Article"}),new S.Setting(t).setName("Readable article note template title").setDesc("Available variables: %title%, %date%").addText(n=>n.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.parseableArticleNoteTitle||_.parseableArticleNoteTitle).onChange(async c=>{this.plugin.settings.parseableArticleNoteTitle=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Readable article note template").setDesc("Available variables: %date%, %articleTitle%, %articleURL%, %articleContent%, %author%, %siteName%, %articleReadingTime%").addTextArea(n=>{n.setValue(this.plugin.settings.parsableArticleNote||_.parsableArticleNote).onChange(async c=>{this.plugin.settings.parsableArticleNote=c,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new S.Setting(t).setName("Download images").setDesc("If enabled, images in article are downloaded to the assets folder (only Desktop App feature)").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadImages")?this.plugin.settings.downloadImages:_.downloadImages).onChange(async c=>{this.plugin.settings.downloadImages=c,o.setDisabled(!c),await this.plugin.saveSettings()}));let o=new S.Setting(t).setName("Download images to note folder").setDesc("If enabled, the images in article are stored in their own folder.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadImagesInArticleDir")?this.plugin.settings.downloadImagesInArticleDir:_.downloadImagesInArticleDir).onChange(async c=>{this.plugin.settings.downloadImagesInArticleDir=c,await this.plugin.saveSettings()}));t.createEl("h2",{text:"Nonreadable Article"}),new S.Setting(t).setName("Nonreadable article note template title").setDesc("Available variables: %date%").addText(n=>n.setPlaceholder("Defaults to 'Article %date%'").setValue(this.plugin.settings.notParseableArticleNoteTitle||_.notParseableArticleNoteTitle).onChange(async c=>{this.plugin.settings.notParseableArticleNoteTitle=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Nonreadable article note template").setDesc("Available variables: %date%, %articleURL%").addTextArea(n=>{n.setValue(this.plugin.settings.notParsableArticleNote||_.notParsableArticleNote).onChange(async c=>{this.plugin.settings.notParsableArticleNote=c,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),t.createEl("h2",{text:"Text Snippet"}),new S.Setting(t).setName("Text snippet note template title").setDesc("Available variables: %date%").addText(n=>n.setPlaceholder("Defaults to 'Note %date%'").setValue(this.plugin.settings.textSnippetNoteTitle||_.textSnippetNoteTitle).onChange(async c=>{this.plugin.settings.textSnippetNoteTitle=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Text snippet note template").setDesc("Available variables: %date%, %content%").addTextArea(n=>{n.setValue(this.plugin.settings.textSnippetNote||_.textSnippetNote).onChange(async c=>{this.plugin.settings.textSnippetNote=c,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25})}};var Be=require("obsidian"),yt=Fe(er());var F=class{constructor(i,t){this.fileName=i,this.content=t}};var Jt=require("obsidian"),G=class{constructor(i,t){this.app=i,this.settings=t}isValidUrl(i){try{new URL(i)}catch(t){return!1}return!0}getFormattedDateForFilename(){return(0,Jt.moment)(new Date).format(this.settings.dateTitleFmt)}getFormattedDateForContent(){return(0,Jt.moment)(new Date).format(this.settings.dateContentFmt)}};var Zt=class extends G{constructor(t,r){super(t,r);this.PATTERN=/(youtube.com|youtu.be)\/(watch|shorts)?(\?v=|\/)?([^?]*)/}test(t){return this.isValidUrl(t)&&this.PATTERN.test(t)}async prepareNote(t){let r=this.settings.youtubeApiKey===""?await this.parseSchema(t):await this.parseApiResponse(t),s=this.settings.youtubeNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%videoTitle%/g,r.title).replace(/%videoId%/g,r.id).replace(/%videoDescription%/g,r.description).replace(/%videoThumbnail%/g,r.thumbnail).replace(/%videoDuration%/g,r.duration.toString()).replace(/%videoDurationFormatted%/g,r.durationFormatted).replace(/%videoPublishDate%/g,r.pubDate.toString()).replace(/%videoViewsCount%/g,r.viewsCount.toString()).replace(/%videoURL%/g,r.url).replace(/%channelId%/g,r.channel.id).replace(/%channelName%/g,r.channel.name).replace(/%channelURL%/g,r.channel.url).replace(/%videoTags%/g,r.tags.join(" ")).replace(/%videoPlayer%/g,r.player),n=`${this.settings.youtubeNoteTitle.replace(/%title%/g,r.title).replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new F(n,s)}async parseApiResponse(t){var s;let r=this.PATTERN.exec(t)[4];try{let o=await(0,Be.request)({method:"GET",url:`https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,statistics,status,topicDetails&id=${r}&key=${this.settings.youtubeApiKey}`,headers:{Accept:"application/json"}}),n=JSON.parse(o);if(n.items.length===0)throw new Error(`Video (${t}) cannot be fetched from API`);let c=n.items[0],d=await(0,Be.request)({method:"GET",url:`https://www.googleapis.com/youtube/v3/channels?part=snippet,contentDetails,statistics&id=${c.snippet.channelId}&key=${this.settings.youtubeApiKey}`,headers:{Accept:"application/json"}}),f=JSON.parse(d);if(f.items.length===0)throw new Error(`Channel (${c.snippet.channelId}) cannot be fetched from API`);let b=f.items[0],D=`VIDEO `,I=(0,yt.parse)(c.contentDetails.duration);return{id:c.id,url:t,title:c.snippet.title,description:c.snippet.description,thumbnail:c.snippet.thumbnails.default.url,player:D,duration:(0,yt.toSeconds)(I),durationFormatted:this.formatDuration(I),pubDate:(0,Be.moment)(c.snippet.publishedAt).format(this.settings.dateContentFmt),viewsCount:c.statistics.viewCount,tags:Object.prototype.hasOwnProperty.call(c,"tags")?c.snippet.tags.map(C=>C.replace(/[\s:\-_.]/g,"").replace(/^/,"#")):[],channel:{id:b.id,url:`https://www.youtube.com/channel/${b.id}`,name:(s=b.snippet.title)!=null?s:""}}}catch(o){vt(o)}}async parseSchema(t){var r,s,o,n,c,d,f,b,D,I;try{let C=await(0,Be.request)({method:"GET",url:t,headers:{"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"}}),x=new DOMParser().parseFromString(C,"text/html").querySelector('[itemtype="http://schema.org/VideoObject"]'),A=(s=(r=x==null?void 0:x.querySelector('[itemprop="identifier"]'))==null?void 0:r.getAttribute("content"))!=null?s:"",m=x.querySelector('[itemtype="http://schema.org/Person"]'),g=`VIDEO `;return{id:A,url:t,title:(n=(o=x==null?void 0:x.querySelector('[itemprop="name"]'))==null?void 0:o.getAttribute("content"))!=null?n:"",description:"",thumbnail:"",player:g,duration:0,durationFormatted:"",pubDate:"",viewsCount:0,tags:[],channel:{id:(d=(c=x==null?void 0:x.querySelector('[itemprop="channelId"'))==null?void 0:c.getAttribute("content"))!=null?d:"",url:(b=(f=m==null?void 0:m.querySelector('[itemprop="url"]'))==null?void 0:f.getAttribute("href"))!=null?b:"",name:(I=(D=m==null?void 0:m.querySelector('[itemprop="name"]'))==null?void 0:D.getAttribute("content"))!=null?I:""}}}catch(C){vt(C)}}formatDuration(t){let r="";return t.years>0&&(r=r.concat(" ",`${t.years}y`)),t.months>0&&(r=r.concat(" ",`${t.months}m`)),t.weeks>0&&(r=r.concat(" ",`${t.weeks}w`)),t.days>0&&(r=r.concat(" ",`${t.days}d`)),t.hours>0&&(r=r.concat(" ",`${t.hours}h`)),t.minutes>0&&(r=r.concat(" ",`${t.minutes}m`)),t.seconds>0&&(r=r.concat(" ",`${t.seconds}s`)),r.trim()}},tr=Zt;var ir=require("obsidian");var Qt=class extends G{constructor(t,r){super(t,r);this.PATTERN=/(vimeo.com)\/(\d+)?/}test(t){return this.isValidUrl(t)&&this.PATTERN.test(t)}async prepareNote(t){let r=await this.parseSchema(t),s=this.settings.vimeoNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%videoTitle%/g,r.title).replace(/%videoId%/g,r.id).replace(/%videoURL%/g,r.url).replace(/%channelName%/g,r.channel.name).replace(/%channelURL%/g,r.channel.url).replace(/%videoPlayer%/g,r.player),n=`${this.settings.vimeoNoteTitle.replace(/%title%/g,r.title).replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new F(n,s)}async parseSchema(t){var f,b,D,I,C,U;let r=await(0,ir.request)({method:"GET",url:t,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"}}),o=new DOMParser().parseFromString(r,"text/html").querySelector('script[type="application/ld+json"]'),c=JSON.parse(o.textContent)[0],d=this.PATTERN.exec(t);return{id:d.length===3?d[2]:"",url:(f=c==null?void 0:c.url)!=null?f:"",title:(b=c==null?void 0:c.name)!=null?b:"",player:``,channel:{name:(I=(D=c==null?void 0:c.author)==null?void 0:D.name)!=null?I:"",url:(U=(C=c==null?void 0:c.author)==null?void 0:C.url)!=null?U:""}}}},rr=Qt;var nr=require("obsidian");var ei=class extends G{constructor(t,r){super(t,r);this.PATTERN=/(bilibili.com)\/(video)?\/([a-z0-9]+)?/i}test(t){return this.isValidUrl(t)&&this.PATTERN.test(t)}async prepareNote(t){let r=await(0,nr.request)({method:"GET",url:t,headers:{"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"}}),o=new DOMParser().parseFromString(r,"text/html").querySelector("[property~='og:title']").getAttribute("content"),n=this.PATTERN.exec(t)[3],c=``,d=this.settings.bilibiliNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%videoTitle%/g,o).replace(/%videoURL%/g,t).replace(/%videoId%/g,n).replace(/%videoPlayer%/g,c),b=`${this.settings.bilibiliNoteTitle.replace(/%title%/g,o).replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new F(b,d)}},ar=ei;var Ar=require("obsidian");function Mn(e){for(var i=1;i0&&e[i-1]===`
`;)i--;return e.substring(0,i)}var Fn=["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 ai(e){return si(e,Fn)}var lr=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function cr(e){return si(e,lr)}function Un(e){return hr(e,lr)}var ur=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function Bn(e){return si(e,ur)}function Hn(e){return hr(e,ur)}function si(e,i){return i.indexOf(e.nodeName)>=0}function hr(e,i){return e.getElementsByTagName&&i.some(function(t){return e.getElementsByTagName(t).length})}var Z={};Z.paragraph={filter:"p",replacement:function(e){return`
`+e+`
`}};Z.lineBreak={filter:"br",replacement:function(e,i,t){return t.br+`
`}};Z.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,i,t){var r=Number(i.nodeName.charAt(1));if(t.headingStyle==="setext"&&r<3){var s=ni(r===1?"=":"-",e.length);return`
`+e+`
`+s+`
`}else return`
`+ni("#",r)+" "+e+`
`}};Z.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
`+e+`
`}};Z.list={filter:["ul","ol"],replacement:function(e,i){var t=i.parentNode;return t.nodeName==="LI"&&t.lastElementChild===i?`
`+e:`
`+e+`
`}};Z.listItem={filter:"li",replacement:function(e,i,t){e=e.replace(/^\n+/,"").replace(/\n+$/,`
`).replace(/\n/gm,`
`);var r=t.bulletListMarker+" ",s=i.parentNode;if(s.nodeName==="OL"){var o=s.getAttribute("start"),n=Array.prototype.indexOf.call(s.children,i);r=(o?Number(o)+n:n+1)+". "}return r+e+(i.nextSibling&&!/\n$/.test(e)?`
`:"")}};Z.indentedCodeBlock={filter:function(e,i){return i.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,i,t){return`
`+i.firstChild.textContent.replace(/\n/g,`
`)+`
`}};Z.fencedCodeBlock={filter:function(e,i){return i.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,i,t){for(var r=i.firstChild.getAttribute("class")||"",s=(r.match(/language-(\S+)/)||[null,""])[1],o=i.firstChild.textContent,n=t.fence.charAt(0),c=3,d=new RegExp("^"+n+"{3,}","gm"),f;f=d.exec(o);)f[0].length>=c&&(c=f[0].length+1);var b=ni(n,c);return`
`+b+s+`
`+o.replace(/\n$/,"")+`
`+b+`
`}};Z.horizontalRule={filter:"hr",replacement:function(e,i,t){return`
`+t.hr+`
`}};Z.inlineLink={filter:function(e,i){return i.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,i){var t=i.getAttribute("href"),r=Nt(i.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+t+r+")"}};Z.referenceLink={filter:function(e,i){return i.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,i,t){var r=i.getAttribute("href"),s=Nt(i.getAttribute("title"));s&&(s=' "'+s+'"');var o,n;switch(t.linkReferenceStyle){case"collapsed":o="["+e+"][]",n="["+e+"]: "+r+s;break;case"shortcut":o="["+e+"]",n="["+e+"]: "+r+s;break;default:var c=this.references.length+1;o="["+e+"]["+c+"]",n="["+c+"]: "+r+s}return this.references.push(n),o},references:[],append:function(e){var i="";return this.references.length&&(i=`
`+this.references.join(`
`)+`
`,this.references=[]),i}};Z.emphasis={filter:["em","i"],replacement:function(e,i,t){return e.trim()?t.emDelimiter+e+t.emDelimiter:""}};Z.strong={filter:["strong","b"],replacement:function(e,i,t){return e.trim()?t.strongDelimiter+e+t.strongDelimiter:""}};Z.code={filter:function(e){var i=e.previousSibling||e.nextSibling,t=e.parentNode.nodeName==="PRE"&&!i;return e.nodeName==="CODE"&&!t},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var i=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",t="`",r=e.match(/`+/gm)||[];r.indexOf(t)!==-1;)t=t+"`";return t+i+e+i+t}};Z.image={filter:"img",replacement:function(e,i){var t=Nt(i.getAttribute("alt")),r=i.getAttribute("src")||"",s=Nt(i.getAttribute("title")),o=s?' "'+s+'"':"";return r?"!["+t+"]("+r+o+")":""}};function Nt(e){return e?e.replace(/(\n+\s*)+/g,`
`):""}function pr(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 i in e.rules)this.array.push(e.rules[i])}pr.prototype={add:function(e,i){this.array.unshift(i)},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 i;return(i=ti(this.array,e,this.options))||(i=ti(this._keep,e,this.options))||(i=ti(this._remove,e,this.options))?i:this.defaultRule},forEach:function(e){for(var i=0;i-1)return!0}else if(typeof r=="function"){if(r.call(e,i,t))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function Wn(e){var i=e.element,t=e.isBlock,r=e.isVoid,s=e.isPre||function(D){return D.nodeName==="PRE"};if(!(!i.firstChild||s(i))){for(var o=null,n=!1,c=null,d=sr(c,i,s);d!==i;){if(d.nodeType===3||d.nodeType===4){var f=d.data.replace(/[ \r\n\t]+/g," ");if((!o||/ $/.test(o.data))&&!n&&f[0]===" "&&(f=f.substr(1)),!f){d=ii(d);continue}d.data=f,o=d}else if(d.nodeType===1)t(d)||d.nodeName==="BR"?(o&&(o.data=o.data.replace(/ $/,"")),o=null,n=!1):r(d)||s(d)?(o=null,n=!0):o&&(n=!1);else{d=ii(d);continue}var b=sr(c,d,s);c=d,d=b}o&&(o.data=o.data.replace(/ $/,""),o.data||ii(o))}}function ii(e){var i=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),i}function sr(e,i,t){return e&&e.parentNode===i||t(i)?i.nextSibling||i.parentNode:i.firstChild||i.nextSibling||i.parentNode}var gr=typeof window!="undefined"?window:{};function Vn(){var e=gr.DOMParser,i=!1;try{new e().parseFromString("","text/html")&&(i=!0)}catch(t){}return i}function $n(){var e=function(){};return zn()?e.prototype.parseFromString=function(i){var t=new window.ActiveXObject("htmlfile");return t.designMode="on",t.open(),t.write(i),t.close(),t}:e.prototype.parseFromString=function(i){var t=document.implementation.createHTMLDocument("");return t.open(),t.write(i),t.close(),t},e}function zn(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch(i){window.ActiveXObject&&(e=!0)}return e}var jn=Vn()?gr.DOMParser:$n();function qn(e,i){var t;if(typeof e=="string"){var r=Yn().parseFromString(''+e+" ","text/html");t=r.getElementById("turndown-root")}else t=e.cloneNode(!0);return Wn({element:t,isBlock:ai,isVoid:cr,isPre:i.preformattedCode?Xn:null}),t}var ri;function Yn(){return ri=ri||new jn,ri}function Xn(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function Kn(e,i){return e.isBlock=ai(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=Jn(e),e.flankingWhitespace=Zn(e,i),e}function Jn(e){return!cr(e)&&!Bn(e)&&/^\s*$/i.test(e.textContent)&&!Un(e)&&!Hn(e)}function Zn(e,i){if(e.isBlock||i.preformattedCode&&e.isCode)return{leading:"",trailing:""};var t=Qn(e.textContent);return t.leadingAscii&&or("left",e,i)&&(t.leading=t.leadingNonAscii),t.trailingAscii&&or("right",e,i)&&(t.trailing=t.trailingNonAscii),{leading:t.leading,trailing:t.trailing}}function Qn(e){var i=e.match(/^(([ \t\r\n]*)(\s*))[\s\S]*?((\s*?)([ \t\r\n]*))$/);return{leading:i[1],leadingAscii:i[2],leadingNonAscii:i[3],trailing:i[4],trailingNonAscii:i[5],trailingAscii:i[6]}}function or(e,i,t){var r,s,o;return e==="left"?(r=i.previousSibling,s=/ $/):(r=i.nextSibling,s=/^ /),r&&(r.nodeType===3?o=s.test(r.nodeValue):t.preformattedCode&&r.nodeName==="CODE"?o=!1:r.nodeType===1&&!ai(r)&&(o=s.test(r.textContent))),o}var ea=Array.prototype.reduce,ta=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Tt(e){if(!(this instanceof Tt))return new Tt(e);var i={rules:Z,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(t,r){return r.isBlock?`
`:""},keepReplacement:function(t,r){return r.isBlock?`
`+r.outerHTML+`
`:r.outerHTML},defaultReplacement:function(t,r){return r.isBlock?`
`+t+`
`:t}};this.options=Mn({},i,e),this.rules=new pr(this.options)}Tt.prototype={turndown:function(e){if(!na(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var i=mr.call(this,new qn(e,this.options));return ia.call(this,i)},use:function(e){if(Array.isArray(e))for(var i=0;i0&&(n=o.item(0).getAttribute("href"),Array.from(o).forEach(b=>{b.remove()}));let c=s.createElement("base");c.setAttribute("href",qt(n!=null?n:t.href,t.origin)),s.head.append(c);let d=Cr.sanitize(s.body.innerHTML);s.body.innerHTML=d,(0,Et.isProbablyReaderable)(s)||new He.Notice("@mozilla/readability considers this document to unlikely be readerable.");let f=new Et.Readability(s).parse();return f!=null&&f.content?await this.parsableArticle(this.app,f,t.href):this.notParsableArticle(t.href)}async parsableArticle(i,t,r){let s=t.title||"No title",o=t.siteName||"",n=t.byline||"",c=await de(t.content),d=this.settings.parseableArticleNoteTitle.replace(/%title%/g,s).replace(/%date%/g,this.getFormattedDateForFilename()),f=this.settings.downloadImagesInArticleDir?`${this.settings.assetsDir}/${ne(d)}/`:this.settings.assetsDir;this.settings.downloadImages&&He.Platform.isDesktop&&(c=await _e(i,c,f));let b=this.settings.parsableArticleNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%articleTitle%/g,s).replace(/%articleURL%/g,r).replace(/%articleReadingTime%/g,`${this.getEstimatedReadingTime(t)}`).replace(/%articleContent%/g,c).replace(/%siteName%/g,o).replace(/%author%/g,n),D=`${d}.md`;return new F(D,b)}notParsableArticle(i){console.error("Website not parseable");let t=this.settings.notParsableArticleNote.replace("%articleURL%",i),s=`${this.settings.notParseableArticleNoteTitle.replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new F(s,t)}getEstimatedReadingTime(i){let t=i.lang||"en",r=this.getReadingSpeed(t),s=i.textContent.trim().split(/\s+/).length;return Math.ceil(s/r)}getReadingSpeed(i){let t=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",199],["tr",166],["zh",158]]);return t.get(i)||t.get("en")}},Pr=di;var vi=class extends G{constructor(i,t){super(i,t)}test(){return!0}async prepareNote(i){let r=`${this.settings.textSnippetNoteTitle.replace(/%date%/g,this.getFormattedDateForFilename())}.md`,s=this.settings.textSnippetNote.replace(/%content%/g,i).replace(/%date%/g,this.getFormattedDateForContent());return new F(r,s)}},Mr=vi;var Ge=require("obsidian");var bi={INSTANCE:"/api/v2/instance",OEMBED:"/api/oembed",STATUS:"/api/v1/statuses",CONTEXT:"/api/v1/statuses/%id%/context"},yi=class extends G{constructor(i,t){super(i,t)}async test(i){return et(i)&&await this.testIsMastodon(i)}async prepareNote(i){let t=new URL(i),r=t.pathname.split("/")[2],s=await this.loadStatus(t.hostname,r),o=this.settings.mastodonNoteTitle.replace(/%tootAuthorName%/g,s.account.display_name).replace(/%date%/g,this.getFormattedDateForFilename()),n=this.settings.downloadMastodonMediaAttachmentsInDir?`${this.settings.assetsDir}/${ne(o)}/`:this.settings.assetsDir,c=await this.parseStatus(s,n);if(this.settings.saveMastodonReplies){let b=await this.loadReplies(t.hostname,r);for(let D=0;D{let o=s?`
> *${s}*`:"";return`${t}
![](${r})${o}`},"")}async testIsMastodon(i){if(!i)return!1;let t=new URL(i).hostname;try{let r=JSON.parse(await(0,Ge.request)({method:"GET",contentType:"application/json",url:`https://${t}${bi.INSTANCE}`}));return(r==null?void 0:r.domain)===t}catch(r){return!1}}},kr=yi;var Or=require("obsidian");var Ni=class extends G{constructor(t,r){super(t,r);this.PATTERN=/(tiktok.com)\/(\S+)\/(video)\/(\d+)/}test(t){return this.isValidUrl(t)&&this.PATTERN.test(t)}async prepareNote(t){let r=await this.parseHtml(t),s=this.settings.tikTokNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%videoDescription%/g,r.description).replace(/%videoId%/g,r.id).replace(/%videoURL%/g,r.url).replace(/%authorName%/g,r.author.name).replace(/%authorURL%/g,r.author.url).replace(/%videoPlayer%/g,r.player),n=`${this.settings.tikTokNoteTitle.replace(/%authorName%/g,r.author.name).replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new F(n,s)}async parseHtml(t){var n,c,d,f;let r=await(0,Or.request)({method:"GET",url:t,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"}}),s=new DOMParser().parseFromString(r,"text/html"),o=this.PATTERN.exec(t);return{id:o[4],url:(c=(n=s.querySelector('meta[property="og:url"]'))==null?void 0:n.getAttribute("content"))!=null?c:t,description:(f=(d=s.querySelector('meta[property="og:description"]'))==null?void 0:d.getAttribute("content"))!=null?f:"",player:``,author:{name:o[2],url:`https://www.tiktok.com/${o[2]}`}}}},Fr=Ni;var tt=class{constructor(i){this.parsers=i}async createParser(i){for(let t of this.parsers)if(await t.test(i))return t}};var _t=class extends ue.Plugin{async onload(){await this.loadSettings(),this.parserCreator=new tt([new tr(this.app,this.settings),new rr(this.app,this.settings),new ar(this.app,this.settings),new Er(this.app,this.settings),new wr(this.app,this.settings),new kr(this.app,this.settings),new Fr(this.app,this.settings),new Pr(this.app,this.settings),new Mr(this.app,this.settings)]),(0,ue.addIcon)("read-it-later",da),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 bt(this.app,this)),this.settings.extendShareMenu&&this.registerEvent(this.app.workspace.on("receive-text-menu",(t,r)=>{t.addItem(s=>{s.setTitle("ReadItLater"),s.setIcon("read-it-later"),s.onClick(()=>this.processContent(r))})}))}async loadSettings(){this.settings=Object.assign({},_,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}async processClipboard(){let t=await navigator.clipboard.readText(),s=await(await this.parserCreator.createParser(t)).prepareNote(t);await this.writeFile(s.fileName,s.content)}async processContent(t){let s=await(await this.parserCreator.createParser(t)).prepareNote(t);await this.writeFile(s.fileName,s.content)}async writeFile(t,r){let s;if(t=ne(t),await Qe(this.app.vault,this.settings.inboxDir),this.settings.inboxDir?s=(0,ue.normalizePath)(`${this.settings.inboxDir}/${t}`):s=(0,ue.normalizePath)(`/${t}`),await this.app.vault.adapter.exists(s))new ue.Notice(`${t} already exists!`);else{let o=await this.app.vault.create(s,r);this.settings.openNewNote&&this.app.workspace.getLeaf(!1).openFile(o),new ue.Notice(`${t} created successful`)}}},da=`
`;
/*! 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 *)
*/