server.mjs 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530
  1. import { effectScope, shallowReactive, reactive, getCurrentScope, hasInjectionContext, getCurrentInstance, inject, toRef, version, unref, h, shallowRef, isReadonly, isRef, isShallow, isReactive, toRaw, ref, computed, defineComponent, provide, Suspense, nextTick, mergeProps, Transition, watch, Fragment, withCtx, createVNode, useSSRContext, onErrorCaptured, onServerPrefetch, resolveDynamicComponent, createApp } from "vue";
  2. import { $fetch as $fetch$1 } from "ofetch";
  3. import { baseURL } from "#internal/nuxt/paths";
  4. import { createHooks } from "hookable";
  5. import { getContext } from "unctx";
  6. import { sanitizeStatusCode, createError as createError$1 } from "h3";
  7. import { getActiveHead, CapoPlugin } from "unhead";
  8. import { defineHeadPlugin } from "@unhead/shared";
  9. import { START_LOCATION, createMemoryHistory, createRouter as createRouter$1, useRoute as useRoute$1, RouterView } from "vue-router";
  10. import { toRouteMatcher, createRouter } from "radix3";
  11. import { defu } from "defu";
  12. import { hasProtocol, isScriptProtocol, joinURL, withQuery } from "ufo";
  13. import { createPinia } from "pinia";
  14. import { ssrRenderComponent, ssrRenderAttrs, ssrRenderSuspense, ssrRenderVNode } from "vue/server-renderer";
  15. if (!globalThis.$fetch) {
  16. globalThis.$fetch = $fetch$1.create({
  17. baseURL: baseURL()
  18. });
  19. }
  20. const appLayoutTransition = false;
  21. const appPageTransition = false;
  22. const appKeepalive = false;
  23. const nuxtLinkDefaults = { "componentName": "NuxtLink", "prefetch": true, "prefetchOn": { "visibility": true } };
  24. const asyncDataDefaults = { "value": null, "errorValue": null, "deep": true };
  25. const appId = "nuxt-app";
  26. function getNuxtAppCtx(id = appId) {
  27. return getContext(id, {
  28. asyncContext: false
  29. });
  30. }
  31. const NuxtPluginIndicator = "__nuxt_plugin";
  32. function createNuxtApp(options) {
  33. var _a;
  34. let hydratingCount = 0;
  35. const nuxtApp = {
  36. _id: options.id || appId || "nuxt-app",
  37. _scope: effectScope(),
  38. provide: void 0,
  39. globalName: "nuxt",
  40. versions: {
  41. get nuxt() {
  42. return "3.15.2";
  43. },
  44. get vue() {
  45. return nuxtApp.vueApp.version;
  46. }
  47. },
  48. payload: shallowReactive({
  49. ...((_a = options.ssrContext) == null ? void 0 : _a.payload) || {},
  50. data: shallowReactive({}),
  51. state: reactive({}),
  52. once: /* @__PURE__ */ new Set(),
  53. _errors: shallowReactive({})
  54. }),
  55. static: {
  56. data: {}
  57. },
  58. runWithContext(fn) {
  59. if (nuxtApp._scope.active && !getCurrentScope()) {
  60. return nuxtApp._scope.run(() => callWithNuxt(nuxtApp, fn));
  61. }
  62. return callWithNuxt(nuxtApp, fn);
  63. },
  64. isHydrating: false,
  65. deferHydration() {
  66. if (!nuxtApp.isHydrating) {
  67. return () => {
  68. };
  69. }
  70. hydratingCount++;
  71. let called = false;
  72. return () => {
  73. if (called) {
  74. return;
  75. }
  76. called = true;
  77. hydratingCount--;
  78. if (hydratingCount === 0) {
  79. nuxtApp.isHydrating = false;
  80. return nuxtApp.callHook("app:suspense:resolve");
  81. }
  82. };
  83. },
  84. _asyncDataPromises: {},
  85. _asyncData: shallowReactive({}),
  86. _payloadRevivers: {},
  87. ...options
  88. };
  89. {
  90. nuxtApp.payload.serverRendered = true;
  91. }
  92. if (nuxtApp.ssrContext) {
  93. nuxtApp.payload.path = nuxtApp.ssrContext.url;
  94. nuxtApp.ssrContext.nuxt = nuxtApp;
  95. nuxtApp.ssrContext.payload = nuxtApp.payload;
  96. nuxtApp.ssrContext.config = {
  97. public: nuxtApp.ssrContext.runtimeConfig.public,
  98. app: nuxtApp.ssrContext.runtimeConfig.app
  99. };
  100. }
  101. nuxtApp.hooks = createHooks();
  102. nuxtApp.hook = nuxtApp.hooks.hook;
  103. {
  104. const contextCaller = async function(hooks, args) {
  105. for (const hook of hooks) {
  106. await nuxtApp.runWithContext(() => hook(...args));
  107. }
  108. };
  109. nuxtApp.hooks.callHook = (name, ...args) => nuxtApp.hooks.callHookWith(contextCaller, name, ...args);
  110. }
  111. nuxtApp.callHook = nuxtApp.hooks.callHook;
  112. nuxtApp.provide = (name, value) => {
  113. const $name = "$" + name;
  114. defineGetter(nuxtApp, $name, value);
  115. defineGetter(nuxtApp.vueApp.config.globalProperties, $name, value);
  116. };
  117. defineGetter(nuxtApp.vueApp, "$nuxt", nuxtApp);
  118. defineGetter(nuxtApp.vueApp.config.globalProperties, "$nuxt", nuxtApp);
  119. const runtimeConfig = options.ssrContext.runtimeConfig;
  120. nuxtApp.provide("config", runtimeConfig);
  121. return nuxtApp;
  122. }
  123. function registerPluginHooks(nuxtApp, plugin2) {
  124. if (plugin2.hooks) {
  125. nuxtApp.hooks.addHooks(plugin2.hooks);
  126. }
  127. }
  128. async function applyPlugin(nuxtApp, plugin2) {
  129. if (typeof plugin2 === "function") {
  130. const { provide: provide2 } = await nuxtApp.runWithContext(() => plugin2(nuxtApp)) || {};
  131. if (provide2 && typeof provide2 === "object") {
  132. for (const key in provide2) {
  133. nuxtApp.provide(key, provide2[key]);
  134. }
  135. }
  136. }
  137. }
  138. async function applyPlugins(nuxtApp, plugins2) {
  139. var _a, _b, _c, _d;
  140. const resolvedPlugins = [];
  141. const unresolvedPlugins = [];
  142. const parallels = [];
  143. const errors = [];
  144. let promiseDepth = 0;
  145. async function executePlugin(plugin2) {
  146. var _a2;
  147. const unresolvedPluginsForThisPlugin = ((_a2 = plugin2.dependsOn) == null ? void 0 : _a2.filter((name) => plugins2.some((p) => p._name === name) && !resolvedPlugins.includes(name))) ?? [];
  148. if (unresolvedPluginsForThisPlugin.length > 0) {
  149. unresolvedPlugins.push([new Set(unresolvedPluginsForThisPlugin), plugin2]);
  150. } else {
  151. const promise = applyPlugin(nuxtApp, plugin2).then(async () => {
  152. if (plugin2._name) {
  153. resolvedPlugins.push(plugin2._name);
  154. await Promise.all(unresolvedPlugins.map(async ([dependsOn, unexecutedPlugin]) => {
  155. if (dependsOn.has(plugin2._name)) {
  156. dependsOn.delete(plugin2._name);
  157. if (dependsOn.size === 0) {
  158. promiseDepth++;
  159. await executePlugin(unexecutedPlugin);
  160. }
  161. }
  162. }));
  163. }
  164. });
  165. if (plugin2.parallel) {
  166. parallels.push(promise.catch((e) => errors.push(e)));
  167. } else {
  168. await promise;
  169. }
  170. }
  171. }
  172. for (const plugin2 of plugins2) {
  173. if (((_a = nuxtApp.ssrContext) == null ? void 0 : _a.islandContext) && ((_b = plugin2.env) == null ? void 0 : _b.islands) === false) {
  174. continue;
  175. }
  176. registerPluginHooks(nuxtApp, plugin2);
  177. }
  178. for (const plugin2 of plugins2) {
  179. if (((_c = nuxtApp.ssrContext) == null ? void 0 : _c.islandContext) && ((_d = plugin2.env) == null ? void 0 : _d.islands) === false) {
  180. continue;
  181. }
  182. await executePlugin(plugin2);
  183. }
  184. await Promise.all(parallels);
  185. if (promiseDepth) {
  186. for (let i = 0; i < promiseDepth; i++) {
  187. await Promise.all(parallels);
  188. }
  189. }
  190. if (errors.length) {
  191. throw errors[0];
  192. }
  193. }
  194. // @__NO_SIDE_EFFECTS__
  195. function defineNuxtPlugin(plugin2) {
  196. if (typeof plugin2 === "function") {
  197. return plugin2;
  198. }
  199. const _name = plugin2._name || plugin2.name;
  200. delete plugin2.name;
  201. return Object.assign(plugin2.setup || (() => {
  202. }), plugin2, { [NuxtPluginIndicator]: true, _name });
  203. }
  204. function callWithNuxt(nuxt, setup, args) {
  205. const fn = () => setup();
  206. const nuxtAppCtx = getNuxtAppCtx(nuxt._id);
  207. {
  208. return nuxt.vueApp.runWithContext(() => nuxtAppCtx.callAsync(nuxt, fn));
  209. }
  210. }
  211. function tryUseNuxtApp(id) {
  212. var _a;
  213. let nuxtAppInstance;
  214. if (hasInjectionContext()) {
  215. nuxtAppInstance = (_a = getCurrentInstance()) == null ? void 0 : _a.appContext.app.$nuxt;
  216. }
  217. nuxtAppInstance = nuxtAppInstance || getNuxtAppCtx(id).tryUse();
  218. return nuxtAppInstance || null;
  219. }
  220. function useNuxtApp(id) {
  221. const nuxtAppInstance = tryUseNuxtApp(id);
  222. if (!nuxtAppInstance) {
  223. {
  224. throw new Error("[nuxt] instance unavailable");
  225. }
  226. }
  227. return nuxtAppInstance;
  228. }
  229. // @__NO_SIDE_EFFECTS__
  230. function useRuntimeConfig(_event) {
  231. return useNuxtApp().$config;
  232. }
  233. function defineGetter(obj, key, val) {
  234. Object.defineProperty(obj, key, { get: () => val });
  235. }
  236. const LayoutMetaSymbol = Symbol("layout-meta");
  237. const PageRouteSymbol = Symbol("route");
  238. const useRouter = () => {
  239. var _a;
  240. return (_a = useNuxtApp()) == null ? void 0 : _a.$router;
  241. };
  242. const useRoute = () => {
  243. if (hasInjectionContext()) {
  244. return inject(PageRouteSymbol, useNuxtApp()._route);
  245. }
  246. return useNuxtApp()._route;
  247. };
  248. // @__NO_SIDE_EFFECTS__
  249. function defineNuxtRouteMiddleware(middleware) {
  250. return middleware;
  251. }
  252. const isProcessingMiddleware = () => {
  253. try {
  254. if (useNuxtApp()._processingMiddleware) {
  255. return true;
  256. }
  257. } catch {
  258. return false;
  259. }
  260. return false;
  261. };
  262. const URL_QUOTE_RE = /"/g;
  263. const navigateTo = (to, options) => {
  264. if (!to) {
  265. to = "/";
  266. }
  267. const toPath = typeof to === "string" ? to : "path" in to ? resolveRouteObject(to) : useRouter().resolve(to).href;
  268. const isExternalHost = hasProtocol(toPath, { acceptRelative: true });
  269. const isExternal = (options == null ? void 0 : options.external) || isExternalHost;
  270. if (isExternal) {
  271. if (!(options == null ? void 0 : options.external)) {
  272. throw new Error("Navigating to an external URL is not allowed by default. Use `navigateTo(url, { external: true })`.");
  273. }
  274. const { protocol } = new URL(toPath, "http://localhost");
  275. if (protocol && isScriptProtocol(protocol)) {
  276. throw new Error(`Cannot navigate to a URL with '${protocol}' protocol.`);
  277. }
  278. }
  279. const inMiddleware = isProcessingMiddleware();
  280. const router = useRouter();
  281. const nuxtApp = useNuxtApp();
  282. {
  283. if (nuxtApp.ssrContext) {
  284. const fullPath = typeof to === "string" || isExternal ? toPath : router.resolve(to).fullPath || "/";
  285. const location2 = isExternal ? toPath : joinURL((/* @__PURE__ */ useRuntimeConfig()).app.baseURL, fullPath);
  286. const redirect = async function(response) {
  287. await nuxtApp.callHook("app:redirected");
  288. const encodedLoc = location2.replace(URL_QUOTE_RE, "%22");
  289. const encodedHeader = encodeURL(location2, isExternalHost);
  290. nuxtApp.ssrContext._renderResponse = {
  291. statusCode: sanitizeStatusCode((options == null ? void 0 : options.redirectCode) || 302, 302),
  292. body: `<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=${encodedLoc}"></head></html>`,
  293. headers: { location: encodedHeader }
  294. };
  295. return response;
  296. };
  297. if (!isExternal && inMiddleware) {
  298. router.afterEach((final) => final.fullPath === fullPath ? redirect(false) : void 0);
  299. return to;
  300. }
  301. return redirect(!inMiddleware ? void 0 : (
  302. /* abort route navigation */
  303. false
  304. ));
  305. }
  306. }
  307. if (isExternal) {
  308. nuxtApp._scope.stop();
  309. if (options == null ? void 0 : options.replace) {
  310. (void 0).replace(toPath);
  311. } else {
  312. (void 0).href = toPath;
  313. }
  314. if (inMiddleware) {
  315. if (!nuxtApp.isHydrating) {
  316. return false;
  317. }
  318. return new Promise(() => {
  319. });
  320. }
  321. return Promise.resolve();
  322. }
  323. return (options == null ? void 0 : options.replace) ? router.replace(to) : router.push(to);
  324. };
  325. function resolveRouteObject(to) {
  326. return withQuery(to.path || "", to.query || {}) + (to.hash || "");
  327. }
  328. function encodeURL(location2, isExternalHost = false) {
  329. const url = new URL(location2, "http://localhost");
  330. if (!isExternalHost) {
  331. return url.pathname + url.search + url.hash;
  332. }
  333. if (location2.startsWith("//")) {
  334. return url.toString().replace(url.protocol, "");
  335. }
  336. return url.toString();
  337. }
  338. const NUXT_ERROR_SIGNATURE = "__nuxt_error";
  339. const useError = () => toRef(useNuxtApp().payload, "error");
  340. const showError = (error) => {
  341. const nuxtError = createError(error);
  342. try {
  343. const nuxtApp = useNuxtApp();
  344. const error2 = useError();
  345. if (false) ;
  346. error2.value = error2.value || nuxtError;
  347. } catch {
  348. throw nuxtError;
  349. }
  350. return nuxtError;
  351. };
  352. const isNuxtError = (error) => !!error && typeof error === "object" && NUXT_ERROR_SIGNATURE in error;
  353. const createError = (error) => {
  354. const nuxtError = createError$1(error);
  355. Object.defineProperty(nuxtError, NUXT_ERROR_SIGNATURE, {
  356. value: true,
  357. configurable: false,
  358. writable: false
  359. });
  360. return nuxtError;
  361. };
  362. version[0] === "3";
  363. function resolveUnref(r) {
  364. return typeof r === "function" ? r() : unref(r);
  365. }
  366. function resolveUnrefHeadInput(ref2) {
  367. if (ref2 instanceof Promise || ref2 instanceof Date || ref2 instanceof RegExp)
  368. return ref2;
  369. const root = resolveUnref(ref2);
  370. if (!ref2 || !root)
  371. return root;
  372. if (Array.isArray(root))
  373. return root.map((r) => resolveUnrefHeadInput(r));
  374. if (typeof root === "object") {
  375. const resolved = {};
  376. for (const k in root) {
  377. if (!Object.prototype.hasOwnProperty.call(root, k)) {
  378. continue;
  379. }
  380. if (k === "titleTemplate" || k[0] === "o" && k[1] === "n") {
  381. resolved[k] = unref(root[k]);
  382. continue;
  383. }
  384. resolved[k] = resolveUnrefHeadInput(root[k]);
  385. }
  386. return resolved;
  387. }
  388. return root;
  389. }
  390. defineHeadPlugin({
  391. hooks: {
  392. "entries:resolve": (ctx) => {
  393. for (const entry2 of ctx.entries)
  394. entry2.resolvedInput = resolveUnrefHeadInput(entry2.input);
  395. }
  396. }
  397. });
  398. const headSymbol = "usehead";
  399. const _global = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  400. const globalKey$1 = "__unhead_injection_handler__";
  401. function setHeadInjectionHandler(handler) {
  402. _global[globalKey$1] = handler;
  403. }
  404. function injectHead() {
  405. if (globalKey$1 in _global) {
  406. return _global[globalKey$1]();
  407. }
  408. const head = inject(headSymbol);
  409. if (!head && process.env.NODE_ENV !== "production")
  410. console.warn("Unhead is missing Vue context, falling back to shared context. This may have unexpected results.");
  411. return head || getActiveHead();
  412. }
  413. [CapoPlugin({ track: true })];
  414. const unhead_KgADcZ0jPj = /* @__PURE__ */ defineNuxtPlugin({
  415. name: "nuxt:head",
  416. enforce: "pre",
  417. setup(nuxtApp) {
  418. const head = nuxtApp.ssrContext.head;
  419. setHeadInjectionHandler(
  420. // need a fresh instance of the nuxt app to avoid parallel requests interfering with each other
  421. () => useNuxtApp().vueApp._context.provides.usehead
  422. );
  423. nuxtApp.vueApp.use(head);
  424. }
  425. });
  426. function createContext(opts = {}) {
  427. let currentInstance;
  428. let isSingleton = false;
  429. const checkConflict = (instance) => {
  430. if (currentInstance && currentInstance !== instance) {
  431. throw new Error("Context conflict");
  432. }
  433. };
  434. let als;
  435. if (opts.asyncContext) {
  436. const _AsyncLocalStorage = opts.AsyncLocalStorage || globalThis.AsyncLocalStorage;
  437. if (_AsyncLocalStorage) {
  438. als = new _AsyncLocalStorage();
  439. } else {
  440. console.warn("[unctx] `AsyncLocalStorage` is not provided.");
  441. }
  442. }
  443. const _getCurrentInstance = () => {
  444. if (als) {
  445. const instance = als.getStore();
  446. if (instance !== void 0) {
  447. return instance;
  448. }
  449. }
  450. return currentInstance;
  451. };
  452. return {
  453. use: () => {
  454. const _instance = _getCurrentInstance();
  455. if (_instance === void 0) {
  456. throw new Error("Context is not available");
  457. }
  458. return _instance;
  459. },
  460. tryUse: () => {
  461. return _getCurrentInstance();
  462. },
  463. set: (instance, replace) => {
  464. if (!replace) {
  465. checkConflict(instance);
  466. }
  467. currentInstance = instance;
  468. isSingleton = true;
  469. },
  470. unset: () => {
  471. currentInstance = void 0;
  472. isSingleton = false;
  473. },
  474. call: (instance, callback) => {
  475. checkConflict(instance);
  476. currentInstance = instance;
  477. try {
  478. return als ? als.run(instance, callback) : callback();
  479. } finally {
  480. if (!isSingleton) {
  481. currentInstance = void 0;
  482. }
  483. }
  484. },
  485. async callAsync(instance, callback) {
  486. currentInstance = instance;
  487. const onRestore = () => {
  488. currentInstance = instance;
  489. };
  490. const onLeave = () => currentInstance === instance ? onRestore : void 0;
  491. asyncHandlers.add(onLeave);
  492. try {
  493. const r = als ? als.run(instance, callback) : callback();
  494. if (!isSingleton) {
  495. currentInstance = void 0;
  496. }
  497. return await r;
  498. } finally {
  499. asyncHandlers.delete(onLeave);
  500. }
  501. }
  502. };
  503. }
  504. function createNamespace(defaultOpts = {}) {
  505. const contexts = {};
  506. return {
  507. get(key, opts = {}) {
  508. if (!contexts[key]) {
  509. contexts[key] = createContext({ ...defaultOpts, ...opts });
  510. }
  511. return contexts[key];
  512. }
  513. };
  514. }
  515. const _globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : {};
  516. const globalKey = "__unctx__";
  517. _globalThis[globalKey] || (_globalThis[globalKey] = createNamespace());
  518. const asyncHandlersKey = "__unctx_async_handlers__";
  519. const asyncHandlers = _globalThis[asyncHandlersKey] || (_globalThis[asyncHandlersKey] = /* @__PURE__ */ new Set());
  520. function executeAsync(function_) {
  521. const restores = [];
  522. for (const leaveHandler of asyncHandlers) {
  523. const restore2 = leaveHandler();
  524. if (restore2) {
  525. restores.push(restore2);
  526. }
  527. }
  528. const restore = () => {
  529. for (const restore2 of restores) {
  530. restore2();
  531. }
  532. };
  533. let awaitable = function_();
  534. if (awaitable && typeof awaitable === "object" && "catch" in awaitable) {
  535. awaitable = awaitable.catch((error) => {
  536. restore();
  537. throw error;
  538. });
  539. }
  540. return [awaitable, restore];
  541. }
  542. const ROUTE_KEY_PARENTHESES_RE$1 = /(:\w+)\([^)]+\)/g;
  543. const ROUTE_KEY_SYMBOLS_RE$1 = /(:\w+)[?+*]/g;
  544. const ROUTE_KEY_NORMAL_RE$1 = /:\w+/g;
  545. const interpolatePath = (route, match) => {
  546. return match.path.replace(ROUTE_KEY_PARENTHESES_RE$1, "$1").replace(ROUTE_KEY_SYMBOLS_RE$1, "$1").replace(ROUTE_KEY_NORMAL_RE$1, (r) => {
  547. var _a;
  548. return ((_a = route.params[r.slice(1)]) == null ? void 0 : _a.toString()) || "";
  549. });
  550. };
  551. const generateRouteKey$1 = (routeProps, override) => {
  552. const matchedRoute = routeProps.route.matched.find((m) => {
  553. var _a;
  554. return ((_a = m.components) == null ? void 0 : _a.default) === routeProps.Component.type;
  555. });
  556. const source = override ?? (matchedRoute == null ? void 0 : matchedRoute.meta.key) ?? (matchedRoute && interpolatePath(routeProps.route, matchedRoute));
  557. return typeof source === "function" ? source(routeProps.route) : source;
  558. };
  559. const wrapInKeepAlive = (props, children) => {
  560. return { default: () => children };
  561. };
  562. function toArray(value) {
  563. return Array.isArray(value) ? value : [value];
  564. }
  565. async function getRouteRules(arg) {
  566. const path = typeof arg === "string" ? arg : arg.path;
  567. {
  568. useNuxtApp().ssrContext._preloadManifest = true;
  569. const _routeRulesMatcher = toRouteMatcher(
  570. createRouter({ routes: (/* @__PURE__ */ useRuntimeConfig()).nitro.routeRules })
  571. );
  572. return defu({}, ..._routeRulesMatcher.matchAll(path).reverse());
  573. }
  574. }
  575. function handleHotUpdate(_router, _generateRoutes) {
  576. }
  577. const _routes = [
  578. {
  579. name: "dir-dir-id",
  580. path: "/:dir()/:dir()/:id()",
  581. component: () => import("./_nuxt/_id_-CY4S08zh.js")
  582. },
  583. {
  584. name: "dir-dir-list-id",
  585. path: "/:dir()/:dir()/list-:id()",
  586. component: () => import("./_nuxt/list-_id_-By6mIPL6.js")
  587. },
  588. {
  589. name: "dir-id",
  590. path: "/:dir()/:id()",
  591. component: () => import("./_nuxt/_id_-DSKwGPjq.js")
  592. },
  593. {
  594. name: "dir-index.html",
  595. path: "/:dir()/index.html",
  596. component: () => import("./_nuxt/index.html-DZvbkZ4V.js")
  597. },
  598. {
  599. name: "dir-list-id",
  600. path: "/:dir()/list-:id()",
  601. component: () => import("./_nuxt/list-_id_-DSsbG6f8.js")
  602. },
  603. {
  604. name: "about-dir-dir-id",
  605. path: "/about/:dir()/:dir()/:id()",
  606. component: () => import("./_nuxt/_id_-BYaqDGP_.js")
  607. },
  608. {
  609. name: "about-dir-index.html",
  610. path: "/about/:dir()/index.html",
  611. component: () => import("./_nuxt/index.html-CGLEEYXF.js")
  612. },
  613. {
  614. name: "about-dir-list-id",
  615. path: "/about/:dir()/list-:id()",
  616. component: () => import("./_nuxt/list-_id_-Bkf2uAQN.js")
  617. },
  618. {
  619. name: "advertising-adDetail",
  620. path: "/advertising/adDetail",
  621. component: () => import("./_nuxt/adDetail-DiEtJ07k.js")
  622. },
  623. {
  624. name: "advertising",
  625. path: "/advertising",
  626. component: () => import("./_nuxt/index-DJajLbTi.js")
  627. },
  628. {
  629. name: "index",
  630. path: "/",
  631. component: () => import("./_nuxt/index-BDsvj-bv.js")
  632. },
  633. {
  634. name: "search-id",
  635. path: "/search/:id()",
  636. component: () => import("./_nuxt/_id_-DYJ3XEyk.js")
  637. },
  638. {
  639. name: "topic-id",
  640. path: "/topic/:id()",
  641. component: () => import("./_nuxt/_id_-CwA5PBWj.js")
  642. },
  643. {
  644. name: "topic",
  645. path: "/topic",
  646. component: () => import("./_nuxt/index-BwfKHbcJ.js")
  647. }
  648. ];
  649. const _wrapIf = (component, props, slots) => {
  650. props = props === true ? {} : props;
  651. return { default: () => {
  652. var _a;
  653. return props ? h(component, props, slots) : (_a = slots.default) == null ? void 0 : _a.call(slots);
  654. } };
  655. };
  656. const ROUTE_KEY_PARENTHESES_RE = /(:\w+)\([^)]+\)/g;
  657. const ROUTE_KEY_SYMBOLS_RE = /(:\w+)[?+*]/g;
  658. const ROUTE_KEY_NORMAL_RE = /:\w+/g;
  659. function generateRouteKey(route) {
  660. const source = (route == null ? void 0 : route.meta.key) ?? route.path.replace(ROUTE_KEY_PARENTHESES_RE, "$1").replace(ROUTE_KEY_SYMBOLS_RE, "$1").replace(ROUTE_KEY_NORMAL_RE, (r) => {
  661. var _a;
  662. return ((_a = route.params[r.slice(1)]) == null ? void 0 : _a.toString()) || "";
  663. });
  664. return typeof source === "function" ? source(route) : source;
  665. }
  666. function isChangingPage(to, from) {
  667. if (to === from || from === START_LOCATION) {
  668. return false;
  669. }
  670. if (generateRouteKey(to) !== generateRouteKey(from)) {
  671. return true;
  672. }
  673. const areComponentsSame = to.matched.every(
  674. (comp, index) => {
  675. var _a, _b;
  676. return comp.components && comp.components.default === ((_b = (_a = from.matched[index]) == null ? void 0 : _a.components) == null ? void 0 : _b.default);
  677. }
  678. );
  679. if (areComponentsSame) {
  680. return false;
  681. }
  682. return true;
  683. }
  684. const routerOptions0 = {
  685. scrollBehavior(to, from, savedPosition) {
  686. var _a;
  687. const nuxtApp = useNuxtApp();
  688. const behavior = ((_a = useRouter().options) == null ? void 0 : _a.scrollBehaviorType) ?? "auto";
  689. let position = savedPosition || void 0;
  690. const routeAllowsScrollToTop = typeof to.meta.scrollToTop === "function" ? to.meta.scrollToTop(to, from) : to.meta.scrollToTop;
  691. if (!position && from && to && routeAllowsScrollToTop !== false && isChangingPage(to, from)) {
  692. position = { left: 0, top: 0 };
  693. }
  694. if (to.path === from.path) {
  695. if (from.hash && !to.hash) {
  696. return { left: 0, top: 0 };
  697. }
  698. if (to.hash) {
  699. return { el: to.hash, top: _getHashElementScrollMarginTop(to.hash), behavior };
  700. }
  701. return false;
  702. }
  703. const hasTransition = (route) => !!(route.meta.pageTransition ?? appPageTransition);
  704. const hookToWait = hasTransition(from) && hasTransition(to) ? "page:transition:finish" : "page:finish";
  705. return new Promise((resolve) => {
  706. nuxtApp.hooks.hookOnce(hookToWait, async () => {
  707. await new Promise((resolve2) => setTimeout(resolve2, 0));
  708. if (to.hash) {
  709. position = { el: to.hash, top: _getHashElementScrollMarginTop(to.hash), behavior };
  710. }
  711. resolve(position);
  712. });
  713. });
  714. }
  715. };
  716. function _getHashElementScrollMarginTop(selector) {
  717. try {
  718. const elem = (void 0).querySelector(selector);
  719. if (elem) {
  720. return (Number.parseFloat(getComputedStyle(elem).scrollMarginTop) || 0) + (Number.parseFloat(getComputedStyle((void 0).documentElement).scrollPaddingTop) || 0);
  721. }
  722. } catch {
  723. }
  724. return 0;
  725. }
  726. const routerOptions1 = {
  727. routes: async (routes) => {
  728. return [
  729. ...routes
  730. //...routeData,
  731. ];
  732. }
  733. };
  734. const configRouterOptions = {
  735. hashMode: false,
  736. scrollBehaviorType: "auto"
  737. };
  738. const hashMode = routerOptions0.hashMode ?? false;
  739. const routerOptions = {
  740. ...configRouterOptions,
  741. ...routerOptions0,
  742. ...routerOptions1
  743. };
  744. const validate = /* @__PURE__ */ defineNuxtRouteMiddleware(async (to) => {
  745. var _a;
  746. let __temp, __restore;
  747. if (!((_a = to.meta) == null ? void 0 : _a.validate)) {
  748. return;
  749. }
  750. const nuxtApp = useNuxtApp();
  751. const router = useRouter();
  752. const result = ([__temp, __restore] = executeAsync(() => Promise.resolve(to.meta.validate(to))), __temp = await __temp, __restore(), __temp);
  753. if (result === true) {
  754. return;
  755. }
  756. const error = createError({
  757. statusCode: result && result.statusCode || 404,
  758. statusMessage: result && result.statusMessage || `Page Not Found: ${to.fullPath}`,
  759. data: {
  760. path: to.fullPath
  761. }
  762. });
  763. const unsub = router.beforeResolve((final) => {
  764. unsub();
  765. if (final === to) {
  766. const unsub2 = router.afterEach(async () => {
  767. unsub2();
  768. await nuxtApp.runWithContext(() => showError(error));
  769. });
  770. return false;
  771. }
  772. });
  773. });
  774. const manifest_45route_45rule = /* @__PURE__ */ defineNuxtRouteMiddleware(async (to) => {
  775. {
  776. return;
  777. }
  778. });
  779. const globalMiddleware = [
  780. validate,
  781. manifest_45route_45rule
  782. ];
  783. const namedMiddleware = {
  784. auth: () => import("./_nuxt/auth-DWp-I46x.js")
  785. };
  786. const plugin = /* @__PURE__ */ defineNuxtPlugin({
  787. name: "nuxt:router",
  788. enforce: "pre",
  789. async setup(nuxtApp) {
  790. var _a, _b, _c;
  791. let __temp, __restore;
  792. let routerBase = (/* @__PURE__ */ useRuntimeConfig()).app.baseURL;
  793. if (hashMode && !routerBase.includes("#")) {
  794. routerBase += "#";
  795. }
  796. const history = ((_a = routerOptions.history) == null ? void 0 : _a.call(routerOptions, routerBase)) ?? createMemoryHistory(routerBase);
  797. const routes = routerOptions.routes ? ([__temp, __restore] = executeAsync(() => routerOptions.routes(_routes)), __temp = await __temp, __restore(), __temp) ?? _routes : _routes;
  798. let startPosition;
  799. const router = createRouter$1({
  800. ...routerOptions,
  801. scrollBehavior: (to, from, savedPosition) => {
  802. if (from === START_LOCATION) {
  803. startPosition = savedPosition;
  804. return;
  805. }
  806. if (routerOptions.scrollBehavior) {
  807. router.options.scrollBehavior = routerOptions.scrollBehavior;
  808. if ("scrollRestoration" in (void 0).history) {
  809. const unsub = router.beforeEach(() => {
  810. unsub();
  811. (void 0).history.scrollRestoration = "manual";
  812. });
  813. }
  814. return routerOptions.scrollBehavior(to, START_LOCATION, startPosition || savedPosition);
  815. }
  816. },
  817. history,
  818. routes
  819. });
  820. handleHotUpdate(router, routerOptions.routes ? routerOptions.routes : (routes2) => routes2);
  821. nuxtApp.vueApp.use(router);
  822. const previousRoute = shallowRef(router.currentRoute.value);
  823. router.afterEach((_to, from) => {
  824. previousRoute.value = from;
  825. });
  826. Object.defineProperty(nuxtApp.vueApp.config.globalProperties, "previousRoute", {
  827. get: () => previousRoute.value
  828. });
  829. const initialURL = nuxtApp.ssrContext.url;
  830. const _route = shallowRef(router.currentRoute.value);
  831. const syncCurrentRoute = () => {
  832. _route.value = router.currentRoute.value;
  833. };
  834. nuxtApp.hook("page:finish", syncCurrentRoute);
  835. router.afterEach((to, from) => {
  836. var _a2, _b2, _c2, _d;
  837. if (((_b2 = (_a2 = to.matched[0]) == null ? void 0 : _a2.components) == null ? void 0 : _b2.default) === ((_d = (_c2 = from.matched[0]) == null ? void 0 : _c2.components) == null ? void 0 : _d.default)) {
  838. syncCurrentRoute();
  839. }
  840. });
  841. const route = {};
  842. for (const key in _route.value) {
  843. Object.defineProperty(route, key, {
  844. get: () => _route.value[key],
  845. enumerable: true
  846. });
  847. }
  848. nuxtApp._route = shallowReactive(route);
  849. nuxtApp._middleware = nuxtApp._middleware || {
  850. global: [],
  851. named: {}
  852. };
  853. useError();
  854. if (!((_b = nuxtApp.ssrContext) == null ? void 0 : _b.islandContext)) {
  855. router.afterEach(async (to, _from, failure) => {
  856. delete nuxtApp._processingMiddleware;
  857. if (failure) {
  858. await nuxtApp.callHook("page:loading:end");
  859. }
  860. if ((failure == null ? void 0 : failure.type) === 4) {
  861. return;
  862. }
  863. if (to.redirectedFrom && to.fullPath !== initialURL) {
  864. await nuxtApp.runWithContext(() => navigateTo(to.fullPath || "/"));
  865. }
  866. });
  867. }
  868. try {
  869. if (true) {
  870. ;
  871. [__temp, __restore] = executeAsync(() => router.push(initialURL)), await __temp, __restore();
  872. ;
  873. }
  874. ;
  875. [__temp, __restore] = executeAsync(() => router.isReady()), await __temp, __restore();
  876. ;
  877. } catch (error2) {
  878. [__temp, __restore] = executeAsync(() => nuxtApp.runWithContext(() => showError(error2))), await __temp, __restore();
  879. }
  880. const resolvedInitialRoute = router.currentRoute.value;
  881. syncCurrentRoute();
  882. if ((_c = nuxtApp.ssrContext) == null ? void 0 : _c.islandContext) {
  883. return { provide: { router } };
  884. }
  885. const initialLayout = nuxtApp.payload.state._layout;
  886. router.beforeEach(async (to, from) => {
  887. var _a2, _b2;
  888. await nuxtApp.callHook("page:loading:start");
  889. to.meta = reactive(to.meta);
  890. if (nuxtApp.isHydrating && initialLayout && !isReadonly(to.meta.layout)) {
  891. to.meta.layout = initialLayout;
  892. }
  893. nuxtApp._processingMiddleware = true;
  894. if (!((_a2 = nuxtApp.ssrContext) == null ? void 0 : _a2.islandContext)) {
  895. const middlewareEntries = /* @__PURE__ */ new Set([...globalMiddleware, ...nuxtApp._middleware.global]);
  896. for (const component of to.matched) {
  897. const componentMiddleware = component.meta.middleware;
  898. if (!componentMiddleware) {
  899. continue;
  900. }
  901. for (const entry2 of toArray(componentMiddleware)) {
  902. middlewareEntries.add(entry2);
  903. }
  904. }
  905. {
  906. const routeRules = await nuxtApp.runWithContext(() => getRouteRules({ path: to.path }));
  907. if (routeRules.appMiddleware) {
  908. for (const key in routeRules.appMiddleware) {
  909. if (routeRules.appMiddleware[key]) {
  910. middlewareEntries.add(key);
  911. } else {
  912. middlewareEntries.delete(key);
  913. }
  914. }
  915. }
  916. }
  917. for (const entry2 of middlewareEntries) {
  918. const middleware = typeof entry2 === "string" ? nuxtApp._middleware.named[entry2] || await ((_b2 = namedMiddleware[entry2]) == null ? void 0 : _b2.call(namedMiddleware).then((r) => r.default || r)) : entry2;
  919. if (!middleware) {
  920. throw new Error(`Unknown route middleware: '${entry2}'.`);
  921. }
  922. const result = await nuxtApp.runWithContext(() => middleware(to, from));
  923. {
  924. if (result === false || result instanceof Error) {
  925. const error2 = result || createError$1({
  926. statusCode: 404,
  927. statusMessage: `Page Not Found: ${initialURL}`
  928. });
  929. await nuxtApp.runWithContext(() => showError(error2));
  930. return false;
  931. }
  932. }
  933. if (result === true) {
  934. continue;
  935. }
  936. if (result || result === false) {
  937. return result;
  938. }
  939. }
  940. }
  941. });
  942. router.onError(async () => {
  943. delete nuxtApp._processingMiddleware;
  944. await nuxtApp.callHook("page:loading:end");
  945. });
  946. router.afterEach(async (to, _from) => {
  947. if (to.matched.length === 0) {
  948. await nuxtApp.runWithContext(() => showError(createError$1({
  949. statusCode: 404,
  950. fatal: false,
  951. statusMessage: `Page not found: ${to.fullPath}`,
  952. data: {
  953. path: to.fullPath
  954. }
  955. })));
  956. }
  957. });
  958. nuxtApp.hooks.hookOnce("app:created", async () => {
  959. try {
  960. if ("name" in resolvedInitialRoute) {
  961. resolvedInitialRoute.name = void 0;
  962. }
  963. await router.replace({
  964. ...resolvedInitialRoute,
  965. force: true
  966. });
  967. router.options.scrollBehavior = routerOptions.scrollBehavior;
  968. } catch (error2) {
  969. await nuxtApp.runWithContext(() => showError(error2));
  970. }
  971. });
  972. return { provide: { router } };
  973. }
  974. });
  975. function definePayloadReducer(name, reduce) {
  976. {
  977. useNuxtApp().ssrContext._payloadReducers[name] = reduce;
  978. }
  979. }
  980. const reducers = [
  981. ["NuxtError", (data) => isNuxtError(data) && data.toJSON()],
  982. ["EmptyShallowRef", (data) => isRef(data) && isShallow(data) && !data.value && (typeof data.value === "bigint" ? "0n" : JSON.stringify(data.value) || "_")],
  983. ["EmptyRef", (data) => isRef(data) && !data.value && (typeof data.value === "bigint" ? "0n" : JSON.stringify(data.value) || "_")],
  984. ["ShallowRef", (data) => isRef(data) && isShallow(data) && data.value],
  985. ["ShallowReactive", (data) => isReactive(data) && isShallow(data) && toRaw(data)],
  986. ["Ref", (data) => isRef(data) && data.value],
  987. ["Reactive", (data) => isReactive(data) && toRaw(data)]
  988. ];
  989. const revive_payload_server_eJ33V7gbc6 = /* @__PURE__ */ defineNuxtPlugin({
  990. name: "nuxt:revive-payload:server",
  991. setup() {
  992. for (const [reducer, fn] of reducers) {
  993. definePayloadReducer(reducer, fn);
  994. }
  995. }
  996. });
  997. const components_plugin_KR1HBZs4kY = /* @__PURE__ */ defineNuxtPlugin({
  998. name: "nuxt:global-components"
  999. });
  1000. const element_plus_elM4AXquKi = /* @__PURE__ */ defineNuxtPlugin(() => {
  1001. });
  1002. const globals_W2yFmejOiw = /* @__PURE__ */ defineNuxtPlugin((nuxtApp) => {
  1003. nuxtApp.provide("webUrl", "http://apipre1.bjzxtw.org.cn:29501");
  1004. nuxtApp.provide("CwebUrl", "http://nwpre.bjzxtw.org.cn");
  1005. nuxtApp.provide("BwebUrl", "http://adminpre.bjzxtw.org.cn");
  1006. nuxtApp.provide("LoginWebUrl", "http://adminpre.bjzxtw.org.cn/adminapi");
  1007. nuxtApp.provide("userUrl", "http://localhost:3000");
  1008. });
  1009. const pinia_Uphuq97G1L = /* @__PURE__ */ defineNuxtPlugin((nuxtApp) => {
  1010. const pinia = createPinia();
  1011. nuxtApp.vueApp.use(pinia);
  1012. return {
  1013. provide: {
  1014. pinia
  1015. }
  1016. };
  1017. });
  1018. const plugins = [
  1019. unhead_KgADcZ0jPj,
  1020. plugin,
  1021. revive_payload_server_eJ33V7gbc6,
  1022. components_plugin_KR1HBZs4kY,
  1023. element_plus_elM4AXquKi,
  1024. globals_W2yFmejOiw,
  1025. pinia_Uphuq97G1L
  1026. ];
  1027. function defaultEstimatedProgress(duration, elapsed) {
  1028. const completionPercentage = elapsed / duration * 100;
  1029. return 2 / Math.PI * 100 * Math.atan(completionPercentage / 50);
  1030. }
  1031. function createLoadingIndicator(opts = {}) {
  1032. opts.estimatedProgress || defaultEstimatedProgress;
  1033. const nuxtApp = useNuxtApp();
  1034. const progress = ref(0);
  1035. const isLoading = ref(false);
  1036. const error = ref(false);
  1037. const start = () => {
  1038. error.value = false;
  1039. set(0);
  1040. };
  1041. function set(at = 0) {
  1042. if (nuxtApp.isHydrating) {
  1043. return;
  1044. }
  1045. if (at >= 100) {
  1046. return finish();
  1047. }
  1048. progress.value = at < 0 ? 0 : at;
  1049. {
  1050. isLoading.value = true;
  1051. }
  1052. }
  1053. function finish(opts2 = {}) {
  1054. progress.value = 100;
  1055. if (opts2.error) {
  1056. error.value = true;
  1057. }
  1058. if (opts2.force) {
  1059. progress.value = 0;
  1060. isLoading.value = false;
  1061. }
  1062. }
  1063. function clear() {
  1064. }
  1065. let _cleanup = () => {
  1066. };
  1067. return {
  1068. _cleanup,
  1069. progress: computed(() => progress.value),
  1070. isLoading: computed(() => isLoading.value),
  1071. error: computed(() => error.value),
  1072. start,
  1073. set,
  1074. finish,
  1075. clear
  1076. };
  1077. }
  1078. function useLoadingIndicator(opts = {}) {
  1079. const nuxtApp = useNuxtApp();
  1080. const indicator = nuxtApp._loadingIndicator = nuxtApp._loadingIndicator || createLoadingIndicator(opts);
  1081. return indicator;
  1082. }
  1083. const __nuxt_component_0 = defineComponent({
  1084. name: "NuxtLoadingIndicator",
  1085. props: {
  1086. throttle: {
  1087. type: Number,
  1088. default: 200
  1089. },
  1090. duration: {
  1091. type: Number,
  1092. default: 2e3
  1093. },
  1094. height: {
  1095. type: Number,
  1096. default: 3
  1097. },
  1098. color: {
  1099. type: [String, Boolean],
  1100. default: "repeating-linear-gradient(to right,#00dc82 0%,#34cdfe 50%,#0047e1 100%)"
  1101. },
  1102. errorColor: {
  1103. type: String,
  1104. default: "repeating-linear-gradient(to right,#f87171 0%,#ef4444 100%)"
  1105. },
  1106. estimatedProgress: {
  1107. type: Function,
  1108. required: false
  1109. }
  1110. },
  1111. setup(props, { slots, expose }) {
  1112. const { progress, isLoading, error, start, finish, clear } = useLoadingIndicator({
  1113. duration: props.duration,
  1114. throttle: props.throttle,
  1115. estimatedProgress: props.estimatedProgress
  1116. });
  1117. expose({
  1118. progress,
  1119. isLoading,
  1120. error,
  1121. start,
  1122. finish,
  1123. clear
  1124. });
  1125. return () => h("div", {
  1126. class: "nuxt-loading-indicator",
  1127. style: {
  1128. position: "fixed",
  1129. top: 0,
  1130. right: 0,
  1131. left: 0,
  1132. pointerEvents: "none",
  1133. width: "auto",
  1134. height: `${props.height}px`,
  1135. opacity: isLoading.value ? 1 : 0,
  1136. background: error.value ? props.errorColor : props.color || void 0,
  1137. backgroundSize: `${100 / progress.value * 100}% auto`,
  1138. transform: `scaleX(${progress.value}%)`,
  1139. transformOrigin: "left",
  1140. transition: "transform 0.1s, height 0.4s, opacity 0.4s",
  1141. zIndex: 999999
  1142. }
  1143. }, slots);
  1144. }
  1145. });
  1146. const layouts = {};
  1147. const LayoutLoader = defineComponent({
  1148. name: "LayoutLoader",
  1149. inheritAttrs: false,
  1150. props: {
  1151. name: String,
  1152. layoutProps: Object
  1153. },
  1154. setup(props, context) {
  1155. return () => h(layouts[props.name], props.layoutProps, context.slots);
  1156. }
  1157. });
  1158. const __nuxt_component_1 = defineComponent({
  1159. name: "NuxtLayout",
  1160. inheritAttrs: false,
  1161. props: {
  1162. name: {
  1163. type: [String, Boolean, Object],
  1164. default: null
  1165. },
  1166. fallback: {
  1167. type: [String, Object],
  1168. default: null
  1169. }
  1170. },
  1171. setup(props, context) {
  1172. const nuxtApp = useNuxtApp();
  1173. const injectedRoute = inject(PageRouteSymbol);
  1174. const route = injectedRoute === useRoute() ? useRoute$1() : injectedRoute;
  1175. const layout = computed(() => {
  1176. let layout2 = unref(props.name) ?? route.meta.layout ?? "default";
  1177. if (layout2 && !(layout2 in layouts)) {
  1178. if (props.fallback) {
  1179. layout2 = unref(props.fallback);
  1180. }
  1181. }
  1182. return layout2;
  1183. });
  1184. const layoutRef = ref();
  1185. context.expose({ layoutRef });
  1186. const done = nuxtApp.deferHydration();
  1187. return () => {
  1188. const hasLayout = layout.value && layout.value in layouts;
  1189. const transitionProps = route.meta.layoutTransition ?? appLayoutTransition;
  1190. return _wrapIf(Transition, hasLayout && transitionProps, {
  1191. default: () => h(Suspense, { suspensible: true, onResolve: () => {
  1192. nextTick(done);
  1193. } }, {
  1194. default: () => h(
  1195. LayoutProvider,
  1196. {
  1197. layoutProps: mergeProps(context.attrs, { ref: layoutRef }),
  1198. key: layout.value || void 0,
  1199. name: layout.value,
  1200. shouldProvide: !props.name,
  1201. hasTransition: !!transitionProps
  1202. },
  1203. context.slots
  1204. )
  1205. })
  1206. }).default();
  1207. };
  1208. }
  1209. });
  1210. const LayoutProvider = defineComponent({
  1211. name: "NuxtLayoutProvider",
  1212. inheritAttrs: false,
  1213. props: {
  1214. name: {
  1215. type: [String, Boolean]
  1216. },
  1217. layoutProps: {
  1218. type: Object
  1219. },
  1220. hasTransition: {
  1221. type: Boolean
  1222. },
  1223. shouldProvide: {
  1224. type: Boolean
  1225. }
  1226. },
  1227. setup(props, context) {
  1228. const name = props.name;
  1229. if (props.shouldProvide) {
  1230. provide(LayoutMetaSymbol, {
  1231. isCurrent: (route) => name === (route.meta.layout ?? "default")
  1232. });
  1233. }
  1234. return () => {
  1235. var _a, _b;
  1236. if (!name || typeof name === "string" && !(name in layouts)) {
  1237. return (_b = (_a = context.slots).default) == null ? void 0 : _b.call(_a);
  1238. }
  1239. return h(
  1240. LayoutLoader,
  1241. { key: name, layoutProps: props.layoutProps, name },
  1242. context.slots
  1243. );
  1244. };
  1245. }
  1246. });
  1247. const RouteProvider = defineComponent({
  1248. props: {
  1249. vnode: {
  1250. type: Object,
  1251. required: true
  1252. },
  1253. route: {
  1254. type: Object,
  1255. required: true
  1256. },
  1257. vnodeRef: Object,
  1258. renderKey: String,
  1259. trackRootNodes: Boolean
  1260. },
  1261. setup(props) {
  1262. const previousKey = props.renderKey;
  1263. const previousRoute = props.route;
  1264. const route = {};
  1265. for (const key in props.route) {
  1266. Object.defineProperty(route, key, {
  1267. get: () => previousKey === props.renderKey ? props.route[key] : previousRoute[key],
  1268. enumerable: true
  1269. });
  1270. }
  1271. provide(PageRouteSymbol, shallowReactive(route));
  1272. return () => {
  1273. return h(props.vnode, { ref: props.vnodeRef });
  1274. };
  1275. }
  1276. });
  1277. const __nuxt_component_2 = defineComponent({
  1278. name: "NuxtPage",
  1279. inheritAttrs: false,
  1280. props: {
  1281. name: {
  1282. type: String
  1283. },
  1284. transition: {
  1285. type: [Boolean, Object],
  1286. default: void 0
  1287. },
  1288. keepalive: {
  1289. type: [Boolean, Object],
  1290. default: void 0
  1291. },
  1292. route: {
  1293. type: Object
  1294. },
  1295. pageKey: {
  1296. type: [Function, String],
  1297. default: null
  1298. }
  1299. },
  1300. setup(props, { attrs, slots, expose }) {
  1301. const nuxtApp = useNuxtApp();
  1302. const pageRef = ref();
  1303. const forkRoute = inject(PageRouteSymbol, null);
  1304. let previousPageKey;
  1305. expose({ pageRef });
  1306. inject(LayoutMetaSymbol, null);
  1307. let vnode;
  1308. const done = nuxtApp.deferHydration();
  1309. if (props.pageKey) {
  1310. watch(() => props.pageKey, (next, prev) => {
  1311. if (next !== prev) {
  1312. nuxtApp.callHook("page:loading:start");
  1313. }
  1314. });
  1315. }
  1316. let pageLoadingEndHookAlreadyCalled = false;
  1317. return () => {
  1318. return h(RouterView, { name: props.name, route: props.route, ...attrs }, {
  1319. default: (routeProps) => {
  1320. if (!routeProps.Component) {
  1321. done();
  1322. return;
  1323. }
  1324. const key = generateRouteKey$1(routeProps, props.pageKey);
  1325. if (!nuxtApp.isHydrating && !hasChildrenRoutes(forkRoute, routeProps.route, routeProps.Component) && previousPageKey === key) {
  1326. nuxtApp.callHook("page:loading:end");
  1327. pageLoadingEndHookAlreadyCalled = true;
  1328. }
  1329. previousPageKey = key;
  1330. const hasTransition = !!(props.transition ?? routeProps.route.meta.pageTransition ?? appPageTransition);
  1331. const transitionProps = hasTransition && _mergeTransitionProps([
  1332. props.transition,
  1333. routeProps.route.meta.pageTransition,
  1334. appPageTransition,
  1335. { onAfterLeave: () => {
  1336. nuxtApp.callHook("page:transition:finish", routeProps.Component);
  1337. } }
  1338. ].filter(Boolean));
  1339. const keepaliveConfig = props.keepalive ?? routeProps.route.meta.keepalive ?? appKeepalive;
  1340. vnode = _wrapIf(
  1341. Transition,
  1342. hasTransition && transitionProps,
  1343. wrapInKeepAlive(
  1344. keepaliveConfig,
  1345. h(Suspense, {
  1346. suspensible: true,
  1347. onPending: () => nuxtApp.callHook("page:start", routeProps.Component),
  1348. onResolve: () => {
  1349. nextTick(() => nuxtApp.callHook("page:finish", routeProps.Component).then(() => {
  1350. if (!pageLoadingEndHookAlreadyCalled) {
  1351. return nuxtApp.callHook("page:loading:end");
  1352. }
  1353. pageLoadingEndHookAlreadyCalled = false;
  1354. }).finally(done));
  1355. }
  1356. }, {
  1357. default: () => {
  1358. const providerVNode = h(RouteProvider, {
  1359. key: key || void 0,
  1360. vnode: slots.default ? h(Fragment, void 0, slots.default(routeProps)) : routeProps.Component,
  1361. route: routeProps.route,
  1362. renderKey: key || void 0,
  1363. trackRootNodes: hasTransition,
  1364. vnodeRef: pageRef
  1365. });
  1366. return providerVNode;
  1367. }
  1368. })
  1369. )
  1370. ).default();
  1371. return vnode;
  1372. }
  1373. });
  1374. };
  1375. }
  1376. });
  1377. function _mergeTransitionProps(routeProps) {
  1378. const _props = routeProps.map((prop) => ({
  1379. ...prop,
  1380. onAfterLeave: prop.onAfterLeave ? toArray(prop.onAfterLeave) : void 0
  1381. }));
  1382. return defu(..._props);
  1383. }
  1384. function hasChildrenRoutes(fork, newRoute, Component) {
  1385. if (!fork) {
  1386. return false;
  1387. }
  1388. const index = newRoute.matched.findIndex((m) => {
  1389. var _a;
  1390. return ((_a = m.components) == null ? void 0 : _a.default) === (Component == null ? void 0 : Component.type);
  1391. });
  1392. return index < newRoute.matched.length - 1;
  1393. }
  1394. const _export_sfc = (sfc, props) => {
  1395. const target = sfc.__vccOpts || sfc;
  1396. for (const [key, val] of props) {
  1397. target[key] = val;
  1398. }
  1399. return target;
  1400. };
  1401. const _sfc_main$2 = {};
  1402. function _sfc_ssrRender(_ctx, _push, _parent, _attrs) {
  1403. const _component_NuxtLoadingIndicator = __nuxt_component_0;
  1404. const _component_NuxtLayout = __nuxt_component_1;
  1405. const _component_NuxtPage = __nuxt_component_2;
  1406. _push(`<!--[-->`);
  1407. _push(ssrRenderComponent(_component_NuxtLoadingIndicator, { color: "#49A769" }, null, _parent));
  1408. _push(ssrRenderComponent(_component_NuxtLayout, null, {
  1409. default: withCtx((_, _push2, _parent2, _scopeId) => {
  1410. if (_push2) {
  1411. _push2(ssrRenderComponent(_component_NuxtPage, null, null, _parent2, _scopeId));
  1412. } else {
  1413. return [
  1414. createVNode(_component_NuxtPage)
  1415. ];
  1416. }
  1417. }),
  1418. _: 1
  1419. }, _parent));
  1420. _push(`<!--]-->`);
  1421. }
  1422. const _sfc_setup$2 = _sfc_main$2.setup;
  1423. _sfc_main$2.setup = (props, ctx) => {
  1424. const ssrContext = useSSRContext();
  1425. (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("app.vue");
  1426. return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
  1427. };
  1428. const AppComponent = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender]]);
  1429. const _sfc_main$1 = {
  1430. __name: "error",
  1431. __ssrInlineRender: true,
  1432. setup(__props) {
  1433. useRouter();
  1434. return (_ctx, _push, _parent, _attrs) => {
  1435. _push(`<div${ssrRenderAttrs(mergeProps({ class: "errorBox" }, _attrs))} data-v-ea3a617f><img src="https://img.bjzxtw.org.cn/pre/public/error/404.png" alt="遇到了网络错误!" data-v-ea3a617f><div class="goHome" data-v-ea3a617f> 返回网站首页 </div></div>`);
  1436. };
  1437. }
  1438. };
  1439. const _sfc_setup$1 = _sfc_main$1.setup;
  1440. _sfc_main$1.setup = (props, ctx) => {
  1441. const ssrContext = useSSRContext();
  1442. (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("error.vue");
  1443. return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
  1444. };
  1445. const ErrorComponent = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-ea3a617f"]]);
  1446. const _sfc_main = {
  1447. __name: "nuxt-root",
  1448. __ssrInlineRender: true,
  1449. setup(__props) {
  1450. const IslandRenderer = () => null;
  1451. const nuxtApp = useNuxtApp();
  1452. nuxtApp.deferHydration();
  1453. nuxtApp.ssrContext.url;
  1454. const SingleRenderer = false;
  1455. provide(PageRouteSymbol, useRoute());
  1456. nuxtApp.hooks.callHookWith((hooks) => hooks.map((hook) => hook()), "vue:setup");
  1457. const error = useError();
  1458. const abortRender = error.value && !nuxtApp.ssrContext.error;
  1459. onErrorCaptured((err, target, info) => {
  1460. nuxtApp.hooks.callHook("vue:error", err, target, info).catch((hookError) => console.error("[nuxt] Error in `vue:error` hook", hookError));
  1461. {
  1462. const p = nuxtApp.runWithContext(() => showError(err));
  1463. onServerPrefetch(() => p);
  1464. return false;
  1465. }
  1466. });
  1467. const islandContext = nuxtApp.ssrContext.islandContext;
  1468. return (_ctx, _push, _parent, _attrs) => {
  1469. ssrRenderSuspense(_push, {
  1470. default: () => {
  1471. if (unref(abortRender)) {
  1472. _push(`<div></div>`);
  1473. } else if (unref(error)) {
  1474. _push(ssrRenderComponent(unref(ErrorComponent), { error: unref(error) }, null, _parent));
  1475. } else if (unref(islandContext)) {
  1476. _push(ssrRenderComponent(unref(IslandRenderer), { context: unref(islandContext) }, null, _parent));
  1477. } else if (unref(SingleRenderer)) {
  1478. ssrRenderVNode(_push, createVNode(resolveDynamicComponent(unref(SingleRenderer)), null, null), _parent);
  1479. } else {
  1480. _push(ssrRenderComponent(unref(AppComponent), null, null, _parent));
  1481. }
  1482. },
  1483. _: 1
  1484. });
  1485. };
  1486. }
  1487. };
  1488. const _sfc_setup = _sfc_main.setup;
  1489. _sfc_main.setup = (props, ctx) => {
  1490. const ssrContext = useSSRContext();
  1491. (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("node_modules/nuxt/dist/app/components/nuxt-root.vue");
  1492. return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
  1493. };
  1494. let entry;
  1495. {
  1496. entry = async function createNuxtAppServer(ssrContext) {
  1497. const vueApp = createApp(_sfc_main);
  1498. const nuxt = createNuxtApp({ vueApp, ssrContext });
  1499. try {
  1500. await applyPlugins(nuxt, plugins);
  1501. await nuxt.hooks.callHook("app:created", vueApp);
  1502. } catch (error) {
  1503. await nuxt.hooks.callHook("app:error", error);
  1504. nuxt.payload.error = nuxt.payload.error || createError(error);
  1505. }
  1506. if (ssrContext == null ? void 0 : ssrContext._renderResponse) {
  1507. throw new Error("skipping render");
  1508. }
  1509. return vueApp;
  1510. };
  1511. }
  1512. const entry$1 = (ssrContext) => entry(ssrContext);
  1513. export {
  1514. _export_sfc as _,
  1515. useRoute as a,
  1516. asyncDataDefaults as b,
  1517. createError as c,
  1518. useRouter as d,
  1519. entry$1 as default,
  1520. resolveRouteObject as e,
  1521. navigateTo as f,
  1522. useRuntimeConfig as g,
  1523. hashMode as h,
  1524. injectHead as i,
  1525. defineNuxtRouteMiddleware as j,
  1526. nuxtLinkDefaults as n,
  1527. resolveUnrefHeadInput as r,
  1528. useNuxtApp as u
  1529. };
  1530. //# sourceMappingURL=server.mjs.map