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.

212 lines
199 KiB

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var tr=Object.create;var Et=Object.defineProperty;var ir=Object.getOwnPropertyDescriptor;var ar=Object.getOwnPropertyNames;var nr=Object.getPrototypeOf,rr=Object.prototype.hasOwnProperty;var sr=(i,t,e)=>t in i?Et(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var lt=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),or=(i,t)=>{for(var e in t)Et(i,e,{get:t[e],enumerable:!0})},Da=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ar(t))!rr.call(i,s)&&s!==e&&Et(i,s,{get:()=>t[s],enumerable:!(a=ir(t,s))||a.enumerable});return i};var Yt=(i,t,e)=>(e=i!=null?tr(nr(i)):{},Da(t||!i||!i.__esModule?Et(e,"default",{value:i,enumerable:!0}):e,i)),lr=i=>Da(Et({},"__esModule",{value:!0}),i);var k=(i,t,e)=>sr(i,typeof t!="symbol"?t+"":t,e);var qa=lt(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.toSeconds=re.end=re.parse=re.pattern=void 0;var ct="\\d+",Li="".concat(ct,"(?:[\\.,]").concat(ct,")?"),cr="(".concat(ct,"Y)?(").concat(ct,"M)?(").concat(ct,"W)?(").concat(ct,"D)?"),mr="T(".concat(Li,"H)?(").concat(Li,"M)?(").concat(Li,"S)?"),dr="P(?:".concat(cr,"(?:").concat(mr,")?)"),ur=["years","months","weeks","days","hours","minutes","seconds"],$a=Object.freeze({years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0});re.pattern=new RegExp(dr);var gr=function(i){var t=i.replace(/,/g,".").match(re.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,s,n){return a[ur[n]]=parseFloat(s||"0")||0,a},{})};re.parse=gr;var hr=function(i,t){t===void 0&&(t=new Date);var e=Object.assign({},$a,i),a=t.getTime(),s=new Date(a);s.setFullYear(s.getFullYear()+e.years),s.setMonth(s.getMonth()+e.months),s.setDate(s.getDate()+e.days);var n=e.hours*3600*1e3,r=e.minutes*60*1e3;return s.setMilliseconds(s.getMilliseconds()+e.seconds*1e3+n+r),s.setDate(s.getDate()+e.weeks*7),s};re.end=hr;var fr=function(i,t){t===void 0&&(t=new Date);var e=Object.assign({},$a,i),a=t.getTime(),s=new Date(a),n=(0,re.end)(e,s),r=t.getTimezoneOffset(),o=n.getTimezoneOffset(),p=(r-o)*60,c=(n.getTime()-s.getTime())/1e3;return c+p};re.toSeconds=fr;re.default={end:re.end,toSeconds:re.toSeconds,pattern:re.pattern,parse:re.parse}});var Gi=lt((qi,Wi)=>{(function(i,t){typeof qi=="object"&&typeof Wi!="undefined"?Wi.exports=t():typeof define=="function"&&define.amd?define(t):(i=typeof globalThis!="undefined"?globalThis:i||self,i.DOMPurify=t())})(qi,function(){"use strict";function i(v){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(b){return typeof b}:function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},i(v)}function t(v,b){return t=Object.setPrototypeOf||function(D,$){return D.__proto__=$,D},t(v,b)}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(v){return!1}}function a(v,b,S){return e()?a=Reflect.construct:a=function($,ve,me){var Fe=[null];Fe.push.apply(Fe,ve);var Xe=Function.bind.apply($,Fe),xt=new Xe;return me&&t(xt,me.prototype),xt},a.apply(null,arguments)}function s(v){return n(v)||r(v)||o(v)||c()}function n(v){if(Array.isArray(v))return p(v)}function r(v){if(typeof Symbol!="undefined"&&v[Symbol.iterator]!=null||v["@@iterator"]!=null)return Array.from(v)}function o(v,b){if(v){if(typeof v=="string")return p(v,b);var S=Object.prototype.toString.call(v).slice(8,-1);if(S==="Object"&&v.constructor&&(S=v.constructor.name),S==="Map"||S==="Set")return Array.from(v);if(S==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(S))return p(v,b)}}function p(v,b){(b==null||b>v.length)&&(b=v.length);for(var S=0,D=new Array(b);S<b;S++)D[S]=v[S];return D}function c(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var d=Object.hasOwnProperty,h=Object.setPrototypeOf,_=Object.isFrozen,N=Object.getPrototypeOf,C=Object.getOwnPropertyDescriptor,A=Object.freeze,f=Object.seal,P=Object.create,L=typeof Reflect!="undefined"&&Reflect,z=L.apply,x=L.construct;z||(z=function(b,S,D){return b.apply(S,D)}),A||(A=function(b){return b}),f||(f=function(b){return b}),x||(x=function(b,S){return a(b,s(S))});var W=j(Array.prototype.forEach),E=j(Array.prototype.pop),I=j(Array.prototype.push),Y=j(String.prototype.toLowerCase),J=j(String.prototype.toString),Q=j(String.prototype.match),B=j(String.prototype.replace),ue=j(String.prototype.indexOf),Te=j(String.prototype.trim),O=j(RegExp.prototype.test),U=ge(TypeError);function j(v){return function(b){for(var S=arguments.length,D=new Array(S>1?S-1:0),$=1;$<S;$++)D[$-1]=arguments[$];return z(v,b,D)}}function ge(v){return function(){for(var b=arguments.length,S=new Array(b),D=0;D<b;D++)S[D]=arguments[D];return x(v,S)}}function w(v,b,S){var D;S=(D=S)!==null&&D!==void 0?D:Y,h&&h(v,null);for(var $=b.length;$--;){var ve=b[$];if(typeof ve=="string"){var me=S(ve);me!==ve&&(_(b)||(b[$]=me),ve=me)}v[ve]=!0}return v}function G(v){var b=P(null),S;for(S in v)z(d,v,[S])===!0&&(b[S]=v[S]);return b}function R(v,b){for(;v!==null;){var S=C(v,b);if(S){if(S.get)return j(S.get);if(typeof S.value=="function")return j(S.value)}v=N(v)}function D($){return console.warn("fallback value for",$),null}return D}var ae=A(["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"]),we=A(["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"]),Ne=A(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ie=A(["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"]),ye=A(["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"]),Ee=A(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ae=A(["#text"]),he=A(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),_e=A(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ce=A(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),K=A(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),se=f(/\{\{[\w\W]*|[\w\W]*\}\}/gm),De=f(/<%[\w\W]*|[\w\W]*%>/gm),xe=f(/\${[\w\W]*}/gm),fe=f(/^data-[\-\w.\u00B7-\uFFFF]/),Re=f(/^aria-[\-\w]+$/),M=f(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Be=f(/^(?:\w+script|data):/i),He=f(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ot=f(/^html$/i),bt=f(/^[a-z][.\w]*(-[.\w]+)+$/i),yt=function(){return typeof window=="undefined"?null:window},Ut=function(b,S){if(i(b)!=="object"||typeof b.createPolicy!="function")return null;var D=null,$="data-tt-policy-suffix";S.currentScript&&S.currentScript.hasAttribute($)&&(D=S.currentScript.getAttribute($));var ve="dompurify"+(D?"#"+D:"");try{return b.createPolicy(ve,{createHTML:function(Fe){return Fe},createScriptURL:function(Fe){return Fe}})}catch(me){return console.warn("TrustedTypes policy "+ve+" could not be created."),null}};function ce(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:yt(),b=function(l){return ce(l)};if(b.version="2.5.6",b.removed=[],!v||!v.document||v.document.nodeType!==9)return b.isSupported=!1,b;var S=v.document,D=v.document,$=v.DocumentFragment,ve=v.HTMLTemplateElement,me=v.Node,Fe=v.Element,Xe=v.NodeFilter,xt=v.NamedNodeMap,Ln=xt===void 0?v.NamedNodeMap||v.MozNamedAttrMap:xt,In=v.HTMLFormElement,Fn=v.DOMParser,Vt=v.trustedTypes,Bt=Fe.prototype,Mn=R(Bt,"cloneNode"),On=R(Bt,"nextSibling"),Un=R(Bt,"childNodes"),pi=R(Bt,"parentNode");if(typeof ve=="function"){var ci=D.createElement("template");ci.content&&ci.content.ownerDocument&&(D=ci.content.ownerDocument)}var Pe=Ut(Vt,S),mi=Pe?Pe.createHTML(""):"",Ht=D,di=Ht.implementation,Vn=Ht.createNodeIterator,Bn=Ht.createDocumentFragment,Hn=Ht.getElementsByTagName,zn=S.importNode,sa={};try{sa=G(D).documentMode?D.documentMode:{}}catch(T){}var Me={};b.isSupported=typeof pi=="function"&&di&&di.createHTMLDocument!==void 0&&sa!==9;var ui=se,gi=De,hi=xe,jn=fe,$n=Re,qn=Be,oa=He,Wn=bt,fi=M,ee=null,la=w({},[].concat(s(ae),s(we),s(Ne),s(ye),s(Ae))),te=null,pa=w({},[].concat(s(he),s(_e),s(Ce),s(K))),X=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}})),Tt=null,vi=null,ca=!0,bi=!0,ma=!1,da=!0,it=!1,yi=!0,Ke=!1,xi=!1,Ti=!1,at=!1,zt=!1,jt=!1,ua=!0,ga=!1,Gn="user-content-",wi=!0,wt=!1,nt={},rt=null,ha=w({},["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"]),fa=null,va=w({},["audio","video","img","source","image","track"]),Ni=null,ba=w({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$t="http://www.w3.org/1998/Math/MathML",qt="http://www.w3.org/2000/svg",ze="http://www.w3.org/1999/xhtml",st=ze,Ei=!1,Ai=null,Yn=w({},[$t,qt,ze],J),Je,Xn=["application/xhtml+xml","text/html"],Kn="text/html",ie,ot=null,Jn=D.createElement("form"),ya=function(l){return l instanceof RegExp||l instanceof Function},Si=function(l){ot&&ot===l||((!l||i(l)!=="object")&&(l={}),l=G(l),Je=Xn.indexOf(l.PARSER_MEDIA_TYPE)===-1?Je=Kn:Je=l.PARSER_MEDIA_TYPE,ie=Je==="application/xhtml+xml"?J:Y,ee="ALLOWED_TAGS"in l?w({},l.ALLOWED_TAGS,ie):la,te="ALLOWED_ATTR"in l?w({},l.ALLOWED_ATTR,ie):pa,Ai="ALLOWED_NAMESPACES"in l?w({},l.ALLOWED_NAMESPACES,J):Yn,Ni="ADD_URI_SAFE_ATTR"in l?w(G(ba),l.ADD_URI_SAFE_ATTR,ie):ba,fa="ADD_DATA_URI_TAGS"in l?w(G(va),l.ADD_DATA_URI_TAGS,ie):va,rt="FORBID_CONTENTS"in l?w({},l.FORBID_CONTENTS,ie):ha,Tt="FORBID_TAGS"in l?w({},l.FORBID_TAGS,ie):{},vi="FORBID_ATTR"in l?w({},l.FORBID_ATTR,ie):{},nt="USE_PROFILES"in l?l.USE_PROFILES:!1,ca=l.ALLOW_ARIA_ATTR!==!1,bi=l.ALLOW_DATA_ATTR!==!1,ma=l.ALLOW_UNKNOWN_PROTOCOLS||!1,da=l.ALLOW_SELF_CLOSE_IN_ATTR!==!1,it=l.SAFE_FOR_TEMPLATES||!1,yi=l.SAFE_FOR_XML!==!1,Ke=l.WHOLE_DOCUMENT||!1,at=l.RETURN_DOM||!1,zt=l.RETURN_DOM_FRAGMENT||!1,jt=l.RETURN_TRUSTED_TYPE||!1,Ti=l.FORCE_BODY||!1,ua=l.SANITIZE_DOM!==!1,ga=l.SANITIZE_NAMED_PROPS||!1,wi=l.KEEP_CONTENT!==!1,wt=l.IN_PLACE||!1,fi=l.ALLOWED_URI_REGEXP||fi,st=l.NAMESPACE||ze,X=l.CUSTOM_ELEMENT_HANDLING||{},l.CUSTOM_ELEMENT_HANDLING&&ya(l.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(X.tagNameCheck=l.CUSTOM_ELEMENT_HANDLING.tagNameCheck),l.CUSTOM_ELEMENT_HANDLING&&ya(l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(X.attributeNameCheck=l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),l.CUSTOM_ELEMENT_HANDLING&&typeof l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(X.allowCustomizedBuiltInElements=l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),it&&(bi=!1),zt&&(at=!0),nt&&(ee=w({},s(Ae)),te=[],nt.html===!0&&(w(ee,ae),w(te,he)),nt.svg===!0&&(w(ee,we),w(te,_e),w(te,K)),nt.svgFilters===!0&&(w(ee,Ne),w(te,_e),w(te,K)),nt.mathMl===!0&&(w(ee,ye),w(te,Ce),w(te,K))),l.ADD_TAGS&&(ee===la&&(ee=G(ee)),w(ee,l.ADD_TAGS,ie)),l.ADD_ATTR&&(te===pa&&(te=G(te)),w(te,l.ADD_ATTR,ie)),l.ADD_URI_SAFE_ATTR&&w(Ni,l.ADD_URI_SAFE_ATTR,ie),l.FORBID_CONTENTS&&(rt===ha&&(rt=G(rt)),w(rt,l.FORBID_CONTENTS,ie)),wi&&(ee["#text"]=!0),Ke&&w(ee,["html","head","body"]),ee.table&&(w(ee,["tbody"]),delete Tt.tbody),A&&A(l),ot=l)},xa=w({},["mi","mo","mn","ms","mtext"]),Ta=w({},["foreignobject","annotation-xml"]),Zn=w({},["title","style","font","a","script"]),Wt=w({},we);w(Wt,Ne),w(Wt,Ie);var ki=w({},ye);w(ki,Ee);var Qn=function(l){var u=pi(l);(!u||!u.tagName)&&(u={namespaceURI:st,tagName:"template"});var y=Y(l.tagName),F=Y(u.tagName);return Ai[l.namespaceURI]?l.namespaceURI===qt?u.namespaceURI===ze?y==="svg":u.namespaceURI===$t?y==="svg"&&(F==="annotation-xml"||xa[F]):!!Wt[y]:l.namespaceURI===$t?u.namespaceURI===ze?y==="math":u.namespaceURI===qt?y==="math"&&Ta[F]:!!ki[y]:l.namespaceURI===ze?u.namespaceURI===qt&&!Ta[F]||u.namespaceURI===$t&&!xa[F]?!1:!ki[y]&&(Zn[y]||!Wt[y]):!!(Je==="application/xhtml+xml"&&Ai[l.namespaceURI]):!1},Se=function(l){I(b.removed,{element:l});try{l.parentNode.removeChild(l)}catch(u){try{l.outerHTML=mi}catch(y){l.remove()}}},Gt=function(l,u){try{I(b.removed,{attribute:u.getAttributeNode(l),from:u})}catch(y){I(b.removed,{attribute:null,from:u})}if(u.removeAttribute(l),l==="is"&&!te[l])if(at||zt)try{Se(u)}catch(y){}else try{u.setAttribute(l,"")}catch(y){}},wa=function(l){var u,y;if(Ti)l="<remove></remove>"+l;else{var F=Q(l,/^[\r\n\t ]+/);y=F&&F[0]}Je==="application/xhtml+xml"&&st===ze&&(l='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+l+"</body></html>");var be=Pe?Pe.createHTML(l):l;if(st===ze)try{u=new Fn().parseFromString(be,Je)}catch(ne){}if(!u||!u.documentElement){u=di.createDocument(st,"template",null);try{u.documentElement.innerHTML=Ei?mi:be}catch(ne){}}var le=u.body||u.documentElement;return l&&y&&le.insertBefore(D.createTextNode(y),le.childNodes[0]||null),st===ze?Hn.call(u,Ke?"html":"body")[0]:Ke?u.documentElement:le},Na=function(l){return Vn.call(l.ownerDocument||l,l,Xe.SHOW_ELEMENT|Xe.SHOW_COMMENT|Xe.SHOW_TEXT|Xe.SHOW_PROCESSING_INSTRUCTION|Xe.SHOW_CDATA_SECTION,null,!1)},Ea=function(l){return l instanceof In&&(typeof l.nodeName!="string"||typeof l.textContent!="string"||typeof l.removeChild!="function"||!(l.attributes instanceof Ln)||typeof l.removeAttribute!="function"||typeof l.setAttribute!="function"||typeof l.namespaceURI!="string"||typeof l.insertBefore!="function"||typeof l.hasChildNodes!="function")},Nt=function(l){return i(me)==="object"?l instanceof me:l&&i(l)==="object"&&typeof l.nodeType=="number"&&typeof l.nodeName=="string"},je=function(l,u,y){Me[l]&&W(Me[l],function(F){F.call(b,u,y,ot)})},Aa=function(l){var u;if(je("beforeSanitizeElements",l,null),Ea(l)||O(/[\u0080-\uFFFF]/,l.nodeName))return Se(l),!0;var y=ie(l.nodeName);if(je("uponSanitizeElement",l,{tagName:y,allowedTags:ee}),l.hasChildNodes()&&!Nt(l.firstElementChild)&&(!Nt(l.content)||!Nt(l.content.firstElementChild))&&O(/<[/\w]/g,l.innerHTML)&&O(/<[/\w]/g,l.textContent)||y==="select"&&O(/<template/i,l.innerHTML)||l.nodeType===7||yi&&l.nodeType===8&&O(/<[/\w]/g,l.data))return Se(l),!0;if(!ee[y]||Tt[y]){if(!Tt[y]&&ka(y)&&(X.tagNameCheck instanceof RegExp&&O(X.tagNameCheck,y)||X.tagNameCheck instanceof Function&&X.tagNameCheck(y)))return!1;if(wi&&!rt[y]){var F=pi(l)||l.parentNode,be=Un(l)||l.childNodes;if(be&&F)for(var le=be.length,ne=le-1;ne>=0;--ne){var Ze=Mn(be[ne],!0);Ze.__removalCount=(l.__removalCount||0)+1,F.insertBefore(Ze,On(l))}}return Se(l),!0}return l instanceof Fe&&!Qn(l)||(y==="noscript"||y==="noembed"||y==="noframes")&&O(/<\/no(script|embed|frames)/i,l.innerHTML)?(Se(l),!0):(it&&l.nodeType===3&&(u=l.textContent,u=B(u,ui," "),u=B(u,gi," "),u=B(u,hi," "),l.textContent!==u&&(I(b.removed,{element:l.cloneNode()}),l.textContent=u)),je("afterSanitizeElements",l,null),!1)},Sa=function(l,u,y){if(ua&&(u==="id"||u==="name")&&(y in D||y in Jn))return!1;if(!(bi&&!vi[u]&&O(jn,u))){if(!(ca&&O($n,u))){if(!te[u]||vi[u]){if(!(ka(l)&&(X.tagNameCheck instanceof RegExp&&O(X.tagNameCheck,l)||X.tagNameCheck instanceof Function&&X.tagNameCheck(l))&&(X.attributeNameCheck instanceof RegExp&&O(X.attributeNameCheck,u)||X.attributeNameCheck instanceof Function&&X.attributeNameCheck(u))||u==="is"&&X.allowCustomizedBuiltInElements&&(X.tagNameCheck instanceof RegExp&&O(X.tagNameCheck,y)||X.tagNameCheck instanceof Function&&X.tagNameCheck(y))))return!1}else if(!Ni[u]){if(!O(fi,B(y,oa,""))){if(!((u==="src"||u==="xlink:href"||u==="href")&&l!=="script"&&ue(y,"data:")===0&&fa[l])){if(!(ma&&!O(qn,B(y,oa,"")))){if(y)return!1}}}}}}return!0},ka=function(l){return l!=="annotation-xml"&&Q(l,Wn)},_a=function(l){var u,y,F,be;je("beforeSanitizeAttributes",l,null);var le=l.attributes;if(le){var ne={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:te};for(be=le.length;be--;){u=le[be];var Ze=u,Z=Ze.name,_i=Ze.namespaceURI;if(y=Z==="value"?u.value:Te(u.value),F=ie(Z),ne.attrName=F,ne.attrValue=y,ne.keepAttr=!0,ne.forceKeepAttr=void 0,je("uponSanitizeAttribute",l,ne),y=ne.attrValue,yi&&O(/((--!?|])>)|<\/(style|title)/i,y)){Gt(Z,l);continue}if(!ne.forceKeepAttr&&(Gt(Z,l),!!ne.keepAttr)){if(!da&&O(/\/>/i,y)){Gt(Z,l);continue}it&&(y=B(y,ui," "),y=B(y,gi," "),y=B(y,hi," "));var Ca=ie(l.nodeName);if(Sa(Ca,F,y)){if(ga&&(F==="id"||F==="name")&&(Gt(Z,l),y=Gn+y),Pe&&i(Vt)==="object"&&typeof Vt.getAttributeType=="function"&&!_i)switch(Vt.getAttributeType(Ca,F)){case"TrustedHTML":{y=Pe.createHTML(y);break}case"TrustedScriptURL":{y=Pe.createScriptURL(y);break}}try{_i?l.setAttributeNS(_i,Z,y):l.setAttribute(Z,y),Ea(l)?Se(l):E(b.removed)}catch(ms){}}}}je("afterSanitizeAttributes",l,null)}},er=function T(l){var u,y=Na(l);for(je("beforeSanitizeShadowDOM",l,null);u=y.nextNode();)je("uponSanitizeShadowNode",u,null),!Aa(u)&&(u.content instanceof $&&T(u.content),_a(u));je("afterSanitizeShadowDOM",l,null)};return b.sanitize=function(T){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u,y,F,be,le;if(Ei=!T,Ei&&(T="<!-->"),typeof T!="string"&&!Nt(T))if(typeof T.toString=="function"){if(T=T.toString(),typeof T!="string")throw U("dirty is not a string, aborting")}else throw U("toString is not a function");if(!b.isSupported){if(i(v.toStaticHTML)==="object"||typeof v.toStaticHTML=="function"){if(typeof T=="string")return v.toStaticHTML(T);if(Nt(T))return v.toStaticHTML(T.outerHTML)}return T}if(xi||Si(l),b.removed=[],typeof T=="string"&&(wt=!1),wt){if(T.nodeName){var ne=ie(T.nodeName);if(!ee[ne]||Tt[ne])throw U("root node is forbidden and cannot be sanitized in-place")}}else if(T instanceof me)u=wa("<!---->"),y=u.ownerDocument.importNode(T,!0),y.nodeType===1&&y.nodeName==="BODY"||y.nodeName==="HTML"?u=y:u.appendChild(y);else{if(!at&&!it&&!Ke&&T.indexOf("<")===-1)return Pe&&jt?Pe.createHTML(T):T;if(u=wa(T),!u)return at?null:jt?mi:""}u&&Ti&&Se(u.firstChild);for(var Ze=Na(wt?T:u);F=Ze.nextNode();)F.nodeType===3&&F===be||Aa(F)||(F.content instanceof $&&er(F.content),_a(F),be=F);if(be=null,wt)return T;if(at){if(zt)for(le=Bn.call(u.ownerDocument);u.firstChild;)le.appendChild(u.firstChild);else le=u;return(te.shadowroot||te.shadowrootmod)&&(le=zn.call(S,le,!0)),le}var Z=Ke?u.outerHTML:u.innerHTML;return Ke&&ee["!doctype"]&&u.ownerDocument&&u.ownerDocument.doctype&&u.ownerDocument.doctype.name&&O(Ot,u.ownerDocument.doctype.name)&&(Z="<!DOCTYPE "+u.ownerDocument.doctype.name+`>
`+Z),it&&(Z=B(Z,ui," "),Z=B(Z,gi," "),Z=B(Z,hi," ")),Pe&&jt?Pe.createHTML(Z):Z},b.setConfig=function(T){Si(T),xi=!0},b.clearConfig=function(){ot=null,xi=!1},b.isValidAttribute=function(T,l,u){ot||Si({});var y=ie(T),F=ie(l);return Sa(y,F,u)},b.addHook=function(T,l){typeof l=="function"&&(Me[T]=Me[T]||[],I(Me[T],l))},b.removeHook=function(T){if(Me[T])return E(Me[T])},b.removeHooks=function(T){Me[T]&&(Me[T]=[])},b.removeAllHooks=function(){Me={}},b}var oe=ce();return oe})});var Yi=lt((So,fn)=>{fn.exports=window.DOMPurify||(window.DOMPurify=Gi().default||Gi())});var xn=lt((Go,Zi)=>{function yn(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 s=Array.from(a.attributes||[],function(n){return`${n.name}="${n.value}"`}).join(" ");return`<${a.localName} ${s}>`};this.log=function(){if(typeof console!="undefined"){let s=Array.from(arguments,n=>n&&n.nodeType==this.ELEMENT_NODE?e(n):n);s.unshift("Reader: (Readability)"),console.log.apply(console,s)}else if(typeof dump!="undefined"){var a=Array.prototype.map.call(arguments,function(s){return s&&s.nodeName?e(s):s}).join(" ");dump("Reader: (Readability) "+a+`
`)}}}else this.log=function(){}}yn.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],s=a.parentNode;s&&(!t||t.call(this,a,e,i))&&s.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){var t=this._classesToPreserve,e=(i.getAttribute("class")||"").split(/\s+/).filter(function(a){return t.indexOf(a)!=-1}).join(" ");for(e?i.setAttribute("class",e):i.removeAttribute("class"),i=i.firstElementChild;i;i=i.nextElementSibling)this._cleanClasses(i)},_fixRelativeUris:function(i){var t=this._doc.baseURI,e=this._doc.documentURI;function a(r){if(t==e&&r.charAt(0)=="#")return r;try{return new URL(r,t).href}catch(o){}return r}var s=this._getAllNodesWithTag(i,["a"]);this._forEachNode(s,function(r){var o=r.getAttribute("href");if(o)if(o.indexOf("javascript:")===0)if(r.childNodes.length===1&&r.childNodes[0].nodeType===this.TEXT_NODE){var p=this._doc.createTextNode(r.textContent);r.parentNode.replaceChild(p,r)}else{for(var c=this._doc.createElement("span");r.firstChild;)c.appendChild(r.firstChild);r.parentNode.replaceChild(c,r)}else r.setAttribute("href",a(o))});var n=this._getAllNodesWithTag(i,["img","picture","figure","video","audio","source"]);this._forEachNode(n,function(r){var o=r.getAttribute("src"),p=r.getAttribute("poster"),c=r.getAttribute("srcset");if(o&&r.setAttribute("src",a(o)),p&&r.setAttribute("poster",a(p)),c){var d=c.replace(this.REGEXPS.srcsetUrl,function(h,_,N,C){return a(_)+(N||"")+C});r.setAttribute("srcset",d)}})},_simplifyNestedElements:function(i){for(var t=i;t;){if(t.parentNode&&["DIV","SECTION"].includes(t.tagName)&&!(t.id&&t.id.startsWith("readability"))){if(this._isElementWithoutContent(t)){t=this._removeAndGetNext(t);continue}else if(this._hasSingleTagInsideElement(t,"DIV")||this._hasSingleTagInsideElement(t,"SECTION")){for(var e=t.children[0],a=0;a<t.attributes.length;a++)e.setAttribute(t.attributes[a].name,t.attributes[a].value);t.parentNode.replaceChild(e,t),t=e;continue}}t=this._getNextNode(t)}},_getArticleTitle:function(){var i=this._doc,t="",e="";try{t=e=i.title.trim(),typeof t!="string"&&(t=e=this._getInnerText(i.getElementsByTagName("title")[0]))}catch(d){}var a=!1;function s(d){return d.split(/\s+/).length}if(/ [\|\-\\\/>»] /.test(t))a=/ [\\\/>»] /.test(t),t=e.replace(/(.*)[\|\-\\\/>»] .*/gi,"$1"),s(t)<3&&(t=e.replace(/[^\|\-\\\/>»]*[\|\-\\\/>»](.*)/gi,"$1"));else if(t.indexOf(": ")!==-1){var n=this._concatNodeLists(i.getElementsByTagName("h1"),i.getElementsByTagName("h2")),r=t.trim(),o=this._someNode(n,function(d){return d.textContent.trim()===r});o||(t=e.substring(e.lastIndexOf(":")+1),s(t)<3?t=e.substring(e.indexOf(":")+1):s(e.substr(0,e.indexOf(":")))>5&&(t=e))}else if(t.length>150||t.length<15){var p=i.getElementsByTagName("h1");p.length===1&&(t=this._getInnerText(p[0]))}t=t.trim().replace(this.REGEXPS.normalize," ");var c=s(t);return c<=4&&(!a||c!=s(e.replace(/[\|\-\\\/>»]+/g,""))-1)&&(t=e),t},_prepDocument:function(){var i=this._doc;this._removeNodes(this._getAllNodesWithTag(i,["style"])),i.body&&this._replaceBrs(i.body),this._replaceNodeTags(this._getAllNodesWithTag(i,["font"]),"SPAN")},_nextNode:function(i){for(var t=i;t&&t.nodeType!=this.ELEMENT_NODE&&this.REGEXPS.whitespace.test(t.textContent);)t=t.nextSibling;return t},_replaceBrs:function(i){this._forEachNode(this._getAllNodesWithTag(i,["br"]),function(t){for(var e=t.nextSibling,a=!1;(e=this._nextNode(e))&&e.tagName=="BR";){a=!0;var s=e.nextSibling;e.parentNode.removeChild(e),e=s}if(a){var n=this._doc.createElement("p");for(t.parentNode.replaceChild(n,t),e=n.nextSibling;e;){if(e.tagName=="BR"){var r=this._nextNode(e.nextSibling);if(r&&r.tagName=="BR")break}if(!this._isPhrasingContent(e))break;var o=e.nextSibling;n.appendChild(e),e=o}for(;n.lastChild&&this._isWhitespace(n.lastChild);)n.removeChild(n.lastChild);n.parentNode.tagName==="P"&&this._setNodeTag(n.parentNode,"DIV")}})},_setNodeTag:function(i,t){if(this.log("_setNodeTag",i,t),this._docJSDOMParser)return i.localName=t.toLowerCase(),i.tagName=t.toUpperCase(),i;for(var e=i.ownerDocument.createElement(t);i.firstChild;)e.appendChild(i.firstChild);i.parentNode.replaceChild(e,i),i.readability&&(e.readability=i.readability);for(var a=0;a<i.attributes.length;a++)try{e.setAttribute(i.attributes[a].name,i.attributes[a].value)}catch(s){}return e},_prepArticle:function(i){this._cleanStyles(i),this._markDataTables(i),this._fixLazyImages(i),this._cleanConditionally(i,"form"),this._cleanConditionally(i,"fieldset"),this._clean(i,"object"),this._clean(i,"embed"),this._clean(i,"footer"),this._clean(i,"link"),this._clean(i,"aside");var t=this.DEFAULT_CHAR_THRESHOLD;this._forEachNode(i.children,function(e){this._cleanMatchedNodes(e,function(a,s){return this.REGEXPS.shareElements.test(s)&&a.textContent.length<t})}),this._clean(i,"iframe"),this._clean(i,"input"),this._clean(i,"textarea"),this._clean(i,"select"),this._clean(i,"button"),this._cleanHeaders(i),this._cleanConditionally(i,"table"),this._cleanConditionally(i,"ul"),this._cleanConditionally(i,"div"),this._replaceNodeTags(this._getAllNodesWithTag(i,["h1"]),"h2"),this._removeNodes(this._getAllNodesWithTag(i,["p"]),function(e){var a=e.getElementsByTagName("img").length,s=e.getElementsByTagName("embed").length,n=e.getElementsByTagName("object").length,r=e.getElementsByTagName("iframe").length,o=a+s+n+r;return o===0&&!this._getInnerText(e,!1)}),this._forEachNode(this._getAllNodesWithTag(i,["br"]),function(e){var a=this._nextNode(e.nextSibling);a&&a.tagName=="P"&&e.parentNode.removeChild(e)}),this._forEachNode(this._getAllNodesWithTag(i,["table"]),function(e){var a=this._hasSingleTagInsideElement(e,"TBODY")?e.firstElementChild:e;if(this._hasSingleTagInsideElement(a,"TR")){var s=a.firstElementChild;if(this._hasSingleTagInsideElement(s,"TD")){var n=s.firstElementChild;n=this._setNodeTag(n,this._everyNode(n.childNodes,this._isPhrasingContent)?"P":"DIV"),e.parentNode.replaceChild(n,e)}}})},_initializeNode:function(i){switch(i.readability={contentScore:0},i.tagName){case"DIV":i.readability.contentScore+=5;break;case"PRE":case"TD":case"BLOCKQUOTE":i.readability.contentScore+=3;break;case"ADDRESS":case"OL":case"UL":case"DL":case"DD":case"DT":case"LI":case"FORM":i.readability.contentScore-=3;break;case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":case"TH":i.readability.contentScore-=5;break}i.readability.contentScore+=this._getClassWeight(i)},_removeAndGetNext:function(i){var t=this._getNextNode(i,!0);return i.parentNode.removeChild(i),t},_getNextNode:function(i,t){if(!t&&i.firstElementChild)return i.firstElementChild;if(i.nextElementSibling)return i.nextElementSibling;do i=i.parentNode;while(i&&!i.nextElementSibling);return i&&i.nextElementSibling},_textSimilarity:function(i,t){var e=i.toLowerCase().split(this.REGEXPS.tokenize).filter(Boolean),a=t.toLowerCase().split(this.REGEXPS.tokenize).filter(Boolean);if(!e.length||!a.length)return 0;var s=a.filter(r=>!e.includes(r)),n=s.join(" ").length/a.join(" ").length;return 1-n},_checkByline:function(i,t){if(this._articleByline)return!1;if(i.getAttribute!==void 0)var e=i.getAttribute("rel"),a=i.getAttribute("itemprop");return(e==="author"||a&&a.indexOf("author")!==-1||this.REGEXPS.byline.test(t))&&this._isValidByline(i.textContent)?(this._articleByline=i.textContent.trim(),!0):!1},_getNodeAncestors:function(i,t){t=t||0;for(var e=0,a=[];i.parentNode&&(a.push(i.parentNode),!(t&&++e===t));)i=i.parentNode;return a},_grabArticle:function(i){this.log("**** grabArticle ****");var t=this._doc,e=i!==null;if(i=i||this._doc.body,!i)return this.log("No body found in document. Abort."),null;for(var a=i.innerHTML;;){this.log("Starting grabArticle loop");var s=this._flagIsActive(this.FLAG_STRIP_UNLIKELYS),n=[],r=this._doc.documentElement;let Ce=!0;for(;r;){r.tagName==="HTML"&&(this._articleLang=r.getAttribute("lang"));var o=r.className+" "+r.id;if(!this._isProbablyVisible(r)){this.log("Removing hidden node - "+o),r=this._removeAndGetNext(r);continue}if(r.getAttribute("aria-modal")=="true"&&r.getAttribute("role")=="dialog"){r=this._removeAndGetNext(r);continue}if(this._checkByline(r,o)){r=this._removeAndGetNext(r);continue}if(Ce&&this._headerDuplicatesTitle(r)){this.log("Removing header: ",r.textContent.trim(),this._articleTitle.trim()),Ce=!1,r=this._removeAndGetNext(r);continue}if(s){if(this.REGEXPS.unlikelyCandidates.test(o)&&!this.REGEXPS.okMaybeItsACandidate.test(o)&&!this._hasAncestorTag(r,"table")&&!this._hasAncestorTag(r,"code")&&r.tagName!=="BODY"&&r.tagName!=="A"){this.log("Removing unlikely candidate - "+o),r=this._removeAndGetNext(r);continue}if(this.UNLIKELY_ROLES.includes(r.getAttribute("role"))){this.log("Removing content with role "+r.getAttribute("role")+" - "+o),r=this._removeAndGetNext(r);continue}}if((r.tagName==="DIV"||r.tagName==="SECTION"||r.tagName==="HEADER"||r.tagName==="H1"||r.tagName==="H2"||r.tagName==="H3"||r.tagName==="H4"||r.tagName==="H5"||r.tagName==="H6")&&this._isElementWithoutContent(r)){r=this._removeAndGetNext(r);continue}if(this.DEFAULT_TAGS_TO_SCORE.indexOf(r.tagName)!==-1&&n.push(r),r.tagName==="DIV"){for(var p=null,c=r.firstChild;c;){var d=c.nextSibling;if(this._isPhrasingContent(c))p!==null?p.appendChild(c):this._isWhitespace(c)||(p=t.createElement("p"),r.replaceChild(p,c),p.appendChild(c));else if(p!==null){for(;p.lastChild&&this._isWhitespace(p.lastChild);)p.removeChild(p.lastChild);p=null}c=d}if(this._hasSingleTagInsideElement(r,"P")&&this._getLinkDensity(r)<.25){var h=r.children[0];r.parentNode.replaceChild(h,r),r=h,n.push(r)}else this._hasChildBlockElement(r)||(r=this._setNodeTag(r,"P"),n.push(r))}r=this._getNextNode(r)}var _=[];this._forEachNode(n,function(K){if(!(!K.parentNode||typeof K.parentNode.tagName=="undefined")){var se=this._getInnerText(K);if(!(se.length<25)){var De=this._getNodeAncestors(K,5);if(De.length!==0){var xe=0;xe+=1,xe+=se.split(this.REGEXPS.commas).length,xe+=Math.min(Math.floor(se.length/100),3),this._forEachNode(De,function(fe,Re){if(!(!fe.tagName||!fe.parentNode||typeof fe.parentNode.tagName=="undefined")){if(typeof fe.readability=="undefined"&&(this._initializeNode(fe),_.push(fe)),Re===0)var M=1;else Re===1?M=2:M=Re*3;fe.readability.contentScore+=xe/M}})}}}});for(var N=[],C=0,A=_.length;C<A;C+=1){var f=_[C],P=f.readability.contentScore*(1-this._getLinkDensity(f));f.readability.contentScore=P,this.log("Candidate:",f,"with score "+P);for(var L=0;L<this._nbTopCandidates;L++){var z=N[L];if(!z||P>z.readability.contentScore){N.splice(L,0,f),N.length>this._nbTopCandidates&&N.pop();break}}}var x=N[0]||null,W=!1,E;if(x===null||x.tagName==="BODY"){for(x=t.createElement("DIV"),W=!0;i.firstChild;)this.log("Moving child out:",i.firstChild),x.appendChild(i.firstChild);i.appendChild(x),this._initializeNode(x)}else if(x){for(var I=[],Y=1;Y<N.length;Y++)N[Y].readability.contentScore/x.readability.contentScore>=.75&&I.push(this._getNodeAncestors(N[Y]));var J=3;if(I.length>=J)for(E=x.parentNode;E.tagName!=="BODY";){for(var Q=0,B=0;B<I.length&&Q<J;B++)Q+=Number(I[B].includes(E));if(Q>=J){x=E;break}E=E.parentNode}x.readability||this._initializeNode(x),E=x.parentNode;for(var ue=x.readability.contentScore,Te=ue/3;E.tagName!=="BODY";){if(!E.readability){E=E.parentNode;continue}var O=E.readability.contentScore;if(O<Te)break;if(O>ue){x=E;break}ue=E.readability.contentScore,E=E.parentNode}for(E=x.parentNode;E.tagName!="BODY"&&E.children.length==1;)x=E,E=x.parentNode;x.readability||this._initializeNode(x)}var U=t.createElement("DIV");e&&(U.id="readability-content");var j=Math.max(10,x.readability.contentScore*.2);E=x.parentNode;for(var ge=E.children,w=0,G=ge.length;w<G;w++){var R=ge[w],ae=!1;if(this.log("Looking at sibling node:",R,R.readability?"with score "+R.readability.contentScore:""),this.log("Sibling has score",R.readability?R.readability.contentScore:"Unknown"),R===x)ae=!0;else{var we=0;if(R.className===x.className&&x.className!==""&&(we+=x.readability.contentScore*.2),R.readability&&R.readability.contentScore+we>=j)ae=!0;else if(R.nodeName==="P"){var Ne=this._getLinkDensity(R),Ie=this._getInnerText(R),ye=Ie.length;(ye>80&&Ne<.25||ye<80&&ye>0&&Ne===0&&Ie.search(/\.( |$)/)!==-1)&&(ae=!0)}}ae&&(this.log("Appending node:",R),this.ALTER_TO_DIV_EXCEPTIONS.indexOf(R.nodeName)===-1&&(this.log("Altering sibling:",R,"to div."),R=this._setNodeTag(R,"DIV")),U.appendChild(R),ge=E.children,w-=1,G-=1)}if(this._debug&&this.log("Article content pre-prep: "+U.innerHTML),this._prepArticle(U),this._debug&&this.log("Article content post-prep: "+U.innerHTML),W)x.id="readability-page-1",x.className="page";else{var Ee=t.createElement("DIV");for(Ee.id="readability-page-1",Ee.className="page";U.firstChild;)Ee.appendChild(U.firstChild);U.appendChild(Ee)}this._debug&&this.log("Article content after paging: "+U.innerHTML);var Ae=!0,he=this._getInnerText(U,!0).length;if(he<this._charThreshold)if(Ae=!1,i.innerHTML=a,this._flagIsActive(this.FLAG_STRIP_UNLIKELYS))this._removeFlag(this.FLAG_STRIP_UNLIKELYS),this._attempts.push({articleContent:U,textLength:he});else if(this._flagIsActive(this.FLAG_WEIGHT_CLASSES))this._removeFlag(this.FLAG_WEIGHT_CLASSES),this._attempts.push({articleContent:U,textLength:he});else if(this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY))this._removeFlag(this.FLAG_CLEAN_CONDITIONALLY),this._attempts.push({articleContent:U,textLength:he});else{if(this._attempts.push({articleContent:U,textLength:he}),this._attempts.sort(function(K,se){return se.textLength-K.textLength}),!this._attempts[0].textLength)return null;U=this._attempts[0].articleContent,Ae=!0}if(Ae){var _e=[E,x].concat(this._getNodeAncestors(E));return this._someNode(_e,function(K){if(!K.tagName)return!1;var se=K.getAttribute("dir");return se?(this._articleDir=se,!0):!1}),U}}},_isValidByline:function(i){return typeof i=="string"||i instanceof String?(i=i.trim(),i.length>0&&i.length<100):!1},_unescapeHtmlEntities:function(i){if(!i)return i;var t=this.HTML_ESCAPE_MAP;return i.replace(/&(quot|amp|apos|lt|gt);/g,function(e,a){return t[a]}).replace(/&#(?:x([0-9a-z]{1,4})|([0-9]{1,4}));/gi,function(e,a,s){var n=parseInt(a||s,a?16:10);return String.fromCharCode(n)})},_getJSONLD:function(i){var t=this._getAllNodesWithTag(i,["script"]),e;return this._forEachNode(t,function(a){if(!e&&a.getAttribute("type")==="application/ld+json")try{var s=a.textContent.replace(/^\s*<!\[CDATA\[|\]\]>\s*$/g,""),n=JSON.parse(s);if(!n["@context"]||!n["@context"].match(/^https?\:\/\/schema\.org$/)||(!n["@type"]&&Array.isArray(n["@graph"])&&(n=n["@graph"].find(function(c){return(c["@type"]||"").match(this.REGEXPS.jsonLdArticleTypes)})),!n||!n["@type"]||!n["@type"].match(this.REGEXPS.jsonLdArticleTypes)))return;if(e={},typeof n.name=="string"&&typeof n.headline=="string"&&n.name!==n.headline){var r=this._getArticleTitle(),o=this._textSimilarity(n.name,r)>.75,p=this._textSimilarity(n.headline,r)>.75;p&&!o?e.title=n.headline:e.title=n.name}else typeof n.name=="string"?e.title=n.name.trim():typeof n.headline=="string"&&(e.title=n.headline.trim());n.author&&(typeof n.author.name=="string"?e.byline=n.author.name.trim():Array.isArray(n.author)&&n.author[0]&&typeof n.author[0].name=="string"&&(e.byline=n.author.filter(function(c){return c&&typeof c.name=="string"}).map(function(c){return c.name.trim()}).join(", "))),typeof n.description=="string"&&(e.excerpt=n.description.trim()),n.publisher&&typeof n.publisher.name=="string"&&(e.siteName=n.publisher.name.trim()),typeof n.datePublished=="string"&&(e.datePublished=n.datePublished.trim());return}catch(c){this.log(c.message)}}),e||{}},_getArticleMetadata:function(i){var t={},e={},a=this._doc.getElementsByTagName("meta"),s=/\s*(article|dc|dcterm|og|twitter)\s*:\s*(author|creator|description|published_time|title|site_name)\s*/gi,n=/^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|site_name)\s*$/i;return this._forEachNode(a,function(r){var o=r.getAttribute("name"),p=r.getAttribute("property"),c=r.getAttribute("content");if(c){var d=null,h=null;p&&(d=p.match(s),d&&(h=d[0].toLowerCase().replace(/\s/g,""),e[h]=c.trim())),!d&&o&&n.test(o)&&(h=o,c&&(h=h.toLowerCase().replace(/\s/g,"").replace(/\./g,":"),e[h]=c.trim()))}}),t.title=i.title||e["dc:title"]||e["dcterm:title"]||e["og:title"]||e["weibo:article:title"]||e["weibo:webpage:title"]||e.title||e["twitter:title"],t.title||(t.title=this._getArticleTitle()),t.byline=i.byline||e["dc:creator"]||e["dcterm:creator"]||e.author,t.excerpt=i.excerpt||e["dc:description"]||e["dcterm:description"]||e["og:description"]||e["weibo:article:description"]||e["weibo:webpage:description"]||e.description||e["twitter:description"],t.siteName=i.siteName||e["og:site_name"],t.publishedTime=i.datePublished||e["article:published_time"]||null,t.title=this._unescapeHtmlEntities(t.title),t.byline=this._unescapeHtmlEntities(t.byline),t.excerpt=this._unescapeHtmlEntities(t.excerpt),t.siteName=this._unescapeHtmlEntities(t.siteName),t.publishedTime=this._unescapeHtmlEntities(t.publishedTime),t},_isSingleImage:function(i){return i.tagName==="IMG"?!0:i.children.length!==1||i.textContent.trim()!==""?!1:this._isSingleImage(i.children[0])},_unwrapNoscriptImages:function(i){var t=Array.from(i.getElementsByTagName("img"));this._forEachNode(t,function(a){for(var s=0;s<a.attributes.length;s++){var n=a.attributes[s];switch(n.name){case"src":case"srcset":case"data-src":case"data-srcset":return}if(/\.(jpg|jpeg|png|webp)/i.test(n.value))return}a.parentNode.removeChild(a)});var e=Array.from(i.getElementsByTagName("noscript"));this._forEachNode(e,function(a){var s=i.createElement("div");if(s.innerHTML=a.innerHTML,!!this._isSingleImage(s)){var n=a.previousElementSibling;if(n&&this._isSingleImage(n)){var r=n;r.tagName!=="IMG"&&(r=n.getElementsByTagName("img")[0]);for(var o=s.getElementsByTagName("img")[0],p=0;p<r.attributes.length;p++){var c=r.attributes[p];if(c.value!==""&&(c.name==="src"||c.name==="srcset"||/\.(jpg|jpeg|png|webp)/i.test(c.value))){if(o.getAttribute(c.name)===c.value)continue;var d=c.name;o.hasAttribute(d)&&(d="data-old-"+d),o.setAttribute(d,c.value)}}a.parentNode.replaceChild(s.firstElementChild,n)}}})},_removeScripts:function(i){this._removeNodes(this._getAllNodesWithTag(i,["script","noscript"]))},_hasSingleTagInsideElement:function(i,t){return i.children.length!=1||i.children[0].tagName!==t?!1:!this._someNode(i.childNodes,function(e){return e.nodeType===this.TEXT_NODE&&this.REGEXPS.hasContent.test(e.textContent)})},_isElementWithoutContent:function(i){return i.nodeType===this.ELEMENT_NODE&&i.textContent.trim().length==0&&(i.children.length==0||i.children.length==i.getElementsByTagName("br").length+i.getElementsByTagName("hr").length)},_hasChildBlockElement:function(i){return this._someNode(i.childNodes,function(t){return this.DIV_TO_P_ELEMS.has(t.tagName)||this._hasChildBlockElement(t)})},_isPhrasingContent:function(i){return i.nodeType===this.TEXT_NODE||this.PHRASING_ELEMS.indexOf(i.tagName)!==-1||(i.tagName==="A"||i.tagName==="DEL"||i.tagName==="INS")&&this._everyNode(i.childNodes,this._isPhrasingContent)},_isWhitespace:function(i){return i.nodeType===this.TEXT_NODE&&i.textContent.trim().length===0||i.nodeType===this.ELEMENT_NODE&&i.tagName==="BR"},_getInnerText:function(i,t){t=typeof t=="undefined"?!0:t;var e=i.textContent.trim();return t?e.replace(this.REGEXPS.normalize," "):e},_getCharCount:function(i,t){return t=t||",",this._getInnerText(i).split(t).length-1},_cleanStyles:function(i){if(!(!i||i.tagName.toLowerCase()==="svg")){for(var t=0;t<this.PRESENTATIONAL_ATTRIBUTES.length;t++)i.removeAttribute(this.PRESENTATIONAL_ATTRIBUTES[t]);this.DEPRECATED_SIZE_ATTRIBUTE_ELEMS.indexOf(i.tagName)!==-1&&(i.removeAttribute("width"),i.removeAttribute("height"));for(var e=i.firstElementChild;e!==null;)this._cleanStyles(e),e=e.nextElementSibling}},_getLinkDensity:function(i){var t=this._getInnerText(i).length;if(t===0)return 0;var e=0;return this._forEachNode(i.getElementsByTagName("a"),function(a){var s=a.getAttribute("href"),n=s&&this.REGEXPS.hashUrl.test(s)?.3:1;e+=this._getInnerText(a).length*n}),e/t},_getClassWeight:function(i){if(!this._flagIsActive(this.FLAG_WEIGHT_CLASSES))return 0;var t=0;return typeof i.className=="string"&&i.className!==""&&(this.REGEXPS.negative.test(i.className)&&(t-=25),this.REGEXPS.positive.test(i.className)&&(t+=25)),typeof i.id=="string"&&i.id!==""&&(this.REGEXPS.negative.test(i.id)&&(t-=25),this.REGEXPS.positive.test(i.id)&&(t+=25)),t},_clean:function(i,t){var e=["object","embed","iframe"].indexOf(t)!==-1;this._removeNodes(this._getAllNodesWithTag(i,[t]),function(a){if(e){for(var s=0;s<a.attributes.length;s++)if(this._allowedVideoRegex.test(a.attributes[s].value))return!1;if(a.tagName==="object"&&this._allowedVideoRegex.test(a.innerHTML))return!1}return!0})},_hasAncestorTag:function(i,t,e,a){e=e||3,t=t.toUpperCase();for(var s=0;i.parentNode;){if(e>0&&s>e)return!1;if(i.parentNode.tagName===t&&(!a||a(i.parentNode)))return!0;i=i.parentNode,s++}return!1},_getRowAndColumnCount:function(i){for(var t=0,e=0,a=i.getElementsByTagName("tr"),s=0;s<a.length;s++){var n=a[s].getAttribute("rowspan")||0;n&&(n=parseInt(n,10)),t+=n||1;for(var r=0,o=a[s].getElementsByTagName("td"),p=0;p<o.length;p++){var c=o[p].getAttribute("colspan")||0;c&&(c=parseInt(c,10)),r+=c||1}e=Math.max(e,r)}return{rows:t,columns:e}},_markDataTables:function(i){for(var t=i.getElementsByTagName("table"),e=0;e<t.length;e++){var a=t[e],s=a.getAttribute("role");if(s=="presentation"){a._readabilityDataTable=!1;continue}var n=a.getAttribute("datatable");if(n=="0"){a._readabilityDataTable=!1;continue}var r=a.getAttribute("summary");if(r){a._readabilityDataTable=!0;continue}var o=a.getElementsByTagName("caption")[0];if(o&&o.childNodes.length>0){a._readabilityDataTable=!0;continue}var p=["col","colgroup","tfoot","thead","th"],c=function(h){return!!a.getElementsByTagName(h)[0]};if(p.some(c)){this.log("Data table because found data-y descendant"),a._readabilityDataTable=!0;continue}if(a.getElementsByTagName("table")[0]){a._readabilityDataTable=!1;continue}var d=this._getRowAndColumnCount(a);if(d.rows>=10||d.columns>4){a._readabilityDataTable=!0;continue}a._readabilityDataTable=d.rows*d.columns>10}},_fixLazyImages:function(i){this._forEachNode(this._getAllNodesWithTag(i,["img","picture","figure"]),function(t){if(t.src&&this.REGEXPS.b64DataUrl.test(t.src)){var e=this.REGEXPS.b64DataUrl.exec(t.src);if(e[1]==="image/svg+xml")return;for(var a=!1,s=0;s<t.attributes.length;s++){var n=t.attributes[s];if(n.name!=="src"&&/\.(jpg|jpeg|png|webp)/i.test(n.value)){a=!0;break}}if(a){var r=t.src.search(/base64\s*/i)+7,o=t.src.length-r;o<133&&t.removeAttribute("src")}}if(!((t.src||t.srcset&&t.srcset!="null")&&t.className.toLowerCase().indexOf("lazy")===-1)){for(var p=0;p<t.attributes.length;p++)if(n=t.attributes[p],!(n.name==="src"||n.name==="srcset"||n.name==="alt")){var c=null;if(/\.(jpg|jpeg|png|webp)\s+\d/.test(n.value)?c="srcset":/^\s*\S+\.(jpg|jpeg|png|webp)\S*\s*$/.test(n.value)&&(c="src"),c){if(t.tagName==="IMG"||t.tagName==="PICTURE")t.setAttribute(c,n.value);else if(t.tagName==="FIGURE"&&!this._getAllNodesWithTag(t,["img","picture"]).length){var d=this._doc.createElement("img");d.setAttribute(c,n.value),t.appendChild(d)}}}}})},_getTextDensity:function(i,t){var e=this._getInnerText(i,!0).length;if(e===0)return 0;var a=0,s=this._getAllNodesWithTag(i,t);return this._forEachNode(s,n=>a+=this._getInnerText(n,!0).length),a/e},_cleanConditionally:function(i,t){this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)&&this._removeNodes(this._getAllNodesWithTag(i,[t]),function(e){var a=function(E){return E._readabilityDataTable},s=t==="ul"||t==="ol";if(!s){var n=0,r=this._getAllNodesWithTag(e,["ul","ol"]);this._forEachNode(r,E=>n+=this._getInnerText(E).length),s=n/this._getInnerText(e).length>.9}if(t==="table"&&a(e)||this._hasAncestorTag(e,"table",-1,a)||this._hasAncestorTag(e,"code"))return!1;var o=this._getClassWeight(e);this.log("Cleaning Conditionally",e);var p=0;if(o+p<0)return!0;if(this._getCharCount(e,",")<10){for(var c=e.getElementsByTagName("p").length,d=e.getElementsByTagName("img").length,h=e.getElementsByTagName("li").length-100,_=e.getElementsByTagName("input").length,N=this._getTextDensity(e,["h1","h2","h3","h4","h5","h6"]),C=0,A=this._getAllNodesWithTag(e,["object","embed","iframe"]),f=0;f<A.length;f++){for(var P=0;P<A[f].attributes.length;P++)if(this._allowedVideoRegex.test(A[f].attributes[P].value))return!1;if(A[f].tagName==="object"&&this._allowedVideoRegex.test(A[f].innerHTML))return!1;C++}var L=this._getLinkDensity(e),z=this._getInnerText(e).length,x=d>1&&c/d<.5&&!this._hasAncestorTag(e,"figure")||!s&&h>c||_>Math.floor(c/3)||!s&&N<.9&&z<25&&(d===0||d>2)&&!this._hasAncestorTag(e,"figure")||!s&&o<25&&L>.2||o>=25&&L>.5||C===1&&z<75||C>1;if(s&&x){for(var W=0;W<e.children.length;W++)if(e.children[W].children.length>1)return x;let E=e.getElementsByTagName("li").length;if(d==E)return!1}return x}return!1})},_cleanMatchedNodes:function(i,t){for(var e=this._getNextNode(i,!0),a=this._getNextNode(i);a&&a!=e;)t.call(this,a,a.className+" "+a.id)?a=this._removeAndGetNext(a):a=this._getNextNode(a)},_cleanHeaders:function(i){let t=this._getAllNodesWithTag(i,["h1","h2"]);this._removeNodes(t,function(e){let a=this._getClassWeight(e)<0;return a&&this.log("Removing header with low class weight:",e),a})},_headerDuplicatesTitle:function(i){if(i.tagName!="H1"&&i.tagName!="H2")return!1;var t=this._getInnerText(i,!1);return this.log("Evaluating similarity of header:",t,this._articleTitle),this._textSimilarity(this._articleTitle,t)>.75},_flagIsActive:function(i){return(this._flags&i)>0},_removeFlag:function(i){this._flags=this._flags&~i},_isProbablyVisible:function(i){return(!i.style||i.style.display!="none")&&(!i.style||i.style.visibility!="hidden")&&!i.hasAttribute("hidden")&&(!i.hasAttribute("aria-hidden")||i.getAttribute("aria-hidden")!="true"||i.className&&i.className.indexOf&&i.className.indexOf("fallback-image")!==-1)},parse:function(){if(this._maxElemsToParse>0){var i=this._doc.getElementsByTagName("*").length;if(i>this._maxElemsToParse)throw new Error("Aborting parsing document; "+i+" elements found")}this._unwrapNoscriptImages(this._doc);var t=this._disableJSONLD?{}:this._getJSONLD(this._doc);this._removeScripts(this._doc),this._prepDocument();var e=this._getArticleMetadata(t);this._articleTitle=e.title;var a=this._grabArticle();if(!a)return null;if(this.log("Grabbed: "+a.innerHTML),this._postProcessContent(a),!e.excerpt){var s=a.getElementsByTagName("p");s.length>0&&(e.excerpt=s[0].textContent.trim())}var n=a.textContent;return{title:this._articleTitle,byline:e.byline||this._articleByline,dir:this._articleDir,lang:this._articleLang,content:this._serializer(a),textContent:n,length:n.length,excerpt:e.excerpt,siteName:e.siteName||this._articleSiteName,publishedTime:e.publishedTime}}};typeof Zi=="object"&&(Zi.exports=yn)});var wn=lt((Yo,Qi)=>{var Tn={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 ns(i){return(!i.style||i.style.display!="none")&&!i.hasAttribute("hidden")&&(!i.hasAttribute("aria-hidden")||i.getAttribute("aria-hidden")!="true"||i.className&&i.className.indexOf&&i.className.indexOf("fallback-image")!==-1)}function rs(i,t={}){typeof t=="function"&&(t={visibilityChecker:t});var e={minScore:20,minContentLength:140,visibilityChecker:ns};t=Object.assign(e,t);var a=i.querySelectorAll("p, pre, article"),s=i.querySelectorAll("div > br");if(s.length){var n=new Set(a);[].forEach.call(s,function(o){n.add(o.parentNode)}),a=Array.from(n)}var r=0;return[].some.call(a,function(o){if(!t.visibilityChecker(o))return!1;var p=o.className+" "+o.id;if(Tn.unlikelyCandidates.test(p)&&!Tn.okMaybeItsACandidate.test(p)||o.matches("li p"))return!1;var c=o.textContent.trim().length;return c<t.minContentLength?!1:(r+=Math.sqrt(c-t.minContentLength),r>t.minScore)})}typeof Qi=="object"&&(Qi.exports=rs)});var En=lt((Xo,Nn)=>{var ss=xn(),os=wn();Nn.exports={Readability:ss,isProbablyReaderable:os}});var cs={};or(cs,{default:()=>li});module.exports=lr(cs);var vt=require("obsidian");function Ra(){return[{label:"New Line",option:"newLine"},{label:"Comma",option:"comma"},{label:"Period",option:"period"},{label:"Semicolon",option:"semicolon"}]}function Pa(i){switch(i){case"newLine":return`
`;case"comma":return",";case"period":return".";case"semicolon":return";"}}function La(){return[{label:"Ask",option:"ask"},{label:"Nothing",option:"nothing"},{label:"Append to the existing note",option:"appendToExisting"}]}var m={inboxDir:"ReadItLater Inbox",assetsDir:"ReadItLater Inbox/assets",openNewNote:!1,batchProcess:!1,batchProcessDelimiter:"newLine",openNewNoteInNewTab:!1,youtubeContentTypeSlug:"youtube",youtubeNoteTitle:"Youtube - {{ title }}",youtubeNote:`[[ReadItLater]] [[Youtube]]
# [{{ videoTitle }}]({{ videoURL }})
{{ videoPlayer }}`,youtubeEmbedWidth:"560",youtubeEmbedHeight:"315",youtubeUsePrivacyEnhancedEmbed:!0,vimeoContentTypeSlug:"vimeo",vimeoNoteTitle:"Vimeo - {{ title }}",vimeoNote:`[[ReadItLater]] [[Vimeo]]
# [{{ videoTitle }}]({{ videoURL }})
{{ videoPlayer }}
{{ videoChapters }}`,vimeoEmbedWidth:"560",vimeoEmbedHeight:"315",bilibiliContentTypeSlug:"bilibili",bilibiliNoteTitle:"Bilibili - {{ title }}",bilibiliNote:`[[ReadItLater]] [[Bilibili]]
# [{{ videoTitle }}]({{ videoURL }})
{{ videoPlayer }}`,bilibiliEmbedWidth:"560",bilibiliEmbedHeight:"315",twitterContentTypeSlug:"xcom",twitterNoteTitle:"Tweet from {{ tweetAuthorName }} ({{ date }})",twitterNote:`[[ReadItLater]] [[Tweet]]
# [{{ tweetAuthorName }}]({{ tweetURL }})
{{ tweetContent }}`,parseableArticleContentType:"article",parseableArticleNoteTitle:"{{ title }}",parsableArticleNote:`[[ReadItLater]] [[Article]]
# [{{ articleTitle }}]({{ articleURL }})
{{ articleContent }}`,notParseableArticleContentType:"article",notParseableArticleNoteTitle:"Article {{ date }}",notParsableArticleNote:`[[ReadItLater]] [[Article]]
[{{ articleURL }}]({{ articleURL }})`,textSnippetContentType:"textsnippet",textSnippetNoteTitle:"Note {{ date }}",textSnippetNote:`[[ReadItLater]] [[Textsnippet]]
{{ content }}`,mastodonContentTypeSlug:"mastodon",mastodonNoteTitle:"Toot from {{ tootAuthorName }} ({{ date }})",mastodonNote:`[[ReadItLater]] [[Toot]]
# [{{ tootAuthorName }}]({{ tootURL }})
> {{ 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 }}`,stackExchangeContentType:"stackexchange",stackExchangeNoteTitle:"{{ title }}",stackExchangeNote:`[[ReadItLater]] [[StackExchange]]
# [{{ questionTitle }}]({{ questionURL }})
Author: [{{ authorName }}]({{ authorProfileURL }})
{{ questionContent }}
***
{{ topAnswer }}
{{ answers }}`,stackExchangeAnswer:`Answered by: [{{ authorName }}]({{ authorProfileURL }})
{{ answerContent }}`,downloadStackExchangeAssets:!0,downloadStackExchangeAssetsInDir:!1,youtubeApiKey:"",tikTokContentTypeSlug:"tiktok",tikTokNoteTitle:"TikTok from {{ authorName }} ({{ date }})",tikTokNote:`[[ReadItLater]] [[TikTok]]
{{ videoDescription }}
[{{ videoURL }}]({{ videoURL }})
{{ videoPlayer }}`,tikTokEmbedWidth:"325",tikTokEmbedHeight:"760",extendShareMenu:!0,filesystemLimitPath:null,filesystemLimitFileName:null,youtubeChannelContentTypeSlug:"youtube-channel",youtubeChannelNoteTitle:"{{ title }}",youtubeChannelNote:`[[ReadItLater]] [[YoutubeChannel]]
# [{{ channelTitle }}]({{ channelURL }})
![{{ channelTitle }}|300]({{ channelAvatar }})
[Videos]({{ channelVideosURL }})
{{ channelSubscribersCount|numberLexify }} subscribers`,fileExistsStrategy:"ask",blueskyContentTypeSlug:"bluesky",blueskyNoteTitle:"Status from {{ authorName }} ({{ date }})",blueskyNote:`[[ReadItLater]] [[Bluesky]]
# [{{ authorName }}]({{ postURL }})
{{ content|blockquote }}`,downloadBlueskyEmbeds:!0,downloadBlueskyEmbedsInDir:!1,saveBlueskyPostReplies:!1,blueskyPostReply:`[{{ authorName }}]({{ postURL }})
{{ content|blockquote }}`,pinterestContentTypeSlug:"pinterest",pinterestNoteTitle:"Pin from {{ authorName }} ({{ date }})",pinterestNote:`[[ReadItLater]] [[Pinterest]]
# [{{ authorName }}]({{ pinURL }})
![]({{ image }})
{{ description }}`,downloadPinterestImage:!0};var g=require("obsidian");var Ba=require("obsidian");var Fa={"application/prs.cww":["cww"],"application/prs.xsf+xml":["xsf"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["*xfdf"],"application/vnd.age":["age"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["*fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["*mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.pwg-xhtml-print+xml":["xhtm"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml","uo"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["*prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["*sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["*aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif","btf"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.cld":["cld"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.pytha.pyox":["pyo","pyox"],"model/vnd.sap.vds":["vds"],"model/vnd.usda":["usda"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.familysearch.gedcom":["ged"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]};Object.freeze(Fa);var Ma=Fa;var Oa={"application/andrew-inset":["ez"],"application/appinstaller":["appinstaller"],"application/applixware":["aw"],"application/appx":["appx"],"application/appxbundle":["appxbundle"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/automationml-aml+xml":["aml"],"application/automationml-amlx+zip":["amlx"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cpl+xml":["cpl"],"application/cu-seeme":["cu"],"application/cwl":["cwl"],"application/dash+xml":["mpd"],"application/dash-patch+xml":["mpp"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdf":["fdf"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["*js"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/media-policy-dataset+xml":["mpf"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["*mp4","*mpg4","mp4s","m4p"],"application/msix":["msix"],"application/msixbundle":["msixbundle"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-keys":["asc"],"application/pgp-signature":["sig","*asc"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/sql":["sql"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/watcherinfo+xml":["wif"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xfdf":["xfdf"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/aac":["adts","aac"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avci":["avci"],"image/avcs":["avcs"],"image/avif":["avif"],"image/bmp":["bmp","dib"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/dpx":["dpx"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm","jpgm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/jt":["jt"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/prc":["prc"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/u3d":["u3d"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/javascript":["js","mjs"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["md","markdown"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/wgsl":["wgsl"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","*jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};Object.freeze(Oa);var Ua=Oa;var ke=function(i,t,e,a){if(e==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?i!==t||!a:!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?a:e==="a"?a.call(i):a?a.value:t.get(i)},pt,At,Qe,Ci=class{constructor(...t){pt.set(this,new Map),At.set(this,new Map),Qe.set(this,new Map);for(let e of t)this.define(e)}define(t,e=!1){for(let[a,s]of Object.entries(t)){a=a.toLowerCase(),s=s.map(o=>o.toLowerCase()),ke(this,Qe,"f").has(a)||ke(this,Qe,"f").set(a,new Set);let n=ke(this,Qe,"f").get(a),r=!0;for(let o of s){let p=o.startsWith("*");if(o=p?o.slice(1):o,n==null||n.add(o),r&&ke(this,At,"f").set(a,o),r=!1,p)continue;let c=ke(this,pt,"f").get(o);if(c&&c!=a&&!e)throw new Error(`"${a} -> ${o}" conflicts with "${c} -> ${o}". Pass \`force=true\` to override this definition.`);ke(this,pt,"f").set(o,a)}}return this}getType(t){var r;if(typeof t!="string")return null;let e=t.replace(/^.*[/\\]/,"").toLowerCase(),a=e.replace(/^.*\./,"").toLowerCase(),s=e.length<t.length;return!(a.length<e.length-1)&&s?null:(r=ke(this,pt,"f").get(a))!=null?r:null}getExtension(t){var e,a;return typeof t!="string"?null:(t=(e=t==null?void 0:t.split)==null?void 0:e.call(t,";")[0],(a=t&&ke(this,At,"f").get(t.trim().toLowerCase()))!=null?a:null)}getAllExtensions(t){var e;return typeof t!="string"?null:(e=ke(this,Qe,"f").get(t.toLowerCase()))!=null?e:null}_freeze(){this.define=()=>{throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances")},Object.freeze(this);for(let t of ke(this,Qe,"f").values())Object.freeze(t);return this}_getTestState(){return{types:ke(this,pt,"f"),extensions:ke(this,At,"f")}}};pt=new WeakMap,At=new WeakMap,Qe=new WeakMap;var Di=Ci;var Va=new Di(Ua,Ma)._freeze();function Oe(i,t=[]){let e;try{e=new URL(i)}catch(a){return!1}return t.length===0?!0:t.includes(e.protocol)}function Ha(i,t){return new URL(i,t).href}function q(i,t=!0){return t?i.replace(/[:#/\\|?*<>"]/g,""):i.replace(/[:#/\\()|?*<>"[\u{1F300}-\u{1F9FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{1F000}-\u{1F02F}\u{1F0A0}-\u{1F0FF}\u{1F100}-\u{1F64F}\u{1F680}-\u{1F6FF}]/gu,"")}function St(i,t,e,a){let s=`.${pr(t)}`,n=t;n.length>a.fileName&&(n=n.substring(0,a.fileName-s.length)+`${s}`);let r=(0,Ba.normalizePath)(`${i}/${n}`),o=e.getFullPath(r);return o.length>a.path&&(r=r.substring(0,r.length-(o.length-a.path)-s.length)+`${s}`),r}function za(i,t){var a,s;let e=Pi(i);return{path:(a=t.filesystemLimitPath)!=null?a:e.path,fileName:(s=t.filesystemLimitFileName)!=null?s:e.fileName}}function Pi(i){return i.isLinux?Ri(4096,255):i.isMacOS||i.isIosApp||i.isAndroidApp||i.isMobile?Ri(1024,255):Ri(256,256)}function pr(i){return i.includes(".")?i.split(".").pop():""}function ja(i){var t;return(t=Va.getExtension(i))!=null?t:""}function Ri(i,t){return{path:i,fileName:t}}function Xt(i){return createFragment(t=>t.createDiv().innerHTML=i)}var Kt=class extends g.PluginSettingTab{constructor(e,a){super(e,a);k(this,"plugin");k(this,"activeDetatils",[]);this.plugin=a}display(){let{containerEl:e}=this;e.empty(),e.createEl("h2",{text:"General"}),new g.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"?m.inboxDir:this.plugin.settings.inboxDir).onChange(async r=>{this.plugin.settings.inboxDir=r,await this.plugin.saveSettings()})),new g.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"?m.inboxDir+"/assets":this.plugin.settings.assetsDir).onChange(async r=>{this.plugin.settings.assetsDir=r,await this.plugin.saveSettings()})),new g.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||m.openNewNote).onChange(async r=>{this.plugin.settings.openNewNote=r,r===!0&&(this.plugin.settings.openNewNoteInNewTab=!1),await this.plugin.saveSettings(),this.display()})),new g.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||m.openNewNoteInNewTab).onChange(async r=>{this.plugin.settings.openNewNoteInNewTab=r,r===!0&&(this.plugin.settings.openNewNote=!1),await this.plugin.saveSettings(),this.display()})),new g.Setting(e).setName("Duplicate note filename behavior").setDesc("Applied when note with the same filename already exists").addDropdown(n=>{La().forEach(r=>n.addOption(r.option,r.label)),n.setValue(this.plugin.settings.fileExistsStrategy||m.fileExistsStrategy),n.onChange(async r=>{this.plugin.settings.fileExistsStrategy=r,await this.plugin.saveSettings()})}),new g.Setting(e).setName("Batch note creation delimiter").setDesc("Delimiter for batch list of notes").addDropdown(n=>{Ra().forEach(r=>n.addOption(r.option,r.label)),n.setValue(this.plugin.settings.batchProcessDelimiter||m.batchProcessDelimiter),n.onChange(async r=>{this.plugin.settings.batchProcessDelimiter=r,await this.plugin.saveSettings()})}),new g.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 ${m.dateTitleFmt}`).setValue(typeof this.plugin.settings.dateTitleFmt=="undefined"?m.dateTitleFmt:this.plugin.settings.dateTitleFmt).onChange(async r=>{this.plugin.settings.dateTitleFmt=r,await this.plugin.saveSettings()})),new g.Setting(e).setName("Date format string in content").setDesc("Format of the %date% variable for content").addText(n=>n.setPlaceholder(`Defaults to ${m.dateContentFmt}`).setValue(typeof this.plugin.settings.dateContentFmt=="undefined"?m.dateContentFmt:this.plugin.settings.dateContentFmt).onChange(async r=>{this.plugin.settings.dateContentFmt=r,await this.plugin.saveSettings()})),new g.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:m.extendShareMenu).onChange(async r=>{this.plugin.settings.extendShareMenu=r,await this.plugin.saveSettings()})),new g.Setting(e).setName("Youtube Data API v3 key").setDesc("If entered, Youtube related content types will use Youtube API to fetc the data.").addText(n=>n.setPlaceholder("").setValue(this.plugin.settings.youtubeApiKey||m.youtubeApiKey).onChange(async r=>{this.plugin.settings.youtubeApiKey=r,await this.plugin.saveSettings()})),e.createEl("h1",{text:"Content Types"}),e.createDiv({text:"Settings for each content. Click on caret to expand."});let a;e.createEl("hr",{cls:"readitlater-setting-hr"}),a=this.createDetailsElement(e,"readableArticle"),a.createEl("summary",{text:"Readable Article",cls:"readitlater-setting-h3"}),new g.Setting(a).setName("Readable content type slug").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.parseableArticleContentType).setValue(typeof this.plugin.settings.parseableArticleContentType=="undefined"?m.parseableArticleContentType:this.plugin.settings.parseableArticleContentType).onChange(async r=>{this.plugin.settings.parseableArticleContentType=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Readable article note template title").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.parseableArticleNoteTitle).setValue(this.plugin.settings.parseableArticleNoteTitle||m.parseableArticleNoteTitle).onChange(async r=>{this.plugin.settings.parseableArticleNoteTitle=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Readable article note template").setDesc(this.createTemplateVariableReferenceDiv()).addTextArea(n=>{n.setValue(this.plugin.settings.parsableArticleNote||m.parsableArticleNote).onChange(async r=>{this.plugin.settings.parsableArticleNote=r,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new g.Setting(a).setName("Download images").setDesc("Images from article will be downloaded to the assets directory (Desktop App feature only). To dynamically change destination directory you can use variables. Check variables reference to learn more.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadImages")?this.plugin.settings.downloadImages:m.downloadImages).onChange(async r=>{this.plugin.settings.downloadImages=r,r===!1&&(this.plugin.settings.downloadImagesInArticleDir=!1),await this.plugin.saveSettings(),this.display()})),new g.Setting(a).setName("Download images to note directory").setDesc("Images from article will be downloaded to the dedicated note assets directory (Desktop App feature only). Overrides assets directory template.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadImagesInArticleDir")?this.plugin.settings.downloadImagesInArticleDir:m.downloadImagesInArticleDir).onChange(async r=>{this.plugin.settings.downloadImagesInArticleDir=r,r===!0&&(this.plugin.settings.downloadImages=!0),await this.plugin.saveSettings(),this.display()})),e.createEl("hr",{cls:"readitlater-setting-hr"}),a=this.createDetailsElement(e,"youtube"),a.createEl("summary",{text:"YouTube",cls:"readitlater-setting-h3"}),new g.Setting(a).setName("Youtube content type slug").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.youtubeContentTypeSlug).setValue(typeof this.plugin.settings.youtubeContentTypeSlug=="undefined"?m.youtubeContentTypeSlug:this.plugin.settings.youtubeContentTypeSlug).onChange(async r=>{this.plugin.settings.youtubeContentTypeSlug=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Youtube note template title").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.youtubeNoteTitle).setValue(this.plugin.settings.youtubeNoteTitle||m.youtubeNoteTitle).onChange(async r=>{this.plugin.settings.youtubeNoteTitle=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Youtube note template").setDesc(this.createTemplateVariableReferenceDiv()).addTextArea(n=>{n.setValue(this.plugin.settings.youtubeNote||m.youtubeNote).onChange(async r=>{this.plugin.settings.youtubeNote=r,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new g.Setting(a).setName("Youtube embed player width").addText(n=>n.setPlaceholder(m.youtubeEmbedWidth).setValue(this.plugin.settings.youtubeEmbedWidth||m.youtubeEmbedWidth).onChange(async r=>{this.plugin.settings.youtubeEmbedWidth=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Youtube embed player height").addText(n=>n.setPlaceholder(m.youtubeEmbedHeight).setValue(this.plugin.settings.youtubeEmbedHeight||m.youtubeEmbedHeight).onChange(async r=>{this.plugin.settings.youtubeEmbedHeight=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Embed in privacy enhanced mode").setDesc("If enabled, content will be embeded in privacy enhanced mode, which prevents the use of views of it from influencing the viewer\u2019s browsing experience on YouTube.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"youtubeUsePrivacyEnhancedEmbed")?this.plugin.settings.youtubeUsePrivacyEnhancedEmbed:m.youtubeUsePrivacyEnhancedEmbed).onChange(async r=>{this.plugin.settings.youtubeUsePrivacyEnhancedEmbed=r,await this.plugin.saveSettings()})),e.createEl("hr",{cls:"readitlater-setting-hr"}),a=this.createDetailsElement(e,"youtubeChannel"),a.createEl("summary",{text:"YouTube channel",cls:"readitlater-setting-h3"}),new g.Setting(a).setName("Youtube channel content type slug").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.youtubeChannelContentTypeSlug).setValue(typeof this.plugin.settings.youtubeChannelContentTypeSlug=="undefined"?m.youtubeChannelContentTypeSlug:this.plugin.settings.youtubeChannelContentTypeSlug).onChange(async r=>{this.plugin.settings.youtubeChannelContentTypeSlug=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Youtube channel note template title").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.youtubeChannelNoteTitle).setValue(this.plugin.settings.youtubeChannelNoteTitle||m.youtubeChannelNoteTitle).onChange(async r=>{this.plugin.settings.youtubeChannelNoteTitle=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Youtube channel note template").setDesc(this.createTemplateVariableReferenceDiv()).addTextArea(n=>{n.setValue(this.plugin.settings.youtubeChannelNote||m.youtubeChannelNote).onChange(async r=>{this.plugin.settings.youtubeChannelNote=r,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),e.createEl("hr",{cls:"readitlater-setting-hr"}),a=this.createDetailsElement(e,"x"),a.createEl("summary",{text:"X.com",cls:"readitlater-setting-h3"}),new g.Setting(a).setName("X.com content type slug").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.twitterContentTypeSlug).setValue(typeof this.plugin.settings.twitterContentTypeSlug=="undefined"?m.twitterContentTypeSlug:this.plugin.settings.twitterContentTypeSlug).onChange(async r=>{this.plugin.settings.twitterContentTypeSlug=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("X.com note template title").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.twitterNoteTitle).setValue(this.plugin.settings.twitterNoteTitle||m.twitterNoteTitle).onChange(async r=>{this.plugin.settings.twitterNoteTitle=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("X.com note template").setDesc(this.createTemplateVariableReferenceDiv()).addTextArea(n=>{n.setValue(this.plugin.settings.twitterNote||m.twitterNote).onChange(async r=>{this.plugin.settings.twitterNote=r,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),e.createEl("hr",{cls:"readitlater-setting-hr"}),a=this.createDetailsElement(e,"bluesky"),a.createEl("summary",{text:"Bluesky",cls:"readitlater-setting-h3"}),new g.Setting(a).setName("Bluesky content type slug").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.blueskyContentTypeSlug).setValue(typeof this.plugin.settings.blueskyContentTypeSlug=="undefined"?m.blueskyContentTypeSlug:this.plugin.settings.blueskyContentTypeSlug).onChange(async r=>{this.plugin.settings.blueskyContentTypeSlug=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Bluesky note template title").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.blueskyNoteTitle).setValue(this.plugin.settings.blueskyNoteTitle||m.blueskyNoteTitle).onChange(async r=>{this.plugin.settings.blueskyNoteTitle=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Bluesky note template").setDesc(this.createTemplateVariableReferenceDiv()).addTextArea(n=>{n.setValue(this.plugin.settings.blueskyNote||m.blueskyNote).onChange(async r=>{this.plugin.settings.blueskyNote=r,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new g.Setting(a).setName("Download embedded content").setDesc("Embedded content will be downloaded to the assets directory (Desktop App feature only). To dynamically change destination directory you can use variables. Check variables reference to learn more.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadBlueskyEmbeds")?this.plugin.settings.downloadBlueskyEmbeds:m.downloadBlueskyEmbeds).onChange(async r=>{this.plugin.settings.downloadBlueskyEmbeds=r,r===!1&&(this.plugin.settings.downloadBlueskyEmbedsInDir=!1),await this.plugin.saveSettings(),this.display()})),new g.Setting(a).setName("Download embedded content to note directory").setDesc("Embedded content will be downloaded to the dedicated note assets directory (Desktop App feature only). Overrides assets directory template.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadBlueskyEmbedsInDir")?this.plugin.settings.downloadBlueskyEmbedsInDir:m.downloadBlueskyEmbedsInDir).onChange(async r=>{this.plugin.settings.downloadBlueskyEmbedsInDir=r,r===!0&&(this.plugin.settings.downloadBlueskyEmbeds=!0),await this.plugin.saveSettings(),this.display()})),new g.Setting(a).setName("Save replies").setDesc("If enabled, post replies will be saved.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"saveBlueskyPostReplies")?this.plugin.settings.saveBlueskyPostReplies:m.saveBlueskyPostReplies).onChange(async r=>{this.plugin.settings.saveBlueskyPostReplies=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Bluesky post reply template").addTextArea(n=>{n.setValue(this.plugin.settings.blueskyPostReply||m.blueskyPostReply).onChange(async r=>{this.plugin.settings.blueskyPostReply=r,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),e.createEl("hr",{cls:"readitlater-setting-hr"}),a=this.createDetailsElement(e,"stackExchange"),a.createEl("summary",{text:"Stack Exchange",cls:"readitlater-setting-h3"}),new g.Setting(a).setName("Stack Exchange content type slug").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.stackExchangeContentType).setValue(typeof this.plugin.settings.stackExchangeContentType=="undefined"?m.stackExchangeContentType:this.plugin.settings.stackExchangeContentType).onChange(async r=>{this.plugin.settings.stackExchangeContentType=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Stack Exchange note title template").addText(n=>n.setPlaceholder(m.stackExchangeNoteTitle).setValue(this.plugin.settings.stackExchangeNoteTitle||m.stackExchangeNoteTitle).onChange(async r=>{this.plugin.settings.stackExchangeNoteTitle=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Stack Exchange question note template").setDesc(this.createTemplateVariableReferenceDiv()).addTextArea(n=>{n.setValue(this.plugin.settings.stackExchangeNote||m.stackExchangeNote).onChange(async r=>{this.plugin.settings.stackExchangeNote=r,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new g.Setting(a).setName("Stack Exchange answer template").setDesc(this.createTemplateVariableReferenceDiv()).addTextArea(n=>{n.setValue(this.plugin.settings.stackExchangeAnswer||m.stackExchangeAnswer).onChange(async r=>{this.plugin.settings.stackExchangeAnswer=r,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new g.Setting(a).setName("Download media attachments").setDesc("Media attachments will be downloaded to the assets directory (Desktop App feature only). To dynamically change destination directory you can use variables. Check variables reference to learn more.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadStackExchangeAssets")?this.plugin.settings.downloadStackExchangeAssets:m.downloadStackExchangeAssets).onChange(async r=>{this.plugin.settings.downloadStackExchangeAssets=r,r===!1&&(this.plugin.settings.downloadStackExchangeAssetsInDir=!1),await this.plugin.saveSettings(),this.display()})),new g.Setting(a).setName("Download media attachments to note directory").setDesc("Media attachments will be downloaded to the dedicated note assets directory (Desktop App feature only). Overrides assets directory template.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadStackExchangeAssetsInDir")?this.plugin.settings.downloadStackExchangeAssetsInDir:m.downloadStackExchangeAssetsInDir).onChange(async r=>{this.plugin.settings.downloadStackExchangeAssetsInDir=r,r===!0&&(this.plugin.settings.downloadStackExchangeAssets=!0),await this.plugin.saveSettings(),this.display()})),e.createEl("hr",{cls:"readitlater-setting-hr"}),a=this.createDetailsElement(e,"pinterest"),a.createEl("summary",{text:"Pinterest",cls:"readitlater-setting-h3"}),new g.Setting(a).setName("Pinterest content type slug").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.pinterestContentTypeSlug).setValue(typeof this.plugin.settings.pinterestContentTypeSlug=="undefined"?m.pinterestContentTypeSlug:this.plugin.settings.pinterestContentTypeSlug).onChange(async r=>{this.plugin.settings.pinterestContentTypeSlug=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Pinterest note template title").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.pinterestNoteTitle).setValue(this.plugin.settings.pinterestNoteTitle||m.pinterestNoteTitle).onChange(async r=>{this.plugin.settings.pinterestNoteTitle=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Pinterest note template").setDesc(this.createTemplateVariableReferenceDiv()).addTextArea(n=>{n.setValue(this.plugin.settings.pinterestNote||m.pinterestNote).onChange(async r=>{this.plugin.settings.pinterestNote=r,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new g.Setting(a).setName("Download image").setDesc("Image will be downloaded to the assets directory (Desktop App feature only). To dynamically change destination directory you can use variables. Check variables reference to learn more.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadPinterestImage")?this.plugin.settings.downloadPinterestImage:m.downloadPinterestImage).onChange(async r=>{this.plugin.settings.downloadPinterestImage=r,await this.plugin.saveSettings()})),e.createEl("hr",{cls:"readitlater-setting-hr"}),a=this.createDetailsElement(e,"mastodon"),a.createEl("summary",{text:"Mastodon",cls:"readitlater-setting-h3"}),new g.Setting(a).setName("Mastodon content type slug").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.mastodonContentTypeSlug).setValue(typeof this.plugin.settings.mastodonContentTypeSlug=="undefined"?m.mastodonContentTypeSlug:this.plugin.settings.mastodonContentTypeSlug).onChange(async r=>{this.plugin.settings.mastodonContentTypeSlug=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Mastodon note template title").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.mastodonNoteTitle).setValue(this.plugin.settings.mastodonNoteTitle||m.mastodonNoteTitle).onChange(async r=>{this.plugin.settings.mastodonNoteTitle=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Mastodon note template").setDesc(this.createTemplateVariableReferenceDiv()).addTextArea(n=>{n.setValue(this.plugin.settings.mastodonNote||m.mastodonNote).onChange(async r=>{this.plugin.settings.mastodonNote=r,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new g.Setting(a).setName("Download media attachments").setDesc("Media attachments will be downloaded to the assets directory (Desktop App feature only). To dynamically change destination directory you can use variables. Check variables reference to learn more.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadMastodonMediaAttachments")?this.plugin.settings.downloadMastodonMediaAttachments:m.downloadMastodonMediaAttachments).onChange(async r=>{this.plugin.settings.downloadMastodonMediaAttachments=r,r===!1&&(this.plugin.settings.downloadMastodonMediaAttachmentsInDir=!1),await this.plugin.saveSettings(),this.display()})),new g.Setting(a).setName("Download media attachments to note directory").setDesc("Media attachments will be downloaded to the dedicated note assets directory (Desktop App feature only). Overrides assets directory template.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadMastodonMediaAttachmentsInDir")?this.plugin.settings.downloadMastodonMediaAttachmentsInDir:m.downloadMastodonMediaAttachmentsInDir).onChange(async r=>{this.plugin.settings.downloadMastodonMediaAttachmentsInDir=r,r===!0&&(this.plugin.settings.downloadMastodonMediaAttachments=!0),await this.plugin.saveSettings(),this.display()})),new g.Setting(a).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:m.saveMastodonReplies).onChange(async r=>{this.plugin.settings.saveMastodonReplies=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Mastodon reply template").addTextArea(n=>{n.setValue(this.plugin.settings.mastodonReply||m.mastodonReply).onChange(async r=>{this.plugin.settings.mastodonReply=r,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),e.createEl("hr",{cls:"readitlater-setting-hr"}),a=this.createDetailsElement(e,"vimeo"),a.createEl("summary",{text:"Vimeo",cls:"readitlater-setting-h3"}),new g.Setting(a).setName("Vimeo content type slug").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.vimeoContentTypeSlug).setValue(typeof this.plugin.settings.vimeoContentTypeSlug=="undefined"?m.vimeoContentTypeSlug:this.plugin.settings.vimeoContentTypeSlug).onChange(async r=>{this.plugin.settings.vimeoContentTypeSlug=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Vimeo note title template").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.vimeoNoteTitle).setValue(this.plugin.settings.vimeoNoteTitle||m.vimeoNoteTitle).onChange(async r=>{this.plugin.settings.vimeoNoteTitle=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Vimeo note template").setDesc(this.createTemplateVariableReferenceDiv()).addTextArea(n=>{n.setValue(this.plugin.settings.vimeoNote||m.vimeoNote).onChange(async r=>{this.plugin.settings.vimeoNote=r,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new g.Setting(a).setName("Vimeo embed player width").addText(n=>n.setPlaceholder(m.vimeoEmbedWidth).setValue(this.plugin.settings.vimeoEmbedWidth||m.vimeoEmbedWidth).onChange(async r=>{this.plugin.settings.vimeoEmbedWidth=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Vimeo embed player height").addText(n=>n.setPlaceholder(m.vimeoEmbedHeight).setValue(this.plugin.settings.vimeoEmbedHeight||m.vimeoEmbedHeight).onChange(async r=>{this.plugin.settings.vimeoEmbedHeight=r,await this.plugin.saveSettings()})),e.createEl("hr",{cls:"readitlater-setting-hr"}),a=this.createDetailsElement(e,"bilibili"),a.createEl("summary",{text:"Bilibili",cls:"readitlater-setting-h3"}),new g.Setting(a).setName("Bilibili content type slug").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.bilibiliContentTypeSlug).setValue(typeof this.plugin.settings.bilibiliContentTypeSlug=="undefined"?m.bilibiliContentTypeSlug:this.plugin.settings.bilibiliContentTypeSlug).onChange(async r=>{this.plugin.settings.bilibiliContentTypeSlug=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Bilibili note template title").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.bilibiliNoteTitle).setValue(this.plugin.settings.bilibiliNoteTitle||m.bilibiliNoteTitle).onChange(async r=>{this.plugin.settings.bilibiliNoteTitle=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Bilibili note template").setDesc(this.createTemplateVariableReferenceDiv()).addTextArea(n=>{n.setValue(this.plugin.settings.bilibiliNote||m.bilibiliNote).onChange(async r=>{this.plugin.settings.bilibiliNote=r,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new g.Setting(a).setName("Bilibili embed player width").addText(n=>n.setPlaceholder(m.bilibiliEmbedWidth).setValue(this.plugin.settings.bilibiliEmbedWidth||m.bilibiliEmbedWidth).onChange(async r=>{this.plugin.settings.bilibiliEmbedWidth=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Bilibili embed player height").addText(n=>n.setPlaceholder(m.bilibiliEmbedHeight).setValue(this.plugin.settings.bilibiliEmbedHeight||m.bilibiliEmbedHeight).onChange(async r=>{this.plugin.settings.bilibiliEmbedHeight=r,await this.plugin.saveSettings()})),e.createEl("hr",{cls:"readitlater-setting-hr"}),a=this.createDetailsElement(e,"tikTok"),a.createEl("summary",{text:"TikTok",cls:"readitlater-setting-h3"}),new g.Setting(a).setName("TikTok content type slug").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.tikTokContentTypeSlug).setValue(typeof this.plugin.settings.tikTokContentTypeSlug=="undefined"?m.tikTokContentTypeSlug:this.plugin.settings.tikTokContentTypeSlug).onChange(async r=>{this.plugin.settings.tikTokContentTypeSlug=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("TikTok note title template").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.tikTokNoteTitle).setValue(this.plugin.settings.tikTokNoteTitle||m.tikTokNoteTitle).onChange(async r=>{this.plugin.settings.tikTokNoteTitle=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("TikTok note template").setDesc(this.createTemplateVariableReferenceDiv()).addTextArea(n=>{n.setValue(this.plugin.settings.tikTokNote||m.tikTokNote).onChange(async r=>{this.plugin.settings.tikTokNote=r,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new g.Setting(a).setName("TikTok embed player width").addText(n=>n.setPlaceholder(m.tikTokEmbedWidth).setValue(this.plugin.settings.tikTokEmbedWidth||m.tikTokEmbedWidth).onChange(async r=>{this.plugin.settings.tikTokEmbedWidth=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("TikTok embed player height").addText(n=>n.setPlaceholder(m.tikTokEmbedHeight).setValue(this.plugin.settings.tikTokEmbedHeight||m.tikTokEmbedHeight).onChange(async r=>{this.plugin.settings.tikTokEmbedHeight=r,await this.plugin.saveSettings()})),e.createEl("hr",{cls:"readitlater-setting-hr"}),a=this.createDetailsElement(e,"nonReadableArticle"),a.createEl("summary",{text:"Nonreadable Article",cls:"readitlater-setting-h3"}),new g.Setting(a).setName("Nonreadable content type slug").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.notParseableArticleContentType).setValue(typeof this.plugin.settings.notParseableArticleContentType=="undefined"?m.notParseableArticleContentType:this.plugin.settings.notParseableArticleContentType).onChange(async r=>{this.plugin.settings.notParseableArticleContentType=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Nonreadable article note template title").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.notParseableArticleNoteTitle).setValue(this.plugin.settings.notParseableArticleNoteTitle||m.notParseableArticleNoteTitle).onChange(async r=>{this.plugin.settings.notParseableArticleNoteTitle=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Nonreadable article note template").setDesc(this.createTemplateVariableReferenceDiv()).addTextArea(n=>{n.setValue(this.plugin.settings.notParsableArticleNote||m.notParsableArticleNote).onChange(async r=>{this.plugin.settings.notParsableArticleNote=r,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),e.createEl("hr",{cls:"readitlater-setting-hr"}),a=this.createDetailsElement(e,"textSnippet"),a.createEl("summary",{text:"Text Snippet",cls:"readitlater-setting-h3"}),new g.Setting(a).setName("Text Snippet content type slug").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.textSnippetContentType).setValue(typeof this.plugin.settings.textSnippetContentType=="undefined"?m.textSnippetContentType:this.plugin.settings.textSnippetContentType).onChange(async r=>{this.plugin.settings.textSnippetContentType=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Text snippet note template title").setDesc(this.createTemplateVariableReferenceDiv()).addText(n=>n.setPlaceholder(m.textSnippetNoteTitle).setValue(this.plugin.settings.textSnippetNoteTitle||m.textSnippetNoteTitle).onChange(async r=>{this.plugin.settings.textSnippetNoteTitle=r,await this.plugin.saveSettings()})),new g.Setting(a).setName("Text snippet note template").setDesc(this.createTemplateVariableReferenceDiv()).addTextArea(n=>{n.setValue(this.plugin.settings.textSnippetNote||m.textSnippetNote).onChange(async r=>{this.plugin.settings.textSnippetNote=r,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),e.createEl("h2",{text:"Advanced"});let s=Pi(g.Platform);new g.Setting(e).setName("Maximum file path length").setDesc(`Defaults to ${s.path} characters on your current platform.`).addText(n=>n.setPlaceholder(String(s.path)).onChange(async r=>{let o=r.trim();if(o!==""&&Number.isNaN(Number(o))){new g.Notice("Maximum file path length must be a number.");return}o===""?this.plugin.settings.filesystemLimitPath=null:this.plugin.settings.filesystemLimitPath=Number(o),await this.plugin.saveSettings()})),new g.Setting(e).setName("Maximum file name length").setDesc(`Defaults to ${s.fileName} characters on your current platform.`).addText(n=>n.setPlaceholder(String(s.fileName)).onChange(async r=>{let o=r.trim();if(o!==""&&Number.isNaN(Number(o))){new g.Notice("Maximum file name length must be a number.");return}o===""?this.plugin.settings.filesystemLimitFileName=null:this.plugin.settings.filesystemLimitFileName=Number(o),await this.plugin.saveSettings()}))}createDetailsElement(e,a){let s=e.createEl("details");return s.addEventListener("toggle",()=>{s.open?this.activeDetatils.push(a):this.activeDetatils=this.activeDetatils.filter(n=>n!==a)}),this.activeDetatils.includes(a)&&s.setAttribute("open",""),s}createTemplateVariableReferenceDiv(e=""){return Xt(`<p>${e} See the <a href="https://github.com/DominikPieper/obsidian-ReadItLater?tab=readme-ov-file#template-engine">template variables reference</a></p>`)}};var qe=require("obsidian"),Zt=Yt(qa());var Wa=require("obsidian");function Ue(i,t){throw new Wa.Notice(`${t} Check the console output.`),i}var vr=/(const|let|var)\s+(\w+)\s*=\s*(.+|\n+?)\s*(?=(?:^|\s+)(const|let|var)\s+|$)/g;function Jt(i,t){return br(t).find(e=>e.name===i)}function br(i){let t=[],e;return i.forEach(a=>{for(;(e=vr.exec(a.textContent))!==null;)t.push({type:e[1].trim(),name:e[2].trim(),value:e[3].trim().replace(/;+\s*$/,"")})}),t}var Ve={"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"};var V=class{constructor(t,e,a,s,n){this.fileName=t;this.fileExtension=e;this.content=a;this.contentType=s;this.createdAt=n;k(this,"_filePath",null);this.fileName=q(this.fileName)}getFullFilename(){return`${this.fileName}.${this.fileExtension}`}get filePath(){return this._filePath}set filePath(t){this._filePath=t}};var Ga=require("obsidian");function kt(i,t){return(0,Ga.moment)(i).format(t)}var H=class{constructor(t,e,a){k(this,"app");k(this,"plugin");k(this,"templateEngine");this.app=t,this.plugin=e,this.templateEngine=a}isValidUrl(t){return Oe(t)}getFormattedDateForFilename(t){return kt(t,this.plugin.settings.dateTitleFmt)}getFormattedDateForContent(t){return kt(t,this.plugin.settings.dateContentFmt)}};var Ii=class extends H{constructor(){super(...arguments);k(this,"PATTERN",/^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]+)(?:\?([^&\s]+(?:&[^&\s]+)*))?/)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,s=this.plugin.settings.youtubeApiKey===""?await this.parseSchema(e,a):await this.parseApiResponse(e,a),n=this.templateEngine.render(this.plugin.settings.youtubeNote,s),r=this.templateEngine.render(this.plugin.settings.youtubeNoteTitle,{title:s.videoTitle,date:this.getFormattedDateForFilename(a)});return new V(r,"md",n,this.plugin.settings.youtubeContentTypeSlug,a)}async parseApiResponse(e,a){var n,r,o,p,c,d,h,_,N,C,A,f,P;let s=this.PATTERN.exec(e)[1];try{let L=await(0,qe.request)({method:"GET",url:`https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,statistics,status,topicDetails&id=${s}&key=${this.plugin.settings.youtubeApiKey}`,headers:{Accept:"application/json"}}),z=JSON.parse(L);if(z.items.length===0)throw new Error(`Video (${e}) cannot be fetched from API`);let x=z.items[0],W=await(0,qe.request)({method:"GET",url:`https://www.googleapis.com/youtube/v3/channels?part=snippet,contentDetails,statistics&id=${x.snippet.channelId}&key=${this.plugin.settings.youtubeApiKey}`,headers:{Accept:"application/json"}}),E=JSON.parse(W);if(E.items.length===0)throw new Error(`Channel (${x.snippet.channelId}) cannot be fetched from API`);let I=E.items[0],Y=(0,Zt.parse)(x.contentDetails.duration),J=(o=(r=(n=x.snippet)==null?void 0:n.tags)==null?void 0:r.map(B=>B.replace(/[\s:\-_.]/g,"").replace(/^/,"#")))!=null?o:[],Q=this.getVideoChapters(x.snippet.description);return{date:this.getFormattedDateForContent(a),videoId:x.id,videoURL:e,videoTitle:x.snippet.title,videoDescription:x.snippet.description,videoThumbnail:(f=(A=(_=(c=(p=x.snippet.thumbnails)==null?void 0:p.maxres)==null?void 0:c.url)!=null?_:(h=(d=x.snippet.thumbnails)==null?void 0:d.medium)==null?void 0:h.url)!=null?A:(C=(N=x.snippet.thumbnails)==null?void 0:N.default)==null?void 0:C.url)!=null?f:"",videoPlayer:this.getEmbedPlayer(x.id),videoDuration:(0,Zt.toSeconds)(Y),videoDurationFormatted:this.formatDuration(Y),videoPublishDate:(0,qe.moment)(x.snippet.publishedAt).format(this.plugin.settings.dateContentFmt),videoViewsCount:x.statistics.viewCount,videoTags:J.join(" "),videoChapters:this.formatVideoChapters(x.id,Q),channelId:I.id,channelURL:`https://www.youtube.com/channel/${I.id}`,channelName:(P=I.snippet.title)!=null?P:"",extra:{thumbnails:x.snippet.thumbnails,publishedAt:(0,qe.moment)(x.snippet.publishedAt).toDate(),tags:J,channel:{thumbnails:I.snippet.thumbnails},chapters:Q}}}catch(L){Ue(L,"Unable to parse Youtube API response.")}}async parseSchema(e,a){var s,n,r,o,p,c,d,h,_,N,C,A,f,P,L,z,x,W,E,I,Y,J,Q,B,ue,Te,O,U,j,ge,w,G,R,ae,we,Ne,Ie,ye,Ee,Ae,he,_e,Ce,K,se,De,xe,fe,Re,M,Be,He,Ot;try{let bt=await(0,qe.request)({method:"GET",url:e,headers:{...Ve}}),yt=new DOMParser().parseFromString(bt,"text/html"),Ut=Jt("ytInitialData",yt.querySelectorAll("script")),ce=typeof Ut!="undefined"?JSON.parse(Ut.value):{},oe=yt.querySelector('[itemtype*="http://schema.org/VideoObject"]');if(oe===null)throw new Error("Unable to find Schema.org element in HTML.");let v=(n=(s=oe==null?void 0:oe.querySelector('[itemprop="identifier"]'))==null?void 0:s.getAttribute("content"))!=null?n:"",b=oe.querySelector('[itemtype="http://schema.org/Person"]'),S=(f=(A=(N=(_=(h=(d=(c=(p=(o=(r=ce==null?void 0:ce.contents)==null?void 0:r.twoColumnWatchNextResults)==null?void 0:o.results)==null?void 0:p.results)==null?void 0:c.contents)==null?void 0:d[1])==null?void 0:h.videoSecondaryInfoRenderer)==null?void 0:_.attributedDescription)==null?void 0:N.content)!=null?A:(C=oe==null?void 0:oe.querySelector('[itemprop="description"]'))==null?void 0:C.getAttribute("content"))!=null?f:"",D=this.getVideoChapters(S),$=(Q=(J=(Y=(I=(E=(W=(x=(z=(L=(P=ce==null?void 0:ce.engagementPanels)==null?void 0:P[5])==null?void 0:L.engagementPanelSectionListRenderer)==null?void 0:z.content)==null?void 0:x.structuredDescriptionContentRenderer)==null?void 0:W.items)==null?void 0:E[0])==null?void 0:I.videoDescriptionHeaderRenderer)==null?void 0:Y.publishDate)==null?void 0:J.simpleText)!=null?Q:"",ve=(R=(G=(w=(ge=(j=(U=(O=(Te=(ue=(B=ce==null?void 0:ce.contents)==null?void 0:B.twoColumnWatchNextResults)==null?void 0:ue.results)==null?void 0:Te.results)==null?void 0:O.contents)==null?void 0:U[0])==null?void 0:j.videoPrimaryInfoRenderer)==null?void 0:ge.viewCount)==null?void 0:w.videoViewCountRenderer)==null?void 0:G.originalViewCount)!=null?R:0,me=(se=(K=(_e=(he=(Ae=(Ee=(ye=(Ie=(Ne=(we=(ae=ce==null?void 0:ce.contents)==null?void 0:ae.twoColumnWatchNextResults)==null?void 0:we.results)==null?void 0:Ne.results)==null?void 0:Ie.contents)==null?void 0:ye[1])==null?void 0:Ee.videoSecondaryInfoRenderer)==null?void 0:Ae.subscribeButton)==null?void 0:he.subscribeButtonRenderer)==null?void 0:_e.channelId)!=null?K:(Ce=oe==null?void 0:oe.querySelector('[itemprop="channelId"]'))==null?void 0:Ce.getAttribute("content"))!=null?se:"";return{date:this.getFormattedDateForContent(a),videoId:v,videoURL:e,videoTitle:(xe=(De=oe==null?void 0:oe.querySelector('[itemprop="name"]'))==null?void 0:De.getAttribute("content"))!=null?xe:"",videoDescription:S,videoThumbnail:(Re=(fe=yt.querySelector('meta[property="og:image"]'))==null?void 0:fe.getAttribute("content"))!=null?Re:"",videoPlayer:this.getEmbedPlayer(v),videoDuration:0,videoDurationFormatted:"",videoPublishDate:$!==""?(0,qe.moment)($).format(this.plugin.settings.dateContentFmt):"",videoViewsCount:ve,videoTags:"",videoChapters:this.formatVideoChapters(v,D),channelId:me,channelURL:(Be=(M=b==null?void 0:b.querySelector('[itemprop="url"]'))==null?void 0:M.getAttribute("href"))!=null?Be:"",channelName:(Ot=(He=b==null?void 0:b.querySelector('[itemprop="name"]'))==null?void 0:He.getAttribute("content"))!=null?Ot:"",extra:null}}catch(bt){Ue(bt,"Unable to parse Youtube schema from DOM.")}}formatDuration(e){let a="";return e.years>0&&(a=a.concat(" ",`${e.years}y`)),e.months>0&&(a=a.concat(" ",`${e.months}m`)),e.weeks>0&&(a=a.concat(" ",`${e.weeks}w`)),e.days>0&&(a=a.concat(" ",`${e.days}d`)),e.hours>0&&(a=a.concat(" ",`${e.hours}h`)),e.minutes>0&&(a=a.concat(" ",`${e.minutes}m`)),e.seconds>0&&(a=a.concat(" ",`${e.seconds}s`)),a.trim()}formatVideoChapters(e,a){return a.map(s=>`- [${s.timestamp}](https://www.youtube.com/watch?v=${e}&t=${s.seconds}) ${s.title}`).join(`
`)}getVideoChapters(e){let a=/^((?:\d{1,2}:)?(?:\d{1,2}):(?:\d{1,2}))\s+(.+)$/gm,s=[],n;for(;(n=a.exec(e))!==null;){let r=n[1].trim(),o=n[2].trim(),p=r.split(":"),c=0,d,h;p.length===3?[c,d,h]=p.map(Number):[d,h]=p.map(Number);let _=c*3600+d*60+h;s.push({timestamp:r,title:o,seconds:_})}return s}getEmbedPlayer(e){let a=this.plugin.settings.youtubeUsePrivacyEnhancedEmbed?"youtube-nocookie.com":"youtube.com";return`<iframe width="${this.plugin.settings.youtubeEmbedWidth}" height="${this.plugin.settings.youtubeEmbedHeight}" src="https://www.${a}/embed/${e}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`}},Ya=Ii;var Xa=require("obsidian");var Fi=class extends H{constructor(){super(...arguments);k(this,"PATTERN",/(vimeo.com)\/(\d+)?/)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,s=await this.parseSchema(e,a),n=this.templateEngine.render(this.plugin.settings.vimeoNote,s),r=this.templateEngine.render(this.plugin.settings.vimeoNoteTitle,{title:s.videoTitle,date:this.getFormattedDateForFilename(a)});return new V(r,"md",n,this.plugin.settings.vimeoContentTypeSlug,a)}async parseSchema(e,a){var d,h,_,N,C,A;let s=await(0,Xa.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(s,"text/html").querySelector('script[type="application/ld+json"]'),p=JSON.parse(r.textContent)[0],c=this.PATTERN.exec(e);return{date:this.getFormattedDateForContent(a),videoId:c.length===3?c[2]:"",videoURL:(d=p==null?void 0:p.url)!=null?d:"",videoTitle:(h=p==null?void 0:p.name)!=null?h:"",videoPlayer:`<iframe width="${this.plugin.settings.vimeoEmbedWidth}" height="${this.plugin.settings.vimeoEmbedHeight}" src="${p==null?void 0:p.embedUrl}" title="Vimeo video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`,channelName:(N=(_=p==null?void 0:p.author)==null?void 0:_.name)!=null?N:"",channelURL:(A=(C=p==null?void 0:p.author)==null?void 0:C.url)!=null?A:""}}},Ka=Fi;var Ja=require("obsidian");var Mi=class extends H{constructor(){super(...arguments);k(this,"PATTERN",/(bilibili.com)\/(video)?\/([a-z0-9]+)?/i)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,s=await this.getNoteData(e,a),n=this.templateEngine.render(this.plugin.settings.bilibiliNote,s),r=this.templateEngine.render(this.plugin.settings.bilibiliNoteTitle,{title:s.videoTitle,date:this.getFormattedDateForFilename(a)});return new V(r,"md",n,this.plugin.settings.bilibiliContentTypeSlug,a)}async getNoteData(e,a){var o,p;let s=await(0,Ja.request)({method:"GET",url:e,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"}}),n=new DOMParser().parseFromString(s,"text/html"),r=(o=this.PATTERN.exec(e)[3])!=null?o:"";return{date:this.getFormattedDateForContent(a),videoId:r,videoTitle:(p=n.querySelector("[property~='og:title']").getAttribute("content"))!=null?p:"",videoURL:e,videoPlayer:`<iframe width="${this.plugin.settings.bilibiliEmbedWidth}" height="${this.plugin.settings.bilibiliEmbedHeight}" src="https://player.bilibili.com/player.html?autoplay=0&bvid=${r}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>`}}},Za=Mi;var ti=require("obsidian");function yr(i){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var a in e)e.hasOwnProperty(a)&&(i[a]=e[a])}return i}function Bi(i,t){return Array(t+1).join(i)}function xr(i){return i.replace(/^\n*/,"")}function Tr(i){for(var t=i.length;t>0&&i[t-1]===`
`;)t--;return i.substring(0,t)}var wr=["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 Hi(i){return zi(i,wr)}var tn=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function an(i){return zi(i,tn)}function Nr(i){return rn(i,tn)}var nn=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function Er(i){return zi(i,nn)}function Ar(i){return rn(i,nn)}function zi(i,t){return t.indexOf(i.nodeName)>=0}function rn(i,t){return i.getElementsByTagName&&t.some(function(e){return i.getElementsByTagName(e).length})}var pe={};pe.paragraph={filter:"p",replacement:function(i){return`
`+i+`
`}};pe.lineBreak={filter:"br",replacement:function(i,t,e){return e.br+`
`}};pe.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 s=Bi(a===1?"=":"-",i.length);return`
`+i+`
`+s+`
`}else return`
`+Bi("#",a)+" "+i+`
`}};pe.blockquote={filter:"blockquote",replacement:function(i){return i=i.replace(/^\n+|\n+$/g,""),i=i.replace(/^/gm,"> "),`
`+i+`
`}};pe.list={filter:["ul","ol"],replacement:function(i,t){var e=t.parentNode;return e.nodeName==="LI"&&e.lastElementChild===t?`
`+i:`
`+i+`
`}};pe.listItem={filter:"li",replacement:function(i,t,e){i=i.replace(/^\n+/,"").replace(/\n+$/,`
`).replace(/\n/gm,`
`);var a=e.bulletListMarker+" ",s=t.parentNode;if(s.nodeName==="OL"){var n=s.getAttribute("start"),r=Array.prototype.indexOf.call(s.children,t);a=(n?Number(n)+r:r+1)+". "}return a+i+(t.nextSibling&&!/\n$/.test(i)?`
`:"")}};pe.indentedCodeBlock={filter:function(i,t){return t.codeBlockStyle==="indented"&&i.nodeName==="PRE"&&i.firstChild&&i.firstChild.nodeName==="CODE"},replacement:function(i,t,e){return`
`+t.firstChild.textContent.replace(/\n/g,`
`)+`
`}};pe.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")||"",s=(a.match(/language-(\S+)/)||[null,""])[1],n=t.firstChild.textContent,r=e.fence.charAt(0),o=3,p=new RegExp("^"+r+"{3,}","gm"),c;c=p.exec(n);)c[0].length>=o&&(o=c[0].length+1);var d=Bi(r,o);return`
`+d+s+`
`+n.replace(/\n$/,"")+`
`+d+`
`}};pe.horizontalRule={filter:"hr",replacement:function(i,t,e){return`
`+e.hr+`
`}};pe.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=Qt(t.getAttribute("title"));return a&&(a=' "'+a.replace(/"/g,'\\"')+'"'),"["+i+"]("+e+a+")"}};pe.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"),s=Qt(t.getAttribute("title"));s&&(s=' "'+s+'"');var n,r;switch(e.linkReferenceStyle){case"collapsed":n="["+i+"][]",r="["+i+"]: "+a+s;break;case"shortcut":n="["+i+"]",r="["+i+"]: "+a+s;break;default:var o=this.references.length+1;n="["+i+"]["+o+"]",r="["+o+"]: "+a+s}return this.references.push(r),n},references:[],append:function(i){var t="";return this.references.length&&(t=`
`+this.references.join(`
`)+`
`,this.references=[]),t}};pe.emphasis={filter:["em","i"],replacement:function(i,t,e){return i.trim()?e.emDelimiter+i+e.emDelimiter:""}};pe.strong={filter:["strong","b"],replacement:function(i,t,e){return i.trim()?e.strongDelimiter+i+e.strongDelimiter:""}};pe.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}};pe.image={filter:"img",replacement:function(i,t){var e=Qt(t.getAttribute("alt")),a=t.getAttribute("src")||"",s=Qt(t.getAttribute("title")),n=s?' "'+s+'"':"";return a?"!["+e+"]("+a+n+")":""}};function Qt(i){return i?i.replace(/(\n+\s*)+/g,`
`):""}function sn(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])}sn.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=Oi(this.array,i,this.options))||(t=Oi(this._keep,i,this.options))||(t=Oi(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 Oi(i,t,e){for(var a=0;a<i.length;a++){var s=i[a];if(Sr(s,t,e))return s}}function Sr(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 kr(i){var t=i.element,e=i.isBlock,a=i.isVoid,s=i.isPre||function(h){return h.nodeName==="PRE"};if(!(!t.firstChild||s(t))){for(var n=null,r=!1,o=null,p=Qa(o,t,s);p!==t;){if(p.nodeType===3||p.nodeType===4){var c=p.data.replace(/[ \r\n\t]+/g," ");if((!n||/ $/.test(n.data))&&!r&&c[0]===" "&&(c=c.substr(1)),!c){p=Ui(p);continue}p.data=c,n=p}else if(p.nodeType===1)e(p)||p.nodeName==="BR"?(n&&(n.data=n.data.replace(/ $/,"")),n=null,r=!1):a(p)||s(p)?(n=null,r=!0):n&&(r=!1);else{p=Ui(p);continue}var d=Qa(o,p,s);o=p,p=d}n&&(n.data=n.data.replace(/ $/,""),n.data||Ui(n))}}function Ui(i){var t=i.nextSibling||i.parentNode;return i.parentNode.removeChild(i),t}function Qa(i,t,e){return i&&i.parentNode===t||e(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var ji=typeof window!="undefined"?window:{};function _r(){var i=ji.DOMParser,t=!1;try{new i().parseFromString("","text/html")&&(t=!0)}catch(e){}return t}function Cr(){var i=function(){};return Dr()?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 Dr(){var i=!1;try{document.implementation.createHTMLDocument("").open()}catch(t){ji.ActiveXObject&&(i=!0)}return i}var Rr=_r()?ji.DOMParser:Cr();function Pr(i,t){var e;if(typeof i=="string"){var a=Lr().parseFromString('<x-turndown id="turndown-root">'+i+"</x-turndown>","text/html");e=a.getElementById("turndown-root")}else e=i.cloneNode(!0);return kr({element:e,isBlock:Hi,isVoid:an,isPre:t.preformattedCode?Ir:null}),e}var Vi;function Lr(){return Vi=Vi||new Rr,Vi}function Ir(i){return i.nodeName==="PRE"||i.nodeName==="CODE"}function Fr(i,t){return i.isBlock=Hi(i),i.isCode=i.nodeName==="CODE"||i.parentNode.isCode,i.isBlank=Mr(i),i.flankingWhitespace=Or(i,t),i}function Mr(i){return!an(i)&&!Er(i)&&/^\s*$/i.test(i.textContent)&&!Nr(i)&&!Ar(i)}function Or(i,t){if(i.isBlock||t.preformattedCode&&i.isCode)return{leading:"",trailing:""};var e=Ur(i.textContent);return e.leadingAscii&&en("left",i,t)&&(e.leading=e.leadingNonAscii),e.trailingAscii&&en("right",i,t)&&(e.trailing=e.trailingNonAscii),{leading:e.leading,trailing:e.trailing}}function Ur(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 en(i,t,e){var a,s,n;return i==="left"?(a=t.previousSibling,s=/ $/):(a=t.nextSibling,s=/^ /),a&&(a.nodeType===3?n=s.test(a.nodeValue):e.preformattedCode&&a.nodeName==="CODE"?n=!1:a.nodeType===1&&!Hi(a)&&(n=s.test(a.textContent))),n}var Vr=Array.prototype.reduce,Br=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function ei(i){if(!(this instanceof ei))return new ei(i);var t={rules:pe,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(e,a){return a.isBlock?`
`:""},keepReplacement:function(e,a){return a.isBlock?`
`+a.outerHTML+`
`:a.outerHTML},defaultReplacement:function(e,a){return a.isBlock?`
`+e+`
`:e}};this.options=yr({},t,i),this.rules=new sn(this.options)}ei.prototype={turndown:function(i){if(!jr(i))throw new TypeError(i+" is not a string, or an element/document/fragment node.");if(i==="")return"";var t=on.call(this,new Pr(i,this.options));return Hr.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 Br.reduce(function(t,e){return t.replace(e[0],e[1])},i)}};function on(i){var t=this;return Vr.call(i.childNodes,function(e,a){a=new Fr(a,t.options);var s="";return a.nodeType===3?s=a.isCode?a.nodeValue:t.escape(a.nodeValue):a.nodeType===1&&(s=zr.call(t,a)),ln(e,s)},"")}function Hr(i){var t=this;return this.rules.forEach(function(e){typeof e.append=="function"&&(i=ln(i,e.append(t.options)))}),i.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function zr(i){var t=this.rules.forNode(i),e=on.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 ln(i,t){var e=Tr(i),a=xr(t),s=Math.max(i.length-e.length,t.length-a.length),n=`
`.substring(0,s);return e+n+a}function jr(i){return i!=null&&(typeof i=="string"||i.nodeType&&(i.nodeType===1||i.nodeType===9||i.nodeType===11))}var pn=ei;var cn=/highlight-(?:text|source)-([a-z0-9]+)/;function $r(i){i.addRule("highlightedCodeBlock",{filter:function(t){var e=t.firstChild;return t.nodeName==="DIV"&&cn.test(t.className)&&e&&e.nodeName==="PRE"},replacement:function(t,e,a){var s=e.className||"",n=(s.match(cn)||[null,""])[1];return`
`+a.fence+n+`
`+e.firstChild.textContent+`
`+a.fence+`
`}})}function qr(i){i.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(t){return"~"+t+"~"}})}var Wr=Array.prototype.indexOf,et={};et.tableCell={filter:["th","td"],replacement:function(i,t){return mn(i,t)+dn(t,"")}};et.tableRow={filter:"tr",replacement:function(i,t){var e="",a={left:":--",right:"--:",center:":-:"};if(Gr(t))for(var s=0;s<t.childNodes.length;s++){var n="---",r=(t.childNodes[s].getAttribute("align")||"").toLowerCase();r&&(n=a[r]||n),e+=mn(n,t.childNodes[s])+dn(t.childNodes[s],n)}return`
`+i+(e?`
`+e:"")}};et.table={filter:function(i){return i.nodeName==="TABLE"&&!un(i)},replacement:function(i){return i=i.replace(`
`,`
`),`
`+i+`
`}};et.tableSection={filter:["thead","tbody","tfoot"],replacement:function(i){return i}};et.captionSection={filter:"caption",replacement:function(i,t){return t.parentNode.nodeName==="TABLE"&&t.parentNode.childNodes[0]===t?i:""}};function Gr(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 mn(i,t){var e=Wr.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 dn(i,t){var e=i.getAttribute("colspan")||1;return e<=1?"":(" "+t+" |").repeat(e-1)}function un(i){for(var t=i.parentNode;t;){if(t.nodeName==="TABLE")return!0;t=t.parentNode}return!1}function Yr(i){i.keep(function(e){return e.nodeName==="TABLE"&&un(e)});for(var t in et)i.addRule(t,et[t])}function Xr(i){i.addRule("taskListItems",{filter:function(t){return t.type==="checkbox"&&t.parentNode.nodeName==="LI"},replacement:function(t,e){return(e.checked?"[x]":"[ ]")+" "}})}function gn(i){i.use([$r,qr,Yr,Xr])}async function $e(i){let t=gn,e=new pn({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",emDelimiter:"*"});return e.use(t),e.addRule("torchlightCodeBlock",{filter:s=>s.nodeName==="PRE"&&s.firstChild.nodeName==="CODE"&&s.firstChild.firstChild.nodeName==="P",replacement:function(s,n,r){return n.querySelectorAll("p").forEach(o=>{o.innerHTML=o.innerHTML+`
`}),`
`+r.fence+n.firstChild.getAttribute("data-lang")+`
`+n.firstChild.textContent+`
`+r.fence+`
`}}),e.addRule("fencedCodeLangBlock",{filter:s=>s.nodeName=="PRE"&&(!s.firstChild||s.firstChild.nodeName!="CODE")&&!s.querySelector("img"),replacement:function(s,n,r){var A;n.innerHTML=n.innerHTML.replaceAll("<br-keep></br-keep>","<br>");let o=(A=n.id)==null?void 0:A.match(/code-lang-(.+)/),p=(o==null?void 0:o.length)>0?o[1]:"",c=n.textContent,d=r.fence.charAt(0),h=3,_=new RegExp("^"+d+"{3,}","gm"),N;for(;N=_.exec(c);)N[0].length>=h&&(h=N[0].length+1);let C=Array(h+1).join(d);return`
`+C+p+`
`+c.replace(/\n$/,"")+`
`+C+`
`}}),e.turndown(i)}var $i=class extends H{constructor(){super(...arguments);k(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,s=new URL(e);s.hostname==="x.com"&&(s.hostname="twitter.com");let n=await this.getTweetNoteData(s,a),r=this.templateEngine.render(this.plugin.settings.twitterNote,n),o=this.templateEngine.render(this.plugin.settings.twitterNoteTitle,{tweetAuthorName:n.tweetAuthorName,date:this.getFormattedDateForFilename(a)});return new V(o,"md",r,this.plugin.settings.twitterContentTypeSlug,a)}async getTweetNoteData(e,a){let s=JSON.parse(await(0,ti.request)({method:"GET",contentType:"application/json",url:`https://publish.twitter.com/oembed?url=${e.href}`})),n=await $e(s.html);return{date:this.getFormattedDateForContent(a),tweetAuthorName:s.author_name,tweetURL:s.url,tweetContent:n,tweetPublishDate:this.getPublishedDateFromDOM(s.html)}}getPublishedDateFromDOM(e){let s=new DOMParser().parseFromString(e,"text/html").querySelector("blockquote > a"),n=(0,ti.moment)(s.textContent);return n.isValid()?n.format(this.plugin.settings.dateContentFmt):""}},hn=$i;var ii=require("obsidian"),Ki=Yt(Yi());var We=require("obsidian");var mt="http:",dt="https:";function Xi(i){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let a=0;a<i;a++)e+=t.charAt(Math.floor(Math.random()*t.length));return e}function vn(i,t){let e=i.trim().split(Pa(t)).filter(s=>s.trim().length>0),a=e.reduce((s,n)=>s&&Oe(n,[mt,dt]),!0);return{urls:e,everyLineIsURL:a}}var Jr=/!\[(?<anchor>.*?)\]\((?<link>.+?)\)/g,Zr=5,Qr=1e3;async function Le(i,t,e,a){return await es(e,Jr,ts(i,t,a))}async function es(i,t,e){try{if(typeof e=="function"){let a=[];return String.prototype.replace.call(i,t,function(s,n,r){return a.push(e(s,n,r)),""}),Promise.all(a).then(function(s){return String.prototype.replace.call(i,t,function(){return s.shift()})})}else return Promise.resolve(String.prototype.replace.call(i,t,e))}catch(a){return console.error(),Promise.reject(a)}}function ts(i,t,e){return async function(s,n,r){if(!Oe(r,[mt,dt]))return s;let o=new URL(r);await i.getVaultRepository().createDirectory(e);try{let{fileContent:p,fileExtension:c}=await as(o),d=0;for(;d<Zr;)try{let{fileName:h,needWrite:_}=await is(i.app.vault.adapter,i.getFileSystemLimits(),e,t,c);if(_&&h!==""){await i.app.vault.createBinary(h,p);let N=h.replace(/\s/g,"%20");return`![${n}](${N})`}else return s}catch(h){console.warn(h),d++}return s}catch(p){return console.warn(p),s}}}async function is(i,t,e,a,s){if(s==="")return{fileName:"",needWrite:!1};let n=!1,r="",o=0;for(;r===""&&o<Qr;){let p;i instanceof We.CapacitorAdapter||i instanceof We.FileSystemAdapter?p=St(e,`${a}-${Xi(10)}.${s}`,i,t):p=`${e}/${a}-${Xi(10)}.${s}`,await i.exists((0,We.normalizePath)(p),!1)||(r=p,n=!0),o++}return{fileName:r,needWrite:n}}async function as(i){var e;let t=await(0,We.requestUrl)({url:i.href,method:"get"});return{fileContent:t.arrayBuffer,fileExtension:(e=ja(t.headers["content-type"]||""))!=null?e:""}}var Ji=class extends H{constructor(){super(...arguments);k(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,s=await(0,ii.request)({method:"GET",url:e,headers:{...Ve}}),n=new DOMParser().parseFromString(s,"text/html"),r=await this.parseDocument(n),o=this.templateEngine.render(this.plugin.settings.stackExchangeNoteTitle,{title:r.title,date:this.getFormattedDateForFilename(a)}),p;this.plugin.settings.downloadStackExchangeAssetsInDir?(p=this.templateEngine.render(this.plugin.settings.assetsDir,{date:"",fileName:"",contentType:""}),p=`${p}/${q(o)}`):p=this.templateEngine.render(this.plugin.settings.assetsDir,{date:this.getFormattedDateForFilename(a),fileName:q(o),contentType:this.plugin.settings.stackExchangeContentType});let c=this.templateEngine.render(this.plugin.settings.stackExchangeNote,this.getNoteData(r,a));return this.plugin.settings.downloadStackExchangeAssets&&ii.Platform.isDesktop&&(c=await Le(this.plugin,q(o),c,p)),new V(o,"md",c,this.plugin.settings.stackExchangeContentType,a)}getNoteData(e,a){let s=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}):"",n="";for(let r=0;r<e.answers.length;r++)n=n.concat(`
***
`,this.templateEngine.render(this.plugin.settings.stackExchangeAnswer,{date:this.getFormattedDateForContent(a),answerContent:e.answers[r].content,authorName:e.answers[r].author.name,authorProfileURL:e.answers[r].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:s,answers:n.trim(),extra:{question:e}}}async parseDocument(e){var r,o,p,c,d,h,_,N,C,A,f,P,L,z,x,W;let a;try{a=new URL((p=(r=e.querySelector('link[rel="canonical"]'))==null?void 0:r.getAttribute("href"))!=null?p:(o=e.querySelector('meta[property="og:url"]'))==null?void 0:o.getAttribute("content"))}catch(E){a=null}let s=e.querySelector('#question [itemprop="author"]'),n=[];for(let E of e.querySelectorAll(".answer")){let I=E.querySelector('[itemprop="author"]');n.push({content:await $e(Ki.sanitize((c=E.querySelector('[itemprop="text"]'))!=null?c:"")),author:{name:(h=(d=I==null?void 0:I.querySelector('[itemprop="name"]'))==null?void 0:d.textContent)!=null?h:"",profile:I instanceof Element&&a instanceof URL?String.prototype.concat(a.origin,(N=(_=I.querySelector("a"))==null?void 0:_.getAttribute("href"))!=null?N:""):""}})}return{title:(A=(C=e.querySelector('#question-header [itemprop="name"]'))==null?void 0:C.textContent)!=null?A:"",content:await $e(Ki.sanitize((f=e.querySelector('#question [itemprop="text"]'))!=null?f:"")),url:(P=a==null?void 0:a.href)!=null?P:"",topAnswer:n.slice(0,1).shift(),answers:n.slice(1),author:{name:(z=(L=s==null?void 0:s.querySelector('[itemprop="name"]'))==null?void 0:L.textContent)!=null?z:"",profile:s instanceof Element&&a instanceof URL?String.prototype.concat(a.origin,(W=(x=s.querySelector("a"))==null?void 0:x.getAttribute("href"))!=null?W:""):""}}}},bn=Ji;var tt=require("obsidian"),ai=Yt(En()),An=Yt(Yi());var ea=class extends H{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,ai.isProbablyReaderable)(t)||new tt.Notice("@mozilla/readability considers this document to unlikely be readerable.");let a=new Date,s=this.extractPreviewUrl(t),n=new ai.Readability(t).parse();if(n===null||!Object.prototype.hasOwnProperty.call(n,"content"))return this.notParsableArticle(e.href,s,a);let r=await $e(n.content);return this.parsableArticle({date:this.getFormattedDateForContent(a),articleTitle:n.title||"No title",articleURL:e.href,articleReadingTime:this.getEstimatedReadingTime(n),articleContent:r,siteName:n.siteName||"",author:n.byline||"",previewURL:s||"",publishedTime:n.publishedTime!==null?this.getFormattedDateForContent(n.publishedTime):"",readabilityArticle:n},a)}async getDocument(t){var o,p,c,d,h,_,N,C,A;let e=await this.parseHtmlDom(t),a=e.getElementsByTagName("base"),s=null;a.length>0&&(s=a.item(0).getAttribute("href"),Array.from(a).forEach(f=>{f.remove()}));let n=e.createElement("base");n.setAttribute("href",Ha(s!=null?s:t.href,t.origin)),e.head.append(n);let r=An.sanitize(e.body.innerHTML);return e.body.innerHTML=r,(o=e.body.querySelectorAll("pre br"))==null||o.forEach(f=>{f.outerHTML="<br-keep></br-keep>"}),(p=e.body.querySelectorAll("h1, h2, h3, h4, h5, h6"))==null||p.forEach(f=>{f.className=""}),(c=e.body.querySelectorAll("[class*=highlight-text],[class*=highlight-source]"))==null||c.forEach(f=>{var L;let P=(L=f.className.match(/highlight-(?:text|source)-([a-z0-9]+)/))==null?void 0:L[1];f.firstElementChild.nodeName=="PRE"&&(f.removeAttribute("data-snippet-clipboard-copy-content"),f.firstElementChild.id=`code-lang-${P}`)}),(d=e.body.querySelectorAll("[class*=language-]"))==null||d.forEach(f=>{var L;let P=(L=f.className.match(/language-([a-z0-9]+)/))==null?void 0:L[1];f.id=`code-lang-${P}`}),(h=e.body.querySelectorAll(".codehilite > pre"))==null||h.forEach(f=>{f.firstChild.nodeName!=="CODE"&&!f.className.includes("language")&&(f.id="code-lang-text")}),(_=e.body.querySelectorAll(".captioned-image-container figure"))==null||_.forEach(f=>{let P=f.querySelector("img");P&&(f.querySelector(".image-link").remove(),f.prepend(P))}),(N=e.body.querySelectorAll("div > figure"))==null||N.forEach(f=>{let P=f;f.parentElement.before(P)}),(C=e.body.querySelector(".rich_media_content.js_underline_content"))==null||C.removeAttribute("style"),(A=e.body.querySelectorAll(".rich_media_content.js_underline_content img[data-src]"))==null||A.forEach(f=>{f.getAttribute("src")===null&&f.setAttribute("src",f.getAttribute("data-src"))}),e}async parsableArticle(t,e){let a=this.templateEngine.render(this.plugin.settings.parseableArticleNoteTitle,{title:t.articleTitle,date:this.getFormattedDateForFilename(e)}),s=this.templateEngine.render(this.plugin.settings.parsableArticleNote,t);return this.plugin.settings.downloadImages&&tt.Platform.isDesktop&&(s=await Le(this.plugin,q(a),s,this.getAssetsDir(a,e))),new V(a,"md",s,this.plugin.settings.parseableArticleContentType,e)}async notParsableArticle(t,e,a){console.error("Website not parseable");let s=this.templateEngine.render(this.plugin.settings.notParsableArticleNote,{articleURL:t,previewURL:e}),n=this.templateEngine.render(this.plugin.settings.notParseableArticleNoteTitle,{date:this.getFormattedDateForFilename(a)});return this.plugin.settings.downloadImages&&tt.Platform.isDesktop&&(s=await Le(this.plugin,q(n),s,this.getAssetsDir(n,a))),new V(n,"md",s,this.plugin.settings.notParseableArticleContentType,a)}extractPreviewUrl(t){let e=t.querySelector('meta[property="og:image"]');return e==null&&(e=t.querySelector('meta[name="twitter:image"]')),e==null?void 0:e.getAttribute("content")}getAssetsDir(t,e){return this.plugin.settings.downloadImagesInArticleDir?`${this.templateEngine.render(this.plugin.settings.assetsDir,{date:"",fileName:"",contentType:""})}/${q(t)}`:this.templateEngine.render(this.plugin.settings.assetsDir,{date:this.getFormattedDateForFilename(e),fileName:q(t),contentType:this.plugin.settings.parseableArticleContentType})}getEstimatedReadingTime(t){let e=this.getReadingSpeed(t.lang||"en"),a=t.textContent.trim().split(/\s+/).length;return Math.ceil(a/e)}getReadingSpeed(t){let e=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 e.get(t)||e.get("en")}async parseHtmlDom(t,e=null){var h,_;let a=await(0,tt.requestUrl)({method:"GET",url:t.href,headers:{...Ve}}),s=e!=null?e:this.getCharsetFromResponseHeader(a),n=a.arrayBuffer,o=new TextDecoder(s).decode(n),c=new DOMParser().parseFromString(o,"text/html"),d=c.querySelector('meta[charset], meta[http-equiv="Content-Type"]');if(d){let N=d.getAttribute("charset")||((_=(h=d.getAttribute("content"))==null?void 0:h.match(/charset=([^;]+)/i))==null?void 0:_[1]);if(N&&N!==s)return this.parseHtmlDom(t,N)}return c}getCharsetFromResponseHeader(t){var n;let e=(n=t.headers)==null?void 0:n["content-type"],a="UTF-8",s=e==null?void 0:e.match(/charset=([^;]+)/i);return s&&(a=s[1]),a}},ut=ea;var ta=class extends H{test(){return!0}async prepareNote(t){let e=new Date,a=this.templateEngine.render(this.plugin.settings.textSnippetNoteTitle,{date:this.getFormattedDateForFilename(e)}),s=this.templateEngine.render(this.plugin.settings.textSnippetNote,{content:t,date:this.getFormattedDateForContent(e)});return new V(a,"md",s,this.plugin.settings.textSnippetContentType,e)}},Sn=ta;var gt=require("obsidian");var ia={INSTANCE:"/api/v2/instance",OEMBED:"/api/oembed",STATUS:"/api/v1/statuses",CONTEXT:"/api/v1/statuses/%id%/context"},aa=class extends H{async test(t){return Oe(t)&&await this.testIsMastodon(t)}async prepareNote(t){let e=new Date,a=new URL(t),s=a.pathname.split("/")[2],n=await this.loadStatus(a.hostname,s),r=[];this.plugin.settings.saveMastodonReplies&&(r=await this.loadReplies(a.hostname,s));let o=this.templateEngine.render(this.plugin.settings.mastodonNoteTitle,{tootAuthorName:n.account.display_name,date:this.getFormattedDateForFilename(e)}),p;this.plugin.settings.downloadMastodonMediaAttachmentsInDir?(p=this.templateEngine.render(this.plugin.settings.assetsDir,{date:"",fileName:"",contentType:""}),p=`${p}/${q(o)}`):p=this.templateEngine.render(this.plugin.settings.assetsDir,{date:this.getFormattedDateForFilename(e),fileName:q(o),contentType:this.plugin.settings.mastodonContentTypeSlug});let c=await this.getNoteData(n,r,p,q(o),e),d=this.templateEngine.render(this.plugin.settings.mastodonNote,c);return new V(o,"md",d,this.plugin.settings.mastodonContentTypeSlug,e)}async getNoteData(t,e,a,s,n){let r=await this.parseStatus(t,a,s);if(e.length>0)for(let o=0;o<e.length;o++){let p=await this.parseStatus(e[o],a,s),c=this.templateEngine.render(this.plugin.settings.mastodonReply,{tootAuthorName:e[o].account.display_name,tootURL:e[o].url,tootContent:p});r=r.concat(`
***
`,c)}return{date:this.getFormattedDateForContent(n),tootAuthorName:t.account.display_name,tootURL:t.url,tootContent:r,extra:{status:t,replies:e}}}async loadStatus(t,e){return JSON.parse(await(0,gt.request)({method:"GET",contentType:"application/json",url:`https://${t}${ia.STATUS}/${e}`}))}async loadReplies(t,e){let a=String.prototype.concat.call("https://",t,String.prototype.replace.call(ia.CONTEXT,"%id%",e));return JSON.parse(await(0,gt.request)({method:"GET",contentType:"application/json",url:a})).descendants}async parseStatus(t,e,a){let s=await $e(t.content),n=this.plugin.settings.downloadMastodonMediaAttachments&&gt.Platform.isDesktop?await Le(this.plugin,e,this.prepareMedia(t.media_attachments),a):this.prepareMedia(t.media_attachments);return s.concat(n)}prepareMedia(t){return t.reduce((e,{url:a,description:s})=>{let n=s?`
> *${s}*`:"";return`${e}
![](${a})${n}`},"")}async testIsMastodon(t){if(!t)return!1;let e=new URL(t).hostname;try{let a=JSON.parse(await(0,gt.request)({method:"GET",contentType:"application/json",url:`https://${e}${ia.INSTANCE}`}));return(a==null?void 0:a.domain)===e}catch(a){return!1}}},kn=aa;var _n=require("obsidian");var na=class extends H{constructor(){super(...arguments);k(this,"PATTERN",/(tiktok.com)\/(\S+)\/(video)\/(\d+)/)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,s=await this.parseHtml(e,a),n=this.templateEngine.render(this.plugin.settings.tikTokNote,s),r=this.templateEngine.render(this.plugin.settings.tikTokNoteTitle,{authorName:s.authorName,date:this.getFormattedDateForFilename(a)});return new V(r,"md",n,this.plugin.settings.tikTokContentTypeSlug,a)}async parseHtml(e,a){var o,p,c,d;let s=await(0,_n.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"}}),n=new DOMParser().parseFromString(s,"text/html"),r=this.PATTERN.exec(e);return{date:this.getFormattedDateForContent(a),videoId:r[4],videoURL:(p=(o=n.querySelector('meta[property="og:url"]'))==null?void 0:o.getAttribute("content"))!=null?p:e,videoDescription:(d=(c=n.querySelector('meta[property="og:description"]'))==null?void 0:c.getAttribute("content"))!=null?d:"",videoPlayer:`<iframe width="${this.plugin.settings.tikTokEmbedWidth}" height="${this.plugin.settings.tikTokEmbedHeight}" src="https://www.tiktok.com/embed/v2/${r[4]}"></iframe>`,authorName:r[2],authorURL:`https://www.tiktok.com/${r[2]}`}}},Cn=na;var _t=class{constructor(t){k(this,"parsers");this.parsers=t}async createParser(t){for(let e of this.parsers)if(await e.test(t))return e}};var Ct=class extends ut{constructor(){super(...arguments);k(this,"PATTERN",/^https?:\/\/(?:www\.)?github\.com\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+)\/?/i)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new URL(e),s=await this.getDocument(a),n=s.querySelector("article.markdown-body");return n.querySelectorAll('[aria-label^="Permalink:"]').forEach(r=>r.remove()),s.querySelector("body").innerHTML=n.outerHTML,this.makeNote(s,a)}};var Dt=class extends ut{constructor(){super(...arguments);k(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),s=await this.getDocument(a);return s.querySelectorAll(".reference .cite-bracket").forEach(n=>{n.remove()}),s.querySelectorAll(".reference a").forEach(n=>{n.textContent="\xA0"+n.textContent}),s.querySelectorAll(".mw-cite-backlink").forEach(n=>{n.remove()}),s.querySelectorAll(".infobox caption").forEach(n=>{let r=s.createElement("p");r.innerHTML=n.innerHTML,n.parentElement.insertBefore(r,n),n.remove()}),s.querySelectorAll(".wikitable caption").forEach(n=>{let r=s.createElement("p");r.innerHTML=n.innerHTML,n.parentElement.insertBefore(r,n),n.remove()}),this.makeNote(s,a)}};function Rn(i){return i<1e3?String(i):i<1e6?`${Dn(Number(i/1e3),1)}K`:i<1e9?`${Dn(Number(i/1e6),1)}M`:String(i)}function Dn(i,t){return i.toFixed(t).replace(/\.0+$/,"")}var ht=["string","number","bigint","symbol"],ls=/{{(.*?)}}/g,Rt=class{constructor(){k(this,"modifiers");this.modifiers={blockquote:t=>this.validateFilterValueType(t,"blockquote",ht)?t.split(`
`).map(e=>`> ${e}`).join(`
`):t,capitalize:t=>{if(!this.validateFilterValueType(t,"capitalize",ht))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,numberLexify:t=>Rn(t),lower:t=>{if(!this.validateFilterValueType(t,"lower",ht))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",ht)?t.replaceAll(e,a):t,striptags:(t,e="")=>{if(!this.validateFilterValueType(t,"striptags",ht))return t;let a=new RegExp(`<(?!/?(${e.replace(/[<>]/g,"").split(",").join("|")})s*/?)[^>]+>`,"gi");return t.replace(a,"")},upper:t=>{if(!this.validateFilterValueType(t,"upper",ht))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,(s,n)=>{try{let r=this.resolveValue(n,e);return r===void 0?(console.warn(`Unable to resolve ${n}`),s):String(r)}catch(r){return console.warn(`Error processing simple pattern "${s}":`,r),s}})}processVariables(t,e){return t.replace(ls,(a,s)=>{try{let[n,...r]=s.split("|").map(h=>h.trim()),p=/(['"])((?:[^\\]|\\.)*?)\1/.exec(n),c;if(p!==null?c=p[2]:c=this.resolveValue(n,e),c===void 0)return console.warn(`Unable to resolve ${n}`),a;let d=c;for(let h of r)d=this.applyModifier(d,h);return String(d)}catch(n){return console.warn(`Error processing variable "${a}":`,n),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,(s,n,r,o)=>{try{let p=this.resolveValue(r,e);return Array.isArray(p)?p.map(c=>{let d={...e,[n]:c};return this.render(o,d)}).join(""):(console.warn(`Value at "${r}" is not an array`),"")}catch(p){return console.warn(`Error processing loop "${s}":`,p),""}})}resolveValue(t,e){let a=t.trim().split("."),s=e;for(let n of a){if(s==null)return;s=s[n]}return s}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,s]=e,n=s?this.parseArguments(s):[];return{name:a,args:n}}parseArguments(t){let e=[],a="",s=!1,n="",r=!1,o=0,p=!1,c=()=>{(a.trim()||s)&&e.push(this.evaluateArgument(a.trim())),a=""};for(let d=0;d<t.length;d++){let h=t[d];if(p){a+=h,p=!1;continue}switch(h){case"\\":p=!0;break;case'"':case"'":r||(s&&h===n?s=!1:s||(s=!0,n=h)),a+=h;break;case"(":o++,a+=h;break;case")":o--,a+=h;break;case"=":t[d+1]===">"?(r=!0,a+="=>",d++):a+=h;break;case",":!s&&!r&&o===0?c():a+=h;break;default:a+=h}}return(a||s)&&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:s}=this.parseModifier(e);return this.modifiers[a]?this.modifiers[a](t,...s):(console.warn(`Modifier "${a}" not found`),t)}catch(a){return console.warn(`Error applying modifier "${e}":`,a),t}}validateFilterValueType(t,e,a){let s=typeof t;return a.includes(s)?!0:a.includes("array")?Array.isArray(t):(console.warn(`Filter ${e} supports following types ${a.join(", ")}, but ${s} was provided.`),!1)}};var ra=require("obsidian");var Pt=class extends H{constructor(){super(...arguments);k(this,"PATTERN",/^(https?:\/\/(?:(?:www|m)\.)?youtube\.com\/(?:channel\/(UC[\w-]{22})|c\/([^\s\/]+)|@([\w-]+)))(?:\/.*)?$/u)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,s=this.plugin.settings.youtubeApiKey===""?await this.parseSchema(e,a):await this.parseApiResponse(e,a),n=this.templateEngine.render(this.plugin.settings.youtubeChannelNote,s),r=this.templateEngine.render(this.plugin.settings.youtubeChannelNoteTitle,{title:s.channelTitle,date:this.getFormattedDateForFilename(a)});return new V(r,"md",n,this.plugin.settings.youtubeChannelContentTypeSlug,a)}async parseSchema(e,a){var s,n,r,o,p,c,d,h,_,N,C,A,f,P,L,z,x,W,E,I,Y,J,Q,B,ue,Te,O,U,j,ge,w,G,R,ae,we,Ne,Ie,ye,Ee,Ae,he,_e,Ce,K,se;try{let De=await(0,ra.request)({method:"GET",url:e,headers:{...Ve}}),[,xe]=this.PATTERN.exec(e),fe=new DOMParser().parseFromString(De,"text/html"),Re=Jt("ytInitialData",fe.querySelectorAll("script")),M=typeof Re!="undefined"?JSON.parse(Re.value):{},Be=(N=(_=(h=(d=(c=(p=(o=(r=(n=(s=M==null?void 0:M.header)==null?void 0:s.pageHeaderRenderer)==null?void 0:n.content)==null?void 0:r.pageHeaderViewModel)==null?void 0:o.metadata)==null?void 0:p.contentMetadataViewModel)==null?void 0:c.metadataRows)==null?void 0:d[1])==null?void 0:h.metadataParts)==null?void 0:_[0])==null?void 0:N.text.content;Be===null&&console.warn("Unable to parse subscribers count.");let He=(I=(E=(W=(x=(z=(L=(P=(f=(A=(C=M==null?void 0:M.header)==null?void 0:C.pageHeaderRenderer)==null?void 0:A.content)==null?void 0:f.pageHeaderViewModel)==null?void 0:P.metadata)==null?void 0:L.contentMetadataViewModel)==null?void 0:z.metadataRows)==null?void 0:x[1])==null?void 0:W.metadataParts)==null?void 0:E[1])==null?void 0:I.text.content;return He===null&&console.warn("Unable to parse subscribers count."),{date:this.getFormattedDateForContent(a),channelId:(Q=(J=(Y=M==null?void 0:M.metadata)==null?void 0:Y.channelMetadataRenderer)==null?void 0:J.externalId)!=null?Q:"",channelTitle:(Te=(ue=(B=M==null?void 0:M.metadata)==null?void 0:B.channelMetadataRenderer)==null?void 0:ue.title)!=null?Te:"",channelDescription:(j=(U=(O=M==null?void 0:M.metadata)==null?void 0:O.channelMetadataRenderer)==null?void 0:U.description)!=null?j:"",channelURL:xe,channelAvatar:(we=(ae=(R=(G=(w=(ge=M==null?void 0:M.metadata)==null?void 0:ge.channelMetadataRenderer)==null?void 0:w.avatar)==null?void 0:G.thumbnails)==null?void 0:R[0])==null?void 0:ae.url)!=null?we:"",channelBanner:(se=(K=(Ce=(_e=(he=(Ae=(Ee=(ye=(Ie=(Ne=M==null?void 0:M.header)==null?void 0:Ne.pageHeaderRenderer)==null?void 0:Ie.content)==null?void 0:ye.pageHeaderViewModel)==null?void 0:Ee.banner)==null?void 0:Ae.imageBannerViewModel)==null?void 0:he.image)==null?void 0:_e.sources)==null?void 0:Ce[0])==null?void 0:K.url)!=null?se:"",channelSubscribersCount:this.parseNumberValue(Be!=null?Be:""),channelVideosCount:this.parseNumberValue(He!=null?He:""),channelVideosURL:`${xe}/videos`,channelShortsURL:`${xe}/shorts`}}catch(De){Ue(De,"Unable to parse Youtube channel schema from DOM.")}}async parseApiResponse(e,a){var c,d,h,_,N;let s=new URL("https://youtube.googleapis.com/youtube/v3/channels?part=snippet,contentDetails,statistics,brandingSettings"),[,n,r,o,p]=this.PATTERN.exec(e);if(r)s.searchParams.append("id",r);else if(p)s.searchParams.append("forHandle",p);else if(o){let C=await this.parseSchema(e,a);s.searchParams.append("id",C.channelId)}else throw new Error("Unable to compose Youtube API URL");s.searchParams.append("key",this.plugin.settings.youtubeApiKey);try{let C=await(0,ra.request)({method:"GET",url:s.toString(),headers:{Accept:"application/json"}}),A=JSON.parse(C);if(A.items.length===0)throw new Error(`Channel (${e}) cannot be fetched from API`);let f=A.items[0];return{date:this.getFormattedDateForContent(a),channelId:f.id,channelTitle:f.snippet.title,channelDescription:f.snippet.description,channelURL:n,channelAvatar:(d=(c=f.snippet.thumbnails)==null?void 0:c.high.url)!=null?d:f.snippet.thumbnails.default.url,channelBanner:(N=(_=(h=f.brandingSettings)==null?void 0:h.image)==null?void 0:_.bannerExternalUrl)!=null?N:"",channelSubscribersCount:f.statistics.subscriberCount,channelVideosCount:f.statistics.videoCount,channelVideosURL:`${n}/videos`,channelShortsURL:`${n}/shorts`}}catch(C){Ue(C,"Unable to parse Youtube channel API response.")}}parseNumberValue(e){let a=/(\d+(?:\.\d+)?)(K|M|B)?/,s=e.match(a);if(!s)return 0;let[,n,r]=s;if(typeof r=="undefined")return Number(n);switch(r){case"K":return Number(n)*1e3;case"M":return Number(n)*1e6;case"B":return Number(n)*1e9}}};var de=require("obsidian");var ft=class extends Error{constructor(t){super(t),this.name="FileNotFoundError"}};var Ge=class extends Error{constructor(t){super(t),this.name="FileExistsError"}};var Lt=class{constructor(t,e){k(this,"plugin");k(this,"templateEngine");this.plugin=t,this.templateEngine=e}async saveNote(t){let e;if(this.plugin.app.vault.adapter instanceof de.CapacitorAdapter||this.plugin.app.vault.adapter instanceof de.FileSystemAdapter?e=St("/",t.getFullFilename(),this.plugin.app.vault.adapter,this.plugin.getFileSystemLimits()):e=(0,de.normalizePath)(`/${t.getFullFilename()}`),this.plugin.settings.inboxDir){let a=this.templateEngine.render(this.plugin.settings.inboxDir,{date:kt(t.createdAt,this.plugin.settings.dateTitleFmt),fileName:t.fileName,contentType:t.contentType});await this.createDirectory(a),this.plugin.app.vault.adapter instanceof de.CapacitorAdapter||this.plugin.app.vault.adapter instanceof de.FileSystemAdapter?e=St(a,t.getFullFilename(),this.plugin.app.vault.adapter,this.plugin.getFileSystemLimits()):e=(0,de.normalizePath)(`${a}/${t.getFullFilename()}`)}if(t.filePath=e,await this.exists(t.filePath))throw new Ge(`${t.getFullFilename()} already exists!`);{let a=await this.plugin.app.vault.create(t.filePath,t.content);(this.plugin.settings.openNewNote||this.plugin.settings.openNewNoteInNewTab)&&this.plugin.app.workspace.getLeaf(this.plugin.settings.openNewNoteInNewTab?"tab":!1).openFile(a),new de.Notice(`${t.getFullFilename()} created successfully`)}}async createDirectory(t){let e=(0,de.normalizePath)(t),a=this.plugin.app.vault.getAbstractFileByPath(e);a&&a instanceof de.TFolder||await this.plugin.app.vault.createFolder(e)}async exists(t){return await this.plugin.app.vault.adapter.exists(t)}getFileByPath(t){let e=this.plugin.app.vault.getFileByPath(t);if(e===null)throw new ft(`File not found: ${t}`);return e}async appendToExistingNote(t){let e;try{e=this.getFileByPath(t.filePath)}catch(a){if(a instanceof ft)new de.Notice(`Unable to edit ${t.getFullFilename()}`);else throw a}await this.plugin.app.vault.process(e,a=>`${a}
${t.content}`)}};var Mt=require("obsidian");var It=require("obsidian");var Ft=class extends It.Modal{constructor(t,e,a){super(t),this.setTitle("Duplicate notes detected");let s=e.map(r=>`<li>${r.fileName}</li>`).join("");this.setContent(Xt(`<ul>${s}</ul>`));let n=!1;new It.Setting(this.contentEl).setName("Do not ask again").addToggle(r=>{r.setValue(!1).onChange(()=>n=!0)}),new It.Setting(this.contentEl).addButton(r=>r.setButtonText("Append to existing").setCta().onClick(()=>{this.close(),a("appendToExisting",n)})).addButton(r=>r.setButtonText("Nothing").onClick(()=>{this.close(),a("nothing",n)}))}};var ni=class{constructor(t,e,a){this.parserCreator=t;this.plugin=e;this.repository=a}async createNote(t){let e=await this.makeNote(t);try{await this.repository.saveNote(e)}catch(a){a instanceof Ge&&this.handleFileExistsError([e])}}async createNotesFromBatch(t){let e=vn(t,this.plugin.settings.batchProcessDelimiter),a=[];for(let s of e.everyLineIsURL?e.urls:[t]){let n=await this.makeNote(s);try{await this.repository.saveNote(n)}catch(r){r instanceof Ge&&a.push(n)}}a.length>0&&this.handleFileExistsError(a)}async insertContentAtEditorCursorPosition(t,e){let a=await this.makeNote(t);e.replaceRange(a.content,e.getCursor())}async makeNote(t){return await(await this.parserCreator.createParser(t)).prepareNote(t)}openNote(t){if(this.plugin.settings.openNewNote||this.plugin.settings.openNewNoteInNewTab)try{let e=this.repository.getFileByPath(t.filePath);this.plugin.app.workspace.getLeaf(this.plugin.settings.openNewNoteInNewTab?"tab":!1).openFile(e)}catch(e){console.error(e),new Mt.Notice(`Unable to open ${t.getFullFilename()}`)}}async handleFileExistsError(t){switch(this.plugin.settings.fileExistsStrategy){case"ask":new Ft(this.plugin.app,t,(e,a)=>{this.handleFileAskModalResponse(e,a,t)}).open();break;case"nothing":this.handleFileExistsStrategyNothing(t);break;case"appendToExisting":this.handleFileExistsStrategyAppend(t);break}}async handleFileAskModalResponse(t,e,a){switch(t){case"nothing":this.handleFileExistsStrategyNothing(a);break;case"appendToExisting":this.handleFileExistsStrategyAppend(a);break}e&&this.plugin.saveSetting("fileExistsStrategy",t),a.length===1&&this.openNote(a.shift())}async handleFileExistsStrategyAppend(t){for(let e of t)try{await this.repository.appendToExistingNote(e),new Mt.Notice(`${e.getFullFilename()} was updated.`)}catch(a){console.error(a),new Mt.Notice(`${e.getFullFilename()} was not updated!`,0)}}handleFileExistsStrategyNothing(t){for(let e of t)new Mt.Notice(`${e.getFullFilename()} already exists.`)}};var ri=class{constructor(t){this.noteService=t}async processContent(t){this.noteService.createNote(t)}async processContentBatch(t){this.noteService.createNotesFromBatch(t)}async insertContentAtEditorCursorPosition(t,e){this.noteService.insertContentAtEditorCursorPosition(t,e)}};var Ye=require("obsidian");var si=class extends H{constructor(){super(...arguments);k(this,"PATTERN",/^https:\/\/bsky\.app\/profile\/(?<handle>[a-zA-Z0-9-.:]+)\/post\/(?<postId>[a-zA-Z0-9]+)/);k(this,"AT_URI_PATTERN",/^at:\/\/(?<handle>(?:did:plc:[a-zA-Z0-9]+|[a-zA-Z0-9.-]+(?:\.[a-zA-Z0-9.-]+)*?))\/(?<collection>[a-zA-Z.]+)\/(?<rkey>[a-zA-Z0-9]+)$/)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,s=await this.loadPost(e),n=this.formatPostContent(s,a,this.plugin.settings.blueskyNote);this.plugin.settings.saveBlueskyPostReplies&&s.replies.forEach(o=>{n=n.concat(`
***
`,this.formatPostContent(o,a,this.plugin.settings.blueskyPostReply))});let r=this.templateEngine.render(this.plugin.settings.blueskyNoteTitle,{date:this.getFormattedDateForFilename(a),authorHandle:s.author.handle,authorName:q(s.author.displayName,!1)});if(this.plugin.settings.downloadBlueskyEmbeds){let o;this.plugin.settings.downloadBlueskyEmbedsInDir?(o=this.templateEngine.render(this.plugin.settings.assetsDir,{date:"",fileName:"",contentType:""}),o=`${o}/${q(r)}`):o=this.templateEngine.render(this.plugin.settings.assetsDir,{date:this.getFormattedDateForFilename(a),fileName:q(r),contentType:this.plugin.settings.mastodonContentTypeSlug}),n=await Le(this.plugin,q(r),n,o)}return new V(r,"md",n,this.plugin.settings.blueskyContentTypeSlug,a)}async loadPost(e){var a,s,n;try{let r=this.getPostUri(this.getPostIdFromUrl(e)),o=JSON.parse(await(0,Ye.request)({method:"GET",contentType:"application/json",url:`https://public.api.bsky.app/xrpc/app.bsky.feed.getPostThread?uri=${r}`})),p=[];return o.thread.replies.forEach(c=>{var h,_,N;let d=this.getPostUrl(this.getPostIdFromAtUri(c.post.uri));p.push({url:d,content:c.post.record.text,author:{...c.post.author},embeds:Object.prototype.hasOwnProperty.call(c.post,"embed")?this.makeEmbeds(c.post.embed,d):[],likeCount:c.post.likeCount,replyCount:c.post.replyCount,repostCount:c.post.repostCount,quoteCount:c.post.replyCount,publishedAt:(0,Ye.moment)(c.post.record.createdAt).toDate(),facets:(N=(_=(h=c.post.record)==null?void 0:h.facets)==null?void 0:_.map(C=>this.makeFacet(C)))!=null?N:[]})}),{url:e,content:o.thread.post.record.text,author:{...o.thread.post.author},embeds:Object.prototype.hasOwnProperty.call(o.thread.post,"embed")?this.makeEmbeds(o.thread.post.embed,e):[],likeCount:o.thread.post.likeCount,replyCount:o.thread.post.replyCount,repostCount:o.thread.post.repostCount,quoteCount:o.thread.post.replyCount,publishedAt:(0,Ye.moment)(o.thread.post.record.createdAt).toDate(),facets:(n=(s=(a=o.thread.post.record)==null?void 0:a.facets)==null?void 0:s.map(c=>this.makeFacet(c)))!=null?n:[],replies:p}}catch(r){Ue(r,"Unable to parse Bluesky API response.")}}makeEmbeds(e,a){var r,o,p;let s=[];switch(e.$type){case"app.bsky.embed.images#view":e.images.forEach(c=>{s.push({type:"image",url:c.fullsize,thumbnail:c.thumb,title:"",description:c.alt})});break;case"app.bsky.embed.video#view":s.push({type:"video",url:a,thumbnail:e.thumbnail,title:"",description:""});break;case"app.bsky.embed.external#view":s.push({type:"external",url:e.external.uri,thumbnail:e.external.thumb,title:((r=e.external)==null?void 0:r.title)||"",description:e.external.description||""});break;case"app.bsky.embed.record#view":s.push({type:"record",url:this.getPostUrl(this.getPostIdFromAtUri(e.record.uri)),thumbnail:"",title:`Post from ${((o=e.record.author)==null?void 0:o.displayName)||e.record.author.handle}`,description:e.record.value.text});break;case"app.bsky.embed.record#viewRecord":s.push({type:"record",url:this.getPostUrl(this.getPostIdFromAtUri(e.uri)),thumbnail:"",title:`Post from ${((p=e.author)==null?void 0:p.displayName)||e.author.handle}`,description:e.value.text});break;case"app.bsky.embed.recordWithMedia#view":if(Object.prototype.hasOwnProperty.call(e,"media")){let c=this.makeEmbeds(e.media,a);c&&s.push(...c)}if(Object.prototype.hasOwnProperty.call(e,"record")){let c=this.makeEmbeds(e.record.record,a);c&&s.push(...c)}break}return s}makeFacet(e){var a,s,n,r;switch((a=e.features)==null?void 0:a[0].$type){case"app.bsky.richtext.facet#mention":return{type:"mention",did:(s=e.features)==null?void 0:s[0].did,byteStart:e.index.byteStart,byteEnd:e.index.byteEnd};case"app.bsky.richtext.facet#link":return{type:"link",uri:(n=e.features)==null?void 0:n[0].uri,byteStart:e.index.byteStart,byteEnd:e.index.byteEnd};case"app.bsky.richtext.facet#tag":return{type:"tag",tag:(r=e.features)==null?void 0:r[0].tag,byteStart:e.index.byteStart,byteEnd:e.index.byteEnd}}throw new Error(`Unrecognized facet type ${e}`)}formatPostContent(e,a,s){let n="";e.embeds.forEach(o=>{let p;switch(o.type){case"video":p=`[Watch video on Bluesky](${o.url})`;break;case"external":case"record":o.url.startsWith("https://media.tenor.com")?p=`![${o.title}](${o.url})`:o.thumbnail?p=`![${o.title}](${o.thumbnail})
${o.description}
${o.url}`:p=`[${o.title}](${o.url})
${o.description}`;break;default:p=`![](${o.thumbnail})`}n=n.concat(p,`
`)});let r=this.replaceFacets(e)+`
`+n;return this.renderPost(s,{date:this.getFormattedDateForContent(a),content:r.trim(),postURL:e.url,authorHandle:e.author.handle,authorName:e.author.displayName||e.author.handle,likeCount:e.likeCount,replyCount:e.replyCount,repostCount:e.repostCount,quoteCount:e.quoteCount,publishedAt:this.getFormattedDateForContent(e.publishedAt),extra:{post:e}})}replaceFacets(e){if(e.facets.length===0)return e.content;let a=new TextEncoder,s=new TextDecoder,n=a.encode(e.content),r=[...e.facets].sort((c,d)=>c.byteStart-d.byteStart),o="",p=0;for(let c of r){o+=s.decode(n.slice(p,c.byteStart));let d=s.decode(n.slice(c.byteStart,c.byteEnd));switch(c.type){case"mention":o+=`[${d}](https://bsky.app/profile/${c.did})`;break;case"link":o+=`[${d}](${c.uri})`;break;case"tag":o+=`[${d}](https://bsky.app/search?q=${encodeURIComponent(c.tag)})`;break}p=c.byteEnd}return p<n.length&&(o+=s.decode(n.slice(p))),o}renderPost(e,a){return this.templateEngine.render(e,a)}getPostUrl(e){return`https://bsky.app/profile/${e.handle}/post/${e.id}`}getPostUri(e){return`at://${e.handle}/app.bsky.feed.post/${e.id}`}getPostIdFromUrl(e){let a=e.match(this.PATTERN);if(!a){let s=`Unable to determine handle and id from provided url ${e}`;throw new Ye.Notice(s),new Error(s)}return{handle:a.groups.handle,id:a.groups.postId}}getPostIdFromAtUri(e){let a=e.match(this.AT_URI_PATTERN);if(!a){let s=`Unable to determine handle and id from provided AT uri ${e}`;throw new Ye.Notice(s),new Error(s)}return{handle:a.groups.handle,id:a.groups.rkey}}};var Pn=require("obsidian");var oi=class extends H{constructor(){super(...arguments);k(this,"PATTERN",/^https?:\/\/(?:[a-z]{2}\.|www\.)?pinterest\.(?:com|ca|co\.uk|fr|de|es|it)\/pin\/(\d+)\/?/i)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,s;try{s=await this.parseHtml(e)}catch(o){Ue(o,"Unable to parse Pinterest note data.")}let n=this.templateEngine.render(this.plugin.settings.pinterestNoteTitle,{date:this.getFormattedDateForFilename(a),authorName:s.author.fullName||s.author.username}),r=this.renderContent({date:this.getFormattedDateForContent(a),pinId:s.id,pinURL:s.url,title:s.title,link:s.link,image:s.image,description:s.description,likeCount:s.likeCount,authorName:s.author.fullName||s.author.username,authorProfileURL:s.author.profileURL});if(this.plugin.settings.downloadPinterestImage){let o=this.templateEngine.render(this.plugin.settings.assetsDir,{date:this.getFormattedDateForFilename(a),fileName:q(n),contentType:this.plugin.settings.pinterestContentTypeSlug});r=await Le(this.plugin,q(n),r,o)}return new V(n,"md",r,this.plugin.settings.pinterestContentTypeSlug,a)}renderContent(e){return this.templateEngine.render(this.plugin.settings.pinterestNote,e)}async parseHtml(e){var c,d,h,_,N,C,A,f,P,L,z,x,W,E,I,Y,J,Q,B,ue,Te,O,U,j,ge,w;let a=await(0,Pn.request)({method:"GET",url:e,headers:{...Ve}}),s=new DOMParser().parseFromString(a,"text/html"),n=s.querySelectorAll("[data-relay-response='true']"),r;n.forEach(G=>{var ae;let R=JSON.parse(G.textContent);((ae=R==null?void 0:R.variables)==null?void 0:ae.isDesktop)===!0&&(r=R)}),r===void 0&&(r=(c=JSON.parse(n==null?void 0:n[0].textContent))!=null?c:{});let o=(_=(h=(d=r==null?void 0:r.response)==null?void 0:d.data)==null?void 0:h.v3GetPinQuery)==null?void 0:_.data;if(o===void 0)throw new Error("pinJsonData is undefined");let p=(C=(N=o==null?void 0:o.originPinner)!=null?N:o==null?void 0:o.pinner)!=null?C:{};return{id:e.match(this.PATTERN)[1],url:e,title:(P=(f=o==null?void 0:o.title)!=null?f:(A=s.querySelector("h1"))==null?void 0:A.textContent)!=null?P:"",description:(x=(z=o==null?void 0:o.descriotion)!=null?z:(L=s.querySelector("[data-test-id='truncated-description'] div div"))==null?void 0:L.textContent)!=null?x:"",link:(Y=(E=o==null?void 0:o.link)!=null?E:(W=s.querySelector("meta[property='pinterestapp:source']"))==null?void 0:W.getAttribute("content"))!=null?Y:(I=s.querySelector("meta[property='og:see_also']"))==null?void 0:I.getAttribute("content"),image:(ue=(B=(J=o==null?void 0:o.imageSpec_orig)==null?void 0:J.url)!=null?B:(Q=s.querySelector("[data-test-id='pin-closeup-image'] img"))==null?void 0:Q.getAttribute("src"))!=null?ue:"",author:{fullName:(Te=p==null?void 0:p.fullName)!=null?Te:"",username:(O=p==null?void 0:p.username)!=null?O:"",profileURL:`https://www.pinterest.com/${(U=p==null?void 0:p.username)!=null?U:""}`},likeCount:(w=(ge=(j=o==null?void 0:o.reactionCountsData)==null?void 0:j.find(G=>(G==null?void 0:G.reactionType)===1))==null?void 0:ge.reactionCount)!=null?w:0}}};var li=class extends vt.Plugin{constructor(){super(...arguments);k(this,"api");k(this,"settings");k(this,"fileSystemLimits");k(this,"noteService");k(this,"parserCreator");k(this,"templateEngine");k(this,"vaultRepository")}getFileSystemLimits(){return this.fileSystemLimits}getVaultRepository(){return this.vaultRepository}async onload(){await this.loadSettings(),this.fileSystemLimits=za(vt.Platform,this.settings),this.templateEngine=new Rt,this.parserCreator=new _t([new Ya(this.app,this,this.templateEngine),new Pt(this.app,this,this.templateEngine),new Ka(this.app,this,this.templateEngine),new Za(this.app,this,this.templateEngine),new hn(this.app,this,this.templateEngine),new bn(this.app,this,this.templateEngine),new Cn(this.app,this,this.templateEngine),new Ct(this.app,this,this.templateEngine),new Dt(this.app,this,this.templateEngine),new si(this.app,this,this.templateEngine),new oi(this.app,this,this.templateEngine),new kn(this.app,this,this.templateEngine),new ut(this.app,this,this.templateEngine),new Sn(this.app,this,this.templateEngine)]),this.vaultRepository=new Lt(this,this.templateEngine),this.noteService=new ni(this.parserCreator,this,this.vaultRepository),this.api=new ri(this.noteService),(0,vt.addIcon)("read-it-later",ps),this.addRibbonIcon("read-it-later","ReadItLater: Create from clipboard",async()=>{await this.api.processContent(await this.getTextClipboardContent())}),this.addCommand({id:"save-clipboard-to-notice",name:"Create from clipboard",callback:async()=>{await this.api.processContent(await this.getTextClipboardContent())}}),this.addCommand({id:"create-from-clipboard-batch",name:"Create from batch in clipboard",callback:async()=>{await this.api.processContentBatch(await this.getTextClipboardContent())}}),this.addCommand({id:"insert-at-cursor",name:"Insert at the cursor position",editorCallback:async e=>{await this.api.insertContentAtEditorCursorPosition(await this.getTextClipboardContent(),e)}}),this.addSettingTab(new Kt(this.app,this)),this.settings.extendShareMenu&&this.registerEvent(this.app.workspace.on("receive-text-menu",(e,a)=>{e.addItem(s=>{s.setTitle("ReadItLater"),s.setIcon("read-it-later"),s.onClick(()=>this.api.processContent(a))})})),this.registerEvent(this.app.workspace.on("url-menu",(e,a)=>{Oe(a,[mt,dt])&&e.addItem(s=>{s.setTitle("ReadItLater"),s.setIcon("read-it-later"),s.onClick(()=>this.api.processContent(a))})}))}async loadSettings(){this.settings=Object.assign({},m,await this.loadData())}async saveSetting(e,a){this.settings[e]=a,await this.saveSettings()}async saveSettings(){await this.saveData(this.settings)}async getTextClipboardContent(){return await navigator.clipboard.readText()}},ps=`
<svg fill="currentColor" stroke="currentColor" version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
<g>
<path d="m365.9,144.9c-12.3,0-24.2,1.8-35.4,5.2v-114.7h-96.9l7.3-35.4h-150.2l6.8,35.4h-97.5v454.6h330.5v-102.1c11.2,3.4 23.1,5.2 35.4,5.2 68.8-0.1 124.1-56.4 124.1-124.1 0-67.8-55.3-124.1-124.1-124.1zm-150.1-124l-10.4,50h-79.2l-9.4-50h99zm93.8,448.2h-288.7v-412.8h80.7l6.8,35.4h113.6l7.3-35.4h80.3v102.2c-27.3,14-48.8,37.9-59.7,66.7h-200.9v20.8h195c-1.4,7.4-2.2,15.1-2.2,22.9 0,13.4 2.2,26.4 6.2,38.6h-199v20.9h208.1c12,21.8 30.3,39.7 52.5,51.1v89.6zm56.3-98c-57.3,0-103.2-46.9-103.2-103.2s46.9-103.2 103.2-103.2c57.3,0 103.2,46.9 103.2,103.2s-45.8,103.2-103.2,103.2z"/>
<polygon points="426.4,223.1 346.1,303.4 313.8,271.1 299.2,285.7 346.1,332.6 441,237.7 "/>
<rect width="233.5" x="49" y="143.9" height="20.9"/>
<rect width="233.5" x="49" y="388.9" height="20.9"/>
</g>
</svg>`;
/*! Bundled license information:
dompurify/dist/purify.js:
(*! @license DOMPurify 2.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 *)
*/
/* nosourcemap */