// ==UserScript== // @name DISTILL // @namespace https://github.com/shmidtqq65/distill // @version 1.0.0 // @description TL;DR any website. Press Alt+Shift+D for the summary, Esc to put the page back. Nothing leaves your browser. // @author shmidtqq // @license MIT // @homepageURL https://github.com/shmidtqq65/distill // @downloadURL https://raw.githubusercontent.com/shmidtqq65/distill/main/userscript/distill.user.js // @updateURL https://raw.githubusercontent.com/shmidtqq65/distill/main/userscript/distill.user.js // @match *://*/* // @grant none // @run-at document-idle // @noframes // ==/UserScript== (function () { 'use strict'; function run() { (()=>{'use strict';const t=window,e=document,n=e.documentElement,o=t.__distill;if(o&&o.alive)return void('exit'===o.state().phase?o.stop():o.toggle());if(!(n&&e.body&&e.body instanceof HTMLElement))return;const r=Object.assign({ai:!0,translate:!0,motion:!0,credit:!0},t.__DS_OPTIONS||{}),a=!!t.__DS_MANUAL,i=e=>!(!t.matchMedia||!t.matchMedia(e).matches),s=!a&&(!1===r.motion||i('(prefers-reduced-motion: reduce)')),l=(t,e,n)=>tn?n:t,c=(t,e,n)=>t+(e-t)*n,f=t=>1-Math.pow(1-l(t,0,1),3),u=t=>(t=l(t,0,1))<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;let d=49723809;const p=()=>{d=d+1831565813|0;let t=Math.imul(d^d>>>15,1|d);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296},h=(t,e)=>t+p()*(e-t),b=t=>t.parentElement||t.parentNode&&t.parentNode.host||null,g=(t,e)=>{for(;t;t=b(t))if(t===e)return!0;return!1},m=()=>t.performance?performance.now():Date.now();let w;const x=t=>{const n=/^rgba?\(([\d.]+),\s*([\d.]+),\s*([\d.]+)(?:,\s*([\d.]+))?\)$/.exec(t||'');if(n)return[+n[1],+n[2],+n[3],void 0===n[4]?1:+n[4]];if(!w){const t=e.createElement('canvas');t.width=t.height=1,w=t.getContext('2d',{willReadFrequently:!0})}w.clearRect(0,0,1,1),w.fillStyle='#000',w.fillStyle=t||'#000',w.fillRect(0,0,1,1);const o=w.getImageData(0,0,1,1).data;return[o[0],o[1],o[2],o[3]/255]},v=(t,e,n,o)=>'rgba('+[0,1,2].map(o=>Math.round(c(t[o],e[o],n))).join(',')+','+(void 0===o?1:o)+')',y=t=>(.2126*t[0]+.7152*t[1]+.0722*t[2])/255,k=new Map,M=(t,e,n)=>{if(!t.style)return;let o=k.get(t);if(o||k.set(t,o={a:t.getAttribute('style'),p:{},w:{}}),e in o.p){if(t.style.getPropertyValue(e)!==o.w[e]||'important'!==t.style.getPropertyPriority(e))return}else o.p[e]=[t.style.getPropertyValue(e),t.style.getPropertyPriority(e)];t.style.setProperty(e,n,'important'),o.w[e]=t.style.getPropertyValue(e)},S=t=>{const n=e.createElement('i');return n.style.cssText=t||'',n.style.cssText},z=t=>{const e=k.get(t);if(!e)return;k.delete(t);for(const n in e.p){if(t.style.getPropertyValue(n)!==e.w[n]||'important'!==t.style.getPropertyPriority(n))continue;const o=e.p[n];o[0]?t.style.setProperty(n,o[0],o[1]):t.style.removeProperty(n)}const n=t.getAttribute('style');null===e.a?null===n||t.style.length||t.removeAttribute('style'):n!==e.a&&t.style.cssText===S(e.a)&&(t.setAttribute('style',e.a),t.style.cssText!==S(e.a)&&(t.style.cssText=S(e.a)))},L={en:'the,of,and,to,in,a,is,that,for,it,as,was,with,be,by,on,not,he,i,this,are,or,his,from,at,which,but,have,an,they,you,were,her,she,there,one,all,we,their,been,has,would,will,its,if,more,so,who,what,can,no,when,also,about,into,than,them,could,these,only,other,some,my,like,then,do,any,may,just,most,over,out,such,our,new,how,up,after,him,should,very,where,between,through,those,both,each,made,many,before,well,much,even,while,must,because,did,said,back,same,however,under,being,does,during,without,since,own,until,per,via,yet,among,off,few,here,me,too,why,your,am,again,down,once,ever,around,within,upon,s,t,enough,lot,really,quite,almost,often,always,never,something,thing,things,first,last,next,long,little,great,good,best,high,big,small,though,although,already,instead,across,along,every,another,others,less,least,time,times,two,three,four,five,six,seven,eight,nine,ten,hundred,thousand,million,billion,dozen,percent,half,way,ways,get,got,make,use,used,using,need,know,see,say,says,take,still,now,today,year,years,day,days,people,click,press,open,run,read,work,works,show,find,give,keep,put,look,looks,makes,takes,uses,want,try,start,set,add',de:'der,die,und,in,den,von,zu,das,mit,sich,des,auf,fur,ist,im,dem,nicht,ein,eine,als,auch,es,an,werden,aus,er,hat,dass,sie,nach,wird,bei,einer,um,am,sind,noch,wie,einem,uber,einen,so,zum,war,haben,nur,oder,aber,vor,zur,bis,mehr,durch,man,sein,wurde,sei,kann,wenn,diese,was,dann,doch,sehr,unter',fr:'de,la,le,et,les,des,en,un,du,une,que,est,pour,qui,dans,par,sur,au,pas,plus,ne,il,ce,sont,avec,se,ou,mais,elle,son,aux,sa,ont,cette,ses,leur,nous,on,comme,tout,vous,je,lui,y,ete,etre,fait,peut,ces,dont,entre,aussi,bien,tres,sans,apres,meme,ils',es:'de,la,que,el,en,y,a,los,se,del,las,un,por,con,no,una,su,para,es,al,lo,como,mas,pero,sus,le,ha,me,si,sin,sobre,este,ya,entre,cuando,todo,esta,ser,son,dos,tambien,fue,habia,era,muy,hasta,desde,porque,hay,puede,todos,nos,ni,donde,cada,otro,otros',it:'di,e,il,la,che,in,a,per,un,non,una,del,le,si,i,da,con,al,sono,della,lo,come,piu,ma,gli,anche,se,ha,ci,dei,alla,nel,delle,o,questo,suo,sua,loro,dal,ne,essere,molto,tra,cui',pt:'de,a,o,que,e,do,da,em,um,para,com,nao,uma,os,no,se,na,por,mais,as,dos,como,mas,foi,ao,ele,das,tem,seu,sua,ou,ser,quando,muito,ha,nos,ja,esta,tambem,pelo,pela,ate,isso,ela,entre,era',nl:'de,en,van,het,een,in,is,dat,op,te,zijn,met,voor,niet,aan,er,die,maar,om,ook,als,dan,bij,of,uit,nog,door,over,wat,naar,wordt,worden,kan,was,hij,ze,zij,we,heeft,hebben,werd,geen,meer,zo,al,tot',zh:'\u4e00\u4e2a,\u6211\u4eec,\u4ed6\u4eec,\u8fd9\u4e2a,\u53ef\u4ee5,\u6ca1\u6709,\u56e0\u4e3a,\u4f46\u662f,\u5c31\u662f,\u4e0d\u662f,\u81ea\u5df1,\u4ec0\u4e48',th:'\u0e17\u0e35\u0e48,\u0e01\u0e32\u0e23,\u0e02\u0e2d\u0e07,\u0e41\u0e25\u0e30,\u0e43\u0e19,\u0e40\u0e1b\u0e47\u0e19,\u0e44\u0e14\u0e49,\u0e08\u0e30,\u0e21\u0e35,\u0e44\u0e21\u0e48,\u0e43\u0e2b\u0e49,\u0e27\u0e48\u0e32,\u0e01\u0e31\u0e1a,\u0e19\u0e35\u0e49,\u0e04\u0e27\u0e32\u0e21'},$={en:228,de:179,fr:195,es:218,it:188,pt:181,nl:202,pl:166,u:166,sv:199,fi:161,da:173,ar:138,he:187},j={zh:255,ja:357,th:900,lo:900,km:900,my:900},q=RegExp('(?:^|[\\s(\\[])(?:mr|mrs|ms|dr|prof|sr|jr|st|vs|etc|no|nr|fig|inc|ltd|co|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec|al|ca|approx|cf|vol|pp|e\\.g|i\\.e|z\\.b|bzw|vgl|usw|d\\.h)\\.$','i'),I=/^(this|it|they|these|those|he|she|but|however|also|and|so|then|that|such|its|their|there|here|thus|still|yet|or|because)\b/i,C=((navigator.language||'en')+'').toLowerCase(),A={main:'Main idea',points:'Key points',M:'Figures',L:'Keywords',read:'read',min:'min',$:'s',words:'words',j:'#\xd7 shorter',copy:'Copy',I:'Copied',share:'Share',u:'Translate',C:'Original',ai:'AI',quotes:'Quotes',A:'Use Chrome\'s AI',F:'Chrome\'s built-in AI can retell this page in its own words.',T:'The first run downloads the model and needs about 22 GB of free disk space.',dl:'Downloading the model',N:'Writing a summary',D:'Translating',R:'Picked from the page. Nothing left your browser.',P:'Written by Chrome\'s on-device AI. Nothing left your browser.',H:'Translated by Chrome\'s on-device AI.',empty:'Not much to distill here',O:'Open an article, a blog post or a docs page and try again.',W:'Distilled with DISTILL',close:'Close',_:'Minimize',focus:'Show the page as it is',K:'Chrome\'s AI could not finish, showing quotes.',U:'Translation is not available for this language.'},F=new Intl.NumberFormat('en'),T=new Set('script style noscript template textarea input select option button svg math canvas iframe object embed video audio picture img pre head title meta link dialog datalist meter progress noembed rt rp'.split(' ')),N=/(?{let e=E.get(t);if(!e){const n=getComputedStyle(t);e={d:n.display,v:n.visibility,p:n.position,f:n.cssFloat},E.set(t,e)}return e},P=/[\u0e00-\u0eff\u1000-\u109f\u1780-\u17ff\u3040-\u30ff\u3400-\u9fff]/g,B='(?{let o=V.get(t);if(void 0===o){const r=(t.getAttribute('class')||'')+' '+(t.id||''),a=t.getAttribute('role');o=t!==e.body&&t!==n&&(K.has(t.localName)||!!a&&U.test(a)||(H.test(r)||O.test(r)||W.test(r))&&!_.test(r))||'header'===t.localName&&!t.querySelector('h1'),V.set(t,o)}return o},Q=(t,o)=>{for(let r=0;t&&t!==o&&t!==e.body&&t!==n&&r<9;t=b(t),r++)if(G(t))return!0;return!1},Y=t=>(t=t.toLowerCase(),/[\u00c0-\u024f]/.test(t)&&(t=t.normalize('NFD').replace(/[\u0300-\u036f]/g,'')),t.replace(/\u2019/g,'\''));let J='en',X=!1,Z=new Set,tt=null,et=null;const nt=t=>X||t.length<3||/\d/.test(t)||t.length<4?t:'en'===J?(t=t.replace(/'s$/,''),/ies$/.test(t)?t=t.slice(0,-3)+'y':/sses$/.test(t)?t=t.slice(0,-2):/[^su]s$/.test(t)&&!/(is|us|ss)$/.test(t)&&(t=t.slice(0,-1)),t.length>5&&/ing$/.test(t)?t=t.slice(0,-3):t.length>4&&/ed$/.test(t)&&(t=t.slice(0,-2)),t.length>3&&/e$/.test(t)&&(t=t.slice(0,-1)),/([bdfgklmnprt])\1$/.test(t)&&(t=t.slice(0,-1)),t.slice(0,8)):(t=t.replace(/(es|en|er|os|as|s|e|a|o)$/,e=>t.length-e.length>=4?'':e)).slice(0,7),ot=(t,e)=>{const n=[],o=(t,o)=>{const r=Y(t),a=Z.has(r)||!X&&r.length<2||'ja'===J&&/^[\u3040-\u309f]+$/.test(r);n.push({w:r,raw:t,o:e+o,l:t.length,s:a?'':nt(r),stop:a})};if(et)for(const e of et.segment(t))e.isWordLike&&o(e.segment,e.index);else{const e=/[\p{L}\p{N}][\p{L}\p{N}\p{M}'\u2019-]*/gu;let n;for(;n=e.exec(t);)o(n[0],n.index)}return n},rt=(t,e,n)=>{for(;ee&&/\s/.test(t[n-1]);)n--;return[e,n]};function at(t){const e=t.t,n=[];if(tt)for(const t of tt.segment(e))n.push([t.index,t.index+t.segment.length]);else{const t=/[^.!?\u3002\uff01\uff1f\n]+(?:[.!?\u3002\uff01\uff1f]+["')\]\u00bb\u201d\u2019]*|\n|$)/g;let o;for(;o=t.exec(e);)o[0]?n.push([o.index,o.index+o[0].length]):t.lastIndex++}const o=[];for(const t of n){const n=o[o.length-1];if(n){const o=e.slice(n[0],n[1]),r=e.slice(t[0],t[1]).trimStart();if(!/\n/.test(o)&&(!r||/^\p{Ll}/u.test(r)||/(?:^|[\s.(])\p{Lu}\.\s*$/u.test(o)||q.test(o.trimEnd())||/^[,;:)\]]/.test(r))){n[1]=t[1];continue}}o.push(t.slice())}return o.map(t=>rt(e,t[0],t[1])).filter(t=>t[1]-t[0]>1)}const it=t=>t.replace(/\[(?:\d+|[a-z]|citation needed)\]/gi,'').replace(/[\u00ad\u200b-\u200d\ufeff]/g,'').replace(/\s+/g,' ').trim();function st(){const o=m(),a=(()=>{const t=[],n=new Map,o=new Map;let r=null;const a=t=>{if(o.has(t))return o.get(t);const e=R(t);let n=null;const r=('none'!==e.f||'inline-block'===e.d)&&(t.textContent||'').trim().length<=2;if('none'===e.d)n=null;else if((i=e.d).startsWith('inline')||'contents'===i||i.startsWith('ruby')||r){const o=b(t),i=o?a(o):null;n=i&&{b:i.b,a:i.a||'a'===t.localName,V:'inline'===e.d||'contents'===e.d||r?i.V:t}}else n={b:t,a:'a'===t.localName||!(!t.closest||!t.closest('a')),V:null};var i;return o.set(t,n),n},i=e=>{let o=n.get(e);return void 0===o&&(o=(t=>{if(t.checkVisibility&&!t.checkVisibility())return!1;const e=t.getBoundingClientRect();return e.width>1&&e.height>1})(e)?{G:e,t:'',Y:[],link:0,V:null}:null,n.set(e,o),o&&t.push(o)),o},s=t=>{if(3===t.nodeType)return 1;const e=t.localName;if(T.has(e)||t===D||'true'===t.getAttribute('aria-hidden')||t.hasAttribute('data-distill'))return 2;if('sup'===e&&(t.querySelector('a')||/ref|note|cite/i.test(t.className)))return 2;const n=t.getAttribute('class');return n&&N.test(n)?2:1},l=t=>{const c=e.createTreeWalker(t,5,{acceptNode:s});for(let t=c.nextNode();t;t=c.nextNode()){if(1===t.nodeType){if('br'===t.localName){const e=t.parentNode&&1===t.parentNode.nodeType?a(t.parentNode):null,o=e&&n.get(e.b);o&&o.t&&!o.t.endsWith('\n')&&(o.t+='\n')}t.shadowRoot&&l(t.shadowRoot);continue}const e=t.parentNode;if(!e||1!==e.nodeType)continue;const s=t.data,c=!/\S/.test(s);if(c&&!n.get(e)&&(!o.get(e)||!n.get(o.get(e).b)))continue;if('visible'!==R(e).v)continue;const f=a(e);if(!f)continue;let u=c?n.get(f.b):i(f.b);if(!u)continue;if(!c){const t=u.t.charCodeAt(u.t.length-1);u!==r&&u.t?10!==t&&(u.t+='\n'):u.V!==f.V&&u.t&&32!==t&&10!==t&&(u.t+=' '),u.V=f.V,r=u}const d=u.t.length;u.t+=s.replace(/\s/g,' '),u.Y.push(t,d,u.t.length),f.a&&(u.link+=s.length)}};l(e.body);const c=[];for(const e of t){if(!/[\p{L}\p{N}]/u.test(e.t))continue;const t=/^h([1-6])$/.exec(e.G.localName);e.h=t?+t[1]:'heading'===e.G.getAttribute('role')?+(e.G.getAttribute('aria-level')||2):0,e.J=e.t.replace(/\s+/g,'').length;const n=(e.t.match(P)||[]).length;e.words=(e.t.match(/[\p{L}\p{N}]+/gu)||[]).length+(n?Math.round(n/2):0),e.X=e.link/Math.max(1,e.t.length),c.push(e)}return c})();if(!a.length)return null;const{root:i}=(t=>{const o=new Map;for(const e of t){if(e.h)continue;let t,r=0;if(Q(e.G))t=e.J;else{const n=/^(li|dd|dt|td)$/.test(e.G.localName);e.X<.35&&(e.words>=10||n&&e.words>=3)&&(r=e.J*(1-e.X)),t=e.J*e.X+(r||n?0:e.J*(1-e.X)*.3)}for(let a=e.G;a&&a!==n;a=b(a)){const e=o.get(a);e?(e[0]+=r,e[1]+=t):o.set(a,[r,t])}}const r=t=>{const e=o.get(t);if(!e||!e[0])return-1e9;const n=(t.getAttribute('class')||'')+' '+(t.id||'');return(e[0]-1.3*e[1])*(_.test(n)?1.06:1)*(/^(article|main)$/.test(t.localName)?1.06:1)};let a=e.body,i=-1e9;for(const t of o.keys()){const e=r(t);e>i&&(i=e,a=t)}for(let t=0;t<4;t++){const t=b(a);if(!t||t===e.body||t===n)break;const o=r(t);if(!((!a.querySelector('h1')&&t.querySelector('h1')||'article'===t.localName&&!/^(article|main)$/.test(a.localName))&&o>=.82*i))break;a=t,i=Math.max(i,o)}return{root:a,acc:o}})(a),s=a.filter(t=>g(t.G,i)),l=s.filter(t=>t.h),c=s.filter(t=>!t.h&&t.words>=4&&t.X<.5&&!Q(t.G,i)&&!t.G.closest('figure,figcaption,caption,table.infobox,.thumbcaption,.wp-caption-text')),f=c.map(t=>t.t).join(' ');(e=>{J=e,X=/^(zh|ja|th|lo|km|my)$/.test(e),Z=new Set(((L[e]||'')+','+L.en).split(','));try{tt=t.Intl&&Intl.Segmenter?new Intl.Segmenter(e,{granularity:'sentence'}):null,et=t.Intl&&Intl.Segmenter?new Intl.Segmenter(e,{granularity:'word'}):null}catch(t){tt=et=null}})(r.lang||(t=>{const e=t.slice(0,6e3),o=(n.getAttribute('lang')||'').toLowerCase().split(/[-_]/)[0],r=t=>(e.match(t)||[]).length,a=r(/[a-z\u00c0-\u024f]/gi),i=r(/[\u3040-\u30ff]/g),s=r(/[\u4e00-\u9fff]/g),l=r(/[\uac00-\ud7af]/g),c=r(/[\u0370-\u06ff\u0900-\u097f]/g),f=r(/[\u0e00-\u0e7f]/g),u=Math.max(a,i+s,l,c,f);if(!u)return o||'en';if(i+s===u)return i>20?'ja':'zh';if(l===u)return'ko';if(f===u)return'th';if(c===u)return o||'xx';const d=t.slice(0,12e3).toLowerCase().match(/\p{L}+/gu)||[];let p='',h=0;for(const t of['en','de','fr','es','it','pt','nl']){const e=new Set(L[t].split(',').slice(0,30));let n=0;for(const t of d)e.has(Y(t))&&n++;n>h&&(h=n,p=t)}return o&&o!==p&&L[o]&&h<.12*d.length?o:h>.05*d.length?p:o||p||'en'})(f));let u=null;for(const t of a)if(1===t.h&&(!u||g(t.G,i))&&(u=t,g(t.G,i)))break;let d=u?it(u.t):'';if(!d){const t=e.querySelector('meta[property="og:title"]');d=it(t&&t.content||e.title||location.hostname)}const p=[];let h=0,w=0;for(const t of s)Q(t.G,i)||(h+=t.words,X&&(w+=(t.t.match(P)||[]).length));let x=0,v=!1;const y=new Set(c),k=new Set,M=[],S=/(?{for(let e=t.G,n=0;e&&e!==i&&n<4;e=b(e),n++)if('header'===e.localName||S.test(e.getAttribute('class')||''))return!0;return!1};for(const t of s){if(p.length>=4e3)break;if(t.h&&t.h>1){x++;continue}if(!y.has(t))continue;t.Z=!v&&0===t.h&&z(t),!t.Z&&t.words>=12&&(v=!0);const e=at(t),n=!!t.G.closest('blockquote,q,aside,figure');e.forEach((o,r)=>{const a=t.t.slice(o[0],o[1]).toLowerCase().replace(/[^\p{L}\p{N}]+/gu,' ').trim();if(a.length>24&&(k.has(a)||n&&M.some(t=>t.includes(a))))return;k.add(a),a.length>24&&M.push(a);const i=ot(t.t.slice(o[0],o[1]),o[0]);i.length&&p.push({B:t,a:o[0],b:o[1],k:r,tt:e.length,$:x,n:X?Math.ceil(i.reduce((t,e)=>t+e.l,0)/2):i.length,et:i,text:it(t.t.slice(o[0],o[1]))})})}const q=p.length;if(q<3||!(X?w>200:h>=80))return{empty:!0,title:d,lang:J,root:i,words:h};const C=new Map;let A=0;for(const t of p){t.nt=new Map;for(const e of t.et)if(e.s){let n=C.get(e.s);void 0===n&&C.set(e.s,n=A++),t.nt.set(n,(t.nt.get(n)||0)+1)}}const F=new Uint32Array(A);for(const t of p)for(const e of t.nt.keys())F[e]++;const E=new Float64Array(A);for(let t=0;t{let n=0;const[o,r]=t.v.size[]);p.forEach((t,e)=>{for(const n of t.v.keys())H[n].push(e)});const O=new Map,W=Math.max(4,Math.min(90,.35*q));for(let t=0;tW))for(let n=0;n[]),U=new Float64Array(q);for(const[t,e]of O){const n=Math.floor(t/q),o=t-n*q,r=e/(p[n].ot*p[o].ot);r<.03||(K[n].push(o,r),K[o].push(n,r),U[n]+=r,U[o]+=r)}let V=new Float64Array(q).fill(1/q),G=new Float64Array(q);for(let t=0;t<32;t++){G.fill(.15/q);for(let t=0;t{const n=t.et,o=t.B.t;for(let r=0;r0&&/^\p{Lu}/u.test(a.raw)?a.raw:a.raw.toLowerCase();i.f.set(s,(i.f.get(s)||0)+1),r>0&&/^\p{Lu}/u.test(a.raw)&&i.rt++,i.st.length<400&&i.st.push([t.B,a.o,a.o+a.l,e]);const l=n[r+1];if(l&&l.s&&!/^\d/.test(l.s)&&(X||l.w.length>=3)&&/^[\s\u00a0-]*$/.test(o.slice(a.o+a.l,l.o))){const n=a.s+' '+l.s;let i=dt.get(n);i||dt.set(n,i={s:n,p:[a.s,l.s],c:0,f:new Map,rt:0,st:[]}),i.c++;const s=o.slice(a.o,l.o+l.l).replace(/\s+/g,' '),c=r>0&&/\p{Lu}/u.test(s)?s:s.toLowerCase();i.f.set(c,(i.f.get(c)||0)+1),r>0&&(/^\p{Lu}/u.test(a.raw)||/^\p{Lu}/u.test(l.raw))&&i.rt++,i.st.length<200&&i.st.push([t.B,a.o,l.o+l.l,e])}}});const pt=new Set(ot(d,0).map(t=>t.s).filter(Boolean)),ht=[];for(const t of st.values())t.c>=2&&ht.push({...t,lt:t.c*(pt.has(t.s)?1.6:1)*(t.b.size>1?1:.6)*(t.rt>.6*t.c?1.15:1),ct:[t.s]});for(const t of dt.values())(t.c>=3||t.c>=2&&(t.rt>=t.c||t.p.every(t=>pt.has(t))))&&ht.push({...t,lt:2.6*t.c*(t.p.some(t=>pt.has(t))?1.4:1),ct:t.p});ht.sort((t,e)=>e.lt-t.lt);const bt=[],gt=new Set;for(const t of ht){if(bt.length>=7)break;if(t.ct.some(t=>gt.has(t)))continue;if(1===t.ct.length&&ht.some(e=>2===e.ct.length&&e.ct.includes(t.s)&&e.c>=.7*t.c))continue;t.ct.forEach(t=>gt.add(t));let e='',n=0;for(const[o,r]of t.f)(r>n||r===n&&omt.add(t));const wt=3+.06*q;let xt=0;for(let t=0;t{let t=0;for(const n of rt)e.v.has(n)&&t++;return t/rt.size})():0,e.ut=Math.exp(-xt++/wt);let o=0;for(const t of e.et)t.s&&mt.has(t.s)&&o++;e.kw=Math.min(1,o/4);const r=e.n;let a=r<5?.15:r<8?.55:r<=38?1:r<=55?.8:.5;const i=e.text;/\?\s*["'\u201d\u00bb)]*$/.test(i)&&(a*=.65),/:\s*$/.test(i)&&(a*=.55),/!\s*["'\u201d\u00bb)]*$/.test(i)&&(a*=.9),'en'===J&&I.test(i)&&(a*=.82),('li'===e.B.G.localName||e.B.G.closest('li'))&&(a*=.88),e.B.G.closest('blockquote')&&(a*=.8),0===e.k?a*=e.tt>1?1.08:1.04:e.k===e.tt-1&&e.tt>2&&(a*=.96),/\d/.test(i)&&(a*=1.05),(/\b(cookie|subscribe|sign up|newsletter|all rights reserved|click here|terms of service|privacy policy)\b/i.test(i)||/\u00a9/.test(i))&&(a*=.2),e.dt=(.54*n+.14*e.ft+.14*e.ut+.18*e.kw)*a}p.forEach((t,e)=>t.i=e);let vt=null,yt=-1,kt=0;for(const t of p)kt=Math.max(kt,t.dt);for(const t of p){if(t.n<(t.i<3?7:X?8:10)||t.n>45||/\?\s*$/.test(t.text))continue;const e=.42*t.dt/(kt||1)+.22*t.ft+.26*t.ut+(t.B.Z?.2:0);e>yt&&(yt=e,vt=t)}vt||(vt=p.slice().sort((t,e)=>e.dt-t.dt)[0]);const Mt=q<10||h<400?3:q<22?4:5,St=[vt],zt=p.filter(t=>t!==vt&&!t.B.Z&&t.n>=9&&t.n<=60).sort((t,e)=>e.dt-t.dt).slice(0,60);zt.lengtht!==vt&&!zt.includes(t)&&t.n>=6&&t.n<=60).sort((t,e)=>e.dt-t.dt).slice(0,Mt));const Lt=new Set(p.map(t=>t.$)).size;for(;St.length<=Mt&&zt.length;){let t=-1,e=-1e9;if(zt.forEach((n,o)=>{let r=0;for(const t of St)r=Math.max(r,B(n,t),t.B===n.B?.5:0,Lt>2&&t.$===n.$?.3:0);const a=n.dt/(kt||1)*.7-.3*r;a>e&&(e=a,t=o)}),t<0)break;St.push(zt.splice(t,1)[0])}const $t=St.slice(1).sort((t,e)=>t.i-e.i),jt=((t,e)=>{const n=[];for(const o of t){const t=o.B.t,r=t.slice(o.a,o.b);let a;for(lt.lastIndex=0;a=lt.exec(r);){const r=o.a+a.index;let i=r+a[0].length;const s=a[2],l=parseFloat(s.replace(/[,\u00a0\u202f\u2009 ](?=\d{3}\b)/g,'').replace(',','.'));if(!isFinite(l))continue;if((/\p{L}/u.test(t[r-1]||'')||/[\p{L}]/u.test(t[i]||'')&&!/^\s/.test(t[i]||''))&&!/^(k|m|bn)(?![\p{L}])/iu.test(t.slice(i)))continue;let c=a[1]||a[3]?3:0;const f=/^(k|m|bn|b)(?![\p{L}])/iu.exec(t.slice(i,i+3));f&&(i+=f[0].length,c=Math.max(c,2.6));const u=ut.exec(t.slice(i,i+16));u&&(i+=u[0].length,lt.lastIndex=i-o.a,u[2]&&(c=3));const d=ft.exec(t.slice(i,i+40));let p='';d&&d[0].trim()&&(p=d[0],i+=p.length,c=Math.max(c,/percent/i.test(p)?3:RegExp('^\\s?('+ct+')','iu').test(p)?2.6:2)),c||(c=/^\d{4}$/.test(s)&&l>=1500&&l<=2100?.15:u?1.6:l>=1e3?2:l>=10?.9:.25),/^\s?%/.test(t.slice(i))||n.push({S:o,a:r,b:i,kind:c,lt:c*(.35+o.dt/(e||1)),text:t.slice(r,i).trim()})}}n.sort((t,e)=>e.lt-t.lt);const o=[],r=new Set,a=new Set;for(const t of n){if(o.length>=3||t.kind<.8)break;const e=t.text.replace(/\s+/g,'').toLowerCase();if(r.has(t.S)||a.has(e))continue;r.add(t.S),a.add(e);const n=t.S.B.t;let i=t.a,s=t.b;const l=/[.;:!?\u3002\n(]/,c=/[.;:!?\u3002\n)]/,f=t=>t.trim()?t.trim().split(/\s+/).length:0;for(;i>t.S.a&&!l.test(n[i-1])&&!(','===n[i-1]&&f(n.slice(i,t.a))>=3);)i--;for(;si&&p<7;)u--,' '===n[u]&&' '!==n[u+1]&&p++;for(;di?'\u2026':'')+it(n.slice(u,d))+(dt.S.i-e.S.i||t.a-e.a)})(p,kt),qt=$[J]||200,It=X?w/(j[J]||300)*60:h/qt*60,Ct=[vt,...$t].reduce((t,e)=>t+e.n,0),At=Ct/(X?180:qt)*60;return{title:d,bt:u?u.G:null,lang:J,root:i,gt:a,wt:s,xt:c,vt:l,yt:p,main:vt,points:$t,M:jt,L:bt,words:X?Math.round(w/1.6):h,kt:Ct,Mt:It,St:At,ms:Math.round(m()-o)}}const lt=RegExp('([\\$\u20ac\xa3\xa5\u20b9]\\s?)?(\\d{1,3}(?:[,\\u00a0\\u202f\\u2009 ]\\d{3})+(?:[.,]\\d+)?|\\d+(?:[.,]\\d+)?)(\\s?(?:%|\\u2030))?','g'),ct='thousand|million|billion|trillion|bn|mln|mio\\.?|mrd\\.?|millions?|milliards?|millones|mil millones|milioni|miliardi|milh\\p{L}*|bilh\\p{L}*',ft=RegExp('^(?:\\s?(?:'+ct+')(?![\\p{L}]))?(?:\\s?(?:percent|per cent|degrees?|\\u00b0\\s?[cf]|km/h|kph|mph|km|kilomet\\p{L}*|miles?|meters?|metres?|cm|mm|kg|grams?|g|tons?|tonnes?|lbs?|pounds?|liters?|litres?|ml|gb|mb|tb|kb|kwh|mwh|gw|mw|kw|hz|khz|ghz|ms|hours?|hrs?|minutes?|mins?|seconds?|secs?|days?|weeks?|months?|years?|decades?|centuries|times|square \\S+|cubic \\S+|dollars?|euros?|usd|eur)(?![\\p{L}]))?','iu'),ut=RegExp('^\\s?(?:to|-|\\u2013|\\u2014|bis|\\u00e0|a|al)\\s?(\\d[\\d.,]*)(\\s?%)?','i'),dt=(t,e,n)=>{const o=t.Y,r=o.length/3;let a=0,i=r-1,s=n?0:r-1;if(n)for(;a<=i;){const t=a+i>>1;o[3*t+1]>1;o[3*t+2]>e?(s=t,i=t-1):a=t+1}const c=o[3*s];return[c,Math.min(c.length,l(e,o[3*s+1],o[3*s+2])-o[3*s+1])]},pt=(t,n,o)=>{try{const r=e.createRange(),a=dt(t,n,0),i=dt(t,o,1);return r.setStart(a[0],a[1]),r.setEnd(i[0],i[1]),r}catch(t){return null}},ht=t.CSS&&CSS.highlights&&t.Highlight?CSS.highlights:null,bt={};let gt=null;const mt=new Set;let wt,xt,vt,yt,kt=null,Mt=!0,St='intro',zt=0,Lt=0,$t=0,jt=!1,qt={},It=0,Ct=0,At=1,Ft=!1,Tt=[],Nt=[],Dt=[],Et=[],Rt=[];const Pt=[],Bt=[];let Ht={x:0,y:0,level:0,show:0,zt:0,Lt:1},Ot={start:2.1,done:!1,p:0},Wt=-1,_t=!1,Kt={},Ut=null,Vt=null,Gt=null,Qt=null,Yt=null,Jt=null,Xt=-1,Zt=-1,te='q',ee=0,ne=null,oe=null;const re={$t:'none',jt:'',qt:[],It:0,Ct:'',map:[]},ae=t=>{const n=t.G.getRootNode();gt&&n!==e&&n.adoptedStyleSheets&&!mt.has(n)&&(mt.add(n),n.adoptedStyleSheets=[...n.adoptedStyleSheets,gt])};function ie(t){for(const e of Tt){let n=f(l((1.25*t-e.d)/.9,0,1));!e.near&&n>.001&&(n=1),n=Math.round(50*n)/50,n!==e.p&&(e.p=n,n<=.001?e.on&&(z(e.G),e.on=!1):(e.on=!0,M(e.G,'transition-property','none'),M(e.G,'opacity',e.o*(1-.86*n)+''),M(e.G,'filter','blur('+(1.8*n).toFixed(2)+'px) grayscale('+n.toFixed(2)+')'),M(e.G,'translate','0 '+(-10*n).toFixed(1)+'px'),M(e.G,'pointer-events','none')))}for(const e of Nt){const n=Math.round(50*f(t))/50;n!==e.p&&(e.p=n,n<=.001?e.on&&(z(e.G),e.on=!1):(e.on=!0,M(e.G,'transition-property','none'),M(e.G,'opacity',e.o*(1-.6*n)+''),M(e.G,'filter','grayscale('+(.7*n).toFixed(2)+')')))}}let se=-1,le=-1;function ce(t){t=Math.round(4*t)/4,Ut&&t!==se&&(se=t,t<=0?Ut.style.removeProperty('color'):Ut.style.setProperty('color',v(Kt.At,x(Kt.dim),t)))}function fe(t){t=Math.round(4*t)/4,Vt&&t!==le&&(le=t,Vt.style.setProperty('background-color',jt?'rgba(232,220,74,'+t+')':'rgba(255,230,64,'+(.78*t).toFixed(3)+')'),jt&&t>.5?Vt.style.setProperty('color','#15150f'):Vt.style.removeProperty('color'))}const ue=(t,n,o,r)=>{const a=e.createElement(t);return n&&(a.className=n),void 0!==r&&(a.textContent=r),o&&o.appendChild(a),a},de=(t,n,o)=>{const r=e.createElementNS('http://www.w3.org/2000/svg',t);for(const t in n)r.setAttribute(t,n[t]);return o&&o.appendChild(r),r},pe='M9 2.5h6 M10 2.5v7.5L3.6 21.6c-.9 1.7.3 3.4 2.2 3.4h12.4c1.9 0 3.1-1.7 2.2-3.4L14 10V2.5',he='undefined'!=typeof Path2D?new Path2D('M10 2.5v7.5L3.6 21.6c-.9 1.7.3 3.4 2.2 3.4h12.4c1.9 0 3.1-1.7 2.2-3.4L14 10V2.5z'):null;function be(){const t=jt?{g:'rgba(25,29,31,.93)',so:'#191d1f',i:'#eef1ef',m:'#9ca6a7',l:'rgba(238,241,239,.15)',h:'rgba(238,241,239,.07)',b:'#93b2ff',k:'rgba(232,220,74,.42)',w:'#93b2ff',x:'#0d1424',e:'rgba(255,255,255,.07)'}:{g:'rgba(250,251,250,.94)',so:'#fbfcfb',i:'#1b2326',m:'#5c676b',l:'rgba(27,35,38,.14)',h:'rgba(31,79,209,.07)',b:'#1f4fd1',k:'#ffe84a',w:'#1f4fd1',x:'#ffffff',e:'rgba(27,35,38,.06)'};for(const e in t)wt.style.setProperty('--'+e,t[e])}function ge(){const e=wt.getBoundingClientRect();It=e.width||innerWidth,Ct=e.height||innerHeight,At=Math.min(2,t.devicePixelRatio||1),xt.width=Math.round(It*At),xt.height=Math.round(Ct*At),vt.setTransform(At,0,0,At,0,0),Ft=It<640,yt&&(yt.classList.toggle('sheet',Ft),me())}function me(){if(!qt.Ft)return;const t=qt.Ft.getBoundingClientRect();Ht.x=t.left+t.width/2,Ht.y=t.top+t.height/2}const we=t=>t<57.5?Math.max(5,5*Math.round(t/5))+'\xa0'+A.$:Math.max(1,Math.round(t/60))+'\xa0'+A.min,xe=t=>{qt.Tt&&qt.Tt.setAttribute('y',(25-15.5*l(t,0,1)).toFixed(2))};function ve(){const t='a'===te&&re.qt.length,e=t?{main:re.jt||kt.main.text,qt:re.qt}:{main:kt.main.text,qt:kt.points.map(t=>t.text)},n=2===ee&&ne?t?ne.ai:ne.q:null;return{useAI:t,main:n&&n.main||e.main,qt:e.qt.map((t,e)=>n&&n.qt[e]||t)}}function ye(){if(!qt.qt)return;const t=ve(),e=t.useAI;if(qt.jt.textContent='',ue('span','',qt.jt,t.main).dir='auto',qt.qt.textContent='',t.qt.forEach((t,e)=>{const n=ue('li','',qt.qt),o=ue('button','pt',n);o.dataset.act='jump',o.dataset.i=e+'',ue('em','',o,e+1+''),ue('span','',o,t).dir='auto'}),'work'===re.$t&&'a'===te&&!re.qt.length){const t=ue('li','',qt.qt);ue('span','note',t,A.N+'\u2026')}qt.tabs.hidden=!(re.qt.length||'work'===re.$t);for(const t of qt.tabs.children)t.setAttribute('aria-pressed',(t.dataset.m===te)+'');qt.note&&(qt.note.textContent=2===ee?A.H:e?A.P:A.R)}function ke(t){const e=t.target.closest('button');if(!e||!e.dataset.act)return;t.stopPropagation();const n=+e.dataset.i;switch(e.dataset.act){case'close':Qe();break;case'mini':yt.classList.toggle('mini'),me();break;case'focus':Le();break;case'jump':Me(n);break;case'fig':{const t=kt.M[n];Se(t.S.B,t.S.a,t.S.b,[t.S.B,t.a,t.b]);break}case'kw':ze(n);break;case'copy':je();break;case'share':navigator.share({title:kt.title,text:$e(),url:location.href}).catch(()=>{});break;case'mode':te=e.dataset.m,re.Nt=!0,ye();break;case'tr':(async()=>{if(1===ee)return;if(2===ee)return ee=0,qt.u.textContent=A.u,void ye();const t=C.split(/[-_]/)[0];ee=1,qt.u.textContent=A.D+'\u2026';try{const e=await Translator.create({sourceLanguage:J,targetLanguage:t,monitor(t){return t.addEventListener('downloadprogress',t=>{qt.u.textContent=A.D+' '+Math.round(100*t.loaded)+'%'})}});oe=e;const n=async t=>t?it(await e.translate(t)):t,o={main:await n(kt.main.text),qt:[]};for(const t of kt.points)o.qt.push(await n(t.text));ne={q:o,ai:await Te(!0)},ee=2,qt.u.textContent=A.C}catch(t){return ee=0,qt.u.textContent=A.u,void(qt.note.textContent=A.U)}ye()})();break;case'ai':Ce(!0)}}function Me(t){let e;e=t<0?'a'===te&&re.jt&&re.map[0]?re.map[0]:kt.main:'a'===te&&re.qt.length?re.map[t+1]:kt.points[t],e&&Se(e.B,e.a,e.b)}function Se(o,r,i,c){const f=pt(o,r,i);if(!f)return;const u=f.getBoundingClientRect(),d=(t=>{const o=e.scrollingElement||n;for(let e=b(t);e&&e!==o;e=b(e)){const t=getComputedStyle(e);if(/(auto|scroll|overlay)/.test(t.overflowY)&&e.scrollHeight>e.clientHeight+4)return e}return null})(o.G),p=Ft&&yt?yt.getBoundingClientRect().height:0,h=Ft?Math.max(70,.32*(Ct-p)):.3*Ct;if(d){const t=d.getBoundingClientRect();d.scrollBy({top:u.top-t.top-Math.min(.3*d.clientHeight,h),behavior:s||a?'auto':'smooth'})}else{const o=l(t.scrollY+u.top-h,0,(e.scrollingElement||n).scrollHeight-Ct);Math.abs(o-t.scrollY)>2&&(Yt={from:t.scrollY,to:o,t:0,d:s?0:l(Math.abs(o-t.scrollY)/2600,.35,.8)})}const g=c?pt(c[0],c[1],c[2]):f;bt.flash&&g&&(bt.flash.clear(),bt.flash.add(g),Jt={t:0}),_e()}function ze(t){const e=kt.L[t];if(!e||!bt.kw)return;if(Xt!==t){Xt=t,Zt=-1,bt.kw.clear();for(const t of e.st){const e=pt(t[0],t[1],t[2]);e&&bt.kw.add(e)}}if(Zt++,qt.Dt.forEach((t,e)=>{t.setAttribute('aria-pressed',(e===Xt)+''),t.lastChild.textContent=kt.L[e].count+''}),Zt>=e.st.length)return Xt=-1,bt.kw.clear(),void qt.Dt[t].setAttribute('aria-pressed','false');qt.Dt[t].lastChild.textContent=Zt+1+'/'+e.st.length;const n=e.st[Zt];Se(n[0],n[1],n[2])}function Le(){_t=!_t,qt.focus&&qt.focus.setAttribute('aria-pressed',_t+''),ie(_t?0:1),ce(_t?0:1)}function $e(){const t=ve();let e=kt.title+'\n'+location.href+'\n\n'+A.main+': '+t.main+'\n\n'+A.points+':\n'+t.qt.map(t=>'- '+t).join('\n');return kt.M.length&&(e+='\n\n'+A.M+': '+kt.M.map(t=>t.text+' ('+t.ht+')').join('; ')),kt.L.length&&(e+='\n'+A.L+': '+kt.L.map(t=>t.label).join(', ')),e+='\n\n'+we(kt.Mt)+' '+A.read+' \u2192 '+we(kt.St),r.credit&&(e+='\n'+A.W+': github.com/shmidtqq65/distill'),e}function je(){const o=$e(),r=()=>{qt.copy.textContent=A.I,setTimeout(()=>{qt.copy&&(qt.copy.textContent=A.copy)},1600)},a=()=>{const t=e.createElement('textarea');t.value=o,t.setAttribute('data-distill',''),t.style.cssText='position:fixed;left:-9999px;top:0;opacity:0',n.appendChild(t),t.select();try{e.execCommand('copy')&&r()}catch(t){}t.remove(),qt.copy.focus()};navigator.clipboard&&t.isSecureContext?navigator.clipboard.writeText(o).then(r,a):a()}function qe(t,e){return{type:t,length:e,format:'plain-text',expectedInputLanguages:[J],expectedContextLanguages:[J],outputLanguage:J,sharedContext:'A web page titled "'+kt.title+'" from '+location.hostname+'.'}}function Ie(t){const e=kt.yt.slice();let n='';if(t){const o=new Set(kt.yt.slice().sort((t,e)=>e.dt-t.dt).slice(0,Math.max(8,Math.floor(kt.yt.length*t))).map(t=>t.i));let r=null;for(const t of e)o.has(t.i)&&(n+=(r&&r!==t.B?'\n\n':r?' ':'')+t.text,r=t.B);return n}let o=null;for(const t of e)n+=(o&&o!==t.B?'\n\n':o?' ':'')+t.text,o=t.B;return n}async function Ce(e){if('work'===re.$t||'done'===re.$t||!t.Summarizer)return;re.$t='work',re.It=0,Fe(),ye(),qt.Et&&qt.Et.setAttribute('opacity','1');const n=t=>t.addEventListener('downloadprogress',t=>{re.It=t.loaded,Fe()}),o=Summarizer.create({...qe('tldr','short'),monitor:n}),r=Summarizer.create({...qe('key-points','medium'),monitor:n});o.catch(()=>{}),r.catch(()=>{});try{const t=await o;if(!Mt)return;const e=await(async t=>{let e=Ie(0);if(!t.inputQuota||!t.measureInputUsage)return e.slice(0,12e3);let n=await t.measureInputUsage(e),o=1;for(let r=0;r<5&&n>t.inputQuota;r++)o*=Math.min(.9,t.inputQuota/n*.92),e=Ie(o),n=await t.measureInputUsage(e);return e})(t),n='Summarize for a busy reader. Keep names and numbers exact.';if(re.jt=it(await t.summarize(e,{context:n})),!Mt)return;ye();const a=await r;let i='';const s=()=>i.split('\n').map(t=>it(t.replace(/^\s*(?:[-*\u2022]|\d+[.)])\s*/,'').replace(/\*\*/g,''))).filter(t=>t.length>2);if(a.summarizeStreaming){const t=a.summarizeStreaming(e,{context:n});for await(const e of t){if(!Mt)return;i=i&&e.startsWith(i)?e:i+e,re.qt=s(),re.qt.length&&!re.Nt&&(te='a'),ye()}}else i=await a.summarize(e,{context:n});re.qt=s().slice(0,7),re.map=[re.jt,...re.qt].map(Ae),re.$t=re.qt.length?'done':'err',re.qt.length?re.Nt||(te='a'):te='q',2===ee&&oe&&Te()}catch(n){te='q',e||re.qt.length?(re.$t='err',re.Ct=(n&&n.message||n)+'',t.console&&console.warn('DISTILL',n)):re.$t='offer'}finally{for(const t of[o,r])t.then(t=>{try{t.destroy()}catch(t){}},()=>{})}qt.Et&&qt.Et.setAttribute('opacity','0'),Fe(),ye()}function Ae(t){const e=ot(t,0);let n=null,o=0;for(const t of kt.yt){let r=0;for(const n of e)if(n.s)for(const e of t.et)if(e.s===n.s){r++;break}const a=r/Math.sqrt(1+t.et.length);a>o&&(o=a,n=t)}return n}function Fe(){const t=qt.Rt;t&&(t.textContent='',t.hidden=!('offer'===re.$t||'work'===re.$t&&re.It>0&&re.It<1||'err'===re.$t),'offer'===re.$t?(ue('div','',t,A.F+('available'===re.Pt?'':' '+A.T)),ue('button','b',t,A.A).dataset.act='ai'):'work'===re.$t?(ue('div','',t,A.dl+' '+Math.round(100*re.It)+'%'),ue('i','',ue('div','bar',t)).style.width=(100*re.It).toFixed(1)+'%'):'err'===re.$t&&ue('div','',t,A.K))}async function Te(t){const e={main:'',qt:[]};try{re.jt&&(e.main=it(await oe.translate(re.jt)));for(const t of re.qt)e.qt.push(it(await oe.translate(t)))}catch(t){}if(t)return e;ne&&(ne.ai=e,ye())}let Ne=null;const De=t=>{const n=e.createElement('canvas');n.width=n.height=64;const o=n.getContext('2d'),r=o.createRadialGradient(32,32,0,32,32,32);return r.addColorStop(0,'rgba('+t+',1)'),r.addColorStop(.42,'rgba('+t+',.5)'),r.addColorStop(1,'rgba('+t+',0)'),o.fillStyle=r,o.fillRect(0,0,64,64),n};function Ee(t){Pt.push(t.Bt?{w:1,x:h(t.l+4,t.r-4),y:t.t+4,vx:0,vy:h(-52,-34),r:h(1.8,3),Ht:h(26,50),Ot:0,Wt:h(.9,1.5),a:h(.45,.7),_t:h(3,7),Kt:h(0,6.3)}:{x:h(t.l,t.r),y:h(t.t,Math.min(t.b,t.t+70)),vx:h(-8,8),vy:h(-85,-40),r:h(10,20),Ht:h(26,50),Ot:0,Wt:h(1,1.9),a:h(.08,.15),_t:h(.55,.85)})}function Re(t){if(s||!t.r)return;const e=[...t.r.getClientRects()].filter(t=>t.bottom>0&&t.top4);if(!e.length)return;const n=l(4*e.length,6,12);for(let t=0;t{const a=1-r;return a*a*a*t+3*a*a*r*e+3*a*r*r*n+r*r*r*o};function Be(e){zt+=e=Math.min(e,.05),s&&'intro'===St&&(zt=Math.max(zt,3.2));const n=l((zt-.05)/1,0,1);if('intro'===St||'idle'===St){!_t&&zt<1.4&&(ie(n),ce(l((zt-.15)/.75,0,1)));let t=0;for(const e of Rt){if(!e.r)continue;if(!e.start){const n=e.r.getBoundingClientRect(),o=pt(e.S.B,e.S.a,e.S.b),r=o?o.getBoundingClientRect():n;e.Qt=!s&&r.bottom>0&&r.top0,e.start=e.Qt?.45+.14*t++:.45,e.Yt=e.Qt?l((e.S.b-e.S.a)/300,.34,.62):0}const n=e.Yt?l((zt-e.start)/e.Yt,0,1):zt>=e.start?1:0;if(n!==e.p&&n>0){e.p=n;const t=Math.round(c(e.S.a,e.S.b,u(n))),o=dt(e.S.B,t,1);try{e.r.setEnd(o[0],o[1])}catch(t){}bt.key&&(bt.key.delete(e.r),bt.key.add(e.r)),n>=1&&e.Qt&&!e.Jt&&(e.Jt=!0,Re(e))}}zt<1&&fe(l((zt-.5)/.2,0,1)),zt>.6&&!Ht.show&&Rt.some(t=>t.Qt)&&(Ht.show=.001)}(t=>{if(s)return;const e=l(zt/1.1,0,1);if(!(e>=1||Wt>=0))for(const n of[!1,!0]){const o=Dt.filter(t=>t.Bt===n),r=o.reduce((t,e)=>t+e.w,0);let a=(1-e)*(n?120:130)*t;for(;a>0&&o.length&&!(a<1&&p()>a);){a--;let t=p()*r,e=o[0];for(const n of o)if(t-=n.w,t<=0){e=n;break}Ee(e)}}})(e);for(let t=Pt.length-1;t>=0;t--){const n=Pt[t];n.Ot+=e,n.Ot>n.Wt?Pt.splice(t,1):n.w?n.y+=n.vy*e:(n.vx+=(22*Math.sin(.02*n.y+3*n.Ot)-.6*n.vx)*e,n.x+=n.vx*e,n.y+=n.vy*e,n.vy*=1-.25*e,n.r+=n.Ht*e)}let o=0;for(const t of Bt){if(t.done)continue;if(t.Ot+=e,t.Ot<=0){o++;continue}const n=l(t.Ot/t.Wt,0,1),r=n*n*(3-2*n)*.35+n*n*.65;t.px=t.x,t.Gt=t.y,t.x=Pe(t.Ut,t.Ut+.3*t._t,Ht.x+t._t,Ht.x,r),t.y=Pe(t.Vt,t.Vt+70,Ht.y-190,Ht.y-18,r),n>=1?(t.done=!0,Ht.zt++,Ht.Xt=1):o++}if(Ht.show&&(Ht.show=Math.min(1,Ht.show+3*e)),Ht.Xt&&(Ht.Xt=Math.max(0,Ht.Xt-4*e)),'intro'===St){const t=Rt.some(t=>t.Qt);if(!Ot.go&&(zt>=(t?1.75:1)&&!o||zt>=2.6)&&(Ot.go=zt),Ot.go){if(Ot.p=s?1:l((zt-Ot.go)/.62,0,1),yt){const t=f(Ot.p);yt.style.clipPath='inset('+(100*(1-t)).toFixed(2)+'% 0 0 0 round '+(Ft?18:14)+'px)',yt.style.opacity=l(3*Ot.p,0,1)+''}Ot.p>=1&&(St='idle',yt.style.clipPath='none',Ot.t=zt)}}if(qt.fill&&void 0!==Ot.t){const t=u(l((zt-Ot.t-.1)/.8,0,1));qt.fill.style.width=(100*c(1,qt.Zt,t)).toFixed(2)+'%'}else qt.fill&&(qt.fill.style.width='100%');if(Yt){Yt.t+=e;const n=Yt.d?u(Yt.t/Yt.d):1;t.scrollTo({top:c(Yt.from,Yt.to,n),behavior:'instant'}),n>=1&&(Yt=null)}if(Jt){Jt.t+=e;const t=Jt.t<.25?Jt.t/.25:Math.max(0,1-(Jt.t-.25)/1.1);Gt&&Gt.style.setProperty('background-color',jt?'rgba(147,178,255,'+(.55*t).toFixed(3)+')':'rgba(31,79,209,'+(.28*t).toFixed(3)+')'),Jt.t>1.4&&(Jt=null,bt.flash&&bt.flash.clear())}if('exit'===St){const t=l((zt-Wt)/.42,0,1),e=f(t);if(ie(_t?0:1-e),ce(_t?0:1-e),fe(1-e),Qt&&Qt.style.setProperty('background-color',(jt?'rgba(61,95,196,':'rgba(205,220,255,')+(1-e).toFixed(3)+')'),yt&&(yt.style.clipPath='inset('+(100*e).toFixed(2)+'% 0 0 0 round 14px)',yt.style.opacity=1-.6*e+''),t>=1)return void Ye()}He()}function He(){vt.clearRect(0,0,It,Ct);const t='exit'===St?0:l(zt/.3,0,1)*l((2.3-zt)/.8,0,1);if(t>0&&!s){const e=.85+.15*Math.sin(23*zt)*Math.sin(7.3*zt),n=vt.createLinearGradient(0,Ct,0,Ct-150);n.addColorStop(0,'rgba(56,104,255,'+(.22*t*e).toFixed(3)+')'),n.addColorStop(.35,'rgba(56,104,255,'+(.08*t*e).toFixed(3)+')'),n.addColorStop(1,'rgba(56,104,255,0)'),vt.fillStyle=n,vt.fillRect(0,Ct-150,It,150)}if(Pt.length){Ne||(Ne=De(jt?'228,234,238':'104,124,146'));const t=jt?'228,234,238':'96,118,142';vt.lineCap='round';for(const e of Pt){const n=e.Ot/e.Wt;if(e.w){const o=e.Ht*(.45+n),r=e.a*Math.sin(Math.PI*n);if(r<=.01)continue;const a=vt.createLinearGradient(0,e.y,0,e.y-o);a.addColorStop(0,'rgba('+t+',0)'),a.addColorStop(.35,'rgba('+t+','+r.toFixed(3)+')'),a.addColorStop(1,'rgba('+t+',0)'),vt.strokeStyle=a,vt.lineWidth=e.r*(1+n),vt.beginPath();for(let t=0;t<=8;t++){const n=t/8,r=e.x+Math.sin(e.Kt+4.2*n+4*e.Ot)*e._t*n,a=e.y-n*o;t?vt.lineTo(r,a):vt.moveTo(r,a)}vt.stroke();continue}const o=e.a*(n<.2?n/.2:1-(n-.2)/.8);o<=.003||(vt.globalAlpha=o,vt.drawImage(Ne,e.x-e.r*e._t,e.y-1.25*e.r,2*e.r*e._t,2.5*e.r))}vt.globalAlpha=1}const e=Ht.show*(Ot.go?l(1-(zt-Ot.go)/.3,0,1):1),n=l(Ht.zt/Math.max(1,Ht.Lt-1),0,1);if(yt&&qt.Tt&&xe(.14+.52*(Ot.go?1:n)),e>.01&&he){const t=2.3-1.3*f(Ot.go?(zt-Ot.go)/.3:0);vt.save(),vt.globalAlpha=e,vt.translate(Ht.x,Ht.y),vt.scale(t*(1+.05*(Ht.Xt||0)),t*(1-.04*(Ht.Xt||0))),vt.translate(-12,-14),vt.fillStyle=jt?'rgba(25,29,31,.85)':'rgba(250,251,250,.9)',vt.fill(he),vt.save(),vt.clip(he),vt.fillStyle='#ffe84a';const o=25-15.5*(.14+.52*n);vt.beginPath(),vt.moveTo(0,28);for(let t=0;t<=24;t+=2)vt.lineTo(t,o+.6*Math.sin(.7*t+9*zt)*(.4+(Ht.Xt||0)));vt.lineTo(24,28),vt.fill(),vt.restore(),vt.strokeStyle=jt?'#93b2ff':'#1f4fd1',vt.lineWidth=1.4/t,vt.lineJoin=vt.lineCap='round',vt.stroke(new Path2D(pe)),vt.restore()}for(const t of Bt){if(t.done||t.Ot<=0)continue;const e=t.x-t.px,n=t.y-t.Gt,o=Math.hypot(e,n);vt.save(),vt.translate(t.x,t.y),vt.rotate(Math.atan2(n,e));const r=t.r*(1.4+Math.min(4,.16*o)),a=t.r;vt.fillStyle=jt?'#ffe84a':'#ffd915',vt.beginPath(),vt.moveTo(-r,0),vt.quadraticCurveTo(.6*-a,1.02*-a,0,-a),vt.arc(0,0,a,-Math.PI/2,Math.PI/2),vt.quadraticCurveTo(.6*-a,1.02*a,-r,0),vt.fill(),vt.strokeStyle=jt?'rgba(255,255,255,.35)':'rgba(160,118,0,.5)',vt.lineWidth=.8,vt.stroke(),vt.fillStyle='rgba(255,255,255,.9)',vt.beginPath(),vt.arc(.25*a,.38*-a,.3*a,0,2*Math.PI),vt.fill(),vt.restore()}for(const t of Rt){if(!t.Qt||t.p<=0||t.p>=1||!t.r)continue;const e=t.r.getClientRects(),n=e[e.length-1];if(!n)continue;const o=n.right,r=n.top+n.height/2,a=vt.createRadialGradient(o,r,0,o,r,.9*n.height);a.addColorStop(0,'rgba(255,248,180,.9)'),a.addColorStop(1,'rgba(255,236,80,0)'),vt.fillStyle=a,vt.fillRect(o-n.height,r-n.height,2*n.height,2*n.height)}}const Oe=()=>'idle'!==St||Pt.length||Bt.some(t=>!t.done)||Yt||Jt||qt.fill&&void 0!==Ot.t&&zt-Ot.t<1;function We(t){if(Lt=0,!Mt)return;const e=$t?(t-$t)/1e3:1/60;$t=t,Ke(e),Mt&&Oe()?Lt=requestAnimationFrame(We):$t=0}function _e(){a||!Mt||Lt||($t=0,Lt=requestAnimationFrame(We))}function Ke(t){try{Be(t)}catch(t){throw Ye(),t}}function Ue(t){if(!Mt||t.ctrlKey||t.metaKey||t.altKey)return;const e=t.composedPath?t.composedPath()[0]:t.target,n=e&&e.localName?e.localName.toLowerCase():'';if(e&&(e.isContentEditable||/^(input|textarea|select)$/.test(n)||n.includes('-')&&e!==D))return;if('Escape'===t.key)return t.preventDefault(),t.stopPropagation(),void Qe();if(!kt||kt.empty||'idle'!==St)return;const o=t.key.toLowerCase();if('c'!==o||t.shiftKey){if('h'===o)Le();else if(/^[1-7]$/.test(o)){const t=+o-1;t<('a'===te&&re.qt.length?re.qt.length:kt.points.length)&&Me(t)}}else je()}const Ve=()=>{ge(),Dt=[],He()},Ge=()=>{Yt=null};function Qe(){Mt&&'exit'!==St&&(s?Ye():(St='exit',Wt=zt,Pt.length=0,Bt.length=0,Yt=null,_e()))}function Ye(){if(Mt){Mt=!1,Xe.alive=!1,Lt&&cancelAnimationFrame(Lt),Lt=0;try{oe&&oe.destroy()}catch(t){}if(t.removeEventListener('keydown',Ue,!0),t.removeEventListener('resize',Ve),t.removeEventListener('wheel',Ge),t.removeEventListener('touchstart',Ge),ht)for(const t of['dim','key','kw','flash'])ht.get('distill-'+t)===bt[t]&&ht.delete('distill-'+t);if(gt){e.adoptedStyleSheets=e.adoptedStyleSheets.filter(t=>t!==gt);for(const t of mt)t.adoptedStyleSheets=t.adoptedStyleSheets.filter(t=>t!==gt)}for(const t of[...k.keys()])z(t);D&&D.remove(),D=null}}const Je=t=>{const e=parseFloat(getComputedStyle(t).opacity);return isNaN(e)?1:e},Xe=t.__distill={version:'1.0.0',alive:!0,toggle(){return Qe()},close:Qe,stop(){return Ye()},step(t){Mt&&Ke(void 0===t?1/60:t)},jump(t){return kt&&!kt.empty&&Me(t)},keyword(t){return kt&&!kt.empty&&ze(t)},result(){return kt&&!kt.empty?{title:kt.title,lang:kt.lang,words:kt.words,ms:kt.ms,readMinutes:+(kt.Mt/60).toFixed(1),summarySeconds:Math.round(kt.St),main:kt.main.text,points:kt.points.map(t=>t.text),figures:kt.M.map(t=>({value:t.text,context:t.ht})),keywords:kt.L.map(t=>({word:t.label,count:t.count})),ai:re.qt.length?{main:re.jt,points:re.qt.slice()}:null,root:kt.root}:{empty:!0,title:kt&&kt.title,words:kt&&kt.words}},state(){return{phase:St,t:zt,particles:Pt.length,drops:Bt.filter(t=>!t.done).length,chaff:Tt.length,dim:Et.length,highlight:!!ht,ai:re.$t,mode:te,translated:2===ee}},debug:{analyze(){return st()},summaryText(){return $e()},ai:re}};(()=>{(()=>{D=e.createElement('distill-overlay'),D.setAttribute('data-distill',''),D.style.cssText='all:initial;position:fixed;inset:0;z-index:2147483647;pointer-events:none;display:block';const t=D.attachShadow({mode:'open'}),o=new CSSStyleSheet;o.replaceSync(':host{all:initial}\n*{box-sizing:border-box}\n[hidden]{display:none!important}\n.w{position:fixed;inset:0;pointer-events:none;font:14px/1.45 var(--f);color:var(--i);-webkit-font-smoothing:antialiased;text-align:start;direction:ltr;--f:var(--distill-sans,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif);--r:var(--distill-serif,"Iowan Old Style",Charter,"Palatino Linotype",Palatino,Georgia,serif)}\n.fx{position:absolute;left:0;top:0;width:100%;height:100%}\n.card{position:absolute;right:16px;bottom:16px;width:376px;max-height:calc(100% - 32px);display:flex;flex-direction:column;pointer-events:auto;background:var(--g);color:var(--i);border-radius:14px;box-shadow:inset 0 0 0 1px var(--e),0 22px 60px -18px rgba(8,18,28,.45),0 4px 16px rgba(8,18,28,.12);backdrop-filter:blur(18px) saturate(1.4);overflow:hidden;clip-path:inset(100% 0 0 0 round 14px)}\n.card.sheet{left:8px;right:8px;bottom:8px;width:auto;max-height:min(72%,640px);border-radius:18px}\nbutton{font:inherit;color:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;text-align:inherit;-webkit-tap-highlight-color:transparent}\nbutton:focus-visible{outline:2px solid var(--b);outline-offset:2px}\n.hd{display:flex;align-items:center;gap:2px;padding:9px 8px 0 18px;font:500 12px/1.2 var(--f);color:var(--m)}\n.wm{font:600 15px/1 var(--r);letter-spacing:-.01em;color:var(--i);margin-right:9px}\n.dom{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-top:1px}\n.ic{width:30px;height:30px;border-radius:8px;display:grid;place-items:center;color:var(--m)}\n.ic:hover,.ic[aria-pressed=true]{background:var(--h);color:var(--i)}\n.ic svg{width:16px;height:16px}\n.bd{overflow:auto;overscroll-behavior:contain;padding:2px 18px 6px;scrollbar-width:thin}\n.ttl{font:600 17px/1.28 var(--r);letter-spacing:-.005em;margin:2px 0 12px;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}\n.meter{margin:0 0 18px}\n.rt{display:flex;align-items:baseline;gap:7px;font:600 15px/1.2 var(--f);font-variant-numeric:tabular-nums}\n.rt i{font-style:normal;color:var(--b);font-weight:500}\n.rt .sv{margin-left:auto;font:500 12px/1.2 var(--f);color:var(--m)}\n.scale{position:relative;height:9px;margin:9px 0 7px;border-radius:5px;box-shadow:inset 0 0 0 1px var(--b);overflow:hidden}\n.scale b{position:absolute;left:0;top:0;bottom:0;width:100%;background:var(--k);border-right:1px solid var(--b)}\n.scale u{position:absolute;top:0;width:1px;height:3px;background:var(--b);opacity:.7}\n.wc{font:400 12px/1.3 var(--f);color:var(--m);font-variant-numeric:tabular-nums}\n.sec{margin:0 0 18px}\n.lbl{display:flex;align-items:center;gap:8px;min-height:20px;font:600 11.5px/1.2 var(--f);color:var(--b);margin:0 0 7px;letter-spacing:.01em}\n.tldr{font:400 18px/1.42 var(--r);margin:0;cursor:pointer;display:block;width:100%}\n.tldr span{background:linear-gradient(transparent 55%,var(--k) 55%,var(--k) 93%,transparent 93%);-webkit-box-decoration-break:clone;box-decoration-break:clone}\n.pts{list-style:none;margin:0;padding:0}\n.pt{display:grid;grid-template-columns:22px 1fr;gap:8px;width:calc(100% + 12px);padding:6px 8px 6px 4px;margin:0 -8px 1px -4px;border-radius:9px;font:400 14px/1.48 var(--f)}\n.pt:hover,.fig:hover,.tldr:hover span{background-color:var(--h)}\n.pt em{font-style:normal;width:20px;height:20px;border-radius:50%;box-shadow:inset 0 0 0 1px var(--b);color:var(--b);font:600 10.5px/20px var(--f);text-align:center;margin-top:1px}\n.tabs{margin-left:auto;display:inline-flex;border-radius:999px;padding:2px;box-shadow:inset 0 0 0 1px var(--l)}\n.tabs button{padding:3px 9px;border-radius:999px;font:600 11px/1.25 var(--f);color:var(--m)}\n.tabs button[aria-pressed=true]{background:var(--i);color:var(--so)}\n.g{display:grid;margin:0 -8px;border-top:1px solid var(--l)}\n.fig{display:grid;grid-template-columns:92px 1fr;gap:12px;align-items:baseline;width:100%;padding:9px 8px;border-bottom:1px solid var(--l)}\n.fig b{font:600 20px/1.1 var(--r);font-variant-numeric:lining-nums;letter-spacing:-.01em;overflow-wrap:anywhere;color:var(--i)}\n.fig b i{display:block;font:500 11.5px/1.3 var(--f);font-style:normal;color:var(--m);letter-spacing:0;margin-top:2px}\n.fig small{font:400 12.5px/1.42 var(--f);color:var(--i);opacity:.82;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}\n.chips{display:flex;flex-wrap:wrap;gap:6px}\n.chip{display:inline-flex;align-items:baseline;gap:6px;padding:5px 10px;border-radius:999px;box-shadow:inset 0 0 0 1px var(--l);font:500 12.5px/1.25 var(--f)}\n.chip i{font-style:normal;font-size:11px;color:var(--m);font-variant-numeric:tabular-nums}\n.chip:hover{background:var(--h)}\n.chip[aria-pressed=true]{background:var(--w);box-shadow:none;color:var(--x)}\n.chip[aria-pressed=true] i{color:inherit;opacity:.8}\n.aib{display:grid;gap:8px;margin:2px 0 18px;padding:11px 12px;border-radius:10px;background:var(--h);font:400 12.5px/1.42 var(--f);color:var(--i)}\n.aib .bar{height:4px;border-radius:2px;background:var(--l);overflow:hidden}\n.aib .bar i{display:block;height:100%;width:0;background:var(--b)}\n.aib button{justify-self:start}\n.ft{border-top:1px solid var(--l);padding:9px 12px 11px 14px;display:grid;grid-template-columns:auto 1fr;gap:5px 10px;align-items:center}\n.flask{width:24px;height:28px;grid-row:span 2;overflow:visible}\n.acts{display:flex;gap:6px;flex-wrap:wrap}\n.b{padding:7px 12px;border-radius:8px;background:var(--i);color:var(--so);font:600 12.5px/1.15 var(--f)}\n.b.s{background:transparent;color:var(--i);box-shadow:inset 0 0 0 1px var(--l)}\n.b.s:hover{background:var(--h)}\n.note{font:400 11px/1.35 var(--f);color:var(--m)}\n.mini .bd,.mini .note{display:none}\n.mini .ft{border-top:0}\n.empty{padding:6px 18px 16px}\n.empty p{margin:4px 0 0;color:var(--m);font:400 13px/1.45 var(--f)}\n.empty h2{font:600 17px/1.3 var(--r);margin:0}\n.bub{animation:bub 1.6s ease-in infinite;opacity:0}\n.bub:nth-of-type(2){animation-delay:.55s}.bub:nth-of-type(3){animation-delay:1.1s}\n@keyframes bub{0%{opacity:0;transform:translateY(0)}20%{opacity:1}100%{opacity:0;transform:translateY(-9px)}}\n@media (prefers-reduced-motion:reduce){.bub{animation:none}}'),t.adoptedStyleSheets=[o],wt=ue('div','w',t),xt=ue('canvas','fx',wt),vt=xt.getContext('2d'),n.appendChild(D),be(),ge()})();try{kt=st()}catch(e){t.console&&console.warn('DISTILL',e),kt=null}if((()=>{let t=null;for(let n=kt&&kt.root?kt.root:e.body;n&&1===n.nodeType;n=b(n)){const e=x(getComputedStyle(n).backgroundColor);if(e[3]>.5){t=e;break}}const n=x(getComputedStyle(kt&&kt.xt&&kt.xt[Math.min(2,kt.xt.length-1)]?kt.xt[Math.min(2,kt.xt.length-1)].G:e.body).color);(!t||y(n)>.75&&y(t)>.5)&&(t=y(n)>.6?[18,18,18,1]:[255,255,255,1]),jt=y(t)<.42,Kt={te:t,At:n,dim:v(n,t,jt?.6:.64)}})(),be(),kt&&!kt.empty){(()=>{if(!ht)return;for(const t of['dim','key','kw','flash'])bt[t]=new Highlight,bt[t].priority={dim:1,key:2,kw:3,flash:4}[t],ht.set('distill-'+t,bt[t]);gt=new CSSStyleSheet,gt.replaceSync('::highlight(distill-dim){}::highlight(distill-key){background-color:transparent}::highlight(distill-kw){background-color:'+(jt?'#3d5fc4':'#cddcff')+';color:'+(jt?'#fff':'inherit')+'}::highlight(distill-flash){background-color:transparent}'),e.adoptedStyleSheets=[...e.adoptedStyleSheets,gt];const t=gt.cssRules;Ut=t[0],Vt=t[1],Qt=t[2],Gt=t[3]})(),(()=>{const t=[kt.main,...kt.points],e=new Map;for(const n of t)e.has(n.B)||e.set(n.B,[]),e.get(n.B).push(n);if(Rt=t.map(t=>({S:t,r:pt(t.B,t.a,t.a),p:0,start:0,Qt:!1,Jt:!1})),ht){for(const e of t)ae(e.B);if(kt.xt.length>500||kt.xt.reduce((t,e)=>t+e.t.length,0)>8e4)for(const t of Rt)t.r&&bt.key.add(t.r);else{for(const t of kt.xt){ae(t);const n=(e.get(t)||[]).slice().sort((t,e)=>t.a-e.a);let o=0;for(const e of n){const[n,r]=rt(t.t,o,e.a);r>n&&Et.push(pt(t,n,r)),o=e.b}const[r,a]=rt(t.t,o,t.t.length);a>r&&Et.push(pt(t,r,a))}Et=Et.filter(Boolean);for(const t of Et)bt.dim.add(t);for(const t of Rt)t.r&&bt.key.add(t.r)}}})();const t=(()=>{const t=kt.root,o=kt.bt,r=new Set,a=t=>{for(let e=b(t);e;e=b(e))if(r.has(e))return!0;return!1},i=t=>{if(t===D||!(t instanceof Element)||!t.style||T.has(t.localName)&&!/^(iframe|img|video|svg|picture|canvas|button|input|select|textarea|object|embed)$/.test(t.localName))return!1;if(/^(script|style|link|meta|template|noscript)$/.test(t.localName))return!1;const e=t.getBoundingClientRect();return e.width>2&&e.height>2},s=(e,n)=>{if(!(!i(e)||g(t,e)||o&&g(e,o)))if(o&&g(o,e)){if(n<6)for(const t of e.children)s(t,n+1)}else r.add(e)};for(let o=t;o&&o!==e.body&&o!==n;o=b(o)){const t=b(o);if(!t)break;const e=t.shadowRoot&&o.getRootNode()===t.shadowRoot?t.shadowRoot.children:t.children;for(const t of e)t!==o&&s(t,0)}const l=e=>kt.xt.some(n=>g(n.G,e)&&!Q(n.G,t)),c=(t,e)=>{for(const n of t.children)n!==D&&(G(n)||'iframe'===n.localName&&!l(n)?!i(n)||o&&g(o,n)||r.add(n):e<12&&c(n,e+1))};c(t,0);const f=[];return t.querySelectorAll('img,video,picture,svg,canvas,figure,iframe').forEach(t=>{t.closest('figure')&&'figure'!==t.localName||r.has(t)||a(t)||!t.style||'svg'===t.localName&&t.getBoundingClientRect().width<40||f.push(t)}),{list:[...r].filter(t=>!a(t)).slice(0,600),soft:f.slice(0,200)}})(),o=kt.root.getBoundingClientRect();Tt=t.list.map(t=>{const e=t.getBoundingClientRect(),n=Math.max(0,o.left-e.right,e.left-o.right),r=Math.max(0,o.top-e.bottom,e.top-o.bottom);return{G:t,o:Je(t),d:l(Math.hypot(n,r)/3e3,0,.12)+.16*l(e.top/Math.max(1,Ct),0,1),on:!1,p:-1,r:e,near:e.bottom>.5*-Ct&&e.top<1.5*Ct&&e.right>0&&e.left({G:t,o:Je(t),on:!1,p:-1})),Dt=(()=>{const t=[];let e=0;const n=(n,o)=>{const r=Math.max(0,n.left),a=Math.min(It,n.right),i=Math.max(0,n.top),s=Math.min(Ct,n.bottom);if(a-r<6||s-i<4)return;const l=(a-r)*Math.min(s-i,220)*(o?.6:1);t.push({l:r,r:a,t:i,b:s,w:l,Bt:o}),e+=l};for(const t of Tt)t.near&&n(t.r,!1);let o=0;for(const t of Et){if(o>80)break;const e=t.getBoundingClientRect();if(!(e.bottom<0||e.top>Ct))for(const e of t.getClientRects())n(e,!0),o++}return t.ee=e,t})()}else St='intro';(()=>{yt=ue('div','card',wt),yt.setAttribute('role','dialog'),yt.setAttribute('aria-label','DISTILL'),yt.classList.toggle('sheet',Ft);const t=ue('div','hd',yt);ue('b','wm',t,'distill'),ue('span','dom',t,location.hostname.replace(/^www\./,'')||'');const e=(e,n,o)=>{const r=ue('button','ic',t);return r.appendChild((t=>{const e=de('svg',{viewBox:'0 0 16 16',fill:'none',stroke:'currentColor','stroke-width':'1.6','stroke-linecap':'round','aria-hidden':'true'});return de('path',{d:t},e),e})(e)),r.setAttribute('aria-label',n),r.title=n,r.dataset.act=o,r};if(kt&&!kt.empty&&(qt.focus=e('M1.5 8s2.4-4.5 6.5-4.5S14.5 8 14.5 8s-2.4 4.5-6.5 4.5S1.5 8 1.5 8z M8 6.2a1.8 1.8 0 1 0 0 3.6a1.8 1.8 0 1 0 0-3.6z',A.focus,'focus')),e('M3.5 9.5h9',A._,'mini'),e('M4 4l8 8M12 4l-8 8',A.close+' (Esc)','close'),!kt||kt.empty){const t=ue('div','empty',yt);ue('h2','',t,A.empty),ue('p','',t,A.O)}else{const t=qt.bd=ue('div','bd',yt);ue('h2','ttl',t,kt.title).dir='auto';const e=ue('div','meter',t),n=ue('div','rt',e);ue('span','',n,we(kt.Mt)+' '+A.read),ue('i','',n,'\u2192'),ue('span','',n,we(kt.St)),ue('span','sv',n,A.j.replace('#',Math.max(1,Math.round(kt.words/Math.max(1,kt.kt)))));const o=ue('div','scale',e),r=kt.Mt/60,a=r>40?10:r>15?5:1;for(let t=a;t{const o=ue('button','fig',n);o.dataset.act='fig',o.dataset.i=e+'';const r=/^(.*\d[\d.,%\u2030+]*)(.*)$/.exec(t.text)||[0,t.text,''],a=ue('b','',o,r[1]);r[2].trim()&&ue('i','',a,r[2].trim()),ue('small','',o,t.ht).dir='auto'})}if(kt.L.length){const e=ue('section','sec',t);ue('div','lbl',e,A.L);const n=ue('div','chips',e);qt.Dt=kt.L.map((t,e)=>{const o=ue('button','chip',n);return o.dataset.act='kw',o.dataset.i=e+'',o.setAttribute('aria-pressed','false'),ue('span','',o,t.label).dir='auto',ue('i','',o,t.count+''),o})}}const n=ue('div','ft',yt),o=qt.Ft=de('svg',{class:'flask',viewBox:'0 0 24 28','aria-hidden':'true'},n),r='dsc'+Math.round(1e6*p()),a=de('clipPath',{id:r},de('defs',{},o));de('path',{d:'M10 2.5v7.5L3.6 21.6c-.9 1.7.3 3.4 2.2 3.4h12.4c1.9 0 3.1-1.7 2.2-3.4L14 10V2.5z'},a);const s=de('g',{'clip-path':'url(#'+r+')'},o);qt.Tt=de('rect',{x:'0',y:'25',width:'24',height:'28',fill:'var(--k)'},s),qt.Et=de('g',{opacity:'0'},s);for(const[t,e]of[[9.5,1],[13.5,.8],[11.5,1.1]])de('circle',{class:'bub',cx:t+'',cy:'22',r:e+'',fill:'var(--b)'},qt.Et);de('path',{d:pe,fill:'none',stroke:'var(--b)','stroke-width':'1.4','stroke-linejoin':'round','stroke-linecap':'round'},o),de('path',{d:'M15.2 15.5h2.2M16.2 18.5h2.2M17.2 21.5h2.2',stroke:'var(--b)','stroke-width':'1',opacity:'.7'},o);const c=qt.ne=ue('div','acts',n);kt&&!kt.empty?(qt.copy=ue('button','b',c,A.copy),qt.copy.dataset.act='copy',qt.u=ue('button','b s',c,A.u),qt.u.dataset.act='tr',qt.u.hidden=!0,navigator.share&&i('(pointer: coarse)')&&(ue('button','b s',c,A.share).dataset.act='share')):ue('button','b',c,A.close).dataset.act='close',qt.note=ue('div','note',n,kt&&!kt.empty?A.R:''),yt.addEventListener('click',ke);for(const t of'keydown keyup keypress click dblclick pointerdown pointerup mousedown mouseup wheel touchstart touchend contextmenu'.split(' '))yt.addEventListener(t,t=>t.stopPropagation(),{passive:!0});ye(),me(),xe(kt&&!kt.empty?.66:.06)})(),t.addEventListener('keydown',Ue,!0),t.addEventListener('resize',Ve),t.addEventListener('wheel',Ge,{passive:!0}),t.addEventListener('touchstart',Ge,{passive:!0}),kt&&!kt.empty&&((async()=>{if(!r.ai||a&&!t.__DS_AI_TEST||!t.Summarizer||!kt||kt.empty)return;let e;try{e=await Summarizer.availability(qe('key-points','medium'))}catch(t){return}Mt&&'unavailable'!==e&&e&&(re.Pt=e,'available'===e?Ce(!1):(re.$t='offer',Fe()))})(),(async()=>{if(!r.translate||!t.Translator||!kt||kt.empty||a&&!t.__DS_AI_TEST)return;const e=C.split(/[-_]/)[0];if(e&&e!==J&&('nb'!==e||'no'!==J))try{const t=await Translator.availability({sourceLanguage:J,targetLanguage:e});if(!Mt||!t||'unavailable'===t)return;qt.u.hidden=!1;try{const t=new Intl.DisplayNames(['en'],{type:'language'}).of(e);qt.u.title=t?t.charAt(0).toUpperCase()+t.slice(1):e}catch(t){}}catch(t){}})()),a||(s&&kt&&!kt.empty&&(ie(1),ce(1),fe(1)),s&&Be(4),_e())})()})(); } window.addEventListener('keydown', function (e) { if (!e.altKey || !e.shiftKey || e.ctrlKey || e.metaKey || e.repeat || e.code !== 'KeyD') return; var t = e.target; if (t && (t.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName))) return; e.preventDefault(); run(); }, true); })();