TOPVERSE_Official/.output/server/chunks/app/_nuxt/ContentSlot-ff6cce0d.mjs

149 lines
4.0 KiB
JavaScript

import { defineComponent, getCurrentInstance, useSlots, computed, h, useSSRContext } from 'vue';
import { b as useUnwrap } from './utils-6d756e03.mjs';
import 'ufo';
import '../server.mjs';
import 'ofetch';
import 'hookable';
import 'unctx';
import 'h3';
import '@unhead/ssr';
import 'unhead';
import '@unhead/shared';
import 'vue-router';
import '@intlify/core-base';
import 'cookie-es';
import 'is-https';
import 'anu-vue';
import 'vue/server-renderer';
import 'defu';
import '../../nitro/node-server.mjs';
import 'node-fetch-native/polyfill';
import 'node:http';
import 'node:https';
import 'destr';
import 'unenv/runtime/fetch/index';
import 'scule';
import 'klona';
import 'ohash';
import 'unstorage';
import 'unstorage/drivers/fs';
import 'unstorage/drivers/overlay';
import 'unstorage/drivers/memory';
import 'radix3';
import 'node:fs';
import 'node:url';
import 'pathe';
import '@intlify/bundle-utils';
import 'unified';
import 'mdast-util-to-string';
import 'micromark/lib/preprocess.js';
import 'micromark/lib/postprocess.js';
import 'unist-util-stringify-position';
import 'micromark-util-character';
import 'micromark-util-chunked';
import 'micromark-util-resolve-all';
import 'remark-emoji';
import 'rehype-slug';
import 'remark-squeeze-paragraphs';
import 'rehype-external-links';
import 'remark-gfm';
import 'rehype-sort-attribute-values';
import 'rehype-sort-attributes';
import 'rehype-raw';
import 'remark-mdc';
import 'remark-parse';
import 'remark-rehype';
import 'mdast-util-to-hast';
import 'detab';
import 'unist-builder';
import 'mdurl';
import 'slugify';
import 'unist-util-position';
import 'unist-util-visit';
import 'shiki-es';
import 'unenv/runtime/npm/consola';
const _sfc_main = /* @__PURE__ */ defineComponent({
name: "ContentSlot",
functional: true,
props: {
/**
* A slot name or function
*/
use: {
type: Function,
default: void 0
},
/**
* Tags to unwrap separated by spaces
* Example: 'ul li'
*/
unwrap: {
type: [Boolean, String],
default: false
}
},
setup(props) {
const { parent } = getCurrentInstance();
const { between, default: fallbackSlot } = useSlots();
const tags = computed(() => {
if (typeof props.unwrap === "string") {
return props.unwrap.split(" ");
}
return ["*"];
});
return {
fallbackSlot,
tags,
between,
parent
};
},
render({ use, unwrap, fallbackSlot, between, tags, parent }) {
var _a;
try {
let slot = use;
if (typeof use === "string") {
slot = (parent == null ? void 0 : parent.slots[use]) || ((_a = parent == null ? void 0 : parent.parent) == null ? void 0 : _a.slots[use]);
console.warn(`Please set :use="$slots.${use}" in <ContentSlot> component to enable reactivity`);
}
if (!slot) {
return fallbackSlot ? fallbackSlot() : h("div");
}
if (!unwrap) {
return [slot()];
}
const { flatUnwrap } = useUnwrap();
const unwrapped = flatUnwrap(slot(), tags);
if (between) {
return unwrapped.flatMap(
(vnode, index) => index === 0 ? [vnode] : [between(), vnode]
);
}
return unwrapped.reduce((acc, item) => {
if (typeof item.children === "string") {
if (typeof acc[acc.length - 1] === "string") {
acc[acc.length - 1] += item.children;
} else {
acc.push(item.children);
}
} else {
acc.push(item);
}
return acc;
}, []);
} catch (e) {
return h("div");
}
}
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("node_modules/.pnpm/@nuxt+content@2.6.0_rollup@2.79.1/node_modules/@nuxt/content/dist/runtime/components/ContentSlot.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export { _sfc_main as default };
//# sourceMappingURL=ContentSlot-ff6cce0d.mjs.map