a637c062ef82d8fde44780e77cad851fbe8e1899dfb4f9d37c3fd8123df10507bf6314e23ad785027e7972c4f0bd0be7fe94bce654d2e15128c5802cc9e276 54 KB

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