diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index 8ccf0e7..0000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "recommendations": ["dbaeumer.vscode-eslint"] -} diff --git a/out/main/index.js b/out/main/index.js index e448b93..aabd21d 100644 --- a/out/main/index.js +++ b/out/main/index.js @@ -91,12 +91,14 @@ class Config { ); } } +const DEFAULT_WINDOW_SIZE = { width: 354, height: 549 }; +const DEFAULT_MOVE_WINDOW_SIZE = { width: 708, height: 549 }; const preloadPath = join(__dirname, "../preload/index.mjs"); const rendererPath = join(__dirname, "../renderer/index.html"); function createWindow() { const mainWindow = new BrowserWindow({ - width: 354, - height: 549, + width: DEFAULT_WINDOW_SIZE.width, + height: DEFAULT_WINDOW_SIZE.height, show: false, autoHideMenuBar: true, webPreferences: { @@ -119,8 +121,8 @@ function createWindow() { } function createNoteWindow(noteId) { const noteWindow = new BrowserWindow({ - width: 354, - height: 549, + width: DEFAULT_WINDOW_SIZE.width, + height: DEFAULT_WINDOW_SIZE.height, autoHideMenuBar: true, webPreferences: { preload: preloadPath, @@ -186,6 +188,26 @@ app.whenReady().then(async () => { ipcMain.on("note-changed", (_, event, data) => { broadcastNoteChange(event, data); }); + ipcMain.handle("move-opened", (_) => { + const activeWindow = BrowserWindow.getFocusedWindow(); + const windowSize = activeWindow.getSize(); + if (windowSize[0] < DEFAULT_MOVE_WINDOW_SIZE.width) { + activeWindow.setSize( + DEFAULT_MOVE_WINDOW_SIZE.width, + DEFAULT_MOVE_WINDOW_SIZE.height + ); + } + }); + ipcMain.handle("move-closed", (_) => { + const activeWindow = BrowserWindow.getFocusedWindow(); + const windowSize = activeWindow.getSize(); + if (windowSize[0] === 708) { + activeWindow.setSize( + DEFAULT_WINDOW_SIZE.width, + DEFAULT_WINDOW_SIZE.height + ); + } + }); electronApp.setAppUserModelId("com.electron"); app.on("browser-window-created", (_, window) => { optimizer.watchWindowShortcuts(window); diff --git a/out/preload/index.mjs b/out/preload/index.mjs index a384f06..fe8debb 100644 --- a/out/preload/index.mjs +++ b/out/preload/index.mjs @@ -21,6 +21,12 @@ const api = { }, notifyNoteChanged: (event, data) => { ipcRenderer.send("note-changed", event, data); + }, + moveOpened: () => { + ipcRenderer.invoke("move-opened"); + }, + moveClosed: () => { + ipcRenderer.invoke("move-closed"); } }; const adapter = { diff --git a/out/renderer/assets/index-CoqDP7Z2.js b/out/renderer/assets/index-CzxWU9vx.js similarity index 91% rename from out/renderer/assets/index-CoqDP7Z2.js rename to out/renderer/assets/index-CzxWU9vx.js index bd779a9..f438b79 100644 --- a/out/renderer/assets/index-CoqDP7Z2.js +++ b/out/renderer/assets/index-CzxWU9vx.js @@ -1,8 +1,8 @@ // @__NO_SIDE_EFFECTS__ function makeMap(str) { - const map2 = /* @__PURE__ */ Object.create(null); - for (const key of str.split(",")) map2[key] = 1; - return (val) => val in map2; + const map3 = /* @__PURE__ */ Object.create(null); + for (const key of str.split(",")) map3[key] = 1; + return (val) => val in map3; } const EMPTY_OBJ = {}; const EMPTY_ARR = []; @@ -25,12 +25,12 @@ const isArray$1 = Array.isArray; const isMap = (val) => toTypeString(val) === "[object Map]"; const isSet = (val) => toTypeString(val) === "[object Set]"; const isDate = (val) => toTypeString(val) === "[object Date]"; -const isFunction$2 = (val) => typeof val === "function"; -const isString = (val) => typeof val === "string"; +const isFunction$3 = (val) => typeof val === "function"; +const isString$2 = (val) => typeof val === "string"; const isSymbol = (val) => typeof val === "symbol"; -const isObject$1 = (val) => val !== null && typeof val === "object"; +const isObject$2 = (val) => val !== null && typeof val === "object"; const isPromise = (val) => { - return (isObject$1(val) || isFunction$2(val)) && isFunction$2(val.then) && isFunction$2(val.catch); + return (isObject$2(val) || isFunction$3(val)) && isFunction$3(val.then) && isFunction$3(val.catch); }; const objectToString = Object.prototype.toString; const toTypeString = (value) => objectToString.call(value); @@ -38,7 +38,7 @@ const toRawType = (value) => { return toTypeString(value).slice(8, -1); }; const isPlainObject$1 = (val) => toTypeString(val) === "[object Object]"; -const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; +const isIntegerKey = (key) => isString$2(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; const isReservedProp = /* @__PURE__ */ makeMap( // the leading comma is intentional so empty string "" is also included ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" @@ -88,7 +88,7 @@ const looseToNumber = (val) => { return isNaN(n2) ? val : n2; }; const toNumber = (val) => { - const n2 = isString(val) ? Number(val) : NaN; + const n2 = isString$2(val) ? Number(val) : NaN; return isNaN(n2) ? val : n2; }; let _globalThis; @@ -100,7 +100,7 @@ function normalizeStyle(value) { const res = {}; for (let i = 0; i < value.length; i++) { const item = value[i]; - const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); + const normalized = isString$2(item) ? parseStringStyle(item) : normalizeStyle(item); if (normalized) { for (const key in normalized) { res[key] = normalized[key]; @@ -108,7 +108,7 @@ function normalizeStyle(value) { } } return res; - } else if (isString(value) || isObject$1(value)) { + } else if (isString$2(value) || isObject$2(value)) { return value; } } @@ -127,7 +127,7 @@ function parseStringStyle(cssText) { } function normalizeClass(value) { let res = ""; - if (isString(value)) { + if (isString$2(value)) { res = value; } else if (isArray$1(value)) { for (let i = 0; i < value.length; i++) { @@ -136,7 +136,7 @@ function normalizeClass(value) { res += normalized + " "; } } - } else if (isObject$1(value)) { + } else if (isObject$2(value)) { for (const name in value) { if (value[name]) { res += name + " "; @@ -175,8 +175,8 @@ function looseEqual(a2, b2) { if (aValidType || bValidType) { return aValidType && bValidType ? looseCompareArrays(a2, b2) : false; } - aValidType = isObject$1(a2); - bValidType = isObject$1(b2); + aValidType = isObject$2(a2); + bValidType = isObject$2(b2); if (aValidType || bValidType) { if (!aValidType || !bValidType) { return false; @@ -196,11 +196,14 @@ function looseEqual(a2, b2) { } return String(a2) === String(b2); } +function looseIndexOf(arr, val) { + return arr.findIndex((item) => looseEqual(item, val)); +} const isRef$1 = (val) => { return !!(val && val["__v_isRef"] === true); }; const toDisplayString = (val) => { - return isString(val) ? val : val == null ? "" : isArray$1(val) || isObject$1(val) && (val.toString === objectToString || !isFunction$2(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val); + return isString$2(val) ? val : val == null ? "" : isArray$1(val) || isObject$2(val) && (val.toString === objectToString || !isFunction$3(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val); }; const replacer = (_key, val) => { if (isRef$1(val)) { @@ -221,7 +224,7 @@ const replacer = (_key, val) => { }; } else if (isSymbol(val)) { return stringifySymbol(val); - } else if (isObject$1(val) && !isArray$1(val) && !isPlainObject$1(val)) { + } else if (isObject$2(val) && !isArray$1(val) && !isPlainObject$1(val)) { return String(val); } return val; @@ -348,9 +351,6 @@ class EffectScope { } } } -function effectScope(detached) { - return new EffectScope(detached); -} function getCurrentScope() { return activeEffectScope; } @@ -419,8 +419,8 @@ class ReactiveEffect { } stop() { if (this.flags & 1) { - for (let link = this.deps; link; link = link.nextDep) { - removeSub(link); + for (let link2 = this.deps; link2; link2 = link2.nextDep) { + removeSub(link2); } this.deps = this.depsTail = void 0; cleanupEffect(this); @@ -479,7 +479,7 @@ function endBatch() { e = next; } } - let error; + let error2; while (batchedSub) { let e = batchedSub; batchedSub = void 0; @@ -492,44 +492,44 @@ function endBatch() { ; e.trigger(); } catch (err) { - if (!error) error = err; + if (!error2) error2 = err; } } e = next; } } - if (error) throw error; + if (error2) throw error2; } function prepareDeps(sub) { - for (let link = sub.deps; link; link = link.nextDep) { - link.version = -1; - link.prevActiveLink = link.dep.activeLink; - link.dep.activeLink = link; + for (let link2 = sub.deps; link2; link2 = link2.nextDep) { + link2.version = -1; + link2.prevActiveLink = link2.dep.activeLink; + link2.dep.activeLink = link2; } } function cleanupDeps(sub) { let head; let tail = sub.depsTail; - let link = tail; - while (link) { - const prev = link.prevDep; - if (link.version === -1) { - if (link === tail) tail = prev; - removeSub(link); - removeDep(link); + let link2 = tail; + while (link2) { + const prev = link2.prevDep; + if (link2.version === -1) { + if (link2 === tail) tail = prev; + removeSub(link2); + removeDep(link2); } else { - head = link; + head = link2; } - link.dep.activeLink = link.prevActiveLink; - link.prevActiveLink = void 0; - link = prev; + link2.dep.activeLink = link2.prevActiveLink; + link2.prevActiveLink = void 0; + link2 = prev; } sub.deps = head; sub.depsTail = tail; } function isDirty(sub) { - for (let link = sub.deps; link; link = link.nextDep) { - if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) { + for (let link2 = sub.deps; link2; link2 = link2.nextDep) { + if (link2.dep.version !== link2.version || link2.dep.computed && (refreshComputed(link2.dep.computed) || link2.dep.version !== link2.version)) { return true; } } @@ -574,17 +574,17 @@ function refreshComputed(computed2) { computed2.flags &= -3; } } -function removeSub(link, soft = false) { - const { dep, prevSub, nextSub } = link; +function removeSub(link2, soft = false) { + const { dep, prevSub, nextSub } = link2; if (prevSub) { prevSub.nextSub = nextSub; - link.prevSub = void 0; + link2.prevSub = void 0; } if (nextSub) { nextSub.prevSub = prevSub; - link.nextSub = void 0; + link2.nextSub = void 0; } - if (dep.subs === link) { + if (dep.subs === link2) { dep.subs = prevSub; if (!prevSub && dep.computed) { dep.computed.flags &= -5; @@ -597,15 +597,15 @@ function removeSub(link, soft = false) { dep.map.delete(dep.key); } } -function removeDep(link) { - const { prevDep, nextDep } = link; +function removeDep(link2) { + const { prevDep, nextDep } = link2; if (prevDep) { prevDep.nextDep = nextDep; - link.prevDep = void 0; + link2.prevDep = void 0; } if (nextDep) { nextDep.prevDep = prevDep; - link.nextDep = void 0; + link2.nextDep = void 0; } } let shouldTrack = true; @@ -656,35 +656,35 @@ class Dep { if (!activeSub || !shouldTrack || activeSub === this.computed) { return; } - let link = this.activeLink; - if (link === void 0 || link.sub !== activeSub) { - link = this.activeLink = new Link$1(activeSub, this); + let link2 = this.activeLink; + if (link2 === void 0 || link2.sub !== activeSub) { + link2 = this.activeLink = new Link$1(activeSub, this); if (!activeSub.deps) { - activeSub.deps = activeSub.depsTail = link; + activeSub.deps = activeSub.depsTail = link2; } else { - link.prevDep = activeSub.depsTail; - activeSub.depsTail.nextDep = link; - activeSub.depsTail = link; + link2.prevDep = activeSub.depsTail; + activeSub.depsTail.nextDep = link2; + activeSub.depsTail = link2; } - addSub(link); - } else if (link.version === -1) { - link.version = this.version; - if (link.nextDep) { - const next = link.nextDep; - next.prevDep = link.prevDep; - if (link.prevDep) { - link.prevDep.nextDep = next; + addSub(link2); + } else if (link2.version === -1) { + link2.version = this.version; + if (link2.nextDep) { + const next = link2.nextDep; + next.prevDep = link2.prevDep; + if (link2.prevDep) { + link2.prevDep.nextDep = next; } - link.prevDep = activeSub.depsTail; - link.nextDep = void 0; - activeSub.depsTail.nextDep = link; - activeSub.depsTail = link; - if (activeSub.deps === link) { + link2.prevDep = activeSub.depsTail; + link2.nextDep = void 0; + activeSub.depsTail.nextDep = link2; + activeSub.depsTail = link2; + if (activeSub.deps === link2) { activeSub.deps = next; } } } - return link; + return link2; } trigger(debugInfo) { this.version++; @@ -695,10 +695,10 @@ class Dep { startBatch(); try { if (false) ; - for (let link = this.subs; link; link = link.prevSub) { - if (link.sub.notify()) { + for (let link2 = this.subs; link2; link2 = link2.prevSub) { + if (link2.sub.notify()) { ; - link.sub.dep.notify(); + link2.sub.dep.notify(); } } } finally { @@ -706,22 +706,22 @@ class Dep { } } } -function addSub(link) { - link.dep.sc++; - if (link.sub.flags & 4) { - const computed2 = link.dep.computed; - if (computed2 && !link.dep.subs) { +function addSub(link2) { + link2.dep.sc++; + if (link2.sub.flags & 4) { + const computed2 = link2.dep.computed; + if (computed2 && !link2.dep.subs) { computed2.flags |= 4 | 16; for (let l2 = computed2.deps; l2; l2 = l2.nextDep) { addSub(l2); } } - const currentTail = link.dep.subs; - if (currentTail !== link) { - link.prevSub = currentTail; - if (currentTail) currentTail.nextSub = link; + const currentTail = link2.dep.subs; + if (currentTail !== link2) { + link2.prevSub = currentTail; + if (currentTail) currentTail.nextSub = link2; } - link.dep.subs = link; + link2.dep.subs = link2; } } const targetMap = /* @__PURE__ */ new WeakMap(); @@ -813,10 +813,6 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) { } endBatch(); } -function getDepFromReactive(object, key) { - const depMap = targetMap.get(object); - return depMap && depMap.get(key); -} function reactiveReadArray(array) { const raw = /* @__PURE__ */ toRaw(array); if (raw === array) return raw; @@ -1080,9 +1076,9 @@ class BaseReactiveHandler { } if (/* @__PURE__ */ isRef(res)) { const value = targetIsArray && isIntegerKey(key) ? res : res.value; - return isReadonly2 && isObject$1(value) ? /* @__PURE__ */ readonly(value) : value; + return isReadonly2 && isObject$2(value) ? /* @__PURE__ */ readonly(value) : value; } - if (isObject$1(res)) { + if (isObject$2(res)) { return isReadonly2 ? /* @__PURE__ */ readonly(res) : /* @__PURE__ */ reactive(res); } return res; @@ -1215,11 +1211,11 @@ function createInstrumentations(readonly2, shallow) { } track(rawTarget, "get", rawKey); } - const { has } = getProto(rawTarget); + const { has: has2 } = getProto(rawTarget); const wrap2 = shallow ? toShallow : readonly2 ? toReadonly : toReactive; - if (has.call(rawTarget, key)) { + if (has2.call(rawTarget, key)) { return wrap2(target.get(key)); - } else if (has.call(rawTarget, rawKey)) { + } else if (has2.call(rawTarget, rawKey)) { return wrap2(target.get(rawKey)); } else if (target !== rawTarget) { target.get(key); @@ -1279,11 +1275,11 @@ function createInstrumentations(readonly2, shallow) { value = /* @__PURE__ */ toRaw(value); } const target = /* @__PURE__ */ toRaw(this); - const { has, get: get2 } = getProto(target); - let hadKey = has.call(target, key); + const { has: has2, get: get2 } = getProto(target); + let hadKey = has2.call(target, key); if (!hadKey) { key = /* @__PURE__ */ toRaw(key); - hadKey = has.call(target, key); + hadKey = has2.call(target, key); } const oldValue = get2.call(target, key); target.set(key, value); @@ -1296,11 +1292,11 @@ function createInstrumentations(readonly2, shallow) { }, delete(key) { const target = /* @__PURE__ */ toRaw(this); - const { has, get: get2 } = getProto(target); - let hadKey = has.call(target, key); + const { has: has2, get: get2 } = getProto(target); + let hadKey = has2.call(target, key); if (!hadKey) { key = /* @__PURE__ */ toRaw(key); - hadKey = has.call(target, key); + hadKey = has2.call(target, key); } get2 ? get2.call(target, key) : void 0; const result = target.delete(key); @@ -1430,7 +1426,7 @@ function shallowReadonly(target) { ); } function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { - if (!isObject$1(target)) { + if (!isObject$2(target)) { return target; } if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { @@ -1481,8 +1477,8 @@ function markRaw(value) { } return value; } -const toReactive = (value) => isObject$1(value) ? /* @__PURE__ */ reactive(value) : value; -const toReadonly = (value) => isObject$1(value) ? /* @__PURE__ */ readonly(value) : value; +const toReactive = (value) => isObject$2(value) ? /* @__PURE__ */ reactive(value) : value; +const toReadonly = (value) => isObject$2(value) ? /* @__PURE__ */ readonly(value) : value; // @__NO_SIDE_EFFECTS__ function isRef(r2) { return r2 ? r2["__v_isRef"] === true : false; @@ -1533,7 +1529,7 @@ function unref(ref2) { return /* @__PURE__ */ isRef(ref2) ? ref2.value : ref2; } function toValue(source2) { - return isFunction$2(source2) ? source2() : unref(source2); + return isFunction$3(source2) ? source2() : unref(source2); } const shallowUnwrapHandlers = { get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)), @@ -1555,9 +1551,9 @@ class CustomRefImpl { this["__v_isRef"] = true; this._value = void 0; const dep = this.dep = new Dep(); - const { get: get2, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep)); + const { get: get2, set: set2 } = factory(dep.track.bind(dep), dep.trigger.bind(dep)); this._get = get2; - this._set = set; + this._set = set2; } get value() { return this._value = this._get(); @@ -1569,70 +1565,6 @@ class CustomRefImpl { function customRef(factory) { return new CustomRefImpl(factory); } -class ObjectRefImpl { - constructor(_object, _key, _defaultValue) { - this._object = _object; - this._key = _key; - this._defaultValue = _defaultValue; - this["__v_isRef"] = true; - this._value = void 0; - this._raw = /* @__PURE__ */ toRaw(_object); - let shallow = true; - let obj = _object; - if (!isArray$1(_object) || !isIntegerKey(String(_key))) { - do { - shallow = !/* @__PURE__ */ isProxy(obj) || /* @__PURE__ */ isShallow(obj); - } while (shallow && (obj = obj["__v_raw"])); - } - this._shallow = shallow; - } - get value() { - let val = this._object[this._key]; - if (this._shallow) { - val = unref(val); - } - return this._value = val === void 0 ? this._defaultValue : val; - } - set value(newVal) { - if (this._shallow && /* @__PURE__ */ isRef(this._raw[this._key])) { - const nestedRef = this._object[this._key]; - if (/* @__PURE__ */ isRef(nestedRef)) { - nestedRef.value = newVal; - return; - } - } - this._object[this._key] = newVal; - } - get dep() { - return getDepFromReactive(this._raw, this._key); - } -} -class GetterRefImpl { - constructor(_getter) { - this._getter = _getter; - this["__v_isRef"] = true; - this["__v_isReadonly"] = true; - this._value = void 0; - } - get value() { - return this._value = this._getter(); - } -} -// @__NO_SIDE_EFFECTS__ -function toRef$1(source2, key, defaultValue) { - if (/* @__PURE__ */ isRef(source2)) { - return source2; - } else if (isFunction$2(source2)) { - return new GetterRefImpl(source2); - } else if (isObject$1(source2) && arguments.length > 1) { - return propertyToRef(source2, key, defaultValue); - } else { - return /* @__PURE__ */ ref(source2); - } -} -function propertyToRef(source2, key, defaultValue) { - return new ObjectRefImpl(source2, key, defaultValue); -} class ComputedRefImpl { constructor(fn, setter, isSSR) { this.fn = fn; @@ -1661,10 +1593,10 @@ class ComputedRefImpl { } } get value() { - const link = this.dep.track(); + const link2 = this.dep.track(); refreshComputed(this); - if (link) { - link.version = this.dep.version; + if (link2) { + link2.version = this.dep.version; } return this._value; } @@ -1678,7 +1610,7 @@ class ComputedRefImpl { function computed$1(getterOrOptions, debugOptions, isSSR = false) { let getter; let setter; - if (isFunction$2(getterOrOptions)) { + if (isFunction$3(getterOrOptions)) { getter = getterOrOptions; } else { getter = getterOrOptions.get; @@ -1725,11 +1657,11 @@ function watch$1(source2, cb2, options = EMPTY_OBJ) { return s2.value; } else if (/* @__PURE__ */ isReactive(s2)) { return reactiveGetter(s2); - } else if (isFunction$2(s2)) { + } else if (isFunction$3(s2)) { return call ? call(s2, 2) : s2(); } else ; }); - } else if (isFunction$2(source2)) { + } else if (isFunction$3(source2)) { if (cb2) { getter = call ? () => call(source2, 2) : source2; } else { @@ -1840,7 +1772,7 @@ function watch$1(source2, cb2, options = EMPTY_OBJ) { return watchHandle; } function traverse(value, depth = Infinity, seen2) { - if (depth <= 0 || !isObject$1(value) || value["__v_skip"]) { + if (depth <= 0 || !isObject$2(value) || value["__v_skip"]) { return value; } seen2 = seen2 || /* @__PURE__ */ new Map(); @@ -1962,7 +1894,7 @@ function formatProps(props) { return res; } function formatProp(key, value, raw) { - if (isString(value)) { + if (isString$2(value)) { value = JSON.stringify(value); return raw ? value : [`${key}=${value}`]; } else if (typeof value === "number" || typeof value === "boolean" || value == null) { @@ -1970,7 +1902,7 @@ function formatProp(key, value, raw) { } else if (/* @__PURE__ */ isRef(value)) { value = formatProp(key, /* @__PURE__ */ toRaw(value.value), true); return raw ? value : [`${key}=Ref<`, value, `>`]; - } else if (isFunction$2(value)) { + } else if (isFunction$3(value)) { return [`${key}=fn${value.name ? `<${value.name}>` : ``}`]; } else { value = /* @__PURE__ */ toRaw(value); @@ -1985,7 +1917,7 @@ function callWithErrorHandling(fn, instance, type, args) { } } function callWithAsyncErrorHandling(fn, instance, type, args) { - if (isFunction$2(fn)) { + if (isFunction$3(fn)) { const res = callWithErrorHandling(fn, instance, type, args); if (res && isPromise(res)) { res.catch((err) => { @@ -2219,7 +2151,7 @@ function withDirectives(vnode, directives) { for (let i = 0; i < directives.length; i++) { let [dir, value, arg, modifiers2 = EMPTY_OBJ] = directives[i]; if (dir) { - if (isFunction$2(dir)) { + if (isFunction$3(dir)) { dir = { mounted: dir, updated: dir @@ -2278,7 +2210,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) { if (provides && key in provides) { return provides[key]; } else if (arguments.length > 1) { - return treatDefaultAsFactory && isFunction$2(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue; + return treatDefaultAsFactory && isFunction$3(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue; } else ; } } @@ -2357,9 +2289,9 @@ function doWatch(source2, cb2, options = EMPTY_OBJ) { } function instanceWatch(source2, value, options) { const publicThis = this.proxy; - const getter = isString(source2) ? source2.includes(".") ? createPathGetter(publicThis, source2) : () => publicThis[source2] : source2.bind(publicThis, publicThis); + const getter = isString$2(source2) ? source2.includes(".") ? createPathGetter(publicThis, source2) : () => publicThis[source2] : source2.bind(publicThis, publicThis); let cb2; - if (isFunction$2(value)) { + if (isFunction$3(value)) { cb2 = value; } else { cb2 = value.handler; @@ -2693,7 +2625,7 @@ function getInnerChild$1(vnode) { if (shapeFlag & 16) { return children[0]; } - if (shapeFlag & 32 && isFunction$2(children.default)) { + if (shapeFlag & 32 && isFunction$3(children.default)) { return children.default(); } } @@ -2733,7 +2665,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) { } // @__NO_SIDE_EFFECTS__ function defineComponent(options, extraOptions) { - return isFunction$2(options) ? ( + return isFunction$3(options) ? ( // #8236: extend call and options.name access are considered side-effects // by Rollup, so we have to wrap it in a pure-annotated IIFE. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))() @@ -2787,7 +2719,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) { }; if (oldRef != null && oldRef !== ref3) { invalidatePendingSetRef(oldRawRef); - if (isString(oldRef)) { + if (isString$2(oldRef)) { refs[oldRef] = null; if (canSetSetupRef(oldRef)) { setupState[oldRef] = null; @@ -2800,10 +2732,10 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) { if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null; } } - if (isFunction$2(ref3)) { + if (isFunction$3(ref3)) { callWithErrorHandling(ref3, owner, 12, [value, refs]); } else { - const _isString = isString(ref3); + const _isString = isString$2(ref3); const _isRef = /* @__PURE__ */ isRef(ref3); if (_isString || _isRef) { const doSet = () => { @@ -2955,7 +2887,7 @@ function resolveComponent(name, maybeSelfReference) { } const NULL_DYNAMIC_COMPONENT = /* @__PURE__ */ Symbol.for("v-ndc"); function resolveDynamicComponent(component) { - if (isString(component)) { + if (isString$2(component)) { return resolveAsset(COMPONENTS, component, false) || component; } else { return component || NULL_DYNAMIC_COMPONENT; @@ -2993,7 +2925,7 @@ function renderList(source2, renderItem, cache, index2) { let ret; const cached = cache; const sourceIsArray = isArray$1(source2); - if (sourceIsArray || isString(source2)) { + if (sourceIsArray || isString$2(source2)) { const sourceIsReactiveArray = sourceIsArray && /* @__PURE__ */ isReactive(source2); let needsWrap = false; let isReadonlySource = false; @@ -3016,7 +2948,7 @@ function renderList(source2, renderItem, cache, index2) { for (let i = 0; i < source2; i++) { ret[i] = renderItem(i + 1, i, void 0, cached); } - } else if (isObject$1(source2)) { + } else if (isObject$2(source2)) { if (source2[Symbol.iterator]) { ret = Array.from( source2, @@ -3164,6 +3096,18 @@ function normalizePropsOrEmits(props) { {} ) : props; } +function withAsyncContext(getAwaitable) { + const ctx = getCurrentInstance(); + let awaitable = getAwaitable(); + unsetCurrentInstance(); + if (isPromise(awaitable)) { + awaitable = awaitable.catch((e) => { + setCurrentInstance(ctx); + throw e; + }); + } + return [awaitable, () => setCurrentInstance(ctx)]; +} let shouldCacheAccess = true; function applyOptions(instance) { const options = resolveMergedOptions(instance); @@ -3213,7 +3157,7 @@ function applyOptions(instance) { if (methods) { for (const key in methods) { const methodHandler = methods[key]; - if (isFunction$2(methodHandler)) { + if (isFunction$3(methodHandler)) { { ctx[key] = methodHandler.bind(publicThis); } @@ -3222,7 +3166,7 @@ function applyOptions(instance) { } if (dataOptions) { const data = dataOptions.call(publicThis, publicThis); - if (!isObject$1(data)) ; + if (!isObject$2(data)) ; else { instance.data = /* @__PURE__ */ reactive(data); } @@ -3231,11 +3175,11 @@ function applyOptions(instance) { if (computedOptions) { for (const key in computedOptions) { const opt = computedOptions[key]; - const get2 = isFunction$2(opt) ? opt.bind(publicThis, publicThis) : isFunction$2(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP; - const set = !isFunction$2(opt) && isFunction$2(opt.set) ? opt.set.bind(publicThis) : NOOP; + const get2 = isFunction$3(opt) ? opt.bind(publicThis, publicThis) : isFunction$3(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP; + const set2 = !isFunction$3(opt) && isFunction$3(opt.set) ? opt.set.bind(publicThis) : NOOP; const c2 = computed({ get: get2, - set + set: set2 }); Object.defineProperty(ctx, key, { enumerable: true, @@ -3251,7 +3195,7 @@ function applyOptions(instance) { } } if (provideOptions) { - const provides = isFunction$2(provideOptions) ? provideOptions.call(publicThis) : provideOptions; + const provides = isFunction$3(provideOptions) ? provideOptions.call(publicThis) : provideOptions; Reflect.ownKeys(provides).forEach((key) => { provide(key, provides[key]); }); @@ -3311,7 +3255,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) for (const key in injectOptions) { const opt = injectOptions[key]; let injected; - if (isObject$1(opt)) { + if (isObject$2(opt)) { if ("default" in opt) { injected = inject( opt.from || key, @@ -3345,23 +3289,23 @@ function callHook$1(hook, instance, type) { } function createWatcher(raw, ctx, publicThis, key) { let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key]; - if (isString(raw)) { + if (isString$2(raw)) { const handler = ctx[raw]; - if (isFunction$2(handler)) { + if (isFunction$3(handler)) { { watch(getter, handler); } } - } else if (isFunction$2(raw)) { + } else if (isFunction$3(raw)) { { watch(getter, raw.bind(publicThis)); } - } else if (isObject$1(raw)) { + } else if (isObject$2(raw)) { if (isArray$1(raw)) { raw.forEach((r2) => createWatcher(r2, ctx, publicThis, key)); } else { - const handler = isFunction$2(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler]; - if (isFunction$2(handler)) { + const handler = isFunction$3(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler]; + if (isFunction$3(handler)) { watch(getter, handler, raw); } } @@ -3392,7 +3336,7 @@ function resolveMergedOptions(instance) { } mergeOptions$1(resolved, base2, optionMergeStrategies); } - if (isObject$1(base2)) { + if (isObject$2(base2)) { cache.set(base2, resolved); } return resolved; @@ -3456,8 +3400,8 @@ function mergeDataFn(to, from2) { } return function mergedDataFn() { return extend( - isFunction$2(to) ? to.call(this, this) : to, - isFunction$2(from2) ? from2.call(this, this) : from2 + isFunction$3(to) ? to.call(this, this) : to, + isFunction$3(from2) ? from2.call(this, this) : from2 ); }; } @@ -3527,10 +3471,10 @@ function createAppContext() { let uid$1 = 0; function createAppAPI(render, hydrate) { return function createApp2(rootComponent, rootProps = null) { - if (!isFunction$2(rootComponent)) { + if (!isFunction$3(rootComponent)) { rootComponent = extend({}, rootComponent); } - if (rootProps != null && !isObject$1(rootProps)) { + if (rootProps != null && !isObject$2(rootProps)) { rootProps = null; } const context = createAppContext(); @@ -3552,10 +3496,10 @@ function createAppAPI(render, hydrate) { }, use(plugin, ...options) { if (installedPlugins.has(plugin)) ; - else if (plugin && isFunction$2(plugin.install)) { + else if (plugin && isFunction$3(plugin.install)) { installedPlugins.add(plugin); plugin.install(app2, ...options); - } else if (isFunction$2(plugin)) { + } else if (isFunction$3(plugin)) { installedPlugins.add(plugin); plugin(app2, ...options); } else ; @@ -3644,7 +3588,7 @@ function emit(instance, event, ...rawArgs) { const modifiers2 = isModelListener2 && getModelModifiers(props, event.slice(7)); if (modifiers2) { if (modifiers2.trim) { - args = rawArgs.map((a2) => isString(a2) ? a2.trim() : a2); + args = rawArgs.map((a2) => isString$2(a2) ? a2.trim() : a2); } if (modifiers2.number) { args = rawArgs.map(looseToNumber); @@ -3690,7 +3634,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) { const raw = comp.emits; let normalized = {}; let hasExtends = false; - if (!isFunction$2(comp)) { + if (!isFunction$3(comp)) { const extendEmits = (raw2) => { const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true); if (normalizedFromExtend) { @@ -3709,7 +3653,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) { } } if (!raw && !hasExtends) { - if (isObject$1(comp)) { + if (isObject$2(comp)) { cache.set(comp, null); } return null; @@ -3719,7 +3663,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) { } else { extend(normalized, raw); } - if (isObject$1(comp)) { + if (isObject$2(comp)) { cache.set(comp, normalized); } return normalized; @@ -3834,6 +3778,24 @@ function renderComponentRoot(instance) { setCurrentRenderingInstance(prev); return result; } +function filterSingleRoot(children, recurse = true) { + let singleRoot; + for (let i = 0; i < children.length; i++) { + const child = children[i]; + if (isVNode(child)) { + if (child.type !== Comment || child.children === "v-if") { + if (singleRoot) { + return; + } else { + singleRoot = child; + } + } + } else { + return; + } + } + return singleRoot; +} const getFunctionalFallthrough = (attrs) => { let res; for (const key in attrs) { @@ -3912,7 +3874,7 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) { function hasPropValueChanged(nextProps, prevProps, key) { const nextProp = nextProps[key]; const prevProp = prevProps[key]; - if (key === "style" && isObject$1(nextProp) && isObject$1(prevProp)) { + if (key === "style" && isObject$2(nextProp) && isObject$2(prevProp)) { return !looseEqual(nextProp, prevProp); } return nextProp !== prevProp; @@ -4092,7 +4054,7 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) { const hasDefault = hasOwn(opt, "default"); if (hasDefault && value === void 0) { const defaultValue = opt.default; - if (opt.type !== Function && !opt.skipFactory && isFunction$2(defaultValue)) { + if (opt.type !== Function && !opt.skipFactory && isFunction$3(defaultValue)) { const { propsDefaults } = instance; if (key in propsDefaults) { value = propsDefaults[key]; @@ -4138,7 +4100,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) { const normalized = {}; const needCastKeys = []; let hasExtends = false; - if (!isFunction$2(comp)) { + if (!isFunction$3(comp)) { const extendProps = (raw2) => { hasExtends = true; const [props, keys2] = normalizePropsOptions(raw2, appContext, true); @@ -4156,7 +4118,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) { } } if (!raw && !hasExtends) { - if (isObject$1(comp)) { + if (isObject$2(comp)) { cache.set(comp, EMPTY_ARR); } return EMPTY_ARR; @@ -4173,14 +4135,14 @@ function normalizePropsOptions(comp, appContext, asMixin = false) { const normalizedKey = camelize(key); if (validatePropName(normalizedKey)) { const opt = raw[key]; - const prop = normalized[normalizedKey] = isArray$1(opt) || isFunction$2(opt) ? { type: opt } : extend({}, opt); + const prop = normalized[normalizedKey] = isArray$1(opt) || isFunction$3(opt) ? { type: opt } : extend({}, opt); const propType = prop.type; let shouldCast = false; let shouldCastTrue = true; if (isArray$1(propType)) { for (let index2 = 0; index2 < propType.length; ++index2) { const type = propType[index2]; - const typeName = isFunction$2(type) && type.name; + const typeName = isFunction$3(type) && type.name; if (typeName === "Boolean") { shouldCast = true; break; @@ -4189,7 +4151,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) { } } } else { - shouldCast = isFunction$2(propType) && propType.name === "Boolean"; + shouldCast = isFunction$3(propType) && propType.name === "Boolean"; } prop[ 0 @@ -4206,7 +4168,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) { } } const res = [normalized, needCastKeys]; - if (isObject$1(comp)) { + if (isObject$2(comp)) { cache.set(comp, res); } return res; @@ -4235,7 +4197,7 @@ const normalizeObjectSlots = (rawSlots, slots, instance) => { for (const key in rawSlots) { if (isInternalKey(key)) continue; const value = rawSlots[key]; - if (isFunction$2(value)) { + if (isFunction$3(value)) { slots[key] = normalizeSlot$1(key, value, ctx); } else if (value != null) { const normalized = normalizeSlotValue(value); @@ -5665,6 +5627,545 @@ function resolveAsyncComponentPlaceholder(anchorVnode) { return null; } const isSuspense = (type) => type.__isSuspense; +let suspenseId = 0; +const SuspenseImpl = { + name: "Suspense", + // In order to make Suspense tree-shakable, we need to avoid importing it + // directly in the renderer. The renderer checks for the __isSuspense flag + // on a vnode's type and calls the `process` method, passing in renderer + // internals. + __isSuspense: true, + process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { + if (n1 == null) { + mountSuspense( + n2, + container, + anchor, + parentComponent, + parentSuspense, + namespace, + slotScopeIds, + optimized, + rendererInternals + ); + } else { + if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) { + n2.suspense = n1.suspense; + n2.suspense.vnode = n2; + n2.el = n1.el; + return; + } + patchSuspense( + n1, + n2, + container, + anchor, + parentComponent, + namespace, + slotScopeIds, + optimized, + rendererInternals + ); + } + }, + hydrate: hydrateSuspense, + normalize: normalizeSuspenseChildren +}; +const Suspense = SuspenseImpl; +function triggerEvent(vnode, name) { + const eventListener = vnode.props && vnode.props[name]; + if (isFunction$3(eventListener)) { + eventListener(); + } +} +function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { + const { + p: patch, + o: { createElement } + } = rendererInternals; + const hiddenContainer = createElement("div"); + const suspense = vnode.suspense = createSuspenseBoundary( + vnode, + parentSuspense, + parentComponent, + container, + hiddenContainer, + anchor, + namespace, + slotScopeIds, + optimized, + rendererInternals + ); + patch( + null, + suspense.pendingBranch = vnode.ssContent, + hiddenContainer, + null, + parentComponent, + suspense, + namespace, + slotScopeIds + ); + if (suspense.deps > 0) { + triggerEvent(vnode, "onPending"); + triggerEvent(vnode, "onFallback"); + patch( + null, + vnode.ssFallback, + container, + anchor, + parentComponent, + null, + // fallback tree will not have suspense context + namespace, + slotScopeIds + ); + setActiveBranch(suspense, vnode.ssFallback); + } else { + suspense.resolve(false, true); + } +} +function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) { + const suspense = n2.suspense = n1.suspense; + suspense.vnode = n2; + n2.el = n1.el; + const newBranch = n2.ssContent; + const newFallback = n2.ssFallback; + const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense; + if (pendingBranch) { + suspense.pendingBranch = newBranch; + if (isSameVNodeType(pendingBranch, newBranch)) { + patch( + pendingBranch, + newBranch, + suspense.hiddenContainer, + null, + parentComponent, + suspense, + namespace, + slotScopeIds, + optimized + ); + if (suspense.deps <= 0) { + suspense.resolve(); + } else if (isInFallback) { + if (!isHydrating) { + patch( + activeBranch, + newFallback, + container, + anchor, + parentComponent, + null, + // fallback tree will not have suspense context + namespace, + slotScopeIds, + optimized + ); + setActiveBranch(suspense, newFallback); + } + } + } else { + suspense.pendingId = suspenseId++; + if (isHydrating) { + suspense.isHydrating = false; + suspense.activeBranch = pendingBranch; + } else { + unmount(pendingBranch, parentComponent, suspense); + } + suspense.deps = 0; + suspense.effects.length = 0; + suspense.hiddenContainer = createElement("div"); + if (isInFallback) { + patch( + null, + newBranch, + suspense.hiddenContainer, + null, + parentComponent, + suspense, + namespace, + slotScopeIds, + optimized + ); + if (suspense.deps <= 0) { + suspense.resolve(); + } else { + patch( + activeBranch, + newFallback, + container, + anchor, + parentComponent, + null, + // fallback tree will not have suspense context + namespace, + slotScopeIds, + optimized + ); + setActiveBranch(suspense, newFallback); + } + } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) { + patch( + activeBranch, + newBranch, + container, + anchor, + parentComponent, + suspense, + namespace, + slotScopeIds, + optimized + ); + suspense.resolve(true); + } else { + patch( + null, + newBranch, + suspense.hiddenContainer, + null, + parentComponent, + suspense, + namespace, + slotScopeIds, + optimized + ); + if (suspense.deps <= 0) { + suspense.resolve(); + } + } + } + } else { + if (activeBranch && isSameVNodeType(activeBranch, newBranch)) { + patch( + activeBranch, + newBranch, + container, + anchor, + parentComponent, + suspense, + namespace, + slotScopeIds, + optimized + ); + setActiveBranch(suspense, newBranch); + } else { + triggerEvent(n2, "onPending"); + suspense.pendingBranch = newBranch; + if (newBranch.shapeFlag & 512) { + suspense.pendingId = newBranch.component.suspenseId; + } else { + suspense.pendingId = suspenseId++; + } + patch( + null, + newBranch, + suspense.hiddenContainer, + null, + parentComponent, + suspense, + namespace, + slotScopeIds, + optimized + ); + if (suspense.deps <= 0) { + suspense.resolve(); + } else { + const { timeout, pendingId } = suspense; + if (timeout > 0) { + setTimeout(() => { + if (suspense.pendingId === pendingId) { + suspense.fallback(newFallback); + } + }, timeout); + } else if (timeout === 0) { + suspense.fallback(newFallback); + } + } + } + } +} +function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) { + const { + p: patch, + m: move, + um: unmount, + n: next, + o: { parentNode: parentNode2, remove: remove2 } + } = rendererInternals; + let parentSuspenseId; + const isSuspensible = isVNodeSuspensible(vnode); + if (isSuspensible) { + if (parentSuspense && parentSuspense.pendingBranch) { + parentSuspenseId = parentSuspense.pendingId; + parentSuspense.deps++; + } + } + const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0; + const initialAnchor = anchor; + const suspense = { + vnode, + parent: parentSuspense, + parentComponent, + namespace, + container, + hiddenContainer, + deps: 0, + pendingId: suspenseId++, + timeout: typeof timeout === "number" ? timeout : -1, + activeBranch: null, + pendingBranch: null, + isInFallback: !isHydrating, + isHydrating, + isUnmounted: false, + effects: [], + resolve(resume = false, sync = false) { + const { + vnode: vnode2, + activeBranch, + pendingBranch, + pendingId, + effects, + parentComponent: parentComponent2, + container: container2, + isInFallback + } = suspense; + let delayEnter = false; + if (suspense.isHydrating) { + suspense.isHydrating = false; + } else if (!resume) { + delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in"; + if (delayEnter) { + activeBranch.transition.afterLeave = () => { + if (pendingId === suspense.pendingId) { + move( + pendingBranch, + container2, + anchor === initialAnchor ? next(activeBranch) : anchor, + 0 + ); + queuePostFlushCb(effects); + if (isInFallback && vnode2.ssFallback) { + vnode2.ssFallback.el = null; + } + } + }; + } + if (activeBranch) { + if (parentNode2(activeBranch.el) === container2) { + anchor = next(activeBranch); + } + unmount(activeBranch, parentComponent2, suspense, true); + if (!delayEnter && isInFallback && vnode2.ssFallback) { + queuePostRenderEffect(() => vnode2.ssFallback.el = null, suspense); + } + } + if (!delayEnter) { + move(pendingBranch, container2, anchor, 0); + } + } + setActiveBranch(suspense, pendingBranch); + suspense.pendingBranch = null; + suspense.isInFallback = false; + let parent = suspense.parent; + let hasUnresolvedAncestor = false; + while (parent) { + if (parent.pendingBranch) { + parent.effects.push(...effects); + hasUnresolvedAncestor = true; + break; + } + parent = parent.parent; + } + if (!hasUnresolvedAncestor && !delayEnter) { + queuePostFlushCb(effects); + } + suspense.effects = []; + if (isSuspensible) { + if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) { + parentSuspense.deps--; + if (parentSuspense.deps === 0 && !sync) { + parentSuspense.resolve(); + } + } + } + triggerEvent(vnode2, "onResolve"); + }, + fallback(fallbackVNode) { + if (!suspense.pendingBranch) { + return; + } + const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense; + triggerEvent(vnode2, "onFallback"); + const anchor2 = next(activeBranch); + const mountFallback = () => { + if (!suspense.isInFallback) { + return; + } + patch( + null, + fallbackVNode, + container2, + anchor2, + parentComponent2, + null, + // fallback tree will not have suspense context + namespace2, + slotScopeIds, + optimized + ); + setActiveBranch(suspense, fallbackVNode); + }; + const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in"; + if (delayEnter) { + activeBranch.transition.afterLeave = mountFallback; + } + suspense.isInFallback = true; + unmount( + activeBranch, + parentComponent2, + null, + // no suspense so unmount hooks fire now + true + // shouldRemove + ); + if (!delayEnter) { + mountFallback(); + } + }, + move(container2, anchor2, type) { + suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type); + suspense.container = container2; + }, + next() { + return suspense.activeBranch && next(suspense.activeBranch); + }, + registerDep(instance, setupRenderEffect, optimized2) { + const isInPendingSuspense = !!suspense.pendingBranch; + if (isInPendingSuspense) { + suspense.deps++; + } + const hydratedEl = instance.vnode.el; + instance.asyncDep.catch((err) => { + handleError(err, instance, 0); + }).then((asyncSetupResult) => { + if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) { + return; + } + instance.asyncResolved = true; + const { vnode: vnode2 } = instance; + handleSetupResult(instance, asyncSetupResult); + if (hydratedEl) { + vnode2.el = hydratedEl; + } + const placeholder = !hydratedEl && instance.subTree.el; + setupRenderEffect( + instance, + vnode2, + // component may have been moved before resolve. + // if this is not a hydration, instance.subTree will be the comment + // placeholder. + parentNode2(hydratedEl || instance.subTree.el), + // anchor will not be used if this is hydration, so only need to + // consider the comment placeholder case. + hydratedEl ? null : next(instance.subTree), + suspense, + namespace, + optimized2 + ); + if (placeholder) { + vnode2.placeholder = null; + remove2(placeholder); + } + updateHOCHostEl(instance, vnode2.el); + if (isInPendingSuspense && --suspense.deps === 0) { + suspense.resolve(); + } + }); + }, + unmount(parentSuspense2, doRemove) { + suspense.isUnmounted = true; + if (suspense.activeBranch) { + unmount( + suspense.activeBranch, + parentComponent, + parentSuspense2, + doRemove + ); + } + if (suspense.pendingBranch) { + unmount( + suspense.pendingBranch, + parentComponent, + parentSuspense2, + doRemove + ); + } + } + }; + return suspense; +} +function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) { + const suspense = vnode.suspense = createSuspenseBoundary( + vnode, + parentSuspense, + parentComponent, + node.parentNode, + // eslint-disable-next-line no-restricted-globals + document.createElement("div"), + null, + namespace, + slotScopeIds, + optimized, + rendererInternals, + true + ); + const result = hydrateNode( + node, + suspense.pendingBranch = vnode.ssContent, + parentComponent, + suspense, + slotScopeIds, + optimized + ); + if (suspense.deps === 0) { + suspense.resolve(false, true); + } + return result; +} +function normalizeSuspenseChildren(vnode) { + const { shapeFlag, children } = vnode; + const isSlotChildren = shapeFlag & 32; + vnode.ssContent = normalizeSuspenseSlot( + isSlotChildren ? children.default : children + ); + vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment); +} +function normalizeSuspenseSlot(s2) { + let block2; + if (isFunction$3(s2)) { + const trackBlock = isBlockTreeEnabled && s2._c; + if (trackBlock) { + s2._d = false; + openBlock(); + } + s2 = s2(); + if (trackBlock) { + s2._d = true; + block2 = currentBlock; + closeBlock(); + } + } + if (isArray$1(s2)) { + const singleChild = filterSingleRoot(s2); + s2 = singleChild; + } + s2 = normalizeVNode(s2); + if (block2 && !s2.dynamicChildren) { + s2.dynamicChildren = block2.filter((c2) => c2 !== s2); + } + return s2; +} function queueEffectWithSuspense(fn, suspense) { if (suspense && suspense.pendingBranch) { if (isArray$1(fn)) { @@ -5676,6 +6177,24 @@ function queueEffectWithSuspense(fn, suspense) { queuePostFlushCb(fn); } } +function setActiveBranch(suspense, branch) { + suspense.activeBranch = branch; + const { vnode, parentComponent } = suspense; + let el = branch.el; + while (!el && branch.component) { + branch = branch.component.subTree; + el = branch.el; + } + vnode.el = el; + if (parentComponent && parentComponent.subTree === vnode) { + parentComponent.vnode.el = el; + updateHOCHostEl(parentComponent, el); + } +} +function isVNodeSuspensible(vnode) { + const suspensible = vnode.props && vnode.props.suspensible; + return suspensible != null && suspensible !== false; +} const Fragment$1 = /* @__PURE__ */ Symbol.for("v-fgt"); const Text$2 = /* @__PURE__ */ Symbol.for("v-txt"); const Comment = /* @__PURE__ */ Symbol.for("v-cmt"); @@ -5744,7 +6263,7 @@ const normalizeRef = ({ if (typeof ref3 === "number") { ref3 = "" + ref3; } - return ref3 != null ? isString(ref3) || /* @__PURE__ */ isRef(ref3) || isFunction$2(ref3) ? { i: currentRenderingInstance, r: ref3, k: ref_key, f: !!ref_for } : ref3 : null; + return ref3 != null ? isString$2(ref3) || /* @__PURE__ */ isRef(ref3) || isFunction$3(ref3) ? { i: currentRenderingInstance, r: ref3, k: ref_key, f: !!ref_for } : ref3 : null; }; function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment$1 ? 0 : 1, isBlockNode2 = false, needFullChildrenNormalization = false) { const vnode = { @@ -5782,7 +6301,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn type.normalize(vnode); } } else if (children) { - vnode.shapeFlag |= isString(children) ? 8 : 16; + vnode.shapeFlag |= isString$2(children) ? 8 : 16; } if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself !isBlockNode2 && // has current parent block @@ -5828,17 +6347,17 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami if (props) { props = guardReactiveProps(props); let { class: klass, style: style2 } = props; - if (klass && !isString(klass)) { + if (klass && !isString$2(klass)) { props.class = normalizeClass(klass); } - if (isObject$1(style2)) { + if (isObject$2(style2)) { if (/* @__PURE__ */ isProxy(style2) && !isArray$1(style2)) { style2 = extend({}, style2); } props.style = normalizeStyle(style2); } } - const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject$1(type) ? 4 : isFunction$2(type) ? 2 : 0; + const shapeFlag = isString$2(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject$2(type) ? 4 : isFunction$3(type) ? 2 : 0; return createBaseVNode( type, props, @@ -5909,11 +6428,11 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false } return cloned; } -function createTextVNode(text = " ", flag = 0) { - return createVNode(Text$2, null, text, flag); +function createTextVNode(text2 = " ", flag = 0) { + return createVNode(Text$2, null, text2, flag); } -function createCommentVNode(text = "", asBlock = false) { - return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text); +function createCommentVNode(text2 = "", asBlock = false) { + return asBlock ? (openBlock(), createBlock(Comment, null, text2)) : createVNode(Comment, null, text2); } function normalizeVNode(child) { if (child == null || typeof child === "boolean") { @@ -5964,7 +6483,7 @@ function normalizeChildren(vnode, children) { } } } - } else if (isFunction$2(children)) { + } else if (isFunction$3(children)) { children = { default: children, _ctx: currentRenderingInstance }; type = 32; } else { @@ -6111,7 +6630,7 @@ let setInSSRSetupState; if (!(setters = g2[key])) setters = g2[key] = []; setters.push(setter); return (v2) => { - if (setters.length > 1) setters.forEach((set) => set(v2)); + if (setters.length > 1) setters.forEach((set2) => set2(v2)); else setters[0](v2); }; }; @@ -6194,13 +6713,13 @@ function setupStatefulComponent(instance, isSSR) { } } function handleSetupResult(instance, setupResult, isSSR) { - if (isFunction$2(setupResult)) { + if (isFunction$3(setupResult)) { if (instance.type.__ssrInlineRender) { instance.ssrRender = setupResult; } else { instance.render = setupResult; } - } else if (isObject$1(setupResult)) { + } else if (isObject$2(setupResult)) { instance.setupState = proxyRefs(setupResult); } else ; finishComponentSetup(instance); @@ -6261,14 +6780,14 @@ function getComponentPublicInstance(instance) { const classifyRE = /(?:^|[-_])\w/g; const classify = (str) => str.replace(classifyRE, (c2) => c2.toUpperCase()).replace(/[-_]/g, ""); function getComponentName(Component, includeInferred = true) { - return isFunction$2(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name; + return isFunction$3(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name; } function formatComponentName(instance, Component, isRoot = false) { let name = getComponentName(Component); if (!name && Component.__file) { - const match = Component.__file.match(/([^/\\]+)\.\w+$/); - if (match) { - name = match[1]; + const match2 = Component.__file.match(/([^/\\]+)\.\w+$/); + if (match2) { + name = match2[1]; } } if (!name && instance) { @@ -6286,7 +6805,7 @@ function formatComponentName(instance, Component, isRoot = false) { return name ? classify(name) : isRoot ? `App` : `Anonymous`; } function isClassComponent(value) { - return isFunction$2(value) && "__vccOpts" in value; + return isFunction$3(value) && "__vccOpts" in value; } const computed = (getterOrOptions, debugOptions) => { const c2 = /* @__PURE__ */ computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup); @@ -6297,7 +6816,7 @@ function h$2(type, propsOrChildren, children) { setBlockTracking(-1); const l2 = arguments.length; if (l2 === 2) { - if (isObject$1(propsOrChildren) && !isArray$1(propsOrChildren)) { + if (isObject$2(propsOrChildren) && !isArray$1(propsOrChildren)) { if (isVNode(propsOrChildren)) { return createVNode(type, null, [propsOrChildren]); } @@ -6350,13 +6869,13 @@ const nodeOps = { } return el; }, - createText: (text) => doc$2.createTextNode(text), - createComment: (text) => doc$2.createComment(text), - setText: (node, text) => { - node.nodeValue = text; + createText: (text2) => doc$2.createTextNode(text2), + createComment: (text2) => doc$2.createComment(text2), + setText: (node, text2) => { + node.nodeValue = text2; }, - setElementText: (el, text) => { - el.textContent = text; + setElementText: (el, text2) => { + el.textContent = text2; }, parentNode: (node) => node.parentNode, nextSibling: (node) => node.nextSibling, @@ -6368,7 +6887,7 @@ const nodeOps = { // Reason: innerHTML. // Static content here can only come from compiled templates. // As long as the user only uses trusted templates, this is safe. - insertStaticContent(content, parent, anchor, namespace, start, end) { + insertStaticContent(content2, parent, anchor, namespace, start, end) { const before = anchor ? anchor.previousSibling : parent.lastChild; if (start && (start === end || start.nextSibling)) { while (true) { @@ -6377,7 +6896,7 @@ const nodeOps = { } } else { templateContainer.innerHTML = unsafeToTrustedHTML( - namespace === "svg" ? `${content}` : namespace === "mathml" ? `${content}` : content + namespace === "svg" ? `${content2}` : namespace === "mathml" ? `${content2}` : content2 ); const template = templateContainer.content; if (namespace === "svg" || namespace === "mathml") { @@ -6558,7 +7077,7 @@ function resolveTransitionProps(rawProps) { function normalizeDuration(duration) { if (duration == null) { return null; - } else if (isObject$1(duration)) { + } else if (isObject$2(duration)) { return [NumberOf(duration.enter), NumberOf(duration.leave)]; } else { const n2 = NumberOf(duration); @@ -6693,11 +7212,11 @@ const CSS_VAR_TEXT = /* @__PURE__ */ Symbol(""); const displayRE = /(?:^|;)\s*display\s*:/; function patchStyle(el, prev, next) { const style2 = el.style; - const isCssString = isString(next); + const isCssString = isString$2(next); let hasControlledDisplay = false; if (next && !isCssString) { if (prev) { - if (!isString(prev)) { + if (!isString$2(prev)) { for (const key in prev) { if (next[key] == null) { setStyle(style2, key, ""); @@ -6938,7 +7457,7 @@ const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => } } else if ( // #11081 force set props for possible async custom element - el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue)) + el._isVueCE && (/[A-Z]/.test(key) || !isString$2(nextValue)) ) { patchDOMProp(el, camelize(key), nextValue, parentComponent, key); } else { @@ -6955,7 +7474,7 @@ function shouldSetAsProp(el, key, value, isSVG) { if (key === "innerHTML" || key === "textContent") { return true; } - if (key in el && isNativeOn(key) && isFunction$2(value)) { + if (key in el && isNativeOn(key) && isFunction$3(value)) { return true; } return false; @@ -6981,7 +7500,7 @@ function shouldSetAsProp(el, key, value, isSVG) { return false; } } - if (isNativeOn(key) && isString(value)) { + if (isNativeOn(key) && isString$2(value)) { return false; } return key in el; @@ -7048,6 +7567,184 @@ const vModelText = { el.value = newValue; } }; +const vModelCheckbox = { + // #4096 array checkboxes need to be deep traversed + deep: true, + created(el, _2, vnode) { + el[assignKey] = getModelAssigner(vnode); + addEventListener(el, "change", () => { + const modelValue = el._modelValue; + const elementValue = getValue(el); + const checked = el.checked; + const assign2 = el[assignKey]; + if (isArray$1(modelValue)) { + const index2 = looseIndexOf(modelValue, elementValue); + const found2 = index2 !== -1; + if (checked && !found2) { + assign2(modelValue.concat(elementValue)); + } else if (!checked && found2) { + const filtered = [...modelValue]; + filtered.splice(index2, 1); + assign2(filtered); + } + } else if (isSet(modelValue)) { + const cloned = new Set(modelValue); + if (checked) { + cloned.add(elementValue); + } else { + cloned.delete(elementValue); + } + assign2(cloned); + } else { + assign2(getCheckboxValue(el, checked)); + } + }); + }, + // set initial checked on mount to wait for true-value/false-value + mounted: setChecked, + beforeUpdate(el, binding, vnode) { + el[assignKey] = getModelAssigner(vnode); + setChecked(el, binding, vnode); + } +}; +function setChecked(el, { value, oldValue }, vnode) { + el._modelValue = value; + let checked; + if (isArray$1(value)) { + checked = looseIndexOf(value, vnode.props.value) > -1; + } else if (isSet(value)) { + checked = value.has(vnode.props.value); + } else { + if (value === oldValue) return; + checked = looseEqual(value, getCheckboxValue(el, true)); + } + if (el.checked !== checked) { + el.checked = checked; + } +} +const vModelRadio = { + created(el, { value }, vnode) { + el.checked = looseEqual(value, vnode.props.value); + el[assignKey] = getModelAssigner(vnode); + addEventListener(el, "change", () => { + el[assignKey](getValue(el)); + }); + }, + beforeUpdate(el, { value, oldValue }, vnode) { + el[assignKey] = getModelAssigner(vnode); + if (value !== oldValue) { + el.checked = looseEqual(value, vnode.props.value); + } + } +}; +const vModelSelect = { + // relies on its children + //