Urara-Blog/build/_app/immutable/chunks/post_layout-9085e57e.js
2022-08-14 01:14:53 +08:00

1 line
14 KiB
JavaScript

import{S as C,i as D,s as N,a as M,e as z,c as q,b as y,f as h,t as _,h as f,l as p,r as ue,m as b,n as v,u as de,p as d,I as U,G as O,J as he,E as j,g as J,d as K,H as re,w as S,x as L,y as P,B as x,o as se,Y as me,K as Q,L as W,M as Y,P as oe,Q as ae,R as ie,T as ce}from"./index-cd58b8d1.js";import{t as _e}from"./posts-c52cb603.js";import{f as G}from"./title-765c989f.js";import{P as ge}from"./post_card-e7f4525a.js";import{H as pe}from"./head-4a058b17.js";import{s as B}from"./icon-3aa13b39.js";import{F as be}from"./footer-1abd9501.js";function X(o,e,r){const n=o.slice();return n[6]=e[r],n}function ve(o){let e,r,n,t;return{c(){e=p("span"),r=ue(o[0]),this.h()},l(s){e=b(s,"SPAN",{dir:!0,id:!0,class:!0});var l=v(e);r=de(l,o[0]),l.forEach(f),this.h()},h(){d(e,"dir","ltr"),d(e,"id",`toc-link-${o[1]}`),d(e,"class","cursor-pointer border-l-4 border-transparent transition-all hover:border-primary hover:bg-base-content hover:bg-opacity-10 active:bg-primary active:text-primary-content active:font-bold pr-4 "+(o[2]<=2?"py-3":"py-2")),U(e,"pl-4",o[2]<=2),U(e,"pl-8",o[2]===3),U(e,"pl-12",o[2]===4),U(e,"pl-16",o[2]===5),U(e,"pl-20",o[2]===6)},m(s,l){y(s,e,l),O(e,r),n||(t=he(e,"click",o[5]),n=!0)},p:j,d(s){s&&f(e),n=!1,t()}}}function ye(o){let e,r,n=o[3],t=[];for(let l=0;l<n.length;l+=1)t[l]=Z(X(o,n,l));const s=l=>_(t[l],1,1,()=>{t[l]=null});return{c(){e=p("ul");for(let l=0;l<t.length;l+=1)t[l].c();this.h()},l(l){e=b(l,"UL",{dir:!0,id:!0});var a=v(e);for(let i=0;i<t.length;i+=1)t[i].l(a);a.forEach(f),this.h()},h(){var l;d(e,"dir","ltr"),d(e,"id",`toc-list-${(l=o[1])!=null?l:"root"}`)},m(l,a){y(l,e,a);for(let i=0;i<t.length;i+=1)t[i].m(e,null);r=!0},p(l,a){if(a&8){n=l[3];let i;for(i=0;i<n.length;i+=1){const u=X(l,n,i);t[i]?(t[i].p(u,a),h(t[i],1)):(t[i]=Z(u),t[i].c(),h(t[i],1),t[i].m(e,null))}for(J(),i=n.length;i<t.length;i+=1)s(i);K()}},i(l){if(!r){for(let a=0;a<n.length;a+=1)h(t[a]);r=!0}},o(l){t=t.filter(Boolean);for(let a=0;a<t.length;a+=1)_(t[a]);r=!1},d(l){l&&f(e),re(t,l)}}}function Z(o){let e,r,n,t;return r=new fe({props:{toc:o[6]}}),{c(){e=p("li"),S(r.$$.fragment),n=M(),this.h()},l(s){e=b(s,"LI",{id:!0,class:!0});var l=v(e);L(r.$$.fragment,l),n=q(l),l.forEach(f),this.h()},h(){d(e,"id",`toc-item-${o[6].slug}`),d(e,"class","flex flex-col")},m(s,l){y(s,e,l),P(r,e,null),O(e,n),t=!0},p:j,i(s){t||(h(r.$$.fragment,s),t=!0)},o(s){_(r.$$.fragment,s),t=!1},d(s){s&&f(e),x(r)}}}function we(o){let e,r,n,t=o[0]&&ve(o),s=o[3]&&ye(o);return{c(){t&&t.c(),e=M(),s&&s.c(),r=z()},l(l){t&&t.l(l),e=q(l),s&&s.l(l),r=z()},m(l,a){t&&t.m(l,a),y(l,e,a),s&&s.m(l,a),y(l,r,a),n=!0},p(l,[a]){l[0]&&t.p(l,a),l[3]&&s.p(l,a)},i(l){n||(h(s),n=!0)},o(l){_(s),n=!1},d(l){t&&t.d(l),l&&f(e),s&&s.d(l),l&&f(r)}}}function $e(o,e,r){let{toc:n}=e;const{title:t,slug:s,depth:l,children:a}=n,i=()=>document.getElementById(s).scrollIntoView({behavior:"smooth"});return o.$$set=u=>{"toc"in u&&r(4,n=u.toc)},[t,s,l,a,n,i]}class fe extends C{constructor(e){super(),D(this,e,$e,we,N,{toc:4})}}function Ee(o){let e,r,n,t;return n=new fe({props:{toc:o[0].reduce(ee,{depth:o[0][0].depth-1,children:[]})}}),{c(){e=p("aside"),r=p("nav"),S(n.$$.fragment),this.h()},l(s){e=b(s,"ASIDE",{class:!0});var l=v(e);r=b(l,"NAV",{id:!0,"aria-label":!0,dir:!0,class:!0});var a=v(r);L(n.$$.fragment,a),a.forEach(f),l.forEach(f),this.h()},h(){d(r,"id","post-toc"),d(r,"aria-label","TableOfContent"),d(r,"dir","rtl"),d(r,"class","max-h-[calc(100vh-12rem)] overflow-y-hidden hover:overflow-y-auto"),d(e,"class","sticky top-16 py-8")},m(s,l){y(s,e,l),O(e,r),P(n,r,null),t=!0},p(s,[l]){const a={};l&1&&(a.toc=s[0].reduce(ee,{depth:s[0][0].depth-1,children:[]})),n.$set(a)},i(s){t||(h(n.$$.fragment,s),t=!0)},o(s){_(n.$$.fragment,s),t=!1},d(s){s&&f(e),x(n)}}}const ee=(o,e)=>{var n;let r=o;for(;r.depth+1<e.depth;)r=r.children.at(-1);return r.children=[...(n=r.children)!=null?n:[],{...e,children:[]}],o};function ke(o,e,r){let{toc:n}=e,t=[],s=!0,l=[];return se(()=>{if(window.screen.availWidth>=1280){const a=new IntersectionObserver(u=>u.forEach($=>$.isIntersecting?t.push($.target.id):r(1,t=t.filter(A=>A!==$.target.id))),{rootMargin:"-64px 0px 0px 0px"}),i=new IntersectionObserver(u=>r(2,s=u[0].isIntersecting));Array.from(document.querySelectorAll("main h2, main h3, main h4, main h5, main h6")).forEach(u=>a.observe(u)),i.observe(document.getElementsByTagName("main")[0])}}),me(()=>{typeof headingsObserver<"u"&&headingsObserver.disconnect(),typeof headingsObserver<"u"&&articleObserver.disconnect()}),o.$$set=a=>{"toc"in a&&r(0,n=a.toc)},o.$$.update=()=>{o.$$.dirty&2&&t.length>0&&r(3,l=t),o.$$.dirty&4&&s===!1&&r(3,l=[]),o.$$.dirty&9&&l&&n.forEach(a=>{var i,u;return l.includes(a.slug)?(i=document.getElementById(`toc-link-${a.slug}`))==null?void 0:i.classList.add("!border-accent"):(u=document.getElementById(`toc-link-${a.slug}`))==null?void 0:u.classList.remove("!border-accent")})},[n,t,s,l]}class Oe extends C{constructor(e){super(),D(this,e,ke,Ee,N,{toc:0})}}function Ie(o){let e,r;return{c(){e=p("a"),r=p("span"),this.h()},l(n){e=b(n,"A",{href:!0,class:!0});var t=v(e);r=b(t,"SPAN",{class:!0}),v(r).forEach(f),t.forEach(f),this.h()},h(){d(r,"class","i-heroicons-outline-chat-alt-2"),d(e,"href","#post-comment"),d(e,"class","btn btn-lg btn-circle btn-ghost bg-base-100 shadow-lg hover:shadow-xl")},m(n,t){y(n,e,t),O(e,r)},p:j,i:j,o:j,d(n){n&&f(e)}}}class Se extends C{constructor(e){super(),D(this,e,null,Ie,N,{})}}const Pe=Object.freeze(Object.defineProperty({__proto__:null,default:Se},Symbol.toStringTag,{value:"Module"}));function xe(o){let e,r,n;return{c(){e=p("a"),r=p("span"),this.h()},l(t){e=b(t,"A",{href:!0,class:!0});var s=v(e);r=b(s,"SPAN",{class:!0}),v(r).forEach(f),s.forEach(f),this.h()},h(){d(r,"class","i-heroicons-outline-translate"),d(e,"href",n=`https://translate.google.com/translate?sl=auto&tl=${navigator.languages?navigator.languages[0]:navigator.language}&u=${B.protocol+B.domain+o[0].path}`),d(e,"class","btn btn-lg btn-circle btn-ghost bg-base-100 shadow-lg hover:shadow-xl")},m(t,s){y(t,e,s),O(e,r)},p(t,[s]){s&1&&n!==(n=`https://translate.google.com/translate?sl=auto&tl=${navigator.languages?navigator.languages[0]:navigator.language}&u=${B.protocol+B.domain+t[0].path}`)&&d(e,"href",n)},i:j,o:j,d(t){t&&f(e)}}}function Ae(o,e,r){let{post:n}=e;return o.$$set=t=>{"post"in t&&r(0,n=t.post)},[n]}class je extends C{constructor(e){super(),D(this,e,Ae,xe,N,{post:0})}}const Le=Object.freeze(Object.defineProperty({__proto__:null,default:je},Symbol.toStringTag,{value:"Module"}));function Te(o){let e,r,n;return{c(){e=p("a"),r=p("span"),this.h()},l(t){e=b(t,"A",{href:!0,class:!0});var s=v(e);r=b(s,"SPAN",{class:!0}),v(r).forEach(f),s.forEach(f),this.h()},h(){var t;d(r,"class","i-heroicons-outline-share"),d(e,"href",n=`https://www.addtoany.com/share#url=${B.protocol+B.domain+o[0].path}&title=${encodeURI((t=o[0].title)!=null?t:o[0].path.slice(1))}`),d(e,"class","btn btn-lg btn-circle btn-ghost bg-base-100 shadow-lg hover:shadow-xl")},m(t,s){y(t,e,s),O(e,r)},p(t,[s]){var l;s&1&&n!==(n=`https://www.addtoany.com/share#url=${B.protocol+B.domain+t[0].path}&title=${encodeURI((l=t[0].title)!=null?l:t[0].path.slice(1))}`)&&d(e,"href",n)},i:j,o:j,d(t){t&&f(e)}}}function Be(o,e,r){let{post:n}=e;return o.$$set=t=>{"post"in t&&r(0,n=t.post)},[n]}class Ce extends C{constructor(e){super(),D(this,e,Be,Te,N,{post:0})}}const De=Object.freeze(Object.defineProperty({__proto__:null,default:Ce},Symbol.toStringTag,{value:"Module"}));function te(o,e,r){const n=o.slice();return n[2]=e[r],n}function Ne(o){let e,r,n=Object.values(o[1]),t=[];for(let l=0;l<n.length;l+=1)t[l]=ne(te(o,n,l));const s=l=>_(t[l],1,1,()=>{t[l]=null});return{c(){for(let l=0;l<t.length;l+=1)t[l].c();e=z()},l(l){for(let a=0;a<t.length;a+=1)t[a].l(l);e=z()},m(l,a){for(let i=0;i<t.length;i+=1)t[i].m(l,a);y(l,e,a),r=!0},p(l,a){if(a&3){n=Object.values(l[1]);let i;for(i=0;i<n.length;i+=1){const u=te(l,n,i);t[i]?(t[i].p(u,a),h(t[i],1)):(t[i]=ne(u),t[i].c(),h(t[i],1),t[i].m(e.parentNode,e))}for(J(),i=n.length;i<t.length;i+=1)s(i);K()}},i(l){if(!r){for(let a=0;a<n.length;a+=1)h(t[a]);r=!0}},o(l){t=t.filter(Boolean);for(let a=0;a<t.length;a+=1)_(t[a]);r=!1},d(l){re(t,l),l&&f(e)}}}function ne(o){let e,r,n;var t=o[2].default;function s(l){return{props:{post:l[0]}}}return t&&(e=new t(s(o))),{c(){e&&S(e.$$.fragment),r=z()},l(l){e&&L(e.$$.fragment,l),r=z()},m(l,a){e&&P(e,l,a),y(l,r,a),n=!0},p(l,a){const i={};if(a&1&&(i.post=l[0]),t!==(t=l[2].default)){if(e){J();const u=e;_(u.$$.fragment,1,0,()=>{x(u,1)}),K()}t?(e=new t(s(l)),S(e.$$.fragment),h(e.$$.fragment,1),P(e,r.parentNode,r)):e=null}else t&&e.$set(i)},i(l){n||(e&&h(e.$$.fragment,l),n=!0)},o(l){e&&_(e.$$.fragment,l),n=!1},d(l){l&&f(r),e&&x(e,l)}}}function Ve(o){let e,r=Object.keys(o[1]).length,n,t=r&&Ne(o);return{c(){e=p("div"),t&&t.c(),this.h()},l(s){e=b(s,"DIV",{class:!0});var l=v(e);t&&t.l(l),l.forEach(f),this.h()},h(){d(e,"class","sticky top-24 hidden xl:flex flex-col gap-4 w-fit h-[calc(100vh-12rem)] ml-auto mr-8 my-8 justify-center")},m(s,l){y(s,e,l),t&&t.m(e,null),n=!0},p(s,[l]){r&&t.p(s,l)},i(s){n||(h(t),n=!0)},o(s){_(t),n=!1},d(s){s&&f(e),t&&t.d()}}}function Re(o,e,r){let{post:n}=e;const t=Object.assign({"/src/lib/components/actions/1-reply.svelte":Pe,"/src/lib/components/actions/2-translate.svelte":Le,"/src/lib/components/actions/3-share.svelte":De});return o.$$set=s=>{"post"in s&&r(0,n=s.post)},[n,t]}class Me extends C{constructor(e){super(),D(this,e,Re,Ve,N,{post:0})}}const qe=()=>{const o=document.querySelectorAll("pre"),e="Copy",r="Copied!",n=async(t,s)=>{const l=document.createRange(),a=t.childNodes.length;l.setStart(t,2),l.setEnd(t,a);const i=window.getSelection();!i||(i.removeAllRanges(),i.addRange(l),document.execCommand("copy",!1),!(async()=>navigator.clipboard.writeText(i.toString())))||(s.textContent=r,setTimeout(()=>{s.textContent=e},1e3),i.removeRange(l))};o.forEach(t=>{const s=document.createElement("button");s.textContent=e,s.classList.add("btn","btn-secondary","btn-xs","absolute","right-2","top-3","hidden"),t.prepend(s),t.addEventListener("mouseenter",()=>{s.classList.remove("hidden")}),t.addEventListener("mouseleave",()=>{s.classList.add("hidden")}),s.addEventListener("click",l=>{l.preventDefault(),n(t,s)})})};function ze(o){let e,r;return e=new Me({props:{post:o[0]}}),{c(){S(e.$$.fragment)},l(n){L(e.$$.fragment,n)},m(n,t){P(e,n,t),r=!0},p(n,t){const s={};t&1&&(s.post=n[0]),e.$set(s)},i(n){r||(h(e.$$.fragment,n),r=!0)},o(n){_(e.$$.fragment,n),r=!1},d(n){x(e,n)}}}function le(o){let e,r,n;return r=new Oe({props:{toc:o[0].toc}}),{c(){e=p("div"),S(r.$$.fragment),this.h()},l(t){e=b(t,"DIV",{class:!0});var s=v(e);L(r.$$.fragment,s),s.forEach(f),this.h()},h(){d(e,"class","h-full hidden xl:block")},m(t,s){y(t,e,s),P(r,e,null),n=!0},p(t,s){const l={};s&1&&(l.toc=t[0].toc),r.$set(l)},i(t){n||(h(r.$$.fragment,t),n=!0)},o(t){_(r.$$.fragment,t),n=!1},d(t){t&&f(e),x(r)}}}function He(o){let e;const r=o[1].default,n=oe(r,o,o[2],null);return{c(){n&&n.c()},l(t){n&&n.l(t)},m(t,s){n&&n.m(t,s),e=!0},p(t,s){n&&n.p&&(!e||s&4)&&ae(n,r,t,t[2],e?ce(r,t[2],s,null):ie(t[2]),null)},i(t){e||(h(n,t),e=!0)},o(t){_(n,t),e=!1},d(t){n&&n.d(t)}}}function Ue(o){let e,r,n,t,s,l,a,i,u,$,A,E,k,V,I,T;e=new pe({props:{post:o[0]}});let w=ze(o),m=o[0].toc&&le(o);return k=new ge({props:{post:o[0],$$slots:{default:[He]},$$scope:{ctx:o}}}),I=new be({props:{sticky:!0}}),{c(){S(e.$$.fragment),r=M(),n=p("div"),t=p("div"),w&&w.c(),a=M(),i=p("div"),m&&m.c(),A=M(),E=p("div"),S(k.$$.fragment),V=M(),S(I.$$.fragment),this.h()},l(c){L(e.$$.fragment,c),r=q(c),n=b(c,"DIV",{class:!0});var g=v(n);t=b(g,"DIV",{class:!0});var H=v(t);w&&w.l(H),H.forEach(f),a=q(g),i=b(g,"DIV",{class:!0});var R=v(i);m&&m.l(R),R.forEach(f),A=q(g),E=b(g,"DIV",{class:!0});var F=v(E);L(k.$$.fragment,F),V=q(F),L(I.$$.fragment,F),F.forEach(f),g.forEach(f),this.h()},h(){d(t,"class","flex-1 w-full max-w-screen-md order-first ease-out transform mx-auto xl:mr-0"),d(i,"class","flex-1 w-full max-w-screen-md xl:order-last ease-out transform mx-auto xl:mr-0"),d(E,"class","flex-none w-full max-w-screen-md mx-auto xl:mx-0"),d(n,"class","flex flex-col flex-nowrap justify-center xl:flex-row xl:flex-wrap")},m(c,g){P(e,c,g),y(c,r,g),y(c,n,g),O(n,t),w&&w.m(t,null),O(n,a),O(n,i),m&&m.m(i,null),O(n,A),O(n,E),P(k,E,null),O(E,V),P(I,E,null),T=!0},p(c,[g]){const H={};g&1&&(H.post=c[0]),e.$set(H),w.p(c,g),c[0].toc?m?(m.p(c,g),g&1&&h(m,1)):(m=le(c),m.c(),h(m,1),m.m(i,null)):m&&(J(),_(m,1,1,()=>{m=null}),K());const R={};g&1&&(R.post=c[0]),g&4&&(R.$$scope={dirty:g,ctx:c}),k.$set(R)},i(c){T||(h(e.$$.fragment,c),h(w),Q(()=>{l&&l.end(1),s=W(t,G,{x:25,duration:300,delay:500}),s.start()}),h(m),Q(()=>{$&&$.end(1),u=W(i,G,{x:-25,duration:300,delay:500}),u.start()}),h(k.$$.fragment,c),h(I.$$.fragment,c),T=!0)},o(c){_(e.$$.fragment,c),_(w),s&&s.invalidate(),l=Y(t,G,{x:25,duration:300}),_(m),u&&u.invalidate(),$=Y(i,G,{x:-25,duration:300}),_(k.$$.fragment,c),_(I.$$.fragment,c),T=!1},d(c){x(e,c),c&&f(r),c&&f(n),w&&w.d(),c&&l&&l.end(),m&&m.d(),c&&$&&$.end(),x(k),x(I)}}}function Fe(o,e,r){let{$$slots:n={},$$scope:t}=e,{post:s}=e;return se(()=>{qe()}),o.$$set=l=>{"post"in l&&r(0,s=l.post),"$$scope"in l&&r(2,t=l.$$scope)},[s,n,t]}class Ge extends C{constructor(e){super(),D(this,e,Fe,Ue,N,{post:0})}}function Je(o){let e;const r=o[13].default,n=oe(r,o,o[14],null);return{c(){n&&n.c()},l(t){n&&n.l(t)},m(t,s){n&&n.m(t,s),e=!0},p(t,s){n&&n.p&&(!e||s&16384)&&ae(n,r,t,t[14],e?ce(r,t[14],s,null):ie(t[14]),null)},i(t){e||(h(n,t),e=!0)},o(t){_(n,t),e=!1},d(t){n&&n.d(t)}}}function Ke(o){let e,r;return e=new Ge({props:{post:o[0],$$slots:{default:[Je]},$$scope:{ctx:o}}}),{c(){S(e.$$.fragment)},l(n){L(e.$$.fragment,n)},m(n,t){P(e,n,t),r=!0},p(n,[t]){const s={};t&16384&&(s.$$scope={dirty:t,ctx:n}),e.$set(s)},i(n){r||(h(e.$$.fragment,n),r=!0)},o(n){_(e.$$.fragment,n),r=!1},d(n){x(e,n)}}}function Qe(o,e,r){let{$$slots:n={},$$scope:t}=e,{path:s}=e,{slug:l}=e,{toc:a}=e,{created:i}=e,{updated:u}=e,{published:$}=e,{summary:A}=e,{tags:E}=e,{flags:k}=e,{title:V}=e,{image:I}=e,{in_reply_to:T}=e,w={path:s,slug:l,toc:a,created:i,updated:u,published:$,summary:A,tags:E,flags:k,title:V,image:I,in_reply_to:T},m={type:_e(w),...w};return o.$$set=c=>{"path"in c&&r(1,s=c.path),"slug"in c&&r(2,l=c.slug),"toc"in c&&r(3,a=c.toc),"created"in c&&r(4,i=c.created),"updated"in c&&r(5,u=c.updated),"published"in c&&r(6,$=c.published),"summary"in c&&r(7,A=c.summary),"tags"in c&&r(8,E=c.tags),"flags"in c&&r(9,k=c.flags),"title"in c&&r(10,V=c.title),"image"in c&&r(11,I=c.image),"in_reply_to"in c&&r(12,T=c.in_reply_to),"$$scope"in c&&r(14,t=c.$$scope)},[m,s,l,a,i,u,$,A,E,k,V,I,T,n,t]}class lt extends C{constructor(e){super(),D(this,e,Qe,Ke,N,{path:1,slug:2,toc:3,created:4,updated:5,published:6,summary:7,tags:8,flags:9,title:10,image:11,in_reply_to:12})}}export{lt as P};