runtime-dom.esm-bundler.js 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870
  1. /**
  2. * @vue/runtime-dom v3.5.18
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. import { warn, BaseTransitionPropsValidators, h, BaseTransition, assertNumber, getCurrentInstance, onBeforeUpdate, queuePostFlushCb, onMounted, watch, onUnmounted, Fragment, Static, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, unref, createVNode, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, Text, createRenderer, createHydrationRenderer, isRuntimeOnly } from '@vue/runtime-core';
  7. export * from '@vue/runtime-core';
  8. import { extend, isObject, toNumber, isArray, NOOP, normalizeCssVarValue, isString, hyphenate, capitalize, isSpecialBooleanAttr, includeBooleanAttr, isSymbol, isFunction, isOn, isModelListener, camelize as camelize$1, isPlainObject, hasOwn, EMPTY_OBJ, looseToNumber, looseIndexOf, isSet, looseEqual, invokeArrayFns, isHTMLTag, isSVGTag, isMathMLTag } from '@vue/shared';
  9. let policy = void 0;
  10. const tt = typeof window !== "undefined" && window.trustedTypes;
  11. if (tt) {
  12. try {
  13. policy = /* @__PURE__ */ tt.createPolicy("vue", {
  14. createHTML: (val) => val
  15. });
  16. } catch (e) {
  17. !!(process.env.NODE_ENV !== "production") && warn(`Error creating trusted types policy: ${e}`);
  18. }
  19. }
  20. const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
  21. const svgNS = "http://www.w3.org/2000/svg";
  22. const mathmlNS = "http://www.w3.org/1998/Math/MathML";
  23. const doc = typeof document !== "undefined" ? document : null;
  24. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  25. const nodeOps = {
  26. insert: (child, parent, anchor) => {
  27. parent.insertBefore(child, anchor || null);
  28. },
  29. remove: (child) => {
  30. const parent = child.parentNode;
  31. if (parent) {
  32. parent.removeChild(child);
  33. }
  34. },
  35. createElement: (tag, namespace, is, props) => {
  36. const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
  37. if (tag === "select" && props && props.multiple != null) {
  38. el.setAttribute("multiple", props.multiple);
  39. }
  40. return el;
  41. },
  42. createText: (text) => doc.createTextNode(text),
  43. createComment: (text) => doc.createComment(text),
  44. setText: (node, text) => {
  45. node.nodeValue = text;
  46. },
  47. setElementText: (el, text) => {
  48. el.textContent = text;
  49. },
  50. parentNode: (node) => node.parentNode,
  51. nextSibling: (node) => node.nextSibling,
  52. querySelector: (selector) => doc.querySelector(selector),
  53. setScopeId(el, id) {
  54. el.setAttribute(id, "");
  55. },
  56. // __UNSAFE__
  57. // Reason: innerHTML.
  58. // Static content here can only come from compiled templates.
  59. // As long as the user only uses trusted templates, this is safe.
  60. insertStaticContent(content, parent, anchor, namespace, start, end) {
  61. const before = anchor ? anchor.previousSibling : parent.lastChild;
  62. if (start && (start === end || start.nextSibling)) {
  63. while (true) {
  64. parent.insertBefore(start.cloneNode(true), anchor);
  65. if (start === end || !(start = start.nextSibling)) break;
  66. }
  67. } else {
  68. templateContainer.innerHTML = unsafeToTrustedHTML(
  69. namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
  70. );
  71. const template = templateContainer.content;
  72. if (namespace === "svg" || namespace === "mathml") {
  73. const wrapper = template.firstChild;
  74. while (wrapper.firstChild) {
  75. template.appendChild(wrapper.firstChild);
  76. }
  77. template.removeChild(wrapper);
  78. }
  79. parent.insertBefore(template, anchor);
  80. }
  81. return [
  82. // first
  83. before ? before.nextSibling : parent.firstChild,
  84. // last
  85. anchor ? anchor.previousSibling : parent.lastChild
  86. ];
  87. }
  88. };
  89. const TRANSITION = "transition";
  90. const ANIMATION = "animation";
  91. const vtcKey = Symbol("_vtc");
  92. const DOMTransitionPropsValidators = {
  93. name: String,
  94. type: String,
  95. css: {
  96. type: Boolean,
  97. default: true
  98. },
  99. duration: [String, Number, Object],
  100. enterFromClass: String,
  101. enterActiveClass: String,
  102. enterToClass: String,
  103. appearFromClass: String,
  104. appearActiveClass: String,
  105. appearToClass: String,
  106. leaveFromClass: String,
  107. leaveActiveClass: String,
  108. leaveToClass: String
  109. };
  110. const TransitionPropsValidators = /* @__PURE__ */ extend(
  111. {},
  112. BaseTransitionPropsValidators,
  113. DOMTransitionPropsValidators
  114. );
  115. const decorate$1 = (t) => {
  116. t.displayName = "Transition";
  117. t.props = TransitionPropsValidators;
  118. return t;
  119. };
  120. const Transition = /* @__PURE__ */ decorate$1(
  121. (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
  122. );
  123. const callHook = (hook, args = []) => {
  124. if (isArray(hook)) {
  125. hook.forEach((h2) => h2(...args));
  126. } else if (hook) {
  127. hook(...args);
  128. }
  129. };
  130. const hasExplicitCallback = (hook) => {
  131. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  132. };
  133. function resolveTransitionProps(rawProps) {
  134. const baseProps = {};
  135. for (const key in rawProps) {
  136. if (!(key in DOMTransitionPropsValidators)) {
  137. baseProps[key] = rawProps[key];
  138. }
  139. }
  140. if (rawProps.css === false) {
  141. return baseProps;
  142. }
  143. const {
  144. name = "v",
  145. type,
  146. duration,
  147. enterFromClass = `${name}-enter-from`,
  148. enterActiveClass = `${name}-enter-active`,
  149. enterToClass = `${name}-enter-to`,
  150. appearFromClass = enterFromClass,
  151. appearActiveClass = enterActiveClass,
  152. appearToClass = enterToClass,
  153. leaveFromClass = `${name}-leave-from`,
  154. leaveActiveClass = `${name}-leave-active`,
  155. leaveToClass = `${name}-leave-to`
  156. } = rawProps;
  157. const durations = normalizeDuration(duration);
  158. const enterDuration = durations && durations[0];
  159. const leaveDuration = durations && durations[1];
  160. const {
  161. onBeforeEnter,
  162. onEnter,
  163. onEnterCancelled,
  164. onLeave,
  165. onLeaveCancelled,
  166. onBeforeAppear = onBeforeEnter,
  167. onAppear = onEnter,
  168. onAppearCancelled = onEnterCancelled
  169. } = baseProps;
  170. const finishEnter = (el, isAppear, done, isCancelled) => {
  171. el._enterCancelled = isCancelled;
  172. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  173. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  174. done && done();
  175. };
  176. const finishLeave = (el, done) => {
  177. el._isLeaving = false;
  178. removeTransitionClass(el, leaveFromClass);
  179. removeTransitionClass(el, leaveToClass);
  180. removeTransitionClass(el, leaveActiveClass);
  181. done && done();
  182. };
  183. const makeEnterHook = (isAppear) => {
  184. return (el, done) => {
  185. const hook = isAppear ? onAppear : onEnter;
  186. const resolve = () => finishEnter(el, isAppear, done);
  187. callHook(hook, [el, resolve]);
  188. nextFrame(() => {
  189. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  190. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  191. if (!hasExplicitCallback(hook)) {
  192. whenTransitionEnds(el, type, enterDuration, resolve);
  193. }
  194. });
  195. };
  196. };
  197. return extend(baseProps, {
  198. onBeforeEnter(el) {
  199. callHook(onBeforeEnter, [el]);
  200. addTransitionClass(el, enterFromClass);
  201. addTransitionClass(el, enterActiveClass);
  202. },
  203. onBeforeAppear(el) {
  204. callHook(onBeforeAppear, [el]);
  205. addTransitionClass(el, appearFromClass);
  206. addTransitionClass(el, appearActiveClass);
  207. },
  208. onEnter: makeEnterHook(false),
  209. onAppear: makeEnterHook(true),
  210. onLeave(el, done) {
  211. el._isLeaving = true;
  212. const resolve = () => finishLeave(el, done);
  213. addTransitionClass(el, leaveFromClass);
  214. if (!el._enterCancelled) {
  215. forceReflow();
  216. addTransitionClass(el, leaveActiveClass);
  217. } else {
  218. addTransitionClass(el, leaveActiveClass);
  219. forceReflow();
  220. }
  221. nextFrame(() => {
  222. if (!el._isLeaving) {
  223. return;
  224. }
  225. removeTransitionClass(el, leaveFromClass);
  226. addTransitionClass(el, leaveToClass);
  227. if (!hasExplicitCallback(onLeave)) {
  228. whenTransitionEnds(el, type, leaveDuration, resolve);
  229. }
  230. });
  231. callHook(onLeave, [el, resolve]);
  232. },
  233. onEnterCancelled(el) {
  234. finishEnter(el, false, void 0, true);
  235. callHook(onEnterCancelled, [el]);
  236. },
  237. onAppearCancelled(el) {
  238. finishEnter(el, true, void 0, true);
  239. callHook(onAppearCancelled, [el]);
  240. },
  241. onLeaveCancelled(el) {
  242. finishLeave(el);
  243. callHook(onLeaveCancelled, [el]);
  244. }
  245. });
  246. }
  247. function normalizeDuration(duration) {
  248. if (duration == null) {
  249. return null;
  250. } else if (isObject(duration)) {
  251. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  252. } else {
  253. const n = NumberOf(duration);
  254. return [n, n];
  255. }
  256. }
  257. function NumberOf(val) {
  258. const res = toNumber(val);
  259. if (!!(process.env.NODE_ENV !== "production")) {
  260. assertNumber(res, "<transition> explicit duration");
  261. }
  262. return res;
  263. }
  264. function addTransitionClass(el, cls) {
  265. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  266. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  267. }
  268. function removeTransitionClass(el, cls) {
  269. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  270. const _vtc = el[vtcKey];
  271. if (_vtc) {
  272. _vtc.delete(cls);
  273. if (!_vtc.size) {
  274. el[vtcKey] = void 0;
  275. }
  276. }
  277. }
  278. function nextFrame(cb) {
  279. requestAnimationFrame(() => {
  280. requestAnimationFrame(cb);
  281. });
  282. }
  283. let endId = 0;
  284. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  285. const id = el._endId = ++endId;
  286. const resolveIfNotStale = () => {
  287. if (id === el._endId) {
  288. resolve();
  289. }
  290. };
  291. if (explicitTimeout != null) {
  292. return setTimeout(resolveIfNotStale, explicitTimeout);
  293. }
  294. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  295. if (!type) {
  296. return resolve();
  297. }
  298. const endEvent = type + "end";
  299. let ended = 0;
  300. const end = () => {
  301. el.removeEventListener(endEvent, onEnd);
  302. resolveIfNotStale();
  303. };
  304. const onEnd = (e) => {
  305. if (e.target === el && ++ended >= propCount) {
  306. end();
  307. }
  308. };
  309. setTimeout(() => {
  310. if (ended < propCount) {
  311. end();
  312. }
  313. }, timeout + 1);
  314. el.addEventListener(endEvent, onEnd);
  315. }
  316. function getTransitionInfo(el, expectedType) {
  317. const styles = window.getComputedStyle(el);
  318. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  319. const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
  320. const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
  321. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  322. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  323. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  324. const animationTimeout = getTimeout(animationDelays, animationDurations);
  325. let type = null;
  326. let timeout = 0;
  327. let propCount = 0;
  328. if (expectedType === TRANSITION) {
  329. if (transitionTimeout > 0) {
  330. type = TRANSITION;
  331. timeout = transitionTimeout;
  332. propCount = transitionDurations.length;
  333. }
  334. } else if (expectedType === ANIMATION) {
  335. if (animationTimeout > 0) {
  336. type = ANIMATION;
  337. timeout = animationTimeout;
  338. propCount = animationDurations.length;
  339. }
  340. } else {
  341. timeout = Math.max(transitionTimeout, animationTimeout);
  342. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
  343. propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
  344. }
  345. const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
  346. getStyleProperties(`${TRANSITION}Property`).toString()
  347. );
  348. return {
  349. type,
  350. timeout,
  351. propCount,
  352. hasTransform
  353. };
  354. }
  355. function getTimeout(delays, durations) {
  356. while (delays.length < durations.length) {
  357. delays = delays.concat(delays);
  358. }
  359. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  360. }
  361. function toMs(s) {
  362. if (s === "auto") return 0;
  363. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  364. }
  365. function forceReflow() {
  366. return document.body.offsetHeight;
  367. }
  368. function patchClass(el, value, isSVG) {
  369. const transitionClasses = el[vtcKey];
  370. if (transitionClasses) {
  371. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  372. }
  373. if (value == null) {
  374. el.removeAttribute("class");
  375. } else if (isSVG) {
  376. el.setAttribute("class", value);
  377. } else {
  378. el.className = value;
  379. }
  380. }
  381. const vShowOriginalDisplay = Symbol("_vod");
  382. const vShowHidden = Symbol("_vsh");
  383. const vShow = {
  384. beforeMount(el, { value }, { transition }) {
  385. el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
  386. if (transition && value) {
  387. transition.beforeEnter(el);
  388. } else {
  389. setDisplay(el, value);
  390. }
  391. },
  392. mounted(el, { value }, { transition }) {
  393. if (transition && value) {
  394. transition.enter(el);
  395. }
  396. },
  397. updated(el, { value, oldValue }, { transition }) {
  398. if (!value === !oldValue) return;
  399. if (transition) {
  400. if (value) {
  401. transition.beforeEnter(el);
  402. setDisplay(el, true);
  403. transition.enter(el);
  404. } else {
  405. transition.leave(el, () => {
  406. setDisplay(el, false);
  407. });
  408. }
  409. } else {
  410. setDisplay(el, value);
  411. }
  412. },
  413. beforeUnmount(el, { value }) {
  414. setDisplay(el, value);
  415. }
  416. };
  417. if (!!(process.env.NODE_ENV !== "production")) {
  418. vShow.name = "show";
  419. }
  420. function setDisplay(el, value) {
  421. el.style.display = value ? el[vShowOriginalDisplay] : "none";
  422. el[vShowHidden] = !value;
  423. }
  424. function initVShowForSSR() {
  425. vShow.getSSRProps = ({ value }) => {
  426. if (!value) {
  427. return { style: { display: "none" } };
  428. }
  429. };
  430. }
  431. const CSS_VAR_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? "CSS_VAR_TEXT" : "");
  432. function useCssVars(getter) {
  433. const instance = getCurrentInstance();
  434. if (!instance) {
  435. !!(process.env.NODE_ENV !== "production") && warn(`useCssVars is called without current active component instance.`);
  436. return;
  437. }
  438. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  439. Array.from(
  440. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  441. ).forEach((node) => setVarsOnNode(node, vars));
  442. };
  443. if (!!(process.env.NODE_ENV !== "production")) {
  444. instance.getCssVars = () => getter(instance.proxy);
  445. }
  446. const setVars = () => {
  447. const vars = getter(instance.proxy);
  448. if (instance.ce) {
  449. setVarsOnNode(instance.ce, vars);
  450. } else {
  451. setVarsOnVNode(instance.subTree, vars);
  452. }
  453. updateTeleports(vars);
  454. };
  455. onBeforeUpdate(() => {
  456. queuePostFlushCb(setVars);
  457. });
  458. onMounted(() => {
  459. watch(setVars, NOOP, { flush: "post" });
  460. const ob = new MutationObserver(setVars);
  461. ob.observe(instance.subTree.el.parentNode, { childList: true });
  462. onUnmounted(() => ob.disconnect());
  463. });
  464. }
  465. function setVarsOnVNode(vnode, vars) {
  466. if (vnode.shapeFlag & 128) {
  467. const suspense = vnode.suspense;
  468. vnode = suspense.activeBranch;
  469. if (suspense.pendingBranch && !suspense.isHydrating) {
  470. suspense.effects.push(() => {
  471. setVarsOnVNode(suspense.activeBranch, vars);
  472. });
  473. }
  474. }
  475. while (vnode.component) {
  476. vnode = vnode.component.subTree;
  477. }
  478. if (vnode.shapeFlag & 1 && vnode.el) {
  479. setVarsOnNode(vnode.el, vars);
  480. } else if (vnode.type === Fragment) {
  481. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  482. } else if (vnode.type === Static) {
  483. let { el, anchor } = vnode;
  484. while (el) {
  485. setVarsOnNode(el, vars);
  486. if (el === anchor) break;
  487. el = el.nextSibling;
  488. }
  489. }
  490. }
  491. function setVarsOnNode(el, vars) {
  492. if (el.nodeType === 1) {
  493. const style = el.style;
  494. let cssText = "";
  495. for (const key in vars) {
  496. const value = normalizeCssVarValue(vars[key]);
  497. style.setProperty(`--${key}`, value);
  498. cssText += `--${key}: ${value};`;
  499. }
  500. style[CSS_VAR_TEXT] = cssText;
  501. }
  502. }
  503. const displayRE = /(^|;)\s*display\s*:/;
  504. function patchStyle(el, prev, next) {
  505. const style = el.style;
  506. const isCssString = isString(next);
  507. let hasControlledDisplay = false;
  508. if (next && !isCssString) {
  509. if (prev) {
  510. if (!isString(prev)) {
  511. for (const key in prev) {
  512. if (next[key] == null) {
  513. setStyle(style, key, "");
  514. }
  515. }
  516. } else {
  517. for (const prevStyle of prev.split(";")) {
  518. const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
  519. if (next[key] == null) {
  520. setStyle(style, key, "");
  521. }
  522. }
  523. }
  524. }
  525. for (const key in next) {
  526. if (key === "display") {
  527. hasControlledDisplay = true;
  528. }
  529. setStyle(style, key, next[key]);
  530. }
  531. } else {
  532. if (isCssString) {
  533. if (prev !== next) {
  534. const cssVarText = style[CSS_VAR_TEXT];
  535. if (cssVarText) {
  536. next += ";" + cssVarText;
  537. }
  538. style.cssText = next;
  539. hasControlledDisplay = displayRE.test(next);
  540. }
  541. } else if (prev) {
  542. el.removeAttribute("style");
  543. }
  544. }
  545. if (vShowOriginalDisplay in el) {
  546. el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
  547. if (el[vShowHidden]) {
  548. style.display = "none";
  549. }
  550. }
  551. }
  552. const semicolonRE = /[^\\];\s*$/;
  553. const importantRE = /\s*!important$/;
  554. function setStyle(style, name, val) {
  555. if (isArray(val)) {
  556. val.forEach((v) => setStyle(style, name, v));
  557. } else {
  558. if (val == null) val = "";
  559. if (!!(process.env.NODE_ENV !== "production")) {
  560. if (semicolonRE.test(val)) {
  561. warn(
  562. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  563. );
  564. }
  565. }
  566. if (name.startsWith("--")) {
  567. style.setProperty(name, val);
  568. } else {
  569. const prefixed = autoPrefix(style, name);
  570. if (importantRE.test(val)) {
  571. style.setProperty(
  572. hyphenate(prefixed),
  573. val.replace(importantRE, ""),
  574. "important"
  575. );
  576. } else {
  577. style[prefixed] = val;
  578. }
  579. }
  580. }
  581. }
  582. const prefixes = ["Webkit", "Moz", "ms"];
  583. const prefixCache = {};
  584. function autoPrefix(style, rawName) {
  585. const cached = prefixCache[rawName];
  586. if (cached) {
  587. return cached;
  588. }
  589. let name = camelize(rawName);
  590. if (name !== "filter" && name in style) {
  591. return prefixCache[rawName] = name;
  592. }
  593. name = capitalize(name);
  594. for (let i = 0; i < prefixes.length; i++) {
  595. const prefixed = prefixes[i] + name;
  596. if (prefixed in style) {
  597. return prefixCache[rawName] = prefixed;
  598. }
  599. }
  600. return rawName;
  601. }
  602. const xlinkNS = "http://www.w3.org/1999/xlink";
  603. function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
  604. if (isSVG && key.startsWith("xlink:")) {
  605. if (value == null) {
  606. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  607. } else {
  608. el.setAttributeNS(xlinkNS, key, value);
  609. }
  610. } else {
  611. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  612. el.removeAttribute(key);
  613. } else {
  614. el.setAttribute(
  615. key,
  616. isBoolean ? "" : isSymbol(value) ? String(value) : value
  617. );
  618. }
  619. }
  620. }
  621. function patchDOMProp(el, key, value, parentComponent, attrName) {
  622. if (key === "innerHTML" || key === "textContent") {
  623. if (value != null) {
  624. el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
  625. }
  626. return;
  627. }
  628. const tag = el.tagName;
  629. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  630. !tag.includes("-")) {
  631. const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
  632. const newValue = value == null ? (
  633. // #11647: value should be set as empty string for null and undefined,
  634. // but <input type="checkbox"> should be set as 'on'.
  635. el.type === "checkbox" ? "on" : ""
  636. ) : String(value);
  637. if (oldValue !== newValue || !("_value" in el)) {
  638. el.value = newValue;
  639. }
  640. if (value == null) {
  641. el.removeAttribute(key);
  642. }
  643. el._value = value;
  644. return;
  645. }
  646. let needRemove = false;
  647. if (value === "" || value == null) {
  648. const type = typeof el[key];
  649. if (type === "boolean") {
  650. value = includeBooleanAttr(value);
  651. } else if (value == null && type === "string") {
  652. value = "";
  653. needRemove = true;
  654. } else if (type === "number") {
  655. value = 0;
  656. needRemove = true;
  657. }
  658. }
  659. try {
  660. el[key] = value;
  661. } catch (e) {
  662. if (!!(process.env.NODE_ENV !== "production") && !needRemove) {
  663. warn(
  664. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  665. e
  666. );
  667. }
  668. }
  669. needRemove && el.removeAttribute(attrName || key);
  670. }
  671. function addEventListener(el, event, handler, options) {
  672. el.addEventListener(event, handler, options);
  673. }
  674. function removeEventListener(el, event, handler, options) {
  675. el.removeEventListener(event, handler, options);
  676. }
  677. const veiKey = Symbol("_vei");
  678. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  679. const invokers = el[veiKey] || (el[veiKey] = {});
  680. const existingInvoker = invokers[rawName];
  681. if (nextValue && existingInvoker) {
  682. existingInvoker.value = !!(process.env.NODE_ENV !== "production") ? sanitizeEventValue(nextValue, rawName) : nextValue;
  683. } else {
  684. const [name, options] = parseName(rawName);
  685. if (nextValue) {
  686. const invoker = invokers[rawName] = createInvoker(
  687. !!(process.env.NODE_ENV !== "production") ? sanitizeEventValue(nextValue, rawName) : nextValue,
  688. instance
  689. );
  690. addEventListener(el, name, invoker, options);
  691. } else if (existingInvoker) {
  692. removeEventListener(el, name, existingInvoker, options);
  693. invokers[rawName] = void 0;
  694. }
  695. }
  696. }
  697. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  698. function parseName(name) {
  699. let options;
  700. if (optionsModifierRE.test(name)) {
  701. options = {};
  702. let m;
  703. while (m = name.match(optionsModifierRE)) {
  704. name = name.slice(0, name.length - m[0].length);
  705. options[m[0].toLowerCase()] = true;
  706. }
  707. }
  708. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  709. return [event, options];
  710. }
  711. let cachedNow = 0;
  712. const p = /* @__PURE__ */ Promise.resolve();
  713. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  714. function createInvoker(initialValue, instance) {
  715. const invoker = (e) => {
  716. if (!e._vts) {
  717. e._vts = Date.now();
  718. } else if (e._vts <= invoker.attached) {
  719. return;
  720. }
  721. callWithAsyncErrorHandling(
  722. patchStopImmediatePropagation(e, invoker.value),
  723. instance,
  724. 5,
  725. [e]
  726. );
  727. };
  728. invoker.value = initialValue;
  729. invoker.attached = getNow();
  730. return invoker;
  731. }
  732. function sanitizeEventValue(value, propName) {
  733. if (isFunction(value) || isArray(value)) {
  734. return value;
  735. }
  736. warn(
  737. `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
  738. Expected function or array of functions, received type ${typeof value}.`
  739. );
  740. return NOOP;
  741. }
  742. function patchStopImmediatePropagation(e, value) {
  743. if (isArray(value)) {
  744. const originalStop = e.stopImmediatePropagation;
  745. e.stopImmediatePropagation = () => {
  746. originalStop.call(e);
  747. e._stopped = true;
  748. };
  749. return value.map(
  750. (fn) => (e2) => !e2._stopped && fn && fn(e2)
  751. );
  752. } else {
  753. return value;
  754. }
  755. }
  756. const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
  757. key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
  758. const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
  759. const isSVG = namespace === "svg";
  760. if (key === "class") {
  761. patchClass(el, nextValue, isSVG);
  762. } else if (key === "style") {
  763. patchStyle(el, prevValue, nextValue);
  764. } else if (isOn(key)) {
  765. if (!isModelListener(key)) {
  766. patchEvent(el, key, prevValue, nextValue, parentComponent);
  767. }
  768. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  769. patchDOMProp(el, key, nextValue);
  770. if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
  771. patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
  772. }
  773. } else if (
  774. // #11081 force set props for possible async custom element
  775. el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
  776. ) {
  777. patchDOMProp(el, camelize$1(key), nextValue, parentComponent, key);
  778. } else {
  779. if (key === "true-value") {
  780. el._trueValue = nextValue;
  781. } else if (key === "false-value") {
  782. el._falseValue = nextValue;
  783. }
  784. patchAttr(el, key, nextValue, isSVG);
  785. }
  786. };
  787. function shouldSetAsProp(el, key, value, isSVG) {
  788. if (isSVG) {
  789. if (key === "innerHTML" || key === "textContent") {
  790. return true;
  791. }
  792. if (key in el && isNativeOn(key) && isFunction(value)) {
  793. return true;
  794. }
  795. return false;
  796. }
  797. if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
  798. return false;
  799. }
  800. if (key === "form") {
  801. return false;
  802. }
  803. if (key === "list" && el.tagName === "INPUT") {
  804. return false;
  805. }
  806. if (key === "type" && el.tagName === "TEXTAREA") {
  807. return false;
  808. }
  809. if (key === "width" || key === "height") {
  810. const tag = el.tagName;
  811. if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
  812. return false;
  813. }
  814. }
  815. if (isNativeOn(key) && isString(value)) {
  816. return false;
  817. }
  818. return key in el;
  819. }
  820. const REMOVAL = {};
  821. /*! #__NO_SIDE_EFFECTS__ */
  822. // @__NO_SIDE_EFFECTS__
  823. function defineCustomElement(options, extraOptions, _createApp) {
  824. const Comp = defineComponent(options, extraOptions);
  825. if (isPlainObject(Comp)) extend(Comp, extraOptions);
  826. class VueCustomElement extends VueElement {
  827. constructor(initialProps) {
  828. super(Comp, initialProps, _createApp);
  829. }
  830. }
  831. VueCustomElement.def = Comp;
  832. return VueCustomElement;
  833. }
  834. /*! #__NO_SIDE_EFFECTS__ */
  835. const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
  836. return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
  837. };
  838. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  839. };
  840. class VueElement extends BaseClass {
  841. constructor(_def, _props = {}, _createApp = createApp) {
  842. super();
  843. this._def = _def;
  844. this._props = _props;
  845. this._createApp = _createApp;
  846. this._isVueCE = true;
  847. /**
  848. * @internal
  849. */
  850. this._instance = null;
  851. /**
  852. * @internal
  853. */
  854. this._app = null;
  855. /**
  856. * @internal
  857. */
  858. this._nonce = this._def.nonce;
  859. this._connected = false;
  860. this._resolved = false;
  861. this._numberProps = null;
  862. this._styleChildren = /* @__PURE__ */ new WeakSet();
  863. this._ob = null;
  864. if (this.shadowRoot && _createApp !== createApp) {
  865. this._root = this.shadowRoot;
  866. } else {
  867. if (!!(process.env.NODE_ENV !== "production") && this.shadowRoot) {
  868. warn(
  869. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  870. );
  871. }
  872. if (_def.shadowRoot !== false) {
  873. this.attachShadow({ mode: "open" });
  874. this._root = this.shadowRoot;
  875. } else {
  876. this._root = this;
  877. }
  878. }
  879. }
  880. connectedCallback() {
  881. if (!this.isConnected) return;
  882. if (!this.shadowRoot && !this._resolved) {
  883. this._parseSlots();
  884. }
  885. this._connected = true;
  886. let parent = this;
  887. while (parent = parent && (parent.parentNode || parent.host)) {
  888. if (parent instanceof VueElement) {
  889. this._parent = parent;
  890. break;
  891. }
  892. }
  893. if (!this._instance) {
  894. if (this._resolved) {
  895. this._mount(this._def);
  896. } else {
  897. if (parent && parent._pendingResolve) {
  898. this._pendingResolve = parent._pendingResolve.then(() => {
  899. this._pendingResolve = void 0;
  900. this._resolveDef();
  901. });
  902. } else {
  903. this._resolveDef();
  904. }
  905. }
  906. }
  907. }
  908. _setParent(parent = this._parent) {
  909. if (parent) {
  910. this._instance.parent = parent._instance;
  911. this._inheritParentContext(parent);
  912. }
  913. }
  914. _inheritParentContext(parent = this._parent) {
  915. if (parent && this._app) {
  916. Object.setPrototypeOf(
  917. this._app._context.provides,
  918. parent._instance.provides
  919. );
  920. }
  921. }
  922. disconnectedCallback() {
  923. this._connected = false;
  924. nextTick(() => {
  925. if (!this._connected) {
  926. if (this._ob) {
  927. this._ob.disconnect();
  928. this._ob = null;
  929. }
  930. this._app && this._app.unmount();
  931. if (this._instance) this._instance.ce = void 0;
  932. this._app = this._instance = null;
  933. }
  934. });
  935. }
  936. /**
  937. * resolve inner component definition (handle possible async component)
  938. */
  939. _resolveDef() {
  940. if (this._pendingResolve) {
  941. return;
  942. }
  943. for (let i = 0; i < this.attributes.length; i++) {
  944. this._setAttr(this.attributes[i].name);
  945. }
  946. this._ob = new MutationObserver((mutations) => {
  947. for (const m of mutations) {
  948. this._setAttr(m.attributeName);
  949. }
  950. });
  951. this._ob.observe(this, { attributes: true });
  952. const resolve = (def, isAsync = false) => {
  953. this._resolved = true;
  954. this._pendingResolve = void 0;
  955. const { props, styles } = def;
  956. let numberProps;
  957. if (props && !isArray(props)) {
  958. for (const key in props) {
  959. const opt = props[key];
  960. if (opt === Number || opt && opt.type === Number) {
  961. if (key in this._props) {
  962. this._props[key] = toNumber(this._props[key]);
  963. }
  964. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize$1(key)] = true;
  965. }
  966. }
  967. }
  968. this._numberProps = numberProps;
  969. this._resolveProps(def);
  970. if (this.shadowRoot) {
  971. this._applyStyles(styles);
  972. } else if (!!(process.env.NODE_ENV !== "production") && styles) {
  973. warn(
  974. "Custom element style injection is not supported when using shadowRoot: false"
  975. );
  976. }
  977. this._mount(def);
  978. };
  979. const asyncDef = this._def.__asyncLoader;
  980. if (asyncDef) {
  981. this._pendingResolve = asyncDef().then((def) => {
  982. def.configureApp = this._def.configureApp;
  983. resolve(this._def = def, true);
  984. });
  985. } else {
  986. resolve(this._def);
  987. }
  988. }
  989. _mount(def) {
  990. if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) && !def.name) {
  991. def.name = "VueElement";
  992. }
  993. this._app = this._createApp(def);
  994. this._inheritParentContext();
  995. if (def.configureApp) {
  996. def.configureApp(this._app);
  997. }
  998. this._app._ceVNode = this._createVNode();
  999. this._app.mount(this._root);
  1000. const exposed = this._instance && this._instance.exposed;
  1001. if (!exposed) return;
  1002. for (const key in exposed) {
  1003. if (!hasOwn(this, key)) {
  1004. Object.defineProperty(this, key, {
  1005. // unwrap ref to be consistent with public instance behavior
  1006. get: () => unref(exposed[key])
  1007. });
  1008. } else if (!!(process.env.NODE_ENV !== "production")) {
  1009. warn(`Exposed property "${key}" already exists on custom element.`);
  1010. }
  1011. }
  1012. }
  1013. _resolveProps(def) {
  1014. const { props } = def;
  1015. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  1016. for (const key of Object.keys(this)) {
  1017. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  1018. this._setProp(key, this[key]);
  1019. }
  1020. }
  1021. for (const key of declaredPropKeys.map(camelize$1)) {
  1022. Object.defineProperty(this, key, {
  1023. get() {
  1024. return this._getProp(key);
  1025. },
  1026. set(val) {
  1027. this._setProp(key, val, true, true);
  1028. }
  1029. });
  1030. }
  1031. }
  1032. _setAttr(key) {
  1033. if (key.startsWith("data-v-")) return;
  1034. const has = this.hasAttribute(key);
  1035. let value = has ? this.getAttribute(key) : REMOVAL;
  1036. const camelKey = camelize$1(key);
  1037. if (has && this._numberProps && this._numberProps[camelKey]) {
  1038. value = toNumber(value);
  1039. }
  1040. this._setProp(camelKey, value, false, true);
  1041. }
  1042. /**
  1043. * @internal
  1044. */
  1045. _getProp(key) {
  1046. return this._props[key];
  1047. }
  1048. /**
  1049. * @internal
  1050. */
  1051. _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
  1052. if (val !== this._props[key]) {
  1053. if (val === REMOVAL) {
  1054. delete this._props[key];
  1055. } else {
  1056. this._props[key] = val;
  1057. if (key === "key" && this._app) {
  1058. this._app._ceVNode.key = val;
  1059. }
  1060. }
  1061. if (shouldUpdate && this._instance) {
  1062. this._update();
  1063. }
  1064. if (shouldReflect) {
  1065. const ob = this._ob;
  1066. ob && ob.disconnect();
  1067. if (val === true) {
  1068. this.setAttribute(hyphenate(key), "");
  1069. } else if (typeof val === "string" || typeof val === "number") {
  1070. this.setAttribute(hyphenate(key), val + "");
  1071. } else if (!val) {
  1072. this.removeAttribute(hyphenate(key));
  1073. }
  1074. ob && ob.observe(this, { attributes: true });
  1075. }
  1076. }
  1077. }
  1078. _update() {
  1079. const vnode = this._createVNode();
  1080. if (this._app) vnode.appContext = this._app._context;
  1081. render(vnode, this._root);
  1082. }
  1083. _createVNode() {
  1084. const baseProps = {};
  1085. if (!this.shadowRoot) {
  1086. baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
  1087. }
  1088. const vnode = createVNode(this._def, extend(baseProps, this._props));
  1089. if (!this._instance) {
  1090. vnode.ce = (instance) => {
  1091. this._instance = instance;
  1092. instance.ce = this;
  1093. instance.isCE = true;
  1094. if (!!(process.env.NODE_ENV !== "production")) {
  1095. instance.ceReload = (newStyles) => {
  1096. if (this._styles) {
  1097. this._styles.forEach((s) => this._root.removeChild(s));
  1098. this._styles.length = 0;
  1099. }
  1100. this._applyStyles(newStyles);
  1101. this._instance = null;
  1102. this._update();
  1103. };
  1104. }
  1105. const dispatch = (event, args) => {
  1106. this.dispatchEvent(
  1107. new CustomEvent(
  1108. event,
  1109. isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
  1110. )
  1111. );
  1112. };
  1113. instance.emit = (event, ...args) => {
  1114. dispatch(event, args);
  1115. if (hyphenate(event) !== event) {
  1116. dispatch(hyphenate(event), args);
  1117. }
  1118. };
  1119. this._setParent();
  1120. };
  1121. }
  1122. return vnode;
  1123. }
  1124. _applyStyles(styles, owner) {
  1125. if (!styles) return;
  1126. if (owner) {
  1127. if (owner === this._def || this._styleChildren.has(owner)) {
  1128. return;
  1129. }
  1130. this._styleChildren.add(owner);
  1131. }
  1132. const nonce = this._nonce;
  1133. for (let i = styles.length - 1; i >= 0; i--) {
  1134. const s = document.createElement("style");
  1135. if (nonce) s.setAttribute("nonce", nonce);
  1136. s.textContent = styles[i];
  1137. this.shadowRoot.prepend(s);
  1138. if (!!(process.env.NODE_ENV !== "production")) {
  1139. if (owner) {
  1140. if (owner.__hmrId) {
  1141. if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
  1142. let entry = this._childStyles.get(owner.__hmrId);
  1143. if (!entry) {
  1144. this._childStyles.set(owner.__hmrId, entry = []);
  1145. }
  1146. entry.push(s);
  1147. }
  1148. } else {
  1149. (this._styles || (this._styles = [])).push(s);
  1150. }
  1151. }
  1152. }
  1153. }
  1154. /**
  1155. * Only called when shadowRoot is false
  1156. */
  1157. _parseSlots() {
  1158. const slots = this._slots = {};
  1159. let n;
  1160. while (n = this.firstChild) {
  1161. const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
  1162. (slots[slotName] || (slots[slotName] = [])).push(n);
  1163. this.removeChild(n);
  1164. }
  1165. }
  1166. /**
  1167. * Only called when shadowRoot is false
  1168. */
  1169. _renderSlots() {
  1170. const outlets = (this._teleportTarget || this).querySelectorAll("slot");
  1171. const scopeId = this._instance.type.__scopeId;
  1172. for (let i = 0; i < outlets.length; i++) {
  1173. const o = outlets[i];
  1174. const slotName = o.getAttribute("name") || "default";
  1175. const content = this._slots[slotName];
  1176. const parent = o.parentNode;
  1177. if (content) {
  1178. for (const n of content) {
  1179. if (scopeId && n.nodeType === 1) {
  1180. const id = scopeId + "-s";
  1181. const walker = document.createTreeWalker(n, 1);
  1182. n.setAttribute(id, "");
  1183. let child;
  1184. while (child = walker.nextNode()) {
  1185. child.setAttribute(id, "");
  1186. }
  1187. }
  1188. parent.insertBefore(n, o);
  1189. }
  1190. } else {
  1191. while (o.firstChild) parent.insertBefore(o.firstChild, o);
  1192. }
  1193. parent.removeChild(o);
  1194. }
  1195. }
  1196. /**
  1197. * @internal
  1198. */
  1199. _injectChildStyle(comp) {
  1200. this._applyStyles(comp.styles, comp);
  1201. }
  1202. /**
  1203. * @internal
  1204. */
  1205. _removeChildStyle(comp) {
  1206. if (!!(process.env.NODE_ENV !== "production")) {
  1207. this._styleChildren.delete(comp);
  1208. if (this._childStyles && comp.__hmrId) {
  1209. const oldStyles = this._childStyles.get(comp.__hmrId);
  1210. if (oldStyles) {
  1211. oldStyles.forEach((s) => this._root.removeChild(s));
  1212. oldStyles.length = 0;
  1213. }
  1214. }
  1215. }
  1216. }
  1217. }
  1218. function useHost(caller) {
  1219. const instance = getCurrentInstance();
  1220. const el = instance && instance.ce;
  1221. if (el) {
  1222. return el;
  1223. } else if (!!(process.env.NODE_ENV !== "production")) {
  1224. if (!instance) {
  1225. warn(
  1226. `${caller || "useHost"} called without an active component instance.`
  1227. );
  1228. } else {
  1229. warn(
  1230. `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
  1231. );
  1232. }
  1233. }
  1234. return null;
  1235. }
  1236. function useShadowRoot() {
  1237. const el = !!(process.env.NODE_ENV !== "production") ? useHost("useShadowRoot") : useHost();
  1238. return el && el.shadowRoot;
  1239. }
  1240. function useCssModule(name = "$style") {
  1241. {
  1242. const instance = getCurrentInstance();
  1243. if (!instance) {
  1244. !!(process.env.NODE_ENV !== "production") && warn(`useCssModule must be called inside setup()`);
  1245. return EMPTY_OBJ;
  1246. }
  1247. const modules = instance.type.__cssModules;
  1248. if (!modules) {
  1249. !!(process.env.NODE_ENV !== "production") && warn(`Current instance does not have CSS modules injected.`);
  1250. return EMPTY_OBJ;
  1251. }
  1252. const mod = modules[name];
  1253. if (!mod) {
  1254. !!(process.env.NODE_ENV !== "production") && warn(`Current instance does not have CSS module named "${name}".`);
  1255. return EMPTY_OBJ;
  1256. }
  1257. return mod;
  1258. }
  1259. }
  1260. const positionMap = /* @__PURE__ */ new WeakMap();
  1261. const newPositionMap = /* @__PURE__ */ new WeakMap();
  1262. const moveCbKey = Symbol("_moveCb");
  1263. const enterCbKey = Symbol("_enterCb");
  1264. const decorate = (t) => {
  1265. delete t.props.mode;
  1266. return t;
  1267. };
  1268. const TransitionGroupImpl = /* @__PURE__ */ decorate({
  1269. name: "TransitionGroup",
  1270. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  1271. tag: String,
  1272. moveClass: String
  1273. }),
  1274. setup(props, { slots }) {
  1275. const instance = getCurrentInstance();
  1276. const state = useTransitionState();
  1277. let prevChildren;
  1278. let children;
  1279. onUpdated(() => {
  1280. if (!prevChildren.length) {
  1281. return;
  1282. }
  1283. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  1284. if (!hasCSSTransform(
  1285. prevChildren[0].el,
  1286. instance.vnode.el,
  1287. moveClass
  1288. )) {
  1289. prevChildren = [];
  1290. return;
  1291. }
  1292. prevChildren.forEach(callPendingCbs);
  1293. prevChildren.forEach(recordPosition);
  1294. const movedChildren = prevChildren.filter(applyTranslation);
  1295. forceReflow();
  1296. movedChildren.forEach((c) => {
  1297. const el = c.el;
  1298. const style = el.style;
  1299. addTransitionClass(el, moveClass);
  1300. style.transform = style.webkitTransform = style.transitionDuration = "";
  1301. const cb = el[moveCbKey] = (e) => {
  1302. if (e && e.target !== el) {
  1303. return;
  1304. }
  1305. if (!e || /transform$/.test(e.propertyName)) {
  1306. el.removeEventListener("transitionend", cb);
  1307. el[moveCbKey] = null;
  1308. removeTransitionClass(el, moveClass);
  1309. }
  1310. };
  1311. el.addEventListener("transitionend", cb);
  1312. });
  1313. prevChildren = [];
  1314. });
  1315. return () => {
  1316. const rawProps = toRaw(props);
  1317. const cssTransitionProps = resolveTransitionProps(rawProps);
  1318. let tag = rawProps.tag || Fragment;
  1319. prevChildren = [];
  1320. if (children) {
  1321. for (let i = 0; i < children.length; i++) {
  1322. const child = children[i];
  1323. if (child.el && child.el instanceof Element) {
  1324. prevChildren.push(child);
  1325. setTransitionHooks(
  1326. child,
  1327. resolveTransitionHooks(
  1328. child,
  1329. cssTransitionProps,
  1330. state,
  1331. instance
  1332. )
  1333. );
  1334. positionMap.set(
  1335. child,
  1336. child.el.getBoundingClientRect()
  1337. );
  1338. }
  1339. }
  1340. }
  1341. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  1342. for (let i = 0; i < children.length; i++) {
  1343. const child = children[i];
  1344. if (child.key != null) {
  1345. setTransitionHooks(
  1346. child,
  1347. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  1348. );
  1349. } else if (!!(process.env.NODE_ENV !== "production") && child.type !== Text) {
  1350. warn(`<TransitionGroup> children must be keyed.`);
  1351. }
  1352. }
  1353. return createVNode(tag, null, children);
  1354. };
  1355. }
  1356. });
  1357. const TransitionGroup = TransitionGroupImpl;
  1358. function callPendingCbs(c) {
  1359. const el = c.el;
  1360. if (el[moveCbKey]) {
  1361. el[moveCbKey]();
  1362. }
  1363. if (el[enterCbKey]) {
  1364. el[enterCbKey]();
  1365. }
  1366. }
  1367. function recordPosition(c) {
  1368. newPositionMap.set(c, c.el.getBoundingClientRect());
  1369. }
  1370. function applyTranslation(c) {
  1371. const oldPos = positionMap.get(c);
  1372. const newPos = newPositionMap.get(c);
  1373. const dx = oldPos.left - newPos.left;
  1374. const dy = oldPos.top - newPos.top;
  1375. if (dx || dy) {
  1376. const s = c.el.style;
  1377. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  1378. s.transitionDuration = "0s";
  1379. return c;
  1380. }
  1381. }
  1382. function hasCSSTransform(el, root, moveClass) {
  1383. const clone = el.cloneNode();
  1384. const _vtc = el[vtcKey];
  1385. if (_vtc) {
  1386. _vtc.forEach((cls) => {
  1387. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  1388. });
  1389. }
  1390. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  1391. clone.style.display = "none";
  1392. const container = root.nodeType === 1 ? root : root.parentNode;
  1393. container.appendChild(clone);
  1394. const { hasTransform } = getTransitionInfo(clone);
  1395. container.removeChild(clone);
  1396. return hasTransform;
  1397. }
  1398. const getModelAssigner = (vnode) => {
  1399. const fn = vnode.props["onUpdate:modelValue"] || false;
  1400. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  1401. };
  1402. function onCompositionStart(e) {
  1403. e.target.composing = true;
  1404. }
  1405. function onCompositionEnd(e) {
  1406. const target = e.target;
  1407. if (target.composing) {
  1408. target.composing = false;
  1409. target.dispatchEvent(new Event("input"));
  1410. }
  1411. }
  1412. const assignKey = Symbol("_assign");
  1413. const vModelText = {
  1414. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  1415. el[assignKey] = getModelAssigner(vnode);
  1416. const castToNumber = number || vnode.props && vnode.props.type === "number";
  1417. addEventListener(el, lazy ? "change" : "input", (e) => {
  1418. if (e.target.composing) return;
  1419. let domValue = el.value;
  1420. if (trim) {
  1421. domValue = domValue.trim();
  1422. }
  1423. if (castToNumber) {
  1424. domValue = looseToNumber(domValue);
  1425. }
  1426. el[assignKey](domValue);
  1427. });
  1428. if (trim) {
  1429. addEventListener(el, "change", () => {
  1430. el.value = el.value.trim();
  1431. });
  1432. }
  1433. if (!lazy) {
  1434. addEventListener(el, "compositionstart", onCompositionStart);
  1435. addEventListener(el, "compositionend", onCompositionEnd);
  1436. addEventListener(el, "change", onCompositionEnd);
  1437. }
  1438. },
  1439. // set value on mounted so it's after min/max for type="range"
  1440. mounted(el, { value }) {
  1441. el.value = value == null ? "" : value;
  1442. },
  1443. beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
  1444. el[assignKey] = getModelAssigner(vnode);
  1445. if (el.composing) return;
  1446. const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
  1447. const newValue = value == null ? "" : value;
  1448. if (elValue === newValue) {
  1449. return;
  1450. }
  1451. if (document.activeElement === el && el.type !== "range") {
  1452. if (lazy && value === oldValue) {
  1453. return;
  1454. }
  1455. if (trim && el.value.trim() === newValue) {
  1456. return;
  1457. }
  1458. }
  1459. el.value = newValue;
  1460. }
  1461. };
  1462. const vModelCheckbox = {
  1463. // #4096 array checkboxes need to be deep traversed
  1464. deep: true,
  1465. created(el, _, vnode) {
  1466. el[assignKey] = getModelAssigner(vnode);
  1467. addEventListener(el, "change", () => {
  1468. const modelValue = el._modelValue;
  1469. const elementValue = getValue(el);
  1470. const checked = el.checked;
  1471. const assign = el[assignKey];
  1472. if (isArray(modelValue)) {
  1473. const index = looseIndexOf(modelValue, elementValue);
  1474. const found = index !== -1;
  1475. if (checked && !found) {
  1476. assign(modelValue.concat(elementValue));
  1477. } else if (!checked && found) {
  1478. const filtered = [...modelValue];
  1479. filtered.splice(index, 1);
  1480. assign(filtered);
  1481. }
  1482. } else if (isSet(modelValue)) {
  1483. const cloned = new Set(modelValue);
  1484. if (checked) {
  1485. cloned.add(elementValue);
  1486. } else {
  1487. cloned.delete(elementValue);
  1488. }
  1489. assign(cloned);
  1490. } else {
  1491. assign(getCheckboxValue(el, checked));
  1492. }
  1493. });
  1494. },
  1495. // set initial checked on mount to wait for true-value/false-value
  1496. mounted: setChecked,
  1497. beforeUpdate(el, binding, vnode) {
  1498. el[assignKey] = getModelAssigner(vnode);
  1499. setChecked(el, binding, vnode);
  1500. }
  1501. };
  1502. function setChecked(el, { value, oldValue }, vnode) {
  1503. el._modelValue = value;
  1504. let checked;
  1505. if (isArray(value)) {
  1506. checked = looseIndexOf(value, vnode.props.value) > -1;
  1507. } else if (isSet(value)) {
  1508. checked = value.has(vnode.props.value);
  1509. } else {
  1510. if (value === oldValue) return;
  1511. checked = looseEqual(value, getCheckboxValue(el, true));
  1512. }
  1513. if (el.checked !== checked) {
  1514. el.checked = checked;
  1515. }
  1516. }
  1517. const vModelRadio = {
  1518. created(el, { value }, vnode) {
  1519. el.checked = looseEqual(value, vnode.props.value);
  1520. el[assignKey] = getModelAssigner(vnode);
  1521. addEventListener(el, "change", () => {
  1522. el[assignKey](getValue(el));
  1523. });
  1524. },
  1525. beforeUpdate(el, { value, oldValue }, vnode) {
  1526. el[assignKey] = getModelAssigner(vnode);
  1527. if (value !== oldValue) {
  1528. el.checked = looseEqual(value, vnode.props.value);
  1529. }
  1530. }
  1531. };
  1532. const vModelSelect = {
  1533. // <select multiple> value need to be deep traversed
  1534. deep: true,
  1535. created(el, { value, modifiers: { number } }, vnode) {
  1536. const isSetModel = isSet(value);
  1537. addEventListener(el, "change", () => {
  1538. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  1539. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  1540. );
  1541. el[assignKey](
  1542. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  1543. );
  1544. el._assigning = true;
  1545. nextTick(() => {
  1546. el._assigning = false;
  1547. });
  1548. });
  1549. el[assignKey] = getModelAssigner(vnode);
  1550. },
  1551. // set value in mounted & updated because <select> relies on its children
  1552. // <option>s.
  1553. mounted(el, { value }) {
  1554. setSelected(el, value);
  1555. },
  1556. beforeUpdate(el, _binding, vnode) {
  1557. el[assignKey] = getModelAssigner(vnode);
  1558. },
  1559. updated(el, { value }) {
  1560. if (!el._assigning) {
  1561. setSelected(el, value);
  1562. }
  1563. }
  1564. };
  1565. function setSelected(el, value) {
  1566. const isMultiple = el.multiple;
  1567. const isArrayValue = isArray(value);
  1568. if (isMultiple && !isArrayValue && !isSet(value)) {
  1569. !!(process.env.NODE_ENV !== "production") && warn(
  1570. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  1571. );
  1572. return;
  1573. }
  1574. for (let i = 0, l = el.options.length; i < l; i++) {
  1575. const option = el.options[i];
  1576. const optionValue = getValue(option);
  1577. if (isMultiple) {
  1578. if (isArrayValue) {
  1579. const optionType = typeof optionValue;
  1580. if (optionType === "string" || optionType === "number") {
  1581. option.selected = value.some((v) => String(v) === String(optionValue));
  1582. } else {
  1583. option.selected = looseIndexOf(value, optionValue) > -1;
  1584. }
  1585. } else {
  1586. option.selected = value.has(optionValue);
  1587. }
  1588. } else if (looseEqual(getValue(option), value)) {
  1589. if (el.selectedIndex !== i) el.selectedIndex = i;
  1590. return;
  1591. }
  1592. }
  1593. if (!isMultiple && el.selectedIndex !== -1) {
  1594. el.selectedIndex = -1;
  1595. }
  1596. }
  1597. function getValue(el) {
  1598. return "_value" in el ? el._value : el.value;
  1599. }
  1600. function getCheckboxValue(el, checked) {
  1601. const key = checked ? "_trueValue" : "_falseValue";
  1602. return key in el ? el[key] : checked;
  1603. }
  1604. const vModelDynamic = {
  1605. created(el, binding, vnode) {
  1606. callModelHook(el, binding, vnode, null, "created");
  1607. },
  1608. mounted(el, binding, vnode) {
  1609. callModelHook(el, binding, vnode, null, "mounted");
  1610. },
  1611. beforeUpdate(el, binding, vnode, prevVNode) {
  1612. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  1613. },
  1614. updated(el, binding, vnode, prevVNode) {
  1615. callModelHook(el, binding, vnode, prevVNode, "updated");
  1616. }
  1617. };
  1618. function resolveDynamicModel(tagName, type) {
  1619. switch (tagName) {
  1620. case "SELECT":
  1621. return vModelSelect;
  1622. case "TEXTAREA":
  1623. return vModelText;
  1624. default:
  1625. switch (type) {
  1626. case "checkbox":
  1627. return vModelCheckbox;
  1628. case "radio":
  1629. return vModelRadio;
  1630. default:
  1631. return vModelText;
  1632. }
  1633. }
  1634. }
  1635. function callModelHook(el, binding, vnode, prevVNode, hook) {
  1636. const modelToUse = resolveDynamicModel(
  1637. el.tagName,
  1638. vnode.props && vnode.props.type
  1639. );
  1640. const fn = modelToUse[hook];
  1641. fn && fn(el, binding, vnode, prevVNode);
  1642. }
  1643. function initVModelForSSR() {
  1644. vModelText.getSSRProps = ({ value }) => ({ value });
  1645. vModelRadio.getSSRProps = ({ value }, vnode) => {
  1646. if (vnode.props && looseEqual(vnode.props.value, value)) {
  1647. return { checked: true };
  1648. }
  1649. };
  1650. vModelCheckbox.getSSRProps = ({ value }, vnode) => {
  1651. if (isArray(value)) {
  1652. if (vnode.props && looseIndexOf(value, vnode.props.value) > -1) {
  1653. return { checked: true };
  1654. }
  1655. } else if (isSet(value)) {
  1656. if (vnode.props && value.has(vnode.props.value)) {
  1657. return { checked: true };
  1658. }
  1659. } else if (value) {
  1660. return { checked: true };
  1661. }
  1662. };
  1663. vModelDynamic.getSSRProps = (binding, vnode) => {
  1664. if (typeof vnode.type !== "string") {
  1665. return;
  1666. }
  1667. const modelToUse = resolveDynamicModel(
  1668. // resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase
  1669. vnode.type.toUpperCase(),
  1670. vnode.props && vnode.props.type
  1671. );
  1672. if (modelToUse.getSSRProps) {
  1673. return modelToUse.getSSRProps(binding, vnode);
  1674. }
  1675. };
  1676. }
  1677. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  1678. const modifierGuards = {
  1679. stop: (e) => e.stopPropagation(),
  1680. prevent: (e) => e.preventDefault(),
  1681. self: (e) => e.target !== e.currentTarget,
  1682. ctrl: (e) => !e.ctrlKey,
  1683. shift: (e) => !e.shiftKey,
  1684. alt: (e) => !e.altKey,
  1685. meta: (e) => !e.metaKey,
  1686. left: (e) => "button" in e && e.button !== 0,
  1687. middle: (e) => "button" in e && e.button !== 1,
  1688. right: (e) => "button" in e && e.button !== 2,
  1689. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  1690. };
  1691. const withModifiers = (fn, modifiers) => {
  1692. const cache = fn._withMods || (fn._withMods = {});
  1693. const cacheKey = modifiers.join(".");
  1694. return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
  1695. for (let i = 0; i < modifiers.length; i++) {
  1696. const guard = modifierGuards[modifiers[i]];
  1697. if (guard && guard(event, modifiers)) return;
  1698. }
  1699. return fn(event, ...args);
  1700. });
  1701. };
  1702. const keyNames = {
  1703. esc: "escape",
  1704. space: " ",
  1705. up: "arrow-up",
  1706. left: "arrow-left",
  1707. right: "arrow-right",
  1708. down: "arrow-down",
  1709. delete: "backspace"
  1710. };
  1711. const withKeys = (fn, modifiers) => {
  1712. const cache = fn._withKeys || (fn._withKeys = {});
  1713. const cacheKey = modifiers.join(".");
  1714. return cache[cacheKey] || (cache[cacheKey] = (event) => {
  1715. if (!("key" in event)) {
  1716. return;
  1717. }
  1718. const eventKey = hyphenate(event.key);
  1719. if (modifiers.some(
  1720. (k) => k === eventKey || keyNames[k] === eventKey
  1721. )) {
  1722. return fn(event);
  1723. }
  1724. });
  1725. };
  1726. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  1727. let renderer;
  1728. let enabledHydration = false;
  1729. function ensureRenderer() {
  1730. return renderer || (renderer = createRenderer(rendererOptions));
  1731. }
  1732. function ensureHydrationRenderer() {
  1733. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  1734. enabledHydration = true;
  1735. return renderer;
  1736. }
  1737. const render = (...args) => {
  1738. ensureRenderer().render(...args);
  1739. };
  1740. const hydrate = (...args) => {
  1741. ensureHydrationRenderer().hydrate(...args);
  1742. };
  1743. const createApp = (...args) => {
  1744. const app = ensureRenderer().createApp(...args);
  1745. if (!!(process.env.NODE_ENV !== "production")) {
  1746. injectNativeTagCheck(app);
  1747. injectCompilerOptionsCheck(app);
  1748. }
  1749. const { mount } = app;
  1750. app.mount = (containerOrSelector) => {
  1751. const container = normalizeContainer(containerOrSelector);
  1752. if (!container) return;
  1753. const component = app._component;
  1754. if (!isFunction(component) && !component.render && !component.template) {
  1755. component.template = container.innerHTML;
  1756. }
  1757. if (container.nodeType === 1) {
  1758. container.textContent = "";
  1759. }
  1760. const proxy = mount(container, false, resolveRootNamespace(container));
  1761. if (container instanceof Element) {
  1762. container.removeAttribute("v-cloak");
  1763. container.setAttribute("data-v-app", "");
  1764. }
  1765. return proxy;
  1766. };
  1767. return app;
  1768. };
  1769. const createSSRApp = (...args) => {
  1770. const app = ensureHydrationRenderer().createApp(...args);
  1771. if (!!(process.env.NODE_ENV !== "production")) {
  1772. injectNativeTagCheck(app);
  1773. injectCompilerOptionsCheck(app);
  1774. }
  1775. const { mount } = app;
  1776. app.mount = (containerOrSelector) => {
  1777. const container = normalizeContainer(containerOrSelector);
  1778. if (container) {
  1779. return mount(container, true, resolveRootNamespace(container));
  1780. }
  1781. };
  1782. return app;
  1783. };
  1784. function resolveRootNamespace(container) {
  1785. if (container instanceof SVGElement) {
  1786. return "svg";
  1787. }
  1788. if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
  1789. return "mathml";
  1790. }
  1791. }
  1792. function injectNativeTagCheck(app) {
  1793. Object.defineProperty(app.config, "isNativeTag", {
  1794. value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  1795. writable: false
  1796. });
  1797. }
  1798. function injectCompilerOptionsCheck(app) {
  1799. if (isRuntimeOnly()) {
  1800. const isCustomElement = app.config.isCustomElement;
  1801. Object.defineProperty(app.config, "isCustomElement", {
  1802. get() {
  1803. return isCustomElement;
  1804. },
  1805. set() {
  1806. warn(
  1807. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  1808. );
  1809. }
  1810. });
  1811. const compilerOptions = app.config.compilerOptions;
  1812. const msg = `The \`compilerOptions\` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, \`compilerOptions\` must be passed to \`@vue/compiler-dom\` in the build setup instead.
  1813. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  1814. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  1815. - For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc`;
  1816. Object.defineProperty(app.config, "compilerOptions", {
  1817. get() {
  1818. warn(msg);
  1819. return compilerOptions;
  1820. },
  1821. set() {
  1822. warn(msg);
  1823. }
  1824. });
  1825. }
  1826. }
  1827. function normalizeContainer(container) {
  1828. if (isString(container)) {
  1829. const res = document.querySelector(container);
  1830. if (!!(process.env.NODE_ENV !== "production") && !res) {
  1831. warn(
  1832. `Failed to mount app: mount target selector "${container}" returned null.`
  1833. );
  1834. }
  1835. return res;
  1836. }
  1837. if (!!(process.env.NODE_ENV !== "production") && window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  1838. warn(
  1839. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  1840. );
  1841. }
  1842. return container;
  1843. }
  1844. let ssrDirectiveInitialized = false;
  1845. const initDirectivesForSSR = () => {
  1846. if (!ssrDirectiveInitialized) {
  1847. ssrDirectiveInitialized = true;
  1848. initVModelForSSR();
  1849. initVShowForSSR();
  1850. }
  1851. } ;
  1852. export { Transition, TransitionGroup, VueElement, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, hydrate, initDirectivesForSSR, render, useCssModule, useCssVars, useHost, useShadowRoot, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, withKeys, withModifiers };