ScrapBubble
一部css改変している
code:script.js
var m,$t,I,ue,fe,xt,Q={},se=[],yt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|inech|zoo|^ord|itera/i;function F(e,t){for(var r in t)er=tr;return e}function he(e){var t=e.parentNode;t&&t.removeChild(e)}function E(e,t,r){var o,a,n,s=arguments,c={};for(n in t)n=="key"?o=tn:n=="ref"?a=tn:cn=tn;if(arguments.length>3)for(r=r,n=3;n<arguments.length;n++)r.push(sn);if(r!=null&&(c.children=r),typeof e=="function"&&e.defaultProps!=null)for(n in e.defaultProps)cn===void 0&&(cn=e.defaultPropsn);return K(e,c,o,a,null)}function K(e,t,r,o,a){var n={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:a??++m.__v};return m.vnode!=null&&m.vnode(n),n}function O(e){return e.children}function X(e,t){this.props=e,this.context=t}function W(e,t){if(t==null)return e.__?W(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"?W(e):null}function _e(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 _e(e)}}function me(e){(!e.__d&&(e.__d=!0)&&I.push(e)&&!V.__r++||fe!==m.debounceRendering)&&((fe=m.debounceRendering)||ue)(V)}function V(){for(var e;V.__r=I.length;)e=I.sort(function(t,r){return t.__v.__b-r.__v.__b}),I=[],e.some(function(t){var r,o,a,n,s,c;t.__d&&(s=(n=(r=t).__v).__e,(c=r.__P)&&(o=[],(a=F({},n)).__v=n.__v+1,le(c,n,a,r.__n,c.ownerSVGElement!==void 0,n.__h!=null?s:null,o,s??W(n),n.__h),ke(o,n),n.__e!=s&&_e(n)))})}function be(e,t,r,o,a,n,s,c,p,f){var l,v,u,d,h,_,$,b=o&&o.__k||se,g=b.length;for(r.__k=[],l=0;l<t.length;l++)if((d=r.__kl=(d=tl)==null||typeof d=="boolean"?null:typeof d=="string"||typeof d=="number"||typeof d=="bigint"?K(null,d,null,null,d):Array.isArray(d)?K(O,{children:d},null,null,null):d.__b>0?K(d.type,d.props,d.key,null,d.__v):d)!=null){if(d.__=r,d.__b=r.__b+1,(u=bl)===null||u&&d.key==u.key&&d.type===u.type)bl=void 0;else for(v=0;v<g;v++){if((u=bv)&&d.key==u.key&&d.type===u.type){bv=void 0;break}u=null}le(e,d,u=u||Q,a,n,s,c,p,f),h=d.__e,(v=d.ref)&&u.ref!=v&&($||($=[]),u.ref&&$.push(u.ref,null,d),$.push(v,d.__c||h,d)),h!=null?(_==null&&(_=h),typeof d.type=="function"&&d.__k!=null&&d.__k===u.__k?d.__d=p=ge(d,p,e):p=ve(e,d,u,b,h,p),f||r.type!=="option"?typeof r.type=="function"&&(r.__d=p):e.value=""):p&&u.__e==p&&p.parentNode!=e&&(p=W(u))}for(r.__e=_,l=g;l--;)bl!=null&&(typeof r.type=="function"&&bl.__e!=null&&bl.__e==r.__d&&(r.__d=W(o,l+1)),je(bl,bl));if($)for(l=0;l<$.length;l++)we($l,$++l,$++l)}function ge(e,t,r){var o,a;for(o=0;o<e.__k.length;o++)(a=e.__ko)&&(a.__=e,t=typeof a.type=="function"?ge(a,t,r):ve(r,a,a,e.__k,a.__e,t));return t}function ve(e,t,r,o,a,n){var s,c,p;if(t.__d!==void 0)s=t.__d,t.__d=void 0;else if(r==null||a!=n||a.parentNode==null)e:if(n==null||n.parentNode!==e)e.appendChild(a),s=null;else{for(c=n,p=0;(c=c.nextSibling)&&p<o.length;p+=2)if(c==a)break e;e.insertBefore(a,n),s=n}return s!==void 0?s:a.nextSibling}function kt(e,t,r,o,a){var n;for(n in r)n==="children"||n==="key"||n in t||G(e,n,null,rn,o);for(n in t)a&&typeof tn!="function"||n==="children"||n==="key"||n==="value"||n==="checked"||rn===tn||G(e,n,tn,rn,o)}function $e(e,t,r){t0==="-"?e.setProperty(t,r):et=r==null?"":typeof r!="number"||yt.test(t)?r:r+"px"}function G(e,t,r,o,a){var n;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||$e(e.style,t,"");if(r)for(t in r)o&&rt===ot||$e(e.style,t,rt)}else if(t0==="o"&&t1==="n")n=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.lt+n=r,r?o||e.addEventListener(t,n?ye:xe,n):e.removeEventListener(t,n?ye:xe,n);else if(t!=="dangerouslySetInnerHTML"){if(a)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(s){}typeof r=="function"||(r!=null&&(r!==!1||t0==="a"&&t1==="r")?e.setAttribute(t,r):e.removeAttribute(t))}}function xe(e){this.le.type+!1(m.event?m.event(e):e)}function ye(e){this.le.type+!0(m.event?m.event(e):e)}function le(e,t,r,o,a,n,s,c,p){var f,l,v,u,d,h,_,$,b,g,P,y=t.type;if(t.constructor!==void 0)return null;r.__h!=null&&(p=r.__h,c=t.__e=r.__e,t.__h=null,n=c),(f=m.__b)&&f(t);try{e:if(typeof y=="function"){if($=t.props,b=(f=y.contextType)&&of.__c,g=f?b?b.props.value:f.__:o,r.__c?_=(l=t.__c=r.__c).__=l.__E:("prototype"in y&&y.prototype.render?t.__c=l=new y($,g):(t.__c=l=new X($,g),l.constructor=y,l.render=jt),b&&b.sub(l),l.props=$,l.state||(l.state={}),l.context=g,l.__n=o,v=l.__d=!0,l.__h=[]),l.__s==null&&(l.__s=l.state),y.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=F({},l.__s)),F(l.__s,y.getDerivedStateFromProps($,l.__s))),u=l.props,d=l.state,v)y.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(y.getDerivedStateFromProps==null&&$!==u&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps($,g),!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate($,l.__s,g)===!1||t.__v===r.__v){l.props=$,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(x){x&&(x.__=t)}),l.__h.length&&s.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate($,l.__s,g),l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(u,d,h)})}l.context=g,l.props=$,l.state=l.__s,(f=m.__r)&&f(t),l.__d=!1,l.__v=t,l.__P=e,f=l.render(l.props,l.state,l.context),l.state=l.__s,l.getChildContext!=null&&(o=F(F({},o),l.getChildContext())),v||l.getSnapshotBeforeUpdate==null||(h=l.getSnapshotBeforeUpdate(u,d)),P=f!=null&&f.type===O&&f.key==null?f.props.children:f,be(e,Array.isArray(P)?P:P,t,r,o,a,n,s,c,p),l.base=t.__e,t.__h=null,l.__h.length&&s.push(l),_&&(l.__E=l.__=null),l.__e=!1}else n==null&&t.__v===r.__v?(t.__k=r.__k,t.__e=r.__e):t.__e=wt(r.__e,t,r,o,a,n,s,p);(f=m.diffed)&&f(t)}catch(x){t.__v=null,(p||n!=null)&&(t.__e=c,t.__h=!!p,nn.indexOf(c)=null),m.__e(x,t,r)}}function ke(e,t){m.__c&&m.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){m.__e(o,r.__v)}})}function wt(e,t,r,o,a,n,s,c){var p,f,l,v,u=r.props,d=t.props,h=t.type,_=0;if(h==="svg"&&(a=!0),n!=null){for(;_<n.length;_++)if((p=n_)&&(p===e||(h?p.localName==h:p.nodeType==3))){e=p,n_=null;break}}if(e==null){if(h===null)return document.createTextNode(d);e=a?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,d.is&&d),n=null,c=!1}if(h===null)u===d||c&&e.data===d||(e.data=d);else{if(n=n&&se.slice.call(e.childNodes),f=(u=r.props||Q).dangerouslySetInnerHTML,l=d.dangerouslySetInnerHTML,!c){if(n!=null)for(u={},v=0;v<e.attributes.length;v++)u[e.attributes[v].name]=e.attributes[v].value;(l||f)&&(l&&(f&&l.__html==f.__html||l.__html===e.innerHTML)||(e.innerHTML=l&&l.__html||""))}if(kt(e,d,u,a,c),l)t.__k=[];else if(_=t.props.children,be(e,Array.isArray(_)?_:_,t,r,o,a&&h!=="foreignObject",n,s,e.firstChild,c),n!=null)for(_=n.length;_--;)n_!=null&&he(n_);c||("value"in d&&(_=d.value)!==void 0&&(_!==e.value||h==="progress"&&!_)&&G(e,"value",_,u.value,!1),"checked"in d&&(_=d.checked)!==void 0&&_!==e.checked&&G(e,"checked",_,u.checked,!1))}return e}function we(e,t,r){try{typeof e=="function"?e(t):e.current=t}catch(o){m.__e(o,r)}}function je(e,t,r){var o,a,n;if(m.unmount&&m.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||we(o,null,t)),r||typeof e.type=="function"||(r=(a=e.__e)!=null),e.__e=e.__d=void 0,(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(s){m.__e(s,t)}o.base=o.__P=null}if(o=e.__k)for(n=0;n<o.length;n++)on&&je(on,t,r);a!=null&&he(a)}function jt(e,t,r){return this.constructor(e,r)}function Ce(e,t,r){var o,a,n;m.__&&m.__(e,t),a=(o=typeof r=="function")?null:r&&r.__k||t.__k,n=[],le(t,e=(!o&&r||t).__k=E(O,null,e),a||Q,Q,t.ownerSVGElement!==void 0,!o&&r?r:a?null:t.firstChild?se.slice.call(t.childNodes):null,n,!o&&r?r:a?a.__e:t.firstChild,o),ke(n,e)}m={__e:function(e,t){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e),a=r.__d),a)return r.__E=r}catch(n){e=n}throw e},__v:0},$t=function(e){return e!=null&&e.constructor===void 0},X.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=F({},this.state),typeof e=="function"&&(e=e(F({},r),this.props)),e&&F(r,e),e!=null&&this.__v&&(t&&this.__h.push(t),me(this))},X.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),me(this))},X.prototype.render=O,I=[],ue=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,V.__r=0,xt=0;var Se=function(e,t,r,o){var a;t0=0;for(var n=1;n<t.length;n++){var s=tn++,c=tn?(t0|=s?1:2,r[tn++]):t++n;s===3?o0=c:s===4?o1=Object.assign(o1||{},c):s===5?(o1=o1||{})[t++n]=c:s===6?o1[t++n]+=c+"":s?(a=e.apply(c,Se(e,c,r,"",null)),o.push(a),c0?t0|=2:(tn-2=0,tn=a)):o.push(c)}return o},Te=new Map;function Le(e){var t=Te.get(this);return t||(t=new Map,Te.set(this,t)),(t=Se(this,t.get(e)||(t.set(e,t=function(r){for(var o,a,n=1,s="",c="",p=0,f=function(u){n===1&&(u||(s=s.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?p.push(0,u,s):n===3&&(u||s)?(p.push(3,u,s),n=2):n===2&&s==="..."&&u?p.push(4,u,0):n===2&&s&&!u?p.push(5,0,!0,s):n>=5&&((s||!u&&n===5)&&(p.push(n,0,s,a),n=6),u&&(p.push(n,u,0,a),n=6)),s=""},l=0;l<r.length;l++){l&&(n===1&&f(),f(l));for(var v=0;v<rl.length;v++)o=rlv,n===1?o==="<"?(f(),p=p,n=3):s+=o:n===4?s==="--"&&o===">"?(n=1,s=""):s=o+s0:c?o===c?c="":s+=o:o==='"'||o==="'"?c=o:o===">"?(f(),n=1):n&&(o==="="?(n=5,a=s,s=""):o==="/"&&(n<5||rlv+1===">")?(f(),n===3&&(p=p0),n=p,(p=p0).push(2,0,n),n=0):o===" "||o===" "||o===` ||o==="\r"?(f(),n=2):s+=o),n===3&&s==="!--"&&(n=4,p=p[0])}return f(),p}(e)),t),arguments,[])).length>1?t:t[0]}var i=Le.bind(E);var Z,T,Pe,D=0,ce=[],Ee=m.__b,Oe=m.__r,Me=m.diffed,Ne=m.__c,ze=m.unmount;function ie(e,t){m.__h&&m.__h(T,e,D||t),D=0;var r=T.__H||(T.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function L(e){return D=1,Ct(He,e)}function Ct(e,t,r){var o=ie(Z++,2);return o.t=e,o.__c||(o.__=[r?r(t):He(void 0,t),function(a){var n=o.t(o.__[0],a);o.__[0]!==n&&(o.__=[n,o.__[1]],o.__c.setState({}))}],o.__c=T),o.__}function R(e,t){var r=ie(Z++,3);!m.__s&&Be(r.__H,t)&&(r.__=e,r.__H=t,T.__H.__h.push(r))}function Y(e){return D=5,M(function(){return{current:e}},[])}function M(e,t){var r=ie(Z++,7);return Be(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function j(e,t){return D=8,M(function(){return e},t)}function St(){ce.forEach(function(e){if(e.__P)try{e.__H.__h.forEach(J),e.__H.__h.forEach(pe),e.__H.__h=[]}catch(t){e.__H.__h=[],m.__e(t,e.__v)}}),ce=[]}m.__b=function(e){T=null,Ee&&Ee(e)},m.__r=function(e){Oe&&Oe(e),Z=0;var t=(T=e.__c).__H;t&&(t.__h.forEach(J),t.__h.forEach(pe),t.__h=[])},m.diffed=function(e){Me&&Me(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(ce.push(t)!==1&&Pe===m.requestAnimationFrame||((Pe=m.requestAnimationFrame)||function(r){var o,a=function(){clearTimeout(n),Fe&&cancelAnimationFrame(o),setTimeout(r)},n=setTimeout(a,100);Fe&&(o=requestAnimationFrame(a))})(St)),T=void 0},m.__c=function(e,t){t.some(function(r){try{r.__h.forEach(J),r.__h=r.__h.filter(function(o){return!o.__||pe(o)})}catch(o){t.some(function(a){a.__h&&(a.__h=[])}),t=[],m.__e(o,r.__v)}}),Ne&&Ne(e,t)},m.unmount=function(e){ze&&ze(e);var t=e.__c;if(t&&t.__H)try{t.__H.__.forEach(J)}catch(r){m.__e(r,t.__v)}};var Fe=typeof requestAnimationFrame=="function";function J(e){var t=T;typeof e.__c=="function"&&e.__c(),T=t}function pe(e){var t=T;e.__c=e.__(),T=t}function Be(e,t){return!e||e.length!==t.length||t.some(function(r,o){return r!==e[o]})}function He(e,t){return typeof t=="function"?t(e):t}var Ae="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.3/katex.min.js",Re=!1,Ie=()=>new Promise(async(e,t)=>{if(document.querySelector(scriptsrc="${Ae}")){Re||await We(),e();return}let r=document.createElement("script");r.addEventListener("load",async()=>{await We(),Re=!0,e()}),r.addEventListener("error",o=>t(o)),r.src=Ae,document.head.appendChild(r)}),We=()=>new Promise(e=>{let t=setInterval(()=>{!window.katex||(clearInterval(t),e())},500)});var ee=e=>{let t=Y(null),[r,o]=L(e),[a,n]=L(void 0);return R(()=>{(async()=>{await Ie();try{katex.render(r,t.current),n(void 0)}catch(s){s instanceof katex.ParseError&&n(s.message)}})()},[r,t]),{ref:t,formula:r,error:a,setFormula:o}};var Tt=Object.defineProperty,Lt=(e,t)=>{for(var r in t)Tt(e,r,{get:t[r],enumerable:!0})},De={};Lt(De,{convertToBlock:()=>Ke,getTitle:()=>Ur,packRows:()=>Ge,parse:()=>Dr,parseToRows:()=>Xe});var Pt=e=>({type:"title",text:e.rows[0].text}),Et=e=>{let{rows:[t,...r]}=e,{indent:o=0,text:a=""}=t??{},n=a.replace(/^\s*code:/,"");return{indent:o,type:"codeBlock",fileName:n,content:r.map(s=>s.text.substring(o+1)).join( )}},k=(e,{parseOnNested:t,parseOnQuoted:r,patterns:o})=>(a,n,s)=>{var c,p,f,l,v,u;if(!t&&n.nested)return(c=s==null?void 0:s())!==null&&c!==void 0?c:[];if(!r&&n.quoted)return(p=s==null?void 0:s())!==null&&p!==void 0?p:[];for(let d of o){let h=d.exec(a);if(h===null)continue;let _=a.substring(0,h.index),$=a.substring(h.index+((l=(f=h[0])===null||f===void 0?void 0:f.length)!==null&&l!==void 0?l:0)),b=e((v=h[0])!==null&&v!==void 0?v:"",n);return[...B(_,n),...Array.isArray(b)?b:[b],...B($,n)]}return(u=s==null?void 0:s())!==null&&u!==void 0?u:[]},Ot=/^>.*$/,Mt=(e,t)=>({type:"quote",raw:e,nodes:B(e.substring(1),{...t,quoted:!0})}),Nt=k(Mt,{parseOnNested:!1,parseOnQuoted:!1,patterns:[Ot]}),zt=/^\? .+$/,Ft=e=>({type:"helpfeel",raw:e,text:e.substring(2)}),Bt=k(Ft,{parseOnNested:!1,parseOnQuoted:!1,patterns:[zt]}),Ht=/\[\[https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)\]\]/i,At=/\[\[https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}\]\]/,Rt=e=>{let t=e.substring(2,e.length-2),r=/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}$/.test(t);return{type:"strongImage",raw:e,src:r?${t}/thumb/1000:t}},It=k(Rt,{parseOnNested:!1,parseOnQuoted:!0,patterns:[Ht,At]}),Wt=/\[[^[\]]*\.icon(?:\*[1-9]\d*)?\]/;function Ue(e){return t=>{let r=e==="icon"?t.substring(1,t.length-1):t.substring(2,t.length-2),o=r.lastIndexOf(".icon"),a=r.substring(0,o),n=a.startsWith("/")?"root":"relative",s=r.substring(o+5,r.length),c=s.startsWith("*")?parseInt(s.substring(1),10):1;return new Array(c).fill({}).map(()=>({path:a,pathType:n,type:e,raw:t}))}}var Dt=Ue("icon"),Ut=k(Dt,{parseOnNested:!1,parseOnQuoted:!0,patterns:[Wt]}),qt=/\[\[[^[\]]*\.icon(?:\*\d+)?\]\]/,Qt=Ue("strongIcon"),Kt=k(Qt,{parseOnNested:!1,parseOnQuoted:!0,patterns:[qt]}),Xt=/\[\[(?:[^[]|\[[^[]).*?\]*\]\]/,Vt=(e,t)=>({type:"strong",raw:e,nodes:B(e.substring(2,e.length-2),{...t,nested:!0})}),Gt=k(Vt,{parseOnNested:!1,parseOnQuoted:!0,patterns:[Xt]}),Zt=/\[\$ .+? \]/,Yt=/\[\$ [^\]]+\]/,Jt=e=>({type:"formula",raw:e,formula:e.substring(3,e.length-(e.endsWith(" ]")?2:1))}),er=k(Jt,{parseOnNested:!1,parseOnQuoted:!0,patterns:[Zt,Yt]}),tr=/\[[!"#%&'()*+,\-./{|}<>_~]+ (?:\[[^[\]]+\]|[^\]])+\]/,rr=(e,t)=>{let r=e.indexOf(" "),o=e.substring(1,r),a=e.substring(r+1,e.length-1),n=new Set(o);if(n.has("*")){let s=o.split("*").length-1;n.delete("*"),n.add(*-${Math.min(s,10)})}return{type:"decoration",raw:e,rawDecos:o,decos:Array.from(n),nodes:B(a,{...t,nested:!0})}},or=k(rr,{parseOnNested:!1,parseOnQuoted:!0,patterns:[tr]}),nr=/.*?/,ar=e=>({type:"code",raw:e,text:e.substring(1,e.length-1)}),sr=k(ar,{parseOnNested:!1,parseOnQuoted:!0,patterns:[nr]}),lr=/^[$%] .+$/,cr=e=>{var t;let r=(t=e[0])!==null&&t!==void 0?t:"",o=e.substring(2);return{type:"commandLine",raw:e,symbol:r,text:o}},ir=k(cr,{parseOnNested:!1,parseOnQuoted:!1,patterns:[lr]}),pr=/\[\s+\]/,dr=e=>({type:"blank",raw:e,text:e.substring(1,e.length-1)}),ur=k(dr,{parseOnNested:!1,parseOnQuoted:!0,patterns:[pr]}),fr=/\[https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)(?:\?[^\]\s]+)?(?:\s+https?:\/\/[^\s\]]+)?\]/i,hr=/\[https?:\/\/[^\s\]]+\s+https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)(?:\?[^\]\s]+)?\]/i,_r=/\[https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}(?:\/raw)?(?:\s+https?:\/\/[^\s\]]+)?\]/,mr=/\[https?:\/\/[^\s\]]+\s+https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}(?:\/raw)?\]/,br=e=>/^https?:\/\/[^\s\]]+\.(png|jpe?g|gif|svg)(\?[^\]\s]+)?$/i.test(e)||gr(e),gr=e=>/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}(\/raw)?$/.test(e),vr=e=>{let t=e.search(/\s/),r=t!==-1?e.substring(1,t):e.substring(1,e.length-1),o=t!==-1?e.substring(t,e.length-1).trimLeft():"",[a,n]=br(o)?[o,r]:[r,o];return{type:"image",raw:e,src:/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}$/.test(a)?${a}/thumb/1000:a,link:n}},$r=k(vr,{parseOnNested:!0,parseOnQuoted:!0,patterns:[fr,hr,_r,mr]}),xr=/\[https?:\/\/[^\s\]]+\s+[^\]]*[^\s]\]/,yr=/\[[^[\]]*[^\s]\s+https?:\/\/[^\s\]]+\]/,kr=/\[https?:\/\/[^\s\]]+\]/,wr=/https?:\/\/[^\s]+/,jr=e=>{let t=e.startsWith("[")&&e.endsWith("]")?e.substring(1,e.length-1):e,r=/^https?:\/\/[^\s\]]/.test(t),o=(r?/^https?:\/\/[^\s\]]+/:/https?:\/\/[^\s\]]+$/).exec(t);if((o==null?void 0:o[0])===void 0)return[];let a=r?t.substring(o[0].length):t.substring(0,o.index-1);return{type:"link",raw:e,pathType:"absolute",href:o[0],content:a.trim()}},Cr=k(jr,{parseOnNested:!0,parseOnQuoted:!0,patterns:[xr,yr,kr,wr]}),qe=/\[([^\]]*[^\s])\s+([NS]\d+(?:\.\d+)?,[EW]\d+(?:\.\d+)?(?:,Z\d+)?)\]/,Qe=/\[([NS]\d+(?:\.\d+)?,[EW]\d+(?:\.\d+)?(?:,Z\d+)?)(?:\s+([^\]]*[^\s]))?\]/,Sr=e=>{let[t="",r="",o=""]=e.split(","),a=parseFloat(t.replace(/^N/,"").replace(/^S/,"-")),n=parseFloat(r.replace(/^E/,"").replace(/^W/,"-")),s=/^Z\d+$/.test(o)?parseInt(o.replace(/^Z/,""),10):14;return{latitude:a,longitude:n,zoom:s}},Tr=e=>{var t;let r=(t=e.match(qe))!==null&&t!==void 0?t:e.match(Qe);if(r===null)return[];let o=e.startsWith("[N")||e.startsWith("[S"),[,a="",n=""]=o?r:[r[0],r[2],r[1]],{latitude:s,longitude:c,zoom:p}=Sr(a),f=n!==""?https://www.google.com/maps/place/${encodeURIComponent(n)}/@${s},${c},${p}z:https://www.google.com/maps/@${s},${c},${p}z;return{type:"googleMap",raw:e,latitude:s,longitude:c,zoom:p,place:n,url:f}},Lr=k(Tr,{parseOnNested:!1,parseOnQuoted:!0,patterns:[qe,Qe]}),Pr=/\[\/?[^[\]]+\]/,Er=e=>{let t=e.substring(1,e.length-1);return{type:"link",raw:e,pathType:t.startsWith("/")?"root":"relative",href:t,content:""}},Or=k(Er,{parseOnNested:!0,parseOnQuoted:!0,patterns:[Pr]}),Mr=/(?:^|\s)#\S+/,Nr=e=>{if(e.startsWith("#"))return{type:"hashTag",raw:e,href:e.substring(1)};let t=e.substring(0,1),r=e.substring(1);return[{type:"plain",raw:t,text:t},{type:"hashTag",raw:r,href:r.substring(1)}]},zr=k(Nr,{parseOnNested:!1,parseOnQuoted:!0,patterns:[Mr]}),Fr=e=>({type:"plain",raw:e,text:e}),Br=k(Fr,{parseOnNested:!0,parseOnQuoted:!0,patterns:[/^()(.*)()$/]}),Hr=(e,t,r)=>{var o;return e===""?[]:(o=r==null?void 0:r())!==null&&o!==void 0?o:[]},Ar=(...e)=>(t="",r={nested:!1,quoted:!1})=>e.reduceRight((o,a)=>()=>a(t,r,o),()=>Br(t,r))(),B=Ar(Hr,Nt,Bt,sr,ir,er,ur,or,It,Kt,Gt,$r,Cr,Ut,Lr,Or,zr),Rr=e=>{let{rows:[t,...r]}=e,{indent:o=0,text:a=""}=t??{},n=a.replace(/^\s*table:/,"");return{indent:o,type:"table",fileName:n,cells:r.map(s=>s.text.substring(o+1)).map(s=>s.split(" ").map(c=>B(c,{nested:!0,quoted:!1})))}},Ir=e=>{let{indent:t,text:r}=e.rows[0];return{indent:t,type:"line",nodes:B(r.substring(t))}},Ke=e=>{switch(e.type){case"title":return Pt(e);case"codeBlock":return Et(e);case"table":return Rr(e);case"line":return Ir(e)}},Xe=e=>e.split( ).map(t=>{var r,o,a;return{indent:(a=(o=(r=/^\s+/.exec(t))===null||r===void 0?void 0:r[0])===null||o===void 0?void 0:o.length)!==null&&a!==void 0?a:0,text:t}}),Wr=(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)},Ve=(e,t)=>{let r=e[e.length-1];return r!==void 0&&Wr(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)},Ge=(e,t)=>{var r;if((r=t.hasTitle)!==null&&r!==void 0?r:!0){let[o,...a]=e;return o===void 0?[]:[{type:"title",rows:[o]},...a.reduce(Ve,[])]}return e.reduce(Ve,[])},Dr=(e,t)=>{var r;let o=Xe(e);return Ge(o,{hasTitle:(r=t==null?void 0:t.hasTitle)!==null&&r!==void 0?r:!0}).map(Ke)},Ur=e=>{var t,r;let o=/^\s*\S.*$/m.exec(e);return(r=(t=o==null?void 0:o[0])===null||t===void 0?void 0:t.trim())!==null&&r!==void 0?r:"Untitled"},{packRows:Ao,parse:te,getTitle:Ro,convertToBlock:Io,parseToRows:Wo}=De;var C=e=>e.toLowerCase().replaceAll(" ","_").replace(/[/?#\{}^|<>]/g,t=>encodeURIComponent(t));var Ze=({lines:e,project:t,titleLc:r,noIndent:o})=>{let a=M(()=>{let c=e.map(p=>typeof p=="string"?p:p.text).join(
);return te(c,{hasTitle:!1})},[e]),n=M(()=>e.flatMap(c=>typeof c=="string"?[]:[c.id]),[e]),s=0;return i${a.flatMap(c=>{switch(c.type){case"title":return[];case"codeBlock":{let p=s;return s+=c.content.split(`
).length+1,[i<${qr}
block="${c}"
project="${t}" titleLc="${r}"
noIndent="${o}"
ids="${n.slice(p,s)}" />]}case"table":{let p=s;return s+=c.cells.length+1,[i<${Qr}
block="${c}"
project="${t}" titleLc="${r}"
noIndent="${o}"
ids="${n.slice(p,s)}" />]}case"line":return s++,[i<${U}
indent="${c.indent}"
noIndent="${o}">
${c.nodes.length>0?c.nodes.map(p=>i<${re} node="${p}" project="${t}" />):i<br />}
<//>]}})}},U=({index:e,indent:t,noIndent:r,children:o})=>i`<div class="line"
data-id="L${e}"
data-indent="${t}"
style="margin-left: ${r?"":${1*t}em};"
${o}</div>,qr=({block:{fileName:e,content:t,indent:r},project:o,titleLc:a,ids:n})=>{let[s,c]=L(""),p=j(()=>{navigator.clipboard.writeText(t),c("Copied"),setTimeout(()=>c(""),1e3)},[t]);return i
<${U} index="${n0}" indent="${r}"> <span class="code-block">
<span class="code-block-start">
${e.includes(".")?i<a href="/api/code/${o}/${a}/${e}" target="_blank">${e}</a>:e}
</span>
<span class="copy" title="Copy" onClick="${p}">${s}</span>
</span>
<//>
${t.split(`
).map((f,l)=>i<${U} index="${nl+1}" indent="${r}"> <code class="code-block">
${f}
</code>
<//>`)}
},Qr=({block:{fileName:e,cells:t,indent:r},project:o,titleLc:a,ids:n})=>i
<${U} index="${n0}" indent="${r}"> <span class="table-block">
<span class="table-block-start">
<a href="/api/table/${o}/${a}/${e}.csv" target="_blank">${e}</a>
</span>
</span>
<//>
${t.map((s,c)=>i`
<${U} index="${nc+1}" indent="${r}"> <span class="table-block table-block-row">
${s.map((p,f)=>i`<span class="cell col-${f}">
</span>`)}
</span>
<//>
`)}
,re=({node:e,project:t})=>{switch(e.type){case"code":return i<${Kr} node="${e}" />;case"formula":return i<${Xr} node="${e}" />;case"commmandLine":return i<${Vr} node="${e}" />;case"helpfeel":return i<${Gr} node="${e}" />;case"quote":return i<${Zr} node="${e}" project="${t}" />;case"strong":return i<${Yr} node="${e}" project="${t}" />;case"decoration":return i<${Jr} node="${e}" project="${t}" />;case"plain":case"blank":return i<${to} node="${e}" />;case"hashTag":return i<${ro} node="${e}" project="${t}" />;case"link":return i<${oo} node="${e}" project="${t}" />;case"googleMap":return i<${eo} node="${e}" />;case"icon":return i<${Ye} node="${e}" project="${t}" />;case"strongIcon":return i<${Ye} node="${e}" project="${t}" strong />;case"image":return i<${Je} node="${e}" />;case"strongImage":return i<${Je} node="${e}" strong />}},Kr=({node:{text:e}})=>i<code class="code">${e}</code>,Xr=({node:{formula:e}})=>{let{ref:t,error:r,setFormula:o}=ee("");return o(e),i
<span class="formula${r?" error":""}">
${r?i<code>${e}</code>:i<span class="katex-display" ref="${t}"/>}
</span>},Vr=({node:{text:e,symbol:t}})=>i<code class="cli">
<span class="prefix">${t}</span>
${" "}
<span class="command">${e}</span>
</code>,Gr=({node:{text:e}})=>i<code class="helpfeel">
<span class="prefix">?</span>
${" "}
<span class="entry">${e}</span>
</code>,Zr=({node:{nodes:e},project:t})=>i
<blockquote class="quote">
${e.map(r=>i<${re} node="${r}" project="${t}" />)}
</blockquote>
,Yr=({node:{nodes:e},project:t})=>i
<strong>
${e.map(r=>i<${re} node="${r}" project="${t}" />)}
</strong>
,Jr=({node:{decos:e,nodes:t},project:r})=>i
<span class="${e.map(o=>deco-${o}).join(" ")}">
${t.map(o=>i<${re} node="${o}" project="${r}" />)}
</span>
,eo=({node:{place:e,latitude:t,longitude:r,zoom:o}})=>i
<span class="pointing-device-map">
rel="noopner noreferrer"
target="_blank">
<img class="google-map"
src="/api/google-map/static-map?center=${t}%2C${r}&markers=${e}&zoom=${o}&_csrf=${window._csrf}" />
</a>
</span>
,to=({node:{text:e}})=>i${e},Ye=({node:{pathType:e,path:t},strong:r,project:o})=>{let a=e==="relative"?o:t.match(/\/([\w\-]+)/)[1],n=e==="relative"?t:t.match(/\/[\w\-]+\/(.+)$/)[1],s=C(n);return i
<a href="/${a}/${s}"
rel="${a===scrapbox.Project.name?"route":"noopener noreferrer"}"
target="${a===scrapbox.Project.name?"":"_blank"}">
<img class="${r?"icon strong-icon":"icon"}"
alt="${n}"
src="/api/pages/${a}/${s}/icon">${n}</img>
</a>
},Je=({node:{link:e,src:t},strong:r})=>{let o=e||(/https:\/\/gyazo\.com\/[^\/]+\/thumb\/1000/.test(t)?t.slice(0,-"/thumb/1000".length):t);return i
<a class="${e?"link":""}" href="${o}" rel="noopner noreferrer" target="_blank">
<img class="${r?"image strong-image":"image"}" src="${t}" />
</a>
},ro=({node:{href:e},project:t})=>i
<a href="/${t}/${C(e)}"
class="page-link"
type="hashTag"
rel="${t===scrapbox.Project.name?"route":"noopener noreferrer"}"
target="${t===scrapbox.Project.name?"":"_blank"}">
</a>
,oo=({node:{pathType:e,href:t,content:r},project:o})=>{switch(e){case"root":{let[n,s,c,p]=t.match(/\/([\w\-]+)\/([^#]*)(.*)/)??["","","",""];return i
<a class="page-link"
type="link" href="/${s}/${C(c)}${p}"
rel="${s===scrapbox.Project.name?"route":"noopener noreferrer"}"
target="${s===scrapbox.Project.name?"":"_blank"}">
${t}
</a>}case"relative":{let[n,s,c]=t.match(/^([^#]*)(.*)/)??["","",""];return i
<a class="page-link"
type="link" href="/${o}/${C(s)}${c}"
rel="${o===scrapbox.Project.name?"route":"noopener noreferrer"}"
target="${o===scrapbox.Project.name?"":"_blank"}">
${t}
</a>}case"absolute":let a=new URL(t);switch(a.hostname){case"www.youtube.com":return i<iframe
type="text/html"
allowfullscreen='' />;case"vimeo.com":return i<iframe
type="text/html"
allowfullscreen='' />;default:break}return/\.(?:mp3|ogg|wav)/.test(t)??r===""?i<audio preload='none' src="${t}" controls />:i<a class="link" href="${t}" rel="noopener noreferrer" target="_blank">
${r||t}
</a>}},et=
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%;
background-color: var(--code-bg, rgba(0,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,0.05));
display: block;
padding-left: 4px;
margin: 0px;
}
strong {
font-weight: bold;
}
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 {
}
.helpfeel {
border-radius: 4px;
padding: 3px !important;
}
.helpfeel .prefix {
}
.helpfeel .entry {
}
.code-block {
display: block;
line-height: 1.7em;
background-color: var(--code-bg, rgba(0,0,0,0.04));
}
.code-block-start {
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
font-size: .9em;
padding: 1px 2px;
}
.code-block-start a {
text-decoration: underline;
}
code.code-block,
.table-block.table-block-row {
padding-left: 1.0em;
}
.copy {
font-family: "Font Awesome 5 Free";
cursor: pointer;
}
.table-block {
white-space: nowrap;
}
.table-block-start {
padding: 1px 2px;
font-size: .9em;
}
.table-block-start a {
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: rgba(0,0,0,0.04);
}
.cell:nth-child(2n) {
background-color: rgba(0,0,0,0.06);
}
.strong-image {
max-height: 100%;
}
.icon {
height: 11px;
vertical-align: middle;
}
.strong-icon {
height: calc(11px * 1.2);
}
.deco-\\/ {font-style: italic;}
.deco-\\*-1 {font-weight: bold;}
.deco-\\*-2 {font-weight: bold; font-size: 1.20em;}
.deco-\\*-3 {font-weight: bold; font-size: 1.44em;}
.deco-\\*-4 {font-weight: bold; font-size: 1.73em;}
.deco-\\*-5 {font-weight: bold; font-size: 2.07em;}
.deco-\\*-6 {font-weight: bold; font-size: 2.49em;}
.deco-\\*-7 {font-weight: bold; font-size: 3.00em;}
.deco-\\*-8 {font-weight: bold; font-size: 3.58em;}
.deco-\\*-9 {font-weight: bold; font-size: 4.30em;}
.deco-\\*-10 {font-weight: bold; font-size: 5.16em;}
.deco-\\- {text-decoration: line-through;}
.deco-_ {text-decoration: underline;}
.page-link {color: var(--page-link-color, #5e8af7);} .page-link:hover {color: var(--page-link-hover-color, #2d67f5);} .empty-page-link {color: :var(--empty-page-link-color, #fd7373);} .empty-page-link:hover {color: :var(--empty-page-link-hover-color, #fd7373);} .link {
text-decoration: underline;
}
.link:hover {color: var(--page-link-color-hover-color, #2d67f5);} .link img {
padding-bottom: 3px;
border-style: none none solid;
border-width: 1.5px;
}
.permalink {
background-color: var(--line-permalink-color, rgba(234,218,74,0.75));
}
;var no=1,tt="wc-";function ao(){let e=Math.random().toString(36).slice(2);return${tt}${e}-${no++}}var rt=${tt}text,ot=!1,so=typeof window!="undefined"&&!!window.customElements;function q(e,t,r){if(Array.isArray(e)){let o=e.map((a,n)=>q(a,t,wc-slot-${n}));return r?E(O,{key:r},o):o}if(typeof e!="object")return ot||(ot=!0,so&&window.customElements.define(rt,class extends HTMLElement{})),E(rt,{key:r,slot:t},e);if(co(e)){let{type:o}=e;if(typeof o=="string")return{...e,props:{...e.props,slot:t},key:e.key??r};if(typeof o=="symbol"){let f=o;if(f.description==="react.fragment")return{...e,props:{...e.props,children:q(e.props.children,t)},key:e.key??r};throw new Error("Could not handle node of type "+String(f))}let{props:{children:a,...n},key:s}=e,c=nt.get(o);if(c)return E(c,{...n,key:s??r,slot:t},a);let p=lo(o);return nt.set(o,p),E(p,{...n,key:s??r,slot:t},a)}return null}var nt=new WeakMap;function lo(e){return io(e)?class extends e{render(){let t=super.render();return E(O,{children:q(t,this.props.slot)})}}:({slot:t,...r})=>{let o=e(r);return E(O,{children:q(o,t)})}}function co(e){return e!=null&&e.type!==void 0}function io(e){return!!e.prototype&&!!e.prototype.isReactComponent}function po(e,t){if(!t||t.length===0)return e.children;let r=e,o=[];for(let a of t){let n=r[a];o.push(q(n,a,slot-${a}))}return o.push(e.children),o}var at=Symbol("slot");function*uo(e,t){for(let r=e;r<t;r++)yield r}function fo(e,t){let r=e[0],o=[];for(let a of uo(0,t.length)){let n=t[a];if(typeof n!="object")r+=st(String(n));else{let s=n[at];s&&s!=="children"?(r+=<slot name="${st(s)}"></slot>,o.push(s)):r+="<slot></slot>"}r+=e[a+1]}return[r,o]}function ho(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";case"'":return"'";default:return e}}function st(e){return e.replace(/[&<>"']/g,ho)}function H(e,...t){let r=ao(),o=!1,a=document.createDocumentFragment(),[n,s]=fo(e,t);return Object.assign(c=>{if(!o){o=!0;let f=document.createElement("div");f.insertAdjacentHTML("afterbegin",n),a.append(...f.childNodes);class l extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"}).appendChild(a.cloneNode(!0))}}window.customElements.define(r,l)}let p=po(c,s);return E(r,{},p)},{elementName:r})}function A(e){return{[at]:e||""}}var oe=
:host {
display: inline-block;
position: absolute;
cursor: default;
}
,_o=H
<style>
${oe}
:host {
top: 0;
left: 0;
}
::slotted(*) {
border-right: 1px solid var(--status-bar-border-color, #a9aaaf); border-bottom: 1px solid var(--status-bar-border-color, #a9aaaf); }
::slotted(*:last-of-type) {
border-bottom-right-radius: 3px;
}
</style>
${A()}
,mo=H
<style>
${oe}
:host {
top: 0;
right: 0;
}
::slotted(*) {
border-left: 1px solid var(--status-bar-border-color, #a9aaaf); border-bottom: 1px solid var(--status-bar-border-color, #a9aaaf); }
::slotted(*:first-of-type) {
border-bottom-left-radius: 3px;
}
</style>
${A()}
,bo=H
<style>
${oe}
:host {
bottom: 0;
right: 0;
}
::slotted(*) {
border-left: 1px solid var(--status-bar-border-color, #a9aaaf); border-top: 1px solid var(--status-bar-border-color, #a9aaaf); }
::slotted(*:first-of-type) {
border-top-left-radius: 3px;
}
</style>
${A()}
,go=H
<style>
${oe}
:host {
bottom: 0;
left: 0;
}
::slotted(*) {
border-right: 1px solid var(--status-bar-border-color, #a9aaaf); border-top: 1px solid var(--status-bar-border-color, #a9aaaf); }
::slotted(*:last-of-type) {
border-top-right-radius: 3px;
}
</style>
${A()}
,ne=({orientation:e,children:t})=>{if(!t||t.length===0)return i;switch(e){case"top-left":return i<${_o}>${t}<//>;case"top-right":return i<${mo}>${t}<//>;case"bottom-right":return i<${bo}>${t}<//>;case"bottom-left":return i<${go}>${t}<//>;default:throw Error(${e} is an invalid value)}};var lt=({project:e,titleLc:t,lines:r,loading:o,hasChild:a,style:n,theme:s,onPointerEnterCapture:c,onPointerLeaveCapture:p,onClick:f})=>(r.length>0||o)&&i<div class="text-bubble${a?" no-scroll":""}"
data-theme="${s}"
onPointerEnterCapture="${c}"
onPointerLeaveCapture="${p}"
onClick="${f}"
style="${n}" >
<${ne} orientation="${r.length>0?"top-right":"top-left"}">
${o&&i<span>${r.length>0?"Updating...":"Loading..."}</span>}
${e!==scrapbox.Project.name&&i`
<${$o} project="${e}" titleLc="${t}" />
`}
<//>
${r.length>0&&i`
<${Ze} lines="${r}" project="${e}" titleLc="${t}" />
`}
</div>,ct=
以下のCSSはちょっといじったbluemountain.icon
code:script.js
.text-bubble {
padding: 5px 0px 5px 5px;
font-size: 12px;
line-height: 1.7;
user-select: text;
position: absolute;
max-height: 800vh;
overflow-y: auto;
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 rgba(0,0,0,0.175);
z-index: 9000;
}
.text-bubble.no-scroll {
overflow-y: hidden;
}
--text-bubble-border-color: hsl(0, 0%, 60%);
}
--text-bubble-border-color: hsl(0, 0%, 89%);
}
--text-bubble-border-color: hsl(53, 8%, 58%);
}
--text-bubble-border-color: hsl(203, 42%, 17%);
}
--text-bubble-border-color: hsl(227, 68%, 62%);
}
--text-bubble-border-color: hsl(267, 39%, 60%);
}
--text-bubble-border-color: hsl(136, 29%, 50%);
}
--text-bubble-border-color: hsl(43, 71%, 51%);
}
--text-bubble-border-color: hsl(4, 58%, 56%);
}
--text-bubble-border-color: hsl(72, 64%, 57%);
}
--text-bubble-border-color: hsl(331, 21%, 26%);
}
--text-bubble-border-color: hsl(176, 29%, 67%);
}
${et}
,vo=H
<style>
::slotted(a) {
text-decoration: none;
}
</style>
${A()}
;function $o({project:e,titleLc:t}){return i<${vo}>
<a href="/${e}/${t}"
target="_blank"
rel="noopener noreferrer"
/${e}
</a>
<//>}var it=({loading:e,hasChild:t,children:r,...o})=>{let a=Y(null),n=j(s=>{t||(s.preventDefault(),s.stopPropagation(),a.current.scrollLeft+=s.deltaY<0?-120:120)},[]);return(r.length>0||e)&&i
<div class="card-bubble" ...${o}>
<ul ref="${a}" onWheel="${n}">
${r.map(s=>i<li>${s}</li>)}
</ul>
${e&&i`
<${ne} orientation="${r.length>0?"top-left":"bottom-left"}">
<span>${r.length>0?"Updating...":"Loading..."}</span>
<//>
`}
</div>},pt=
.card-bubble {
background-color: var(--page-bg, #FFF); box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.2),0 1px 5px 0 rgba(0,0,0,.12);
position: absolute;
max-width: 80vw;
box-sizing: content-box;
z-index: 9000;
font-size: 11px;
line-height: 1.42857;
}
.card-bubble > ul {
display: flex;
padding: 0px;
margin: 0px;
list-style: none;
overflow-x: auto;
overflow-y: visible;
}
.card-bubble > ul > 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,0.12));
border-radius: 2px;
width: 120px;
height: 120px;
}
;var dt=({project:e,title:t,descriptions:r,thumbnail:o,theme:a,onPointerEnterCapture:n,onPointerLeaveCapture:s})=>{let c=M(()=>o?[]:te(r.join(
),{hasTitle:!1}),[r,o]);return i
<a class="related-page-card page-link" type="link"
data-theme="${a}"
onPointerEnterCapture="${n}"
onPointerLeaveCapture="${s}"
href="/${e}/${C(t)}"
rel="${e===scrapbox.Project.name?"route":"noopner noreferrer"}"
target="${e!==scrapbox.Project.name?"_blank":""}">
<div class="hover" />
<div class="content">
<div class="header">
<div class="title">${t}</div>
</div>
${o?i<div class="thumbnail"><img src="${o}"/></div>:i`<div class="description">
${c.flatMap((p,f)=>p.type==="line"?[i`<p key="${f}">
${p.nodes.map(l=>i<${ut} node="${l}" project="${e}" />)}
</>`]:[])}
</div>`}
</div>
</a>
},ut=({node:e,project:t})=>{switch(e.type){case"code":return i<code>${e.text}</code>;case"formula":return i<${xo} node="${e}" />;case"commmandLine":return i<code>${e.symbol} ${e.text}</code>;case"helpfeel":return i<code>? ${e.text}</code>;case"quote":case"strong":case"decoration":return e.nodes.map(r=>i<${ut} node="${r}" project="${t}" />);case"googleMap":case"image":case"strongImage":return i;case"icon":case"strongIcon":return i<${yo} node="${e}" project="${t}" />;case"hashTag":return i<${ko} node="${e}" project="${t}" />;case"link":return i<${wo} node="${e}" project="${t}" />;case"plain":case"blank":return i${e.text}}},xo=({node:{formula:e}})=>{let{ref:t,error:r,setFormula:o}=ee("");return o(e),i
<span class="formula${r?" error":""}">
${!r&&i<span class="katex-display" ref="${t}"/>}
</span>},yo=({node:{pathType:e,path:t},project:r})=>{let o=e==="relative"?r:t.match(/\/([\w\-]+)/)[1],a=e==="relative"?t:t.match(/\/[\w\-]+\/(.+)$/)[1];return i<img class="icon" src="/api/pages/${o}/${C(a)}/icon" />},ko=({node:{href:e},project:t})=>i<span class="page-link">#${e}</span>,wo=({node:{pathType:e,href:t,content:r},project:o})=>e!=="absolute"?i<span class="page-link">${t}</span>:i<span class="link">${r||t}</span>,ft=
--card-title-bg: hsl(0, 0%, 39%);
}
--card-title-bg: hsl(0, 0%, 89%);
}
--card-title-bg: hsl(53, 8%, 58%);
}
--card-title-bg: hsl(203, 42%, 17%);
}
--card-title-bg: hsl(227, 68%, 62%);
}
--card-title-bg: hsl(267, 39%, 60%);
}
--card-title-bg: hsl(136, 29%, 50%);
}
--card-title-bg: hsl(43, 71%, 51%);
}
--card-title-bg: hsl(4, 58%, 56%);
}
--card-title-bg: hsl(72, 64%, 57%);
}
--card-title-bg: hsl(331, 21%, 26%);
}
--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,0.23));
}
.related-page-card:focus {
outline: 0;
box-shadow: 0 0px 0px 3px rgba(102,175,233,0.6);
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.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,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,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%;
text-overflow: ellipsis;
border-top: var(--card-title-bg, #f2f2f3) solid 10px; padding: 8px 10px;
}
.related-page-card .content .header .title {
font-size: 11px; /* 14 * 0.8 */
line-height: 16px; /* 20 * 0.8 */
font-weight: bold;
max-height: 48px; /* 60 * 0.8 */
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; /* 20 * 0.8 */
padding: 8px 10px 0;
font-size: 10px; /* 12 * 0.8 */
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%;
background-color: var(--code-bg, rgba(0,0,0,0.04));
padding: 0;
white-space: pre-wrap;
word-wrap: break-word;
}
.related-page-card .content .description .icon {
height: 9px; /* 11 * 0.8 */
vertical-align: middle;
}
.related-page-card .content .description .page-link {
background-color: transparent;
text-decoration: none;
cursor: pointer;
}
;function ht({expired:e=60,whiteList:t=[]}={}){let[r,o]=L({}),[a,n]=L([]),s=M(()=>[...new Set([scrapbox.Project.name,...t])],[t]),c=j(async(u,d)=>{let h=_t(u,d),_=new Date().getTime()/1e3,$=!0;if(o(g=>($=(g[h]?.checked??0)+e<_,g[h]={project:u,titleLc:d,loading:$,lines:g[h]?.lines??[],linked:g[h]?.linked??[],checked:_},{...g})),!$)return;let b;try{b=await jo(u,d)}catch(g){console.error(g)}finally{o(g=>(g[h]={project:u,titleLc:d,loading:!1,lines:b?.lines??g[h]?.lines??[],linked:b?.linked??g[h]?.linked??[],checked:g[h]?.checked??_},{...g}))}},[e]),p=j(async(u,d)=>{if(!!s.includes(u))for(let h of s)await c(h,d)},[c,s]),f=j((u,d,h,_)=>{!s.includes(d)||n($=>{let b=s.map(g=>_t(g,h));return[...$.slice(0,u),{ids:b,position:_}]})},[s]),l=j(u=>n(d=>[...d.slice(0,u)]),[]);return{cards:M(()=>{let u=[{project:scrapbox.Project.name,titleLc:C(scrapbox.Page.title??"")}];return a.flatMap(({ids:d,position:h})=>{let _=d.flatMap(x=>r[x]?[r[x]]:[]),{project:$,titleLc:b,lines:g}=_.find(x=>x.lines.length>0)??_[0],P=_.flatMap(({project:x,linked:N})=>N.map(S=>({...S,project:x}))),y={project:$,titleLc:b,position:h,lines:b===u[0].titleLc?[]:g,linked:P.flatMap(({project:x,title:N,...S})=>u.some(w=>w.project===x&&w.titleLc===C(N))?[]:[{project:x,title:N,...S}]),loading:_.every(({loading:x})=>x)};return u.push({project:$,titleLc:b}),y.lines.length>0||y.linked.length>0?[y]:[]})},[r,a]),cache:p,show:f,hide:l}}function _t(e,t){return/${e}/${t}}async function jo(e,t){let r=await fetch(/api/pages/${e}/${t});if(!r.ok)return{};let o=await r.json();if(!o.lines)return{};let{lines:a,links:n,relatedPages:{links1hop:s}}=o,c=n.map(f=>C(f)),p=s.flatMap(({title:f,descriptions:l,image:v})=>c.includes(C(f))?[]:[{title:f,descriptions:l,image:v}]);return{lines:a.slice(1),linked:p}}function ae(e,t,r,o){R(()=>(e.addEventListener(t,r,o),()=>e.removeEventListener(t,r,o)),[e,r,o,t])}var de="default-light";function mt(){let[e,t]=L({}),r=j(a=>{e[a]||a!==scrapbox.Project.name&&(async()=>{t(n=>(n[a]=de,{...n}));try{let n=await fetch(/api/projects/${a}),{theme:s}=await n.json();t(c=>(c[a]=s??de,{...c}))}catch(n){}})()},[e]);return{getTheme:j(a=>a===scrapbox.Project.name?document.documentElement.dataset.projectTheme:e[a]??de,[e]),loadTheme:r}}var bt=(e,t,r)=>R(()=>{let o=new MutationObserver(a=>{o.disconnect(),t(a);for(let n of e)n.current&&o.observe(n.current,r)});for(let a of e)a.current&&o.observe(a.current,r);return()=>o.disconnect()},[]);var gt="scrap-bubble",Co=({delay:e=500,expired:t=60,whiteList:r=[]}={})=>{let{cards:o,cache:a,show:n,hide:s}=ht({expired:t,whiteList:r}),[c,p]=L(null),{getTheme:f,loadTheme:l}=mt(),v=j((h,_)=>{if(!_.matches("a.page-link, .line-title .text"))return;let[$,b,g]=_.classList.contains("page-link")?_.href.match(/\/([\w\-]+)\/([^#]*)/)??["","",""]:["",scrapbox.Project.name,scrapbox.Page.title];if(b==="")return;let P=C(decodeURIComponent(g));l(b),a(b,P),p(y=>(clearTimeout(y),setTimeout(()=>{let{top:x,right:N,left:S,bottom:w}=_.getBoundingClientRect(),z=document.getElementById("editor").getBoundingClientRect(),vt=(S-z.left)/z.width>.5;n(h,b,P,{top:Math.round(w-z.top),bottom:Math.round(z.bottom-x),...vt?{right:Math.round(z.right-N)}:{left:Math.round(S-z.left)}})},e)))},[a,n,l]),u=j(({target:h})=>{!h.matches("a.page-link, .line-title .text")||p(_=>(clearTimeout(_),null))},[]),d=document.getElementById("editor");return ae(d,"pointerenter",({target:h})=>v(0,h),{capture:!0}),ae(d,"pointerleave",u,{capture:!0}),ae(document,"click",({target:h})=>{h.dataset.userscriptName!==gt&&s(0)},{capture:!0}),bt([{current:document.getElementsByClassName("page-wrapper")[0]}],([{target:h}])=>{h.classList.contains("enter")||s(0)},{attributes:!0,attributeFilter:["class"]}),i
<style>
* {box-sizing: border-box;}
${ct}
${pt}
${ft}
</style>
${o.map(({project:h,titleLc:_,lines:$,position:{top:b,left:g,bottom:P,right:y},linked:x,loading:N},S)=>i`<${O} key="/${h}/${_}/">
<${lt}
project="${h}" titleLc="${_}"
theme="${f(h)}"
style="top: ${b}px; ${g?left: ${g}:right: ${y}}px;"
lines="${$}"
loading="${N}"
onPointerEnterCapture="${({target:w})=>v(S+1,w)}"
onPointerLeaveCapture="${u}"
onClick="${()=>s(S+1)}"
hasChild="${o.length>S+1}" />
<${it}
loading="${N}"
style="bottom: ${P}px; ${g?left: ${g}:right: ${y}}px;"
onClickCapture="${({target:w})=>w.tagName!=="A"&&s(S+1)}"
hasChild="${o.length>S+1}">
${x.map(w=>i`
<${dt}
key="/${w.project}/${w.title}"
project="${w.project}" title="${w.title}"
theme="${f(w.project)}"
descriptions="${w.descriptions}" thumbnail="${w.image}"
onPointerEnterCapture="${({target:z})=>v(S+1,z)}"
onPointerLeaveCapture="${u}" />
`)}
<//>
<//>`)}
};function Un({delay:e=500,expired:t=60,whiteList:r=[]}={}){let o=document.createElement("div");o.dataset.userscriptName=gt,document.getElementById("editor").append(o),o.attachShadow({mode:"open"}),Ce(i<${Co} delay="${e}" expired="${t}" whiteList="${r}"/>`,o.shadowRoot)}export{Co as App,Un as mount};