valaxy 0.7.5 → 0.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,181 +0,0 @@
1
- import * as vue from 'vue';
2
- import { InjectionKey, ComputedRef, Ref } from 'vue';
3
- import { V as ValaxyConfig, b as ValaxyThemeConfig, P as PageData, f as Post } from '../index-cfcea95c.js';
4
- import { ViteSSGContext } from 'vite-ssg';
5
- import { Awaitable } from '@antfu/utils';
6
- import { VitePluginConfig } from 'unocss/vite';
7
- import '@vitejs/plugin-vue';
8
- import 'unplugin-vue-components/vite';
9
- import 'type-fest';
10
- import 'markdown-it';
11
- import 'shiki';
12
- import 'markdown-it-anchor';
13
- import 'katex';
14
-
15
- interface ValaxyContext {
16
- userRoot: string;
17
- }
18
- declare const valaxyConfigSymbol: InjectionKey<ComputedRef<ValaxyConfig>>;
19
- declare const valaxyConfigRef: vue.ShallowRef<ValaxyConfig<ValaxyThemeConfig>>;
20
- declare const valaxyContextRef: vue.ShallowRef<ValaxyContext>;
21
- declare function initConfig(): ComputedRef<ValaxyConfig<ValaxyThemeConfig>>;
22
- declare function initContext(): ComputedRef<ValaxyContext>;
23
- declare function useConfig<ThemeConfig = any>(): ComputedRef<ValaxyConfig<ThemeConfig>>;
24
- interface ValaxyData<T = any> {
25
- page: Ref<PageData>;
26
- theme: Ref<T>;
27
- }
28
-
29
- interface BaseCategory {
30
- total: number;
31
- }
32
- interface ParentCategory extends BaseCategory {
33
- children: Categories;
34
- }
35
- interface PostCategory extends BaseCategory {
36
- posts: Post[];
37
- }
38
- declare type Category = ParentCategory | PostCategory;
39
- declare type Categories = Map<string, Category>;
40
- declare const isParentCategory: (category: any) => category is ParentCategory;
41
- /**
42
- * get categories from posts
43
- * @returns
44
- */
45
- declare function useCategory(category?: string, posts?: Post[]): ParentCategory;
46
-
47
- declare const usePostTitle: (post: Ref<Post>) => vue.ComputedRef<any>;
48
- /**
49
- * get post list
50
- * todo: use vue provide/inject to global
51
- * @param params
52
- * @returns
53
- */
54
- declare function usePostList(params?: {
55
- type?: string;
56
- }): vue.ComputedRef<Post[]>;
57
- /**
58
- * get all page
59
- * @returns
60
- */
61
- declare function usePageList(): vue.ComputedRef<any[]>;
62
- /**
63
- * get prev and next post
64
- * @param path
65
- * @returns
66
- */
67
- declare function usePrevNext(path?: string): vue.ComputedRef<Post | null>[];
68
-
69
- declare type Tags = Map<string, {
70
- count: number;
71
- }>;
72
- /**
73
- * get utils about tags
74
- */
75
- declare function useTags(options?: {
76
- /**
77
- * Primary Color
78
- */
79
- primary: string;
80
- }): {
81
- tags: Tags;
82
- getTagStyle: (count: number) => {
83
- '--yun-tag-color': string;
84
- fontSize: string;
85
- };
86
- };
87
- /**
88
- * get tag map
89
- * @returns
90
- */
91
- declare function useTag(): Tags;
92
-
93
- declare function useFrontmatter(): vue.ComputedRef<Post>;
94
- /**
95
- * get full url
96
- */
97
- declare function useFullUrl(): vue.ComputedRef<string>;
98
-
99
- /**
100
- * trigger show invisible element
101
- * @param target
102
- * @returns
103
- */
104
- declare function useInvisibleElement(target: Ref<HTMLElement>): {
105
- show: () => void;
106
- };
107
-
108
- declare const isDark: vue.WritableComputedRef<boolean>;
109
- declare const toggleDark: (value?: boolean | undefined) => boolean;
110
-
111
- declare function useLayout(layout: string): vue.ComputedRef<boolean>;
112
-
113
- /**
114
- * use MetingJS and Aplayer
115
- * https://github.com/MoePlayer/APlayer
116
- * https://github.com/metowolf/MetingJS
117
- */
118
- declare function useAplayer(): void;
119
-
120
- /**
121
- * You can use href="#" to back to top
122
- * @description 你可以使用它来编写自己的 backToTop
123
- */
124
- declare function useBackToTop(options?: {
125
- /**
126
- * show backToTop button, when height > offset
127
- */
128
- offset: number;
129
- }): {
130
- percentage: vue.Ref<number>;
131
- show: vue.Ref<boolean>;
132
- } | {
133
- percentage: vue.ComputedRef<number>;
134
- show: vue.ComputedRef<boolean>;
135
- };
136
-
137
- declare function useCodePen(): void;
138
-
139
- declare function useActiveSidebarLinks(container: Ref<HTMLElement>, marker: Ref<HTMLElement>): void;
140
-
141
- declare function useTwikoo(options?: {}): void;
142
-
143
- declare function useWaline(options?: {}): any;
144
-
145
- /**
146
- * 生成介于 min 与 max 之间的随机数
147
- * @returns
148
- */
149
- declare function random(min: number, max: number): number;
150
- /**
151
- * wrap node
152
- * @param className
153
- */
154
- declare function wrap(el: HTMLElement, className: string): void;
155
- /**
156
- * 包裹表格,添加 class 以控制 table 样式
157
- */
158
- declare const wrapTable: (container?: HTMLElement | Document) => void;
159
- declare function throttleAndDebounce(fn: () => void, delay: number): () => void;
160
-
161
- /**
162
- * use dayjs format date
163
- * @param date
164
- * @param template
165
- * @returns
166
- */
167
- declare function formatDate(date: string | number | Date, template?: string): string;
168
- /**
169
- * sort posts by date
170
- * @param posts
171
- * @param desc
172
- */
173
- declare function sortByDate(posts: Post[], desc?: boolean): Post[];
174
-
175
- declare type AppContext = ViteSSGContext;
176
- declare type AppSetup = (ctx: AppContext) => Awaitable<void>;
177
- declare type UnoSetup = () => Awaitable<Partial<VitePluginConfig> | undefined>;
178
- declare function defineAppSetup(fn: AppSetup): AppSetup;
179
- declare function defineUnoSetup(fn: UnoSetup): UnoSetup;
180
-
181
- export { AppSetup, BaseCategory, Categories, Category, ParentCategory, PostCategory, Tags, UnoSetup, ValaxyData, defineAppSetup, defineUnoSetup, formatDate, initConfig, initContext, isDark, isParentCategory, random, sortByDate, throttleAndDebounce, toggleDark, useActiveSidebarLinks, useAplayer, useBackToTop, useCategory, useCodePen, useConfig, useFrontmatter, useFullUrl, useInvisibleElement, useLayout, usePageList, usePostList, usePostTitle, usePrevNext, useTag, useTags, useTwikoo, useWaline, valaxyConfigRef, valaxyConfigSymbol, valaxyContextRef, wrap, wrapTable };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('../chunk-KRHFRLOW.js');var _config = require('/@valaxyjs/config'); var _config2 = _interopRequireDefault(_config);var _context = require('/@valaxyjs/context'); var _context2 = _interopRequireDefault(_context);var _vue = require('vue');function h(t){let e=JSON.parse(t);return __DEV__?_vue.readonly.call(void 0, e):e}var U=Symbol("valaxy:config"),C= exports.valaxyConfigRef =_vue.shallowRef.call(void 0, h(_config2.default)),w= exports.valaxyContextRef =_vue.shallowRef.call(void 0, h(_context2.default));import.meta.hot&&(import.meta.hot.accept("/@valaxyjs/config",t=>{C.value=h(t.default)}),import.meta.hot.accept("/@valaxyjs/context",t=>{w.value=h(t.default)}));function vt(){return _vue.computed.call(void 0, ()=>C.value)}function Ct(){return _vue.computed.call(void 0, ()=>w.value)}function T(){let t=_vue.inject.call(void 0, U);if(!t)throw new Error("[Valaxy] config not properly injected in app");return t}var _vuerouter = require('vue-router');var _vuei18n = require('vue-i18n');function Tt(t,e){return Math.random()*(e-t)+t}function O(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var bt=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",O(e,"table-container")})};function Pt(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}var _dayjs = require('dayjs'); var _dayjs2 = _interopRequireDefault(_dayjs);function Lt(t,e="YYYY-MM-DD"){return _dayjs2.default.call(void 0, t).format(e)}function y(t,e=!0){return t.sort((o,n)=>{let i=+new Date(o.date||""),r=+new Date(n.date||"");return e?r-i:i-r})}var Ut=t=>{let{locale:e}=_vuei18n.useI18n.call(void 0, );return _vue.computed.call(void 0, ()=>{let o=e.value==="zh-CN"?"zh":e.value;return t.value[`title_${o}`]||t.value.title})};function g(t={}){let e=_vuerouter.useRouter.call(void 0, );return _vue.computed.call(void 0, ()=>{let o=e.getRoutes().filter(r=>r.path.startsWith("/posts")&&r.meta.frontmatter&&r.meta.frontmatter.date).filter(r=>!r.path.endsWith(".html")).filter(r=>!t.type||r.meta.frontmatter.type===t.type).map(r=>Object.assign({path:r.path,excerpt:r.meta.excerpt},r.meta.frontmatter)),n=y(o.filter(r=>r.top)).sort((r,l)=>l.top-r.top),i=y(o.filter(r=>!r.top));return n.concat(i)})}function Ot(){let t=_vuerouter.useRouter.call(void 0, );return _vue.computed.call(void 0, ()=>t.getRoutes().map(o=>Object.assign({path:o.path,excerpt:o.meta.excerpt},o.meta.frontmatter)))}function Bt(t){let e=_vuerouter.useRoute.call(void 0, ),o=_vue.computed.call(void 0, ()=>t||e.path),n=g(),i=_vue.computed.call(void 0, ()=>{let s=-1;return n.value.find((a,u)=>a.path===o.value?(s=u,!0):!1),s}),r=_vue.computed.call(void 0, ()=>i.value-1>=0?n.value[i.value-1]:null),l=_vue.computed.call(void 0, ()=>i.value+1<n.value.length?n.value[i.value+1]:null);return[r,l]}var Nt=t=>t.children;function Wt(t,e=[]){var i;e.length||(e=_vue.unref.call(void 0, g()));let o={total:e.length,children:new Map([["Uncategorized",{total:0,posts:[]}]])},n=o.children.get("Uncategorized");if(e.forEach(r=>{if(r.categories)if(Array.isArray(r.categories)){let l=r.categories.length,s=o;r.categories.forEach((a,u)=>{var p,d,f;if(u===l-1)if(s.children.has(a)){let c=s.children.get(a);c.posts&&(c.total+=1,c.posts.push(r))}else(p=s.children)==null||p.set(a,{total:1,posts:[r]});else if((d=s.children)!=null&&d.has(a)){let c=s.children.get(a);c.total+=1,s=c}else{let c={total:1,children:new Map};(f=s.children)==null||f.set(a,c),s=c}})}else{let l=r.categories;if(o.children.has(l)){let s=o.children.get(l);s.total+=1,s.posts.push(r)}else o.children.set(l,{total:1,posts:[r]})}else n.total+=1,n.posts.push(r)}),n.total===0&&((i=o.children)==null||i.delete("Uncategorized")),t){let r=o.children.get(t);return r?{total:r==null?void 0:r.total,children:new Map([[t,r]])}:(console.warn(`Do not have category: ${t}`),o)}else return o}var _tinycolor = require('@ctrl/tinycolor');function Ft(t={primary:"#0078E7"}){let e=N(),o=new (0, _tinycolor.TinyColor)("#999999"),n=new (0, _tinycolor.TinyColor)(t.primary);return{tags:e,getTagStyle:r=>{let l=Array.from(e).map(([d,f])=>f.count),s=Math.max(...l),a=Math.min(...l),u=s-a,p=(r-a)/u;return{"--yun-tag-color":o.mix(n,p*100).toString(),fontSize:`${p*36+12}px`}}}}function N(){let t=g(),e=new Map;return t.value.forEach(o=>{if(o.tags){let n;typeof o.tags=="string"?n=[o.tags]:n=o.tags,n.forEach(i=>{if(e.has(i)){let r=e.get(i);e.set(i,{...r,count:r.count+1})}else e.set(i,{count:1})})}}),e}var _core = require('@vueuse/core');function Zt(){let t=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>t.meta.frontmatter)}function te(){let t=T(),e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>((t.value.url.endsWith("/")?t.value.url.slice(0,-1):t.value.url)||_core.isClient&&window.location.origin)+e.path)}function ne(t){let e=_vue.ref.call(void 0, !1),{top:o}=_core.useElementBounding.call(void 0, t);return _core.useIntersectionObserver.call(void 0, t,([{isIntersecting:i}])=>{e.value=i}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}var K=_core.useDark.call(void 0, ),ae= exports.toggleDark =_core.useToggle.call(void 0, K);function pe(t){let e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>e.meta.layout===t)}var _head = require('@vueuse/head');function ge(){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"}]}),_core.useScriptTag.call(void 0, "https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js",()=>{_core.useScriptTag.call(void 0, "https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js")})}function ve(t={offset:100}){if(!_core.isClient)return{percentage:_vue.ref.call(void 0, 0),show:_vue.ref.call(void 0, !1)};let{y:e}=_core.useWindowScroll.call(void 0, ),o=_vue.computed.call(void 0, ()=>e.value/(document.body.scrollHeight-window.innerHeight)),n=_vue.computed.call(void 0, ()=>e.value>t.offset);return{percentage:o,show:n}}function Te(){_head.useHead.call(void 0, {script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}function Me(t,e){let o=it(n,200);function n(){let s=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),a=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(u=>s.some(p=>p.hash===u.hash));for(let u=0;u<a.length;u++){let p=a[u],d=a[u+1],[f,c]=nt(u,p,d);if(f){history.replaceState(null,document.title,c||" "),r(c);return}}}let i=null;function r(s){l(i);let a=i=s==null?null:t.value.querySelector(`.va-toc a[href="${s}"]`);e.value&&(a?(a.classList.add("active"),e.value.style.opacity="1",e.value.style.top=`${a.offsetTop+2}px`):(e.value.style.opacity="0",e.value.style.top="54px"))}function l(s){s&&s.classList.remove("active")}_vue.onMounted.call(void 0, ()=>{requestAnimationFrame(n),window.addEventListener("scroll",o)}),_vue.onUnmounted.call(void 0, ()=>{window.removeEventListener("scroll",o)})}function S(t){return t.parentElement.offsetTop-50}function nt(t,e,o){let n=window.scrollY;return t===0&&n===0?[!0,null]:n<S(e)?[!1,null]:!o||n<S(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function it(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}function ke(t={}){let e=_vuerouter.useRoute.call(void 0, ),{locale:o}=_vuei18n.useI18n.call(void 0, );function n(i={}){if(!_core.isClient)return;let r={el:".comment #tcomment",lang:o.value,path:e.path},l=Object.assign(r,i);return window.twikoo.init(l)}_core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/twikoo@1.5.1/dist/twikoo.all.min.js",()=>{n(t)})}function Ie(t={}){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/@waline/client/dist/waline.css"}]});let e=_vuerouter.useRoute.call(void 0, ),{locale:o}=_vuei18n.useI18n.call(void 0, ),n;function i(r={}){if(!_core.isClient)return;let l={el:".comment #waline",lang:o.value,dark:"html.dark",emoji:["https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/qq","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo"],path:e.path},s=Object.assign(l,r);return window.Waline.init(s)}return _core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/@waline/client/dist/waline.js",()=>{n=i(t)}),_vue.watch.call(void 0, ()=>e.path,r=>{!n||n.update({path:r})}),_vue.watch.call(void 0, o,r=>{!n||n.update({lang:r})}),_vue.onUnmounted.call(void 0, ()=>{!n||n.destroy()}),n}function ro(t){return t}function no(t){return t}exports.defineAppSetup = ro; exports.defineUnoSetup = no; exports.formatDate = Lt; exports.initConfig = vt; exports.initContext = Ct; exports.isDark = K; exports.isParentCategory = Nt; exports.random = Tt; exports.sortByDate = y; exports.throttleAndDebounce = Pt; exports.toggleDark = ae; exports.useActiveSidebarLinks = Me; exports.useAplayer = ge; exports.useBackToTop = ve; exports.useCategory = Wt; exports.useCodePen = Te; exports.useConfig = T; exports.useFrontmatter = Zt; exports.useFullUrl = te; exports.useInvisibleElement = ne; exports.useLayout = pe; exports.usePageList = Ot; exports.usePostList = g; exports.usePostTitle = Ut; exports.usePrevNext = Bt; exports.useTag = N; exports.useTags = Ft; exports.useTwikoo = ke; exports.useWaline = Ie; exports.valaxyConfigRef = C; exports.valaxyConfigSymbol = U; exports.valaxyContextRef = w; exports.wrap = O; exports.wrapTable = bt;
@@ -1 +0,0 @@
1
- import"../chunk-B2L4QLCB.mjs";import D from"/@valaxyjs/config";import H from"/@valaxyjs/context";import{computed as x,inject as k,readonly as V,shallowRef as v}from"vue";function h(t){let e=JSON.parse(t);return __DEV__?V(e):e}var U=Symbol("valaxy:config"),C=v(h(D)),w=v(h(H));import.meta.hot&&(import.meta.hot.accept("/@valaxyjs/config",t=>{C.value=h(t.default)}),import.meta.hot.accept("/@valaxyjs/context",t=>{w.value=h(t.default)}));function vt(){return x(()=>C.value)}function Ct(){return x(()=>w.value)}function T(){let t=k(U);if(!t)throw new Error("[Valaxy] config not properly injected in app");return t}import{unref as I}from"vue";import{computed as m}from"vue";import{useRoute as q,useRouter as b}from"vue-router";import{useI18n as z}from"vue-i18n";function Tt(t,e){return Math.random()*(e-t)+t}function O(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var bt=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",O(e,"table-container")})};function Pt(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}import B from"dayjs";function Lt(t,e="YYYY-MM-DD"){return B(t).format(e)}function y(t,e=!0){return t.sort((o,n)=>{let i=+new Date(o.date||""),r=+new Date(n.date||"");return e?r-i:i-r})}var Ut=t=>{let{locale:e}=z();return m(()=>{let o=e.value==="zh-CN"?"zh":e.value;return t.value[`title_${o}`]||t.value.title})};function g(t={}){let e=b();return m(()=>{let o=e.getRoutes().filter(r=>r.path.startsWith("/posts")&&r.meta.frontmatter&&r.meta.frontmatter.date).filter(r=>!r.path.endsWith(".html")).filter(r=>!t.type||r.meta.frontmatter.type===t.type).map(r=>Object.assign({path:r.path,excerpt:r.meta.excerpt},r.meta.frontmatter)),n=y(o.filter(r=>r.top)).sort((r,l)=>l.top-r.top),i=y(o.filter(r=>!r.top));return n.concat(i)})}function Ot(){let t=b();return m(()=>t.getRoutes().map(o=>Object.assign({path:o.path,excerpt:o.meta.excerpt},o.meta.frontmatter)))}function Bt(t){let e=q(),o=m(()=>t||e.path),n=g(),i=m(()=>{let s=-1;return n.value.find((a,u)=>a.path===o.value?(s=u,!0):!1),s}),r=m(()=>i.value-1>=0?n.value[i.value-1]:null),l=m(()=>i.value+1<n.value.length?n.value[i.value+1]:null);return[r,l]}var Nt=t=>t.children;function Wt(t,e=[]){var i;e.length||(e=I(g()));let o={total:e.length,children:new Map([["Uncategorized",{total:0,posts:[]}]])},n=o.children.get("Uncategorized");if(e.forEach(r=>{if(r.categories)if(Array.isArray(r.categories)){let l=r.categories.length,s=o;r.categories.forEach((a,u)=>{var p,d,f;if(u===l-1)if(s.children.has(a)){let c=s.children.get(a);c.posts&&(c.total+=1,c.posts.push(r))}else(p=s.children)==null||p.set(a,{total:1,posts:[r]});else if((d=s.children)!=null&&d.has(a)){let c=s.children.get(a);c.total+=1,s=c}else{let c={total:1,children:new Map};(f=s.children)==null||f.set(a,c),s=c}})}else{let l=r.categories;if(o.children.has(l)){let s=o.children.get(l);s.total+=1,s.posts.push(r)}else o.children.set(l,{total:1,posts:[r]})}else n.total+=1,n.posts.push(r)}),n.total===0&&((i=o.children)==null||i.delete("Uncategorized")),t){let r=o.children.get(t);return r?{total:r==null?void 0:r.total,children:new Map([[t,r]])}:(console.warn(`Do not have category: ${t}`),o)}else return o}import{TinyColor as P}from"@ctrl/tinycolor";function Ft(t={primary:"#0078E7"}){let e=N(),o=new P("#999999"),n=new P(t.primary);return{tags:e,getTagStyle:r=>{let l=Array.from(e).map(([d,f])=>f.count),s=Math.max(...l),a=Math.min(...l),u=s-a,p=(r-a)/u;return{"--yun-tag-color":o.mix(n,p*100).toString(),fontSize:`${p*36+12}px`}}}}function N(){let t=g(),e=new Map;return t.value.forEach(o=>{if(o.tags){let n;typeof o.tags=="string"?n=[o.tags]:n=o.tags,n.forEach(i=>{if(e.has(i)){let r=e.get(i);e.set(i,{...r,count:r.count+1})}else e.set(i,{count:1})})}}),e}import{useRoute as A}from"vue-router";import{computed as j}from"vue";import{isClient as W}from"@vueuse/core";function Zt(){let t=A();return j(()=>t.meta.frontmatter)}function te(){let t=T(),e=A();return j(()=>((t.value.url.endsWith("/")?t.value.url.slice(0,-1):t.value.url)||W&&window.location.origin)+e.path)}import{useElementBounding as _,useIntersectionObserver as Y}from"@vueuse/core";import{ref as $}from"vue";function ne(t){let e=$(!1),{top:o}=_(t);return Y(t,([{isIntersecting:i}])=>{e.value=i}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}import{useDark as F,useToggle as G}from"@vueuse/core";var K=F(),ae=G(K);import{computed as J}from"vue";import{useRoute as Q}from"vue-router";function pe(t){let e=Q();return J(()=>e.meta.layout===t)}import{useScriptTag as L}from"@vueuse/core";import{useHead as X}from"@vueuse/head";function ge(){X({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"}]}),L("https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js",()=>{L("https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js")})}import{isClient as Z,useWindowScroll as tt}from"@vueuse/core";import{computed as E,ref as M}from"vue";function ve(t={offset:100}){if(!Z)return{percentage:M(0),show:M(!1)};let{y:e}=tt(),o=E(()=>e.value/(document.body.scrollHeight-window.innerHeight)),n=E(()=>e.value>t.offset);return{percentage:o,show:n}}import{useHead as et}from"@vueuse/head";function Te(){et({script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}import{onMounted as ot,onUnmounted as rt}from"vue";function Me(t,e){let o=it(n,200);function n(){let s=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),a=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(u=>s.some(p=>p.hash===u.hash));for(let u=0;u<a.length;u++){let p=a[u],d=a[u+1],[f,c]=nt(u,p,d);if(f){history.replaceState(null,document.title,c||" "),r(c);return}}}let i=null;function r(s){l(i);let a=i=s==null?null:t.value.querySelector(`.va-toc a[href="${s}"]`);e.value&&(a?(a.classList.add("active"),e.value.style.opacity="1",e.value.style.top=`${a.offsetTop+2}px`):(e.value.style.opacity="0",e.value.style.top="54px"))}function l(s){s&&s.classList.remove("active")}ot(()=>{requestAnimationFrame(n),window.addEventListener("scroll",o)}),rt(()=>{window.removeEventListener("scroll",o)})}function S(t){return t.parentElement.offsetTop-50}function nt(t,e,o){let n=window.scrollY;return t===0&&n===0?[!0,null]:n<S(e)?[!1,null]:!o||n<S(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function it(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}import{isClient as st,useScriptTag as at}from"@vueuse/core";import{useI18n as lt}from"vue-i18n";import{useRoute as ut}from"vue-router";function ke(t={}){let e=ut(),{locale:o}=lt();function n(i={}){if(!st)return;let r={el:".comment #tcomment",lang:o.value,path:e.path},l=Object.assign(r,i);return window.twikoo.init(l)}at("//cdn.jsdelivr.net/npm/twikoo@1.5.1/dist/twikoo.all.min.js",()=>{n(t)})}import{isClient as ct,useScriptTag as pt}from"@vueuse/core";import{useHead as mt}from"@vueuse/head";import{onUnmounted as ft,watch as R}from"vue";import{useI18n as dt}from"vue-i18n";import{useRoute as gt}from"vue-router";function Ie(t={}){mt({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/@waline/client/dist/waline.css"}]});let e=gt(),{locale:o}=dt(),n;function i(r={}){if(!ct)return;let l={el:".comment #waline",lang:o.value,dark:"html.dark",emoji:["https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/qq","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo"],path:e.path},s=Object.assign(l,r);return window.Waline.init(s)}return pt("//cdn.jsdelivr.net/npm/@waline/client/dist/waline.js",()=>{n=i(t)}),R(()=>e.path,r=>{!n||n.update({path:r})}),R(o,r=>{!n||n.update({lang:r})}),ft(()=>{!n||n.destroy()}),n}function ro(t){return t}function no(t){return t}export{ro as defineAppSetup,no as defineUnoSetup,Lt as formatDate,vt as initConfig,Ct as initContext,K as isDark,Nt as isParentCategory,Tt as random,y as sortByDate,Pt as throttleAndDebounce,ae as toggleDark,Me as useActiveSidebarLinks,ge as useAplayer,ve as useBackToTop,Wt as useCategory,Te as useCodePen,T as useConfig,Zt as useFrontmatter,te as useFullUrl,ne as useInvisibleElement,pe as useLayout,Ot as usePageList,g as usePostList,Ut as usePostTitle,Bt as usePrevNext,N as useTag,Ft as useTags,ke as useTwikoo,Ie as useWaline,C as valaxyConfigRef,U as valaxyConfigSymbol,w as valaxyContextRef,O as wrap,bt as wrapTable};