longz
2026-04-28 bfa7d3b23e526809b04299d9c2719c3449aba3be
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { createSSRApp } from 'vue'
import App from './App.vue'
import router from './router'
import 'uno.css'
 
if (typeof globalThis.TextEncoder === 'undefined') {
  class MiniTextEncoder {
    encode(input = '') {
      const bytes: number[] = []
      for (const char of input) {
        const codePoint = char.codePointAt(0) ?? 0
        if (codePoint <= 0x7F) {
          bytes.push(codePoint)
          continue
        }
        if (codePoint <= 0x7FF) {
          bytes.push(
            0xC0 | (codePoint >> 6),
            0x80 | (codePoint & 0x3F),
          )
          continue
        }
        if (codePoint <= 0xFFFF) {
          bytes.push(
            0xE0 | (codePoint >> 12),
            0x80 | ((codePoint >> 6) & 0x3F),
            0x80 | (codePoint & 0x3F),
          )
          continue
        }
        bytes.push(
          0xF0 | (codePoint >> 18),
          0x80 | ((codePoint >> 12) & 0x3F),
          0x80 | ((codePoint >> 6) & 0x3F),
          0x80 | (codePoint & 0x3F),
        )
      }
      return new Uint8Array(bytes)
    }
  }
 
  globalThis.TextEncoder = MiniTextEncoder as typeof TextEncoder
}
 
const pinia = createPinia()
pinia.use(persistPlugin)
export function createApp() {
  const app = createSSRApp(App)
  app.use(router)
  app.use(pinia)
  return {
    app,
  }
}