runtime-dom.cjs.prod.js 53 KB

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