From 528c0a10de388a17c20cf7c6ee403f0c4e4ef36e Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Fri, 22 Sep 2023 10:22:24 +0500 Subject: [PATCH] mobile: skip clipping images from webpage --- .../ios/extension.bundle/clipper.bundle.js | 2 +- apps/mobile/share/fetch-webview.js | 71 +++++++++++-------- apps/mobile/share/share.js | 3 +- 3 files changed, 45 insertions(+), 31 deletions(-) diff --git a/apps/mobile/native/ios/extension.bundle/clipper.bundle.js b/apps/mobile/native/ios/extension.bundle/clipper.bundle.js index 528a2eb9a..a8b3ecc49 100644 --- a/apps/mobile/native/ios/extension.bundle/clipper.bundle.js +++ b/apps/mobile/native/ios/extension.bundle/clipper.bundle.js @@ -1 +1 @@ -(()=>{var e={110:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isSVGElement=t.cloneNode=void 0;const r=n(32),o=n(787),s=["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"].map((e=>e.toLowerCase())),a=["script"].map((e=>e.toLowerCase()));function l(e){return!(!e||!e.tagName)&&s.includes(e.tagName.toLowerCase())}t.cloneNode=function e(t,n){return i(this,void 0,void 0,(function*(){const{root:c,filter:u}=n;if(!c&&u&&!u(t))return null;let d=yield function(e,t){try{if(e instanceof HTMLCanvasElement)return(0,r.createImage)(e.toDataURL(),t);if(e.nodeType===Node.COMMENT_NODE)return null;if((n=e)&&n.tagName&&a.includes(n.tagName.toLowerCase()))return null;if(e.nodeType!==Node.TEXT_NODE&&!l(e)){const{display:t,width:n,height:i}=window.getComputedStyle(e);if("none"===t||"0px"===n&&"0px"===i)return null;if(function(e){return!(!e||!e.tagName)&&!s.includes(e.tagName.toLowerCase())&&e.tagName.includes("-")}(e)){const n=t.includes("inline"),i=document.createElement(n?"span":"div");for(const t of e.attributes)i.setAttribute(t.name,t.value);return i}}return e.cloneNode(!1)}catch(e){return console.error("Failed to clone element",e),null}var n}(t,n.fetchOptions);if(!d)return null;d=yield function(t,n,r){return i(this,void 0,void 0,(function*(){const o=t.childNodes;return 0===o.length||(yield function(t,n,r){return i(this,void 0,void 0,(function*(){for(const i of n){const n=yield e(i,Object.assign(Object.assign({},r),{root:!1}));n&&t.appendChild(n)}}))}(n,o,r)),n}))}(t,d,n);const h=function(e,t,n){return t instanceof Element?(n.styles&&(function(e,t,n){const{getElementStyles:i}=n,r=i&&i(e);if(!r)return;var o,s;t.style.cssText=r.cssText,"body"===e.tagName.toLowerCase()&&(o=getComputedStyle(e),(s=t.style).font=o.font,s.fontFamily=o.fontFamily,s.fontFeatureSettings=o.fontFeatureSettings,s.fontKerning=o.fontKerning,s.fontSize=o.fontSize,s.fontStretch=o.fontStretch,s.fontStyle=o.fontStyle,s.fontVariant=o.fontVariant,s.fontVariantCaps=o.fontVariantCaps,s.fontVariantEastAsian=o.fontVariantEastAsian,s.fontVariantLigatures=o.fontVariantLigatures,s.fontVariantNumeric=o.fontVariantNumeric,s.fontVariationSettings=o.fontVariationSettings,s.fontWeight=o.fontWeight);const a=t.getAttribute("style");a&&t.setAttribute("style",a.replace(/(:?[:;])(:? +)/gm,((e,t)=>t)))}(e,t,n),function(e,t,n){const{getPseudoElementStyles:i}=n;let r=!1;const s=document.createElement("style"),a=`pseudo--${(0,o.uid)()}`;for(const t of[":before",":after"]){const n=i&&i(e,t)||getComputedStyle(e,t);if(!n.cssText)continue;const o=`.${a}:${t} {\n ${n.cssText}\n }`;s.appendChild(document.createTextNode(o)),r=!0}r&&(t.className=a,t.appendChild(s))}(e,t,n)),function(e){const t=["href","src"],n=window.location.href;for(const i of t){const t=e.getAttribute(i),r=(null==t?void 0:t.startsWith("http"))?void 0:t;if(r){const t=new URL(r,n).href;e.setAttribute(i,t)}}}(t),function(e,t){(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&t.setAttribute("value",e.value)}(e,t),function(e){e instanceof SVGElement&&(e.setAttribute("xmlns","http://www.w3.org/2000/svg"),["width","height"].forEach((function(t){const n=e.getAttribute(t);n&&!e.style.getPropertyValue(t)&&e.style.setProperty(t,n)})))}(t),t):t}(t,d,n);return h}))},t.isSVGElement=l},136:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tokenize=void 0;const n=String.fromCharCode;function i(e,t){return 0|e.charCodeAt(t)}function r(e,t){return t.push(e),e}let o=1,s=1,a=0,l=0,c=0,u="";function d(){return c=l'+(0,l.escapeXhtml)((new XMLSerializer).serializeToString(e))+""}(n,t.width||(0,l.width)(e),t.height||(0,l.height)(e))}))}function f(e,t){return t=Object.assign(Object.assign({},u),t),h(e,t).then((e=>e?(0,o.createImage)(e,t.fetchOptions):null)).then((0,l.delay)(0)).then((function(n){const i="number"!=typeof t.scale?1:t.scale,r=function(e,t,n){const i=document.createElement("canvas");if(i.width=(n.width||(0,l.width)(e))*t,i.height=(n.height||(0,l.height)(e))*t,n.backgroundColor){const e=i.getContext("2d");if(!e)return null;e.fillStyle=n.backgroundColor,e.fillRect(0,0,i.width,i.height)}return i}(e,i,t),o=null==r?void 0:r.getContext("2d");return o?(o.imageSmoothingEnabled=!1,n&&(o.scale(i,i),o.drawImage(n,0,0)),r):null}))}t.getInlinedNode=d,t.toSvg=h,t.toPixelData=function(e,t){return(t=t||{}).raster=!0,f(e,t).then((function(t){var n;return null===(n=null==t?void 0:t.getContext("2d"))||void 0===n?void 0:n.getImageData(0,0,(0,l.width)(e),(0,l.height)(e)).data}))},t.toPng=function(e,t){return t.raster=!0,f(e,t).then((function(e){return null==e?void 0:e.toDataURL()}))},t.toJpeg=function(e,t){return t.raster=!0,f(e,t).then((function(e){return null==e?void 0:e.toDataURL("image/jpeg",t.quality||1)}))},t.toBlob=function(e,t){return t.raster=!0,f(e,t).then((e=>e&&(0,l.canvasToBlob)(e)))},t.toCanvas=function(e,t){return t.raster=!0,f(e,t)};const g=["src","href","title","style","srcset","sizes","width","height","target","rel"]},32:function(e,t){"use strict";var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};function i(e,t){if(!e.startsWith("http"))return e;if((null==t?void 0:t.noCache)&&(e+=(/\?/.test(e)?"&":"?")+Date.now()),(null==t?void 0:t.bypassCors)&&(null==t?void 0:t.corsHost)){if(e.startsWith(t.corsHost))return e;e=`${t.corsHost}/${e}`}return e}Object.defineProperty(t,"__esModule",{value:!0}),t.constructUrl=t.reloadImage=t.createImage=t.fetchResource=void 0,t.fetchResource=function(e,t){return n(this,void 0,void 0,(function*(){if(!e)return null;const n=yield fetch(i(e,t));if(!n.ok)return"";const r=yield n.blob(),o=new FileReader;return o.readAsDataURL(r),new Promise((e=>{o.addEventListener("loadend",(()=>{"string"==typeof o.result&&e(o.result)}))}))}))},t.createImage=function(e,t){return"data:,"===e?Promise.resolve(null):new Promise((function(n,r){const o=new Image;o.crossOrigin=(null==t?void 0:t.crossOrigin)||null,o.onload=function(){n(o)},o.onerror=r,o.src=i(e,t)}))},t.reloadImage=function(e,t){return t.corsHost&&e.currentSrc.startsWith(t.corsHost)?Promise.resolve(null):(t.noCache=!0,new Promise((function(n,r){e.crossOrigin=t.crossOrigin||null,e.onload=function(){n(e)},e.onerror=t=>{console.error("Failed to load image",e.currentSrc),r(t)},e.src=i(e.currentSrc,t)})))},t.constructUrl=i},663:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.resolveAll=void 0;const r=n(783);function o(e){return{resolve:function(t){const n=(e.parentStyleSheet||{}).href||void 0;return(0,r.inlineAll)(e.cssText,t,n)},src:function(){return e.style.getPropertyValue("src")}}}function s(e){return e.filter((function(e){return e.type===CSSRule.FONT_FACE_RULE})).filter((function(e){return(0,r.shouldProcess)(e.style.getPropertyValue("src"))}))}t.resolveAll=function(e){return i(this,void 0,void 0,(function*(){const t=s(function(e){const t=[];for(const n of e)try{const e=s(Array.from(n.cssRules));e.length>3&&t.push(e[0])}catch(e){e instanceof Error&&console.log("Error while reading CSS rules from "+n.href,e.toString())}return t}(document.styleSheets)).map(o),n=[];for(const i of t)n.push(yield i.resolve(e));return n.join("\n")}))}},261:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.inlineAllImages=void 0;const r=n(32),o=n(783),s=n(787);function a(e,t){return i(this,void 0,void 0,(function*(){if((0,s.isDataUrl)(e.currentSrc))return Promise.resolve(null);const n=yield(0,r.fetchResource)(e.currentSrc||e.src,t);return n?"data:,"===n?(e.removeAttribute("src"),e):new Promise((function(t,i){var r,o;"PICTURE"===(null===(r=e.parentElement)||void 0===r?void 0:r.tagName)&&(null===(o=e.parentElement)||void 0===o||o.replaceWith(e)),e.onload=()=>t(e),e.onerror=e=>i(e),e.src=n,e.removeAttribute("srcset")})):null}))}function l(e,t){return i(this,void 0,void 0,(function*(){const n=e.style.getPropertyValue("background-image");if(!n)return e;const i=yield(0,o.inlineAll)(n,t);return e.style.setProperty("background-image",i),e}))}t.inlineAllImages=function(e,t){return i(this,void 0,void 0,(function*(){const n=e.querySelectorAll("img"),i=[];for(let e=0;econsole.error(e)))}))}},590:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.enterNodeSelectionMode=t.clipScreenshot=t.cleanup=t.clipArticle=t.clipPage=void 0;const r=n(107),o=n(787),s=n(482),a=n(917),l={nodeHover:"nn-node-selection--hover",nodeSelected:"nn-node-selection--selected",nodeSelectionContainer:"nn-node-selection-container"},c=[l.nodeSelected,l.nodeSelectionContainer],u={fonts:!1,images:!0,stylesheets:!0};function d(e){for(const t of c)if(e.classList.contains(t)||e.closest(`.${t}`))return!1;return!0}t.clipPage=function(e,t,n){return i(this,void 0,void 0,(function*(){const{body:i,head:r}=yield v(e,n,t);return i&&r?`\n${m(r,i).documentElement.outerHTML}`:null}))},t.clipArticle=function(e,t){return i(this,void 0,void 0,(function*(){const{body:n,head:i}=yield v(e,t);if(!n||!i)return null;const o=m(i,n),s=new r.Readability(o);s.PRESENTATIONAL_ATTRIBUTES=["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","valign","vspace"];const a=s.parse();return`${(null==i?void 0:i.outerHTML)||""}${(null==a?void 0:a.content)||""}`}))},t.clipScreenshot=function(e,t="jpeg",n){return i(this,void 0,void 0,(function*(){const i=e||document.body,r="jpeg"===t?a.toJpeg:"png"===t?a.toPng:a.toBlob,o=yield r(i,{quality:1,backgroundColor:"white",width:document.body.scrollWidth,height:document.body.scrollHeight,fetchOptions:b(n),inlineOptions:{fonts:!0,images:!0,stylesheets:!0},styles:!0});return"jpeg"===t||"png"===t?``:o}))};const h=e=>{const t=e.target;!t.classList.contains(l.nodeHover)&&d(t)&&t.classList.add(l.nodeHover)},f=e=>{const t=e.target;t.classList.contains(l.nodeHover)&&t.classList.remove(l.nodeHover)},g=e=>{e.preventDefault();const t=e.target;t.classList.contains(l.nodeSelected)?t.classList.remove(l.nodeSelected):d(t)&&t.classList.add(l.nodeSelected)};function p(e){e.nodeType!==Node.TEXT_NODE&&e.getBoundingClientRect||!e.parentElement||(e=e.parentElement);const t=function(e){const t={isInViewport:!1,isPartiallyInViewport:!1,isInsideViewport:!1,isAroundViewport:!1,isOnEdge:!1,isOnTopEdge:!1,isOnRightEdge:!1,isOnBottomEdge:!1,isOnLeftEdge:!1},n=e.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight,r=window.innerWidth||document.documentElement.clientWidth,o=n.left>=0&&n.left+n.width<=r,s=n.top>=0&&n.top+n.height<=i;t.isInsideViewport=o&&s;const a=n.left<0&&n.left+n.width>r,l=n.top<0&&n.top+n.height>i;t.isAroundViewport=a&&l;const c=n.top<0&&n.top+n.height>0,u=n.leftr,d=n.left<0&&n.left+n.width>0,h=n.topi,f=s||l||c||h,g=o||a||d||u;t.isOnTopEdge=c&&g,t.isOnRightEdge=u&&f,t.isOnBottomEdge=h&&g,t.isOnLeftEdge=d&&f,t.isOnEdge=t.isOnLeftEdge||t.isOnRightEdge||t.isOnTopEdge||t.isOnBottomEdge;const p=o||a||t.isOnLeftEdge||t.isOnRightEdge,m=s||l||t.isOnTopEdge||t.isOnBottomEdge;return t.isInViewport=p&&m,t.isPartiallyInViewport=t.isInViewport&&t.isOnEdge,t}(e);return t.isInViewport}function m(e,t){const n=document.implementation.createHTMLDocument();return n.documentElement.replaceChildren(e,t),n}function y(){setTimeout((()=>{var e;document.querySelectorAll(`.${l.nodeSelected}`).forEach((e=>{e instanceof HTMLElement&&e.classList.remove(l.nodeSelected)})),document.querySelectorAll(`.${l.nodeSelectionContainer}`).forEach((e=>e.remove())),(e=document).body.removeEventListener("mouseout",f),e.body.removeEventListener("mouseover",h),document.body.removeEventListener("click",g)}),0)}function v(e,t,n=!1){return i(this,void 0,void 0,(function*(){const i=yield(0,a.getInlinedNode)(e.body,{raster:!0,fetchOptions:b(t),inlineOptions:{fonts:!1,images:null==t?void 0:t.images,stylesheets:null==t?void 0:t.styles},styles:null==t?void 0:t.styles,filter:e=>!n||p(e)});if(!i)return{};const r=e.createElement("head"),o=e.createElement("title");return o.innerText=e.title,r.appendChild(o),{body:i,head:r}}))}function b(e){return(null==e?void 0:e.corsProxy)?{bypassCors:!0,corsHost:e.corsProxy,crossOrigin:"anonymous",noCache:!0}:void 0}t.enterNodeSelectionMode=function(e,t){return setTimeout((()=>{!function(e){e.body.addEventListener("click",g)}(e),function(e){e.body.addEventListener("mouseout",f),e.body.addEventListener("mouseover",h)}(e)}),0),function(){const e=`.${l.nodeHover} {\n border: 1px solid green;\n background-color: rgb(0,0,0,0.05);\n cursor: pointer;\n }\n\n .${l.nodeSelected} {\n border: 2px solid green;\n cursor: pointer;\n }\n\n .${l.nodeSelectionContainer} {\n position: fixed;\n bottom: 0px;\n right: 0px;\n z-index: ${Number.MAX_VALUE};\n }`;(0,o.injectCss)(e,"nn-clipper-styles")}(),new Promise(((e,n)=>{!function(e,t){const n=document.createElement("div");n.classList.add(l.nodeSelectionContainer),setTimeout((()=>{document.body.appendChild(n)}),0),(0,s.app)({init:{isClipping:!1},view:({isClipping:n})=>(0,s.h)("div",{style:{padding:"10px",backgroundColor:"white",borderRadius:"5px",boxShadow:"0px 0px 10px 0px #00000038"}},[(0,s.h)("p",{style:{marginBottom:"0px",fontSize:"18px"}},[(0,s.text)("Notesnook Web Clipper")]),(0,s.h)("p",{style:{margin:"0px",marginBottom:"5px",fontStyle:"italic"}},[n?(0,s.text)("Clipping selected elements. Please wait..."):(0,s.text)("Click on any element to select it.")]),(0,s.h)("div",{style:{display:"flex",alignItems:"center"}},[(0,s.h)("button",{onclick:t=>[Object.assign(Object.assign({},t),{isClipping:!0}),t=>{null==e||e(),t({isClipping:!1})}],style:{marginRight:"5px"},disabled:n},[n?(0,s.text)("Clipping..."):(0,s.text)("Clip")]),(0,s.h)("button",{onclick:e=>(y(),null==t||t(),e),disabled:n},[(0,s.text)("Cancel")])])]),node:n})}((()=>i(this,void 0,void 0,(function*(){y();const n=document.querySelectorAll(`.${l.nodeSelected}`),i=document.createElement("div");for(const e of n){e.classList.remove(l.nodeSelected);const n=yield(0,a.getInlinedNode)(e,{raster:!1,fetchOptions:b(t),inlineOptions:u});n&&i.appendChild(n)}e(null==i?void 0:i.outerHTML)}))),(()=>n("Cancelled.")))}))},t.cleanup=y},783:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.readUrls=t.inlineAll=t.shouldProcess=void 0;const r=n(32),o=n(787),s=/url\(['"]?([^'"]+?)['"]?\)/g;function a(e){return-1!==e.search(s)}function l(e){const t=[];let n;for(;null!==(n=s.exec(e));)t.push(n[1]);return t.filter((function(e){return!(0,o.isDataUrl)(e)}))}function c(e,t,n,s){return i(this,void 0,void 0,(function*(){t=s?(0,o.resolveUrl)(t,s):t;const i=yield(0,r.fetchResource)(t,n);return e.replace((a=t,new RegExp("(url\\(['\"]?)("+(0,o.escape)(a)+")(['\"]?\\))","g")),"$1"+i+"$3");var a}))}t.shouldProcess=a,t.readUrls=l,t.inlineAll=function(e,t,n){return i(this,void 0,void 0,(function*(){if(!a(e))return e;const i=l(e);let r=e;for(const e of i)r=yield c(r,e,t,n);return r}))}},69:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.cacheStylesheets=t.inlineStylesheets=void 0;const r=n(32),o=n(302),s=n(136),a=n(763),l=["animation","background","border","border-block-end","border-block-start","border-bottom","border-color","border-image","border-inline-end","border-inline-start","border-left","border-radius","border-right","border-style","border-top","border-width","column-rule","columns","contain-intrinsic-size","flex","flex-flow","font","gap","grid","grid-area","grid-column","grid-row","grid-template","grid-gap","list-style","margin","mask","offset","outline","overflow","padding","place-content","place-items","place-self","scroll-margin","scroll-padding","text-decoration","text-emphasis","transition"];function c(e,t){return i(this,void 0,void 0,(function*(){try{const n=document.createElement("style"),i=yield fetch((0,r.constructUrl)(e,t));return!!i.ok&&(n.innerText=yield i.text(),n.setAttribute("href",e),n)}catch(t){console.error("Failed to inline stylesheet",e,t)}}))}function u(e,t,n,i,r){for(const a of e)if(a instanceof CSSStyleRule){if((s=a.selectorText).includes(":before")||s.includes(":after")||s.includes("::after")||s.includes("::before")){const e=m(a.selectorText);for(const t of e){if(!t||!t.selector.trim())continue;const e=document.querySelectorAll(t.selector);for(const n of e){if(!(n instanceof HTMLElement||n instanceof SVGElement))continue;const e=i.get(n)||[];i.set(n,e),e.push({rule:a.style,href:p(r),pseudoElement:t.pseudoElement})}}}const e=document.querySelectorAll(a.selectorText);for(const t of e){if(!(t instanceof HTMLElement||t instanceof SVGElement))continue;const e=a.selectorText.split(","),i=n.get(t)||[];n.set(t,i);for(const t of e)try{const e=(0,o.calculate)(t)[0];i.push({specificity:e.specificityArray,rule:a.style,href:p(r)});break}catch(e){console.error(e,r&&p(r))}}}else(a instanceof CSSMediaRule&&window.matchMedia(a.conditionText).matches||a instanceof CSSSupportsRule&&CSS.supports(a.conditionText))&&u(a.cssRules,t,n,i,r);var s}function d(e,t,n){const i=function(){const e=new CSSStyleSheet;return e.insertRule(".dummy{}"),e.cssRules[0].style}(),r=function(e){let t;return Object.defineProperty({},"style",{get:()=>(t||(t=getComputedStyle(e)),t)})}(e),o=["display"];for(const e of t)for(const t of[...e.rule,...l]){let s=e.rule.getPropertyValue(t);o.includes(t)&&(s=r.style.getPropertyValue(t)),s.trim()&&h(i,t,s,(e=>r.style.getPropertyValue(e)||n.getPropertyValue(e)),(t=>(console.log("resolving url",t,e.href),t.startsWith("data:")||!e.href?t:(console.log("resolving url",t,e.href.href),t.startsWith("/")?new URL(`${e.href.origin}${t}`).href:new URL(`${e.href.href}${t}`).href))),e.rule.getPropertyPriority(t))}return i}function h(e,t,n,i,r,o){n=function(e,t){const n=(0,s.tokenize)(e),i=[];for(let e=0;ee.trim())).includes("print")}function g(e,t){const n=(0,s.tokenize)(e),i=[];for(let e=0;e!(e.type!==a.SelectorType.Pseudo&&e.type!==a.SelectorType.PseudoElement||"after"!==e.name&&"before"!==e.name)));n<=-1||t.push({selector:(0,a.stringify)([e.slice(0,n)]),pseudoElement:(0,a.stringify)([e.slice(n)])})}return t}t.inlineStylesheets=function(e){return i(this,void 0,void 0,(function*(){for(const t of document.styleSheets){if(f(t))continue;const n=t.ownerNode;if(t.href&&n instanceof HTMLLinkElement)try{t.cssRules.length}catch(t){const i=yield c(n.href,e);i&&n.replaceWith(i),console.error("Failed to access sheet",n.href,t)}}yield function(e){return i(this,void 0,void 0,(function*(){let t=0;for(const n of document.styleSheets)if(!f(n))for(const i of n.cssRules){if(i.type===CSSRule.IMPORT_RULE){const r=i.href,o=yield c(r,e);o&&(n.ownerNode?n.ownerNode.before(o):document.head.appendChild(o),n.deleteRule(t))}++t}}))}(e)}))},t.cacheStylesheets=function(e){const t=new Map,n=new Map;for(const i of document.styleSheets){if(f(i))continue;let r=i.href||void 0;!r&&i.ownerNode instanceof HTMLElement&&(r=i.ownerNode.getAttribute("href")||void 0),u(i.cssRules,e,t,n,r)}return{getPseudo(t,i){var r;const o=null===(r=n.get(t))||void 0===r?void 0:r.filter((e=>e.pseudoElement.includes(i)));if(o&&o.length)return d(t,o,e)},get(n){const i=t.get(n);if(!i)return;const r=i.sort(((e,t)=>(0,o.compare)(e.specificity,t.specificity)));return r.push({rule:n.style,specificity:[0,0,0,0],href:null}),d(n,r,e)}}}},787:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.height=t.width=t.escapeXhtml=t.asArray=t.delay=t.uid=t.resolveUrl=t.canvasToBlob=t.isDataUrl=t.dataAsUrl=t.mimeType=t.parseExtension=t.escape=t.injectCss=void 0;const n="application/font-woff",i="image/jpeg",r={woff:n,woff2:n,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:i,jpeg:i,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"};function o(e){const t=/\.([^./]*?)(\?|$)/g.exec(e);return t?t[1]:""}t.parseExtension=o,t.mimeType=function(e){const t=o(e).toLowerCase();return r[t]||""},t.isDataUrl=function(e){return-1!==e.search(/^(data:)/)},t.canvasToBlob=function(e){return e.toBlob?new Promise((function(t){e.toBlob(t)})):Promise.resolve(function(e){const t=atob(e.toDataURL().split(",")[1]),n=t.length,i=new Uint8Array(n);for(let e=0;e{var t={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 n(e){return(!e.style||"none"!=e.style.display)&&!e.hasAttribute("hidden")&&(!e.hasAttribute("aria-hidden")||"true"!=e.getAttribute("aria-hidden")||e.className&&e.className.indexOf&&-1!==e.className.indexOf("fallback-image"))}e.exports=function(e,i={}){"function"==typeof i&&(i={visibilityChecker:i});var r={minScore:20,minContentLength:140,visibilityChecker:n};i=Object.assign(r,i);var o=e.querySelectorAll("p, pre, article"),s=e.querySelectorAll("div > br");if(s.length){var a=new Set(o);[].forEach.call(s,(function(e){a.add(e.parentNode)})),o=Array.from(a)}var l=0;return[].some.call(o,(function(e){if(!i.visibilityChecker(e))return!1;var n=e.className+" "+e.id;if(t.unlikelyCandidates.test(n)&&!t.okMaybeItsACandidate.test(n))return!1;if(e.matches("li p"))return!1;var r=e.textContent.trim().length;return!(ri.minScore}))}},174:e=>{function t(e,t){if(t&&t.documentElement)e=t,t=arguments[2];else if(!e||!e.documentElement)throw new Error("First argument to Readability constructor should be a document object.");if(t=t||{},this._doc=e,this._docJSDOMParser=this._doc.firstChild.__JSDOMParser__,this._articleTitle=null,this._articleByline=null,this._articleDir=null,this._articleSiteName=null,this._attempts=[],this._debug=!!t.debug,this._maxElemsToParse=t.maxElemsToParse||this.DEFAULT_MAX_ELEMS_TO_PARSE,this._nbTopCandidates=t.nbTopCandidates||this.DEFAULT_N_TOP_CANDIDATES,this._charThreshold=t.charThreshold||this.DEFAULT_CHAR_THRESHOLD,this._classesToPreserve=this.CLASSES_TO_PRESERVE.concat(t.classesToPreserve||[]),this._keepClasses=!!t.keepClasses,this._serializer=t.serializer||function(e){return e.innerHTML},this._disableJSONLD=!!t.disableJSONLD,this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY,this._debug){let e=function(e){if(e.nodeType==e.TEXT_NODE)return`${e.nodeName} ("${e.textContent}")`;let t=Array.from(e.attributes||[],(function(e){return`${e.name}="${e.value}"`})).join(" ");return`<${e.localName} ${t}>`};this.log=function(){if("undefined"!=typeof dump){var t=Array.prototype.map.call(arguments,(function(t){return t&&t.nodeName?e(t):t})).join(" ");dump("Reader: (Readability) "+t+"\n")}else if("undefined"!=typeof console){let t=Array.from(arguments,(t=>t&&t.nodeType==this.ELEMENT_NODE?e(t):t));t.unshift("Reader: (Readability)"),console.log.apply(console,t)}}}else this.log=function(){}}t.prototype={FLAG_STRIP_UNLIKELYS:1,FLAG_WEIGHT_CLASSES:2,FLAG_CLEAN_CONDITIONALLY:4,ELEMENT_NODE:1,TEXT_NODE:3,DEFAULT_MAX_ELEMS_TO_PARSE:0,DEFAULT_N_TOP_CANDIDATES:5,DEFAULT_TAGS_TO_SCORE:"section,h2,h3,h4,h5,h6,p,td,pre".toUpperCase().split(","),DEFAULT_CHAR_THRESHOLD:500,REGEXPS:{unlikelyCandidates:/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,okMaybeItsACandidate:/and|article|body|column|content|main|shadow/i,positive:/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,negative:/-ad-|hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i,extraneous:/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,byline:/byline|author|dateline|writtenby|p-author/i,replaceFonts:/<(\/?)font[^>]*>/gi,normalize:/\s{2,}/g,videos:/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i,shareElements:/(\b|_)(share|sharedaddy)(\b|_)/i,nextLink:/(next|weiter|continue|>([^\|]|$)|»([^\|]|$))/i,prevLink:/(prev|earl|old|new|<|«)/i,tokenize:/\W+/g,whitespace:/^\s*$/,hasContent:/\S$/,hashUrl:/^#.+/,srcsetUrl:/(\S+)(\s+[\d.]+[xw])?(\s*(?:,|$))/g,b64DataUrl:/^data:\s*([^\s;,]+)\s*;\s*base64\s*,/i,jsonLdArticleTypes:/^Article|AdvertiserContentArticle|NewsArticle|AnalysisNewsArticle|AskPublicNewsArticle|BackgroundNewsArticle|OpinionNewsArticle|ReportageNewsArticle|ReviewNewsArticle|Report|SatiricalArticle|ScholarlyArticle|MedicalScholarlyArticle|SocialMediaPosting|BlogPosting|LiveBlogPosting|DiscussionForumPosting|TechArticle|APIReference$/},UNLIKELY_ROLES:["menu","menubar","complementary","navigation","alert","alertdialog","dialog"],DIV_TO_P_ELEMS:new Set(["BLOCKQUOTE","DL","DIV","IMG","OL","P","PRE","TABLE","UL"]),ALTER_TO_DIV_EXCEPTIONS:["DIV","ARTICLE","SECTION","P"],PRESENTATIONAL_ATTRIBUTES:["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","style","valign","vspace"],DEPRECATED_SIZE_ATTRIBUTE_ELEMS:["TABLE","TH","TD","HR","PRE"],PHRASING_ELEMS:["ABBR","AUDIO","B","BDO","BR","BUTTON","CITE","CODE","DATA","DATALIST","DFN","EM","EMBED","I","IMG","INPUT","KBD","LABEL","MARK","MATH","METER","NOSCRIPT","OBJECT","OUTPUT","PROGRESS","Q","RUBY","SAMP","SCRIPT","SELECT","SMALL","SPAN","STRONG","SUB","SUP","TEXTAREA","TIME","VAR","WBR"],CLASSES_TO_PRESERVE:["page"],HTML_ESCAPE_MAP:{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"},_postProcessContent:function(e){this._fixRelativeUris(e),this._simplifyNestedElements(e),this._keepClasses||this._cleanClasses(e)},_removeNodes:function(e,t){if(this._docJSDOMParser&&e._isLiveNodeList)throw new Error("Do not pass live node lists to _removeNodes");for(var n=e.length-1;n>=0;n--){var i=e[n],r=i.parentNode;r&&(t&&!t.call(this,i,n,e)||r.removeChild(i))}},_replaceNodeTags:function(e,t){if(this._docJSDOMParser&&e._isLiveNodeList)throw new Error("Do not pass live node lists to _replaceNodeTags");for(const n of e)this._setNodeTag(n,t)},_forEachNode:function(e,t){Array.prototype.forEach.call(e,t,this)},_findNode:function(e,t){return Array.prototype.find.call(e,t,this)},_someNode:function(e,t){return Array.prototype.some.call(e,t,this)},_everyNode:function(e,t){return Array.prototype.every.call(e,t,this)},_concatNodeLists:function(){var e=Array.prototype.slice,t=e.call(arguments).map((function(t){return e.call(t)}));return Array.prototype.concat.apply([],t)},_getAllNodesWithTag:function(e,t){return e.querySelectorAll?e.querySelectorAll(t.join(",")):[].concat.apply([],t.map((function(t){var n=e.getElementsByTagName(t);return Array.isArray(n)?n:Array.from(n)})))},_cleanClasses:function(e){var t=this._classesToPreserve,n=(e.getAttribute("class")||"").split(/\s+/).filter((function(e){return-1!=t.indexOf(e)})).join(" ");for(n?e.setAttribute("class",n):e.removeAttribute("class"),e=e.firstElementChild;e;e=e.nextElementSibling)this._cleanClasses(e)},_fixRelativeUris:function(e){var t=this._doc.baseURI,n=this._doc.documentURI;function i(e){if(t==n&&"#"==e.charAt(0))return e;try{return new URL(e,t).href}catch(e){}return e}var r=this._getAllNodesWithTag(e,["a"]);this._forEachNode(r,(function(e){var t=e.getAttribute("href");if(t)if(0===t.indexOf("javascript:"))if(1===e.childNodes.length&&e.childNodes[0].nodeType===this.TEXT_NODE){var n=this._doc.createTextNode(e.textContent);e.parentNode.replaceChild(n,e)}else{for(var r=this._doc.createElement("span");e.firstChild;)r.appendChild(e.firstChild);e.parentNode.replaceChild(r,e)}else e.setAttribute("href",i(t))}));var o=this._getAllNodesWithTag(e,["img","picture","figure","video","audio","source"]);this._forEachNode(o,(function(e){var t=e.getAttribute("src"),n=e.getAttribute("poster"),r=e.getAttribute("srcset");if(t&&e.setAttribute("src",i(t)),n&&e.setAttribute("poster",i(n)),r){var o=r.replace(this.REGEXPS.srcsetUrl,(function(e,t,n,r){return i(t)+(n||"")+r}));e.setAttribute("srcset",o)}}))},_simplifyNestedElements:function(e){for(var t=e;t;){if(t.parentNode&&["DIV","SECTION"].includes(t.tagName)&&(!t.id||!t.id.startsWith("readability"))){if(this._isElementWithoutContent(t)){t=this._removeAndGetNext(t);continue}if(this._hasSingleTagInsideElement(t,"DIV")||this._hasSingleTagInsideElement(t,"SECTION")){for(var n=t.children[0],i=0;i»] /.test(t))i=/ [\\\/>»] /.test(t),r(t=n.replace(/(.*)[\|\-\\\/>»] .*/gi,"$1"))<3&&(t=n.replace(/[^\|\-\\\/>»]*[\|\-\\\/>»](.*)/gi,"$1"));else if(-1!==t.indexOf(": ")){var o=this._concatNodeLists(e.getElementsByTagName("h1"),e.getElementsByTagName("h2")),s=t.trim();this._someNode(o,(function(e){return e.textContent.trim()===s}))||(r(t=n.substring(n.lastIndexOf(":")+1))<3?t=n.substring(n.indexOf(":")+1):r(n.substr(0,n.indexOf(":")))>5&&(t=n))}else if(t.length>150||t.length<15){var a=e.getElementsByTagName("h1");1===a.length&&(t=this._getInnerText(a[0]))}var l=r(t=t.trim().replace(this.REGEXPS.normalize," "));return l<=4&&(!i||l!=r(n.replace(/[\|\-\\\/>»]+/g,""))-1)&&(t=n),t},_prepDocument:function(){var e=this._doc;this._removeNodes(this._getAllNodesWithTag(e,["style"])),e.body&&this._replaceBrs(e.body),this._replaceNodeTags(this._getAllNodesWithTag(e,["font"]),"SPAN")},_nextNode:function(e){for(var t=e;t&&t.nodeType!=this.ELEMENT_NODE&&this.REGEXPS.whitespace.test(t.textContent);)t=t.nextSibling;return t},_replaceBrs:function(e){this._forEachNode(this._getAllNodesWithTag(e,["br"]),(function(e){for(var t=e.nextSibling,n=!1;(t=this._nextNode(t))&&"BR"==t.tagName;){n=!0;var i=t.nextSibling;t.parentNode.removeChild(t),t=i}if(n){var r=this._doc.createElement("p");for(e.parentNode.replaceChild(r,e),t=r.nextSibling;t;){if("BR"==t.tagName){var o=this._nextNode(t.nextSibling);if(o&&"BR"==o.tagName)break}if(!this._isPhrasingContent(t))break;var s=t.nextSibling;r.appendChild(t),t=s}for(;r.lastChild&&this._isWhitespace(r.lastChild);)r.removeChild(r.lastChild);"P"===r.parentNode.tagName&&this._setNodeTag(r.parentNode,"DIV")}}))},_setNodeTag:function(e,t){if(this.log("_setNodeTag",e,t),this._docJSDOMParser)return e.localName=t.toLowerCase(),e.tagName=t.toUpperCase(),e;for(var n=e.ownerDocument.createElement(t);e.firstChild;)n.appendChild(e.firstChild);e.parentNode.replaceChild(n,e),e.readability&&(n.readability=e.readability);for(var i=0;i!n.includes(e))).join(" ").length/i.join(" ").length:0},_checkByline:function(e,t){if(this._articleByline)return!1;if(void 0!==e.getAttribute)var n=e.getAttribute("rel"),i=e.getAttribute("itemprop");return!(!("author"===n||i&&-1!==i.indexOf("author")||this.REGEXPS.byline.test(t))||!this._isValidByline(e.textContent)||(this._articleByline=e.textContent.trim(),0))},_getNodeAncestors:function(e,t){t=t||0;for(var n=0,i=[];e.parentNode&&(i.push(e.parentNode),!t||++n!==t);)e=e.parentNode;return i},_grabArticle:function(e){this.log("**** grabArticle ****");var t=this._doc,n=null!==e;if(!(e=e||this._doc.body))return this.log("No body found in document. Abort."),null;for(var i=e.innerHTML;;){this.log("Starting grabArticle loop");var r=this._flagIsActive(this.FLAG_STRIP_UNLIKELYS),o=[],s=this._doc.documentElement;let F=!0;for(;s;){"HTML"===s.tagName&&(this._articleLang=s.getAttribute("lang"));var a=s.className+" "+s.id;if(this._isProbablyVisible(s))if(this._checkByline(s,a))s=this._removeAndGetNext(s);else if(F&&this._headerDuplicatesTitle(s))this.log("Removing header: ",s.textContent.trim(),this._articleTitle.trim()),F=!1,s=this._removeAndGetNext(s);else{if(r){if(this.REGEXPS.unlikelyCandidates.test(a)&&!this.REGEXPS.okMaybeItsACandidate.test(a)&&!this._hasAncestorTag(s,"table")&&!this._hasAncestorTag(s,"code")&&"BODY"!==s.tagName&&"A"!==s.tagName){this.log("Removing unlikely candidate - "+a),s=this._removeAndGetNext(s);continue}if(this.UNLIKELY_ROLES.includes(s.getAttribute("role"))){this.log("Removing content with role "+s.getAttribute("role")+" - "+a),s=this._removeAndGetNext(s);continue}}if("DIV"!==s.tagName&&"SECTION"!==s.tagName&&"HEADER"!==s.tagName&&"H1"!==s.tagName&&"H2"!==s.tagName&&"H3"!==s.tagName&&"H4"!==s.tagName&&"H5"!==s.tagName&&"H6"!==s.tagName||!this._isElementWithoutContent(s)){if(-1!==this.DEFAULT_TAGS_TO_SCORE.indexOf(s.tagName)&&o.push(s),"DIV"===s.tagName){for(var l=null,c=s.firstChild;c;){var u=c.nextSibling;if(this._isPhrasingContent(c))null!==l?l.appendChild(c):this._isWhitespace(c)||(l=t.createElement("p"),s.replaceChild(l,c),l.appendChild(c));else if(null!==l){for(;l.lastChild&&this._isWhitespace(l.lastChild);)l.removeChild(l.lastChild);l=null}c=u}if(this._hasSingleTagInsideElement(s,"P")&&this._getLinkDensity(s)<.25){var d=s.children[0];s.parentNode.replaceChild(d,s),s=d,o.push(s)}else this._hasChildBlockElement(s)||(s=this._setNodeTag(s,"P"),o.push(s))}s=this._getNextNode(s)}else s=this._removeAndGetNext(s)}else this.log("Removing hidden node - "+a),s=this._removeAndGetNext(s)}var h=[];this._forEachNode(o,(function(e){if(e.parentNode&&void 0!==e.parentNode.tagName){var t=this._getInnerText(e);if(!(t.length<25)){var n=this._getNodeAncestors(e,5);if(0!==n.length){var i=0;i+=1,i+=t.split(",").length,i+=Math.min(Math.floor(t.length/100),3),this._forEachNode(n,(function(e,t){if(e.tagName&&e.parentNode&&void 0!==e.parentNode.tagName){if(void 0===e.readability&&(this._initializeNode(e),h.push(e)),0===t)var n=1;else n=1===t?2:3*t;e.readability.contentScore+=i/n}}))}}}}));for(var f=[],g=0,p=h.length;gb.readability.contentScore){f.splice(v,0,m),f.length>this._nbTopCandidates&&f.pop();break}}}var _,E=f[0]||null,N=!1;if(null===E||"BODY"===E.tagName){for(E=t.createElement("DIV"),N=!0;e.firstChild;)this.log("Moving child out:",e.firstChild),E.appendChild(e.firstChild);e.appendChild(E),this._initializeNode(E)}else if(E){for(var A=[],T=1;T=.75&&A.push(this._getNodeAncestors(f[T]));if(A.length>=3)for(_=E.parentNode;"BODY"!==_.tagName;){for(var C=0,S=0;S=3){E=_;break}_=_.parentNode}E.readability||this._initializeNode(E),_=E.parentNode;for(var w=E.readability.contentScore,x=w/3;"BODY"!==_.tagName;)if(_.readability){var L=_.readability.contentScore;if(Lw){E=_;break}w=_.readability.contentScore,_=_.parentNode}else _=_.parentNode;for(_=E.parentNode;"BODY"!=_.tagName&&1==_.children.length;)_=(E=_).parentNode;E.readability||this._initializeNode(E)}var P=t.createElement("DIV");n&&(P.id="readability-content");for(var O=Math.max(10,.2*E.readability.contentScore),I=(_=E.parentNode).children,R=0,D=I.length;R=O)M=!0;else if("P"===k.nodeName){var H=this._getLinkDensity(k),U=this._getInnerText(k),j=U.length;(j>80&&H<.25||j<80&&j>0&&0===H&&-1!==U.search(/\.( |$)/))&&(M=!0)}}M&&(this.log("Appending node:",k),-1===this.ALTER_TO_DIV_EXCEPTIONS.indexOf(k.nodeName)&&(this.log("Altering sibling:",k,"to div."),k=this._setNodeTag(k,"DIV")),P.appendChild(k),I=_.children,R-=1,D-=1)}if(this._debug&&this.log("Article content pre-prep: "+P.innerHTML),this._prepArticle(P),this._debug&&this.log("Article content post-prep: "+P.innerHTML),N)E.id="readability-page-1",E.className="page";else{var $=t.createElement("DIV");for($.id="readability-page-1",$.className="page";P.firstChild;)$.appendChild(P.firstChild);P.appendChild($)}this._debug&&this.log("Article content after paging: "+P.innerHTML);var G=!0,V=this._getInnerText(P,!0).length;if(V0&&e.length<100},_unescapeHtmlEntities:function(e){if(!e)return e;var t=this.HTML_ESCAPE_MAP;return e.replace(/&(quot|amp|apos|lt|gt);/g,(function(e,n){return t[n]})).replace(/&#(?:x([0-9a-z]{1,4})|([0-9]{1,4}));/gi,(function(e,t,n){var i=parseInt(t||n,t?16:10);return String.fromCharCode(i)}))},_getJSONLD:function(e){var t,n=this._getAllNodesWithTag(e,["script"]);return this._forEachNode(n,(function(e){if(!t&&"application/ld+json"===e.getAttribute("type"))try{var n=e.textContent.replace(/^\s*\s*$/g,""),i=JSON.parse(n);if(!i["@context"]||!i["@context"].match(/^https?\:\/\/schema\.org$/))return;if(!i["@type"]&&Array.isArray(i["@graph"])&&(i=i["@graph"].find((function(e){return(e["@type"]||"").match(this.REGEXPS.jsonLdArticleTypes)}))),!i||!i["@type"]||!i["@type"].match(this.REGEXPS.jsonLdArticleTypes))return;if(t={},"string"==typeof i.name&&"string"==typeof i.headline&&i.name!==i.headline){var r=this._getArticleTitle(),o=this._textSimilarity(i.name,r)>.75,s=this._textSimilarity(i.headline,r)>.75;t.title=s&&!o?i.headline:i.name}else"string"==typeof i.name?t.title=i.name.trim():"string"==typeof i.headline&&(t.title=i.headline.trim());return i.author&&("string"==typeof i.author.name?t.byline=i.author.name.trim():Array.isArray(i.author)&&i.author[0]&&"string"==typeof i.author[0].name&&(t.byline=i.author.filter((function(e){return e&&"string"==typeof e.name})).map((function(e){return e.name.trim()})).join(", "))),"string"==typeof i.description&&(t.excerpt=i.description.trim()),void(i.publisher&&"string"==typeof i.publisher.name&&(t.siteName=i.publisher.name.trim()))}catch(e){this.log(e.message)}})),t||{}},_getArticleMetadata:function(e){var t={},n={},i=this._doc.getElementsByTagName("meta"),r=/\s*(dc|dcterm|og|twitter)\s*:\s*(author|creator|description|title|site_name)\s*/gi,o=/^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|site_name)\s*$/i;return this._forEachNode(i,(function(e){var t=e.getAttribute("name"),i=e.getAttribute("property"),s=e.getAttribute("content");if(s){var a=null,l=null;i&&(a=i.match(r))&&(l=a[0].toLowerCase().replace(/\s/g,""),n[l]=s.trim()),!a&&t&&o.test(t)&&(l=t,s&&(l=l.toLowerCase().replace(/\s/g,"").replace(/\./g,":"),n[l]=s.trim()))}})),t.title=e.title||n["dc:title"]||n["dcterm:title"]||n["og:title"]||n["weibo:article:title"]||n["weibo:webpage:title"]||n.title||n["twitter:title"],t.title||(t.title=this._getArticleTitle()),t.byline=e.byline||n["dc:creator"]||n["dcterm:creator"]||n.author,t.excerpt=e.excerpt||n["dc:description"]||n["dcterm:description"]||n["og:description"]||n["weibo:article:description"]||n["weibo:webpage:description"]||n.description||n["twitter:description"],t.siteName=e.siteName||n["og:site_name"],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},_isSingleImage:function(e){return"IMG"===e.tagName||1===e.children.length&&""===e.textContent.trim()&&this._isSingleImage(e.children[0])},_unwrapNoscriptImages:function(e){var t=Array.from(e.getElementsByTagName("img"));this._forEachNode(t,(function(e){for(var t=0;t0&&r>n)return!1;if(e.parentNode.tagName===t&&(!i||i(e.parentNode)))return!0;e=e.parentNode,r++}return!1},_getRowAndColumnCount:function(e){for(var t=0,n=0,i=e.getElementsByTagName("tr"),r=0;r0)i._readabilityDataTable=!0;else if(["col","colgroup","tfoot","thead","th"].some((function(e){return!!i.getElementsByTagName(e)[0]})))this.log("Data table because found data-y descendant"),i._readabilityDataTable=!0;else if(i.getElementsByTagName("table")[0])i._readabilityDataTable=!1;else{var o=this._getRowAndColumnCount(i);o.rows>=10||o.columns>4?i._readabilityDataTable=!0:i._readabilityDataTable=o.rows*o.columns>10}}else i._readabilityDataTable=!1;else i._readabilityDataTable=!1}},_fixLazyImages:function(e){this._forEachNode(this._getAllNodesWithTag(e,["img","picture","figure"]),(function(e){if(e.src&&this.REGEXPS.b64DataUrl.test(e.src)){if("image/svg+xml"===this.REGEXPS.b64DataUrl.exec(e.src)[1])return;for(var t=!1,n=0;ni+=this._getInnerText(e,!0).length)),i/n},_cleanConditionally:function(e,t){this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)&&this._removeNodes(this._getAllNodesWithTag(e,[t]),(function(e){var n=function(e){return e._readabilityDataTable},i="ul"===t||"ol"===t;if(!i){var r=0,o=this._getAllNodesWithTag(e,["ul","ol"]);this._forEachNode(o,(e=>r+=this._getInnerText(e).length)),i=r/this._getInnerText(e).length>.9}if("table"===t&&n(e))return!1;if(this._hasAncestorTag(e,"table",-1,n))return!1;if(this._hasAncestorTag(e,"code"))return!1;var s=this._getClassWeight(e);if(this.log("Cleaning Conditionally",e),s+0<0)return!0;if(this._getCharCount(e,",")<10){for(var a=e.getElementsByTagName("p").length,l=e.getElementsByTagName("img").length,c=e.getElementsByTagName("li").length-100,u=e.getElementsByTagName("input").length,d=this._getTextDensity(e,["h1","h2","h3","h4","h5","h6"]),h=0,f=this._getAllNodesWithTag(e,["object","embed","iframe"]),g=0;g1&&a/l<.5&&!this._hasAncestorTag(e,"figure")||!i&&c>a||u>Math.floor(a/3)||!i&&d<.9&&y<25&&(0===l||l>2)&&!this._hasAncestorTag(e,"figure")||!i&&s<25&&m>.2||s>=25&&m>.5||1===h&&y<75||h>1}return!1}))},_cleanMatchedNodes:function(e,t){for(var n=this._getNextNode(e,!0),i=this._getNextNode(e);i&&i!=n;)i=t.call(this,i,i.className+" "+i.id)?this._removeAndGetNext(i):this._getNextNode(i)},_cleanHeaders:function(e){let t=this._getAllNodesWithTag(e,["h1","h2"]);this._removeNodes(t,(function(e){let t=this._getClassWeight(e)<0;return t&&this.log("Removing header with low class weight:",e),t}))},_headerDuplicatesTitle:function(e){if("H1"!=e.tagName&&"H2"!=e.tagName)return!1;var t=this._getInnerText(e,!1);return this.log("Evaluating similarity of header:",t,this._articleTitle),this._textSimilarity(this._articleTitle,t)>.75},_flagIsActive:function(e){return(this._flags&e)>0},_removeFlag:function(e){this._flags=this._flags&~e},_isProbablyVisible:function(e){return(!e.style||"none"!=e.style.display)&&!e.hasAttribute("hidden")&&(!e.hasAttribute("aria-hidden")||"true"!=e.getAttribute("aria-hidden")||e.className&&e.className.indexOf&&-1!==e.className.indexOf("fallback-image"))},parse:function(){if(this._maxElemsToParse>0){var e=this._doc.getElementsByTagName("*").length;if(e>this._maxElemsToParse)throw new Error("Aborting parsing document; "+e+" elements found")}this._unwrapNoscriptImages(this._doc);var t=this._disableJSONLD?{}:this._getJSONLD(this._doc);this._removeScripts(this._doc),this._prepDocument();var n=this._getArticleMetadata(t);this._articleTitle=n.title;var i=this._grabArticle();if(!i)return null;if(this.log("Grabbed: "+i.innerHTML),this._postProcessContent(i),!n.excerpt){var r=i.getElementsByTagName("p");r.length>0&&(n.excerpt=r[0].textContent.trim())}var o=i.textContent;return{title:this._articleTitle,byline:n.byline||this._articleByline,dir:this._articleDir,lang:this._articleLang,content:this._serializer(i),textContent:o,length:o.length,excerpt:n.excerpt,siteName:n.siteName||this._articleSiteName}}},e.exports=t},107:(e,t,n)=>{var i=n(174),r=n(893);e.exports={Readability:i,isProbablyReaderable:r}},763:(e,t,n)=>{"use strict";var i;n.r(t),n.d(t,{AttributeAction:()=>o,IgnoreCaseMode:()=>r,SelectorType:()=>i,isTraversal:()=>u,parse:()=>m,stringify:()=>A}),function(e){e.Attribute="attribute",e.Pseudo="pseudo",e.PseudoElement="pseudo-element",e.Tag="tag",e.Universal="universal",e.Adjacent="adjacent",e.Child="child",e.Descendant="descendant",e.Parent="parent",e.Sibling="sibling",e.ColumnCombinator="column-combinator"}(i||(i={}));const r={Unknown:null,QuirksMode:"quirks",IgnoreCase:!0,CaseSensitive:!1};var o;!function(e){e.Any="any",e.Element="element",e.End="end",e.Equals="equals",e.Exists="exists",e.Hyphen="hyphen",e.Not="not",e.Start="start"}(o||(o={}));const s=/^[^\\#]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/,a=/\\([\da-f]{1,6}\s?|(\s)|.)/gi,l=new Map([[126,o.Element],[94,o.Start],[36,o.End],[42,o.Any],[33,o.Not],[124,o.Hyphen]]),c=new Set(["has","not","matches","is","where","host","host-context"]);function u(e){switch(e.type){case i.Adjacent:case i.Child:case i.Descendant:case i.Parent:case i.Sibling:case i.ColumnCombinator:return!0;default:return!1}}const d=new Set(["contains","icontains"]);function h(e,t,n){const i=parseInt(t,16)-65536;return i!=i||n?t:i<0?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320)}function f(e){return e.replace(a,h)}function g(e){return 39===e||34===e}function p(e){return 32===e||9===e||10===e||12===e||13===e}function m(e){const t=[],n=y(t,`${e}`,0);if(n0&&n0&&u(r[r.length-1]))throw new Error("Did not expect successive traversals.")}function _(e){r.length>0&&r[r.length-1].type===i.Descendant?r[r.length-1].type=e:(b(),r.push({type:e}))}function E(e,t){r.push({type:i.Attribute,name:e,action:t,value:a(1),namespace:null,ignoreCase:"quirks"})}function N(){if(r.length&&r[r.length-1].type===i.Descendant&&r.pop(),0===r.length)throw new Error("Empty sub-selector");e.push(r)}if(h(0),t.length===n)return n;e:for(;ne.charCodeAt(0)))),E=new Set(b.map((e=>e.charCodeAt(0)))),N=new Set([...b,"~","^","$","*","+","!","|",":","[","]"," ","."].map((e=>e.charCodeAt(0))));function A(e){return e.map((e=>e.map(T).join(""))).join(", ")}function T(e,t,n){switch(e.type){case i.Child:return 0===t?"> ":" > ";case i.Parent:return 0===t?"< ":" < ";case i.Sibling:return 0===t?"~ ":" ~ ";case i.Adjacent:return 0===t?"+ ":" + ";case i.Descendant:return" ";case i.ColumnCombinator:return 0===t?"|| ":" || ";case i.Universal:return"*"===e.namespace&&t+10?i+e.slice(n):e}},482:(e,t,n)=>{"use strict";n.r(t),n.d(t,{app:()=>E,h:()=>_,memo:()=>v,text:()=>b});var i={},r=[],o=e=>e,s=r.map,a=Array.isArray,l="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:setTimeout,c=e=>{var t="";if("string"==typeof e)return e;if(a(e))for(var n,i=0;i{for(var n in{...e,...t})if("function"==typeof(a(e[n])?e[n][0]:e[n]))t[n]=e[n];else if(e[n]!==t[n])return!0},d=e=>null==e?e:e.key,h=(e,t,n,i,r,o)=>{if("style"===t)for(var s in{...n,...i})n=null==i||null==i[s]?"":i[s],"-"===s[0]?e[t].setProperty(s,n):e[t][s]=n;else"o"===t[0]&&"n"===t[1]?((e.events||(e.events={}))[t=t.slice(2)]=i)?n||e.addEventListener(t,r):e.removeEventListener(t,r):!o&&"list"!==t&&"form"!==t&&t in e?e[t]=null==i?"":i:null==i||!1===i?e.removeAttribute(t):e.setAttribute(t,i)},f=(e,t,n)=>{var i=e.props,r=3===e.type?document.createTextNode(e.tag):(n=n||"svg"===e.tag)?document.createElementNS("http://www.w3.org/2000/svg",e.tag,i.is&&i):document.createElement(e.tag,i.is&&i);for(var o in i)h(r,o,null,i[o],t,n);for(var s=0;s{if(n===i);else if(null!=n&&3===n.type&&3===i.type)n.tag!==i.tag&&(t.nodeValue=i.tag);else if(null==n||n.tag!==i.tag)t=e.insertBefore(f(i=p(i),r,o),t),null!=n&&e.removeChild(n.node);else{var s,a,l,c,u=n.props,m=i.props,y=n.children,v=i.children,b=0,_=0,E=y.length-1,N=v.length-1;for(var A in o=o||"svg"===i.tag,{...u,...m})("value"===A||"selected"===A||"checked"===A?t[A]:u[A])!==m[A]&&h(t,A,u[A],m[A],r,o);for(;_<=N&&b<=E&&null!=(l=d(y[b]))&&l===d(v[_]);)g(t,y[b].node,y[b],v[_]=p(v[_++],y[b++]),r,o);for(;_<=N&&b<=E&&null!=(l=d(y[E]))&&l===d(v[N]);)g(t,y[E].node,y[E],v[N]=p(v[N--],y[E--]),r,o);if(b>E)for(;_<=N;)t.insertBefore(f(v[_]=p(v[_++]),r,o),(a=y[b])&&a.node);else if(_>N)for(;b<=E;)t.removeChild(y[b++].node);else{var T={},C={};for(A=b;A<=E;A++)null!=(l=y[A].key)&&(T[l]=y[A]);for(;_<=N;)l=d(a=y[b]),c=d(v[_]=p(v[_],a)),C[l]||null!=c&&c===d(y[b+1])?(null==l&&t.removeChild(a.node),b++):null==c||1===n.type?(null==l&&(g(t,a&&a.node,a,v[_],r,o),_++),b++):(l===c?(g(t,a.node,a,v[_],r,o),C[c]=!0,b++):null!=(s=T[c])?(g(t,t.insertBefore(s.node,a&&a.node),s,v[_],r,o),C[c]=!0):g(t,a&&a.node,null,v[_],r,o),_++);for(;b<=E;)null==d(a=y[b++])&&t.removeChild(a.node);for(var A in T)null==C[A]&&t.removeChild(T[A].node)}}return i.node=t},p=(e,t)=>!0!==e&&!1!==e&&e?"function"==typeof e.tag?((!t||null==t.memo||((e,t)=>{for(var n in e)if(e[n]!==t[n])return!0;for(var n in t)if(e[n]!==t[n])return!0})(t.memo,e.memo))&&((t=e.tag(e.memo)).memo=e.memo),t):e:b(""),m=e=>3===e.nodeType?b(e.nodeValue,e):y(e.nodeName.toLowerCase(),i,s.call(e.childNodes,m),1,e),y=(e,{key:t,...n},i,r,o)=>({tag:e,props:n,key:t,children:i,type:r,node:o}),v=(e,t)=>({tag:e,memo:t}),b=(e,t)=>y(e,i,r,3,t),_=(e,{class:t,...n},o=r)=>y(e,{...n,...t?{class:c(t)}:i},a(o)?o:[o]),E=({node:e,view:t,subscriptions:n,dispatch:s=o,init:c=i})=>{var d,h,f=e&&m(e),p=[],y=e=>{d!==e&&(null==(d=e)&&(s=n=v=o),n&&(p=((e,t=r,n)=>{for(var i,o,s=[],a=0;ae=g(e.parentNode,e,f,f=t(d),b,h=!1),b=function(e){s(this.events[e.type],e)};return(s=s(((e,t)=>"function"==typeof e?s(e(d,t)):a(e)?"function"==typeof e[0]?s(e[0],e[1]):e.slice(1).map((e=>e&&!0!==e&&(e[0]||e)(s,e[1])),y(e[0])):y(e))))(c),s}},302:(e,t,n)=>{"use strict";n.r(t),n.d(t,{calculate:()=>i,compare:()=>o});var i=function(e){var t,n,i,o,s=[];for(i=0,o=(t=e.split(",")).length;i0&&s.push(r(n));return s},r=function(e){var t,n,i=e,r={a:0,b:0,c:0},o=[];return t=function(t,n){var s,a,l,c,u,d;if(t.test(i))for(a=0,l=(s=i.match(t)).length;a~\.\[:\)]+)/g,"a"),t(/(\.[^\s\+>~\.\[:\)]+)/g,"b"),t(/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,"c"),t(/(:(?!not|global|local)[\w-]+\([^\)]*\))/gi,"b"),t(/(:(?!not|global|local)[^\s\+>~\.\[:]+)/g,"b"),i=(i=(i=(i=(i=(i=i.replace(/[\*\s\+>~]/g," ")).replace(/[#\.]/g," ")).replace(/:not/g," ")).replace(/:local/g," ")).replace(/:global/g," ")).replace(/[\(\)]/g," "),t(/([^\s\+>~\.\[:]+)/g,"c"),o.sort((function(e,t){return e.index-t.index})),{selector:e,specificity:"0,"+r.a.toString()+","+r.b.toString()+","+r.c.toString(),specificityArray:[0,r.a,r.b,r.c],parts:o}},o=function(e,t){var n,i,o;if("string"==typeof e){if(-1!==e.indexOf(","))throw"Invalid CSS selector";n=r(e).specificityArray}else{if(!Array.isArray(e))throw"Invalid CSS selector or specificity array";if(4!==e.filter((function(e){return"number"==typeof e})).length)throw"Invalid specificity array";n=e}if("string"==typeof t){if(-1!==t.indexOf(","))throw"Invalid CSS selector";i=r(t).specificityArray}else{if(!Array.isArray(t))throw"Invalid CSS selector or specificity array";if(4!==t.filter((function(e){return"number"==typeof e})).length)throw"Invalid specificity array";i=t}for(o=0;o<4;o+=1){if(n[o]i[o])return 1}return 0}}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";const e=n(590);n.g.Clipper={clipArticle:e.clipArticle,clipPage:e.clipPage}})()})(); \ No newline at end of file +(()=>{var e={110:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isSVGElement=t.cloneNode=void 0;const r=n(32),o=n(787),s=["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"].map((e=>e.toLowerCase())),a=["script"].map((e=>e.toLowerCase()));function l(e){return!(!e||!e.tagName)&&s.includes(e.tagName.toLowerCase())}t.cloneNode=function e(t,n){return i(this,void 0,void 0,(function*(){const{root:c,filter:u}=n;if(!c&&u&&!u(t))return null;let d=yield function(e,t){try{if(e instanceof HTMLCanvasElement&&(null==t?void 0:t.images))return(0,r.createImage)(e.toDataURL(),null==t?void 0:t.fetchOptions);if(!(null==t?void 0:t.images)&&e instanceof HTMLImageElement)return null;if(!(null==t?void 0:t.styles)&&(e instanceof HTMLButtonElement||e instanceof HTMLFormElement||e instanceof HTMLSelectElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))return null;if(e.nodeType===Node.COMMENT_NODE)return null;if((n=e)&&n.tagName&&a.includes(n.tagName.toLowerCase()))return null;if(e.nodeType!==Node.TEXT_NODE&&!l(e)){const{display:t,width:n,height:i}=window.getComputedStyle(e);if("none"===t||"0px"===n&&"0px"===i)return null;if(function(e){return!(!e||!e.tagName)&&!s.includes(e.tagName.toLowerCase())&&e.tagName.includes("-")}(e)){const n=t.includes("inline"),i=document.createElement(n?"span":"div");for(const t of e.attributes)i.setAttribute(t.name,t.value);return i}}return e.cloneNode(!1)}catch(e){return console.error("Failed to clone element",e),null}var n}(t,n);if(!d)return null;d=yield function(t,n,r){return i(this,void 0,void 0,(function*(){const o=t.childNodes;return 0===o.length||(yield function(t,n,r){return i(this,void 0,void 0,(function*(){for(const i of n){const n=yield e(i,Object.assign(Object.assign({},r),{root:!1}));n&&t.appendChild(n)}}))}(n,o,r)),n}))}(t,d,n);const h=function(e,t,n){return t instanceof Element?(n.styles&&(function(e,t,n){const{getElementStyles:i}=n,r=i&&i(e);if(!r)return;var o,s;t.style.cssText=r.cssText,"body"===e.tagName.toLowerCase()&&(o=getComputedStyle(e),(s=t.style).font=o.font,s.fontFamily=o.fontFamily,s.fontFeatureSettings=o.fontFeatureSettings,s.fontKerning=o.fontKerning,s.fontSize=o.fontSize,s.fontStretch=o.fontStretch,s.fontStyle=o.fontStyle,s.fontVariant=o.fontVariant,s.fontVariantCaps=o.fontVariantCaps,s.fontVariantEastAsian=o.fontVariantEastAsian,s.fontVariantLigatures=o.fontVariantLigatures,s.fontVariantNumeric=o.fontVariantNumeric,s.fontVariationSettings=o.fontVariationSettings,s.fontWeight=o.fontWeight);const a=t.getAttribute("style");a&&t.setAttribute("style",a.replace(/(:?[:;])(:? +)/gm,((e,t)=>t)))}(e,t,n),function(e,t,n){const{getPseudoElementStyles:i}=n;let r=!1;const s=document.createElement("style"),a=`pseudo--${(0,o.uid)()}`;for(const t of[":before",":after"]){const n=i&&i(e,t)||getComputedStyle(e,t);if(!n.cssText)continue;const o=`.${a}:${t} {\n ${n.cssText}\n }`;s.appendChild(document.createTextNode(o)),r=!0}r&&(t.className=a,t.appendChild(s))}(e,t,n)),function(e){const t=["href","src"],n=window.location.href;for(const i of t){const t=e.getAttribute(i),r=(null==t?void 0:t.startsWith("http"))?void 0:t;if(r){const t=new URL(r,n).href;e.setAttribute(i,t)}}}(t),function(e,t){(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&t.setAttribute("value",e.value)}(e,t),function(e){e instanceof SVGElement&&(e.setAttribute("xmlns","http://www.w3.org/2000/svg"),["width","height"].forEach((function(t){const n=e.getAttribute(t);n&&!e.style.getPropertyValue(t)&&e.style.setProperty(t,n)})))}(t),t):t}(t,d,n);return h}))},t.isSVGElement=l},136:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tokenize=void 0;const n=String.fromCharCode;function i(e,t){return 0|e.charCodeAt(t)}function r(e,t){return t.push(e),e}let o=1,s=1,a=0,l=0,c=0,u="";function d(){return c=l'+(0,l.escapeXhtml)((new XMLSerializer).serializeToString(e))+""}(n,t.width||(0,l.width)(e),t.height||(0,l.height)(e))}))}function f(e,t){return t=Object.assign(Object.assign({},u),t),h(e,t).then((e=>e?(0,o.createImage)(e,t.fetchOptions):null)).then((0,l.delay)(0)).then((function(n){const i="number"!=typeof t.scale?1:t.scale,r=function(e,t,n){const i=document.createElement("canvas");if(i.width=(n.width||(0,l.width)(e))*t,i.height=(n.height||(0,l.height)(e))*t,n.backgroundColor){const e=i.getContext("2d");if(!e)return null;e.fillStyle=n.backgroundColor,e.fillRect(0,0,i.width,i.height)}return i}(e,i,t),o=null==r?void 0:r.getContext("2d");return o?(o.imageSmoothingEnabled=!1,n&&(o.scale(i,i),o.drawImage(n,0,0)),r):null}))}t.getInlinedNode=d,t.toSvg=h,t.toPixelData=function(e,t){return(t=t||{}).raster=!0,f(e,t).then((function(t){var n;return null===(n=null==t?void 0:t.getContext("2d"))||void 0===n?void 0:n.getImageData(0,0,(0,l.width)(e),(0,l.height)(e)).data}))},t.toPng=function(e,t){return t.raster=!0,f(e,t).then((function(e){return null==e?void 0:e.toDataURL()}))},t.toJpeg=function(e,t){return t.raster=!0,f(e,t).then((function(e){return null==e?void 0:e.toDataURL("image/jpeg",t.quality||1)}))},t.toBlob=function(e,t){return t.raster=!0,f(e,t).then((e=>e&&(0,l.canvasToBlob)(e)))},t.toCanvas=function(e,t){return t.raster=!0,f(e,t)};const g=["src","href","title","style","srcset","sizes","width","height","target","rel"]},32:function(e,t){"use strict";var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};function i(e,t){if(!e.startsWith("http"))return e;if((null==t?void 0:t.noCache)&&(e+=(/\?/.test(e)?"&":"?")+Date.now()),(null==t?void 0:t.bypassCors)&&(null==t?void 0:t.corsHost)){if(e.startsWith(t.corsHost))return e;e=`${t.corsHost}/${e}`}return e}Object.defineProperty(t,"__esModule",{value:!0}),t.constructUrl=t.reloadImage=t.createImage=t.fetchResource=void 0,t.fetchResource=function(e,t){return n(this,void 0,void 0,(function*(){if(!e)return null;const n=yield fetch(i(e,t));if(!n.ok)return"";const r=yield n.blob(),o=new FileReader;return o.readAsDataURL(r),new Promise((e=>{o.addEventListener("loadend",(()=>{"string"==typeof o.result&&e(o.result)}))}))}))},t.createImage=function(e,t){return"data:,"===e?Promise.resolve(null):new Promise((function(n,r){const o=new Image;o.crossOrigin=(null==t?void 0:t.crossOrigin)||null,o.onload=function(){n(o)},o.onerror=r,o.src=i(e,t)}))},t.reloadImage=function(e,t){return t.corsHost&&e.currentSrc.startsWith(t.corsHost)?Promise.resolve(null):(t.noCache=!0,new Promise((function(n,r){e.crossOrigin=t.crossOrigin||null,e.onload=function(){n(e)},e.onerror=t=>{console.error("Failed to load image",e.currentSrc),r(t)},e.src=i(e.currentSrc,t)})))},t.constructUrl=i},663:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.resolveAll=void 0;const r=n(783);function o(e){return{resolve:function(t){const n=(e.parentStyleSheet||{}).href||void 0;return(0,r.inlineAll)(e.cssText,t,n)},src:function(){return e.style.getPropertyValue("src")}}}function s(e){return e.filter((function(e){return e.type===CSSRule.FONT_FACE_RULE})).filter((function(e){return(0,r.shouldProcess)(e.style.getPropertyValue("src"))}))}t.resolveAll=function(e){return i(this,void 0,void 0,(function*(){const t=s(function(e){const t=[];for(const n of e)try{const e=s(Array.from(n.cssRules));e.length>3&&t.push(e[0])}catch(e){e instanceof Error&&console.log("Error while reading CSS rules from "+n.href,e.toString())}return t}(document.styleSheets)).map(o),n=[];for(const i of t)n.push(yield i.resolve(e));return n.join("\n")}))}},261:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.inlineAllImages=void 0;const r=n(32),o=n(783),s=n(787);function a(e,t){return i(this,void 0,void 0,(function*(){if((0,s.isDataUrl)(e.currentSrc))return Promise.resolve(null);const n=yield(0,r.fetchResource)(e.currentSrc||e.src,t);return n?"data:,"===n?(e.removeAttribute("src"),e):new Promise((function(t,i){var r,o;"PICTURE"===(null===(r=e.parentElement)||void 0===r?void 0:r.tagName)&&(null===(o=e.parentElement)||void 0===o||o.replaceWith(e)),e.onload=()=>t(e),e.onerror=e=>i(e),e.src=n,e.removeAttribute("srcset")})):null}))}function l(e,t){return i(this,void 0,void 0,(function*(){const n=e.style.getPropertyValue("background-image");if(!n)return e;const i=yield(0,o.inlineAll)(n,t);return e.style.setProperty("background-image",i),e}))}t.inlineAllImages=function(e,t){return i(this,void 0,void 0,(function*(){const n=e.querySelectorAll("img"),i=[];for(let e=0;econsole.error(e)))}))}},590:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.enterNodeSelectionMode=t.clipScreenshot=t.cleanup=t.clipArticle=t.clipPage=void 0;const r=n(107),o=n(787),s=n(482),a=n(917),l={nodeHover:"nn-node-selection--hover",nodeSelected:"nn-node-selection--selected",nodeSelectionContainer:"nn-node-selection-container"},c=[l.nodeSelected,l.nodeSelectionContainer],u={fonts:!1,images:!0,stylesheets:!0};function d(e){for(const t of c)if(e.classList.contains(t)||e.closest(`.${t}`))return!1;return!0}t.clipPage=function(e,t,n){return i(this,void 0,void 0,(function*(){const{body:i,head:r}=yield v(e,n,t);return i&&r?`\n${p(r,i).documentElement.outerHTML}`:null}))},t.clipArticle=function(e,t){return i(this,void 0,void 0,(function*(){const{body:n,head:i}=yield v(e,t);if(!n||!i)return null;const o=p(i,n),s=new r.Readability(o);s.PRESENTATIONAL_ATTRIBUTES=["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","valign","vspace"];const a=s.parse();return`${(null==i?void 0:i.outerHTML)||""}${(null==a?void 0:a.content)||""}`}))},t.clipScreenshot=function(e,t="jpeg",n){return i(this,void 0,void 0,(function*(){const i=e||document.body,r="jpeg"===t?a.toJpeg:"png"===t?a.toPng:a.toBlob,o=yield r(i,{quality:1,backgroundColor:"white",width:document.body.scrollWidth,height:document.body.scrollHeight,fetchOptions:b(n),inlineOptions:{fonts:!0,images:!0,stylesheets:!0},styles:!0});return"jpeg"===t||"png"===t?``:o}))};const h=e=>{const t=e.target;!t.classList.contains(l.nodeHover)&&d(t)&&t.classList.add(l.nodeHover)},f=e=>{const t=e.target;t.classList.contains(l.nodeHover)&&t.classList.remove(l.nodeHover)},g=e=>{e.preventDefault();const t=e.target;t.classList.contains(l.nodeSelected)?t.classList.remove(l.nodeSelected):d(t)&&t.classList.add(l.nodeSelected)};function m(e){e.nodeType!==Node.TEXT_NODE&&e.getBoundingClientRect||!e.parentElement||(e=e.parentElement);const t=function(e){const t={isInViewport:!1,isPartiallyInViewport:!1,isInsideViewport:!1,isAroundViewport:!1,isOnEdge:!1,isOnTopEdge:!1,isOnRightEdge:!1,isOnBottomEdge:!1,isOnLeftEdge:!1},n=e.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight,r=window.innerWidth||document.documentElement.clientWidth,o=n.left>=0&&n.left+n.width<=r,s=n.top>=0&&n.top+n.height<=i;t.isInsideViewport=o&&s;const a=n.left<0&&n.left+n.width>r,l=n.top<0&&n.top+n.height>i;t.isAroundViewport=a&&l;const c=n.top<0&&n.top+n.height>0,u=n.leftr,d=n.left<0&&n.left+n.width>0,h=n.topi,f=s||l||c||h,g=o||a||d||u;t.isOnTopEdge=c&&g,t.isOnRightEdge=u&&f,t.isOnBottomEdge=h&&g,t.isOnLeftEdge=d&&f,t.isOnEdge=t.isOnLeftEdge||t.isOnRightEdge||t.isOnTopEdge||t.isOnBottomEdge;const m=o||a||t.isOnLeftEdge||t.isOnRightEdge,p=s||l||t.isOnTopEdge||t.isOnBottomEdge;return t.isInViewport=m&&p,t.isPartiallyInViewport=t.isInViewport&&t.isOnEdge,t}(e);return t.isInViewport}function p(e,t){const n=document.implementation.createHTMLDocument();return n.documentElement.replaceChildren(e,t),n}function y(){setTimeout((()=>{var e;document.querySelectorAll(`.${l.nodeSelected}`).forEach((e=>{e instanceof HTMLElement&&e.classList.remove(l.nodeSelected)})),document.querySelectorAll(`.${l.nodeSelectionContainer}`).forEach((e=>e.remove())),(e=document).body.removeEventListener("mouseout",f),e.body.removeEventListener("mouseover",h),document.body.removeEventListener("click",g)}),0)}function v(e,t,n=!1){return i(this,void 0,void 0,(function*(){const i=yield(0,a.getInlinedNode)(e.body,{raster:!0,fetchOptions:b(t),inlineOptions:{fonts:!1,inlineImages:null==t?void 0:t.inlineImages,images:null==t?void 0:t.images,stylesheets:null==t?void 0:t.styles},styles:null==t?void 0:t.styles,filter:e=>!n||m(e)});if(!i)return{};const r=e.createElement("head"),o=e.createElement("title");return o.innerText=e.title,r.appendChild(o),{body:i,head:r}}))}function b(e){return(null==e?void 0:e.corsProxy)?{bypassCors:!0,corsHost:e.corsProxy,crossOrigin:"anonymous",noCache:!0}:void 0}t.enterNodeSelectionMode=function(e,t){return setTimeout((()=>{!function(e){e.body.addEventListener("click",g)}(e),function(e){e.body.addEventListener("mouseout",f),e.body.addEventListener("mouseover",h)}(e)}),0),function(){const e=`.${l.nodeHover} {\n border: 1px solid green;\n background-color: rgb(0,0,0,0.05);\n cursor: pointer;\n }\n\n .${l.nodeSelected} {\n border: 2px solid green;\n cursor: pointer;\n }\n\n .${l.nodeSelectionContainer} {\n position: fixed;\n bottom: 0px;\n right: 0px;\n z-index: ${Number.MAX_VALUE};\n }`;(0,o.injectCss)(e,"nn-clipper-styles")}(),new Promise(((e,n)=>{!function(e,t){const n=document.createElement("div");n.classList.add(l.nodeSelectionContainer),setTimeout((()=>{document.body.appendChild(n)}),0),(0,s.app)({init:{isClipping:!1},view:({isClipping:n})=>(0,s.h)("div",{style:{padding:"10px",backgroundColor:"white",borderRadius:"5px",boxShadow:"0px 0px 10px 0px #00000038"}},[(0,s.h)("p",{style:{marginBottom:"0px",fontSize:"18px"}},[(0,s.text)("Notesnook Web Clipper")]),(0,s.h)("p",{style:{margin:"0px",marginBottom:"5px",fontStyle:"italic"}},[n?(0,s.text)("Clipping selected elements. Please wait..."):(0,s.text)("Click on any element to select it.")]),(0,s.h)("div",{style:{display:"flex",alignItems:"center"}},[(0,s.h)("button",{onclick:t=>[Object.assign(Object.assign({},t),{isClipping:!0}),t=>{null==e||e(),t({isClipping:!1})}],style:{marginRight:"5px"},disabled:n},[n?(0,s.text)("Clipping..."):(0,s.text)("Clip")]),(0,s.h)("button",{onclick:e=>(y(),null==t||t(),e),disabled:n},[(0,s.text)("Cancel")])])]),node:n})}((()=>i(this,void 0,void 0,(function*(){y();const n=document.querySelectorAll(`.${l.nodeSelected}`),i=document.createElement("div");for(const e of n){e.classList.remove(l.nodeSelected);const n=yield(0,a.getInlinedNode)(e,{raster:!1,fetchOptions:b(t),inlineOptions:u});n&&i.appendChild(n)}e(null==i?void 0:i.outerHTML)}))),(()=>n("Cancelled.")))}))},t.cleanup=y},783:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.readUrls=t.inlineAll=t.shouldProcess=void 0;const r=n(32),o=n(787),s=/url\(['"]?([^'"]+?)['"]?\)/g;function a(e){return-1!==e.search(s)}function l(e){const t=[];let n;for(;null!==(n=s.exec(e));)t.push(n[1]);return t.filter((function(e){return!(0,o.isDataUrl)(e)}))}function c(e,t,n,s){return i(this,void 0,void 0,(function*(){t=s?(0,o.resolveUrl)(t,s):t;const i=yield(0,r.fetchResource)(t,n);return e.replace((a=t,new RegExp("(url\\(['\"]?)("+(0,o.escape)(a)+")(['\"]?\\))","g")),"$1"+i+"$3");var a}))}t.shouldProcess=a,t.readUrls=l,t.inlineAll=function(e,t,n){return i(this,void 0,void 0,(function*(){if(!a(e))return e;const i=l(e);let r=e;for(const e of i)r=yield c(r,e,t,n);return r}))}},69:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.cacheStylesheets=t.inlineStylesheets=void 0;const r=n(32),o=n(302),s=n(136),a=n(763),l=["animation","background","border","border-block-end","border-block-start","border-bottom","border-color","border-image","border-inline-end","border-inline-start","border-left","border-radius","border-right","border-style","border-top","border-width","column-rule","columns","contain-intrinsic-size","flex","flex-flow","font","gap","grid","grid-area","grid-column","grid-row","grid-template","grid-gap","list-style","margin","mask","offset","outline","overflow","padding","place-content","place-items","place-self","scroll-margin","scroll-padding","text-decoration","text-emphasis","transition"];function c(e,t){return i(this,void 0,void 0,(function*(){try{const n=document.createElement("style"),i=yield fetch((0,r.constructUrl)(e,t));return!!i.ok&&(n.innerText=yield i.text(),n.setAttribute("href",e),n)}catch(t){console.error("Failed to inline stylesheet",e,t)}}))}function u(e,t,n,i,r){for(const a of e)if(a instanceof CSSStyleRule){if((s=a.selectorText).includes(":before")||s.includes(":after")||s.includes("::after")||s.includes("::before")){const e=p(a.selectorText);for(const t of e){if(!t||!t.selector.trim())continue;const e=document.querySelectorAll(t.selector);for(const n of e){if(!(n instanceof HTMLElement||n instanceof SVGElement))continue;const e=i.get(n)||[];i.set(n,e),e.push({rule:a.style,href:m(r),pseudoElement:t.pseudoElement})}}}const e=document.querySelectorAll(a.selectorText);for(const t of e){if(!(t instanceof HTMLElement||t instanceof SVGElement))continue;const e=a.selectorText.split(","),i=n.get(t)||[];n.set(t,i);for(const t of e)try{const e=(0,o.calculate)(t)[0];i.push({specificity:e.specificityArray,rule:a.style,href:m(r)});break}catch(e){console.error(e,r&&m(r))}}}else(a instanceof CSSMediaRule&&window.matchMedia(a.conditionText).matches||a instanceof CSSSupportsRule&&CSS.supports(a.conditionText))&&u(a.cssRules,t,n,i,r);var s}function d(e,t,n){const i=function(){const e=new CSSStyleSheet;return e.insertRule(".dummy{}"),e.cssRules[0].style}(),r=function(e){let t;return Object.defineProperty({},"style",{get:()=>(t||(t=getComputedStyle(e)),t)})}(e),o=["display"];for(const e of t)for(const t of[...e.rule,...l]){let s=e.rule.getPropertyValue(t);o.includes(t)&&(s=r.style.getPropertyValue(t)),s.trim()&&h(i,t,s,(e=>r.style.getPropertyValue(e)||n.getPropertyValue(e)),(t=>(console.log("resolving url",t,e.href),t.startsWith("data:")||!e.href?t:(console.log("resolving url",t,e.href.href),t.startsWith("/")?new URL(`${e.href.origin}${t}`).href:new URL(`${e.href.href}${t}`).href))),e.rule.getPropertyPriority(t))}return i}function h(e,t,n,i,r,o){n=function(e,t){const n=(0,s.tokenize)(e),i=[];for(let e=0;ee.trim())).includes("print")}function g(e,t){const n=(0,s.tokenize)(e),i=[];for(let e=0;e!(e.type!==a.SelectorType.Pseudo&&e.type!==a.SelectorType.PseudoElement||"after"!==e.name&&"before"!==e.name)));n<=-1||t.push({selector:(0,a.stringify)([e.slice(0,n)]),pseudoElement:(0,a.stringify)([e.slice(n)])})}return t}t.inlineStylesheets=function(e){return i(this,void 0,void 0,(function*(){for(const t of document.styleSheets){if(f(t))continue;const n=t.ownerNode;if(t.href&&n instanceof HTMLLinkElement)try{t.cssRules.length}catch(t){const i=yield c(n.href,e);i&&n.replaceWith(i),console.error("Failed to access sheet",n.href,t)}}yield function(e){return i(this,void 0,void 0,(function*(){let t=0;for(const n of document.styleSheets)if(!f(n))for(const i of n.cssRules){if(i.type===CSSRule.IMPORT_RULE){const r=i.href,o=yield c(r,e);o&&(n.ownerNode?n.ownerNode.before(o):document.head.appendChild(o),n.deleteRule(t))}++t}}))}(e)}))},t.cacheStylesheets=function(e){const t=new Map,n=new Map;for(const i of document.styleSheets){if(f(i))continue;let r=i.href||void 0;!r&&i.ownerNode instanceof HTMLElement&&(r=i.ownerNode.getAttribute("href")||void 0),u(i.cssRules,e,t,n,r)}return{getPseudo(t,i){var r;const o=null===(r=n.get(t))||void 0===r?void 0:r.filter((e=>e.pseudoElement.includes(i)));if(o&&o.length)return d(t,o,e)},get(n){const i=t.get(n);if(!i)return;const r=i.sort(((e,t)=>(0,o.compare)(e.specificity,t.specificity)));return r.push({rule:n.style,specificity:[0,0,0,0],href:null}),d(n,r,e)}}}},787:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.height=t.width=t.escapeXhtml=t.asArray=t.delay=t.uid=t.resolveUrl=t.canvasToBlob=t.isDataUrl=t.dataAsUrl=t.mimeType=t.parseExtension=t.escape=t.injectCss=void 0;const n="application/font-woff",i="image/jpeg",r={woff:n,woff2:n,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:i,jpeg:i,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"};function o(e){const t=/\.([^./]*?)(\?|$)/g.exec(e);return t?t[1]:""}t.parseExtension=o,t.mimeType=function(e){const t=o(e).toLowerCase();return r[t]||""},t.isDataUrl=function(e){return-1!==e.search(/^(data:)/)},t.canvasToBlob=function(e){return e.toBlob?new Promise((function(t){e.toBlob(t)})):Promise.resolve(function(e){const t=atob(e.toDataURL().split(",")[1]),n=t.length,i=new Uint8Array(n);for(let e=0;e{var t={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 n(e){return(!e.style||"none"!=e.style.display)&&!e.hasAttribute("hidden")&&(!e.hasAttribute("aria-hidden")||"true"!=e.getAttribute("aria-hidden")||e.className&&e.className.indexOf&&-1!==e.className.indexOf("fallback-image"))}e.exports=function(e,i={}){"function"==typeof i&&(i={visibilityChecker:i});var r={minScore:20,minContentLength:140,visibilityChecker:n};i=Object.assign(r,i);var o=e.querySelectorAll("p, pre, article"),s=e.querySelectorAll("div > br");if(s.length){var a=new Set(o);[].forEach.call(s,(function(e){a.add(e.parentNode)})),o=Array.from(a)}var l=0;return[].some.call(o,(function(e){if(!i.visibilityChecker(e))return!1;var n=e.className+" "+e.id;if(t.unlikelyCandidates.test(n)&&!t.okMaybeItsACandidate.test(n))return!1;if(e.matches("li p"))return!1;var r=e.textContent.trim().length;return!(ri.minScore}))}},174:e=>{function t(e,t){if(t&&t.documentElement)e=t,t=arguments[2];else if(!e||!e.documentElement)throw new Error("First argument to Readability constructor should be a document object.");if(t=t||{},this._doc=e,this._docJSDOMParser=this._doc.firstChild.__JSDOMParser__,this._articleTitle=null,this._articleByline=null,this._articleDir=null,this._articleSiteName=null,this._attempts=[],this._debug=!!t.debug,this._maxElemsToParse=t.maxElemsToParse||this.DEFAULT_MAX_ELEMS_TO_PARSE,this._nbTopCandidates=t.nbTopCandidates||this.DEFAULT_N_TOP_CANDIDATES,this._charThreshold=t.charThreshold||this.DEFAULT_CHAR_THRESHOLD,this._classesToPreserve=this.CLASSES_TO_PRESERVE.concat(t.classesToPreserve||[]),this._keepClasses=!!t.keepClasses,this._serializer=t.serializer||function(e){return e.innerHTML},this._disableJSONLD=!!t.disableJSONLD,this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY,this._debug){let e=function(e){if(e.nodeType==e.TEXT_NODE)return`${e.nodeName} ("${e.textContent}")`;let t=Array.from(e.attributes||[],(function(e){return`${e.name}="${e.value}"`})).join(" ");return`<${e.localName} ${t}>`};this.log=function(){if("undefined"!=typeof dump){var t=Array.prototype.map.call(arguments,(function(t){return t&&t.nodeName?e(t):t})).join(" ");dump("Reader: (Readability) "+t+"\n")}else if("undefined"!=typeof console){let t=Array.from(arguments,(t=>t&&t.nodeType==this.ELEMENT_NODE?e(t):t));t.unshift("Reader: (Readability)"),console.log.apply(console,t)}}}else this.log=function(){}}t.prototype={FLAG_STRIP_UNLIKELYS:1,FLAG_WEIGHT_CLASSES:2,FLAG_CLEAN_CONDITIONALLY:4,ELEMENT_NODE:1,TEXT_NODE:3,DEFAULT_MAX_ELEMS_TO_PARSE:0,DEFAULT_N_TOP_CANDIDATES:5,DEFAULT_TAGS_TO_SCORE:"section,h2,h3,h4,h5,h6,p,td,pre".toUpperCase().split(","),DEFAULT_CHAR_THRESHOLD:500,REGEXPS:{unlikelyCandidates:/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,okMaybeItsACandidate:/and|article|body|column|content|main|shadow/i,positive:/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,negative:/-ad-|hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i,extraneous:/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,byline:/byline|author|dateline|writtenby|p-author/i,replaceFonts:/<(\/?)font[^>]*>/gi,normalize:/\s{2,}/g,videos:/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i,shareElements:/(\b|_)(share|sharedaddy)(\b|_)/i,nextLink:/(next|weiter|continue|>([^\|]|$)|»([^\|]|$))/i,prevLink:/(prev|earl|old|new|<|«)/i,tokenize:/\W+/g,whitespace:/^\s*$/,hasContent:/\S$/,hashUrl:/^#.+/,srcsetUrl:/(\S+)(\s+[\d.]+[xw])?(\s*(?:,|$))/g,b64DataUrl:/^data:\s*([^\s;,]+)\s*;\s*base64\s*,/i,jsonLdArticleTypes:/^Article|AdvertiserContentArticle|NewsArticle|AnalysisNewsArticle|AskPublicNewsArticle|BackgroundNewsArticle|OpinionNewsArticle|ReportageNewsArticle|ReviewNewsArticle|Report|SatiricalArticle|ScholarlyArticle|MedicalScholarlyArticle|SocialMediaPosting|BlogPosting|LiveBlogPosting|DiscussionForumPosting|TechArticle|APIReference$/},UNLIKELY_ROLES:["menu","menubar","complementary","navigation","alert","alertdialog","dialog"],DIV_TO_P_ELEMS:new Set(["BLOCKQUOTE","DL","DIV","IMG","OL","P","PRE","TABLE","UL"]),ALTER_TO_DIV_EXCEPTIONS:["DIV","ARTICLE","SECTION","P"],PRESENTATIONAL_ATTRIBUTES:["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","style","valign","vspace"],DEPRECATED_SIZE_ATTRIBUTE_ELEMS:["TABLE","TH","TD","HR","PRE"],PHRASING_ELEMS:["ABBR","AUDIO","B","BDO","BR","BUTTON","CITE","CODE","DATA","DATALIST","DFN","EM","EMBED","I","IMG","INPUT","KBD","LABEL","MARK","MATH","METER","NOSCRIPT","OBJECT","OUTPUT","PROGRESS","Q","RUBY","SAMP","SCRIPT","SELECT","SMALL","SPAN","STRONG","SUB","SUP","TEXTAREA","TIME","VAR","WBR"],CLASSES_TO_PRESERVE:["page"],HTML_ESCAPE_MAP:{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"},_postProcessContent:function(e){this._fixRelativeUris(e),this._simplifyNestedElements(e),this._keepClasses||this._cleanClasses(e)},_removeNodes:function(e,t){if(this._docJSDOMParser&&e._isLiveNodeList)throw new Error("Do not pass live node lists to _removeNodes");for(var n=e.length-1;n>=0;n--){var i=e[n],r=i.parentNode;r&&(t&&!t.call(this,i,n,e)||r.removeChild(i))}},_replaceNodeTags:function(e,t){if(this._docJSDOMParser&&e._isLiveNodeList)throw new Error("Do not pass live node lists to _replaceNodeTags");for(const n of e)this._setNodeTag(n,t)},_forEachNode:function(e,t){Array.prototype.forEach.call(e,t,this)},_findNode:function(e,t){return Array.prototype.find.call(e,t,this)},_someNode:function(e,t){return Array.prototype.some.call(e,t,this)},_everyNode:function(e,t){return Array.prototype.every.call(e,t,this)},_concatNodeLists:function(){var e=Array.prototype.slice,t=e.call(arguments).map((function(t){return e.call(t)}));return Array.prototype.concat.apply([],t)},_getAllNodesWithTag:function(e,t){return e.querySelectorAll?e.querySelectorAll(t.join(",")):[].concat.apply([],t.map((function(t){var n=e.getElementsByTagName(t);return Array.isArray(n)?n:Array.from(n)})))},_cleanClasses:function(e){var t=this._classesToPreserve,n=(e.getAttribute("class")||"").split(/\s+/).filter((function(e){return-1!=t.indexOf(e)})).join(" ");for(n?e.setAttribute("class",n):e.removeAttribute("class"),e=e.firstElementChild;e;e=e.nextElementSibling)this._cleanClasses(e)},_fixRelativeUris:function(e){var t=this._doc.baseURI,n=this._doc.documentURI;function i(e){if(t==n&&"#"==e.charAt(0))return e;try{return new URL(e,t).href}catch(e){}return e}var r=this._getAllNodesWithTag(e,["a"]);this._forEachNode(r,(function(e){var t=e.getAttribute("href");if(t)if(0===t.indexOf("javascript:"))if(1===e.childNodes.length&&e.childNodes[0].nodeType===this.TEXT_NODE){var n=this._doc.createTextNode(e.textContent);e.parentNode.replaceChild(n,e)}else{for(var r=this._doc.createElement("span");e.firstChild;)r.appendChild(e.firstChild);e.parentNode.replaceChild(r,e)}else e.setAttribute("href",i(t))}));var o=this._getAllNodesWithTag(e,["img","picture","figure","video","audio","source"]);this._forEachNode(o,(function(e){var t=e.getAttribute("src"),n=e.getAttribute("poster"),r=e.getAttribute("srcset");if(t&&e.setAttribute("src",i(t)),n&&e.setAttribute("poster",i(n)),r){var o=r.replace(this.REGEXPS.srcsetUrl,(function(e,t,n,r){return i(t)+(n||"")+r}));e.setAttribute("srcset",o)}}))},_simplifyNestedElements:function(e){for(var t=e;t;){if(t.parentNode&&["DIV","SECTION"].includes(t.tagName)&&(!t.id||!t.id.startsWith("readability"))){if(this._isElementWithoutContent(t)){t=this._removeAndGetNext(t);continue}if(this._hasSingleTagInsideElement(t,"DIV")||this._hasSingleTagInsideElement(t,"SECTION")){for(var n=t.children[0],i=0;i»] /.test(t))i=/ [\\\/>»] /.test(t),r(t=n.replace(/(.*)[\|\-\\\/>»] .*/gi,"$1"))<3&&(t=n.replace(/[^\|\-\\\/>»]*[\|\-\\\/>»](.*)/gi,"$1"));else if(-1!==t.indexOf(": ")){var o=this._concatNodeLists(e.getElementsByTagName("h1"),e.getElementsByTagName("h2")),s=t.trim();this._someNode(o,(function(e){return e.textContent.trim()===s}))||(r(t=n.substring(n.lastIndexOf(":")+1))<3?t=n.substring(n.indexOf(":")+1):r(n.substr(0,n.indexOf(":")))>5&&(t=n))}else if(t.length>150||t.length<15){var a=e.getElementsByTagName("h1");1===a.length&&(t=this._getInnerText(a[0]))}var l=r(t=t.trim().replace(this.REGEXPS.normalize," "));return l<=4&&(!i||l!=r(n.replace(/[\|\-\\\/>»]+/g,""))-1)&&(t=n),t},_prepDocument:function(){var e=this._doc;this._removeNodes(this._getAllNodesWithTag(e,["style"])),e.body&&this._replaceBrs(e.body),this._replaceNodeTags(this._getAllNodesWithTag(e,["font"]),"SPAN")},_nextNode:function(e){for(var t=e;t&&t.nodeType!=this.ELEMENT_NODE&&this.REGEXPS.whitespace.test(t.textContent);)t=t.nextSibling;return t},_replaceBrs:function(e){this._forEachNode(this._getAllNodesWithTag(e,["br"]),(function(e){for(var t=e.nextSibling,n=!1;(t=this._nextNode(t))&&"BR"==t.tagName;){n=!0;var i=t.nextSibling;t.parentNode.removeChild(t),t=i}if(n){var r=this._doc.createElement("p");for(e.parentNode.replaceChild(r,e),t=r.nextSibling;t;){if("BR"==t.tagName){var o=this._nextNode(t.nextSibling);if(o&&"BR"==o.tagName)break}if(!this._isPhrasingContent(t))break;var s=t.nextSibling;r.appendChild(t),t=s}for(;r.lastChild&&this._isWhitespace(r.lastChild);)r.removeChild(r.lastChild);"P"===r.parentNode.tagName&&this._setNodeTag(r.parentNode,"DIV")}}))},_setNodeTag:function(e,t){if(this.log("_setNodeTag",e,t),this._docJSDOMParser)return e.localName=t.toLowerCase(),e.tagName=t.toUpperCase(),e;for(var n=e.ownerDocument.createElement(t);e.firstChild;)n.appendChild(e.firstChild);e.parentNode.replaceChild(n,e),e.readability&&(n.readability=e.readability);for(var i=0;i!n.includes(e))).join(" ").length/i.join(" ").length:0},_checkByline:function(e,t){if(this._articleByline)return!1;if(void 0!==e.getAttribute)var n=e.getAttribute("rel"),i=e.getAttribute("itemprop");return!(!("author"===n||i&&-1!==i.indexOf("author")||this.REGEXPS.byline.test(t))||!this._isValidByline(e.textContent)||(this._articleByline=e.textContent.trim(),0))},_getNodeAncestors:function(e,t){t=t||0;for(var n=0,i=[];e.parentNode&&(i.push(e.parentNode),!t||++n!==t);)e=e.parentNode;return i},_grabArticle:function(e){this.log("**** grabArticle ****");var t=this._doc,n=null!==e;if(!(e=e||this._doc.body))return this.log("No body found in document. Abort."),null;for(var i=e.innerHTML;;){this.log("Starting grabArticle loop");var r=this._flagIsActive(this.FLAG_STRIP_UNLIKELYS),o=[],s=this._doc.documentElement;let F=!0;for(;s;){"HTML"===s.tagName&&(this._articleLang=s.getAttribute("lang"));var a=s.className+" "+s.id;if(this._isProbablyVisible(s))if(this._checkByline(s,a))s=this._removeAndGetNext(s);else if(F&&this._headerDuplicatesTitle(s))this.log("Removing header: ",s.textContent.trim(),this._articleTitle.trim()),F=!1,s=this._removeAndGetNext(s);else{if(r){if(this.REGEXPS.unlikelyCandidates.test(a)&&!this.REGEXPS.okMaybeItsACandidate.test(a)&&!this._hasAncestorTag(s,"table")&&!this._hasAncestorTag(s,"code")&&"BODY"!==s.tagName&&"A"!==s.tagName){this.log("Removing unlikely candidate - "+a),s=this._removeAndGetNext(s);continue}if(this.UNLIKELY_ROLES.includes(s.getAttribute("role"))){this.log("Removing content with role "+s.getAttribute("role")+" - "+a),s=this._removeAndGetNext(s);continue}}if("DIV"!==s.tagName&&"SECTION"!==s.tagName&&"HEADER"!==s.tagName&&"H1"!==s.tagName&&"H2"!==s.tagName&&"H3"!==s.tagName&&"H4"!==s.tagName&&"H5"!==s.tagName&&"H6"!==s.tagName||!this._isElementWithoutContent(s)){if(-1!==this.DEFAULT_TAGS_TO_SCORE.indexOf(s.tagName)&&o.push(s),"DIV"===s.tagName){for(var l=null,c=s.firstChild;c;){var u=c.nextSibling;if(this._isPhrasingContent(c))null!==l?l.appendChild(c):this._isWhitespace(c)||(l=t.createElement("p"),s.replaceChild(l,c),l.appendChild(c));else if(null!==l){for(;l.lastChild&&this._isWhitespace(l.lastChild);)l.removeChild(l.lastChild);l=null}c=u}if(this._hasSingleTagInsideElement(s,"P")&&this._getLinkDensity(s)<.25){var d=s.children[0];s.parentNode.replaceChild(d,s),s=d,o.push(s)}else this._hasChildBlockElement(s)||(s=this._setNodeTag(s,"P"),o.push(s))}s=this._getNextNode(s)}else s=this._removeAndGetNext(s)}else this.log("Removing hidden node - "+a),s=this._removeAndGetNext(s)}var h=[];this._forEachNode(o,(function(e){if(e.parentNode&&void 0!==e.parentNode.tagName){var t=this._getInnerText(e);if(!(t.length<25)){var n=this._getNodeAncestors(e,5);if(0!==n.length){var i=0;i+=1,i+=t.split(",").length,i+=Math.min(Math.floor(t.length/100),3),this._forEachNode(n,(function(e,t){if(e.tagName&&e.parentNode&&void 0!==e.parentNode.tagName){if(void 0===e.readability&&(this._initializeNode(e),h.push(e)),0===t)var n=1;else n=1===t?2:3*t;e.readability.contentScore+=i/n}}))}}}}));for(var f=[],g=0,m=h.length;gb.readability.contentScore){f.splice(v,0,p),f.length>this._nbTopCandidates&&f.pop();break}}}var _,E=f[0]||null,N=!1;if(null===E||"BODY"===E.tagName){for(E=t.createElement("DIV"),N=!0;e.firstChild;)this.log("Moving child out:",e.firstChild),E.appendChild(e.firstChild);e.appendChild(E),this._initializeNode(E)}else if(E){for(var A=[],T=1;T=.75&&A.push(this._getNodeAncestors(f[T]));if(A.length>=3)for(_=E.parentNode;"BODY"!==_.tagName;){for(var C=0,S=0;S=3){E=_;break}_=_.parentNode}E.readability||this._initializeNode(E),_=E.parentNode;for(var w=E.readability.contentScore,x=w/3;"BODY"!==_.tagName;)if(_.readability){var L=_.readability.contentScore;if(Lw){E=_;break}w=_.readability.contentScore,_=_.parentNode}else _=_.parentNode;for(_=E.parentNode;"BODY"!=_.tagName&&1==_.children.length;)_=(E=_).parentNode;E.readability||this._initializeNode(E)}var P=t.createElement("DIV");n&&(P.id="readability-content");for(var O=Math.max(10,.2*E.readability.contentScore),I=(_=E.parentNode).children,R=0,D=I.length;R=O)k=!0;else if("P"===M.nodeName){var H=this._getLinkDensity(M),U=this._getInnerText(M),j=U.length;(j>80&&H<.25||j<80&&j>0&&0===H&&-1!==U.search(/\.( |$)/))&&(k=!0)}}k&&(this.log("Appending node:",M),-1===this.ALTER_TO_DIV_EXCEPTIONS.indexOf(M.nodeName)&&(this.log("Altering sibling:",M,"to div."),M=this._setNodeTag(M,"DIV")),P.appendChild(M),I=_.children,R-=1,D-=1)}if(this._debug&&this.log("Article content pre-prep: "+P.innerHTML),this._prepArticle(P),this._debug&&this.log("Article content post-prep: "+P.innerHTML),N)E.id="readability-page-1",E.className="page";else{var $=t.createElement("DIV");for($.id="readability-page-1",$.className="page";P.firstChild;)$.appendChild(P.firstChild);P.appendChild($)}this._debug&&this.log("Article content after paging: "+P.innerHTML);var G=!0,V=this._getInnerText(P,!0).length;if(V0&&e.length<100},_unescapeHtmlEntities:function(e){if(!e)return e;var t=this.HTML_ESCAPE_MAP;return e.replace(/&(quot|amp|apos|lt|gt);/g,(function(e,n){return t[n]})).replace(/&#(?:x([0-9a-z]{1,4})|([0-9]{1,4}));/gi,(function(e,t,n){var i=parseInt(t||n,t?16:10);return String.fromCharCode(i)}))},_getJSONLD:function(e){var t,n=this._getAllNodesWithTag(e,["script"]);return this._forEachNode(n,(function(e){if(!t&&"application/ld+json"===e.getAttribute("type"))try{var n=e.textContent.replace(/^\s*\s*$/g,""),i=JSON.parse(n);if(!i["@context"]||!i["@context"].match(/^https?\:\/\/schema\.org$/))return;if(!i["@type"]&&Array.isArray(i["@graph"])&&(i=i["@graph"].find((function(e){return(e["@type"]||"").match(this.REGEXPS.jsonLdArticleTypes)}))),!i||!i["@type"]||!i["@type"].match(this.REGEXPS.jsonLdArticleTypes))return;if(t={},"string"==typeof i.name&&"string"==typeof i.headline&&i.name!==i.headline){var r=this._getArticleTitle(),o=this._textSimilarity(i.name,r)>.75,s=this._textSimilarity(i.headline,r)>.75;t.title=s&&!o?i.headline:i.name}else"string"==typeof i.name?t.title=i.name.trim():"string"==typeof i.headline&&(t.title=i.headline.trim());return i.author&&("string"==typeof i.author.name?t.byline=i.author.name.trim():Array.isArray(i.author)&&i.author[0]&&"string"==typeof i.author[0].name&&(t.byline=i.author.filter((function(e){return e&&"string"==typeof e.name})).map((function(e){return e.name.trim()})).join(", "))),"string"==typeof i.description&&(t.excerpt=i.description.trim()),void(i.publisher&&"string"==typeof i.publisher.name&&(t.siteName=i.publisher.name.trim()))}catch(e){this.log(e.message)}})),t||{}},_getArticleMetadata:function(e){var t={},n={},i=this._doc.getElementsByTagName("meta"),r=/\s*(dc|dcterm|og|twitter)\s*:\s*(author|creator|description|title|site_name)\s*/gi,o=/^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|site_name)\s*$/i;return this._forEachNode(i,(function(e){var t=e.getAttribute("name"),i=e.getAttribute("property"),s=e.getAttribute("content");if(s){var a=null,l=null;i&&(a=i.match(r))&&(l=a[0].toLowerCase().replace(/\s/g,""),n[l]=s.trim()),!a&&t&&o.test(t)&&(l=t,s&&(l=l.toLowerCase().replace(/\s/g,"").replace(/\./g,":"),n[l]=s.trim()))}})),t.title=e.title||n["dc:title"]||n["dcterm:title"]||n["og:title"]||n["weibo:article:title"]||n["weibo:webpage:title"]||n.title||n["twitter:title"],t.title||(t.title=this._getArticleTitle()),t.byline=e.byline||n["dc:creator"]||n["dcterm:creator"]||n.author,t.excerpt=e.excerpt||n["dc:description"]||n["dcterm:description"]||n["og:description"]||n["weibo:article:description"]||n["weibo:webpage:description"]||n.description||n["twitter:description"],t.siteName=e.siteName||n["og:site_name"],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},_isSingleImage:function(e){return"IMG"===e.tagName||1===e.children.length&&""===e.textContent.trim()&&this._isSingleImage(e.children[0])},_unwrapNoscriptImages:function(e){var t=Array.from(e.getElementsByTagName("img"));this._forEachNode(t,(function(e){for(var t=0;t0&&r>n)return!1;if(e.parentNode.tagName===t&&(!i||i(e.parentNode)))return!0;e=e.parentNode,r++}return!1},_getRowAndColumnCount:function(e){for(var t=0,n=0,i=e.getElementsByTagName("tr"),r=0;r0)i._readabilityDataTable=!0;else if(["col","colgroup","tfoot","thead","th"].some((function(e){return!!i.getElementsByTagName(e)[0]})))this.log("Data table because found data-y descendant"),i._readabilityDataTable=!0;else if(i.getElementsByTagName("table")[0])i._readabilityDataTable=!1;else{var o=this._getRowAndColumnCount(i);o.rows>=10||o.columns>4?i._readabilityDataTable=!0:i._readabilityDataTable=o.rows*o.columns>10}}else i._readabilityDataTable=!1;else i._readabilityDataTable=!1}},_fixLazyImages:function(e){this._forEachNode(this._getAllNodesWithTag(e,["img","picture","figure"]),(function(e){if(e.src&&this.REGEXPS.b64DataUrl.test(e.src)){if("image/svg+xml"===this.REGEXPS.b64DataUrl.exec(e.src)[1])return;for(var t=!1,n=0;ni+=this._getInnerText(e,!0).length)),i/n},_cleanConditionally:function(e,t){this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)&&this._removeNodes(this._getAllNodesWithTag(e,[t]),(function(e){var n=function(e){return e._readabilityDataTable},i="ul"===t||"ol"===t;if(!i){var r=0,o=this._getAllNodesWithTag(e,["ul","ol"]);this._forEachNode(o,(e=>r+=this._getInnerText(e).length)),i=r/this._getInnerText(e).length>.9}if("table"===t&&n(e))return!1;if(this._hasAncestorTag(e,"table",-1,n))return!1;if(this._hasAncestorTag(e,"code"))return!1;var s=this._getClassWeight(e);if(this.log("Cleaning Conditionally",e),s+0<0)return!0;if(this._getCharCount(e,",")<10){for(var a=e.getElementsByTagName("p").length,l=e.getElementsByTagName("img").length,c=e.getElementsByTagName("li").length-100,u=e.getElementsByTagName("input").length,d=this._getTextDensity(e,["h1","h2","h3","h4","h5","h6"]),h=0,f=this._getAllNodesWithTag(e,["object","embed","iframe"]),g=0;g1&&a/l<.5&&!this._hasAncestorTag(e,"figure")||!i&&c>a||u>Math.floor(a/3)||!i&&d<.9&&y<25&&(0===l||l>2)&&!this._hasAncestorTag(e,"figure")||!i&&s<25&&p>.2||s>=25&&p>.5||1===h&&y<75||h>1}return!1}))},_cleanMatchedNodes:function(e,t){for(var n=this._getNextNode(e,!0),i=this._getNextNode(e);i&&i!=n;)i=t.call(this,i,i.className+" "+i.id)?this._removeAndGetNext(i):this._getNextNode(i)},_cleanHeaders:function(e){let t=this._getAllNodesWithTag(e,["h1","h2"]);this._removeNodes(t,(function(e){let t=this._getClassWeight(e)<0;return t&&this.log("Removing header with low class weight:",e),t}))},_headerDuplicatesTitle:function(e){if("H1"!=e.tagName&&"H2"!=e.tagName)return!1;var t=this._getInnerText(e,!1);return this.log("Evaluating similarity of header:",t,this._articleTitle),this._textSimilarity(this._articleTitle,t)>.75},_flagIsActive:function(e){return(this._flags&e)>0},_removeFlag:function(e){this._flags=this._flags&~e},_isProbablyVisible:function(e){return(!e.style||"none"!=e.style.display)&&!e.hasAttribute("hidden")&&(!e.hasAttribute("aria-hidden")||"true"!=e.getAttribute("aria-hidden")||e.className&&e.className.indexOf&&-1!==e.className.indexOf("fallback-image"))},parse:function(){if(this._maxElemsToParse>0){var e=this._doc.getElementsByTagName("*").length;if(e>this._maxElemsToParse)throw new Error("Aborting parsing document; "+e+" elements found")}this._unwrapNoscriptImages(this._doc);var t=this._disableJSONLD?{}:this._getJSONLD(this._doc);this._removeScripts(this._doc),this._prepDocument();var n=this._getArticleMetadata(t);this._articleTitle=n.title;var i=this._grabArticle();if(!i)return null;if(this.log("Grabbed: "+i.innerHTML),this._postProcessContent(i),!n.excerpt){var r=i.getElementsByTagName("p");r.length>0&&(n.excerpt=r[0].textContent.trim())}var o=i.textContent;return{title:this._articleTitle,byline:n.byline||this._articleByline,dir:this._articleDir,lang:this._articleLang,content:this._serializer(i),textContent:o,length:o.length,excerpt:n.excerpt,siteName:n.siteName||this._articleSiteName}}},e.exports=t},107:(e,t,n)=>{var i=n(174),r=n(893);e.exports={Readability:i,isProbablyReaderable:r}},763:(e,t,n)=>{"use strict";var i;n.r(t),n.d(t,{AttributeAction:()=>o,IgnoreCaseMode:()=>r,SelectorType:()=>i,isTraversal:()=>u,parse:()=>p,stringify:()=>A}),function(e){e.Attribute="attribute",e.Pseudo="pseudo",e.PseudoElement="pseudo-element",e.Tag="tag",e.Universal="universal",e.Adjacent="adjacent",e.Child="child",e.Descendant="descendant",e.Parent="parent",e.Sibling="sibling",e.ColumnCombinator="column-combinator"}(i||(i={}));const r={Unknown:null,QuirksMode:"quirks",IgnoreCase:!0,CaseSensitive:!1};var o;!function(e){e.Any="any",e.Element="element",e.End="end",e.Equals="equals",e.Exists="exists",e.Hyphen="hyphen",e.Not="not",e.Start="start"}(o||(o={}));const s=/^[^\\#]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/,a=/\\([\da-f]{1,6}\s?|(\s)|.)/gi,l=new Map([[126,o.Element],[94,o.Start],[36,o.End],[42,o.Any],[33,o.Not],[124,o.Hyphen]]),c=new Set(["has","not","matches","is","where","host","host-context"]);function u(e){switch(e.type){case i.Adjacent:case i.Child:case i.Descendant:case i.Parent:case i.Sibling:case i.ColumnCombinator:return!0;default:return!1}}const d=new Set(["contains","icontains"]);function h(e,t,n){const i=parseInt(t,16)-65536;return i!=i||n?t:i<0?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320)}function f(e){return e.replace(a,h)}function g(e){return 39===e||34===e}function m(e){return 32===e||9===e||10===e||12===e||13===e}function p(e){const t=[],n=y(t,`${e}`,0);if(n0&&n0&&u(r[r.length-1]))throw new Error("Did not expect successive traversals.")}function _(e){r.length>0&&r[r.length-1].type===i.Descendant?r[r.length-1].type=e:(b(),r.push({type:e}))}function E(e,t){r.push({type:i.Attribute,name:e,action:t,value:a(1),namespace:null,ignoreCase:"quirks"})}function N(){if(r.length&&r[r.length-1].type===i.Descendant&&r.pop(),0===r.length)throw new Error("Empty sub-selector");e.push(r)}if(h(0),t.length===n)return n;e:for(;ne.charCodeAt(0)))),E=new Set(b.map((e=>e.charCodeAt(0)))),N=new Set([...b,"~","^","$","*","+","!","|",":","[","]"," ","."].map((e=>e.charCodeAt(0))));function A(e){return e.map((e=>e.map(T).join(""))).join(", ")}function T(e,t,n){switch(e.type){case i.Child:return 0===t?"> ":" > ";case i.Parent:return 0===t?"< ":" < ";case i.Sibling:return 0===t?"~ ":" ~ ";case i.Adjacent:return 0===t?"+ ":" + ";case i.Descendant:return" ";case i.ColumnCombinator:return 0===t?"|| ":" || ";case i.Universal:return"*"===e.namespace&&t+10?i+e.slice(n):e}},482:(e,t,n)=>{"use strict";n.r(t),n.d(t,{app:()=>E,h:()=>_,memo:()=>v,text:()=>b});var i={},r=[],o=e=>e,s=r.map,a=Array.isArray,l="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:setTimeout,c=e=>{var t="";if("string"==typeof e)return e;if(a(e))for(var n,i=0;i{for(var n in{...e,...t})if("function"==typeof(a(e[n])?e[n][0]:e[n]))t[n]=e[n];else if(e[n]!==t[n])return!0},d=e=>null==e?e:e.key,h=(e,t,n,i,r,o)=>{if("style"===t)for(var s in{...n,...i})n=null==i||null==i[s]?"":i[s],"-"===s[0]?e[t].setProperty(s,n):e[t][s]=n;else"o"===t[0]&&"n"===t[1]?((e.events||(e.events={}))[t=t.slice(2)]=i)?n||e.addEventListener(t,r):e.removeEventListener(t,r):!o&&"list"!==t&&"form"!==t&&t in e?e[t]=null==i?"":i:null==i||!1===i?e.removeAttribute(t):e.setAttribute(t,i)},f=(e,t,n)=>{var i=e.props,r=3===e.type?document.createTextNode(e.tag):(n=n||"svg"===e.tag)?document.createElementNS("http://www.w3.org/2000/svg",e.tag,i.is&&i):document.createElement(e.tag,i.is&&i);for(var o in i)h(r,o,null,i[o],t,n);for(var s=0;s{if(n===i);else if(null!=n&&3===n.type&&3===i.type)n.tag!==i.tag&&(t.nodeValue=i.tag);else if(null==n||n.tag!==i.tag)t=e.insertBefore(f(i=m(i),r,o),t),null!=n&&e.removeChild(n.node);else{var s,a,l,c,u=n.props,p=i.props,y=n.children,v=i.children,b=0,_=0,E=y.length-1,N=v.length-1;for(var A in o=o||"svg"===i.tag,{...u,...p})("value"===A||"selected"===A||"checked"===A?t[A]:u[A])!==p[A]&&h(t,A,u[A],p[A],r,o);for(;_<=N&&b<=E&&null!=(l=d(y[b]))&&l===d(v[_]);)g(t,y[b].node,y[b],v[_]=m(v[_++],y[b++]),r,o);for(;_<=N&&b<=E&&null!=(l=d(y[E]))&&l===d(v[N]);)g(t,y[E].node,y[E],v[N]=m(v[N--],y[E--]),r,o);if(b>E)for(;_<=N;)t.insertBefore(f(v[_]=m(v[_++]),r,o),(a=y[b])&&a.node);else if(_>N)for(;b<=E;)t.removeChild(y[b++].node);else{var T={},C={};for(A=b;A<=E;A++)null!=(l=y[A].key)&&(T[l]=y[A]);for(;_<=N;)l=d(a=y[b]),c=d(v[_]=m(v[_],a)),C[l]||null!=c&&c===d(y[b+1])?(null==l&&t.removeChild(a.node),b++):null==c||1===n.type?(null==l&&(g(t,a&&a.node,a,v[_],r,o),_++),b++):(l===c?(g(t,a.node,a,v[_],r,o),C[c]=!0,b++):null!=(s=T[c])?(g(t,t.insertBefore(s.node,a&&a.node),s,v[_],r,o),C[c]=!0):g(t,a&&a.node,null,v[_],r,o),_++);for(;b<=E;)null==d(a=y[b++])&&t.removeChild(a.node);for(var A in T)null==C[A]&&t.removeChild(T[A].node)}}return i.node=t},m=(e,t)=>!0!==e&&!1!==e&&e?"function"==typeof e.tag?((!t||null==t.memo||((e,t)=>{for(var n in e)if(e[n]!==t[n])return!0;for(var n in t)if(e[n]!==t[n])return!0})(t.memo,e.memo))&&((t=e.tag(e.memo)).memo=e.memo),t):e:b(""),p=e=>3===e.nodeType?b(e.nodeValue,e):y(e.nodeName.toLowerCase(),i,s.call(e.childNodes,p),1,e),y=(e,{key:t,...n},i,r,o)=>({tag:e,props:n,key:t,children:i,type:r,node:o}),v=(e,t)=>({tag:e,memo:t}),b=(e,t)=>y(e,i,r,3,t),_=(e,{class:t,...n},o=r)=>y(e,{...n,...t?{class:c(t)}:i},a(o)?o:[o]),E=({node:e,view:t,subscriptions:n,dispatch:s=o,init:c=i})=>{var d,h,f=e&&p(e),m=[],y=e=>{d!==e&&(null==(d=e)&&(s=n=v=o),n&&(m=((e,t=r,n)=>{for(var i,o,s=[],a=0;ae=g(e.parentNode,e,f,f=t(d),b,h=!1),b=function(e){s(this.events[e.type],e)};return(s=s(((e,t)=>"function"==typeof e?s(e(d,t)):a(e)?"function"==typeof e[0]?s(e[0],e[1]):e.slice(1).map((e=>e&&!0!==e&&(e[0]||e)(s,e[1])),y(e[0])):y(e))))(c),s}},302:(e,t,n)=>{"use strict";n.r(t),n.d(t,{calculate:()=>i,compare:()=>o});var i=function(e){var t,n,i,o,s=[];for(i=0,o=(t=e.split(",")).length;i0&&s.push(r(n));return s},r=function(e){var t,n,i=e,r={a:0,b:0,c:0},o=[];return t=function(t,n){var s,a,l,c,u,d;if(t.test(i))for(a=0,l=(s=i.match(t)).length;a~\.\[:\)]+)/g,"a"),t(/(\.[^\s\+>~\.\[:\)]+)/g,"b"),t(/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,"c"),t(/(:(?!not|global|local)[\w-]+\([^\)]*\))/gi,"b"),t(/(:(?!not|global|local)[^\s\+>~\.\[:]+)/g,"b"),i=(i=(i=(i=(i=(i=i.replace(/[\*\s\+>~]/g," ")).replace(/[#\.]/g," ")).replace(/:not/g," ")).replace(/:local/g," ")).replace(/:global/g," ")).replace(/[\(\)]/g," "),t(/([^\s\+>~\.\[:]+)/g,"c"),o.sort((function(e,t){return e.index-t.index})),{selector:e,specificity:"0,"+r.a.toString()+","+r.b.toString()+","+r.c.toString(),specificityArray:[0,r.a,r.b,r.c],parts:o}},o=function(e,t){var n,i,o;if("string"==typeof e){if(-1!==e.indexOf(","))throw"Invalid CSS selector";n=r(e).specificityArray}else{if(!Array.isArray(e))throw"Invalid CSS selector or specificity array";if(4!==e.filter((function(e){return"number"==typeof e})).length)throw"Invalid specificity array";n=e}if("string"==typeof t){if(-1!==t.indexOf(","))throw"Invalid CSS selector";i=r(t).specificityArray}else{if(!Array.isArray(t))throw"Invalid CSS selector or specificity array";if(4!==t.filter((function(e){return"number"==typeof e})).length)throw"Invalid specificity array";i=t}for(o=0;o<4;o+=1){if(n[o]i[o])return 1}return 0}}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";const e=n(590);n.g.Clipper={clipArticle:e.clipArticle,clipPage:e.clipPage}})()})(); \ No newline at end of file diff --git a/apps/mobile/share/fetch-webview.js b/apps/mobile/share/fetch-webview.js index 48b02dd58..4c8dee6e3 100644 --- a/apps/mobile/share/fetch-webview.js +++ b/apps/mobile/share/fetch-webview.js @@ -96,7 +96,6 @@ export const HtmlLoadingWebViewAgent = React.memo( { - console.log("Webview is loaded"); loadHandler.current?.(true); }} style={{ @@ -106,6 +105,7 @@ export const HtmlLoadingWebViewAgent = React.memo( opacity: 0, zIndex: -1 }} + useSharedProcessPool={false} pointerEvents="none" onMessage={(event) => { try { @@ -123,33 +123,7 @@ export const HtmlLoadingWebViewAgent = React.memo( console.log("Error handling webview message", e); } }} - injectedJavaScriptBeforeContentLoaded={` - ${clipper} - window.addEventListener("load",() => { - function postMessage(type, value) { - if (window.ReactNativeWebView) { - window.ReactNativeWebView.postMessage( - JSON.stringify({ - type: type, - value: value - }) - ); - } - } - if (!globalThis.Clipper.clipPage) { - postMessage("error", globalThis.Clipper.clipPage); - } else { - globalThis.Clipper.clipPage(document,false, { - images: false, - styles: false, - corsProxy: undefined - }).then(result => { - postMessage("html", result); - }).catch(e => { - postMessage("error"); - }); - } - }, false);`} + injectedJavaScriptBeforeContentLoaded={script(clipper, premium.current)} onError={() => { console.log("Error loading page"); loadHandler.current?.(); @@ -163,4 +137,45 @@ export const HtmlLoadingWebViewAgent = React.memo( () => true ); +const script = (clipper, pro) => ` +${clipper} + +function postMessage(type, value) { + if (window.ReactNativeWebView) { + window.ReactNativeWebView.postMessage( + JSON.stringify({ + type: type, + value: value + }) + ); + } +} + +(() => { + try { + const loadFn = () => { + if (!globalThis.Clipper.clipPage) { + postMessage("error", globalThis.Clipper.clipPage); + } else { + globalThis.Clipper.clipPage(document,false, { + images: ${pro}, + inlineImages: false, + styles: false, + corsProxy: undefined + }).then(result => { + postMessage("html", result); + }).catch(e => { + postMessage("error"); + }); + } + }; + window.addEventListener("load",loadFn, false); + } catch(e) { + postMessage("error", e.message); + } +})(); + + +`; + HtmlLoadingWebViewAgent.displayName = "HtmlLoadingWebViewAgent"; diff --git a/apps/mobile/share/share.js b/apps/mobile/share/share.js index 45656a2ff..2c814822d 100644 --- a/apps/mobile/share/share.js +++ b/apps/mobile/share/share.js @@ -228,7 +228,6 @@ const ShareView = ({ quicknote = false }) => { }, [onLoad]); const onLoad = useCallback(() => { - console.log("sending event..."); eSendEvent(eOnLoadNote + "shareEditor", { id: null, content: { @@ -658,7 +657,7 @@ const ShareView = ({ quicknote = false }) => { <> {loadingPage ? ( <> - + Preparing web clip... ) : null}