shelfware 0.0.1 → 0.1.1

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.
Files changed (206) hide show
  1. package/.output/nitro.json +15 -0
  2. package/.output/public/_nuxt/6IstVYrV.js +1 -0
  3. package/.output/public/_nuxt/9C5WUlLE.js +36 -0
  4. package/.output/public/_nuxt/BDNMzG2s.js +1 -0
  5. package/.output/public/_nuxt/BW3xJdEx.js +1 -0
  6. package/.output/public/_nuxt/BXXtFil5.js +1 -0
  7. package/.output/public/_nuxt/BZuUK3cr.js +1 -0
  8. package/.output/public/_nuxt/BeLyMmd4.js +1 -0
  9. package/.output/public/_nuxt/C_VgD9ZI.js +3 -0
  10. package/.output/public/_nuxt/DB5Vxbte.js +2 -0
  11. package/.output/public/_nuxt/DMg0j7gv.js +14 -0
  12. package/.output/public/_nuxt/builds/latest.json +1 -0
  13. package/.output/public/_nuxt/builds/meta/e0d2b6a3-3a30-44b7-8c79-a56f66400005.json +1 -0
  14. package/.output/public/_nuxt/entry.b3_DJTEt.css +2 -0
  15. package/.output/public/_nuxt/error-404.CHsn7XF-.css +1 -0
  16. package/.output/public/_nuxt/error-500.Bawx2bLr.css +1 -0
  17. package/.output/server/chunks/_/api-handler.mjs +44 -0
  18. package/.output/server/chunks/_/batch.mjs +27 -0
  19. package/.output/server/chunks/_/catalog.mjs +1115 -0
  20. package/.output/server/chunks/_/detail.mjs +16 -0
  21. package/.output/server/chunks/_/error-500.mjs +19 -0
  22. package/.output/server/chunks/_/quarantine.mjs +159 -0
  23. package/.output/server/chunks/nitro/nitro.mjs +5399 -0
  24. package/.output/server/chunks/routes/api/_..._.mjs +16 -0
  25. package/.output/server/chunks/routes/api/health.get.mjs +13 -0
  26. package/.output/server/chunks/routes/api/skills/_id/file.get.mjs +25 -0
  27. package/.output/server/chunks/routes/api/skills/_id_.get.mjs +25 -0
  28. package/.output/server/chunks/routes/api/skills/_id_.put.mjs +74 -0
  29. package/.output/server/chunks/routes/api/skills/delete.post.mjs +48 -0
  30. package/.output/server/chunks/routes/api/skills/quarantine.post.mjs +26 -0
  31. package/.output/server/chunks/routes/api/skills/restore.post.mjs +26 -0
  32. package/.output/server/chunks/routes/api/skills.get.mjs +41 -0
  33. package/.output/server/chunks/routes/renderer.mjs +341 -0
  34. package/.output/server/chunks/virtual/_virtual_spa-template.mjs +3 -0
  35. package/.output/server/chunks/virtual/precomputed.mjs +3 -0
  36. package/.output/server/index.mjs +9 -0
  37. package/.output/server/node_modules/@babel/parser/lib/index.js +14611 -0
  38. package/.output/server/node_modules/@babel/parser/package.json +50 -0
  39. package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6801 -0
  40. package/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
  41. package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +692 -0
  42. package/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
  43. package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1420 -0
  44. package/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
  45. package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1903 -0
  46. package/.output/server/node_modules/@vue/reactivity/package.json +55 -0
  47. package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6980 -0
  48. package/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
  49. package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1867 -0
  50. package/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
  51. package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +904 -0
  52. package/.output/server/node_modules/@vue/server-renderer/package.json +53 -0
  53. package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +636 -0
  54. package/.output/server/node_modules/@vue/shared/package.json +47 -0
  55. package/.output/server/node_modules/devalue/index.js +17 -0
  56. package/.output/server/node_modules/devalue/package.json +39 -0
  57. package/.output/server/node_modules/devalue/src/base64.js +60 -0
  58. package/.output/server/node_modules/devalue/src/constants.js +12 -0
  59. package/.output/server/node_modules/devalue/src/operations.js +193 -0
  60. package/.output/server/node_modules/devalue/src/parse.js +274 -0
  61. package/.output/server/node_modules/devalue/src/stringify.js +428 -0
  62. package/.output/server/node_modules/devalue/src/uneval.js +606 -0
  63. package/.output/server/node_modules/devalue/src/utils.js +185 -0
  64. package/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
  65. package/.output/server/node_modules/entities/dist/commonjs/decode.js +568 -0
  66. package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
  67. package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
  68. package/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
  69. package/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
  70. package/.output/server/node_modules/entities/dist/commonjs/package.json +3 -0
  71. package/.output/server/node_modules/entities/package.json +120 -0
  72. package/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
  73. package/.output/server/node_modules/estree-walker/package.json +37 -0
  74. package/.output/server/node_modules/hookable/dist/index.mjs +257 -0
  75. package/.output/server/node_modules/hookable/package.json +53 -0
  76. package/.output/server/node_modules/nostics/dist/formatters/ansi.mjs +19 -0
  77. package/.output/server/node_modules/nostics/dist/index.mjs +187 -0
  78. package/.output/server/node_modules/nostics/package.json +125 -0
  79. package/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
  80. package/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  81. package/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
  82. package/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
  83. package/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
  84. package/.output/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
  85. package/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
  86. package/.output/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
  87. package/.output/server/node_modules/source-map-js/lib/source-node.js +413 -0
  88. package/.output/server/node_modules/source-map-js/lib/util.js +594 -0
  89. package/.output/server/node_modules/source-map-js/package.json +71 -0
  90. package/.output/server/node_modules/source-map-js/source-map.js +8 -0
  91. package/.output/server/node_modules/ufo/dist/index.mjs +645 -0
  92. package/.output/server/node_modules/ufo/package.json +48 -0
  93. package/.output/server/node_modules/unhead/dist/client.mjs +22 -0
  94. package/.output/server/node_modules/unhead/dist/legacy.mjs +33 -0
  95. package/.output/server/node_modules/unhead/dist/minify.mjs +183 -0
  96. package/.output/server/node_modules/unhead/dist/parser.mjs +518 -0
  97. package/.output/server/node_modules/unhead/dist/plugins.mjs +720 -0
  98. package/.output/server/node_modules/unhead/dist/server.mjs +99 -0
  99. package/.output/server/node_modules/unhead/dist/shared/unhead.-hZVKou0.mjs +400 -0
  100. package/.output/server/node_modules/unhead/dist/shared/unhead.BEmVMkeA.mjs +673 -0
  101. package/.output/server/node_modules/unhead/dist/shared/unhead.BGFxPGPQ.mjs +47 -0
  102. package/.output/server/node_modules/unhead/dist/shared/unhead.BQWSw36o.mjs +192 -0
  103. package/.output/server/node_modules/unhead/dist/shared/unhead.Bf_fPVYA.mjs +6 -0
  104. package/.output/server/node_modules/unhead/dist/shared/unhead.Bjbp1C8D.mjs +224 -0
  105. package/.output/server/node_modules/unhead/dist/shared/unhead.Bm4Y6XQI.mjs +17 -0
  106. package/.output/server/node_modules/unhead/dist/shared/unhead.C5Bksi2B.mjs +49 -0
  107. package/.output/server/node_modules/unhead/dist/shared/unhead.CGPOfp5O.mjs +32 -0
  108. package/.output/server/node_modules/unhead/dist/shared/unhead.CHEy9ana.mjs +7 -0
  109. package/.output/server/node_modules/unhead/dist/shared/unhead.D7HkBzZn.mjs +59 -0
  110. package/.output/server/node_modules/unhead/dist/shared/unhead.Dssd7L5I.mjs +196 -0
  111. package/.output/server/node_modules/unhead/dist/shared/unhead.jEy9BmRq.mjs +264 -0
  112. package/.output/server/node_modules/unhead/dist/shared/unhead.oZ7pkTV1.mjs +19 -0
  113. package/.output/server/node_modules/unhead/dist/shared/unhead.tQnRaXfX.mjs +240 -0
  114. package/.output/server/node_modules/unhead/dist/stream/client.mjs +33 -0
  115. package/.output/server/node_modules/unhead/dist/stream/iife.mjs +2 -0
  116. package/.output/server/node_modules/unhead/dist/stream/server.mjs +445 -0
  117. package/.output/server/node_modules/unhead/dist/utils.mjs +7 -0
  118. package/.output/server/node_modules/unhead/package.json +179 -0
  119. package/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
  120. package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
  121. package/.output/server/node_modules/vue/index.js +7 -0
  122. package/.output/server/node_modules/vue/index.mjs +1 -0
  123. package/.output/server/node_modules/vue/package.json +112 -0
  124. package/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
  125. package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +278 -0
  126. package/.output/server/node_modules/vue-bundle-renderer/package.json +54 -0
  127. package/.output/server/node_modules/yaml/dist/compose/compose-collection.js +90 -0
  128. package/.output/server/node_modules/yaml/dist/compose/compose-doc.js +45 -0
  129. package/.output/server/node_modules/yaml/dist/compose/compose-node.js +112 -0
  130. package/.output/server/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
  131. package/.output/server/node_modules/yaml/dist/compose/composer.js +224 -0
  132. package/.output/server/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
  133. package/.output/server/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
  134. package/.output/server/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
  135. package/.output/server/node_modules/yaml/dist/compose/resolve-end.js +39 -0
  136. package/.output/server/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
  137. package/.output/server/node_modules/yaml/dist/compose/resolve-flow-scalar.js +227 -0
  138. package/.output/server/node_modules/yaml/dist/compose/resolve-props.js +148 -0
  139. package/.output/server/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
  140. package/.output/server/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
  141. package/.output/server/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
  142. package/.output/server/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
  143. package/.output/server/node_modules/yaml/dist/doc/Document.js +337 -0
  144. package/.output/server/node_modules/yaml/dist/doc/anchors.js +76 -0
  145. package/.output/server/node_modules/yaml/dist/doc/applyReviver.js +57 -0
  146. package/.output/server/node_modules/yaml/dist/doc/createNode.js +90 -0
  147. package/.output/server/node_modules/yaml/dist/doc/directives.js +178 -0
  148. package/.output/server/node_modules/yaml/dist/errors.js +62 -0
  149. package/.output/server/node_modules/yaml/dist/index.js +50 -0
  150. package/.output/server/node_modules/yaml/dist/log.js +19 -0
  151. package/.output/server/node_modules/yaml/dist/nodes/Alias.js +118 -0
  152. package/.output/server/node_modules/yaml/dist/nodes/Collection.js +151 -0
  153. package/.output/server/node_modules/yaml/dist/nodes/Node.js +40 -0
  154. package/.output/server/node_modules/yaml/dist/nodes/Pair.js +39 -0
  155. package/.output/server/node_modules/yaml/dist/nodes/Scalar.js +27 -0
  156. package/.output/server/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
  157. package/.output/server/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
  158. package/.output/server/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
  159. package/.output/server/node_modules/yaml/dist/nodes/identity.js +53 -0
  160. package/.output/server/node_modules/yaml/dist/nodes/toJS.js +39 -0
  161. package/.output/server/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
  162. package/.output/server/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
  163. package/.output/server/node_modules/yaml/dist/parse/cst-visit.js +99 -0
  164. package/.output/server/node_modules/yaml/dist/parse/cst.js +112 -0
  165. package/.output/server/node_modules/yaml/dist/parse/lexer.js +723 -0
  166. package/.output/server/node_modules/yaml/dist/parse/line-counter.js +41 -0
  167. package/.output/server/node_modules/yaml/dist/parse/parser.js +980 -0
  168. package/.output/server/node_modules/yaml/dist/public-api.js +107 -0
  169. package/.output/server/node_modules/yaml/dist/schema/Schema.js +39 -0
  170. package/.output/server/node_modules/yaml/dist/schema/common/map.js +19 -0
  171. package/.output/server/node_modules/yaml/dist/schema/common/null.js +17 -0
  172. package/.output/server/node_modules/yaml/dist/schema/common/seq.js +19 -0
  173. package/.output/server/node_modules/yaml/dist/schema/common/string.js +16 -0
  174. package/.output/server/node_modules/yaml/dist/schema/core/bool.js +21 -0
  175. package/.output/server/node_modules/yaml/dist/schema/core/float.js +47 -0
  176. package/.output/server/node_modules/yaml/dist/schema/core/int.js +42 -0
  177. package/.output/server/node_modules/yaml/dist/schema/core/schema.js +25 -0
  178. package/.output/server/node_modules/yaml/dist/schema/json/schema.js +64 -0
  179. package/.output/server/node_modules/yaml/dist/schema/tags.js +99 -0
  180. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
  181. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
  182. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
  183. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
  184. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
  185. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
  186. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
  187. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
  188. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
  189. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
  190. package/.output/server/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
  191. package/.output/server/node_modules/yaml/dist/stringify/stringify.js +132 -0
  192. package/.output/server/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
  193. package/.output/server/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
  194. package/.output/server/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
  195. package/.output/server/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
  196. package/.output/server/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
  197. package/.output/server/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
  198. package/.output/server/node_modules/yaml/dist/visit.js +236 -0
  199. package/.output/server/node_modules/yaml/package.json +97 -0
  200. package/.output/server/package.json +28 -0
  201. package/LICENSE +21 -0
  202. package/README.md +57 -1
  203. package/bin/launch.mjs +216 -0
  204. package/bin/shelfware.mjs +11 -0
  205. package/package.json +64 -5
  206. package/cli.mjs +0 -3
