Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

runtime-dom.cjs.prod.js 43KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468
  1. /**
  2. * @vue/runtime-dom v3.4.38
  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. const svgNS = "http://www.w3.org/2000/svg";
  11. const mathmlNS = "http://www.w3.org/1998/Math/MathML";
  12. const doc = typeof document !== "undefined" ? document : null;
  13. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  14. const nodeOps = {
  15. insert: (child, parent, anchor) => {
  16. parent.insertBefore(child, anchor || null);
  17. },
  18. remove: (child) => {
  19. const parent = child.parentNode;
  20. if (parent) {
  21. parent.removeChild(child);
  22. }
  23. },
  24. createElement: (tag, namespace, is, props) => {
  25. const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
  26. if (tag === "select" && props && props.multiple != null) {
  27. el.setAttribute("multiple", props.multiple);
  28. }
  29. return el;
  30. },
  31. createText: (text) => doc.createTextNode(text),
  32. createComment: (text) => doc.createComment(text),
  33. setText: (node, text) => {
  34. node.nodeValue = text;
  35. },
  36. setElementText: (el, text) => {
  37. el.textContent = text;
  38. },
  39. parentNode: (node) => node.parentNode,
  40. nextSibling: (node) => node.nextSibling,
  41. querySelector: (selector) => doc.querySelector(selector),
  42. setScopeId(el, id) {
  43. el.setAttribute(id, "");
  44. },
  45. // __UNSAFE__
  46. // Reason: innerHTML.
  47. // Static content here can only come from compiled templates.
  48. // As long as the user only uses trusted templates, this is safe.
  49. insertStaticContent(content, parent, anchor, namespace, start, end) {
  50. const before = anchor ? anchor.previousSibling : parent.lastChild;
  51. if (start && (start === end || start.nextSibling)) {
  52. while (true) {
  53. parent.insertBefore(start.cloneNode(true), anchor);
  54. if (start === end || !(start = start.nextSibling)) break;
  55. }
  56. } else {
  57. templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
  58. const template = templateContainer.content;
  59. if (namespace === "svg" || namespace === "mathml") {
  60. const wrapper = template.firstChild;
  61. while (wrapper.firstChild) {
  62. template.appendChild(wrapper.firstChild);
  63. }
  64. template.removeChild(wrapper);
  65. }
  66. parent.insertBefore(template, anchor);
  67. }
  68. return [
  69. // first
  70. before ? before.nextSibling : parent.firstChild,
  71. // last
  72. anchor ? anchor.previousSibling : parent.lastChild
  73. ];
  74. }
  75. };
  76. const TRANSITION = "transition";
  77. const ANIMATION = "animation";
  78. const vtcKey = Symbol("_vtc");
  79. const Transition = (props, { slots }) => runtimeCore.h(runtimeCore.BaseTransition, resolveTransitionProps(props), slots);
  80. Transition.displayName = "Transition";
  81. const DOMTransitionPropsValidators = {
  82. name: String,
  83. type: String,
  84. css: {
  85. type: Boolean,
  86. default: true
  87. },
  88. duration: [String, Number, Object],
  89. enterFromClass: String,
  90. enterActiveClass: String,
  91. enterToClass: String,
  92. appearFromClass: String,
  93. appearActiveClass: String,
  94. appearToClass: String,
  95. leaveFromClass: String,
  96. leaveActiveClass: String,
  97. leaveToClass: String
  98. };
  99. const TransitionPropsValidators = Transition.props = /* @__PURE__ */ shared.extend(
  100. {},
  101. runtimeCore.BaseTransitionPropsValidators,
  102. DOMTransitionPropsValidators
  103. );
  104. const callHook = (hook, args = []) => {
  105. if (shared.isArray(hook)) {
  106. hook.forEach((h2) => h2(...args));
  107. } else if (hook) {
  108. hook(...args);
  109. }
  110. };
  111. const hasExplicitCallback = (hook) => {
  112. return hook ? shared.isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  113. };
  114. function resolveTransitionProps(rawProps) {
  115. const baseProps = {};
  116. for (const key in rawProps) {
  117. if (!(key in DOMTransitionPropsValidators)) {
  118. baseProps[key] = rawProps[key];
  119. }
  120. }
  121. if (rawProps.css === false) {
  122. return baseProps;
  123. }
  124. const {
  125. name = "v",
  126. type,
  127. duration,
  128. enterFromClass = `${name}-enter-from`,
  129. enterActiveClass = `${name}-enter-active`,
  130. enterToClass = `${name}-enter-to`,
  131. appearFromClass = enterFromClass,
  132. appearActiveClass = enterActiveClass,
  133. appearToClass = enterToClass,
  134. leaveFromClass = `${name}-leave-from`,
  135. leaveActiveClass = `${name}-leave-active`,
  136. leaveToClass = `${name}-leave-to`
  137. } = rawProps;
  138. const durations = normalizeDuration(duration);
  139. const enterDuration = durations && durations[0];
  140. const leaveDuration = durations && durations[1];
  141. const {
  142. onBeforeEnter,
  143. onEnter,
  144. onEnterCancelled,
  145. onLeave,
  146. onLeaveCancelled,
  147. onBeforeAppear = onBeforeEnter,
  148. onAppear = onEnter,
  149. onAppearCancelled = onEnterCancelled
  150. } = baseProps;
  151. const finishEnter = (el, isAppear, done) => {
  152. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  153. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  154. done && done();
  155. };
  156. const finishLeave = (el, done) => {
  157. el._isLeaving = false;
  158. removeTransitionClass(el, leaveFromClass);
  159. removeTransitionClass(el, leaveToClass);
  160. removeTransitionClass(el, leaveActiveClass);
  161. done && done();
  162. };
  163. const makeEnterHook = (isAppear) => {
  164. return (el, done) => {
  165. const hook = isAppear ? onAppear : onEnter;
  166. const resolve = () => finishEnter(el, isAppear, done);
  167. callHook(hook, [el, resolve]);
  168. nextFrame(() => {
  169. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  170. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  171. if (!hasExplicitCallback(hook)) {
  172. whenTransitionEnds(el, type, enterDuration, resolve);
  173. }
  174. });
  175. };
  176. };
  177. return shared.extend(baseProps, {
  178. onBeforeEnter(el) {
  179. callHook(onBeforeEnter, [el]);
  180. addTransitionClass(el, enterFromClass);
  181. addTransitionClass(el, enterActiveClass);
  182. },
  183. onBeforeAppear(el) {
  184. callHook(onBeforeAppear, [el]);
  185. addTransitionClass(el, appearFromClass);
  186. addTransitionClass(el, appearActiveClass);
  187. },
  188. onEnter: makeEnterHook(false),
  189. onAppear: makeEnterHook(true),
  190. onLeave(el, done) {
  191. el._isLeaving = true;
  192. const resolve = () => finishLeave(el, done);
  193. addTransitionClass(el, leaveFromClass);
  194. addTransitionClass(el, leaveActiveClass);
  195. forceReflow();
  196. nextFrame(() => {
  197. if (!el._isLeaving) {
  198. return;
  199. }
  200. removeTransitionClass(el, leaveFromClass);
  201. addTransitionClass(el, leaveToClass);
  202. if (!hasExplicitCallback(onLeave)) {
  203. whenTransitionEnds(el, type, leaveDuration, resolve);
  204. }
  205. });
  206. callHook(onLeave, [el, resolve]);
  207. },
  208. onEnterCancelled(el) {
  209. finishEnter(el, false);
  210. callHook(onEnterCancelled, [el]);
  211. },
  212. onAppearCancelled(el) {
  213. finishEnter(el, true);
  214. callHook(onAppearCancelled, [el]);
  215. },
  216. onLeaveCancelled(el) {
  217. finishLeave(el);
  218. callHook(onLeaveCancelled, [el]);
  219. }
  220. });
  221. }
  222. function normalizeDuration(duration) {
  223. if (duration == null) {
  224. return null;
  225. } else if (shared.isObject(duration)) {
  226. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  227. } else {
  228. const n = NumberOf(duration);
  229. return [n, n];
  230. }
  231. }
  232. function NumberOf(val) {
  233. const res = shared.toNumber(val);
  234. return res;
  235. }
  236. function addTransitionClass(el, cls) {
  237. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  238. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  239. }
  240. function removeTransitionClass(el, cls) {
  241. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  242. const _vtc = el[vtcKey];
  243. if (_vtc) {
  244. _vtc.delete(cls);
  245. if (!_vtc.size) {
  246. el[vtcKey] = void 0;
  247. }
  248. }
  249. }
  250. function nextFrame(cb) {
  251. requestAnimationFrame(() => {
  252. requestAnimationFrame(cb);
  253. });
  254. }
  255. let endId = 0;
  256. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  257. const id = el._endId = ++endId;
  258. const resolveIfNotStale = () => {
  259. if (id === el._endId) {
  260. resolve();
  261. }
  262. };
  263. if (explicitTimeout) {
  264. return setTimeout(resolveIfNotStale, explicitTimeout);
  265. }
  266. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  267. if (!type) {
  268. return resolve();
  269. }
  270. const endEvent = type + "end";
  271. let ended = 0;
  272. const end = () => {
  273. el.removeEventListener(endEvent, onEnd);
  274. resolveIfNotStale();
  275. };
  276. const onEnd = (e) => {
  277. if (e.target === el && ++ended >= propCount) {
  278. end();
  279. }
  280. };
  281. setTimeout(() => {
  282. if (ended < propCount) {
  283. end();
  284. }
  285. }, timeout + 1);
  286. el.addEventListener(endEvent, onEnd);
  287. }
  288. function getTransitionInfo(el, expectedType) {
  289. const styles = window.getComputedStyle(el);
  290. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  291. const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
  292. const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
  293. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  294. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  295. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  296. const animationTimeout = getTimeout(animationDelays, animationDurations);
  297. let type = null;
  298. let timeout = 0;
  299. let propCount = 0;
  300. if (expectedType === TRANSITION) {
  301. if (transitionTimeout > 0) {
  302. type = TRANSITION;
  303. timeout = transitionTimeout;
  304. propCount = transitionDurations.length;
  305. }
  306. } else if (expectedType === ANIMATION) {
  307. if (animationTimeout > 0) {
  308. type = ANIMATION;
  309. timeout = animationTimeout;
  310. propCount = animationDurations.length;
  311. }
  312. } else {
  313. timeout = Math.max(transitionTimeout, animationTimeout);
  314. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
  315. propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
  316. }
  317. const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
  318. getStyleProperties(`${TRANSITION}Property`).toString()
  319. );
  320. return {
  321. type,
  322. timeout,
  323. propCount,
  324. hasTransform
  325. };
  326. }
  327. function getTimeout(delays, durations) {
  328. while (delays.length < durations.length) {
  329. delays = delays.concat(delays);
  330. }
  331. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  332. }
  333. function toMs(s) {
  334. if (s === "auto") return 0;
  335. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  336. }
  337. function forceReflow() {
  338. return document.body.offsetHeight;
  339. }
  340. function patchClass(el, value, isSVG) {
  341. const transitionClasses = el[vtcKey];
  342. if (transitionClasses) {
  343. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  344. }
  345. if (value == null) {
  346. el.removeAttribute("class");
  347. } else if (isSVG) {
  348. el.setAttribute("class", value);
  349. } else {
  350. el.className = value;
  351. }
  352. }
  353. const vShowOriginalDisplay = Symbol("_vod");
  354. const vShowHidden = Symbol("_vsh");
  355. const vShow = {
  356. beforeMount(el, { value }, { transition }) {
  357. el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
  358. if (transition && value) {
  359. transition.beforeEnter(el);
  360. } else {
  361. setDisplay(el, value);
  362. }
  363. },
  364. mounted(el, { value }, { transition }) {
  365. if (transition && value) {
  366. transition.enter(el);
  367. }
  368. },
  369. updated(el, { value, oldValue }, { transition }) {
  370. if (!value === !oldValue) return;
  371. if (transition) {
  372. if (value) {
  373. transition.beforeEnter(el);
  374. setDisplay(el, true);
  375. transition.enter(el);
  376. } else {
  377. transition.leave(el, () => {
  378. setDisplay(el, false);
  379. });
  380. }
  381. } else {
  382. setDisplay(el, value);
  383. }
  384. },
  385. beforeUnmount(el, { value }) {
  386. setDisplay(el, value);
  387. }
  388. };
  389. function setDisplay(el, value) {
  390. el.style.display = value ? el[vShowOriginalDisplay] : "none";
  391. el[vShowHidden] = !value;
  392. }
  393. function initVShowForSSR() {
  394. vShow.getSSRProps = ({ value }) => {
  395. if (!value) {
  396. return { style: { display: "none" } };
  397. }
  398. };
  399. }
  400. const CSS_VAR_TEXT = Symbol("");
  401. function useCssVars(getter) {
  402. return;
  403. }
  404. const displayRE = /(^|;)\s*display\s*:/;
  405. function patchStyle(el, prev, next) {
  406. const style = el.style;
  407. const isCssString = shared.isString(next);
  408. let hasControlledDisplay = false;
  409. if (next && !isCssString) {
  410. if (prev) {
  411. if (!shared.isString(prev)) {
  412. for (const key in prev) {
  413. if (next[key] == null) {
  414. setStyle(style, key, "");
  415. }
  416. }
  417. } else {
  418. for (const prevStyle of prev.split(";")) {
  419. const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
  420. if (next[key] == null) {
  421. setStyle(style, key, "");
  422. }
  423. }
  424. }
  425. }
  426. for (const key in next) {
  427. if (key === "display") {
  428. hasControlledDisplay = true;
  429. }
  430. setStyle(style, key, next[key]);
  431. }
  432. } else {
  433. if (isCssString) {
  434. if (prev !== next) {
  435. const cssVarText = style[CSS_VAR_TEXT];
  436. if (cssVarText) {
  437. next += ";" + cssVarText;
  438. }
  439. style.cssText = next;
  440. hasControlledDisplay = displayRE.test(next);
  441. }
  442. } else if (prev) {
  443. el.removeAttribute("style");
  444. }
  445. }
  446. if (vShowOriginalDisplay in el) {
  447. el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
  448. if (el[vShowHidden]) {
  449. style.display = "none";
  450. }
  451. }
  452. }
  453. const importantRE = /\s*!important$/;
  454. function setStyle(style, name, val) {
  455. if (shared.isArray(val)) {
  456. val.forEach((v) => setStyle(style, name, v));
  457. } else {
  458. if (val == null) val = "";
  459. if (name.startsWith("--")) {
  460. style.setProperty(name, val);
  461. } else {
  462. const prefixed = autoPrefix(style, name);
  463. if (importantRE.test(val)) {
  464. style.setProperty(
  465. shared.hyphenate(prefixed),
  466. val.replace(importantRE, ""),
  467. "important"
  468. );
  469. } else {
  470. style[prefixed] = val;
  471. }
  472. }
  473. }
  474. }
  475. const prefixes = ["Webkit", "Moz", "ms"];
  476. const prefixCache = {};
  477. function autoPrefix(style, rawName) {
  478. const cached = prefixCache[rawName];
  479. if (cached) {
  480. return cached;
  481. }
  482. let name = runtimeCore.camelize(rawName);
  483. if (name !== "filter" && name in style) {
  484. return prefixCache[rawName] = name;
  485. }
  486. name = shared.capitalize(name);
  487. for (let i = 0; i < prefixes.length; i++) {
  488. const prefixed = prefixes[i] + name;
  489. if (prefixed in style) {
  490. return prefixCache[rawName] = prefixed;
  491. }
  492. }
  493. return rawName;
  494. }
  495. const xlinkNS = "http://www.w3.org/1999/xlink";
  496. function patchAttr(el, key, value, isSVG, instance, isBoolean = shared.isSpecialBooleanAttr(key)) {
  497. if (isSVG && key.startsWith("xlink:")) {
  498. if (value == null) {
  499. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  500. } else {
  501. el.setAttributeNS(xlinkNS, key, value);
  502. }
  503. } else {
  504. if (value == null || isBoolean && !shared.includeBooleanAttr(value)) {
  505. el.removeAttribute(key);
  506. } else {
  507. el.setAttribute(
  508. key,
  509. isBoolean ? "" : shared.isSymbol(value) ? String(value) : value
  510. );
  511. }
  512. }
  513. }
  514. function patchDOMProp(el, key, value, parentComponent) {
  515. if (key === "innerHTML" || key === "textContent") {
  516. if (value == null) return;
  517. el[key] = value;
  518. return;
  519. }
  520. const tag = el.tagName;
  521. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  522. !tag.includes("-")) {
  523. const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
  524. const newValue = value == null ? "" : String(value);
  525. if (oldValue !== newValue || !("_value" in el)) {
  526. el.value = newValue;
  527. }
  528. if (value == null) {
  529. el.removeAttribute(key);
  530. }
  531. el._value = value;
  532. return;
  533. }
  534. let needRemove = false;
  535. if (value === "" || value == null) {
  536. const type = typeof el[key];
  537. if (type === "boolean") {
  538. value = shared.includeBooleanAttr(value);
  539. } else if (value == null && type === "string") {
  540. value = "";
  541. needRemove = true;
  542. } else if (type === "number") {
  543. value = 0;
  544. needRemove = true;
  545. }
  546. }
  547. try {
  548. el[key] = value;
  549. } catch (e) {
  550. }
  551. needRemove && el.removeAttribute(key);
  552. }
  553. function addEventListener(el, event, handler, options) {
  554. el.addEventListener(event, handler, options);
  555. }
  556. function removeEventListener(el, event, handler, options) {
  557. el.removeEventListener(event, handler, options);
  558. }
  559. const veiKey = Symbol("_vei");
  560. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  561. const invokers = el[veiKey] || (el[veiKey] = {});
  562. const existingInvoker = invokers[rawName];
  563. if (nextValue && existingInvoker) {
  564. existingInvoker.value = nextValue;
  565. } else {
  566. const [name, options] = parseName(rawName);
  567. if (nextValue) {
  568. const invoker = invokers[rawName] = createInvoker(
  569. nextValue,
  570. instance
  571. );
  572. addEventListener(el, name, invoker, options);
  573. } else if (existingInvoker) {
  574. removeEventListener(el, name, existingInvoker, options);
  575. invokers[rawName] = void 0;
  576. }
  577. }
  578. }
  579. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  580. function parseName(name) {
  581. let options;
  582. if (optionsModifierRE.test(name)) {
  583. options = {};
  584. let m;
  585. while (m = name.match(optionsModifierRE)) {
  586. name = name.slice(0, name.length - m[0].length);
  587. options[m[0].toLowerCase()] = true;
  588. }
  589. }
  590. const event = name[2] === ":" ? name.slice(3) : shared.hyphenate(name.slice(2));
  591. return [event, options];
  592. }
  593. let cachedNow = 0;
  594. const p = /* @__PURE__ */ Promise.resolve();
  595. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  596. function createInvoker(initialValue, instance) {
  597. const invoker = (e) => {
  598. if (!e._vts) {
  599. e._vts = Date.now();
  600. } else if (e._vts <= invoker.attached) {
  601. return;
  602. }
  603. runtimeCore.callWithAsyncErrorHandling(
  604. patchStopImmediatePropagation(e, invoker.value),
  605. instance,
  606. 5,
  607. [e]
  608. );
  609. };
  610. invoker.value = initialValue;
  611. invoker.attached = getNow();
  612. return invoker;
  613. }
  614. function patchStopImmediatePropagation(e, value) {
  615. if (shared.isArray(value)) {
  616. const originalStop = e.stopImmediatePropagation;
  617. e.stopImmediatePropagation = () => {
  618. originalStop.call(e);
  619. e._stopped = true;
  620. };
  621. return value.map(
  622. (fn) => (e2) => !e2._stopped && fn && fn(e2)
  623. );
  624. } else {
  625. return value;
  626. }
  627. }
  628. const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
  629. key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
  630. const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
  631. const isSVG = namespace === "svg";
  632. if (key === "class") {
  633. patchClass(el, nextValue, isSVG);
  634. } else if (key === "style") {
  635. patchStyle(el, prevValue, nextValue);
  636. } else if (shared.isOn(key)) {
  637. if (!shared.isModelListener(key)) {
  638. patchEvent(el, key, prevValue, nextValue, parentComponent);
  639. }
  640. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  641. patchDOMProp(el, key, nextValue);
  642. if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
  643. patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
  644. }
  645. } else {
  646. if (key === "true-value") {
  647. el._trueValue = nextValue;
  648. } else if (key === "false-value") {
  649. el._falseValue = nextValue;
  650. }
  651. patchAttr(el, key, nextValue, isSVG);
  652. }
  653. };
  654. function shouldSetAsProp(el, key, value, isSVG) {
  655. if (isSVG) {
  656. if (key === "innerHTML" || key === "textContent") {
  657. return true;
  658. }
  659. if (key in el && isNativeOn(key) && shared.isFunction(value)) {
  660. return true;
  661. }
  662. return false;
  663. }
  664. if (key === "spellcheck" || key === "draggable" || key === "translate") {
  665. return false;
  666. }
  667. if (key === "form") {
  668. return false;
  669. }
  670. if (key === "list" && el.tagName === "INPUT") {
  671. return false;
  672. }
  673. if (key === "type" && el.tagName === "TEXTAREA") {
  674. return false;
  675. }
  676. if (key === "width" || key === "height") {
  677. const tag = el.tagName;
  678. if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
  679. return false;
  680. }
  681. }
  682. if (isNativeOn(key) && shared.isString(value)) {
  683. return false;
  684. }
  685. return key in el;
  686. }
  687. /*! #__NO_SIDE_EFFECTS__ */
  688. // @__NO_SIDE_EFFECTS__
  689. function defineCustomElement(options, extraOptions, hydrate2) {
  690. const Comp = runtimeCore.defineComponent(options, extraOptions);
  691. class VueCustomElement extends VueElement {
  692. constructor(initialProps) {
  693. super(Comp, initialProps, hydrate2);
  694. }
  695. }
  696. VueCustomElement.def = Comp;
  697. return VueCustomElement;
  698. }
  699. /*! #__NO_SIDE_EFFECTS__ */
  700. const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
  701. return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
  702. };
  703. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  704. };
  705. class VueElement extends BaseClass {
  706. constructor(_def, _props = {}, hydrate2) {
  707. super();
  708. this._def = _def;
  709. this._props = _props;
  710. /**
  711. * @internal
  712. */
  713. this._instance = null;
  714. this._connected = false;
  715. this._resolved = false;
  716. this._numberProps = null;
  717. this._ob = null;
  718. if (this.shadowRoot && hydrate2) {
  719. hydrate2(this._createVNode(), this.shadowRoot);
  720. } else {
  721. this.attachShadow({ mode: "open" });
  722. if (!this._def.__asyncLoader) {
  723. this._resolveProps(this._def);
  724. }
  725. }
  726. }
  727. connectedCallback() {
  728. this._connected = true;
  729. if (!this._instance) {
  730. if (this._resolved) {
  731. this._update();
  732. } else {
  733. this._resolveDef();
  734. }
  735. }
  736. }
  737. disconnectedCallback() {
  738. this._connected = false;
  739. runtimeCore.nextTick(() => {
  740. if (!this._connected) {
  741. if (this._ob) {
  742. this._ob.disconnect();
  743. this._ob = null;
  744. }
  745. render(null, this.shadowRoot);
  746. this._instance = null;
  747. }
  748. });
  749. }
  750. /**
  751. * resolve inner component definition (handle possible async component)
  752. */
  753. _resolveDef() {
  754. this._resolved = true;
  755. for (let i = 0; i < this.attributes.length; i++) {
  756. this._setAttr(this.attributes[i].name);
  757. }
  758. this._ob = new MutationObserver((mutations) => {
  759. for (const m of mutations) {
  760. this._setAttr(m.attributeName);
  761. }
  762. });
  763. this._ob.observe(this, { attributes: true });
  764. const resolve = (def, isAsync = false) => {
  765. const { props, styles } = def;
  766. let numberProps;
  767. if (props && !shared.isArray(props)) {
  768. for (const key in props) {
  769. const opt = props[key];
  770. if (opt === Number || opt && opt.type === Number) {
  771. if (key in this._props) {
  772. this._props[key] = shared.toNumber(this._props[key]);
  773. }
  774. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[shared.camelize(key)] = true;
  775. }
  776. }
  777. }
  778. this._numberProps = numberProps;
  779. if (isAsync) {
  780. this._resolveProps(def);
  781. }
  782. this._applyStyles(styles);
  783. this._update();
  784. };
  785. const asyncDef = this._def.__asyncLoader;
  786. if (asyncDef) {
  787. asyncDef().then((def) => resolve(def, true));
  788. } else {
  789. resolve(this._def);
  790. }
  791. }
  792. _resolveProps(def) {
  793. const { props } = def;
  794. const declaredPropKeys = shared.isArray(props) ? props : Object.keys(props || {});
  795. for (const key of Object.keys(this)) {
  796. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  797. this._setProp(key, this[key], true, false);
  798. }
  799. }
  800. for (const key of declaredPropKeys.map(shared.camelize)) {
  801. Object.defineProperty(this, key, {
  802. get() {
  803. return this._getProp(key);
  804. },
  805. set(val) {
  806. this._setProp(key, val);
  807. }
  808. });
  809. }
  810. }
  811. _setAttr(key) {
  812. let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
  813. const camelKey = shared.camelize(key);
  814. if (this._numberProps && this._numberProps[camelKey]) {
  815. value = shared.toNumber(value);
  816. }
  817. this._setProp(camelKey, value, false);
  818. }
  819. /**
  820. * @internal
  821. */
  822. _getProp(key) {
  823. return this._props[key];
  824. }
  825. /**
  826. * @internal
  827. */
  828. _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
  829. if (val !== this._props[key]) {
  830. this._props[key] = val;
  831. if (shouldUpdate && this._instance) {
  832. this._update();
  833. }
  834. if (shouldReflect) {
  835. if (val === true) {
  836. this.setAttribute(shared.hyphenate(key), "");
  837. } else if (typeof val === "string" || typeof val === "number") {
  838. this.setAttribute(shared.hyphenate(key), val + "");
  839. } else if (!val) {
  840. this.removeAttribute(shared.hyphenate(key));
  841. }
  842. }
  843. }
  844. }
  845. _update() {
  846. render(this._createVNode(), this.shadowRoot);
  847. }
  848. _createVNode() {
  849. const vnode = runtimeCore.createVNode(this._def, shared.extend({}, this._props));
  850. if (!this._instance) {
  851. vnode.ce = (instance) => {
  852. this._instance = instance;
  853. instance.isCE = true;
  854. const dispatch = (event, args) => {
  855. this.dispatchEvent(
  856. new CustomEvent(event, {
  857. detail: args
  858. })
  859. );
  860. };
  861. instance.emit = (event, ...args) => {
  862. dispatch(event, args);
  863. if (shared.hyphenate(event) !== event) {
  864. dispatch(shared.hyphenate(event), args);
  865. }
  866. };
  867. let parent = this;
  868. while (parent = parent && (parent.parentNode || parent.host)) {
  869. if (parent instanceof VueElement) {
  870. instance.parent = parent._instance;
  871. instance.provides = parent._instance.provides;
  872. break;
  873. }
  874. }
  875. };
  876. }
  877. return vnode;
  878. }
  879. _applyStyles(styles) {
  880. if (styles) {
  881. styles.forEach((css) => {
  882. const s = document.createElement("style");
  883. s.textContent = css;
  884. this.shadowRoot.appendChild(s);
  885. });
  886. }
  887. }
  888. }
  889. function useCssModule(name = "$style") {
  890. {
  891. const instance = runtimeCore.getCurrentInstance();
  892. if (!instance) {
  893. return shared.EMPTY_OBJ;
  894. }
  895. const modules = instance.type.__cssModules;
  896. if (!modules) {
  897. return shared.EMPTY_OBJ;
  898. }
  899. const mod = modules[name];
  900. if (!mod) {
  901. return shared.EMPTY_OBJ;
  902. }
  903. return mod;
  904. }
  905. }
  906. const positionMap = /* @__PURE__ */ new WeakMap();
  907. const newPositionMap = /* @__PURE__ */ new WeakMap();
  908. const moveCbKey = Symbol("_moveCb");
  909. const enterCbKey = Symbol("_enterCb");
  910. const TransitionGroupImpl = {
  911. name: "TransitionGroup",
  912. props: /* @__PURE__ */ shared.extend({}, TransitionPropsValidators, {
  913. tag: String,
  914. moveClass: String
  915. }),
  916. setup(props, { slots }) {
  917. const instance = runtimeCore.getCurrentInstance();
  918. const state = runtimeCore.useTransitionState();
  919. let prevChildren;
  920. let children;
  921. runtimeCore.onUpdated(() => {
  922. if (!prevChildren.length) {
  923. return;
  924. }
  925. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  926. if (!hasCSSTransform(
  927. prevChildren[0].el,
  928. instance.vnode.el,
  929. moveClass
  930. )) {
  931. return;
  932. }
  933. prevChildren.forEach(callPendingCbs);
  934. prevChildren.forEach(recordPosition);
  935. const movedChildren = prevChildren.filter(applyTranslation);
  936. forceReflow();
  937. movedChildren.forEach((c) => {
  938. const el = c.el;
  939. const style = el.style;
  940. addTransitionClass(el, moveClass);
  941. style.transform = style.webkitTransform = style.transitionDuration = "";
  942. const cb = el[moveCbKey] = (e) => {
  943. if (e && e.target !== el) {
  944. return;
  945. }
  946. if (!e || /transform$/.test(e.propertyName)) {
  947. el.removeEventListener("transitionend", cb);
  948. el[moveCbKey] = null;
  949. removeTransitionClass(el, moveClass);
  950. }
  951. };
  952. el.addEventListener("transitionend", cb);
  953. });
  954. });
  955. return () => {
  956. const rawProps = runtimeCore.toRaw(props);
  957. const cssTransitionProps = resolveTransitionProps(rawProps);
  958. let tag = rawProps.tag || runtimeCore.Fragment;
  959. prevChildren = [];
  960. if (children) {
  961. for (let i = 0; i < children.length; i++) {
  962. const child = children[i];
  963. if (child.el && child.el instanceof Element) {
  964. prevChildren.push(child);
  965. runtimeCore.setTransitionHooks(
  966. child,
  967. runtimeCore.resolveTransitionHooks(
  968. child,
  969. cssTransitionProps,
  970. state,
  971. instance
  972. )
  973. );
  974. positionMap.set(
  975. child,
  976. child.el.getBoundingClientRect()
  977. );
  978. }
  979. }
  980. }
  981. children = slots.default ? runtimeCore.getTransitionRawChildren(slots.default()) : [];
  982. for (let i = 0; i < children.length; i++) {
  983. const child = children[i];
  984. if (child.key != null) {
  985. runtimeCore.setTransitionHooks(
  986. child,
  987. runtimeCore.resolveTransitionHooks(child, cssTransitionProps, state, instance)
  988. );
  989. }
  990. }
  991. return runtimeCore.createVNode(tag, null, children);
  992. };
  993. }
  994. };
  995. const removeMode = (props) => delete props.mode;
  996. /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
  997. const TransitionGroup = TransitionGroupImpl;
  998. function callPendingCbs(c) {
  999. const el = c.el;
  1000. if (el[moveCbKey]) {
  1001. el[moveCbKey]();
  1002. }
  1003. if (el[enterCbKey]) {
  1004. el[enterCbKey]();
  1005. }
  1006. }
  1007. function recordPosition(c) {
  1008. newPositionMap.set(c, c.el.getBoundingClientRect());
  1009. }
  1010. function applyTranslation(c) {
  1011. const oldPos = positionMap.get(c);
  1012. const newPos = newPositionMap.get(c);
  1013. const dx = oldPos.left - newPos.left;
  1014. const dy = oldPos.top - newPos.top;
  1015. if (dx || dy) {
  1016. const s = c.el.style;
  1017. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  1018. s.transitionDuration = "0s";
  1019. return c;
  1020. }
  1021. }
  1022. function hasCSSTransform(el, root, moveClass) {
  1023. const clone = el.cloneNode();
  1024. const _vtc = el[vtcKey];
  1025. if (_vtc) {
  1026. _vtc.forEach((cls) => {
  1027. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  1028. });
  1029. }
  1030. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  1031. clone.style.display = "none";
  1032. const container = root.nodeType === 1 ? root : root.parentNode;
  1033. container.appendChild(clone);
  1034. const { hasTransform } = getTransitionInfo(clone);
  1035. container.removeChild(clone);
  1036. return hasTransform;
  1037. }
  1038. const getModelAssigner = (vnode) => {
  1039. const fn = vnode.props["onUpdate:modelValue"] || false;
  1040. return shared.isArray(fn) ? (value) => shared.invokeArrayFns(fn, value) : fn;
  1041. };
  1042. function onCompositionStart(e) {
  1043. e.target.composing = true;
  1044. }
  1045. function onCompositionEnd(e) {
  1046. const target = e.target;
  1047. if (target.composing) {
  1048. target.composing = false;
  1049. target.dispatchEvent(new Event("input"));
  1050. }
  1051. }
  1052. const assignKey = Symbol("_assign");
  1053. const vModelText = {
  1054. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  1055. el[assignKey] = getModelAssigner(vnode);
  1056. const castToNumber = number || vnode.props && vnode.props.type === "number";
  1057. addEventListener(el, lazy ? "change" : "input", (e) => {
  1058. if (e.target.composing) return;
  1059. let domValue = el.value;
  1060. if (trim) {
  1061. domValue = domValue.trim();
  1062. }
  1063. if (castToNumber) {
  1064. domValue = shared.looseToNumber(domValue);
  1065. }
  1066. el[assignKey](domValue);
  1067. });
  1068. if (trim) {
  1069. addEventListener(el, "change", () => {
  1070. el.value = el.value.trim();
  1071. });
  1072. }
  1073. if (!lazy) {
  1074. addEventListener(el, "compositionstart", onCompositionStart);
  1075. addEventListener(el, "compositionend", onCompositionEnd);
  1076. addEventListener(el, "change", onCompositionEnd);
  1077. }
  1078. },
  1079. // set value on mounted so it's after min/max for type="range"
  1080. mounted(el, { value }) {
  1081. el.value = value == null ? "" : value;
  1082. },
  1083. beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
  1084. el[assignKey] = getModelAssigner(vnode);
  1085. if (el.composing) return;
  1086. const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? shared.looseToNumber(el.value) : el.value;
  1087. const newValue = value == null ? "" : value;
  1088. if (elValue === newValue) {
  1089. return;
  1090. }
  1091. if (document.activeElement === el && el.type !== "range") {
  1092. if (lazy && value === oldValue) {
  1093. return;
  1094. }
  1095. if (trim && el.value.trim() === newValue) {
  1096. return;
  1097. }
  1098. }
  1099. el.value = newValue;
  1100. }
  1101. };
  1102. const vModelCheckbox = {
  1103. // #4096 array checkboxes need to be deep traversed
  1104. deep: true,
  1105. created(el, _, vnode) {
  1106. el[assignKey] = getModelAssigner(vnode);
  1107. addEventListener(el, "change", () => {
  1108. const modelValue = el._modelValue;
  1109. const elementValue = getValue(el);
  1110. const checked = el.checked;
  1111. const assign = el[assignKey];
  1112. if (shared.isArray(modelValue)) {
  1113. const index = shared.looseIndexOf(modelValue, elementValue);
  1114. const found = index !== -1;
  1115. if (checked && !found) {
  1116. assign(modelValue.concat(elementValue));
  1117. } else if (!checked && found) {
  1118. const filtered = [...modelValue];
  1119. filtered.splice(index, 1);
  1120. assign(filtered);
  1121. }
  1122. } else if (shared.isSet(modelValue)) {
  1123. const cloned = new Set(modelValue);
  1124. if (checked) {
  1125. cloned.add(elementValue);
  1126. } else {
  1127. cloned.delete(elementValue);
  1128. }
  1129. assign(cloned);
  1130. } else {
  1131. assign(getCheckboxValue(el, checked));
  1132. }
  1133. });
  1134. },
  1135. // set initial checked on mount to wait for true-value/false-value
  1136. mounted: setChecked,
  1137. beforeUpdate(el, binding, vnode) {
  1138. el[assignKey] = getModelAssigner(vnode);
  1139. setChecked(el, binding, vnode);
  1140. }
  1141. };
  1142. function setChecked(el, { value, oldValue }, vnode) {
  1143. el._modelValue = value;
  1144. if (shared.isArray(value)) {
  1145. el.checked = shared.looseIndexOf(value, vnode.props.value) > -1;
  1146. } else if (shared.isSet(value)) {
  1147. el.checked = value.has(vnode.props.value);
  1148. } else if (value !== oldValue) {
  1149. el.checked = shared.looseEqual(value, getCheckboxValue(el, true));
  1150. }
  1151. }
  1152. const vModelRadio = {
  1153. created(el, { value }, vnode) {
  1154. el.checked = shared.looseEqual(value, vnode.props.value);
  1155. el[assignKey] = getModelAssigner(vnode);
  1156. addEventListener(el, "change", () => {
  1157. el[assignKey](getValue(el));
  1158. });
  1159. },
  1160. beforeUpdate(el, { value, oldValue }, vnode) {
  1161. el[assignKey] = getModelAssigner(vnode);
  1162. if (value !== oldValue) {
  1163. el.checked = shared.looseEqual(value, vnode.props.value);
  1164. }
  1165. }
  1166. };
  1167. const vModelSelect = {
  1168. // <select multiple> value need to be deep traversed
  1169. deep: true,
  1170. created(el, { value, modifiers: { number } }, vnode) {
  1171. const isSetModel = shared.isSet(value);
  1172. addEventListener(el, "change", () => {
  1173. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  1174. (o) => number ? shared.looseToNumber(getValue(o)) : getValue(o)
  1175. );
  1176. el[assignKey](
  1177. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  1178. );
  1179. el._assigning = true;
  1180. runtimeCore.nextTick(() => {
  1181. el._assigning = false;
  1182. });
  1183. });
  1184. el[assignKey] = getModelAssigner(vnode);
  1185. },
  1186. // set value in mounted & updated because <select> relies on its children
  1187. // <option>s.
  1188. mounted(el, { value, modifiers: { number } }) {
  1189. setSelected(el, value);
  1190. },
  1191. beforeUpdate(el, _binding, vnode) {
  1192. el[assignKey] = getModelAssigner(vnode);
  1193. },
  1194. updated(el, { value, modifiers: { number } }) {
  1195. if (!el._assigning) {
  1196. setSelected(el, value);
  1197. }
  1198. }
  1199. };
  1200. function setSelected(el, value, number) {
  1201. const isMultiple = el.multiple;
  1202. const isArrayValue = shared.isArray(value);
  1203. if (isMultiple && !isArrayValue && !shared.isSet(value)) {
  1204. return;
  1205. }
  1206. for (let i = 0, l = el.options.length; i < l; i++) {
  1207. const option = el.options[i];
  1208. const optionValue = getValue(option);
  1209. if (isMultiple) {
  1210. if (isArrayValue) {
  1211. const optionType = typeof optionValue;
  1212. if (optionType === "string" || optionType === "number") {
  1213. option.selected = value.some((v) => String(v) === String(optionValue));
  1214. } else {
  1215. option.selected = shared.looseIndexOf(value, optionValue) > -1;
  1216. }
  1217. } else {
  1218. option.selected = value.has(optionValue);
  1219. }
  1220. } else if (shared.looseEqual(getValue(option), value)) {
  1221. if (el.selectedIndex !== i) el.selectedIndex = i;
  1222. return;
  1223. }
  1224. }
  1225. if (!isMultiple && el.selectedIndex !== -1) {
  1226. el.selectedIndex = -1;
  1227. }
  1228. }
  1229. function getValue(el) {
  1230. return "_value" in el ? el._value : el.value;
  1231. }
  1232. function getCheckboxValue(el, checked) {
  1233. const key = checked ? "_trueValue" : "_falseValue";
  1234. return key in el ? el[key] : checked;
  1235. }
  1236. const vModelDynamic = {
  1237. created(el, binding, vnode) {
  1238. callModelHook(el, binding, vnode, null, "created");
  1239. },
  1240. mounted(el, binding, vnode) {
  1241. callModelHook(el, binding, vnode, null, "mounted");
  1242. },
  1243. beforeUpdate(el, binding, vnode, prevVNode) {
  1244. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  1245. },
  1246. updated(el, binding, vnode, prevVNode) {
  1247. callModelHook(el, binding, vnode, prevVNode, "updated");
  1248. }
  1249. };
  1250. function resolveDynamicModel(tagName, type) {
  1251. switch (tagName) {
  1252. case "SELECT":
  1253. return vModelSelect;
  1254. case "TEXTAREA":
  1255. return vModelText;
  1256. default:
  1257. switch (type) {
  1258. case "checkbox":
  1259. return vModelCheckbox;
  1260. case "radio":
  1261. return vModelRadio;
  1262. default:
  1263. return vModelText;
  1264. }
  1265. }
  1266. }
  1267. function callModelHook(el, binding, vnode, prevVNode, hook) {
  1268. const modelToUse = resolveDynamicModel(
  1269. el.tagName,
  1270. vnode.props && vnode.props.type
  1271. );
  1272. const fn = modelToUse[hook];
  1273. fn && fn(el, binding, vnode, prevVNode);
  1274. }
  1275. function initVModelForSSR() {
  1276. vModelText.getSSRProps = ({ value }) => ({ value });
  1277. vModelRadio.getSSRProps = ({ value }, vnode) => {
  1278. if (vnode.props && shared.looseEqual(vnode.props.value, value)) {
  1279. return { checked: true };
  1280. }
  1281. };
  1282. vModelCheckbox.getSSRProps = ({ value }, vnode) => {
  1283. if (shared.isArray(value)) {
  1284. if (vnode.props && shared.looseIndexOf(value, vnode.props.value) > -1) {
  1285. return { checked: true };
  1286. }
  1287. } else if (shared.isSet(value)) {
  1288. if (vnode.props && value.has(vnode.props.value)) {
  1289. return { checked: true };
  1290. }
  1291. } else if (value) {
  1292. return { checked: true };
  1293. }
  1294. };
  1295. vModelDynamic.getSSRProps = (binding, vnode) => {
  1296. if (typeof vnode.type !== "string") {
  1297. return;
  1298. }
  1299. const modelToUse = resolveDynamicModel(
  1300. // resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase
  1301. vnode.type.toUpperCase(),
  1302. vnode.props && vnode.props.type
  1303. );
  1304. if (modelToUse.getSSRProps) {
  1305. return modelToUse.getSSRProps(binding, vnode);
  1306. }
  1307. };
  1308. }
  1309. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  1310. const modifierGuards = {
  1311. stop: (e) => e.stopPropagation(),
  1312. prevent: (e) => e.preventDefault(),
  1313. self: (e) => e.target !== e.currentTarget,
  1314. ctrl: (e) => !e.ctrlKey,
  1315. shift: (e) => !e.shiftKey,
  1316. alt: (e) => !e.altKey,
  1317. meta: (e) => !e.metaKey,
  1318. left: (e) => "button" in e && e.button !== 0,
  1319. middle: (e) => "button" in e && e.button !== 1,
  1320. right: (e) => "button" in e && e.button !== 2,
  1321. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  1322. };
  1323. const withModifiers = (fn, modifiers) => {
  1324. const cache = fn._withMods || (fn._withMods = {});
  1325. const cacheKey = modifiers.join(".");
  1326. return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
  1327. for (let i = 0; i < modifiers.length; i++) {
  1328. const guard = modifierGuards[modifiers[i]];
  1329. if (guard && guard(event, modifiers)) return;
  1330. }
  1331. return fn(event, ...args);
  1332. });
  1333. };
  1334. const keyNames = {
  1335. esc: "escape",
  1336. space: " ",
  1337. up: "arrow-up",
  1338. left: "arrow-left",
  1339. right: "arrow-right",
  1340. down: "arrow-down",
  1341. delete: "backspace"
  1342. };
  1343. const withKeys = (fn, modifiers) => {
  1344. const cache = fn._withKeys || (fn._withKeys = {});
  1345. const cacheKey = modifiers.join(".");
  1346. return cache[cacheKey] || (cache[cacheKey] = (event) => {
  1347. if (!("key" in event)) {
  1348. return;
  1349. }
  1350. const eventKey = shared.hyphenate(event.key);
  1351. if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
  1352. return fn(event);
  1353. }
  1354. });
  1355. };
  1356. const rendererOptions = /* @__PURE__ */ shared.extend({ patchProp }, nodeOps);
  1357. let renderer;
  1358. let enabledHydration = false;
  1359. function ensureRenderer() {
  1360. return renderer || (renderer = runtimeCore.createRenderer(rendererOptions));
  1361. }
  1362. function ensureHydrationRenderer() {
  1363. renderer = enabledHydration ? renderer : runtimeCore.createHydrationRenderer(rendererOptions);
  1364. enabledHydration = true;
  1365. return renderer;
  1366. }
  1367. const render = (...args) => {
  1368. ensureRenderer().render(...args);
  1369. };
  1370. const hydrate = (...args) => {
  1371. ensureHydrationRenderer().hydrate(...args);
  1372. };
  1373. const createApp = (...args) => {
  1374. const app = ensureRenderer().createApp(...args);
  1375. const { mount } = app;
  1376. app.mount = (containerOrSelector) => {
  1377. const container = normalizeContainer(containerOrSelector);
  1378. if (!container) return;
  1379. const component = app._component;
  1380. if (!shared.isFunction(component) && !component.render && !component.template) {
  1381. component.template = container.innerHTML;
  1382. }
  1383. container.innerHTML = "";
  1384. const proxy = mount(container, false, resolveRootNamespace(container));
  1385. if (container instanceof Element) {
  1386. container.removeAttribute("v-cloak");
  1387. container.setAttribute("data-v-app", "");
  1388. }
  1389. return proxy;
  1390. };
  1391. return app;
  1392. };
  1393. const createSSRApp = (...args) => {
  1394. const app = ensureHydrationRenderer().createApp(...args);
  1395. const { mount } = app;
  1396. app.mount = (containerOrSelector) => {
  1397. const container = normalizeContainer(containerOrSelector);
  1398. if (container) {
  1399. return mount(container, true, resolveRootNamespace(container));
  1400. }
  1401. };
  1402. return app;
  1403. };
  1404. function resolveRootNamespace(container) {
  1405. if (container instanceof SVGElement) {
  1406. return "svg";
  1407. }
  1408. if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
  1409. return "mathml";
  1410. }
  1411. }
  1412. function normalizeContainer(container) {
  1413. if (shared.isString(container)) {
  1414. const res = document.querySelector(container);
  1415. return res;
  1416. }
  1417. return container;
  1418. }
  1419. let ssrDirectiveInitialized = false;
  1420. const initDirectivesForSSR = () => {
  1421. if (!ssrDirectiveInitialized) {
  1422. ssrDirectiveInitialized = true;
  1423. initVModelForSSR();
  1424. initVShowForSSR();
  1425. }
  1426. } ;
  1427. exports.Transition = Transition;
  1428. exports.TransitionGroup = TransitionGroup;
  1429. exports.VueElement = VueElement;
  1430. exports.createApp = createApp;
  1431. exports.createSSRApp = createSSRApp;
  1432. exports.defineCustomElement = defineCustomElement;
  1433. exports.defineSSRCustomElement = defineSSRCustomElement;
  1434. exports.hydrate = hydrate;
  1435. exports.initDirectivesForSSR = initDirectivesForSSR;
  1436. exports.render = render;
  1437. exports.useCssModule = useCssModule;
  1438. exports.useCssVars = useCssVars;
  1439. exports.vModelCheckbox = vModelCheckbox;
  1440. exports.vModelDynamic = vModelDynamic;
  1441. exports.vModelRadio = vModelRadio;
  1442. exports.vModelSelect = vModelSelect;
  1443. exports.vModelText = vModelText;
  1444. exports.vShow = vShow;
  1445. exports.withKeys = withKeys;
  1446. exports.withModifiers = withModifiers;
  1447. Object.keys(runtimeCore).forEach(function (k) {
  1448. if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = runtimeCore[k];
  1449. });