From 5dc1c98a626bf57b6767958035537f563481de10 Mon Sep 17 00:00:00 2001 From: Rustem Mussabekov Date: Sun, 9 Jun 2024 13:31:52 +0300 Subject: [PATCH] Update highlights script --- .../background/highlights/highlight.js | 102 +++++++++--------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/src/target/extension/background/highlights/highlight.js b/src/target/extension/background/highlights/highlight.js index f99fa847..78847544 100644 --- a/src/target/extension/background/highlights/highlight.js +++ b/src/target/extension/background/highlights/highlight.js @@ -1,5 +1,5 @@ -"use strict";var zr=Object.defineProperty;var Ur=(e,t,n)=>t in e?zr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ce=(e,t,n)=>(Ur(e,typeof t!="symbol"?t+"":t,n),n),Dn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var te=(e,t,n)=>(Dn(e,t,"read from private field"),n?n.call(e):t.get(e)),Bt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Yt=(e,t,n,r)=>(Dn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);(function(){var e=window.Document.prototype.createElement,t=window.Document.prototype.createElementNS,n=window.Document.prototype.importNode,r=window.Document.prototype.prepend,o=window.Document.prototype.append,s=window.DocumentFragment.prototype.prepend,c=window.DocumentFragment.prototype.append,p=window.Node.prototype.cloneNode,d=window.Node.prototype.appendChild,f=window.Node.prototype.insertBefore,b=window.Node.prototype.removeChild,m=window.Node.prototype.replaceChild,x=Object.getOwnPropertyDescriptor(window.Node.prototype,"textContent"),E=window.Element.prototype.attachShadow,S=Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),y=window.Element.prototype.getAttribute,T=window.Element.prototype.setAttribute,N=window.Element.prototype.removeAttribute,$=window.Element.prototype.toggleAttribute,k=window.Element.prototype.getAttributeNS,O=window.Element.prototype.setAttributeNS,G=window.Element.prototype.removeAttributeNS,C=window.Element.prototype.insertAdjacentElement,A=window.Element.prototype.insertAdjacentHTML,M=window.Element.prototype.prepend,R=window.Element.prototype.append,q=window.Element.prototype.before,V=window.Element.prototype.after,K=window.Element.prototype.replaceWith,ue=window.Element.prototype.remove,Y=window.HTMLElement,ee=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),$e=window.HTMLElement.prototype.insertAdjacentElement,Qe=window.HTMLElement.prototype.insertAdjacentHTML,et=new Set;"annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" ").forEach(function(i){return et.add(i)});function yn(i){var l=et.has(i);return i=/^[a-z][.0-9_a-z]*-[-.0-9_a-z]*$/.test(i),!l&&i}var Fr=document.contains?document.contains.bind(document):document.documentElement.contains.bind(document.documentElement);function P(i){var l=i.isConnected;if(l!==void 0)return l;if(Fr(i))return!0;for(;i&&!(i.__CE_isImportDocument||i instanceof Document);)i=i.parentNode||(window.ShadowRoot&&i instanceof ShadowRoot?i.host:void 0);return!(!i||!(i.__CE_isImportDocument||i instanceof Document))}function Ft(i){var l=i.children;if(l)return Array.prototype.slice.call(l);for(l=[],i=i.firstChild;i;i=i.nextSibling)i.nodeType===Node.ELEMENT_NODE&&l.push(i);return l}function Ht(i,l){for(;l&&l!==i&&!l.nextSibling;)l=l.parentNode;return l&&l!==i?l.nextSibling:null}function Pt(i,l,u){for(var v=i;v;){if(v.nodeType===Node.ELEMENT_NODE){var a=v;l(a);var h=a.localName;if(h==="link"&&a.getAttribute("rel")==="import"){if(v=a.import,u===void 0&&(u=new Set),v instanceof Node&&!u.has(v))for(u.add(v),v=v.firstChild;v;v=v.nextSibling)Pt(v,l,u);v=Ht(i,a);continue}else if(h==="template"){v=Ht(i,a);continue}if(a=a.__CE_shadowRoot)for(a=a.firstChild;a;a=a.nextSibling)Pt(a,l,u)}v=v.firstChild?v.firstChild:Ht(i,v)}}function vt(){var i=!(pe==null||!pe.noDocumentConstructionObserver),l=!(pe==null||!pe.shadyDomFastWalk);this.m=[],this.g=[],this.j=!1,this.shadyDomFastWalk=l,this.I=!i}function tt(i,l,u,v){var a=window.ShadyDOM;if(i.shadyDomFastWalk&&a&&a.inUse){if(l.nodeType===Node.ELEMENT_NODE&&u(l),l.querySelectorAll)for(i=a.nativeMethods.querySelectorAll.call(l,"*"),l=0;lr[t]),s=o.s.get(t)),s!==void 0&&j(s,se(n,o.i,o));const c=o.a,p=!(t in e);if(c&&t==="length")for(let d=n;d"u"?e=>setTimeout(e,1):requestIdleCallback;let Ct=!1,xt=!1,Zt=[],Qt=[];function tr(){Ct=!1;const e=Zt.slice();Zt=[],er(e)}function nr(){xt=!1;const e=Qt.slice();Qt=[],er(e)}function rr(e){Ct||(Ct=!0,queueMicrotask(tr)),Zt.push(e)}function yo(e){xt||(xt=!0,wo(nr)),Qt.push(e)}function Eo(){Ct&&tr(),xt&&nr()}function ko(e){let t=Oe|be;I===null&&(t|=Te);const n={deps:null,deriveds:null,equals:Qn,f:t,first:null,fn:e,last:null,reactions:null,v:null,version:0};if(J!==null&&J.f&Oe){var r=J;r.deriveds===null?r.deriveds=[n]:r.deriveds.push(n)}return n}function or(e){dn(e);var t=e.deriveds;if(t!==null){e.deriveds=null;for(var n=0;ne.version)return e.version=m,!p;!qe&&!((x=b==null?void 0:b.reactions)!=null&&x.includes(e))&&(d=b.reactions,d===null?b.reactions=[e]:d.push(e))}else{if(e.f&be)return!0;o&&(m>e.version&&(e.version=m,n=!0),d=b.reactions,d===null?b.reactions=[e]:d.includes(e)||d.push(e))}}r||ae(e,de),o&&(e.f^=yt)}return n}function $o(e,t,n){throw e}function lr(e){const t=z,n=W,r=xe,o=J,s=qe,c=me;z=null,W=0,xe=null,J=e,qe=!Be&&(e.f&Te)!==0,me=!1;try{let p=(0,e.fn)(),d=e.deps;if(z!==null){let f;if(d!==null){const b=d.length,m=W===0?z:d.slice(0,W).concat(z),E=m.length>16&&b-W>1?new Set(m):null;for(f=W;f0)for(d.length=W+z.length,f=0;f1e3&&(Ye=0,vo()),Ye++}function cr(e){const t=e.length;if(t!==0){ur();var n=Be;Be=!0;try{for(var r=0;r1001)return;const e=Ae;Ae=[],cr(e),st||(Ye=0)}function Lt(e){mt===sr&&(st||(st=!0,queueMicrotask(So)));for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(n&_e){if(!(n&de))return;ae(t,Le)}}Ae.push(t)}function fr(e,t){var n=e.first,r=[];e:for(;n!==null;){var o=n.f,s=(o&(Ge|Me))===0,c=o&_e,p=(o&de)!==0,d=n.first;if(s&&(!c||!p)){if(c&&ae(n,de),o&Xe){if(!c&&ut(n)&&(Ot(n),d=n.first),d!==null){n=d;continue}}else if(o&Jn)if(c||p){if(d!==null){n=d;continue}}else r.push(n)}var f=n.next;if(f===null){let x=n.parent;for(;x!==null;){if(e===x)break e;var b=x.next;if(b!==null){n=b;continue e}x=x.parent}}n=f}for(var m=0;m0||s.length>0)&&Ie(),Ye=0,o}finally{mt=n,Ae=r}}function L(e){const t=e.f;if(t&Ge)return e.v;if(J!==null&&!(J.f&(_e|un))&&!me){const n=(J.f&Te)!==0,r=J.deps;z===null&&r!==null&&r[W]===e&&!(n&&I!==null)?W++:(r===null||W===0||r[W-1]!==e)&&(z===null?z=[e]:z[z.length-1]!==e&&z.push(e)),xe!==null&&I!==null&&I.f&de&&!(I.f&_e)&&xe.includes(e)&&(ae(I,be),Lt(I))}return t&Oe&&ut(e)&&ir(e,!1),e.v}function hn(e,t,n){var r=e.reactions;if(r!==null)for(var o=en(),s=r.length,c=0;c{ht(t)}}function Je(e){return Ke(Jn,e,!1)}function dt(e){return Ke(Xe,e,!0)}function Ce(e){return dt(e)}function vr(e,t=0){return Ke(Xe|Zn|t,e,!0)}function lt(e){return Ke(Xe|_e,e,!0)}function pr(e){var t=e.teardown;if(t!==null){const n=fn,r=me;Rn(!0),In(!0);try{t.call(null)}finally{Rn(n),In(r)}}}function ht(e,t=!0){var n=e.dom;if(n!==null&&t&&pn(n),dn(e,t),Dt(e,0),ae(e,Ge),e.transitions)for(const c of e.transitions)c.stop();pr(e);var r=e.parent;if(r!==null&&e.f&_e&&r.first!==null){var o=e.prev,s=e.next;o!==null?s!==null?(o.next=s,s.prev=o):(o.next=null,r.last=o):s!==null?(s.prev=null,r.first=s):(r.first=null,r.last=null)}e.next=e.prev=e.teardown=e.ctx=e.dom=e.deps=e.parent=e.fn=null}function tn(e,t){var n=[];gn(e,n,!0),gr(n,()=>{ht(e),t&&t()})}function gr(e,t){var n=e.length;if(n>0){var r=()=>--n||t();for(var o of e)o.out(r)}else t()}function gn(e,t,n){if(!(e.f&Me)){if(e.f^=Me,e.transitions!==null)for(const c of e.transitions)(c.is_global||n)&&t.push(c);for(var r=e.first;r!==null;){var o=r.next,s=(r.f&cn)!==0||(r.f&_e)!==0;gn(r,t,s?n:!1),r=o}}}function Tt(e){mr(e,!0)}function mr(e,t){if(e.f&Me){e.f^=Me,ut(e)&&Ot(e);for(var n=e.first;n!==null;){var r=n.next,o=(n.f&cn)!==0||(n.f&_e)!==0;mr(n,o?t:!1),n=r}if(e.transitions!==null)for(const s of e.transitions)(s.is_global||t)&&s.in()}}var $t,Se;function _r(){if($t===void 0){$t=window,Se=document;var e=Element.prototype;e.__click=void 0,e.__className="",e.__attributes=null,e.__e=void 0,Text.prototype.__t=void 0}}function Ze(){return document.createTextNode("")}function le(e){const t=e.firstChild;return Q?t===null?e.appendChild(Ze()):ze(t):t}function Mt(e,t){return Q?ze(De):e.firstChild}function H(e,t=!1){var n=e.nextSibling;if(!Q)return n;var r=n.nodeType;if(r===8&&n.data===Zr)return H(n,t);if(t&&r!==3){var o=Ze(),s=I.dom;return s.unshift(o),n==null||n.before(o),o}return ze(n)}function mn(e){e.textContent=""}function Mo(e){return document.createElement(e)}function Ro(e,t,n,r){function o(s){if(r.capture||nn(t,s),!s.cancelBubble)return n.call(this,s)}return e.startsWith("pointer")||e==="wheel"?rr(()=>{t.addEventListener(e,o,r)}):t.addEventListener(e,o,r),o}function ge(e,t,n,r,o){var s={capture:r,passive:o},c=Ro(e,t,n,s);(t===document.body||t===window||t===document)&&dr(()=>{t.removeEventListener(e,c,s)})}function br(e){for(var t=0;t{throw N});throw b}}finally{t.__root=e,s=e}}const wr=new Set,rn=new Set;function Wt(e,t){(e.__t??(e.__t=e.nodeValue))!==t&&(e.nodeValue=e.__t=t)}function yr(e,t){const n=t.anchor??t.target.appendChild(Ze());return Ie(()=>Er(e,{...t,anchor:n}),!1)}function Io(e,t){const n=t.target,r=Re;try{return Ie(()=>{Ee(!0);for(var o=n.firstChild;o&&(o.nodeType!==8||o.data!==bt);)o=o.nextSibling;if(!o)throw Kt;const s=ze(o),c=Er(e,{...t,anchor:s});return Ee(!1),c},!1)}catch(o){if(o===Kt)return t.recover===!1&&po(),_r(),mn(n),Ee(!1),yr(e,t);throw o}finally{Ee(!!r),eo(r)}}function Er(e,{target:t,anchor:n,props:r={},events:o,context:s,intro:c=!1}){_r();const p=new Set,d=nn.bind(null,t),f=nn.bind(null,document),b=E=>{for(let S=0;S(lt(()=>{if(s){ct({});var E=U;E.c=s}o&&(r.$$events=o),m=e(n,r)||{},s&&ft()}),()=>{for(const E of p)t.removeEventListener(E,d);rn.delete(b),on.delete(m)}));return on.set(m,x),m}let on=new WeakMap;function Fo(e){const t=on.get(e);t==null||t()}async function _n(e,t,n){await Promise.resolve();const r=Ho(e);if(!r.getElementById(t)){const o=Mo("style");o.id=t,o.textContent=n,(r.head||r).appendChild(o)}}function Ho(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function at(e,t,n,r=null,o=!1){var s=null,c=null,p=null,d=o?cn:0;vr(()=>{if(p===(p=!!t()))return;let f=!1;if(Q){const b=e.data===Gn;p===b&&(pn(Re),Ee(!1),f=!0)}p?(s?Tt(s):s=lt(()=>n(e)),c&&tn(c,()=>{c=null})):(c?Tt(c):r&&(c=lt(()=>r(e))),s&&tn(s,()=>{s=null})),f&&Ee(!0)},d)}let zt=null;function Po(e,t){return t}function jo(e,t,n){for(var r=[],o=e.length,s=0;s0&&r.length===0&&t!==null;if(c){var p=t.parentNode;mn(p),p.append(t),n.clear(),ke(e[0].prev,e[o-1].next)}gr(r,()=>{for(var d=0;d{var b=n(),m=Ue(b)?b:b==null?[]:Array.from(b),x=m.length,E=c.flags;E&Gt&&!Kn(m)&&!(X in m)&&(E^=Gt,E&Vr&&!(E&ot)&&(E^=ot));let S=!1;if(Q){var y=e.data===Gn;y!==(x===0)&&(pn(Re),Ee(!1),S=!0)}if(Q){for(var T=De,N=c,$,k=0;k0)for(;T!==e;){var A=T.nextSibling;T.remove(),T=A}}Q||qo(m,c,e,o,E,r),s!==null&&(x===0?f?Tt(f):f=lt(()=>s(e)):f!==null&&tn(f,()=>{f=null})),S&&Ee(!0)})}function qo(e,t,n,r,o,s){var Y,ee,$e,Qe;var c=(o&Xr)!==0,p=(o&(ot|an))!==0,d=e.length,f=t.items,b=t.next,m=b,x=new Set,E=t,S=new Set,y=[],T=[],N,$,k,O;if(c)for(O=0;O0){var ue=o&Vn&&d===0?n:null;if(c){for(O=0;O{vn(()=>{var et;for(k of S)(et=k.a)==null||et.apply()})})}function Bo(e,t,n,r){r&ot&&j(e.v,t),r&an?j(e.i,n):e.i=n}function kr(e,t,n,r,o,s,c,p,d){var f=zt;try{var b=(d&ot)!==0,m=(d&Gt)===0,x=b?m?Et(o):re(o):o,E=d&an?re(c):c,S={i:E,v:x,k:s,a:null,e:null,o:e,prev:n,next:r};return n.next=S,r!==null&&(r.prev=S),zt=S,S.e=lt(()=>p(t,x,E)),S}finally{zt=f}}function Pn(e,t,n){for(var r=e.next?e.next.o:n,o=t?t.o:n,s=e.o;s!==r;){var c=s.nextSibling;o.before(s),s=c}}function ke(e,t){e.next=t,t!==null&&(t.prev=e)}function St(e,t=I){var n=t.dom;return n===null?t.dom=e:(Ue(n)||(n=t.dom=[n]),Ue(e)?n.push(...e):n.push(e)),e}function he(e,t){var n=(t&Kr)!==0,r=(t&Jr)!==0,o;return()=>{if(Q)return St(n?Re:De),De;o||(o=Do(e),n||(o=o.firstChild));var s=r?document.importNode(o,!0):o.cloneNode(!0);return St(n?[...s.childNodes]:s),s}}function Cr(){if(Q)return St(Re),De;var e=document.createDocumentFragment(),t=Ze();return e.append(t),St([t]),e}function ne(e,t){Q||e.before(t)}function Yo(e,t){{const n=document.body;e.autofocus=!0,Je(()=>{document.activeElement===n&&e.focus()})}}function Wo(e){Q&&e.firstChild!==null&&mn(e)}let jn=!1;function xr(){jn||(jn=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const n of e.target.elements)(t=n.__on_r)==null||t.call(n)})},{capture:!0}))}function zo(e){if(Q){let t=!1;const n=()=>{if(t)return;t=!0;const r=e.getAttribute("value");fe(e,"value",null),fe(e,"checked",null),r&&(e.value=r)};e.__on_r=n,yo(n),xr()}}function Uo(e,t){var n=e.__attributes??(e.__attributes={});n.value!==(n.value=t)&&(e.value=t)}function fe(e,t,n){n=n==null?null:n+"";var r=e.__attributes??(e.__attributes={});Q&&(r[t]=e.getAttribute(t),t==="src"||t==="href"||t==="srcset")||r[t]!==(r[t]=n)&&(t==="loading"&&(e[lo]=n),n===null?e.removeAttribute(t):e.setAttribute(t,n))}function sn(e,t,n){n?e.classList.add(t):e.classList.remove(t)}function Tr(e,t,n,r=n){e.addEventListener(t,n);const o=e.__on_r;o?e.__on_r=()=>{o(),r()}:e.__on_r=r,xr()}function Vo(e,t,n){Tr(e,"input",()=>{n(qn(e)?Bn(e.value):e.value)}),dt(()=>{var r=t();e.__value=r,!(qn(e)&&r===Bn(e.value))&&(e.type==="date"&&!r&&!e.value||(e.value=r??""))})}function Xo(e,t,n,r,o){var s=n.getAttribute("type")==="checkbox",c=e;if(t!==null)for(var p of t){var d=c;c=d[p],c===void 0&&(c=d[p]=[])}c.push(n),Tr(n,"change",()=>{var f=n.__value;s&&(f=Go(c,f,n.checked)),o(f)},()=>o(s?[]:null)),dt(()=>{var f=r();s?(f=f||[],n.checked=kt(f).includes(kt(n.__value))):n.checked=bo(n.__value,f)}),dr(()=>{var f=c.indexOf(n);f!==-1&&c.splice(f,1)}),Je(()=>{c.sort((f,b)=>f.compareDocumentPosition(b)===4?-1:1)})}function Go(e,t,n){for(var r=new Set,o=0;o{var o,s;return dt(()=>{o=s,s=[],vn(()=>{e!==n(...s)&&(t(e,...s),o&&Yn(n(...o),e)&&t(null,...o))})}),()=>{rr(()=>{s&&Yn(n(...s),e)&&t(null,...s)})}})}function Rt(e,t,n,r){var E;var o=(n&Gr)!==0,s=e[t],c=(E=Jt(e,t))==null?void 0:E.set,p=r,d=()=>p;s===void 0&&r!==void 0&&(c&&o&&go(),s=d(),c&&c(s));var f;if(f=()=>{var S=e[t];return S===void 0?d():S},c)return function(S){return arguments.length===1?(c(S),S):f()};var b=!1,m=Et(s),x=ko(()=>{var S=f(),y=L(m);return b?(b=!1,y):m.v=S});return function(S){var y=L(x);return arguments.length>0?(x.equals(S)||(b=!0,j(m,S),L(x),x.version++),S):y}}function Ko(e){return new Jo(e)}var ye,ie;class Jo{constructor(t){Bt(this,ye,void 0);Bt(this,ie,void 0);const n=se({...t.props||{},$$events:{}},!1);Yt(this,ie,(t.hydrate?Io:yr)(t.component,{target:t.target,props:n,context:t.context,intro:t.intro,recover:t.recover})),Yt(this,ye,n.$$events);for(const r of Object.keys(te(this,ie)))r==="$set"||r==="$destroy"||r==="$on"||it(this,r,{get(){return te(this,ie)[r]},set(o){te(this,ie)[r]=o},enumerable:!0});te(this,ie).$set=r=>{Object.assign(n,r)},te(this,ie).$destroy=()=>{Fo(te(this,ie))}}$set(t){te(this,ie).$set(t)}$on(t,n){te(this,ye)[t]=te(this,ye)[t]||[];const r=(...o)=>n.call(this,...o);return te(this,ye)[t].push(r),()=>{te(this,ye)[t]=te(this,ye)[t].filter(o=>o!==r)}}$destroy(){te(this,ie).$destroy()}}ye=new WeakMap,ie=new WeakMap;let $r;typeof HTMLElement=="function"&&($r=class extends HTMLElement{constructor(t,n,r){super();ce(this,"$$ctor");ce(this,"$$s");ce(this,"$$c");ce(this,"$$cn",!1);ce(this,"$$d",{});ce(this,"$$r",!1);ce(this,"$$p_d",{});ce(this,"$$l",{});ce(this,"$$l_u",new Map);ce(this,"$$me");this.$$ctor=t,this.$$s=n,r&&this.attachShadow({mode:"open"})}addEventListener(t,n,r){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(n),this.$$c){const o=this.$$c.$on(t,n);this.$$l_u.set(n,o)}super.addEventListener(t,n,r)}removeEventListener(t,n,r){if(super.removeEventListener(t,n,r),this.$$c){const o=this.$$l_u.get(n);o&&(o(),this.$$l_u.delete(n))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(o){return s=>{const c=document.createElement("slot");o!=="default"&&(c.name=o),ne(s,c)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const n={},r=Zo(this);for(const o of this.$$s)o in r&&(o==="default"&&!this.$$d.children?(this.$$d.children=t(o),n.default=!0):n[o]=t(o));for(const o of this.attributes){const s=this.$$g_p(o.name);s in this.$$d||(this.$$d[s]=_t(s,o.value,this.$$p_d,"toProp"))}for(const o in this.$$p_d)!(o in this.$$d)&&this[o]!==void 0&&(this.$$d[o]=this[o],delete this[o]);this.$$c=Ko({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:n,$$host:this}}),this.$$me=dt(()=>{var o;this.$$r=!0;for(const s of wt(this.$$c)){if(!((o=this.$$p_d[s])!=null&&o.reflect))continue;this.$$d[s]=this.$$c[s];const c=_t(s,this.$$d[s],this.$$p_d,"toAttribute");c==null?this.removeAttribute(this.$$p_d[s].attribute||s):this.setAttribute(this.$$p_d[s].attribute||s,c)}this.$$r=!1});for(const o in this.$$l)for(const s of this.$$l[o]){const c=this.$$c.$on(o,s);this.$$l_u.set(s,c)}this.$$l={}}}attributeChangedCallback(t,n,r){var o;this.$$r||(t=this.$$g_p(t),this.$$d[t]=_t(t,r,this.$$p_d,"toProp"),(o=this.$$c)==null||o.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),ht(this.$$me),this.$$c=void 0)})}$$g_p(t){return wt(this.$$p_d).find(n=>this.$$p_d[n].attribute===t||!this.$$p_d[n].attribute&&n.toLowerCase()===t)||t}});function _t(e,t,n,r){var s;const o=(s=n[e])==null?void 0:s.type;if(t=o==="Boolean"&&typeof t!="boolean"?t!=null:t,!r||!n[e])return t;if(r==="toAttribute")switch(o){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(o){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function Zo(e){const t={};return e.childNodes.forEach(n=>{t[n.slot||"default"]=!0}),t}function It(e,t,n,r,o,s){let c=class extends $r{constructor(){super(e,n,o),this.$$p_d=t}static get observedAttributes(){return wt(t).map(p=>(t[p].attribute||p).toLowerCase())}};return wt(t).forEach(p=>{it(c.prototype,p,{get(){return this.$$c&&p in this.$$c?this.$$c[p]:this.$$d[p]},set(d){var f;d=_t(p,d,t),this.$$d[p]=d,(f=this.$$c)==null||f.$set({[p]:d})}})}),r.forEach(p=>{it(c.prototype,p,{get(){var d;return(d=this.$$c)==null?void 0:d[p]}})}),e.element=c,c}const Ve=new Map([["yellow","#F8B920"],["red","#FF4646"],["blue","#0064FF"],["green","#00C564"]]),Qo=["SCRIPT","STYLE","NOSCRIPT","TEXTAREA","OPTION"];function Sr(e){const t=e.map(c=>c.trim().toLocaleLowerCase()),n=t.map(()=>({start:null,end:null,shift:0})),r=t.map(()=>[]),o=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,c=>{var p,d;return Qo.includes((p=c.parentNode)==null?void 0:p.tagName)||!((d=c.parentNode)!=null&&d.checkVisibility())?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});let s;for(;s=o.nextNode();)if(s!=null&&s.nodeValue)for(let c=0;c{var m;for(;d[n[f].shift]&&!d[n[f].shift].trim();)n[f].shift++;let b=d[n[f].shift]===p;if(!b&&n[f].shift&&(n[f].shift=0,b=d[n[f].shift]===p),b&&(n[f].shift||(n[f].start=[s,c]),n[f].end=[s,c],n[f].shift++),n[f].shift>=d.length){const x=document.createRange();x.setStart(n[f].start[0],n[f].start[1]),x.setEnd(n[f].end[0],n[f].end[1]+1),!x.collapsed&&((m=x.commonAncestorContainer.parentElement)!=null&&m.checkVisibility())?r[f].push(x):x.detach(),b=!1}b||(n[f].shift=0,n[f].start=null,n[f].end=null)})}return r}const We=`rh-${new Date().getTime()}-`,wn="highlights"in CSS;function ei(e){if(!e.length&&!CSS.highlights.size)return;const t=[];if(CSS.highlights.clear(),e.length){const r=Sr(e.map(({text:o})=>o));for(const o in e){if(!r[o].length)continue;const{_id:s,color:c}=e[o],p=`${We}${s}`;CSS.highlights.set(p,new Highlight(...r[o]));const d=r[o][0].getBoundingClientRect();t.push(` - ::highlight(${p}) { +"use strict";var Ur=Object.defineProperty;var Vr=(e,t,n)=>t in e?Ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ce=(e,t,n)=>(Vr(e,typeof t!="symbol"?t+"":t,n),n),Ln=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var te=(e,t,n)=>(Ln(e,t,"read from private field"),n?n.call(e):t.get(e)),Wt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},zt=(e,t,n,r)=>(Ln(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);(function(){var e=window.Document.prototype.createElement,t=window.Document.prototype.createElementNS,n=window.Document.prototype.importNode,r=window.Document.prototype.prepend,o=window.Document.prototype.append,s=window.DocumentFragment.prototype.prepend,c=window.DocumentFragment.prototype.append,v=window.Node.prototype.cloneNode,d=window.Node.prototype.appendChild,f=window.Node.prototype.insertBefore,y=window.Node.prototype.removeChild,g=window.Node.prototype.replaceChild,x=Object.getOwnPropertyDescriptor(window.Node.prototype,"textContent"),E=window.Element.prototype.attachShadow,S=Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),w=window.Element.prototype.getAttribute,T=window.Element.prototype.setAttribute,N=window.Element.prototype.removeAttribute,$=window.Element.prototype.toggleAttribute,k=window.Element.prototype.getAttributeNS,O=window.Element.prototype.setAttributeNS,G=window.Element.prototype.removeAttributeNS,C=window.Element.prototype.insertAdjacentElement,A=window.Element.prototype.insertAdjacentHTML,M=window.Element.prototype.prepend,R=window.Element.prototype.append,q=window.Element.prototype.before,V=window.Element.prototype.after,K=window.Element.prototype.replaceWith,ue=window.Element.prototype.remove,Y=window.HTMLElement,ee=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),Se=window.HTMLElement.prototype.insertAdjacentElement,Qe=window.HTMLElement.prototype.insertAdjacentHTML,et=new Set;"annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" ").forEach(function(i){return et.add(i)});function kn(i){var l=et.has(i);return i=/^[a-z][.0-9_a-z]*-[-.0-9_a-z]*$/.test(i),!l&&i}var Hr=document.contains?document.contains.bind(document):document.documentElement.contains.bind(document.documentElement);function P(i){var l=i.isConnected;if(l!==void 0)return l;if(Hr(i))return!0;for(;i&&!(i.__CE_isImportDocument||i instanceof Document);)i=i.parentNode||(window.ShadowRoot&&i instanceof ShadowRoot?i.host:void 0);return!(!i||!(i.__CE_isImportDocument||i instanceof Document))}function Pt(i){var l=i.children;if(l)return Array.prototype.slice.call(l);for(l=[],i=i.firstChild;i;i=i.nextSibling)i.nodeType===Node.ELEMENT_NODE&&l.push(i);return l}function jt(i,l){for(;l&&l!==i&&!l.nextSibling;)l=l.parentNode;return l&&l!==i?l.nextSibling:null}function qt(i,l,u){for(var p=i;p;){if(p.nodeType===Node.ELEMENT_NODE){var a=p;l(a);var h=a.localName;if(h==="link"&&a.getAttribute("rel")==="import"){if(p=a.import,u===void 0&&(u=new Set),p instanceof Node&&!u.has(p))for(u.add(p),p=p.firstChild;p;p=p.nextSibling)qt(p,l,u);p=jt(i,a);continue}else if(h==="template"){p=jt(i,a);continue}if(a=a.__CE_shadowRoot)for(a=a.firstChild;a;a=a.nextSibling)qt(a,l,u)}p=p.firstChild?p.firstChild:jt(i,p)}}function vt(){var i=!(ve==null||!ve.noDocumentConstructionObserver),l=!(ve==null||!ve.shadyDomFastWalk);this.m=[],this.g=[],this.j=!1,this.shadyDomFastWalk=l,this.I=!i}function tt(i,l,u,p){var a=window.ShadyDOM;if(i.shadyDomFastWalk&&a&&a.inUse){if(l.nodeType===Node.ELEMENT_NODE&&u(l),l.querySelectorAll)for(i=a.nativeMethods.querySelectorAll.call(l,"*"),l=0;lr[t]),s=o.s.get(t)),s!==void 0&&j(s,se(n,o.i,o));const c=o.a,v=!(t in e);if(c&&t==="length")for(let d=n;d"u"?e=>setTimeout(e,1):requestIdleCallback;let xt=!1,Tt=!1,en=[],tn=[];function rr(){xt=!1;const e=en.slice();en=[],nr(e)}function or(){Tt=!1;const e=tn.slice();tn=[],nr(e)}function ir(e){xt||(xt=!0,queueMicrotask(rr)),en.push(e)}function Eo(e){Tt||(Tt=!0,wo(or)),tn.push(e)}function ko(){xt&&rr(),Tt&&or()}function Co(e){let t=Le|ye;I===null&&(t|=$e);const n={deps:null,deriveds:null,equals:tr,f:t,first:null,fn:e,last:null,reactions:null,v:null,version:0};if(J!==null&&J.f&Le){var r=J;r.deriveds===null?r.deriveds=[n]:r.deriveds.push(n)}return n}function sr(e){vn(e);var t=e.deriveds;if(t!==null){e.deriveds=null;for(var n=0;ne.version)return e.version=g,!v;!Be&&!((x=y==null?void 0:y.reactions)!=null&&x.includes(e))&&(d=y.reactions,d===null?y.reactions=[e]:d.push(e))}else{if(e.f&ye)return!0;o&&(g>e.version&&(e.version=g,n=!0),d=y.reactions,d===null?y.reactions=[e]:d.includes(e)||d.push(e))}}r||ae(e,de),o&&(e.f^=Et)}return n}function So(e,t,n){throw e}function ur(e){const t=z,n=W,r=Te,o=J,s=Be,c=ge;z=null,W=0,Te=null,J=e,Be=!Ye&&(e.f&$e)!==0,ge=!1;try{let v=(0,e.fn)(),d=e.deps;if(z!==null){let f;if(d!==null){const y=d.length,g=W===0?z:d.slice(0,W).concat(z),E=g.length>16&&y-W>1?new Set(g):null;for(f=W;f0)for(d.length=W+z.length,f=0;f1e3&&(We=0,vo()),We++}function dr(e){const t=e.length;if(t!==0){fr();var n=Ye;Ye=!0;try{for(var r=0;r1001)return;const e=Ae;Ae=[],dr(e),lt||(We=0)}function Mt(e){_t===ar&&(lt||(lt=!0,queueMicrotask(No)));for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(n&_e){if(!(n&de))return;ae(t,Me)}}Ae.push(t)}function hr(e,t){var n=e.first,r=[];e:for(;n!==null;){var o=n.f,s=(o&(Ge|Re))===0,c=o&_e,v=(o&de)!==0,d=n.first;if(s&&(!c||!v)){if(c&&ae(n,de),o&Xe){if(!c&&ct(n)&&(Lt(n),d=n.first),d!==null){n=d;continue}}else if(o&Qn)if(c||v){if(d!==null){n=d;continue}}else r.push(n)}var f=n.next;if(f===null){let x=n.parent;for(;x!==null;){if(e===x)break e;var y=x.next;if(y!==null){n=y;continue e}x=x.parent}}n=f}for(var g=0;g0||s.length>0)&&Fe(),We=0,o}finally{_t=n,Ae=r}}function L(e){const t=e.f;if(t&Ge)return e.v;if(J!==null&&!(J.f&(_e|dn))&&!ge){const n=(J.f&$e)!==0,r=J.deps;z===null&&r!==null&&r[W]===e&&!(n&&I!==null)?W++:(r===null||W===0||r[W-1]!==e)&&(z===null?z=[e]:z[z.length-1]!==e&&z.push(e)),Te!==null&&I!==null&&I.f&de&&!(I.f&_e)&&Te.includes(e)&&(ae(I,ye),Mt(I))}return t&Le&&ct(e)&&lr(e,!1),e.v}function mn(e,t,n){var r=e.reactions;if(r!==null)for(var o=nn(),s=r.length,c=0;c{pt(t)}}function Je(e){return Ke(Qn,e,!1)}function ht(e){return Ke(Xe,e,!0)}function xe(e){return ht(e)}function vr(e,t=0){return Ke(Xe|er|t,e,!0)}function at(e){return Ke(Xe|_e,e,!0)}function mr(e){var t=e.teardown;if(t!==null){const n=pn,r=ge;Fn(!0),Hn(!0);try{t.call(null)}finally{Fn(n),Hn(r)}}}function pt(e,t=!0){var n=e.dom;if(n!==null&&t&&_n(n),vn(e,t),Ot(e,0),ae(e,Ge),e.transitions)for(const c of e.transitions)c.stop();mr(e);var r=e.parent;if(r!==null&&e.f&_e&&r.first!==null){var o=e.prev,s=e.next;o!==null?s!==null?(o.next=s,s.prev=o):(o.next=null,r.last=o):s!==null?(s.prev=null,r.first=s):(r.first=null,r.last=null)}e.next=e.prev=e.teardown=e.ctx=e.dom=e.deps=e.parent=e.fn=null}function on(e,t){var n=[];yn(e,n,!0),gr(n,()=>{pt(e),t&&t()})}function gr(e,t){var n=e.length;if(n>0){var r=()=>--n||t();for(var o of e)o.out(r)}else t()}function yn(e,t,n){if(!(e.f&Re)){if(e.f^=Re,e.transitions!==null)for(const c of e.transitions)(c.is_global||n)&&t.push(c);for(var r=e.first;r!==null;){var o=r.next,s=(r.f&hn)!==0||(r.f&_e)!==0;yn(r,t,s?n:!1),r=o}}}function $t(e){_r(e,!0)}function _r(e,t){if(e.f&Re){e.f^=Re,ct(e)&&Lt(e);for(var n=e.first;n!==null;){var r=n.next,o=(n.f&hn)!==0||(n.f&_e)!==0;_r(n,o?t:!1),n=r}if(e.transitions!==null)for(const s of e.transitions)(s.is_global||t)&&s.in()}}var St,Ne;function yr(){if(St===void 0){St=window,Ne=document;var e=Element.prototype;e.__click=void 0,e.__className="",e.__attributes=null,e.__e=void 0,Text.prototype.__t=void 0}}function Ze(){return document.createTextNode("")}function le(e){const t=e.firstChild;return Q?t===null?e.appendChild(Ze()):ze(t):t}function Rt(e,t){return Q?ze(Oe):e.firstChild}function H(e,t=!1){var n=e.nextSibling;if(!Q)return n;var r=n.nodeType;if(r===8&&n.data===Qr)return H(n,t);if(t&&r!==3){var o=Ze(),s=I.dom;return s.unshift(o),n==null||n.before(o),o}return ze(n)}function bn(e){e.textContent=""}function Ro(e){return document.createElement(e)}function Io(e,t,n,r){function o(s){if(r.capture||sn(t,s),!s.cancelBubble)return n.call(this,s)}return e.startsWith("pointer")||e==="wheel"?ir(()=>{t.addEventListener(e,o,r)}):t.addEventListener(e,o,r),o}function me(e,t,n,r,o){var s={capture:r,passive:o},c=Io(e,t,n,s);(t===document.body||t===window||t===document)&&pr(()=>{t.removeEventListener(e,c,s)})}function br(e){for(var t=0;t{throw N});throw y}}finally{t.__root=e,s=e}}const wr=new Set,ln=new Set;function Ut(e,t){(e.__t??(e.__t=e.nodeValue))!==t&&(e.nodeValue=e.__t=t)}function Er(e,t){const n=t.anchor??t.target.appendChild(Ze());return Fe(()=>kr(e,{...t,anchor:n}),!1)}function Fo(e,t){const n=t.target,r=Ie;try{return Fe(()=>{ke(!0);for(var o=n.firstChild;o&&(o.nodeType!==8||o.data!==bt);)o=o.nextSibling;if(!o)throw Zt;const s=ze(o),c=kr(e,{...t,anchor:s});return ke(!1),c},!1)}catch(o){if(o===Zt)return t.recover===!1&&mo(),yr(),bn(n),ke(!1),Er(e,t);throw o}finally{ke(!!r),to(r)}}function kr(e,{target:t,anchor:n,props:r={},events:o,context:s,intro:c=!1}){yr();const v=new Set,d=sn.bind(null,t),f=sn.bind(null,document),y=E=>{for(let S=0;S(at(()=>{if(s){ft({});var E=U;E.c=s}o&&(r.$$events=o),g=e(n,r)||{},s&&dt()}),()=>{for(const E of v)t.removeEventListener(E,d);ln.delete(y),an.delete(g)}));return an.set(g,x),g}let an=new WeakMap;function Ho(e){const t=an.get(e);t==null||t()}async function wn(e,t,n){await Promise.resolve();const r=Po(e);if(!r.getElementById(t)){const o=Ro("style");o.id=t,o.textContent=n,(r.head||r).appendChild(o)}}function Po(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function ut(e,t,n,r=null,o=!1){var s=null,c=null,v=null,d=o?hn:0;vr(()=>{if(v===(v=!!t()))return;let f=!1;if(Q){const y=e.data===Jn;v===y&&(_n(Ie),ke(!1),f=!0)}v?(s?$t(s):s=at(()=>n(e)),c&&on(c,()=>{c=null})):(c?$t(c):r&&(c=at(()=>r(e))),s&&on(s,()=>{s=null})),f&&ke(!0)},d)}let Vt=null;function jo(e,t){return t}function qo(e,t,n){for(var r=[],o=e.length,s=0;s0&&r.length===0&&t!==null;if(c){var v=t.parentNode;bn(v),v.append(t),n.clear(),Ce(e[0].prev,e[o-1].next)}gr(r,()=>{for(var d=0;d{var y=n(),g=Ue(y)?y:y==null?[]:Array.from(y),x=g.length,E=c.flags;E&Jt&&!Zn(g)&&!(X in g)&&(E^=Jt,E&Xr&&!(E&it)&&(E^=it));let S=!1;if(Q){var w=e.data===Jn;w!==(x===0)&&(_n(Ie),ke(!1),S=!0)}if(Q){for(var T=Oe,N=c,$,k=0;k0)for(;T!==e;){var A=T.nextSibling;T.remove(),T=A}}Q||Bo(g,c,e,o,E,r),s!==null&&(x===0?f?$t(f):f=at(()=>s(e)):f!==null&&on(f,()=>{f=null})),S&&ke(!0)})}function Bo(e,t,n,r,o,s){var Y,ee,Se,Qe;var c=(o&Gr)!==0,v=(o&(it|fn))!==0,d=e.length,f=t.items,y=t.next,g=y,x=new Set,E=t,S=new Set,w=[],T=[],N,$,k,O;if(c)for(O=0;O0){var ue=o&Gn&&d===0?n:null;if(c){for(O=0;O{gn(()=>{var et;for(k of S)(et=k.a)==null||et.apply()})})}function Yo(e,t,n,r){r&it&&j(e.v,t),r&fn?j(e.i,n):e.i=n}function Cr(e,t,n,r,o,s,c,v,d){var f=Vt;try{var y=(d&it)!==0,g=(d&Jt)===0,x=y?g?kt(o):re(o):o,E=d&fn?re(c):c,S={i:E,v:x,k:s,a:null,e:null,o:e,prev:n,next:r};return n.next=S,r!==null&&(r.prev=S),Vt=S,S.e=at(()=>v(t,x,E)),S}finally{Vt=f}}function qn(e,t,n){for(var r=e.next?e.next.o:n,o=t?t.o:n,s=e.o;s!==r;){var c=s.nextSibling;o.before(s),s=c}}function Ce(e,t){e.next=t,t!==null&&(t.prev=e)}function Nt(e,t=I){var n=t.dom;return n===null?t.dom=e:(Ue(n)||(n=t.dom=[n]),Ue(e)?n.push(...e):n.push(e)),e}function he(e,t){var n=(t&Jr)!==0,r=(t&Zr)!==0,o;return()=>{if(Q)return Nt(n?Ie:Oe),Oe;o||(o=Oo(e),n||(o=o.firstChild));var s=r?document.importNode(o,!0):o.cloneNode(!0);return Nt(n?[...s.childNodes]:s),s}}function xr(){if(Q)return Nt(Ie),Oe;var e=document.createDocumentFragment(),t=Ze();return e.append(t),Nt([t]),e}function ne(e,t){Q||e.before(t)}function Wo(e,t){{const n=document.body;e.autofocus=!0,Je(()=>{document.activeElement===n&&e.focus()})}}function zo(e){Q&&e.firstChild!==null&&bn(e)}let Bn=!1;function Tr(){Bn||(Bn=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const n of e.target.elements)(t=n.__on_r)==null||t.call(n)})},{capture:!0}))}function Uo(e){if(Q){let t=!1;const n=()=>{if(t)return;t=!0;const r=e.getAttribute("value");fe(e,"value",null),fe(e,"checked",null),r&&(e.value=r)};e.__on_r=n,Eo(n),Tr()}}function Vo(e,t){var n=e.__attributes??(e.__attributes={});n.value!==(n.value=t)&&(e.value=t)}function fe(e,t,n){n=n==null?null:n+"";var r=e.__attributes??(e.__attributes={});Q&&(r[t]=e.getAttribute(t),t==="src"||t==="href"||t==="srcset")||r[t]!==(r[t]=n)&&(t==="loading"&&(e[ao]=n),n===null?e.removeAttribute(t):e.setAttribute(t,n))}function un(e,t,n){n?e.classList.add(t):e.classList.remove(t)}function $r(e,t,n,r=n){e.addEventListener(t,n);const o=e.__on_r;o?e.__on_r=()=>{o(),r()}:e.__on_r=r,Tr()}function Xo(e,t,n){$r(e,"input",()=>{n(Yn(e)?Wn(e.value):e.value)}),ht(()=>{var r=t();e.__value=r,!(Yn(e)&&r===Wn(e.value))&&(e.type==="date"&&!r&&!e.value||(e.value=r??""))})}function Go(e,t,n,r,o){var s=n.getAttribute("type")==="checkbox",c=e;if(t!==null)for(var v of t){var d=c;c=d[v],c===void 0&&(c=d[v]=[])}c.push(n),$r(n,"change",()=>{var f=n.__value;s&&(f=Ko(c,f,n.checked)),o(f)},()=>o(s?[]:null)),ht(()=>{var f=r();s?(f=f||[],n.checked=Ct(f).includes(Ct(n.__value))):n.checked=bo(n.__value,f)}),pr(()=>{var f=c.indexOf(n);f!==-1&&c.splice(f,1)}),Je(()=>{c.sort((f,y)=>f.compareDocumentPosition(y)===4?-1:1)})}function Ko(e,t,n){for(var r=new Set,o=0;o{var o,s;return ht(()=>{o=s,s=[],gn(()=>{e!==n(...s)&&(t(e,...s),o&&zn(n(...o),e)&&t(null,...o))})}),()=>{ir(()=>{s&&zn(n(...s),e)&&t(null,...s)})}})}function It(e,t,n,r){var E;var o=(n&Kr)!==0,s=e[t],c=(E=Qt(e,t))==null?void 0:E.set,v=r,d=()=>v;s===void 0&&r!==void 0&&(c&&o&&go(),s=d(),c&&c(s));var f;if(f=()=>{var S=e[t];return S===void 0?d():S},c)return function(S){return arguments.length===1?(c(S),S):f()};var y=!1,g=kt(s),x=Co(()=>{var S=f(),w=L(g);return y?(y=!1,w):g.v=S});return function(S){var w=L(x);return arguments.length>0?(x.equals(S)||(y=!0,j(g,S),L(x),x.version++),S):w}}function Jo(e){return new Zo(e)}var we,ie;class Zo{constructor(t){Wt(this,we,void 0);Wt(this,ie,void 0);const n=se({...t.props||{},$$events:{}},!1);zt(this,ie,(t.hydrate?Fo:Er)(t.component,{target:t.target,props:n,context:t.context,intro:t.intro,recover:t.recover})),zt(this,we,n.$$events);for(const r of Object.keys(te(this,ie)))r==="$set"||r==="$destroy"||r==="$on"||st(this,r,{get(){return te(this,ie)[r]},set(o){te(this,ie)[r]=o},enumerable:!0});te(this,ie).$set=r=>{Object.assign(n,r)},te(this,ie).$destroy=()=>{Ho(te(this,ie))}}$set(t){te(this,ie).$set(t)}$on(t,n){te(this,we)[t]=te(this,we)[t]||[];const r=(...o)=>n.call(this,...o);return te(this,we)[t].push(r),()=>{te(this,we)[t]=te(this,we)[t].filter(o=>o!==r)}}$destroy(){te(this,ie).$destroy()}}we=new WeakMap,ie=new WeakMap;let Sr;typeof HTMLElement=="function"&&(Sr=class extends HTMLElement{constructor(t,n,r){super();ce(this,"$$ctor");ce(this,"$$s");ce(this,"$$c");ce(this,"$$cn",!1);ce(this,"$$d",{});ce(this,"$$r",!1);ce(this,"$$p_d",{});ce(this,"$$l",{});ce(this,"$$l_u",new Map);ce(this,"$$me");this.$$ctor=t,this.$$s=n,r&&this.attachShadow({mode:"open"})}addEventListener(t,n,r){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(n),this.$$c){const o=this.$$c.$on(t,n);this.$$l_u.set(n,o)}super.addEventListener(t,n,r)}removeEventListener(t,n,r){if(super.removeEventListener(t,n,r),this.$$c){const o=this.$$l_u.get(n);o&&(o(),this.$$l_u.delete(n))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(o){return s=>{const c=document.createElement("slot");o!=="default"&&(c.name=o),ne(s,c)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const n={},r=Qo(this);for(const o of this.$$s)o in r&&(o==="default"&&!this.$$d.children?(this.$$d.children=t(o),n.default=!0):n[o]=t(o));for(const o of this.attributes){const s=this.$$g_p(o.name);s in this.$$d||(this.$$d[s]=yt(s,o.value,this.$$p_d,"toProp"))}for(const o in this.$$p_d)!(o in this.$$d)&&this[o]!==void 0&&(this.$$d[o]=this[o],delete this[o]);this.$$c=Jo({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:n,$$host:this}}),this.$$me=ht(()=>{var o;this.$$r=!0;for(const s of wt(this.$$c)){if(!((o=this.$$p_d[s])!=null&&o.reflect))continue;this.$$d[s]=this.$$c[s];const c=yt(s,this.$$d[s],this.$$p_d,"toAttribute");c==null?this.removeAttribute(this.$$p_d[s].attribute||s):this.setAttribute(this.$$p_d[s].attribute||s,c)}this.$$r=!1});for(const o in this.$$l)for(const s of this.$$l[o]){const c=this.$$c.$on(o,s);this.$$l_u.set(s,c)}this.$$l={}}}attributeChangedCallback(t,n,r){var o;this.$$r||(t=this.$$g_p(t),this.$$d[t]=yt(t,r,this.$$p_d,"toProp"),(o=this.$$c)==null||o.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),pt(this.$$me),this.$$c=void 0)})}$$g_p(t){return wt(this.$$p_d).find(n=>this.$$p_d[n].attribute===t||!this.$$p_d[n].attribute&&n.toLowerCase()===t)||t}});function yt(e,t,n,r){var s;const o=(s=n[e])==null?void 0:s.type;if(t=o==="Boolean"&&typeof t!="boolean"?t!=null:t,!r||!n[e])return t;if(r==="toAttribute")switch(o){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(o){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function Qo(e){const t={};return e.childNodes.forEach(n=>{t[n.slot||"default"]=!0}),t}function Ft(e,t,n,r,o,s){let c=class extends Sr{constructor(){super(e,n,o),this.$$p_d=t}static get observedAttributes(){return wt(t).map(v=>(t[v].attribute||v).toLowerCase())}};return wt(t).forEach(v=>{st(c.prototype,v,{get(){return this.$$c&&v in this.$$c?this.$$c[v]:this.$$d[v]},set(d){var f;d=yt(v,d,t),this.$$d[v]=d,(f=this.$$c)==null||f.$set({[v]:d})}})}),r.forEach(v=>{st(c.prototype,v,{get(){var d;return(d=this.$$c)==null?void 0:d[v]}})}),e.element=c,c}const Ve=new Map([["yellow","#F8B920"],["red","#FF4646"],["blue","#0064FF"],["green","#00C564"]]),ei=["SCRIPT","STYLE","NOSCRIPT","TEXTAREA","OPTION"];function Nr(e){const t=e.map(c=>c.trim().toLocaleLowerCase()),n=t.map(()=>({start:null,end:null,shift:0})),r=t.map(()=>[]),o=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,c=>{var v,d;return ei.includes((v=c.parentNode)==null?void 0:v.tagName)||!((d=c.parentNode)!=null&&d.checkVisibility())?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});let s;for(;s=o.nextNode();)if(s!=null&&s.nodeValue)for(let c=0;c{var g;for(;d[n[f].shift]&&!d[n[f].shift].trim();)n[f].shift++;let y=d[n[f].shift]===v;if(!y&&n[f].shift&&(n[f].shift=0,y=d[n[f].shift]===v),y&&(n[f].shift||(n[f].start=[s,c]),n[f].end=[s,c],n[f].shift++),n[f].shift>=d.length){const x=document.createRange();x.setStart(n[f].start[0],n[f].start[1]),x.setEnd(n[f].end[0],n[f].end[1]+1),!x.collapsed&&((g=x.commonAncestorContainer.parentElement)!=null&&g.checkVisibility())?r[f].push(x):x.detach(),y=!1}y||(n[f].shift=0,n[f].start=null,n[f].end=null)})}return r}const De=`rh-${new Date().getTime()}-`,Ht="highlights"in CSS;function ti(e){if(!e.length&&!CSS.highlights.size)return;const t=[];if(CSS.highlights.clear(),e.length){const r=Nr(e.map(({text:o})=>o));for(const o in e){if(!r[o].length)continue;const{_id:s,color:c}=e[o],v=`${De}${s}`;CSS.highlights.set(v,new Highlight(...r[o]));const d=r[o][0].getBoundingClientRect();t.push(` + ::highlight(${v}) { all: unset; background-color: color-mix(in srgb, ${Ve.get(c)||c}, transparent 50%) !important; } @@ -7,15 +7,15 @@ :root { --highlight-${s}-top: ${(100/document.documentElement.scrollHeight*(window.scrollY+d.top-10)).toFixed(2)}%; } - `);for(const f of r[o])f.detach()}}const n=(()=>{let r=document.getElementById(We);return r||(r=document.createElement("style"),r.id=We,document.head.appendChild(r)),r})();n.innerHTML=t.join(` -`)}function ti(e){var t;for(const[n,r]of CSS.highlights){const o=n.replace(We,"");if(e==o)for(const s of r){(t=s.startContainer.parentElement)==null||t.scrollIntoView({behavior:"smooth",block:"start"});break}}}function ni(e){let t;for(const[n,r]of CSS.highlights)for(const o of r){const s=e.compareBoundaryPoints(Range.START_TO_START,o),c=e.compareBoundaryPoints(Range.END_TO_END,o);(s==0&&c==0||e!=null&&e.collapsed&&s>=0&&c<=0)&&(t=[n.replace(We,""),o])}if(t)return t[0].replace(We,"")}const Ne=`rh-${new Date().getTime()}`;function ri(e){const t=document.body.querySelectorAll(`.${Ne}`);if(!e.length&&!t.length)return;t.forEach(s=>s.outerHTML=s.innerText);const n=[],r=Sr(e.map(({text:s})=>s));for(const s in e){const{_id:c,color:p}=e[s];for(const d of r[s]){const f=document.createElement("mark");f.className=Ne,f.setAttribute("data-id",String(c)),f.append(d.extractContents()),d.insertNode(f),d.detach()}n.push(` - .${Ne}[data-id="${c}"] { + `);for(const f of r[o])f.detach()}}const n=(()=>{let r=document.getElementById(De);return r||(r=document.createElement("style"),r.id=De,document.head.appendChild(r)),r})();n.innerHTML=t.join(` +`)}function ni(){var e;(e=document.getElementById(De))==null||e.remove()}function ri(e){var t;for(const[n,r]of CSS.highlights){const o=n.replace(De,"");if(e==o)for(const s of r){(t=s.startContainer.parentElement)==null||t.scrollIntoView({behavior:"smooth",block:"start"});break}}}function oi(e){let t;for(const[n,r]of CSS.highlights)for(const o of r){const s=e.compareBoundaryPoints(Range.START_TO_START,o),c=e.compareBoundaryPoints(Range.END_TO_END,o);(s==0&&c==0||e!=null&&e.collapsed&&s>=0&&c<=0)&&(t=[n.replace(De,""),o])}if(t)return t[0].replace(De,"")}const Ee=`rh-${new Date().getTime()}`;function ii(e){const t=document.body.querySelectorAll(`.${Ee}`);if(!e.length&&!t.length)return;t.forEach(s=>s.outerHTML=s.innerText);const n=[],r=Nr(e.map(({text:s})=>s));for(const s in e){const{_id:c,color:v}=e[s];for(const d of r[s]){const f=document.createElement("mark");f.className=Ee,f.setAttribute("data-id",String(c)),f.append(d.extractContents()),d.insertNode(f),d.detach()}n.push(` + .${Ee}[data-id="${c}"] { all: unset; display: inline-block; - background-color: ${si(Ve.get(p)||p,.5)} !important; + background-color: ${ui(Ve.get(v)||v,.5)} !important; } - `)}const o=(()=>{let s=document.getElementById(Ne);return s||(s=document.createElement("style"),s.id=Ne,document.head.appendChild(s)),s})();o.innerHTML=n.join(` -`)}function oi(e){const t=document.body.querySelector(`.${Ne}[data-id="${e}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"start"})}function ii(e){const t=e.commonAncestorContainer.nodeType==Node.ELEMENT_NODE?e.commonAncestorContainer:e.commonAncestorContainer.parentElement;if((t==null?void 0:t.className)==Ne){if(!e.collapsed){const n=new Range;n.selectNodeContents(e.commonAncestorContainer);const r=e.compareBoundaryPoints(Range.START_TO_START,n),o=e.compareBoundaryPoints(Range.END_TO_END,n);if(n.detach(),r!=0||o!=0)return}return t.getAttribute("data-id")||void 0}}function si(e,t){const n=parseInt(e.slice(1,3),16),r=parseInt(e.slice(3,5),16),o=parseInt(e.slice(5,7),16);return`rgba(${n}, ${r}, ${o}, ${t})`}function Nt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var li=typeof global=="object"&&global&&global.Object===Object&&global,ai=typeof self=="object"&&self&&self.Object===Object&&self,Nr=li||ai||Function("return this")(),Ut=function(){return Nr.Date.now()},ui=/\s/;function ci(e){for(var t=e.length;t--&&ui.test(e.charAt(t)););return t}var fi=/^\s+/;function di(e){return e&&e.slice(0,ci(e)+1).replace(fi,"")}var At=Nr.Symbol,Ar=Object.prototype,hi=Ar.hasOwnProperty,vi=Ar.toString,nt=At?At.toStringTag:void 0;function pi(e){var t=hi.call(e,nt),n=e[nt];try{e[nt]=void 0;var r=!0}catch{}var o=vi.call(e);return r&&(t?e[nt]=n:delete e[nt]),o}var gi=Object.prototype,mi=gi.toString;function _i(e){return mi.call(e)}var bi="[object Null]",wi="[object Undefined]",Wn=At?At.toStringTag:void 0;function yi(e){return e==null?e===void 0?wi:bi:Wn&&Wn in Object(e)?pi(e):_i(e)}function Ei(e){return e!=null&&typeof e=="object"}var ki="[object Symbol]";function Ci(e){return typeof e=="symbol"||Ei(e)&&yi(e)==ki}var zn=NaN,xi=/^[-+]0x[0-9a-f]+$/i,Ti=/^0b[01]+$/i,$i=/^0o[0-7]+$/i,Si=parseInt;function Un(e){if(typeof e=="number")return e;if(Ci(e))return zn;if(Nt(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Nt(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=di(e);var n=Ti.test(e);return n||$i.test(e)?Si(e.slice(2),n?2:8):xi.test(e)?zn:+e}var Ni="Expected a function",Ai=Math.max,Di=Math.min;function Oi(e,t,n){var r,o,s,c,p,d,f=0,b=!1,m=!1,x=!0;if(typeof e!="function")throw new TypeError(Ni);t=Un(t)||0,Nt(n)&&(b=!!n.leading,m="maxWait"in n,s=m?Ai(Un(n.maxWait)||0,t):s,x="trailing"in n?!!n.trailing:x);function E(C){var A=r,M=o;return r=o=void 0,f=C,c=e.apply(M,A),c}function S(C){return f=C,p=setTimeout(N,t),b?E(C):c}function y(C){var A=C-d,M=C-f,R=t-A;return m?Di(R,s-M):R}function T(C){var A=C-d,M=C-f;return d===void 0||A>=t||A<0||m&&M>=s}function N(){var C=Ut();if(T(C))return $(C);p=setTimeout(N,y(C))}function $(C){return p=void 0,x&&r?E(C):(r=o=void 0,c)}function k(){p!==void 0&&clearTimeout(p),f=0,r=d=o=p=void 0}function O(){return p===void 0?c:$(Ut())}function G(){var C=Ut(),A=T(C);if(r=arguments,o=this,d=C,A){if(p===void 0)return S(d);if(m)return clearTimeout(p),p=setTimeout(N,t),E(d)}return p===void 0&&(p=setTimeout(N,t)),c}return G.cancel=k,G.flush=O,G}var Li="Expected a function";function Dr(e,t,n){var r=!0,o=!0;if(typeof e!="function")throw new TypeError(Li);return Nt(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),Oi(e,t,{leading:r,maxWait:t,trailing:o})}function Or(e){return wn?ei(e):ri(e)}const Mi=Dr(Or,500);function Vt(e){return e.length?Mi(e):Or(e)}function Lr(e){return wn?ti(e):oi(e)}function Ri(e){return wn?ni(e):ii(e)}function rt(){const e=(()=>{const t=document.getSelection();return t!=null&&t.rangeCount?t.getRangeAt(0):null})();if(e){const t=Ri(e);if(t)return{range:e,id:t}}if(e&&!e.collapsed&&e.toString().trim())return{range:e}}function Ii(e){if(!e)return"";var t=document.createElement("div");t.appendChild(e.cloneContents().cloneNode(!0)),document.body.appendChild(t);const n=t.innerText;return document.body.removeChild(t),t=void 0,n}function Xt(e){return{text:Ii(e).trim(),note:"",color:""}}function Fi(e,t,n){let r=re(se([])),o=re(!1),s=re(!1),c=re(void 0);function p(y){const T={...y,text:y.text||"",note:y.note||"",color:y.color||"yellow"};if(y._id){const N=L(r).findIndex($=>$._id==y._id);N!=-1&&(L(r)[N]=T),t(T)}else{if(L(r).some(N=>N.text.toLocaleLowerCase().trim()==T.text.toLocaleLowerCase().trim()))return;L(r).push(T),e(T)}}function d(y){j(r,se(L(r).filter(T=>T._id!=y))),n({_id:y})}function f(){var N;const{range:y,id:T}=rt()||{};!y||T||(p(Xt(y)),(N=document.getSelection())==null||N.removeAllRanges())}function b(y){var k;const{range:T,id:N}=rt()||{};if(!T)return;const $=N?L(r).find(O=>O._id==N):Xt(T);$&&(p({...$,color:y}),(k=document.getSelection())==null||k.removeAllRanges())}function m(){var T;const{id:y}=rt()||{};y&&(d(y),(T=document.getSelection())==null||T.removeAllRanges())}function x(){const{range:y,id:T}=rt()||{};if(!y)return;const N=T?L(r).find($=>$._id==T):Xt(y);N&&j(c,se(JSON.parse(JSON.stringify(N))))}function E(){L(c)&&(p(L(c)),j(c,void 0))}function S(){j(c,void 0)}return{get highlights(){return L(r)},set highlights(y){j(r,se(y))},get pro(){return L(o)},set pro(y){j(o,se(y))},get nav(){return L(s)},set nav(y){j(s,se(y))},get draft(){return L(c)},addSelected:f,colorSelected:b,removeSelected:m,draftSelected:x,draftSubmit:E,draftCancel:S}}const Hi="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Hi);var Pi=he(''),ji=he(''),qi=he(''),Bi=he('
');function Mr(e,t){ct(t,!0);let n=Rt(t,"store",7),r,o=re(void 0),s=re(!1);function c(C){const A=C.currentTarget.returnValue;switch(C.currentTarget.returnValue="",A){case"add":t.store.addSelected();break;case"note":t.store.draftSelected();break;case"remove":t.store.removeSelected();break;default:if(Ve.has(A)){t.store.colorSelected(A);return}break}}function p(){j(s,!0)}function d(){j(s,!1),f()}function f(){if(L(s)){r==null||r.close();return}requestAnimationFrame(()=>{const{range:C,id:A}=rt()||{};if(!C){r==null||r.close();return}j(o,se(t.store.highlights.find(ee=>ee._id==A))),r.inert=!0,r==null||r.show(),r.inert=!1;const M=C.getBoundingClientRect(),R=Math.max(M.x,10)+window.scrollX,q=window.innerWidth-Math.max(M.x,10)-window.scrollX-M.width,V=Math.max(M.y,40)+window.scrollY+M.height+4,K=window.innerHeight-Math.max(M.y,40)-window.scrollY+4,ue=Rr=C,()=>r);var x=le(m),E=le(x);at(E,()=>{var C;return(C=L(o))==null?void 0:C._id},C=>{var A=Cr(),M=Mt(A);bn(M,71,()=>Ve,(R,q)=>Z(Z(R))[0],(R,q,V)=>{let K=()=>Z(Z(q))[0],ue=()=>Z(Z(q))[1];var Y=Pi(),ee=le(Y);Ce(()=>{Uo(Y,K()),fe(ee,"style",`--color: ${ue()??""}`),sn(ee,"active",K()==L(o).color)}),ne(R,Y)}),ne(C,A)},C=>{var A=ji();ne(C,A)});var S=H(H(E,!0)),y=le(S),T=le(y),N=le(T),$=H(N),k=H($),O=H(k),G=H(H(S,!0));return at(G,()=>{var C;return(C=L(o))==null?void 0:C._id},C=>{var A=qi();ne(C,A)}),Ce(()=>{var C,A,M,R,q,V;sn(m,"new",!((C=L(o))!=null&&C._id)),fe(N,"fill",(A=L(o))!=null&&A.note?"currentColor":"none"),fe(N,"stroke-width",(M=L(o))!=null&&M.note?"0":void 0),fe($,"fill",(R=L(o))!=null&&R.note?"none":"currentColor"),fe(k,"fill",(q=L(o))!=null&&q.note?"none":"currentColor"),fe(O,"fill",(V=L(o))!=null&&V.note?"none":"currentColor")}),ge("close",m,c,!1),ne(e,m),_n(e,"svelte-o4uskr",` + `)}const o=(()=>{let s=document.getElementById(Ee);return s||(s=document.createElement("style"),s.id=Ee,document.head.appendChild(s)),s})();o.innerHTML=n.join(` +`)}function si(){var e;document.body.querySelectorAll(`.${Ee}`).forEach(t=>t.outerHTML=t.innerText),(e=document.getElementById(Ee))==null||e.remove()}function li(e){const t=document.body.querySelector(`.${Ee}[data-id="${e}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"start"})}function ai(e){const t=e.commonAncestorContainer.nodeType==Node.ELEMENT_NODE?e.commonAncestorContainer:e.commonAncestorContainer.parentElement;if((t==null?void 0:t.className)==Ee){if(!e.collapsed){const n=new Range;n.selectNodeContents(e.commonAncestorContainer);const r=e.compareBoundaryPoints(Range.START_TO_START,n),o=e.compareBoundaryPoints(Range.END_TO_END,n);if(n.detach(),r!=0||o!=0)return}return t.getAttribute("data-id")||void 0}}function ui(e,t){if(!e)return e;const n=parseInt(e.slice(1,3),16),r=parseInt(e.slice(3,5),16),o=parseInt(e.slice(5,7),16);return`rgba(${n}, ${r}, ${o}, ${t})`}function At(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ci=typeof global=="object"&&global&&global.Object===Object&&global,fi=typeof self=="object"&&self&&self.Object===Object&&self,Ar=ci||fi||Function("return this")(),Xt=function(){return Ar.Date.now()},di=/\s/;function hi(e){for(var t=e.length;t--&&di.test(e.charAt(t)););return t}var pi=/^\s+/;function vi(e){return e&&e.slice(0,hi(e)+1).replace(pi,"")}var Dt=Ar.Symbol,Dr=Object.prototype,mi=Dr.hasOwnProperty,gi=Dr.toString,nt=Dt?Dt.toStringTag:void 0;function _i(e){var t=mi.call(e,nt),n=e[nt];try{e[nt]=void 0;var r=!0}catch{}var o=gi.call(e);return r&&(t?e[nt]=n:delete e[nt]),o}var yi=Object.prototype,bi=yi.toString;function wi(e){return bi.call(e)}var Ei="[object Null]",ki="[object Undefined]",Un=Dt?Dt.toStringTag:void 0;function Ci(e){return e==null?e===void 0?ki:Ei:Un&&Un in Object(e)?_i(e):wi(e)}function xi(e){return e!=null&&typeof e=="object"}var Ti="[object Symbol]";function $i(e){return typeof e=="symbol"||xi(e)&&Ci(e)==Ti}var Vn=NaN,Si=/^[-+]0x[0-9a-f]+$/i,Ni=/^0b[01]+$/i,Ai=/^0o[0-7]+$/i,Di=parseInt;function Xn(e){if(typeof e=="number")return e;if($i(e))return Vn;if(At(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=At(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=vi(e);var n=Ni.test(e);return n||Ai.test(e)?Di(e.slice(2),n?2:8):Si.test(e)?Vn:+e}var Oi="Expected a function",Li=Math.max,Mi=Math.min;function Ri(e,t,n){var r,o,s,c,v,d,f=0,y=!1,g=!1,x=!0;if(typeof e!="function")throw new TypeError(Oi);t=Xn(t)||0,At(n)&&(y=!!n.leading,g="maxWait"in n,s=g?Li(Xn(n.maxWait)||0,t):s,x="trailing"in n?!!n.trailing:x);function E(C){var A=r,M=o;return r=o=void 0,f=C,c=e.apply(M,A),c}function S(C){return f=C,v=setTimeout(N,t),y?E(C):c}function w(C){var A=C-d,M=C-f,R=t-A;return g?Mi(R,s-M):R}function T(C){var A=C-d,M=C-f;return d===void 0||A>=t||A<0||g&&M>=s}function N(){var C=Xt();if(T(C))return $(C);v=setTimeout(N,w(C))}function $(C){return v=void 0,x&&r?E(C):(r=o=void 0,c)}function k(){v!==void 0&&clearTimeout(v),f=0,r=d=o=v=void 0}function O(){return v===void 0?c:$(Xt())}function G(){var C=Xt(),A=T(C);if(r=arguments,o=this,d=C,A){if(v===void 0)return S(d);if(g)return clearTimeout(v),v=setTimeout(N,t),E(d)}return v===void 0&&(v=setTimeout(N,t)),c}return G.cancel=k,G.flush=O,G}var Ii="Expected a function";function Or(e,t,n){var r=!0,o=!0;if(typeof e!="function")throw new TypeError(Ii);return At(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),Ri(e,t,{leading:r,maxWait:t,trailing:o})}function Lr(e){return Ht?ti(e):ii(e)}const Fi=Or(Lr,500);function Gt(e){return e.length?Fi(e):Lr(e)}function Hi(){return Ht?ni():si()}function Mr(e){return Ht?ri(e):li(e)}function Pi(e){return Ht?oi(e):ai(e)}function ot(){const e=(()=>{const t=document.getSelection();return t!=null&&t.rangeCount?t.getRangeAt(0):null})();if(e){const t=Pi(e);if(t)return{range:e,id:t}}if(e&&!e.collapsed&&e.toString().trim())return{range:e}}function ji(e){if(!e)return"";var t=document.createElement("div");t.appendChild(e.cloneContents().cloneNode(!0)),document.body.appendChild(t);const n=t.innerText;return document.body.removeChild(t),t=void 0,n}function Kt(e){return{text:ji(e).trim(),note:"",color:""}}function qi(e,t,n){let r=re(se([])),o=re(!1),s=re(!1),c=re(void 0);function v(w){const T={...w,text:w.text||"",note:w.note||"",color:w.color||"yellow"};if(w._id){const N=L(r).findIndex($=>$._id==w._id);N!=-1&&(L(r)[N]=T),t(T)}else{if(L(r).some(N=>N.text.toLocaleLowerCase().trim()==T.text.toLocaleLowerCase().trim()))return;L(r).push(T),e(T)}}function d(w){j(r,se(L(r).filter(T=>T._id!=w))),n({_id:w})}function f(){var N;const{range:w,id:T}=ot()||{};!w||T||(v(Kt(w)),(N=document.getSelection())==null||N.removeAllRanges())}function y(w){var k;const{range:T,id:N}=ot()||{};if(!T)return;const $=N?L(r).find(O=>O._id==N):Kt(T);$&&(v({...$,color:w}),(k=document.getSelection())==null||k.removeAllRanges())}function g(){var T;const{id:w}=ot()||{};w&&(d(w),(T=document.getSelection())==null||T.removeAllRanges())}function x(){const{range:w,id:T}=ot()||{};if(!w)return;const N=T?L(r).find($=>$._id==T):Kt(w);N&&j(c,se(JSON.parse(JSON.stringify(N))))}function E(){L(c)&&(v(L(c)),j(c,void 0))}function S(){j(c,void 0)}return{get highlights(){return L(r)},set highlights(w){j(r,se(w))},get pro(){return L(o)},set pro(w){j(o,se(w))},get nav(){return L(s)},set nav(w){j(s,se(w))},get draft(){return L(c)},addSelected:f,colorSelected:y,removeSelected:g,draftSelected:x,draftSubmit:E,draftCancel:S}}const Bi="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Bi);var Yi=he(''),Wi=he(''),zi=he(''),Ui=he('
');function Rr(e,t){ft(t,!0);let n=It(t,"store",7),r,o=re(void 0),s=re(!1);function c(C){const A=C.currentTarget.returnValue;switch(C.currentTarget.returnValue="",A){case"add":t.store.addSelected();break;case"note":t.store.draftSelected();break;case"remove":t.store.removeSelected();break;default:if(Ve.has(A)){t.store.colorSelected(A);return}break}}function v(){j(s,!0)}function d(){j(s,!1),f()}function f(){if(L(s)){r==null||r.close();return}requestAnimationFrame(()=>{const{range:C,id:A}=ot()||{};if(!C){r==null||r.close();return}j(o,se(t.store.highlights.find(ee=>ee._id==A))),r.inert=!0,r==null||r.show(),r.inert=!1;const M=C.getBoundingClientRect(),R=Math.max(M.x,10)+window.scrollX,q=window.innerWidth-Math.max(M.x,10)-window.scrollX-M.width,V=Math.max(M.y,40)+window.scrollY+M.height+4,K=window.innerHeight-Math.max(M.y,40)-window.scrollY+4,ue=Rr=C,()=>r);var x=le(g),E=le(x);ut(E,()=>{var C;return(C=L(o))==null?void 0:C._id},C=>{var A=xr(),M=Rt(A);En(M,71,()=>Ve,(R,q)=>Z(Z(R))[0],(R,q,V)=>{let K=()=>Z(Z(q))[0],ue=()=>Z(Z(q))[1];var Y=Yi(),ee=le(Y);xe(()=>{Vo(Y,K()),fe(ee,"style",`--color: ${ue()??""}`),un(ee,"active",K()==L(o).color)}),ne(R,Y)}),ne(C,A)},C=>{var A=Wi();ne(C,A)});var S=H(H(E,!0)),w=le(S),T=le(w),N=le(T),$=H(N),k=H($),O=H(k),G=H(H(S,!0));return ut(G,()=>{var C;return(C=L(o))==null?void 0:C._id},C=>{var A=zi();ne(C,A)}),xe(()=>{var C,A,M,R,q,V;un(g,"new",!((C=L(o))!=null&&C._id)),fe(N,"fill",(A=L(o))!=null&&A.note?"currentColor":"none"),fe(N,"stroke-width",(M=L(o))!=null&&M.note?"0":void 0),fe($,"fill",(R=L(o))!=null&&R.note?"none":"currentColor"),fe(k,"fill",(q=L(o))!=null&&q.note?"none":"currentColor"),fe(O,"fill",(V=L(o))!=null&&V.note?"none":"currentColor")}),me("close",g,c,!1),ne(e,g),wn(e,"svelte-o4uskr",` .svelte-o4uskr { user-select: none; -webkit-user-select: none; @@ -183,13 +183,13 @@ transform: translateY(-3px); } } -`),ft({get store(){return n()},set store(C){n(C),Ie()}})}It(Mr,{store:{}},[],[],!0);function Yi(e){const t=e.currentTarget.getBoundingClientRect();t.top<=e.clientY&&e.clientY<=t.top+t.height&&t.left<=e.clientX&&e.clientX<=t.left+t.width||(e.preventDefault(),e.currentTarget.close())}var Wi=(e,t)=>j(t,!1),zi=he(''),Ui=he('
Upgrade to Pro to unlock annotation
'),Vi=he('
',1),Xi=he('
');function Rr(e,t){ct(t,!0);const n=[];let r=Rt(t,"store",7),o,s,c=re(!0);hr(()=>{t.store.draft?(j(c,!0),o==null||o.showModal()):o==null||o.close()});function p($){const k=$.currentTarget.returnValue;$.currentTarget.returnValue="",setTimeout(k?t.store.draftSubmit:t.store.draftCancel,200)}function d($){var k;$.stopImmediatePropagation(),$.stopPropagation(),$.key=="Enter"&&!$.shiftKey&&($.preventDefault(),s&&((k=$.currentTarget.closest("form"))==null||k.requestSubmit(s)))}var f=Xi();ln(f,$=>o=$,()=>o),f.__mousedown=[Yi];var b=le(f),m=le(b),x=H(H(b,!0)),E=le(x);at(E,()=>t.store.draft,$=>{var k=Vi(),O=Mt(k);O.__click=[Wi,c];var G=le(O);Ce(()=>{var R;return Wt(G,((R=t.store.draft)==null?void 0:R.text.trim())||"")});var C=H(H(O,!0));bn(C,73,()=>Ve,Po,(R,q,V)=>{let K=()=>Z(Z(q))[0],ue=()=>Z(Z(q))[1];var Y=zi();zo(Y);var ee;Ce(()=>{ee!==(ee=K())&&(Y.value=(Y.__value=K())==null?"":K()),fe(Y,"style",`--color: ${ue()??""}`)}),Xo(n,[],Y,()=>(K(),t.store.draft.color),$e=>t.store.draft.color=$e),ne(R,Y)});var A=H(H(C,!0));Wo(A),Yo(A),A.__keydown=d;var M=H(H(A,!0));at(M,()=>!t.store.pro,R=>{var q=Ui();ne(R,q)}),Ce(()=>{sn(O,"compact",L(c)),A.disabled=!t.store.pro}),Vo(A,()=>t.store.draft.note,R=>t.store.draft.note=R),ne($,k)});var S=H(H(E,!0)),y=le(S),T=H(H(y,!0));ln(T,$=>s=$,()=>s);var N=le(T);return Ce(()=>{var $,k;Wt(m,`${(($=t.store.draft)!=null&&$._id?"Edit":"New")??""} highlight`),Wt(N,`${((k=t.store.draft)!=null&&k._id?"Update":"Create")??""} `)}),ge("close",f,p,!1),ne(e,f),_n(e,"svelte-1b8vie9",` - .svelte-1b8vie9 { +`),dt({get store(){return n()},set store(C){n(C),Fe()}})}Ft(Rr,{store:{}},[],[],!0);function Vi(e){const t=e.currentTarget.getBoundingClientRect();t.top<=e.clientY&&e.clientY<=t.top+t.height&&t.left<=e.clientX&&e.clientX<=t.left+t.width||(e.preventDefault(),e.currentTarget.close())}var Xi=(e,t)=>j(t,!1),Gi=he(''),Ki=he('
Upgrade to Pro to unlock annotation
'),Ji=he('
',1),Zi=he('
');function Ir(e,t){ft(t,!0);const n=[];let r=It(t,"store",7),o,s,c=re(!0);rn(()=>{t.store.draft?(j(c,!0),o==null||o.showModal()):o==null||o.close()});function v($){const k=$.currentTarget.returnValue;$.currentTarget.returnValue="",setTimeout(k?t.store.draftSubmit:t.store.draftCancel,200)}function d($){var k;$.stopImmediatePropagation(),$.stopPropagation(),$.key=="Enter"&&!$.shiftKey&&($.preventDefault(),s&&((k=$.currentTarget.closest("form"))==null||k.requestSubmit(s)))}var f=Zi();cn(f,$=>o=$,()=>o),f.__mousedown=[Vi];var y=le(f),g=le(y),x=H(H(y,!0)),E=le(x);ut(E,()=>t.store.draft,$=>{var k=Ji(),O=Rt(k);O.__click=[Xi,c];var G=le(O);xe(()=>{var R;return Ut(G,((R=t.store.draft)==null?void 0:R.text.trim())||"")});var C=H(H(O,!0));En(C,73,()=>Ve,jo,(R,q,V)=>{let K=()=>Z(Z(q))[0],ue=()=>Z(Z(q))[1];var Y=Gi();Uo(Y);var ee;xe(()=>{ee!==(ee=K())&&(Y.value=(Y.__value=K())==null?"":K()),fe(Y,"style",`--color: ${ue()??""}`)}),Go(n,[],Y,()=>(K(),t.store.draft.color),Se=>t.store.draft.color=Se),ne(R,Y)});var A=H(H(C,!0));zo(A),Wo(A),A.__keydown=d;var M=H(H(A,!0));ut(M,()=>!t.store.pro,R=>{var q=Ki();ne(R,q)}),xe(()=>{un(O,"compact",L(c)),A.disabled=!t.store.pro}),Xo(A,()=>t.store.draft.note,R=>t.store.draft.note=R),ne($,k)});var S=H(H(E,!0)),w=le(S),T=H(H(w,!0));cn(T,$=>s=$,()=>s);var N=le(T);return xe(()=>{var $,k;Ut(g,`${(($=t.store.draft)!=null&&$._id?"Edit":"New")??""} highlight`),Ut(N,`${((k=t.store.draft)!=null&&k._id?"Update":"Create")??""} `)}),me("close",f,v,!1),ne(e,f),wn(e,"svelte-1me8cmn",` + .svelte-1me8cmn { box-sizing: border-box; -webkit-tap-highlight-color: transparent; } - dialog.svelte-1b8vie9 { + dialog.svelte-1me8cmn { --bg-light: rgb(245, 245, 245); --bg-dark: rgb(35, 35, 35); --fg-light: black; @@ -210,7 +210,7 @@ } @media (max-width: 1000px) and (pointer: coarse) { - dialog.svelte-1b8vie9 { + dialog.svelte-1me8cmn { left: 0;right: 0;bottom: 0;top: 0; width: 100%; margin: 0; @@ -221,25 +221,25 @@ } @media (pointer: coarse) { - dialog.svelte-1b8vie9 { + dialog.svelte-1me8cmn { bottom: auto; } } - dialog.svelte-1b8vie9, header.svelte-1b8vie9 { + dialog.svelte-1me8cmn, header.svelte-1me8cmn { background: var(--bg-light); background: light-dark(var(--bg-light), var(--bg-dark)); } - [open].svelte-1b8vie9 { + [open].svelte-1me8cmn { box-shadow: 0 0 0 .5px rgba(60, 60, 60, .9), 0 3px 10px rgba(0,0,0,.05), 0 7px 15px -3px rgba(0,0,0,.15); } - .svelte-1b8vie9::backdrop { + .svelte-1me8cmn::backdrop { background-color: rgba(0,0,0,.3); } - header.svelte-1b8vie9 { + header.svelte-1me8cmn { margin: 0; padding: 1em; font-weight: bold; @@ -249,20 +249,20 @@ } @supports(animation-timeline: scroll()) { - header.svelte-1b8vie9 { - animation: svelte-1b8vie9-header-scroll linear both; + header.svelte-1me8cmn { + animation: svelte-1me8cmn-header-scroll linear both; animation-timeline: scroll(); animation-range: 0 1px; } } - @keyframes svelte-1b8vie9-header-scroll { + @keyframes svelte-1me8cmn-header-scroll { to { box-shadow: 0 .5px 0 rgba(0,0,0,.2); } } - form.svelte-1b8vie9 { + form.svelte-1me8cmn { display: flex; flex-direction: column; gap: 1em; @@ -270,13 +270,13 @@ padding-top: 0; } - .color.svelte-1b8vie9 { + .color.svelte-1me8cmn { all: unset; display: flex; gap: .75em; } - .color.svelte-1b8vie9 input[type="radio"]:where(.svelte-1b8vie9) { + .color.svelte-1me8cmn input[type="radio"]:where(.svelte-1me8cmn) { cursor: pointer; appearance: none; user-select: none; @@ -290,40 +290,40 @@ border-radius: 50%; } - .color.svelte-1b8vie9 input[type="radio"]:where(.svelte-1b8vie9):checked { + .color.svelte-1me8cmn input[type="radio"]:where(.svelte-1me8cmn):checked { box-shadow: inset 0 0 0 .5em var(--color); } - .color.svelte-1b8vie9 input[type="radio"]:where(.svelte-1b8vie9):active { + .color.svelte-1me8cmn input[type="radio"]:where(.svelte-1me8cmn):active { transform: translateY(1px); } - blockquote.svelte-1b8vie9, .note.svelte-1b8vie9, button.svelte-1b8vie9 { + blockquote.svelte-1me8cmn, .note.svelte-1me8cmn, button.svelte-1me8cmn { background: var(--control-bg-light); background: light-dark(var(--control-bg-light), var(--control-bg-dark)); } - blockquote.svelte-1b8vie9 { - white-space: pre-line; + blockquote.svelte-1me8cmn { + white-space: pre-wrap; margin: 0; min-width: 100%; width: 0; font-size: 16px; } - blockquote.compact.svelte-1b8vie9 { + blockquote.compact.svelte-1me8cmn { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; overflow: clip; } - blockquote.svelte-1b8vie9, .note.svelte-1b8vie9 { + blockquote.svelte-1me8cmn, .note.svelte-1me8cmn { border-radius: .5em; padding: .5em .6em; } - .note.svelte-1b8vie9 { + .note.svelte-1me8cmn { min-width: min(21em, 70vw); min-height: 4lh; appearance: none; @@ -334,18 +334,18 @@ transition: background .15s ease-in-out, box-shadow .15s ease-in-out; } - .note.svelte-1b8vie9:focus { + .note.svelte-1me8cmn:focus { background: transparent; } - footer.svelte-1b8vie9 { + footer.svelte-1me8cmn { all: unset; display: flex; justify-content: flex-end; gap: .75em; } - button.svelte-1b8vie9 { + button.svelte-1me8cmn { appearance: none; user-select: none; -webkit-user-select: none; @@ -358,35 +358,35 @@ border-radius: .5em; } - button.svelte-1b8vie9:active { + button.svelte-1me8cmn:active { transform: translateY(1px); } - button.svelte-1b8vie9 sup:where(.svelte-1b8vie9) { + button.svelte-1me8cmn sup:where(.svelte-1me8cmn) { margin-left: .25em; vertical-align: text-top; opacity: .5; } @media (pointer: coarse) { - button.svelte-1b8vie9 sup:where(.svelte-1b8vie9) { + button.svelte-1me8cmn sup:where(.svelte-1me8cmn) { display: none; } } - button[value].svelte-1b8vie9 { + button[value].svelte-1me8cmn { background: blue; background: AccentColor; color: white; } - .unlock.svelte-1b8vie9 { + .unlock.svelte-1me8cmn { font-size: .75em; color: GrayText; } /* animation */ - dialog.svelte-1b8vie9, .svelte-1b8vie9::backdrop { + dialog.svelte-1me8cmn, .svelte-1me8cmn::backdrop { transition: display .2s allow-discrete ease-in-out, overlay .2s allow-discrete ease-in-out, @@ -396,37 +396,37 @@ opacity: 0; } - dialog.svelte-1b8vie9 { + dialog.svelte-1me8cmn { transform: translateY(1em); } - [open].svelte-1b8vie9, - [open].svelte-1b8vie9::backdrop { + [open].svelte-1me8cmn, + [open].svelte-1me8cmn::backdrop { opacity: 1; transform: translateY(0); } @starting-style { - [open].svelte-1b8vie9, - [open].svelte-1b8vie9::backdrop { + [open].svelte-1me8cmn, + [open].svelte-1me8cmn::backdrop { opacity: 0; } - [open].svelte-1b8vie9 { + [open].svelte-1me8cmn { transform: translateY(-1em); } } @supports not selector(::highlight(a)) { - dialog.svelte-1b8vie9, dialog.svelte-1b8vie9::backdrop { - animation: svelte-1b8vie9-simple-appear .2s forwards; + dialog.svelte-1me8cmn, dialog.svelte-1me8cmn::backdrop { + animation: svelte-1me8cmn-simple-appear .2s forwards; } - @keyframes svelte-1b8vie9-simple-appear { + @keyframes svelte-1me8cmn-simple-appear { from { opacity: 0; } to { opacity: 1; } } } -`),ft({get store(){return r()},set store($){r($),Ie()}})}br(["mousedown","click","keydown"]);It(Rr,{store:{}},[],[],!0);const Gi=(e,t)=>{const n=e.target.getAttribute("data-highlight");n&&(e.preventDefault(),t(n))};var Ki=he('
'),Ji=he('');function Ir(e,t){ct(t,!0);let n=Rt(t,"store",7);var r=Cr(),o=Mt(r);return at(o,()=>t.store.nav,s=>{var c=Ji();c.__click=[Gi,Lr],bn(c,77,()=>t.store.highlights,(p,d)=>Z(p)._id,(p,d,f)=>{var b=Ki();Ce(()=>fe(b,"style",`top: var(--highlight-${Z(d)._id??""}-top); --color: ${(Ve.get(Z(d).color)||Z(d).color)??""}`)),Ce(()=>fe(b,"data-highlight",Z(d)._id)),ne(p,b)}),ne(s,c)}),ne(e,r),_n(e,"svelte-1t9y4ki",` +`),dt({get store(){return r()},set store($){r($),Fe()}})}br(["mousedown","click","keydown"]);Ft(Ir,{store:{}},[],[],!0);const Qi=(e,t)=>{const n=e.target.getAttribute("data-highlight");n&&(e.preventDefault(),t(n))};var es=he('
'),ts=he('');function Fr(e,t){ft(t,!0);let n=It(t,"store",7);var r=xr(),o=Rt(r);return ut(o,()=>t.store.nav,s=>{var c=ts();c.__click=[Qi,Mr],En(c,77,()=>t.store.highlights,(v,d)=>Z(v)._id,(v,d,f)=>{var y=es();xe(()=>fe(y,"style",`top: var(--highlight-${Z(d)._id??""}-top); --color: ${(Ve.get(Z(d).color)||Z(d).color)??""}`)),xe(()=>fe(y,"data-highlight",Z(d)._id)),ne(v,y)}),ne(s,c)}),ne(e,r),wn(e,"svelte-1t9y4ki",` nav.svelte-1t9y4ki { all: unset; } @@ -451,4 +451,4 @@ width: 100%; background: var(--color); } -`),ft({get store(){return n()},set store(s){n(s),Ie()}})}br(["click"]);It(Ir,{store:{}},[],[],!0);var Zi=he(" ",1);function Qi(e,t){ct(t,!0);let n=Rt(t,"store",7);hr(()=>{Vt(t.store.highlights)});let r;function o(){Vt(t.store.highlights),clearTimeout(r),r=setTimeout(()=>Vt(t.store.highlights),3e3)}var s=Zi();ge("load",$t,o,!1),ge("popstate",$t,o,!1);var c=Mt(s);Mr(c,{get store(){return t.store}});var p=H(H(c,!0));Rr(p,{get store(){return t.store}});var d=H(H(p,!0));return Ir(d,{get store(){return t.store}}),ne(e,s),ft({get store(){return n()},set store(f){n(f),Ie()}})}customElements.define("rdh-ui",It(Qi,{store:{}},[],[],!0));function es(e){if(typeof chrome=="object"&&chrome.runtime&&chrome.runtime.onMessage||typeof browser=="object"&&browser.runtime&&browser.runtime.onMessage){const{runtime:t}=typeof browser=="object"?browser:chrome,n=(r,o)=>{o.id==t.id&&typeof r.type=="string"&&e(r)};return t.onMessage.removeListener(n),t.onMessage.addListener(n),r=>t.sendMessage(null,r)}if(window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.rdh)return window.rdhSend=e,t=>window.webkit.messageHandlers.rdh.postMessage(t);if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&process.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0){const{ipcRenderer:t}=require("electron"),n=(r,o)=>e(o);return t.removeListener("RDH",n),t.on("RDH",n),r=>t.sendToHost("RDH",r)}if("ReactNativeWebView"in window)return window.ReactNativeWebViewSendMessage=e,t=>window.ReactNativeWebView.postMessage(JSON.stringify(t));if(window.self!==window.top){const t=({data:n,source:r})=>{r!==window.parent||typeof n!="object"||typeof n.type!="string"||e(n)};return window.removeEventListener("message",t),window.addEventListener("message",t),n=>window.parent.postMessage(n,"*")}throw new Error("unsupported platform")}async function ts(e){let t=!1;const n=new Set,r=es(o=>{if(!t){n.add(o);return}e(o)});await new Promise(o=>{function s(){window.removeEventListener("DOMContentLoaded",s),o()}document.readyState=="loading"?(window.removeEventListener("DOMContentLoaded",s),window.addEventListener("DOMContentLoaded",s,{once:!0})):o()}),t=!0;for(const o of n)e(o),n.delete(o);return r}(async()=>{const e=await ts(r=>{switch(r.type){case"RDH_APPLY":Array.isArray(r.payload)&&(t.highlights=r.payload);break;case"RDH_CONFIG":t.pro=r.payload.pro||!1,t.nav=r.payload.nav||!1;break;case"RDH_SCROLL":typeof r.payload._id=="string"&&Lr(r.payload._id);break;case"RDH_ADD_SELECTION":t.addSelected();break;case"RDH_NOTE_SELECTION":t.draftSelected();break}}),t=Fi(r=>e({type:"RDH_ADD",payload:r}),r=>e({type:"RDH_UPDATE",payload:r}),({_id:r})=>e({type:"RDH_REMOVE",payload:{_id:r}})),n=document.createElement("rdh-ui");n.store=t,document.body.appendChild(n),e({type:"RDH_READY",payload:{url:location.href}})})(); +`),dt({get store(){return n()},set store(s){n(s),Fe()}})}br(["click"]);Ft(Fr,{store:{}},[],[],!0);var ns=he(" ",1);function rs(e,t){ft(t,!0);let n=It(t,"store",7);rn(()=>{Gt(t.store.highlights)});let r;function o(){Gt(t.store.highlights),clearTimeout(r),r=setTimeout(()=>Gt(t.store.highlights),3e3)}rn(()=>Hi);var s=ns();me("load",St,o,!1),me("popstate",St,o,!1);var c=Rt(s);Rr(c,{get store(){return t.store}});var v=H(H(c,!0));Ir(v,{get store(){return t.store}});var d=H(H(v,!0));return Fr(d,{get store(){return t.store}}),ne(e,s),dt({get store(){return n()},set store(f){n(f),Fe()}})}customElements.define("rdh-ui",Ft(rs,{store:{}},[],[],!0));function os(e){if(typeof chrome=="object"&&chrome.runtime&&chrome.runtime.onMessage||typeof browser=="object"&&browser.runtime&&browser.runtime.onMessage){const{runtime:t}=typeof browser=="object"?browser:chrome,n=(r,o)=>{o.id==t.id&&typeof r.type=="string"&&e(r)};return t.onMessage.removeListener(n),t.onMessage.addListener(n),r=>t.sendMessage(null,r)}if(window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.rdh)return window.rdhSend=e,t=>window.webkit.messageHandlers.rdh.postMessage(t);if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&process.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0){const{ipcRenderer:t}=require("electron"),n=(r,o)=>e(o);return t.removeListener("RDH",n),t.on("RDH",n),r=>t.sendToHost("RDH",r)}if("ReactNativeWebView"in window)return window.ReactNativeWebViewSendMessage=e,t=>window.ReactNativeWebView.postMessage(JSON.stringify(t));if(window.self!==window.top){const t=({data:n,source:r})=>{r!==window.parent||typeof n!="object"||typeof n.type!="string"||e(n)};return window.removeEventListener("message",t),window.addEventListener("message",t),n=>window.parent.postMessage(n,"*")}throw new Error("unsupported platform")}async function is(e){let t=!1;const n=new Set,r=os(o=>{if(!t){n.add(o);return}e(o)});await new Promise(o=>{function s(){window.removeEventListener("DOMContentLoaded",s),o()}document.readyState=="loading"?(window.removeEventListener("DOMContentLoaded",s),window.addEventListener("DOMContentLoaded",s,{once:!0})):o()}),t=!0;for(const o of n)e(o),n.delete(o);return r}const rt=document.createElement("rdh-ui");(async()=>{const e=await is(n=>{switch(n.type){case"RDH_APPLY":Array.isArray(n.payload)&&(t.highlights=n.payload);break;case"RDH_CONFIG":typeof n.payload.pro=="boolean"&&(t.pro=n.payload.pro),typeof n.payload.nav=="boolean"&&(t.nav=n.payload.nav),typeof n.payload.enabled=="boolean"&&(n.payload.enabled===!0?document.body.contains(rt)||document.body.appendChild(rt):document.body.contains(rt)&&document.body.removeChild(rt));break;case"RDH_SCROLL":typeof n.payload._id=="string"&&Mr(n.payload._id);break;case"RDH_ADD_SELECTION":t.addSelected();break;case"RDH_NOTE_SELECTION":t.draftSelected();break}}),t=qi(n=>e({type:"RDH_ADD",payload:n}),n=>e({type:"RDH_UPDATE",payload:n}),({_id:n})=>e({type:"RDH_REMOVE",payload:{_id:n}}));rt.store=t,e({type:"RDH_READY",payload:{url:location.href}})})();