@@ -0,0 +1,99 @@
1
+ import { parseHtmlForUnheadExtraction, applyHeadToHtml, parseHtmlForIndexes } from './parser.mjs';
2
+ export { prepareTemplate } from './parser.mjs';
3
+ import { a as capoTagWeight } from './shared/unhead.Dssd7L5I.mjs';
4
+ export { c as createHead, b as createServerRenderer, e as escapeHtml, p as propsToString, r as renderSSRHead, s as ssrRenderTags, t as tagToString } from './shared/unhead.Dssd7L5I.mjs';
5
+ import { n as normalizeEntryToTags, d as dedupeKey, h as hashTag } from './shared/unhead.-hZVKou0.mjs';
6
+ import './shared/unhead.Bf_fPVYA.mjs';
7
+ import './shared/unhead.D7HkBzZn.mjs';
8
+ import './shared/unhead.Bm4Y6XQI.mjs';
9
+ import 'hookable';
10
+ import './shared/unhead.CGPOfp5O.mjs';
11
+
12
+ let extractedTemplates;
13
+ function cloneExtractedInput(value) {
14
+ if (Array.isArray(value))
15
+ return value.map(cloneExtractedInput);
16
+ if (value && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype) {
17
+ const clone = {};
18
+ for (const key of Object.keys(value))
19
+ clone[key] = cloneExtractedInput(value[key]);
20
+ return clone;
21
+ }
22
+ return value;
23
+ }
24
+ function freezeExtractedInput(value) {
25
+ if (Array.isArray(value)) {
26
+ for (const item of value)
27
+ freezeExtractedInput(item);
28
+ } else if (value && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype) {
29
+ for (const key of Object.keys(value))
30
+ freezeExtractedInput(value[key]);
31
+ }
32
+ return value && typeof value === "object" ? Object.freeze(value) : value;
33
+ }
34
+ function hasHooks(head) {
35
+ const hooks = head.hooks?._hooks || {};
36
+ for (const key in hooks) {
37
+ if (hooks[key]?.length)
38
+ return true;
39
+ }
40
+ return false;
41
+ }
42
+ function precomputeExtractedTags(input) {
43
+ const tags = normalizeEntryToTags(input, []);
44
+ for (let i = 0; i < tags.length; i++) {
45
+ const tag = tags[i];
46
+ tag._w = capoTagWeight(tag);
47
+ tag._p = i;
48
+ tag._d = dedupeKey(tag);
49
+ if (!tag._d)
50
+ tag._h = hashTag(tag);
51
+ }
52
+ return tags;
53
+ }
54
+ function extractPreparedTemplate(prepared) {
55
+ const cache = extractedTemplates ||= /* @__PURE__ */ new WeakMap();
56
+ let extracted = cache.get(prepared);
57
+ if (!extracted) {
58
+ const template = parseHtmlForUnheadExtraction(prepared.html);
59
+ freezeExtractedInput(template.input);
60
+ Object.freeze(template.indexes);
61
+ Object.freeze(template);
62
+ const tags = precomputeExtractedTags(template.input);
63
+ freezeExtractedInput(tags);
64
+ extracted = Object.freeze({
65
+ template,
66
+ tags
67
+ });
68
+ cache.set(prepared, extracted);
69
+ }
70
+ return extracted;
71
+ }
72
+ // @__NO_SIDE_EFFECTS__
73
+ function transformHtmlTemplate(head, html) {
74
+ let cached;
75
+ let template;
76
+ if (typeof html === "string") {
77
+ template = parseHtmlForUnheadExtraction(html);
78
+ } else {
79
+ cached = extractPreparedTemplate(html);
80
+ template = cached.template;
81
+ }
82
+ const hooked = cached ? hasHooks(head) : false;
83
+ const hasDynamicResolver = cached ? head.resolvedOptions.propResolvers?.some((resolver) => !resolver._static) || false : false;
84
+ const input = cached && (hooked || hasDynamicResolver) ? cloneExtractedInput(template.input) : template.input;
85
+ head.push(input, { _index: 0 });
86
+ if (cached && !hooked && head.resolvedOptions._tagWeight === capoTagWeight && !hasDynamicResolver) {
87
+ const entry = head.entries.get(0);
88
+ if (entry)
89
+ entry._precomputedTags = cached.tags;
90
+ }
91
+ return applyHeadToHtml(template, head.render());
92
+ }
93
+ // @__NO_SIDE_EFFECTS__
94
+ function transformHtmlTemplateRaw(head, html) {
95
+ const template = typeof html === "string" ? parseHtmlForIndexes(html) : html;
96
+ return applyHeadToHtml(template, head.render());
97
+ }
98
+
99
+ export { capoTagWeight, transformHtmlTemplate, transformHtmlTemplateRaw };
@@ -0,0 +1,400 @@
1
+ import { U as UniqueTags, c as TagsWithInnerContent, M as MetaTagsArrayable, i as isUnsafeKey, H as HasElementTags, T as TagConfigKeys, D as DupeableTags, d as UsesMergeStrategy, V as ValidHeadTags, h as hasContent } from './unhead.CGPOfp5O.mjs';
2
+ import { a as callHook } from './unhead.Bm4Y6XQI.mjs';
3
+
4
+ const META_NOREWRITE_RE = /^(?:viewport|description|keywords|robots)$/;
5
+ const META_KEY_ATTRS = ["name", "property", "http-equiv"];
6
+ function isMetaArrayDupeKey(v) {
7
+ const i = v.indexOf(":");
8
+ if (i === -1)
9
+ return false;
10
+ const key = v.slice(i + 1);
11
+ return MetaTagsArrayable.has(key) || key.startsWith("og:image:") || key.startsWith("og:video:") || key.startsWith("og:audio:") || key.startsWith("twitter:image:");
12
+ }
13
+ function dedupeKey(tag) {
14
+ const { props, tag: t, key } = tag;
15
+ if (UniqueTags.has(t))
16
+ return t;
17
+ if (t === "link") {
18
+ if (props.rel === "canonical")
19
+ return "canonical";
20
+ if (props.rel === "alternate" && props.hreflang)
21
+ return `alternate:${props.hreflang}`;
22
+ }
23
+ if (props.charset)
24
+ return "charset";
25
+ if (t === "meta") {
26
+ for (const n of META_KEY_ATTRS) {
27
+ const v = props[n];
28
+ if (v !== void 0)
29
+ return `meta:${v}${(typeof v !== "string" || !v.includes(":")) && !META_NOREWRITE_RE.test(v) && key ? `:key:${key}` : ""}`;
30
+ }
31
+ }
32
+ if (key)
33
+ return `${t}:key:${key}`;
34
+ if (props.id)
35
+ return `${t}:id:${props.id}`;
36
+ if (t === "link" && props.rel && props.href)
37
+ return `link:${props.rel}:${props.href}`;
38
+ return TagsWithInnerContent.has(t) && (tag.textContent || tag.innerHTML) ? `${t}:content:${tag.textContent || tag.innerHTML}` : void 0;
39
+ }
40
+ function hashTag(tag) {
41
+ const identity = tag._h || tag._d || tag.textContent || tag.innerHTML;
42
+ if (identity)
43
+ return identity;
44
+ const keys = Object.keys(tag.props).sort();
45
+ let hash = `${tag.tag}:`;
46
+ let separator = "";
47
+ for (const key of keys) {
48
+ hash += `${separator}${key}:${String(tag.props[key])}`;
49
+ separator = ",";
50
+ }
51
+ return hash;
52
+ }
53
+
54
+ function walkResolver(val, resolve, key) {
55
+ if (key === "_resolver")
56
+ return val;
57
+ if (typeof val === "function" && (!key || key !== "titleTemplate" && !key.startsWith("on")))
58
+ val = val();
59
+ const v = resolve ? resolve(key, val) : val;
60
+ if (Array.isArray(v)) {
61
+ let out;
62
+ for (let i = 0; i < v.length; i++) {
63
+ const r = walkResolver(v[i], resolve);
64
+ if (out) {
65
+ out[i] = r;
66
+ } else if (r !== v[i]) {
67
+ out = v.slice(0, i);
68
+ out[i] = r;
69
+ }
70
+ }
71
+ return out || v;
72
+ }
73
+ if (v?.constructor === Object) {
74
+ let next;
75
+ for (const k in v) {
76
+ const unsafe = isUnsafeKey(k);
77
+ const r = unsafe ? void 0 : walkResolver(v[k], resolve, k);
78
+ if (!next && (unsafe || r !== v[k])) {
79
+ next = {};
80
+ for (const pk in v) {
81
+ if (pk === k)
82
+ break;
83
+ next[pk] = v[pk];
84
+ }
85
+ }
86
+ if (next && !unsafe)
87
+ next[k] = r;
88
+ }
89
+ return next || v;
90
+ }
91
+ return v;
92
+ }
93
+
94
+ const INVALID_ATTR_NAME_RE = /[\s"'<>/=\x00-\x1F\x7F]/;
95
+
96
+ function normalizeStyleClassProps(key, value) {
97
+ const isStyle = key === "style";
98
+ const store = isStyle ? /* @__PURE__ */ new Map() : /* @__PURE__ */ new Set();
99
+ const add = (v) => {
100
+ if (!v)
101
+ return;
102
+ if (isStyle) {
103
+ const i = v.indexOf(":");
104
+ i > 0 && store.set(v.slice(0, i).trim(), v.slice(i + 1).trim());
105
+ } else {
106
+ v.split(" ").forEach((c) => c && store.add(c));
107
+ }
108
+ };
109
+ if (typeof value === "string") {
110
+ (isStyle ? value.split(";") : [value]).forEach(add);
111
+ } else if (Array.isArray(value)) {
112
+ value.forEach(add);
113
+ } else if (value && typeof value === "object") {
114
+ for (const k in value) {
115
+ const v = value[k];
116
+ v && v !== "false" && (isStyle ? store.set(k.trim(), String(v)) : add(k));
117
+ }
118
+ }
119
+ return store;
120
+ }
121
+ function normalizeProps(tag, input) {
122
+ tag.props = tag.props || {};
123
+ if (!input)
124
+ return tag;
125
+ if (tag.tag === "templateParams") {
126
+ tag.props = input;
127
+ return tag;
128
+ }
129
+ const isHtmlTag = HasElementTags.has(tag.tag) || tag.tag === "htmlAttrs" || tag.tag === "bodyAttrs";
130
+ for (const prop in input) {
131
+ if (isUnsafeKey(prop))
132
+ continue;
133
+ const isData = prop.startsWith("data-");
134
+ const isHtmlAttr = isHtmlTag && !TagConfigKeys.has(prop);
135
+ const key = isHtmlAttr && !isData ? prop.toLowerCase() : prop;
136
+ if (isHtmlAttr && (!key || INVALID_ATTR_NAME_RE.test(key)))
137
+ continue;
138
+ const value = input[prop];
139
+ if (value === null) {
140
+ tag.props[key] = null;
141
+ } else if (prop === "class" || prop === "style") {
142
+ tag.props[prop] = normalizeStyleClassProps(prop, value);
143
+ } else if (TagConfigKeys.has(prop)) {
144
+ if ((prop === "textContent" || prop === "innerHTML") && typeof value === "object") {
145
+ const type = input.type || "application/json";
146
+ if (type.endsWith("json") || type === "speculationrules" || type === "importmap") {
147
+ tag.props.type = type;
148
+ tag[prop] = JSON.stringify(value);
149
+ }
150
+ } else {
151
+ tag[prop] = value;
152
+ }
153
+ } else if (value !== void 0) {
154
+ const str = String(value);
155
+ const isMeta = tag.tag === "meta" && key === "content";
156
+ tag.props[key] = str === "true" || str === "" ? isData || isMeta ? str : true : !value && isData && str === "false" ? "false" : value;
157
+ }
158
+ }
159
+ return tag;
160
+ }
161
+ function resolveHeadInput(input, propResolvers) {
162
+ let resolve;
163
+ if (propResolvers.length) {
164
+ resolve = (key, val) => {
165
+ for (let i = 0; i < propResolvers.length; i++)
166
+ val = propResolvers[i](key, val);
167
+ return val;
168
+ };
169
+ input = resolve(void 0, input);
170
+ }
171
+ return walkResolver(input, resolve);
172
+ }
173
+ function normalizeTag(tagName, _input) {
174
+ const input = typeof _input === "object" && typeof _input !== "function" ? _input : { [tagName === "script" || tagName === "noscript" || tagName === "style" ? "innerHTML" : "textContent"]: _input };
175
+ const tag = normalizeProps({ tag: tagName, props: {} }, input);
176
+ if (tag.key && DupeableTags.has(tag.tag))
177
+ tag.props["data-hid"] = tag._h = tag.key;
178
+ if (tag.tag === "script" && typeof tag.innerHTML === "object") {
179
+ tag.innerHTML = JSON.stringify(tag.innerHTML);
180
+ tag.props.type = tag.props.type || "application/json";
181
+ }
182
+ if (Array.isArray(tag.props.content)) {
183
+ const tags = [];
184
+ for (const content of tag.props.content) {
185
+ tags.push({ ...tag, props: { ...tag.props, content } });
186
+ }
187
+ return tags;
188
+ }
189
+ return tag;
190
+ }
191
+ function pushNormalizedTag(tags, tag) {
192
+ if (Array.isArray(tag)) {
193
+ for (const t of tag) tags.push(t);
194
+ } else {
195
+ tags.push(tag);
196
+ }
197
+ }
198
+ function normalizeEntryToTags(input, propResolvers) {
199
+ if (!input)
200
+ return [];
201
+ if (typeof input === "function")
202
+ input = input();
203
+ input = resolveHeadInput(input, propResolvers);
204
+ const tags = [];
205
+ for (const key in input) {
206
+ const value = input[key];
207
+ if (value !== void 0) {
208
+ if (Array.isArray(value)) {
209
+ for (const v of value) pushNormalizedTag(tags, normalizeTag(key, v));
210
+ } else {
211
+ pushNormalizedTag(tags, normalizeTag(key, value));
212
+ }
213
+ }
214
+ }
215
+ return tags;
216
+ }
217
+
218
+ const LT_RE = /</g;
219
+ const SCRIPT_END_RE = /<\/script/g;
220
+ const sortTags = (a, b) => a._w === b._w ? a._p - b._p : a._w - b._w;
221
+ const DEFAULT_TAG_WEIGHT = () => 100;
222
+ function isEmptyProps(props) {
223
+ for (const _ in props)
224
+ return false;
225
+ return true;
226
+ }
227
+ const TAG_MUTATING_HOOK_RE = /^tags:|:render/;
228
+ function syncEntryHookCache(head, hooks) {
229
+ const count = (hooks["entries:resolve"]?.length || 0) + (hooks["entries:normalize"]?.length || 0);
230
+ if (head._h !== count) {
231
+ head._h = count;
232
+ for (const entry of head.entries.values())
233
+ delete entry._tags;
234
+ }
235
+ }
236
+ function cloneTagsInPlace(tags) {
237
+ for (let i = 0; i < tags.length; i++) {
238
+ const t = tags[i];
239
+ const props = { ...t.props };
240
+ if (props.class instanceof Set)
241
+ props.class = new Set(props.class);
242
+ if (props.style instanceof Map)
243
+ props.style = new Map(props.style);
244
+ tags[i] = { ...t, props };
245
+ }
246
+ }
247
+ function valuesToTags(ctx, sortFlatMeta) {
248
+ const tags = ctx.tags;
249
+ let w = 0;
250
+ for (const value of ctx.tagMap.values()) {
251
+ if (Array.isArray(value)) {
252
+ for (const tag of value) tags[w++] = tag;
253
+ } else {
254
+ tags[w++] = value;
255
+ }
256
+ }
257
+ tags.length = w;
258
+ if (sortFlatMeta)
259
+ tags.sort(sortTags);
260
+ }
261
+ function dedupeTags(ctx) {
262
+ let hasFlatMeta = false;
263
+ for (const next of ctx.tags.sort(sortTags)) {
264
+ const k = next._d || hashTag(next);
265
+ if (!k)
266
+ continue;
267
+ const prev = ctx.tagMap.get(k);
268
+ if (!prev) {
269
+ ctx.tagMap.set(k, next);
270
+ continue;
271
+ }
272
+ const strategy = next.tagDuplicateStrategy || (UsesMergeStrategy.has(next.tag) ? "merge" : null) || (next.key && next.key === prev.key ? "merge" : null);
273
+ if (strategy === "merge") {
274
+ const props = { ...prev.props };
275
+ for (const p in next.props) {
276
+ props[p] = p === "style" ? new Map([...prev.props.style || /* @__PURE__ */ new Map(), ...next.props[p]]) : p === "class" ? /* @__PURE__ */ new Set([...prev.props.class || [], ...next.props[p]]) : next.props[p];
277
+ }
278
+ ctx.tagMap.set(k, { ...next, props });
279
+ } else if (next._p >> 10 === prev._p >> 10 && next.tag === "meta" && isMetaArrayDupeKey(k)) {
280
+ ctx.tagMap.set(k, Object.assign([...Array.isArray(prev) ? prev : [prev], next], next));
281
+ hasFlatMeta = true;
282
+ } else if (next._w === prev._w ? next._p > prev._p : next._w < prev._w) {
283
+ ctx.tagMap.set(k, next);
284
+ }
285
+ }
286
+ return hasFlatMeta;
287
+ }
288
+ function resolveTitleTemplate(ctx, head) {
289
+ const title = ctx.tagMap.get("title");
290
+ const tpl = ctx.tagMap.get("titleTemplate");
291
+ head._title = title?.textContent;
292
+ if (!tpl)
293
+ return;
294
+ const fn = tpl.textContent;
295
+ head._titleTemplate = fn;
296
+ if (!fn)
297
+ return;
298
+ let v = typeof fn === "function" ? fn(title?.textContent) : fn;
299
+ if (typeof v === "string" && !head.plugins.has("template-params"))
300
+ v = v.replace("%s", title?.textContent || "");
301
+ if (title) {
302
+ v === null ? ctx.tagMap.delete("title") : ctx.tagMap.set("title", { ...title, textContent: v });
303
+ } else {
304
+ ctx.tagMap.set("titleTemplate", { ...tpl, tag: "title", textContent: v });
305
+ }
306
+ }
307
+ function sanitizeTagsInPlace(tags) {
308
+ let w = 0;
309
+ for (let t of tags) {
310
+ const { innerHTML, tag, props } = t;
311
+ if (!ValidHeadTags.has(tag) || isEmptyProps(props) && !hasContent(innerHTML) && !hasContent(t.textContent))
312
+ continue;
313
+ if (tag === "meta") {
314
+ if (!hasContent(props.content) && !props["http-equiv"] && !props.charset)
315
+ continue;
316
+ }
317
+ if (tag === "script" && (innerHTML || t.textContent)) {
318
+ const type = String(props.type);
319
+ const isJsonLike = type.endsWith("json") || type === "importmap" || type === "speculationrules";
320
+ const escape = (content) => isJsonLike ? (typeof content === "string" ? content : JSON.stringify(content)).replace(LT_RE, "\\u003C") : typeof content === "string" ? content.replace(SCRIPT_END_RE, "<\\/script") : content;
321
+ t = { ...t };
322
+ if (innerHTML)
323
+ t.innerHTML = escape(innerHTML);
324
+ if (t.textContent)
325
+ t.textContent = escape(t.textContent);
326
+ t._d = dedupeKey(t);
327
+ }
328
+ tags[w++] = t;
329
+ }
330
+ tags.length = w;
331
+ return tags;
332
+ }
333
+ function sanitizeTags(tags) {
334
+ return sanitizeTagsInPlace([...tags]);
335
+ }
336
+ function resolveTags(head, options) {
337
+ const weightFn = options?.tagWeight ?? head.resolvedOptions._tagWeight ?? DEFAULT_TAG_WEIGHT;
338
+ const ctx = { tagMap: /* @__PURE__ */ new Map(), tags: [] };
339
+ const hooks = head.hooks?._hooks || {};
340
+ syncEntryHookCache(head, hooks);
341
+ for (const e of head.entries.values()) {
342
+ if (e._pending !== void 0) {
343
+ e.input = e._pending;
344
+ delete e._pending;
345
+ delete e._tags;
346
+ delete e._precomputedTags;
347
+ }
348
+ }
349
+ let entries;
350
+ if (hooks["entries:resolve"]?.length || hooks["entries:normalize"]?.length) {
351
+ entries = [...head.entries.values()];
352
+ if (hooks["entries:resolve"]?.length)
353
+ callHook(head, "entries:resolve", { entries, ...ctx });
354
+ }
355
+ syncEntryHookCache(head, hooks);
356
+ for (const e of entries || head.entries.values()) {
357
+ let tags = e._tags;
358
+ if (!tags) {
359
+ if (e._precomputedTags && weightFn === head.resolvedOptions._tagWeight && !hooks["entries:normalize"]?.length && !hooks["entries:resolve"]?.length && (!e.options || isEmptyProps(e.options))) {
360
+ tags = e._precomputedTags;
361
+ } else {
362
+ tags = normalizeEntryToTags(e.input, head.resolvedOptions.propResolvers || []);
363
+ if (e.options && !isEmptyProps(e.options)) {
364
+ for (const t of tags)
365
+ Object.assign(t, e.options);
366
+ }
367
+ if (hooks["entries:normalize"]?.length) {
368
+ const normalizeCtx = { tags, entry: e };
369
+ callHook(head, "entries:normalize", normalizeCtx);
370
+ tags = normalizeCtx.tags;
371
+ }
372
+ for (let i = 0; i < tags.length; i++) {
373
+ const t = tags[i];
374
+ t._w = weightFn(t);
375
+ t._p = (e._i << 10) + i;
376
+ t._d = dedupeKey(t);
377
+ if (!t._d)
378
+ t._h = hashTag(t);
379
+ }
380
+ e._tags = tags;
381
+ }
382
+ }
383
+ ctx.tags.push(...tags);
384
+ }
385
+ for (const name in hooks) {
386
+ if (hooks[name]?.length && TAG_MUTATING_HOOK_RE.test(name)) {
387
+ cloneTagsInPlace(ctx.tags);
388
+ break;
389
+ }
390
+ }
391
+ const hasFlatMeta = dedupeTags(ctx);
392
+ resolveTitleTemplate(ctx, head);
393
+ valuesToTags(ctx, hasFlatMeta);
394
+ callHook(head, "tags:beforeResolve", ctx);
395
+ callHook(head, "tags:resolve", ctx);
396
+ callHook(head, "tags:afterResolve", ctx);
397
+ return sanitizeTagsInPlace(ctx.tags);
398
+ }
399
+
400
+ export { INVALID_ATTR_NAME_RE as I, dedupeTags as a, normalizeProps as b, resolveTitleTemplate as c, dedupeKey as d, resolveHeadInput as e, hashTag as h, isMetaArrayDupeKey as i, normalizeEntryToTags as n, resolveTags as r, sanitizeTags as s, walkResolver as w };