ScrapBubble
複製時須連換行一同複製
可先複製到VSCode後,再轉貼到Scrapbox上
code:script.js
var Le,h,Lt,To,fe,Tt,Nt,Pt,Te={},St=[],No=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|inech|zoo|^ord|itera/i;function K(e,t){for(var r in t)er=tr;return e}function Ct(e){var t=e.parentNode;t&&t.removeChild(e)}function u(e,t,r){var o,n,s,a={};for(s in t)s=="key"?o=ts:s=="ref"?n=ts:as=ts;if(arguments.length>2&&(a.children=arguments.length>3?Le.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)as===void 0&&(as=e.defaultPropss);return Ne(e,a,o,n,null)}function Ne(e,t,r,o,n){var s={type:e,props:t,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:n??++Lt};return n==null&&h.vnode!=null&&h.vnode(s),s}function w(e){return e.children}function Pe(e,t){this.props=e,this.context=t}function ee(e,t){if(t==null)return e.__?ee(e.__,e.__.__k.indexOf(e)+1):null;for(var r;t<e.__k.length;t++)if((r=e.__kt)!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?ee(e):null}function It(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__kt)!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return It(e)}}function Ze(e){(!e.__d&&(e.__d=!0)&&fe.push(e)&&!Se.__r++||Nt!==h.debounceRendering)&&((Nt=h.debounceRendering)||Tt)(Se)}function Se(){for(var e;Se.__r=fe.length;)e=fe.sort(function(t,r){return t.__v.__b-r.__v.__b}),fe=[],e.some(function(t){var r,o,n,s,a,i;t.__d&&(a=(s=(r=t).__v).__e,(i=r.__P)&&(o=[],(n=K({},s)).__v=s.__v+1,et(i,s,n,r.__n,i.ownerSVGElement!==void 0,s.__h!=null?a:null,o,a??ee(s),s.__h),Ft(o,s),s.__e!=a&&It(s)))})}function Rt(e,t,r,o,n,s,a,i,c,p){var l,g,d,f,m,x,b,y=o&&o.__k||St,L=y.length;for(r.__k=[],l=0;l<t.length;l++)if((f=r.__kl=(f=tl)==null||typeof f=="boolean"?null:typeof f=="string"||typeof f=="number"||typeof f=="bigint"?Ne(null,f,null,null,f):Array.isArray(f)?Ne(w,{children:f},null,null,null):f.__b>0?Ne(f.type,f.props,f.key,null,f.__v):f)!=null){if(f.__=r,f.__b=r.__b+1,(d=yl)===null||d&&f.key==d.key&&f.type===d.type)yl=void 0;else for(g=0;g<L;g++){if((d=yg)&&f.key==d.key&&f.type===d.type){yg=void 0;break}d=null}et(e,f,d=d||Te,n,s,a,i,c,p),m=f.__e,(g=f.ref)&&d.ref!=g&&(b||(b=[]),d.ref&&b.push(d.ref,null,f),b.push(g,f.__c||m,f)),m!=null?(x==null&&(x=m),typeof f.type=="function"&&f.__k===d.__k?f.__d=c=Mt(f,c,e):c=jt(e,f,d,y,m,c),typeof r.type=="function"&&(r.__d=c)):c&&d.__e==c&&c.parentNode!=e&&(c=ee(d))}for(r.__e=x,l=L;l--;)yl!=null&&(typeof r.type=="function"&&yl.__e!=null&&yl.__e==r.__d&&(r.__d=ee(o,l+1)),Ht(yl,yl));if(b)for(l=0;l<b.length;l++)Dt(bl,b++l,b++l)}function Mt(e,t,r){for(var o,n=e.__k,s=0;n&&s<n.length;s++)(o=ns)&&(o.__=e,t=typeof o.type=="function"?Mt(o,t,r):jt(r,o,o,n,o.__e,t));return t}function jt(e,t,r,o,n,s){var a,i,c;if(t.__d!==void 0)a=t.__d,t.__d=void 0;else if(r==null||n!=s||n.parentNode==null)e:if(s==null||s.parentNode!==e)e.appendChild(n),a=null;else{for(i=s,c=0;(i=i.nextSibling)&&c<o.length;c+=2)if(i==n)break e;e.insertBefore(n,s),a=s}return a!==void 0?a:n.nextSibling}function Po(e,t,r,o,n){var s;for(s in r)s==="children"||s==="key"||s in t||Ce(e,s,null,rs,o);for(s in t)n&&typeof ts!="function"||s==="children"||s==="key"||s==="value"||s==="checked"||rs===ts||Ce(e,s,ts,rs,o)}function Bt(e,t,r){t0==="-"?e.setProperty(t,r):et=r==null?"":typeof r!="number"||No.test(t)?r:r+"px"}function Ce(e,t,r,o,n){var s;e:if(t==="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)r&&t in r||Bt(e.style,t,"");if(r)for(t in r)o&&rt===ot||Bt(e.style,t,rt)}else if(t0==="o"&&t1==="n")s=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.lt+s=r,r?o||e.addEventListener(t,s?$t:Ot,s):e.removeEventListener(t,s?$t:Ot,s);else if(t!=="dangerouslySetInnerHTML"){if(n)t=t.replace(/xlinkH:h/,"h").replace(/sName$/,"s");else if(t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t in e)try{et=r??"";break e}catch{}typeof r=="function"||(r!=null&&(r!==!1||t0==="a"&&t1==="r")?e.setAttribute(t,r):e.removeAttribute(t))}}function Ot(e){this.le.type+!1(h.event?h.event(e):e)}function $t(e){this.le.type+!0(h.event?h.event(e):e)}function et(e,t,r,o,n,s,a,i,c){var p,l,g,d,f,m,x,b,y,L,A,M=t.type;if(t.constructor!==void 0)return null;r.__h!=null&&(c=r.__h,i=t.__e=r.__e,t.__h=null,s=i),(p=h.__b)&&p(t);try{e:if(typeof M=="function"){if(b=t.props,y=(p=M.contextType)&&op.__c,L=p?y?y.props.value:p.__:o,r.__c?x=(l=t.__c=r.__c).__=l.__E:("prototype"in M&&M.prototype.render?t.__c=l=new M(b,L):(t.__c=l=new Pe(b,L),l.constructor=M,l.render=Co),y&&y.sub(l),l.props=b,l.state||(l.state={}),l.context=L,l.__n=o,g=l.__d=!0,l.__h=[]),l.__s==null&&(l.__s=l.state),M.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=K({},l.__s)),K(l.__s,M.getDerivedStateFromProps(b,l.__s))),d=l.props,f=l.state,g)M.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(M.getDerivedStateFromProps==null&&b!==d&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(b,L),!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(b,l.__s,L)===!1||t.__v===r.__v){l.props=b,l.state=l.__s,t.__v!==r.__v&&(l.__d=!1),l.__v=t,t.__e=r.__e,t.__k=r.__k,t.__k.forEach(function(U){U&&(U.__=t)}),l.__h.length&&a.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(b,l.__s,L),l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(d,f,m)})}l.context=L,l.props=b,l.state=l.__s,(p=h.__r)&&p(t),l.__d=!1,l.__v=t,l.__P=e,p=l.render(l.props,l.state,l.context),l.state=l.__s,l.getChildContext!=null&&(o=K(K({},o),l.getChildContext())),g||l.getSnapshotBeforeUpdate==null||(m=l.getSnapshotBeforeUpdate(d,f)),A=p!=null&&p.type===w&&p.key==null?p.props.children:p,Rt(e,Array.isArray(A)?A:A,t,r,o,n,s,a,i,c),l.base=t.__e,t.__h=null,l.__h.length&&a.push(l),x&&(l.__E=l.__=null),l.__e=!1}else s==null&&t.__v===r.__v?(t.__k=r.__k,t.__e=r.__e):t.__e=So(r.__e,t,r,o,n,s,a,c);(p=h.diffed)&&p(t)}catch(U){t.__v=null,(c||s!=null)&&(t.__e=i,t.__h=!!c,ss.indexOf(i)=null),h.__e(U,t,r)}}function Ft(e,t){h.__c&&h.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){h.__e(o,r.__v)}})}function So(e,t,r,o,n,s,a,i){var c,p,l,g=r.props,d=t.props,f=t.type,m=0;if(f==="svg"&&(n=!0),s!=null){for(;m<s.length;m++)if((c=sm)&&"setAttribute"in c==!!f&&(f?c.localName===f:c.nodeType===3)){e=c,sm=null;break}}if(e==null){if(f===null)return document.createTextNode(d);e=n?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f,d.is&&d),s=null,i=!1}if(f===null)g===d||i&&e.data===d||(e.data=d);else{if(s=s&&Le.call(e.childNodes),p=(g=r.props||Te).dangerouslySetInnerHTML,l=d.dangerouslySetInnerHTML,!i){if(s!=null)for(g={},m=0;m<e.attributes.length;m++)g[e.attributes[m].name]=e.attributes[m].value;(l||p)&&(l&&(p&&l.__html==p.__html||l.__html===e.innerHTML)||(e.innerHTML=l&&l.__html||""))}if(Po(e,d,g,n,i),l)t.__k=[];else if(m=t.props.children,Rt(e,Array.isArray(m)?m:m,t,r,o,n&&f!=="foreignObject",s,a,s?s0:r.__k&&ee(r,0),i),s!=null)for(m=s.length;m--;)sm!=null&&Ct(sm);i||("value"in d&&(m=d.value)!==void 0&&(m!==g.value||m!==e.value||f==="progress"&&!m)&&Ce(e,"value",m,g.value,!1),"checked"in d&&(m=d.checked)!==void 0&&m!==e.checked&&Ce(e,"checked",m,g.checked,!1))}return e}function Dt(e,t,r){try{typeof e=="function"?e(t):e.current=t}catch(o){h.__e(o,r)}}function Ht(e,t,r){var o,n;if(h.unmount&&h.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||Dt(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(s){h.__e(s,t)}o.base=o.__P=null}if(o=e.__k)for(n=0;n<o.length;n++)on&&Ht(on,t,typeof e.type!="function");r||e.__e==null||Ct(e.__e),e.__e=e.__d=void 0}function Co(e,t,r){return this.constructor(e,r)}function Ie(e,t,r){var o,n,s;h.__&&h.__(e,t),n=(o=typeof r=="function")?null:r&&r.__k||t.__k,s=[],et(t,e=(!o&&r||t).__k=u(w,null,e),n||Te,Te,t.ownerSVGElement!==void 0,!o&&r?r:n?null:t.firstChild?Le.call(t.childNodes):null,s,!o&&r?r:n?n.__e:t.firstChild,o),Ft(s,e)}function tt(e,t){var r={__c:t="__cC"+Pt++,__:e,Consumer:function(o,n){return o.children(n)},Provider:function(o){var n,s;return this.getChildContext||(n=[],(s={})t=this,this.getChildContext=function(){return s},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&n.some(Ze)},this.sub=function(a){n.push(a);var i=a.componentWillUnmount;a.componentWillUnmount=function(){n.splice(n.indexOf(a),1),i&&i.call(a)}}),o.children}};return r.Provider.__=r.Consumer.contextType=r}Le=St.slice,h={__e:function(e,t){for(var r,o,n;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),n=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e),n=r.__d),n)return r.__E=r}catch(s){e=s}throw e}},Lt=0,To=function(e){return e!=null&&e.constructor===void 0},Pe.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=K({},this.state),typeof e=="function"&&(e=e(K({},r),this.props)),e&&K(r,e),e!=null&&this.__v&&(t&&this.__h.push(t),Ze(this))},Pe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ze(this))},Pe.prototype.render=w,fe=[],Tt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Se.__r=0,Pt=0;var te,j,At,me=0,rt=[],Ut=h.__b,qt=h.__r,zt=h.diffed,Kt=h.__c,Gt=h.unmount;function ge(e,t){h.__h&&h.__h(j,e,me||t),me=0;var r=j.__H||(j.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__e}function R(e){return me=1,Io(Xt,e)}function Io(e,t,r){var o=ge(te++,2);return o.t=e,o.__c||(o.__=[r?r(t):Xt(void 0,t),function(n){var s=o.t(o.__0,n);o.__0!==s&&(o.__=[s,o.__1],o.__c.setState({}))}],o.__c=j),o.__}function $(e,t){var r=ge(te++,3);!h.__s&&nt(r.__H,t)&&(r.__=e,r.__H=t,j.__H.__h.push(r))}function Re(e,t){var r=ge(te++,4);!h.__s&&nt(r.__H,t)&&(r.__=e,r.__H=t,j.__h.push(r))}function re(e){return me=5,k(function(){return{current:e}},[])}function k(e,t){var r=ge(te++,7);return nt(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function O(e,t){return me=8,k(function(){return e},t)}function G(e){var t=j.contexte.__c,r=ge(te++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(j)),t.props.value):e.__}function Ro(){var e;for(rt.sort(function(t,r){return t.__v.__b-r.__v.__b});e=rt.pop();)if(e.__P)try{e.__H.__h.forEach(Me),e.__H.__h.forEach(ot),e.__H.__h=[]}catch(t){e.__H.__h=[],h.__e(t,e.__v)}}h.__b=function(e){j=null,Ut&&Ut(e)},h.__r=function(e){qt&&qt(e),te=0;var t=(j=e.__c).__H;t&&(t.__h.forEach(Me),t.__h.forEach(ot),t.__h=[])},h.diffed=function(e){zt&&zt(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(rt.push(t)!==1&&At===h.requestAnimationFrame||((At=h.requestAnimationFrame)||function(r){var o,n=function(){clearTimeout(s),Wt&&cancelAnimationFrame(o),setTimeout(r)},s=setTimeout(n,100);Wt&&(o=requestAnimationFrame(n))})(Ro)),j=null},h.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Me),r.__h=r.__h.filter(function(o){return!o.__||ot(o)})}catch(o){t.some(function(n){n.__h&&(n.__h=[])}),t=[],h.__e(o,r.__v)}}),Kt&&Kt(e,t)},h.unmount=function(e){Gt&&Gt(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(o){try{Me(o)}catch(n){t=n}}),t&&h.__e(t,r.__v))};var Wt=typeof requestAnimationFrame=="function";function Me(e){var t=j,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),j=t}function ot(e){var t=j;e.__c=e.__(),j=t}function nt(e,t){return!e||e.length!==t.length||t.some(function(r,o){return r!==eo})}function Xt(e,t){return typeof t=="function"?t(e):t}var v=e=>{let{fetch:t=globalThis.fetch,hostName:r="scrapbox.io",...o}=e;return{fetch:t,hostName:r,...o}};var jo=e=>typeof e=="object"&&e!==null,Bo=e=>jo(e)?(e.name===void 0||typeof e.name=="string")&&typeof e.message=="string":!1,Vt=e=>{try{let t=typeof e=="string"?JSON.parse(e):e;return Bo(t)?t:!1}catch(t){if(t instanceof SyntaxError)return!1;throw t}};var oe=class extends Error{constructor(t){super(${t.status} ${t.statusText} when fetching ${t.url});this.response=t;this.name="UnexpectedResponseError";Error.captureStackTrace&&Error.captureStackTrace(this,oe)}},N=async e=>{let t=e.clone(),r=await t.text(),o=Vt(r);if(!o)throw new oe(t);return{ok:!1,value:o}};var T=e=>connect.sid=${e};var B=e=>e.replaceAll(" ","_").toLowerCase();var P=e=>...e.map((t,r)=>t===" "?"_":!Oo.includes(t)||r===e.length-1&&$o.includes(t)?encodeURIComponent(t):t).join(""),Oo='@$&+=:;",',$o=':;",';var Yt=(e,t,r)=>{let{sid:o,hostName:n,followRename:s,projects:a}=v(r??{}),i=new URLSearchParams;i.append("followRename",${s??!0});for(let p of a??[])i.append("projects",p);let c=https://${n}/api/pages/${e}/${P(t)}?${i.toString()};return new Request(c,o?{headers:{Cookie:T(o)}}:void 0)},Qt=async e=>{if(!e.ok)return e.status===414?{ok:!1,value:{name:"TooLongURIError",message:"project ids may be too much."}}:N(e);let t=await e.json();return{ok:!0,value:t}},ne=async(e,t,r)=>{let{fetch:o}=v(r??{}),n=Yt(e,t,r),s=await o(n);return await Qt(s)};ne.toRequest=Yt;ne.fromResponse=Qt;var Jt=(e,t)=>{let{sid:r,hostName:o,sort:n,limit:s,skip:a}=v(t??{}),i=new URLSearchParams;n!==void 0&&i.append("sort",n),s!==void 0&&i.append("limit",${s}),a!==void 0&&i.append("skip",${a});let c=https://${o}/api/pages/${e}?${i.toString()};return new Request(c,r?{headers:{Cookie:T(r)}}:void 0)},Zt=async e=>{if(!e.ok)return N(e);let t=await e.json();return{ok:!0,value:t}},er=async(e,t)=>{let{fetch:r}=v(t??{}),o=await r(Jt(e,t));return await Zt(o)};er.toRequest=Jt;er.fromResponse=Zt;var tr=(e,t,r,o)=>{let{sid:n,hostName:s}=v(o??{}),a=https://${s}/api/table/${e}/${P(t)}/${encodeURIComponent(r)}.csv;return new Request(a,n?{headers:{Cookie:T(n)}}:void 0)},rr=async e=>e.ok?{ok:!0,value:await e.text()}:e.status===404?{ok:!1,value:{name:"NotFoundError",message:"Table not found."}}:N(e),or=async(e,t,r,o)=>{let{fetch:n}=v(o??{}),s=tr(e,t,r,o),a=await n(s);return await rr(a)};or.toRequest=tr;or.fromResponse=rr;var nr=(e,t)=>{let{sid:r,hostName:o}=v(t??{});return new Request(https://${o}/api/projects/${e},r?{headers:{Cookie:T(r)}}:void 0)},sr=async e=>{if(!e.ok)return N(e);let t=await e.json();return{ok:!0,value:t}},he=async(e,t)=>{let{fetch:r}=v(t??{}),o=nr(e,t),n=await r(o);return sr(n)};he.toRequest=nr;he.fromResponse=sr;var ir=(e,t)=>{let{sid:r,hostName:o}=v(t??{}),n=new URLSearchParams;for(let s of e)n.append("ids",s);return new Request(https://${o}/api/projects?${n.toString()},r?{headers:{Cookie:T(r)}}:void 0)},ar=async e=>{if(!e.ok)return N(e);let t=await e.json();return{ok:!0,value:t}},je=async(e,t)=>{let{fetch:r}=v(t??{}),o=await r(ir(e,t));return ar(o)};je.toRequest=ir;je.fromResponse=ar;var cr=(e,t,r,o)=>{let{sid:n,hostName:s}=v(o??{}),a=https://${s}/api/code/${e}/${P(t)}/${P(r)};return new Request(a,n?{headers:{Cookie:T(n)}}:void 0)},lr=async e=>e.ok?{ok:!0,value:await e.text()}:e.status===404&&e.headers.get("Content-Type")?.includes?.("text/plain")?{ok:!1,value:{name:"NotFoundError",message:"Code block is not found"}}:N(e),pr=async(e,t,r,o)=>{let{fetch:n}=v(o??{}),s=cr(e,t,r,o),a=await n(s);return await lr(a)};pr.toRequest=cr;pr.fromResponse=lr;var ur=new TextEncoder().encode("0123456789abcdef");function dr(e){let t=new Uint8Array(e.length*2);for(let r=0;r<t.length;r++){let o=er;tr*2=uro>>4,tr*2+1=uro&15}return t}var fr="md5: data is invalid type",Q=64,st=class{#e;#t;#r;#o;#n;#i;#s;#a;constructor(){this.#e=1732584193,this.#t=4023233417,this.#r=2562383102,this.#o=271733878,this.#n=new Uint8Array(Q),this.#i=0,this.#s=0,this.#a=0}#l(t){let r=this.#s;r+=t,r>4294967295&&(this.#a+=1),this.#s=r>>>0}#c(t){let r=this.#e,o=this.#t,n=this.#r,s=this.#o,a=Y=>tY|tY+1<<8|tY+2<<16|tY+3<<24,i=(Y,Et)=>Y<<Et|Y>>>32-Et,c=a(0),p=a(4),l=a(8),g=a(12),d=a(16),f=a(20),m=a(24),x=a(28),b=a(32),y=a(36),L=a(40),A=a(44),M=a(48),U=a(52),we=a(56),Ee=a(60);r=o+i(((n^s)&o^s)+r+c+3614090360,7),s=r+i(((o^n)&r^n)+s+p+3905402710,12),n=s+i(((r^o)&s^o)+n+l+606105819,17),o=n+i(((s^r)&n^r)+o+g+3250441966,22),r=o+i(((n^s)&o^s)+r+d+4118548399,7),s=r+i(((o^n)&r^n)+s+f+1200080426,12),n=s+i(((r^o)&s^o)+n+m+2821735955,17),o=n+i(((s^r)&n^r)+o+x+4249261313,22),r=o+i(((n^s)&o^s)+r+b+1770035416,7),s=r+i(((o^n)&r^n)+s+y+2336552879,12),n=s+i(((r^o)&s^o)+n+L+4294925233,17),o=n+i(((s^r)&n^r)+o+A+2304563134,22),r=o+i(((n^s)&o^s)+r+M+1804603682,7),s=r+i(((o^n)&r^n)+s+U+4254626195,12),n=s+i(((r^o)&s^o)+n+we+2792965006,17),o=n+i(((s^r)&n^r)+o+Ee+1236535329,22),r=o+i(((o^n)&s^n)+r+p+4129170786,5),s=r+i(((r^o)&n^o)+s+m+3225465664,9),n=s+i(((s^r)&o^r)+n+A+643717713,14),o=n+i(((n^s)&r^s)+o+c+3921069994,20),r=o+i(((o^n)&s^n)+r+f+3593408605,5),s=r+i(((r^o)&n^o)+s+L+38016083,9),n=s+i(((s^r)&o^r)+n+Ee+3634488961,14),o=n+i(((n^s)&r^s)+o+d+3889429448,20),r=o+i(((o^n)&s^n)+r+y+568446438,5),s=r+i(((r^o)&n^o)+s+we+3275163606,9),n=s+i(((s^r)&o^r)+n+g+4107603335,14),o=n+i(((n^s)&r^s)+o+b+1163531501,20),r=o+i(((o^n)&s^n)+r+U+2850285829,5),s=r+i(((r^o)&n^o)+s+l+4243563512,9),n=s+i(((s^r)&o^r)+n+x+1735328473,14),o=n+i(((n^s)&r^s)+o+M+2368359562,20),r=o+i((o^n^s)+r+f+4294588738,4),s=r+i((r^o^n)+s+b+2272392833,11),n=s+i((s^r^o)+n+A+1839030562,16),o=n+i((n^s^r)+o+we+4259657740,23),r=o+i((o^n^s)+r+p+2763975236,4),s=r+i((r^o^n)+s+d+1272893353,11),n=s+i((s^r^o)+n+x+4139469664,16),o=n+i((n^s^r)+o+L+3200236656,23),r=o+i((o^n^s)+r+U+681279174,4),s=r+i((r^o^n)+s+c+3936430074,11),n=s+i((s^r^o)+n+g+3572445317,16),o=n+i((n^s^r)+o+m+76029189,23),r=o+i((o^n^s)+r+y+3654602809,4),s=r+i((r^o^n)+s+M+3873151461,11),n=s+i((s^r^o)+n+Ee+530742520,16),o=n+i((n^s^r)+o+l+3299628645,23),r=o+i((n^(o|~s))+r+c+4096336452,6),s=r+i((o^(r|~n))+s+x+1126891415,10),n=s+i((r^(s|~o))+n+we+2878612391,15),o=n+i((s^(n|~r))+o+f+4237533241,21),r=o+i((n^(o|~s))+r+M+1700485571,6),s=r+i((o^(r|~n))+s+g+2399980690,10),n=s+i((r^(s|~o))+n+L+4293915773,15),o=n+i((s^(n|~r))+o+p+2240044497,21),r=o+i((n^(o|~s))+r+b+1873313359,6),s=r+i((o^(r|~n))+s+Ee+4264355552,10),n=s+i((r^(s|~o))+n+m+2734768916,15),o=n+i((s^(n|~r))+o+U+1309151649,21),r=o+i((n^(o|~s))+r+d+4149444226,6),s=r+i((o^(r|~n))+s+A+3174756917,10),n=s+i((r^(s|~o))+n+l+718787259,15),o=n+i((s^(n|~r))+o+y+3951481745,21),this.#e=this.#e+r>>>0,this.#t=this.#t+o>>>0,this.#r=this.#r+n>>>0,this.#o=this.#o+s>>>0}update(t){let r;if(typeof t=="string")r=new TextEncoder().encode(t);else if(typeof t=="object")if(t instanceof ArrayBuffer||ArrayBuffer.isView(t))r=new Uint8Array(t);else throw new TypeError(fr);else throw new TypeError(fr);let o=this.#i,n=Q-o;if(r.length<n)this.#n.set(r,o),o+=r.length;else{this.#n.set(r.slice(0,n),o),this.#c(this.#n);let s=n;for(;s+Q<=r.length;)this.#c(r.slice(s,s+Q)),s+=Q;this.#n.fill(0).set(r.slice(s),0),o=r.length-s}return this.#i=o,this.#l(r.length),this}digest(){let t=Q-this.#i;t<9&&(t+=Q);let r=new Uint8Array(t);r0=128;let o=this.#s<<3,n=this.#a<<3|this.#s>>>29;rr.length-8=o&255,rr.length-7=o>>>8&255,rr.length-6=o>>>16&255,rr.length-5=o>>>24&255,rr.length-4=n&255,rr.length-3=n>>>8&255,rr.length-2=n>>>16&255,rr.length-1=n>>>24&255,this.update(r.buffer);let s=new ArrayBuffer(16),a=new DataView(s);return a.setUint32(0,this.#e,!0),a.setUint32(4,this.#t,!0),a.setUint32(8,this.#r,!0),a.setUint32(12,this.#o,!0),s}toString(t="hex"){let r=this.digest();switch(t){case"hex":return new TextDecoder().decode(dr(new Uint8Array(r)));case"base64":{let o=new Uint8Array(r),n="";for(let s=0;s<o.length;++s)n+=String.fromCharCode(os);return btoa(n)}default:throw new Error("md5: invalid format")}}};var J=e=>new Promise(t=>setTimeout(()=>t(),e));var Fo=/https?:\/\/(?:www\.|music\.|)youtube\.com\/watch/,Do=/https?:\/\/youtu\.be\/(a-zA-Z\d_-+)(?:\?(^\s{0,100})|)/,Ho=/https?:\/\/(?:www\.|)youtube\.com\/shorts\/(a-zA-Z\d_-+)(?:\?(^\s+)|)/,Ao=/https?:\/\/(?:www\.|music\.|)youtube\.com\/playlist\?((?:^\s+&|)list=(a-zA-Z\d_-+)(?:&^\s+|))/,mr=e=>{if(Fo.test(e)){let t=new URL(e).searchParams,r=t.get("v");if(r)return{pathType:"com",videoId:r,params:t}}{let t=e.match(Do);if(t){let,r,o=t;return{videoId:r,params:new URLSearchParams(o),pathType:"dotbe"}}}{let t=e.match(Ho);if(t){let,r,o=t;return{videoId:r,params:new URLSearchParams(o),pathType:"short"}}}{let t=e.match(Ao);if(t){let,r,o=t;return{listId:o,params:new URLSearchParams(r),pathType:"list"}}}};var Uo=/https?:\/\/vimeo\.com\/(0-9+)/i,gr=e=>{let t=e.match(Uo);if(!!t)return t1};var qo=/https?:\/\/open\.spotify\.com\/(track|artist|playlist|album|episode|show)\/(a-zA-Z\d_-+)(?:\?^\s{0,100}|)/,hr=e=>{let t=e.match(qo);if(!t)return;let,r,o=t;return{videoId:o,pathType:r}};var zo=/https?:\/\/anchor\.fm\/a-zA-Z\d_-+\/episodes\/(a-zA-Z\d_-+(?:\/a-zA-Z\d_-+)?)(?:\?^\s{0,100}|)/,br=e=>{let t=e.match(zo);if(!t)return;let,r=t;return r};var xr=e=>{let{type:t,pathType:r,content:o,href:n,...s}=e;if(o===""){let a=mr(n);if(a)return{type:"youtube",href:n,...a,...s};let i=gr(n);if(i)return{type:"vimeo",videoId:i,href:n,...s};let c=hr(n);if(c)return{type:"spotify",href:n,...c,...s};let p=br(n);if(p)return{type:"anchor-fm",videoId:p,href:n,...s};if(Go(n))return{type:"video",href:n,...s}}return Ko(n)?{type:"audio",content:o,href:n,...s}:{type:"absoluteLink",content:o,href:n,...s}},Ko=e=>/\.(?:mp3|ogg|wav|aac)$/.test(e),Go=e=>/\.(?:mp4|webm)$/.test(e);var yr=async()=>{let e=localStorage.getItem("projectsLastAccessed");if(!e)return[];try{let t=JSON.parse(e),r=Object.entries(t).sort((,s,,a)=>a-s).map((s)=>s),o=await je([]);if(!o.ok)return r;let n=o.value.projects.map(s=>s.id);return r.filter(s=>!n.includes(s))}catch(t){if(!(t instanceof SyntaxError))throw t;return[]}};var _r;(function(e){})(_r||(_r={}));var Wo="0.13.3",kr,vr=async(e=Wo)=>{let t=https://cdnjs.cloudflare.com/ajax/libs/KaTeX/${e}/katex.min.js;if(document.querySelector(script[src="${t}"]))return window.katex!==void 0?Promise.resolve(window.katex):await new Promise(o=>{let n=setInterval(()=>{window.katex!==void 0&&(clearInterval(n),o(window.katex))},500)});let r=document.createElement("script");return r.src=t,kr??=new Promise((o,n)=>{r.onload=()=>o(window.katex),r.onerror=s=>n(s),document.head.append(r)}),kr};var be=(e,t={})=>{let r=re(null),o,n=R(e),s,a=R("");return $(()=>{(async()=>{let{render:i}=await vr();if(!!r.current)try{i(o,r.current,t),a("")}catch(c){if(c instanceof Error&&c.name==="ParseError")a(c.message.slice("KaTeX parse error: ".length));else throw c}})()},o),{ref:r,error:s,setFormula:n}};var se=e=>{if(e.pathType==="root"){let,t="",r=""=e.href.match(/\/(\w\-+)(?:\/?|\/(.*))$/)??"","","";if(t==="")throw SyntaxError(Failed to get a project name from "${e.href}");let,o=r?.match?.(/#(a-f\d{24,32})$/)??"","";return r===""?{project:t}:o===""?{project:t,title:r}:{project:t,title:r.slice(0,-1-o.length),hash:o}}else{let,t=e.href.match(/#(a-f\d{24,32})$/)??"","";return t===""?{title:e.href}:{title:e.href.slice(0,-1-t.length),hash:t}}};var it=(e,t)=>t.some(r=>{let o=!e.project;switch(r.type){case"hashTag":return o&&B(r.href)===e.titleLc;case"link":{if(r.pathType=="absolute"||r.pathType==="relative"!==o)return!1;let{project:n,title:s=""}=se({pathType:r.pathType,href:r.href});return o?!n&&B(s)===e.titleLc:n===e.project&&B(s)===e.titleLc}case"quote":case"strong":case"decoration":return it(e,r.nodes)}});var E=(e,t)=>/${e}/${B(t)},Oe=e=>{let t=e.match("/(^/+)/(.+)");if(!t)throw SyntaxError("${e}" cannnot match "/([^/]+)/(.+)");return{project:t1,titleLc:t2}};var ie=(e,t)=>new Promise(r=>{let o=!1,n=()=>{o=!0,r(!1)};e.addEventListener("click",n),e.addEventListener("pointerleave",n),setTimeout(()=>{o||r(!0),e.removeEventListener("click",n),e.removeEventListener("pointerleave",n),r(!1)},t)});var wr=!1;scrapbox.addListener("lines:changed",()=>wr=!1);scrapbox.addListener("layout:changed",()=>wr=!1);var ct=e=>{let t=JSON.parse(localStorage.getItem("pageTransitionContext")??""),r=e.type==="page"?e.from.project===e.to.project?e.from.title===e.to.title?{titleHint:e.to.title}:{linkFrom:e.from.title}:{linkFrom:/${e.from.project}/${e.from.title}}:{searchQuery:e.query};t[page_${B(e.to.title)}]=r,localStorage.setItem("pageTransitionContext",JSON.stringify(t))};var Lr=async(e,t)=>{let r=await globalThis.caches.keys();for(let o of r.sort().reverse()){let s=await(await caches.open(o)).match(e,t);if(s)return s}};var Tr=e=>{let t=[],r=new Set,o=n=>{r.delete(n);let s=t.pop();if(!s)return;let a=s0().finally(()=>o(a)).then(i=>s1(i)).catch(i=>s2(i));r.add(a)};return n=>{if(r.size<e){let s=n().finally(()=>o(s));return r.add(s),s}return new Promise((s,a)=>{t.push(n,s,a)})}};var en="0.6.5",Nr=ScrapBubble-${en},Pr=await globalThis.caches.open(Nr);(async()=>{for(let e of await globalThis.caches.keys())e.startsWith("ScrapBubble-")&&e!==Nr&&(await globalThis.caches.delete(e),console.log([ScrapBubble] deleted old cache :"${e}"))})();var Sr=Tr(3);async function*$e(e,t){let r=((t?.saveFailedResponse?Pr.match(e):void 0)??Lr(e,t)).then(a=>"cache",a);{let a=J(1e3).then(()=>"timeout"),i=await Promise.race(r,a);if(i!=="timeout"){i1&&(yield["cache",i1]);let c=await Sr(()=>fetch(e));!c.ok&&t?.saveFailedResponse&&await Pr.put(e,c.clone()),yield"network",c}}let o=Sr(()=>fetch(e)).then(a=>"network",a),n,s=await Promise.race(r,o);if(n==="network"){yieldn,s;return}s&&(yieldn,s),yield await o}var Cr=(e,t)=>new Date(e.headers.get("Date")??0).getTime()/1e3+t<new Date().getTime()/1e3;var Fe=()=>{let e=new Map;return{dispatch:(t,r)=>{let o=e.get(t);if(!!o)for(let n of o)n(r)},on:(t,r)=>{let o=e.get(t)??new Set;o.add(r),e.set(t,o)},off:(t,r)=>{let o=e.get(t);!o||o.delete(r)}}};var Ir=Symbol.for("immer-nothing"),Rr=Symbol.for("immer-draftable"),_=Symbol.for("immer-state");function H(e,...t){throw new Error([Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf)}var ae=Object.getPrototypeOf;function ce(e){return!!e&&!!e_}function q(e){return e?Mr(e)||Array.isArray(e)||!!eRr||!!e.constructor?.Rr||He(e)||Ae(e):!1}var tn=Object.prototype.constructor.toString();function Mr(e){if(!e||typeof e!="object")return!1;let t=ae(e);if(t===null)return!0;let r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===tn}function xe(e,t){De(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,er,e)}):e.forEach((r,o)=>t(o,r,e))}function De(e){let t=e_;return t?t.type_:Array.isArray(e)?1:He(e)?2:Ae(e)?3:0}function lt(e,t){return De(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function jr(e,t,r){let o=De(e);o===2?e.set(t,r):o===3?e.add(r):et=r}function rn(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function He(e){return e instanceof Map}function Ae(e){return e instanceof Set}function S(e){return e.copy_||e.base_}function pt(e,t){if(He(e))return new Map(e);if(Ae(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=Mr(e);if(t===!0||t==="class_only"&&!r){let o=Object.getOwnPropertyDescriptors(e);delete o_;let n=Reflect.ownKeys(o);for(let s=0;s<n.length;s++){let a=ns,i=oa;i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(oa={configurable:!0,writable:!0,enumerable:i.enumerable,value:ea})}return Object.create(ae(e),o)}else{let o=ae(e);if(o!==null&&r)return{...e};let n=Object.create(o);return Object.assign(n,e)}}function ut(e,t=!1){return Ue(e)||ce(e)||!q(e)||(De(e)>1&&(e.set=e.add=e.clear=e.delete=on),Object.freeze(e),t&&Object.entries(e).forEach((r,o)=>ut(o,!0))),e}function on(){H(2)}function Ue(e){return Object.isFrozen(e)}var dt={};function Z(e){let t=dte;return t||H(0,e),t}function nn(e,t){dte||(dte=t)}var ye;function qe(){return ye}function sn(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Br(e,t){t&&(Z("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ft(e){mt(e),e.drafts_.forEach(an),e.drafts_=null}function mt(e){e===ye&&(ye=e.parent_)}function Or(e){return ye=sn(ye,e)}function an(e){let t=e_;t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function $r(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_0;return e!==void 0&&e!==r?(r_.modified_&&(ft(t),H(4)),q(e)&&(e=ze(t,e),t.parent_||Ke(t,e)),t.patches_&&Z("Patches").generateReplacementPatches_(r_.base_,e,t.patches_,t.inversePatches_)):e=ze(t,r,[]),ft(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ir?e:void 0}function ze(e,t,r){if(Ue(t))return t;let o=t_;if(!o)return xe(t,(n,s)=>Fr(e,o,t,n,s,r)),t;if(o.scope_!==e)return t;if(!o.modified_)return Ke(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;let n=o.copy_,s=n,a=!1;o.type_===3&&(s=new Set(n),n.clear(),a=!0),xe(s,(i,c)=>Fr(e,o,n,i,c,r,a)),Ke(e,n,!1),r&&e.patches_&&Z("Patches").generatePatches_(o,r,e.patches_,e.inversePatches_)}return o.copy_}function Fr(e,t,r,o,n,s,a){if(ce(n)){let i=s&&t&&t.type_!==3&&!lt(t.assigned_,o)?s.concat(o):void 0,c=ze(e,n,i);if(jr(r,o,c),ce(c))e.canAutoFreeze_=!1;else return}else a&&r.add(n);if(q(n)&&!Ue(n)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ze(e,n),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,o)&&Ke(e,n)}}function Ke(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ut(t,r)}function cn(e,t){let r=Array.isArray(e),o={type_:r?1:0,scope_:t?t.scope_:qe(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},n=o,s=gt;r&&(n=o,s=_e);let{revoke:a,proxy:i}=Proxy.revocable(n,s);return o.draft_=i,o.revoke_=a,i}var gt={get(e,t){if(t===_)return e;let r=S(e);if(!lt(r,t))return ln(e,r,t);let o=rt;return e.finalized_||!q(o)?o:o===ht(e.base_,t)?(bt(e),e.copy_t=ke(o,e)):o},has(e,t){return t in S(e)},ownKeys(e){return Reflect.ownKeys(S(e))},set(e,t,r){let o=Dr(S(e),t);if(o?.set)return o.set.call(e.draft_,r),!0;if(!e.modified_){let n=ht(S(e),t),s=n?._;if(s&&s.base_===r)return e.copy_t=r,e.assigned_t=!1,!0;if(rn(r,n)&&(r!==void 0||lt(e.base_,t)))return!0;bt(e),z(e)}return e.copy_t===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_t)||(e.copy_t=r,e.assigned_t=!0),!0},deleteProperty(e,t){return ht(e.base_,t)!==void 0||t in e.base_?(e.assigned_t=!1,bt(e),z(e)):delete e.assigned_t,e.copy_&&delete e.copy_t,!0},getOwnPropertyDescriptor(e,t){let r=S(e),o=Reflect.getOwnPropertyDescriptor(r,t);return o&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:o.enumerable,value:rt}},defineProperty(){H(11)},getPrototypeOf(e){return ae(e.base_)},setPrototypeOf(){H(12)}},_e={};xe(gt,(e,t)=>{_ee=function(){return arguments0=arguments00,t.apply(this,arguments)}});_e.deleteProperty=function(e,t){return _e.set.call(this,e,t,void 0)};_e.set=function(e,t,r){return gt.set.call(this,e0,t,r,e0)};function ht(e,t){let r=e_;return(r?S(r):e)t}function ln(e,t,r){let o=Dr(t,r);return o?"value"in o?o.value:o.get?.call(e.draft_):void 0}function Dr(e,t){if(!(t in e))return;let r=ae(e);for(;r;){let o=Object.getOwnPropertyDescriptor(r,t);if(o)return o;r=ae(r)}}function z(e){e.modified_||(e.modified_=!0,e.parent_&&z(e.parent_))}function bt(e){e.copy_||(e.copy_=pt(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var pn=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,o)=>{if(typeof t=="function"&&typeof r!="function"){let s=r;r=t;let a=this;return function(i=s,...c){return a.produce(i,p=>r.call(this,p,...c))}}typeof r!="function"&&H(6),o!==void 0&&typeof o!="function"&&H(7);let n;if(q(t)){let s=Or(this),a=ke(t,void 0),i=!0;try{n=r(a),i=!1}finally{i?ft(s):mt(s)}return Br(s,o),$r(n,s)}else if(!t||typeof t!="object"){if(n=r(t),n===void 0&&(n=t),n===Ir&&(n=void 0),this.autoFreeze_&&ut(n,!0),o){let s=[],a=[];Z("Patches").generateReplacementPatches_(t,n,s,a),o(s,a)}return n}else H(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,i=>t(i,...a));let o,n;returnthis.produce(t,r,(s,a)=>{o=s,n=a}),o,n},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){q(e)||H(8),ce(e)&&(e=un(e));let t=Or(this),r=ke(e,void 0);return r_.isManual_=!0,mt(t),r}finishDraft(e,t){let r=e&&e_;(!r||!r.isManual_)&&H(9);let{scope_:o}=r;return Br(o,t),$r(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let n=tr;if(n.path.length===0&&n.op==="replace"){e=n.value;break}}r>-1&&(t=t.slice(r+1));let o=Z("Patches").applyPatches_;return ce(e)?o(e,t):this.produce(e,n=>o(n,t))}};function ke(e,t){let r=He(e)?Z("MapSet").proxyMap_(e,t):Ae(e)?Z("MapSet").proxySet_(e,t):cn(e,t);return(t?t.scope_:qe()).drafts_.push(r),r}function un(e){return ce(e)||H(10,e),Hr(e)}function Hr(e){if(!q(e)||Ue(e))return e;let t=e_,r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=pt(e,t.scope_.immer_.useStrictShallowCopy_)}else r=pt(e,!0);return xe(r,(o,n)=>{jr(r,o,Hr(n))}),t&&(t.finalized_=!1),r}function Ar(){class e extends Map{constructor(c,p){super(),this_={type_:2,parent_:p,scope_:p?p.scope_:qe(),modified_:!1,finalized_:!1,copy_:void 0,assigned_:void 0,base_:c,draft_:this,isManual_:!1,revoked_:!1}}get size(){return S(this_).size}has(c){return S(this_).has(c)}set(c,p){let l=this_;return a(l),(!S(l).has(c)||S(l).get(c)!==p)&&(r(l),z(l),l.assigned_.set(c,!0),l.copy_.set(c,p),l.assigned_.set(c,!0)),this}delete(c){if(!this.has(c))return!1;let p=this_;return a(p),r(p),z(p),p.base_.has(c)?p.assigned_.set(c,!1):p.assigned_.delete(c),p.copy_.delete(c),!0}clear(){let c=this_;a(c),S(c).size&&(r(c),z(c),c.assigned_=new Map,xe(c.base_,p=>{c.assigned_.set(p,!1)}),c.copy_.clear())}forEach(c,p){let l=this_;S(l).forEach((g,d,f)=>{c.call(p,this.get(d),d,this)})}get(c){let p=this_;a(p);let l=S(p).get(c);if(p.finalized_||!q(l)||l!==p.base_.get(c))return l;let g=ke(l,p);return r(p),p.copy_.set(c,g),g}keys(){return S(this_).keys()}values(){let c=this.keys();return{Symbol.iterator:()=>this.values(),next:()=>{let p=c.next();return p.done?p:{done:!1,value:this.get(p.value)}}}}entries(){let c=this.keys();return{Symbol.iterator:()=>this.entries(),next:()=>{let p=c.next();if(p.done)return p;let l=this.get(p.value);return{done:!1,value:p.value,l}}}}Symbol.iterator(){return this.entries()}}function t(i,c){return new e(i,c)}function r(i){i.copy_||(i.assigned_=new Map,i.copy_=new Map(i.base_))}class o extends Set{constructor(c,p){super(),this_={type_:3,parent_:p,scope_:p?p.scope_:qe(),modified_:!1,finalized_:!1,copy_:void 0,base_:c,draft_:this,drafts_:new Map,revoked_:!1,isManual_:!1}}get size(){return S(this_).size}has(c){let p=this_;return a(p),p.copy_?!!(p.copy_.has(c)||p.drafts_.has(c)&&p.copy_.has(p.drafts_.get(c))):p.base_.has(c)}add(c){let p=this_;return a(p),this.has(c)||(s(p),z(p),p.copy_.add(c)),this}delete(c){if(!this.has(c))return!1;let p=this_;return a(p),s(p),z(p),p.copy_.delete(c)||(p.drafts_.has(c)?p.copy_.delete(p.drafts_.get(c)):!1)}clear(){let c=this_;a(c),S(c).size&&(s(c),z(c),c.copy_.clear())}values(){let c=this_;return a(c),s(c),c.copy_.values()}entries(){let c=this_;return a(c),s(c),c.copy_.entries()}keys(){return this.values()}Symbol.iterator(){return this.values()}forEach(c,p){let l=this.values(),g=l.next();for(;!g.done;)c.call(p,g.value,g.value,this),g=l.next()}}function n(i,c){return new o(i,c)}function s(i){i.copy_||(i.copy_=new Set,i.base_.forEach(c=>{if(q(c)){let p=ke(c,i);i.drafts_.set(c,p),i.copy_.add(p)}else i.copy_.add(c)}))}function a(i){i.revoked_&&H(3,JSON.stringify(S(i)))}nn("MapSet",{proxyMap_:t,proxySet_:n})}var F=new pn,Ge=F.produce,_u=F.produceWithPatches.bind(F),ku=F.setAutoFreeze.bind(F),vu=F.setUseStrictShallowCopy.bind(F),wu=F.applyPatches.bind(F),Eu=F.createDraft.bind(F),Lu=F.finishDraft.bind(F);Ar();var Ur=e=>{let t=0;for(let r of e)if(!!r&&(r.exists||(t+=(r.linked?.length??0)+(r.projectLinked?.length??0),t>1)))return!1;return t<2},qr=(e,t)=>Ge(e,r=>{if(!r)return t;if(r.updated<t.updated){let{lines:o,linked:n,projectLinked:s,...a}=t;Object.assign(r,a),xt(t)||(r.lines=o),n&&(r.linked??=n),s&&(r.projectLinked??=s);return}xt(r)&&!xt(t)&&(r.lines=t.lines),t.linked&&(t.isLinkedCorrect||!r.isLinkedCorrect&&(r.linked?.length??0)<=t.linked.length)&&(r.linked=t.linked),t.projectLinked&&(r.projectLinked=t.projectLinked)}),xt=e=>e.lines0.id==="dummy";var zr=(e,t)=>{let r=new Map,o=B(t.title);for(let c of t.links){let p=dn(e,c);p.linked=o,r.set(E(e,c),p)}let n=E(e,o),s=t.projectLinks.map(c=>{let p=Oe(c);return E(p.project,p.titleLc)}),a={...We(e,t),linked:[],projectLinked:[]};r.set(n,a);let i=t.links.map(c=>B(c));for(let c of t.relatedPages.links1hop){c.linksLc.includes(o)&&a.linked.push(c.titleLc);for(let d of c.linksLc.filter(f=>i.includes(f))){let f=E(e,d),m=r.get(f);if(!m)throw Error(storage already must have "${f}");if(!m.linked){m.linked=c.titleLc;continue}m.linked.push(c.titleLc)}let p=E(e,c.titleLc),l=We(e,c),g=r.get(p)?.linked;g&&(l.linked=g),r.set(p,l)}for(let c of t.relatedPages.projectLinks1hop){let p=E(c.projectName,c.titleLc);s.includes(p)||a.projectLinked.push(p);let l=We(c.projectName,c),g=r.get(p)?.projectLinked;g&&(l.projectLinked=g),r.set(p,l)}a.isLinkedCorrect=!0;for(let c of t.relatedPages.links2hop){for(let d of c.linksLc){let f=E(e,d),m=r.get(f);if(!m)throw Error(storage already must have "${f}");if(!m.linked){m.linked=c.titleLc;continue}m.linked.push(c.titleLc)}let p=E(e,c.titleLc),l=We(e,c),g=r.get(p)?.linked;g&&(l.linked=g),r.set(p,l)}return r},We=(e,t)=>({project:e,titleLc:"titleLc"in t?t.titleLc:B(t.title),exists:"persistent"in t?t.persistent:!0,descriptions:t.descriptions,image:t.image,lines:"lines"in t?t.lines:t.title,...t.descriptions.map(r=>({text:r,id:"dummy",userId:"dummy",updated:t.updated,created:t.updated})),updated:t.updated,isLinkedCorrect:!1}),dn=(e,t)=>({project:e,titleLc:B(t),exists:!1,descriptions:[],image:null,lines:{text:t,id:"dummy",userId:"dummy",updated:0,created:0},updated:0,isLinkedCorrect:!1});var D=!1,Kr=e=>{D=typeof e=="boolean"?e:new Set(e)},W=e=>Object.fromEntries(...Object.entries(console).map((t,r)=>{if(typeof r!="function")returnt,r;switch(t){case"warn":case"error":return[t,(...o)=>r(%c${e},"color: gray",...o)];case"log":case"info":case"debug":return[t,(...o)=>{D!==!0&&(!D||!D.has(e))||r(%c${e},"color: gray",...o)}];case"assert":return[t,(o,...n)=>{D!==!0&&(!D||!D.has(e))||r(o,%c${e},"color: gray",...n)}];case"time":case"timeEnd":return[t,o=>{D!==!0&&(!D||!D.has(e))||r(${e} ${o})}];default:returnt,(...o)=>{if(!(D!==!0&&(!D||!D.has(e))))return r(...o)}}}));var Xe=W("ScrapBubble:bubble.ts"),yt=new Map,Ve=new Set,_t=Fe();function*Gr(e){for(let t of e)yield yt.get(t)}var Wr=(e,t)=>_t.on(e,t),Xr=(e,t)=>_t.off(e,t),Vr=async(e,t,r,o)=>{let n=[];for(let s of...t.reverse()){let a=E(s,e);Ve.has(a)||n.push(fn(s,e,r,o))}await Promise.all(n)},Yr=0,fn=async(e,t,r,o)=>{let n=E(e,t);if(Ve.has(n))return;Ve.add(n);let s=Yr++,a=[${s}] Check update ${n};Xe.time(a);try{let i=ne.toRequest(e,t,{followRename:!0,projects:...r});for await(letc,pof $e(i,{ignoreSearch:!0,saveFailedResponse:!0})){Xe.debug([${s}]${c} ${n});let l=await ne.fromResponse(p);if(l.ok){let g=zr(e,l.value);for(letd,fof g){let m=yt.get(d),x=qr(m,f);!x||m!==x&&(yt.set(d,x),_t.dispatch(d,f))}}if(o?.ignoreFetch===!0||c==="cache"&&!Cr(p,o?.maxAge??60))break}}catch(i){Xe.error(i)}finally{Ve.delete(n),Xe.timeEnd(a),Yr--}};var Qr=W("ScrapBubble:useBubbleData.ts"),le=e=>{lett,r=R([]);return Re(()=>{let o=()=>{r(()=>{let a=...Gr(e).flatMap(i=>i?i:[]);return Qr.debug(Required: ${e.length} pages, ${a.length} found,a),a})};o();let n,s=()=>{clearTimeout(n),n=setTimeout(()=>{Qr.debug(Update ${e.length} pages),o()},10)};return e.forEach(a=>Wr(a,s)),()=>e.forEach(a=>Xr(a,s))},e),t};var pe=e=>{let{top:t,right:r,left:o,bottom:n}=e.getBoundingClientRect(),s=document.body.getBoundingClientRect(),a=(o-s.left)/s.width>.5;return{top:Math.round(n-s.top),bottom:Math.round(globalThis.innerHeight-globalThis.scrollY-t),...a?{right:Math.round(s.right-r)}:{left:Math.round(o-s.left)},maxWidth:a?r-10:document.documentElement.clientWidth-o-10}};var mn=e=>({type:"title",text:e.rows0.text}),gn=e=>{let{rows:t,...r}=e,{indent:o=0,text:n=""}=t??{},s=n.replace(/^\s*code:/,"");return{indent:o,type:"codeBlock",fileName:s,content:r.map(a=>a.text.substring(o+1)).join(` )}},C=(e,{parseOnNested:t,parseOnQuoted:r,patterns:o})=>(n,s,a)=>{var i,c,p,l,g,d;if(!t&&s.nested)return(i=a?.())!==null&&i!==void 0?i:[];if(!r&&s.quoted)return(c=a?.())!==null&&c!==void 0?c:[];for(let f of o){let m=f.exec(n);if(m===null)continue;let x=n.substring(0,m.index),b=n.substring(m.index+((l=(p=m[0])===null||p===void 0?void 0:p.length)!==null&&l!==void 0?l:0)),y=e((g=m[0])!==null&&g!==void 0?g:"",s);return[...X(x,s),...y,...X(b,s)]}return(d=a?.())!==null&&d!==void 0?d:[]},I=e=>[{type:"plain",raw:e,text:e}],hn=C(I,{parseOnNested:!0,parseOnQuoted:!0,patterns:[/^()(.*)()$/]}),bn=/^>.*$/,xn=(e,t)=>t.context==="table"?I(e,t):[{type:"quote",raw:e,nodes:X(e.substring(1),{...t,quoted:!0})}],yn=C(xn,{parseOnNested:!1,parseOnQuoted:!1,patterns:[bn]}),_n=/^\? .+$/,kn=(e,t)=>t.context==="table"?I(e,t):[{type:"helpfeel",raw:e,text:e.substring(2)}],vn=C(kn,{parseOnNested:!1,parseOnQuoted:!1,patterns:[_n]}),wn=/\[\[https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)\]\]/i,En=/\[\[https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}\]\]/,Ln=(e,t)=>{if(t.context==="table")return I(e,t);let r=e.substring(2,e.length-2),o=/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}$/.test(r);return[{type:"strongImage",raw:e,src:o?${r}/thumb/1000:r}]},Tn=C(Ln,{parseOnNested:!1,parseOnQuoted:!0,patterns:[wn,En]}),Nn=/\[[^[\]]*\.icon(?:\*[1-9]\d*)?\]/;function Jr(e){return(t,r)=>{if(e==="strongIcon"&&r.context==="table")return I(t,r);let o=e==="icon"?t.substring(1,t.length-1):t.substring(2,t.length-2),n=o.lastIndexOf(".icon"),s=o.substring(0,n),a=s.startsWith("/")?"root":"relative",i=o.substring(n+5,o.length),c=i.startsWith("*")?parseInt(i.substring(1),10):1;return new Array(c).fill({}).map(()=>({path:s,pathType:a,type:e,raw:t}))}}var Pn=Jr("icon"),Sn=C(Pn,{parseOnNested:!0,parseOnQuoted:!0,patterns:[Nn]}),Cn=/\[\[[^[\]]*\.icon(?:\*\d+)?\]\]/,In=Jr("strongIcon"),Rn=C(In,{parseOnNested:!1,parseOnQuoted:!0,patterns:[Cn]}),Mn=/\[\[(?:[^[]|\[[^[]).*?\]*\]\]/,jn=(e,t)=>t.context==="table"?I(e,t):[{type:"strong",raw:e,nodes:X(e.substring(2,e.length-2),{...t,nested:!0})}],Bn=C(jn,{parseOnNested:!1,parseOnQuoted:!0,patterns:[Mn]}),On=/\[\$ .+? \]/,$n=/\[\$ [^\]]+\]/,Fn=(e,t)=>t.context==="table"?I(e,t):[{type:"formula",raw:e,formula:e.substring(3,e.length-(e.endsWith(" ]")?2:1))}],Dn=C(Fn,{parseOnNested:!1,parseOnQuoted:!0,patterns:[On,$n]}),Hn=/\[[!"#%&'()*+,\-./{|}<>_~]+ (?:\[[^[\]]+\]|[^\]])+\]/,An=(e,t)=>{if(t.context==="table")return I(e,t);let r=e.indexOf(" "),o=e.substring(1,r),n=e.substring(r+1,e.length-1),s=new Set(o);if(s.has("*")){let a=o.split("*").length-1;s.delete("*"),s.add(*-${Math.min(a,10)})}return[{type:"decoration",raw:e,rawDecos:o,decos:Array.from(s),nodes:X(n,{...t,nested:!0})}]},Un=C(An,{parseOnNested:!1,parseOnQuoted:!0,patterns:[Hn]}),qn=/.*?/,zn=(e,t)=>t.context==="table"?I(e,t):[{type:"code",raw:e,text:e.substring(1,e.length-1)}],Kn=C(zn,{parseOnNested:!1,parseOnQuoted:!0,patterns:[qn]}),Gn=/^[$%] .+$/,Wn=(e,t)=>{var r;if(t.context==="table")return I(e,t);let o=(r=e[0])!==null&&r!==void 0?r:"",n=e.substring(2);return[{type:"commandLine",raw:e,symbol:o,text:n}]},Xn=C(Wn,{parseOnNested:!1,parseOnQuoted:!1,patterns:[Gn]}),Vn=/\[\s+\]/,Yn=(e,t)=>t.context==="table"?I(e,t):[{type:"blank",raw:e,text:e.substring(1,e.length-1)}],Qn=C(Yn,{parseOnNested:!1,parseOnQuoted:!0,patterns:[Vn]}),Jn=/\[https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)(?:\?[^\]\s]+)?(?:\s+https?:\/\/[^\s\]]+)?\]/i,Zn=/\[https?:\/\/[^\s\]]+\s+https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)(?:\?[^\]\s]+)?\]/i,es=/\[https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}(?:\/raw)?(?:\s+https?:\/\/[^\s\]]+)?\]/,ts=/\[https?:\/\/[^\s\]]+\s+https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}(?:\/raw)?\]/,rs=e=>/^https?:\/\/[^\s\]]+\.(png|jpe?g|gif|svg)(\?[^\]\s]+)?$/i.test(e)||os(e),os=e=>/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}(\/raw)?$/.test(e),ns=(e,t)=>{if(t.context==="table")return I(e,t);let r=e.search(/\s/),o=r!==-1?e.substring(1,r):e.substring(1,e.length-1),n=r!==-1?e.substring(r,e.length-1).trimLeft():"",[s,a]=rs(n)?[n,o]:[o,n];return[{type:"image",raw:e,src:/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}$/.test(s)?${s}/thumb/1000:s,link:a}]},ss=C(ns,{parseOnNested:!0,parseOnQuoted:!0,patterns:[Jn,Zn,es,ts]}),is=/\[https?:\/\/[^\s\]]+\s+[^\]]*[^\s]\]/,as=/\[[^[\]]*[^\s]\s+https?:\/\/[^\s\]]+\]/,cs=/\[https?:\/\/[^\s\]]+\]/,ls=/https?:\/\/[^\s]+/,ps=(e,t)=>{if(t.context==="table")return I(e,t);let r=e.startsWith("[")&&e.endsWith("]")?e.substring(1,e.length-1):e,o=/^https?:\/\/[^\s\]]/.test(r),n=(o?/^https?:\/\/[^\s\]]+/:/https?:\/\/[^\s\]]+$/).exec(r);if(n?.[0]===void 0)return[];let s=o?r.substring(n[0].length):r.substring(0,n.index-1);return[{type:"link",raw:e,pathType:"absolute",href:n[0],content:s.trim()}]},us=C(ps,{parseOnNested:!0,parseOnQuoted:!0,patterns:[is,as,cs,ls]}),Zr=/\[([^\]]*[^\s])\s+([NS]\d+(?:\.\d+)?,[EW]\d+(?:\.\d+)?(?:,Z\d+)?)\]/,eo=/\[([NS]\d+(?:\.\d+)?,[EW]\d+(?:\.\d+)?(?:,Z\d+)?)(?:\s+([^\]]*[^\s]))?\]/,ds=e=>{let[t="",r="",o=""]=e.split(","),n=parseFloat(t.replace(/^N/,"").replace(/^S/,"-")),s=parseFloat(r.replace(/^E/,"").replace(/^W/,"-")),a=/^Z\d+$/.test(o)?parseInt(o.replace(/^Z/,""),10):14;return{latitude:n,longitude:s,zoom:a}},fs=(e,t)=>{var r;if(t.context==="table")return I(e,t);let o=(r=e.match(Zr))!==null&&r!==void 0?r:e.match(eo);if(o===null)return[];let n=e.startsWith("[N")||e.startsWith("[S"),[,s="",a=""]=n?o:[o[0],o[2],o[1]],{latitude:i,longitude:c,zoom:p}=ds(s),l=a!==""?https://www.google.com/maps/place/${encodeURIComponent(a)}/@${i},${c},${p}z:https://www.google.com/maps/@${i},${c},${p}z;return[{type:"googleMap",raw:e,latitude:i,longitude:c,zoom:p,place:a,url:l}]},ms=C(fs,{parseOnNested:!1,parseOnQuoted:!0,patterns:[Zr,eo]}),gs=/\[\/?[^[\]]+\]/,hs=e=>{let t=e.substring(1,e.length-1);return[{type:"link",raw:e,pathType:t.startsWith("/")?"root":"relative",href:t,content:""}]},bs=C(hs,{parseOnNested:!0,parseOnQuoted:!0,patterns:[gs]}),xs=/(?:^|\s)#\S+/,ys=(e,t)=>{if(t.context==="table")return I(e,t);if(e.startsWith("#"))return[{type:"hashTag",raw:e,href:e.substring(1)}];let r=e.substring(0,1),o=e.substring(1);return[...I(r,t),{type:"hashTag",raw:o,href:o.substring(1)}]},_s=C(ys,{parseOnNested:!0,parseOnQuoted:!0,patterns:[xs]}),ks=/^[0-9]+\. .*$/,vs=(e,t)=>{if(t.context==="table")return I(e,t);let r=e.indexOf(" "),o=e.substring(0,r-1),n=parseInt(o,10),s=e.substring(r+1,e.length);return[{type:"numberList",raw:e,rawNumber:o,number:n,nodes:X(s,{...t,nested:!0})}]},ws=C(vs,{parseOnNested:!1,parseOnQuoted:!1,patterns:[ks]}),Es=(e,t,r)=>{var o;return e===""?[]:(o=r?.())!==null&&o!==void 0?o:[]},Ls=(...e)=>(t,r)=>e.reduceRight((o,n)=>()=>n(t,r,o),()=>hn(t,r))(),X=Ls(Es,yn,vn,Kn,Xn,Dn,Qn,Un,Tn,Rn,Bn,ss,us,Sn,ms,bs,_s,ws),Ts=e=>{let{rows:[t,...r]}=e,{indent:o=0,text:n=""}=t??{},s=n.replace(/^\s*table:/,"");return{indent:o,type:"table",fileName:s,cells:r.map(a=>a.text.substring(o+1)).map(a=>a.split(" ").map(i=>X(i,{nested:!1,quoted:!1,context:"table"})))}},Ns=e=>{let{indent:t,text:r}=e.rows[0];return{indent:t,type:"line",nodes:X(r.substring(t),{nested:!1,quoted:!1,context:"line"})}},Ps=e=>{switch(e.type){case"title":return mn(e);case"codeBlock":return gn(e);case"table":return Ts(e);case"line":return Ns(e)}},Ss=e=>e.split( ).map(t=>{var r,o,n;return{indent:(n=(o=(r=/^\s+/.exec(t))===null||r===void 0?void 0:r[0])===null||o===void 0?void 0:o.length)!==null&&n!==void 0?n:0,text:t}}),Cs=(e,t)=>{var r,o;return(e.type==="codeBlock"||e.type==="table")&&t.indent>((o=(r=e.rows[0])===null||r===void 0?void 0:r.indent)!==null&&o!==void 0?o:0)},to=(e,t)=>{let r=e[e.length-1];return r!==void 0&&Cs(r,t)?(r.rows.push(t),e):(e.push({type:/^\s*code:/.test(t.text)?"codeBlock":/^\s*table:/.test(t.text)?"table":"line",rows:[t]}),e)},Is=(e,t)=>{var r;if(!((r=t.hasTitle)!==null&&r!==void 0)||r){let[o,...n]=e;return o===void 0?[]:[{type:"title",rows:[o]},...n.reduce(to,[])]}return e.reduce(to,[])},ve=(e,t)=>{var r;let o=Ss(e);return Is(o,{hasTitle:(r=t?.hasTitle)!==null&&r!==void 0?r:!0}).map(Ps)};var V=tt({title:"",project:"",whiteList:new Set,bubble:()=>{},hide:()=>{},delay:0,prefetch:()=>{}}),ro=({lines:e,project:t,title:r,whiteList:o,noIndent:n,hash:s,linkTo:a,...i})=>{let c=k(()=>e.flatMap(d=>typeof d=="string"?[]:[d.id]),[e]),p=k(()=>{let d=0;return ve(e.map(f=>typeof f=="string"?f:f.text).join(
),{hasTitle:!0}).map(f=>{switch(f.type){case"title":case"line":return{...f,id:c[d++]};case"codeBlock":{let m=d;return d+=f.content.split(
).length+1,{...f,ids:c.slice(m,d)}}case"table":{let m=d;return d+=f.cells.length+1,{...f,ids:c.slice(m,d)}}}})},[e,c]),l=k(()=>{if(s&&c.includes(s))return s;if(!!a)return p.find(d=>d.type!=="line"?!1:it(a,d.nodes))?.id},[p,c,s,a?.project,a?.titleLc]),g=re(null);return $(()=>{if(!l)return;let d=g.current?.querySelector(data-id="${l}"),f=globalThis.scrollY;d?.scrollIntoView?.({block:"center"}),globalThis.scroll(0,f)},[l]),u("div",{className:"lines",ref:g},u(V.Provider,{value:{project:t,title:r,whiteList:o,...i}},p.map(d=>{switch(d.type){case"title":return u(w,null,u(ue,{key:d.id,index:d.id,indent:0,noIndent:n,permalink:d.id===l},d.text),u("hr",null));case"codeBlock":return u(Rs,{key:d.ids[0],block:d,noIndent:n,ids:d.ids,scrollId:l});case"table":return u(Ms,{key:d.ids[0],block:d,noIndent:n,ids:d.ids,scrollId:l});case"line":return u(ue,{key:d.id,index:d.id,indent:d.indent,noIndent:n,permalink:d.id===l},d.nodes.length>0?d.nodes.map(f=>u(de,{node:f})):u("br",null))}})))},ue=({index:e,indent:t,noIndent:r,children:o,permalink:n})=>u("div",{className:line${n?" permalink":""},"data-id":e,"data-indent":t,style:{"margin-left":r?"":${1*t}em}},o),Rs=({block:{fileName:e,content:t,indent:r},ids:o,scrollId:n})=>{let{project:s,title:a}=G(V),[i,c]=R(""),p=O(async l=>{l.preventDefault(),l.stopPropagation();try{await navigator.clipboard.writeText(t),c("Copied"),await J(1e3),c("")}catch(g){alert(Failed to copy the code block Error:${g.message})}},[t]);return u(w,null,u(ue,{index:o[0],indent:r,permalink:o[0]===n},u("span",{className:"code-block"},u("span",{className:"code-block-start"},u("a",{href:/api/code/${s}/${P(a)}/${e},target:"_blank"},e)),u("span",{className:"copy",title:"Copy",onClick:p},i))),u(w,null,t.split(
).map((l,g)=>u(ue,{index:o[g+1],indent:r,permalink:o[g+1]===n},u("code",{className:"code-block"},l)))))},Ms=({block:{fileName:e,cells:t,indent:r},ids:o,scrollId:n})=>{let{project:s,title:a}=G(V);return u(w,null,u(ue,{index:o[0],indent:r,permalink:o[0]===n},u("span",{className:"table-block"},u("span",{className:"table-block-start"},u("a",{href:/api/table/${s}/${P(a)}/${e}.csv,target:"_blank"},e)))),u(w,null,t.map((i,c)=>u(ue,{index:o[c+1],indent:r,permalink:o[c+1]===n},u("span",{className:"table-block table-block-row"},i.map((p,l)=>u("span",{className:cell col-${l}},p.map(g=>u(de,{node:g})))))))))},de=({node:e})=>{switch(e.type){case"code":return u("code",{className:"code"},e.text);case"formula":return u(js,{node:e});case"commandLine":return u(Os,{node:e});case"helpfeel":return u("code",{className:"helpfeel"},u("span",{className:"prefix"},"?")," ",u("span",{className:"entry"},e.text));case"quote":return u("blockquote",{className:"quote"},e.nodes.map(t=>u(de,{node:t})));case"strong":return u("strong",null,e.nodes.map(t=>u(de,{node:t})));case"decoration":return u(Bs,{node:e});case"plain":case"blank":return u(w,null,e.text);case"hashTag":return u(Ds,{node:e});case"link":return u(Hs,{node:e});case"googleMap":return u($s,{node:e});case"icon":return u(oo,{node:e});case"strongIcon":return u(oo,{node:e,strong:!0});case"image":return u(Fs,{node:e});case"strongImage":return u("img",{className:"image strong-image",src:e.src});case"numberList":return u(w,null,${e.number}. ,e.nodes.map(t=>u(de,{node:t})))}},js=({node:{formula:e}})=>{let{ref:t,error:r,setFormula:o}=be("");return o(e),u("span",{className:formula ${r?" error":""}},r?u("code",null,e):u("span",{className:"katex-display",ref:t}))},Bs=({node:{decos:e,nodes:t}})=>u("span",{className:e.map(r=>deco-${r}).join(" ")},t.map(r=>u(de,{node:r}))),Os=({node:e})=>{let[t,r]=R(""),o=O(async n=>{n.preventDefault(),n.stopPropagation();try{await navigator.clipboard.writeText(e.text),r("Copied"),await J(1e3),r("")}catch(s){alert(Failed to copy the code block
Error:${s.message})}},[e.text]);return u(w,null,u("code",{className:"cli"},u("span",{className:"prefix"},e.symbol)," ",u("span",{className:"command"},e.text)),u("span",{className:"tool-buttons"},u("span",{title:"Copy",className:"copy",onClick:o},t)))},$s=({node:{place:e,latitude:t,longitude:r,zoom:o}})=>u("span",{className:"pointing-device-map"},u("a",{href:https://www.google.com/maps/search/${e}/@${t},${r},${o}z,rel:"noopner noreferrer",target:"_blank"},u("img",{className:"google-map",src:/api/google-map/static-map?center=${t}%2C${r}&markers=${e}&zoom=${o}&_csrf=${globalThis._csrf}}))),oo=({node:{pathType:e,path:t},strong:r})=>{let{project:o}=G(V),[n,s]=e==="relative"?[o,t]:t.match(/\/([\w\-]+)\/(.+)$/)?.slice?.(1)??[o,t],a=P(s);return u("a",{href:/${n}/${a},rel:n===scrapbox.Project.name?"route":"noopener noreferrer",target:n===scrapbox.Project.name?"":"_blank"},u("img",{className:r?"icon strong-icon":"icon",alt:s,src:/api/pages/${n}/${a}/icon},s))},Fs=({node:{link:e,src:t}})=>{let r=e||(/https:\/\/gyazo\.com\/[^\/]+\/thumb\/1000/.test(t)?t.slice(0,-"/thumb/1000".length):t);return u("a",{className:e?"link":"",href:r,rel:"noopner noreferrer",target:"_blank"},u("img",{className:"image",src:t}))},Ds=({node:{href:e}})=>{let{project:t}=G(V),r=no(t,e),o=so(t,e,"hashtag");return u("a",{href:/${t}/${P(e)},className:page-link${r?" empty-page-link":""},type:"hashTag",rel:t===scrapbox.Project.name?"route":"noopener noreferrer",target:t===scrapbox.Project.name?"":"_blank",onPointerEnter:o},"#",e)},Hs=({node:{pathType:e,...t}})=>{switch(e){case"relative":case"root":return u(As,{pathType:e,href:t.href});case"absolute":{let r=xr({pathType:e,...t});switch(r.type){case"youtube":return u(Us,{...r});case"vimeo":return u(qs,{...r});case"spotify":return u(zs,{...r});case"anchor-fm":return u(Ks,{...r});case"audio":return u(Gs,{...r});case"video":return u(Xs,{...r});case"absoluteLink":return u("a",{className:"link",href:r.href,rel:"noopener noreferrer",target:"_blank"},r.content||r.href)}}}},As=({pathType:e,href:t})=>{let{project:r}=G(V),{project:o=r,title:n,hash:s=""}=se({pathType:e,href:t}),a=so(o,n,"link",s),i=no(o,n??"");return u("a",{className:page-link${n!==void 0&&i?" empty-page-link":""},type:"link",href:/${o}${n===void 0?"":/${P(n)}${s===""?"":#${s}}},rel:o===scrapbox.Project.name?"route":"noopener noreferrer",target:o===scrapbox.Project.name?"":"_blank",onPointerEnter:a},t)},Us=e=>{e.params.append("autoplay","0");let t=e.pathType==="list"?https://www.youtube.com/embed/?${e.params.toString()}&list=${e.listId}:https://www.youtube.com/embed/${e.videoId}?${e.params.toString()};return u("div",{className:"iframe-video-player"},u("iframe",{src:t,allowFullScreen:!0,type:"text/html"}))},qs=({videoId:e})=>u("div",{className:"iframe-video-player"},u("iframe",{src:https://player.vimeo.com/video/${e},allowFullScreen:!0,type:"text/html"})),zs=e=>u("div",{className:"iframe-video-player"},u("iframe",{className:spotify type-${e.pathType},src:https://open.spotify.com/embed/${e.pathType}/${e.videoId},allowFullScreen:!0,type:"text/html",scrolling:"no"})),Ks=e=>u("div",{className:"iframe-video-player"},u("iframe",{className:"anchor-fm",src:e.href.replace("/episodes/","/embed/episodes/"),allowFullScreen:!0,type:"text/html",scrolling:"no"})),Gs=e=>e.content===""?u("audio",{className:"audio-player",preload:"none",controls:!0,src:e.href}):u(Ws,{...e}),Ws=({href:e,content:t})=>{let r=re(null),o=O(()=>{r.current?.paused?(r.current.currentTime=0,r.current.play()):r.current?.pause?.()},[]);return u("span",{className:"audio-link"},u("a",{href:e,rel:"noopener noreferrer",target:"_blank"},t),u("span",{className:"play",onClick:o},"♬"),u("audio",{preload:"none",src:e,ref:r}))},Xs=({href:e})=>u("div",{className:"video-player"},u("video",{class:"video",style:{display:"inline-block"},controls:!0,loop:!0,src:e})),no=(e,t)=>{let{whiteList:r}=G(V),o=k(()=>(r.has(e)?[...r]:[e,...r]).map(s=>E(s,t)),[r,e]),n=le(o);return k(()=>Ur(n),n)},so=(e,t,r,o)=>{let{delay:n,bubble:s,prefetch:a}=G(V);return O(async({currentTarget:i})=>{!t||(a(e,t),!!await ie(i,n)&&s({project:e,title:t,hash:o,type:r,position:pe(i)}))},[e,t,o,r,n,a,s])};var kt=Fe(),Ye=new Map,Vs=W("ScrapBubble:useProject.ts"),io=e=>{let[t,r]=R();return $(()=>{kt.on(e,r);let o=Ye.get(e);return o?r(o.loading?void 0:o.value):(Ye.set(e,{loading:!0}),r(void 0),(async()=>{try{let n=he.toRequest(e);for await(let[,s]of $e(n)){let a=await he.fromResponse(s);Ye.set(e,{loading:!1,value:a}),kt.dispatch(e,a);break}}catch(n){Vs.error(n),Ye.delete(e)}})()),()=>kt.off(e,r)},[e]),t};var Ys=["default-light","default-dark","default-minimal"],Qs=["paper-light","paper-dark-dark","paper-dark"],ao=["blue","purple","green","orange","red"],Js=["hacker1","hacker2"],co=["winter","spring","summer","automn"],lo=["tropical"],po=["kyoto","newyork","paris"],uo=["mred","lgreen"],jd=["default-light","default-minimal","paper-light",...ao,...co,...lo,...po,...uo];var Zs=[...Ys,...Qs,...ao,...Js,...co,...lo,...po,...uo];function fo(e){return Zs.includes(e)}var mo="default-light",Qe=e=>{let t=io(e);return k(()=>{if(!t||!t.ok)return mo;let r=t.value.theme;return fo(r)?r:mo},[t])};var go=({project:e,title:t,descriptions:r,thumbnail:o,linkTo:n,bubble:s,delay:a,prefetch:i})=>{let c=k(()=>o?[]:ve(r.join( ),{hasTitle:!1}),[o,r]),p=Qe(e),l=O(async({currentTarget:d})=>{i(e,t),!!await ie(d,a)&&s({project:e,title:t,linkTo:n,type:"link",position:pe(d)})},[e,t,a,n?.project,n?.titleLc]),g=k(()=>n?()=>{ct({type:"page",from:{project:n.project??e,title:n.titleLc},to:{project:e,title:t}})}:()=>{},[e,t,n?.project,n?.titleLc]);return u("a",{className:"related-page-card page-link",type:"link","data-theme":p,href:/${e}/${P(t)},rel:e===scrapbox.Project.name?"route":"noopner noreferrer",target:e!==scrapbox.Project.name?"_blank":"",onPointerEnter:l,onClick:g},u("div",{class:"hover"}),u("div",{class:"content"},u("div",{class:"header"},u("div",{class:"title"},t)),o?u("div",{class:"thumbnail"},u("img",{src:o})):u("div",{class:"description"},c.flatMap((d,f)=>d.type==="line"?[u("p",{key:f},d.nodes.map(m=>u(ho,{node:m,project:e})))]:[]))))},ho=({node:e,project:t})=>{switch(e.type){case"code":return u("code",null,e.text);case"formula":return u(ei,{node:e});case"commandLine":return u("code",null,e.symbol," $",e.text);case"helpfeel":return u("code",null,"? ",e.text);case"quote":case"strong":case"decoration":return u(w,null,e.nodes.map(r=>u(ho,{node:r,project:t})));case"icon":case"strongIcon":return u(ti,{node:e,project:t});case"hashTag":return u(ri,{node:e});case"link":return u(oi,{node:e});case"plain":case"blank":return u(w,null,e.text);default:return u(w,null)}},ei=({node:{formula:e}})=>{let{ref:t,error:r,setFormula:o}=be("");return o(e),u("span",{className:formula ${r?" error":""}},r?u("code",null,e):u("span",{className:"katex-display",ref:t}))},ti=({node:{pathType:e,path:t},project:r})=>{let[o,n]=e==="relative"?[r,t]:t.match(/\/([\w\-]+)\/(.+)$/)?.slice?.(1)??[r,t];return u("img",{class:"icon",src:/api/pages/${o}/${P(n)}/icon})},ri=({node:{href:e}})=>u("span",{class:"page-link"},"#",e),oi=({node:{pathType:e,href:t,content:r}})=>e!=="absolute"?u("span",{class:"page-link"},t):u("span",{class:"link"},r||t);var bo=({source:e,linked:t,externalLinked:r,projectsForSort:o,...n})=>{let s=k(()=>[...t.keys(),...r.keys()],[t,r]),a=le(s),i=k(()=>[...o],[o]),c=k(()=>{let l=(g,d)=>{let f=i.indexOf(g.project),m=i.indexOf(d.project);return f===m?d.updated-g.updated:f<0?1:m<0?-1:f-m};return[...a].sort(l)},[a,i]),p=k(()=>({bottom:${e.position.bottom}px,maxWidth:${e.position.maxWidth}px,..."left"in e.position?{left:${e.position.left}px}:{right:${e.position.right}px}}),[e.position]);return u("ul",{className:"card-bubble",style:p,onClick:n.onClick},c.map(({project:l,titleLc:g,lines:[{text:d}],descriptions:f,image:m})=>{let x=E(l,g),b=t.get(x)??r.get(x);return u("li",{key:x},u(go,{project:l,title:d,linkTo:b,descriptions:f,thumbnail:m??"",...n}))}))};var xo=W("ScrapBubble:Bubble.tsx"),yo=({source:e,parentTitles:t,whiteList:r,...o})=>{let n=k(()=>r.has(e.project)?new Set([e.project,...r]):new Set([e.project]),[r,e.project]),[s,a,i]=ni(e,n,r,t),c=O(()=>o.hide(),[o.hide]),p=Qe(i[0]?.project??e.project),l=k(()=>({top:${e.position.top}px,maxWidth:${e.position.maxWidth}px,..."left"in e.position?{left:${e.position.left}px}:{right:${e.position.right}px}}),[e.position]);return u(w,null,i.length>0&&u("div",{className:"text-bubble",style:l,"data-theme":p,onClick:c},u(si,null,i[0].project!==scrapbox.Project.name&&u(ii,{project:i[0].project,title:i[0].lines[0].text})),u(ro,{lines:i[0].lines,project:i[0].project,title:i[0].lines[0].text,hash:e.hash,linkTo:e.linkTo,whiteList:r,...o})),u(bo,{linked:s,externalLinked:a,onClick:c,source:e,projectsForSort:n,...o}))},ni=(e,t,r,o)=>{let[[n,s,a],i]=R([new Map,new Map,[]]),c=k(()=>{let g=[...t].map(d=>E(d,e.title));return xo.debug("projects",g),g},[t,e.title]),p=le(c),l=k(()=>o.map(g=>B(g)),[o]);return Re(()=>{let g=new Map,d=new Map,f=[];for(let m of p){let x={project:m.project,titleLc:m.titleLc};for(let y of m.projectLinked??[]){let{project:L,titleLc:A}=Oe(y);l.includes(A)&&r.has(L)||d.has(y)||d.set(y,x)}if(!r.has(m.project))continue;let b={titleLc:m.titleLc};for(let y of m.linked??[]){if(l.includes(y))continue;let L=E(m.project,y);g.has(L)||g.set(L,b)}l.includes(m.titleLc)||!m.exists||f.push(m)}i(Ge(m=>{xo.debug(depth: ${l.length}, bubbled from ${E(e.project,e.title)}, bubbles,,p,"before",m[0],"internal cards,",g,"external cards",d);for(let x of m[0].keys())g.has(x)||m[0].delete(x);for(let[x,b]of g)m[0].set(x,b);for(let x of m[1].keys())d.has(x)||m[1].delete(x);for(let[x,b]of d)m[1].set(x,b);m[2]=f}))},[p,r,l]),[n,s,a]},si=({children:e})=>u("div",{className:"status-bar top-right"},e),ii=({project:e,title:t})=>u("a",{href:/${e}/${P(t)},target:"_blank",rel:"noopener noreferrer"},e);var _o=(e,t)=>{if(e instanceof URL)return e;try{return new URL(e)}catch(r){if(!(r instanceof TypeError))throw r;if(!t||!/^\.\/|^\.\.\/|^\//.test(e))return e;try{return new URL(e,t)}catch(o){if(!(o instanceof TypeError))throw o;return e}}};var ko=e=>{let t=k(()=>_o(e.style,import.meta.url),[e.style]);return u(w,null,t!==""&&(t instanceof URL?u("link",{rel:"stylesheet",href:t.href}):u("style",null,t)))};var vo=String.raw*{box-sizing:border-box}a{background-color:transparent;text-decoration:none;cursor:pointer}img{display:inline-block;max-width:100%;max-height:100px}code{font-family:var(--code-text-font, Menlo, Monaco, Consolas, "Courier New", monospace);font-size:90%;color:var(--code-color, #342d9c);background-color:var(--code-bg, rgba(0,0,0,.04));padding:0;white-space:pre-wrap;word-wrap:break-word}blockquote{background-color:var(--quote-bg-color, rgba(0,0,0,.05));display:block;border-left:solid 4px #a0a0a0;padding-left:4px;margin:0}strong{font-weight:700}iframe{display:inline-block;margin:3px 0;vertical-align:middle;max-width:100%;width:640px;height:360px;border:0}audio{display:inline-block;vertical-align:middle;white-space:initial;max-width:100%}.formula{margin:auto 6px}.formula.error code{color:#fd7373}.katex-display{display:inline-block!important;margin:0!important;text-align:inherit!important}.error .katex-display{display:none}.cli{border-radius:4px}.cli .prefix{color:#9c6248}.helpfeel{background-color:#fbebdd;border-radius:4px;padding:3px!important}.helpfeel .prefix{color:#f17c00}.helpfeel .entry{color:#cc5020}.code-block{display:block;line-height:1.7em;background-color:var(--code-bg, rgba(0,0,0,.04))}.code-block-start{font-family:Menlo,Monaco,Consolas,Courier New,monospace;color:#342d9c;background-color:#ffcfc6;font-size:.9em;padding:1px 2px}.code-block-start a{color:#342d9c;text-decoration:underline}code.code-block,.table-block.table-block-row{padding-left:1em}.copy{font-family:"Font Awesome 5 Free";cursor:pointer}.table-block{white-space:nowrap}.table-block-start{padding:1px 2px;font-size:.9em;background-color:#ffcfc6}.table-block-start a{color:#342d9c;text-decoration:underline}.cell{margin:0;padding:0 2px 0 8px;box-sizing:content-box;display:inline-block;white-space:pre}.cell:nth-child(2n+1){background-color:#0000000a}.cell:nth-child(2n){background-color:#0000000f}.strong-image{max-height:100%}.icon{height:11px;vertical-align:middle}.strong-icon{height:13.2px}.tool-button{margin-left:1em;cursor:pointer;font-size:.9em}.deco-\/{font-style:italic}.deco-\*-1{font-weight:700}.deco-\*-2{font-weight:700;font-size:1.2em}.deco-\*-3{font-weight:700;font-size:1.44em}.deco-\*-4{font-weight:700;font-size:1.73em}.deco-\*-5{font-weight:700;font-size:2.07em}.deco-\*-6{font-weight:700;font-size:2.49em}.deco-\*-7{font-weight:700;font-size:3em}.deco-\*-8{font-weight:700;font-size:3.58em}.deco-\*-9{font-weight:700;font-size:4.3em}.deco-\*-10{font-weight:700;font-size:5.16em}.deco--{text-decoration:line-through}.deco-_{text-decoration:underline}.page-link{color:var(--page-link-color, #5e8af7)}a.page-link:hover{color:var(--page-link-hover-color, #2d67f5)}.empty-page-link{color:var(--empty-page-link-color, #fd7373)}a.empty-page-link:hover{color:var(--empty-page-link-hover-color, #fd7373)}.link{color:var(--page-link-color, #5e8af7);text-decoration:underline}a.link:hover{color:var(--page-link-color-hover-color, #2d67f5)}.link img{padding-bottom:3px;border-style:none none solid;border-width:1.5px;border-color:#8fadf9}.permalink{background-color:var(--line-permalink-color, rgba(234,218,74,.75))}.status-bar{display:inline-block;position:absolute;background-color:var(--page-bg, #fefefe);cursor:default}.status-bar>*{border:1px solid var(--status-bar-border-color, #a9aaaf)}.status-bar.top-left{top:0;left:0}.status-bar.top-left>*{border-top:none;border-left:none}.status-bar.top-left :last-of-type{border-bottom-right-radius:3px}.status-bar.top-right{top:0;right:0}.status-bar.top-right>*{border-top:none;border-right:none}.status-bar.top-right :last-of-type{border-bottom-left-radius:3px}.status-bar.bottom-right{bottom:0;right:0}.status-bar.bottom-right>*{border-bottom:none;border-right:none}.status-bar.bottom-right :last-of-type{border-top-left-radius:3px}.status-bar.bottom-left{bottom:0;left:0}.status-bar.bottom-left>*{border-bottom:none;border-left:none}.status-bar.bottom-left :last-of-type{border-top-right-radius:3px}.text-bubble{padding:5px 0 5px 5px;font-size:11px;line-height:1.42857;user-select:text;position:absolute;max-height:80vh;overflow-y:auto;background-color:var(--page-bg, #fefefe);color:var(--page-text-color, #4a4a4a);border-radius:4px;--text-bubble-border-color: hsl(221, 15%, 25%);border:1px solid var(--text-bubble-border-color, #f2f2f3);--status-bar-border-color: var(--text-bubble-border-color, #f2f2f3);box-shadow:0 6px 12px #0000002d;z-index:9000}.text-bubble.no-scroll{overflow-y:hidden}.text-bubbledata-theme=default-dark{--text-bubble-border-color: hsl(0, 0%, 39%)}.text-bubbledata-theme=default-minimal{--text-bubble-border-color: hsl(0, 0%, 89%)}.text-bubbledata-theme=paper-light{--text-bubble-border-color: hsl(53, 8%, 58%)}.text-bubbledata-theme=paper-dark-dark{--text-bubble-border-color: hsl(203, 42%, 17%)}.text-bubbledata-theme=blue{--text-bubble-border-color: hsl(227, 68%, 62%)}.text-bubbledata-theme=purple{--text-bubble-border-color: hsl(267, 39%, 60%)}.text-bubbledata-theme=green{--text-bubble-border-color: hsl(136, 29%, 50%)}.text-bubbledata-theme=orange{--text-bubble-border-color: hsl(43, 71%, 51%)}.text-bubbledata-theme=red{--text-bubble-border-color: hsl(4, 58%, 56%)}.text-bubbledata-theme=spring{--text-bubble-border-color: hsl(72, 64%, 57%)}.text-bubbledata-theme=kyoto{--text-bubble-border-color: hsl(331, 21%, 26%)}.text-bubbledata-theme=newyork{--text-bubble-border-color: hsl(176, 29%, 67%)}.project-badge{text-decoration:none;color:var(--tool-text-color, #363c49)}.related-page-carddata-theme=default-dark{--card-title-bg: hsl(0, 0%, 39%)}.related-page-carddata-theme=default-minimal{--card-title-bg: hsl(0, 0%, 89%)}.related-page-carddata-theme=paper-light{--card-title-bg: hsl(53, 8%, 58%)}.related-page-carddata-theme=paper-dark-dark{--card-title-bg: hsl(203, 42%, 17%)}.related-page-carddata-theme=blue{--card-title-bg: hsl(227, 68%, 62%)}.related-page-carddata-theme=purple{--card-title-bg: hsl(267, 39%, 60%)}.text-bubbledata-theme=green{--card-title-bg: hsl(136, 29%, 50%)}.related-page-carddata-theme=orange{--card-title-bg: hsl(43, 71%, 51%)}.related-page-carddata-theme=red{--card-title-bg: hsl(4, 58%, 56%)}.related-page-carddata-theme=spring{--card-title-bg: hsl(72, 64%, 57%)}.related-page-carddata-theme=kyoto{--card-title-bg: hsl(331, 21%, 26%)}.related-page-carddata-theme=newyork{--card-title-bg: hsl(176, 29%, 67%)}.related-page-card{display:block;position:relative;height:inherit;width:inherit;overflow:hidden;text-overflow:ellipsis;font-family:Roboto,Helvetica,Arial,Hiragino Sans,sans-serif;background-color:var(--card-bg, #fff);color:var(--card-title-color, #555);word-break:break-word;text-decoration:none}.related-page-card:hover{box-shadow:var(--card-box-hover-shadow, 0 2px 0 rgba(0,0,0,.23))}.related-page-card:focus{outline:0;box-shadow:0 0 0 3px #66afe999;border-color:#66afe9;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.related-page-card.hover{opacity:0;position:absolute;width:100%;height:100%;top:0;left:0;background-color:var(--card-hover-bg, rgba(0,0,0,.05));mix-blend-mode:multiply;z-index:1;transition:background-color .1s}.related-page-card:hover .hover{opacity:1}.related-page-card:active .hover{opacity:1;background-color:var(--card-active-bg, rgba(0,0,0,.1))}.related-page-card .content{height:calc(100% - 5px);width:inherit;display:flex;flex-direction:column;overflow:hidden}.related-page-card .content .header{width:100%;color:#396bdd;text-overflow:ellipsis;border-top:var(--card-title-bg, #f2f2f3) solid 10px;padding:8px 10px}.related-page-card .content .header .title{font-size:11px;line-height:16px;font-weight:700;max-height:48px;color:var(--card-title-color, #363c49);margin:0;overflow:hidden;display:block;-webkit-line-clamp:3;-webkit-box-orient:vertical;text-overflow:ellipsis}.related-page-card .content .description{line-height:16px;padding:8px 10px 0;font-size:10px;white-space:pre-line;column-count:1;column-gap:2em;column-width:10em;height:inherit;color:var(--card-description-color, gray);flex-shrink:16;overflow:hidden}.related-page-card .content .thumbnail{display:block;width:100%;margin:0 auto;padding:0 5px}.related-page-card .content .description p{margin:0;display:block}.related-page-card .content .description code{font-family:Menlo,Monaco,Consolas,Courier New,monospace;font-size:90%;color:var(--code-color, #342d9c);background-color:var(--code-bg, rgba(0,0,0,.04));padding:0;white-space:pre-wrap;word-wrap:break-word}.related-page-card .content .description .icon{height:9px;vertical-align:middle}.related-page-card .content .description .page-link{background-color:transparent;text-decoration:none;cursor:pointer;color:var(--page-link-color, #5e8af7)}.card-bubble{background-color:var(--page-bg, #FFF);box-shadow:0 2px 2px #00000024,0 3px 1px -2px #0003,0 1px 5px #0000001f;position:absolute;max-width:80vw;box-sizing:content-box;z-index:9000;font-size:11px;line-height:1.42857;display:flex;padding:0;margin:0;list-style:none;overflow-x:auto;overflow-y:visible}.card-bubble li{display:block;position:relative;float:none;margin:5px;box-sizing:border-box;box-shadow:var(--card-box-shadow, 0 2px 0 rgba(0,0,0,.12));border-radius:2px;width:120px;height:120px} ;var wo=()=>{let[e,t]=R([]),r=O((s,a)=>t(i=>a?[...i.slice(0,s),a]:[...i.slice(0,s)]),[]),[o,n]=R([{bubble:s=>r(0,s),hide:()=>r(0)}]);return $(()=>{n(([s,...a])=>[s,...e.map((i,c)=>i===a.at(c)?.source?a.at(c):{source:i,parentTitles:[scrapbox.Page.title??"",...e.slice(0,c).map(p=>p.title)],bubble:p=>r(c+1,p),hide:()=>r(c+1)})])},[e]),o};var vt=(e,t,r,o,n)=>{$(()=>(e.addEventListener(t,r,o),()=>e.removeEventListener(t,r,o)),[e,t,o,...n??[]])};var Eo=e=>e instanceof HTMLSpanElement&&e.matches(".line-title .text"),Je=e=>e instanceof HTMLAnchorElement&&e.classList.contains("page-link");var wt="scrap-bubble",Lo=({delay:e,whiteList:t,watchList:r,style:o})=>{let[{bubble:n,hide:s},...a]=wo(),i=O((c,p)=>Vr(p,t.has(c)?t:new Set([c]),r),[t,r]);return vt(document,"pointerenter",async c=>{let p=c.target;if(!Je(p)&&!Eo(p))return;let{project:l=scrapbox.Project.name,title:g,hash:d=""}=Je(p)?se({pathType:"root",href:${new URL(p.href).pathname}${new URL(p.href).hash}`}):{project:scrapbox.Project.name,title:scrapbox.Page.title};if(l==="")return;let f=decodeURIComponent(g??"");i(l,f),!!await ie(p,e)&&n({project:l,title:f,hash:d,position:pe(p),type:ai(p)})},{capture:!0},e,t,r),vt(document,"click",c=>{c.target.dataset.userscriptName!==wt&&s()},{capture:!0},s),$(()=>(scrapbox.addListener("page:changed",s),()=>scrapbox.removeListener("page:changed",s)),s),u(w,null,u("link",{rel:"stylesheet",href:"https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.12.0/katex.min.css"}),u("style",null,vo),u(ko,{style:o}),a.map(c=>u(yo,{key:E(c.source.project,c.source.title),...c,whiteList:t,delay:e,prefetch:i})))},ai=e=>Je(e)?e.type==="link"?"link":"hashtag":"title";var zf=async e=>{let{delay:t=500,whiteList:r=[],watchList:o=(await yr()).slice(0,100),style:n="",debug:s=!1}=e??{};Kr(s);let a=document.createElement("div");a.dataset.userscriptName=wt,document.body.append(a);let i=a.attachShadow({mode:"open"});Ie(u(Lo,{delay:t,whiteList:new Set(scrapbox.Project.name,...r),watchList:new Set(o),style:n}),i)};export{zf as mount};